NAME
PDK::Utils::Set - A module for handling sets of numeric ranges
VERSION
Version 1.0
SYNOPSIS
use PDK::Utils::Set;
my $set = PDK::Utils::Set->new(mins => [1, 5], maxs => [3, 7]);
# Add a range to the set
$set->addToSet(8, 10);
# Merge another set
my $set2 = PDK::Utils::Set->new(mins => [6], maxs => [9]);
$set->mergeToSet($set2);
# Get the length of the set
my $length = $set->length;
# Output the contents of the set
$set->dump;
ATTRIBUTES
mins
Type: ArrayRef[Int]
Description: An array of minimum values.
maxs
Type: ArrayRef[Int]
Description: An array of maximum values.
METHODS
BUILDARGS
Processes constructor parameters to construct object parameters based on different input situations.
BUILD
Initializes the object and validates the attributes in the constructor.
length
Returns the length of the minimum and maximum values.
min
Returns the first element of the minimum value array.
max
Returns the last element of the maximum value array.
dump
Outputs the pairs of minimum and maximum values.
addToSet($MIN, $MAX)
Adds the minimum and maximum values to the set.
mergeToSet($setObj)
Merges another set into the current set.
compare($setObj)
Compares the relationship between two sets.
isEqual($setObj)
Checks if two sets are equal.
notEqual($setObj)
Checks if two sets are not equal.
isContain($setObj)
Checks if the current set contains another set.
isBelong($setObj)
Checks if the current set belongs to another set.
interSet($setObj)
Calculates the intersection between the current set and another set.
AUTHOR
WENWU YAN <968828@gmail.com>
COPYRIGHT AND LICENSE
Copyright (C) 2024 WENWU YAN. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.