private void generateColumn( int x, int z ) { this.chunkLock.writeLock().lock(); try { ChunkColumn chunkColumnColumn = new ChunkColumn( x, z, this ); for ( int i = 0; i < chunkColumnColumn.getSections().length; i++ ) { ChunkSection section = new ChunkSection( chunkColumnColumn ); chunkColumnColumn.getSections()[i] = section; } this.generator.generate( chunkColumnColumn ); TByteObjectMap<ChunkColumn> c = this.columns.get( (byte) x ); if ( c == null ) { this.columns.put( (byte) x, c = new TByteObjectHashMap<>() ); } c.put( (byte) z, chunkColumnColumn ); } finally { this.chunkLock.writeLock().unlock(); } }
@Override @SuppressWarnings("unchecked") public <T extends Message, U extends MessageHandler<T>> void register(Addon addon, Class<T> message, Class<U> handler) { if (locked) { throw new IllegalStateException(addon.getDescription().getName() + " attempted to register a message after INITIALIZE phase! This is NOT ALLOWED."); } final TByteObjectHashMap<Class<? extends Message>> discriminators; try { discriminatorsField.setAccessible(true); discriminators = (TByteObjectHashMap<Class<? extends Message>>) discriminatorsField.get(this); discriminatorsField.setAccessible(false); } catch (IllegalAccessException e) { game.getLogger().info("Encountered fatal exception when " + addon.getDescription().getName() + " attempted to register [" + message.getSimpleName() + "]", e); return; } if (discriminators.containsValue(message)) { game.getLogger().warn(addon.getDescription().getName() + " attempted to register [" + message + "] twice!"); return; } addDiscriminator(discriminators.size() == 0 ? 0 : discriminators.size() + 1, message); if (handler != null) { handlers.put(message, handler); game.getLogger().info(addon.getDescription().getName() + " has registered message [" + message.getSimpleName() + "] with handler [" + handler.getSimpleName() + "] in the pipeline"); } else { game.getLogger().info(addon.getDescription().getName() + " has registered message [" + message.getSimpleName() + "] with no handler in the pipeline"); } }
/** * Constructor which specifies the index's key. * * @param keyDefinition * the {@code IndexKeyDefinition} to be used */ public TroveByteIndexedCollection(final IndexKeyDefinition keyDefinition) { super(keyDefinition); if (!keyDefinition.isSingleTypedKey(Byte.class)) { throw new IllegalArgumentException("The key must be a single Byte"); } troveMap = new TByteObjectHashMap<Object>(); }
public AutoDeltaBoolObjectMap(Function<ByteBuffer, V> valueCreator) { this.changes = new ArrayList<>(5); this.container = new TByteObjectHashMap<>(); this.baselineCommandCount = 0; this.valueCreator = valueCreator; }
public AutoDeltaBoolStringMap() { this.changes = new ArrayList<>(5); this.container = new TByteObjectHashMap<>(); this.baselineCommandCount = 0; }
public AutoDeltaByteObjectMap(Function<ByteBuffer, V> valueCreator) { this.changes = new ArrayList<>(5); this.container = new TByteObjectHashMap<>(); this.baselineCommandCount = 0; this.valueCreator = valueCreator; }
public AutoDeltaByteStringMap() { this.changes = new ArrayList<>(5); this.container = new TByteObjectHashMap<>(); this.baselineCommandCount = 0; }