|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.hd.d.pg2k.svrCore.location.Location.Base
public abstract static class Location.Base
Base of all location classes. All such classes contain an optional time value (with error bounds), and flag to indicate if this location information was specific to this collection item, or applied to a group of items.
A true value for `specific' says that the item had its own time info rather than inheriting a general value.
If the time value is zero it indicates that none is known. (If the time value is zero, so should its error bound be.)
All classes derived from this should be immutable and serialisable and support equals() and hashCode().
TODO: should do validation on deserialisation.
| Field Summary | |
|---|---|
private static long |
serialVersionUID
Unique Serialisation class ID generated by http://random.hd.org/. |
boolean |
specific
Did this item have its own specific location info? |
static java.lang.String |
specificKey
Name of key giving specificity in Properties map. |
java.lang.String |
type
The type of this location info. |
static java.lang.String |
typeKey
Name of key giving location type in Properties map. |
| Constructor Summary | |
|---|---|
protected |
Location.Base(boolean _specific,
java.lang.String prefix,
java.util.Properties p)
Build new base from properties. |
| Method Summary | |
|---|---|
static Location.Base |
buildFromFile(boolean specific,
java.io.File f)
Build directly from a file, assuming empty prefix. |
static Location.Base |
buildFromFileOrNONE(boolean specific,
java.io.File f)
Attempts to build location from file. |
static Location.Base |
buildFromProperties(boolean specific,
java.util.Properties p)
Build from properties with empty prefix. |
static Location.Base |
buildFromProperties(boolean specific,
java.lang.String prefix,
java.util.Properties p)
Factory method to build a class from a property set; never returns null. |
boolean |
equals(java.lang.Object obj)
Hash depends on equality of type and "specific" flags. |
static java.lang.Boolean |
getBooleanProp(java.lang.String prefix,
java.util.Properties p,
java.lang.String prop,
boolean manditory)
Routine to get a boolean property. |
static java.lang.Double |
getDoubleProp(java.lang.String prefix,
java.util.Properties p,
java.lang.String prop,
boolean rejectNegative)
Routine to get a double property. |
static Location.DoubleValueAndBounds |
getDoubleProps(java.lang.String prefix,
java.util.Properties p,
java.lang.String prop,
boolean manditory)
Get pair of double properties; requested one and its error interval. |
static java.lang.Long |
getLongProp(java.lang.String prefix,
java.util.Properties p,
java.lang.String prop,
boolean rejectNegative)
Routine to get a double property. |
static Location.LongValueAndBounds |
getLongProps(java.lang.String prefix,
java.util.Properties p,
java.lang.String prop,
boolean manditory)
Get pair of long properties; requested one and its error interval. |
int |
hashCode()
Hash depends on type and "specific" flag. |
java.lang.String |
toString()
Generate terse, human readable portion of location info. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public final java.lang.String type
public final boolean specific
public static final java.lang.String typeKey
public static final java.lang.String specificKey
private static final long serialVersionUID
| Constructor Detail |
|---|
protected Location.Base(boolean _specific,
java.lang.String prefix,
java.util.Properties p)
throws PGException
Note that the _specific parameter is overridden where a `specific' property is present.
Package-visible to restrict the range of derived classes.
_specific - is true if the location info was specifically
for this item, else false to indicate that
this location info was inherited from some
more general source
PGException| Method Detail |
|---|
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String toString()
The string generated by this routine contains no white space to make the result handlable as one token and is shell- and HTML- friendly, with portions separated by colons, and deriving classes must abide by this too.
This generates a string consisting of the type name followed by a colon then `s' for a specific location or `g' for a generic one.
toString in class java.lang.Object
public static Location.Base buildFromProperties(boolean specific,
java.lang.String prefix,
java.util.Properties p)
throws PGException
Whatever type of map is being built, there must always be the key given by the prefix + typeKey, which must contain the type of location info, and that type must be the name of the class in this Location outer class, derived from Base, that holds the location info.
For robustness, if we cannot use the location info for some reason, we should probably pretend that the item has none, though flag the problem to stderr.
PGException - in case of inability to
build a location value from the specified
properties
public static Location.Base buildFromProperties(boolean specific,
java.util.Properties p)
throws PGException
PGException
public static Location.Base buildFromFile(boolean specific,
java.io.File f)
throws java.io.IOException,
PGException
java.io.IOException
PGException
public static Location.Base buildFromFileOrNONE(boolean specific,
java.io.File f)
public static final java.lang.Double getDoubleProp(java.lang.String prefix,
java.util.Properties p,
java.lang.String prop,
boolean rejectNegative)
throws PGException
Can be asked to veto negative values, eg for error margins.
PGException
public static final Location.DoubleValueAndBounds getDoubleProps(java.lang.String prefix,
java.util.Properties p,
java.lang.String prop,
boolean manditory)
throws PGException
If manditory and either property is missing, a PGException is thrown.
If optional and the first property is missing, null is returned; but if the first property is present and the second is absent then a PGException is thrown.
PGException
public static final java.lang.Boolean getBooleanProp(java.lang.String prefix,
java.util.Properties p,
java.lang.String prop,
boolean manditory)
throws PGException
PGException
public static final java.lang.Long getLongProp(java.lang.String prefix,
java.util.Properties p,
java.lang.String prop,
boolean rejectNegative)
throws PGException
Can be asked to veto negative values, eg for error margins.
PGException
public static final Location.LongValueAndBounds getLongProps(java.lang.String prefix,
java.util.Properties p,
java.lang.String prop,
boolean manditory)
throws PGException
If manditory and either property is missing, a PGException is thrown.
If optional and the first property is missing, null is returned; but if the first property is present and the second absent a PGException is thrown.
PGException
|
DHD Multimedia Gallery V1.57.21 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||