LazyGroup

A lazy group is a wrapper around RangeGroup of type UnicodeNormType. It implements some batch operations and lazy evaluation to optimize evaluating an expression. Only when it is needed will the value be converted to a RangeGroup

Constructor

new LazyGroup(ranges)

Create a new LazyGroup

Parameters:
NameTypeDescription
rangesArray.<Range> | RangeGroup

initial value for #ranges; can be a RangeGroup (greedy) or list of ranges (#lazy); if a RangeGroup, it is considered #readonly to start

Members

lazy :boolean

Whether ranges have been converted to RangeGroup already

Type:
  • boolean

ranges :Array.<Range>|RangeGroup

Ranges, possibly not converted to a group yet

Type:
  • Array.<Range> | RangeGroup

readonly :boolean

Indicates value came from unicode property lookup, so shouldn't be modified

Type:
  • boolean

Methods

binaryOp(op, other)

Perform binary set operation

Parameters:
NameTypeDescription
opstring

operation to perform; one of union, difference, intersect, or symmetricDifference

otherLazyGroup

other operand of the operation

complement()

Compute complement/inverse of the group

copy(other)

Copy the values (shallow) from other to this

Parameters:
NameTypeDescription
otherLazyGroup

get(writable) → {RangeGroup}

Greedily evaluate the RangeGroup and return it

Parameters:
NameTypeDefaultDescription
writablebooleanfalse

whether we need the range group to be writable; will make a copy if necessary

Returns:
Type: 
RangeGroup

isEmpty() → {boolean}

Check if range group is empty

Returns:
Type: 
boolean

size() → {number}

Get size of range group

Returns:
Type: 
number

(static) batch(op, groups) → {LazyGroup}

Perform batch set operation; the operation will have left-to-right operator precedence

Parameters:
NameTypeDescription
opstring

operation to perform; one of union, difference, intersect, or symmetricDifference

groupsArray.<LazyGroup>

groups to operate on

Returns:

output of operation; it is the same as groups[0], modified in-place

Type: 
LazyGroup