cgp.runtime
Class Type
java.lang.Object
|
+--cgp.runtime.Type
- Direct Known Subclasses:
- BooleanType, ConceptType, FileType, FunctionType, GraphType, KBase, LambdaType, ListType, NumberType, ProcessType, StringType, UndefinedType, Util, Window
- public abstract class Type
- extends java.lang.Object
Constructor Summary |
protected |
Type()
|
Methods inherited from class java.lang.Object |
,
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
toString,
wait,
wait,
wait |
type
private java.lang.String type
scopeStack
private static ScopeStack scopeStack
kbStack
private static KnowledgeBaseStack kbStack
Type
protected Type()
setType
protected void setType(java.lang.String type)
operationError
protected void operationError(java.lang.String msg)
orOp
public Type orOp(Type other)
andOp
public Type andOp(Type other)
gtOp
public Type gtOp(Type other)
ltOp
public Type ltOp(Type other)
geOp
public Type geOp(Type other)
leOp
public Type leOp(Type other)
eqOp
public Type eqOp(Type other)
neOp
public Type neOp(Type other)
isOp
public Type isOp(Type other)
- Is this type of the type specified by the string value other.
addOp
public Type addOp(Type other)
- Concatenation of this value to a string via toString().
This handles the case where in the expression x + y,
y is a string and x is any type.
One problem with this approach is that it presupposes
the existence of the subclass StringType. I guess this
is okay if pCG's type system is viewed hollistically.
A numerical subclass would of course override this method
to handle arithmetic addition if the second operand (y) is
also a numeric type. A list subclass *could* override this method
to handle addition to the end of the list, where the first operand
(x) is a list, and the second operand (y) is any other type.
subtractOp
public Type subtractOp(Type other)
multiplyOp
public Type multiplyOp(Type other)
divideOp
public Type divideOp(Type other)
modulusOp
public Type modulusOp(Type other)
negateOp
public Type negateOp()
notOp
public Type notOp()
getNthOp
public Type getNthOp(Type n)
- List access operator (e.g. x = y[n]).
setNthOp
public void setNthOp(Type n,
Type value)
- List assignment operator (e.g. x[2] = 3).
getType
public StringType getType()
- Getter and setter methods for attributes.
getAttr
public Type getAttr(java.lang.String name)
- Attribute access operator (e.g. t = x.type).
setAttr
public void setAttr(java.lang.String name,
Type x)
- Attribute assignment operator (e.g. t.referent = "foo").
invokeMemberFunc
public Type invokeMemberFunc(java.lang.String methodName,
java.lang.Object[] actuals)
- pCG member function invocation.
setScopeStack
public static void setScopeStack(ScopeStack stack)
getScopeStack
public static ScopeStack getScopeStack()
setKBStack
public static void setKBStack(KnowledgeBaseStack stack)
getKBStack
public static KnowledgeBaseStack getKBStack()