net.sourceforge.toscanaj.model.lattice
Class ConceptImplementation

java.lang.Object
  extended bynet.sourceforge.toscanaj.model.lattice.ConceptImplementation
All Implemented Interfaces:
Concept, Ordered, XMLizable

public class ConceptImplementation
extends java.lang.Object
implements Concept

This implements concepts. Intent and extent are mapped into filter and ideal resp. to avoid redundant storage. Filter and ideal are explicitely stored to reduce computational efforts for these operations. The calculation of intent and extent size is done in this class, the joins on the sets themselves are done by creating an iterator which iterates over all contingents in filter and ideal resp. To use this class one has to ensure all sub- and superconcept relations are set up properly. If only the neighbourhood relation is set the method buildClosures() can be called to extent this to the full sub-/superconcept relation.


Field Summary
static java.lang.String ATTRIBUTE_CONTINGENT_ELEMENT_NAME
           
static java.lang.String ATTRIBUTE_ELEMENT_NAME
           
static java.lang.String CONCEPT_ELEMENT_NAME
           
static java.lang.String DESCRIPTION_ELEMENT_NAME
           
protected  java.util.Set filter
          Stores all concepts in the filter, including this.
protected  java.util.Set ideal
          Stores all concepts in the ideal, including this.
static java.lang.String OBJECT_CONTINGENT_ELEMENT_NAME
           
static java.lang.String OBJECT_ELEMENT_NAME
           
 
Constructor Summary
ConceptImplementation()
          Initializes the ideal and filter with linked list having a reference to this.
ConceptImplementation(org.jdom.Element element)
           
 
Method Summary
 void addAttribute(java.lang.Object attribute)
           
 void addObject(java.lang.Object object)
           
 void addSubConcept(Concept subConcept)
          Adds a concept to the ideal.
 void addSuperConcept(Concept superConcept)
          Adds a concept to the filter.
 void buildClosures()
          Calculates the ideal and filter for this concept if only direct neighbours are given.
 java.util.Iterator getAttributeContingentIterator()
          Returns an iterator returning the attributes from the contingent.
 int getAttributeContingentSize()
          Returns the size of the attribute contingent.
 double getAttributeContingentSizeRelative()
          Calculates the relative attribute contingent size.
 Concept getBottomConcept()
           
 java.util.Collection getDownset()
           
 java.util.Iterator getExtentIterator()
          Iterates over all object contingents in the ideal.
 int getExtentSize()
          Calculates the extent size based on the contingent sizes in the ideal.
 double getExtentSizeRelative()
          Calculates the relative extent size.
 java.util.Iterator getIntentIterator()
          Iterates over all attribute contingents in the filter.
 int getIntentSize()
          Calculates the intent size based on the contingent sizes in the filter.
 double getIntentSizeRelative()
          Calculates the relative intent size.
 java.util.Iterator getObjectContingentIterator()
          Returns an iterator returning the objects from the contingent.
 int getObjectContingentSize()
          Returns the size of the object contingent.
 double getObjectContingentSizeRelative()
          Calculates the relative object contingent size.
 Concept getTopConcept()
           
 java.util.Collection getUpset()
           
 boolean hasSubConcept(Concept concept)
          Returns true iff the given concept is in the ideal of this one.
 boolean hasSuperConcept(Concept concept)
          Returns true iff the given concept is in the filter of this one.
 boolean isBottom()
          Returns true if this is the bottom concept.
 boolean isEqual(Ordered other)
          Compare the current with another object on equality.
 boolean isJoinIrreducible()
           
 boolean isLesserThan(Ordered other)
          Compares the current with another object on ordering.
 boolean isMeetIrreducible()
           
 boolean isTop()
          Returns true if this is the top concept.
 void readXML(org.jdom.Element elem)
          Read this element as the content of elem.
 void removeAttribute(java.lang.Object attribute)
           
 void removeObject(java.lang.Object object)
           
 void removeObjectContingent()
           
 void replaceObject(java.lang.Object objectToReplace, java.lang.Object newObject)
           
 org.jdom.Element toXML()
          Write this element as the content of elem.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONCEPT_ELEMENT_NAME

public static final java.lang.String CONCEPT_ELEMENT_NAME
See Also:
Constant Field Values

OBJECT_CONTINGENT_ELEMENT_NAME

public static final java.lang.String OBJECT_CONTINGENT_ELEMENT_NAME
See Also:
Constant Field Values

OBJECT_ELEMENT_NAME

public static final java.lang.String OBJECT_ELEMENT_NAME
See Also:
Constant Field Values

ATTRIBUTE_CONTINGENT_ELEMENT_NAME

public static final java.lang.String ATTRIBUTE_CONTINGENT_ELEMENT_NAME
See Also:
Constant Field Values

ATTRIBUTE_ELEMENT_NAME

public static final java.lang.String ATTRIBUTE_ELEMENT_NAME
See Also:
Constant Field Values

DESCRIPTION_ELEMENT_NAME

public static final java.lang.String DESCRIPTION_ELEMENT_NAME
See Also:
Constant Field Values

filter

protected java.util.Set filter
Stores all concepts in the filter, including this.


ideal

protected java.util.Set ideal
Stores all concepts in the ideal, including this.

Constructor Detail

ConceptImplementation

public ConceptImplementation()
Initializes the ideal and filter with linked list having a reference to this. Use addSuperConcept(Concept) and addSubConcept(Concept) to extent filter and ideal.


ConceptImplementation

public ConceptImplementation(org.jdom.Element element)
                      throws XMLSyntaxError
Method Detail

toXML

public org.jdom.Element toXML()
Description copied from interface: XMLizable
Write this element as the content of elem.

Specified by:
toXML in interface XMLizable

addSuperConcept

public void addSuperConcept(Concept superConcept)
Adds a concept to the filter.


addSubConcept

public void addSubConcept(Concept subConcept)
Adds a concept to the ideal.


buildClosures

public void buildClosures()
Calculates the ideal and filter for this concept if only direct neighbours are given. If only direct neighbours in the neighbourhoud relation where given this method can be called to create the ideal and filter by building the transitive closures.


getIntentSize

public int getIntentSize()
Calculates the intent size based on the contingent sizes in the filter.

Specified by:
getIntentSize in interface Concept

getIntentSizeRelative

public double getIntentSizeRelative()
Calculates the relative intent size.


getExtentSize

public int getExtentSize()
Calculates the extent size based on the contingent sizes in the ideal.

Specified by:
getExtentSize in interface Concept

getExtentSizeRelative

public double getExtentSizeRelative()
Calculates the relative extent size.


getIntentIterator

public java.util.Iterator getIntentIterator()
Iterates over all attribute contingents in the filter.

Specified by:
getIntentIterator in interface Concept

getExtentIterator

public java.util.Iterator getExtentIterator()
Iterates over all object contingents in the ideal.

Specified by:
getExtentIterator in interface Concept

getAttributeContingentSizeRelative

public double getAttributeContingentSizeRelative()
Calculates the relative attribute contingent size.


getObjectContingentSizeRelative

public double getObjectContingentSizeRelative()
Calculates the relative object contingent size.


isTop

public boolean isTop()
Returns true if this is the top concept.

Specified by:
isTop in interface Concept

isBottom

public boolean isBottom()
Returns true if this is the bottom concept.

Specified by:
isBottom in interface Concept

hasSuperConcept

public boolean hasSuperConcept(Concept concept)
Returns true iff the given concept is in the filter of this one.

Specified by:
hasSuperConcept in interface Concept

hasSubConcept

public boolean hasSubConcept(Concept concept)
Returns true iff the given concept is in the ideal of this one.

Specified by:
hasSubConcept in interface Concept

getDownset

public java.util.Collection getDownset()
Specified by:
getDownset in interface Concept

getUpset

public java.util.Collection getUpset()
Specified by:
getUpset in interface Concept

getAttributeContingentSize

public int getAttributeContingentSize()
Description copied from interface: Concept
Returns the size of the attribute contingent.

Specified by:
getAttributeContingentSize in interface Concept

getObjectContingentSize

public int getObjectContingentSize()
Description copied from interface: Concept
Returns the size of the object contingent.

Specified by:
getObjectContingentSize in interface Concept

getAttributeContingentIterator

public java.util.Iterator getAttributeContingentIterator()
Description copied from interface: Concept
Returns an iterator returning the attributes from the contingent. The Java objects returned from the iterator should offer a toString() implementation suited for displaying the attributes.

Specified by:
getAttributeContingentIterator in interface Concept

getObjectContingentIterator

public java.util.Iterator getObjectContingentIterator()
Description copied from interface: Concept
Returns an iterator returning the objects from the contingent. The Java objects returned from the iterator should offer a toString() implementation suited for displaying the objects.

Specified by:
getObjectContingentIterator in interface Concept

readXML

public void readXML(org.jdom.Element elem)
             throws XMLSyntaxError
Description copied from interface: XMLizable
Read this element as the content of elem.

Specified by:
readXML in interface XMLizable
Throws:
XMLSyntaxError

addObject

public void addObject(java.lang.Object object)

addAttribute

public void addAttribute(java.lang.Object attribute)

replaceObject

public void replaceObject(java.lang.Object objectToReplace,
                          java.lang.Object newObject)

removeObject

public void removeObject(java.lang.Object object)

removeAttribute

public void removeAttribute(java.lang.Object attribute)

isLesserThan

public boolean isLesserThan(Ordered other)
Description copied from interface: Ordered
Compares the current with another object on ordering.

Specified by:
isLesserThan in interface Ordered
Parameters:
other - the object to compare to, must not be null
Returns:
true iff the current object is considered less than the one passed

isEqual

public boolean isEqual(Ordered other)
Description copied from interface: Ordered
Compare the current with another object on equality. This can be useful if a different notion of equality should be used than the one implemented by Object.equals(Object). Otherwise it should be just mapped to the latter (which in turn might map to reference identity). Note that this method does not accept null values. This also means when overriding it by mapping it to the standard equals method, a check for null should be done first.

Specified by:
isEqual in interface Ordered
Parameters:
other - the object to compare to, must not be null
Returns:
true iff the current object is considered equal to the one passed

isMeetIrreducible

public boolean isMeetIrreducible()
Specified by:
isMeetIrreducible in interface Concept

isJoinIrreducible

public boolean isJoinIrreducible()
Specified by:
isJoinIrreducible in interface Concept

removeObjectContingent

public void removeObjectContingent()

getTopConcept

public Concept getTopConcept()
Specified by:
getTopConcept in interface Concept

getBottomConcept

public Concept getBottomConcept()
Specified by:
getBottomConcept in interface Concept


The ToscanaJ project