Class ImmutableRegion.Builder

java.lang.Object
pl.poznan.put.structure.pseudoknots.ImmutableRegion.Builder
Enclosing class:
ImmutableRegion

@NotThreadSafe public static final class ImmutableRegion.Builder extends Object
Builds instances of type ImmutableRegion. Initialize attributes and then invoke the build() method to create an immutable instance.

Builder is not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.

  • Method Details

    • from

      public final ImmutableRegion.Builder from(Region instance)
      Fill a builder with attribute values from the provided Region instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values. Collection elements and entries will be added, not replaced.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • addEntries

      public final ImmutableRegion.Builder addEntries(BpSeq.Entry element)
      Adds one element to entries list.
      Parameters:
      element - A entries element
      Returns:
      this builder for use in a chained invocation
    • addEntries

      public final ImmutableRegion.Builder addEntries(BpSeq.Entry... elements)
      Adds elements to entries list.
      Parameters:
      elements - An array of entries elements
      Returns:
      this builder for use in a chained invocation
    • entries

      public final ImmutableRegion.Builder entries(Iterable<? extends BpSeq.Entry> elements)
      Sets or replaces all elements for entries list.
      Parameters:
      elements - An iterable of entries elements
      Returns:
      this builder for use in a chained invocation
    • addAllEntries

      public final ImmutableRegion.Builder addAllEntries(Iterable<? extends BpSeq.Entry> elements)
      Adds elements to entries list.
      Parameters:
      elements - An iterable of entries elements
      Returns:
      this builder for use in a chained invocation
    • begin

      public final ImmutableRegion.Builder begin(int begin)
      Initializes the value for the begin attribute.

      If not set, this attribute will have a default value as returned by the initializer of begin.

      Parameters:
      begin - The value for begin
      Returns:
      this builder for use in a chained invocation
    • end

      public final ImmutableRegion.Builder end(int end)
      Initializes the value for the end attribute.

      If not set, this attribute will have a default value as returned by the initializer of end.

      Parameters:
      end - The value for end
      Returns:
      this builder for use in a chained invocation
    • isRemoved

      public final ImmutableRegion.Builder isRemoved(boolean isRemoved)
      Initializes the value for the isRemoved attribute.

      If not set, this attribute will have a default value as returned by the initializer of isRemoved.

      Parameters:
      isRemoved - The value for isRemoved
      Returns:
      this builder for use in a chained invocation
    • build

      public ImmutableRegion build()
      Builds a new ImmutableRegion.
      Returns:
      An immutable instance of Region
      Throws:
      IllegalStateException - if any required attributes are missing