/* This file was generated by SableCC's ObjectMacro. */

package org.sablecc.sablecc.codegeneration.java.macro;

import java.util.*;

public class MTransitionStateSingleton {

    private final String pNumber;

    private final MTransitionStateSingleton mTransitionStateSingleton = this;

    private final List<Object> eDefaultPackage_SpecifiedPackage = new LinkedList<Object>();

    private final List<Object> eSetMarker = new LinkedList<Object>();

    private final List<Object> eNoMarker = new LinkedList<Object>();

    private final List<Object> eTransitionTarget = new LinkedList<Object>();

    public MTransitionStateSingleton(
            String pNumber) {

        if (pNumber == null) {
            throw new NullPointerException();
        }
        this.pNumber = pNumber;
    }

    public MSetMarker newSetMarker(
            String pName) {

        MSetMarker lSetMarker = new MSetMarker(pName);
        this.eSetMarker.add(lSetMarker);
        return lSetMarker;
    }

    public MNoMarker newNoMarker() {

        MNoMarker lNoMarker = new MNoMarker();
        this.eNoMarker.add(lNoMarker);
        return lNoMarker;
    }

    public MTransitionTarget newTransitionTarget(
            String pSymbol,
            String pTarget) {

        MTransitionTarget lTransitionTarget = new MTransitionTarget(pSymbol,
                pTarget);
        this.eTransitionTarget.add(lTransitionTarget);
        return lTransitionTarget;
    }

    public MDefaultPackage newDefaultPackage(
            String pLanguageName) {

        MDefaultPackage lDefaultPackage = new MDefaultPackage(pLanguageName);
        this.eDefaultPackage_SpecifiedPackage.add(lDefaultPackage);
        return lDefaultPackage;
    }

    public MSpecifiedPackage newSpecifiedPackage(
            String pLanguageName,
            String pPackage) {

        MSpecifiedPackage lSpecifiedPackage = new MSpecifiedPackage(
                pLanguageName, pPackage);
        this.eDefaultPackage_SpecifiedPackage.add(lSpecifiedPackage);
        return lSpecifiedPackage;
    }

    String pNumber() {

        return this.pNumber;
    }

    private String rNumber() {

        return this.mTransitionStateSingleton.pNumber();
    }

    @Override
    public String toString() {

        StringBuilder sb = new StringBuilder();
        sb.append(new MHeader().toString());
        if (this.eDefaultPackage_SpecifiedPackage.size() > 0) {
            sb.append(System.getProperty("line.separator"));
        }
        for (Object oDefaultPackage_SpecifiedPackage : this.eDefaultPackage_SpecifiedPackage) {
            sb.append(oDefaultPackage_SpecifiedPackage.toString());
        }
        sb.append(System.getProperty("line.separator"));
        sb.append("class S_");
        sb.append(rNumber());
        sb.append(System.getProperty("line.separator"));
        sb.append("    extends TransitionState {");
        sb.append(System.getProperty("line.separator"));
        sb.append(System.getProperty("line.separator"));
        sb.append("  static final S_");
        sb.append(rNumber());
        sb.append(" instance = new S_");
        sb.append(rNumber());
        sb.append("();");
        sb.append(System.getProperty("line.separator"));
        sb.append(System.getProperty("line.separator"));
        sb.append("  private S_");
        sb.append(rNumber());
        sb.append("() {");
        sb.append(System.getProperty("line.separator"));
        sb.append("  }");
        sb.append(System.getProperty("line.separator"));
        sb.append(System.getProperty("line.separator"));
        for (Object oSetMarker : this.eSetMarker) {
            sb.append(oSetMarker.toString());
        }
        for (Object oNoMarker : this.eNoMarker) {
            sb.append(oNoMarker.toString());
        }
        sb.append(System.getProperty("line.separator"));
        sb.append("  State getTarget(Symbol symbol) {");
        sb.append(System.getProperty("line.separator"));
        sb.append("    switch(symbol) {");
        sb.append(System.getProperty("line.separator"));
        for (Object oTransitionTarget : this.eTransitionTarget) {
            sb.append(oTransitionTarget.toString());
        }
        sb.append("    default:");
        sb.append(System.getProperty("line.separator"));
        sb.append("      return null;");
        sb.append(System.getProperty("line.separator"));
        sb.append("    }");
        sb.append(System.getProperty("line.separator"));
        sb.append("  }");
        sb.append(System.getProperty("line.separator"));
        sb.append(System.getProperty("line.separator"));
        sb.append("}");
        sb.append(System.getProperty("line.separator"));
        return sb.toString();
    }

}
