public ExtendedUUID put(byte[] key, byte[] val) { return put(0, key, val); }
public ExtendedUUID put(String key, byte[] val) { return put(Util.stringToBytes(key), val); }
protected ExtendedUUID put(int start_index, byte[] key, byte[] val) { if(val != null && val.length > 0xff) throw new IllegalArgumentException("value has to be <= " + 0xff + " bytes"); if(keys == null) resize(3); for(int i=start_index; i < keys.length; i++) { byte[] k=keys[i]; if(k == null || Arrays.equals(key, k)) { keys[i]=key; values[i]=val; return this; } } int index=keys.length; resize(keys.length + 3); return put(index, key, val); }
@Override public <T extends FlagsUUID> T addContents(T o) { super.addContents(o); if(o instanceof ExtendedUUID) { ExtendedUUID other=(ExtendedUUID)o; if(other.keys != null) { for(int i=0; i < other.keys.length; i++) { byte[] key=other.keys[i]; byte[] val=other.values[i]; if(!keyExists(key)) put(key, val); // overwrite } } } return (T)this; }
public void init() throws Exception { super.init(); if(site == null || site.isEmpty()) throw new IllegalArgumentException("\"site\" must be set"); timer=getTransport().getTimer(); JChannel channel=getProtocolStack().getChannel(); if(channel == null) throw new IllegalStateException("channel must be set"); channel.addAddressGenerator(() -> ExtendedUUID.randomUUID().put(SITE_ID, Util.stringToBytes(site))); }
public ExtendedUUID put(byte[] key, byte[] val) { return put(0, key, val); }
public ExtendedUUID put(String key, byte[] val) { return put(Util.stringToBytes(key), val); }
protected ExtendedUUID put(int start_index, byte[] key, byte[] val) { if(val != null && val.length > 0xff) throw new IllegalArgumentException("value has to be <= " + 0xff + " bytes"); if(keys == null) resize(3); for(int i=start_index; i < keys.length; i++) { byte[] k=keys[i]; if(k == null || Arrays.equals(key, k)) { keys[i]=key; values[i]=val; return this; } } int index=keys.length; resize(keys.length + 3); return put(index, key, val); }
@Override public <T extends FlagsUUID> T addContents(T o) { super.addContents(o); if(o instanceof ExtendedUUID) { ExtendedUUID other=(ExtendedUUID)o; if(other.keys != null) { for(int i=0; i < other.keys.length; i++) { byte[] key=other.keys[i]; byte[] val=other.values[i]; if(!keyExists(key)) put(key, val); // overwrite } } } return (T)this; }
public void init() throws Exception { super.init(); if(site == null || site.isEmpty()) throw new IllegalArgumentException("\"site\" must be set"); timer=getTransport().getTimer(); JChannel channel=getProtocolStack().getChannel(); if(channel == null) throw new IllegalStateException("channel must be set"); channel.addAddressGenerator(() -> ExtendedUUID.randomUUID().put(SITE_ID, Util.stringToBytes(site))); }