Class PathFinder.Path
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<Relationship>
-
- software.amazon.smithy.model.selector.PathFinder.Path
-
- All Implemented Interfaces:
java.lang.Iterable<Relationship>,java.util.Collection<Relationship>,java.util.List<Relationship>
- Enclosing class:
- PathFinder
public static final class PathFinder.Path extends java.util.AbstractList<Relationship>
An immutableRelationshippath from a starting shape to an end shape.
-
-
Constructor Summary
Constructors Constructor Description Path(java.util.List<Relationship> relationships)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Relationshipget(int index)ShapegetEndShape()Gets the ending shape of thePaththat matched the selector and is connected to the starting shape.java.util.List<Shape>getShapes()Gets a list of all shapes in the path including the starting shape all the way to the last shape.ShapegetStartShape()Gets the starting shape of thePath.java.util.Iterator<Relationship>iterator()intsize()java.lang.StringtoString()Converts the path to validSelectorsyntax.-
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
-
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
-
-
-
-
Constructor Detail
-
Path
public Path(java.util.List<Relationship> relationships)
-
-
Method Detail
-
size
public int size()
- Specified by:
sizein interfacejava.util.Collection<Relationship>- Specified by:
sizein interfacejava.util.List<Relationship>- Specified by:
sizein classjava.util.AbstractCollection<Relationship>
-
get
public Relationship get(int index)
- Specified by:
getin interfacejava.util.List<Relationship>- Specified by:
getin classjava.util.AbstractList<Relationship>
-
iterator
public java.util.Iterator<Relationship> iterator()
- Specified by:
iteratorin interfacejava.util.Collection<Relationship>- Specified by:
iteratorin interfacejava.lang.Iterable<Relationship>- Specified by:
iteratorin interfacejava.util.List<Relationship>- Overrides:
iteratorin classjava.util.AbstractList<Relationship>
-
getShapes
public java.util.List<Shape> getShapes()
Gets a list of all shapes in the path including the starting shape all the way to the last shape.The returned list does not return the last element (the end shape targeted by the last neighbor) if it does not exist.
- Returns:
- Returns the list of shapes.
-
getStartShape
public Shape getStartShape()
Gets the starting shape of thePath.- Returns:
- Returns the starting shape of the Path.
-
getEndShape
public Shape getEndShape()
Gets the ending shape of thePaththat matched the selector and is connected to the starting shape.- Returns:
- Returns the ending shape of the Path.
- Throws:
SourceException- if the last relationship is invalid.
-
toString
public java.lang.String toString()
Converts the path to validSelectorsyntax.- Overrides:
toStringin classjava.util.AbstractCollection<Relationship>- Returns:
- Returns the path as a selector.
-
-