|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.javaseis.properties.TraceProperties
public class TraceProperties
The TraceProperites class provides trace properties support for JavaSeis datasets. This design uses Java Properties files for persistence, and a LinkedHashMap from the Collections interface to hold the property descriptions in memory at runtime. The descriptions provide the keyword name and location in the binary records. A Java NIO ByteBuffer holds the binary records in memory. Typed views (int, float, etc.) of the ByteBuffer are then used to return typed values for a particular element.
| Field Summary | |
|---|---|
protected java.nio.ByteBuffer |
_buffer
|
protected java.util.Map<java.lang.String,PropertyDescription> |
_map
|
protected int |
_recordLength
|
protected int |
_traceIndex
|
protected java.lang.String |
_version
|
| Constructor Summary | |
|---|---|
TraceProperties()
Constructs an instance of TraceProperites. |
|
TraceProperties(java.nio.ByteBuffer buffer)
Constructs an instance of TraceProperites. |
|
TraceProperties(int numProps,
PropertyDescription[] traceProps)
Constructs an instance of TraceProperites. |
|
| Method Summary | ||
|---|---|---|
void |
addTraceProperty(PropertyDescription property)
Adds specified trace property to storage. |
|
boolean |
exists(java.lang.String key)
Gets specified trace property from storage. |
|
double |
getDouble(java.lang.String key)
Gets a trace property value as a double. |
|
void |
getDoubleArray(java.lang.String key,
double[] values)
Gets a trace property value as a double array. |
|
float |
getFloat(java.lang.String key)
Gets a trace property value as a float. |
|
void |
getFloatArray(java.lang.String key,
float[] values)
Gets a trace property value as a float array. |
|
int |
getInt(java.lang.String key)
Gets a trace property value as an integer. |
|
void |
getIntArray(java.lang.String key,
int[] values)
Gets a trace property value as an integer array. |
|
long |
getLong(java.lang.String key)
Gets a trace property value as a long. |
|
void |
getLongArray(java.lang.String key,
long[] values)
Gets a trace property value as a long array. |
|
int |
getNumProperties()
Gets the number of trace properties. |
|
int |
getRecordLength()
Gets the record length (in bytes) used for property storage. |
|
short |
getShort(java.lang.String key)
Gets a trace property value as a short. |
|
void |
getShortArray(java.lang.String key,
short[] values)
Gets a trace property value as a short array. |
|
PropertyDescription[] |
getTraceProperties()
Gets the trace properties currently stored. |
|
PropertyDescription |
getTraceProperty(java.lang.String key)
Gets specified trace property from storage. |
|
|
getValue(java.lang.String key)
Gets a trace property value as a typed-value. |
|
void |
load(java.io.InputStream istream)
Loaded properties from specified input stream to buffer. |
|
void |
loadProMAX_C(java.io.InputStream istream,
int propertyCount)
Loaded properties from specified input stream to buffer, based on the VERSION_C_PROMAX format. |
|
static void |
main(java.lang.String[] args)
The "main" method used for testing. |
|
double |
putDouble(java.lang.String key,
double value)
Puts a trace property value as a double. |
|
double[] |
putDoubleArray(java.lang.String key,
double[] values)
Puts a trace property value as a double array. |
|
float |
putFloat(java.lang.String key,
float value)
Puts a trace property value as a float. |
|
float[] |
putFloatArray(java.lang.String key,
float[] values)
Puts a trace property value as a float array. |
|
int |
putInt(java.lang.String key,
int value)
Puts a trace property value as an integer. |
|
int[] |
putIntArray(java.lang.String key,
int[] values)
Puts a trace property value as an integer array. |
|
long |
putLong(java.lang.String key,
long value)
Puts a trace property value as a long. |
|
long[] |
putLongArray(java.lang.String key,
long[] values)
Puts a trace property value as a long array. |
|
short |
putShort(java.lang.String key,
short value)
Puts a trace property value as a short. |
|
short[] |
putShortArray(java.lang.String key,
short[] values)
Puts a trace property value as a short array. |
|
|
putValue(java.lang.String key,
T value)
Puts a trace property value as a typed-value. |
|
void |
setBuffer(java.nio.ByteBuffer buffer)
Sets the byte buffer for property storage. |
|
protected void |
setBufferPosition(PropertyDescription property)
Sets the buffer position, based on the current trace index and specified property. |
|
protected void |
setBufferPosition(java.lang.String key)
Sets the buffer position, based on the current trace index and specified property keyword. |
|
void |
setTraceIndex(int traceIndex)
Sets the trace property index to use for subsequent operations. |
|
void |
store(java.io.OutputStream ostream)
Stores properties from buffer to specified output stream. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.nio.ByteBuffer _buffer
protected java.util.Map<java.lang.String,PropertyDescription> _map
protected int _recordLength
protected int _traceIndex
protected java.lang.String _version
| Constructor Detail |
|---|
public TraceProperties()
public TraceProperties(java.nio.ByteBuffer buffer)
buffer - The byte buffer to use for properties storage.
public TraceProperties(int numProps,
PropertyDescription[] traceProps)
numProps - The number of trace properties.traceProps - The trace properties.| Method Detail |
|---|
public void addTraceProperty(PropertyDescription property)
property - The trace property to be added.public boolean exists(java.lang.String key)
key - The keyword name of the trace property to be returned.
public double getDouble(java.lang.String key)
key - The keyword name of the trace property.
public void getDoubleArray(java.lang.String key,
double[] values)
key - The keyword name of the trace property.values - The double values of the trace property.public float getFloat(java.lang.String key)
key - The keyword name of the trace property.
public void getFloatArray(java.lang.String key,
float[] values)
key - The keyword name of the trace property.values - The float values of the trace property.public int getInt(java.lang.String key)
key - The keyword name of the trace property.
public void getIntArray(java.lang.String key,
int[] values)
key - The keyword name of the trace property.values - The integer values of the trace property.public long getLong(java.lang.String key)
key - The keyword name of the trace property.
public void getLongArray(java.lang.String key,
long[] values)
key - The keyword name of the trace property.values - The long values of the trace property.public int getNumProperties()
public int getRecordLength()
public short getShort(java.lang.String key)
key - The keyword name of the trace property.
public void getShortArray(java.lang.String key,
short[] values)
key - The keyword name of the trace property.values - The short values of the trace property.
public PropertyDescription[] getTraceProperties()
throws java.io.IOException
java.io.IOException - Thrown on properties error.public PropertyDescription getTraceProperty(java.lang.String key)
key - The keyword name of the trace property to be returned.
public <T> T getValue(java.lang.String key)
key - The keyword name of the trace property.
public void load(java.io.InputStream istream)
throws java.io.IOException
istream - The input stream.
java.io.IOException - Thrown on properties load errors.
public void loadProMAX_C(java.io.InputStream istream,
int propertyCount)
throws java.io.IOException
istream - The input stream.propertyCount - The property count to load.
java.io.IOException - Thrown on properties load errors.
public static void main(java.lang.String[] args)
throws SeisException,
java.io.IOException
args - The arguments for testing.
SeisException - Thrown on testing errors.
java.io.IOException
public double putDouble(java.lang.String key,
double value)
key - The keyword name of the trace property.value - The double value of the trace property.
public double[] putDoubleArray(java.lang.String key,
double[] values)
key - The keyword name of the trace property.values - The double values of the trace property.
public float putFloat(java.lang.String key,
float value)
key - The keyword name of the trace property.value - The float value of the trace property.
public float[] putFloatArray(java.lang.String key,
float[] values)
key - The keyword name of the trace property.values - The float values of the trace property.
public int putInt(java.lang.String key,
int value)
key - The keyword name of the trace property.value - The integer value of the trace property.
public int[] putIntArray(java.lang.String key,
int[] values)
key - The keyword name of the trace property.values - The integer values of the trace property.
public long putLong(java.lang.String key,
long value)
key - The keyword name of the trace property.value - The long value of the trace property.
public long[] putLongArray(java.lang.String key,
long[] values)
key - The keyword name of the trace property.values - The long values of the trace property.
public short putShort(java.lang.String key,
short value)
key - The keyword name of the trace property.value - The shot value of the trace property.
public short[] putShortArray(java.lang.String key,
short[] values)
key - The keyword name of the trace property.values - The short values of the trace property.
public <T> T putValue(java.lang.String key,
T value)
key - The keyword name of the trace property.value - The typed-value of the trace property.
public void setBuffer(java.nio.ByteBuffer buffer)
buffer - The buffer to use for property storage.protected void setBufferPosition(PropertyDescription property)
property - The trace property.protected void setBufferPosition(java.lang.String key)
key - The keyword name of the trace property.public void setTraceIndex(int traceIndex)
traceIndex - The trace index to set.
public void store(java.io.OutputStream ostream)
throws java.io.IOException
ostream - The output stream.
java.io.IOException - Thrown on properties store errors.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||