Ejemplo n.º 1
0
  public Object evaluate(Evaluator evaluator) {
    final Member[] members = tupleCalc.evaluateTuple(evaluator);
    if (members == null) {
      return null;
    }

    final boolean needToReturnNull = evaluator.needToReturnNullForUnrelatedDimension(members);
    if (needToReturnNull) {
      return null;
    }

    Member[] savedMembers = new Member[members.length];
    for (int i = 0; i < members.length; i++) {
      savedMembers[i] = evaluator.setContext(members[i]);
    }
    Object result = evaluator.evaluateCurrent();
    evaluator.setContext(savedMembers);
    return result;
  }
Ejemplo n.º 2
0
 public boolean dependsOn(Hierarchy hierarchy) {
   if (super.dependsOn(hierarchy)) {
     return true;
   }
   for (Type type : ((TupleType) tupleCalc.getType()).elementTypes) {
     // If the expression definitely includes the dimension (in this
     // case, that means it is a member of that dimension) then we
     // do not depend on the dimension. For example, the scalar value of
     //   ([Store].[USA], [Gender].[F])
     // does not depend on [Store].
     //
     // If the dimensionality of the expression is unknown, then the
     // expression MIGHT include the dimension, so to be safe we have to
     // say that it depends on the given dimension. For example,
     //   (Dimensions(3).CurrentMember.Parent, [Gender].[F])
     // may depend on [Store].
     if (type.usesHierarchy(hierarchy, true)) {
       return false;
     }
   }
   return true;
 }