JavaScript is disabled on your browser.
Skip navigation links
gnu.expr

Class CaseExp

  • All Implemented Interfaces:
    gnu.kawa.format.Printable, Named, javax.xml.transform.SourceLocator, org.xml.sax.Locator


    public class CaseExp
    extends Expression 
    This class represents a case expression
     case case-key case-clause+
     case case-key case-clause* case-else-clause
     case-key ::= expression
     case-clause ::=  ((datum* ) expression+ )
     |  ((datum* ) => expression )
     case-else-clause ::= (else expression+)
     |  (else => expression )
     
    • Constructor Detail

      • CaseExp

        public CaseExp(Expression key,
         CaseExp.CaseClause[] clauses)
        Constructor for a case expression with no else clause. Arguments must be non null. clauses parameter must contain at least one CaseClause.
    • Method Detail

      • apply

        public void apply(CallContext ctx)
         throws java.lang.Throwable
        Description copied from class: Expression
        Evaluate the expression. This is named apply rather than eval so it is compatible with the full-tail-call calling convention, and we can stash an Expression in CallContext's proc field. FIXME - are we making use of this?
        Overrides:
        apply in class Expression
        Throws:
        java.lang.Throwable
      • print

        public void print(gnu.kawa.io.OutPort out)
        Specified by:
        print in class Expression
      • calculateDatumValue

        protected java.lang.Object calculateDatumValue(Expression datum)
        Given the expression generated from a datum returns the value of the datum as an Object.
      • calculateDatumsType

        protected Type calculateDatumsType()
        Computes the union type of the case expression datums. Useful to know if the datums are all integer values.
      • searchValue

        public boolean searchValue(java.lang.Object keyValue)
        Search a clause containing the specified key. If the clause is found returns true, false otherwise.
      • selectCase

        public Expression selectCase(java.lang.Object keyValue)
        Search for a clause containing the specified key. If the clause is found returns the corresponding expression.
Skip navigation links

AltStyle によって変換されたページ (->オリジナル) /