Class ImmutableDefaultStrand

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

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

Use the builder to create immutable instances: ImmutableDefaultStrand.builder(). Use the static factory method to create immutable instances: ImmutableDefaultStrand.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 DefaultStrand
      Returns:
      The value of the name attribute
    • symbols

      public List<DotBracketSymbol> symbols()
      Specified by:
      symbols in interface DotBracket
      Specified by:
      symbols in class DefaultStrand
      Returns:
      The value of the symbols attribute
    • withCombineStrands

      public final ImmutableDefaultStrand 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 ImmutableDefaultStrand 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 ImmutableDefaultStrand 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
    • withSymbols

      public final ImmutableDefaultStrand withSymbols(DotBracketSymbol... elements)
      Copy the current immutable object with elements that replace the content of symbols.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withSymbols

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

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

      public static ImmutableDefaultStrand of(String name, List<DotBracketSymbol> symbols)
      Construct a new immutable DefaultStrand instance.
      Parameters:
      name - The value for the name attribute
      symbols - The value for the symbols attribute
      Returns:
      An immutable DefaultStrand instance
    • of

      public static ImmutableDefaultStrand of(String name, Iterable<? extends DotBracketSymbol> symbols)
      Construct a new immutable DefaultStrand instance.
      Parameters:
      name - The value for the name attribute
      symbols - The value for the symbols attribute
      Returns:
      An immutable DefaultStrand instance
    • copyOf

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

      public static ImmutableDefaultStrand.Builder builder()
      Creates a builder for ImmutableDefaultStrand.
       ImmutableDefaultStrand.builder()
          .addCombineStrands|addAllCombineStrands(pl.poznan.put.structure.formats.DotBracket) // combineStrands elements
          .name(String) // required name
          .addSymbols|addAllSymbols(pl.poznan.put.structure.DotBracketSymbol) // symbols elements
          .build();
       
      Returns:
      A new ImmutableDefaultStrand builder