@SuppressWarnings("unchecked") private void putForCreate(int key, V value) { Entry<V>[] table = this.table; int length = table.length; int index = index(key, length); Entry<V> e = table[index]; while (e != null) { index = nextIndex(index, length); e = table[index]; } table[index] = new Entry<V>(key, value); }
/** * Get the byte value of this field. * * @return the byte value of this field * @throws IOException if the value cannot be read */ public byte getByte() throws IOException { throw wrongFieldType(); }
public boolean containsValue(Object value) { for (Entry<V> e : table) if (e != null && eq(value, e.value)) return true; return false; }
private void prepareFields(final Object subject, final ClonerPutField fields) throws InvalidObjectException { final Map<String, SerializableField> defMap = fields.fieldDefMap; final Map<String, ReadField> map = fields.fieldMap; for (String name : defMap.keySet()) { final SerializableField serializableField = defMap.get(name); if (serializableField.isAccessible()) switch (serializableField.getKind()) { case BOOLEAN: map.put(name, new BooleanReadField(serializableField, serializableField.getBoolean(subject))); continue; case BYTE: map.put(name, new ByteReadField(serializableField, serializableField.getByte(subject))); continue; case CHAR: map.put(name, new CharReadField(serializableField, serializableField.getChar(subject))); continue; case DOUBLE: map.put(name, new DoubleReadField(serializableField, serializableField.getDouble(subject))); continue; case FLOAT: map.put(name, new FloatReadField(serializableField, serializableField.getFloat(subject))); continue; case INT: map.put(name, new IntReadField(serializableField, serializableField.getInt(subject))); continue; case LONG: map.put(name, new LongReadField(serializableField, serializableField.getLong(subject))); continue; case OBJECT: map.put(name, new ObjectReadField(serializableField, serializableField.getObject(subject))); continue; case SHORT: map.put(name, new ShortReadField(serializableField, serializableField.getShort(subject))); continue; default: throw new IllegalStateException(); } } }
public Object get(final String name, final Object val) throws IOException { final ReadField field = clonerPutField.fieldMap.get(name); return field == null || field.isDefaulted() ? val : field.getObject(); } };
@SuppressWarnings("unchecked") private void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); int size = s.readInt(); init(size, loadFactor); for (int i = 0; i < size; i++) { int key = s.readInt(); V value = (V) s.readObject(); putForCreate(key, value); } this.size = size; }
public final boolean equals(final Object obj) { return obj instanceof Entry && equals((Entry<?, ?>) obj); }
public Entry<V> next() { if (! hasNext()) { throw new NoSuchElementException(); } return table[i++]; }
public Object get(final String name, final Object val) throws IOException { final ReadField field = find(name); return field == null || field.isDefaulted() ? val : field.getObject(); } };
/** * Get the short value of this field. * * @return the short value of this field * @throws IOException if the value cannot be read */ public short getShort() throws IOException { throw wrongFieldType(); }
/** * Get the float value of this field. * * @return the float value of this field * @throws IOException if the value cannot be read */ public float getFloat() throws IOException { throw wrongFieldType(); }
/** * Get the double value of this field. * * @return the double value of this field * @throws IOException if the value cannot be read */ public double getDouble() throws IOException { throw wrongFieldType(); }
/** * Get the character value of this field. * * @return the character value of this field * @throws IOException if the value cannot be read */ public char getChar() throws IOException { throw wrongFieldType(); }
/** * Get the integer value of this field. * * @return the integer value of this field * @throws IOException if the value cannot be read */ public int getInt() throws IOException { throw wrongFieldType(); }
/** * Get the object value of this field. * * @return the object value of this field * @throws IOException if the value cannot be read */ public Object getObject() throws IOException { throw wrongFieldType(); }
/** * Get the boolean value of this field. * * @return the boolean value of this field * @throws IOException if the value cannot be read */ public boolean getBoolean() throws IOException { throw wrongFieldType(); }
/** * Get the long value of this field. * * @return the long value of this field * @throws IOException if the value cannot be read */ public long getLong() throws IOException { throw wrongFieldType(); }