|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwpi.associations.arminerSequence.ARMinerItemset
ARMinerItemset.java
An item set is an ordered list of integers that identify items coupled with a float value representing the support of the item set as a percentage.
Field Summary | |
private int |
capacity
The capacity of the item set. |
private static int |
debug
Specifies debug info level 0: no debug info 1: input to methods 2: output of methods 3: all sorts of stuff |
private java.util.Vector |
eventVector
A vector of vectors. |
private long |
eventWeight
The weight of the item set's events. |
private int |
iterateIndex
Internal index used for cycling through the item set's items. |
private boolean |
mark
The mark of the item set. |
private java.util.Hashtable |
nameHash
The name of time sequence event attributes |
private java.util.Hashtable |
numberHash
Used to look up actual value of an item using its integer representation. |
private java.util.Hashtable |
realHash
Used to look up the real begin and end times of the events in this item set. |
private java.util.Hashtable |
relativeHash
Used to look up the relative begin and end times of the events in this item set. |
private java.util.Vector |
relativeVector
The relative time labels and corresponding real time values |
private int[] |
set
The item set. |
private int |
size
The number of items in the item set. |
private static int |
SIZE_INCR
|
private int |
sum
|
private float |
support
The support of the item set. |
private long |
weight
The weight of the item set. |
Constructor Summary | |
ARMinerItemset()
Creates a new empty item set. |
|
ARMinerItemset(ARMinerItemset itemset)
Create a new item set by copying a given one. |
|
ARMinerItemset(int c)
Create a new empty item set of specified capacity. |
Method Summary | |
ARMinerItemset |
add(ARMinerItemset itemset)
Return a new ARMinerItemset that contains all those items that appear in this ARMinerItemset and in itemset . |
private boolean |
addEventItem(int item)
Add a new event item information to the item set. |
protected void |
addEventItem(int item,
java.lang.String name,
double begin,
double end)
Add new event item information to the item set with the specified name, begin and end times. |
protected void |
addEventItem(int item,
java.lang.String name,
java.lang.Double begin,
java.lang.Double end)
Add new event item information to the item set with the specified name, begin and end times. |
boolean |
addItem(int item)
Add a new item to the itemset. |
protected boolean |
addItem(int item,
ARMinerItemset itemset)
Adds a new item to the itemset using the information provided in the specified itemset rather than the number hash. |
protected boolean |
addRegularItem(int item)
Adds a new item to the itemset while not taking care of any time sequence event issues. |
private void |
addRelativeTime(int item)
Adds the relative begin and end times of an item to this item set. |
private int |
addRelativeTime(java.lang.String item,
java.lang.Double time,
int index)
Adds the relative begin and end times of an item to this item set. |
static java.lang.String |
beginLabel(int item)
Returns the begin item label used for looking up begin times for time sequence events in this item set. |
static java.lang.String |
beginLabel(java.lang.Integer item)
Returns the begin item label used for looking up begin times for time sequence events in this item set. |
static ARMinerItemset |
buildItemsetFromIndexes(ARMinerItemset itemset,
int[] indexes)
Builds an ARMinerItemset based on the specified itemset indexes. |
static ARMinerItemset |
buildItemsetFromItemList(ARMinerItemset itemset,
int[] items)
Builds an ARMinerItemset based on the specified itemset item list. |
static ARMinerItemset |
buildItemsetFromItemList(ARMinerItemset itemset,
java.lang.Integer[] items)
Builds an ARMinerItemset based on the specified itemset item list. |
java.util.Hashtable |
canCombineWith(ARMinerItemset itemset)
Check whether two item sets can be combined. |
private boolean |
checkRelativeTime(ARMinerItemset itemset)
Compares the relative times of the events contained in the itemset specified with this itemset. |
private java.util.Hashtable |
checkRelativeTime(ARMinerItemset itemset,
int offset)
Compares the relative times of the events contained in the itemset specified with this itemset. |
private java.util.Hashtable |
checkRelativeTime(ARMinerItemset itemset,
int[] usedTimes)
Compares the relative times of the events contained in the itemset specified with this itemset. |
java.util.Vector |
combineWith(ARMinerItemset itemset,
java.util.Hashtable eventLabelMap)
Combine two item sets into a new one that will contain all the items in the first itemset plus the last item in the second itemset. |
boolean |
contains(int item)
Checks if the item set contains the specified item. |
int |
countMapExtensions(ARMinerItemset itemset,
java.util.Vector maps)
Each partial map in the map list is tested to see if it can be expanded to a valid map of the entire item set. |
boolean |
doesIntersect(ARMinerItemset itemset)
Return true if this itemset has items in common with itemset . |
static java.lang.String |
endLabel(int item)
Returns the end item label used for looking up end times for time sequence events in this item set This method is needed to support time sequence attributes. |
static java.lang.String |
endLabel(java.lang.Integer item)
Returns the end item label used for looking up end times for time sequence events in this item set This method is needed to support time sequence attributes. |
java.lang.String |
eventName(int item)
Returns the name of an event. |
java.lang.String |
eventName(java.lang.Integer item)
Returns the name of an event. |
private void |
fillTimeArrays(double[] begin,
double[] end)
Fills in the arrays of begin and end times specified for the combineWith method. |
private int |
fillTimeArrays(double[] begin,
double[] end,
int[] range)
Fills in the arrays of begin and end times specified for the combineWith method. |
java.util.Vector |
findAllMaps(ARMinerItemset itemset)
Finds all the possible mappings between the event items in this item set and the event items in the specified item set. |
java.util.Vector |
findAllMaps(ARMinerItemset itemset,
java.util.Hashtable map)
Finds all the possible mappings between the event items in this item set and the event items in the specified item set. |
java.util.Vector |
findAllMaps(ARMinerItemset itemset,
java.util.Hashtable map,
int numMaps)
Finds all the possible mappings between the event items in this item set and the event items in the specified item set. |
private java.util.Vector |
findAllMaps(ARMinerItemset itemset,
java.util.Hashtable map,
java.util.Vector eventItemVector,
java.util.Vector otherEventVector)
Finds all the possible mappings between the event items in this item set and the event items in the specified item set. |
private java.util.Vector |
findAllMaps(ARMinerItemset itemset,
java.util.Hashtable map,
java.util.Vector eventItemVector,
java.util.Vector otherEventVector,
int numMaps)
Finds all the possible mappings between the event items in this item set and the event items in the specified item set. |
java.util.Vector |
findAllMaps(ARMinerItemset itemset,
java.util.Vector maps)
Finds all the possible mappings between the event items in this item set and the event items in the specified item set. |
private int[] |
findRange(int item,
ARMinerItemset itemset,
java.util.Hashtable eventLabelMap)
Finds the range of possible relative times for the begin and end of an event being added based on common events with anothert itemset. |
private int[] |
findRange(java.lang.String eventLabel,
ARMinerItemset itemset,
java.util.Hashtable eventLabelMap)
Finds the range of possible relative times for the event label specified based on common events with anothert itemset. |
java.util.Vector |
getEventVector()
Returns a copy of the event vector used for looking up the time sequence event begin and end labels associated with a relative time. |
long |
getEventWeight()
Return event weight of itemset. |
int |
getFirstItem()
Return first item in set. |
int |
getItem(int i)
Return i-th item in set. |
java.util.Hashtable |
getNameHash()
Returns a copy of the name hash used for looking up attribute names for time sequence events in this item set. |
int |
getNextItem()
Return next item in set. |
java.util.Hashtable |
getNumberHash()
Returns the number hash used for looking up values in this item set. |
java.util.Hashtable |
getRealHash()
Returns a copy of the real hash used for looking up the real times for time sequence events in this item set This method is needed to support time sequence attributes. |
java.util.Hashtable |
getRelativeHash()
Returns a copy of the relative hash used for looking up the relative times for time sequence events in this item set. |
java.util.Vector |
getRelativeVector()
Returns a copy of the realtive vector used for looking up the real times associated with relative times for time sequence events in this item set. |
float |
getSupport()
Return support of itemset. |
long |
getWeight()
Return weight of itemset. |
boolean |
hasAttributes(java.util.Vector attributes)
Return true if this itemset has the set of attributes with itemset . |
boolean |
hasMoreItems()
Return true if there are more items in the itemset. |
void |
incrementEventWeight(long addWeight)
Increment the event weight of the itemset. |
void |
incrementWeight()
Increment the weight of the itemset. |
static boolean |
isBeginLabel(java.lang.String label)
Tests if the string is an item begin label. |
static boolean |
isEndLabel(java.lang.String label)
Tests if the string is an item end label. |
boolean |
isEqualTo(ARMinerItemset itemset)
Checks equality with a given itemset. |
boolean |
isIncludedIn(ARMinerItemset itemset)
Checks if this itemset is included in the given itemset. |
boolean |
isMapValid(ARMinerItemset itemset,
java.util.Hashtable map)
Tests if the map of event items to the specified item set creates an item set which is included in this item set. |
boolean |
isMarked()
Return itemset mark. |
static int |
itemInt(java.lang.String label)
Returns the item integer used to represent items based on the begin or end label for the item. |
java.lang.String |
itemValue(int item)
Constructs and returns a string representing the value of an item. |
private void |
labelRelativeTimes(int i)
Relables the relative times of the events in this item set. |
static void |
main(java.lang.String[] args)
for testing purposes only !!! |
private java.util.Vector |
mapRelativeTime(ARMinerItemset itemset)
Compares the relative times of the events contained in the itemset specified with this itemset. |
private java.util.Hashtable |
mapRelativeTime(ARMinerItemset itemset,
int offset)
Compares the relative times of the events contained in the itemset specified with this itemset. |
private java.util.Hashtable |
mapRelativeTime(ARMinerItemset itemset,
int[] usedTimes)
Compares the relative times of the events contained in the itemset specified with this itemset. |
boolean |
mark()
Mark the itemset. |
int |
numEventItems()
Returns the number of event items contained in this itemset. |
int |
numIncludedIn(ARMinerItemset itemset)
Checks how many times this itemset is included in the given itemset. |
static void |
pruneDuplicates(java.util.Vector v)
Remove all duplicate item sets from the vector v |
static void |
pruneNonMaximal(java.util.Vector v)
Remove all non-maximal item sets from the vector v |
java.lang.Integer |
relativeBegin(java.lang.Integer item)
Returns the relative begin time of the item specified. |
java.lang.Integer |
relativeEnd(java.lang.Integer item)
Returns the relative end time of the item specified. |
private void |
removeEventItem(int item)
Removes a given event item from the time sequence specific areas of this itemset. |
boolean |
removeItem(int item)
Removes a given item from the itemset. |
boolean |
removeLastItem()
Removes last item (which has the greatest value) from the itemset. |
private void |
removeRelativeTime(int item)
Removes the relative begin and end times of an item from this item set. |
private int |
removeRelativeTime(java.lang.String item,
java.lang.Double time,
int index)
Removes the relative time and label of an item from this item set. |
void |
setEventWeight(long newWeight)
Set the event weight of the itemset. |
void |
setNumberHash(java.util.Hashtable h)
Sets the number hash to use for looking up values in this item set This method is needed to support time sequence attributes. |
void |
setSupport(float newSupport)
Set the support of the itemset. |
void |
setWeight(long newWeight)
Set the weight of the itemset. |
int |
size()
Return size of itemset. |
void |
startItemIteration()
Sets the iteration to the first item. |
ARMinerItemset |
subtract(ARMinerItemset itemset)
Return a new ARMinerItemset that contains only those items that do not appear in itemset . |
int |
sum()
Gets the sum of the items in the itemset |
java.lang.String |
toString()
Return a String representation of the ARMinerItemset. |
boolean |
unmark()
Unmark the itemset. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private static final int SIZE_INCR
private int capacity
private int size
private int[] set
private float support
private long weight
private boolean mark
private int iterateIndex
private int sum
private long eventWeight
private java.util.Hashtable numberHash
private java.util.Hashtable nameHash
private java.util.Hashtable realHash
private java.util.Hashtable relativeHash
private java.util.Vector relativeVector
private java.util.Vector eventVector
private static final int debug
Constructor Detail |
public ARMinerItemset()
public ARMinerItemset(int c)
c
- the capacity of the item set
java.lang.IllegalArgumentException
- c
is negative or zeropublic ARMinerItemset(ARMinerItemset itemset)
itemset
- the itemset to be copied
java.lang.IllegalArgumentException
- itemset
is nullMethod Detail |
public void setNumberHash(java.util.Hashtable h)
h
- the number hashpublic java.util.Hashtable getNumberHash()
public static java.lang.String beginLabel(int item)
item
- the integer representation of an item
public static java.lang.String beginLabel(java.lang.Integer item)
item
- the integer representation of an item
public static java.lang.String endLabel(int item)
item
- the integer representation of an item
public static java.lang.String endLabel(java.lang.Integer item)
item
- the integer representation of an item
public static int itemInt(java.lang.String label)
label
- the begin or end label of an item
public java.lang.String itemValue(int item)
public static boolean isBeginLabel(java.lang.String label)
label
- the label to test
public static boolean isEndLabel(java.lang.String label)
label
- the label to test
public java.lang.String eventName(java.lang.Integer item)
item
- the item to get the name of
public java.lang.String eventName(int item)
item
- the item to get the name of
public java.lang.Integer relativeBegin(java.lang.Integer item)
item
- the item
public java.lang.Integer relativeEnd(java.lang.Integer item)
item
- the item
public java.util.Hashtable getNameHash()
public java.util.Hashtable getRealHash()
public int numEventItems()
public java.util.Hashtable getRelativeHash()
public java.util.Vector getRelativeVector()
public java.util.Vector getEventVector()
public static ARMinerItemset buildItemsetFromIndexes(ARMinerItemset itemset, int[] indexes)
itemset
- an itemset from which to get itemsindexes
- the indexespublic static ARMinerItemset buildItemsetFromItemList(ARMinerItemset itemset, int[] items)
itemset
- an itemset from which to get itemsitems
- the itemspublic static ARMinerItemset buildItemsetFromItemList(ARMinerItemset itemset, java.lang.Integer[] items)
itemset
- an itemset from which to get itemsitems
- the itemspublic float getSupport()
public long getWeight()
public long getEventWeight()
public int getItem(int i)
i
- the index of the item to get
i
-th item
java.lang.IndexOutOfBoundsException
- i
is an invalid indexpublic void startItemIteration()
public int getFirstItem()
java.lang.IndexOutOfBoundsException
- there is no first itempublic int getNextItem()
java.lang.IndexOutOfBoundsException
- there is no next itempublic boolean hasMoreItems()
public int size()
public boolean hasAttributes(java.util.Vector attributes)
itemset
.
itemset
contains items of this
itemset, false otherwise.
java.lang.IllegalArgumentException
- itemset
is nullpublic boolean doesIntersect(ARMinerItemset itemset)
itemset
.
itemset
- the itemset with which we compare
itemset
contains items of this itemset,
false otherwise.
java.lang.IllegalArgumentException
- itemset
is nullpublic boolean contains(int item)
item
- the item to check for
public ARMinerItemset subtract(ARMinerItemset itemset)
itemset
.
itemset
- the itemset whose items we want to subtract
itemset
.
java.lang.IllegalArgumentException
- itemset
is nullpublic ARMinerItemset add(ARMinerItemset itemset)
itemset
.
itemset
- the itemset whose items we want to add
itemset
.
java.lang.IllegalArgumentException
- itemset
is nullprotected boolean addItem(int item, ARMinerItemset itemset)
item
- the item to be addeditemset
- the itemset to get item info from
java.lang.IllegalArgumentException
- item
is <= 0protected boolean addRegularItem(int item)
item
- the item to be added
java.lang.IllegalArgumentException
- item
is <= 0public boolean addItem(int item)
item
- the item to be added
java.lang.IllegalArgumentException
- item
is <= 0private boolean addEventItem(int item)
item
- the item to be added
java.lang.IllegalArgumentException
- item
is <= 0protected void addEventItem(int item, java.lang.String name, double begin, double end)
item
- the item to be addedname
- the name of the event itembegin
- the event begin timeend
- the event end time
java.lang.IllegalArgumentException
- item
is <= 0protected void addEventItem(int item, java.lang.String name, java.lang.Double begin, java.lang.Double end)
item
- the item to be addedname
- the name of the event itembegin
- the event begin timeend
- the event end time
java.lang.IllegalArgumentException
- item
is <= 0private void addRelativeTime(int item)
item
- private int addRelativeTime(java.lang.String item, java.lang.Double time, int index)
item
- the item label to be addedtime
- the real time of the item labelindex
- the index from which to start scanning for a place
to add the item (also the relative time)private void labelRelativeTimes(int i)
i
- the reltive time to start relabling itemspublic boolean removeItem(int item)
item
- the item to remove
java.lang.IllegalArgumentException
- item
is <= 0private void removeEventItem(int item)
item
- the item to removeprivate void removeRelativeTime(int item)
item
- the item to remove relative times forprivate int removeRelativeTime(java.lang.String item, java.lang.Double time, int index)
item
- the item label to be removedtime
- the real time of the item labelindex
- the index from which to start scanning for the item
to remove (also the relative time)public boolean removeLastItem()
public void setSupport(float newSupport)
newSupport
- the support of the itemset
java.lang.IllegalArgumentException
- newSupport
is < 0 or > 100public void setWeight(long newWeight)
newWeight
- the weight of the itemset
java.lang.IllegalArgumentException
- newWeight
is < 0public void setEventWeight(long newWeight)
newWeight
- the event weight of the itemset
java.lang.IllegalArgumentException
- newWeight
is < 0public void incrementWeight()
public void incrementEventWeight(long addWeight)
addWeight
- how much to increment the event weight
java.lang.IllegalArgumentException
- addWeight
is < 0public boolean isEqualTo(ARMinerItemset itemset)
itemset
- the itemset against which we test for equality
java.lang.IllegalArgumentException
- itemset
is nullpublic boolean isIncludedIn(ARMinerItemset itemset)
itemset
- the itemset against which we test for inclusion
(so we test if the items we have are in itemset)
java.lang.IllegalArgumentException
- itemset
is nullprivate boolean checkRelativeTime(ARMinerItemset itemset)
itemset
- the itemset to check for relative times in
private java.util.Hashtable checkRelativeTime(ARMinerItemset itemset, int offset)
itemset
- the itemset to check for relative times inoffset
- the relative time to start checking in itemset
private java.util.Hashtable checkRelativeTime(ARMinerItemset itemset, int[] usedTimes)
itemset
- the itemset to check for relative times inusedTimes
- the relative times used in itemset to match our
relative timespublic int numIncludedIn(ARMinerItemset itemset)
itemset
- the itemset against which we test for inclusion
(so we test if the items we have are in itemset)
java.lang.IllegalArgumentException
- itemset
is nullprivate java.util.Vector mapRelativeTime(ARMinerItemset itemset)
itemset
- the itemset to check for relative times in
private java.util.Hashtable mapRelativeTime(ARMinerItemset itemset, int offset)
itemset
- the itemset to check for relative times inoffset
- the relative time to start checking in itemset
private java.util.Hashtable mapRelativeTime(ARMinerItemset itemset, int[] usedTimes)
itemset
- the itemset to check for relative times inusedTimes
- the relative times used in itemset to match our
relative timespublic java.util.Vector findAllMaps(ARMinerItemset itemset)
itemset
- the itemset containing the event items to map to
public java.util.Vector findAllMaps(ARMinerItemset itemset, java.util.Vector maps)
itemset
- the itemset containing the event items to map tomaps
- a list of partial map of event items
public int countMapExtensions(ARMinerItemset itemset, java.util.Vector maps)
itemset
- the itemset containing the event items to map tomaps
- a list of partial map of event items
public java.util.Vector findAllMaps(ARMinerItemset itemset, java.util.Hashtable map)
itemset
- the itemset containing the event items to map tomap
- a partial map of event items
public java.util.Vector findAllMaps(ARMinerItemset itemset, java.util.Hashtable map, int numMaps)
itemset
- the itemset containing the event items to map tomap
- a partial map of event itemsnumMaps
- the maps found so far are returned once this number
of maps are found. A value or 0 (zero) or less indicates
find all maps possible.
private java.util.Vector findAllMaps(ARMinerItemset itemset, java.util.Hashtable map, java.util.Vector eventItemVector, java.util.Vector otherEventVector)
itemset
- the itemset containing the event items to map tomap
- a partial map of event itemseventItemVector
- list of event items to map into the specified item setotherEventVector
- list of event items not already mapped to in the
specified item set
private java.util.Vector findAllMaps(ARMinerItemset itemset, java.util.Hashtable map, java.util.Vector eventItemVector, java.util.Vector otherEventVector, int numMaps)
itemset
- the itemset containing the event items to map tomap
- a partial map of event itemseventItemVector
- list of event items to map into the specified item setotherEventVector
- list of event items not already mapped to in the
specified item setnumMaps
- the maps found so far are returned once this number
of maps are found. A value or 0 (zero) or less indicates
find all maps possible.
public boolean isMapValid(ARMinerItemset itemset, java.util.Hashtable map)
itemset
- item set mapped tomap
- the map of event items to the event items in the
specified item set
public boolean mark()
public boolean unmark()
public boolean isMarked()
public java.lang.String toString()
public java.util.Hashtable canCombineWith(ARMinerItemset itemset)
itemset
- itemset with which to combine
java.lang.IllegalArgumentException
- itemset
is nullpublic java.util.Vector combineWith(ARMinerItemset itemset, java.util.Hashtable eventLabelMap)
itemset
- itemset with which to combineeventLabelMap
- A map of event labels from itemset to ours.
The map can be obtained from the
canCombineWith method. The map can be null if no
events are present in itemset.
java.lang.IllegalArgumentException
- itemset
is nullprivate int[] findRange(int item, ARMinerItemset itemset, java.util.Hashtable eventLabelMap)
item
- the item to find the range foritemset
- the itemset sharing events in commoneventLabelMap
- a map of event labels from itemset ours
private int[] findRange(java.lang.String eventLabel, ARMinerItemset itemset, java.util.Hashtable eventLabelMap)
eventLabel
- the event label to find the range foritemset
- the itemset sharing events in commoneventLabelMap
- a map of event labels from itemset to ours
private int fillTimeArrays(double[] begin, double[] end, int[] range)
begin
- the begin time arrayend
- the end time arrayrange
- the range limiting the 13 possible begin and end times
private void fillTimeArrays(double[] begin, double[] end)
begin
- the begin time arrayend
- the end time arraypublic int sum()
public static void pruneNonMaximal(java.util.Vector v)
v
- the collection of item setspublic static void pruneDuplicates(java.util.Vector v)
v
- the collection of item setspublic static void main(java.lang.String[] args)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |