Example #1
0
 public int size() {
   return _flow.getProperties() != null
       ? 11
       : _flow.getEcho()
           ? 10
           : _flow.getDrain()
               ? 9
               : _flow.getAvailable() != null
                   ? 8
                   : _flow.getLinkCredit() != null
                       ? 7
                       : _flow.getDeliveryCount() != null
                           ? 6
                           : _flow.getHandle() != null ? 5 : 4;
 }
Example #2
0
    public Object get(final int index) {

      switch (index) {
        case 0:
          return _flow.getNextIncomingId();
        case 1:
          return _flow.getIncomingWindow();
        case 2:
          return _flow.getNextOutgoingId();
        case 3:
          return _flow.getOutgoingWindow();
        case 4:
          return _flow.getHandle();
        case 5:
          return _flow.getDeliveryCount();
        case 6:
          return _flow.getLinkCredit();
        case 7:
          return _flow.getAvailable();
        case 8:
          return _flow.getDrain();
        case 9:
          return _flow.getEcho();
        case 10:
          return _flow.getProperties();
      }

      throw new IllegalStateException("Unknown index " + index);
    }
Example #3
0
  public Flow newInstance(Object described) {
    List l = (List) described;

    Flow o = new Flow();

    if (l.size() <= 3) {
      throw new DecodeException("The outgoing-window field cannot be omitted");
    }

    switch (11 - l.size()) {
      case 0:
        o.setProperties((Map) l.get(10));
      case 1:
        Boolean echo = (Boolean) l.get(9);
        o.setEcho(echo == null ? false : echo);
      case 2:
        Boolean drain = (Boolean) l.get(8);
        o.setDrain(drain == null ? false : drain);
      case 3:
        o.setAvailable((UnsignedInteger) l.get(7));
      case 4:
        o.setLinkCredit((UnsignedInteger) l.get(6));
      case 5:
        o.setDeliveryCount((UnsignedInteger) l.get(5));
      case 6:
        o.setHandle((UnsignedInteger) l.get(4));
      case 7:
        o.setOutgoingWindow((UnsignedInteger) l.get(3));
      case 8:
        o.setNextOutgoingId((UnsignedInteger) l.get(2));
      case 9:
        o.setIncomingWindow((UnsignedInteger) l.get(1));
      case 10:
        o.setNextIncomingId((UnsignedInteger) l.get(0));
    }

    return o;
  }