GATE
Version 3.1-2270

gate.creole.gazetteer
Class GazetteerList

java.lang.Object
  extended by gate.util.AbstractFeatureBearer
      extended by gate.creole.AbstractResource
          extended by gate.creole.AbstractLanguageResource
              extended by gate.creole.gazetteer.GazetteerList
All Implemented Interfaces:
LanguageResource, Resource, FeatureBearer, NameBearer, Serializable, Iterable, Collection, List

public class GazetteerList
extends AbstractLanguageResource
implements List

Gazetteer List provides the means for uploading, managing and storing the data in the gazetteer list files.

See Also:
Serialized Form

Field Summary
static int LIST_MODE
          indicates list representation of the gazetteer list
static int STRING_MODE
          indicates representation of the gaz list as a single string
 
Fields inherited from class gate.creole.AbstractLanguageResource
dataStore, lrPersistentId
 
Fields inherited from class gate.creole.AbstractResource
name
 
Fields inherited from class gate.util.AbstractFeatureBearer
features
 
Constructor Summary
GazetteerList()
          create a new gazetteer list
 
Method Summary
 void add(int index, Object element)
           
 boolean add(Object o)
           
 boolean addAll(Collection c)
          Adds entire collection
 boolean addAll(int index, Collection c)
           
 void clear()
           
 boolean contains(Object o)
           
 boolean containsAll(Collection c)
           
 boolean equals(Object o)
           
 Object get(int index)
           
 String getEncoding()
          Gets the encoding of the list
 int getMode()
          Retrieves the current mode of the gaz list
 URL getURL()
          Gets the URL of the list
 int indexOf(Object o)
           
 boolean isEmpty()
           
 boolean isModified()
          Returns true of an LR has been modified since the last sync.
 Iterator iterator()
          Gets an iterator over the list.
 int lastIndexOf(Object o)
           
 ListIterator listIterator()
           
 ListIterator listIterator(int index)
           
 void load()
          Loads a gazetteer list
 Object remove(int index)
           
 boolean remove(Object o)
           
 boolean removeAll(Collection c)
           
 boolean retainAll(Collection c)
           
 Object set(int index, Object element)
           
 void setEncoding(String encod)
          Sets the encoding of the list
 void setMode(int m)
          Sets mode of the gazetteer list
 void setModified(boolean modified)
          Sets the modified status of the current list
 void setURL(URL theUrl)
          Sets the URL of the list
 int size()
           
 void store()
          Stores the list to the specified url
 List subList(int fromIndex, int toIndex)
           
 Object[] toArray()
           
 Object[] toArray(Object[] a)
           
 String toString()
          Retrieves the string representation of the gaz list according to its mode.
 void updateContent(String newContent)
          Updates the content of the gaz list with the given parameter.
 
Methods inherited from class gate.creole.AbstractLanguageResource
cleanup, getDataStore, getLRPersistenceId, getParent, setDataStore, setLRPersistenceId, setParent, sync
 
Methods inherited from class gate.creole.AbstractResource
checkParameterValues, getBeanInfo, getName, getParameterValue, getParameterValue, init, removeResourceListeners, setName, setParameterValue, setParameterValue, setParameterValues, setParameterValues, setResourceListeners
 
Methods inherited from class gate.util.AbstractFeatureBearer
getFeatures, setFeatures
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
hashCode
 
Methods inherited from interface gate.Resource
getParameterValue, init, setParameterValue, setParameterValues
 
Methods inherited from interface gate.util.FeatureBearer
getFeatures, setFeatures
 
Methods inherited from interface gate.util.NameBearer
getName, setName
 

Field Detail

LIST_MODE

public static final int LIST_MODE
indicates list representation of the gazetteer list

See Also:
Constant Field Values

STRING_MODE

public static final int STRING_MODE
indicates representation of the gaz list as a single string

See Also:
Constant Field Values
Constructor Detail

GazetteerList

public GazetteerList()
create a new gazetteer list

Method Detail

isModified

public boolean isModified()
Description copied from class: AbstractLanguageResource
Returns true of an LR has been modified since the last sync. Always returns false for transient LRs.

Specified by:
isModified in interface LanguageResource
Overrides:
isModified in class AbstractLanguageResource
Returns:
true if the list has been modified after load/store

setModified

public void setModified(boolean modified)
Sets the modified status of the current list

Parameters:
modified - is modified flag

getMode

public int getMode()
Retrieves the current mode of the gaz list

Returns:
the current mode

setMode

public void setMode(int m)
Sets mode of the gazetteer list

Parameters:
m - the mode to be set

setEncoding

public void setEncoding(String encod)
Sets the encoding of the list

Parameters:
encod - the encoding to be set

getEncoding

public String getEncoding()
Gets the encoding of the list

Returns:
the encoding of the list

load

public void load()
          throws ResourceInstantiationException
Loads a gazetteer list

Throws:
ResourceInstantiationException

store

public void store()
           throws ResourceInstantiationException
Stores the list to the specified url

Throws:
ResourceInstantiationException

setURL

public void setURL(URL theUrl)
Sets the URL of the list

Parameters:
theUrl - the URL of the List

getURL

public URL getURL()
Gets the URL of the list

Returns:
the URL of the list

size

public int size()
Specified by:
size in interface Collection
Specified by:
size in interface List

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection
Specified by:
isEmpty in interface List

contains

public boolean contains(Object o)
Specified by:
contains in interface Collection
Specified by:
contains in interface List

iterator

public Iterator iterator()
Gets an iterator over the list. It is not dangerous if the iterator is modified since there are no dependencies of entries to other members

Specified by:
iterator in interface Iterable
Specified by:
iterator in interface Collection
Specified by:
iterator in interface List

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection
Specified by:
toArray in interface List

toArray

public Object[] toArray(Object[] a)
Specified by:
toArray in interface Collection
Specified by:
toArray in interface List

add

public boolean add(Object o)
Specified by:
add in interface Collection
Specified by:
add in interface List

remove

public boolean remove(Object o)
Specified by:
remove in interface Collection
Specified by:
remove in interface List

containsAll

public boolean containsAll(Collection c)
Specified by:
containsAll in interface Collection
Specified by:
containsAll in interface List

addAll

public boolean addAll(Collection c)
Adds entire collection

Specified by:
addAll in interface Collection
Specified by:
addAll in interface List
Parameters:
c - a collection to be addded
Returns:
true if all the elements where Strings and all are sucessfully added

addAll

public boolean addAll(int index,
                      Collection c)
Specified by:
addAll in interface List

removeAll

public boolean removeAll(Collection c)
Specified by:
removeAll in interface Collection
Specified by:
removeAll in interface List

retainAll

public boolean retainAll(Collection c)
Specified by:
retainAll in interface Collection
Specified by:
retainAll in interface List

clear

public void clear()
Specified by:
clear in interface Collection
Specified by:
clear in interface List

equals

public boolean equals(Object o)
Specified by:
equals in interface Collection
Specified by:
equals in interface List
Overrides:
equals in class Object

get

public Object get(int index)
Specified by:
get in interface List

set

public Object set(int index,
                  Object element)
Specified by:
set in interface List

add

public void add(int index,
                Object element)
Specified by:
add in interface List

remove

public Object remove(int index)
Specified by:
remove in interface List

indexOf

public int indexOf(Object o)
Specified by:
indexOf in interface List

lastIndexOf

public int lastIndexOf(Object o)
Specified by:
lastIndexOf in interface List

listIterator

public ListIterator listIterator()
Specified by:
listIterator in interface List

listIterator

public ListIterator listIterator(int index)
Specified by:
listIterator in interface List

subList

public List subList(int fromIndex,
                    int toIndex)
Specified by:
subList in interface List

toString

public String toString()
Retrieves the string representation of the gaz list according to its mode. If LIST_MODE then all the entries are dumped sequentially to a string. If STRING_MODE then the content (a string) of the gaz list is retrieved.

Overrides:
toString in class Object
Returns:
the string representation of the gaz list

updateContent

public void updateContent(String newContent)
Updates the content of the gaz list with the given parameter. Depends on the mode of the gaz list. In the case of LIST_MODE the new content is parsed and loaded as single nodes through the List interface. In the case of STRING_MODE the new content is stored as a String and is not parsed.

Parameters:
newContent - the new content of the gazetteer list

GATE
Version 3.1-2270