public short put( int key, short value ) { synchronized( mutex ) { return m.put( key, value ); } } public short remove( int key ) {
/** * Inserts a key/value pair into the map. * * @param key an <code>Object</code> value * @param value an <code>Object</code> value * @return the previous value associated with <tt>key</tt>, * or Short(0) if none was found. */ public Short put( Integer key, Short value ) { int k; short v; if ( key == null ) { k = _map.getNoEntryKey(); } else { k = unwrapKey( key ); } if ( value == null ) { v = _map.getNoEntryValue(); } else { v = unwrapValue( value ); } short retval = _map.put( k, v ); if ( retval == _map.getNoEntryValue() ) { return null; } return wrapValue( retval ); }
public short put( int key, short value ) { synchronized( mutex ) { return m.put( key, value ); } } public short remove( int key ) {
@Override public short put( int key, short value ) { synchronized( mutex ) { return m.put( key, value ); } } @Override
public short put( int key, short value ) { synchronized( mutex ) { return m.put( key, value ); } } public short remove( int key ) {
public short put( int key, short value ) { synchronized( mutex ) { return m.put( key, value ); } } public short remove( int key ) {
@Override public final void read(ObjectInputStream is, int count) throws IOException { for (int i=0; i<count; ++i) { final long value = is.readLong(); this.values.put(i, value); if (value != defaultValueAsLong) { final short zoneId = is.readShort(); this.zoneIds.put(i, zoneId); } } }
/** * Inserts a key/value pair into the map. * * @param key an <code>Object</code> value * @param value an <code>Object</code> value * @return the previous value associated with <tt>key</tt>, * or Short(0) if none was found. */ @Override public Short put( Integer key, Short value ) { int k = unwrapKey( key ); short v = unwrapValue( value ); if ( _map.containsKey( k ) ) { short retval = _map.put( k, v ); return wrapValue( retval); } _map.put( k, v ); return null; }
@Override public Array<ZonedDateTime> fill(ZonedDateTime value, int start, int end) { final long fillValue = value != null ? value.toInstant().toEpochMilli() : nullValue; if (fillValue == defaultValueAsLong) { this.values.clear(); this.zoneIds.clear(); } else { final short fillZoneId = value != null ? zoneIdMap1.get(value.getZone()) : NULL_ZONE; for (int i=start; i<end; ++i) { this.values.put(i, fillValue); this.zoneIds.put(i, fillZoneId); } } return this; }
@Override public final ZonedDateTime setValue(int index, ZonedDateTime value) { this.checkBounds(index, length); final ZonedDateTime oldValue = getValue(index); final long valueAsLong = value == null ? nullValue : value.toInstant().toEpochMilli(); if (valueAsLong == defaultValueAsLong) { this.values.remove(index); this.zoneIds.remove(index); return oldValue; } else { final short zoneId = value == null ? NULL_ZONE : zoneIdMap1.get(value.getZone()); this.values.put(index, valueAsLong); this.zoneIds.put(index, zoneId); return oldValue; } }
@Override() public final Array<ZonedDateTime> copy(int[] indexes) { final SparseArrayOfZonedDateTimes clone = new SparseArrayOfZonedDateTimes(indexes.length, defaultValue); for (int i = 0; i < indexes.length; ++i) { final long value = getLong(indexes[i]); if (value != defaultValueAsLong) { clone.values.put(i, value); clone.zoneIds.put(i, this.zoneIds.get(i)); } } return clone; }
@Override() public final Array<ZonedDateTime> copy(int start, int end) { final int length = end - start; final SparseArrayOfZonedDateTimes clone = new SparseArrayOfZonedDateTimes(length, defaultValue); for (int i=0; i<length; ++i) { final long value = getLong(start+i); if (value != defaultValueAsLong) { final short zoneId = zoneIds.get(start+i); clone.setLong(i, value); clone.zoneIds.put(i, zoneId); } } return clone; }
@Override public final Array<ZonedDateTime> update(int toIndex, Array<ZonedDateTime> from, int fromIndex, int length) { if (from instanceof SparseArrayOfZonedDateTimes) { final SparseArrayOfZonedDateTimes other = (SparseArrayOfZonedDateTimes)from; for (int i=0; i<length; ++i) { this.values.put(toIndex + i, other.values.get(fromIndex + i)); this.zoneIds.put(toIndex + i, other.zoneIds.get(fromIndex + i)); } } else { for (int i=0; i<length; ++i) { final ZonedDateTime update = from.getValue(fromIndex + i); this.setValue(toIndex + i, update); } } return this; }
@Override public final Array<ZonedDateTime> swap(int i, int j) { final long v1 = values.get(i); final long v2 = values.get(j); final short z1 = zoneIds.get(i); final short z2 = zoneIds.get(j); if (v1 == defaultValueAsLong) { this.values.remove(j); this.zoneIds.remove(j); } else { this.values.put(j, v1); this.zoneIds.put(j, z1); } if (v2 == defaultValueAsLong) { this.values.remove(i); this.zoneIds.remove(i); } else { this.values.put(i, v2); this.zoneIds.put(i, z2); } return this; }
@Override public final long setLong(int index, long value) { this.checkBounds(index, length); final long oldValue = getLong(index); if (value == defaultValueAsLong) { this.values.remove(index); this.zoneIds.remove(index); return oldValue; } else { final short zoneId = zoneIds.get(index); this.values.put(index, value); this.zoneIds.put(index, zoneId != NULL_ZONE ? zoneId : UTC_ZONE); return oldValue; } }
/** * Inserts a key/value pair into the map. * * @param key an <code>Object</code> value * @param value an <code>Object</code> value * @return the previous value associated with <tt>key</tt>, * or Short(0) if none was found. */ public Short put( Integer key, Short value ) { int k; short v; if ( key == null ) { k = _map.getNoEntryKey(); } else { k = unwrapKey( key ); } if ( value == null ) { v = _map.getNoEntryValue(); } else { v = unwrapValue( value ); } short retval = _map.put( k, v ); if ( retval == _map.getNoEntryValue() ) { return null; } return wrapValue( retval ); }
/** * Inserts a key/value pair into the map. * * @param key an <code>Object</code> value * @param value an <code>Object</code> value * @return the previous value associated with <tt>key</tt>, * or Short(0) if none was found. */ public Short put( Integer key, Short value ) { int k; short v; if ( key == null ) { k = _map.getNoEntryKey(); } else { k = unwrapKey( key ); } if ( value == null ) { v = _map.getNoEntryValue(); } else { v = unwrapValue( value ); } short retval = _map.put( k, v ); if ( retval == _map.getNoEntryValue() ) { return null; } return wrapValue( retval ); }
/** * Inserts a key/value pair into the map. * * @param key an <code>Object</code> value * @param value an <code>Object</code> value * @return the previous value associated with <tt>key</tt>, * or Short(0) if none was found. */ public Short put( Integer key, Short value ) { int k; short v; if ( key == null ) { k = _map.getNoEntryKey(); } else { k = unwrapKey( key ); } if ( value == null ) { v = _map.getNoEntryValue(); } else { v = unwrapValue( value ); } short retval = _map.put( k, v ); if ( retval == _map.getNoEntryValue() ) { return null; } return wrapValue( retval ); }