Package com.ericsson.otp.erlang

Examples of com.ericsson.otp.erlang.OtpErlangDouble


    @Override
    public void dump(OtpErlangObject arg, StringBuffer resultHolder) {
      assert (arg instanceof OtpErlangDouble)
          || (arg instanceof OtpErlangFloat);
      if (arg instanceof OtpErlangDouble) {
        OtpErlangDouble doubleValue = (OtpErlangDouble) arg;
        resultHolder.append(doubleValue.doubleValue());
      } else if (arg instanceof OtpErlangFloat) {
        OtpErlangDouble doubleValue = (OtpErlangDouble) arg;
        resultHolder.append(doubleValue.doubleValue());
      }
    }
View Full Code Here


          OtpErlangObject value = null;
          if (outcome.getClass().equals(Boolean.class))
            value = new OtpErlangBoolean(
                ((Boolean) outcome).booleanValue());
          else if (outcome.getClass().equals(Double.class))
            value = new OtpErlangDouble(
                ((Double) outcome).doubleValue());
          else if (outcome.getClass().equals(String.class))
            value = new OtpErlangAtom((String) outcome);
          else if (outcome.getClass().equals(Integer.class))
            value = new OtpErlangInt(((Integer) outcome).intValue());
View Full Code Here

      // For Markov, we do not need to learn anything at all - our Markov matrix contains enough information to classify paths and hence compare it to the reference graph.
      ConfusionMatrix mat = DiffExperiments.classifyAgainstMarkov(testSet, referenceGraph, m);
      DifferenceToReferenceLanguageBCR differenceBCRMarkov = new DifferenceToReferenceLanguageBCR(mat);
     
      return new OtpErlangTuple(new OtpErlangObject[]{
          new OtpErlangDouble(differenceStructural.getValue()),new OtpErlangDouble(differenceBCRlearnt.getValue()),new OtpErlangDouble(differenceBCRMarkov.getValue())
      });
    }
View Full Code Here

* @version $Rev$ $Date$
*/
public class FloatTypeHelper implements TypeHelper {

  public OtpErlangObject toErlang(Object object) {
    return new OtpErlangDouble((Float) object);
  }
View Full Code Here

* @version $Rev$ $Date$
*/
public class DoubleTypeHelper implements TypeHelper {

  public OtpErlangObject toErlang(Object object) {
    return new OtpErlangDouble((Double) object);
  }
View Full Code Here

                return new OtpErlangFloat((Float) obj);
            }
            failConversion(obj, type);
        } else if (obj instanceof Double) {
            if (type.kind == 'd') {
                return new OtpErlangDouble((Double) obj);
            }
            failConversion(obj, type);
        } else if (type.kind == 'i') {
            if (obj instanceof BigInteger) {
                return new OtpErlangLong((BigInteger) obj);
View Full Code Here

        }
        if (obj instanceof Float) {
            return new OtpErlangFloat((Float) obj);
        }
        if (obj instanceof Double) {
            return new OtpErlangDouble((Double) obj);
        }
        if (obj instanceof Boolean) {
            return new OtpErlangAtom((Boolean) obj ? "true" : "false");
        }
        if (obj instanceof Iterable<?>) {
View Full Code Here

  }

  private OtpErlangObject parseField(Fieldable field) {
    switch (getFieldType(field.name())) {
    case DOUBLE:
      return new OtpErlangDouble(Double.parseDouble(field.stringValue()));
    case FLOAT:
      return new OtpErlangFloat(Float.parseFloat(field.stringValue()));
    case INT:
      return new OtpErlangInt(Integer.parseInt(field.stringValue()));
    case LONG:
      return new OtpErlangLong(Long.parseLong(field.stringValue()));
    case ATOM:
      return new OtpErlangAtom(field.stringValue());
    case GEO:
      double[] latLong = GeoHashUtils.decode(field.stringValue());
      if (latLong.length != 2)
        return new OtpErlangString(field.stringValue());
      return new OtpErlangTuple(new OtpErlangObject[] {
          new OtpErlangAtom("geo"), new OtpErlangDouble(latLong[0]),
          new OtpErlangDouble(latLong[1]) });
    default:
      return new OtpErlangString(field.stringValue());
    }
  }
View Full Code Here

    final double[] lngIndex = FieldCache.DEFAULT.getDoubles(reader,
        this.fieldName + "`lng");
    docValues = new OtpErlangObject[latIndex.length];
    for (int i = 0; i < latIndex.length; i++) {
      docValues[i] = new OtpErlangTuple(new OtpErlangObject[] {
          new OtpErlangAtom("geo"), new OtpErlangDouble(latIndex[i]),
          new OtpErlangDouble(lngIndex[i]) });
    }
    return docValues;
  }
View Full Code Here

    final OtpErlangObject[] docValues;
    double[] origs = FieldCache.DEFAULT.getDoubles(reader, this.fieldName);
    docValues = new OtpErlangObject[origs.length];
    for (int i = 0; i < origs.length; i++) {
      if (origs[i] != Double.NaN) {
        docValues[i] = new OtpErlangDouble(origs[i]);
      } else {
        docValues[i] = new OtpErlangAtom("undefined");
      }
    }
    return docValues;
View Full Code Here

TOP

Related Classes of com.ericsson.otp.erlang.OtpErlangDouble

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.