org.omegahat.Models.Formulae.Expressions
Class ModelFormula

java.lang.Object
  |
  +--antlr.BaseAST
        |
        +--antlr.CommonAST
              |
              +--org.omegahat.Models.Formulae.Expressions.ModelFormula
All Implemented Interfaces:
antlr.collections.AST, ModelFormulaInt, Subsettable
Direct Known Subclasses:
DistributionalModelFormula, StructuralModelFormula

public class ModelFormula
extends antlr.CommonAST
implements Subsettable, ModelFormulaInt

This is the top-level class for an entire formula consisting of a response, structural form and conditional variables. An entire model is made up of a collection of these objects that define the relationship between the variables identified in each individual formula. Need to add a random component.


Field Summary
protected  java.lang.Object groups
          A (currently) arbitrary object representing the conditional variables/expressions for this formula.
static int GROUPS
           
protected  java.lang.Object response
          Expression representing the left hand side of the formula.
static int RESPONSE
           
protected  java.lang.Object structural
          Expression representing the right hand side of the formula.
static int STRUCTURAL
           
 
Fields inherited from class antlr.BaseAST
down, right
 
Constructor Summary
ModelFormula()
           
ModelFormula(java.lang.Object response, java.lang.Object structural)
           
ModelFormula(java.lang.Object response, java.lang.Object structural, java.lang.Object groups)
           
 
Method Summary
 boolean equals(java.lang.Object o)
           
 java.util.AbstractCollection getReferencedVariables(boolean recursive)
           
 java.util.AbstractCollection getReferencedVariables(boolean recursive, java.util.AbstractCollection container)
           
 java.lang.Object groups()
          Access the conditioning terms of the formula.
 java.lang.Object groups(java.lang.Object o)
          Set the conditioning terms for this formula.
static MultiLineModelFormula multiLineParse(FormulaLexer lex)
           
static MultiLineModelFormula multiLineParse(java.io.Reader input)
           
static MultiLineModelFormula multiLineParse(java.lang.String input)
          Parse a potentially multi-expression formula specified as a string.
static ModelFormula parse(java.io.File f)
           
static ModelFormula parse(FormulaLexer lex)
           
static ModelFormula parse(java.io.InputStream f)
           
static ModelFormula parse(java.io.Reader reader)
           
static ModelFormula parse(java.lang.String str)
          Parse the content of the specified string as a single formula expression.
 java.lang.Object response()
          Accessor for the left hand side of the formula.
 java.lang.Object response(java.lang.Object o)
          Set the left hand side, or response expression of the formula.
 java.lang.String separator()
           
 java.lang.Object structural()
          Accessor for the right hand side of the formula.
 java.lang.Object structural(java.lang.Object o)
          Set the expression representing the right hand side of the formula.
 java.lang.Object subset(java.lang.Object index, boolean keepStructure)
           
 java.lang.String toString()
          Display the contents of this formula object in a more human readable manner.
 
Methods inherited from class antlr.CommonAST
getText, getType, initialize, initialize, initialize, setText, setType
 
Methods inherited from class antlr.BaseAST
addChild, equals, equalsList, equalsListPartial, equalsTree, equalsTreePartial, findAll, findAllPartial, getFirstChild, getNextSibling, removeChildren, setFirstChild, setNextSibling, setVerboseStringConversion, toStringList, toStringTree
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RESPONSE

public static final int RESPONSE

STRUCTURAL

public static final int STRUCTURAL

GROUPS

public static final int GROUPS

response

protected java.lang.Object response
Expression representing the left hand side of the formula.

structural

protected java.lang.Object structural
Expression representing the right hand side of the formula.

groups

protected java.lang.Object groups
A (currently) arbitrary object representing the conditional variables/expressions for this formula. In an expression such as
y ~ x | a,b
the List consisting of a and b is stored in this field.
Constructor Detail

ModelFormula

public ModelFormula()

ModelFormula

public ModelFormula(java.lang.Object response,
                    java.lang.Object structural)

ModelFormula

public ModelFormula(java.lang.Object response,
                    java.lang.Object structural,
                    java.lang.Object groups)
Method Detail

structural

public java.lang.Object structural()
Accessor for the right hand side of the formula.

structural

public java.lang.Object structural(java.lang.Object o)
Set the expression representing the right hand side of the formula.

response

public java.lang.Object response()
Accessor for the left hand side of the formula.

response

public java.lang.Object response(java.lang.Object o)
Set the left hand side, or response expression of the formula.

groups

public java.lang.Object groups()
Access the conditioning terms of the formula.

groups

public java.lang.Object groups(java.lang.Object o)
Set the conditioning terms for this formula.

toString

public java.lang.String toString()
Display the contents of this formula object in a more human readable manner.
Overrides:
toString in class antlr.BaseAST

parse

public static ModelFormula parse(java.lang.String str)
                          throws java.lang.Exception
Parse the content of the specified string as a single formula expression.
See Also:
multiLineParse(java.lang.String)

parse

public static ModelFormula parse(java.io.File f)
                          throws java.lang.Exception

parse

public static ModelFormula parse(java.io.InputStream f)
                          throws java.lang.Exception

parse

public static ModelFormula parse(java.io.Reader reader)
                          throws java.lang.Exception

parse

public static ModelFormula parse(FormulaLexer lex)
                          throws java.lang.Exception

multiLineParse

public static MultiLineModelFormula multiLineParse(java.lang.String input)
                                            throws java.lang.Exception
Parse a potentially multi-expression formula specified as a string.

multiLineParse

public static MultiLineModelFormula multiLineParse(java.io.Reader input)
                                            throws java.lang.Exception

multiLineParse

public static MultiLineModelFormula multiLineParse(FormulaLexer lex)
                                            throws java.lang.Exception

subset

public java.lang.Object subset(java.lang.Object index,
                               boolean keepStructure)
                        throws java.lang.Throwable
Specified by:
subset in interface Subsettable

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

separator

public java.lang.String separator()

getReferencedVariables

public java.util.AbstractCollection getReferencedVariables(boolean recursive)

getReferencedVariables

public java.util.AbstractCollection getReferencedVariables(boolean recursive,
                                                           java.util.AbstractCollection container)