org.nlogo.command
Class BasicBlockCommand

java.lang.Object
  extended by org.nlogo.command.Instruction
      extended by org.nlogo.command.Command
          extended by org.nlogo.command.BasicBlockCommand
All Implemented Interfaces:
Cloneable, org.nlogo.compiler.Branching

public class BasicBlockCommand
extends Command
implements org.nlogo.compiler.Branching


Field Summary
 ArrayList commandList
           
 
Fields inherited from class org.nlogo.command.Command
switches
 
Fields inherited from class org.nlogo.command.Instruction
agentBits, args, blockAgentClassString, chosenEvalMethod, chosenEvalMethodMatchCost, disassembly, userSource, world
 
Constructor Summary
BasicBlockCommand(ArrayList commandList)
           
 
Method Summary
 int getBranchTargetOffset()
          This offset should refer to the "other" place that execution could go, besides incrementing by 1.
 org.nlogo.compiler.Syntax getSyntax()
           
 void init(Workspace workspace)
           
 void perform(Context context)
           
 void setBranchTargetOffset(int newOffset)
           
 String toString()
           
 
Methods inherited from class org.nlogo.command.Instruction
addProcedureToInliningRecords, agentClassCanPerform, agentClassString, agentClassString, argEvalAgent, argEvalAgentSet, argEvalAgentSet, argEvalBoolean, argEvalBooleanValue, argEvalDouble, argEvalDoubleValue, argEvalIntValue, argEvalLink, argEvalList, argEvalLong, argEvalLongValue, argEvalPatch, argEvalString, argEvalTurtle, assemble, checkAgentClass, checkAgentSetClass, clone, copyFieldsFrom, displayName, dump, dump, getInlinedDepth, getInliningRecords, getPositionAndLength, getSourceEndPosition, getSourceSnippet, getSourceStartPosition, newValidDouble, newValidDouble, optimize0, optimize1, optimize2, setSourceSnippet, throwAgentClassException, token, token, tokenLimitingType, tokenLimitingType, validDouble, wasInlined, workspace
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

commandList

public ArrayList commandList
Constructor Detail

BasicBlockCommand

public BasicBlockCommand(ArrayList commandList)
Method Detail

getBranchTargetOffset

public int getBranchTargetOffset()
Description copied from interface: org.nlogo.compiler.Branching
This offset should refer to the "other" place that execution could go, besides incrementing by 1. If this method returns 1, then the instruction is not, in fact, branching after all, since it's only choices are to go to 1 or 1. Note: some commands may return Integer.MIN_VALUE, which is a special value that indicates that their branch destination is either: 1) their destination is not relative to their current location 2) their destination is unknown at compile-time. An offset of 0 means that the command is "Loopy" (such as _fdinternal ), and it may not increment the IP at all. ~Forrest (1/4/2007)

Specified by:
getBranchTargetOffset in interface org.nlogo.compiler.Branching

setBranchTargetOffset

public void setBranchTargetOffset(int newOffset)
Specified by:
setBranchTargetOffset in interface org.nlogo.compiler.Branching

perform

public void perform(Context context)
             throws LogoException
Specified by:
perform in class Command
Throws:
LogoException

getSyntax

public org.nlogo.compiler.Syntax getSyntax()
Specified by:
getSyntax in class Instruction

toString

public String toString()
Overrides:
toString in class Command

init

public void init(Workspace workspace)
Overrides:
init in class Instruction