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 immutableRelationship
path 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 Relationship
get(int index)
Shape
getEndShape()
Gets the ending shape of thePath
that 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.Shape
getStartShape()
Gets the starting shape of thePath
.java.util.Iterator<Relationship>
iterator()
int
size()
java.lang.String
toString()
Converts the path to validSelector
syntax.-
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:
size
in interfacejava.util.Collection<Relationship>
- Specified by:
size
in interfacejava.util.List<Relationship>
- Specified by:
size
in classjava.util.AbstractCollection<Relationship>
-
get
public Relationship get(int index)
- Specified by:
get
in interfacejava.util.List<Relationship>
- Specified by:
get
in classjava.util.AbstractList<Relationship>
-
iterator
public java.util.Iterator<Relationship> iterator()
- Specified by:
iterator
in interfacejava.util.Collection<Relationship>
- Specified by:
iterator
in interfacejava.lang.Iterable<Relationship>
- Specified by:
iterator
in interfacejava.util.List<Relationship>
- Overrides:
iterator
in 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 thePath
that 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 validSelector
syntax.- Overrides:
toString
in classjava.util.AbstractCollection<Relationship>
- Returns:
- Returns the path as a selector.
-
-