Package org.timerescue.element

Examples of org.timerescue.element.Element$Constants


   */
  private Action attack() {
    // TODO Check on other skills and see how to attack
    DefaultAttackAction attack = getAttack();
    //Looking for other agents
    Element element;
    Agent target = null, temp = null;
    int target_life, temp_life;
    for (int i = 0; i < surroundings.length; i++) {
      element = surroundings[i];
      if (element instanceof Agent){           
View Full Code Here


    // TODO Optimization for this
    InformationParameters information_paramaters = new InformationParametersHash();
    List<Serializable> data_elements = new ArrayList<Serializable>();
    //Sent all closer Elements in the map
    for (Iterator<Element> iterator = elements.iterator(); iterator.hasNext();) {
      Element element =  iterator.next();
     
      if (center.isClose(element.getCoordinate(), distance_sense)){
        //information_paramaters.addParamData(Constants.SURROUND_PROPERTY, element);
       
      }
    }
    //Sent all closer Agents in the map
View Full Code Here

   */
  @Test
  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 method for {@link org.timerescue.action.ExecutionContext#fromSerial(java.lang.String)}.
   */
  @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());
    }
    String temp1 = ec.toSerial();
    String temp2 = ec2.toSerial();
    assertArrayEquals(temp1.getBytes(), temp2.getBytes());
  }
View Full Code Here

   * Test method for {@link org.timerescue.information.InformationParametersSerials#getParam(java.lang.String)}.
   */
  @Test
  public void testGetParam() {
    InformationParametersSerials info = new InformationParametersSerials();
    Element el1 = new Element(), el2 = new Element();
    el1.setCoordinate(1, 2);
    info.addParamData("PROP", el1);
    try {
      el2 = (Element)info.getParam("PROP");
    } catch (InvalidPropertyException e) {
      // TODO Auto-generated catch block
      fail(e.getMessage());
    }
    assertArrayEquals(el1.toSerial().getBytes(), el2.toSerial().getBytes());
  }
View Full Code Here

    //TODO
    InformationParametersSerials info = new InformationParametersSerials();
    //Element[] array = new Element[2];
    ArrayList<Serializable> array = new ArrayList<Serializable>();
    ArrayList<Serializable> array2 = new ArrayList<Serializable>();
    Element el1 = new Element(), el2 = new Element(), el3, el4;
    el1.setCoordinate(1, 2);
    el2.setCoordinate(3, 4);
    array.add(el1);
    array.add(el2);
    info.addArrayParamData("ARRAY", array);
    try {
      array2 = (ArrayList<Serializable>) info.getArrayParam("ARRAY");
    } catch (InvalidPropertyException e) {
      // TODO Auto-generated catch block
      fail(e.getMessage());
    }
    el3 = (Element)array2.get(0);
    el4 = (Element)array2.get(1);
    assertArrayEquals(el1.toSerial().getBytes(), el3.toSerial().getBytes());
    assertArrayEquals(el2.toSerial().getBytes(), el4.toSerial().getBytes());
  }
View Full Code Here

TOP

Related Classes of org.timerescue.element.Element$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.