Package it.polito.appeal.traci.protocol

Examples of it.polito.appeal.traci.protocol.Command


    new Command(A_COMMAND_ID);
  }

  @Test
  public void testId() {
    Command cmd = new Command(sampleStorage());
    assertEquals(A_COMMAND_ID, cmd.id());
  }
View Full Code Here


    assertEquals(A_COMMAND_ID, cmd.id());
  }

  @Test
  public void testContent() {
    Command cmd = new Command(sampleStorage());
    assertEquals(AN_INTEGER, cmd.content().readInt());
  }
View Full Code Here

    assertEquals(AN_INTEGER, cmd.content().readInt());
  }

  @Test
  public void testWriteRawTo() {
    Command cmd = new Command(sampleStorage());
    Storage s = new Storage();
    cmd.writeRawTo(s);
    Iterator<Byte> bytes = s.getStorageList().iterator();
    assertEquals(0, (int)bytes.next());
    assertEquals(0, (int)bytes.next());
    assertEquals(0, (int)bytes.next());
    assertEquals(0, (int)bytes.next());
View Full Code Here

  List<Command> getRequests() {
    if (time == -1)
      throw new IllegalStateException("time must be set first");
   
    List<Command> reqs = super.getRequests();
    Command req = reqs.iterator().next();
    req.content().writeByte(Constants.TYPE_INTEGER);
    req.content().writeInt(time);
    return reqs;
  }
View Full Code Here

   
  }

  public SumoCommand(Object input1, Object input2, Object input3, Object[] array){
   
    this.cmd = new Command((Integer) input1);
    this.input1=(Integer) input1;
    this.input2=(Integer) input2;
   
    cmd.content().writeUnsignedByte((Integer) input2);
    cmd.content().writeStringASCII(String.valueOf(input3));
View Full Code Here

   
  }

  public SumoCommand(Object input1, Object input2, Object input3, Object input){
   
    this.cmd = new Command((Integer) input1);
    this.input1=(Integer) input1;
    this.input2=(Integer) input2;
   
    cmd.content().writeUnsignedByte((Integer) input2);
    cmd.content().writeStringASCII(String.valueOf(input3));
View Full Code Here

    List<ResponseContainer> responses = respMsg.responses();
    if (commands.size() > responses.size())
      throw new TraCIException("not enough responses received");
   
    for (int i=0; i<commands.size(); i++) {
      Command cmd = commands.get(i);
      ResponseContainer responsePair = responses.get(i);
      StatusResponse statusResp = responsePair.getStatus();
      verify("command and status IDs match", cmd.id(), statusResp.id());
      if (statusResp.result() != Constants.RTYPE_OK)
        throw new TraCIException("SUMO error for command "
            + statusResp.id() + ": " + statusResp.description());
    }
   
View Full Code Here

  int output_type;

  //Get Statements
  public SumoCommand(Object input1, Object input2, Object input3, Object response, Object output_type){
 
    this.cmd = new Command((Integer) input1);
    cmd.content().writeUnsignedByte((Integer) input2);
    cmd.content().writeStringASCII(String.valueOf(input3));
   
    this.input1=(Integer) input1;
    this.input2=(Integer) input2;
View Full Code Here

   
  }

  public SumoCommand(Object input1, Object input2, Object input3, Object[] array, Object response, Object output_type){
   
    this.cmd = new Command((Integer) input1);
    cmd.content().writeUnsignedByte((Integer) input2);
    cmd.content().writeStringASCII(String.valueOf(input3));
   
    if(array.length == 1){
      add_type(array[0]);
View Full Code Here

  public SumoCommand(Object input1, Object input3){
   
    this.input1=(Integer) input1;
    this.input2=(Integer) input3;
   
    this.cmd = new Command((Integer) input1);
    this.add_variable(input3);
   
    this.raw = new LinkedList<Object>();
    this.raw.add(input1);
    this.raw.add(input3);
View Full Code Here

TOP

Related Classes of it.polito.appeal.traci.protocol.Command

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.