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

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

public static final class Name.ExhibitFull
extends Name

ExhibitFullName implementation on top of SharedTermini8BitString. This will only allow construction of instances representing a valid full exhibit name.

This carries no significant extra data over SharedTermini8BitString, and mainly represents a guarantee that the data is a valid full exhibit name, plus some utility methods/types for conveniently and efficiently accessing components of that name.

The constructors are private and only accessible via factory methods to help with instance control, and all instances are automatically intern()ed to eliminate duplicates.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.hd.d.pg2k.svrCore.Name
Name.ExhibitFull, Name.ExhibitShort
 
Field Summary
static Name.ExhibitFull DUMMY
          Shared dummy (valid, small, alphabetically-late) instance with no prev; not null.
private static long serialVersionUID
          Unique Serialisation class ID generated by http://random.hd.org/.
private  Name.ExhibitShort shortName
          Cache of link to parent, computed on demand.
 
Fields inherited from class org.hd.d.pg2k.svrCore.Name
CASE_INSENSITIVE_ORDER, EMPTY, prev
 
Constructor Summary
private Name.ExhibitFull(java.lang.CharSequence name, Name prev)
           
 
Method Summary
static Name.ExhibitFull create(java.lang.CharSequence fullName)
          Create an ExhibitFull instance; never null.
static Name.ExhibitFull create(java.lang.CharSequence fullName, Name prev)
          Create an ExhibitFull instance with a previous value to attempt to share a prefix with; never null.
 Name.ExhibitShort getShortName()
          Extract strongly-typed ExhibitShortName, ie the filename component; never null.
 Name.ExhibitFull getVirtualExhibitName()
          Create a "virtual" full name consisting of the category directory and then the file component; never null.
 java.lang.String toString()
          Convert to String containing same char sequence; never null.
 void validateObject()
          Validate fields/state.
 
Methods inherited from class org.hd.d.pg2k.svrCore.Name
charAt, compareTo, compareTo, contentEquals, createOrStringFallback, equals, getPrefixLen, getPrevChainLength, hashCode, length, readResolve, subSequence, toByteArray
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DUMMY

public static final Name.ExhibitFull DUMMY
Shared dummy (valid, small, alphabetically-late) instance with no prev; not null. Can help to avoid picking up random dependencies on other ExhibitFull instances, eg by blocking use of ad-hoc prefix sharing, which may be useful for data due to be serialised.


shortName

private transient Name.ExhibitShort shortName
Cache of link to parent, computed on demand. Only accessed under instance lock so as to eliminate access races and thus guarantee avoidance of creation of duplicates.

Not serialisable (because recomputable).


serialVersionUID

private static final long serialVersionUID
Unique Serialisation class ID generated by http://random.hd.org/.

See Also:
Constant Field Values
Constructor Detail

Name.ExhibitFull

private Name.ExhibitFull(java.lang.CharSequence name,
                         Name prev)
Method Detail

create

public static Name.ExhibitFull create(java.lang.CharSequence fullName)
Create an ExhibitFull instance; never null. It is often best to attempt to share a prefix with the lexically previous (or next) item.

If passed an ExhibitFull (but not including sub-classes) this returns it untouched.

Parameters:
fullName - the (8-bit) syntactically-valid full exhibit name; never null nor empty
Throws:
java.lang.IllegalArgumentException - in the case of a null or invalid putative full name

create

public static Name.ExhibitFull create(java.lang.CharSequence fullName,
                                      Name prev)
Create an ExhibitFull instance with a previous value to attempt to share a prefix with; never null. It is often best to attempt to share a prefix with the lexically previous (or next) item.

If passed an ExhibitFull (but not including sub-classes) this returns it untouched.

Parameters:
fullName - the (8-bit) syntactically-valid full exhibit name; never null nor empty
prev - previous Name with which to attempt to share a prefix; null if none
Throws:
java.lang.IllegalArgumentException - in the case of a null or invalid putative full name

getShortName

public Name.ExhibitShort getShortName()
Extract strongly-typed ExhibitShortName, ie the filename component; never null. This is a light-weight, non-intern()able CharSequence wrapper around the existing data.

This guarantees that only one ShortName instance can be generated for each FullName. Thus intern()ing is neither needed nor supported.


getVirtualExhibitName

public Name.ExhibitFull getVirtualExhibitName()
Create a "virtual" full name consisting of the category directory and then the file component; never null. The results in a syntactically-valid full exhibit name, but omits the internal directory "noise".

Returns this instance as-is if already 'virtual'.


toString

public java.lang.String toString()
Convert to String containing same char sequence; never null. We automatically intern() the full-exhibit-name result to avoid duplication.

Specified by:
toString in interface java.lang.CharSequence
Overrides:
toString in class Name

validateObject

public void validateObject()
                    throws java.io.InvalidObjectException
Validate fields/state. Called in the constructor and possibly after de-serialising.

Barf if something bad is found. (Maybe allow some extra info in debug version.)

Specified by:
validateObject in interface java.io.ObjectInputValidation
Overrides:
validateObject in class Name
Throws:
java.io.InvalidObjectException

DHD Multimedia Gallery V1.53.0

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