|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.hd.d.pg2k.svrCore.ExhibitThumbnails
public final class ExhibitThumbnails
Immutable, Serializable thumbnails/samples of an exhibit. This is designed to be transportable across a network if need be, and persistable to disc, and reasonably efficient when serialised.
This holds a standard and a small thumbnail (of a static image) or equivalent sample of an exhibit for other exhibit types, or an indication that such a sample is not needed because the original can be used, or an indication that such a sample could not be made (eg failed and should not be rebuilt).
Exhibit thumbnails/samples are strictly limited in size to minimise the space they consume in toto and the time that they take to send across the network to clients. The small thumbnails are meant to be small enough that they can be permanently held in memory at the servers and are lightning-fast to transfer to client (while not so small as to simple dwarfed by network overheads).
(All thumbnails/samples must be smaller than the original exhibit.)
Any sample is of the same MIME type as the original.
An example of when an exhibit could be used as its own thumbnail is when its size in bytes is less than the appropriate limit, and the (x,y) dimensions are no greater than the appropriate limits, then no thumbnail is required and the image can be used directly.
This is made to implement equals() and hashCode() so that comparisons for equality, eg in a Set, can be performed. Two objects are equal if their constituent thumbnails are equal. The hash is computed from those of the thumbnails.
| Nested Class Summary | |
|---|---|
static class |
ExhibitThumbnails.Thumbnail
Immutable, Serializable single thumbnail (standard or small). |
| Field Summary | |
|---|---|
long |
created
Creation timestamp (positive), or zero if none. |
static int |
MAX_BYTES_EST
Crude estimate of maximum bytes consumed in memory and on disc by thumbnails; ignores VM and serialisation details, etc. |
static ExhibitThumbnails |
NO_THUMBNAILS
Value indicating that no thumbnails could be made for an exhibit. |
private static long |
serialVersionUID
My initial version number. |
private ExhibitThumbnails.Thumbnail |
sml
Small thumbnail; null means none can be constructed. |
static short |
SML_ABS_MAX_BYTES
Absolute maximum size of any small thumbnail/sample binary in bytes (4kB-1). |
static int |
SML_STATIC_IMAGE_TN_LDIM_PX
For a small static image thumbnail, its longest dimension in pixels. |
private ExhibitThumbnails.Thumbnail |
std
Standard thumbnail; null means none can be constructed. |
static short |
STD_ABS_MAX_BYTES
Absolute maximum size of any standard thumbnail/sample binary in bytes (32kB-1). |
static int |
STD_STATIC_IMAGE_TN_LDIM_PX
For a standard static image thumbnail, its longest dimension in pixels. |
| Constructor Summary | |
|---|---|
private |
ExhibitThumbnails(ExhibitThumbnails.Thumbnail small,
ExhibitThumbnails.Thumbnail standard)
Construct from a pair of thumbnails. |
| Method Summary | |
|---|---|
static java.awt.Dimension |
computeThumbnailDimensions(java.awt.Dimension original,
boolean std)
Given the original dimensions of an image, compute the size of the standard/small thumbnail. |
static ExhibitThumbnails |
createExhibitThumbnails(ExhibitThumbnails.Thumbnail small,
ExhibitThumbnails.Thumbnail standard)
Make a pair of thumbnails. |
boolean |
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one. |
ExhibitThumbnails.Thumbnail |
getSmall()
Get small thumbnail; null means none can be constructed. |
ExhibitThumbnails.Thumbnail |
getStandard()
Get standard thumbnail; null means none can be constructed. |
int |
hashCode()
Returns a hash code value for the object. |
static boolean |
isEmpty(ExhibitThumbnails tns)
Returns true if its argument is null or contains no thumbnails. |
private void |
readObject(java.io.ObjectInputStream in)
Deserialise. |
protected java.lang.Object |
readResolve()
Eliminate duplicate empty objects after deserialisation. |
java.lang.String |
toString()
Human-readable summary. |
void |
validateObject()
Validate fields/state. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final ExhibitThumbnails NO_THUMBNAILS
This value is a singleton.
private final ExhibitThumbnails.Thumbnail sml
private final ExhibitThumbnails.Thumbnail std
public final long created
public static final short STD_ABS_MAX_BYTES
This value is small enough to store in a short.
public static final short SML_ABS_MAX_BYTES
This value is small enough to store in a short.
public static final int STD_STATIC_IMAGE_TN_LDIM_PX
public static final int SML_STATIC_IMAGE_TN_LDIM_PX
public static final int MAX_BYTES_EST
private static final long serialVersionUID
| Constructor Detail |
|---|
private ExhibitThumbnails(ExhibitThumbnails.Thumbnail small,
ExhibitThumbnails.Thumbnail standard)
The timestamp is always zero if both thumbnails are.
| Method Detail |
|---|
public static boolean isEmpty(ExhibitThumbnails tns)
public ExhibitThumbnails.Thumbnail getSmall()
public ExhibitThumbnails.Thumbnail getStandard()
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
Equality ignores the creation timestamp.
equals in class java.lang.Object
public static java.awt.Dimension computeThumbnailDimensions(java.awt.Dimension original,
boolean std)
If the longest dimension of the original image is no more than {STD|SML}_STATIC_IMAGE_TN_LDIM_PX pixels then the input dimensions will be returned unaltered, else the values are scaled so that the longest dimension is exactly {STD|SML}_STATIC_IMAGE_TN_LDIM_PX pixels.
std - if true, compute for standard, else compute for small
private void readObject(java.io.ObjectInputStream in)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundExceptionprotected java.lang.Object readResolve()
public void validateObject()
throws java.io.InvalidObjectException
Barf if something bad is found. (Maybe allow some extra info in debug version.)
validateObject in interface java.io.ObjectInputValidationjava.io.InvalidObjectException
public static ExhibitThumbnails createExhibitThumbnails(ExhibitThumbnails.Thumbnail small,
ExhibitThumbnails.Thumbnail standard)
public java.lang.String toString()
toString in class java.lang.Object
|
DHD Multimedia Gallery V1.57.21 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||