public class ItemSet extends Object implements Serializable
int
values. It is assumed that each item has
a distinct integer identifier.
The necessary methods are implemented allowing instances of this class to be
used within the standard utility library (i.e. HashMap
...).
Constructor and Description |
---|
ItemSet(int itemID)
Construct an item set with a single item.
|
ItemSet(int[] itemIDs)
Construct an item set from the given items.
|
ItemSet(int[] itemIDs,
int length)
Create an item set from the list of items specifying how
many from the list to use.
|
ItemSet(int[] itemsLHS,
int[] itemsRHS)
Combine the two sets of items into one set.
|
ItemSet(int[] itemIDs,
long support,
double supportPct)
Construct an item set from the given items.
|
ItemSet(int itemID,
int[] itemIDs)
Combine the given singular item and a list of items into a single item set.
|
Modifier and Type | Method and Description |
---|---|
void |
calculateSupportPct(long transactionTotal)
Given the number of transactions in a DB compute the
support percent for this item set.
|
boolean |
equals(Object o) |
int[] |
getItemIDs()
Get the item identifiers contained in this item list.
|
long |
getSupport()
Get the current support value.
|
double |
getSupportPct()
Get the support percentage value.
|
int |
hashCode() |
void |
incrementSupport()
Increment the support value.
|
static Comparator<ItemSet> |
newSetSizeComparator()
Create a new
Comparator that compares item sets
and allows sorting by item set size and support. |
boolean |
represents(int[] items)
Returns whether the given list of items matches the list of items
within this item set.
|
void |
setSupport(long support)
Set the support value.
|
int |
size()
Return the size of this item set.
|
String |
toString() |
public ItemSet(int itemID)
itemID
- item identifierpublic ItemSet(int[] itemIDs)
itemIDs
- items within the item setpublic ItemSet(int[] itemIDs, long support, double supportPct)
itemIDs
- items within the item setsupport
- the initial support valuesupportPct
- the initial support percentage valuepublic ItemSet(int itemID, int[] itemIDs)
itemID
- the singular itemitemIDs
- a list of itemspublic ItemSet(int[] itemsLHS, int[] itemsRHS)
itemsLHS
- a list of item identifiersitemsRHS
- a list of item identifierspublic ItemSet(int[] itemIDs, int length)
itemIDs
- the item identifierslength
- the number of items to includepublic boolean represents(int[] items)
items
- item identifierspublic int size()
public int[] getItemIDs()
public void calculateSupportPct(long transactionTotal)
transactionTotal
- total number of transactionspublic double getSupportPct()
public void incrementSupport()
public long getSupport()
public void setSupport(long support)
support
- support value to setpublic static Comparator<ItemSet> newSetSizeComparator()
Comparator
that compares item sets
and allows sorting by item set size and support.Comparator
instanceCopyright © 2024 Actian Corporation. All rights reserved.