arules
Class ARuleSet

java.lang.Object
  extended by arules.ARuleSet

public class ARuleSet
extends java.lang.Object

Class for a set of association rules.

Since:
2004.07.06

Field Summary
static int AREM
          sort mode: additional rule evaluation measure
protected  int body
          the maximal number of items in a rule body
static int BODY
          sort mode: body support
protected  int cnt
          the current number of rules
static int CONF
          sort mode: confidence
protected  int head
          the maximal number of items in a rule head
static int HEAD
          sort mode: head of the rule
protected  util.IdMap iset
          the underlying item set
static int LIFT
          sort mode: lift value
protected  arules.ARule[] rules
          the set of association rules
static int SIZE
          sort mode: size / number of items
static int SUPP
          sort mode: support
 
Constructor Summary
ARuleSet()
          Create an empty set of association rules.
ARuleSet(util.IdMap iset)
          Create an empty set of association rules.
 
Method Summary
 int addRule(arules.ARule rule)
          Add an association rule.
 util.IdMap getItemSet()
          Get the underlying item set.
 int getMaxBodySize()
          Get the maximal size of a rule body.
 int getMaxSize()
          Get the maximal size of a rule.
 arules.ARule getRule(int i)
          Get an association rule
 int getRuleCount()
          Get the number of association rules.
static void main(java.lang.String[] args)
          Main function for testing some basic functionality.
static ARuleSet parseARuleSet(util.IdMap iset, java.io.Reader reader)
          Parse a set of association rules.
static ARuleSet parseARuleSet(util.IdMap iset, util.Scanner scan)
          Parse a set of association rules.
 void sort(int field)
          Sort the set of association rules.
 void write(java.io.Writer writer)
          Write a set of association rules.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SIZE

public static final int SIZE
sort mode: size / number of items

See Also:
Constant Field Values

CONF

public static final int CONF
sort mode: confidence

See Also:
Constant Field Values

SUPP

public static final int SUPP
sort mode: support

See Also:
Constant Field Values

BODY

public static final int BODY
sort mode: body support

See Also:
Constant Field Values

LIFT

public static final int LIFT
sort mode: lift value

See Also:
Constant Field Values

AREM

public static final int AREM
sort mode: additional rule evaluation measure

See Also:
Constant Field Values

HEAD

public static final int HEAD
sort mode: head of the rule

See Also:
Constant Field Values

iset

protected util.IdMap iset
the underlying item set


rules

protected arules.ARule[] rules
the set of association rules


cnt

protected int cnt
the current number of rules


body

protected int body
the maximal number of items in a rule body


head

protected int head
the maximal number of items in a rule head

Constructor Detail

ARuleSet

public ARuleSet()
Create an empty set of association rules.

Since:
2005.07.06 (Christian Borgelt)

ARuleSet

public ARuleSet(util.IdMap iset)
Create an empty set of association rules.

Parameters:
iset - the underlying item set
Since:
2005.07.06 (Christian Borgelt)
Method Detail

getItemSet

public util.IdMap getItemSet()
Get the underlying item set.

Returns:
the underlying item set
Since:
2005.07.06 (Christian Borgelt)

getRuleCount

public int getRuleCount()
Get the number of association rules.

Returns:
the number of association rules
Since:
2005.07.06 (Christian Borgelt)

getRule

public arules.ARule getRule(int i)
Get an association rule

Parameters:
i - the index of the association rule
Returns:
the association rule with index i
Since:
2005.07.06 (Christian Borgelt)

addRule

public int addRule(arules.ARule rule)
Add an association rule.

Parameters:
rule - the association rule to add
Returns:
the index of the association rule in the set
Since:
2005.07.06 (Christian Borgelt)

getMaxSize

public int getMaxSize()
Get the maximal size of a rule.

Returns:
the maximal size of a rule
Since:
2007.03.12 (Christian Borgelt)

getMaxBodySize

public int getMaxBodySize()
Get the maximal size of a rule body.

Returns:
the maximal size of a rule body
Since:
2005.07.06 (Christian Borgelt)

sort

public void sort(int field)
Sort the set of association rules.

Parameters:
field - the identifier of the field to compare first
Since:
2005.07.06 (Christian Borgelt)

write

public void write(java.io.Writer writer)
           throws java.io.IOException
Write a set of association rules.

Parameters:
writer - the writer to write to
Throws:
java.io.IOException - if a write error occurs
Since:
2007.06.06 (Christian Borgelt)

parseARuleSet

public static ARuleSet parseARuleSet(util.IdMap iset,
                                     util.Scanner scan)
                              throws java.io.IOException
Parse a set of association rules.

Parameters:
iset - the underlying item set
scan - the scanner to read from
Returns:
the parsed set of association rules
Throws:
java.io.IOException - if a read error occurs
Since:
2005.07.06 (Christian Borgelt)

parseARuleSet

public static ARuleSet parseARuleSet(util.IdMap iset,
                                     java.io.Reader reader)
                              throws java.io.IOException
Parse a set of association rules.

Parameters:
iset - the underlying item set
reader - the reader to read from
Returns:
the parsed set of association rules
Throws:
java.io.IOException - if a read error occurs
Since:
2005.07.06 (Christian Borgelt)

main

public static void main(java.lang.String[] args)
Main function for testing some basic functionality.

It is tried to parse the file that is given as the first command line argument as a set of association rules.

Parameters:
args - the command line arguments
Since:
2005.07.06 (Christian Borgelt)