Map

sealed trait Map[T <: Exec[T], Version, A] extends Writable with Disposable[T]
trait Disposable[T]
trait Writable
class Object
trait Matchable
class Any

Type members

Types

type K = Vertex[T, Version]

Value members

Abstract methods

def +=(entry: (K, A))(tx: T): Map[T, Version, A]
def -=(vertex: K)(tx: T): Map[T, Version, A]
def add(entry: (K, A))(tx: T): Boolean

Marks a given key with a given value.

Marks a given key with a given value.

Value Params
entry

the key-value pair (where the key is a vertex in the full tree)

Returns

true if the mark is new, false if there had been a mark for the given vertex.

def debugPrint(tx: T): String
def full: Tree[T, Version]
def get(vertex: K)(tx: T): Option[A]

Queries for a mark at a given version vertex. Unlike nearest, this does not search in the map, but merely tests if the given vertex has been marked or not.

Queries for a mark at a given version vertex. Unlike nearest, this does not search in the map, but merely tests if the given vertex has been marked or not.

Value Params
vertex

the version vertex to look up

Returns

the value associated with that vertex, or None if the vertex is unmarked.

def nearest(vertex: K)(tx: T): (K, A)

Finds the nearest marked ancestor of a given version key. Since the map is constructed with a defined root value, this method is guaranteed to succeed—if there are no other marks in the map, it will return the root value (unless the version argument is illegal, i.e. has a version lower than the root vertex' version).

Finds the nearest marked ancestor of a given version key. Since the map is constructed with a defined root value, this method is guaranteed to succeed—if there are no other marks in the map, it will return the root value (unless the version argument is illegal, i.e. has a version lower than the root vertex' version).

Value Params
vertex

the key to look for. The algorithm searches for the nearest ancestor in the marked map with a version less than or equal to the given version

Returns

a pair consisting of the tree vertex found and the value with which it has been marked. If the query version vertex was marked, it will be that vertex which is returned, and not an ancestor.

def nearestOption(vertex: K)(tx: T): Option[(K, A)]
def nearestWithFilter(vertex: K)(p: Int => Boolean)(tx: T): Option[(K, A)]

Searches for the nearest marked ancestor, where version control is handed over to a custom predicate function. I.e., while nearestOption will test for a version that is less than or equal to the query version, the behaviour may be customised here. The predicate function is called with the versionInt field of the vertices, e.g. using the tree's intView.

Searches for the nearest marked ancestor, where version control is handed over to a custom predicate function. I.e., while nearestOption will test for a version that is less than or equal to the query version, the behaviour may be customised here. The predicate function is called with the versionInt field of the vertices, e.g. using the tree's intView.

Only those vertices are considered for which the predicate is true.

'''Note:''' This currently only works correctly if the predicate tests for version anteriority!

Value Params
p

the predicate function for the integer view of the vertex versions

vertex

the query vertex

def remove(vertex: K)(tx: T): Boolean
def valueFormat: TFormat[T, A]

Inherited methods

def dispose(tx: T): Unit
Inherited from
Disposable
def write(out: DataOutput): Unit
Inherited from
Writable