public class DataCategory
extends java.lang.Object
+-----+ +-----+ +-----+ | FOO |--> | BAR | --> | ZOO | +-----+ +-----+ +-----+There are static utility methods for parsing a string category name into a chain of objects. Likewise there are methods for parsing a String of semi-colon delimited category strings into a Collection of DataCategory chains.
Category names can also hold regular expressions,e.g., "*", "+" and "." that gives us alot of flexibility in creating categories that match a variety of flavors of data.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ATTR_DESC
The description attribute (for XML)
|
static java.lang.String |
ATTR_NAME
The name attribute (for XML)
|
static java.lang.String |
CATEGORY_2D
The 2D category
|
static java.lang.String |
CATEGORY_3D
The 3D category
|
static java.lang.String |
CATEGORY_ANY
The category that matches any other category
|
static java.lang.String |
CATEGORY_COSMICSKEWT
The track skew-T category @deprecated use TRACK_SOUNDING
|
static java.lang.String |
CATEGORY_DISPLAY
The display category
|
static java.lang.String |
CATEGORY_ENSEMBLE
The grid ensemble category
|
static java.lang.String |
CATEGORY_GRID
The grid category
|
static java.lang.String |
CATEGORY_GRIDSKEWT
The grid skew-T category @deprecated use GRID_SOUNDING
|
static java.lang.String |
CATEGORY_GRIDSOUNDING
The grid skew-T category
|
static java.lang.String |
CATEGORY_HTML
The html category
|
static java.lang.String |
CATEGORY_IMAGE
The image category
|
static java.lang.String |
CATEGORY_POINT
The point category
|
static java.lang.String |
CATEGORY_POINTPLOT
The stationplot category
|
static java.lang.String |
CATEGORY_PROFILER_3D
The profiler 3D category
|
static java.lang.String |
CATEGORY_PROFILER_MULTISTA
The multi station profiler category
|
static java.lang.String |
CATEGORY_PROFILER_ONESTA
The one station profiler category
|
static java.lang.String |
CATEGORY_PROFILER_PLAN
The profiler plan view category
|
static java.lang.String |
CATEGORY_RAOB
The RAOB category
|
static java.lang.String |
CATEGORY_RAOBSKEWT
The RAOB skew-T category @deprecated use RAOB_SOUNDING
|
static java.lang.String |
CATEGORY_RAOBSOUNDING
The RAOB skew-T category
|
static java.lang.String |
CATEGORY_SKEWT
The Skew-T category
|
static java.lang.String |
CATEGORY_SOUNDING
The Sounding category
|
static java.lang.String |
CATEGORY_TEXT
The text category
|
static java.lang.String |
CATEGORY_TRACK
The track category
|
static java.lang.String |
CATEGORY_TRACKSKEWT
The track skew-T category @deprecated use TRACK_SOUNDING
|
static java.lang.String |
CATEGORY_TRACKSOUNDING
The track skew-T category
|
static java.lang.String |
CATEGORY_TRAJECTORYSOUNDING
The track skew-T category
|
static java.lang.String |
CATEGORY_VISAD
The VisAD category
|
protected DataCategory |
child
child of thie DataCategory
|
static DataCategory |
COSMIC_SKEWT_CATEGORY
_more_
|
static java.lang.String |
DIVIDER
Identifier for a category divider
|
static DataCategory |
ENSEMBLE_CATEGORY
grid ensemble categories
|
static DataCategory |
GRID_3D_SKEWT_CATEGORY
Deprecated.
use #GRID_3D_SOUNDING_CATEGORY
|
static DataCategory |
GRID_3D_SOUNDING_CATEGORY
Grid-derived data appropriate for an aerological sounding display
(
DateTime -> (EarthLocationTuple
-> (AirTemperature ,
DewPoint ))). |
static DataCategory |
LOCATIONS_CATEGORY
Category for locations
|
protected java.lang.String |
name
name of this DataCategory
|
static DataCategory |
NONE_CATEGORY
Category to use for none.
|
static DataCategory |
NULL
NULL category
|
static DataCategory |
POINT_PLOT_CATEGORY
Point Plot Category
|
static DataCategory |
PROFILER_ONESTA_CATEGORY
Profiler data appropriate for a one station time-hgt display
|
static DataCategory |
PROFILER_PLAN_CATEGORY
Profiler data appropriate for multi-staiton plan view of winds at hgt;
|
static DataCategory |
RAOB_SKEWT_CATEGORY
RAOB-derived data appropriate for a Skew-T display
(
DateTime , EarthLocationTuple ,
InSituAirTemperatureProfile ,
DewPointProfile ). |
static DataCategory |
RAOB_SOUNDING_CATEGORY
RAOB-derived data appropriate for a sounding display
(
DateTime , EarthLocationTuple ,
InSituAirTemperatureProfile ,
DewPointProfile ). |
static java.lang.String |
TAG_CATEGORIES
An id for a set of categories
|
static java.lang.String |
TAG_CATEGORY
An id for a single category
|
static DataCategory |
TRACK_SKEWT_CATEGORY
Deprecated.
use #TRACK_SOUNDING_CATEGORY
|
static DataCategory |
TRACK_SOUNDING_CATEGORY
Track-derived data appropriate for an aerological sounding display
(
DateTime -> (Pressure ,
Temperature ,
DewPoint ,
PolarHorizontalWind ,
EarthLocationTuple )). |
static DataCategory |
TRAJECTORY_SOUNDING_CATEGORY
Category for the trajectory feature type data files
|
static DataCategory |
XGRF_CATEGORY
Category for the drawing files
|
Constructor and Description |
---|
DataCategory()
Default constructor.
|
DataCategory(boolean forDisplay)
ctor
|
DataCategory(DataCategory parent,
java.lang.String name)
Create a category with given parent category and name.
|
DataCategory(java.lang.String name)
Create a parent-less category with the given name.
|
DataCategory(java.lang.String name,
boolean forDisplay)
Create a parent-less category with the given forDisplay state
|
DataCategory(java.lang.String name,
DataCategory metaCategory)
Create a parent-less category with the given metacategory.
|
DataCategory(java.lang.String name,
java.util.List metaCategories)
Create a parent-less category with the given metacategories.
|
Modifier and Type | Method and Description |
---|---|
static void |
addCurrentCategory(java.lang.String c)
Add the category into the global list
|
boolean |
applicableTo(DataCategory d)
Check to see if this object is applicable to the given
DataCategory argument.
|
boolean |
applicableTo(java.util.List dcs)
Go through the list of DataCategory objects.
|
static boolean |
applicableTo(java.util.List from,
java.util.List to)
Return whether any of the DataCategory's in from are
applicable to the list in
to . |
DataCategory |
copyAndAppend(java.lang.String append)
Append the string to the data category and return a new category.
|
static DataCategory |
createCategory(java.lang.String n1)
Helper method to instantiate a single category
|
static DataCategory |
createCategory(java.lang.String[] names)
Create a DataCategory from the array of names.
|
static DataCategory |
createCategory(java.lang.String n1,
java.lang.String n2)
Helper method to instantiate two categories
|
static DataCategory |
createCategory(java.lang.String n1,
java.lang.String n2,
java.lang.String n3)
Helper method to instantiate a three categories
|
static DataCategory |
createCategory(java.lang.String n1,
java.lang.String n2,
java.lang.String n3,
java.lang.String n4)
Helper method to instantiate a four categories
|
boolean |
equals(java.lang.Object o)
See if this DataCategory is equivalent to another
|
java.lang.String |
getAppend()
Get the appended category string (used by XML persistence)
|
int |
getCategoryIndex()
Get the category index (used by XML persistence)
|
DataCategory |
getChild()
Return the child category of this object.
|
int |
getChildIndex()
Get the child index (used by XML persistence)
|
static java.util.List |
getCurrentCategories()
Get all current category strings
|
boolean |
getForDisplay()
Get the "for display" property.
|
java.lang.String |
getFullName()
Return the full path of this category with its child
Use the default DIVIDER as the string divider between
sub categories.
|
java.lang.String |
getFullName(java.lang.String divider)
Return the full path of this category with its child
Use the given argument as the string divider between
sub categories.
|
java.lang.String |
getFullName(java.lang.String prefix,
java.lang.String suffix)
Return the full path of this category with its child
Use the given arguments as the string divider between
sub categories.
|
java.util.List |
getMetaCategories()
Get the list of meta categories for this DataCategory
|
java.lang.String |
getName()
Return the name of this category
|
protected java.lang.String |
getPattern()
Return the regular expression that this DataCategory represents
It is somewhat tricky because the parent category might
have been none (i.e., "*" or if this is the topmost category)
|
java.lang.String |
getReplace()
Get the Replace property.
|
boolean |
hasCategory()
Check if this DataCategory has a meta category.
|
int |
hashCode()
Return the hashcode for this DataCategory
|
static void |
init(XmlResourceCollection resources)
Used by XML persistence initialization.
|
boolean |
isInherited()
See if this is an inherited category
|
static void |
main(java.lang.String[] args)
Method for testing this class.
|
static boolean |
matchRegexp(java.lang.String source,
java.lang.String pattern)
Deprecated.
use ucar.unidata.util.StringUtil.stringMatch(String, String) instead
|
static java.util.List |
parseCategories(java.lang.String c)
Parse out a string of semi-colon delimited categories
e.g.:
"catname1-catname2-catnameN;othercategory1-othercategory2;..."
|
static java.util.List |
parseCategories(java.lang.String c,
boolean firstOneForDisplay)
Parse out a string of semi-colon delimited categories
e.g.:
"catname1-catname2-catnameN;othercategory1-othercategory2;..."
|
static DataCategory |
parseCategory(java.lang.String c,
boolean forDisplay)
Parse out a string of the form "catname1-catname2-catnameN"
and return a chain of category objects representing
catname1->catname2->catnameN.
|
void |
setAppend(java.lang.String value)
Set the appended category string (used by XML persistence)
|
void |
setCategoryIndex(int value)
Set the category index (used by XML persistence)
|
void |
setChild(DataCategory child)
Sets the child member of this category.
|
void |
setChildIndex(int value)
Set the child index (used by XML persistence)
|
void |
setForDisplay(boolean value)
Set the "for display" property.
|
void |
setName(java.lang.String n)
Set the name property.
|
void |
setReplace(java.lang.String value)
Set the Replace property.
|
java.lang.String |
toString()
Return a String representation of this DataCategory
|
java.lang.String |
toString(java.lang.String divider)
Return a String representation of this DataCategory using the given divider
|
public static final DataCategory NULL
public static final java.lang.String DIVIDER
protected java.lang.String name
protected DataCategory child
public static final java.lang.String CATEGORY_ANY
public static final java.lang.String CATEGORY_TEXT
public static final java.lang.String CATEGORY_HTML
public static final java.lang.String CATEGORY_DISPLAY
public static final java.lang.String CATEGORY_GRID
public static final java.lang.String CATEGORY_POINT
public static final java.lang.String CATEGORY_VISAD
public static final java.lang.String CATEGORY_IMAGE
public static final java.lang.String CATEGORY_3D
public static final java.lang.String CATEGORY_2D
public static final java.lang.String CATEGORY_RAOB
public static final java.lang.String CATEGORY_SKEWT
public static final java.lang.String CATEGORY_SOUNDING
public static final java.lang.String CATEGORY_POINTPLOT
public static final java.lang.String CATEGORY_TRACK
public static final java.lang.String CATEGORY_GRIDSKEWT
public static final java.lang.String CATEGORY_RAOBSKEWT
public static final java.lang.String CATEGORY_TRACKSKEWT
public static final java.lang.String CATEGORY_COSMICSKEWT
public static final java.lang.String CATEGORY_GRIDSOUNDING
public static final java.lang.String CATEGORY_ENSEMBLE
public static final java.lang.String CATEGORY_RAOBSOUNDING
public static final java.lang.String CATEGORY_TRACKSOUNDING
public static final java.lang.String CATEGORY_TRAJECTORYSOUNDING
public static final java.lang.String CATEGORY_PROFILER_ONESTA
public static final java.lang.String CATEGORY_PROFILER_MULTISTA
public static final java.lang.String CATEGORY_PROFILER_PLAN
public static final java.lang.String CATEGORY_PROFILER_3D
public static final DataCategory NONE_CATEGORY
public static final DataCategory RAOB_SKEWT_CATEGORY
DateTime
, EarthLocationTuple
,
InSituAirTemperatureProfile
,
DewPointProfile
).public static final DataCategory RAOB_SOUNDING_CATEGORY
DateTime
, EarthLocationTuple
,
InSituAirTemperatureProfile
,
DewPointProfile
).public static final DataCategory PROFILER_ONESTA_CATEGORY
public static final DataCategory PROFILER_PLAN_CATEGORY
public static final DataCategory GRID_3D_SKEWT_CATEGORY
DateTime
-> (EarthLocationTuple
-> (AirTemperature
,
DewPoint
))).public static final DataCategory TRACK_SKEWT_CATEGORY
DateTime
-> (Pressure
,
Temperature
,
DewPoint
,
PolarHorizontalWind
,
EarthLocationTuple
)).public static final DataCategory COSMIC_SKEWT_CATEGORY
public static final DataCategory ENSEMBLE_CATEGORY
public static final DataCategory GRID_3D_SOUNDING_CATEGORY
DateTime
-> (EarthLocationTuple
-> (AirTemperature
,
DewPoint
))).public static final DataCategory TRACK_SOUNDING_CATEGORY
DateTime
-> (Pressure
,
Temperature
,
DewPoint
,
PolarHorizontalWind
,
EarthLocationTuple
)).public static final DataCategory TRAJECTORY_SOUNDING_CATEGORY
public static final DataCategory XGRF_CATEGORY
public static final DataCategory LOCATIONS_CATEGORY
public static final DataCategory POINT_PLOT_CATEGORY
public static final java.lang.String TAG_CATEGORIES
public static final java.lang.String TAG_CATEGORY
public static final java.lang.String ATTR_NAME
public static final java.lang.String ATTR_DESC
public DataCategory()
public DataCategory(boolean forDisplay)
forDisplay
- Is this category a display categorypublic DataCategory(java.lang.String name)
name
- name of this DataCategory.public DataCategory(java.lang.String name, boolean forDisplay)
name
- name of this DataCategoryforDisplay
- true if this should be displayedpublic DataCategory(java.lang.String name, java.util.List metaCategories)
name
- name of this DataCategorymetaCategories
- list of meta categoriespublic DataCategory(java.lang.String name, DataCategory metaCategory)
name
- name of this DataCategorymetaCategory
- meta categorypublic DataCategory(DataCategory parent, java.lang.String name)
parent
- parent categoryname
- name of this sub categorypublic boolean hasCategory()
public java.util.List getMetaCategories()
public static void init(XmlResourceCollection resources)
resources
- collection of XML resourcespublic static void addCurrentCategory(java.lang.String c)
c
- categorypublic static java.util.List getCurrentCategories()
public static DataCategory parseCategory(java.lang.String c, boolean forDisplay)
c
- string of categoriesforDisplay
- true if the first is for display onlypublic static java.util.List parseCategories(java.lang.String c)
c
- semi-colon delimeted String of categoriespublic static java.util.List parseCategories(java.lang.String c, boolean firstOneForDisplay)
c
- semi-colon delimeted String of categoriesfirstOneForDisplay
- true if the first one is for display onlypublic static DataCategory createCategory(java.lang.String[] names)
names
- array of category namespublic static DataCategory createCategory(java.lang.String n1)
n1
- name of the categorypublic static DataCategory createCategory(java.lang.String n1, java.lang.String n2)
n1
- name of the categoryn2
- name of the child of n1public static DataCategory createCategory(java.lang.String n1, java.lang.String n2, java.lang.String n3)
n1
- name of the categoryn2
- name of the child of n1n3
- name of the child of n2public static DataCategory createCategory(java.lang.String n1, java.lang.String n2, java.lang.String n3, java.lang.String n4)
n1
- name of the categoryn2
- name of the child of n1n3
- name of the child of n2n4
- name of the child of n3public DataCategory getChild()
null
if none.public void setChild(DataCategory child)
child
- child category for thispublic java.lang.String getName()
public void setName(java.lang.String n)
n
- namepublic boolean isInherited()
public java.lang.String getFullName()
public java.lang.String getFullName(java.lang.String divider)
divider
- divider characterpublic java.lang.String getFullName(java.lang.String prefix, java.lang.String suffix)
prefix
- prefix dividersuffix
- suffix dividerprotected java.lang.String getPattern()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(java.lang.String divider)
divider
- The divider to use between sub-categories.public boolean applicableTo(java.util.List dcs)
dcs
- list of DataCategoriespublic boolean applicableTo(DataCategory d)
"*" represents 0 or more sub-categories, "+" represents one or more sub-categories "." represents one sub-categoryHere are some examples:
This | Argument | applicableTo |
"FOO-BAR" | "FOO-BAR" | true |
"FOO-BAR-ZOO" | "FOO-BAR" | false |
"FOO-BAR-ZOO" | "FOO-BAR" | false |
"FOO-BAR-*" | "FOO-BAR" | true |
"FOO-BAR-+" | "FOO-BAR" | false |
"FOO-." | "FOO-BAR" | true |
"FOO-.-*" | "FOO-BAR" | true |
"*" | "FOO-BAR" | true |
".-.-*" | "FOO-BAR" | true |
d
- DataCategory to checkd
public void setForDisplay(boolean value)
value
- for display propertypublic boolean getForDisplay()
public static boolean applicableTo(java.util.List from, java.util.List to)
to
.from
- List of DataCategories to checkto
- List of categories that from
may be
applicable to.from
list is applicable
to the to
list.applicableTo(List)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- other categoryo
is a DataCategory and they
have the same full name.public int hashCode()
hashCode
in class java.lang.Object
public static void main(java.lang.String[] args)
args
- category stringpublic static boolean matchRegexp(java.lang.String source, java.lang.String pattern)
source
- source stringpattern
- regular expression patternpublic void setCategoryIndex(int value)
value
- the indexpublic int getCategoryIndex()
public void setChildIndex(int value)
value
- the child indexpublic int getChildIndex()
public void setAppend(java.lang.String value)
value
- append valuepublic java.lang.String getAppend()
public void setReplace(java.lang.String value)
value
- The new value for Replacepublic java.lang.String getReplace()
public DataCategory copyAndAppend(java.lang.String append)
append
- category string to append (may be null)