Class TopcatCodec2
java.lang.Object
uk.ac.starlink.topcat.TopcatCodec2
- All Implemented Interfaces:
TopcatCodec
Second version of TopcatCodec implementation.
This defines a different serialization format to the older
TopcatCodec1,
and unlike that, this one stores the algebraic expressions
etc for algebraically-defined columns and subsets,
as well as the definition of some other RowSubset variants
like ones based on other subsets or columns.
It can thus preserve state better and also requires less storage.- Since:
- 6 Sep 2017
- Author:
- Mark Taylor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondecode(uk.ac.starlink.table.StarTable table, String location, ControlWindow controlWindow) uk.ac.starlink.table.StarTableencode(TopcatModel tcModel, boolean withGlobals) Turns a TopcatModel into a StarTable, ready for serialization.booleanisEncoded(uk.ac.starlink.table.StarTable table) Indicates whether a given table is a candidate for this codec'sdecodemethod.
-
Constructor Details
-
TopcatCodec2
public TopcatCodec2()
-
-
Method Details
-
encode
Description copied from interface:TopcatCodecTurns a TopcatModel into a StarTable, ready for serialization. Optionally, the output table may include global information associated with the state of the application as a whole alongside state specific to the provided TopcatModel.- Specified by:
encodein interfaceTopcatCodec- Parameters:
tcModel- modelwithGlobals- if true, include global state in the output- Returns:
- table
-
isEncoded
public boolean isEncoded(uk.ac.starlink.table.StarTable table) Description copied from interface:TopcatCodecIndicates whether a given table is a candidate for this codec'sdecodemethod. It should in general return true for a table that has been returned from this object'sencodemethod (possibly following a table write/read cycle) and false for other tables.- Specified by:
isEncodedin interfaceTopcatCodec- Parameters:
table- data+metadata table- Returns:
- true iff it looks like the table was written by this codec and can be decoded by it
-
decode
public TopcatModel decode(uk.ac.starlink.table.StarTable table, String location, ControlWindow controlWindow) Description copied from interface:TopcatCodecTakes a table which has been previously serialized by calling this codec'sencodemethod, and for which theisEncodedmethod returns true, and turns it into a TopcatModel. If decoding fails, null is returned.If used with a ControlWindow that users may be interacting with, this method should be called from the AWT event dispatch thread. This method may (for instance during testing) be called with a null value for the
controlWindowparameter, but the resulting TopcatModel may not be suitable for all kinds of user interactions.- Specified by:
decodein interfaceTopcatCodec- Parameters:
table- encoded tablelocation- table location stringcontrolWindow- control window, or null if necessary- Returns:
- topcat model, or null
-