Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.javathis.utilities.pagedArray
Class FieldDetails  view FieldDetails download FieldDetails.java

java.lang.Object
  extended bycom.javathis.utilities.pagedArray.FieldDetails
All Implemented Interfaces:
java.lang.Cloneable

public class FieldDetails
extends java.lang.Object
implements java.lang.Cloneable

Describes the name and type of field within an element.

An element is a structured list of at least one field. Each field holds a numberic value. Each field is expressed by a FieldDetails object. An ElementDetails object holds the FieldDetails objects.


Field Summary
protected static int BITS_IN_A_BYTE
           
private  int fieldBits
           
private  int fieldIndex
           
private  java.lang.String fieldName
           
private  int fieldType
           
static int FIRST_TYPE
           
static int LAST_TYPE
           
private static java.util.ResourceBundle MAIN_RESOURCE_BUNDLE
           
static int TYPE_BYTE
           
static int TYPE_DOUBLE
           
static int TYPE_FLOAT
           
static int TYPE_INT
           
static int TYPE_LONG
           
protected static java.lang.String[] TYPE_NAMES
           
static int TYPE_SHORT
           
protected static int[] TYPE_SIZES
           
 
Constructor Summary
private FieldDetails(FieldDetails fieldDetails)
           
  FieldDetails(java.lang.String fieldName, int fieldType)
          Creates a new FieldDetails object with the provided fieldName and fieldType.
  FieldDetails(java.lang.String fieldName, int fieldType, int fieldBits)
          Creates a new FieldDetails object with the provided fieldName, fieldType, and fieldType.
 
Method Summary
 java.lang.Object clone()
          Performs a deep copy.
 void destroy()
           
 boolean equals(FieldDetails fieldDetails)
          Checks against primitives, and Strings.
 boolean equals(java.lang.Object object)
          Delegates to equals(FieldDetails) 55
protected  void finalize()
          Called on an object by the Virtual Machine at most once, at some point after the Object is determined unreachable but before it is destroyed.
 int getFieldBits()
          Returns the number of bits used by the fields' value.
 int getIndex()
          Returns the index of this field within an element.
 int getType()
          Returns the int representing the fields' type.
 java.lang.String getTypeName()
          Returns the name of the fields' type.
static java.lang.String getTypeName(int fieldType)
          Returns the name of the provided type.
 int getTypeSize()
          Returns the number of bytes used by the fields' type.
static int getTypeSize(int fieldType)
          Returns the number of bytes used by the provided type.
 int hashCode()
          Get a value that represents this Object, as uniquely as possible within the confines of an int.
protected  void setIndex(int fieldIndex)
          Set the index of this field within an element.
 void setName(java.lang.String fieldName)
          Provide a name for the field.
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MAIN_RESOURCE_BUNDLE

private static final java.util.ResourceBundle MAIN_RESOURCE_BUNDLE

FIRST_TYPE

public static final int FIRST_TYPE
See Also:
Constant Field Values

TYPE_BYTE

public static final int TYPE_BYTE
See Also:
Constant Field Values

TYPE_SHORT

public static final int TYPE_SHORT
See Also:
Constant Field Values

TYPE_INT

public static final int TYPE_INT
See Also:
Constant Field Values

TYPE_LONG

public static final int TYPE_LONG
See Also:
Constant Field Values

TYPE_FLOAT

public static final int TYPE_FLOAT
See Also:
Constant Field Values

TYPE_DOUBLE

public static final int TYPE_DOUBLE
See Also:
Constant Field Values

LAST_TYPE

public static final int LAST_TYPE
See Also:
Constant Field Values

TYPE_SIZES

protected static final int[] TYPE_SIZES

TYPE_NAMES

protected static final java.lang.String[] TYPE_NAMES

BITS_IN_A_BYTE

protected static final int BITS_IN_A_BYTE
See Also:
Constant Field Values

fieldName

private volatile java.lang.String fieldName

fieldIndex

private volatile int fieldIndex

fieldType

private int fieldType

fieldBits

private int fieldBits
Constructor Detail

FieldDetails

public FieldDetails(java.lang.String fieldName,
                    int fieldType)
Creates a new FieldDetails object with the provided fieldName and fieldType. The fieldType is set to is max.

Note: Delegates to the following constructor:

FieldDetails(String fieldName, int fieldType, int fieldBits)


FieldDetails

public FieldDetails(java.lang.String fieldName,
                    int fieldType,
                    int fieldBits)
Creates a new FieldDetails object with the provided fieldName, fieldType, and fieldType.

Note: TYPE_FLOAT and TYPE_DOUBLE require the fieldBits to be their max. The fieldBits will automaticly be set to the max for these types. Also any invalid fieldBits provided will be set to their max.


FieldDetails

private FieldDetails(FieldDetails fieldDetails)
Method Detail

getTypeSize

public int getTypeSize()
Returns the number of bytes used by the fields' type.


getType

public int getType()
Returns the int representing the fields' type.


getFieldBits

public int getFieldBits()
Returns the number of bits used by the fields' value.


getTypeName

public java.lang.String getTypeName()
Returns the name of the fields' type.


setName

public void setName(java.lang.String fieldName)
Provide a name for the field.

Note: null's are ignored.


getIndex

public int getIndex()
Returns the index of this field within an element.

Note: -1 indicates that it is within an element.


clone

public java.lang.Object clone()
Performs a deep copy.


equals

public boolean equals(java.lang.Object object)
Delegates to equals(FieldDetails) 55


equals

public boolean equals(FieldDetails fieldDetails)
Checks against primitives, and Strings.


hashCode

public int hashCode()
Description copied from class: java.lang.Object
Get a value that represents this Object, as uniquely as possible within the confines of an int.

There are some requirements on this method which subclasses must follow:

  • Semantic equality implies identical hashcodes. In other words, if a.equals(b) is true, then a.hashCode() == b.hashCode() must be as well. However, the reverse is not necessarily true, and two objects may have the same hashcode without being equal.
  • It must be consistent. Whichever value o.hashCode() returns on the first invocation must be the value returned on all later invocations as long as the object exists. Notice, however, that the result of hashCode may change between separate executions of a Virtual Machine, because it is not invoked on the same object.

Notice that since hashCode is used in java.util.Hashtable and other hashing classes, a poor implementation will degrade the performance of hashing (so don't blindly implement it as returning a constant!). Also, if calculating the hash is time-consuming, a class may consider caching the results.

The default implementation returns System.identityHashCode(this)


toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


getTypeSize

public static int getTypeSize(int fieldType)
Returns the number of bytes used by the provided type.


getTypeName

public static java.lang.String getTypeName(int fieldType)
Returns the name of the provided type.


destroy

public void destroy()

finalize

protected void finalize()
Description copied from class: java.lang.Object
Called on an object by the Virtual Machine at most once, at some point after the Object is determined unreachable but before it is destroyed. You would think that this means it eventually is called on every Object, but this is not necessarily the case. If execution terminates abnormally, garbage collection does not always happen. Thus you cannot rely on this method to always work. For finer control over garbage collection, use references from the java.lang.ref package.

Virtual Machines are free to not call this method if they can determine that it does nothing important; for example, if your class extends Object and overrides finalize to do simply super.finalize().

finalize() will be called by a java.lang.Thread that has no locks on any Objects, and may be called concurrently. There are no guarantees on the order in which multiple objects are finalized. This means that finalize() is usually unsuited for performing actions that must be thread-safe, and that your implementation must be use defensive programming if it is to always work.

If an Exception is thrown from finalize() during garbage collection, it will be patently ignored and the Object will still be destroyed.

It is allowed, although not typical, for user code to call finalize() directly. User invocation does not affect whether automatic invocation will occur. It is also permitted, although not recommended, for a finalize() method to "revive" an object by making it reachable from normal code again.

Unlike constructors, finalize() does not get called for an object's superclass unless the implementation specifically calls super.finalize().

The default implementation does nothing.


setIndex

protected void setIndex(int fieldIndex)
Set the index of this field within an element.

Note: Should not be used. Used automaticly by ElementDetails objects.