Package edu.stanford.nlp.util

Examples of edu.stanford.nlp.util.MutableDouble


  /** {@inheritDoc} */
  @Override
  public void setCount(E key, double count) {
    if (tempMDouble == null) {
      //System.out.println("creating mdouble");
      tempMDouble = new MutableDouble();
    }
    //System.out.println("setting mdouble");
    tempMDouble.set(count);
    //System.out.println("putting mdouble in map");
    tempMDouble = map.put(key, tempMDouble);
View Full Code Here


  /** {@inheritDoc} */
  @Override
  public double incrementCount(E key, double count) {
    if (tempMDouble == null) {
      tempMDouble = new MutableDouble();
    }
    MutableDouble oldMDouble = map.put(key, tempMDouble);
    totalCount += count;
    if (oldMDouble != null) {
      count += oldMDouble.doubleValue();
    }
    tempMDouble.set(count);
    tempMDouble = oldMDouble;

    return count;
View Full Code Here

  /** {@inheritDoc} */
  @Override
  public double logIncrementCount(E key, double count) {
    if (tempMDouble == null) {
      tempMDouble = new MutableDouble();
    }
    MutableDouble oldMDouble = map.put(key, tempMDouble);
    if (oldMDouble != null) {
      count = SloppyMath.logAdd(count, oldMDouble.doubleValue());
      totalCount += count - oldMDouble.doubleValue();
    } else {
      totalCount += count;
    }
    tempMDouble.set(count);
    tempMDouble = oldMDouble;
View Full Code Here

  }

  /** {@inheritDoc} */
  @Override
  public double remove(E key) {
    MutableDouble d = mutableRemove(key); // this also updates totalCount
    if(d != null) {
      return d.doubleValue();
    }
    return defaultValue;
  }
View Full Code Here

        return map.size();
      }

      @Override
      public boolean contains(Object v) {
        return v instanceof Double && map.values().contains(new MutableDouble((Double) v));
      }

    };
  }
View Full Code Here

   *
   *  @param key The key to remove
   *  @return Its value as a MutableDouble
   */
  private MutableDouble mutableRemove(E key) {
    MutableDouble md = map.remove(key);
    if (md != null) {
      totalCount -= md.doubleValue();
    }
    return md;
  }
View Full Code Here

        K[] newKey = ErasureUtils.<K>mkTArray(Object.class,key.length + 1);
        if (key.length > 0) {
          System.arraycopy(key, 0, newKey, 0, key.length);
        }
        newKey[key.length] = finalKey;
        MutableDouble value = (MutableDouble) map.get(finalKey);
        Double value1 = new Double(value.doubleValue());
        if (useLists) {
          s.add(new Entry<Object,Double>(Arrays.asList(newKey), value1));
        } else {
          s.add(new Entry<Object,Double>(newKey[0], value1));
        }
View Full Code Here

    }

    addToTotal(count);

    if (tempMDouble == null) {
      tempMDouble = new MutableDouble();
    }
    tempMDouble.set(count);
    MutableDouble oldMDouble = (MutableDouble) map.put(o, tempMDouble);

    if (oldMDouble != null) {
      tempMDouble.set(count + oldMDouble.doubleValue());
    }

    tempMDouble = oldMDouble;

  }
View Full Code Here

      iterations++;
      for (int i = 0; i < lambda.length; i++) {
        if (lambda_converged[i]) {
          continue;
        }
        MutableDouble deltaI = new MutableDouble();
        boolean fl = iterate(i, eps, deltaI);
        if (fl) {
          flag = true;
          updateConds(i, deltaI.doubleValue());
          // checkCorrectness();
        } else {
          //lambda_converged[i]=true;
          numNConverged--;
        }
View Full Code Here

      iterations++;
      for (int i = 0; i < lambda.length; i++) {
        if (lambda_converged[i]) {
          continue;
        }
        MutableDouble deltaI = new MutableDouble();
        boolean fl = iterate(i, eps, deltaI);
        if (fl) {
          updateConds(i, deltaI.doubleValue());
          // checkCorrectness();
        } else {
          //lambda_converged[i]=true;
          numNConverged--;
        }
View Full Code Here

TOP

Related Classes of edu.stanford.nlp.util.MutableDouble

Copyright © 2018 www.massapicom. 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.