public class Snippet extends Object
Modifier and Type | Field and Description |
---|---|
TreeMap<LevelOrderPair,ArrayList<Block>> |
blocks
The blocks that are contained in this snippet.
|
Constructor and Description |
---|
Snippet()
Initializes this snippet.
|
Modifier and Type | Method and Description |
---|---|
void |
addBlock(int level)
Adds a new block to this snippet in the given level.
|
void |
addStatement(Statement statement)
Adds a statement to the last added block.
|
void |
elseBlock(String type)
Adds a final path to the last branch block (e.g.
|
void |
elseifBlock(String type)
Adds a path to the last branch block.
|
void |
endBlock(String type)
Ends the last block.
|
void |
levelInner()
Moves a level in for this snippet.
|
void |
levelOuter()
Moves a level out for this snippet.
|
void |
startBlock(String type)
Starts a new block.
|
String |
toString()
Returns a string representation of this snippet.
|
public TreeMap<LevelOrderPair,ArrayList<Block>> blocks
public void addBlock(int level)
level
- the level to which the new block is added.public void levelInner()
public void levelOuter()
public void startBlock(String type)
type
- the type of the block (METHOD, LOOP, CONDITION, CASE, TRY).public void elseifBlock(String type)
type
- the type of the block (CONDITION, CASE, TRY).public void elseBlock(String type)
type
- the type of the block (LOOP, CONDITION, CASE, TRY).public void endBlock(String type)
type
- the type of the block (METHOD, LOOP, CONDITION, CASE, TRY).public void addStatement(Statement statement)
statement
- the statement to be added.Copyright © 2017. All rights reserved.