fleXplorer.Terminologies
Interface ITerminology<Type extends FacetsType>

Type Parameters:
Type - Generic Type. Terminology can include only one type of Terms. Type can be int, String, Date, Interval ...
All Known Implementing Classes:
Taxonomy, Terminology

public interface ITerminology<Type extends FacetsType>

Version:
1.1
Author:
Nikos

Method Summary
 void clear()
          Removes all Terms from the Terminology but does not delete the Terms.
 boolean containsTerm(FacetsType termValue)
          Checks if the Term with specified value is included in Terminology.
 boolean containsTermWithId(int termId)
          Tests if the Term with specified id is included in Terminology.
 void decrSeqNumber(int decrNumber)
          Decreases the sequence number of giving ids to the new Terms of Terminology.
 boolean deleteAllIndexes()
          Deletes from all Terms of the Terminology the indexes.
 Comparison getComparability()
          Returns if the Terms that included into Terminology are comparable.
 java.lang.String getName()
          Returns the name of Terminology.
 int getSeqNumber()
          Returns the sequence number of giving ids to the new Terms of Terminology.
 Term<FacetsType> getTerm(FacetsType termValue)
          Returns the Term with the specified value, if it is included in Terminology.
 Term<FacetsType> getTerm(int index)
          Returns the term at the specified position in this Terminology.
 Term<FacetsType> getTerm(Term<FacetsType> term)
          Returns the specified Term, if it is included in Terminology.
 int getTermId(FacetsType value)
          Returns the id of the first Term with the specified value.
 java.util.Collection<Term<FacetsType>> getTerminology()
          Reruns a Collection that includes all Terms of the Terminology.
 Term<FacetsType> getTermWithId(int termId)
          Returns the Term with the specified id that included in Terminology.
 void incrSeqNumber(int incrNumber)
          Increases the sequence number of giving ids to the new Terms of Terminology.
 boolean isComparable()
          Returns true if the Terms of Terminology are comparable.
 boolean isEmpty()
          Checks if Terminology is empty.
 boolean removeTerm(FacetsType termValue)
          Removes the Term with the specified value from Terminology.
 Term<FacetsType> removeTerm(int index)
          Removes the Term at the specified position in this Terminology.
 boolean removeTerm(Term<FacetsType> term)
          Removes the specified Term from Terminology.
 boolean removeTermWithId(int termId)
          Removes the Term with the specified id from Terminology.
 void setComparability(Comparison comparability)
          Sets the value of variable that defines if the Terms of Terminology are comparable.
 void setName(java.lang.String name)
          Define the name of Terminology.
 void setSeqNumber(int num)
          Sets the value of sequence number that is used for giving ids to the new Terms of Terminology.
 Term<FacetsType> setTerm(FacetsType termValue)
          Add a Term with the specified value to the Terminology.
 Term<FacetsType> setTerm(FacetsType termValue, int termId)
          Add a Term with the specified value and id to the Terminology.
 boolean setTerm(Term<FacetsType> term)
          Adds a Term to Terminology.
 void setTerminology(java.util.Collection<Term<FacetsType>> terms)
          Sets the Terminology.
 boolean setTerms(java.util.Collection<Term<FacetsType>> set)
          Adds a Collection of Terms to Terminology.
 boolean setTermsValues(java.util.Collection<Type> set)
          Get a Collection of Terms's values, creates Terms with specified values and insert them into Terminology.
 int size()
          Returns Terminology's size.
 java.lang.String toString()
          Returns a String representation of Terminology.
 

Method Detail

deleteAllIndexes

boolean deleteAllIndexes()
Deletes from all Terms of the Terminology the indexes. Preconditions: Always true.
Postconditions: Deletes from all Terms of the Terminology the indexes.

Returns:
true if all indexes removed successfully; false otherwise.

setSeqNumber

void setSeqNumber(int num)
Sets the value of sequence number that is used for giving ids to the new Terms of Terminology.
Preconditions: Always true.
Postconditions: Changes the value of private variable seqNumber

Parameters:
num - the new value of sequence number.

getSeqNumber

int getSeqNumber()
Returns the sequence number of giving ids to the new Terms of Terminology.
Preconditions: Always true.
Postconditions: Returns the value of private variable seqNumber.

Returns:
the sequence number of giving ids to the new Terms of Terminology.

incrSeqNumber

void incrSeqNumber(int incrNumber)
Increases the sequence number of giving ids to the new Terms of Terminology.
Preconditions: The argument must not be negative or zero.
Postconditions: Increases the value of private variable seqNumber at incrNumber.

Parameters:
incrNumber - the number according to which the serial number will be increased.

decrSeqNumber

void decrSeqNumber(int decrNumber)
Decreases the sequence number of giving ids to the new Terms of Terminology.
Preconditions: The argument must not be negative or zero.
Postconditions: Decreases the value of private variable seqNumber at incrNumber. The sequence number after decrease must not be negative.

Parameters:
decrNumber - the number according to which the serial number will be decreased.

setComparability

void setComparability(Comparison comparability)
Sets the value of variable that defines if the Terms of Terminology are comparable.
Preconditions: Always true.
Postconditions: Sets to the value of private variable comparability the value of argument.

Parameters:
comparability - defines if the Terms of Terminology are comparable.

isComparable

boolean isComparable()
Returns true if the Terms of Terminology are comparable.
Preconditions: Always true.
Postconditions: Returns the value of private variable comparability.

Returns:
true if the Terms of Terminology are comparable; false otherwise.

getComparability

Comparison getComparability()
Returns if the Terms that included into Terminology are comparable.
Preconditions: Always true.
Postconditions: Returns the value of private variable comparability.

Returns:
COMPARABLE if the Terms that included into Terminology are comparable.

clear

void clear()
Removes all Terms from the Terminology but does not delete the Terms.
Preconditions: Always true.
Postconditions: Removes all Terms from the Collection listOfTerms. The Collection must be empty after this method returns.


containsTerm

boolean containsTerm(FacetsType termValue)
Checks if the Term with specified value is included in Terminology.
Preconditions: The argument must not be null.
Postconditions: Checks if the Term with specified value is included in Terminology. It checks the String value of the argument. If it is included returns true, false otherwise.

Parameters:
termValue - the value of Term that look for.
Returns:
true if Terminology contains the Term; false otherwise.

containsTermWithId

boolean containsTermWithId(int termId)
Tests if the Term with specified id is included in Terminology.
Preconditions: The argument must not be negative.
Postconditions: Tests if Terminology contains a Term with the specified id. If yes then returns true, false otherwise.

Parameters:
termId - The id of Term.
Returns:
true if Terminology contains the Term; false otherwise.

getTerm

Term<FacetsType> getTerm(FacetsType termValue)
Returns the Term with the specified value, if it is included in Terminology.
Preconditions: The argument must not be null.
Postconditions: Checks if the Term with specified value is included in Terminology. It checks the String value of the argument. If it is included returns the Term, null otherwise.

Parameters:
termValue - the value of Term that it is looking for.
Returns:
the Term if it is included in Terminology; null otherwise.

getTerm

Term<FacetsType> getTerm(Term<FacetsType> term)
Returns the specified Term, if it is included in Terminology.
Preconditions: The argument must not be null.
Postconditions: Checks if the Term with specified value is included in Terminology. It checks the id of the argument. If it is included returns the Term, null otherwise.

Parameters:
term - the Term that it is looking for.
Returns:
the Term if it is included in Terminology; null otherwise.

getTerm

Term<FacetsType> getTerm(int index)
Returns the term at the specified position in this Terminology.
Preconditions: Index must be into the bounds of Terminology.
Postconditions: Checks value of index, if it is ok returns the Term at the specified position.

Parameters:
index - index of the Term into the Terminology to be returned.
Returns:
the Term at the specified index.

getTermWithId

Term<FacetsType> getTermWithId(int termId)
Returns the Term with the specified id that included in Terminology. Checks if Terminology include Term with specified id and if it is included, returns it.
Preconditions: Term id must not be negative.
Postconditions: Tests if Terminology contains a Term with the specified id. If yes then return it.

Parameters:
termId - the id of the Term to be returned.
Returns:
the Term with specified id if it is included in Terminology; null otherwise.

getTerminology

java.util.Collection<Term<FacetsType>> getTerminology()
Reruns a Collection that includes all Terms of the Terminology.
Preconditions: Always true.
Postconditions: Returns the collection listOfTerms.

Returns:
a Collection that includes all Terms of the Terminology.

getName

java.lang.String getName()
Returns the name of Terminology.
Preconditions: Always true.
Postconditions: Returns the value of private variable name.

Returns:
the name of Terminology.

size

int size()
Returns Terminology's size.
Preconditions: Always true.
Postconditions: Returns the size of listOfTerms Collection.

Returns:
Terminology's size.

isEmpty

boolean isEmpty()
Checks if Terminology is empty.
Preconditions: Always true.
Postconditions: Check if the size of listOfTerms Collection is zero. if yes return true; false otherwise.

Returns:
true if and only if this Terminology has no Terms, that is, its size is zero; false otherwise.

removeTerm

boolean removeTerm(Term<FacetsType> term)
Removes the specified Term from Terminology.
If the Terminology does not contain the Term, it is unchanged.
Preconditions: The argument must not be null.
Postconditions: Checks if listOfTerms Collection contains a Term with the specified value.

Parameters:
term - The term to be removed.
Returns:
true if Term removed successfully; false otherwise.

removeTerm

boolean removeTerm(FacetsType termValue)
Removes the Term with the specified value from Terminology.
If the Terminology does not contain the Term, it is unchanged.
Preconditions: The argument must not be null. Postconditions: Checks if listOfTerms Collection contains the specified Term. If yes remove it from listOfTerms and returns true; false otherwise.

Parameters:
termValue - value of Term to be removed from this Terminology, if present.
Returns:
true if Term removed successfully; false otherwise.

removeTermWithId

boolean removeTermWithId(int termId)
Removes the Term with the specified id from Terminology. If the Terminology does not contain the Term, it is unchanged.
Preconditions: The argument must not be negative
Postconditions: Checks if Terminology contains a Term with the specified id. If yes then remove it from listOfTerms and returns true; false otherwise.

Parameters:
termId - id of Term to be removed from the Terminology, if present.
Returns:
true if Term removed successfully; false otherwise.

removeTerm

Term<FacetsType> removeTerm(int index)
Removes the Term at the specified position in this Terminology. Returns the Term that was removed from the Terminology.
Preconditions: THe argument must be into the bounds of Terminology
Postconditions: Checks value of index, if it is ok removes the Term at the specified position of listOfTerms Collection and return it; null otherwise.

Parameters:
index - the index of the Term to removed.
Returns:
the Term if it is removed successfully; null otherwise.

setTerm

Term<FacetsType> setTerm(FacetsType termValue)
Add a Term with the specified value to the Terminology.
Preconditions: Argument must not be null.
Postconditions: Creates a Term with specified value and gives to the term as id the sequence number of Terminology then sets the comparability of the Term according to Terminology's comparability and insert it to the Terminology. Finally, increase Terminology's sequence number and if the Term added successfully returns true; false otherwise.

Parameters:
termValue - The value of Term.
Returns:
the Term if it is added successfully; null otherwise.

setTerm

Term<FacetsType> setTerm(FacetsType termValue,
                         int termId)
Add a Term with the specified value and id to the Terminology.
Preconditions: Term must not be null and termId must not be negative.
Postconditions: Creates a Term with specified value and id then sets the comparability of the Term according to Terminology's comparability. Checks if in Terminology already exists a Term with the same id and if not, insert it to the Terminology. Finally, increase Terminology's sequence number and if the Term added successfully returns true; false otherwise.

Parameters:
termValue - The value of the Term.
termId - the id of the Term.
Returns:
the Term if it is added successfully; null otherwise.

setTerm

boolean setTerm(Term<FacetsType> term)
Adds a Term to Terminology.
Preconditions: Argument must not be null and comparability of Term must be the same with the comparability of the Terminology
Postconditions: Checks if already exists in Terminology any other Term with the same id and if term and Terminology have the same comparability. If everything is ok, adds it to Terminology and returns true; false otherwise.

Parameters:
term - the Term to be added.
Returns:
true if Term added successfully; false otherwise.

setName

void setName(java.lang.String name)
Define the name of Terminology.
Preconditions: Always true.
Postconditions: Sets the value of private variable name as the value of argument name.

Parameters:
name - the new name of Terminology.

setTerminology

void setTerminology(java.util.Collection<Term<FacetsType>> terms)
Sets the Terminology. Adds all Terms of the Collection to Terminology. Preconditions: Argument must not be null, Terminology must be empty. Postconditions: Adds to Terminology all The Terms of Collection.

Parameters:
terms - the Collection of terms that will be added to the Terminology.

setTerms

boolean setTerms(java.util.Collection<Term<FacetsType>> set)
Adds a Collection of Terms to Terminology.
Preconditions: Argument must not be null.
Postconditions: For every Term of Collection checks if already exists in Terminology, if not inserts it to Terminology. If all Terms of Collection added successfully returns true; false otherwise.

Parameters:
set - Collection of Terms.
Returns:
true if all Terms added successfully; false otherwise.

getTermId

int getTermId(FacetsType value)
Returns the id of the first Term with the specified value. Preconditions: Argument must not be null. Postconditions: Returns the id of the first Term with the specified value.

Parameters:
value - the value of Term.
Returns:
the id of the first Term with the specified value.

setTermsValues

boolean setTermsValues(java.util.Collection<Type> set)
Get a Collection of Terms's values, creates Terms with specified values and insert them into Terminology.
Preconditions: Collection must not be null.
Postconditions: For every value of Collection checks if already exists in Terminology any Term with the same value, if not inserts it to Terminology. If all Terms of Collection added successfully returns true; false otherwise.

Parameters:
set - Collection of Terms's values.
Returns:
true if all Terms added successfully;false otherwise.

toString

java.lang.String toString()
Returns a String representation of Terminology. Preconditions: Always true. Postconditions: Append to a STringBuffer all properties of Terminology.

Overrides:
toString in class java.lang.Object
Returns:
a String representation of Terminology.