All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class edu.vt.marian.Document.MarcVarField

java.lang.Object
   |
   +----edu.vt.marian.Document.MarcVarField

public class MarcVarField
extends Object
A "variable field" in a US MARC record. The user can assume a variable field is composed of an integer id, two one-character indicators and at least one subfield.


Variable Index

 o debug
just used for debugging
 o id
The USMARC field id.
 o indicator1
Indicator characters: see MARC documentation.
 o indicator2
 o subfield_separator
the USMARC tape format subfield separator character.
 o subfields
all the subfields of this variable field
 o xmlMap
Device for mapping ANSEL (and some ASCII) characters to XML entities.

Constructor Index

 o MarcVarField(int, EntityMap, Debug)
Create a MarcVarField object from a field ID and a segment of a MARC tape format record.

Method Index

 o getID()
return the id of this object
 o getIndicators()
return the indicators of this object
 o getNumberSubfields()
return the number of subfields in this object
 o getSubfieldByIndex(int)
return the indexth subfield of this object
 o getSubfieldsByLabel(char)
return all the subfields in this object with the specified label
 o presentAsTapeFormat(BufferedWriter)
Send this to an output stream in the form of OAI XML.
 o presentAsXml(BufferedWriter)
Send this to an output stream in the form of OAI XML.
 o setFromTapeFormat(String)
Set this object from a segment of a MARC tape format record.
 o setFromXml(BufferedReader)
Set this object from an OA XML MARC string.
 o setIndicators(char, char)

Variables

 o id
 protected int id
The USMARC field id.

 o indicator1
 protected char indicator1
Indicator characters: see MARC documentation.

 o indicator2
 protected char indicator2
 o subfield_separator
 protected static final String subfield_separator
the USMARC tape format subfield separator character.

 o subfields
 protected Vector subfields
all the subfields of this variable field

 o debug
 protected Debug debug
just used for debugging

 o xmlMap
 protected EntityMap xmlMap
Device for mapping ANSEL (and some ASCII) characters to XML entities.

Constructors

 o MarcVarField
 public MarcVarField(int fieldId,
                     EntityMap xMap,
                     Debug dbg)
Create a MarcVarField object from a field ID and a segment of a MARC tape format record.

Parameters:
id - --- this will be the id of this object
tapeFormat - -- this string contains the indicators and all the subfields in US MARC tape format.
debug - -- used for debugging

Methods

 o setIndicators
 public void setIndicators(char ind1,
                           char ind2)
 o setFromTapeFormat
 public int setFromTapeFormat(String tapeFormat)
Set this object from a segment of a MARC tape format record.

Parameters:
tapeFormat - -- this string contains all the subfields in US MARC tape format.
debug - -- used for debugging
 o setFromXml
 public int setFromXml(BufferedReader in) throws IOException
Set this object from an OA XML MARC string.

Parameters:
in - -- a BufferedReader containing the contents of a VarField (i.e., all the subfields but not the initial tag) in OA XML format.
Returns:
OK -- everything jake.
IO_ERROR or PARSE_ERROR -- problems.

NOTE: Expects opening tag to already be read; eats closing tag.

 o presentAsTapeFormat
 public int presentAsTapeFormat(BufferedWriter out) throws IOException
Send this to an output stream in the form of OAI XML.

Parameters:
out - -- a BufferedWriter (String or InputStream, presumably) to which to write the next record in OA_MARC XML format.
Returns:
OK -- everything jake.
INVALID_INPUT or PARSE_ERROR -- problems.
 o presentAsXml
 public int presentAsXml(BufferedWriter out) throws IOException
Send this to an output stream in the form of OAI XML.

Parameters:
out - -- a BufferedWriter (String or InputStream, presumably) to which to write the next record in OA_MARC XML format.
Returns:
OK -- everything jake.
INVALID_INPUT or PARSE_ERROR -- problems.
 o getID
 public int getID()
return the id of this object

Returns:
the id of this object as an integer
 o getNumberSubfields
 public int getNumberSubfields()
return the number of subfields in this object

Returns:
the number of subfields in this object as an integer
 o getSubfieldByIndex
 public MarcSubField getSubfieldByIndex(int index)
return the indexth subfield of this object

Parameters:
index - -- used to search the subfields vector
Returns:
a MarcSubField object or null if the index is not invalid
 o getSubfieldsByLabel
 public Vector getSubfieldsByLabel(char label)
return all the subfields in this object with the specified label

Parameters:
label - -- used to search the subfields vector
Returns:
a vector containing all the subfields in this object that have the specified label.
 o getIndicators
 public String getIndicators()
return the indicators of this object

Returns:
the indicators of this object as a string

All Packages  Class Hierarchy  This Package  Previous  Next  Index