Examples of Constant


Examples of com.sun.corba.ee.impl.orbutil.closure.Constant

      org.omg.CosTransactions.Current transactionCurrent =
        jts.get_current();
     
      theORB.getLocalResolver().register(
                 ORBConstants.TRANSACTION_CURRENT_NAME,
                 new Constant(transactionCurrent));
     
      // the JTS PI use this to call the proprietary hooks
      theORB.getLocalResolver().register(
                 "TSIdentification", new Constant(tsIdent));
      txServiceInitialized = true
        } catch (Exception ex) {
            throw new org.omg.CORBA.INITIALIZE(
                 "JTS Exception: "+ex, POASystemException.JTS_INIT_ERROR ,
                 CompletionStatus.COMPLETED_MAYBE);
View Full Code Here

Examples of com.sun.corba.se.impl.orbutil.closure.Constant

public abstract class ClosureFactory {
    private ClosureFactory() {}

    public static Closure makeConstant( Object value )
    {
        return new Constant( value ) ;
    }
View Full Code Here

Examples of com.sun.org.apache.bcel.internal.classfile.Constant

    for(InstructionHandle ih=start; ih != null; ih = ih.next) {
      Instruction i = ih.instruction;

      if(i instanceof CPInstruction) {
  CPInstruction ci = (CPInstruction)i;
  Constant      c  = old_cp.getConstant(ci.getIndex());
  ci.setIndex(new_cp.addConstant(c, old_cp));
      }
    }   
  }
View Full Code Here

Examples of common.model.Constant

    }
    // Range Check
    for (int i = 0; i < total; i++) {
      String var = MessageFormat.format(varPattern, i);
      result.add(new Assert(new Predicate(Operator.AND, new Predicate(
          Operator.GE, new Variable(var), new Constant(1)),
          new Predicate(Operator.LE, new Variable(var), new Constant(
              size * size)))));
    }
    // Assigned values
    for (int[] assign : assigned) {
      String var = MessageFormat.format(varPattern,
          translate(assign[0], assign[1]));
      result.add(new Assert(new Predicate(Operator.EQUAL, new Variable(
          var), new Constant(assign[2]))));
    }
    // Limitations
    // Columns and rows
    for (int i = 0; i < size * size; i++) {
      for (int j = 0; j < size * size; j++) {
View Full Code Here

Examples of condor.classad.Constant

         *
         * if (exprType == Expr.RECORD) { Ad ad = new Ad(); ad.jobAd =
         * (RecordExpr) value; // put the right casting TBD put a // valid
         * constructor return ad; } else {
         */
        Constant co = (Constant) value;
        if (exprType == Expr.INTEGER) {
            return new Integer(co.intValue()); // Integer Value
        } else if (exprType == Expr.BOOLEAN) {
            return new Boolean(co.isTrue()); // Boolean Value
        } else if (exprType == Expr.REAL) {
            return new Double(co.realValue()); // Real Value
        } else if (exprType == Expr.STRING) {
            return co.stringValue(); // String Value
        } else {
            throw new IllegalArgumentException(attrName + ": unexpected type found.");
        }
        // }
    }
View Full Code Here

Examples of de.fuberlin.wiwiss.d2rq.expr.Constant

  // FIXME: This doesn't take column functions other than IDENTITY into account
  // The usesColumnFunctions() method is here to allow detection of this case.
  public Expression toExpression() {
    List<Expression> parts = new ArrayList<Expression>(literalParts.size() * 2 + 1);
    parts.add(new Constant(firstLiteralPart));
    for (int i = 0; i < columns.size(); i++) {
      parts.add(new AttributeExpr(columns.get(i)));
      parts.add(new Constant(literalParts.get(i)));
    }
    return Concatenation.create(parts);
  }
View Full Code Here

Examples of edu.umd.cs.findbugs.ba.constant.Constant

            if (iins.getName(cpg).equals("getConnection")
                    && iins.getSignature(cpg).equals(
                            "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/Connection;")
                            && iins.getClassName(cpg).equals("java.sql.DriverManager")) {
                Constant operandValue = frame.getTopValue();
                if (operandValue.isConstantString()) {
                    String password = operandValue.getConstantString();
                    if (password.length() == 0) {
                        bugAccumulator.accumulateBug(new BugInstance(this, "DMI_EMPTY_DB_PASSWORD", NORMAL_PRIORITY)
                        .addClassAndMethod(methodGen, sourceFile), classContext, methodGen, sourceFile, location);
                    } else {
                        bugAccumulator.accumulateBug(new BugInstance(this, "DMI_CONSTANT_DB_PASSWORD", NORMAL_PRIORITY)
                        .addClassAndMethod(methodGen, sourceFile), classContext, methodGen, sourceFile, location);
                    }

                }
            }

            if (iins.getName(cpg).equals("substring") && iins.getSignature(cpg).equals("(I)Ljava/lang/String;")
                    && iins.getClassName(cpg).equals("java.lang.String")) {

                Constant operandValue = frame.getTopValue();
                if (!operandValue.isConstantInteger()) {
                    continue;
                }
                int v = operandValue.getConstantInt();
                if (v == 0) {
                    bugAccumulator.accumulateBug(new BugInstance(this, "DMI_USELESS_SUBSTRING", NORMAL_PRIORITY)
                    .addClassAndMethod(methodGen, sourceFile), classContext, methodGen, sourceFile, location);
                }

            } else if (iins.getName(cpg).equals("<init>") && iins.getSignature(cpg).equals("(Ljava/lang/String;)V")
                    && iins.getClassName(cpg).equals("java.io.File")) {

                Constant operandValue = frame.getTopValue();
                if (!operandValue.isConstantString()) {
                    continue;
                }
                String v = operandValue.getConstantString();
                if (isAbsoluteFileName(v) && !v.startsWith("/etc/") && !v.startsWith("/dev/")
                        && !v.startsWith("/proc")) {
                    int priority = NORMAL_PRIORITY;
                    if (v.startsWith("/tmp")) {
                        priority = LOW_PRIORITY;
View Full Code Here

Examples of etch.compiler.ast.Constant

      // it's a named thing, it is a constant and do the
      // types match?
     
      if (named.isConstant())
      {
        Constant c = (Constant) named;
       
        // it's a constant, do the types match?
       
        Named<?> ct = c.type().getNamed( msg.parent() );
        Named<?> paramType = param.type().getNamed( msg.parent() );
        if (ct == paramType)
          return;
       
        throw typeMismatch( param, arg, argNo );
View Full Code Here

Examples of eu.admire.dispel.parser.expression.Constant

            graphBuilder.getSubmittedGraphs().addAll(builder.getSubmittedGraphs());
            graphBuilder.getRegistered().putAll(builder.getRegistered());
        }
       
       
        return new Constant(result);
  }
View Full Code Here

Examples of httl.ast.Constant

          && (msg.startsWith("\"") && msg.endsWith("\"")
          || msg.startsWith("\'") && msg.endsWith("\'")
          || msg.startsWith("`") && msg.endsWith("`"))) {
        String value = StringUtils.unescapeString(msg.substring(1, msg.length() - 1));
        if (msg.startsWith("`") && value.length() == 1) {
          parameterStack.push(new Constant(value.charAt(0), false, token.getOffset()));
        } else if (msg.startsWith("`") && value.length() == 2 && value.charAt(0) == '\\') {
          parameterStack.push(new Constant(value.charAt(1), true, token.getOffset()));
        } else {
          parameterStack.push(new Constant(StringUtils.unescapeString(value), false, token.getOffset()));
        }
        beforeOperator = false;
      } else if (StringUtils.isNumber(msg)) {
        Object value;
        boolean boxed = false;
        if (msg.endsWith("b") || msg.endsWith("B")) {
          value = Byte.valueOf(msg.substring(0, msg.length() - 1));
          boxed = msg.endsWith("B");
        } else if (msg.endsWith("s") || msg.endsWith("S")) {
          value = Short.valueOf(msg.substring(0, msg.length() - 1));
          boxed = msg.endsWith("S");
        } else if (msg.endsWith("i") || msg.endsWith("I")) {
          value = Integer.valueOf(msg.substring(0, msg.length() - 1));
          boxed = msg.endsWith("I");
        } else if (msg.endsWith("l") || msg.endsWith("L")) {
          value = Long.valueOf(msg.substring(0, msg.length() - 1));
          boxed = msg.endsWith("L");
        } else if (msg.endsWith("f") || msg.endsWith("F")) {
          value = Float.valueOf(msg.substring(0, msg.length() - 1));
          boxed = msg.endsWith("F");
        } else if (msg.endsWith("d") || msg.endsWith("D")) {
          value = Double.valueOf(msg.substring(0, msg.length() - 1));
          boxed = msg.endsWith("D");
        } else if (msg.indexOf('.') >= 0) {
          value = Double.valueOf(msg);
        } else {
          value = Integer.valueOf(msg);
        }
        parameterStack.push(new Constant(value, boxed, token.getOffset()));
        beforeOperator = false;
      } else if ("null".equals(msg)) {
        parameterStack.push(new Constant(null, false, token.getOffset()));
        beforeOperator = false;
      } else if ("true".equals(msg) || "false".equals(msg)) {
        parameterStack.push(new Constant("true".equals(msg) ? Boolean.TRUE : Boolean.FALSE, false, token.getOffset()));
        beforeOperator = false;
      } else if ("TRUE".equals(msg) || "FALSE".equals(msg)) {
        parameterStack.push(new Constant("TRUE".equals(msg) ? Boolean.TRUE : Boolean.FALSE, true, token.getOffset()));
        beforeOperator = false;
      } else if (msg.length() > 1 && msg.startsWith("@")) {
        parameterStack.push(new Constant(ClassUtils.forName(importPackages, msg.substring(1).trim()), false, token.getOffset()));
        beforeOperator = false;
      } else if (StringUtils.isNamed(msg) && ! "instanceof".equals(msg)) {
        parameterStack.push(new Variable(msg, getTokenOffset(token) ));
        beforeOperator = false;
      } else if ("(".equals(msg)) {
        operatorStack.push(Bracket.ROUND);
        beforeOperator = true;
      } else if (")".equals(msg)) {
        while (popOperator(parameterStack, operatorStack, operatorTokens, offset) != Bracket.ROUND);
        beforeOperator = false;
      } else if ("]".equals(msg)) {
        while (popOperator(parameterStack, operatorStack, operatorTokens, offset) != Bracket.SQUARE);
        beforeOperator = false;
      } else if ("}".equals(msg)) {
        while (popOperator(parameterStack, operatorStack, operatorTokens, offset) != Bracket.BRACE);
        beforeOperator = false;
      } else {
        if (StringUtils.isFunction(msg)) {
          String method = msg.substring(1);
          if (forbidEqualsMethods != null ) {
            for (String forbid : forbidEqualsMethods) {
              if (method.equals(forbid)) {
                throw new ParseException("Forbid call method " + method + " by forbid.method=" + forbid + " config.", offset);
              }
            }
          }
          if (forbidStartsMethods != null ) {
            for (String forbid : forbidStartsMethods) {
              if (method.startsWith(forbid)) {
                throw new ParseException("Forbid call method " + method + " by forbid.method=" + forbid + "* config.", offset);
              }
            }
          }
          if (forbidEndsMethods != null ) {
            for (String forbid : forbidEndsMethods) {
              if (method.endsWith(forbid)) {
                throw new ParseException("Forbid call method " + method + " by forbid.method=*" + forbid + " config.", offset);
              }
            }
          }
        }
       
        if (beforeOperator) {
          if (! msg.startsWith("new ") && ! StringUtils.isFunction(msg) && ! UNARY_OPERATORS.contains(msg)) {
            throw new ParseException("Unsupported binary operator " + msg, getTokenOffset(token) );
          }
          UnaryOperator operator = createUnaryOperator(msg, getPriority(msg, true), getTokenOffset(token));
          operatorTokens.put(operator, token);
          operatorStack.push(operator);
        } else {
          if (! StringUtils.isFunction(msg) && ! BINARY_OPERATORS.contains(msg)) {
            throw new ParseException("Unsupported binary operator " + msg, getTokenOffset(token) );
          }
          BinaryOperator operator = createBinaryOperator(msg, getPriority(msg, false), getTokenOffset(token));
          operatorTokens.put(operator, token);
          while (! operatorStack.isEmpty() && ! (operatorStack.peek() instanceof Bracket)
              && operatorStack.peek().getPriority() >= operator.getPriority()) {
            popOperator(parameterStack, operatorStack, operatorTokens, offset);
          }
          operatorStack.push(operator);
        }
        if ("[".equals(msg)) {
          operatorStack.push(Bracket.SQUARE);
        } else if ("{".equals(msg)) {
          operatorStack.push(Bracket.BRACE);
        }
        beforeOperator = true;
        // 给无参函数自动补上null参数
        if (msg.startsWith("new ") || StringUtils.isFunction(msg)) {
          boolean miss = i == tokens.size() - 1 || ! "(".equals(tokens.get(i + 1).getMessage().trim());
          boolean empty = i < tokens.size() - 2 && "(".equals(tokens.get(i + 1).getMessage().trim()) && ")".equals(tokens.get(i + 2).getMessage().trim());
          if (miss || empty) {
            parameterStack.push(new Constant(null, true, token.getOffset()));
            beforeOperator = false;
          }
          if (empty) {
            i = i + 2;
          }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.