NAME
DateTime::Event::Cron::Quartz::TreeSet - Ordered, unique set implementation.
AFFILIATION
This TreeSet implementation is a part of the DateTime::Event::Cron::Quartz distribution.
SYNOPSIS
use DateTime::Event::Cron::Quartz::TreeSet;
# TreeSet construction
my $set = DateTime::Event::Cron::Quartz::TreeSet->new;
# TreeSet constuction from the list of numeric values
my $set = DateTime::Event::Cron::Quartz::TreeSet->new([30, 28, 15]);
# adding an element to existing treeset
$set->add(20);
# getting last element from the set (greatest in the set)
my $last = $set->last_item();
# getting the first element from the set (lowest one)
my $first = $set->first_item();
# getting the set size
my $size = $set->size();
# getting the portion of the set whose elements are greater than or equal
# to the parameter value
my $tail_set = $set->tail_set(15);
# check if the set contains an element
if ($set->contains(40)) {
print "set contains element with value of 40\n";
}
DESCRIPTION
This package implements the set. This package guarantees that the sorted set will be in ascending element order. Elements in this set are unique. Package provides some functionality from http://java.sun.com/j2se/1.4.2/docs/api/java/util/TreeSet.html
SUBROUTINES/METHODS
- new($list)
-
Returns a DateTime::Event::Cron::Quartz::TreeSet object which contains the list of values if $list parameter was provided
- size()
-
Returns the number of elements in this set (its cardinality).
- first_item()
-
Returns the first (lowest) element currently in this sorted set.
- last_item()
-
Returns the last (gratest) element currently in this sorted set.
- contains($element)
-
Returns true if this set contains the specified element.
- tail_set($from_element)
-
Returns a view of the portion of this set whose elements are greater than or equal to $from_element. The returned sorted set supports all TreeSet methods.
- to_array()
-
Returns an ordered array of elements
INCOMPATIBILITIES
TreeSet works only with numbers. strings/objects are not allowed
BUGS AND LIMITATIONS
This is not a complete implementation of TreeSet. Only basic functionality used by DateTime::Event::Cron::Quartz provided. Can not be used separately.
AUTHOR
Vadim Loginov <vadim.loginov@gmail.com>
COPYRIGHT AND LICENSE
Based on the source code and documentation of OpenSymphony http://www.opensymphony.com/team.jsp Quartz 1.4.2 project licensed under the Apache License, Version 2.0
Copyright (c) 2009 Vadim Loginov.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
VERSION
0.04
SEE ALSO
DateTime::Event::Cron::Quartz(3), http://java.sun.com/j2se/1.4.2/docs/api/java/util/TreeSet.html