Class VariableElement
Object
com.owenfeehan.pathpatternfinder.patternelements.PatternElement
com.owenfeehan.pathpatternfinder.patternelements.resolved.ResolvedPatternElement
com.owenfeehan.pathpatternfinder.patternelements.resolved.VariableElement
public abstract class VariableElement extends ResolvedPatternElement
A
PatternElement that is resolved and varies across the list of values.- Author:
- Owen Feehan
-
Constructor Summary
Constructors Modifier Constructor Description protectedVariableElement(List<String> values)Creates for a list of values. -
Method Summary
Modifier and Type Method Description booleanequals(Object obj)protected List<String>getValues()The values that describe the variable element, identical to those passed to the constructor.booleanhasConstantValue()Does the element never vary?inthashCode()voidreverse()Reverses the current element.StringvalueAt(int index)The value of the element for a particular string used during pattern extraction.Methods inherited from class com.owenfeehan.pathpatternfinder.patternelements.resolved.ResolvedPatternElement
isResolved, resolveMethods inherited from class com.owenfeehan.pathpatternfinder.patternelements.PatternElement
describe, extractElementFrom, reverseReturn, toString
-
Constructor Details
-
VariableElement
Creates for a list of values.- Parameters:
values- the varying values, respectively corresponding to each string from which the pattern was extracted.
-
-
Method Details
-
hasConstantValue
public boolean hasConstantValue()Description copied from class:PatternElementDoes the element never vary?- Specified by:
hasConstantValuein classPatternElement- Returns:
- true iff this element have a constant value. Otherwise the element has multiple
possible values. Iff true,
PatternElement.describe(int)should return this constant value
-
reverse
public void reverse()Description copied from class:PatternElementReverses the current element.i.e. if the string was previously applied from left to right it is now, right to left and vice-versa
- Specified by:
reversein classPatternElement
-
equals
- Overrides:
equalsin classPatternElement
-
hashCode
public int hashCode()- Overrides:
hashCodein classPatternElement
-
valueAt
Description copied from class:PatternElementThe value of the element for a particular string used during pattern extraction.When {
PatternElement.hasConstantValue()is true, theindexis irrelevant, as the same value will always be returned.The value exists when {
PatternElement.isResolved()is true, and should only be called on elements in this state. Otherwise, anIllegalStateExceptionwill be thrown.- Specified by:
valueAtin classPatternElement- Parameters:
index- the index (zero-valued) of the corresponding string (as passed during pattern extraction to initialize elements) for which we wish to establish a value.- Returns:
- the established value.
-
getValues
The values that describe the variable element, identical to those passed to the constructor.- Returns:
- the values.
-