Top Prev Next Up Down

What is a RangeVector

A RangeVector har as a private structure Ada.Containers.Ordered_Sets Set with rows of Velem type. In both Integer variables of a row a CodePoint’value is stored, f = low value, l = high value. No overlapping of row value ranges is allowed.

Verify a RangeVector

function verify(rvA: RangeVector) return Boolean;

check that every element in value-set of the RangeVector has a lower value (f) which is smaller or equal to the higher value (l) and no lower value is less than zero. Theese values are CodePoint’Val integer values.

Search a RangeVector for a specific CodePoint

function exists(rvA:RangeVector;val:CodePoint) return Boolean;

A RangeVector consists of velem’s with a lower and a higher bound CodePoint’Val. Iterate through all element and search for a velem containing this val CodePoint

Length of a RangeVector

function length(rvA:RangeVector) return Integer;

Compare RangeVectors

function equal(f,l:RangeVector) return Boolean;

function less(f,l:RangeVector) return Boolean;

Reserved keys for Map_TY maps

function reserved_urvId(s:CFix) return Boolean;

A key cannot have a name equal to a Unicode General category name.

Insert values in a RangeVector

procedure putC(rvA:in out RangeVector;val:CodePoint);

procedure putC(rvA:in out RangeVector;f:CodePoint;l:CodePoint);

insert new element in a RangeVector

procedure putGC(rvA:in out RangeVector;val:CFix);

all elements based on a Unicode General category

procedure putGC(rvA:in out RangeVector;val:CodePoint);

all elements based on a Unicode General category

procedure putSET(rvA:in out RangeVector; val:Cvar; urv:RangeVectorPack.Map_TY.Map);

retreive elements from a MAP_TY with a val-key and insert these, see Y2018-Text.Util.Urvpack for how to create new codepoint classes.

Example with putC:


001| putC(rv,CodePoint'Val(16#41#),CodePoint'Val(16#43#));
002| putC(rv,CodePoint'Val(16#45#),CodePoint'Val(16#47#));
003| putC(rv,CodePoint'Val(16#49#),CodePoint'Val(16#4B#));
004| putC(rv,CodePoint'Val(16#4D#),CodePoint'Val(16#4F#));
005| putC(rv,CodePoint'Val(16#51#),CodePoint'Val(16#53#));
006| putC(rv,CodePoint'Val(16#55#),CodePoint'Val(16#57#));
007| To_CList(Cmap,rv);
008| this:=CList.First(Cmap);
009| while Clist.Has_Element(this) loop
010| _val:=CList.Element(this);
011| _Ada.Text_IO.Put_Line (To_String(val.s));
012| _Clist.Next(this);
013| end loop;

Where:
 Cmap:CList.map;
 rv:RangeVector;
 this:Clist.Cursor;
 val:Celem;

and the result looks like this:

______41 .. ______43
______45 .. ______47
______49 .. ______4B
______4D .. ______4F
______51 .. ______53
______55 .. ______57

(A part of the example ExSigma)

Operators on RangeVectors

function clone(rvA:RangeVector) return RangeVector;

Clone or copy a RangeVector

procedure merge(rvA:in out RangeVector);

Merge elements in a RangeVector.
This merge is a very simplex merge and donnot consider cases when second element starts in the middle of the first.

procedure clear(rvA:in out RangeVector);

Clear a RangeVector or remove all rows from a RangeVector

Listing

procedure To_CList(CMap:in out CList.map; rvA:RangeVector;head:String:="";cntMax:Integer:=Integer'Last);

List a RangeVector to a Clist.map.
Head – insert a heading before the actual listing
cntMax – limit the number of rows to list for this RangeVector. Number of elements in a RangeVector can be rather large

Example ExSigma

Verify a set

function verify(value: Set_TY.Set) return Boolean;

check that every element in value-set has a lower value (f) which is smaller or equal to the higher value (l) and no lower value is less than zero. These values are CodePoint’Val integer values.
  All though this function has nothing to do with RangeVectors it is here for use from outside the package.