@Override public int getMemory() { if (value == null) { return DataType.getDataType(getType()).memory; } int mem = super.getMemory(); if (javaObject != null) { mem *= 2; } return mem; }
/** * Get or create a date value for the given date. * * @param dateValue the date value, a bit field with bits for the year, * month, and day * @param timeNanos the nanoseconds since midnight * @return the value */ public static ValueTimestamp fromDateValueAndNanos(long dateValue, long timeNanos) { return (ValueTimestamp) Value.cache(new ValueTimestamp(dateValue, timeNanos)); }
/** * Get the memory used by this object. * * @return the memory used in bytes */ public int getMemory() { return DataType.getDataType(getType()).memory; }
/** * Create an ENUM value from the provided enumerators * and value. * * @param enumerators the enumerators * @param value a value * @return the ENUM value */ public static ValueEnum get(final String[] enumerators, int value) { check(enumerators, ValueInt.get(value)); return new ValueEnum(enumerators, value); }
/** * Get or create a short value for the given short. * * @param i the short * @return the value */ public static ValueShort get(short i) { return (ValueShort) Value.cache(new ValueShort(i)); }
private String[] getEnumerators(Value left, Value right) { if (left.getType() == Value.ENUM) { return ((ValueEnum) left).getEnumerators(); } else if (right.getType() == Value.ENUM) { return ((ValueEnum) right).getEnumerators(); } else { return new String[0]; } }
/** * Get or create a geometry value for the given geometry. * * @param bytes the WKB representation of the geometry * @return the value */ public static ValueGeometry get(byte[] bytes) { return (ValueGeometry) Value.cache(new ValueGeometry(bytes, null)); }
/** * Create a new hash map. Depending on the configuration, the key is case * sensitive or case insensitive. * * @param <V> the value type * @return the hash map */ public <V> ConcurrentHashMap<String, V> newConcurrentStringMap() { return dbSettings.databaseToUpper ? new NullableKeyConcurrentMap<V>() : new CaseInsensitiveConcurrentMap<V>(); }
/** * Evaluates whether a valid ENUM can be constructed * from the provided enumerators and value. * * @param enumerators the enumerators * @param value the value * @return whether a valid ENUM can be constructed from the provided values */ public static boolean isValid(final String enumerators[], final Value value) { return validate(enumerators, value).equals(Validation.VALID); }