edu.vt.marian.Document
Class MarcDocument

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

public class MarcDocument
extends java.lang.Object
implements edu.vt.marian.common.Document

this class represents a MARC document in the system.

uses the services of class(es):

designer(s): Jianxin Zhao (jxzhao@csgrad.cs.vt.edu)

implementator(s):

finished time:

known bugs:

JDK version: 1.1.5

side effects:


Field Summary
 char encoding_level
          this is the encoding level of this document
static int FIX_FIELD_PARSE_ERROR
           
static int INVALID_WEIGHT
           
 boolean is_conference
          this variable specifies whether or not this document is a conference
 java.lang.String language
          this is the language of this document
 char level
          this is the level of this document
static int LONG
           
static int NULL_ID
           
static int NULL_RAW_MARC_RECORD
           
static int NULL_STREAM
           
static int NULL_WEIGHT
           
static int OK
          those are the return values of methods of this class
static int PARSE_ID_ERROR
           
static int PARSE_YEAR_ERROR
           
 int pub_year
          this is the publish year of this document
static int SHORT
          these are the possible format levels
 char type
          this is the type of this document
 MarcRecord umr
          this is structured information of this document, in fact it's parsed from the above string
static int WRITE_ID_ERROR
           
static int WRITE_WEIGHT_ERROR
           
 
Constructor Summary
MarcDocument(java.io.BufferedReader br, edu.vt.marian.common.Debug debug)
          create a MarcDocument object from the specified stream
MarcDocument(java.lang.String rawStr, edu.vt.marian.common.Debug debug)
          create a MarcDocument object from a raw string.
 
Method Summary
 edu.vt.marian.common.DigInfObj copy()
          make a new one just like this one.
 boolean equals(MarcDocument d)
          tell whether this object and the parameter object represent the same document NOTE: At this point we are using String compare on the raw strings to determine equality.
 java.lang.String get_long_description()
          return a long description of the document this object represents
 java.lang.String get_short_description()
          return a short description (probably only one sentence) of the document it represnets
 java.lang.String getRawString()
          return the raw marc record of the document this object represents.
 boolean isValid()
          is this object valid?
 java.util.Vector presentAttributes(int markupType)
          return a Vector of metadata attributes for this document.
 java.lang.String presentFull(int markup_type)
          return a long description of the document this object represents
 java.lang.String presentShort(int markup_type)
          return a short description (probably only one sentence) of the document it represnets
 int setRawString(java.lang.String rawStr)
          set the raw marc record of the document this object represents.
 int toStream(java.io.PrintWriter pw)
          print the contents of this object to the specified stream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

umr

public MarcRecord umr
this is structured information of this document, in fact it's parsed from the above string

type

public char type
this is the type of this document

level

public char level
this is the level of this document

encoding_level

public char encoding_level
this is the encoding level of this document

pub_year

public int pub_year
this is the publish year of this document

language

public java.lang.String language
this is the language of this document

is_conference

public boolean is_conference
this variable specifies whether or not this document is a conference

SHORT

public static final int SHORT
these are the possible format levels

LONG

public static final int LONG

OK

public static final int OK
those are the return values of methods of this class

NULL_WEIGHT

public static final int NULL_WEIGHT

INVALID_WEIGHT

public static final int INVALID_WEIGHT

NULL_STREAM

public static final int NULL_STREAM

WRITE_ID_ERROR

public static final int WRITE_ID_ERROR

WRITE_WEIGHT_ERROR

public static final int WRITE_WEIGHT_ERROR

FIX_FIELD_PARSE_ERROR

public static final int FIX_FIELD_PARSE_ERROR

PARSE_YEAR_ERROR

public static final int PARSE_YEAR_ERROR

PARSE_ID_ERROR

public static final int PARSE_ID_ERROR

NULL_RAW_MARC_RECORD

public static final int NULL_RAW_MARC_RECORD

NULL_ID

public static final int NULL_ID
Constructor Detail

MarcDocument

public MarcDocument(java.io.BufferedReader br,
                    edu.vt.marian.common.Debug debug)
create a MarcDocument object from the specified stream
Parameters:
br - the stream to read out this document
debug - used for debugging

MarcDocument

public MarcDocument(java.lang.String rawStr,
                    edu.vt.marian.common.Debug debug)
create a MarcDocument object from a raw string.
Parameters:
rawStr - a (raw) string in MARC Tape Format
debug - -- used for debugging
Method Detail

isValid

public boolean isValid()
is this object valid?

equals

public boolean equals(MarcDocument d)
tell whether this object and the parameter object represent the same document

NOTE: At this point we are using String compare on the raw strings to determine equality. This obviously leaves something to be desired.

Parameters:
d - the document used to compare with this object
Returns:
true / false

copy

public edu.vt.marian.common.DigInfObj copy()
make a new one just like this one.
(Substitutes for public Object clone() until we straighten things out.)
Returns:
another MarcDocument object just like this one.

get_long_description

public java.lang.String get_long_description()
return a long description of the document this object represents
Returns:
the long description of this document as a string

presentFull

public java.lang.String presentFull(int markup_type)
return a long description of the document this object represents
Parameters:
markup_type - specifies the character set type need to be returned
Returns:
the long description of this document as a string

get_short_description

public java.lang.String get_short_description()
return a short description (probably only one sentence) of the document it represnets
Returns:
the short description of this object as a string

presentShort

public java.lang.String presentShort(int markup_type)
return a short description (probably only one sentence) of the document it represnets
Parameters:
markup_type - -- specifies the charater set type need to be returned
Returns:
the short description of this object as a string

presentAttributes

public java.util.Vector presentAttributes(int markupType)
return a Vector of metadata attributes for this document.
Parameters:
markupType - how to mark up the string returned (e.g., HTML or ASCII).
Returns:
a Vector of triples [attrName, attrType, attrValue].

toStream

public int toStream(java.io.PrintWriter pw)
print the contents of this object to the specified stream
Parameters:
pw - the stream to wtire this object
Returns:
OK -- this object has been written to the stream correctly
NULL_STREAM -- the parameter stream is null

getRawString

public java.lang.String getRawString()
return the raw marc record of the document this object represents.
Returns:
the raw marc record of this document as a string

setRawString

public int setRawString(java.lang.String rawStr)
set the raw marc record of the document this object represents.
Parameters:
rawString - this will become the new raw marc record of this document object
Returns:
OK -- the new raw marc record has been set correctly
NULL_RAW_MARC_RECORD -- the parameter is null