org.quasiliteral.astro
Interface Astro

All Superinterfaces:
AstroArg
All Known Implementing Classes:
AstroAST, AstroToken, QAstro, Term

public interface Astro
extends AstroArg

Untamed:


Method Summary
 Astro build(AstroBuilder builder)
          Enabled: Builds an Astro tree like this one, but the kind of Astro that's made by this builder.
 ConstList getArgs()
          Enabled: @return :AstroArg[]; In most domains, AstroArg is the same as Astro, so this usually returns :Astro[].
 Object getOptArgData()
          Enabled: Equivalent to 'getArgs()[0].getOptData()'.
 Object getOptArgData(short tagCode)
          Enabled: Like getOptArgData/0, but first requires getOptTagCode() == tagCode.
 String getOptArgString(short tagCode)
          Enabled: A convenience equivalent to '((Twine)getOptArgData(tagCode)).bare()'
 Object getOptData()
          Enabled: If this Astro represents a literal-data token, then this is the data, and getTag() must represent the canonical corresponding token-type for this kind of data in this schema.
 String getOptString()
          Enabled: A convenience equivalent to '((Twine)getOptData()).bare()'
 short getOptTagCode()
          Enabled: Equivalent to 'getTag().getOptTypeCode()'
 AstroTag getTag()
          Enabled: Represents the token-type of the functor.
 Astro withArgs(ConstList args)
          Enabled: Given that this Astro is a leaf (has no arguments), this returns an Astro just like it but with these arguments.
 Astro withoutArgs()
          Enabled: An Astro just like this one, but without any arguments, which is therefore a leaf (and so may be a Token).
 
Methods inherited from interface org.quasiliteral.astro.AstroArg
getOptSpan
 

Method Detail

build

public Astro build(AstroBuilder builder)
Enabled: Builds an Astro tree like this one, but the kind of Astro that's made by this builder.

Pattern-wise, the builder functions here as both as a factory, and sort-of as a visitor. It's not quite a visitor, in that it only sees the tree in bottom-up order.


getTag

public AstroTag getTag()
Enabled: Represents the token-type of the functor.


getOptTagCode

public short getOptTagCode()
Enabled: Equivalent to 'getTag().getOptTypeCode()'


getOptData

public Object getOptData()
Enabled: If this Astro represents a literal-data token, then this is the data, and getTag() must represent the canonical corresponding token-type for this kind of data in this schema.

If the getTag() has no schema, then its getTagName() must be the corresponding token-type name.


getOptString

public String getOptString()
Enabled: A convenience equivalent to '((Twine)getOptData()).bare()'


getOptArgData

public Object getOptArgData()
Enabled: Equivalent to 'getArgs()[0].getOptData()'.

This exists as an optimization for composite Tokens, which act like 1-argument Astros, where the 1-argument is a data argument. This operation allows us to avoid creating a singleton argument list just to access this data.

getOptArgData/1 should normally be used instead


getOptArgData

public Object getOptArgData(short tagCode)
Enabled: Like getOptArgData/0, but first requires getOptTagCode() == tagCode.


getOptArgString

public String getOptArgString(short tagCode)
Enabled: A convenience equivalent to '((Twine)getOptArgData(tagCode)).bare()'


getArgs

public ConstList getArgs()
Enabled: @return :AstroArg[]; In most domains, AstroArg is the same as Astro, so this usually returns :Astro[].


withoutArgs

public Astro withoutArgs()
Enabled: An Astro just like this one, but without any arguments, which is therefore a leaf (and so may be a Token).

Even in the mutable AST domain, if this Astro has arguments, 'withoutArgs()' makes a copy rather than modifying this Astro in place.


withArgs

public Astro withArgs(ConstList args)
Enabled: Given that this Astro is a leaf (has no arguments), this returns an Astro just like it but with these arguments.

Even in the mutable AST domain, if 'args' is non-empty, 'withArgs(..)' makes a copy rather than modifying this Astro in place.

If this Astro is not a leaf, this throws an exception even if 'args' is empty.



comments?