Package uk.ac.starlink.tfcat
Class TfcatUtil
java.lang.Object
uk.ac.starlink.tfcat.TfcatUtil
Utilities for use with TFCat classes.
- Since:
- 9 Feb 2022
- Author:
- Mark Taylor
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
checkBoundingBoxes
(Reporter reporter, TfcatObject tfcat) Performs a global check for a given TfcatObject that any positions listed are within the bounding boxes in whose scope they appear.static void
checkCrs
(Reporter reporter, TfcatObject tfcat) Ensure that CRS objects are in place for the tree rooted at the given TFCat Object.static void
checkOption
(Reporter reporter, String token, Collection<String> options) Checks whether a given token is in a supplied list of valid options.getAllGeometries
(TfcatObject tfcat) Returns all the Geometries that are descendents of a given TFCat object, including itself if applicable.getAllPositions
(TfcatObject tfcat) Returns all the Position objects contained in a TFCat object and its descendents.static Bbox
getBboxInScope
(TfcatObject tfcat) Returns a Bounding Box objecct applying to the given TFCat object.static TfcatObject[]
getChildren
(TfcatObject tfcat) Returns any direct children of a TfcatObject that are themselves TfcatObjects.static Crs
getCrsInScope
(TfcatObject tfcat) Returns a CRS object applying to the given TFCat object.static WordChecker
Returns a syntax checker for UCDs.static WordChecker
Returns a syntax checker for VOUnits.static TfcatObject
parseTfcat
(String jsonTxt, Reporter reporter) Performs a validating parse of a given TFCat text.
-
Method Details
-
parseTfcat
Performs a validating parse of a given TFCat text.- Parameters:
jsonTxt
- TFCat textreporter
- error message destination- Returns:
- TFCat object, or null in case of fatal parse error
-
getChildren
Returns any direct children of a TfcatObject that are themselves TfcatObjects. The relationship depends a bit on the object type, but traversing the tree in this way will get you all the TfcatObjects it contains.- Parameters:
tfcat
- parent- Returns:
- children
-
getAllGeometries
Returns all the Geometries that are descendents of a given TFCat object, including itself if applicable.- Parameters:
tfcat
- root- Returns:
- all geometries in tree
-
getAllPositions
Returns all the Position objects contained in a TFCat object and its descendents.- Parameters:
tfcat
- TFCat object- Returns:
- all contained positions
-
checkBoundingBoxes
Performs a global check for a given TfcatObject that any positions listed are within the bounding boxes in whose scope they appear.- Parameters:
reporter
- error message destinationtfcat
- TFCat object
-
getCrsInScope
Returns a CRS object applying to the given TFCat object. This may exist on the object itself or on one of its ancestors. The return value may be null, but probably ought not to be for a legal TFCat object.- Parameters:
tfcat
- target object- Returns:
- CRS object, may be null
-
getBboxInScope
Returns a Bounding Box objecct applying to the given TFCat object. This may exist on the object itself or on one of its ancestors.- Parameters:
tfcat
- target object- Returns:
- Bbox object, may be null
-
checkCrs
Ensure that CRS objects are in place for the tree rooted at the given TFCat Object. Usually that will mean that the given object has a CRS object of its own, but as long as all of its Geometry descendants have CRS objects in scope, it's OK. If CRS objects are missing, a message is written to the reporter.- Parameters:
reporter
- message destinationtfcat
- object to check
-
checkOption
Checks whether a given token is in a supplied list of valid options. No special handling is performed for null values.- Parameters:
reporter
- destination for reports if token is not validtoken
- token to testoptions
- valid token values
-
getUcdChecker
Returns a syntax checker for UCDs.- Returns:
- UCD checker
-
getUnitChecker
Returns a syntax checker for VOUnits.- Returns:
- unit checker
-