Package pl.poznan.put.structure.formats
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 ofStrandView.Use the builder to create immutable instances:
ImmutableStrandView.builder(). Use the static factory method to create immutable instances:ImmutableStrandView.of().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableStrandView.BuilderBuilds instances of typeImmutableStrandView.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intbegin()static ImmutableStrandView.Builderbuilder()Creates a builder forImmutableStrandView.List<DotBracket>combineStrands()Combines strands which share a base pair into a new dot-bracket instance and returns a list of those.static ImmutableStrandViewcopyOf(StrandView instance)Creates an immutable copy of aStrandViewvalue.intend()booleanequals(Object another)This instance is equal to all instances ofImmutableStrandViewthat have equal attribute values.inthashCode()Computes a hash code from attributes:combineStrands,name,begin,end,parent.Stringname()static ImmutableStrandViewof(String name, DotBracket parent, int begin, int end)Construct a new immutableStrandViewinstance.DotBracketparent()List<DotBracketSymbol>symbols()ImmutableStrandViewwithBegin(int value)Copy the current immutable object by setting a value for thebeginattribute.ImmutableStrandViewwithCombineStrands(Iterable<? extends DotBracket> elements)Copy the current immutable object with elements that replace the content ofcombineStrands.ImmutableStrandViewwithCombineStrands(DotBracket... elements)Copy the current immutable object with elements that replace the content ofcombineStrands.ImmutableStrandViewwithEnd(int value)Copy the current immutable object by setting a value for theendattribute.ImmutableStrandViewwithName(String value)Copy the current immutable object by setting a value for thenameattribute.ImmutableStrandViewwithParent(DotBracket value)Copy the current immutable object by setting a value for theparentattribute.-
Methods inherited from class pl.poznan.put.structure.formats.StrandView
description, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface pl.poznan.put.structure.formats.DotBracket
containsMissing, findStrand, length, missingInternal, missingTerminal, originalIndex, pairs, pseudoknotOrder, sequence, sequence, strands, structure, structure, toStringWithStrands
-
Methods inherited from interface pl.poznan.put.structure.formats.Strand
isSingleStrand, missingBegin, missingEnd, sequenceRY
-
-
-
-
Method Detail
-
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:
namein interfaceStrand- Specified by:
namein classStrandView- Returns:
- The value of the
nameattribute
-
begin
public int begin()
- Specified by:
beginin interfaceStrand- Specified by:
beginin classStrandView- Returns:
- The value of the
beginattribute
-
end
public int end()
- Specified by:
endin interfaceStrand- Specified by:
endin classStrandView- Returns:
- The value of the
endattribute
-
parent
public DotBracket parent()
- Specified by:
parentin classStrandView- 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 ofcombineStrands.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
withCombineStrands
public final ImmutableStrandView withCombineStrands(Iterable<? extends DotBracket> elements)
Copy the current immutable object with elements that replace the content ofcombineStrands. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
elements- An iterable of combineStrands elements to set- Returns:
- A modified copy of
thisobject
-
withName
public final ImmutableStrandView withName(String value)
Copy the current immutable object by setting a value for thenameattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for name- Returns:
- A modified copy of the
thisobject
-
withBegin
public final ImmutableStrandView withBegin(int value)
Copy the current immutable object by setting a value for thebeginattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for begin- Returns:
- A modified copy of the
thisobject
-
withEnd
public final ImmutableStrandView withEnd(int value)
Copy the current immutable object by setting a value for theendattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for end- Returns:
- A modified copy of the
thisobject
-
withParent
public final ImmutableStrandView withParent(DotBracket value)
Copy the current immutable object by setting a value for theparentattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for parent- Returns:
- A modified copy of the
thisobject
-
equals
public boolean equals(@Nullable Object another)
This instance is equal to all instances ofImmutableStrandViewthat have equal attribute values.
-
hashCode
public int hashCode()
Computes a hash code from attributes:combineStrands,name,begin,end,parent.
-
symbols
public List<DotBracketSymbol> symbols()
Returns a lazily initialized value of the
symbolsattribute. 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:
symbolsin interfaceDotBracket- Overrides:
symbolsin classStrandView- Returns:
- A lazily initialized value of the
symbolsattribute
-
of
public static ImmutableStrandView of(String name, DotBracket parent, int begin, int end)
Construct a new immutableStrandViewinstance.- Parameters:
name- The value for thenameattributeparent- The value for theparentattributebegin- The value for thebeginattributeend- The value for theendattribute- Returns:
- An immutable StrandView instance
-
copyOf
public static ImmutableStrandView copyOf(StrandView instance)
Creates an immutable copy of aStrandViewvalue. 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 forImmutableStrandView.ImmutableStrandView.builder() .addCombineStrands|addAllCombineStrands(pl.poznan.put.structure.formats.DotBracket) //combineStrandselements .name(String) // requiredname.begin(int) // requiredbegin.end(int) // requiredend.parent(pl.poznan.put.structure.formats.DotBracket) // requiredparent.build();- Returns:
- A new ImmutableStrandView builder
-
-