Package de.uniluebeck.itm.tcpip

Examples of de.uniluebeck.itm.tcpip.Storage


      super(dis, dos, commandID, vehicleID, varID);
    }

    @Override
    protected Point2D readValue(Command resp) throws TraCIException {
      Storage content = resp.content();
      Utils.checkType(content, Constants.POSITION_2D);
      double x = content.readDouble();
      double y = content.readDouble();
      return new Point2D.Double(x, y);
    }
View Full Code Here


    StringQ(DataInputStream dis, DataOutputStream dos, int commandID, String objectID, int varID) {
      super(dis, dos, commandID, objectID, varID);
    }
   
    protected String readValue(Command resp) throws TraCIException {
      Storage content = resp.content();
      Utils.checkType(content, Constants.TYPE_STRING);
      return content.readStringASCII();
    }
View Full Code Here

      super(dis, dos, commandID, vehicleID, varID);
    }

    @Override
    protected Rectangle2D readValue(Command resp) throws TraCIException {
      Storage content = resp.content();
      return new it.polito.appeal.traci.protocol.BoundingBox(content, true);
    }
View Full Code Here

      this.repo = repo;
    }

    @Override
    protected V readValue(Command resp) throws TraCIException {
      Storage content = resp.content();
      Utils.checkType(content, Constants.TYPE_STRING);
      String id = content.readStringASCII();
      try {
        return repo.getByID(id);
      } catch (IOException e) {
        throw new TraCIException(e.toString());
      }
View Full Code Here

    short[] buf = new short[contentLen];
    for (int i=0; i<contentLen; i++) {
      buf[i] = (byte)rawStorage.readUnsignedByte();
    }
   
    content = new Storage(buf);
  }
View Full Code Here

   * @param id
   */
  public Command(int id) {
    if (id > 255)
      throw new IllegalArgumentException("id should fit in a byte");
    content = new Storage();
    this.id = id;
  }
View Full Code Here

   
    dos.writeInt(totalLen);


    for (Command cmd : commands) {
      Storage s = new Storage();
      cmd.writeRawTo(s);
      writeStorage(s, dos, checksum);
    }

    if (log.isDebugEnabled())
View Full Code Here

    int totalLen = dis.readInt() - Integer.SIZE/8;
   
    byte[] buffer = new byte[totalLen];
    dis.readFully(buffer);
   
    Storage s = new Storage(buffer);
   
    while (s.validPos()) {
      StatusResponse sr = new StatusResponse(s);
      ResponseContainer responseContainer;
     
      if (sr.result() != Constants.RTYPE_OK) {
        responseContainer = new ResponseContainer(sr, null);
      }
      else if (sr.id() == Constants.CMD_SIMSTEP2) {
        int nSubResponses = s.readInt();
        List<Command> subResponses = new ArrayList<Command>(
            nSubResponses);
        for (int i = 0; i < nSubResponses; i++) {
          subResponses.add(new Command(s));
        }
View Full Code Here

  protected abstract C makeCollection();
 
  @Override
  protected C readValue(Command resp) throws TraCIException {
    Storage content = resp.content();
    List<String> ids = new StringList(content, true);
    C out = makeCollection();
    for (String id : ids) {
      try {
        out.add(repository.getByID(id));
View Full Code Here

  public void setUp() throws Exception {
  }

  @Test
  public void testCommandStorage() {
    Storage s = sampleStorage();
    new Command(s);
  }
View Full Code Here

TOP

Related Classes of de.uniluebeck.itm.tcpip.Storage

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.