ca.pfv.spmf.algorithms.sequentialpatterns.fournier2008_seqdim.multidimensionalpatterns
Class MDPattern
- java.lang.Object
-
- ca.pfv.spmf.algorithms.sequentialpatterns.fournier2008_seqdim.multidimensionalpatterns.MDPattern
-
public class MDPattern extends java.lang.ObjectImplementation of an MD-Pattern as used by the DIM algorithm proposed by Helen Pinto et al. (2001).- See Also:
AlgoDim,MDPatterns,MDPatternsDatabase
-
-
Field Summary
Fields Modifier and Type Field and Description static intWILDCARDa code representing the special value "*" that can be found in md-patterns
-
Constructor Summary
Constructors Constructor and Description MDPattern(int id)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddInteger(int value)Add a dimension value to this pattern.voidaddIntegerFirstPosition(int value)Add a dimension value to this pattern in first position.voidaddWildCard()Add a wildcard as dimension value to this md-pattern.voidaddWildCardFirstPosition()Add a wildcard (*) to this pattern in first position.java.lang.Integerget(int index)Get the value for the i-th dimension as an Integer.intgetAbsoluteSupport()Get the support of this MD-Pattern as a int value.intgetId()Get the ID of this pattern.java.util.Set<java.lang.Integer>getPatternsID()Get the set of patterns ID containing this pattern.doublegetRelativeSupport(int databaseSize)Get the relative support of this pattern (a double value)java.lang.StringgetRelativeSupportFormatted(int databaseSize)Get the relative support of this pattern as a percentage with two decimals (string)intgetValue(int index)Get the value for the i-th dimension as a int.voidprint()Print this MD-pattern to System.out.voidset(int indexDimension, int newValue)Change the dimension value for a given dimension to a given value.voidsetID(int id2)Set the ID of this pattern.voidsetPatternsIDList(java.util.Set<java.lang.Integer> patternsID)Set the set of patterns ID containing this pattern.intsize()Get the size of this pattern.intstrictlyContains(MDPattern mdpattern2)This method check if this MD-pattern strictly contains a given MD-pattern.java.lang.StringtoString()Get a string representation of this MD-Pattern.java.lang.StringtoStringShort()Get an abbreviated string representation of this MD-Pattern.
-
-
-
Field Detail
-
WILDCARD
public static final int WILDCARD
a code representing the special value "*" that can be found in md-patterns- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MDPattern
public MDPattern(int id)
Constructor.- Parameters:
id- an ID that should be given to this pattern.
-
-
Method Detail
-
getId
public int getId()
Get the ID of this pattern.- Returns:
- an integer.
-
size
public int size()
Get the size of this pattern.- Returns:
- the size as an integer.
-
getValue
public int getValue(int index)
Get the value for the i-th dimension as a int.- Parameters:
index- the position i.- Returns:
- the value.
-
get
public java.lang.Integer get(int index)
Get the value for the i-th dimension as an Integer.- Parameters:
index- the position i.- Returns:
- the value.
-
addInteger
public void addInteger(int value)
Add a dimension value to this pattern.- Parameters:
value- the dimension value (integer)
-
addWildCard
public void addWildCard()
Add a wildcard as dimension value to this md-pattern.
-
addIntegerFirstPosition
public void addIntegerFirstPosition(int value)
Add a dimension value to this pattern in first position.- Parameters:
value- the dimension value (int)
-
addWildCardFirstPosition
public void addWildCardFirstPosition()
Add a wildcard (*) to this pattern in first position.
-
getRelativeSupport
public double getRelativeSupport(int databaseSize)
Get the relative support of this pattern (a double value)- Parameters:
databaseSize- the database size- Returns:
- the relative support
-
getAbsoluteSupport
public int getAbsoluteSupport()
Get the support of this MD-Pattern as a int value.- Returns:
- the support
-
getRelativeSupportFormatted
public java.lang.String getRelativeSupportFormatted(int databaseSize)
Get the relative support of this pattern as a percentage with two decimals (string)- Parameters:
databaseSize- the database size- Returns:
- the relative support as a string
-
print
public void print()
Print this MD-pattern to System.out.
-
toString
public java.lang.String toString()
Get a string representation of this MD-Pattern.- Overrides:
toStringin classjava.lang.Object
-
toStringShort
public java.lang.String toStringShort()
Get an abbreviated string representation of this MD-Pattern.
-
getPatternsID
public java.util.Set<java.lang.Integer> getPatternsID()
Get the set of patterns ID containing this pattern.- Returns:
- a set of patterns ID
-
setPatternsIDList
public void setPatternsIDList(java.util.Set<java.lang.Integer> patternsID)
Set the set of patterns ID containing this pattern.- Parameters:
patternsID- a set of patterns ID
-
strictlyContains
public int strictlyContains(MDPattern mdpattern2)
This method check if this MD-pattern strictly contains a given MD-pattern. Note that this method is only good for patterns having the same size.- Parameters:
mdpattern2- the given MD-pattern.- Returns:
- Return 1 if this mdpattern STRICTLY contains mdpattern2 *AND HAVE THE SAME SUPPORT* Return 2 if this mdpattern is exactly the same as mdpattern2 *AND HAVE THE SAME SUPPORT* Return 0 if this mdpattern does not contains mdpattern2.
-
set
public void set(int indexDimension, int newValue)Change the dimension value for a given dimension to a given value.- Parameters:
indexDimension- the position of the dimension.newValue- the new value
-
setID
public void setID(int id2)
Set the ID of this pattern.- Parameters:
id2- the ID.
-
-
DMelt 3.0 © DataMelt by jWork.ORG