ValueRecord#
The base class of the record types in org.dhtmlx.plen: input data, options, change sets and results. It adds a shallow copy() and replaces equals, hashCode and toString with versions that read the record's public fields. Application code doesn't create a ValueRecord directly. It meets the class through subclasses such as TaskData, SolveOptions or ScheduleResult.
Declaration#
;
Every member below reads the public instance fields of the runtime class, inherited ones included. Static, private, protected and package-private fields are ignored. A subclass can override any of these methods, and its own page says so when it does.
Methods#
copy#
public ValueRecord
Returns a shallow copy made with Object.clone(). Field values are copied as they are, so the copy and the original share lists (Vec), maps and nested records. Most subclasses override copy() with their own return type (TaskData copy()), so no cast is needed. For a copy that shares nothing mutable, use deepClone() from DeepCloneable<T>.
Returns - a new instance of the same runtime class.
equals#
public boolean
Structural equality. Returns true when other is the same object, or when it has exactly the same runtime class and every public field is equal by Objects.deepEquals. An instance of a subclass is never equal to an instance of its parent class.
Field values compare as follows:
| Field value | Compared by |
|---|---|
null |
equal only to null |
double, Double |
Double.equals: -0.0 and 0.0 differ, NaN equals NaN |
Vec, other lists |
the list's equals: same size, same elements in the same order |
| nested record | its own equals, recursively |
| array | element by element (Arrays.deepEquals) |
| anything else | the value's equals |
Returns - true if the records are equal.
hashCode#
public int
A hash over the same public fields, consistent with equals: equal records have equal hash codes.
Records are mutable, so the hash code changes when a field changes. Don't modify a record while it's a key in a HashMap or an element of a HashSet.
Returns - the hash code.
toString#
public String
Returns the simple class name followed by every public field as name=value, for example Pause{at=2.0, length=1.0, by=null}. Each value is formatted with String.valueOf, so nested records and lists print recursively. Field order follows Class.getFields(), which the JVM doesn't guarantee. Use the string for logs and debugging only; it isn't a serialization format.
Returns - the text form of the record.
Example#
;
Related#
DeepCloneable<T>- the deep copy most records addVec- the list type of record fields- Records, ids and dates - building records and copying them