|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectubc.cs.JLog.Parser.pOperatorEntry
public abstract class pOperatorEntry
Abstract base class for entries in the pOperatorRegistry
. Each
operator entry subclass represents a type of prolog operator predicate at the
level needed for the parser (they are parse time representations).
Operator entries contain information about the corresponding operator, such
as associativity, precedence, and type.
Each instance of the operator entry is bound to parser representations of its
operands. Operator entries generate the corresponding real Prolog operator
objects and their real Prolog operand jTerms
.
Field Summary | |
---|---|
static int |
FX
|
static int |
FY
|
static int |
LEFT_ASSOCIATIVE
|
protected java.lang.String |
library
|
protected java.lang.String |
name
|
static int |
NON_ASSOCIATIVE
|
protected int |
priority
|
static int |
RIGHT_ASSOCIATIVE
|
protected int |
type
|
static int |
XF
|
static int |
XFX
|
static int |
XFY
|
static int |
YF
|
static int |
YFX
|
Constructor Summary | |
---|---|
pOperatorEntry(java.lang.String name,
int type,
int priority)
|
Method Summary | |
---|---|
abstract jTerm |
createOperator(jTerm l,
jTerm r)
The internal method for creating the jTerm representation of this operator
representation. |
jTerm |
createOperator(ubc.cs.JLog.Parser.pToken pt,
ubc.cs.JLog.Parser.pPacket lhs,
ubc.cs.JLog.Parser.pPacket rhs,
pVariableRegistry vars,
pTermToPacketHashtable phash)
Public interface for generating the real prolog term objects. |
int |
getAssociativity()
|
java.lang.String |
getLibrary()
Get the name of the library associated with this operator. |
java.lang.String |
getName()
|
int |
getPriority()
|
int |
getType()
|
boolean |
hasLHS()
|
boolean |
hasRHS()
|
boolean |
isAtomPermitted()
Determine if an unbound operator is not an error, or if it could be an atom |
boolean |
isNonAssociativeLeft()
|
boolean |
isNonAssociativeRight()
|
boolean |
isValidType()
|
boolean |
sameLibrary(java.lang.String lib)
|
void |
setLibrary(java.lang.String lib)
Set the name of the library associated with this operator. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int FX
public static final int FY
public static final int XFX
public static final int XFY
public static final int YFX
public static final int XF
public static final int YF
public static final int NON_ASSOCIATIVE
public static final int LEFT_ASSOCIATIVE
public static final int RIGHT_ASSOCIATIVE
protected java.lang.String name
protected int type
protected int priority
protected java.lang.String library
Constructor Detail |
---|
public pOperatorEntry(java.lang.String name, int type, int priority)
Method Detail |
---|
public java.lang.String getName()
public boolean hasLHS()
public boolean hasRHS()
public boolean isAtomPermitted()
true
if this operator could also be an atom if it is
unbound.public int getType()
public int getPriority()
public int getAssociativity()
public boolean isNonAssociativeLeft()
public boolean isNonAssociativeRight()
public boolean isValidType()
public void setLibrary(java.lang.String lib)
InvalidLibraryEntryException
in this case).
Operators default to a null
valued library.
lib
- The name of the library.public java.lang.String getLibrary()
null
.public boolean sameLibrary(java.lang.String lib)
public jTerm createOperator(ubc.cs.JLog.Parser.pToken pt, ubc.cs.JLog.Parser.pPacket lhs, ubc.cs.JLog.Parser.pPacket rhs, pVariableRegistry vars, pTermToPacketHashtable phash)
createOperator
to perform actual construction of term.
pt
- The parsing token representing the operator. Used for generating
information about the location of the operator in the input stream.lhs
- A parsing packet (possibly null) representing the left operand.
Used to generate the left hand jTerm
.rhs
- A parsing packet (possibly null) representing the right operand.
Used to generate the right hand jTerm
.vars
- A registery of named variables (ensures that variables of the same name
are the same instance). This should be the variable registry of the
rule or command containing this operator.phash
- A registery of terms and their corresponding parsing tokens.
jTerm
representing this operator and its operands.public abstract jTerm createOperator(jTerm l, jTerm r)
jTerm
representation of this operator
representation. Subclasses must override. The operands are provided, already created.
l
- The left hand jTerm
.r
- The right hand jTerm
.
jTerm
representing this operator and its operands.public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |