View Source partisan_interval_sets (partisan v5.0.0-rc.16)

An implementation of a set of bounded open intervals.

Summary

Functions

Return OrdSet with Element inserted in it. -----------------------------------------------------------------------------

Return OrdSet but with Element removed. -----------------------------------------------------------------------------

Filter OrdSet with Fun. -----------------------------------------------------------------------------

Return the number of points in the Ordset. -----------------------------------------------------------------------------

Fold function Fun over all elements in OrdSet and return Accumulator. -----------------------------------------------------------------------------

Build an ordered set from the elements in List. -----------------------------------------------------------------------------

Return the intersection of the list of interval sets. -----------------------------------------------------------------------------

Return the intersection of IntervalSet1 and IntervalSet2. -----------------------------------------------------------------------------

Check whether IntervalSet1 and IntervalSet2 are disjoint. -----------------------------------------------------------------------------

Return 'true' if Element is an element of Sets, else 'false'. -----------------------------------------------------------------------------

Return 'true' if OrdSet is an empty set, otherwise 'false'. -----------------------------------------------------------------------------

Return 'true' when every element of IntervalSet1 is also a member of IntervalSet2, else 'false'. -----------------------------------------------------------------------------

Return 'true' if Set is an ordered set of elements, else 'false'. -----------------------------------------------------------------------------

Returns the maximum integer value contained in the set. -----------------------------------------------------------------------------

Returns the minimum integer value contained in the set. -----------------------------------------------------------------------------

Return a new empty offset. -----------------------------------------------------------------------------

Return the number of elements in OrdSet. -----------------------------------------------------------------------------

Return all and only the elements of IntervalSet1 which are not also in IntervalSet2. -----------------------------------------------------------------------------

Return the points in OrdSet as a list. -----------------------------------------------------------------------------

Return the elements in OrdSet as a list. -----------------------------------------------------------------------------

Return the union of the list of interval sets. -----------------------------------------------------------------------------

Return the union of IntervalSet1 and IntervalSet2. -----------------------------------------------------------------------------

Types

element/0

-type element() :: integer() | interval().

interval/0

-type interval() :: {integer(), integer()}.

t/0

-type t() :: [element()].

Functions

add_element(Element, Set1)

-spec add_element(Element :: element(), Set1 :: t()) -> Set2 :: t().

Return OrdSet with Element inserted in it. -----------------------------------------------------------------------------

del_element(Element, Set1)

-spec del_element(Element :: element(), Set1 :: t()) -> Set2 :: t().

Return OrdSet but with Element removed. -----------------------------------------------------------------------------

filter(Pred, Set1)

-spec filter(Pred, Set1) -> Set2
                when Pred :: fun((Element :: element()) -> boolean()), Set1 :: t(), Set2 :: t().

Filter OrdSet with Fun. -----------------------------------------------------------------------------

flat_size(S)

-spec flat_size(t()) -> non_neg_integer().

Return the number of points in the Ordset. -----------------------------------------------------------------------------

fold(Function, Acc0, Sets)

-spec fold(Function, Acc0, Sets) -> Acc1
              when
                  Function :: fun((Element :: element(), AccIn :: term()) -> AccOut :: term()),
                  Sets :: t(),
                  Acc0 :: term(),
                  Acc1 :: term().

Fold function Fun over all elements in OrdSet and return Accumulator. -----------------------------------------------------------------------------

from_list(List)

-spec from_list(List :: [element()]) -> Sets :: t().

Build an ordered set from the elements in List. -----------------------------------------------------------------------------

intersection(SetsList)

-spec intersection(SetsList :: [t()]) -> Set :: t().

Return the intersection of the list of interval sets. -----------------------------------------------------------------------------

intersection(Set1, Set2)

-spec intersection(Set1 :: t(), Set2 :: t()) -> Set3 :: t().

Return the intersection of IntervalSet1 and IntervalSet2. -----------------------------------------------------------------------------

is_disjoint(Set1, Set2)

-spec is_disjoint(Set1 :: t(), Set2 :: t()) -> boolean().

Check whether IntervalSet1 and IntervalSet2 are disjoint. -----------------------------------------------------------------------------

is_element(Element, Sets)

-spec is_element(Element :: element(), Sets :: t()) -> boolean().

Return 'true' if Element is an element of Sets, else 'false'. -----------------------------------------------------------------------------

is_empty(S)

-spec is_empty(t()) -> boolean().

Return 'true' if OrdSet is an empty set, otherwise 'false'. -----------------------------------------------------------------------------

is_subset(Set1, Set2)

-spec is_subset(Set1 :: t(), Set2 :: t()) -> boolean().

Return 'true' when every element of IntervalSet1 is also a member of IntervalSet2, else 'false'. -----------------------------------------------------------------------------

is_type(Es)

-spec is_type(t()) -> boolean().

Return 'true' if Set is an ordered set of elements, else 'false'. -----------------------------------------------------------------------------

max(S)

-spec max(t()) -> integer().

Returns the maximum integer value contained in the set. -----------------------------------------------------------------------------

min(_)

-spec min(t()) -> integer().

Returns the minimum integer value contained in the set. -----------------------------------------------------------------------------

new()

-spec new() -> [].

Return a new empty offset. -----------------------------------------------------------------------------

size(S)

-spec size(t()) -> non_neg_integer().

Return the number of elements in OrdSet. -----------------------------------------------------------------------------

subtract(Set1, Set2)

-spec subtract(Set1 :: t(), Set2 :: t()) -> Set3 :: t().

Return all and only the elements of IntervalSet1 which are not also in IntervalSet2. -----------------------------------------------------------------------------

to_flat_list(Set)

-spec to_flat_list(t()) -> [integer()].

Return the points in OrdSet as a list. -----------------------------------------------------------------------------

to_list(S)

-spec to_list(t()) -> [element()].

Return the elements in OrdSet as a list. -----------------------------------------------------------------------------

union(SetsList)

-spec union(SetsList :: [t()]) -> Set :: t().

Return the union of the list of interval sets. -----------------------------------------------------------------------------

union(Set1, Set2)

-spec union(Set1 :: t(), Set2 :: t()) -> Set3 :: t().

Return the union of IntervalSet1 and IntervalSet2. -----------------------------------------------------------------------------