Package components.statement
Class Statement1
java.lang.Object
components.statement.StatementSecondary
components.statement.Statement1
- All Implemented Interfaces:
Standard<Statement>,Statement,StatementKernel
- Representation Invariant (concrete invariant of $this):
[$this.rep is a valid representation of a Statement]- Abstraction Relation (interpretation mapping between $this and this):
this = $this.rep
-
Nested Class Summary
Nested classes/interfaces inherited from interface components.statement.StatementKernel
StatementKernel.Condition, StatementKernel.Kind -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddToBlock(int pos, Statement s) Adds the statementsat positionposinthisBLOCK statement; the declaration notwithstanding, the dynamic type ofsmust be the same as the dynamic type ofthis.final voidassembleCall(String inst) Assembles inthisa CALL statement with root label(CALL, ?, inst)and no subtrees.final voidAssembles inthisan IF statement with root label(IF, c, ?)and only subtree the BLOCKs; the declaration notwithstanding, the dynamic type ofsmust be the same as the dynamic type ofthis.final voidAssembles inthisan IF_ELSE statement with root label(IF_ELSE, c, ?)and as two subtrees the BLOCKss1ands2; the declaration notwithstanding, the dynamic type ofs1ands2must be the same as the dynamic type ofthis.final voidAssembles inthisa WHILE statement with root label(WHILE, c, ?)and only subtree the BLOCKs; the declaration notwithstanding, the dynamic type ofsmust be the same as the dynamic type ofthis.final voidclear()Resetsthisto an initial value.final StringDisassembles CALL statementthisand returns the called instruction name as the value of the function.Disassembles IF statementthisinto its testCondition, which is returned as the value of the function, and its only subtree, the BLOCK statements; the declaration notwithstanding, the dynamic type ofsmust be the same as the dynamic type ofthis.disassembleIfElse(Statement s1, Statement s2) Disassembles IF_ELSE statementthisinto its testCondition, which is returned as the value of the function, and its two subtrees, the BLOCK statementss1ands2; the declaration notwithstanding, the dynamic type ofs1ands2must be the same as the dynamic type ofthis.Disassembles WHILE statementthisinto its testCondition, which is returned as the value of the function, and its only subtree, the BLOCK statements; the declaration notwithstanding, the dynamic type ofsmust be the same as the dynamic type ofthis.final StatementKernel.Kindkind()Reports the kind of statementthisis.final intReports the number of statements inthisBLOCK.final Statement1Returns a new object with the same dynamic type asthis, having an initial value.final StatementremoveFromBlock(int pos) Removes and returns the statement at positionposinthisBLOCK statement.final voidtransferFrom(Statement source) Setsthisto the incoming value ofsource, and resetssourceto an initial value; the declaration notwithstanding, the dynamic type ofsourcemust be the same as the dynamic type ofthis.Methods inherited from class components.statement.StatementSecondary
equals, hashCode, parse, parseBlock, prettyPrint, toString
-
Constructor Details
-
Statement1
public Statement1()No-argument constructor.
-
-
Method Details
-
newInstance
Description copied from interface:StandardReturns a new object with the same dynamic type asthis, having an initial value. If the typeThas a no-argument constructor, then the value of the new returned object satisfies the contract of the no-argument constructor forT. IfTdoes not have a no-argument constructor, then the value of the new returned object satisfies the contract of the constructor call that was used to initializethis.- Returns:
- new object "like"
thiswith an initial value
-
clear
Description copied from interface:StandardResetsthisto an initial value. If the typeThas a no-argument constructor, thenthissatisfies the contract of the no-argument constructor forT. IfTdoes not have a no-argument constructor, thenthissatisfies the contract of the constructor call that was used to initialize#this. -
transferFrom
Description copied from interface:StandardSetsthisto the incoming value ofsource, and resetssourceto an initial value; the declaration notwithstanding, the dynamic type ofsourcemust be the same as the dynamic type ofthis. If the typeThas a no-argument constructor, thensourcesatisfies the contract of the no-argument constructor forT. IfTdoes not have a no-argument constructor, thensourcesatisfies the contract of the constructor call that was used to initialize#source.- Parameters:
source- object whose value is to be transferred
-
kind
Description copied from interface:StatementKernelReports the kind of statementthisis.- Returns:
- the kind of this statement
-
addToBlock
Description copied from interface:StatementKernelAdds the statementsat positionposinthisBLOCK statement; the declaration notwithstanding, the dynamic type ofsmust be the same as the dynamic type ofthis.- Parameters:
pos- the position at which to addss- theStatementto add
-
removeFromBlock
Description copied from interface:StatementKernelRemoves and returns the statement at positionposinthisBLOCK statement.- Parameters:
pos- the position of the child to remove- Returns:
- the child at position pos in
this
-
lengthOfBlock
Description copied from interface:StatementKernelReports the number of statements inthisBLOCK.- Returns:
- the length of
thisBLOCK
-
assembleIf
Description copied from interface:StatementKernelAssembles inthisan IF statement with root label(IF, c, ?)and only subtree the BLOCKs; the declaration notwithstanding, the dynamic type ofsmust be the same as the dynamic type ofthis.- Parameters:
c- theConditionof the IF statements- the body of the IF statement
-
disassembleIf
Description copied from interface:StatementKernelDisassembles IF statementthisinto its testCondition, which is returned as the value of the function, and its only subtree, the BLOCK statements; the declaration notwithstanding, the dynamic type ofsmust be the same as the dynamic type ofthis.- Parameters:
s- the body of this IF statement- Returns:
- the
Conditionof this IF statement
-
assembleIfElse
Description copied from interface:StatementKernelAssembles inthisan IF_ELSE statement with root label(IF_ELSE, c, ?)and as two subtrees the BLOCKss1ands2; the declaration notwithstanding, the dynamic type ofs1ands2must be the same as the dynamic type ofthis.- Parameters:
c- theConditionof the IF_ELSE statements1- the body of the "then" part of the IF_ELSE statements2- the body of the "else" part of the IF_ELSE statement
-
disassembleIfElse
Description copied from interface:StatementKernelDisassembles IF_ELSE statementthisinto its testCondition, which is returned as the value of the function, and its two subtrees, the BLOCK statementss1ands2; the declaration notwithstanding, the dynamic type ofs1ands2must be the same as the dynamic type ofthis.- Parameters:
s1- the body of the "then" part of the IF_ELSE statements2- the body of the "else" part of the IF_ELSE statement- Returns:
- the
Conditionof this IF_ELSE statement
-
assembleWhile
Description copied from interface:StatementKernelAssembles inthisa WHILE statement with root label(WHILE, c, ?)and only subtree the BLOCKs; the declaration notwithstanding, the dynamic type ofsmust be the same as the dynamic type ofthis.- Parameters:
c- theConditionof the WHILE statements- the body of the WHILE statement
-
disassembleWhile
Description copied from interface:StatementKernelDisassembles WHILE statementthisinto its testCondition, which is returned as the value of the function, and its only subtree, the BLOCK statements; the declaration notwithstanding, the dynamic type ofsmust be the same as the dynamic type ofthis.- Parameters:
s- the body of this WHILE statement- Returns:
- the
Conditionof this WHILE statement
-
assembleCall
Description copied from interface:StatementKernelAssembles inthisa CALL statement with root label(CALL, ?, inst)and no subtrees.- Parameters:
inst- the name of the instruction of the CALL statement
-
disassembleCall
Description copied from interface:StatementKernelDisassembles CALL statementthisand returns the called instruction name as the value of the function.- Returns:
- the name of the instruction of this CALL statement
-