public class Block
extends java.lang.Object
Constructor and Description |
---|
Block(Block block)
Create a new Block which is a copy of block.
|
Block(java.util.List<java.lang.String> data)
Create a new Block from a list of strings.
|
Modifier and Type | Method and Description |
---|---|
void |
addAfterLast(java.lang.String str)
Add String after the end of the block.
|
void |
addBeforeFirst(java.lang.String str)
Add String before the start of the block.
|
void |
addPrefixToAll(java.lang.String prefix)
Add the prefix to each string in the block.
|
void |
addTag(java.lang.String tag)
Add a tag to the block.
|
java.util.List<java.lang.String> |
contents()
Get the contents of the block.
|
boolean |
equals(java.lang.Object obj) |
Block |
expandTabs()
Replace tabs with spaces, assuming tab stops are located as usual at n*8 + 1
|
java.lang.String |
find(java.lang.String search)
Return the first string in the block that contains the search string.
|
int |
hashCode() |
boolean |
hasTag(java.lang.String tag)
Return whether or not a block has a particular tag.
|
boolean |
hasTags(java.lang.String... tags)
Return whether or not a block has ALL of the listed tags.
|
Block |
instantiateTemplate(java.util.Map<java.lang.String,java.lang.String> parameters)
replace all occurrences of @KEY@ with parameters.get( KEY ).
|
Pair<Block,Block> |
splitFirst()
Split block into two blocks, with only the
first line of the original Block in result.first().
|
Block |
substitute(java.util.List<? extends Pair<java.lang.String,java.lang.String>> substitutions) |
java.lang.String |
toString() |
void |
write(FileWrapper fw)
Write block to FileWrapper.
|
public Block(java.util.List<java.lang.String> data)
public Block(Block block)
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public void addTag(java.lang.String tag)
public boolean hasTag(java.lang.String tag)
public boolean hasTags(java.lang.String... tags)
public java.util.List<java.lang.String> contents()
public void addBeforeFirst(java.lang.String str)
public void addAfterLast(java.lang.String str)
public void addPrefixToAll(java.lang.String prefix)
public java.lang.String find(java.lang.String search)
public void write(FileWrapper fw) throws java.io.IOException
java.io.IOException
public Block instantiateTemplate(java.util.Map<java.lang.String,java.lang.String> parameters)
public Block expandTabs()
public Block substitute(java.util.List<? extends Pair<java.lang.String,java.lang.String>> substitutions)