Examples of Value


Examples of net.hamnaberg.json.Value

                    map.put(entry.getKey(), ValueFactory.createValue(entry.getValue()));
                }
                properties.add(Property.object(key, map));
            }
            else {
                Value v = ValueFactory.createValue(value);
                properties.add(Property.value(key, v));
            }
        }
        return new Data(properties);
    }
View Full Code Here

Examples of net.sf.cpsolver.ifs.model.Value

        Model model = solution.getModel();
        double bestEval = 0.0;
        Vector best = null;
        for (Enumeration e=model.variables().elements();e.hasMoreElements();) {
            Variable variable = (Variable)e.nextElement();
            Value assigned = variable.getAssignment();
            double assignedVal = (assigned==null?iConflictWeight:iValueWeight*assigned.toDouble());
            for (Enumeration f=variable.values().elements();f.hasMoreElements();) {
                Value value = (Value)f.nextElement();
                if (value.equals(assigned)) continue;
                double eval = iValueWeight*value.toDouble() - assignedVal;
                if (acceptConflicts) {
                    Set conflicts = model.conflictValues(value);
                    for (Iterator i=conflicts.iterator();i.hasNext();) {
                        Value conflict = (Value)i.next();
                        eval -= iValueWeight*conflict.toDouble();
                        eval += iConflictWeight * (1.0+(iStat==null?0.0:iStat.countRemovals(solution.getIteration(), conflict, value)));
                    }
                } else {
                    if (model.inConflict(value)) continue;
                }
                if (iTabu!=null && iTabu.contains(tabuElement(value))) {
                    int un = model.nrUnassignedVariables()-(assigned==null?0:1);
                    if (un>model.getBestUnassignedVariables()) continue;
                    if (un==model.getBestUnassignedVariables() && model.getTotalValue()+eval>=solution.getBestValue()) continue;
                }
                if (best==null || bestEval>eval) {
                    if (best==null)
                        best = new Vector();
                    else
                        best.clear();
                    best.add(value);
                    bestEval = eval;
                } else if (bestEval==eval) {
                    best.add(value);
                }
            }
        }
       
        if (best==null) {
            sLog.debug("  [tabu] --none--");
            iFirstIteration=-1;
            if (iTabu!=null) iTabu.clear();
            return null;
        }
        Value bestVal = (Value)ToolBox.random(best);
       
        if (sLog.isDebugEnabled()) {
            Set conflicts = model.conflictValues(bestVal);
            double wconf = (iStat==null?0.0:iStat.countRemovals(solution.getIteration(), conflicts, bestVal));
            sLog.debug("  [tabu] "+bestVal+" ("+(bestVal.variable().getAssignment()==null?"":"was="+bestVal.variable().getAssignment()+", ")+"val="+bestEval+(conflicts.isEmpty()?"":", conf="+(wconf+conflicts.size())+"/"+conflicts)+")");
        }
       
        if (iTabu!=null)
            iTabu.add(tabuElement(bestVal));

        return new SimpleNeighbour(bestVal.variable(),bestVal);       
    }
View Full Code Here

Examples of net.sf.saxon.value.Value

    public int getWeight() {
        return 10000;
    }

    public Value transform(Object source, TransformationContext context) {
       Value result = null;
         if (source instanceof Integer) {
             result = new IntegerValue((Integer)source);
         } else if (source instanceof Long) {
             result = new IntegerValue((Long)source);
         } else if (source instanceof Short) {
View Full Code Here

Examples of net.sourceforge.jFuzzyLogic.membership.Value

    //       TERM poor := (0, 1) (4, 0) ;
    //       TERM good := (1, 0) (4,1) (6,1) (9,0);
    //       TERM excellent := (6, 0) (9, 1);
    //    END_FUZZIFY

    Value poorX[] = { new Value(0), new Value(4) };
    Value poorY[] = { new Value(1), new Value(0) };
    MembershipFunction poor = new MembershipFunctionPieceWiseLinear(poorX, poorY);

    MembershipFunction good = new MembershipFunctionTrapetzoidal(new Value(1), new Value(4), new Value(6), new Value(9));

    Value exX[] = { new Value(6), new Value(9), new Value(10) };
    Value exY[] = { new Value(0), new Value(1), new Value(1) };
    MembershipFunction excellent = new MembershipFunctionPieceWiseLinear(exX, exY);

    LinguisticTerm ltPoor = new LinguisticTerm("poor", poor);
    LinguisticTerm ltGood = new LinguisticTerm("good", good);
    LinguisticTerm ltExcellent = new LinguisticTerm("excellent", excellent);

    service.add(ltPoor);
    service.add(ltGood);
    service.add(ltExcellent);

    //    FUZZIFY food
    //       TERM rancid := (0, 1) (1, 1) (3,0) ;
    //       TERM delicious := (7,0) (9,1) (10,1);
    //    END_FUZZIFY

    Value ranX[] = { new Value(0), new Value(1), new Value(3) };
    Value ranY[] = { new Value(1), new Value(1), new Value(0) };
    MembershipFunction rancid = new MembershipFunctionPieceWiseLinear(ranX, ranY);

    Value delX[] = { new Value(7), new Value(9), new Value(10) };
    Value delY[] = { new Value(0), new Value(1), new Value(1) };
    MembershipFunction delicious = new MembershipFunctionPieceWiseLinear(delX, delY);

    LinguisticTerm ltRancid = new LinguisticTerm("rancid", rancid);
    LinguisticTerm ltDelicious = new LinguisticTerm("delicious", delicious);

    food.add(ltRancid);
    food.add(ltDelicious);

    //    DEFUZZIFY tip
    //       TERM cheap := (0,0) (5,1) (10,0);
    //       TERM average := (10,0) (15,1) (20,0);
    //       TERM generous := (20,0) (25,1) (30,0);
    //       METHOD : COG;
    //       DEFAULT := 0;
    //    END_DEFUZZIFY

    MembershipFunction cheap = new MembershipFunctionTriangular(new Value(0), new Value(5), new Value(10));
    MembershipFunction average = new MembershipFunctionTriangular(new Value(10), new Value(15), new Value(20));
    MembershipFunction generous = new MembershipFunctionTriangular(new Value(20), new Value(25), new Value(30));

    LinguisticTerm ltCheap = new LinguisticTerm("cheap", cheap);
    LinguisticTerm ltAverage = new LinguisticTerm("average", average);
    LinguisticTerm ltGenerous = new LinguisticTerm("generous", generous);
View Full Code Here

Examples of nginx.clojure.asm.tree.analysis.Value

                if("<init>".equals(min.name)) {
                    int argSize = TypeAnalyzer.getNumArguments(min.desc);
                    Frame frame = frames[i];
                    if (frame != null) {
                       int stackIndex = frame.getStackSize() - argSize - 1;
                         Value thisValue = frame.getStack(stackIndex);
                         if(stackIndex >= 1 &&
                                 isNewValue(thisValue, true) &&
                                 isNewValue(frame.getStack(stackIndex-1), false)) {
                             NewValue newValue = (NewValue)thisValue;
                             if(newValue.omitted) {
View Full Code Here

Examples of oracle.kv.Value

  @Override
  public int update(String table, String key, HashMap<String, ByteIterator> values) {
    for (Map.Entry<String, ByteIterator> entry : values.entrySet()) {
      Key kvKey = createKey(table, key, entry.getKey());
      Value kvValue = Value.createValue(entry.getValue().toArray());
      try {
        store.put(kvKey, kvValue);
      } catch (FaultException e) {
        System.err.println(e);
        return ERROR;
View Full Code Here

Examples of org.adbcj.Value

      // Make sure we can select the row
      rs = connection.executeQuery("SELECT id FROM updates").get();
      assertNotNull(rs);
      assertEquals(rs.size(), 1);
      Value value = rs.get(0).get(0);
      assertEquals(value.getInt(), 1);

      // Rollback transaction
      connection.rollback().get();

      // select query should now be empty
View Full Code Here

Examples of org.apache.accumulo.core.data.Value

        try {
            Connector conn = mockInstance.getConnector("user1", "password");
            BatchWriter writer = conn.createBatchWriter
                    (PEOPLE_TABLE, MAX_MEMORY, MAX_LATENCY, MAX_WRITE_THREADS);
            Mutation m1 = new Mutation("row1");
            m1.put(INFO_CF, NAME, new Value("brian".getBytes()));
            m1.put(INFO_CF, AGE, new Value(ByteBuffer.wrap(new byte[4]).putInt(30).array()));
            m1.put(INFO_CF, SIBLINGS, new Value(ByteBuffer.wrap(new byte[4]).putInt(3).array()));
            m1.put(INFO_CF, LIFETIME_MILLS, new Value(ByteBuffer.wrap(new byte[8]).putLong(12345l).array()));
            m1.put(INFO_CF, GPA, new Value(ByteBuffer.wrap(new byte[8]).putDouble(3.7d).array()));
            m1.put(INFO_CF, HEIGHT, new Value("6ft".getBytes()));
            m1.put(EVENTS_CF, EVENT1, new Value("".getBytes()));
            m1.put(EVENTS_CF, EVENT2, new Value("".getBytes()));

            Mutation m2 = new Mutation("row2");
            m2.put(INFO_CF, NAME, new Value("adam".getBytes()));
            m2.put(INFO_CF, AGE, new Value(ByteBuffer.wrap(new byte[4]).putInt(29).array()));
            m2.put(INFO_CF, SIBLINGS, new Value(ByteBuffer.wrap(new byte[4]).putInt(6).array()));
            m2.put(INFO_CF, LIFETIME_MILLS, new Value(ByteBuffer.wrap(new byte[8]).putLong(6789l).array()));
            m2.put(INFO_CF, GPA, new Value(ByteBuffer.wrap(new byte[8]).putDouble(3.2d).array()));
            m2.put(INFO_CF, HEIGHT, new Value("5ft7inch".getBytes()));
            m2.put(EVENTS_CF, EVENT1, new Value("".getBytes()));

            writer.addMutation(m1);
            writer.addMutation(m2);
            writer.close();
View Full Code Here

Examples of org.apache.batik.css.engine.value.Value

    public Value createValue(LexicalUnit lu, CSSEngine engine)
        throws DOMException {
      if (lu.getLexicalUnitType() == LexicalUnit.SAC_FUNCTION && lu
          .getFunctionName().equalsIgnoreCase("rgba")) {
        lu = lu.getParameters();
        Value red = createColorComponent(lu);
        lu = lu.getNextLexicalUnit().getNextLexicalUnit();
        Value green = createColorComponent(lu);
        lu = lu.getNextLexicalUnit().getNextLexicalUnit();
        Value blue = createColorComponent(lu);
        lu = lu.getNextLexicalUnit().getNextLexicalUnit();
        Value alpha = createColorComponent(lu);
        return createRGBAColor(red, green, blue, alpha);
      } else if (lu.getLexicalUnitType() == LexicalUnit.SAC_IDENT && lu
          .getStringValue().equalsIgnoreCase("transparent")) {
        return createRGBAColor(new FloatValue(CSSPrimitiveValue.CSS_NUMBER, 0),
            new FloatValue(CSSPrimitiveValue.CSS_NUMBER, 0),
View Full Code Here

Examples of org.apache.bookkeeper.metastore.Value

                                    metadata.setVersion(version);
                                    ledgerCb.operationComplete(BKException.Code.OK, lid);
                                }
                            };

                            ledgerTable.put(ledgerId2Key(lid), new Value().setField(META_FIELD, metadata.serialize()),
                                    Version.NEW, msCallback, null);
                            zk.delete(idPathName, -1, new AsyncCallback.VoidCallback() {
                                @Override
                                public void processResult(int rc, String path, Object ctx) {
                                    if (rc != KeeperException.Code.OK.intValue()) {
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.