|
|||||||||
| Home >> All >> org >> greenstone >> gatherer >> [ cdm overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.greenstone.gatherer.cdm
Class Format

java.lang.Objectorg.greenstone.gatherer.cdm.Format
- All Implemented Interfaces:
- java.lang.Comparable, DOMProxyListEntry
- public class Format
- extends java.lang.Object
- implements DOMProxyListEntry
- extends java.lang.Object
This class encapsulates all the information about a format command from the collection configuration. This includes both the 'general' formatting commands, and the commands targetted at specific classifiers or classification component types. This class is, unfortunately, the most complex in terms of DOM model support, since we have to maintain a live reference to any classifier this format applies to. We temporarily use the feature name as the format name attribute but since the order of classifiers can change, this of course gets horribly out of date. Before the CollectionDesignManager saves the CollectionConfiguration it calls a method in the FormatManager to force all of the Formats to update their name attributes.
- Version:
- 2.3
| Field Summary | |
private Classifier |
classifier
If this format is altering a Classifier then this is the classifier in question. |
static java.lang.String[] |
DEFAULT_FEATURES
The default features as specified by the Greenstone Developers manual. |
static java.lang.String[] |
DEFAULT_PARTS
The list of known feature parts. |
private org.w3c.dom.Element |
element
The element this format is based on. |
private java.lang.String |
part
We keep a copy of the part because its slightly more computationally tricky to calculate. |
private java.lang.String |
text
Cached result of toString. |
| Constructor Summary | |
Format()
Constructor only to be used during DOMProxyListModel initialization. |
|
Format(org.w3c.dom.Element element)
|
|
Format(java.lang.Object feature,
java.lang.String part,
boolean state)
Constructor for a flag format command. |
|
Format(java.lang.Object feature,
java.lang.String part,
java.lang.String value)
Constructor for a format-string format command. |
|
| Method Summary | |
boolean |
canHavePart()
|
static boolean |
canHavePart(java.lang.String name)
Not all features have an associated part, such as those in the default features list (apart from Search which does have parts!) |
int |
compareTo(java.lang.Object object)
Compares this object with another, and returns a numerical result based on the comparison. |
DOMProxyListEntry |
create(org.w3c.dom.Element element)
|
boolean |
equals(java.lang.Object object)
Determine whether this Object is semantically equal to another Object. |
static java.lang.String |
generateName(java.lang.Object feature,
java.lang.String part)
|
org.w3c.dom.Element |
getElement()
|
java.lang.Object |
getFeature()
Method to retrieve the value of feature, which may either be a String or a Classifier. |
java.lang.String |
getName()
|
java.lang.String |
getPart()
Method to retrieve the value of part. |
boolean |
getState()
Method to retrieve the value of state. |
java.lang.String |
getValue()
Retrieve the value of value. |
boolean |
isAssigned()
|
boolean |
isParamType()
|
static boolean |
isParamType(java.lang.String name)
|
void |
setAssigned(boolean assigned)
|
void |
setElement(org.w3c.dom.Element element)
|
void |
setName(java.lang.Object feature,
java.lang.String part)
|
void |
setState(boolean state)
Set the value of state. |
void |
setValue(java.lang.String value)
Set the value of value. |
java.lang.String |
toString()
Method to translate this classes information into a line of text as you would expect in the collection configuration file. |
void |
update()
|
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
DEFAULT_FEATURES
public static final java.lang.String[] DEFAULT_FEATURES
- The default features as specified by the Greenstone Developers manual.
DEFAULT_PARTS
public static final java.lang.String[] DEFAULT_PARTS
- The list of known feature parts.
classifier
private Classifier classifier
- If this format is altering a Classifier then this is the classifier in question.
element
private org.w3c.dom.Element element
- The element this format is based on.
part
private java.lang.String part
- We keep a copy of the part because its slightly more computationally tricky to calculate.
text
private java.lang.String text
- Cached result of toString.
| Constructor Detail |
Format
public Format()
- Constructor only to be used during DOMProxyListModel initialization.
Format
public Format(org.w3c.dom.Element element)
Format
public Format(java.lang.Object feature, java.lang.String part, boolean state)
- Constructor for a flag format command.
Format
public Format(java.lang.Object feature, java.lang.String part, java.lang.String value)
- Constructor for a format-string format command.
| Method Detail |
canHavePart
public static boolean canHavePart(java.lang.String name)
- Not all features have an associated part, such as those in the default features list (apart from Search which does have parts!)
generateName
public static java.lang.String generateName(java.lang.Object feature, java.lang.String part)
isParamType
public static boolean isParamType(java.lang.String name)
canHavePart
public boolean canHavePart()
compareTo
public int compareTo(java.lang.Object object)
- Description copied from interface:
java.lang.Comparable - Compares this object with another, and returns a numerical result based
on the comparison. If the result is negative, this object sorts less
than the other; if 0, the two are equal, and if positive, this object
sorts greater than the other. To translate this into boolean, simply
perform
o1.compareTo(o2) <op> 0, where op is one of <, <=, =, !=, >, or >=.You must make sure that the comparison is mutual, ie.
sgn(x.compareTo(y)) == -sgn(y.compareTo(x))(where sgn() is defined as -1, 0, or 1 based on the sign). This includes throwing an exception in either direction if the two are not comparable; hence,compareTo(null)should always throw an Exception.You should also ensure transitivity, in two forms:
x.compareTo(y) > 0 && y.compareTo(z) > 0impliesx.compareTo(z) > 0; andx.compareTo(y) == 0impliesx.compareTo(z) == y.compareTo(z).- Specified by:
compareToin interfacejava.lang.Comparable
create
public DOMProxyListEntry create(org.w3c.dom.Element element)
- Specified by:
createin interfaceDOMProxyListEntry
equals
public boolean equals(java.lang.Object object)
- Description copied from class:
java.lang.Object - Determine whether this Object is semantically equal
to another Object.
There are some fairly strict requirements on this method which subclasses must follow:
- It must be transitive. If
a.equals(b)andb.equals(c), thena.equals(c)must be true as well. - It must be symmetric.
a.equals(b)andb.equals(a)must have the same value. - It must be reflexive.
a.equals(a)must always be true. - It must be consistent. Whichever value a.equals(b) returns on the first invocation must be the value returned on all later invocations.
a.equals(null)must be false.- It must be consistent with hashCode(). That is,
a.equals(b)must implya.hashCode() == b.hashCode(). The reverse is not true; two objects that are not equal may have the same hashcode, but that has the potential to harm hashing performance.
This is typically overridden to throw a java.lang.ClassCastException if the argument is not comparable to the class performing the comparison, but that is not a requirement. It is legal for
a.equals(b)to be true even thougha.getClass() != b.getClass(). Also, it is typical to never cause a java.lang.NullPointerException.In general, the Collections API (
java.util) use theequalsmethod rather than the==operator to compare objects. However, java.util.IdentityHashMap is an exception to this rule, for its own good reasons.The default implementation returns
this == o. - It must be transitive. If
getElement
public org.w3c.dom.Element getElement()
- Specified by:
getElementin interfaceDOMProxyListEntry
getFeature
public java.lang.Object getFeature()
- Method to retrieve the value of feature, which may either be a String or a Classifier.
getName
public java.lang.String getName()
getPart
public java.lang.String getPart()
- Method to retrieve the value of part. Of course there may not be one, in which case return ""
getState
public boolean getState()
- Method to retrieve the value of state.
getValue
public java.lang.String getValue()
- Retrieve the value of value.
isAssigned
public boolean isAssigned()
- Specified by:
isAssignedin interfaceDOMProxyListEntry
isParamType
public boolean isParamType()
setAssigned
public void setAssigned(boolean assigned)
- Specified by:
setAssignedin interfaceDOMProxyListEntry
setElement
public void setElement(org.w3c.dom.Element element)
- Specified by:
setElementin interfaceDOMProxyListEntry
setName
public void setName(java.lang.Object feature, java.lang.String part)
setState
public void setState(boolean state)
- Set the value of state.
setValue
public void setValue(java.lang.String value)
- Set the value of value. Hmmm.
toString
public java.lang.String toString()
- Method to translate this classes information into a line of text as you would expect in the collection configuration file.
update
public void update()
|
|||||||||
| Home >> All >> org >> greenstone >> gatherer >> [ cdm overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.greenstone.gatherer.cdm.Format