Class PathBase<T, P extends Path<T>>
java.lang.Object
org.aksw.commons.path.core.PathBase<T,P>
- Type Parameters:
T-P-
- All Implemented Interfaces:
Serializable, Comparable<Path<T>>, Iterable<Path<T>>, Path<T>
Generic base implementation of the path interface.
Internally keeps a flag for whether the path is
absolute and a list of path segments.
All methods of this class are implemented against the
PathOps interface.
Complex or verbose type expressions can be abstracted by extending this
class as sketched below.
class MyPath extends PathBaseinvalid input: '<'ComplexTypeExpression, MyPath> { MyPath(PathOpsinvalid input: '<'T, P> pathOps, boolean isAbsolute, Listsegments) { super(pathOps, isAbsolute, segments); } } class MyPathOps implements PathOps { MyPath newPath(boolean isAbsolute, List segments) { return new MyPath(this, isAbsolute, segments); } // Implement remaining methods }
- Author:
- raven
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> intcompareLists(List<T> a, List<T> b, Comparator<T> comparator) intbooleanbooleangetName(int index) intgetRoot()Returns an object such as the file system underlying this path.inthashCode()booleanprotected booleanisParentToken(T item) iterator()protected Pstatic <T> List<T> relativize(List<T> a, List<T> b, T parentToken) relativize(Path<T> other) resolveSibling(Path<T> other) resolveSibling(T other) resolveSiblingStr(String other) resolveStr(String other) booleanstartsWith(Path<T> other) subpath(int beginIndex) Experimental.subpath(int beginIndex, int endIndex) static <T> List<T> toString()Methods inherited from interface Iterable
forEach, spliterator
-
Field Details
-
isAbsolute
protected boolean isAbsolute -
segments
-
segmentsView
-
pathOps
-
-
Constructor Details
-
PathBase
-
-
Method Details
-
newPath
-
getPathOps
-
toAbsolutePath
- Specified by:
toAbsolutePathin interfacePath<T>
-
isAbsolute
public boolean isAbsolute()- Specified by:
isAbsolutein interfacePath<T>
-
getRoot
-
getFileName
- Specified by:
getFileNamein interfacePath<T>
-
getParent
-
getNameCount
public int getNameCount()- Specified by:
getNameCountin interfacePath<T>
-
getName
-
subpath
-
subpath
-
startsWith
- Specified by:
startsWithin interfacePath<T>
-
endsWith
-
normalize
-
isParentToken
-
toList
-
resolveStr
- Specified by:
resolveStrin interfacePath<T>
-
resolve
-
relativize
-
toString
-
relativize
-
getSegments
- Specified by:
getSegmentsin interfacePath<T>
-
resolve
-
resolveSiblingStr
- Specified by:
resolveSiblingStrin interfacePath<T>
-
resolveSibling
- Specified by:
resolveSiblingin interfacePath<T>
-
resolveSibling
-
iterator
-
compareTo
- Specified by:
compareToin interfaceComparable<T>
-
compareLists
-
getSystem
-
equals
-
hashCode
-