JointDataList.java 983 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package at.acdp.urweb.sclient.data;
  2. import at.acdp.urweb.CountDataInputStream;
  3. import com.eclipsesource.json.JsonObject;
  4. import java.io.IOException;
  5. import java.util.Arrays;
  6. //49 byte
  7. public class JointDataList implements IRead, IJsonObject{
  8. JointData[] jds;
  9. //TODO: float/double propably wrong
  10. //total length 41 bytes
  11. public void read(CountDataInputStream di, int size) throws IOException {
  12. int joints = size / 41;
  13. JointData[] jds = new JointData[size];
  14. for (int i = 0; i < joints; i++) {
  15. JointData jd = new JointData();
  16. jd.read(di, size);
  17. jds[i] = jd;
  18. }
  19. this.jds=jds;
  20. }
  21. @Override
  22. public String toString() {
  23. return "{\"JointDataList\":{"
  24. + " \"jds\":" + Arrays.toString(jds)
  25. + "}}";
  26. }
  27. @Override
  28. public JsonObject toJSON() {
  29. return new JsonObject().add("jds",Arrays.toString(jds));
  30. }
  31. }