|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hawk.ds.Element
public class Element
This is a placeholder for perspective element in the input string.
Field Summary | |
---|---|
static java.util.regex.Pattern |
ARRAY_EXISTENCE_PATTERN
RegEx to parse variable in the expression. |
protected java.lang.String |
element
Raw element data. |
protected boolean |
execFunction
Boolean if this element is a exec function script. |
protected boolean |
execModule
Boolean if this element is a exec module script. |
protected boolean |
isVariable
Boolean to indiate if the element is variable. |
protected int |
pos
Starting position of raw element data. |
protected boolean |
structAsgnmnt
Boolean if this element is a exec module script. |
protected IScript |
value
|
static java.util.regex.Pattern |
VARIABLE_EXISTENCE_PATTERN
RegEx to parse variable in the expression. |
static java.util.regex.Pattern |
VARIABLE_PATTERN
RegEx to parse variable in the expression. |
Constructor Summary | |
---|---|
protected |
Element(java.lang.String element,
int pos)
|
Method Summary | |
---|---|
int |
compareTo(java.lang.Object herElement)
|
boolean |
equals(java.lang.Object herElement)
|
boolean |
flip()
This flips "(" into ")" and vice versa. |
java.lang.String |
getElement()
|
static Element |
getElement(int pos)
|
int |
getPos()
|
int |
getPrecedence()
This returns the precedence of operators supported in hawk. |
IScript |
getValue()
|
int |
hashCode()
|
boolean |
hasHigherPrecedence(Element otherOpr)
|
boolean |
isClosingClubber()
This checks for ")" |
boolean |
isClubber()
This checks for the element is either "(" or ")" |
boolean |
isConstant()
|
boolean |
isDouble()
|
boolean |
isExecFunction()
|
boolean |
isExecModule()
|
boolean |
isIsVariable()
This checks if the the element is variable... |
boolean |
isLeft(Element herElement)
This checks if the element's position left to the other element |
boolean |
isOperand()
This checks if the element is operand |
boolean |
isOperator()
If this is a operator |
boolean |
isRight(Element herElement)
This checks if the element's position right to the other element |
boolean |
isStartingClubber()
This checks for "(" |
boolean |
isString()
|
boolean |
isStructAsgnmnt()
|
boolean |
isVariable()
|
static void |
main(java.lang.String[] args)
|
static java.util.List<Element> |
parseElements(java.lang.String equation)
This parses input equation into list of Element |
static java.util.List<Element> |
reverse(java.util.List<Element> list)
This returns the input list of elements . |
void |
setElement(java.lang.String element)
|
void |
setExecFunction(boolean execFunction)
|
void |
setExecModule(boolean execModule)
|
void |
setIsVariable(boolean isVariable)
|
void |
setPos(int pos)
|
void |
setStructAsgnmnt(boolean structAsgnmnt)
|
void |
setValue(IScript value)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.lang.String element
protected int pos
protected boolean isVariable
protected boolean execFunction
protected boolean execModule
protected boolean structAsgnmnt
protected IScript value
public static final java.util.regex.Pattern VARIABLE_PATTERN
public static final java.util.regex.Pattern VARIABLE_EXISTENCE_PATTERN
public static final java.util.regex.Pattern ARRAY_EXISTENCE_PATTERN
Constructor Detail |
---|
protected Element(java.lang.String element, int pos)
element
- elementpos
- starting position of elementMethod Detail |
---|
public IScript getValue()
public void setValue(IScript value)
public java.lang.String getElement()
public void setElement(java.lang.String element)
public int getPos()
public void setPos(int pos)
public boolean isOperator()
public boolean isStartingClubber()
public boolean isClosingClubber()
public boolean flip()
public boolean isClubber()
public boolean isOperand()
public boolean isIsVariable()
public void setIsVariable(boolean isVariable)
public boolean isExecFunction()
public void setExecFunction(boolean execFunction)
public boolean isExecModule()
public void setExecModule(boolean execModule)
public boolean isStructAsgnmnt()
public void setStructAsgnmnt(boolean structAsgnmnt)
public boolean isVariable()
public boolean isConstant()
public boolean isDouble()
public boolean isString()
public static Element getElement(int pos)
public final int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public final boolean equals(java.lang.Object herElement)
equals
in class java.lang.Object
public int compareTo(java.lang.Object herElement)
compareTo
in interface java.lang.Comparable
public boolean isLeft(Element herElement)
herElement
- the input element which is to be checked with this element for position
public boolean isRight(Element herElement)
herElement
- the input element which is to be checked with this element for position
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
public static java.util.List<Element> parseElements(java.lang.String equation) throws HawkException
equation
- input equation to be parsed.
HawkException
public static java.util.List<Element> reverse(java.util.List<Element> list)
list
- list of elements to be reversed.
public int getPrecedence() throws HawkException
HawkException
public boolean hasHigherPrecedence(Element otherOpr) throws HawkException
HawkException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |