Companion object for Mergeable.
Attributes
Members list
Value members
Concrete methods
Method to join two ordered sequences of elements at whichever end of second attaches more closely to the end of first, per the given distance function - without ever reversing (or reordering) first: its own orientation is authoritative, and it always comes first in the result. Only second may be reversed, if that yields a closer join.
Method to join two ordered sequences of elements at whichever end of second attaches more closely to the end of first, per the given distance function - without ever reversing (or reordering) first: its own orientation is authoritative, and it always comes first in the result. Only second may be reversed, if that yields a closer join.
This is deliberately generic (not tied to geometry, or to any particular element type): the only thing it needs to know about A is how far apart two instances of it are, if that's even defined (e.g. Issue #54 uses Coordinate.distance, but any "ordered sequence of things with a distance/compatibility notion between them" can reuse this).
Type parameters
- A
-
the element type.
Value parameters
- distance
-
a function yielding the distance between two elements, if defined.
- first
-
the first sequence: appended as-is, never reversed, never reordered.
- second
-
the second sequence: appended as-is, or reversed - whichever end attaches more closely to
first's last element. Ifdistanceis undefined for both candidate joins (or either sequence is empty),secondis appended as-is.
Attributes
- Returns
-
the concatenation of
firstand (possibly-reversed)second.
Method to merge two Optional values of the same type.
Method to merge two Optional values of the same type.
Type parameters
- T
-
the underlying type.
Value parameters
- ao
-
the first optional value.
- bo
-
the second optional value.
- f
-
a method to merge two elements of the underlying type T.
Attributes
- Returns
-
an Option[T].
Method to merge two Optional values of the same type.
Method to merge two Optional values of the same type.
NOTE: In this method, there is no proper merging of two defined values: we arbitrarily select the first.
Type parameters
- T
-
the underlying type.
Value parameters
- ao
-
the first optional value.
- bo
-
the second optional value.
Attributes
- Returns
-
an Option[T].
Method to merge a Sequence into a Sequence of one.
Method to merge a Sequence into a Sequence of one.
NOTE the merge method assumes that it is associative with respect to T.
Type parameters
- T
-
the underlying type (extends Mergeable).
Value parameters
- fail
-
the value of T used for a merge failure.
- ts
-
the sequence to be merged.
Attributes
- Returns
-
Seq[T] with only one element.
Method to merge two optional Strings.
Method to merge two optional Strings.
Value parameters
- ao
-
the first optional String.
- bo
-
the second optional String.
- f
-
a function to combine two Strings and yield an Option[String].
Attributes
- Returns
-
an Option[String].
Method to concatenate two optional Strings with a delimiter between them.
Method to concatenate two optional Strings with a delimiter between them.
Value parameters
- ao
-
the first optional String.
- bo
-
the second optional String.
- delimiter
-
a String to be placed between the two given Strings.
Attributes
- Returns
-
an Option[String].