/**
* This class describe MnM's internal representation of an
instance's slot. Each
* slot has its unique name, tag, type and color.
Additionally a slot has also a
* list tokens. Each token contains information about the
portion of text that has
* been annotated using the tag assigned to the slot (value
and position of the
* annotation, whether it was confirmed or not and the value
the highlight).
*
* @author Mattia Lanzoni
(m.lanzoni@open.ac.uk)
* @created 17 March 2003
*/
public class IEInstanceSlot {
/**
*Constructor for the IEInstanceSlot object
*/
public IEInstanceSlot() { ... }
/**
*Constructor for the IEInstanceSlot object
*
* @param slotName the name of the
slot
*/
public IEInstanceSlot(String slotName) { ... }
/**
*Constructor for the IEInstanceSlot object
*
* @param slotName the name
of the slot
* @param slotTag the
tag of the slot
* @param slotType the type
of the slot
* @param slotColor the color of
the slot
*/
public IEInstanceSlot(String slotName, String
slotTag, String slotType, Color slotColor) { ... }
//GET METHODS
/**
* Gets the color of this slot
*
* @return the color
*/
public Color getColor() { ... }
/**
* Gets the name of this slot
*
* @return the name
*/
public String getName() { ... }
/**
* Gets the tag of this slot
*
* @return the tag
*/
public String getTag() { ... }
/**
* Gets the type of this slot
*
* @return the type
*/
public String getType() { ... }
/**
* Gets the index of the current value of
the list of tokens
*
* @return the index of the
current token
*/
public int getCurrentToken() { ... }
//SET METHODS
/**
* Sets the color for this slot
*
* @param slotColor the color
*/
public void setColor(Color slotColor) { ... }
/**
* Sets the name for this slot
*
* @param slotName the name
*/
public void setName(String slotName) { ... }
/**
* Sets the tag for this slot
*
* @param slotTag the tag
*/
public void setTag(String slotTag) { ... }
/**
* Sets the type for this slot
*
* @param slotType the type
*/
public void setType(String slotType) { ... }
/**
* Sets the index of the current token
*
* @param current the index of the
current token
*/
public void setCurrentToken(int current) { ... }
//PUBLIC METHODS
/**
* For each token in the list of tokens
adjusts the position of annotated
* text when a tag is added or removed
*
* @param offset the modifier
*/
public void adjustRanges(int offset) { ... }
/**
* Removes from the list of tokens the
ones that have not been confirmed
*/
public void clearNonConfirmedTokens() { ... }
/**
* Checks if the list of tokens contains
some non-confirmed tokens
*
* @return true is there are
non-confirmed tokens, false otherwise
*/
public boolean hasNonConfirmedTokens() { ... }
/**
* DEBUG: prints the content of this
IEInstanceSlot object to the console
*/
public void printTokens() { ... }
//PUBLIC METHODS FOR TOKENS
/**
* Adds a new token
*
* @param value the value of the
new token
*/
public void addToken(String value) { ... }
/**
* Adds a new token
*
* @param value the value of the
new token
* @param s
the star-index of the <code>value</code> in the text
* @param e
the end-index of the <code>value</code> in the text
*/
public void addToken(String value, int s, int e) {
... }
/**
* Adds a new token
*
* @param value
the value of the new token
* @param s
the star-index of the
<code>value</code> in the text
* @param e
the end-index of the
<code>value</code> in the text
* @param confirmed
true if the new token is confirmed
*/
public void addToken(String value, int s, int e,
boolean confirmed) { ... }
/**
* Adds a new token
*
* @param value the value of the
new token
* @param s
the star-index of the <code>value</code> in the text
* @param e
the end-index of the <code>value</code> in the text
* @param chunk the object returned
by the highlight method
*/
public void addToken(String value, int s, int e,
Object chunk) { ... }
/**
* Adds a new token
*
* @param value
the value of the new token
* @param s
the star-index of the
<code>value</code> in the text
* @param e
the end-index of the
<code>value</code> in the text
* @param chunk
the object returned by the highlight method
* @param confirmed
true if the new token is confirmed
*/
public void addToken(String value, int s, int e,
Object chunk, boolean confirmed) { ... }
/**
* Sets the new value for the following
attributes for the token at position
* <code>pos</code> in the
list of tokens
*
* @param pos the index
of the token in the list
* @param value the value
* @param s
the start-index
* @param e
the end-index
*/
public void setTokenAt(int pos, String value, int s,
int e) { ... }
/**
* Sets the new value for the following
attributes for the token at position
* <code>pos</code> in the
list of tokens
*
* @param pos the index
of the token in the list
* @param value the value
* @param s
the start-index
* @param e
the end-index
* @param chunk the highlight
*/
public void setTokenAt(int pos, String value, int s,
int e, Object chunk) { ... }
/**
* Sets the new value for the following
attributes for the token at position
* <code>pos</code> in the
list of tokens
*
* @param pos
the index of the token in the list
* @param value
the value
* @param s
the start-index
* @param e
the end-index
* @param confirmed
true if the token is confirmed
*/
public void setTokenAt(int pos, String value, int s,
int e, boolean confirmed) { ... }
/**
* Sets the new value for the following
attributes for the token at position
* <code>pos</code> in the
list of tokens
*
* @param pos
the index of the token in the list
* @param value
the value
* @param s
the start-index
* @param e
the end-index
* @param
chunk the highlight
* @param confirmed
true if the token is confirmed
*/
public void setTokenAt(int pos, String value, int s,
int e, Object chunk, boolean confirmed) { ... }
/**
* Removes the token with value
<code>value</code>, start-index <code>s</code>
* and end-index
<code>e</code> from the list of tokens.
*
* @param value the value
* @param s
the start-index
* @param e
the end-index
*/
public void removeToken(String value, int s, int e) {
... }
/**
* Removes from the list of tokens the
one at position <code>pos</code>
*
* @param pos the position of the
token to remove
*/
public void removeTokenAt(int pos) { ... }
/**
* Empty the list of tokens
*/
public void removeAllTokens() { ... }
/**
* Get the size of the list of tokens
*
* @return The numberOfTokens
value
*/
public int getNumberOfTokens() { ... }
/**
* Insert the highlight in the token at
position <code>pos</code> in the list
* of tokens
*
* @param pos the
position of the token to modify
* @param chunk the highlight
*/
public void chunkToken(int pos, Object chunk) {
... }
/**
* Confirm the token at position
<code>pos</code> in the list of tokens
*
* @param
pos the position of the token
to modify
* @param confirmed true if the
token is confirmed
*/
public void confirmToken(int pos, boolean confirmed)
{ ... }
/**
* Check if the token at position
<code>pos</code> is confirmed
*
* @param pos the position of the
token
* @return true
if the tokens is confirmed, false otherwise
*/
public boolean isTokenConfirmed(int pos) { ... }
//PUBLIC METHODS FOR CHUNKS
/**
* Gets the highlight at position
<code>pos</code>
*
* @param pos the position of the
token
* @return the
highlight
*/
public Object getChunkAt(int pos) { ... }
//PUBLIC METHODS FOR VALUES
/**
* Checks if the list of tokens contains
the given value
*
* @param value the value to look
for
*
@return true if the list of
tokens contains the given value
*/
public boolean containsValue(String value) {
... }
/**
* Gets the value of the token at
position <code>pos</code> in the list
*
* @param pos the position of the
token
* @return the
value
*/
public String getValueAt(int pos) { ... }
/**
* Returns a string given by the
concatenation of all the values in the list
* of tokens.
* Convenience method for
<code>getValuesToString(true)</code>
*
* @return the values
*/
public String getValuesToString() { ... }
/**
* Returns a string given by the
concatenation of all the values in the list
* of tokens. It is possible to ask for a
comma separeted concatenation of
* values.
*
* @param separator true if each
value must be separeted by a comma
*
@return
the values
*/
public String getValuesToString(boolean separator) {
... }
/**
* Returns a string given by the
concatenation of all the values in the list
* of tokens. The return string does not
contains repetition.
* Convenience method for
<code>getValuesToStringNoRep(true)</code>
*
* @return the values
*/
public String getValuesToStringNoRep() { ... }
/**
* Returns a string given by the
concatenation of all the values in the list
* of tokens. It is possible to ask for a
comma separeted concatenation of
* values. The return string does not
contains repetition.
*
* @param separator true if each
value must be separeted by a comma
*
@return
the values
*/
public String getValuesToStringNoRep(boolean
separator) { ... }
/**
* Gets an array of values from the list
of tokens
*
* @return the array of values
*/
public Object[] getArrayOfValues() { ... }
/**
* Gets an array of values without
repetition form the list of tokens
*
* @return the array of values
*/
public Object[] getArrayOfValuesNoRep() { ... }
//PUBLIC METHODS FOR RANGES
/**
* Checks if the list of tokens contains
a value with the given start-index
* <code>s</code> and the
end-index <code>e</code>.
*
* @param s the start-index
* @param e the end-index
* @return true if there is a
token with the given start-index and end-index
*/
public boolean containsRange(int s, int e) {
... }
/**
* Gets the start-index and end-index at
position <code>pos</code> in the list
* of tokens
*
* @param pos the position
* @return the
range value
*/
public IERange getRangeAt(int pos) { ... }
/**
* Gets the array of ranges from the list
of tokens
*
* @return the array of ranges
*/
public Object[] getArrayOfRanges() { ... }
/**
* Gets the array of range without
repetitions from the list of tokens
*
* @return the array of ranges
*/
public Object[] getArrayOfRangesNoRep() { ... }
//INNER CLASS
/**
* This class describes the structure
that an element in the list of tokens
* must have. Each token has the
following attributes:
* - value: the portion of the text that
has been annotated;
* - range: the start-index and end-index
of the portion of text that has been
*
annotated;
* - chunk: the highlight;
* - confirmed: true if the token has
been confirmed, false otherwise.
*
* @author Mattia
Lanzoni (m.lanzoni@open.ac.uk)
* @created 17 March 2003
*/
class Token {
/**
*Constructor for the Token
object
*
* @param value
the value
*/
Token(String value) { ... }
/**
*Constructor for the Token
object
*
* @param value
the value
* @param range
the range
*/
Token(String value, IERange
range) { ... }
/**
*Constructor for the Token
object
*
* @param
value the value
* @param
range the range
* @param
confirmed true if the token is confirmed
*/
Token(String value, IERange
range, boolean confirmed) { ... }
/**
*Constructor for the Token
object
*
* @param value
the value
* @param range
the range
* @param chunk
the highlight
*/
Token(String value, IERange
range, Object chunk) { ... }
/**
*Constructor for the Token
object
*
* @param value
the value
* @param range
the range
* @param chunk
the highlight
* @param
confirmed true if the token is confirmed
*/
Token(String value, IERange
range, Object chunk, boolean confirmed) { ... }
//GET METHODS
/**
* Gets the value
attribute of the Token object
*
* @return
the value
*/
String getValue() { ... }
/**
* Gets the range
attribute of the Token object
*
* @return
the range
*/
IERange getRange() { ... }
/**
* Gets the chunk
attribute of the Token object
*
* @return
the highlight
*/
Object getChunk() { ... }
/**
* Gets the confirmed
attribute of the Token object
*
* @return
true if the token is confirmed
*/
boolean getConfirmed() { ...
}
//SET METHODS
/**
* Sets the value
attribute of the Token object
*
* @param value
the value
*/
public void setValue(String
value) { ... }
/**
* Sets the range
attribute of the Token object
*
* @param range
the range
*/
public void setRange(IERange
range) { ... }
/**
* Sets the range
attribute of the Token object
*
* @param sIndex
the start-index
* @param eIndex
the end-index
*/
public void setRange(int sIndex,
int eIndex) { ... }
/**
* Sets the chunk
attribute of the Token object
*
* @param chunk
the highlight
*/
public void setChunk(Object
chunk) { ... }
/**
* Sets the confirmed
attribute of the Token object
*
* @param
confirmed true if the token is confirmed
*/
public void setConfirmed(boolean
confirmed) { ... }
//PUBLIC METHODS
/**
* Gets the confirmed
attribute of the Token object
*
* @return
true if the token is confirmed
*/
public boolean isConfirmed() {
... }
}
} |