|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.hd.d.pg2k.svrCore.location.LocationMap
public final class LocationMap
Holds a prefix-based lookup map from name to Location. Is immutable.
FIXME: needs proper serialisation support such as read/write/validation.
| Field Summary | |
|---|---|
private static java.lang.String |
locAliasKeyPrefix
Location alias key prefix for properties (containing trailing dot). |
private static boolean |
LOCAREA_PREFIX_CASE_SENSITIVE
Are location area prefixes case-sensitive? |
private static java.lang.String |
locKeyPrefix
Location key prefix for properties (containing trailing dot). |
private MemoryTools.SimpleLRUMapAutoSizeForHitRate<Name,Location.Base> |
lookupCache
Private LRU lookup cache from full name or prefix to location; never null. |
private java.util.Map<Location.Base,Name> |
mapFromLocationToNamePrefix
Immutable reverse map from Location to prefix (as Name); may remove some duplicates. |
private java.util.Map<Name,Location.Base> |
mapFromNamePrefixToLocation
Immutable Map from Name prefix to Location.Base; never null. |
static java.lang.String |
PNAME_REVERSE_LOOKUP_MINWORDS
Property name for minimum words to match for a reverse lookup. |
static java.lang.String |
PNAME_REVERSE_LOOKUP_SECTION
Property name for section to do reverse lookups in. |
private int |
revLookupMinWords
Minimum number of words matched for reverse matches, or non-positive if none. |
private Name |
revLookupSection
Reverse section used for reverse matches, or null if none. |
private static long |
serialVersionUID
Serialisation UID. |
long |
timestamp
Timestamp passed in constructor; never negative. |
| Constructor Summary | |
|---|---|
LocationMap()
Empty, immutable, zero-timestamp, lookup map. |
|
LocationMap(java.util.Properties p,
long timestamp)
Constructed from non-null Properties containing auxInfo data. |
|
| Method Summary | |
|---|---|
private static Location.Base |
_locLookup(java.util.Map<Name,Location.Base> nameToLoc,
Name.ExhibitFull exhibitName,
java.util.Set<java.lang.String> allAttrWords,
Name revLookupSection,
int revLookupMinWords,
MemoryTools.SimpleLRUMapAutoSizeForHitRate<Name,Location.Base> cache)
Lookup of Location by prefix/suffix in given Map; never null. |
private static java.util.Map<Name,Location.Base> |
buildMap(java.util.Properties rawProperties)
Build the basic map from prefix (as Name) to Location; never null. |
boolean |
equals(java.lang.Object obj)
Two LocationMaps are equal if the underlying maps are. |
java.util.Map<Location.Base,Name> |
getMapFromLocationToNamePrefix()
Get immutable reverse map from Location.Base to "virtual" prefix (as Name); never null. |
java.util.Map<Name,Location.Base> |
getMapFromNamePrefixToLocation()
Get immutable map from "virtual" prefix to Location.Base (as Name); never null. |
int |
hashCode()
Hash code is that of the underlying map and zero if empty. |
boolean |
isEmpty()
Returns true if the map is completely empty, eg as built by the default constructor. |
Location.Base |
locLookup(Name.ExhibitFull exhibitName,
java.util.Set<java.lang.String> allAttrWords)
Lookup of Location by prefix; never null. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final boolean LOCAREA_PREFIX_CASE_SENSITIVE
private static final java.lang.String locKeyPrefix
private static final java.lang.String locAliasKeyPrefix
public final long timestamp
private final java.util.Map<Name,Location.Base> mapFromNamePrefixToLocation
A HashMap is preferred for speed.
private final Name revLookupSection
private final int revLookupMinWords
private final transient java.util.Map<Location.Base,Name> mapFromLocationToNamePrefix
public static final java.lang.String PNAME_REVERSE_LOOKUP_SECTION
public static final java.lang.String PNAME_REVERSE_LOOKUP_MINWORDS
private final transient MemoryTools.SimpleLRUMapAutoSizeForHitRate<Name,Location.Base> lookupCache
Not part of the serialised state of the object.
Results are filed against keys that are both:
private static final long serialVersionUID
| Constructor Detail |
|---|
public LocationMap()
public LocationMap(java.util.Properties p,
long timestamp)
| Method Detail |
|---|
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.util.Map<Name,Location.Base> getMapFromNamePrefixToLocation()
public java.util.Map<Location.Base,Name> getMapFromLocationToNamePrefix()
Note that Location values have to be intern()ed or must compare exactly for equality for this map to be of use.
private static java.util.Map<Name,Location.Base> buildMap(java.util.Properties rawProperties)
rawProperties - properties to extract the data from; never null
public Location.Base locLookup(Name.ExhibitFull exhibitName,
java.util.Set<java.lang.String> allAttrWords)
exhibitName - name of exhibit to look up; not nullallAttrWords - attribute words; not null
private static Location.Base _locLookup(java.util.Map<Name,Location.Base> nameToLoc,
Name.ExhibitFull exhibitName,
java.util.Set<java.lang.String> allAttrWords,
Name revLookupSection,
int revLookupMinWords,
MemoryTools.SimpleLRUMapAutoSizeForHitRate<Name,Location.Base> cache)
exhibitName - full name of exhibit to look up; not nullallAttrWords - set of all attribute words
(if empty, canonical-key entries are not used); never nullcache - writable auto-sizing cache map from full or prefix of exhibit name to locationpublic boolean isEmpty()
|
DHD Multimedia Gallery V1.57.21 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||