package jp.sourceforge.projects.ee2e.core.cf;
import jp.sourceforge.projects.ee2e.core.*;
import jp.sourceforge.projects.ee2e.core.relax.*;
import jp.sourceforge.projects.ee2e.core.typeset.EE2EFileJump;
import jp.sourceforge.projects.ee2e.core.typeset.EE2EDerivationResource;
import jp.sourceforge.projects.ee2e.core.typeset.EE2EDerivationResourceSystem;
import jp.sourceforge.projects.ee2e.core.typeset.EE2EPreview;
import jp.sourceforge.projects.ee2e.core.editors.EE2ECommentRegion;
import jp.sourceforge.projects.ee2e.core.editors.EE2ECompleteMarkAmp;
import jp.sourceforge.projects.ee2e.core.editors.EE2ECompleteMarkApos;
import jp.sourceforge.projects.ee2e.core.editors.EE2ECompleteMarkLeft;
import jp.sourceforge.projects.ee2e.core.editors.EE2ECompleteMarkNbsp;
import jp.sourceforge.projects.ee2e.core.editors.EE2ECompleteMarkQuot;
import jp.sourceforge.projects.ee2e.core.editors.EE2ECompleteMarkRight;
import jp.sourceforge.projects.ee2e.core.editors.EE2EDependCompletent;
import jp.sourceforge.projects.ee2e.core.editors.EE2EIndentBehavior;
import jp.sourceforge.projects.ee2e.core.editors.EE2EInsertIterator;
import jp.sourceforge.projects.ee2e.core.editors.EE2EMenuBehavior;
import jp.sourceforge.projects.ee2e.core.editors.EE2ETabDestroyer;
import jp.sourceforge.projects.ee2e.core.editors.EE2EToolkit;
import jp.sourceforge.projects.ee2e.core.editors.EE2ETranslateBigRegion;
import jp.sourceforge.projects.ee2e.core.editors.EE2ETranslateRegion;
import jp.sourceforge.projects.ee2e.core.editors.EE2EUnCommentRegion;
import jp.sourceforge.projects.ee2e.core.editors.EE2EUnTranslateRegion;

/**
 * To change this generated comment edit the template variable "typecomment":
 * Window&gt;Preferences&gt;Java&gt;Templates.
 * To enable and disable the creation of type comments go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation.
 *
 * @author Toshikazu Ando [ ando@park.ruru.ne.jp ]
 */
public abstract class EE2ECF implements java.lang.Comparable {
    public EE2ECF() {
    }
    /** The file name of a dependence setup */
    public abstract String getFactoryName();

    /**
     * @see java.lang.Comparable#compareTo(Object)
     */
    public int compareTo(Object obj) {
        if (!(obj instanceof EE2ECF)) {
            return -1;
        }
        EE2ECF cf = (EE2ECF) obj;
        return this.getFactoryName().compareTo(cf.getFactoryName());
    }
    public EE2EMenuBehavior tabDestroyAction() {
        return new EE2ETabDestroyer();
    }
    public abstract EE2EIndentBehavior indentAction();
    public abstract EE2EIndentBehavior tabFormatAction();
    public EE2EMenuBehavior translateRegion() {
        return new EE2ETranslateRegion();
    }
    public EE2EMenuBehavior translateBigRegion() {
        return new EE2ETranslateBigRegion();
    }
    public EE2EMenuBehavior unTranslateRegion() {
        return new EE2EUnTranslateRegion();
    }
    public final EE2EMenuBehavior eE2EFileInstance(
        String type,
        String oneString) {
        EE2REe2e ee2e = EE2EToolkit.get().getEe2e(this.getFactoryName());
        if (ee2e == null) {
            EE2EDebug.printf(1, "eE2EFileInstance/ee2e is null");
            return null;
        }
        EE2RStructureList structureList =
            EE2EToolkit.get().getStructureList(ee2e, type);
        if (structureList == null) {
            EE2EDebug.printf(
                3,
                "eE2EFileInstance/structureList is null("
                    + this.getFactoryName()
                    + ")/"
                    + type);
            return null;
        }
        return new EE2EDependCompletent(
            structureList,
            this.indentAction(),
            oneString);
    }
    public final EE2EMenuBehavior structureSection() {
        return this.eE2EFileInstance(EE2EDependCompletent.SECTION, "s");
    }
    public final EE2EMenuBehavior structureBegin() {
        return this.eE2EFileInstance(EE2EDependCompletent.BEGIN, "b");
    }
    public final EE2EMenuBehavior structureLearge() {
        return this.eE2EFileInstance(EE2EDependCompletent.LEARGE, "l");
    }
    public final EE2EMenuBehavior structureBig() {
        return this.eE2EFileInstance(EE2EDependCompletent.BIG, "!");
    }
    public final EE2EMenuBehavior structureReturn() {
        return this.eE2EFileInstance(EE2EDependCompletent.RETURN, "n");
    }
    public final EE2EMenuBehavior insertIterator() {
        EE2REe2e ee2e = EE2EToolkit.get().getEe2e(this.getFactoryName());
        if (ee2e == null) {
            EE2EDebug.printf(1, "insertIterator/ee2e is null");
            return null;
        }
        EE2RIterationList iterationList = ee2e.getIterationList();
        if (iterationList == null) {
            EE2EDebug.printf(
                3,
                "insertIterator/list is null(" + this.getFactoryName() + ")");
            return null;
        }
        return new EE2EInsertIterator(iterationList, this.indentAction());
    }
    /** Width of an indent */
    protected int getSize() {
        EE2REe2e ee2e = EE2EToolkit.get().getEe2e(this.getFactoryName());
        if (ee2e == null) {
            EE2EDebug.printf(1, "eE2EFileInstance/ee2e is null");
            return 4;
        }
        return ee2e.getIndent();
    }
    public EE2EMenuBehavior fileJumpRegion() {
        return new EE2EFileJump();
    }

    public EE2EMenuBehavior derivationResource() {
        EE2REe2e ee2e = EE2EToolkit.get().getEe2e(this.getFactoryName());
        if (ee2e == null) {
            EE2EDebug.printf(1, "eE2EFileInstance/ee2e is null");
            return null;
        }
        String derivation = ee2e.getDerivation();
        if ((derivation == null) || (derivation.equals(""))) {
            return null;
        }
        return new EE2EDerivationResource(derivation);
    }
    public EE2EMenuBehavior derivationResourceSystem() {
        EE2REe2e ee2e = EE2EToolkit.get().getEe2e(this.getFactoryName());
        if (ee2e == null) {
            EE2EDebug.printf(1, "eE2EFileInstance/ee2e is null");
            return null;
        }
        String derivation = ee2e.getDerivation();
        if ((derivation == null) || (derivation.equals(""))) {
            return null;
        }
        return new EE2EDerivationResourceSystem(derivation);
    }
    public EE2EMenuBehavior preview() {
        return new EE2EPreview();
    }
    public EE2EMenuBehavior commentRegion() {
        return new EE2ECommentRegion();
    }
    public EE2EMenuBehavior unCommentRegion() {
        return new EE2EUnCommentRegion();
    }
    public EE2EMenuBehavior completeMarkRight() {
        return new EE2ECompleteMarkRight();
    }
    public EE2EMenuBehavior completeMarkLeft() {
        return new EE2ECompleteMarkLeft();
    }
    public EE2EMenuBehavior completeMarkAmp() {
        return new EE2ECompleteMarkAmp();
    }
    public EE2EMenuBehavior completeMarkQuot() {
        return new EE2ECompleteMarkQuot();
    }
    public EE2EMenuBehavior completeMarkApos() {
        return new EE2ECompleteMarkApos();
    }
    public EE2EMenuBehavior completeMarkNbsp() {
        return new EE2ECompleteMarkNbsp();
    }
}
