pascalinterpreter.controlstatements
Class For

java.lang.Object
  extended bypascalinterpreter.Command
      extended bypascalinterpreter.ControlStatement
          extended bypascalinterpreter.controlstatements.For

public class For
extends ControlStatement


Field Summary
private  UnaryOperation assignRegistryOperation
           
private  BinaryOperation incrementOperation
           
private  BinaryOperation initOperation
           
 
Fields inherited from class pascalinterpreter.ControlStatement
 
Constructor Summary
For(Variable counter, Variable initValue, Variable maxValue, Block block)
          Konstruktor pętli For.
 
Method Summary
private  void checkParametrs(Variable counter, Variable initValue, Variable maxValue)
          Metoda sprawdza poprawność typów dla parametrów pętli for.
private  UnaryOperation createAssignRegistryOperation(Variable counter)
           
private  BinaryOperation createControlCondition(Variable counter, Variable maxValue)
           
private  BinaryOperation createIncrementOperation(Variable counter)
           
private  BinaryOperation createInitOperation(Variable counter, Variable initValue)
           
 void execute()
          Metoda rozpoczyna wykonywanie komendy.
protected  UnaryOperation getAssignRegistryOperation()
           
protected  BinaryOperation getIncrementOperation()
           
protected  BinaryOperation getInitOperation()
           
protected  void setAssignRegistryOperation(UnaryOperation operation)
           
protected  void setIncrementOperation(BinaryOperation operation)
           
protected  void setInitOperation(BinaryOperation operation)
           
 
Methods inherited from class pascalinterpreter.ControlStatement
getBlock, getControlCondition, getRegistry, isConditionTrue, setBlock, setControlCondition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

initOperation

private BinaryOperation initOperation

incrementOperation

private BinaryOperation incrementOperation

assignRegistryOperation

private UnaryOperation assignRegistryOperation
Constructor Detail

For

public For(Variable counter,
           Variable initValue,
           Variable maxValue,
           Block block)
    throws AnalyseException,
           InternalException
Konstruktor pętli For.

Parameters:
counter - - zmienna sterująca pętli.
initValue - - wartość początkowa.
maxValue - - wartość końcowa.
Throws:
AnalyseException - - Wyjątek generowany w przypadku podania jako parametr pętli typu różnego od Int.
InternalException
Method Detail

checkParametrs

private void checkParametrs(Variable counter,
                            Variable initValue,
                            Variable maxValue)
                     throws AnalyseException
Metoda sprawdza poprawność typów dla parametrów pętli for.

Throws:
AnalyseException
See Also:
pascalinterpreter.controlstatements.For#For()

createInitOperation

private BinaryOperation createInitOperation(Variable counter,
                                            Variable initValue)
                                     throws InternalException
Throws:
InternalException

createControlCondition

private BinaryOperation createControlCondition(Variable counter,
                                               Variable maxValue)
                                        throws InternalException
Throws:
InternalException

createIncrementOperation

private BinaryOperation createIncrementOperation(Variable counter)
                                          throws InternalException
Throws:
InternalException

createAssignRegistryOperation

private UnaryOperation createAssignRegistryOperation(Variable counter)
                                              throws InternalException
Throws:
InternalException

getInitOperation

protected BinaryOperation getInitOperation()
Returns:

setInitOperation

protected void setInitOperation(BinaryOperation operation)
                         throws AnalyseException
Parameters:
operation -
Throws:
AnalyseException

getIncrementOperation

protected BinaryOperation getIncrementOperation()
Returns:

setIncrementOperation

protected void setIncrementOperation(BinaryOperation operation)
                              throws AnalyseException
Parameters:
operation -
Throws:
AnalyseException

getAssignRegistryOperation

protected UnaryOperation getAssignRegistryOperation()
Returns:

setAssignRegistryOperation

protected void setAssignRegistryOperation(UnaryOperation operation)
                                   throws AnalyseException
Parameters:
operation -
Throws:
AnalyseException

execute

public void execute()
             throws RuntimeException,
                    InternalException
Description copied from class: Command
Metoda rozpoczyna wykonywanie komendy.

Specified by:
execute in class Command
Throws:
RuntimeException - - wyjątek generowany
InternalException