org.jclarion.clarion.runtime.expr
Class CExpr

java.lang.Object
  extended by org.jclarion.clarion.runtime.expr.CExpr
Direct Known Subclasses:
BoolExpr, CmpExpr, ConcatExpr, ConstExpr, LabelExpr, NegExpr, NotExpr, PowExpr, ProdExpr, SumExpr

public abstract class CExpr
extends java.lang.Object


Nested Class Summary
static class CExpr.DeepIterator
           
protected static class CExpr.GenericOp
           
static class CExpr.JoinIterator
           
static class CExpr.OneIterator
           
static class CExpr.OpIterable
           
static class CExpr.OpIterator
           
static class CExpr.TwoIterator
           
static class CExpr.ZeroIterator
           
 
Constructor Summary
CExpr()
           
 
Method Summary
abstract  void cast(CExprType type)
          Force expr type to a new cast
protected  void cast(java.lang.Iterable<CExpr> in, CExprType type)
           
abstract  java.util.Iterator<CExpr> directChildren()
           
abstract  ClarionObject eval()
          Generate result
abstract  boolean generateString(java.lang.StringBuilder out, boolean strict)
          Generate SQL capable string.
abstract  CExprType getType()
          Work out expression type
abstract  boolean isRecastableType()
          Return whether or not expression type is fixed.
protected  boolean isRecastableType(java.lang.Iterable<CExpr> in)
           
 java.util.Iterator<CExpr> iterator()
           
abstract  int precendence()
          Return order of precendence.
protected  CExprType resolveCasts(java.lang.Iterable<CExpr> in)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CExpr

public CExpr()
Method Detail

getType

public abstract CExprType getType()
Work out expression type

Returns:

cast

public abstract void cast(CExprType type)
Force expr type to a new cast


isRecastableType

public abstract boolean isRecastableType()
Return whether or not expression type is fixed. i.e. cannot be easily recast


eval

public abstract ClarionObject eval()
Generate result

Returns:

precendence

public abstract int precendence()
Return order of precendence. Low number = low order of precedence (i.e. bool etc) Hi number = high order of precendence (i.e. * % / etc ). Highest is constants When rebuilding expressions (i.e. SQL) you need to paran anything whose precendence is lower then yourself i.e. Sum(Prod,Prod) = 2*3 + 6*3 Prod(Sum,Sum) = (2+3) * (6+3)


directChildren

public abstract java.util.Iterator<CExpr> directChildren()

generateString

public abstract boolean generateString(java.lang.StringBuilder out,
                                       boolean strict)
Generate SQL capable string. if strict is false (not strict mode) then it will generate expression faithfully without consideration as to whether or not it will yield legal SQL If strict mode is set - then only faithful SQL will be yielded return result in this case will indicate whether or not this call of generateString yielded SQL. If a method returns false it must preserve StringBuilder as is e.g. Pow() will always return false. e.g. BoolExpr will return false if there are any 'OR' components which are not strict SQL


iterator

public java.util.Iterator<CExpr> iterator()

resolveCasts

protected CExprType resolveCasts(java.lang.Iterable<CExpr> in)

isRecastableType

protected boolean isRecastableType(java.lang.Iterable<CExpr> in)

cast

protected void cast(java.lang.Iterable<CExpr> in,
                    CExprType type)


Copyright © 2010. All Rights Reserved.