示例#1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.boris.expr.Expr evaluateVariable(org.boris.expr.ExprVariable paramExprVariable) throws org.boris.expr.ExprException
        public virtual Expr evaluateVariable(ExprVariable paramExprVariable)
        {
            string str = paramExprVariable.Name.ToUpper();

            if (hasAdditionalVariable(str))
            {
                return(getAdditionalVariableValue(paramExprVariable.Name.ToUpper()));
            }
            if (this.variableMap.ContainsKey(str))
            {
                ParamItemInputTable paramItemInputTable = (ParamItemInputTable)this.variableMap[paramExprVariable.Name.ToUpper()];
                return(expressionFromVariable(paramItemInputTable, paramExprVariable));
            }
            if (str.Equals("PRODUCTIVITY") && this.acceptProductivity)
            {
                return(new ExprDouble(nextDouble()));
            }
            if (str.Equals("FACTOR") && this.acceptFactorRate)
            {
                return(new ExprDouble(nextDouble()));
            }
            if (this.acceptBoqColumns)
            {
                int i = this.varNames.IndexOf(str);
                if (i == -1)
                {
                    throw new ExprException("Variable " + paramExprVariable + " not found");
                }
                Type clazz = (Type)this.varClasses[i];
                return(clazz.Equals(typeof(decimal)) ? new ExprDouble(nextDouble()) : (clazz.Equals(typeof(Long)) ? new ExprInteger(nextInt()) : (clazz.Equals(typeof(DateTime)) ? new ExprDouble(ExcelDate.toExcelDate(DateTimeHelper.CurrentUnixTimeMillis())) : (clazz.Equals(typeof(Boolean)) ? new ExprBoolean(false) : new ExprString(str)))));
            }
            throw new ExprException("Variable " + paramExprVariable + " not found");
        }
示例#2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.boris.expr.Expr evaluateVariable(org.boris.expr.ExprVariable paramExprVariable) throws org.boris.expr.ExprException
        public virtual Expr evaluateVariable(ExprVariable paramExprVariable)
        {
            if (hasAdditionalVariable(paramExprVariable.Name.ToUpper()))
            {
                return(getAdditionalVariableValue(paramExprVariable.Name.ToUpper()));
            }
            if (this.variableMap.ContainsKey(paramExprVariable.Name.ToUpper()))
            {
                FunctionArgumentTable functionArgumentTable = (FunctionArgumentTable)this.variableMap[paramExprVariable.Name.ToUpper()];
                return(expressionFromVariable(functionArgumentTable, paramExprVariable));
            }
            throw new ExprException("Variable " + paramExprVariable + " not found");
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void annotateVariable(org.boris.expr.ExprVariable paramExprVariable) throws org.boris.expr.ExprException
        public virtual void annotateVariable(ExprVariable paramExprVariable)
        {
            Range range = null;

            try
            {
                range = Range.valueOf(paramExprVariable.Name);
                updateAliasedRange(range);
            }
            catch (ExprException)
            {
            }
            paramExprVariable.Annotation = range;
        }
示例#4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void annotateVariable(org.boris.expr.ExprVariable paramExprVariable) throws org.boris.expr.ExprException
        public virtual void annotateVariable(ExprVariable paramExprVariable)
        {
            if (this.refArgsIns != null)
            {
                if (this.variableMap.ContainsKey(paramExprVariable.Name.ToUpper()))
                {
                    FunctionArgumentTable functionArgumentTable = (FunctionArgumentTable)this.variableMap[paramExprVariable.Name.ToUpper()];
                    if (!this.refArgsIns.Contains(functionArgumentTable))
                    {
                        this.refArgsIns.Add(functionArgumentTable);
                    }
                }
            }
            else if (!this.variableMap.ContainsKey(paramExprVariable.Name.ToUpper()))
            {
                throw new ExprException("Variable " + paramExprVariable + " not found");
            }
        }
示例#5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void annotateVariable(org.boris.expr.ExprVariable paramExprVariable) throws org.boris.expr.ExprException
        public virtual void annotateVariable(ExprVariable paramExprVariable)
        {
            string str = paramExprVariable.Name.ToUpper();

            if (this.refArgsIns != null)
            {
                if (this.variableMap.ContainsKey(str))
                {
                    ParamItemInputTable paramItemInputTable = (ParamItemInputTable)this.variableMap[str];
                    if (!this.refArgsIns.Contains(paramItemInputTable))
                    {
                        this.refArgsIns.Add(paramItemInputTable);
                    }
                }
            }
            else if ((!this.acceptProductivity || !str.Equals("PRODUCTIVITY")) && (!this.acceptFactorRate || !str.Equals("FACTOR")) && (!this.acceptBoqColumns || this.varNames.IndexOf(str) == -1) && !this.variableMap.ContainsKey(str))
            {
                throw new ExprException("Variable " + paramExprVariable + " not found");
            }
        }
示例#6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: protected void updateDependencies(Desktop.common.nomitech.common.expr.boqitem.Range paramRange, org.boris.expr.Expr paramExpr) throws org.boris.expr.ExprException
        protected internal virtual void updateDependencies(Range paramRange, Expr paramExpr)
        {
            this.graph.clearInbounds(paramRange);
            ExprVariable[] arrayOfExprVariable = ExprVariable.findVariables(paramExpr);
            foreach (ExprVariable exprVariable in arrayOfExprVariable)
            {
                Range range = (Range)exprVariable.Annotation;
                try
                {
                    addDependencies(range, paramRange);
                }
                catch (GraphCycleException graphCycleException)
                {
                    foreach (ExprVariable exprVariable1 in arrayOfExprVariable)
                    {
                        removeDependencies((Range)exprVariable1.Annotation, paramRange);
                    }
                    throw new ExprException(graphCycleException);
                }
            }
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.boris.expr.Expr evaluateVariable(org.boris.expr.ExprVariable paramExprVariable) throws org.boris.expr.ExprException
        public virtual Expr evaluateVariable(ExprVariable paramExprVariable)
        {
            string str = paramExprVariable.Name.ToUpper();

            if (!this.circularError)
            {
                if (StringUtils.checkEquality(this.currentVariableName.ToUpper(), str))
                {
                    throw new CircularExprException(this, "Circullar reference.Invalid variable " + str);
                }
                if (!string.ReferenceEquals(this.localVariablesFormulaMap[str], null))
                {
                    string str1 = ((string)this.localVariablesFormulaMap[str]).ToString();
                    if (str1.Length > 0)
                    {
                        parseStatement(str1);
                    }
                }
                this.usedLocalVariablesInFormula.Add(paramExprVariable.Name);
            }
            return(evaluateVariable(str));
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.boris.expr.Expr evaluateVariable(org.boris.expr.ExprVariable paramExprVariable) throws org.boris.expr.ExprException
        public virtual Expr evaluateVariable(ExprVariable paramExprVariable)
        {
            return(evaluateVariable(paramExprVariable.Name));
        }
示例#9
0
void case_78()
#line 511 "C:\DEV\SharpLang\src\mcs\class\System.XML\\Mono.Xml.Xsl\PatternParser.jay"
{
		Expression ret = null;
		if (Context != null)
			ret = Context.TryGetVariable (((XmlQualifiedName) yyVals[0+yyTop]).ToString ());
		
		if (ret == null)
			ret = new ExprVariable ((XmlQualifiedName) yyVals[0+yyTop], Context);
			
		yyVal = ret;
	}
示例#10
0
void case_78()
#line 511 "net_4_5_PatternParser.jay"
{
		Expression ret = null;
		if (Context != null)
			ret = Context.TryGetVariable (((XmlQualifiedName) yyVals[0+yyTop]).ToString ());
		
		if (ret == null)
			ret = new ExprVariable ((XmlQualifiedName) yyVals[0+yyTop], Context);
			
		yyVal = ret;
	}
  /** the generated parser.
      Maintains a state and a value stack, currently with fixed maximum size.
      @param yyLex scanner.
      @return result of the last reduction, if any.
      @throws yyException on irrecoverable parse error.
    */
  internal Object yyparse (yyParser.yyInput yyLex)
  {
    if (yyMax <= 0) yyMax = 256;			// initial size
    int yyState = 0;                                   // state stack ptr
    int [] yyStates = new int[yyMax];	                // state stack 
    Object yyVal = null;                               // value stack ptr
    Object [] yyVals = new Object[yyMax];	        // value stack
    int yyToken = -1;					// current input
    int yyErrorFlag = 0;				// #tks to shift

    /*yyLoop:*/ for (int yyTop = 0;; ++ yyTop) {
      if (yyTop >= yyStates.Length) {			// dynamically increase
        int[] i = new int[yyStates.Length+yyMax];
        yyStates.CopyTo (i, 0);
        yyStates = i;
        Object[] o = new Object[yyVals.Length+yyMax];
        yyVals.CopyTo (o, 0);
        yyVals = o;
      }
      yyStates[yyTop] = yyState;
      yyVals[yyTop] = yyVal;
      if (debug != null) debug.push(yyState, yyVal);

      /*yyDiscarded:*/ for (;;) {	// discarding a token does not change stack
        int yyN;
        if ((yyN = yyDefRed[yyState]) == 0) {	// else [default] reduce (yyN)
          if (yyToken < 0) {
            yyToken = yyLex.advance() ? yyLex.token() : 0;
            if (debug != null)
              debug.lex(yyState, yyToken, yyname(yyToken), yyLex.value());
          }
          if ((yyN = yySindex[yyState]) != 0 && ((yyN += yyToken) >= 0)
              && (yyN < yyTable.Length) && (yyCheck[yyN] == yyToken)) {
            if (debug != null)
              debug.shift(yyState, yyTable[yyN], yyErrorFlag-1);
            yyState = yyTable[yyN];		// shift to yyN
            yyVal = yyLex.value();
            yyToken = -1;
            if (yyErrorFlag > 0) -- yyErrorFlag;
            goto continue_yyLoop;
          }
          if ((yyN = yyRindex[yyState]) != 0 && (yyN += yyToken) >= 0
              && yyN < yyTable.Length && yyCheck[yyN] == yyToken)
            yyN = yyTable[yyN];			// reduce (yyN)
          else
            switch (yyErrorFlag) {
  
            case 0:
              yyExpectingState = yyState;
              // yyerror(String.Format ("syntax error, got token `{0}'", yyname (yyToken)), yyExpecting(yyState));
              if (debug != null) debug.error("syntax error");
              if (yyToken == 0 /*eof*/ || yyToken == eof_token) throw new yyParser.yyUnexpectedEof ();
              goto case 1;
            case 1: case 2:
              yyErrorFlag = 3;
              do {
                if ((yyN = yySindex[yyStates[yyTop]]) != 0
                    && (yyN += Token.yyErrorCode) >= 0 && yyN < yyTable.Length
                    && yyCheck[yyN] == Token.yyErrorCode) {
                  if (debug != null)
                    debug.shift(yyStates[yyTop], yyTable[yyN], 3);
                  yyState = yyTable[yyN];
                  yyVal = yyLex.value();
                  goto continue_yyLoop;
                }
                if (debug != null) debug.pop(yyStates[yyTop]);
              } while (-- yyTop >= 0);
              if (debug != null) debug.reject();
              throw new yyParser.yyException("irrecoverable syntax error");
  
            case 3:
              if (yyToken == 0) {
                if (debug != null) debug.reject();
                throw new yyParser.yyException("irrecoverable syntax error at end-of-file");
              }
              if (debug != null)
                debug.discard(yyState, yyToken, yyname(yyToken),
  							yyLex.value());
              yyToken = -1;
              goto continue_yyDiscarded;		// leave stack alone
            }
        }
        int yyV = yyTop + 1-yyLen[yyN];
        if (debug != null)
          debug.reduce(yyState, yyStates[yyV-1], yyN, YYRules.getRule (yyN), yyLen[yyN]);
        yyVal = yyDefault(yyV > yyTop ? null : yyVals[yyV]);
        switch (yyN) {
case 2:
#line 170 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprUNION ((NodeSet) yyVals[-2+yyTop], (NodeSet) yyVals[0+yyTop]);
	}
  break;
case 3:
#line 177 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprRoot ();
	}
  break;
case 4:
#line 181 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprSLASH (new ExprRoot (), (NodeSet) yyVals[0+yyTop]);
	}
  break;
case 6:
#line 186 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprSLASH ((Expression) yyVals[-2+yyTop], (NodeSet) yyVals[0+yyTop]);
	}
  break;
case 7:
#line 190 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprSLASH2 ((Expression) yyVals[-2+yyTop], (NodeSet) yyVals[0+yyTop]);
	}
  break;
case 8:
#line 194 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprSLASH2 (new ExprRoot (), (NodeSet) yyVals[0+yyTop]);
	}
  break;
case 10:
#line 203 "Mono.Xml.Xsl/PatternParser.jay"
  {
		XmlQualifiedName name = (XmlQualifiedName) yyVals[-3+yyTop];
		if (name.Name != "id" || name.Namespace != String.Empty)
			throw new XPathException (String.Format ("Expected 'id' but got '{0}'", name));
		yyVal = ExprFunctionCall.Factory (name,
			new FunctionArguments (
				new ExprLiteral ((string) yyVals[-1+yyTop]),
				null),
			Context);
	}
  break;
case 11:
#line 214 "Mono.Xml.Xsl/PatternParser.jay"
  {
		XmlQualifiedName name = (XmlQualifiedName) yyVals[-5+yyTop];
		if (name.Name != "key" || name.Namespace != String.Empty)
			throw new XPathException (String.Format ("Expected 'key' but got '{0}'", name));
		yyVal = Context.TryGetFunction (name,
			new FunctionArguments (
				new ExprLiteral ((string) yyVals[-3+yyTop]),
				new FunctionArguments (
					new ExprLiteral ((string) yyVals[-1+yyTop]),
					null)));
	}
  break;
case 13:
#line 230 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprSLASH ((Expression) yyVals[-2+yyTop], (NodeSet) yyVals[0+yyTop]);
	}
  break;
case 14:
#line 234 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprSLASH2 ((Expression) yyVals[-2+yyTop], (NodeSet) yyVals[0+yyTop]);
	}
  break;
case 15:
#line 241 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = CreateNodeTest ((Axes) yyVals[-2+yyTop], yyVals[-1+yyTop], (ArrayList) yyVals[0+yyTop]);
	}
  break;
case 17:
#line 249 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = Axes.Child;
	}
  break;
case 18:
#line 253 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = Axes.Attribute;
	}
  break;
case 19:
#line 260 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = null;
	}
  break;
case 20:
#line 264 "Mono.Xml.Xsl/PatternParser.jay"
  {
		ArrayList al = (ArrayList) yyVals[-1+yyTop];
		if (al == null)
			al = new ArrayList ();
		al.Add ((Expression) yyVals[0+yyTop]);
		yyVal = al;
	}
  break;
case 23:
#line 283 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprOR ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
	}
  break;
case 25:
#line 291 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprAND ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
	}
  break;
case 27:
#line 299 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprEQ ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
	}
  break;
case 28:
#line 303 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprNE ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
	}
  break;
case 30:
#line 311 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprLT ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
	}
  break;
case 31:
#line 315 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprGT ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
	}
  break;
case 32:
#line 319 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprLE ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
	}
  break;
case 33:
#line 323 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprGE ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
	}
  break;
case 35:
#line 331 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprPLUS ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
	}
  break;
case 36:
#line 335 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprMINUS ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
	}
  break;
case 38:
#line 343 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprMULT ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
	}
  break;
case 39:
#line 347 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprDIV ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
	}
  break;
case 40:
#line 351 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprMOD ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
	}
  break;
case 42:
#line 359 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprNEG ((Expression) yyVals[0+yyTop]);
	}
  break;
case 44:
#line 367 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprUNION ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
	}
  break;
case 47:
#line 376 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprSLASH ((Expression) yyVals[-2+yyTop], (NodeSet) yyVals[0+yyTop]);
	}
  break;
case 48:
#line 380 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprSLASH2 ((Expression) yyVals[-2+yyTop], (NodeSet) yyVals[0+yyTop]);
	}
  break;
case 51:
#line 392 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprRoot ();
	}
  break;
case 52:
#line 396 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprSLASH (new ExprRoot (), (NodeSet) yyVals[0+yyTop]);
	}
  break;
case 53:
#line 400 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprSLASH2 (new ExprRoot (), (NodeSet) yyVals[0+yyTop]);
	}
  break;
case 55:
#line 408 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprSLASH ((NodeSet) yyVals[-2+yyTop], (NodeSet) yyVals[0+yyTop]);
	}
  break;
case 56:
#line 412 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprSLASH2 ((NodeSet) yyVals[-2+yyTop], (NodeSet) yyVals[0+yyTop]);
	}
  break;
case 57:
#line 419 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = CreateNodeTest ((Axes) yyVals[-2+yyTop], yyVals[-1+yyTop], (ArrayList) yyVals[0+yyTop]);
	}
  break;
case 60:
#line 428 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = (XPathNodeType) yyVals[-2+yyTop];
	}
  break;
case 61:
#line 432 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = (string) yyVals[-1+yyTop];
	}
  break;
case 62:
#line 439 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = XmlQualifiedName.Empty;
	}
  break;
case 64:
#line 447 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new NodeTypeTest (Axes.Self, XPathNodeType.All);
	}
  break;
case 65:
#line 451 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new NodeTypeTest (Axes.Parent, XPathNodeType.All);
	}
  break;
case 66:
#line 458 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = null;
	}
  break;
case 67:
#line 462 "Mono.Xml.Xsl/PatternParser.jay"
  {
		ArrayList al = (ArrayList) yyVals[-1+yyTop];
		if (al == null)
			al = new ArrayList ();
		al.Add (yyVals[0+yyTop]);
		yyVal = al;
	}
  break;
case 68:
#line 473 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = yyVals[-1+yyTop];
	}
  break;
case 70:
#line 481 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = Axes.Child;
	}
  break;
case 71:
#line 485 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = Axes.Attribute;
	}
  break;
case 72:
#line 491 "Mono.Xml.Xsl/PatternParser.jay"
  { yyVal = XPathNodeType.Comment; }
  break;
case 73:
#line 492 "Mono.Xml.Xsl/PatternParser.jay"
  { yyVal = XPathNodeType.Text; }
  break;
case 74:
#line 493 "Mono.Xml.Xsl/PatternParser.jay"
  { yyVal = XPathNodeType.ProcessingInstruction; }
  break;
case 75:
#line 494 "Mono.Xml.Xsl/PatternParser.jay"
  { yyVal = XPathNodeType.All; }
  break;
case 77:
#line 501 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprFilter ((Expression) yyVals[-1+yyTop], (Expression) yyVals[0+yyTop]);
	}
  break;
case 78:
#line 508 "Mono.Xml.Xsl/PatternParser.jay"
  {
		Expression ret = null;
		if (Context != null)
			ret = Context.TryGetVariable (((XmlQualifiedName) yyVals[0+yyTop]).ToString ());
		
		if (ret == null)
			ret = new ExprVariable ((XmlQualifiedName) yyVals[0+yyTop], Context);
			
		yyVal = ret;
	}
  break;
case 79:
#line 519 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprParens ((Expression) yyVals[-1+yyTop]);
	}
  break;
case 80:
#line 523 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprLiteral ((String) yyVals[0+yyTop]);
	}
  break;
case 81:
#line 527 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new ExprNumber ((double) yyVals[0+yyTop]);
	}
  break;
case 83:
#line 535 "Mono.Xml.Xsl/PatternParser.jay"
  {
		Expression ret = null;
		if (Context != null)
			ret = Context.TryGetFunction ((XmlQualifiedName) yyVals[-3+yyTop], (FunctionArguments) yyVals[-1+yyTop]);
		if (ret == null)
			ret = ExprFunctionCall.Factory ((XmlQualifiedName) yyVals[-3+yyTop], (FunctionArguments) yyVals[-1+yyTop], Context);
		
		yyVal = ret;
	}
  break;
case 85:
#line 549 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new FunctionArguments ((Expression) yyVals[-1+yyTop], (FunctionArguments) yyVals[0+yyTop]);
	}
  break;
case 87:
#line 557 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = new FunctionArguments ((Expression) yyVals[-1+yyTop], (FunctionArguments) yyVals[0+yyTop]);
	}
  break;
case 88:
#line 564 "Mono.Xml.Xsl/PatternParser.jay"
  {
		yyVal = yyVals[-1+yyTop];
	}
  break;
case 89:
#line 570 "Mono.Xml.Xsl/PatternParser.jay"
  { yyVal = Axes.Ancestor; }
  break;
case 90:
#line 571 "Mono.Xml.Xsl/PatternParser.jay"
  { yyVal = Axes.AncestorOrSelf; }
  break;
case 91:
#line 572 "Mono.Xml.Xsl/PatternParser.jay"
  { yyVal = Axes.Attribute; }
  break;
case 92:
#line 573 "Mono.Xml.Xsl/PatternParser.jay"
  { yyVal = Axes.Child; }
  break;
case 93:
#line 574 "Mono.Xml.Xsl/PatternParser.jay"
  { yyVal = Axes.Descendant; }
  break;
case 94:
#line 575 "Mono.Xml.Xsl/PatternParser.jay"
  { yyVal = Axes.DescendantOrSelf; }
  break;
case 95:
#line 576 "Mono.Xml.Xsl/PatternParser.jay"
  { yyVal = Axes.Following; }
  break;
case 96:
#line 577 "Mono.Xml.Xsl/PatternParser.jay"
  { yyVal = Axes.FollowingSibling; }
  break;
case 97:
#line 578 "Mono.Xml.Xsl/PatternParser.jay"
  { yyVal = Axes.Namespace; }
  break;
case 98:
#line 579 "Mono.Xml.Xsl/PatternParser.jay"
  { yyVal = Axes.Parent; }
  break;
case 99:
#line 580 "Mono.Xml.Xsl/PatternParser.jay"
  { yyVal = Axes.Preceding; }
  break;
case 100:
#line 581 "Mono.Xml.Xsl/PatternParser.jay"
  { yyVal = Axes.PrecedingSibling; }
  break;
case 101:
#line 582 "Mono.Xml.Xsl/PatternParser.jay"
  { yyVal = Axes.Self; }
  break;
#line default
        }
        yyTop -= yyLen[yyN];
        yyState = yyStates[yyTop];
        int yyM = yyLhs[yyN];
        if (yyState == 0 && yyM == 0) {
          if (debug != null) debug.shift(0, yyFinal);
          yyState = yyFinal;
          if (yyToken < 0) {
            yyToken = yyLex.advance() ? yyLex.token() : 0;
            if (debug != null)
               debug.lex(yyState, yyToken,yyname(yyToken), yyLex.value());
          }
          if (yyToken == 0) {
            if (debug != null) debug.accept(yyVal);
            return yyVal;
          }
          goto continue_yyLoop;
        }
        if (((yyN = yyGindex[yyM]) != 0) && ((yyN += yyState) >= 0)
            && (yyN < yyTable.Length) && (yyCheck[yyN] == yyState))
          yyState = yyTable[yyN];
        else
          yyState = yyDgoto[yyM];
        if (debug != null) debug.shift(yyStates[yyTop], yyState);
	 goto continue_yyLoop;
      continue_yyDiscarded: continue;	// implements the named-loop continue: 'continue yyDiscarded'
      }
    continue_yyLoop: continue;		// implements the named-loop continue: 'continue yyLoop'
    }
  }
示例#12
0
 private Expr expressionFromVariable(ParamItemInputTable paramParamItemInputTable, ExprVariable paramExprVariable)
 {
     if (paramParamItemInputTable.DataType.Equals("datatype.decimal"))
     {
         return(new ExprDouble(nextDouble()));
     }
     if (paramParamItemInputTable.DataType.Equals("datatype.takeoff"))
     {
         return(new ExprDouble(nextDouble()));
     }
     if (paramParamItemInputTable.DataType.Equals("datatype.array"))
     {
         return(new DummyExprArray());
     }
     if (paramParamItemInputTable.DataType.Equals("datatype.integer"))
     {
         return(new ExprInteger(nextInt()));
     }
     if (paramParamItemInputTable.DataType.Equals("datatype.list"))
     {
         return(new ExprString("1"));
     }
     if (paramParamItemInputTable.DataType.Equals("datatype.country"))
     {
         return(new ExprString("US"));
     }
     if (paramParamItemInputTable.DataType.Equals("datatype.text"))
     {
         return(new ExprString(""));
     }
     if (paramParamItemInputTable.DataType.Equals("datatype.image"))
     {
         return(new ExprString(""));
     }
     if (paramParamItemInputTable.DataType.Equals("datatype.notes"))
     {
         return(new ExprString(""));
     }
     if (paramParamItemInputTable.DataType.Equals("datatype.bimmodel"))
     {
         return(new ExprString(""));
     }
     if (paramParamItemInputTable.DataType.Equals("datatype.locfactor"))
     {
         return(new ExprLocation("US"));
     }
     if (paramParamItemInputTable.DataType.Equals("datatype.calcvalue"))
     {
         return(new ExprDouble(nextDouble()));
     }
     if (paramParamItemInputTable.DataType.Equals("datatype.calcarray"))
     {
         return(new DummyExprArray());
     }
     if (paramParamItemInputTable.DataType.Equals("datatype.calclist"))
     {
         return(new ExprString("1"));
     }
     if (paramParamItemInputTable.DataType.Equals("datatype.date"))
     {
         return(new ExprDouble(nextDouble()));
     }
     if (paramParamItemInputTable.DataType.Equals("datatype.boolean"))
     {
         return(new ExprBoolean(false));
     }
     if (paramParamItemInputTable.DataType.Equals("datatype.formula"))
     {
         return(new ExprString(""));
     }
     paramExprVariable.Name = paramExprVariable.Name.ToUpper();
     return(paramExprVariable);
 }
示例#13
0
 private Expr expressionFromVariable(FunctionArgumentTable paramFunctionArgumentTable, ExprVariable paramExprVariable)
 {
     if (paramFunctionArgumentTable.Type.Equals("datatype.decimal"))
     {
         return(StringUtils.isDecimal(paramFunctionArgumentTable.DefaultValue) ? new ExprDouble(double.Parse(paramFunctionArgumentTable.DefaultValue)) : new ExprDouble(1.5D));
     }
     if (paramFunctionArgumentTable.Type.Equals("datatype.takeoff"))
     {
         return(StringUtils.isDecimal(paramFunctionArgumentTable.DefaultValue) ? new ExprDouble(double.Parse(paramFunctionArgumentTable.DefaultValue)) : new ExprDouble(1.5D));
     }
     if (paramFunctionArgumentTable.Type.Equals("datatype.integer"))
     {
         return(StringUtils.isInteger(paramFunctionArgumentTable.DefaultValue) ? new ExprInteger(int.Parse(paramFunctionArgumentTable.DefaultValue)) : new ExprInteger(1));
     }
     if (paramFunctionArgumentTable.Type.Equals("datatype.list"))
     {
         if (!StringUtils.isNullOrBlank(paramFunctionArgumentTable.DefaultValue))
         {
             return(new ExprString(paramFunctionArgumentTable.DefaultValue));
         }
         string str = StringUtils.getFirstLine(paramFunctionArgumentTable.SelectionList);
         return(!StringUtils.isNullOrBlank(str) ? new ExprString(str) : new ExprString(paramExprVariable.Name));
     }
     if (paramFunctionArgumentTable.Type.Equals("datatype.country"))
     {
         return(new ExprString("US"));
     }
     if (paramFunctionArgumentTable.Type.Equals("datatype.image"))
     {
         return(new ExprString(""));
     }
     if (paramFunctionArgumentTable.Type.Equals("datatype.notes"))
     {
         return(!StringUtils.isNullOrBlank(paramFunctionArgumentTable.DefaultValue) ? new ExprString(paramFunctionArgumentTable.DefaultValue) : new ExprString(""));
     }
     if (paramFunctionArgumentTable.Type.Equals("datatype.array"))
     {
         return(new DummyExprArray());
     }
     if (paramFunctionArgumentTable.Type.Equals("datatype.text"))
     {
         return(!StringUtils.isNullOrBlank(paramFunctionArgumentTable.DefaultValue) ? new ExprString(paramFunctionArgumentTable.DefaultValue) : new ExprString(""));
     }
     if (paramFunctionArgumentTable.Type.Equals("datatype.locfactor"))
     {
         return(new ExprLocation("US"));
     }
     if (paramFunctionArgumentTable.Type.Equals("datatype.calcvalue"))
     {
         return(new ExprDouble(1.5D));
     }
     if (paramFunctionArgumentTable.Type.Equals("datatype.date"))
     {
         return(new ExprDouble(1.5D));
     }
     if (paramFunctionArgumentTable.Type.Equals("datatype.boolean"))
     {
         return(StringUtils.isBoolean(paramFunctionArgumentTable.DefaultValue) ? new ExprBoolean(bool.Parse(paramFunctionArgumentTable.DefaultValue)) : new ExprBoolean(true));
     }
     Console.WriteLine("oops return variable cause type is: " + paramFunctionArgumentTable.Type);
     paramExprVariable.Name = paramExprVariable.Name.ToUpper();
     return(paramExprVariable);
 }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void validate(org.boris.expr.ExprVariable param1ExprVariable) throws org.boris.expr.ExprException
            public virtual void validate(ExprVariable param1ExprVariable)
            {
            }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.boris.expr.Expr evaluateVariable(org.boris.expr.IEvaluationContext param1IEvaluationContext, org.boris.expr.ExprVariable param1ExprVariable) throws org.boris.expr.ExprException
            public virtual Expr evaluateVariable(IEvaluationContext param1IEvaluationContext, ExprVariable param1ExprVariable)
            {
                string str1 = param1ExprVariable.Name.ToUpper();

                if (outerInstance.hasAdditionalVariable(str1))
                {
                    return(outerInstance.getAdditionalVariableValue(str1));
                }
                if (outerInstance.localVariablesMap.ContainsKey(str1))
                {
                    return(new ExprDouble(((decimal)outerInstance.localVariablesMap[str1]).doubleValue()));
                }
                string str2 = BoqItemFormulaEvaluator.fieldFromVariable(str1);

                if (string.ReferenceEquals(str2, null))
                {
                    throw new ExprException("Variable " + str1 + " not found");
                }
                object @object = outerInstance.getFieldValue(outerInstance.boqTable, str2);

                if (@object == null)
                {
                    if (BoqItemTable.isFieldDate(str2))
                    {
                        @object = Convert.ToDouble(0.0D);
                    }
                    else
                    {
                        @object = "";
                    }
                }
                ExprBoolean exprBoolean = null;

                if (@object is Number)
                {
                    exprBoolean = new ExprDouble(((Number)@object).doubleValue());
                }
                else if (@object is string)
                {
                    ExprString exprString = new ExprString(@object.ToString());
                }
                else if (@object is DateTime)
                {
                    exprBoolean = new ExprDouble(ExcelDate.toExcelDate(((DateTime)@object).Ticks));
                }
                else if (@object is bool?)
                {
                    exprBoolean = new ExprBoolean(((bool?)@object).Value);
                }
                return(exprBoolean);
            }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.boris.expr.Expr evaluateVariable(org.boris.expr.ExprVariable paramExprVariable) throws org.boris.expr.ExprException
        public virtual Expr evaluateVariable(ExprVariable paramExprVariable)
        {
            return(this.provider.evaluateVariable(this, paramExprVariable));
        }