de.hpi.fgis.dude.util.bibtex.data
Class BibtexNode

java.lang.Object
  extended by de.hpi.fgis.dude.util.bibtex.data.BibtexNode
Direct Known Subclasses:
BibtexAbstractEntry, BibtexAbstractValue, BibtexFile, BibtexPerson

public abstract class BibtexNode
extends Object

An abstract superclass for all BibTex model nodes.

Author:
henkel

Constructor Summary
protected BibtexNode(BibtexFile bibtexFile)
          Some people have asked why this constructor has a parameter of type BibtexFile (which in turn extends BibtexNode).
 
Method Summary
 BibtexFile getOwnerFile()
          Returns the owner file of this node.
abstract  void printBibtex(PrintWriter writer)
          Prints the node to the passed PrintWriter.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BibtexNode

protected BibtexNode(BibtexFile bibtexFile)
Some people have asked why this constructor has a parameter of type BibtexFile (which in turn extends BibtexNode). The reason is that each BibtexNode has a reference to the BibtexFile which it belongs to. Of course, for the file itself that pointer is null. By the way, it's unlikely that you need to call this constructor or any constructor for BibtexNodes other than BibtexFile directly - instead, use the BibtexFile as a factory. For example, to create a BibTex file equivalent of this
 ================
 @article{test1,
 author="Johannes Henkel",
 title="README"
 }
 ================
 you'd do
 
 BibtexFile bibtexFile = new BibtexFile();
 BibtexEntry onlyEntry = bibtexFile.makeEntry("article","test1");
 onlyEntry.setField("author",bibtexFile.makeString("Johannes Henkel"));
 onlyEntry.setField("title",bibtexFile.makeString("README"));
 

Parameters:
bibtexFile -
Method Detail

getOwnerFile

public BibtexFile getOwnerFile()
Returns the owner file of this node.

Returns:
The owner file of this node or null if it is not set.

printBibtex

public abstract void printBibtex(PrintWriter writer)
Prints the node to the passed PrintWriter. This method needs to be implemented by each sub-class.

Parameters:
writer - The writer that shall be used for writing the String representation of this node.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011 Hasso Plattner Institute - Chair of Information Systems. All Rights Reserved.