Package org.timerescue.element

Examples of org.timerescue.element.Coordinate$Constants


    //states holders
    target_state_holder = target.getState_holder();
    attacker_state_holder = attacker.getState_holder();
    //Range
    range = getRange();
    Coordinate target_position = target.getCoordinate(),
        attacker_position = attacker.getCoordinate();
    //Properties
    target_property_holder = target.getProperty_holder();
    attacker_property_holder = attacker.getProperty_holder();
    //TODO Is the target visible?
    int visibility = attacker.getVisibility();
    if(target_position.isClose(attacker_position, visibility)){
      //If the target is close enough for a close range attack
      if (target_position.isClose(attacker_position, range)){
        //Attack the target properties!     
        target_life = target.getLife();     
        if(target_life > 0) {//is it alive?         
          //TODO define a method to obtain the properties casted
          //TODO Define a practical formulas, this is just for testing
View Full Code Here


      int speed = Integer.parseInt(
          wanderer.getProperty_holder().getCurrentProperty(
              Agent.Constants.Property.SPEED));
      //points toward a random direction
      wanderer.move(
          new Coordinate(seed.nextInt(), seed.nextInt(), seed.nextInt()),
          speed);
    } catch (InvalidPropertyException e) {
      // TODO log this
    }
    return null;
View Full Code Here

  public void testSetCoordinate() {
   
    try {
      Element e = new Element();
      e.setCoordinate(6, 8);
      Coordinate c = new Coordinate(6,8);
      assertArrayEquals( c.toSerial().getBytes(), e.getCoordinate().toSerial().getBytes());
    } catch (Exception e) {
      fail("Exception: "+e.getMessage());
    }   
   
  }
View Full Code Here

   */
  @Test
  public void testFromSerial() {
    Element ec = new Element();
    Element ec2 = new Element();
    ec.setCoordinate(new Coordinate(1,2));
    ec2.setCoordinate(new Coordinate(3,4));
    try {
      String temp = ec.toSerial();
      ec2.fromSerial(temp);
    } catch (InvalidSerialException e) {
      fail(e.toString());
View Full Code Here

   * Test method for {@link org.timerescue.information.InformationParametersSerials#getParamSerial(java.lang.String)}.
   */
  @Test
  public void testGetParamSerial() {
    InformationParametersSerials param = new InformationParametersSerials();
    Coordinate cor1 = new Coordinate(1,2), cor2 = new Coordinate(3, 4);
    param.addParamData("PROP", cor1);
    try {
      cor2.fromSerial(param.getParamSerial("PROP"));
    } catch (InvalidSerialException e) {
      // TODO Auto-generated catch block
      fail(e.getMessage());
    }   
    assertArrayEquals(cor1.toSerial().getBytes(), cor2.toSerial().getBytes());
   
  }
View Full Code Here

   */
  @Test
  public void testFromSerial() {
    InformationParametersSerials ec = new InformationParametersSerials();
    InformationParametersSerials ec2 = new InformationParametersSerials();
    ec.addParamData("PROP1", new Coordinate(1,2));
    ec2.addParamData("PROP2", new Coordinate(3,4));
    try {
      String temp = ec.toSerial();
      ec2.fromSerial(temp);
    } catch (InvalidSerialException e) {
      fail(e.toString());
View Full Code Here

  /**
   * Test method for {@link org.timerescue.element.Coordinate#fromSerial(java.lang.String)}.
   */
  @Test
  public void testFromSerial() {
    Coordinate ec = new Coordinate(1, 2);
    Coordinate ec2 = new Coordinate(3, 4);
    try {
      String temp = ec.toSerial();
      ec2.fromSerial(temp);
    } catch (InvalidSerialException e) {
      fail(e.toString());
    }
    String temp1 = ec.toSerial();
    String temp2 = ec2.toSerial();
    assertArrayEquals(temp1.getBytes(), temp2.getBytes());   
  }
View Full Code Here

TOP

Related Classes of org.timerescue.element.Coordinate$Constants

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.