Examples of NumericValue


Examples of com.serotonin.m2m2.rt.dataImage.types.NumericValue

      }
    } else if (dataTypeId == DataTypes.NUMERIC) {
      try {
        startObject = NumericValue.parseNumeric(startValue);
      } catch (NumberFormatException e) {
        startObject = new NumericValue(0);
      }
    } else {
      if (startValue == null)
        startObject = new AlphanumericValue("");
      else
View Full Code Here

Examples of com.serotonin.m2m2.rt.dataImage.types.NumericValue

        double newValue = currentValue.getDoubleValue() + change;
        if (newValue > vo.getMax())
            newValue = vo.getMax();
        if (newValue < vo.getMin())
            newValue = vo.getMin();
        return new NumericValue(newValue);
    }
View Full Code Here

Examples of com.serotonin.m2m2.rt.dataImage.types.NumericValue

    }

    @Override
    public DataValue change(DataValue currentValue) {
        double newValue = RANDOM.nextDouble();
        return new NumericValue((vo.getMax() - vo.getMin()) * newValue + vo.getMin());
    }
View Full Code Here

Examples of com.serotonin.m2m2.rt.dataImage.types.NumericValue

     
      //This Equation needs work to make sense with the inputs
      double angularFreq = 2d * Math.PI * (1d/vo.getPeriod());
        double newValue = vo.getOffset() + vo.getAmplitude()*Math.sin(angularFreq*time + vo.getPhaseShift());
        time = time + 1d;
        return new NumericValue(newValue);
    }
View Full Code Here

Examples of com.serotonin.m2m2.rt.dataImage.types.NumericValue

                    decrement = true;
                }
            }
        }

        return new NumericValue(newValue);
    }
View Full Code Here

Examples of com.serotonin.m2m2.rt.dataImage.types.NumericValue

        DataPointRT point = Common.runtimeManager.getDataPoint(vo.getAttractionPointId());
        if (point == null) {
            if (log.isDebugEnabled())
                log.debug("Attraction point is not enabled");
            // Point is not currently active.
            return new NumericValue(current);
        }

        DataValue attractorValue = PointValueTime.getValue(point.getPointValue());
        if (attractorValue == null) {
            if (log.isDebugEnabled())
                log.debug("Attraction point has not vaue");
            return new NumericValue(current);
        }

        double attraction = attractorValue.getDoubleValue();

        // Move half the distance toward the attractor...
        double change = (attraction - current) / 2;

        // ... subject to the maximum change allowed...
        if (change < 0 && -change > vo.getMaxChange())
            change = -vo.getMaxChange();
        else if (change > vo.getMaxChange())
            change = vo.getMaxChange();

        // ... and a random fluctuation.
        change += RANDOM.nextDouble() * vo.getVolatility() * 2 - vo.getVolatility();

        if (log.isDebugEnabled())
            log.debug("attraction=" + attraction + ", change=" + change);

        return new NumericValue(current + change);
    }
View Full Code Here

Examples of com.serotonin.m2m2.rt.dataImage.types.NumericValue

        int i  = b.getInt();
        dataValue = new MultistateValue(i);
        break;
      case DataTypes.NUMERIC:
        double d  = b.getDouble();
        dataValue = new NumericValue(d);
        break;
      default:
        throw new ShouldNeverHappenException("Data type of " + dataType + " is not supported");
    }
   
View Full Code Here

Examples of com.serotonin.m2m2.rt.dataImage.types.NumericValue

                    new Object[] { point.getReportPointId() }, new RowCallbackHandler() {
                        @Override
                        public void processRow(ResultSet rs) throws SQLException {
                            switch (dataType) {
                            case (DataTypes.NUMERIC):
                                edv.setValue(new NumericValue(rs.getDouble(1)));
                                break;
                            case (DataTypes.BINARY):
                                edv.setValue(new BinaryValue(rs.getDouble(1) == 1));
                                break;
                            case (DataTypes.MULTISTATE):
View Full Code Here

Examples of mil.nga.giat.geowave.index.sfc.data.NumericValue

   */
  public static Constraints basicConstraintsFromPoint(
      final double latitudeDegrees,
      final double longitudeDegrees ) {
    // Create a NumericData object using the x axis
    final NumericData latitude = new NumericValue(
        latitudeDegrees);

    // Create a NumericData object using the y axis
    final NumericData longitude = new NumericValue(
        longitudeDegrees);

    final Map<Class<? extends NumericDimensionDefinition>, NumericData> constraintsPerDimension = new HashMap<Class<? extends NumericDimensionDefinition>, NumericData>();
    // Create and return a new IndexRange array with an x and y axis
    // range
View Full Code Here

Examples of net.fortytwo.ripple.model.NumericValue

    // Note: objects which are not equivalent in Ripple (e.g. a wrapped URI and
    // a wrapped xsd:anyURI-typed literal) may map to equivalent Java objects.
    private Object toJavaObject(final RippleValue v) throws ScriptException {
        if (v instanceof NumericValue) {
            NumericValue n = (NumericValue) v;
            switch (n.getDatatype()) {
                case DECIMAL:
                    return n.decimalValue();
                case DOUBLE:
                    return n.doubleValue();
                case FLOAT:
                    return n.floatValue();
                case INTEGER:
                    return n.intValue();
                case LONG:
                    return n.longValue();
                default:
                    throw new ScriptException("numeric value of unexpected type: " + v);
            }
        } else if (v instanceof RDFValue) {
            return toJavaObject(((RDFValue) v).sesameValue());
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.