mondrian.olap
Class Formula

java.lang.Object
  extended by mondrian.olap.QueryPart
      extended by mondrian.olap.Formula
All Implemented Interfaces:
Walkable

public class Formula
extends QueryPart

A Formula is a clause in an MDX query which defines a Set or a Member.

 

Constructor Summary
Formula(Id id, Exp exp)
          Constructs formula specifying a set.
Formula(Id id, Exp exp, MemberProperty[] memberProperties)
          Constructs a formula specifying a member.
 
Method Summary
 Object accept(MdxVisitor visitor)
          Accepts a visitor to this Formula.
(package private)  void accept(Validator validator)
          Resolves identifiers into objects.
 Object clone()
           
(package private) static Formula[] cloneArray(Formula[] x)
           
 void compile()
           
(package private)  void createElement(Query q)
          Creates the Member or NamedSet object which this formula defines.
 String getCaption()
          Returns this formula's caption.
 Object[] getChildren()
          Returns an array of the object's children.
(package private)  OlapElement getElement()
           
 Exp getExpression()
           
 Id getIdentifier()
          Returns the Identifier of the set or member which is declared by this Formula.
 Member getMdxMember()
          Returns the Member.
 String getName()
          Returns this formula's name.
 NamedSet getNamedSet()
           
 Number getSolveOrder()
          Returns the solve order.
(package private)  String getUniqueName()
          Returns the unique name of the member or set.
 boolean isMember()
           
(package private)  void rename(String newName)
          Changes the last part of the name to newName.
 void unparse(PrintWriter pw)
          Writes a string representation of this parse tree node to the given writer.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Formula

public Formula(Id id,
               Exp exp)
Constructs formula specifying a set.


Formula

public Formula(Id id,
               Exp exp,
               MemberProperty[] memberProperties)
Constructs a formula specifying a member.

Method Detail

clone

public Object clone()
Overrides:
clone in class Object

cloneArray

static Formula[] cloneArray(Formula[] x)

accept

void accept(Validator validator)
Resolves identifiers into objects.

Parameters:
validator - Validation context to resolve the identifiers in this formula

createElement

void createElement(Query q)
Creates the Member or NamedSet object which this formula defines.


getChildren

public Object[] getChildren()
Description copied from interface: Walkable
Returns an array of the object's children. Those which are not Walkable are ignored.

Specified by:
getChildren in interface Walkable
Overrides:
getChildren in class QueryPart

unparse

public void unparse(PrintWriter pw)
Description copied from class: QueryPart
Writes a string representation of this parse tree node to the given writer.

Overrides:
unparse in class QueryPart
Parameters:
pw - writer

isMember

public boolean isMember()

getNamedSet

public NamedSet getNamedSet()

getIdentifier

public Id getIdentifier()
Returns the Identifier of the set or member which is declared by this Formula.

Returns:
Identifier

getName

public String getName()
Returns this formula's name.


getCaption

public String getCaption()
Returns this formula's caption.


rename

void rename(String newName)
Changes the last part of the name to newName. For example, [Abc].[Def].[Ghi] becomes [Abc].[Def].[Xyz]; and the member or set is renamed from Ghi to Xyz.


getUniqueName

String getUniqueName()
Returns the unique name of the member or set.


getElement

OlapElement getElement()

getExpression

public Exp getExpression()

getMdxMember

public Member getMdxMember()
Returns the Member. (Not valid if this formula defines a set.)

Pre-condition:
isMember()
Post-condition:
return != null

getSolveOrder

public Number getSolveOrder()
Returns the solve order. (Not valid if this formula defines a set.)

Pre-condition:
isMember()
Returns:
Solve order, or null if SOLVE_ORDER property is not specified or is not a number or is not constant

compile

public void compile()

accept

public Object accept(MdxVisitor visitor)
Accepts a visitor to this Formula. The default implementation dispatches to the MdxVisitor.visit(Formula) method.

Parameters:
visitor - Visitor

SourceForge.net_Logo