Package algorithm

Examples of algorithm.Measurement


      private Collection<Measurement> measurements;

      @Before
      public void setup() {
            measurements = new ArrayList<Measurement> () {{
                add(new Measurement(5,10));
                add(new Measurement(2, 15));
                add(new Measurement(100, 5));
            }};
      }
View Full Code Here


  @Test
  public void SummingAggregation_Produces_Sum() {
    SummingAggregator aggregator = new SummingAggregator(measurements);

    Measurement result = aggregator.aggregate();

    assertEquals(107, result.getX());
    assertEquals(30, result.getY());
  }
View Full Code Here

  @Test
  public void AveragingAggregagtor_Produces_Average() {
    AveragingAggregator aggregator = new AveragingAggregator(measurements);

    Measurement result = aggregator.aggregate();

    assertEquals(35, result.getX());
    assertEquals(10, result.getY());
  }
View Full Code Here

  @Test
  public void LowPassAveragingAggregator_Applys_Filter() {
    LowPassAveragingAggregator aggregator = new LowPassAveragingAggregator(measurements);

    Measurement result = aggregator.aggregate();

    assertEquals(3, result.getX());
    assertEquals(12, result.getY());
  }
View Full Code Here

    return measurements;
  }

  @Override
  protected Measurement aggregateMeasurements() {
    return new Measurement(averageX(measurements), averageY(measurements));

  }
View Full Code Here

    return measurements;
  }

  @Override
  protected Measurement aggregateMeasurements() {
    return new Measurement(sumX(measurements), sumY(measurements));
  }
View Full Code Here

public class SummingStrategy implements IAggregationStrategy {

  @Override
  public Measurement aggregate(Collection<Measurement> measurements) {
    return new Measurement(sumX(measurements), sumY(measurements));
  }
View Full Code Here

public class AveragingStrategy implements IAggregationStrategy {

  @Override
  public Measurement aggregate(Collection<Measurement> measurements) {
    return new Measurement(MeasurementUtil.averageX(measurements), MeasurementUtil.averageY(measurements));
  }
View Full Code Here

      private Collection<Measurement> measurements;

      @Before
      public void setup() {
            measurements = new ArrayList<Measurement> () {{
                add(new Measurement(5,10));
                add(new Measurement(2, 15));
                add(new Measurement(100, 5));
            }};
      }
View Full Code Here

        @Test
        public void SummingAggregation_Produces_Sum() {
          PointsAggregator aggregator = new PointsAggregator(measurements, new EmptyFilter(), new SummingStrategy());

    Measurement result = aggregator.aggregate();

    assertEquals(107, result.getX());
    assertEquals(30, result.getY());
        }
View Full Code Here

TOP

Related Classes of algorithm.Measurement

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.