Class ImmutableAtomPair

java.lang.Object
pl.poznan.put.torsion.AtomPair
pl.poznan.put.torsion.ImmutableAtomPair
All Implemented Interfaces:
Comparable<AtomPair>

@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable public final class ImmutableAtomPair extends AtomPair
Immutable implementation of AtomPair.

Use the builder to create immutable instances: ImmutableAtomPair.builder(). Use the static factory method to create immutable instances: ImmutableAtomPair.of().

  • Method Details

    • withLeftAtom

      public final ImmutableAtomPair withLeftAtom(PdbAtomLine value)
      Copy the current immutable object by setting a value for the leftAtom attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for leftAtom
      Returns:
      A modified copy of the this object
    • withRightAtom

      public final ImmutableAtomPair withRightAtom(PdbAtomLine value)
      Copy the current immutable object by setting a value for the rightAtom attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for rightAtom
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ImmutableAtomPair that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: leftAtom, rightAtom.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value AtomPair with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • 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.

      Overrides:
      distance in class AtomPair
      Returns:
      A lazily initialized value of the distance attribute
    • bondLength

      protected BondLength 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 class AtomPair
      Returns:
      A lazily initialized value of the bondLength attribute
    • of

      public static ImmutableAtomPair of(PdbAtomLine leftAtom, PdbAtomLine rightAtom)
      Construct a new immutable AtomPair instance.
      Parameters:
      leftAtom - The value for the leftAtom attribute
      rightAtom - The value for the rightAtom attribute
      Returns:
      An immutable AtomPair instance
    • copyOf

      public static ImmutableAtomPair copyOf(AtomPair instance)
      Creates an immutable copy of a AtomPair 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

      public static ImmutableAtomPair.Builder builder()
      Creates a builder for ImmutableAtomPair.
       ImmutableAtomPair.builder()
          .leftAtom(pl.poznan.put.pdb.PdbAtomLine) // required leftAtom
          .rightAtom(pl.poznan.put.pdb.PdbAtomLine) // required rightAtom
          .build();
       
      Returns:
      A new ImmutableAtomPair builder