public class Block
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
actualSectionPrefix
The GetPot prefix for the name of the current, actual section.
|
static java.lang.String |
parentSectionPrefix
The GetPot prefix for the name of parent section.
|
Constructor and Description |
---|
Block() |
Modifier and Type | Method and Description |
---|---|
void |
fromGetPot(java.util.ArrayList<java.lang.String> potLines)
An alternative version of fromGetPot that uses a properly assembled array
list of the lines.
|
void |
fromGetPot(java.lang.String getPotString)
This operation loads the Block based on the content of a
GetPot-compatible String.
|
void |
fromTreeComposite(TreeComposite comp)
This operation creates a fully-initialized Block from a TreeComposite.
|
java.lang.String |
getComment()
This operation retrieves the block's comment.
|
java.lang.String |
getDescription()
This operation retrieves the description of the block.
|
java.lang.String |
getName()
This operation retrieves the name of the block.
|
java.util.ArrayList<Parameter> |
getParameters()
This operation retrieves the parameters of the block.
|
java.util.ArrayList<Block> |
getSubblocks()
This operation retrieves the subblocks of the block.
|
java.lang.String |
getType()
This operation retrieves the type of the block.
|
boolean |
isActive()
This operation indicates if the block is Active.
|
void |
loadFromMap(java.util.Map map)
This operation loads the block from an untyped Map.
|
void |
setActive(boolean flag)
This operation sets specifies whether or not the block is Active.
|
void |
setComment(java.lang.String comm)
This operation sets the block's comment.
|
void |
setDescription(java.lang.String desc)
This operation sets the description of the block.
|
void |
setName(java.lang.String blockName)
This operation sets the name of the block.
|
void |
setParameters(java.util.ArrayList<Parameter> params)
This operation sets the parameters of the block.
|
void |
setSubblocks(java.util.ArrayList<Block> blocks)
This operation sets the subblocks of the block.
|
void |
setType(java.lang.String blockType)
This operation sets the type of the block.
|
java.lang.String |
toGetPot(java.lang.String prefix)
This method is the same as calling
toGetPot(prefix, false) . |
java.lang.String |
toGetPot(java.lang.String prefix,
boolean writeInactiveBlocks)
This operation converts the Block to a standard GetPot-compatible format
and returns it as a string.
|
java.lang.String |
toGetPot(java.lang.String prefix,
java.lang.String depthIndent,
boolean writeInactiveBlocks)
This operation converts the Block to a standard GetPot-compatible format
and returns it as a string.
|
java.lang.String |
toString()
This operation overrides toString() to write this class as a String in
GetPot format.
|
TreeComposite |
toTreeComposite()
This operations returns an ICE TreeComposite for the Block.
|
public static final java.lang.String actualSectionPrefix
public static final java.lang.String parentSectionPrefix
public java.lang.String getName()
public java.lang.String getType()
public java.lang.String getComment()
public java.lang.String getDescription()
public java.util.ArrayList<Parameter> getParameters()
public java.util.ArrayList<Block> getSubblocks()
public void setParameters(java.util.ArrayList<Parameter> params)
params
- The parameterspublic void setName(java.lang.String blockName)
blockName
- The namepublic void setDescription(java.lang.String desc)
desc
- The descriptionpublic void setComment(java.lang.String comm)
comm
- The comment to set.public void setType(java.lang.String blockType)
blockType
- The typepublic void setSubblocks(java.util.ArrayList<Block> blocks)
blocks
- The blockspublic TreeComposite toTreeComposite()
public void loadFromMap(java.util.Map map)
map
- The map.public java.lang.String toGetPot(java.lang.String prefix, boolean writeInactiveBlocks)
prefix
- The prefix for the name of the block. This is most commonly null or the actual section prefix (Block.actualSectionPrefix). If the prefix is not equal to Block.actualSectionPrefix, it will be replaced with an empty string.
The prefix is used in GetPot to note the relationship of a section with its parent. In MOOSE it is either null or equal to the actual prefix. In the latter case the section is always closed by the parent section prefix (Block.parentSectionPrefix). These are "./" and "../" for MOOSE, respectively and without the quotation marks.
writeInactiveBlocks
- This flag determines if inactive blocks should still be
written out to the GetPot string, but commented out (with a
("#" in front). By default, all subblocks have this behavior
set to true.public java.lang.String toGetPot(java.lang.String prefix)
toGetPot(prefix, false)
.prefix
- The prefix for the name of the block. This is most commonly null or the actual section prefix (Block.actualSectionPrefix). If the prefix is not equal to Block.actualSectionPrefix, it will be replaced with an empty string.
The prefix is used in GetPot to note the relationship of a section with its parent. In MOOSE it is either null or equal to the actual prefix. In the latter case the section is always closed by the parent section prefix (Block.parentSectionPrefix). These are "./" and "../" for MOOSE, respectively and without the quotation marks.
public java.lang.String toGetPot(java.lang.String prefix, java.lang.String depthIndent, boolean writeInactiveBlocks)
This operation converts the Block to a standard GetPot-compatible format and returns it as a string. If the name of the Block starts with "/", the prefix will be changed so that the name will not start with ".//" or "..//". Only active blocks (isActive == true) are written. This version also takes an string that can be used to indent the GetPot block by a certain amount.
This version is primarily used by the Block itself when dumping its children.
prefix
- The prefix for the name of the block. This is most commonly null or the actual section prefix (Block.actualSectionPrefix). If the prefix is not equal to Block.actualSectionPrefix, it will be replaced with an empty string.
The prefix is used in GetPot to note the relationship of a section with its parent. In MOOSE it is either null or equal to the actual prefix. In the latter case the section is always closed by the parent section prefix (Block.parentSectionPrefix). These are "./" and "../" for MOOSE, respectively and without the quotation marks.
depthIndent
- The indentation of the blockwriteInactiveBlocks
- This flag determines if inactive blocks should still be
written out to the GetPot string, but commented out (with a
"#" in front).public void fromGetPot(java.util.ArrayList<java.lang.String> potLines)
potLines
- The array list of lines created from fromGetPot().public void fromGetPot(java.lang.String getPotString)
This operation loads the Block based on the content of a GetPot-compatible String.
GetPot data has much less information than YAML. The only things that will be loaded are the name of the block, its parameters and its subblocks.
This operation expects that it will be given a single, complete block that starts with the name and ends with the closing characters. It will not handle multiple blocks.
getPotString
- The string that contains the Block information in GetPot
format.public java.lang.String toString()
toString
in class java.lang.Object
public void fromTreeComposite(TreeComposite comp)
This operation creates a fully-initialized Block from a TreeComposite. It expects the same format as that produced from toTreeComposite() and will create a malformed Block if it receives something else.
This operation should ONLY be used to create a Block that will be written to a MOOSE input file because it depends on the creation of Parameters from Entries and there is no 1-1 mapping between those entities.
comp
- The TreeComposite that should be loaded.public boolean isActive()
public void setActive(boolean flag)
flag
- True if Active, false if not