public class MatchRulePrinter extends java.lang.Object implements MatchRuleVisitor
asString( matchRule )
Constructor and Description |
---|
MatchRulePrinter()
Initialize the new instance with default values.
|
MatchRulePrinter(MatchRuleChars ruleCharacters)
Initialize the new instance with match rule characters.
|
Modifier and Type | Method and Description |
---|---|
protected void |
appendOperators(boolean andOperator,
boolean notOperator) |
protected void |
appendValue(java.lang.String value) |
protected void |
appendValueList(java.lang.String[] values) |
java.lang.String |
asString(MatchRule matchRule)
Returns the specified match rule as a string.
|
void |
attribute(java.lang.String name,
MatchRuleCompareOperator compareOperator,
java.lang.String[] values,
boolean andOperator,
boolean notOperator)
This method will be called for each attribute.
|
protected boolean |
containsSpecialCharacter(java.lang.String value) |
void |
endGroup()
This method will be called for each group end occurence.
|
protected char |
getAndChar()
Returns the character for AND operations ( DEFAULT = '&' )
|
protected java.lang.StringBuffer |
getBuffer() |
protected char |
getGroupEndChar()
Returns the character that ends a logical group ( DEFAULT = ')' )
|
protected char |
getGroupStartChar()
Returns the character that starts a logical group ( DEFAULT = '(' )
|
protected char |
getNotChar()
Returns the character for NOT operations ( DEFAULT = '!' )
|
protected char |
getOrChar()
Returns the character for OR operations ( DEFAULT = '|' )
|
protected MatchRuleChars |
getRuleChars() |
protected char |
getValueEndChar()
Returns the character ends a list of values ( DEFAULT = '}' )
|
protected char |
getValueSeparatorChar()
Returns the character for separation of values ( DEFAULT = ',' )
|
protected char |
getValueStartChar()
Returns the character that starts a list of values ( DEFAULT = '{' )
|
protected boolean |
groupStarted() |
protected void |
groupStarted(boolean newValue) |
protected void |
setAndChar(char newValue)
Sets the character for AND operations
|
protected void |
setBuffer(java.lang.StringBuffer newValue) |
protected void |
setGroupEndChar(char newValue)
Sets the character that ends a group
|
protected void |
setGroupStartChar(char newValue)
Sets the character that starts a group
|
protected void |
setNotChar(char newValue)
Sets the character for NOT operations
|
protected void |
setOrChar(char newValue)
Sets the character for OR operations
|
protected void |
setRuleChars(MatchRuleChars newValue) |
protected void |
setValueEndChar(char newValue)
Sets the character that ends a value list
|
protected void |
setValueSeparatorChar(char newValue)
Sets the character that separates values in a value list
|
protected void |
setValueStartChar(char newValue)
Sets the character that starts a value list
|
void |
startGroup(boolean andOperator,
boolean notOperator)
This method will be called for each start of a new group.
|
boolean |
useNewSyntax()
Returns true, if the printer uses the new syntax which is using an equals
character rather than the curly brackets for single values.
|
void |
useNewSyntax(boolean newValue)
Sets if the printer uses the new syntax.
|
protected boolean |
useSetSyntax(MatchRuleCompareOperator compareOperator,
java.lang.String[] values) |
void |
walkThroughFinished()
This method will be called when the MatchRule has finished to walk
through its elements.
|
void |
walkThroughInit()
This method will be called right before the MatchRule walks
through its elements.
|
public MatchRulePrinter()
public MatchRulePrinter(MatchRuleChars ruleCharacters)
public boolean useNewSyntax()
public void useNewSyntax(boolean newValue)
public void walkThroughInit()
walkThroughInit
in interface MatchRuleVisitor
public void walkThroughFinished()
walkThroughFinished
in interface MatchRuleVisitor
public void startGroup(boolean andOperator, boolean notOperator)
startGroup
in interface MatchRuleVisitor
andOperator
- If true it is an AND combination otherwise it is ORnotOperator
- Is only true for a NOT operationpublic void endGroup()
endGroup
in interface MatchRuleVisitor
public void attribute(java.lang.String name, MatchRuleCompareOperator compareOperator, java.lang.String[] values, boolean andOperator, boolean notOperator)
attribute
in interface MatchRuleVisitor
name
- The attribute's namecompareOperator
- The operator used to compare valuesvalues
- All values the attrubute my match (implicit OR combination !)andOperator
- If true it is an AND combination otherwise it is ORnotOperator
- Is only true for a NOT operationpublic java.lang.String asString(MatchRule matchRule)
protected void appendOperators(boolean andOperator, boolean notOperator)
protected void appendValueList(java.lang.String[] values)
protected void appendValue(java.lang.String value)
protected boolean useSetSyntax(MatchRuleCompareOperator compareOperator, java.lang.String[] values)
protected char getAndChar()
protected void setAndChar(char newValue)
protected char getOrChar()
protected void setOrChar(char newValue)
protected char getNotChar()
protected void setNotChar(char newValue)
protected char getValueSeparatorChar()
protected void setValueSeparatorChar(char newValue)
protected char getValueStartChar()
protected void setValueStartChar(char newValue)
protected char getValueEndChar()
protected void setValueEndChar(char newValue)
protected char getGroupStartChar()
protected void setGroupStartChar(char newValue)
protected char getGroupEndChar()
protected void setGroupEndChar(char newValue)
protected boolean containsSpecialCharacter(java.lang.String value)
protected java.lang.StringBuffer getBuffer()
protected void setBuffer(java.lang.StringBuffer newValue)
protected MatchRuleChars getRuleChars()
protected void setRuleChars(MatchRuleChars newValue)
protected boolean groupStarted()
protected void groupStarted(boolean newValue)