public interface Convert
Numeric conversions are between scalar numeric types or between arrays of numeric types. It is not possible to convert between a scalar and an array. Numeric conversions are between types: pvByte, pvShort, pvInt, pvLong, pvFloat, or pvDouble.
getString converts any supported type to a String. Code that implements a PVField interface can implement method toString by calling this method.
fromString converts a String to a scalar. fromStringArray converts an array of String to a pvArray, which must have a scaler element type. A scalar field is a numeric field or pvBoolean or pvString.
All from methods put data into a PVField, e.g. from means where the PVField gets it's data.
, mrkModifier and Type | Method and Description |
---|---|
void |
copy(PVField from,
PVField to)
Copy from a PVField to another PVField.
|
void |
copyScalar(PVScalar from,
PVScalar to)
Copy from a scalar pv to another scalar pv.
|
int |
copyScalarArray(PVScalarArray from,
int offset,
PVScalarArray to,
int toOffset,
int length)
Convert from a source PV array to a destination PV array.
|
void |
copyStructure(PVStructure from,
PVStructure to)
Copy from a structure pv to another structure pv.
|
void |
copyStructureArray(PVStructureArray from,
PVStructureArray to)
Copy from a structure array to another structure array.
|
void |
copyUnion(PVUnion from,
PVUnion to)
Copy from a union pv to another union pv.
|
void |
copyUnionArray(PVUnionArray from,
PVUnionArray to)
Copy from a union array to another union array.
|
void |
fromByte(PVScalar pv,
byte from)
Convert a PV from a byte
|
int |
fromByteArray(PVScalarArray pv,
int offset,
int length,
byte[] from,
int fromOffset)
Convert a PV array from a byte array.
|
void |
fromDouble(PVScalar pv,
double from)
Convert a PV from a double
|
int |
fromDoubleArray(PVScalarArray pv,
int offset,
int length,
double[] from,
int fromOffset)
Convert a PV array from a double array.
|
void |
fromFloat(PVScalar pv,
float from)
Convert a PV from a float
|
int |
fromFloatArray(PVScalarArray pv,
int offset,
int length,
float[] from,
int fromOffset)
Convert a PV array from a float array.
|
void |
fromInt(PVScalar pv,
int from)
Convert a PV from an int
|
int |
fromIntArray(PVScalarArray pv,
int offset,
int length,
int[] from,
int fromOffset)
Convert a PV array from an int array.
|
void |
fromLong(PVScalar pv,
long from)
Convert a PV from a long
|
int |
fromLongArray(PVScalarArray pv,
int offset,
int length,
long[] from,
int fromOffset)
Convert a PV array from a long array interpreted as unsigned.
|
void |
fromShort(PVScalar pv,
short from)
Convert a PV from a short
|
int |
fromShortArray(PVScalarArray pv,
int offset,
int length,
short[] from,
int fromOffset)
Convert a PV array from a short array.
|
int |
fromString(PVScalarArray pv,
String from)
Convert from a String to a PVScalarArray.
|
void |
fromString(PVScalar pv,
String from)
Convert from a String to a PVScalar
|
int |
fromStringArray(PVScalarArray pv,
int offset,
int length,
String[] from,
int fromOffset)
Convert a PVScalarArray from a String array.
|
void |
fromUByte(PVScalar pv,
byte from)
Convert a PV from a byte interpreted as unsigned
|
int |
fromUByteArray(PVScalarArray pv,
int offset,
int length,
byte[] from,
int fromOffset)
Convert a PV array from a byte array interpreted as unsigned.
|
void |
fromUInt(PVScalar pv,
int from)
Convert a PV from an int interpreted as unsigned
|
int |
fromUIntArray(PVScalarArray pv,
int offset,
int length,
int[] from,
int fromOffset)
Convert a PV array from an int array interpreted as unsigned.
|
void |
fromULong(PVScalar pv,
long from)
Convert a PV from a long interpreted as unsigned
|
int |
fromULongArray(PVScalarArray pv,
int offset,
int length,
long[] from,
int fromOffset)
Convert a PV array from a long array.
|
void |
fromUShort(PVScalar pv,
short from)
Convert a PV from a short interpreted as unsigned
|
int |
fromUShortArray(PVScalarArray pv,
int offset,
int length,
short[] from,
int fromOffset)
Convert a PV array from a short array interpreted as unsigned.
|
void |
getFullFieldName(StringBuilder builder,
PVField pvField)
Get the full fieldName for the pvField.
|
void |
getString(StringBuilder buf,
PVField pv)
Convert a PVField to a string.
|
void |
getString(StringBuilder buf,
PVField pv,
int indentLevel)
Convert a PVField to a string.
|
boolean |
isCopyCompatible(Field from,
Field to)
Are from and to valid arguments to copy.
|
boolean |
isCopyScalarArrayCompatible(ScalarArray from,
ScalarArray to)
Are from and to valid arguments to copyArray.
|
boolean |
isCopyScalarCompatible(Scalar from,
Scalar to)
Are from and to valid arguments to copyScalar.
|
boolean |
isCopyStructureArrayCompatible(StructureArray from,
StructureArray to)
Are from and to valid for copyStructureArray.
|
boolean |
isCopyStructureCompatible(Structure from,
Structure to)
Are from and to valid arguments for copyStructure.
|
boolean |
isCopyUnionArrayCompatible(UnionArray from,
UnionArray to)
Are from and to valid for copyUnionArray.
|
boolean |
isCopyUnionCompatible(Union from,
Union to)
Are from and to valid arguments for copyUnion.
|
void |
newLine(StringBuilder builder,
int indentLevel)
Convenience method for implementing toString.
|
byte |
toByte(PVScalar pv)
Convert a PV to a
|
int |
toByteArray(PVScalarArray pv,
int offset,
int length,
byte[] to,
int toOffset)
Convert a PV array to a byte array.
|
double |
toDouble(PVScalar pv)
Convert a PV to a double
|
int |
toDoubleArray(PVScalarArray pv,
int offset,
int length,
double[] to,
int toOffset)
Convert a PV array to a double array.
|
float |
toFloat(PVScalar pv)
Convert a PV to a float
|
int |
toFloatArray(PVScalarArray pv,
int offset,
int length,
float[] to,
int toOffset)
Convert a PV array to a float array.
|
int |
toInt(PVScalar pv)
Convert a PV to an int
|
int |
toIntArray(PVScalarArray pv,
int offset,
int length,
int[] to,
int toOffset)
Convert a PV array to an int array.
|
long |
toLong(PVScalar pv)
Convert a PV to a long
|
int |
toLongArray(PVScalarArray pv,
int offset,
int length,
long[] to,
int toOffset)
Convert a PV array to a long array.
|
short |
toShort(PVScalar pv)
Convert a PV to a short.
|
int |
toShortArray(PVScalarArray pv,
int offset,
int length,
short[] to,
int toOffset)
Convert a PV array to a short array.
|
String |
toString(PVScalar pv)
Convert a PV to a String
|
int |
toStringArray(PVScalarArray pv,
int offset,
int length,
String[] to,
int toOffset)
Convert a PVScalarArray to a String array.
|
void getFullFieldName(StringBuilder builder, PVField pvField)
builder
- The builder that will have the result.pvField
- The pvField.void getString(StringBuilder buf, PVField pv, int indentLevel)
pv
- a PVField to convert to a string.
If a PVField is a structure or array be prepared for a very long string.indentLevel
- indentation levelvoid getString(StringBuilder buf, PVField pv)
pv
- The PVField to convert to a string.
If the PVField is a structure or array be prepared for a very long string.void fromString(PVScalar pv, String from)
pv
- The PV.from
- The String value to convert and put into a PV.NumberFormatException
- if the String does not have a valid value.int fromString(PVScalarArray pv, String from)
pv
- The PV.from
- The String value to convert and put into a PV.IllegalArgumentException
- if the element Type is not a scalar.NumberFormatException
- if the String does not have a valid array values.int fromStringArray(PVScalarArray pv, int offset, int length, String[] from, int fromOffset)
pv
- The PV.offset
- Starting element in a PV.length
- The number of elements to transfer.from
- The array of values to put into the PV.fromOffset
- Starting element in the source array.IllegalArgumentException
- if the element Type is not a scalar.NumberFormatException
- if the String does not have a valid value.int toStringArray(PVScalarArray pv, int offset, int length, String[] to, int toOffset)
pv
- The PV.offset
- Starting element in the PV array.length
- Number of elements to convert to the string array.to
- String array to receive the converted PV data.toOffset
- Starting element in the string array.boolean isCopyCompatible(Field from, Field to)
from
- The source.to
- The destination.void copy(PVField from, PVField to)
from
- The source.to
- The destinationIllegalArgumentException
- if the arguments are not compatible.boolean isCopyScalarCompatible(Scalar from, Scalar to)
from
- The introspection interface for the from data.to
- The introspection interface for the to data..void copyScalar(PVScalar from, PVScalar to)
from
- the source.to
- the destination.IllegalArgumentException
- if the arguments are not compatible.boolean isCopyScalarArrayCompatible(ScalarArray from, ScalarArray to)
from
- The from array.to
- The to array.int copyScalarArray(PVScalarArray from, int offset, PVScalarArray to, int toOffset, int length)
from
- The source array.offset
- Starting element in the source.to
- The destination array.toOffset
- Starting element in the array.length
- Number of elements to transfer.IllegalArgumentException
- if the arguments are not compatible.boolean isCopyStructureCompatible(Structure from, Structure to)
from
- from structure.to
- structure.void copyStructure(PVStructure from, PVStructure to)
from
- The source.to
- The destination.IllegalArgumentException
- if the arguments are not compatible.boolean isCopyUnionCompatible(Union from, Union to)
from
- from union.to
- union.void copyUnion(PVUnion from, PVUnion to)
from
- The source.to
- The destination.IllegalArgumentException
- if the arguments are not compatible.boolean isCopyStructureArrayCompatible(StructureArray from, StructureArray to)
from
- The from StructureArray.to
- The to StructureArray.boolean isCopyUnionArrayCompatible(UnionArray from, UnionArray to)
from
- The from UnionArray.to
- The to UnionArray.void copyStructureArray(PVStructureArray from, PVStructureArray to)
from
- The source array.to
- The destination array.void copyUnionArray(PVUnionArray from, PVUnionArray to)
from
- The source array.to
- The destination array.byte toByte(PVScalar pv)
pv
- a PVshort toShort(PVScalar pv)
pv
- a PVIllegalArgumentException
- if the Type is not a numeric scalarint toInt(PVScalar pv)
pv
- a PVIllegalArgumentException
- if the Type is not a numeric scalarlong toLong(PVScalar pv)
pv
- a PVIllegalArgumentException
- if the Type is not a numeric scalarfloat toFloat(PVScalar pv)
pv
- a PVIllegalArgumentException
- if the Type is not a numeric scalardouble toDouble(PVScalar pv)
pv
- a PVIllegalArgumentException
- if the Type is not a numeric scalarString toString(PVScalar pv)
pv
- a PVvoid fromByte(PVScalar pv, byte from)
pv
- a PVfrom
- value to put into PVIllegalArgumentException
- if the Type is not a numeric scalarvoid fromShort(PVScalar pv, short from)
pv
- a PVfrom
- value to put into PVIllegalArgumentException
- if the Type is not a numeric scalarvoid fromInt(PVScalar pv, int from)
pv
- a PVfrom
- value to put into PVIllegalArgumentException
- if the Type is not a numeric scalarvoid fromLong(PVScalar pv, long from)
pv
- a PVfrom
- value to put into PVIllegalArgumentException
- if the Type is not a numeric scalarvoid fromUByte(PVScalar pv, byte from)
pv
- a PVfrom
- value to put into PVIllegalArgumentException
- if the Type is not a numeric scalarvoid fromUShort(PVScalar pv, short from)
pv
- a PVfrom
- value to put into PVIllegalArgumentException
- if the Type is not a numeric scalarvoid fromUInt(PVScalar pv, int from)
pv
- a PVfrom
- value to put into PVIllegalArgumentException
- if the Type is not a numeric scalarvoid fromULong(PVScalar pv, long from)
pv
- a PVfrom
- value to put into PVIllegalArgumentException
- if the Type is not a numeric scalarvoid fromFloat(PVScalar pv, float from)
pv
- a PVfrom
- value to put into PVIllegalArgumentException
- if the Type is not a numeric scalarvoid fromDouble(PVScalar pv, double from)
pv
- a PVfrom
- value to put into PVIllegalArgumentException
- if the Type is not a numeric scalarint toByteArray(PVScalarArray pv, int offset, int length, byte[] to, int toOffset)
pv
- a PVoffset
- starting element in a PVlength
- number of elements to transferto
- where to put the PV datatoOffset
- starting element in the arrayIllegalArgumentException
- if the element type is not numericint toShortArray(PVScalarArray pv, int offset, int length, short[] to, int toOffset)
pv
- a PVoffset
- starting element in a PVlength
- number of elements to transferto
- where to put the PV datatoOffset
- starting element in the arrayIllegalArgumentException
- if the element type is not numericint toIntArray(PVScalarArray pv, int offset, int length, int[] to, int toOffset)
pv
- a PVoffset
- starting element in a PVlength
- number of elements to transferto
- where to put the PV datatoOffset
- starting element in the arrayIllegalArgumentException
- if the element type is not numericint toLongArray(PVScalarArray pv, int offset, int length, long[] to, int toOffset)
pv
- a PVoffset
- starting element in a PVlength
- number of elements to transferto
- where to put the PV datatoOffset
- starting element in the arrayIllegalArgumentException
- if the element type is not numericint toFloatArray(PVScalarArray pv, int offset, int length, float[] to, int toOffset)
pv
- a PVoffset
- starting element in a PVlength
- number of elements to transferto
- where to put the PV datatoOffset
- starting element in the arrayIllegalArgumentException
- if the element type is not numericint toDoubleArray(PVScalarArray pv, int offset, int length, double[] to, int toOffset)
pv
- a PVoffset
- starting element in a PVlength
- number of elements to transferto
- where to put the PV datatoOffset
- starting element in the arrayIllegalArgumentException
- if the element type is not numericint fromByteArray(PVScalarArray pv, int offset, int length, byte[] from, int fromOffset)
pv
- a PVoffset
- starting element in a PVlength
- number of elements to transferfrom
- value to put into PVfromOffset
- IllegalArgumentException
- if the element type is not numericint fromShortArray(PVScalarArray pv, int offset, int length, short[] from, int fromOffset)
pv
- a PVoffset
- starting element in a PVlength
- number of elements to transferfrom
- value to put into PVfromOffset
- starting element in the source arrayIllegalArgumentException
- if the element type is not numericint fromIntArray(PVScalarArray pv, int offset, int length, int[] from, int fromOffset)
pv
- a PVoffset
- starting element in a PVlength
- number of elements to transferfrom
- value to put into PVfromOffset
- starting element in the source arrayIllegalArgumentException
- if the element type is not numericint fromLongArray(PVScalarArray pv, int offset, int length, long[] from, int fromOffset)
pv
- a PVoffset
- starting element in a PVlength
- number of elements to transferfrom
- value to put into PVfromOffset
- starting element in the source arrayIllegalArgumentException
- if the element type is not numericint fromULongArray(PVScalarArray pv, int offset, int length, long[] from, int fromOffset)
pv
- a PVoffset
- starting element in a PVlength
- number of elements to transferfrom
- value to put into PVfromOffset
- starting element in the source arrayIllegalArgumentException
- if the element type is not numericint fromUByteArray(PVScalarArray pv, int offset, int length, byte[] from, int fromOffset)
pv
- a PVoffset
- starting element in a PVlength
- number of elements to transferfrom
- value to put into PVfromOffset
- IllegalArgumentException
- if the element type is not numericint fromUShortArray(PVScalarArray pv, int offset, int length, short[] from, int fromOffset)
pv
- a PVoffset
- starting element in a PVlength
- number of elements to transferfrom
- value to put into PVfromOffset
- starting element in the source arrayIllegalArgumentException
- if the element type is not numericint fromUIntArray(PVScalarArray pv, int offset, int length, int[] from, int fromOffset)
pv
- a PVoffset
- starting element in a PVlength
- number of elements to transferfrom
- value to put into PVfromOffset
- starting element in the source arrayIllegalArgumentException
- if the element type is not numericint fromFloatArray(PVScalarArray pv, int offset, int length, float[] from, int fromOffset)
pv
- a PVoffset
- starting element in a PVlength
- number of elements to transferfrom
- value to put into PVfromOffset
- starting element in the source arrayIllegalArgumentException
- if the element type is not numericint fromDoubleArray(PVScalarArray pv, int offset, int length, double[] from, int fromOffset)
pv
- a PVoffset
- starting element in a PVlength
- number of elements to transferfrom
- value to put into PVfromOffset
- starting element in the source arrayIllegalArgumentException
- if the element type is not numericvoid newLine(StringBuilder builder, int indentLevel)
builder
- The StringBuilder being constructed.indentLevel
- Indent level, Each level is four spaces.Copyright © 2014. All Rights Reserved.