/*=======================================================
 * CoreCommandPackages.java 
 *
 * "A Tcl like language implementation in Java named APWTCL
 * ((Java) Arnulf's Preferred Web Tcl)"
 *
 * APWTCL CoreCommandPackages class
 *
 * Released under same BSD license as Tcl.
 * (Tcl BSD license found at <http://www.tcl.tk/software/tcltk/license.html>)
 *
 * Copyright 2012 Arnulf P. Wiedemann
 *
 */

package org.apwtcl.lang;

import java.util.ArrayList;
import java.util.HashMap;

public class CoreCommandPackages extends PackageCommandInfo implements Debug {
  private static int oid = 0;

  private int id;


  /* ==================== CoreCommandPackages ================================== */
  public CoreCommandPackages(Interp interp) {
    oid++;
    id = oid;

    HashMap<String, ArrayList<ApwtclObj>> cmds = new HashMap<String, ArrayList<ApwtclObj>>();
    
    ArrayList<ApwtclObj> sub_cmds;
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("AppendCommand ::append", -1, "CORE_COMMAND_PACKAGES_1"));
    cmds.put("append", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("BreakCommand ::break", -1, "CORE_COMMAND_PACKAGES_2"));
    cmds.put("break", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("CatchCommand ::catch", -1, "CORE_COMMAND_PACKAGES_3"));
    cmds.put("catch", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("ConcatCommand ::concat", -1, "CORE_COMMAND_PACKAGES_4"));
    cmds.put("concat", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("ContinueCommand ::continue", -1, "CORE_COMMAND_PACKAGES_5"));
    cmds.put("continue", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("DictCommand ::dict", -1, "CORE_COMMAND_PACKAGES_6"));
    cmds.put("dict", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("EvalCommand ::eval", -1, "CORE_COMMAND_PACKAGES_7"));
    cmds.put("eval", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("ExprCommand ::expr", -1, "CORE_COMMAND_PACKAGES_8"));
    cmds.put("expr", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("ForeachCommand ::foreach", -1, "CORE_COMMAND_PACKAGES_9"));
    cmds.put("foreach", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("IfCommand ::if", -1, "CORE_COMMAND_PACKAGES_10"));
    cmds.put("if", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("IncrCommand ::incr", -1, "CORE_COMMAND_PACKAGES_11"));
    cmds.put("incr", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("InterpCommand ::interp", -1, "CORE_COMMAND_PACKAGES_12"));
    cmds.put("interp", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("JoinCommand ::join", -1, "CORE_COMMAND_PACKAGES_13"));
    cmds.put("join", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("LappendCommand ::lappend", -1, "CORE_COMMAND_PACKAGES_14"));
    cmds.put("lappend", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("LassignCommand ::lassign", -1, "CORE_COMMAND_PACKAGES_15"));
    cmds.put("lassign", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("LindexCommand ::lindex", -1, "CORE_COMMAND_PACKAGES_16"));
    cmds.put("lindex", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("ListCommand ::list", -1, "CORE_COMMAND_PACKAGES_17"));
    cmds.put("list", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("LlengthCommand ::llength", -1, "CORE_COMMAND_PACKAGES_18"));
    cmds.put("llength", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("LrangeCommand ::lrange", -1, "CORE_COMMAND_PACKAGES_19"));
    cmds.put("lrange", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("LreplaceCommand ::lreplace", -1, "CORE_COMMAND_PACKAGES_20"));
    cmds.put("lreplace", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("LsearchCommand ::lsearch", -1, "CORE_COMMAND_PACKAGES_21"));
    cmds.put("lsearch", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("LsortCommand ::lsort", -1, "CORE_COMMAND_PACKAGES_22"));
    cmds.put("lsort", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("NamespaceCommand ::namespace", -1, "CORE_COMMAND_PACKAGES_23"));
    cmds.put("namespace", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("PackageCommand ::package", -1, "CORE_COMMAND_PACKAGES_24"));
    cmds.put("package", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("ProcCommand ::proc", -1, "CORE_COMMAND_PACKAGES_25"));
    cmds.put("proc", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("PutsCommand ::puts", -1, "CORE_COMMAND_PACKAGES_26"));
    cmds.put("puts", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("RegexpCommand ::regexp", -1, "CORE_COMMAND_PACKAGES_27"));
    cmds.put("regexp", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("ReturnCommand ::return", -1, "CORE_COMMAND_PACKAGES_28"));
    cmds.put("return", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("SetCommand ::set", -1, "CORE_COMMAND_PACKAGES_29"));
    cmds.put("set", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("SourceCommand ::source", -1, "CORE_COMMAND_PACKAGES_30"));
    cmds.put("source", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("StringCommand ::string", -1, "CORE_COMMAND_PACKAGES_31"));
    cmds.put("string", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("SwitchCommand ::switch", -1, "CORE_COMMAND_PACKAGES_32"));
    cmds.put("switch", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("TcltestCommand ::tcltest", -1, "CORE_COMMAND_PACKAGES_33"));
    cmds.put("tcltest", sub_cmds);

    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("TraceCommand ::trace", -1, "CORE_COMMAND_PACKAGES_34"));
    cmds.put("trace", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("UnsetCommand ::unset", -1, "CORE_COMMAND_PACKAGES_35"));
    cmds.put("unset", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("VariableCommand ::variable", -1, "CORE_COMMAND_PACKAGES_36"));
    cmds.put("variable", sub_cmds);
    
    sub_cmds = new ArrayList<ApwtclObj>();
    sub_cmds.add(interp.string_obj_type.newStringObj("WhileCommand ::while", -1, "CORE_COMMAND_PACKAGES_37"));
    cmds.put("while", sub_cmds);

//print("core!"+cmds.keySet()+"!");    
    packages.put("core", cmds);
  }

  /* ==================== mySelf ================================== */
  public String mySelf() {
    String str = "CoreCommandPackages!"+id+"!";
    return str;
  } 
      
  /* ==================== toString ===================================== */
  public String toString() {
    return mySelf()+"!";
  }

  /* ==================== toDebugString ===================================== */
  public String toDebugString() {
    StringBuffer str = new StringBuffer(mySelf()+"\n");
    return str.toString();
  }
}

