wpi.associations.arminerSequence
Class ARMinerItemset

java.lang.Object
  extended bywpi.associations.arminerSequence.ARMinerItemset
All Implemented Interfaces:
java.io.Serializable

public class ARMinerItemset
extends java.lang.Object
implements java.io.Serializable

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.

Author:
Keith A. Pray (kap@wpi.edu)
See Also:
Serialized Form

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

SIZE_INCR

private static final int SIZE_INCR
See Also:
Constant Field Values

capacity

private int capacity
The capacity of the item set. @serial


size

private int size
The number of items in the item set. @serial


set

private int[] set
The item set. @serial


support

private float support
The support of the item set. @serial


weight

private long weight
The weight of the item set. @serial


mark

private boolean mark
The mark of the item set. This can be used to mark the item set for various purposes. @serial


iterateIndex

private int iterateIndex
Internal index used for cycling through the item set's items. @serial


sum

private int sum

eventWeight

private long eventWeight
The weight of the item set's events. @serial


numberHash

private java.util.Hashtable numberHash
Used to look up actual value of an item using its integer representation.


nameHash

private java.util.Hashtable nameHash
The name of time sequence event attributes


realHash

private java.util.Hashtable realHash
Used to look up the real begin and end times of the events in this item set.


relativeHash

private java.util.Hashtable relativeHash
Used to look up the relative begin and end times of the events in this item set.


relativeVector

private java.util.Vector relativeVector
The relative time labels and corresponding real time values


eventVector

private java.util.Vector eventVector
A vector of vectors. Each vector contains a list of the time sequence event item labels corresponding to the relative time as denoted by eventVector's index. Used for relabeling when changes occur.


debug

private static final int debug
Specifies debug info level 0: no debug info 1: input to methods 2: output of methods 3: all sorts of stuff

See Also:
Constant Field Values
Constructor Detail

ARMinerItemset

public ARMinerItemset()
Creates a new empty item set.


ARMinerItemset

public ARMinerItemset(int c)
Create a new empty item set of specified capacity.

Parameters:
c - the capacity of the item set
Throws:
java.lang.IllegalArgumentException - c is negative or zero

ARMinerItemset

public ARMinerItemset(ARMinerItemset itemset)
Create a new item set by copying a given one.

Parameters:
itemset - the itemset to be copied
Throws:
java.lang.IllegalArgumentException - itemset is null
Method Detail

setNumberHash

public 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.

Parameters:
h - the number hash

getNumberHash

public java.util.Hashtable getNumberHash()
Returns the number hash used for looking up values in this item set. This method is needed to support time sequence attributes.

Returns:
the number hash

beginLabel

public 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. This method is needed to support time sequence attributes.

Parameters:
item - the integer representation of an item
Returns:
the begin item label

beginLabel

public 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. This method is needed to support time sequence attributes.

Parameters:
item - the integer representation of an item
Returns:
the begin item label

endLabel

public 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.

Parameters:
item - the integer representation of an item
Returns:
the end item label

endLabel

public 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.

Parameters:
item - the integer representation of an item
Returns:
the end item label

itemInt

public 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. This method is needed to support time sequence attributes.

Parameters:
label - the begin or end label of an item
Returns:
the item integer

itemValue

public java.lang.String itemValue(int item)
Constructs and returns a string representing the value of an item. If the item is an event and contained in this itemset, the value will be specific to this itemset. The relative times of the event will be represented.

Returns:
a string value of the item specified

isBeginLabel

public static boolean isBeginLabel(java.lang.String label)
Tests if the string is an item begin label. This method is needed to support time sequence attributes.

Parameters:
label - the label to test
Returns:
true if it's a begin label

isEndLabel

public static boolean isEndLabel(java.lang.String label)
Tests if the string is an item end label. This method is needed to support time sequence attributes.

Parameters:
label - the label to test
Returns:
true if it's a end label

eventName

public java.lang.String eventName(java.lang.Integer item)
Returns the name of an event. The item specified must be in this itemset and an event or no name will be found.

Parameters:
item - the item to get the name of
Returns:
the event name, null if not found

eventName

public java.lang.String eventName(int item)
Returns the name of an event. The item specified must be in this itemset and an event or no name will be found.

Parameters:
item - the item to get the name of
Returns:
the event name, null if not found

relativeBegin

public java.lang.Integer relativeBegin(java.lang.Integer item)
Returns the relative begin time of the item specified. The item specified must be in this itemset and an event or no value will be returned

Parameters:
item - the item
Returns:
the relative begin time

relativeEnd

public java.lang.Integer relativeEnd(java.lang.Integer item)
Returns the relative end time of the item specified. The item specified must be in this itemset and an event or no value will be returned

Parameters:
item - the item
Returns:
the relative end time

getNameHash

public 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. This method is needed to support time sequence attributes.

Returns:
the name hash

getRealHash

public 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.

Returns:
the realtive hash

numEventItems

public int numEventItems()
Returns the number of event items contained in this itemset.

Returns:
the number of event items

getRelativeHash

public 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. This method is needed to support time sequence attributes.

Returns:
the realtive hash

getRelativeVector

public 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. This method is needed to support time sequence attributes.

Returns:
the realtive vector

getEventVector

public 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. This method is needed to support time sequence attributes.

Returns:
the event vector

buildItemsetFromIndexes

public static ARMinerItemset buildItemsetFromIndexes(ARMinerItemset itemset,
                                                     int[] indexes)
Builds an ARMinerItemset based on the specified itemset indexes.

Parameters:
itemset - an itemset from which to get items
indexes - the indexes

buildItemsetFromItemList

public static ARMinerItemset buildItemsetFromItemList(ARMinerItemset itemset,
                                                      int[] items)
Builds an ARMinerItemset based on the specified itemset item list.

Parameters:
itemset - an itemset from which to get items
items - the items

buildItemsetFromItemList

public static ARMinerItemset buildItemsetFromItemList(ARMinerItemset itemset,
                                                      java.lang.Integer[] items)
Builds an ARMinerItemset based on the specified itemset item list.

Parameters:
itemset - an itemset from which to get items
items - the items

getSupport

public float getSupport()
Return support of itemset.


getWeight

public long getWeight()
Return weight of itemset.


getEventWeight

public long getEventWeight()
Return event weight of itemset.


getItem

public int getItem(int i)
Return i-th item in set.

Parameters:
i - the index of the item to get
Returns:
the i-th item
Throws:
java.lang.IndexOutOfBoundsException - i is an invalid index

startItemIteration

public void startItemIteration()
Sets the iteration to the first item.


getFirstItem

public int getFirstItem()
Return first item in set.

Returns:
first item
Throws:
java.lang.IndexOutOfBoundsException - there is no first item

getNextItem

public int getNextItem()
Return next item in set.

Returns:
next item
Throws:
java.lang.IndexOutOfBoundsException - there is no next item

hasMoreItems

public boolean hasMoreItems()
Return true if there are more items in the itemset. You can call this method to find out whether you can call getNext without raising an exception.

Returns:
true if there are more items, false if not

size

public int size()
Return size of itemset.

Returns:
size of itemset

hasAttributes

public boolean hasAttributes(java.util.Vector attributes)
Return true if this itemset has the set of attributes with itemset.

Returns:
true if itemset contains items of this itemset, false otherwise.
Throws:
java.lang.IllegalArgumentException - itemset is null

doesIntersect

public boolean doesIntersect(ARMinerItemset itemset)
Return true if this itemset has items in common with itemset.

Parameters:
itemset - the itemset with which we compare
Returns:
true if itemset contains items of this itemset, false otherwise.
Throws:
java.lang.IllegalArgumentException - itemset is null

contains

public boolean contains(int item)
Checks if the item set contains the specified item.

Parameters:
item - the item to check for
Returns:
true is the item set contains the item, false otherwise

subtract

public ARMinerItemset subtract(ARMinerItemset itemset)
Return a new ARMinerItemset that contains only those items that do not appear in itemset.

Parameters:
itemset - the itemset whose items we want to subtract
Returns:
an ARMinerItemset containing only those items of this ARMinerItemset that do not appear in itemset.
Throws:
java.lang.IllegalArgumentException - itemset is null

add

public ARMinerItemset add(ARMinerItemset itemset)
Return a new ARMinerItemset that contains all those items that appear in this ARMinerItemset and in itemset.

Parameters:
itemset - the itemset whose items we want to add
Returns:
an ARMinerItemset containing all those items that appear in this ARMinerItemset and in itemset.
Throws:
java.lang.IllegalArgumentException - itemset is null

addItem

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.

Parameters:
item - the item to be added
itemset - the itemset to get item info from
Returns:
true if item was added, false if it wasn't added (was already there!)
Throws:
java.lang.IllegalArgumentException - item is <= 0

addRegularItem

protected boolean addRegularItem(int item)
Adds a new item to the itemset while not taking care of any time sequence event issues. If the item is an event addEventItem should also be called with this item.

Parameters:
item - the item to be added
Returns:
true if item was added, false if it wasn't added (was already there!)
Throws:
java.lang.IllegalArgumentException - item is <= 0

addItem

public boolean addItem(int item)
Add a new item to the itemset.

Parameters:
item - the item to be added
Returns:
true if item was added, false if it wasn't added (was already there!)
Throws:
java.lang.IllegalArgumentException - item is <= 0

addEventItem

private boolean addEventItem(int item)
Add a new event item information to the item set. This method is needed to support time sequence attributes.

Parameters:
item - the item to be added
Returns:
true if item was added, false if it wasn't added (was not an event or we didn't have a number hash.)
Throws:
java.lang.IllegalArgumentException - item is <= 0

addEventItem

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. This method is needed to support time sequence attributes.

Parameters:
item - the item to be added
name - the name of the event item
begin - the event begin time
end - the event end time
Returns:
true if item was added, false if it wasn't added (was not an event or we didn't have a number hash.)
Throws:
java.lang.IllegalArgumentException - item is <= 0

addEventItem

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. This method is needed to support time sequence attributes.

Parameters:
item - the item to be added
name - the name of the event item
begin - the event begin time
end - the event end time
Returns:
true if item was added, false if it wasn't added (was not an event or we didn't have a number hash.)
Throws:
java.lang.IllegalArgumentException - item is <= 0

addRelativeTime

private void addRelativeTime(int item)
Adds the relative begin and end times of an item to this item set. This method is needed to support time sequence attributes.

Parameters:
item -

addRelativeTime

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. This method is needed to support time sequence attributes.

Parameters:
item - the item label to be added
time - the real time of the item label
index - the index from which to start scanning for a place to add the item (also the relative time)

labelRelativeTimes

private void labelRelativeTimes(int i)
Relables the relative times of the events in this item set. New values are stored in the relative hash. This method is needed to support time sequence attributes.

Parameters:
i - the reltive time to start relabling items

removeItem

public boolean removeItem(int item)
Removes a given item from the itemset.

Parameters:
item - the item to remove
Returns:
true if item was removed, false if it wasn't removed (was not found in itemset!)
Throws:
java.lang.IllegalArgumentException - item is <= 0

removeEventItem

private void removeEventItem(int item)
Removes a given event item from the time sequence specific areas of this itemset. This method is needed to support time sequence attributes.

Parameters:
item - the item to remove

removeRelativeTime

private void removeRelativeTime(int item)
Removes the relative begin and end times of an item from this item set. This method is needed to support time sequence attributes.

Parameters:
item - the item to remove relative times for

removeRelativeTime

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. This method is needed to support time sequence attributes.

Parameters:
item - the item label to be removed
time - the real time of the item label
index - the index from which to start scanning for the item to remove (also the relative time)

removeLastItem

public boolean removeLastItem()
Removes last item (which has the greatest value) from the itemset.

Returns:
true if item was removed, false if it wasn't removed (the itemset was empty)

setSupport

public void setSupport(float newSupport)
Set the support of the itemset.

Parameters:
newSupport - the support of the itemset
Throws:
java.lang.IllegalArgumentException - newSupport is < 0 or > 100

setWeight

public void setWeight(long newWeight)
Set the weight of the itemset.

Parameters:
newWeight - the weight of the itemset
Throws:
java.lang.IllegalArgumentException - newWeight is < 0

setEventWeight

public void setEventWeight(long newWeight)
Set the event weight of the itemset.

Parameters:
newWeight - the event weight of the itemset
Throws:
java.lang.IllegalArgumentException - newWeight is < 0

incrementWeight

public void incrementWeight()
Increment the weight of the itemset.


incrementEventWeight

public void incrementEventWeight(long addWeight)
Increment the event weight of the itemset.

Parameters:
addWeight - how much to increment the event weight
Throws:
java.lang.IllegalArgumentException - addWeight is < 0

isEqualTo

public boolean isEqualTo(ARMinerItemset itemset)
Checks equality with a given itemset.

Parameters:
itemset - the itemset against which we test for equality
Throws:
java.lang.IllegalArgumentException - itemset is null

isIncludedIn

public boolean isIncludedIn(ARMinerItemset itemset)
Checks if this itemset is included in the given itemset.

Parameters:
itemset - the itemset against which we test for inclusion (so we test if the items we have are in itemset)
Returns:
true if the itemset is found, false otherwise
Throws:
java.lang.IllegalArgumentException - itemset is null

checkRelativeTime

private boolean checkRelativeTime(ARMinerItemset itemset)
Compares the relative times of the events contained in the itemset specified with this itemset. Tests if all of this itemset's events can be found in the same relative time order in the specified event.

Parameters:
itemset - the itemset to check for relative times in
Returns:
true if we find all the events with the same relative temporal relationships, false if not

checkRelativeTime

private java.util.Hashtable checkRelativeTime(ARMinerItemset itemset,
                                              int offset)
Compares the relative times of the events contained in the itemset specified with this itemset. If all of this itemsets events can be found in the same relative order in the specified event, a map of event labels in this itemset to those in the itemset sepcified is returned.

Parameters:
itemset - the itemset to check for relative times in
offset - the relative time to start checking in itemset
Returns:
a map of event labels if we find all the relative times, null otherwise

checkRelativeTime

private java.util.Hashtable checkRelativeTime(ARMinerItemset itemset,
                                              int[] usedTimes)
Compares the relative times of the events contained in the itemset specified with this itemset. If all of this itemsets events can be found in the same relative order using the usedTimes in the specified itemset, a map of event labels in itemset to ours is returned.

Parameters:
itemset - the itemset to check for relative times in
usedTimes - the relative times used in itemset to match our relative times

numIncludedIn

public int numIncludedIn(ARMinerItemset itemset)
Checks how many times this itemset is included in the given itemset. This uses a different method for determining the number of inclusions based on events than the findAllMaps method. The findAllMaps is the prefered method for the counting purpose.

Parameters:
itemset - the itemset against which we test for inclusion (so we test if the items we have are in itemset)
Returns:
the number times the itemset is found
Throws:
java.lang.IllegalArgumentException - itemset is null

mapRelativeTime

private java.util.Vector mapRelativeTime(ARMinerItemset itemset)
Compares the relative times of the events contained in the itemset specified with this itemset. If all of this itemset's events can be found in the same relative time order in the specified event, a list of the possible mappings of event labels in the specified itemset to ours is returned.

Parameters:
itemset - the itemset to check for relative times in
Returns:
a list of maps of event labels if we find all the relative times, an empty list if none are found

mapRelativeTime

private java.util.Hashtable mapRelativeTime(ARMinerItemset itemset,
                                            int offset)
Compares the relative times of the events contained in the itemset specified with this itemset. If all of this itemsets events can be found in the same relative order in the specified event, a map of event labels in this itemset to those in the itemset sepcified is returned.

Parameters:
itemset - the itemset to check for relative times in
offset - the relative time to start checking in itemset
Returns:
a map of event labels if we find all the relative times, null otherwise

mapRelativeTime

private java.util.Hashtable mapRelativeTime(ARMinerItemset itemset,
                                            int[] usedTimes)
Compares the relative times of the events contained in the itemset specified with this itemset. If all of this itemsets events can be found in the same relative order using the usedTimes in the specified itemset, a map of event labels in itemset to ours is returned.

Parameters:
itemset - the itemset to check for relative times in
usedTimes - the relative times used in itemset to match our relative times

findAllMaps

public 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. It is assumed that regular items are not of interest. Inclusion of this itemset in the specified itemset is not determined by this method. Please use isIncludedIn for that purpose.

Parameters:
itemset - the itemset containing the event items to map to
Returns:
a list of maps between event items

findAllMaps

public 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. It is assumed that regular items are not of interest. Inclusion of this itemset in the specified itemset is not determined by this method. Please use isIncludedIn for that purpose.

Parameters:
itemset - the itemset containing the event items to map to
maps - a list of partial map of event items
Returns:
a list of partial maps between event items

countMapExtensions

public 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. The count of partial maps that can be expanded is returned. It is assumed that regular items are not of interest. Inclusion of this itemset in the specified itemset is not determined by this method. Please use isIncludedIn for that purpose.

Parameters:
itemset - the itemset containing the event items to map to
maps - a list of partial map of event items
Returns:
the number of partial maps that can be expanded to a full map

findAllMaps

public 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. It is assumed that regular items are not of interest. Inclusion of this itemset in the specified itemset is not determined by this method. Please use isIncludedIn for that purpose.

Parameters:
itemset - the itemset containing the event items to map to
map - a partial map of event items
Returns:
a list of maps between event items

findAllMaps

public 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. It is assumed that regular items are not of interest. Inclusion of this itemset in the specified itemset is not determined by this method. Please use isIncludedIn for that purpose.

Parameters:
itemset - the itemset containing the event items to map to
map - a partial map of event items
numMaps - 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.
Returns:
a list of maps between event items

findAllMaps

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. It is assumed that regular items are not of interest. Inclusion of this itemset in the specified itemset is not determined by this method. Please use isIncludedIn for that purpose.

Parameters:
itemset - the itemset containing the event items to map to
map - a partial map of event items
eventItemVector - list of event items to map into the specified item set
otherEventVector - list of event items not already mapped to in the specified item set
Returns:
a list of maps between event items

findAllMaps

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. It is assumed that regular items are not of interest. Inclusion of this itemset in the specified itemset is not determined by this method. Please use isIncludedIn for that purpose.

Parameters:
itemset - the itemset containing the event items to map to
map - a partial map of event items
eventItemVector - list of event items to map into the specified item set
otherEventVector - list of event items not already mapped to in the specified item set
numMaps - 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.
Returns:
a list of maps between event items

isMapValid

public 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. If the map is valid this is true. This assumes regular items are not of interest.

Parameters:
itemset - item set mapped to
map - the map of event items to the event items in the specified item set
Returns:
true if the map is valid, false otherwise

mark

public boolean mark()
Mark the itemset.

Returns:
true if itemset was already marked, false otherwise

unmark

public boolean unmark()
Unmark the itemset.

Returns:
true if itemset was marked, false otherwise

isMarked

public boolean isMarked()
Return itemset mark.

Returns:
true if itemset is marked, false otherwise

toString

public java.lang.String toString()
Return a String representation of the ARMinerItemset.

Returns:
String representation of ARMinerItemset

canCombineWith

public java.util.Hashtable canCombineWith(ARMinerItemset itemset)
Check whether two item sets can be combined. Two item sets can be combined if they differ only in the last item. To support time sequences a mapping of event labels in itemset to the itemset specified will be returned if the itemsets can be combined. If there are no events an empty map will be returned.

Parameters:
itemset - itemset with which to combine
Returns:
a map of labels if the item sets can be combined, null otherwise
Throws:
java.lang.IllegalArgumentException - itemset is null

combineWith

public 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. To support time sequence events this has been changed to return a list of itemsets instead of just one.

Parameters:
itemset - itemset with which to combine
eventLabelMap - 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.
Returns:
a list of itemsets that combines the two item sets as described above
Throws:
java.lang.IllegalArgumentException - itemset is null

findRange

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. Used by the combineWith method.

Parameters:
item - the item to find the range for
itemset - the itemset sharing events in common
eventLabelMap - a map of event labels from itemset ours
Returns:
an array of size 4 with: [0] lower begin bound [1] upper begin bound [2] lower end bound [3] upper end bound

findRange

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.

Parameters:
eventLabel - the event label to find the range for
itemset - the itemset sharing events in common
eventLabelMap - a map of event labels from itemset to ours
Returns:
an array of size 2 with: [ 0 ] lower bound [ 1 ] upper bound

fillTimeArrays

private int fillTimeArrays(double[] begin,
                           double[] end,
                           int[] range)
Fills in the arrays of begin and end times specified for the combineWith method.

Parameters:
begin - the begin time array
end - the end time array
range - the range limiting the 13 possible begin and end times
Returns:
the number of begin and end time pairs

fillTimeArrays

private void fillTimeArrays(double[] begin,
                            double[] end)
Fills in the arrays of begin and end times specified for the combineWith method.

Parameters:
begin - the begin time array
end - the end time array

sum

public int sum()
Gets the sum of the items in the itemset

Returns:
the sum of the items in the itemset

pruneNonMaximal

public static void pruneNonMaximal(java.util.Vector v)
Remove all non-maximal item sets from the vector v

Parameters:
v - the collection of item sets

pruneDuplicates

public static void pruneDuplicates(java.util.Vector v)
Remove all duplicate item sets from the vector v

Parameters:
v - the collection of item sets

main

public static void main(java.lang.String[] args)
for testing purposes only !!!