jimmc.roots
Class RootsRecord

java.lang.Object
  |
  +--jimmc.roots.RootsRecord
Direct Known Subclasses:
RootsAddress, RootsPerson, RootsSource, RootsUnion

public abstract class RootsRecord
extends java.lang.Object

RootsRecord is the generic record class from which all other record classes are derived.


Field Summary
protected  RootsBase base
           
protected  java.lang.String comment
           
protected  java.lang.String editDate
           
protected  java.lang.String key
           
protected  java.lang.String keyComment
           
protected  java.lang.String note1
           
protected  java.lang.String note2
           
protected  java.lang.String note2d
           
protected  RootsSource[] sources
           
protected  java.lang.String sourceString
           
 
Constructor Summary
RootsRecord(RootsBase base)
           
 
Method Summary
protected  boolean addNcv(Ncv nv)
           
 RootsRecord[] asArray()
          Return an array referencing this.
 boolean fieldMatches(java.lang.String fieldName, java.lang.String pattern)
          Return true if the specified field matches the given pattern.
 RootsRecord[] findListReference(RootsRecord[] list, java.lang.String numstr)
          Given a string as a number, find the item in a list for it.
 RootsRecord[] findReference(java.lang.String what)
          Find a referenced record.
 java.lang.String formatBrief(PrintOptions po)
          Format a brief listing of the record
 java.lang.String formatGedcom()
          Format this record as GEDCOM.
protected  void formatGedcomBody(java.lang.StringBuffer sb, int level)
          Format the body of the record.
protected  void formatGedcomEvent(java.lang.StringBuffer sb, int level, java.lang.String tag, jimmc.roots.RootsEvent ev)
           
protected  void formatGedcomItem(java.lang.StringBuffer sb, int level, java.lang.String tag, java.lang.String value)
           
protected  void formatGedcomKey(java.lang.StringBuffer sb, int level)
          Format the key line as GEDCOM.
protected  void formatGedcomKey(java.lang.StringBuffer sb, int level, java.lang.String tag)
          Format the key line into the specified buffer.
protected  void formatGedcomReference(java.lang.StringBuffer sb, int level, java.lang.String tag, RootsRecord ref)
          Format a reference into the specified buffer.
 java.lang.String formatKey()
          Return a key string
 void formatKey(java.lang.StringBuffer sb)
          Write the key into the buffer
 java.lang.String formatKeyLine()
          Return the key line for this record
protected  void formatLabeledItem(java.lang.StringBuffer sb, java.lang.String label, java.lang.String value)
          Given a label and one value, print them to the StringBuffer if the value is not null.
protected  void formatLabeledItem(java.lang.StringBuffer sb, java.lang.String label, java.lang.String value, java.lang.String after)
           
protected  void formatLabeledItems(java.lang.StringBuffer sb, java.lang.String label, java.lang.String value1, java.lang.String value2)
          Given a label and two values, print them to the StringBuffer if either is not null.
protected  void formatLabeledItems(java.lang.StringBuffer sb, java.lang.String label, java.lang.String value1, java.lang.String value2, java.lang.String after)
           
 java.lang.String formatMedium(PrintOptions po)
          Format a medium listing of the record
protected  void formatMultiLine(java.lang.StringBuffer sb, java.lang.String value, java.lang.String linePrefix)
           
 java.lang.String formatNcv()
          Format this record as NCV.
 void formatNcvBody(java.lang.StringBuffer sb)
          Format the remainder of this record
protected  void formatNcvItem(java.lang.StringBuffer sb, java.lang.String label, java.lang.String value)
           
abstract  java.lang.String formatNcvType()
          Format the type of this record; subclass must override
protected  void formatNote1(java.lang.StringBuffer sb, java.lang.String before, java.lang.String after)
           
abstract  java.lang.String formatOneLine(PrintOptions po)
          Format a one-line summary.
 java.lang.String[] getCtreeReferenceKeys()
          Get the keys for the records used to generate a ctree with this record as the focus.
 java.lang.String getKey()
          Get the key for this record.
protected  void layoutBox(Layout layout, PrintOptions po, java.lang.String markKey)
          Add a single box to the layout for this record.
protected  void layoutBoxReference(Layout layout, PrintOptions po, java.lang.String reference)
          Add boxes for the referenced items.
 void layoutCtree(Layout layout, PrintOptions po)
          Add our Ctree information to the layout for this record and for all other records required for the ctree layout using this record as the root.
protected  void link()
          Fix up the links in a record that point to another record.
protected  void parseDate(jimmc.roots.RootsEvent d, java.lang.String m)
          Parse a single date, give error message if bad.
protected  void parseDates()
          Check and parse any dates in this record into individual fields.
 void println(java.lang.String s)
          Print a line of text to the output stream associated with our base.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

base

protected RootsBase base

key

protected java.lang.String key

keyComment

protected java.lang.String keyComment

editDate

protected java.lang.String editDate

note1

protected java.lang.String note1

note2

protected java.lang.String note2

note2d

protected java.lang.String note2d

comment

protected java.lang.String comment

sourceString

protected java.lang.String sourceString

sources

protected RootsSource[] sources
Constructor Detail

RootsRecord

public RootsRecord(RootsBase base)
Method Detail

getKey

public java.lang.String getKey()
Get the key for this record.

addNcv

protected boolean addNcv(Ncv nv)

link

protected void link()
Fix up the links in a record that point to another record.

parseDates

protected void parseDates()
Check and parse any dates in this record into individual fields.

parseDate

protected void parseDate(jimmc.roots.RootsEvent d,
                         java.lang.String m)
Parse a single date, give error message if bad.

formatGedcom

public java.lang.String formatGedcom()
Format this record as GEDCOM.

formatGedcomKey

protected void formatGedcomKey(java.lang.StringBuffer sb,
                               int level)
Format the key line as GEDCOM. Subclass must override to make this work.

formatGedcomBody

protected void formatGedcomBody(java.lang.StringBuffer sb,
                                int level)
Format the body of the record.

formatGedcomKey

protected void formatGedcomKey(java.lang.StringBuffer sb,
                               int level,
                               java.lang.String tag)
Format the key line into the specified buffer.

formatGedcomReference

protected void formatGedcomReference(java.lang.StringBuffer sb,
                                     int level,
                                     java.lang.String tag,
                                     RootsRecord ref)
Format a reference into the specified buffer.

formatGedcomItem

protected void formatGedcomItem(java.lang.StringBuffer sb,
                                int level,
                                java.lang.String tag,
                                java.lang.String value)

formatGedcomEvent

protected void formatGedcomEvent(java.lang.StringBuffer sb,
                                 int level,
                                 java.lang.String tag,
                                 jimmc.roots.RootsEvent ev)

formatNcv

public java.lang.String formatNcv()
Format this record as NCV.

formatKeyLine

public java.lang.String formatKeyLine()
Return the key line for this record

formatNcvType

public abstract java.lang.String formatNcvType()
Format the type of this record; subclass must override

formatNcvBody

public void formatNcvBody(java.lang.StringBuffer sb)
Format the remainder of this record

formatNcvItem

protected void formatNcvItem(java.lang.StringBuffer sb,
                             java.lang.String label,
                             java.lang.String value)

formatMultiLine

protected void formatMultiLine(java.lang.StringBuffer sb,
                               java.lang.String value,
                               java.lang.String linePrefix)

formatKey

public java.lang.String formatKey()
Return a key string

formatKey

public void formatKey(java.lang.StringBuffer sb)
Write the key into the buffer

formatLabeledItem

protected final void formatLabeledItem(java.lang.StringBuffer sb,
                                       java.lang.String label,
                                       java.lang.String value)
Given a label and one value, print them to the StringBuffer if the value is not null. If null, print nothing.

formatLabeledItem

protected final void formatLabeledItem(java.lang.StringBuffer sb,
                                       java.lang.String label,
                                       java.lang.String value,
                                       java.lang.String after)

formatLabeledItems

protected final void formatLabeledItems(java.lang.StringBuffer sb,
                                        java.lang.String label,
                                        java.lang.String value1,
                                        java.lang.String value2)
Given a label and two values, print them to the StringBuffer if either is not null. Also print a trailing space. If both null, print nothing.

formatLabeledItems

protected final void formatLabeledItems(java.lang.StringBuffer sb,
                                        java.lang.String label,
                                        java.lang.String value1,
                                        java.lang.String value2,
                                        java.lang.String after)

formatNote1

protected final void formatNote1(java.lang.StringBuffer sb,
                                 java.lang.String before,
                                 java.lang.String after)

formatOneLine

public abstract java.lang.String formatOneLine(PrintOptions po)
Format a one-line summary.

formatBrief

public java.lang.String formatBrief(PrintOptions po)
Format a brief listing of the record

formatMedium

public java.lang.String formatMedium(PrintOptions po)
Format a medium listing of the record

getCtreeReferenceKeys

public java.lang.String[] getCtreeReferenceKeys()
Get the keys for the records used to generate a ctree with this record as the focus.

layoutCtree

public void layoutCtree(Layout layout,
                        PrintOptions po)
Add our Ctree information to the layout for this record and for all other records required for the ctree layout using this record as the root.

layoutBox

protected void layoutBox(Layout layout,
                         PrintOptions po,
                         java.lang.String markKey)
Add a single box to the layout for this record.

layoutBoxReference

protected void layoutBoxReference(Layout layout,
                                  PrintOptions po,
                                  java.lang.String reference)
Add boxes for the referenced items.

findReference

public RootsRecord[] findReference(java.lang.String what)
Find a referenced record.
Parameters:
what - the name of the reference item to follow
Returns:
the referenced record, or null if not found

findListReference

public RootsRecord[] findListReference(RootsRecord[] list,
                                       java.lang.String numstr)
Given a string as a number, find the item in a list for it.
Parameters:
list - the list of records
numstr - the index number N as a string (first item is 0)
Returns:
the Nth item in the list

fieldMatches

public boolean fieldMatches(java.lang.String fieldName,
                            java.lang.String pattern)
Return true if the specified field matches the given pattern.
Parameters:
fieldName - the name of the field to match.
the - pattern to match against.

asArray

public RootsRecord[] asArray()
Return an array referencing this.
Returns:
an array of length one with this object referenced

println

public void println(java.lang.String s)
Print a line of text to the output stream associated with our base.