Download WebRAID API Reference

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
WebRAID API Reference
Onion Networks
Copyright 2001,2002,2003 Onion Networks
Package
com.onionnetworks.util
Contains collections of static helper methods and other miscelaneous datatypes and utilities.
Page 2
com.onionnetworks.util.Range
com.onionnetworks.util
Class Range
java.lang.Object
|
+-com.onionnetworks.util.Range
public class Range
extends java.lang.Object
Represents a range of integers (incuding positive and negative infinity).
Constructor Summary
Range(long num)
Creates a new Range that is only one number, both min and max will equal that number.
Range(long min,long min)
Creates a new Range from min and max (inclusive)
Range(long min,boolean min)
Creates a new Range from min to postive infinity
Range(boolean negInf,long negInf)
Creates a new Range from negative infinity to max.
Range(boolean negInf,boolean negInf)
Creates a new Range from negative infinity to positive infinity.
Method Summary
boolean
contains(long i)
boolean
contains(Range r)
boolean
equals(java.lang.Object obj)
long
getMax()
long
getMin()
int
hashCode()
boolean
isMaxPosInf()
boolean
isMinNegInf()
static Range
parse(java.lang.String s)
This method creates a new range from a String.
Page 3
com.onionnetworks.util.Range
long
java.lang.String
size()
toString()
Methods inherited from : class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Constructors
Range
public Range(long num)
Creates a new Range that is only one number, both min and max will equal that number.
Parameters:
num The number that this range will encompass.
Range
public Range(long min,
long max)
Creates a new Range from min and max (inclusive)
Parameters:
min The min value of the range.
max The max value of the range.
Range
public Range(long min,
boolean posInf)
Creates a new Range from min to postive infinity
Parameters:
min The min value of the range.
posInf Must be true to specify max == positive infinity
Range
public Range(boolean negInf,
long max)
Creates a new Range from negative infinity to max.
Parameters:
negInf Must be true to specify min == negative infinity
max The max value of the range.
Page 4
com.onionnetworks.util.Range
Range
public Range(boolean negInf,
boolean posInf)
Creates a new Range from negative infinity to positive infinity.
Parameters:
negInf must be true.
posInf must be true.
Methods
isMinNegInf
public boolean isMinNegInf()
Returns:
true if min is negative infinity.
isMaxPosInf
public boolean isMaxPosInf()
Returns:
true if max is positive infinity.
getMin
public long getMin()
Returns:
the min value of the range.
getMax
public long getMax()
Returns:
the max value of the range.
size
public long size()
Returns:
(continued on next page)
Page 5
com.onionnetworks.util.Range
(continued from last page)
The size of the range (min and max inclusive) or -1 if the range is infinitly long.
contains
public boolean contains(long i)
Parameters:
i The integer to check to see if it is in the range.
Returns:
true if i is in the range (min and max inclusive)
contains
public boolean contains(Range r)
Parameters:
r The range to check to see if it is in this range.
Returns:
true if this range contains the entirety of the passed range.
hashCode
public int hashCode()
equals
public boolean equals(java.lang.Object obj)
toString
public java.lang.String toString()
parse
public final static Range parse(java.lang.String s)
throws java.text.ParseException
This method creates a new range from a String. Allowable characters are all integer values, "-", ")", and "(". The open and
closed parens indicate positive and negative infinity. Example strings would be:
"11" is the range that only includes 11
"-6" is the range that only includes -6
"10-20" is the range 10 through 20 (inclusive)
"-10--5" is the range -10 through -5
"(-20" is the range negative infinity through 20
"30-)" is the range 30 through positive infinity.
Parameters:
Page 6
com.onionnetworks.util.Range
(continued from last page)
s The String to parse
Returns:
The resulting range
Exceptions:
ParseException,
Page 7
com.onionnetworks.util.RangeSet
com.onionnetworks.util
Class RangeSet
java.lang.Object
|
+-com.onionnetworks.util.RangeSet
public class RangeSet
extends java.lang.Object
This class represents a set of integers in a compact form by using ranges. This is essentially equivilent to run length encoding of a
bitmap-based set and thus works very well for sets with long runs of integers, but is quite poor for sets with very short runs.
This class is similar in flavor to Perl's IntSpan at http://world.std.com/~swmcd/steven/perl/lib/Set/IntSpan/
The Ranges use negative and positive infinity so there should be no border issues with standard set operations and they should
behave exactly as you'd expect from your set identities.
While the data structure itself should be quite efficient for its intended use, the actual implementation could be heavily optimized
beyond what I've done, feel free to improve it.
Field Summary
static int
DEFAULT_CAPACITY
Constructor Summary
RangeSet()
Creates a new empty RangeSet
RangeSet(Range r)
Creates a new RangeSet and adds the provided Range
Method Summary
void
add(long i)
Add a single integer to this set.
void
add(long min,long min)
Add a range to the set.
void
add(Range r)
Add this range to the set.
void
add(RangeSet rs)
Add all of the passed set's elements to this set.
java.lang.Object
RangeSet
Page 8
clone()
complement()
com.onionnetworks.util.RangeSet
boolean
contains(long i)
boolean
contains(long min,long min)
boolean
contains(Range r)
Checks to see if this set contains all of the elements of the Range.
boolean
int
RangeSet
boolean
java.util.Iterator
static void
static RangeSet
equals(java.lang.Object obj)
hashCode()
intersect(RangeSet rs)
isEmpty()
iterator()
main(java.lang.String[] args)
parse(java.lang.String s)
Parse a set of ranges seperated by commas.
void
remove(long i)
void
remove(long min,long min)
void
remove(Range r)
void
remove(RangeSet rs)
long
size()
java.lang.String
toString()
Outputs the Range in a manner that can be used to directly create a new range with the
"parse" method.
RangeSet
union(RangeSet rs)
Methods inherited from : class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Fields
DEFAULT_CAPACITY
public static final int DEFAULT_CAPACITY
Page 9
com.onionnetworks.util.RangeSet
Constructors
RangeSet
public RangeSet()
Creates a new empty RangeSet
RangeSet
public RangeSet(Range r)
Creates a new RangeSet and adds the provided Range
Parameters:
r The range to add.
Methods
union
public RangeSet union(RangeSet rs)
Parameters:
rs The set with which to union with this set.
Returns:
A new set that represents the union of this and the passed set.
intersect
public RangeSet intersect(RangeSet rs)
Parameters:
rs The set with which to intersect with this set.
Returns:
new set that represents the intersct of this and the passed set.
complement
public RangeSet complement()
Returns:
The complement of this set, make sure to check for positive and negative infinity on the returned set.
Page 10
com.onionnetworks.util.RangeSet
(continued from last page)
contains
public boolean contains(long i)
Parameters:
i The integer to check to see if it is in this set..
Returns:
true if i is in the set.
contains
public boolean contains(long min,
long max)
contains
public boolean contains(Range r)
Checks to see if this set contains all of the elements of the Range.
Parameters:
r The Range to see if this RangeSet contains it.
Returns:
true If every element of the Range is within this set.
add
public void add(RangeSet rs)
Add all of the passed set's elements to this set.
Parameters:
rs The set whose elements should be added to this set.
add
public void add(Range r)
Add this range to the set.
Parameters:
r The range to add
add
public void add(long i)
Add a single integer to this set.
Parameters:
i The int to add.
Page 11
com.onionnetworks.util.RangeSet
add
public void add(long min,
long max)
Add a range to the set.
Parameters:
min The min of the range (inclusive)
max The max of the range (inclusive)
remove
public void remove(RangeSet rs)
remove
public void remove(Range r)
remove
public void remove(long i)
remove
public void remove(long min,
long max)
iterator
public java.util.Iterator iterator()
Returns:
An iterator of Range objects that this RangeSet contains.
size
public long size()
Returns:
The number of integers in this set, -1 if infinate.
isEmpty
public boolean isEmpty()
Page 12
Index
(continued from last page)
Returns:
true If the set doesn't contain any integers or ranges.
parse
public static RangeSet parse(java.lang.String s)
throws java.text.ParseException
Parse a set of ranges seperated by commas.
Parameters:
s The String to parse
Returns:
The resulting range
Exceptions:
ParseException
See Also:
Range
hashCode
public int hashCode()
equals
public boolean equals(java.lang.Object obj)
toString
public java.lang.String toString()
Outputs the Range in a manner that can be used to directly create a new range with the "parse" method.
clone
public java.lang.Object clone()
main
public final static void main(java.lang.String[] args)
throws java.lang.Exception
Page 13
Index
Index
parse 6
A
parse 13
add 12
R
C
Range 5
RangeSet 10
clone 13
remove 12
complement 10
contains 6
S
contains 11
size 5
D
size 12
DEFAULT_CAPACITY 9
T
E
toString 6
toString 13
equals 6
equals 13
U
G
union 10
getMax 5
getMin 5
H
hashCode 6
hashCode 13
I
intersect 10
isEmpty 12
isMaxPosInf 5
isMinNegInf 5
iterator 12
M
main 13
P
Page 14