Package weka.core
Class TechnicalInformation
- java.lang.Object
-
- weka.core.TechnicalInformation
-
- All Implemented Interfaces:
RevisionHandler
public class TechnicalInformation extends java.lang.Object implements RevisionHandler
Used for paper references in the Javadoc and for BibTex generation. Based on documentation found here: http://www.ecst.csuchico.edu/~jacobsd/bib/formats/bibtex.html BibTex examples can be found here: http://bib2web.djvuzone.org/bibtex.html- Version:
- $Revision: 1.11 $
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
TechnicalInformationHandler
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TechnicalInformation.Field
the possible fieldsstatic class
TechnicalInformation.Type
the different types of information
-
Constructor Summary
Constructors Constructor Description TechnicalInformation(TechnicalInformation.Type type)
Initializes the information with the given typeTechnicalInformation(TechnicalInformation.Type type, java.lang.String id)
Initializes the information with the given type
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(TechnicalInformation value)
adds the given information to the list of additional technical informationsTechnicalInformation
add(TechnicalInformation.Type type)
Adds an empty technical information with the given type to the list of additional informations and returns the instance.java.util.Enumeration
additional()
returns an enumeration of all the additional technical informations (if there are any)boolean
exists(TechnicalInformation.Field field)
returns TRUE if the field is stored and has a value different from the empty string.java.util.Enumeration
fields()
returns an enumeration over all the stored fieldsjava.lang.String
getID()
returns the unique ID (either the one used in creating this instance or the automatically generated one)java.lang.String
getRevision()
Returns the revision string.TechnicalInformation.Type
getType()
returns the type of this technical informationjava.lang.String
getValue(TechnicalInformation.Field field)
returns the value associated with the given field, or empty if field is not currently stored.boolean
hasAdditional()
returns true if there are further technical informations stored in thisstatic void
main(java.lang.String[] args)
Prints some examples of technical informations if there are no commandline options given.void
setValue(TechnicalInformation.Field field, java.lang.String value)
sets the value for the given field, overwrites any previously existing one.java.lang.String
toBibTex()
Returns a BibTex string representing this technical information.java.lang.String
toString()
Returns a plain-text string representing this technical information.
-
-
-
Constructor Detail
-
TechnicalInformation
public TechnicalInformation(TechnicalInformation.Type type)
Initializes the information with the given type- Parameters:
type
- the type of this information- See Also:
TechnicalInformation.Type
-
TechnicalInformation
public TechnicalInformation(TechnicalInformation.Type type, java.lang.String id)
Initializes the information with the given type- Parameters:
type
- the type of this informationid
- the unique ID (for BibTex), can be empty- See Also:
TechnicalInformation.Type
-
-
Method Detail
-
getType
public TechnicalInformation.Type getType()
returns the type of this technical information- Returns:
- the type of this information
-
getID
public java.lang.String getID()
returns the unique ID (either the one used in creating this instance or the automatically generated one)- Returns:
- the ID for this information
-
setValue
public void setValue(TechnicalInformation.Field field, java.lang.String value)
sets the value for the given field, overwrites any previously existing one.- Parameters:
field
- the field to set the value forvalue
- the value of the field
-
getValue
public java.lang.String getValue(TechnicalInformation.Field field)
returns the value associated with the given field, or empty if field is not currently stored.- Parameters:
field
- the field to retrieve the value for- Returns:
- the value associated with this field, empty if not existing
-
exists
public boolean exists(TechnicalInformation.Field field)
returns TRUE if the field is stored and has a value different from the empty string.- Parameters:
field
- the field to check- Returns:
- true if a value is stored for the field and non-empty
-
fields
public java.util.Enumeration fields()
returns an enumeration over all the stored fields- Returns:
- all currently stored fields
-
hasAdditional
public boolean hasAdditional()
returns true if there are further technical informations stored in this- Returns:
- true if there are further technical informations available
-
additional
public java.util.Enumeration additional()
returns an enumeration of all the additional technical informations (if there are any)- Returns:
- an enumeration over all additional technical informations
-
add
public void add(TechnicalInformation value)
adds the given information to the list of additional technical informations- Parameters:
value
- the information to add
-
add
public TechnicalInformation add(TechnicalInformation.Type type)
Adds an empty technical information with the given type to the list of additional informations and returns the instance.- Parameters:
type
- the type of the new information to add- Returns:
- the generated information
-
toString
public java.lang.String toString()
Returns a plain-text string representing this technical information. Note: it only returns a string based on some fields. At least AUTHOR, YEAR and TITLE are necessary.- Overrides:
toString
in classjava.lang.Object
- Returns:
- a string representation of this information
-
toBibTex
public java.lang.String toBibTex()
Returns a BibTex string representing this technical information. Note: this is just a very raw implementation, special characters need to be escaped manually for LaTeX.- Returns:
- the BibTeX representation of this information
-
getRevision
public java.lang.String getRevision()
Returns the revision string.- Specified by:
getRevision
in interfaceRevisionHandler
- Returns:
- the revision
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception
Prints some examples of technical informations if there are no commandline options given. Otherwise the information of a given TechnicalInformationHandler can be printed. Valid options are: -W classname
The classname of the TechnicalInformationHandler to print the information for -bibtex
Print the information in BibTeX format -plaintext
Print the information in plain text format- Parameters:
args
- the commandline options- Throws:
java.lang.Exception
- if the option parsing fails
-
-