@Override public int hashCode() { return myvalues.hashCode(); } }
/** * Add a key with an associated weight to this set. If the key is already present in this set, the previous * association is replaced. Checks to validate that all keys are of the same type. * * @param key the key to add * @param weight the weight to associate with this key * @return the weight that was previously associated with this key, or null (if there was no previous key) */ public Integer put(K key, Integer weight) { verifyElementCompatibility(key); IntegerFieldValue ifv = putUnChecked(key, new IntegerFieldValue(weight)); return ifv != null ? ifv.getInteger() : null; }
public final FieldValue setFieldValue(Field field, Integer value) { return setFieldValue(field, new IntegerFieldValue(value)); }
public static Struct valueOf(Integer x, Integer y) { Struct ret = new Struct(INSTANCE); ret.setFieldValue(FIELD_X, x != null ? new IntegerFieldValue(x) : null); ret.setFieldValue(FIELD_Y, y != null ? new IntegerFieldValue(y) : null); return ret; }
public final FieldValue setFieldValue(Field field, String value) { return setFieldValue(field, new StringFieldValue(value)); }
public final FieldValue setFieldValue(Field field, Double value) { return setFieldValue(field, new DoubleFieldValue(value)); }
private static Integer getFieldValue(Struct struct, String fieldName) { IntegerFieldValue val = (IntegerFieldValue)struct.getFieldValue(fieldName); return val != null ? val.getInteger() : null; }
public final FieldValue setFieldValue(String field, Byte value) { return setFieldValue(field, new ByteFieldValue(value)); } /**
/** * Remove a key-weight association from this set. * * @param key the key to remove * @return the weight that was previously associated with this key, or null (if there was no previous key) */ public Integer remove(Object key) { IntegerFieldValue ifv = map.remove(key); return ifv != null ? ifv.getInteger() : null; }
public FieldValue getRecursiveValue(FieldPath path) { RecursiveIteratorHandler handler = new RecursiveIteratorHandler(); iterateNested(path, 0, handler); return handler.retVal; }
@Override public boolean removeValue(FieldValue o) { return super.removeValue(o, map.keySet()); }
/** * Checks if another object is equal to this set. * * @param o the object to check for equality with * @return true if o is an instance of WeightedSet and the two encapsulated Maps are equal, false otherwise */ public boolean equals(Object o) { if (!(o instanceof WeightedSet)) return false; return (super.equals(o) && map.equals(((WeightedSet<K>)o).map)); }
/** * Returns the operand of this arithmetic value update. * * @return the operand */ public Number getOperand() { return operand.getDouble(); }
@Override public FloatFieldValue clone() { FloatFieldValue val = (FloatFieldValue) super.clone(); val.value = value; return val; }
@Override public Object getWrappedValue() { if (map instanceof WeightedSet.WeightedSetWrapper) { return ((WeightedSet.WeightedSetWrapper) map).map; } return map.getWrappedValue(); }
public final FieldValue setFieldValue(String field, Integer value) { return setFieldValue(field, new IntegerFieldValue(value)); }
public final FieldValue setFieldValue(String field, Double value) { return setFieldValue(field, new DoubleFieldValue(value)); }