public CqNameToOpSingleEntry(String name, Integer op) { initializeName(name); this.op = op.intValue(); }
@Override public void add(String name, Integer op) { if (isEmpty()) { this.name = new String[] {name}; this.op = op.intValue(); } else if (this.name[0].equals(name)) { this.op = op.intValue(); } else { throw new IllegalStateException("tried to add to a full CqNameToOpSingleEntry"); } }
@Override public void sendTo(DataOutput out) throws IOException { // When serialized it needs to look just as if writeObject was called on a HASH_MAP out.writeByte(DSCODE.HASH_MAP.toByte()); int size = size(); InternalDataSerializer.writeArrayLength(size, out); if (size > 0) { DataSerializer.writeObject(this.name[0], out); DataSerializer.writeObject(Integer.valueOf(this.op), out); } }
String cqNamesKey = DataSerializer.<String>readObject(in); Integer cqNamesValue = DataSerializer.<Integer>readObject(in); value = new CqNameToOpSingleEntry(cqNamesKey, cqNamesValue); } else if (cqNamesSize == 0) { value = new CqNameToOpSingleEntry(null, 0); } else { value = new CqNameToOpHashMap(cqNamesSize);
public void addClientCq(ClientProxyMembershipID clientId, String cqName, Integer cqEvent) { if (this._clientCqs == null) { this._clientCqs = new ClientCqConcurrentMap(); this._hasCqs = true; } CqNameToOp cqInfo = this._clientCqs.get(clientId); if (cqInfo == null) { cqInfo = new CqNameToOpSingleEntry(cqName, cqEvent); this._clientCqs.put(clientId, cqInfo); } else if (!cqInfo.isFull()) { cqInfo.add(cqName, cqEvent); } else { cqInfo = new CqNameToOpHashMap((CqNameToOpSingleEntry) cqInfo); cqInfo.add(cqName, cqEvent); this._clientCqs.put(clientId, cqInfo); } }
@Override public String[] getNames() { return (isEmpty()) ? EMPTY_NAMES_ARRAY : this.name; }
@Override public int size() { return isEmpty() ? 0 : 1; }
@Override public boolean isFull() { return !isEmpty(); } }
@Override public void addToMessage(Message message) { if (!isEmpty()) { message.addStringPart(this.name[0], true); message.addIntPart(this.op); } }