@NotThreadSafe public class PointValue extends Object implements Externalizable, Mappable, Streamer.Validated
Instances of this class and subclasses represent point values inside and between the services. They hold a reference to a point definition, a time stamp, a state and a value. The point definition may be referenced by its UUID or by a point object holding at least the name of the point. The state and value may be null.
The Externalizable interface is implemented for transit thru RMI calls; transit as XML text is supported by the Mappable interface.
Convenience methods are supplied for encoding / decoding, normalization denormalization and for store updates.
| Modifier and Type | Class and Description |
|---|---|
static class |
PointValue.Null
Null.
|
| Modifier and Type | Field and Description |
|---|---|
static PointValue |
NULL
The null point value.
|
static String |
POINT_FIELD
Point field key.
|
static String |
STAMP_FIELD
Stamp field key.
|
static String |
STATE_FIELD
State field key.
|
static String |
UUID_FIELD
UUID field key.
|
static String |
VALUE_FIELD
Value field key.
|
SERIALIZABLE_MODE, SIMPLE_STRING_MODE| Constructor and Description |
|---|
PointValue()
Constructs an instance.
|
PointValue(Point point,
Optional<DateTime> stamp,
Serializable state,
Serializable value)
Constructs an instance.
|
PointValue(PointValue other)
Constructs an instance from an other.
|
PointValue(String point,
Optional<DateTime> stamp,
Serializable state,
Serializable value)
Constructs an instance.
|
PointValue(UUID uuid,
Optional<DateTime> stamp,
Serializable state,
Serializable value)
Constructs an instance from raw data.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkNotFrozen()
Checks that the point value is not frozen.
|
void |
clearStamp()
Clears this value's time stamp.
|
boolean |
confirm(boolean confirmValue)
Confirms this.
|
PointValue |
copy()
Creates a copy of this point value.
|
void |
copyValueFrom(PointValue pointValue)
Copies the value from an other point value.
|
PointValue |
decoded()
Returns this or a decoded clone of this.
|
PointValue |
denormalized()
Denormalizes this.
|
PointValue |
encoded()
Returns this or an encoded clone of this.
|
boolean |
equals(Object object) |
void |
freeze()
Freezes this point value.
|
PointValue |
frozen()
Returns a frozen instance of this.
|
Point |
getNullablePoint()
Gets the point definition.
|
Optional<Point> |
getPoint()
Gets the point definition.
|
Optional<String> |
getPointName()
Gets the point's name.
|
UUID |
getPointUUID()
Gets the point's UUID.
|
DateTime |
getStamp()
Gets this value's time stamp.
|
protected String |
getStampString(DateTime.Context dateTimeContext)
Gets the time stamp string.
|
Serializable |
getState()
Gets this point value's state.
|
protected String |
getSynthesizedString()
Gets the 'synthesized' string.
|
protected Logger |
getThisLogger()
Gets the logger for this instance.
|
Serializable |
getValue()
Gets the actual value.
|
protected DateTime |
getVersion()
Gets this value's version.
|
int |
hashCode() |
boolean |
hasPointUUID()
Asks if this has a point UUID.
|
boolean |
hasStamp()
Asks if this has a stamp.
|
boolean |
isAbsent()
Asks if this point value is absent.
|
boolean |
isCacheable()
Asks if this point value may be cached.
|
boolean |
isDeleted()
Asks if this point value is (going to be) deleted.
|
boolean |
isExtrapolated()
Asks if this point value is extrapolated.
|
boolean |
isFrozen()
Gets the frozen indicator.
|
boolean |
isInterpolated()
Asks if this point value is interpolated.
|
boolean |
isNormalized()
Asks if this point value is normalized.
|
boolean |
isPresent()
Asks if this point value is present.
|
boolean |
isSynthesized()
Asks if this point value is synthesized.
|
PointValue |
morph(Optional<Point> point,
Optional<DateTime> stamp)
Morphs this into a point value for an other point and/or an other time.
|
PointValue |
morph(Optional<UUID> uuid)
Morphs this into a point value for an other point.
|
NormalizedValue |
normalized()
Normalizes this point value.
|
String |
pointString()
Returns a string identification of the point.
|
void |
readExternal(ObjectInput input) |
void |
readMap(Map<String,Serializable> map)
Reads a map of the fields.
|
PointValue |
reset()
Substitutes serialization/deserialization.
|
PointValue |
restore(Point point)
Restores the reference to the point definition.
|
PointValue |
restore(Points points)
Restores the reference to the point definition.
|
boolean |
sameValueAs(PointValue pointValue)
Asks if an other point value has the same value.
|
protected void |
setFrozen()
Sets the frozen indicator.
|
void |
setPointName(String name)
Sets the point's name.
|
void |
setPointUUID(UUID uuid)
Sets the point's UUID.
|
void |
setStamp(DateTime stamp)
Sets this value's time stamp.
|
void |
setState(Serializable state)
Sets this value's state.
|
void |
setValue(Serializable value)
Sets the actual value.
|
protected void |
setVersion(DateTime version)
Sets this value's version.
|
PointValue |
thawed()
Returns a thawed instance of this.
|
Double |
toDouble()
Returns the value as a double floating-point value.
|
Long |
toLong()
Returns the value as a long value.
|
String |
toString() |
String |
toString(DateTime.Context dateTimeContext)
Returns a string representation of itself.
|
boolean |
updateStore()
Updates the store with this.
|
boolean |
validate()
Validates.
|
String |
valueString()
Returns a simple representation of the value.
|
void |
writeExternal(ObjectOutput output) |
void |
writeMap(Map<String,Serializable> map)
Writes a map of the fields.
|
public static final PointValue NULL
public static final String POINT_FIELD
public static final String STAMP_FIELD
public static final String STATE_FIELD
public static final String UUID_FIELD
public static final String VALUE_FIELD
public PointValue()
This is needed for an Externalizable implementation. It is also used as a never matching reference.
public PointValue(@Nonnull
PointValue other)
The copy will be a shallow clone of the original.
other - The other point value.public PointValue(@Nonnull
Point point,
@Nonnull
Optional<DateTime> stamp,
@Nullable
Serializable state,
@Nullable
Serializable value)
point - The point definition.stamp - The optional time stamp of the value.state - The state.value - The value.public PointValue(@Nonnull
String point,
@Nonnull
Optional<DateTime> stamp,
@Nullable
Serializable state,
@Nullable
Serializable value)
point - A string identifying the point.stamp - The optional time stamp of the value.state - The state.value - The value.public PointValue(@Nonnull
UUID uuid,
@Nonnull
Optional<DateTime> stamp,
@Nullable
Serializable state,
@Nullable
Serializable value)
uuid - The UUID of the point definition.stamp - The optional time stamp of the value.state - The state.value - The value.public final void clearStamp()
@CheckReturnValue
public final boolean confirm(boolean confirmValue)
throws InterruptedException,
StoreAccessException
Note: the point reference must be set and its store must be able to confirm.
confirmValue - When true, sameValueAs(org.rvpf.base.value.PointValue) should be called.InterruptedException - When interrupted.StoreAccessException - When store access fails.@Nonnull @CheckReturnValue public PointValue copy()
public void copyValueFrom(@Nonnull
PointValue pointValue)
A subclass supporting additional value informations should override this method.
Used by the processor's batch.
pointValue - The source point value.@Nonnull @CheckReturnValue public final PointValue decoded()
@Nonnull @CheckReturnValue public PointValue denormalized()
This method is overriden by NormalizedValue. Other point value
classes, including this one, assume that their value is not
normalized.
@Nonnull @CheckReturnValue public final PointValue encoded()
public boolean equals(Object object)
equals in class Objectpublic final void freeze()
@Nonnull @CheckReturnValue public PointValue frozen()
@Nullable @CheckReturnValue public final Point getNullablePoint()
Needed by a comparator.
@Nonnull @CheckReturnValue public final Optional<Point> getPoint()
@Nonnull @CheckReturnValue public final Optional<String> getPointName()
@Nonnull @CheckReturnValue public final UUID getPointUUID()
@Nonnull @CheckReturnValue public final DateTime getStamp()
@Nullable @CheckReturnValue public final Serializable getState()
@Nullable @CheckReturnValue public final Serializable getValue()
@CheckReturnValue public boolean hasPointUUID()
@CheckReturnValue public boolean hasStamp()
public int hashCode()
hashCode in class Object@CheckReturnValue public boolean isAbsent()
@CheckReturnValue public final boolean isCacheable()
@CheckReturnValue public boolean isDeleted()
A subclass may override this method to supply this functionality.
VersionedValue.Deleted.isDeleted()@CheckReturnValue public boolean isExtrapolated()
@CheckReturnValue public final boolean isFrozen()
@CheckReturnValue public boolean isInterpolated()
@CheckReturnValue public boolean isNormalized()
@CheckReturnValue public final boolean isPresent()
@CheckReturnValue public boolean isSynthesized()
@Nonnull @CheckReturnValue public PointValue morph(@Nonnull Optional<UUID> uuid)
uuid - The other point's optional UUID.@Nonnull @CheckReturnValue public final PointValue morph(@Nonnull Optional<Point> point, @Nonnull Optional<DateTime> stamp)
point - The other point (may be empty).stamp - The other time (may be empty).@Nonnull @CheckReturnValue public NormalizedValue normalized()
The point's content instance is called to perform the actual normalization.
@Nonnull @CheckReturnValue public final String pointString()
public void readExternal(ObjectInput input)
throws IOException
readExternal in interface ExternalizableIOExceptionpublic void readMap(Map<String,Serializable> map)
@Nonnull @CheckReturnValue public final PointValue reset()
@Nonnull @CheckReturnValue public final PointValue restore(@Nullable Point point)
This is used in the deserialization process.
point - The point's definition.@Nonnull @CheckReturnValue public final PointValue restore(@Nonnull Points points)
points - The points from which to get the point's definition.@CheckReturnValue
public boolean sameValueAs(@Nonnull
PointValue pointValue)
A subclass supporting additional value informations should override this method.
pointValue - The other point value.public final void setPointName(@Nonnull
String name)
name - The point's name.public final void setPointUUID(@Nonnull
UUID uuid)
uuid - The point's UUID.public final void setStamp(@Nonnull
DateTime stamp)
stamp - The time stamp.public final void setState(@Nullable
Serializable state)
state - The state.public final void setValue(@Nullable
Serializable value)
value - The value.@Nonnull @CheckReturnValue public PointValue thawed()
@Nullable @CheckReturnValue public Double toDouble()
@Nullable @CheckReturnValue public Long toLong()
public final String toString()
toString in class Object@Nonnull
@CheckReturnValue
public final String toString(@Nonnull
DateTime.Context dateTimeContext)
dateTimeContext - The date-time context.@CheckReturnValue
public final boolean updateStore()
throws InterruptedException,
StoreAccessException
InterruptedException - When the service is stopped.StoreAccessException - When store access fails.public boolean validate()
validate in interface Streamer.Validated@Nonnull @CheckReturnValue public String valueString()
public void writeExternal(ObjectOutput output)
throws IOException
writeExternal in interface ExternalizableIOExceptionpublic void writeMap(Map<String,Serializable> map)
protected final void checkNotFrozen()
@Nonnull
@CheckReturnValue
protected String getStampString(@Nonnull
DateTime.Context dateTimeContext)
dateTimeContext - The date-time context.@Nonnull @CheckReturnValue protected String getSynthesizedString()
@Nonnull @CheckReturnValue protected final Logger getThisLogger()
@CheckReturnValue protected DateTime getVersion()
protected final void setFrozen()
protected void setVersion(DateTime version)
version - The version.Copyright © 2003-2019 Serge Brisson. All Rights Reserved.