Package zephyropen.state

Examples of zephyropen.state.TimedEntry


      return;
    if (data.equals(""))
      return;
   
    // add to state keeping object
    state.add(new TimedEntry(data, time));
  }
View Full Code Here


 
  /** add new entry */
  public void add(String data) {
    if (data == null) return;
    if (data.equals("")) return;
    state.add(new TimedEntry(data));
  }
View Full Code Here

   *
   * @param value
   *            is the new current value of this state object
   */
  public void update(double value) {
    list.setElementAt(new TimedEntry(String.valueOf(value)), list.size() - 1);

    // track input speed
    last = System.currentTimeMillis();
  }
View Full Code Here

  /**
   * Use the current time for this state objects latest update
   */
  public void touch() {
   
    list.setElementAt(new TimedEntry(getNewestValueString()), list.size() - 1);

    // track input speed
    last = System.currentTimeMillis();
  }
View Full Code Here

  /** */
  public double[] getScaledData() {

    double[] data = new double[list.size()];
    TimedEntry entry = null;
    for (int i = 0; i < list.size(); i++) {

      entry = list.get(i);
      data[i] = scale(entry.getValueDouble());
    }
    return data;
  }
View Full Code Here

  /**  */
  public double[] getScaledData(double min, double max) {

    double[] data = new double[list.size()];
    TimedEntry entry = null;
    for (int i = 0; i < list.size(); i++) {
      entry = list.get(i);
      data[i] = scale(min, (float) entry.getValueDouble(), max);
    }
    return data;
  }
View Full Code Here

  }

  /** */
  protected void calculateAverage() {

    TimedEntry entry = null;
    double value = 0;
    double sum = 0;

    // clear stats
    min = Double.MAX_VALUE;
    max = Double.MIN_VALUE;

    for (int i = 0; i < list.size(); i++) {

      entry = list.get(i);
      value = entry.getValueDouble();
      sum += value;

      if (value > max) {
        max = value;
        maxIndex = i;
View Full Code Here

  }

  /** */
  public Double getNewestValue() {

    TimedEntry entry = getNewest();

    if (entry == null)
      return 0.0;

    return entry.getValueDouble();
  }
View Full Code Here

  public int getMaxInt() {

    if (list.isEmpty())
      return 0;

    TimedEntry entry = list.get(maxIndex);
    return (int) entry.getValueDouble();
  }
View Full Code Here

  public int getMinInt() {

    if (list.isEmpty())
      return 0;

    TimedEntry entry = list.get(minIndex);
    return (int) entry.getValueDouble();
  }
View Full Code Here

TOP

Related Classes of zephyropen.state.TimedEntry

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.