public class IntSetStatistics extends Object implements IntSet
IntSet interface to count method callsIntSet.IntIterator| Constructor and Description |
|---|
IntSetStatistics(IntSet container)
Wraps an
IntSet instance with an IntSetStatistics
instance |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(int i)
Adds the specified element to this set if it is not already present.
|
boolean |
addAll(IntSet c)
Adds all of the elements in the specified collection to this set if
they're not already present.
|
double |
bitmapCompressionRatio()
|
void |
clear()
Removes all of the elements from this set.
|
void |
clear(int from,
int to)
Removes from the set all the elements between
first and
last, both included. |
IntSet |
clone()
See the
clone() of Object |
double |
collectionCompressionRatio()
|
int |
compareTo(IntSet o) |
void |
complement()
Complements the current set.
|
IntSet |
complemented()
Generates the complement set.
|
int |
complementSize()
Computes the complement set size.
|
boolean |
contains(int i)
Returns true if this set contains the specified element.
|
boolean |
containsAll(IntSet c)
Returns true if this set contains all of the elements of the
specified collection.
|
boolean |
containsAny(IntSet other)
|
boolean |
containsAtLeast(IntSet other,
int minElements)
|
IntSet |
convert(Collection<Integer> c)
Converts a given collection into an instance of the current class.
|
IntSet |
convert(int... a)
Converts a given array into an instance of the current class.
|
String |
debugInfo()
Prints debug info about the given
IntSet implementation |
IntSet.IntIterator |
descendingIterator() |
IntSet |
difference(IntSet other)
Generates the difference set
|
int |
differenceSize(IntSet other)
Computes the difference set size.
|
IntSet |
empty()
Generates an empty set
|
boolean |
equals(Object obj) |
static IntSet |
extractContainer(IntSet c)
Removes the
IntSetStatistics wrapper |
void |
fill(int from,
int to)
Adds to the set all the elements between
first and
last, both included. |
int |
first()
Returns the first (lowest) element currently in this set.
|
void |
flip(int e)
Adds the element if it not existing, or removes it if existing
|
int |
get(int i)
Gets the
ith element of the set |
static long |
getComplementCount() |
static long |
getComplementSizeCount() |
static long |
getContainsAllCount() |
static long |
getContainsAnyCount() |
static long |
getContainsAtLeastCount() |
static long |
getDifferenceCount() |
static long |
getDifferenceSizeCount() |
static long |
getEqualsCount() |
static long |
getHashCodeCount() |
static long |
getIntersectionCount() |
static long |
getIntersectionSizeCount() |
static long |
getSizeCheckCount() |
static long |
getSymmetricDifferenceCount() |
static long |
getSymmetricDifferenceSizeCount() |
static long |
getUnionCount() |
static long |
getUnionSizeCount() |
int |
hashCode() |
int |
indexOf(int e)
Provides position of element within the set.
|
IntSet |
intersection(IntSet other)
Generates the intersection set
|
int |
intersectionSize(IntSet other)
Computes the intersection set size.
|
boolean |
isEmpty() |
IntSet.IntIterator |
iterator() |
double |
jaccardDistance(IntSet other)
Computes the Jaccard distance between this set and the given set.
|
double |
jaccardSimilarity(IntSet other)
Computes the Jaccard similarity coefficient between this set and the
given set.
|
int |
last()
Returns the last (highest) element currently in this set.
|
List<? extends IntSet> |
powerSet()
Computes the power-set of the current set.
|
List<? extends IntSet> |
powerSet(int min,
int max)
Computes a subset of the power-set of the current set, composed by those
subsets that have cardinality between
min and
max. |
int |
powerSetSize()
Computes the power-set size of the current set.
|
int |
powerSetSize(int min,
int max)
Computes the power-set size of the current set, composed by those subsets
that have cardinality between
min and max. |
boolean |
remove(int i)
Removes the specified element from this set if it is present.
|
boolean |
removeAll(IntSet c)
Removes from this set all of its elements that are contained in the
specified collection.
|
static void |
resetCounters()
Resets all counters
|
boolean |
retainAll(IntSet c)
Retains only the elements in this set that are contained in the specified
collection.
|
int |
size() |
static String |
summary() |
IntSet |
symmetricDifference(IntSet other)
Generates the symmetric difference set
|
int |
symmetricDifferenceSize(IntSet other)
Computes the symmetric difference set size.
|
int[] |
toArray() |
int[] |
toArray(int[] a)
Returns an array containing all of the elements in this set.
|
String |
toString() |
IntSet |
union(IntSet other)
Generates the union set
|
int |
unionSize(IntSet other)
Computes the union set size.
|
double |
weightedJaccardDistance(IntSet other)
Computes the weighted version of the Jaccard distance between this set
and the given set.
|
double |
weightedJaccardSimilarity(IntSet other)
Computes the weighted version of the Jaccard similarity coefficient
between this set and the given set.
|
public IntSetStatistics(IntSet container)
IntSet instance with an IntSetStatistics
instancecontainer - IntSet to wrappublic static long getUnionCount()
addAll(IntSet) , union(IntSet) )public static long getIntersectionCount()
retainAll(IntSet) , intersection(IntSet) )public static long getDifferenceCount()
removeAll(IntSet) , difference(IntSet) )public static long getSymmetricDifferenceCount()
symmetricDifference(IntSet) )public static long getComplementCount()
complement() , complemented() )public static long getUnionSizeCount()
addAll(IntSet) , union(IntSet) )public static long getIntersectionSizeCount()
retainAll(IntSet) , intersection(IntSet) )public static long getDifferenceSizeCount()
removeAll(IntSet) , difference(IntSet) )public static long getSymmetricDifferenceSizeCount()
symmetricDifference(IntSet) )public static long getComplementSizeCount()
complement() , complemented() )public static long getEqualsCount()
equals(Object) )public static long getHashCodeCount()
hashCode() )public static long getContainsAllCount()
containsAll(IntSet) callspublic static long getContainsAnyCount()
containsAny(IntSet) callspublic static long getContainsAtLeastCount()
containsAtLeast(IntSet,int) callspublic static long getSizeCheckCount()
public static void resetCounters()
public static String summary()
public static IntSet extractContainer(IntSet c)
IntSetStatistics wrapperc - IntSet instancepublic boolean addAll(IntSet c)
addAll in interface IntSetc - collection containing elements to be added to this setIntSet.add(int)public IntSet union(IntSet other)
union in interface IntSetother - IntSet instance that represents the right
operandIntSet.addAll(IntSet)public boolean retainAll(IntSet c)
retainAll in interface IntSetc - collection containing elements to be retained in this setIntSet.remove(int)public IntSet intersection(IntSet other)
intersection in interface IntSetother - IntSet instance that represents the right
operandIntSet.retainAll(IntSet)public boolean removeAll(IntSet c)
removeAll in interface IntSetc - collection containing elements to be removed from this setIntSet.remove(int),
IntSet.contains(int)public IntSet difference(IntSet other)
difference in interface IntSetother - IntSet instance that represents the right
operandIntSet.removeAll(IntSet)public IntSet symmetricDifference(IntSet other)
symmetricDifference in interface IntSetother - IntSet instance that represents the right
operandIntSet.flip(int)public void complement()
IntSet.last() that do not exist in the
current set.complement in interface IntSetIntSet.complemented()public IntSet complemented()
IntSet.last() that do not exist in the
current set.complemented in interface IntSetIntSet.complement()public int unionSize(IntSet other)
This is faster than calling IntSet.union(IntSet) and then
IntSet.size()
public int intersectionSize(IntSet other)
This is faster than calling IntSet.intersection(IntSet) and
then IntSet.size()
intersectionSize in interface IntSetother - IntSet instance that represents the right
operandpublic int differenceSize(IntSet other)
This is faster than calling IntSet.difference(IntSet) and then
IntSet.size()
differenceSize in interface IntSetother - IntSet instance that represents the right
operandpublic int symmetricDifferenceSize(IntSet other)
This is faster than calling IntSet.symmetricDifference(IntSet)
and then IntSet.size()
symmetricDifferenceSize in interface IntSetother - IntSet instance that represents the right
operandpublic int complementSize()
This is faster than calling IntSet.complemented() and then
IntSet.size()
complementSize in interface IntSetpublic boolean containsAll(IntSet c)
containsAll in interface IntSetc - collection to be checked for containment in this setIntSet.contains(int)public boolean containsAny(IntSet other)
true if the specified IntSet
instance contains any elements that are also contained within this
IntSet instancecontainsAny in interface IntSetother - IntSet to intersect withIntSet
intersects the specified IntSet.public boolean containsAtLeast(IntSet other, int minElements)
public double bitmapCompressionRatio()
BitSet, 2 means twice the size of BitSet, etc.)bitmapCompressionRatio in interface IntSetpublic double collectionCompressionRatio()
ArrayList, 2 means twice the size of ArrayList, etc.)collectionCompressionRatio in interface IntSetpublic void clear(int from,
int to)
first and
last, both included.public void fill(int from,
int to)
first and
last, both included.public void clear()
public boolean add(int i)
public boolean remove(int i)
public void flip(int e)
flip in interface IntSete - element to flipIntSet.symmetricDifference(IntSet)public int get(int i)
ith element of the setpublic int indexOf(int e)
It returns -1 if the element does not exist within the set.
public boolean contains(int i)
public int first()
public int last()
public boolean isEmpty()
public int size()
public IntSet.IntIterator iterator()
iterator in interface IntSetIntSet.IntIterator instance to iterate over the setpublic IntSet.IntIterator descendingIterator()
descendingIterator in interface IntSetIntSet.IntIterator instance to iterate over the set in
descending orderpublic int[] toArray()
public int[] toArray(int[] a)
If this set fits in the specified array with room to spare (i.e., the array has more elements than this set), the element in the array immediately following the end of the set are left unchanged.
public int compareTo(IntSet o)
compareTo in interface Comparable<IntSet>public List<? extends IntSet> powerSet()
It is a particular implementation of the algorithm Apriori (see: Rakesh Agrawal, Ramakrishnan Srikant, Fast Algorithms for Mining Association Rules in Large Databases, in Proceedings of the 20th International Conference on Very Large Data Bases, p.487-499, 1994). The returned power-set does not contain the empty set.
The subsets composing the powerset are returned in a list that is sorted according to the lexicographical order provided by the integer set.
powerSet in interface IntSetIntSet.powerSet(int, int),
IntSet.powerSetSize()public List<? extends IntSet> powerSet(int min, int max)
min and
max.
It is a particular implementation of the algorithm Apriori (see: Rakesh Agrawal, Ramakrishnan Srikant, Fast Algorithms for Mining Association Rules in Large Databases, in Proceedings of the 20th International Conference on Very Large Data Bases, p.487-499, 1994). The power-set does not contains the empty set.
The subsets composing the powerset are returned in a list that is sorted according to the lexicographical order provided by the integer set.
powerSet in interface IntSetmin - minimum subset size (greater than zero)max - maximum subset sizeIntSet.powerSet(),
IntSet.powerSetSize(int, int)public int powerSetSize()
The power-set does not contains the empty set.
powerSetSize in interface IntSetIntSet.powerSet()public int powerSetSize(int min,
int max)
min and max.
The returned power-set does not contain the empty set.
powerSetSize in interface IntSetmin - minimum subset size (greater than zero)max - maximum subset sizeIntSet.powerSet(int, int)public double jaccardSimilarity(IntSet other)
The coefficient is defined as
|A intersection B| / |A union B|.
jaccardSimilarity in interface IntSetother - the other setIntSet.jaccardDistance(IntSet)public double jaccardDistance(IntSet other)
The coefficient is defined as
1 - IntSet.jaccardSimilarity(IntSet).
jaccardDistance in interface IntSetother - the other setIntSet.jaccardSimilarity(IntSet)public double weightedJaccardSimilarity(IntSet other)
The coefficient is defined as
sum of min(A_i, B_i) / sum of max(A_i, B_i).
weightedJaccardSimilarity in interface IntSetother - the other setIntSet.weightedJaccardDistance(IntSet)public double weightedJaccardDistance(IntSet other)
The coefficient is defined as 1 -
IntSet.weightedJaccardSimilarity(IntSet).
weightedJaccardDistance in interface IntSetother - the other setIntSet.weightedJaccardSimilarity(IntSet)public IntSet empty()
public IntSet convert(int... a)
public IntSet convert(Collection<Integer> c)
Copyright © 2016. All rights reserved.