Package

scales

utils

Permalink

package utils

The scales.utils packages provide the basis functionality for scales.xml.

The Tree an Path collections that underpin the XML model, as well as the iteratee functionality are located in the relevant sub-packages.

The package object itself pulls in the main utility functions for tree, path and iteratee handling. Import the scales.utils.ScalesUtils object implicit members to provide the path & and | extension functions, the iteratorEnumerator and the +:+ lazy appender for scalaz.EphemeralStream.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. utils
  2. ConcurrentMapUtils
  3. Paths
  4. Trees
  5. EquivFunctions
  6. Iteratees
  7. StackUtils
  8. AsBooleanTrait
  9. IterableUtils
  10. AnyRef
  11. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. type AsBoolean[T] = (T) ⇒ Boolean

    Permalink
    Definition Classes
    AsBooleanTrait
  2. trait AsBooleanTrait extends AnyRef

    Permalink

    Provides the conversion type class AsBoolean, and simple matchers (extractor builders) to use them.

    Provides the conversion type class AsBoolean, and simple matchers (extractor builders) to use them. Used by the xpath boolean function and xmltree matching

  3. class BooleanAndTMatcher[X, T] extends AnyRef

    Permalink
    Definition Classes
    AsBooleanTrait
  4. class BooleanMatcher[X, T] extends AnyRef

    Permalink
    Definition Classes
    AsBooleanTrait
  5. sealed trait EitherLike[+L, +R] extends AnyRef

    Permalink

    Either is great, perfect for what is needed, except for the indirection and the added memory and cpu costs thereof.

    Either is great, perfect for what is needed, except for the indirection and the added memory and cpu costs thereof. If ScalesXml is meant to be used in the placesthat JAXP and friends would live it should perform the best it can.

    That means reducing allocations wherever possible and optimising up to the point of model damage. I think this unfortunately crosses that line but meets the aim.

  6. class Equiv[A] extends AnyRef

    Permalink

    Provides evidence that two instances of two disctinct types are equivalent after a conversion.

    Provides evidence that two instances of two disctinct types are equivalent after a conversion. Requires an instance of Equal for the common convertable type.

  7. trait EquivFunctions extends AnyRef

    Permalink
  8. type FoldR[Item <: LeftLike[Item, Tree[Item, Section, CC]], Section, CC[_]] = Either[Path[Item, Section, CC], FoldError]

    Permalink
    Definition Classes
    Paths
  9. type ItemOrSectionWalk[Item, Section] = Either[Item, SectionWalk[Section]]

    Permalink

    badly named the boolean should indicate if it has any children

    badly named the boolean should indicate if it has any children

    Definition Classes
    Trees
  10. type ItemOrTree[Item <: LeftLike[Item, Tree[Item, Section, CC]], Section, CC[_]] = EitherLike[Item, Tree[Item, Section, CC]]

    Permalink
    Definition Classes
    Trees
  11. trait LeftLike[+L, +R] extends LeftLikeProjection[L] with EitherLike[L, R]

    Permalink
  12. type PathFoldR[Item <: LeftLike[Item, Tree[Item, Section, CC]], Section, CC[_]] = (Path[Item, Section, CC]) ⇒ FoldR[Item, Section, CC]

    Permalink
    Definition Classes
    Paths
  13. trait RightLike[+L, +R] extends RightLikeProjection[R] with EitherLike[L, R]

    Permalink
  14. type TreeCBF[Item <: LeftLike[Item, Tree[Item, Section, CC]], Section, CC[_]] = CanBuildFrom[CC[_], ItemOrTree[Item, Section, CC], CC[ItemOrTree[Item, Section, CC]]]

    Permalink
    Definition Classes
    Trees

Value Members

  1. val ALREADY_RESTARTED: String

    Permalink
    Definition Classes
    IterableUtils
  2. val NotSameRoot: Int

    Permalink
    Definition Classes
    Paths
  3. object ScalesUtils extends ScalesUtilsImplicits

    Permalink

    Allows importing all scales.utils implicits directly

  4. val US_ASCII: Charset

    Permalink
  5. val UTF_8: Charset

    Permalink
  6. def boolean[T](it: T)(implicit arg0: AsBoolean[T]): Boolean

    Permalink
    Definition Classes
    AsBooleanTrait
  7. def booleanAndTMatcher[X, T](eval: (X) ⇒ T)(implicit arg0: AsBoolean[T]): BooleanAndTMatcher[X, T]

    Permalink

    Calls eval to return a T t'.

    Calls eval to return a T t'. This T is then evaluated with the AsBoolean type class.

    When evaluated to true (t',x) is returned. val Matcher = booleanMatcher( (x) => T ); val Matcher(t,x) = x

    Definition Classes
    AsBooleanTrait
  8. def booleanMatcher[X, T](eval: (X) ⇒ T)(implicit arg0: AsBoolean[T]): BooleanMatcher[X, T]

    Permalink

    Calls eval to return a T t'.

    Calls eval to return a T t'. This T is then evaluated with the AsBoolean type class.

    When evaluated to true t' is returned. val Matcher = booleanMatcher( (x) => T ); val Matcher(t) = x

    Definition Classes
    AsBooleanTrait
  9. def calcOnce[K, T](key: K, map: ConcurrentHashMap[K, Once[T]])(calc: ⇒ T): T

    Permalink

    Calculates the value once and only once (using a lazy val), returning the result, use this approach for expensive calculations.

    Calculates the value once and only once (using a lazy val), returning the result, use this approach for expensive calculations.

    Definition Classes
    ConcurrentMapUtils
  10. def capture[A](orig: Iterator[A]): CapturedIterator[A]

    Permalink
    Definition Classes
    IterableUtils
  11. def collectFirst[A, B](in: Iterable[A])(f: (A) ⇒ Option[B]): Option[B]

    Permalink

    Collects the first Some

    Collects the first Some

    Definition Classes
    IterableUtils
  12. package collection

    Permalink

    The collection pacakge provides the scales.utils.collection.Tree

  13. def comparePathPositions[Item <: LeftLike[Item, Tree[Item, Section, CC]], Section, CC[_]](path1: Position[Item, Section, CC], path2: Position[Item, Section, CC]): Int

    Permalink

    When paths are not in the same root, they are compared based on the identity hash of the given roots.

    When paths are not in the same root, they are compared based on the identity hash of the given roots. Of course this relies on that function having a decent vm implementation.

    returns

    1 if path1 is before path2, -1 if path2 is before path1, 0 if they are the same and NotSameRoot+-1 if they are not in the same root

    Definition Classes
    Paths
  14. def comparePaths[Item <: LeftLike[Item, Tree[Item, Section, CC]], Section, CC[_]](path1: Path[Item, Section, CC], path2: Path[Item, Section, CC]): (Int, Position[Item, Section, CC], Position[Item, Section, CC])

    Permalink

    When paths are not in the same root, they are compared based on the identity hash of the given roots.

    When paths are not in the same root, they are compared based on the identity hash of the given roots. Of course this relies on that function having a decent vm implementation. See http://www.w3.org/TR/2007/REC-xpath20-20070123/#dt-document-order, tree order must remain constant. Its also a pretty sensible approach for non xml trees.

    returns

    1 if path1 is before path2, -1 if path2 is before path1, 0 if they are the same and NotSameRoot+-1 if they are not in the same root

    Definition Classes
    Paths
  15. def comparePathsDirect[Item <: LeftLike[Item, Tree[Item, Section, CC]], Section, CC[_]](path1: Path[Item, Section, CC], path2: Path[Item, Section, CC]): Boolean

    Permalink

    Helper for comparePaths, will not evaluate position if the paths are equal

    Helper for comparePaths, will not evaluate position if the paths are equal

    Definition Classes
    Paths
  16. def comparePathsP[Item <: LeftLike[Item, Tree[Item, Section, CC]], Section, CC[_]](path1: (Position[Item, Section, CC], Path[Item, Section, CC]), path2: (Position[Item, Section, CC], Path[Item, Section, CC])): (Int, Position[Item, Section, CC], Position[Item, Section, CC])

    Permalink
    Definition Classes
    Paths
  17. def comparePathsT[Item <: LeftLike[Item, Tree[Item, Section, CC]], Section, CC[_], T](path1: (Position[Item, Section, CC], (T, Path[Item, Section, CC])), path2: (Position[Item, Section, CC], (T, Path[Item, Section, CC]))): (Int, Position[Item, Section, CC], Position[Item, Section, CC])

    Permalink
    Definition Classes
    Paths
  18. final def compareStack(p1: List[Int], p2: List[Int]): Int

    Permalink
    Definition Classes
    StackUtils
    Annotations
    @tailrec()
  19. def deepestLast[Item <: LeftLike[Item, Tree[Item, Section, CC]], Section, CC[_]](path: Path[Item, Section, CC]): Path[Item, Section, CC]

    Permalink

    Deepest last child

    Deepest last child

    Definition Classes
    Paths
  20. val defaultCharset: Charset

    Permalink

    A usable default of UTF8 NOT the vm's Charset.defaultCharset based on its locale, use vmDefaultCharset for that

  21. def equivalent[A, B, C](a: A, b: B)(implicit equiv: Equiv[C], viewA: (A) ⇒ C, viewB: (B) ⇒ C): Boolean

    Permalink

    Are these two parameters (convertable to a C) equal for a given Equiv[C] instance

    Are these two parameters (convertable to a C) equal for a given Equiv[C] instance

    Definition Classes
    EquivFunctions
  22. def error(string: String): Nothing

    Permalink
    Definition Classes
    Iteratees
  23. final def fold[Item <: LeftLike[Item, Tree[Item, Section, CC]], Section, CC[_], A](a: A)(folder: (ItemOrSectionWalk[Item, Section], A) ⇒ A)(tree: Tree[Item, Section, CC]): A

    Permalink
    Definition Classes
    Trees
  24. def foldPositions[Item <: LeftLike[Item, Tree[Item, Section, CC]], Section, CC[_]](locations: Iterable[Path[Item, Section, CC]])(folder: (Path[Item, Section, CC]) ⇒ FoldOperation[Item, Section, CC])(implicit iseqLikeThing: SeqLikeThing[CC[_], ItemOrTree[Item, Section, CC], CC], cm: ClassManifest[(Position[Item, Section, CC], Path[Item, Section, CC])]): FoldR[Item, Section, CC]

    Permalink

    Folds over positions within a single path, for example all given children.

    Folds over positions within a single path, for example all given children. As such positions must be calculated.

    Takes the first root, returning Right(NoSingleRoot) if any of the subsequent roots don't match.

    folder retrieves the current path

    Each iteration folds the resulting tree back into the path. As this function must maintain the Path it does not expose the new path root until the result.

    Definition Classes
    Paths
  25. def foldPositions[Item <: LeftLike[Item, Tree[Item, Section, CC]], Section, CC[_], ACC](locations: Iterable[Path[Item, Section, CC]], accumulator: ACC)(folder: (ACC, Path[Item, Section, CC]) ⇒ (ACC, FoldOperation[Item, Section, CC]))(implicit iseqLikeThing: SeqLikeThing[CC[_], ItemOrTree[Item, Section, CC], CC], cm: ClassManifest[(Position[Item, Section, CC], Path[Item, Section, CC])]): Either[(ACC, Path[Item, Section, CC]), FoldError]

    Permalink

    As per the non accumalating version, folds over positions within a given tree but allows for an additional accumalation.

    As per the non accumalating version, folds over positions within a given tree but allows for an additional accumalation.

    The progress through the document is in reverse document order. This ensures that transformations can always be safely composed, e.g. a delete of a path won't stop changes below it. This, however, implies the developer must also handle any accumulation in "reverse".

    Definition Classes
    Paths
  26. def following[Item <: LeftLike[Item, Tree[Item, Section, CC]], Section, CC[_]](path: Path[Item, Section, CC]): Option[Path[Item, Section, CC]]

    Permalink

    gets the next following:: sibling in document order

    gets the next following:: sibling in document order

    Definition Classes
    Paths
  27. def getList[K, T](key: K, mapToList: ConcurrentHashMap[K, ConcurrentLinkedQueue[T]]): ConcurrentLinkedQueue[T]

    Permalink
    Definition Classes
    ConcurrentMapUtils
  28. implicit val idIteratees: IterateeFunctions[scalaz.Id.Id]

    Permalink

    Warning: Id does not trampoline, consider trampolineIteratees or ioIteratees to import from

    Warning: Id does not trampoline, consider trampolineIteratees or ioIteratees to import from

    Definition Classes
    Iteratees
  29. package impl

    Permalink
  30. package io

    Permalink
  31. implicit val ioIteratees: IterateeFunctions[IO]

    Permalink
    Definition Classes
    Iteratees
  32. final def item[Item <: LeftLike[Item, Tree[Item, Section, CC]], Section, CC[_]](item: Item): ItemOrTree[Item, Section, CC]

    Permalink
    Annotations
    @inline()
  33. package iteratee

    Permalink
  34. def iterateesOf[F[_]](implicit F: Monad[F]): IterateeFunctions[F]

    Permalink
    Definition Classes
    Iteratees
  35. def mkString[A](itr: Iterable[A], builder: StringBuilder = new java.lang.StringBuilder(1000), separator: String = " ")(thunk: (A) ⇒ String): StringBuilder

    Permalink

    Makes a StringBuilder from an iterable using the builder parameter.

    Makes a StringBuilder from an iterable using the builder parameter.

    Definition Classes
    IterableUtils
  36. def moveTo[Item <: LeftLike[Item, Tree[Item, Section, CC]], Section, CC[_]](path: Path[Item, Section, CC], newPos: Position[Item, Section, CC])(implicit seqLikeThing: SeqLikeThing[CC[_], ItemOrTree[Item, Section, CC], CC]): Path[Item, Section, CC]

    Permalink

    Navigates the path until the new position is reached, throws if either its a new root or the position is not reachable

    Navigates the path until the new position is reached, throws if either its a new root or the position is not reachable

    Definition Classes
    Paths
  37. def noPath[Item <: LeftLike[Item, Tree[Item, Section, CC]], Section, CC[_]](implicit seqLikeThing: SeqLikeThing[CC[_], ItemOrTree[Item, Section, CC], CC]): Path[Item, Section, CC]

    Permalink
    Definition Classes
    Paths
  38. final def one[T](i: T): List[T]

    Permalink
    Annotations
    @inline()
  39. def positions[Item <: LeftLike[Item, Tree[Item, Section, CC]], Section, CC[_]](paths: Iterable[Path[Item, Section, CC]]): Iterable[(Position[Item, Section, CC], Path[Item, Section, CC])]

    Permalink

    Obtain the positions for the paths

    Obtain the positions for the paths

    Definition Classes
    Paths
  40. def positionsT[Item <: LeftLike[Item, Tree[Item, Section, CC]], Section, CC[_], T](paths: Iterable[(T, Path[Item, Section, CC])]): Iterable[(Position[Item, Section, CC], (T, Path[Item, Section, CC]))]

    Permalink

    positions with tuples (T, Path)

    positions with tuples (T, Path)

    Definition Classes
    Paths
  41. def preceding[Item <: LeftLike[Item, Tree[Item, Section, CC]], Section, CC[_]](path: Path[Item, Section, CC]): Option[Path[Item, Section, CC]]

    Permalink

    gets the next preceding:: sibling equivalent in document order, unlike XPath preceding:: it does not exclude parents

    gets the next preceding:: sibling equivalent in document order, unlike XPath preceding:: it does not exclude parents

    Definition Classes
    Paths
  42. def removeList[K, T](key: K, mapToList: ConcurrentHashMap[K, ConcurrentLinkedQueue[T]]): ConcurrentLinkedQueue[T]

    Permalink
    Definition Classes
    ConcurrentMapUtils
  43. def removeOr[K, T](key: K, map: ConcurrentHashMap[K, T])(newT: ⇒ T): T

    Permalink

    Removes the value, returning either it or a new item (stops end code worrying about nulls etc..

    Removes the value, returning either it or a new item (stops end code worrying about nulls etc..

    Definition Classes
    ConcurrentMapUtils
  44. def resource(a: AnyRef, path: String): URL

    Permalink

    Simple grabber of resources

  45. package resources

    Permalink
  46. def rootPath[Item <: LeftLike[Item, Tree[Item, Section, CC]], Section, CC[_]](path: Path[Item, Section, CC]): Path[Item, Section, CC]

    Permalink

    Returns the root path for its input, uses zipUp to ensure changes are kept

    Returns the root path for its input, uses zipUp to ensure changes are kept

    Definition Classes
    Paths
  47. def sameBase(test: List[Int], against: List[Int]): Boolean

    Permalink
    Definition Classes
    StackUtils
  48. def sort[Item <: LeftLike[Item, Tree[Item, Section, CC]], Section, CC[_]](paths: Iterable[Path[Item, Section, CC]], isDescending: Boolean = true)(implicit cm: ClassManifest[(Position[Item, Section, CC], Path[Item, Section, CC])]): Iterable[Path[Item, Section, CC]]

    Permalink

    Sorts according to position of each path item, descending or descending based on a depth first then rightwise order.

    Sorts according to position of each path item, descending or descending based on a depth first then rightwise order.

    Definition Classes
    Paths
  49. def sortPositions[Item <: LeftLike[Item, Tree[Item, Section, CC]], Section, CC[_]](paths: Iterable[Path[Item, Section, CC]], isDescending: Boolean = true)(implicit cm: ClassManifest[(Position[Item, Section, CC], Path[Item, Section, CC])]): Iterable[(Position[Item, Section, CC], Path[Item, Section, CC])]

    Permalink

    Sorts according to position of each path item, descending or descending based on a depth first then rightwise order.

    Sorts according to position of each path item, descending or descending based on a depth first then rightwise order.

    Definition Classes
    Paths
  50. def sortPositionsT[Item <: LeftLike[Item, Tree[Item, Section, CC]], Section, CC[X], T](paths: Iterable[(T, Path[Item, Section, CC])], isDescending: Boolean = true)(implicit cm: ClassManifest[(Position[Item, Section, CC], (T, Path[Item, Section, CC]))]): Iterable[(Position[Item, Section, CC], (T, Path[Item, Section, CC]))]

    Permalink

    sortPositions with a tuple T, Path

    sortPositions with a tuple T, Path

    Definition Classes
    Paths
  51. def sortT[Item <: LeftLike[Item, Tree[Item, Section, CC]], Section, CC[_], T](paths: Iterable[(T, Path[Item, Section, CC])], isDescending: Boolean = true)(implicit cm: ClassManifest[(Position[Item, Section, CC], (T, Path[Item, Section, CC]))]): Iterable[(T, Path[Item, Section, CC])]

    Permalink

    sort with a tuple T, Path

    sort with a tuple T, Path

    Definition Classes
    Paths
  52. final def subtree[Item <: LeftLike[Item, Tree[Item, Section, CC]], Section, CC[_]](section: Section, children: CC[ItemOrTree[Item, Section, CC]])(implicit iseqLikeThing: SeqLikeThing[CC[_], ItemOrTree[Item, Section, CC], CC]): ItemOrTree[Item, Section, CC]

    Permalink
    Annotations
    @inline()
  53. def toPositionalEqual[Item <: LeftLike[Item, Tree[Item, Section, CC]], Section, CC[_]]: Equal[Path[Item, Section, CC]]

    Permalink

    Provides an instance of the Equal type class for positional Equality

    Provides an instance of the Equal type class for positional Equality

    Definition Classes
    Paths
  54. def top[Item <: LeftLike[Item, Tree[Item, Section, CC]], Section, CC[_]](tree: Tree[Item, Section, CC])(implicit seqLikeThing: SeqLikeThing[CC[_], ItemOrTree[Item, Section, CC], CC]): Path[Item, Section, CC]

    Permalink
    Definition Classes
    Paths
  55. implicit val trampolineIteratees: IterateeFunctions[Trampoline]

    Permalink
    Definition Classes
    Iteratees
  56. def valueOf[K, T](key: K, map: ConcurrentHashMap[K, T])(newT: ⇒ T): T

    Permalink

    retrieves the value of a concurrent hashmap against a given key, creating if necessary.

    retrieves the value of a concurrent hashmap against a given key, creating if necessary. Note it makes no gaurantee of once only semantics for the value generation

    Definition Classes
    ConcurrentMapUtils

Inherited from ConcurrentMapUtils

Inherited from Paths

Inherited from Trees

Inherited from EquivFunctions

Inherited from Iteratees

Inherited from StackUtils

Inherited from AsBooleanTrait

Inherited from IterableUtils

Inherited from AnyRef

Inherited from Any

Ungrouped