Package ucar.nc2.iosp.noaa
Class StructureDataRegexp
- java.lang.Object
-
- ucar.ma2.StructureData
-
- ucar.nc2.iosp.noaa.StructureDataRegexp
-
public class StructureDataRegexp extends StructureData
Create a StructureData by using a java.util.regex.Pattern on an ascii file.- Since:
- Feb 26, 2011
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StructureDataRegexp.Vinfo
static class
StructureDataRegexp.VinfoField
-
Field Summary
Fields Modifier and Type Field Description protected com.google.re2j.Matcher
matcher
-
Fields inherited from class ucar.ma2.StructureData
EMPTY, members
-
-
Constructor Summary
Constructors Constructor Description StructureDataRegexp(StructureMembers members, com.google.re2j.Matcher m)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
convertScalarDouble(StructureMembers.Member m)
Get scalar value as a double, with conversion as needed.float
convertScalarFloat(StructureMembers.Member m)
Get scalar value as a float, with conversion as needed.int
convertScalarInt(StructureMembers.Member m)
Get scalar value as a int, with conversion as needed.long
convertScalarLong(StructureMembers.Member m)
Get scalar value as a int, with conversion as needed.Array
getArray(StructureMembers.Member m)
Get member data array of any type as an Array.ArraySequence
getArraySequence(StructureMembers.Member m)
Get ArraySequence for a member of type Sequence.ArrayStructure
getArrayStructure(StructureMembers.Member m)
Get ArrayStructure for a member of type Structure.byte[]
getJavaArrayByte(StructureMembers.Member m)
Get java byte array for a member of type byte.char[]
getJavaArrayChar(StructureMembers.Member m)
Get java char array for a member of type char.double[]
getJavaArrayDouble(StructureMembers.Member m)
Get java double array for a member of type double.float[]
getJavaArrayFloat(StructureMembers.Member m)
Get java float array for a member of type float.int[]
getJavaArrayInt(StructureMembers.Member m)
Get java int array for a member of type int.long[]
getJavaArrayLong(StructureMembers.Member m)
Get java long array for a member of type long.short[]
getJavaArrayShort(StructureMembers.Member m)
Get java short array for a member of type short.String[]
getJavaArrayString(StructureMembers.Member m)
Get java array of Strings for a member of type char or String.byte
getScalarByte(StructureMembers.Member m)
Get member data of type byte.char
getScalarChar(StructureMembers.Member m)
Get member data of type char.double
getScalarDouble(StructureMembers.Member m)
Get member data of type double.float
getScalarFloat(StructureMembers.Member m)
Get member data of type float.int
getScalarInt(StructureMembers.Member m)
Get member data of type int.long
getScalarLong(StructureMembers.Member m)
Get member data of type long.short
getScalarShort(StructureMembers.Member m)
Get member data of type short.String
getScalarString(StructureMembers.Member m)
Get String value, from rank 0 String or rank 1 char member array.StructureData
getScalarStructure(StructureMembers.Member m)
Get member data of type Structure.protected Object
parse(DataType dt, StructureDataRegexp.VinfoField vinfo)
protected Object
parse(DataType dt, StructureDataRegexp.VinfoField vinfo, int fldno)
-
Methods inherited from class ucar.ma2.StructureData
convertScalarDouble, convertScalarFloat, convertScalarInt, convertScalarLong, findMember, getArray, getArraySequence, getArrayStructure, getJavaArrayByte, getJavaArrayChar, getJavaArrayDouble, getJavaArrayFloat, getJavaArrayInt, getJavaArrayLong, getJavaArrayShort, getJavaArrayString, getMembers, getName, getScalarByte, getScalarChar, getScalarDouble, getScalarFloat, getScalarInt, getScalarLong, getScalarObject, getScalarObject, getScalarShort, getScalarString, getScalarStructure, getStructureMembers, showInternal, showInternalMembers, toString
-
-
-
-
Constructor Detail
-
StructureDataRegexp
public StructureDataRegexp(StructureMembers members, com.google.re2j.Matcher m)
-
-
Method Detail
-
parse
protected Object parse(DataType dt, StructureDataRegexp.VinfoField vinfo) throws NumberFormatException
- Throws:
NumberFormatException
-
parse
protected Object parse(DataType dt, StructureDataRegexp.VinfoField vinfo, int fldno) throws NumberFormatException
- Throws:
NumberFormatException
-
getArray
public Array getArray(StructureMembers.Member m)
Description copied from class:StructureData
Get member data array of any type as an Array.- Specified by:
getArray
in classStructureData
- Parameters:
m
- get data from this StructureMembers.Member.- Returns:
- Array values.
-
convertScalarFloat
public float convertScalarFloat(StructureMembers.Member m)
Description copied from class:StructureData
Get scalar value as a float, with conversion as needed. Underlying type must be convertible to float.- Specified by:
convertScalarFloat
in classStructureData
- Parameters:
m
- member Variable.- Returns:
- scalar value as a float
-
convertScalarDouble
public double convertScalarDouble(StructureMembers.Member m)
Description copied from class:StructureData
Get scalar value as a double, with conversion as needed. Underlying type must be convertible to double.- Specified by:
convertScalarDouble
in classStructureData
- Parameters:
m
- member Variable.- Returns:
- scalar value as a double
-
convertScalarInt
public int convertScalarInt(StructureMembers.Member m)
Description copied from class:StructureData
Get scalar value as a int, with conversion as needed. Underlying type must be convertible to int.- Specified by:
convertScalarInt
in classStructureData
- Parameters:
m
- member Variable.- Returns:
- scalar value as a int
-
convertScalarLong
public long convertScalarLong(StructureMembers.Member m)
Description copied from class:StructureData
Get scalar value as a int, with conversion as needed. Underlying type must be convertible to int.- Specified by:
convertScalarLong
in classStructureData
- Parameters:
m
- member Variable.- Returns:
- scalar value as a int
-
getScalarDouble
public double getScalarDouble(StructureMembers.Member m)
Description copied from class:StructureData
Get member data of type double.- Specified by:
getScalarDouble
in classStructureData
- Parameters:
m
- get data from this StructureMembers.Member. Must be of type double.- Returns:
- scalar double value
-
getJavaArrayDouble
public double[] getJavaArrayDouble(StructureMembers.Member m)
Description copied from class:StructureData
Get java double array for a member of type double.- Specified by:
getJavaArrayDouble
in classStructureData
- Parameters:
m
- get data from this StructureMembers.Member. Must be of type double.- Returns:
- 1D java array of doubles
-
getScalarFloat
public float getScalarFloat(StructureMembers.Member m)
Description copied from class:StructureData
Get member data of type float.- Specified by:
getScalarFloat
in classStructureData
- Parameters:
m
- get data from this StructureMembers.Member. Must be of type float.- Returns:
- scalar double value
-
getJavaArrayFloat
public float[] getJavaArrayFloat(StructureMembers.Member m)
Description copied from class:StructureData
Get java float array for a member of type float.- Specified by:
getJavaArrayFloat
in classStructureData
- Parameters:
m
- get data from this StructureMembers.Member. Must be of type float.- Returns:
- 1D java array of floats
-
getScalarByte
public byte getScalarByte(StructureMembers.Member m)
Description copied from class:StructureData
Get member data of type byte.- Specified by:
getScalarByte
in classStructureData
- Parameters:
m
- get data from this StructureMembers.Member. Must be of type byte.- Returns:
- scalar byte value
-
getJavaArrayByte
public byte[] getJavaArrayByte(StructureMembers.Member m)
Description copied from class:StructureData
Get java byte array for a member of type byte.- Specified by:
getJavaArrayByte
in classStructureData
- Parameters:
m
- get data from this StructureMembers.Member. Must be of type byte.- Returns:
- 1D java array of bytes
-
getScalarInt
public int getScalarInt(StructureMembers.Member m)
Description copied from class:StructureData
Get member data of type int.- Specified by:
getScalarInt
in classStructureData
- Parameters:
m
- get data from this StructureMembers.Member. Must be of type int.- Returns:
- scalar int value
-
getJavaArrayInt
public int[] getJavaArrayInt(StructureMembers.Member m)
Description copied from class:StructureData
Get java int array for a member of type int.- Specified by:
getJavaArrayInt
in classStructureData
- Parameters:
m
- get data from this StructureMembers.Member. Must be of type int.- Returns:
- 1D java array of ints
-
getScalarShort
public short getScalarShort(StructureMembers.Member m)
Description copied from class:StructureData
Get member data of type short.- Specified by:
getScalarShort
in classStructureData
- Parameters:
m
- get data from this StructureMembers.Member. Must be of type short.- Returns:
- scalar short value
-
getJavaArrayShort
public short[] getJavaArrayShort(StructureMembers.Member m)
Description copied from class:StructureData
Get java short array for a member of type short.- Specified by:
getJavaArrayShort
in classStructureData
- Parameters:
m
- get data from this StructureMembers.Member. Must be of type short.- Returns:
- 1D java array of shorts
-
getScalarLong
public long getScalarLong(StructureMembers.Member m)
Description copied from class:StructureData
Get member data of type long.- Specified by:
getScalarLong
in classStructureData
- Parameters:
m
- get data from this StructureMembers.Member. Must be of type long.- Returns:
- scalar long value
-
getJavaArrayLong
public long[] getJavaArrayLong(StructureMembers.Member m)
Description copied from class:StructureData
Get java long array for a member of type long.- Specified by:
getJavaArrayLong
in classStructureData
- Parameters:
m
- get data from this StructureMembers.Member. Must be of type long.- Returns:
- 1D java array of longs
-
getScalarChar
public char getScalarChar(StructureMembers.Member m)
Description copied from class:StructureData
Get member data of type char.- Specified by:
getScalarChar
in classStructureData
- Parameters:
m
- get data from this StructureMembers.Member. Must be of type char.- Returns:
- scalar char value
-
getJavaArrayChar
public char[] getJavaArrayChar(StructureMembers.Member m)
Description copied from class:StructureData
Get java char array for a member of type char.- Specified by:
getJavaArrayChar
in classStructureData
- Parameters:
m
- get data from this StructureMembers.Member. Must be of type char.- Returns:
- 1D java array of chars
-
getScalarString
public String getScalarString(StructureMembers.Member m)
Description copied from class:StructureData
Get String value, from rank 0 String or rank 1 char member array.- Specified by:
getScalarString
in classStructureData
- Parameters:
m
- get data from this StructureMembers.Member. Must be of type char or String.- Returns:
- scalar String value
-
getJavaArrayString
public String[] getJavaArrayString(StructureMembers.Member m)
Description copied from class:StructureData
Get java array of Strings for a member of type char or String.- Specified by:
getJavaArrayString
in classStructureData
- Parameters:
m
- get data from this StructureMembers.Member. Must be of type char or String.- Returns:
- 1D java array of String
-
getScalarStructure
public StructureData getScalarStructure(StructureMembers.Member m)
Description copied from class:StructureData
Get member data of type Structure.- Specified by:
getScalarStructure
in classStructureData
- Parameters:
m
- get data from this StructureMembers.Member. Must be of type Structure.- Returns:
- StructureData
-
getArrayStructure
public ArrayStructure getArrayStructure(StructureMembers.Member m)
Description copied from class:StructureData
Get ArrayStructure for a member of type Structure.- Specified by:
getArrayStructure
in classStructureData
- Parameters:
m
- get data from this StructureMembers.Member. Must be of type Structure.- Returns:
- ArrayStructure
-
getArraySequence
public ArraySequence getArraySequence(StructureMembers.Member m)
Description copied from class:StructureData
Get ArraySequence for a member of type Sequence.- Specified by:
getArraySequence
in classStructureData
- Parameters:
m
- get data from this StructureMembers.Member. Must be of type Sequence.- Returns:
- ArrayStructure
-
-