fleXplorer.FacetedTaxonomy
Class FT

java.lang.Object
  extended by fleXplorer.FacetedTaxonomy.FT
All Implemented Interfaces:
IFT

public class FT
extends java.lang.Object
implements IFT

Version:
1.1
Author:
Nikos Armenatzoglou

Constructor Summary
FT()
          Constructs a Faceted Taxonomy.
FT(FacetsOrder isOrdered)
          Constructs a Faceted Taxonomy and defines if the facets will be ordered
Preconditions: Always true.
FT(java.lang.String name, java.util.Collection<Facet<?>> list, FacetsOrder isOrdered)
          Constructs a Faceted Taxonomy with specified name and Facets.
FT(java.lang.String name, FacetsOrder isOrdered)
          Constructs a Faceted Taxonomy with specified name and defines if the list of objects will be ordered.
 
Method Summary
 boolean add(Facet<?> facet)
          Adds a Facet into the list of Facets of Faceted Taxonomy.
 boolean add(Facet<?> facet, int index)
          Adds a Facet into the list of Facets of Faceted Taxonomy at the specified position.
 boolean addAll(java.util.Collection<Facet<?>> list)
          Adds a Collection of Facets into the Faceted Taxonomy's list of Facets.
 Facet<?> getFacet(int index)
          Returns the Facet at the specified position in Faceted Taxonomy's list of Facets.
 Facet<?> getFacet(java.lang.String facetName)
          Returns the Facet with the specified name that included in Faceted Taxonomy's list of Facets.
 java.util.Collection<Facet<?>> getFacetsList()
          Returns a Collection with all Facets that included into Faceted Taxonomy's list of Facets.
 java.util.ArrayList<java.lang.String> getFacetsNames()
          Returns the names of the facets that belong to the faceted taxonomy.
 java.lang.String getFTName()
          Returns the name of Faceted Taxonomy.
 boolean isOrdered()
          Checks if the Facets of Faceted Taxonomy are in order.
 int numOfFacets()
          Returns the number of facets of the specified faceted taxonomy.
 boolean removeFacet(int index)
          Removes the Facet at the specified position in Faceted Taxonomy's list of Facets.
 boolean removeFacet(java.lang.String facetName)
          Removes the Facet with specified name from the Faceted Taxonomy's list.
 void setFTName(java.lang.String name)
          Defines the name of Faceted Taxonomy.
 java.lang.String toString()
          Returns the string representation of the specified faceted taxonomy.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FT

public FT()
Constructs a Faceted Taxonomy.
Preconditions: Always true.
Postconditions: Constructs a FT object and defines that the facets will be unordered.


FT

public FT(FacetsOrder isOrdered)
Constructs a Faceted Taxonomy and defines if the facets will be ordered
Preconditions: Always true.
Postconditions: Constructs a FT object with the specified order.

Parameters:
isOrdered - defines if the list of facets will be ordered.

FT

public FT(java.lang.String name,
          FacetsOrder isOrdered)
Constructs a Faceted Taxonomy with specified name and defines if the list of objects will be ordered.
Preconditions: Argument name must not be null.
Postconditions: Constructs a FT object and defines FT's name as the value of the argument.

Parameters:
name - the name of Faceted Taxonomy.
isOrdered - defines if the list of the facets is ordered

FT

public FT(java.lang.String name,
          java.util.Collection<Facet<?>> list,
          FacetsOrder isOrdered)
Constructs a Faceted Taxonomy with specified name and Facets.
Preconditions: Arguments must not be null.
Postconditions: Constructs a FT object and defines the facets list's value as the value of argument list and FT's name as the value of the argument name.

Parameters:
name - the name of Faceted Taxonomy.
list - the list of Facets.
isOrdered - defines if the list of the facets is ordered
Method Detail

add

public boolean add(Facet<?> facet)
Adds a Facet into the list of Facets of Faceted Taxonomy.
Preconditions: The argument must not be null. The list of facets must be unordered.
Postconditions: Checks if facet already exists in facetslist, if not add it to the list of facets and return true; false otherwise;

Specified by:
add in interface IFT
Parameters:
facet - the facet that will be added to the list of Facets.
Returns:
true if facet adds it successfully; false otherwise.

add

public boolean add(Facet<?> facet,
                   int index)
Adds a Facet into the list of Facets of Faceted Taxonomy at the specified position.
Preconditions:The facet must not be null and the index must be into the bounds of the list. FT must keep the list of Facets in order.
Postconditions: Checks if facet already exists into the list of facets, if not add it to the facets list at the specified position and return true; false otherwise;

Specified by:
add in interface IFT
Parameters:
facet - the facet that will be added to the list of Facets.
index - the specified position that facet will be added.
Returns:
true if facet adds it successfully; false otherwise.

removeFacet

public boolean removeFacet(java.lang.String facetName)
Removes the Facet with specified name from the Faceted Taxonomy's list.
Preconditions: FT, FT.facetsList and argument facetName must not be null.
Postconditions: Checks if FT.facetsList contains a Facet with the specified facetName. If yes removes it from facetsList and returns true; false otherwise.

Specified by:
removeFacet in interface IFT
Parameters:
the - name of Facet to be removed.
Returns:
true if removes it successfully; false otherwise.

removeFacet

public boolean removeFacet(int index)
Removes the Facet at the specified position in Faceted Taxonomy's list of Facets.
Returns the Facet that was removed from the list of Facets.
Preconditions: FT and FT.facetsList must not be null. The value of index must be 0<=index<=size of facetsList.
Postconditions: Checks if index is correct, if yes returns the Facet at the specified position of facetsList and remove it from list, null otherwise.

Specified by:
removeFacet in interface IFT
Parameters:
index - the index of Facet to removed.
Returns:
Facet that was removed.

getFacet

public Facet<?> getFacet(java.lang.String facetName)
Returns the Facet with the specified name that included in Faceted Taxonomy's list of Facets.
Checks if list of Facets include Facet with specified name and if yes then return it.
Preconditions: FT, FT.facetsList and argument must not be null.
Postconditions: Checks if FT.facetsList contains a Facet with the specified facetName. If yes returns it; false otherwise.

Specified by:
getFacet in interface IFT
Parameters:
facetName - the name of Facet to return.
Returns:
the Facet with specified name if included in list of Facets; null otherwise.

getFacet

public Facet<?> getFacet(int index)
Returns the Facet at the specified position in Faceted Taxonomy's list of Facets.
Preconditions: FT and FT.facetsList must not be null. The value of index must be 0<=index<=size of facetsList.
Postconditions: Checks if index is correct, if yes returns the Facet at the specified position of facetsList, null otherwise.

Specified by:
getFacet in interface IFT
Parameters:
index - index of Facet to return.
Returns:
Facet at the specified index.

setFTName

public void setFTName(java.lang.String name)
Defines the name of Faceted Taxonomy.
Preconditions: Always true.
Postconditions: Defines FT's name as the value of the argument name.

Specified by:
setFTName in interface IFT
Parameters:
name - the new name of Faceted Taxonomy.

getFTName

public java.lang.String getFTName()
Returns the name of Faceted Taxonomy.
Preconditions: Always true.
Postconditions: Returns the value of private variable name.

Specified by:
getFTName in interface IFT
Returns:
the name of Faceted Taxonomy.

addAll

public boolean addAll(java.util.Collection<Facet<?>> list)
Adds a Collection of Facets into the Faceted Taxonomy's list of Facets.
Preconditions: The argument must not be null.
Postconditions: Add all Facets from the argument Collection to FT.facetsList. If any Facet already exists doesn't add it to the list. If all Facets that contained in argument Collection added successfully returns true; false otherwise.

Specified by:
addAll in interface IFT
Parameters:
Collection - of Facets to be added.
Returns:
true if all Facets added successfully;false otherwise.

getFacetsList

public java.util.Collection<Facet<?>> getFacetsList()
Returns a Collection with all Facets that included into Faceted Taxonomy's list of Facets.
Preconditions: Always true.
Postconditions: Returns the value of private variable facetsList.

Specified by:
getFacetsList in interface IFT
Returns:
a Collection with all Facets that included into Faceted Taxonomy's list of Facets.

toString

public java.lang.String toString()
Returns the string representation of the specified faceted taxonomy. Preconditions: Always true.
Postconditions: Returns the string representation of the specified faceted taxonomy.

Specified by:
toString in interface IFT
Overrides:
toString in class java.lang.Object
Returns:
the string representation of the specified faceted taxonomy.

numOfFacets

public int numOfFacets()
Returns the number of facets of the specified faceted taxonomy. Preconditions: Always true.
Postconditions: Calls the method size for the collection that keeps the facets.

Specified by:
numOfFacets in interface IFT
Returns:
the number of facets of the specified faceted taxonomy.

isOrdered

public boolean isOrdered()
Checks if the Facets of Faceted Taxonomy are in order. Preconditions: Always true.
Postconditions: Returns true if Facets of Faceted Taxonomy are in order.

Specified by:
isOrdered in interface IFT
Returns:
true if Facets of Faceted Taxonomy are in order; false otherwise.

getFacetsNames

public java.util.ArrayList<java.lang.String> getFacetsNames()
Returns the names of the facets that belong to the faceted taxonomy. Preconditions: Always true.
Postconditions: Creates a new ArrayList and adds all the names of facets that are kept into the list of facets.

Returns:
the names of the facets that belong to the faceted taxonomy.