Trait/Object

eu.cdevreeze.yaidom.queryapi

IsNavigableApi

Related Docs: object IsNavigableApi | package queryapi

Permalink

trait IsNavigableApi extends AnyElemApi

This trait offers Path-based navigation support.

This trait typically does not show up in application code using yaidom, yet its (uniform) API does. Hence, it makes sense to read the documentation of this trait, knowing that the API is offered by multiple element implementations.

This trait is purely abstract. The most common implementation of this trait is eu.cdevreeze.yaidom.queryapi.IsNavigable.

IsNavigableApi more formally

Some properties are expected to hold for "navigable elements":

getElemOrSelfByPath(Path.Empty) == self

findElemOrSelfByPath(path1).flatMap(e => e.findElemOrSelfByPath(path2)) == findElemOrSelfByPath(path1.append(path2))
Linear Supertypes
AnyElemApi, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. IsNavigableApi
  2. AnyElemApi
  3. AnyRef
  4. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Type Members

  1. abstract type ThisElem <: ThisElemApi

    Permalink

    The ("stable") element type itself.

    The ("stable") element type itself. It is not restricted in the query API traits (only indirectly, through ThisElemApi).

    Concrete element classes will restrict this type to that element class itself.

    Why do we need 2 type members ThisElem and ThisElemApi and not just ThisElem? Consider for example query method implementations in trait ElemLike. Had we used just one type member ThisElem (restricting it to be a sub-type of ElemLike), then a call of a function like findAllChildElems on another element would not return a value of the same type (ElemLike.this.ThisElem) according to the Scala compiler. To prevent the use of casts, we used 2 type members ThisElem and ThisElemApi instead.

    Definition Classes
    AnyElemApi
  2. abstract type ThisElemApi <: IsNavigableApi

    Permalink

    Upperbound on type ThisElem, which must be restricted to a sub-type of the query API trait in question.

    Upperbound on type ThisElem, which must be restricted to a sub-type of the query API trait in question.

    Concrete element classes will restrict this type to that element class itself.

    The purely abstract query API traits (XXXApi) should only restrict this type to a sub-type of the query API trait, without putting any further restrictions on the type. This way these purely abstract traits are easy to use as "generic" element contracts abstracting over multiple backing element implementations (for example, Saxon tiny trees and native yaidom elements) without "infecting" the client code with generics.

    To a lesser extent, this should also be true for the partially implemented query API traits (XXXLike).

    Definition Classes
    IsNavigableApi → AnyElemApi

Abstract Value Members

  1. abstract def findAllChildElemsWithPathEntries: IndexedSeq[(ThisElem, Entry)]

    Permalink

    Returns all child elements paired with their path entries.

  2. abstract def findChildElemByPathEntry(entry: Entry): Option[ThisElem]

    Permalink

    Finds the child element with the given Path.Entry (where this element is the root), if any, wrapped in an Option.

    Finds the child element with the given Path.Entry (where this element is the root), if any, wrapped in an Option.

    Typically this method must be very efficient, in order for methods like findElemOrSelfByPath to be efficient.

  3. abstract def findElemOrSelfByPath(path: Path): Option[ThisElem]

    Permalink

    Finds the element with the given Path (where this element is the root), if any, wrapped in an Option.

    Finds the element with the given Path (where this element is the root), if any, wrapped in an Option.

    That is, returns:

    findReverseAncestryOrSelfByPath(path).map(_.last)

    Note that for each non-empty Path, we have:

    findElemOrSelfByPath(path) == findChildElemByPathEntry(path.firstEntry) flatMap (e => e.findElemOrSelfByPath(path.withoutFirstEntry))
  4. abstract def findReverseAncestryOrSelfByPath(path: Path): Option[IndexedSeq[ThisElem]]

    Permalink

    Finds the reversed ancestry-or-self of the element with the given Path (where this element is the root), wrapped in an Option.

    Finds the reversed ancestry-or-self of the element with the given Path (where this element is the root), wrapped in an Option. None is returned if no element can be found at the given Path.

    Hence, the resulting element collection, if any, starts with this element and ends with the element at the given Path, relative to this element.

    This method comes in handy for (efficiently) computing base URIs, where the (reverse) ancestry-or-self is needed as input.

  5. abstract def getChildElemByPathEntry(entry: Entry): ThisElem

    Permalink

    Returns (the equivalent of) findChildElemByPathEntry(entry).get

  6. abstract def getElemOrSelfByPath(path: Path): ThisElem

    Permalink

    Returns (the equivalent of) findElemOrSelfByPath(path).get

  7. abstract def getReverseAncestryOrSelfByPath(path: Path): IndexedSeq[ThisElem]

    Permalink

    Returns (the equivalent of) findReverseAncestryOrSelfByPath(path).get

  8. abstract def thisElem: ThisElem

    Permalink

    This element itself.

    This element itself.

    Definition Classes
    AnyElemApi

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  10. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  11. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  13. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  14. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  15. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  16. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  17. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  18. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyElemApi

Inherited from AnyRef

Inherited from Any

Ungrouped