fleXplorer.Terms
Class CompoundTerm

java.lang.Object
  extended by fleXplorer.Terms.CompoundTerm

public class CompoundTerm
extends java.lang.Object

Version:
1.1
Author:
Nikos Armenatzoglou

Constructor Summary
CompoundTerm(int id, FT ft)
          Constructs a compound term with a specific id and defines the faceted taxonomy which belong the terms of the compound term.
 
Method Summary
 boolean addTerm(java.lang.String facet, int termId)
          Adds a term to the compound term.
 boolean containsFacet(java.lang.String facet)
          Checks if the compound term contains a term of a specific facet.
 boolean containsTerm(java.lang.String facet, int termId)
          Checks if compound term contains a specific term of a facet.
 java.util.HashMap<java.lang.String,java.util.ArrayList<java.lang.Integer>> getAllTerms()
          Returns all terms.
 java.util.ArrayList<java.lang.String> getFacets()
          Returns the names of facets that compound term contains terms.
 FT getFT()
          Returns the faceted taxonomy that compound term belongs.
 int getId()
          Returns the id of the compound term.
 int getSize()
          Returns the number of the terms.
 java.util.ArrayList<java.lang.Integer> getTerms(java.lang.String facet)
          Returns the ids of the terms of a specific facet.
 boolean isNarrowerThan(CompoundTerm s)
          Checks if compound term is narrower than an other (subsumption checking).
 boolean isSingleton()
          Returns true if compound term is singleton; false otherwise.
 void removeFacet(java.lang.String facet)
          Removes from the compound term all the terms that belong to a specific facet.
 boolean removeTerm(java.lang.String facet, int termId)
          Removes a specific term of a facet from the compound term.
 void setFT(FT ft)
          Sets the faceted taxonomy that compound term will belong.
 void setId(int id)
          Sets the id of the compound term.
 java.lang.String toString()
          Returns the String representation of the compound term.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CompoundTerm

public CompoundTerm(int id,
                    FT ft)
Constructs a compound term with a specific id and defines the faceted taxonomy which belong the terms of the compound term.

Parameters:
id - the id of the compound term.
ft - the faceted taxonomy which belong the terms.
Method Detail

addTerm

public boolean addTerm(java.lang.String facet,
                       int termId)
Adds a term to the compound term.

Parameters:
facet - the name of the facet that term bolongs.
termId - the id of the term.
Returns:
true if addition completed successfully; false otherwise.

isSingleton

public boolean isSingleton()
Returns true if compound term is singleton; false otherwise.

Returns:
true if compound term is singleton; false otherwise.

isNarrowerThan

public boolean isNarrowerThan(CompoundTerm s)
Checks if compound term is narrower than an other (subsumption checking).

Parameters:
s - the compound term
Returns:
true if this compound term is narrower than s; false otherwise.

containsFacet

public boolean containsFacet(java.lang.String facet)
Checks if the compound term contains a term of a specific facet.

Parameters:
facet - the name of the facet
Returns:
true if contains; false otherwise.

containsTerm

public boolean containsTerm(java.lang.String facet,
                            int termId)
Checks if compound term contains a specific term of a facet.

Parameters:
facet - the name of the facet.
termId - the id of the term.
Returns:
true if compound term contains the specific term; false otherwise.

removeTerm

public boolean removeTerm(java.lang.String facet,
                          int termId)
Removes a specific term of a facet from the compound term.

Parameters:
facet - the name of the facet.
termId - the id of the facet.
Returns:
true if term is removed successfully; false otherwise.

removeFacet

public void removeFacet(java.lang.String facet)
Removes from the compound term all the terms that belong to a specific facet.

Parameters:
facet - the name of the facet.

getSize

public int getSize()
Returns the number of the terms.

Returns:
the number of the terms.

getTerms

public java.util.ArrayList<java.lang.Integer> getTerms(java.lang.String facet)
Returns the ids of the terms of a specific facet.

Parameters:
facet - the name of the facet.
Returns:
the ids of the terms of a specific facet

getAllTerms

public java.util.HashMap<java.lang.String,java.util.ArrayList<java.lang.Integer>> getAllTerms()
Returns all terms. The HashMap contains as key the name of the facet while the value contains a list with the ids of the terms from the specific facet.

Returns:
all terms.

getFacets

public java.util.ArrayList<java.lang.String> getFacets()
Returns the names of facets that compound term contains terms.

Returns:
the names of facets that compound term contains terms.

getId

public int getId()
Returns the id of the compound term.

Returns:
the id of the compound term.

setId

public void setId(int id)
Sets the id of the compound term.

Parameters:
id - the id of the compound term.

getFT

public FT getFT()
Returns the faceted taxonomy that compound term belongs.

Returns:
the faceted taxonomy that compound term belongs.

setFT

public void setFT(FT ft)
Sets the faceted taxonomy that compound term will belong.

Parameters:
ft - the faceted taxonomy

toString

public java.lang.String toString()
Returns the String representation of the compound term.

Overrides:
toString in class java.lang.Object
Returns:
the String representation of the compound term.