cgp.runtime
Class StringType
java.lang.Object
|
+--cgp.runtime.Type
|
+--cgp.runtime.StringType
- public class StringType
- extends Type
Field Summary |
private java.lang.String |
value
|
Constructor Summary |
StringType(java.lang.String s)
|
Methods inherited from class cgp.runtime.Type |
andOp,
divideOp,
getAttr,
getKBStack,
getNthOp,
getScopeStack,
getType,
invokeMemberFunc,
isOp,
modulusOp,
multiplyOp,
negateOp,
notOp,
operationError,
orOp,
setAttr,
setKBStack,
setNthOp,
setScopeStack,
setType,
subtractOp |
Methods inherited from class java.lang.Object |
,
clone,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
wait,
wait,
wait |
value
private java.lang.String value
StringType
public StringType(java.lang.String s)
getValue
public java.lang.String getValue()
toString
public java.lang.String toString()
- Overrides:
- toString in class java.lang.Object
equals
public boolean equals(java.lang.Object other)
- Overrides:
- equals in class java.lang.Object
gtOp
public Type gtOp(Type other)
- Overrides:
- gtOp in class Type
ltOp
public Type ltOp(Type other)
- Overrides:
- ltOp in class Type
geOp
public Type geOp(Type other)
- Overrides:
- geOp in class Type
leOp
public Type leOp(Type other)
- Overrides:
- leOp in class Type
eqOp
public Type eqOp(Type other)
- Overrides:
- eqOp in class Type
neOp
public Type neOp(Type other)
- Overrides:
- neOp in class Type
addOp
public Type addOp(Type other)
- Concatenation of this string to any other object to form
a new string. This handles the case where in the expression
x + y, x is a string and y is any type.
- Overrides:
- addOp in class Type
getLength
public NumberType getLength()
- Getter and setter methods for pCG attributes.
substring
public Type substring(NumberType start,
NumberType end)
- Returns a substring of this string where start and end are >= 1
and <= length of string. When indices are out of bounds, the
returned value is undefined.
substring
public Type substring(NumberType start)
- Returns a substring of this string from start to the end of
the string, where start is >= 1. When indices are out of bounds,
the returned value is undefined.
index
public NumberType index(StringType s)
- Returns the index (>= 1) of the first occurrence of
s in this string, or -1 if it is not found.
replace
public StringType replace(StringType s,
StringType t)
- Replace all occurrences of the single-character string
s with the single-character string t in this string. Any
error leaves the string unchanged.
toBoolean
public BooleanType toBoolean()
toNumber
public Type toNumber()
toGraph
public GraphType toGraph()