|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--org.quasiliteral.quasiterm.QAstroArg
|
+--org.quasiliteral.quasiterm.QAstro
|
+--org.quasiliteral.quasiterm.QTerm
Untamed: A quasi-literal Term, that matches or generates an actual Astro.
| Field Summary | |
private int |
myHeight
Just used to decide how to pretty print. |
private ConstList |
myQArgs
|
private QAstro |
myQFunctor
|
static StaticMaker |
QTermMaker
Enabled: |
(package private) static long |
serialVersionUID
|
| Fields inherited from class org.quasiliteral.quasiterm.QAstroArg |
EListGuard, EMPTY_INDEX, myBuilder, myOptSpan |
| Fields inherited from interface org.erights.e.elib.tables.Selfless |
HONORARY, HONORED_NAMES |
| Fields inherited from interface org.erights.e.elib.serial.PassByConstruction |
HONORARY, HONORED_NAMES |
| Fields inherited from interface org.erights.e.elib.serial.Persistent |
HONORARY, HONORED_NAMES |
| Constructor Summary | |
(package private) |
QTerm(AstroBuilder builder,
QAstro qFunctor,
ConstList qArgs)
Makes a QTerm that matches or generates a Astro. |
| Method Summary | |
(package private) QAstro |
asFunctor()
Returns a variant of this Astro that may serve as a functor of a QTerm. |
(package private) void |
endShape(FlexList optBindings,
int[] prefix,
int shape)
Just delegate to all children |
ConstList |
getArgs()
Enabled: @return :(ConstList of(QAstroArg)) |
int |
getHeight()
Enabled: |
Object |
getOptData()
Enabled: Either literal data or null. |
String |
getOptString()
Enabled: |
short |
getOptTagCode()
Enabled: |
Object[] |
getSpreadUncall()
Enabled: Uses 'QTermMaker(myBuilder, myQFunctor, myQArgs)' |
AstroTag |
getTag()
Enabled: Represents the token-type of the functor of this term. |
int |
matchBindSlice(ConstList args,
ConstList specimenList,
FlexList bindings,
int[] index)
Enabled: Attempts to match against the Astro specimenList[0]. |
void |
prettyPrintOn(TextWriter out)
Enabled: |
AstroArg |
qbuild(QuasiBuilder qbuilder)
Enabled: |
(package private) int |
startShape(ConstList args,
FlexList optBindings,
int[] prefix,
int shapeSoFar)
A QTerm has whatever shape its children agree on |
ConstList |
substSlice(ConstList args,
int[] index)
Enabled: @return A single list of a single Astro, whose functor is based on literal functor info of this qterm, and whose args are the concatentation of the substSlice of the qargs of this qterm. |
Astro |
withArgs(ConstList qArgs)
Enabled: |
Astro |
withoutArgs()
Enabled: Returns a QTerm like with one, but without args. |
| Methods inherited from class org.quasiliteral.quasiterm.QAstro |
build, getOptArgData, getOptArgData, getOptArgString, matchBind, matchBind, substitute |
| Methods inherited from class org.quasiliteral.quasiterm.QAstroArg |
__printOn, asText, getOptSpan, toString |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.quasiliteral.astro.AstroArg |
getOptSpan |
| Field Detail |
static final long serialVersionUID
public static final StaticMaker QTermMaker
private final QAstro myQFunctor
private final ConstList myQArgs
private transient int myHeight
Initialized lazily. 0 if uninitialized, so does not need to be recalculated on revival.
| Constructor Detail |
QTerm(AstroBuilder builder,
QAstro qFunctor,
ConstList qArgs)
The invariants of a QTerm are not checked here, but rather are enforced by the callers in this class and in QTermBuilder.
builder - Used to build the results of a substituteqFunctor - Matches of generates functor informationqArgs - This QTerm's argument list -- a list of QAstroArg| Method Detail |
public Object[] getSpreadUncall()
public AstroArg qbuild(QuasiBuilder qbuilder)
qbuild in class QAstroArgpublic AstroTag getTag()
public short getOptTagCode()
getOptTagCode in interface AstrogetOptTagCode in class QAstropublic Object getOptData()
public String getOptString()
getOptString in interface AstrogetOptString in class QAstropublic ConstList getArgs()
public Astro withoutArgs()
Unlike myQFunctor, this will only match a Term of zero-arity.
public Astro withArgs(ConstList qArgs)
public ConstList substSlice(ConstList args,
int[] index)
substSlice in class QAstroArgindex - Further indexes after a hole's hole-num. For example,
If a dollar-hole's hole-num is 3 and index is [4,5], then
the dollar-hole would evaluate to args[3][4][5].
public int matchBindSlice(ConstList args,
ConstList specimenList,
FlexList bindings,
int[] index)
Matches the arg list by a naive greedy algorithm.
matchBindSlice in class QAstroArgargs - See the doc on 'args' in #substitute(Object[],
String)specimenList - :(ConstList of(Astro))bindings - Like 'args', but by extraction from specimenindex - Further indexes after a hole's hole-num. For example,
If a dollar-hole's hole-num is 3 and index is [4,5], then
the dollar-hole would access args[3][4][5]. Similarly,
an at-hole with hole-num 3 would store into
bindings[3][4][5].
public int getHeight()
getHeight in class QAstroArg
public void prettyPrintOn(TextWriter out)
throws IOException
prettyPrintOn in class QAstroArgIOExceptionQAstro asFunctor()
QAstroIf this Astro (or derivatives) should not be used as a functor, then this operation should throw.
asFunctor in class QAstro
int startShape(ConstList args,
FlexList optBindings,
int[] prefix,
int shapeSoFar)
startShape in class QAstroArg
void endShape(FlexList optBindings,
int[] prefix,
int shape)
endShape in class QAstroArg
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||