de.lmu.ifi.dbs.elki.data
Class Subspace<V extends FeatureVector<V,?>>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.data.Subspace<V>
Type Parameters:
V - the type of FeatureVector this subspace contains
Direct Known Subclasses:
CLIQUESubspace

public class Subspace<V extends FeatureVector<V,?>>
extends Object

Represents a subspace of the original data space.


Nested Class Summary
static class Subspace.DimensionComparator
          A comparator for subspaces based on their involved dimensions.
 
Field Summary
private  int dimensionality
          The dimensionality of this subspace.
private  BitSet dimensions
          The dimensions building this subspace.
 
Constructor Summary
Subspace(BitSet dimensions)
          Creates a new k-dimensional subspace of the original data space.
Subspace(int dimension)
          Creates a new one-dimensional subspace of the original data space.
 
Method Summary
 int dimensionality()
          Returns the dimensionality of this subspace.
 String dimensonsToString()
          Returns a string representation of the dimensions of this subspace separated by comma.
 String dimensonsToString(String sep)
          Returns a string representation of the dimensions of this subspace.
 boolean equals(Object obj)
          Indicates if the specified object is equal to this subspace, i.e. if the specified object is a Subspace and is built of the same dimensions than this subspace.
 BitSet getDimensions()
          Returns the BitSet representing the dimensions of this subspace.
 int hashCode()
          Returns the hash code value of the dimensions of this subspace.
 boolean isSubspace(Subspace<V> subspace)
          Returns true if this subspace is a subspace of the specified subspace, i.e.
 Subspace<V> join(Subspace<V> other)
          Joins this subspace with the specified subspace.
protected  BitSet joinLastDimensions(Subspace<V> other)
          Joins the dimensions of this subspace with the dimensions of the specified subspace.
 String toString()
          Returns a string representation of this subspace by calling toString() with an empty prefix.
 String toString(String pre)
          Returns a string representation of this subspace that contains the given string prefix and the dimensions of this subspace.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

dimensions

private final BitSet dimensions
The dimensions building this subspace.


dimensionality

private final int dimensionality
The dimensionality of this subspace.

Constructor Detail

Subspace

public Subspace(int dimension)
Creates a new one-dimensional subspace of the original data space.

Parameters:
dimension - the dimension building this subspace

Subspace

public Subspace(BitSet dimensions)
Creates a new k-dimensional subspace of the original data space.

Parameters:
dimensions - the dimensions building this subspace
Method Detail

getDimensions

public final BitSet getDimensions()
Returns the BitSet representing the dimensions of this subspace.

Returns:
the dimensions of this subspace

dimensionality

public final int dimensionality()
Returns the dimensionality of this subspace.

Returns:
the number of dimensions this subspace contains

join

public Subspace<V> join(Subspace<V> other)
Joins this subspace with the specified subspace. The join is only successful if both subspaces have the first k-1 dimensions in common (where k is the number of dimensions) and the last dimension of this subspace is less than the last dimension of the specified subspace.

Parameters:
other - the subspace to join
Returns:
the join of this subspace with the specified subspace if the join condition is fulfilled, null otherwise.
See Also:
joinLastDimensions(Subspace)

toString

public String toString()
Returns a string representation of this subspace by calling toString() with an empty prefix.

Overrides:
toString in class Object
Returns:
a string representation of this subspace

toString

public String toString(String pre)
Returns a string representation of this subspace that contains the given string prefix and the dimensions of this subspace.

Parameters:
pre - a string prefix for each row of this string representation
Returns:
a string representation of this subspace

dimensonsToString

public String dimensonsToString()
Returns a string representation of the dimensions of this subspace separated by comma.

Returns:
a string representation of the dimensions of this subspace

dimensonsToString

public String dimensonsToString(String sep)
Returns a string representation of the dimensions of this subspace.

Parameters:
sep - the separator between the dimensions
Returns:
a string representation of the dimensions of this subspace

isSubspace

public boolean isSubspace(Subspace<V> subspace)
Returns true if this subspace is a subspace of the specified subspace, i.e. if the set of dimensions building this subspace are contained in the set of dimensions building the specified subspace.

Parameters:
subspace - the subspace to test
Returns:
true if this subspace is a subspace of the specified subspace, false otherwise

joinLastDimensions

protected BitSet joinLastDimensions(Subspace<V> other)
Joins the dimensions of this subspace with the dimensions of the specified subspace. The join is only successful if both subspaces have the first k-1 dimensions in common (where k is the number of dimensions) and the last dimension of this subspace is less than the last dimension of the specified subspace.

Parameters:
other - the subspace to join
Returns:
the joined dimensions of this subspace with the dimensions of the specified subspace if the join condition is fulfilled, null otherwise.

hashCode

public int hashCode()
Returns the hash code value of the dimensions of this subspace.

Overrides:
hashCode in class Object
Returns:
a hash code value for this subspace

equals

public boolean equals(Object obj)
Indicates if the specified object is equal to this subspace, i.e. if the specified object is a Subspace and is built of the same dimensions than this subspace.

Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

Release 0.4.0 (2011-09-20_1324)