com.bigdata.rdf.internal.impl.literal
Class XSDDecimalIV<V extends BigdataLiteral>

java.lang.Object
  extended by com.bigdata.rdf.internal.impl.AbstractIV<V,T>
      extended by com.bigdata.rdf.internal.impl.AbstractInlineIV<V,T>
          extended by com.bigdata.rdf.internal.impl.literal.AbstractLiteralIV<V,T>
              extended by com.bigdata.rdf.internal.impl.literal.NumericIV<V,BigDecimal>
                  extended by com.bigdata.rdf.internal.impl.literal.XSDDecimalIV<V>
All Implemented Interfaces:
IV<V,BigDecimal>, IVCache<V,BigDecimal>, Serializable, Comparable<IV>, Literal, Value

public class XSDDecimalIV<V extends BigdataLiteral>
extends NumericIV<V,BigDecimal>
implements Literal

Implementation for inline xsd:decimal.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.bigdata.rdf.internal.impl.AbstractIV
flags
 
Constructor Summary
XSDDecimalIV(BigDecimal value)
           
 
Method Summary
 int _compareTo(IV o)
          Compare two IVs having the same intrinsic datatype.
 V asValue(LexiconRelation lex)
          If the value is not already cached, then inflate an inline RDF value to a BigdataValue and cache it on a private field.
 boolean booleanValue()
          Implement Literal.booleanValue().
 int byteLength()
          The byte length of the encoded IV.
 byte byteValue()
          Implement Literal.byteValue().
 IV<V,BigDecimal> clone(boolean clearCache)
          Return a copy of this IV.
 BigDecimal decimalValue()
          Implement Literal.decimalValue().
 double doubleValue()
          Implement Literal.doubleValue().
 boolean equals(Object o)
          Return true iff the two values are the same point in the same value space.
 float floatValue()
          Implement Literal.floatValue().
 BigDecimal getInlineValue()
          Return the Java Object corresponding to the inline value.
 String getLabel()
          Use toPlainString to avoid expression with exponent value that would imply xsd:double rather than xsd:decimal
 int hashCode()
          Return the hash code of the value returned by BigDecimal.stripTrailingZeros().
 BigInteger integerValue()
          Implement Literal.integerValue().
 int intValue()
          Implement Literal.intValue().
 long longValue()
          Implement Literal.longValue().
 short shortValue()
          Implement Literal.shortValue().
 
Methods inherited from class com.bigdata.rdf.internal.impl.literal.AbstractLiteralIV
calendarValue, getDatatype, getLanguage, needsMaterialization, stringValue, toString
 
Methods inherited from class com.bigdata.rdf.internal.impl.AbstractInlineIV
isInline
 
Methods inherited from class com.bigdata.rdf.internal.impl.AbstractIV
compareTo, encode, flags, getDTE, getInternalDataTypeEnum, getInternalValueTypeEnum, getValue, getValueCache, getVTE, getVTE, hasValue, isBigNumeric, isBNode, isExtension, isExtension, isFixedNumeric, isFloatingPointNumeric, isInline, isLiteral, isNullIV, isNumeric, isResource, isSignedNumeric, isStatement, isUnsignedNumeric, isURI, isVocabulary, setValue, toFlags
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.openrdf.model.Literal
calendarValue, getDatatype, getLanguage
 
Methods inherited from interface org.openrdf.model.Value
stringValue
 

Constructor Detail

XSDDecimalIV

public XSDDecimalIV(BigDecimal value)
Method Detail

clone

public IV<V,BigDecimal> clone(boolean clearCache)
Description copied from interface: IVCache
Return a copy of this IV.

Note: This method exists to defeat the hard reference from the IV to the cached BigdataValue in order to avoid a memory leak when the IV is used as the key in a weak value cache whose value is the BigdataValue. Therefore, certain IV implementations MAY return this when they are used for limited collections. The vocabulary IVs are the primary example. For the same reason, we do not need to recursively break the link from the IV to the BigdataValue for IVs which embed other IVs.

Specified by:
clone in interface IVCache<V extends BigdataLiteral,BigDecimal>
Parameters:
clearCache - When true the cached reference (if any) will NOT be set on the copy.
Returns:
The copy.
See Also:
(Thread-local cache combined with unbounded thread pools causes effective memory leak)

getInlineValue

public final BigDecimal getInlineValue()
Description copied from interface: IV
Return the Java Object corresponding to the inline value.

Specified by:
getInlineValue in interface IV<V extends BigdataLiteral,BigDecimal>
Returns:
The Object.

getLabel

public String getLabel()
Use toPlainString to avoid expression with exponent value that would imply xsd:double rather than xsd:decimal

Specified by:
getLabel in interface Literal
Overrides:
getLabel in class AbstractLiteralIV<V extends BigdataLiteral,BigDecimal>

booleanValue

public boolean booleanValue()
Description copied from class: AbstractLiteralIV
Implement Literal.booleanValue().

Specified by:
booleanValue in interface Literal
Overrides:
booleanValue in class AbstractLiteralIV<V extends BigdataLiteral,BigDecimal>

byteValue

public byte byteValue()
Description copied from class: AbstractLiteralIV
Implement Literal.byteValue().

Specified by:
byteValue in interface Literal
Overrides:
byteValue in class AbstractLiteralIV<V extends BigdataLiteral,BigDecimal>

shortValue

public short shortValue()
Description copied from class: AbstractLiteralIV
Implement Literal.shortValue().

Specified by:
shortValue in interface Literal
Overrides:
shortValue in class AbstractLiteralIV<V extends BigdataLiteral,BigDecimal>

intValue

public int intValue()
Description copied from class: AbstractLiteralIV
Implement Literal.intValue().

Specified by:
intValue in interface Literal
Overrides:
intValue in class AbstractLiteralIV<V extends BigdataLiteral,BigDecimal>

longValue

public final long longValue()
Description copied from class: AbstractLiteralIV
Implement Literal.longValue().

Specified by:
longValue in interface Literal
Overrides:
longValue in class AbstractLiteralIV<V extends BigdataLiteral,BigDecimal>

floatValue

public float floatValue()
Description copied from class: AbstractLiteralIV
Implement Literal.floatValue().

Specified by:
floatValue in interface Literal
Overrides:
floatValue in class AbstractLiteralIV<V extends BigdataLiteral,BigDecimal>

doubleValue

public double doubleValue()
Description copied from class: AbstractLiteralIV
Implement Literal.doubleValue().

Specified by:
doubleValue in interface Literal
Overrides:
doubleValue in class AbstractLiteralIV<V extends BigdataLiteral,BigDecimal>

integerValue

public BigInteger integerValue()
Description copied from class: AbstractLiteralIV
Implement Literal.integerValue().

Specified by:
integerValue in interface Literal
Overrides:
integerValue in class AbstractLiteralIV<V extends BigdataLiteral,BigDecimal>

decimalValue

public BigDecimal decimalValue()
Description copied from class: AbstractLiteralIV
Implement Literal.decimalValue().

Specified by:
decimalValue in interface Literal
Overrides:
decimalValue in class AbstractLiteralIV<V extends BigdataLiteral,BigDecimal>

asValue

public V asValue(LexiconRelation lex)
Description copied from interface: IVCache
If the value is not already cached, then inflate an inline RDF value to a BigdataValue and cache it on a private field.

Note: Query plans are responsible for ensuring that IVs have been materialized before operators are evaluated which invoke this method. This pattern ensures that efficient batch operators are used to materialize Values, and thereby avoids heavy RMI overhead in scale-out, and provides operators which use IVCache.getValue() with a simple method signature which does not require access to the lexicon. Query plans are also responsible for dropping variables once they are no longer needed or, in the case of large values and BLOBs, dropping the cached BigdataValue when possible in order to avoid excess network and heap overhead.

Specified by:
asValue in interface IVCache<V extends BigdataLiteral,BigDecimal>
Parameters:
lex - The lexicon relation (this is required in order to access the BigdataValueFactory for the namespace associated with lexicon when we materialize an inline IV).
Returns:
The corresponding BigdataValue.

equals

public boolean equals(Object o)
Description copied from class: AbstractIV
Return true iff the two values are the same point in the same value space. Points in different value spaces (as identified by different datatype URIs) are NOT equal even if they have the same value in the corresponding primitive data type.

Specified by:
equals in interface Literal
Specified by:
equals in class AbstractIV<V extends BigdataLiteral,BigDecimal>

hashCode

public int hashCode()
Return the hash code of the value returned by BigDecimal.stripTrailingZeros().

Note: normalization is necessary to have a stable hash code when encoding and decoding for much the same reason that we have to use BigDecimal.compareTo(BigDecimal) in equals(Object).

Specified by:
hashCode in interface Literal
Specified by:
hashCode in class AbstractIV<V extends BigdataLiteral,BigDecimal>

byteLength

public int byteLength()
Description copied from interface: IV
The byte length of the encoded IV.

Specified by:
byteLength in interface IV<V extends BigdataLiteral,BigDecimal>

_compareTo

public int _compareTo(IV o)
Description copied from class: AbstractIV
Compare two IVs having the same intrinsic datatype.

Specified by:
_compareTo in class AbstractIV<V extends BigdataLiteral,BigDecimal>


Copyright © 2006-2012 SYSTAP, LLC. All Rights Reserved.