Class ImmutableStrandView

java.lang.Object
pl.poznan.put.structure.formats.StrandView
pl.poznan.put.structure.formats.ImmutableStrandView
All Implemented Interfaces:
DotBracket, Strand

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

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

  • Method Details

    • combineStrands

      public List<DotBracket> combineStrands()
      Combines strands which share a base pair into a new dot-bracket instance and returns a list of those.
      Returns:
      The list of dot-bracket instances, each containing strands which only pair with each other.
    • name

      public String name()
      Specified by:
      name in interface Strand
      Specified by:
      name in class StrandView
      Returns:
      The value of the name attribute
    • begin

      public int begin()
      Specified by:
      begin in interface Strand
      Specified by:
      begin in class StrandView
      Returns:
      The value of the begin attribute
    • end

      public int end()
      Specified by:
      end in interface Strand
      Specified by:
      end in class StrandView
      Returns:
      The value of the end attribute
    • parent

      public DotBracket parent()
      Specified by:
      parent in class StrandView
      Returns:
      The parent dot-bracket structure of this strand.
    • withCombineStrands

      public final ImmutableStrandView withCombineStrands(DotBracket... elements)
      Copy the current immutable object with elements that replace the content of combineStrands.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withCombineStrands

      public final ImmutableStrandView withCombineStrands(Iterable<? extends DotBracket> elements)
      Copy the current immutable object with elements that replace the content of combineStrands. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of combineStrands elements to set
      Returns:
      A modified copy of this object
    • withName

      public final ImmutableStrandView withName(String value)
      Copy the current immutable object by setting a value for the name attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for name
      Returns:
      A modified copy of the this object
    • withBegin

      public final ImmutableStrandView withBegin(int value)
      Copy the current immutable object by setting a value for the begin attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for begin
      Returns:
      A modified copy of the this object
    • withEnd

      public final ImmutableStrandView withEnd(int value)
      Copy the current immutable object by setting a value for the end attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for end
      Returns:
      A modified copy of the this object
    • withParent

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

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ImmutableStrandView 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: combineStrands, name, begin, end, parent.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • symbols

      public List<DotBracketSymbol> symbols()

      Returns a lazily initialized value of the symbols 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.

      Specified by:
      symbols in interface DotBracket
      Overrides:
      symbols in class StrandView
      Returns:
      A lazily initialized value of the symbols attribute
    • of

      public static ImmutableStrandView of(String name, DotBracket parent, int begin, int end)
      Construct a new immutable StrandView instance.
      Parameters:
      name - The value for the name attribute
      parent - The value for the parent attribute
      begin - The value for the begin attribute
      end - The value for the end attribute
      Returns:
      An immutable StrandView instance
    • copyOf

      public static ImmutableStrandView copyOf(StrandView instance)
      Creates an immutable copy of a StrandView 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 StrandView instance
    • builder

      public static ImmutableStrandView.Builder builder()
      Creates a builder for ImmutableStrandView.
       ImmutableStrandView.builder()
          .addCombineStrands|addAllCombineStrands(pl.poznan.put.structure.formats.DotBracket) // combineStrands elements
          .name(String) // required name
          .begin(int) // required begin
          .end(int) // required end
          .parent(pl.poznan.put.structure.formats.DotBracket) // required parent
          .build();
       
      Returns:
      A new ImmutableStrandView builder