Class AdhocCode
java.lang.Object
uk.ac.starlink.ttools.taplint.AdhocCode
- All Implemented Interfaces:
ReportCode
ReportCode implementation which can be created at runtime.
In general, use of this class should be avoided in favour of
FixedCode (create as many new enum constants as you want)
where possible, so that static determination of possible codes
works as well as it can.- Since:
- 11 Jun 2014
- Author:
- Mark Taylor
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AdhocCodecreateCodeFromText(ReportType type, String text) Uses some hash function to generate a report code from text.static StringcreateLabelChars(Object id, int nchar) Uses some hash function to generate a fixed-length character string from a supplied object.booleangetLabel()Returns the 4-character label of this code.getType()Returns the type of this code.inthashCode()
-
Field Details
-
LABEL_LENGTH
public static final int LABEL_LENGTHRequired length of labels.- See Also:
-
-
Constructor Details
-
AdhocCode
Constructor.- Parameters:
type- report typelabel- 4-character label
-
-
Method Details
-
getType
Description copied from interface:ReportCodeReturns the type of this code.- Specified by:
getTypein interfaceReportCode- Returns:
- type
-
getLabel
Description copied from interface:ReportCodeReturns the 4-character label of this code.- Specified by:
getLabelin interfaceReportCode- Returns:
- 4-character label
-
hashCode
-
equals
-
createCodeFromText
Uses some hash function to generate a report code from text. Probably unique, but not guaranteed to be.- Parameters:
type- report typetext- message text- Returns:
- suitable message code
-
createLabelChars
-