Package fr.neatmonster.nocheatplus.checks.moving

Examples of fr.neatmonster.nocheatplus.checks.moving.LocationTrace.addEntry()


    double mergeDist = 0.5;
    LocationTrace trace = new LocationTrace(size, mergeDist);
    double x = 0;
    double y = 0;
    double z = 0;
    trace.addEntry(0 , x, y, z);
    for (int i = 0; i < size * 2; i ++) {
      x += 0.5;
      trace.addEntry(i + 1, x, y, z);
      if (Math.abs(trace.size() - (1 + i / 2)) > 1 ) {
        fail("Wrong size, expect roughly half of " + (i + 1) + ", got instead: " + trace.size());
View Full Code Here


    double y = 0;
    double z = 0;
    trace.addEntry(0 , x, y, z);
    for (int i = 0; i < size * 2; i ++) {
      x += 0.5;
      trace.addEntry(i + 1, x, y, z);
      if (Math.abs(trace.size() - (1 + i / 2)) > 1 ) {
        fail("Wrong size, expect roughly half of " + (i + 1) + ", got instead: " + trace.size());
      }
    }
    Iterator<TraceEntry> it = trace.oldestIterator();
View Full Code Here

    int size = 80;
    double mergeDist = -0.1; // Never merge.
    LocationTrace trace = new LocationTrace(size, mergeDist);
    // Adding up to size elements.
    for (int i = 0; i < size; i++) {
      trace.addEntry(i, i, i, i);
    }
    // Test size with one time filled up.
    testIteratorSizeAndOrder(trace);
    // Add size / 2 elements, to test cross-boundary iteration.
    for (int i = 0; i < size / 2; i++) {
View Full Code Here

    }
    // Test size with one time filled up.
    testIteratorSizeAndOrder(trace);
    // Add size / 2 elements, to test cross-boundary iteration.
    for (int i = 0; i < size / 2; i++) {
      trace.addEntry(i + size, i, i, i);
    }
    // Test size again.
    testIteratorSizeAndOrder(trace);
  }
View Full Code Here

    int size = 80;
    double mergeDist = -0.1; // Never merge.
    LocationTrace trace = new LocationTrace(size, mergeDist);
    // Adding up to size elements.
    for (int i = 0; i < size; i++) {
      trace.addEntry(i, i, i, i);
    }
    for (int i = 0; i < size; i++) {
      Iterator<TraceEntry> it = trace.maxAgeIterator(i);
      long got = it.next().time;
      if (got != i) {
View Full Code Here

  @Test
  public void testMaxAgeFirstElementAnyway() {
    int size = 80;
    double mergeDist = -0.1; // Never merge.
    LocationTrace trace = new LocationTrace(size, mergeDist);
    trace.addEntry(0, 0, 0, 0);
    if (!trace.maxAgeIterator(1000).hasNext()) {
      fail("Expect iterator (maxAge) to always contain the latest element.");
    }
    trace.addEntry(1, 0, 0, 0);
    final Iterator<TraceEntry> it = trace.maxAgeIterator(2);
View Full Code Here

    LocationTrace trace = new LocationTrace(size, mergeDist);
    trace.addEntry(0, 0, 0, 0);
    if (!trace.maxAgeIterator(1000).hasNext()) {
      fail("Expect iterator (maxAge) to always contain the latest element.");
    }
    trace.addEntry(1, 0, 0, 0);
    final Iterator<TraceEntry> it = trace.maxAgeIterator(2);
    if (!it.hasNext()) {
      fail("Expect iterator (maxAge) to always contain the latest element.");
    }
    it.next();
View Full Code Here

    if (trace.size() != 0) {
      fail("Size must be 0 at start.");
    }
    // Adding up to size elements.
    for (int i = 0; i < size ; i++) {
      trace.addEntry(i, i, i, i);
      if (trace.size() != i + 1) {
        fail("Wrong size, expect " + (i + 1) + ", got instead: " + trace.size());
      }
    }
    // Adding a lot of elements.
View Full Code Here

        fail("Wrong size, expect " + (i + 1) + ", got instead: " + trace.size());
      }
    }
    // Adding a lot of elements.
    for (int i = 0; i < 1000; i ++) {
      trace.addEntry(i + size, i, i, i);
      if (trace.size() != size) {
        fail("Wrong size, expect " + size + ", got instead: " + trace.size());
      }
    }
  }
View Full Code Here

  public void testMergeZeroDist() {
    int size = 80;
    double mergeDist = 0.0;
    LocationTrace trace = new LocationTrace(size, mergeDist);
    for (int i = 0; i < 1000; i ++) {
      trace.addEntry(i + size, 0 , 0, 0);
      if (trace.size() != 1) {
        fail("Wrong size, expect 1, got instead: " + trace.size());
      }
    }
  }
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.