コード例 #1
0
ファイル: Move.java プロジェクト: waqas64/debrief
    public void testTheMove() {
      // ok, create some locations
      WorldLocation locA = new WorldLocation(0, 0, 12);
      WorldLocation locC = new WorldLocation(0, 3, 12);

      Move move = new Move();
      move.setCourse(new Double(60));
      move.setSpeed(new WorldSpeed(12, WorldSpeed.M_sec));
      move.setDistance(new WorldDistance(3, WorldDistance.DEGS));

      // check the initial values are correct
      assertEquals("the course is set", move.getCourse().doubleValue(), 60, 0.01);
      assertEquals("the speed is set", move.getSpeed().getValueIn(WorldSpeed.M_sec), 12, 0.01);
      assertEquals(
          "the distance is set", move.getDistance().getValueIn(WorldDistance.DEGS), 3, 0.01);

      // change course to head east (to ease our testing)
      move.setCourse(new Double(90));

      Status theStat = new Status(12, 12000);
      theStat.setLocation(locA);
      theStat.setSpeed(new WorldSpeed(12, WorldSpeed.Kts));

      DemandedStatus res = move.decide(theStat, null, null, null, null, 1000);

      // did it work?
      assertEquals("course set correctly", ((SimpleDemandedStatus) res).getCourse(), 90, 0.01);
      assertEquals("speed set correctly", ((SimpleDemandedStatus) res).getSpeed(), 12, 0.01);
      assertEquals("depth not set", ((SimpleDemandedStatus) res).getHeight(), -12, 0.01);

      assertEquals(
          "target location set correctly",
          move._theDestination.subtract(locC).getRange(),
          0,
          0.001);

      // fiddle with the depth
      move.setHeight(new WorldDistance(-55, WorldDistance.METRES));

      res = move.decide(theStat, null, null, null, null, 1000);

      // did it work?
      assertEquals("course set correctly", ((SimpleDemandedStatus) res).getCourse(), 90, 0.01);
      assertEquals("speed set correctly", ((SimpleDemandedStatus) res).getSpeed(), 12, 0.01);
      assertEquals("depth set", ((SimpleDemandedStatus) res).getHeight(), -55, 0.01);
    }
コード例 #2
0
ファイル: Move.java プロジェクト: waqas64/debrief
 /**
  * constructor for editable details of a set of Layers
  *
  * @param data the Layers themselves
  */
 public MoveInfo(final Move data) {
   super(data, data.getName(), "Move");
 }