trait TransformableElemLike extends TransformableElemApi
API and implementation trait for transformable elements.
More precisely, this trait has abstract methods transformChildElems
and transformChildElemsToNodeSeq
. Based on these
abstract methods, this trait offers a rich API for transforming descendant elements or descendant-or-self elements.
The purely abstract API offered by this trait is eu.cdevreeze.yaidom.queryapi.TransformableElemApi. See the documentation of that trait for examples of usage.
All methods are overridable. Hence element implementations mixing in this partial implementation trait can change the implementation without breaking its API, caused by otherwise needed removal of this mixin. Arguably this trait should not exist as part of the public API, because implementation details should not be part of the public API. Such implementation details may be subtle, such as the (runtime) boundary on the ThisElem type member.
- Alphabetic
- By Inheritance
- TransformableElemLike
- TransformableElemApi
- AnyElemNodeApi
- AnyElemApi
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- abstract type ThisElem <: Aux[ThisNode, ThisElem]
The element type itself.
The element type itself. It 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.
- Definition Classes
- TransformableElemLike → TransformableElemApi → AnyElemApi
- abstract type ThisNode >: ThisElem
The node type, that is a super-type of the element type, but also of corresponding text node types etc.
The node type, that is a super-type of the element type, but also of corresponding text node types etc.
- Definition Classes
- AnyElemNodeApi
Abstract Value Members
- abstract def thisElem: ThisElem
This element itself.
This element itself.
- Definition Classes
- AnyElemApi
- abstract def transformChildElems(f: (ThisElem) => ThisElem): ThisElem
Returns the same element, except that child elements have been replaced by applying the given function.
Returns the same element, except that child elements have been replaced by applying the given function. Non-element child nodes occur in the result element unaltered.
That is, returns the equivalent of:
val newChildren = children map { case e: E => f(e) case n: N => n } withChildren(newChildren)
- Definition Classes
- TransformableElemLike → TransformableElemApi
- abstract def transformChildElemsToNodeSeq(f: (ThisElem) => IndexedSeq[ThisNode]): ThisElem
Returns the same element, except that child elements have been replaced by applying the given function.
Returns the same element, except that child elements have been replaced by applying the given function. Non-element child nodes occur in the result element unaltered.
That is, returns the equivalent of:
val newChildren = children flatMap { case e: E => f(e) case n: N => Vector(n) } withChildren(newChildren)
- Definition Classes
- TransformableElemLike → TransformableElemApi
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def transformElems(f: (ThisElem) => ThisElem): ThisElem
Transforms the element by applying the given function to all its descendant elements, in a bottom-up manner.
Transforms the element by applying the given function to all its descendant elements, in a bottom-up manner.
That is, returns the equivalent of:
transformChildElems (e => e.transformElemsOrSelf(f))
- Definition Classes
- TransformableElemLike → TransformableElemApi
- def transformElemsOrSelf(f: (ThisElem) => ThisElem): ThisElem
Transforms the element by applying the given function to all its descendant-or-self elements, in a bottom-up manner.
Transforms the element by applying the given function to all its descendant-or-self elements, in a bottom-up manner.
That is, returns the equivalent of:
f(transformChildElems (e => e.transformElemsOrSelf(f)))
In other words, returns the equivalent of:
f(transformElems(f))
- Definition Classes
- TransformableElemLike → TransformableElemApi
- def transformElemsOrSelfToNodeSeq(f: (ThisElem) => IndexedSeq[ThisNode]): IndexedSeq[ThisNode]
Transforms each descendant element to a node sequence by applying the given function to all its descendant-or-self elements, in a bottom-up manner.
Transforms each descendant element to a node sequence by applying the given function to all its descendant-or-self elements, in a bottom-up manner.
That is, returns the equivalent of:
f(transformChildElemsToNodeSeq(e => e.transformElemsOrSelfToNodeSeq(f)))
In other words, returns the equivalent of:
f(transformElemsToNodeSeq(f))
- Definition Classes
- TransformableElemLike → TransformableElemApi
- def transformElemsToNodeSeq(f: (ThisElem) => IndexedSeq[ThisNode]): ThisElem
Transforms each descendant element to a node sequence by applying the given function to all its descendant elements, in a bottom-up manner.
Transforms each descendant element to a node sequence by applying the given function to all its descendant elements, in a bottom-up manner. The function is not applied to this element itself.
That is, returns the equivalent of:
transformChildElemsToNodeSeq(e => e.transformElemsOrSelfToNodeSeq(f))
It is equivalent to the following expression:
transformElemsOrSelf { e => e.transformChildElemsToNodeSeq(che => f(che)) }
- Definition Classes
- TransformableElemLike → TransformableElemApi
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()