public String toString() {
    String string = super.toString();
    string +=
        "; GroupMod:"
            + "cmd="
            + command
            + ";type="
            + groupType
            + ";anum="
            + actionNum
            + ";gid="
            + groupId
            + ";cid="
            + counterId;

    if (actionList == null) {
      string += "actionList=null";
    } else {
      for (OFAction action : actionList) {
        if (action != null) {
          string += ";act=" + action.toString();
        }
      }
    }

    return string;
  }
  @Override
  public OFGroupMod clone() throws CloneNotSupportedException {
    OFGroupMod groupMod = (OFGroupMod) super.clone();

    if (null != actionList && 0 != actionList.size() && 0 != actionNum) {
      List<OFAction> neoActionList = new ArrayList<OFAction>();
      for (OFAction ofAction : this.actionList) {
        neoActionList.add(ofAction.clone());
      }
      groupMod.setActionList(neoActionList);
    }

    return groupMod;
  }
  public String toBytesString() {
    String string = super.toString();
    string +=
        HexString.toHex(command)
            + HexString.toHex(groupType)
            + HexString.toHex(actionNum)
            + HexString.ByteZeroEnd(1)
            + HexString.toHex(groupId)
            + HexString.toHex(counterId)
            + HexString.ByteZeroEnd(4);

    if (actionList == null) {
      string +=
          HexString.ByteZeroEnd(OFGlobal.OFP_MAX_ACTION_NUMBER_PER_GROUP * OFAction.MAXIMAL_LENGTH);
    } else {
      OFAction action;

      if (actionNum > actionList.size()) {
        throw new RuntimeException(
            "actionNum " + actionNum + " > actionList.size()" + actionList.size());
      }

      int i;
      for (i = 0; i < actionNum && i < OFGlobal.OFP_MAX_ACTION_NUMBER_PER_GROUP; i++) {
        action = actionList.get(i);
        if (action == null) {
          string += HexString.ByteZeroEnd(OFAction.MAXIMAL_LENGTH);
        } else {
          string += action.toBytesString();
          if (action.getLength() < OFAction.MAXIMAL_LENGTH) {
            string += HexString.ByteZeroEnd(OFAction.MAXIMAL_LENGTH - action.getLength());
          }
        }
      }
      if (i < OFGlobal.OFP_MAX_ACTION_NUMBER_PER_GROUP) {
        string +=
            HexString.ByteZeroEnd(
                (OFGlobal.OFP_MAX_ACTION_NUMBER_PER_GROUP - i) * OFAction.MAXIMAL_LENGTH);
      }
    }

    return string;
  }
  @Override
  public void writeTo(ChannelBuffer data) {
    super.writeTo(data);
    data.writeByte(command);
    data.writeByte(groupType);
    data.writeByte(actionNum);
    data.writeByte(0);
    data.writeInt(groupId);

    data.writeInt(counterId);
    data.writeZero(4);

    if (actionList == null) {
      data.writeZero(OFGlobal.OFP_MAX_ACTION_NUMBER_PER_GROUP * OFAction.MAXIMAL_LENGTH);
    } else {
      OFAction action;

      if (actionNum > actionList.size()) {
        throw new RuntimeException(
            "actionNum " + actionNum + " > actionList.size()" + actionList.size());
      }

      int i;
      for (i = 0; i < actionNum && i < OFGlobal.OFP_MAX_ACTION_NUMBER_PER_GROUP; i++) {
        action = actionList.get(i);
        if (action == null) {
          data.writeZero(OFAction.MAXIMAL_LENGTH);
        } else {
          action.writeTo(data);
          if (action.getLength() < OFAction.MAXIMAL_LENGTH) {
            data.writeZero(OFAction.MAXIMAL_LENGTH - action.getLength());
          }
        }
      }
      if (i < OFGlobal.OFP_MAX_ACTION_NUMBER_PER_GROUP) {
        data.writeZero((OFGlobal.OFP_MAX_ACTION_NUMBER_PER_GROUP - i) * OFAction.MAXIMAL_LENGTH);
      }
    }
  }
 @Override
 public void writeTo(ByteBuffer data) {
   super.writeTo(data);
   data.putInt(0); // pad
 }
 @Override
 public void readFrom(ByteBuffer data) {
   super.readFrom(data);
   data.getInt(); // pad
 }
 public OFXActionPopShim() {
   super.setType(OFActionType.POP_SHIM);
   super.setLength((short) MINIMUM_LENGTH);
 }