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
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
addToBlock
(int pos, Statement s) Adds the statements
at positionpos
inthis
BLOCK statement; the declaration notwithstanding, the dynamic type ofs
must be the same as the dynamic type ofthis
.final void
assembleCall
(String inst) Assembles inthis
a CALL statement with root label(CALL, ?, inst)
and no subtrees.final void
Assembles inthis
an IF statement with root label(IF, c, ?)
and only subtree the BLOCKs
; the declaration notwithstanding, the dynamic type ofs
must be the same as the dynamic type ofthis
.final void
Assembles inthis
an IF_ELSE statement with root label(IF_ELSE, c, ?)
and as two subtrees the BLOCKss1
ands2
; the declaration notwithstanding, the dynamic type ofs1
ands2
must be the same as the dynamic type ofthis
.final void
Assembles inthis
a WHILE statement with root label(WHILE, c, ?)
and only subtree the BLOCKs
; the declaration notwithstanding, the dynamic type ofs
must be the same as the dynamic type ofthis
.final void
clear()
Resetsthis
to an initial value.final String
Disassembles CALL statementthis
and returns the called instruction name as the value of the function.Disassembles IF statementthis
into its testCondition
, which is returned as the value of the function, and its only subtree, the BLOCK statements
; the declaration notwithstanding, the dynamic type ofs
must be the same as the dynamic type ofthis
.disassembleIfElse
(Statement s1, Statement s2) Disassembles IF_ELSE statementthis
into its testCondition
, which is returned as the value of the function, and its two subtrees, the BLOCK statementss1
ands2
; the declaration notwithstanding, the dynamic type ofs1
ands2
must be the same as the dynamic type ofthis
.Disassembles WHILE statementthis
into its testCondition
, which is returned as the value of the function, and its only subtree, the BLOCK statements
; the declaration notwithstanding, the dynamic type ofs
must be the same as the dynamic type ofthis
.final StatementKernel.Kind
kind()
Reports the kind of statementthis
is.final int
Reports the number of statements inthis
BLOCK.final Statement1
Returns a new object with the same dynamic type asthis
, having an initial value.final Statement
removeFromBlock
(int pos) Removes and returns the statement at positionpos
inthis
BLOCK statement.final void
transferFrom
(Statement source) Setsthis
to the incoming value ofsource
, and resetssource
to an initial value; the declaration notwithstanding, the dynamic type ofsource
must 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:Standard
Returns a new object with the same dynamic type asthis
, having an initial value. If the typeT
has a no-argument constructor, then the value of the new returned object satisfies the contract of the no-argument constructor forT
. IfT
does 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"
this
with an initial value
-
clear
Description copied from interface:Standard
Resetsthis
to an initial value. If the typeT
has a no-argument constructor, thenthis
satisfies the contract of the no-argument constructor forT
. IfT
does not have a no-argument constructor, thenthis
satisfies the contract of the constructor call that was used to initialize#this
. -
transferFrom
Description copied from interface:Standard
Setsthis
to the incoming value ofsource
, and resetssource
to an initial value; the declaration notwithstanding, the dynamic type ofsource
must be the same as the dynamic type ofthis
. If the typeT
has a no-argument constructor, thensource
satisfies the contract of the no-argument constructor forT
. IfT
does not have a no-argument constructor, thensource
satisfies 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:StatementKernel
Reports the kind of statementthis
is.- Returns:
- the kind of this statement
-
addToBlock
Description copied from interface:StatementKernel
Adds the statements
at positionpos
inthis
BLOCK statement; the declaration notwithstanding, the dynamic type ofs
must be the same as the dynamic type ofthis
.- Parameters:
pos
- the position at which to adds
s
- theStatement
to add
-
removeFromBlock
Description copied from interface:StatementKernel
Removes and returns the statement at positionpos
inthis
BLOCK statement.- Parameters:
pos
- the position of the child to remove- Returns:
- the child at position pos in
this
-
lengthOfBlock
Description copied from interface:StatementKernel
Reports the number of statements inthis
BLOCK.- Returns:
- the length of
this
BLOCK
-
assembleIf
Description copied from interface:StatementKernel
Assembles inthis
an IF statement with root label(IF, c, ?)
and only subtree the BLOCKs
; the declaration notwithstanding, the dynamic type ofs
must be the same as the dynamic type ofthis
.- Parameters:
c
- theCondition
of the IF statements
- the body of the IF statement
-
disassembleIf
Description copied from interface:StatementKernel
Disassembles IF statementthis
into its testCondition
, which is returned as the value of the function, and its only subtree, the BLOCK statements
; the declaration notwithstanding, the dynamic type ofs
must be the same as the dynamic type ofthis
.- Parameters:
s
- the body of this IF statement- Returns:
- the
Condition
of this IF statement
-
assembleIfElse
Description copied from interface:StatementKernel
Assembles inthis
an IF_ELSE statement with root label(IF_ELSE, c, ?)
and as two subtrees the BLOCKss1
ands2
; the declaration notwithstanding, the dynamic type ofs1
ands2
must be the same as the dynamic type ofthis
.- Parameters:
c
- theCondition
of 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:StatementKernel
Disassembles IF_ELSE statementthis
into its testCondition
, which is returned as the value of the function, and its two subtrees, the BLOCK statementss1
ands2
; the declaration notwithstanding, the dynamic type ofs1
ands2
must 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
Condition
of this IF_ELSE statement
-
assembleWhile
Description copied from interface:StatementKernel
Assembles inthis
a WHILE statement with root label(WHILE, c, ?)
and only subtree the BLOCKs
; the declaration notwithstanding, the dynamic type ofs
must be the same as the dynamic type ofthis
.- Parameters:
c
- theCondition
of the WHILE statements
- the body of the WHILE statement
-
disassembleWhile
Description copied from interface:StatementKernel
Disassembles WHILE statementthis
into its testCondition
, which is returned as the value of the function, and its only subtree, the BLOCK statements
; the declaration notwithstanding, the dynamic type ofs
must be the same as the dynamic type ofthis
.- Parameters:
s
- the body of this WHILE statement- Returns:
- the
Condition
of this WHILE statement
-
assembleCall
Description copied from interface:StatementKernel
Assembles inthis
a 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:StatementKernel
Disassembles CALL statementthis
and returns the called instruction name as the value of the function.- Returns:
- the name of the instruction of this CALL statement
-