Class ImmutableAtomPair
- All Implemented Interfaces:
Comparable<AtomPair>
AtomPair
.
Use the builder to create immutable instances:
ImmutableAtomPair.builder()
.
Use the static factory method to create immutable instances:
ImmutableAtomPair.of()
.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionprotected BondLength
static ImmutableAtomPair.Builder
builder()
Creates a builder forImmutableAtomPair
.static ImmutableAtomPair
Creates an immutable copy of aAtomPair
value.protected double
distance()
boolean
This instance is equal to all instances ofImmutableAtomPair
that have equal attribute values.int
hashCode()
Computes a hash code from attributes:leftAtom
,rightAtom
.static ImmutableAtomPair
of
(PdbAtomLine leftAtom, PdbAtomLine rightAtom) Construct a new immutableAtomPair
instance.toString()
Prints the immutable valueAtomPair
with attribute values.final ImmutableAtomPair
withLeftAtom
(PdbAtomLine value) Copy the current immutable object by setting a value for theleftAtom
attribute.final ImmutableAtomPair
withRightAtom
(PdbAtomLine value) Copy the current immutable object by setting a value for therightAtom
attribute.Methods inherited from class pl.poznan.put.torsion.AtomPair
compareTo, generateValidationMessage
-
Method Details
-
withLeftAtom
Copy the current immutable object by setting a value for theleftAtom
attribute. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for leftAtom- Returns:
- A modified copy of the
this
object
-
withRightAtom
Copy the current immutable object by setting a value for therightAtom
attribute. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for rightAtom- Returns:
- A modified copy of the
this
object
-
equals
This instance is equal to all instances ofImmutableAtomPair
that have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:leftAtom
,rightAtom
. -
toString
Prints the immutable valueAtomPair
with attribute values. -
distance
protected double distance()Returns a lazily initialized value of the
distance
attribute. Initialized once and only once and stored for subsequent access with proper synchronization. In case of any exception or error thrown by the lazy value initializer, the result will not be memoised (i.e. remembered) and on next call computation will be attempted again. -
bondLength
Returns a lazily initialized value of the
bondLength
attribute. Initialized once and only once and stored for subsequent access with proper synchronization. In case of any exception or error thrown by the lazy value initializer, the result will not be memoised (i.e. remembered) and on next call computation will be attempted again.- Overrides:
bondLength
in classAtomPair
- Returns:
- A lazily initialized value of the
bondLength
attribute
-
of
Construct a new immutableAtomPair
instance.- Parameters:
leftAtom
- The value for theleftAtom
attributerightAtom
- The value for therightAtom
attribute- Returns:
- An immutable AtomPair instance
-
copyOf
Creates an immutable copy of aAtomPair
value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance
- The instance to copy- Returns:
- A copied immutable AtomPair instance
-
builder
Creates a builder forImmutableAtomPair
.ImmutableAtomPair.builder() .leftAtom(pl.poznan.put.pdb.PdbAtomLine) // required
leftAtom
.rightAtom(pl.poznan.put.pdb.PdbAtomLine) // requiredrightAtom
.build();- Returns:
- A new ImmutableAtomPair builder
-