org.processmining.models.heuristics.impl
Class HNSubSet

java.lang.Object
  extended by org.processmining.models.heuristics.impl.HNSubSet
All Implemented Interfaces:
java.lang.Comparable<HNSubSet>

public class HNSubSet
extends java.lang.Object
implements java.lang.Comparable<HNSubSet>

Ordered set of int that is used to represent subsets in the input and output sets of HeuristicsNet objects.

Author:
Peter van den Brand and Ana Karla Alves de Medeiros

Constructor Summary
HNSubSet()
          Constructs a HNSubSet object
 
Method Summary
 void add(int value)
          Adds a given value to this HNSubSet object
 void addAll(HNSubSet toAdd)
          Adds all the values in a given HNSubSet object to this HNSubSet object
 int compareTo(HNSubSet set)
          Compares a given HNSubSet object with this HNSubSet object.
 boolean contains(int value)
          Checks if a certain value is already contained in this HNSubSet object
 HNSubSet deepCopy()
          Creates a deep copy of this HNSubSet object
 HNSubSet deepCopy(java.util.Map<java.lang.Integer,java.lang.Integer> oldNewIndexMap)
           
 boolean equals(java.lang.Object o)
          Compares if the given HNSubSet object contains the same values of this HNSubSet object
 int get(int index)
          Retrieves the value at a given position in this HNSubSet object
 int hashCode()
          Retrieves the hash code of this HNSubSet object
 void remove(int value)
          Removes a given value of this HNSubSet object
 void removeAll(HNSubSet toRemove)
          Removes from this HNSubSet object all the values that are contained in a given HNSubSet object
 int size()
          Retrieves the number of values contained in this HNSubSet object
 java.lang.String toString()
          Builds a string representation of this HNSubSet object
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HNSubSet

public HNSubSet()
Constructs a HNSubSet object

Method Detail

size

public final int size()
Retrieves the number of values contained in this HNSubSet object

Returns:
size of this HNSubSet object

get

public final int get(int index)
Retrieves the value at a given position in this HNSubSet object

Parameters:
index - element's position
Returns:
value of the element at this position

contains

public final boolean contains(int value)
Checks if a certain value is already contained in this HNSubSet object

Parameters:
value - number that may be contained in this HNSubSet object
Returns:
true if this HNSubSet object contains the given value, false otherwise.

deepCopy

public final HNSubSet deepCopy()
Creates a deep copy of this HNSubSet object

Returns:
a new HNSubSet object with the same contents of the this HNSubSet object

deepCopy

public HNSubSet deepCopy(java.util.Map<java.lang.Integer,java.lang.Integer> oldNewIndexMap)

addAll

public void addAll(HNSubSet toAdd)
Adds all the values in a given HNSubSet object to this HNSubSet object

Parameters:
toAdd - subset contains the values to add

add

public void add(int value)
Adds a given value to this HNSubSet object

Parameters:
value - integer to be added to this HNSubSet object

toString

public java.lang.String toString()
Builds a string representation of this HNSubSet object

Overrides:
toString in class java.lang.Object
Returns:
string representing this HNSubSet object

remove

public void remove(int value)
Removes a given value of this HNSubSet object

Parameters:
value - integer to be removed from this HNSubSet object

removeAll

public void removeAll(HNSubSet toRemove)
Removes from this HNSubSet object all the values that are contained in a given HNSubSet object

Parameters:
toRemove - subset with values to be removed from this HNSubSet object

hashCode

public int hashCode()
Retrieves the hash code of this HNSubSet object

Overrides:
hashCode in class java.lang.Object
Returns:
hash code of this HNSubSet object

compareTo

public int compareTo(HNSubSet set)
Compares a given HNSubSet object with this HNSubSet object. The comparison occurs in the following way:
  1. A non-null HNSubSet object is always 'less than' a null object
  2. ;
  3. A HNSubSet object with smaller size is always 'less than' a HNSubSet object with bigger size
  4. ;
  5. If two objects are non-null and have the same size, than their ordered list of values will be compared. The first set to have a bigger element at a given position is the bigger one
  6. .

Specified by:
compareTo in interface java.lang.Comparable<HNSubSet>
Parameters:
set - heuristics net subset to compare with this HNSubSet object
Returns:
-1 if the other HNSubSet object if smaller than this HNSubSet object, 0 if both objects are the equal, and 1 otherwise.

equals

public boolean equals(java.lang.Object o)
Compares if the given HNSubSet object contains the same values of this HNSubSet object

Overrides:
equals in class java.lang.Object
Parameters:
true - if the two HNSubSet objects are the same, false otherwise