org.hd.d.pg2k.svrCore
Class Name.ExhibitShort

java.lang.Object
  extended by org.hd.d.pg2k.svrCore.Name.CSWrapper<Name.ExhibitFull>
      extended by org.hd.d.pg2k.svrCore.Name.ExhibitShort
All Implemented Interfaces:
java.lang.CharSequence, java.lang.Comparable<java.lang.CharSequence>, MemoryTools.Internable, TextUtils.CharSequence8Bit
Enclosing class:
Name

public static final class Name.ExhibitShort
extends Name.CSWrapper<Name.ExhibitFull>

ExhibitShortName immutable CharSequence light-weight wrapper around underlying ExhibitFullName data. Though slow, these can be used as Map/Set/etc elements, as they have a working (though inefficient) consistent hashCode() and equals(), but it is much preferred (more efficient/fast) to use ExhibitFull as a key.


Field Summary
static char PERSISTABLE_NAME_LEADING_CHAR
          Unique leading printable-ASCII character for persistableKey(), not a valid exhibit name char.
static char PERSISTABLE_NAME_LENGTH
          Length of persistable key in chars; strictly positive.
 
Fields inherited from class org.hd.d.pg2k.svrCore.Name.CSWrapper
end, start, underlying
 
Constructor Summary
private Name.ExhibitShort(Name.ExhibitFull underlying, int start, int end)
          Create an instance.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Equality checks for the same type and content.
 Name.ExhibitFull getFullName()
          Retrieve full name for this short name; never null.
 TextUtils.CharSequence8Bit getMainWordsComponent(java.util.Set<java.lang.String> allAttrWords)
          Extract the main words (stem) component; never null nor empty.
 int hashCode()
          The hash code is based on a fixed-time sampling of the content for speed.
 java.lang.CharSequence persistableKey()
          Persistable unique printable-ASCII immutable CharSequence key; never null.
 java.lang.String toString()
          Convert to String containing same char sequence.
 
Methods inherited from class org.hd.d.pg2k.svrCore.Name.CSWrapper
charAt, compareTo, length, subSequence, toByteArray
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

PERSISTABLE_NAME_LEADING_CHAR

public static final char PERSISTABLE_NAME_LEADING_CHAR
Unique leading printable-ASCII character for persistableKey(), not a valid exhibit name char.

See Also:
Constant Field Values

PERSISTABLE_NAME_LENGTH

public static final char PERSISTABLE_NAME_LENGTH
Length of persistable key in chars; strictly positive.

See Also:
Constant Field Values
Constructor Detail

Name.ExhibitShort

private Name.ExhibitShort(Name.ExhibitFull underlying,
                          int start,
                          int end)
Create an instance. Only intended to be created by an ExhibitFull instance.

Method Detail

getFullName

public Name.ExhibitFull getFullName()
Retrieve full name for this short name; never null.


getMainWordsComponent

public TextUtils.CharSequence8Bit getMainWordsComponent(java.util.Set<java.lang.String> allAttrWords)
Extract the main words (stem) component; never null nor empty. As ExhibitName.getMainWordsComponent() but optimised for this common case, with the result content identical to that from getMainWordsComponent(getFullName()).

The result is intern()able to help conflate identical values if required, ie has a working hashCode() and equals(), which may save space and accelerate searching for example.

Parameters:
allAttrWords - a Set of all legal attribute words (String values); may be empty but not null

equals

public boolean equals(java.lang.Object obj)
Equality checks for the same type and content. Will return true in the case of an identical short name of a different full name.

Overrides:
equals in class Name.CSWrapper<Name.ExhibitFull>

hashCode

public int hashCode()
The hash code is based on a fixed-time sampling of the content for speed.

Overrides:
hashCode in class Name.CSWrapper<Name.ExhibitFull>

toString

public java.lang.String toString()
Convert to String containing same char sequence. We automatically intern() the short exhibit name result to avoid duplication.

Specified by:
toString in interface java.lang.CharSequence
Overrides:
toString in class Name.CSWrapper<Name.ExhibitFull>

persistableKey

public java.lang.CharSequence persistableKey()
Persistable unique printable-ASCII immutable CharSequence key; never null. This generates a key:

This may be slow to compute.


DHD Multimedia Gallery V1.53.0

Copyright (c) 1996-2009, Damon Hart-Davis. All rights reserved.