// Decompiled by DJ v2.6.6.51 Copyright 2000 Atanas Neshkov  Date: 6/15/2001 17:43:22
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   com/macromedia/generator/app/GenLogFile

package com.macromedia.generator.app;

import com.macromedia.generator.utils.GenUtils;
import java.io.File;

class GenLogFile
{

    public GenLogFile(File file)
    {
        FA = null;
        FB = null;
        FC = null;
        FD = 0;
        if(file == null)
            return;
        FA = GenUtils.getParentFile(file);
        if(FA == null)
            return;
        String s = file.getName();
        int i = s.lastIndexOf(".");
        if(i == -1)
            return;
        FB = s.substring(0, i);
        FC = s.substring(i, s.length());
        i = FB.lastIndexOf("_");
        if(i == -1)
            return;
        String s1 = FB.substring(i + 1, FB.length());
        FB = FB.substring(0, i);
        try
        {
            FD = Integer.valueOf(s1).intValue();
        }
        catch(NumberFormatException _ex) { }
    }

    public String getExtension()
    {
        return FC;
    }

    public File getFile()
    {
        if(!verify())
            return null;
        int i = getIndex();
        String s = "";
        if(i != 0)
            s = "_" + getIndex();
        String s1 = getParent() + getName() + s + getExtension();
        if(s1 == null)
        {
            return null;
        } else
        {
            File file = new File(s1);
            return file;
        }
    }

    public int getIndex()
    {
        return FD;
    }

    public String getName()
    {
        return FB;
    }

    public String getParent()
    {
        if(FA == null)
            return null;
        String s = FA.getPath();
        if(s == null)
            return null;
        if(!s.endsWith("/"))
            s = s + "/";
        return s;
    }

    public File getParentFile()
    {
        return FA;
    }

    public File increment()
    {
        setIndex(getIndex() + 1);
        return getFile();
    }

    public void setIndex(int i)
    {
        FD = i;
    }

    public boolean verify()
    {
        return FA != null && FB != null && FC != null;
    }

    private File FA;
    private String FB;
    private String FC;
    private int FD;
}