public class PatternElement extends QueryElement
QueryModel
query model. A pattern
is a description of an element that you wish to search for. It can be defined by
its value at least. It can also store a number of value or attribute constraints, or
conditions, that should be satisfied. These are stored as AttributeConstraint
or
PatternConstraint
elements and relate to this pattern only.Modifier and Type | Field and Description |
---|---|
protected java.util.ArrayList<AttributeConstraint> |
attrConstraints
A list of constraints that need to be satisfied on element attributes.
|
int |
level
Nesting level for this pattern.
|
protected java.util.ArrayList<PatternElement> |
nested
List of nested patterns
|
protected java.util.ArrayList<PatternConstraint> |
valueConstraints
A list of constraints that need to be satisfied on the pattern value.
|
caseSensitive, name, typeCondition, value, valueType, wildcards
Constructor and Description |
---|
PatternElement(java.lang.String type)
Create a new instance of PatternElement.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addValueConstraint(PatternConstraint constraintToAdd)
Add a new pattern constraint.
|
boolean |
containsValueConstraint(java.lang.String constraintType)
Return true if the pattern element contains a constraint of the specified typeCondition.
|
java.util.ArrayList<AttributeConstraint> |
getAttrConstraints()
Get all attribute constraints.
|
java.util.ArrayList<PatternElement> |
getNested()
Get all nested patterns.
|
java.lang.String |
getValue()
Get the element value.
|
PatternConstraint |
getValueConstraint(java.lang.String constraintType)
Return the first constraint of the specified typeCondition.
|
java.util.ArrayList<PatternConstraint> |
getValueConstraints()
Get all value constraints.
|
java.util.ArrayList<PatternConstraint> |
getValueConstraints(java.lang.String constraintType)
Return all constraints of the specified typeCondition.
|
void |
setAttrConstraints(java.util.ArrayList<AttributeConstraint> thisAttrConstraints)
Set the list of attribute constraints.
|
void |
setValue(java.lang.String thisValue)
Set the element name.
|
void |
setValueConstraints(java.util.ArrayList<PatternConstraint> thisValueConstraints)
Set the list of value constraints.
|
getCase, getName, getTypeOrCondition, getValueType, getWildcards, setBooleans, setName, setValueType
protected java.util.ArrayList<AttributeConstraint> attrConstraints
AttributeConstraint
.protected java.util.ArrayList<PatternConstraint> valueConstraints
PatternConstraint
.protected java.util.ArrayList<PatternElement> nested
public int level
public PatternElement(java.lang.String type)
type
- the type of query evaluation for the pattern, for example
QueryConst
.XML
, TEXT
, ASTEXT
or NUMERICAL
. Can be null.public boolean containsValueConstraint(java.lang.String constraintType)
constraintType
- the constraint typeCondition.public boolean addValueConstraint(PatternConstraint constraintToAdd)
constraintToAdd
- the constraint to add.public PatternConstraint getValueConstraint(java.lang.String constraintType)
constraintType
- the constraint typeCondition.public java.util.ArrayList<PatternConstraint> getValueConstraints(java.lang.String constraintType)
constraintType
- the constraint typeCondition.public void setValueConstraints(java.util.ArrayList<PatternConstraint> thisValueConstraints)
thisValueConstraints
- the list of value constraints.public java.util.ArrayList<PatternConstraint> getValueConstraints()
public void setAttrConstraints(java.util.ArrayList<AttributeConstraint> thisAttrConstraints)
thisAttrConstraints
- the list of attribute constraints.public java.util.ArrayList<AttributeConstraint> getAttrConstraints()
public void setValue(java.lang.String thisValue)
setValue
in class QueryElement
thisValue
- the element value.public java.lang.String getValue()
getValue
in class QueryElement
public java.util.ArrayList<PatternElement> getNested()