|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectunsw.cse.framescript.Term
unsw.cse.framescript.Pattern
public class Pattern
This class implements the Pattern type in FrameScript.
Constructor Summary | |
---|---|
Pattern(Term t)
Creates a pattern with one element. |
|
Pattern(Term t,
Pattern p)
Creates a pattern where a term a placed at the head of another pattern. |
Method Summary | |
---|---|
Pattern |
append(Pattern p)
Appends a pattern to the end of a pattern. |
java.lang.String |
asString(int indentLevel,
boolean inPattern)
Turns the Term into a string. |
boolean |
equals(Term t)
Compares two Terms for equality. |
Term |
eval(Instance currentObject,
StackFrame frame)
Evaluates a Term. |
boolean |
fullMatch(unsw.cse.framescript.InputPattern input,
Instance current,
StackFrame frame)
Matches the Term to the current position in an input pattern. |
boolean |
isEmpty()
|
Term |
mapVars(FSList vars)
Maps atoms to variables from the list of variables. |
boolean |
match(unsw.cse.framescript.InputPattern input,
Instance current,
StackFrame frame)
Matches the Term to the current position in an input pattern. |
java.lang.String |
toString()
Turns the Term into a string. |
Methods inherited from class unsw.cse.framescript.Term |
---|
assign, indents |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Pattern(Term t)
t
- the only element in the patternpublic Pattern(Term t, Pattern p)
t
- term to be placed at the head of the patternp
- the pattern that follows the headMethod Detail |
---|
public Pattern append(Pattern p)
p
- pattern being appended to the end
public Term eval(Instance currentObject, StackFrame frame) throws FSException
Term
eval
in class Term
currentObject
- the enclosing instance frame for the code being evaluatedframe
- StackFrame that holds the values for any variables
FSException
- if any errors occur in performing the evaluationpublic boolean equals(Term t)
Term
equals
in class Term
t
- Term to be compared to
public Term mapVars(FSList vars) throws SyntaxError
Term
mapVars
in class Term
vars
- a list of variables to be mapped
SyntaxError
- if in performing the mapping it finds an invalid variable namepublic boolean match(unsw.cse.framescript.InputPattern input, Instance current, StackFrame frame) throws FSException
Term
match
in class Term
input
- the input the Term is being matched againstcurrent
- the enclosing instance frame for the code being evaluatedframe
- StackFrame that holds the values for any variables
FSException
- if any errors occur during the match processpublic boolean fullMatch(unsw.cse.framescript.InputPattern input, Instance current, StackFrame frame) throws FSException
Term
fullMatch
in class Term
input
- the input the Term is being matched againstcurrent
- the enclosing instance frame for the code being evaluatedframe
- StackFrame that holds the values for any variables
FSException
- if any errors occur during the match processpublic java.lang.String toString()
Term
toString
in class Term
public java.lang.String asString(int indentLevel, boolean inPattern)
Term
asString
in class Term
indentLevel
- indentation level to uses for any subsequent lines in the stringinPattern
- whether or not to format the string as though it is inside a pattern
public boolean isEmpty()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |