public class MappingSet
extends java.lang.Object
implements java.lang.Comparable
Mapping
objects
associated with an ExtractorPatternToken
.Modifier and Type | Field and Description |
---|---|
static org.apache.log4j.Logger |
log
Used for logging.
|
Constructor and Description |
---|
MappingSet()
Default constructor required by Castor.
|
MappingSet(int mappingSetID,
java.lang.String name)
Creates a set with all values and loads up all
of its constituent
Mapping objects. |
MappingSet(java.lang.String name)
Creates a new set using the given name.
|
Modifier and Type | Method and Description |
---|---|
void |
addMapping(Mapping mapping)
Adds a
Mapping to the set. |
void |
addMappingToBeDeleted(Mapping mapping)
Adds a
Mapping to the set to be deleted. |
int |
compareTo(java.lang.Object mappingSet)
So we can be sorted.
|
void |
delete()
Deletes the set from the database.
|
void |
deleteMapping(Mapping mapping)
Queues up a
Mapping to be deleted. |
void |
dumpToLog()
Dumps the set to the log.
|
boolean |
equals(java.lang.Object obj)
Overriding equals...
|
int |
getID()
Gets the database ID of the set.
|
Mapping |
getMapping(int sequence)
Gets a
Mapping based on an index. |
java.util.TreeSet |
getMappings()
Gets a reference to the
HashSet
containing the Mapping objects. |
java.util.Iterator |
getMappingsIterator()
Gets an
Iterator used to cycle through
the Mapping objects. |
java.util.Iterator |
getMappingsToBeDeletedIterator()
Gets an
Iterator used to cycle through
the Mapping objects to be deleted. |
java.lang.String |
getName()
Gets the name of the set.
|
int |
getNumMappings()
Gets the number of
Mapping objects in the set. |
java.lang.String |
mapValue(java.lang.String value)
Maps a value based on the mappings held by this set.
|
void |
resequence(int beginSequence,
int endSequence,
boolean increaseSequences)
Re-sequences all of the mappings whose sequence falls in between the
given sequences.
|
void |
save()
Saves the set and all of its constituent
Mapping
objects to the database. |
void |
setName(java.lang.String name)
Sets the name of the set.
|
java.lang.String |
toString()
Gets a
String representation for the set. |
public MappingSet()
public MappingSet(java.lang.String name)
name
- The name of the set.public MappingSet(int mappingSetID, java.lang.String name)
Mapping
objects.mappingSetID
- The database ID of the set.name
- The name of the set.public int getID()
@Nullable public java.lang.String getName()
public void setName(java.lang.String name)
name
- The name.@Nullable public java.util.TreeSet getMappings()
HashSet
containing the Mapping
objects.
Note that this is public only for Castor.HashSet
.@NotNull public java.util.Iterator getMappingsIterator()
Iterator
used to cycle through
the Mapping
objects.Iterator
.public void addMapping(@NotNull Mapping mapping)
Mapping
to the set.mapping
- The mapping.public void resequence(int beginSequence, int endSequence, boolean increaseSequences)
beginSequence
- The sequence to begin at.endSequence
- The sequence to end at.increaseSequences
- Whether or not sequences should be increased.public int getNumMappings()
Mapping
objects in the set.@Nullable public Mapping getMapping(int sequence)
Mapping
based on an index.sequence
- The sequence to check.Mapping
.@NotNull public java.util.Iterator getMappingsToBeDeletedIterator()
Iterator
used to cycle through
the Mapping
objects to be deleted.Iterator
.public void addMappingToBeDeleted(Mapping mapping)
Mapping
to the set to be deleted.mapping
- The mapping.public void deleteMapping(@Nullable Mapping mapping)
Mapping
to be deleted.mapping
- The Mapping
to be deleted.@Nullable public java.lang.String toString()
String
representation for the set.toString
in class java.lang.Object
@Nullable public java.lang.String mapValue(@NotNull java.lang.String value)
value
- The value to be mapped.public int compareTo(java.lang.Object mappingSet)
compareTo
in interface java.lang.Comparable
mappingSet
- The MappingSet
we're comparing to.public void delete()
public void save()
Mapping
objects to the database.public boolean equals(@Nullable java.lang.Object obj)
equals
in class java.lang.Object
obj
- The object to compare to.public void dumpToLog()