public class ArithmeticFactorStateObject extends AbstractStateObject
arithmetic_factor ::= [{+|-}] arithmetic_primary
ArithmeticFactor
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ARITHMETIC_SIGN_PROPERTY
Notifies the arithmetic sign property has changed.
|
static java.lang.String |
STATE_OBJECT_PROPERTY
Notifies the state object property has changed.
|
Constructor and Description |
---|
ArithmeticFactorStateObject(StateObject parent)
Creates a new
ArithmeticFactorStateObject . |
ArithmeticFactorStateObject(StateObject parent,
boolean plusSign,
StateObject stateObject)
Creates a new
ArithmeticFactorStateObject . |
Modifier and Type | Method and Description |
---|---|
void |
accept(StateObjectVisitor visitor)
Visits this
StateObject by the given visitor . |
protected void |
addChildren(java.util.List<StateObject> children)
Adds the children of this
StateObject to the given list. |
void |
addMinus()
Makes sure the
- sign is used. |
void |
addPlus()
Makes sure the
+ sign is used. |
java.lang.String |
getArithmeticSign()
Returns the arithmetic sign this expression is actually representing.
|
ArithmeticFactor |
getExpression()
Returns the actual parsed object if this
StateObject representation of the JPQL query
was created by parsing an existing JPQL query. |
StateObject |
getStateObject()
Returns the
StateObject that represents the arithmetic primary expression. |
boolean |
hasMinusSign()
Determines whether the arithmetic sign is the minus sign.
|
boolean |
hasPlusSign()
Determines whether the arithmetic sign is the plus sign.
|
boolean |
hasStateObject()
Determines whether an
StateObject representing the arithmetic primary expression
exists. |
boolean |
isEquivalent(StateObject stateObject)
Determines whether the given
StateObject is equivalent to this one, i.e. the
information of both StateObject is the same. |
void |
parse(java.lang.String jpqlFragment)
Parses the given JPQL fragment to become the new arithmetic primary.
|
void |
setArithmeticSign(boolean plusSign)
Sets the arithmetic sign this expression is actually representing.
|
void |
setExpression(ArithmeticFactor expression)
Keeps a reference of the
parsed object object, which should only be
done when this object is instantiated during the conversion of a parsed JPQL query into
StateObjects . |
void |
setStateObject(StateObject stateObject)
Returns the
StateObject that represents the arithmetic primary expression. |
void |
toggleArithmeticSign()
Toggles the arithmetic sign, plus becomes minus and vice versa.
|
protected void |
toTextInternal(java.lang.Appendable writer)
Prints out a string representation of this
StateObject , which should not be used to
define a true string representation of a JPQL query but should be used for
debugging purposes. |
acceptUnknownVisitor, acceptUnknownVisitor, addProblems, addPropertyChangeListener, areEquivalent, buildProblem, buildProblem, buildStateObject, buildStateObjects, checkParent, children, decorate, equals, findIdentificationVariable, firePropertyChanged, getChangeSupport, getDeclaration, getDecorator, getGrammar, getManagedTypeProvider, getParent, getQueryBuilder, getRoot, getType, getType, getTypeHelper, getTypeRepository, hashCode, initialize, isDecorated, parent, parent, parent, removePropertyChangeListener, setExpression, setParent, toString, toString, toStringInternal, toStringItems, toText
public static final java.lang.String ARITHMETIC_SIGN_PROPERTY
public static final java.lang.String STATE_OBJECT_PROPERTY
public ArithmeticFactorStateObject(StateObject parent)
ArithmeticFactorStateObject
.parent
- The parent of this state object, which cannot be null
java.lang.NullPointerException
- The given parent cannot be null
public ArithmeticFactorStateObject(StateObject parent, boolean plusSign, StateObject stateObject)
ArithmeticFactorStateObject
.parent
- The parent of this state object, which cannot be null
stateObject
- The StateObject
that represents the arithmetic primary expressionjava.lang.NullPointerException
- The given parent cannot be null
public void accept(StateObjectVisitor visitor)
StateObject
by the given visitor
.visitor
- The visitor
to visit this objectprotected void addChildren(java.util.List<StateObject> children)
StateObject
to the given list.addChildren
in class AbstractStateObject
children
- The list used to store the childrenpublic void addMinus()
-
sign is used.public void addPlus()
+
sign is used.public java.lang.String getArithmeticSign()
public ArithmeticFactor getExpression()
StateObject
representation of the JPQL query
was created by parsing an existing JPQL query.getExpression
in interface StateObject
getExpression
in class AbstractStateObject
StateObject
or null
when the JPQL query is manually created (i.e. not from a string)public StateObject getStateObject()
StateObject
that represents the arithmetic primary expression.StateObject
that represents the arithmetic primary expression or
null
if none was specifiedpublic boolean hasMinusSign()
true
if the arithmetic sign is the minus sign; false
if it
is the plus signpublic boolean hasPlusSign()
true
if the arithmetic sign is the plus sign; false
if it
is the minus signpublic boolean hasStateObject()
StateObject
representing the arithmetic primary expression
exists.true
if there is the arithmetic primary expression exists; false
otherwisepublic boolean isEquivalent(StateObject stateObject)
StateObject
is equivalent to this one, i.e. the
information of both StateObject
is the same.isEquivalent
in interface StateObject
isEquivalent
in class AbstractStateObject
stateObject
- The StateObject
to compare its content to this onetrue
if both object are equivalent; false
otherwisepublic void parse(java.lang.String jpqlFragment)
jpqlFragment
- A portion of a query that will be parsed and the StateObject
that
was created will become the new arithmetic primary of this ArithmeticFactorStateObject
public void setArithmeticSign(boolean plusSign)
plusSign
- The single character value of the arithmetic sign: '+' (true
) or
'-' (false
)public void setExpression(ArithmeticFactor expression)
parsed object
object, which should only be
done when this object is instantiated during the conversion of a parsed JPQL query into
StateObjects
.expression
- The parsed object
representing an arithmetic
factor expressionpublic void setStateObject(StateObject stateObject)
StateObject
that represents the arithmetic primary expression.stateObject
- The StateObject
that represents the arithmetic primary expression
or null
if none was specifiedpublic void toggleArithmeticSign()
protected void toTextInternal(java.lang.Appendable writer) throws java.io.IOException
StateObject
, which should not be used to
define a true
string representation of a JPQL query but should be used for
debugging purposes.toTextInternal
in class AbstractStateObject
writer
- The writer used to print out the string representationjava.io.IOException
- This should never happens, it is only required because Appendable
is used instead of any concrete class