org.mycore.datamodel.metadata
Class MCRMetaNumber

java.lang.Object
  extended by org.mycore.datamodel.metadata.MCRMetaDefault
      extended by org.mycore.datamodel.metadata.MCRMetaNumber
All Implemented Interfaces:
Cloneable, MCRMetaInterface

public final class MCRMetaNumber
extends MCRMetaDefault

This class implements all method for handling with the MCRMetaNumber part of a metadata object. The MCRMetaNumber class present a number value in decimal format and optional a type and a measurement. The number can has the format like xxxx.xxx or xxxx,xxx. There was stored three numbers after the dot and nine befor them. Also you can store an integer.

<tag class="MCRMetaNumber" heritable="...">
<subtag type="..." xml:lang="..." measurement="...">
xxxx.xxx or xxx
</subtag>
</tag>

Version:
$Revision: 14003 $ $Date: 2008-09-16 11:45:07 +0200 (Di, 16 Sep 2008) $
Author:
Jens Kupferschmidt

Field Summary
static int MAX_DIMENSION_LENGTH
          The length of the attributes *
static int MAX_MEASUREMENT_LENGTH
           
 
Fields inherited from class org.mycore.datamodel.metadata.MCRMetaDefault
datapart, DEFAULT_DATAPART, DEFAULT_INHERITED, DEFAULT_LANG_LENGTH, DEFAULT_LANGUAGE, DEFAULT_STRING_LENGTH, DEFAULT_TYPE_LENGTH, inherited, lang, LOGGER, NL, subtag, type
 
Constructor Summary
MCRMetaNumber()
          This is the constructor.
MCRMetaNumber(String set_datapart, String set_subtag, String default_lang, int set_inherted, String set_dimension, String set_measurement, double set_number)
          This is the constructor.
MCRMetaNumber(String set_datapart, String set_subtag, String default_lang, int set_inherted, String set_dimension, String set_measurement, String set_number)
          This is the constructor.
 
Method Summary
 Object clone()
          This method make a clone of this class.
 Element createXML()
          This method create a XML stream for all data in this class, defined by the MyCoRe XML MCRNumber definition for the given subtag.
 void debug()
          This method put debug data to the logger (for the debug mode).
 String getDimension()
          This method get the dimension element.
 String getMeasurement()
          This method get the measurement element.
 double getNumber()
          This method get the number element.
 String getNumberToString()
          This method get the number element as String.
 boolean isValid()
          This method check the validation of the content of this class.
 void setDimension(String set_dimension)
          This method set the dimension, if it is null, an empty string was set to the dimension element.
 void setFromDOM(Element element)
          This method read the XML input stream part from a DOM part for the metadata of the document.
 void setMeasurement(String set_measurement)
          This method set the measurement, if it is null, an empty string was set to the measurement element.
 void setNumber(double set_number)
          This method set the number.
 void setNumber(String set_number)
          This method set the number, if it is null or not a number, a MCRException was thowed.
 
Methods inherited from class org.mycore.datamodel.metadata.MCRMetaDefault
debugDefault, decrementInherited, getDataPart, getInherited, getInheritedToString, getLang, getSubTag, getType, incrementInherited, setDataPart, setInherited, setLang, setSubTag, setType
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_DIMENSION_LENGTH

public static final int MAX_DIMENSION_LENGTH
The length of the attributes *

See Also:
Constant Field Values

MAX_MEASUREMENT_LENGTH

public static final int MAX_MEASUREMENT_LENGTH
See Also:
Constant Field Values
Constructor Detail

MCRMetaNumber

public MCRMetaNumber()
This is the constructor.
The language element was set to en . The number was set to zero, the measurement and the dimension was set to an empty string.


MCRMetaNumber

public MCRMetaNumber(String set_datapart,
                     String set_subtag,
                     String default_lang,
                     int set_inherted,
                     String set_dimension,
                     String set_measurement,
                     String set_number)
              throws MCRException
This is the constructor.
The language element was set. If the value of default_lang is null, empty or false en was set. The subtag element was set to the value of set_subtag. If the value of set_subtag is null or empty an exception was throwed. The dimension element was set to the value of set_dimension, if it is null, an empty string was set to the type element. The measurement element was set to the value of set_measurement, if it is null, an empty string was set to the measurement element. The number string set_number was set to the number element, if it is null or not a number, a MCRException was thowed.

Parameters:
set_datapart - the global part of the elements like 'metadata' or 'service'
set_subtag - the name of the subtag
default_lang - the default language
set_inherted - a value >= 0
set_dimension - the optional dimension string
set_measurement - the optional measurement string
set_number - the number string
Throws:
MCRException - if the set_subtag value is null or empty or if the number string is not in a number format

MCRMetaNumber

public MCRMetaNumber(String set_datapart,
                     String set_subtag,
                     String default_lang,
                     int set_inherted,
                     String set_dimension,
                     String set_measurement,
                     double set_number)
              throws MCRException
This is the constructor.
The language element was set. If the value of default_lang is null, empty or false en was set. The subtag element was set to the value of set_subtag. If the value of set_subtag is null or empty an exception was throwed. The dimension element was set to the value of set_dimension, if it is null, an empty string was set to the type element. The measurement element was set to the value of set_measurement, if it is null, an empty string was set to the measurement element. The number set_number was set to the number element.

Parameters:
set_datapart - the global part of the elements like 'metadata' or 'service'
set_subtag - the name of the subtag
default_lang - the default language
set_inherted - a value >= 0
set_dimension - the optional dimension string
set_measurement - the optional measurement string
set_number - the number value
Throws:
MCRException - if the set_subtag value is null or empty
Method Detail

setDimension

public final void setDimension(String set_dimension)
This method set the dimension, if it is null, an empty string was set to the dimension element.

Parameters:
set_dimension - the dimension string

setMeasurement

public final void setMeasurement(String set_measurement)
This method set the measurement, if it is null, an empty string was set to the measurement element.

Parameters:
set_measurement - the measurement string

setNumber

public final void setNumber(String set_number)
This method set the number, if it is null or not a number, a MCRException was thowed.

Parameters:
set_number - the number string
Throws:
MCRException - if the number string is not in a number format

setNumber

public final void setNumber(double set_number)
This method set the number.

Parameters:
set_number - the number value

getDimension

public final String getDimension()
This method get the dimension element.

Returns:
the dimension String

getMeasurement

public final String getMeasurement()
This method get the measurement element.

Returns:
the measurement String

getNumber

public final double getNumber()
This method get the number element.

Returns:
the number

getNumberToString

public final String getNumberToString()
This method get the number element as String.

Returns:
the number String

setFromDOM

public final void setFromDOM(Element element)
This method read the XML input stream part from a DOM part for the metadata of the document.

Specified by:
setFromDOM in interface MCRMetaInterface
Overrides:
setFromDOM in class MCRMetaDefault
Parameters:
element - a relevant JDOM element for the metadata

createXML

public final Element createXML()
                        throws MCRException
This method create a XML stream for all data in this class, defined by the MyCoRe XML MCRNumber definition for the given subtag.

Specified by:
createXML in interface MCRMetaInterface
Specified by:
createXML in class MCRMetaDefault
Returns:
a JDOM Element with the XML MCRNumber part
Throws:
MCRException - if the content of this class is not valid

isValid

public final boolean isValid()
This method check the validation of the content of this class. The method returns true if
  • the subtag is not null or empty
otherwise the method return false

Specified by:
isValid in interface MCRMetaInterface
Overrides:
isValid in class MCRMetaDefault
Returns:
a boolean value

clone

public final Object clone()
This method make a clone of this class.

Specified by:
clone in interface MCRMetaInterface
Specified by:
clone in class MCRMetaDefault

debug

public final void debug()
This method put debug data to the logger (for the debug mode).

Specified by:
debug in interface MCRMetaInterface
Overrides:
debug in class MCRMetaDefault