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.CharSequence7Bit, TextUtils.CharSequence8Bit
Enclosing class:
Name

public static final class Name.ExhibitFull
extends Name
implements TextUtils.CharSequence7Bit

ExhibitFullName holds a (ASCII-7) valid syntactically-valid full exhibit name. This will only allow construction of instances representing a valid full exhibit name.

This 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
private static long serialVersionUID
          Unique Serialisation class ID generated by http://random.hd.org/.
private  Name.ExhibitShort shortName
          Cache of link to parent, lazily 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
 char charAt(int index)
          Extract char at specified index.
 int compareTo(Name.ExhibitFull o)
          Provide natural sort order for this class.
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 an optional previous value to attempt to share a prefix with; never null.
static Name.ExhibitFull createNoIntern(java.lang.CharSequence fullName, Name prev)
          Create an ExhibitFull instance with an optional previous value to attempt to share a prefix with, with no intern()ing; 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
byteAt, byteAtInner, bytesAtInner, compareTo, contentEquals, contentEquals, createOrStringFallback, equals, getBlockCount, getPrefixLen, getPrevChainLength, getSuffixLen, hashCode, length, readResolve, showInternalStructure, subSequence, toByteArray, writeToByteArray
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.hd.d.pg2k.svrCore.TextUtils.CharSequence8Bit
byteAt, toByteArray
 
Methods inherited from interface java.lang.CharSequence
length, subSequence
 

Field Detail

shortName

private transient Name.ExhibitShort shortName
Cache of link to parent, lazily 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 (7-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 an optional 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 (7-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

createNoIntern

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

This uses minimal cleverness, no intern()ing, no use of prefix/suffix caches, minimal overheads, etc, and so allows generation of completely fresh instances unconnected with any previous ones. This may well not make optimal use of memory, and so is not usually recommended.

Parameters:
fullName - the (7-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'.


charAt

public final char charAt(int index)
Extract char at specified index. This specialisation can take advantage of the fact that exhibit names are entirely 7-bit, so there is no danger of sign extension in conversion from byte to int for comparison.

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

compareTo

public final int compareTo(Name.ExhibitFull o)
Provide natural sort order for this class. This specialisation can take advantage of the fact that exhibit names are entirely 7-bit, so there is no danger of sign extension in conversion from byte to int for comparison.


toString

public java.lang.String toString()
Convert to String containing same char sequence; never null. Automatically intern()s 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.60.69

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