Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.bdgp.apps.dagedit.dataadapter
Class GOFlatFileAdapter  view GOFlatFileAdapter download GOFlatFileAdapter.java

java.lang.Object
  extended byAbstractDataAdapter
      extended byorg.bdgp.apps.dagedit.dataadapter.GOFlatFileAdapter
All Implemented Interfaces:
DEDataAdapterI

public class GOFlatFileAdapter
extends AbstractDataAdapter
implements DEDataAdapterI


Nested Class Summary
protected static class GOFlatFileAdapter.DanglingSorter
           
private  class GOFlatFileAdapter.DefHolder
           
protected  class GOFlatFileAdapter.IDWrapper
           
private  class GOFlatFileAdapter.ParentageHolder
           
private  class GOFlatFileAdapter.TermByDefComparator
           
 
Field Summary
protected  boolean allowCycles
           
protected  boolean allowDangling
           
static char BOUNDARY_CHAR
           
protected  java.util.Vector categories
           
(package private)  java.util.Hashtable charToType
           
protected  java.lang.String comment
           
(package private)  java.lang.String currentType
           
protected static GOFlatFileAdapter.DanglingSorter danglingSorter
           
protected  org.bdgp.apps.dagedit.datamodel.TermRelationshipType defaultType
           
(package private)  java.net.URL defFilename
           
(package private)  CompoundGOFlatFileParseException exceptionHolder
           
protected static org.bdgp.apps.dagedit.datamodel.TermRelationshipType FAILED_TYPE
           
(package private)  java.util.Vector filenames
           
protected  boolean hideDownstream
           
private  DEDataAdapterI idAdapter
           
(package private)  java.util.Vector parentageList
           
protected  boolean reduceSize
           
protected  java.util.Vector relationshipTypes
           
protected static java.util.Hashtable RESERVED_SYMBOLS
           
(package private)  org.bdgp.apps.dagedit.datamodel.Term root
           
protected  boolean strictDefinition
           
protected  boolean strictParentage
           
(package private)  java.util.Stack termStack
           
(package private)  java.util.Hashtable typeToChar
           
protected static org.bdgp.apps.dagedit.datamodel.TermRelationshipType UNKNOWN_TYPE
           
protected  boolean useLegacyTypes
           
(package private)  org.bdgp.apps.dagedit.datamodel.Term writeRoot
           
 
Fields inherited from interface org.bdgp.apps.dagedit.dataadapter.DEDataAdapterI
CONFIGURE, EXPORT_TERMS, FIND_PRODUCTS, GET_HISTORY, GET_ID, IMPORT_TERMS, READ_TERMS, WRITE_TERMS
 
Constructor Summary
GOFlatFileAdapter()
           
 
Method Summary
protected  void addPath(java.lang.String path)
           
 void checkParentage(java.util.Hashtable allterms, java.util.Vector parentageList, java.net.URL filename)
           
protected static boolean contains(org.bdgp.apps.dagedit.datamodel.Term a, org.bdgp.apps.dagedit.datamodel.Term b)
           
private static boolean contains(org.bdgp.apps.dagedit.datamodel.Term a, org.bdgp.apps.dagedit.datamodel.Term b, java.util.Hashtable lookedAt)
           
protected  int countLeadingSpaces(java.lang.String line)
           
 void delegateToIDAdapter(DEDataAdapterI idAdapter)
           
protected  void discardParentageTokens(GOToken typeToken, java.lang.String id, Queue tokens)
           
protected  java.lang.String escape(java.lang.String text)
           
protected static java.lang.String escapeDefText(java.lang.String def)
           
 void exportTerms(org.bdgp.apps.dagedit.datamodel.Term term, java.util.Vector relationshipTypes, org.bdgp.apps.dagedit.datamodel.TermRelationshipType defaultType, boolean showPathToRoot)
           
private  int findStartOfDefFieldData(java.lang.String in)
           
 org.bdgp.apps.dagedit.datamodel.Term findTermInHash(org.bdgp.apps.dagedit.datamodel.Term term, java.util.Hashtable hash)
           
protected  java.lang.String formatSynonym(org.bdgp.apps.dagedit.datamodel.Synonym syn)
           
protected  java.lang.String formatSynonymForID(org.bdgp.apps.dagedit.datamodel.Synonym syn)
           
 boolean getAllowCycles()
           
 boolean getAllowDangling()
           
protected  java.lang.String getCharForRelationship(org.bdgp.apps.dagedit.datamodel.TermRelationship tr)
           
protected  java.lang.String getCharForRelationship(org.bdgp.apps.dagedit.datamodel.TermRelationshipType type)
           
protected  java.lang.String getDbxrefString(org.bdgp.apps.dagedit.datamodel.Term term)
           
protected static org.bdgp.apps.dagedit.datamodel.TermRelationshipType getDefaultTermRelationship()
           
 org.bdgp.apps.dagedit.datamodel.TermRelationshipType getDefaultType()
           
protected static java.util.Hashtable getDefaultTypeBindings()
           
 java.util.Vector getHistories()
           
 java.lang.String[] getIDs(org.bdgp.apps.dagedit.datamodel.Term root, org.bdgp.apps.dagedit.datamodel.Term term, java.lang.String prefix, int length, int count)
           
 java.lang.String[] getIDs(org.bdgp.apps.dagedit.datamodel.Term root, org.bdgp.apps.dagedit.datamodel.Term term, java.lang.String prefix, int min, int max, int length, int count)
           
protected  int getLinesInFile(java.net.URL filename)
           
 java.lang.String getName()
           
protected  java.lang.String getNChars(int n, char c)
           
protected  java.lang.String getParentString(org.bdgp.apps.dagedit.datamodel.Term term, org.bdgp.apps.dagedit.datamodel.Term parent)
           
protected  Queue getQueueForLine(java.net.URL filename, java.lang.String in, int lineNum)
           
 java.util.Vector getRelationshipTypes()
           
 org.bdgp.apps.dagedit.datamodel.DEEditHistory getRoot()
           
 org.bdgp.apps.dagedit.datamodel.Term getRoot(java.util.Hashtable allterms)
           
 java.util.Properties getStateInformation()
           
 IOOperation[] getSupportedOperations()
           
protected  java.lang.String getSynonymString(org.bdgp.apps.dagedit.datamodel.Term term, boolean id)
           
 java.util.Vector getTermCategories()
           
protected  org.bdgp.apps.dagedit.datamodel.Term getTermFromTokens(Queue tokens, java.net.URL filename, java.lang.String line, int lineNum)
           
 org.bdgp.apps.dagedit.datamodel.Term getTerms(java.util.Hashtable allterms, java.net.URL filename)
           
protected  java.lang.String getTermString(org.bdgp.apps.dagedit.datamodel.DanglingRelationship dr)
           
protected  java.lang.String getTermString(org.bdgp.apps.dagedit.datamodel.Term term)
           
 java.util.Vector getTRsForParentWithID(org.bdgp.apps.dagedit.datamodel.Term child, java.lang.String id)
           
 java.lang.String getType()
           
 DataAdapterUI getUI(IOOperation op)
           
protected  java.net.URL getURLForPath(java.lang.String path)
           
 org.bdgp.apps.dagedit.datamodel.Term importTerms(org.bdgp.apps.dagedit.datamodel.Term root, boolean stripIds)
           
 void init()
           
 void init(java.lang.Object params)
           
protected  boolean isComment(java.lang.String in)
           
protected  boolean isNextItemID(Queue tokens)
           
static boolean isReservedCharacter(char c)
           
static void main(java.lang.String[] args)
           
protected  org.bdgp.apps.dagedit.datamodel.Term parseLine(java.net.URL filename, java.lang.String line, int lineNum)
           
 void populateDefinitions(java.util.Hashtable allterms, java.net.URL filename)
           
protected static void println(java.io.PrintStream stream)
           
protected static void println(java.io.PrintStream stream, java.lang.String string)
           
protected  GOFlatFileAdapter.IDWrapper pullOffID(Queue tokens, CompoundGOFlatFileParseException exList)
           
protected  java.util.Vector pullOffIDList(Queue tokens)
           
protected  java.lang.String pullOffTerm(Queue tokens)
           
protected  java.lang.String pullOffType(Queue tokens)
           
protected  java.lang.String pullOffValues(Queue tokens)
           
 void putTermInHash(org.bdgp.apps.dagedit.datamodel.Term term, java.util.Hashtable hash)
           
 void setAllowCycles(boolean allowCycles)
           
 void setAllowDangling(boolean allowDangling)
           
 void setCharTypeMappings(java.util.Hashtable charToType, org.bdgp.apps.dagedit.datamodel.TermRelationshipType defaultType)
           
 void setComment(java.lang.String comment)
           
protected  void setDefinition(GOFlatFileAdapter.IDWrapper id, java.util.Hashtable terms, java.lang.String definition, java.lang.String comment, java.util.Vector refs, CompoundGOFlatFileParseException defExceptions, java.net.URL filename, java.lang.String startline, int startlineNumber)
           
 void setDefinitionPath(java.lang.String defFilename)
           
 void setHideDownstream(boolean hide)
           
 void setPath(java.lang.String filename)
           
 void setPath(java.util.Vector filenames)
           
 void setReduceSize(boolean reduceSize)
           
 void setStateInformation(java.util.Properties props)
           
 void setStrictDefinition(boolean strict)
           
 void setStrictParentage(boolean strict)
           
 void setUseLegacyTypes(boolean useLegacyTypes)
           
protected static java.lang.String unescapeDefText(java.lang.String def)
           
 boolean useLegacyTypes()
           
private  void wipeOutIDs(org.bdgp.apps.dagedit.datamodel.Term term)
           
 org.bdgp.apps.dagedit.datamodel.DEEditHistory write(org.bdgp.apps.dagedit.datamodel.DEEditHistory history)
           
 void write(java.lang.String filename, java.lang.String defFilename, org.bdgp.apps.dagedit.datamodel.Term root, java.util.Vector relationshipTypes, org.bdgp.apps.dagedit.datamodel.TermRelationshipType defaultType)
           
protected  void writeDef(java.io.PrintStream stream, org.bdgp.apps.dagedit.datamodel.Term term)
           
 void writeDefinitions(org.bdgp.apps.dagedit.datamodel.Term root)
           
protected  void writeDefs(java.lang.String filename, java.io.PrintStream stream, org.bdgp.apps.dagedit.datamodel.Term root)
           
protected  void writeHeader(org.bdgp.apps.dagedit.datamodel.Term root, java.util.Vector relationshipTypes, org.bdgp.apps.dagedit.datamodel.TermRelationshipType defaultType, java.io.PrintStream stream)
           
protected  void writeLineForTerm(java.io.PrintStream stream, int spaceDepth, java.lang.String leaderChar, org.bdgp.apps.dagedit.datamodel.Term term, org.bdgp.apps.dagedit.datamodel.Term currentParent, boolean treatAsRoot)
           
protected  void writeTerm(java.lang.String filename, java.io.PrintStream stream, int spaceDepth, java.lang.String leaderChar, org.bdgp.apps.dagedit.datamodel.Term term, org.bdgp.apps.dagedit.datamodel.Term currentParent, boolean treatAsRoot, java.util.Hashtable lookedAt, int termCount)
           
 void writeTypeLine(org.bdgp.apps.dagedit.datamodel.TermRelationshipType trt, java.io.PrintStream stream)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

termStack

java.util.Stack termStack

root

org.bdgp.apps.dagedit.datamodel.Term root

writeRoot

org.bdgp.apps.dagedit.datamodel.Term writeRoot

currentType

java.lang.String currentType

filenames

java.util.Vector filenames

defFilename

java.net.URL defFilename

parentageList

java.util.Vector parentageList

exceptionHolder

CompoundGOFlatFileParseException exceptionHolder

strictParentage

protected boolean strictParentage

strictDefinition

protected boolean strictDefinition

hideDownstream

protected boolean hideDownstream

allowCycles

protected boolean allowCycles

allowDangling

protected boolean allowDangling

idAdapter

private DEDataAdapterI idAdapter

FAILED_TYPE

protected static org.bdgp.apps.dagedit.datamodel.TermRelationshipType FAILED_TYPE

UNKNOWN_TYPE

protected static org.bdgp.apps.dagedit.datamodel.TermRelationshipType UNKNOWN_TYPE

defaultType

protected org.bdgp.apps.dagedit.datamodel.TermRelationshipType defaultType

RESERVED_SYMBOLS

protected static final java.util.Hashtable RESERVED_SYMBOLS

categories

protected java.util.Vector categories

relationshipTypes

protected java.util.Vector relationshipTypes

comment

protected java.lang.String comment

reduceSize

protected boolean reduceSize

useLegacyTypes

protected boolean useLegacyTypes

BOUNDARY_CHAR

public static final char BOUNDARY_CHAR
See Also:
Constant Field Values

charToType

java.util.Hashtable charToType

typeToChar

java.util.Hashtable typeToChar

danglingSorter

protected static GOFlatFileAdapter.DanglingSorter danglingSorter
Constructor Detail

GOFlatFileAdapter

public GOFlatFileAdapter()
Method Detail

isReservedCharacter

public static boolean isReservedCharacter(char c)

setReduceSize

public void setReduceSize(boolean reduceSize)

setComment

public void setComment(java.lang.String comment)

getDefaultTypeBindings

protected static java.util.Hashtable getDefaultTypeBindings()

getDefaultTermRelationship

protected static org.bdgp.apps.dagedit.datamodel.TermRelationshipType getDefaultTermRelationship()

getRelationshipTypes

public java.util.Vector getRelationshipTypes()
Specified by:
getRelationshipTypes in interface DEDataAdapterI

setAllowCycles

public void setAllowCycles(boolean allowCycles)

getAllowCycles

public boolean getAllowCycles()

setAllowDangling

public void setAllowDangling(boolean allowDangling)

getAllowDangling

public boolean getAllowDangling()

getTermCategories

public java.util.Vector getTermCategories()
                                   throws DataAdapterException
Specified by:
getTermCategories in interface DEDataAdapterI

setCharTypeMappings

public void setCharTypeMappings(java.util.Hashtable charToType,
                                org.bdgp.apps.dagedit.datamodel.TermRelationshipType defaultType)

setHideDownstream

public void setHideDownstream(boolean hide)

getIDs

public java.lang.String[] getIDs(org.bdgp.apps.dagedit.datamodel.Term root,
                                 org.bdgp.apps.dagedit.datamodel.Term term,
                                 java.lang.String prefix,
                                 int length,
                                 int count)
                          throws DataAdapterException
Specified by:
getIDs in interface DEDataAdapterI

getIDs

public java.lang.String[] getIDs(org.bdgp.apps.dagedit.datamodel.Term root,
                                 org.bdgp.apps.dagedit.datamodel.Term term,
                                 java.lang.String prefix,
                                 int min,
                                 int max,
                                 int length,
                                 int count)
                          throws DataAdapterException
Specified by:
getIDs in interface DEDataAdapterI

getHistories

public java.util.Vector getHistories()
                              throws DataAdapterException
Specified by:
getHistories in interface DEDataAdapterI

setStrictParentage

public void setStrictParentage(boolean strict)

setStrictDefinition

public void setStrictDefinition(boolean strict)

getUI

public DataAdapterUI getUI(IOOperation op)

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception

setDefinition

protected void setDefinition(GOFlatFileAdapter.IDWrapper id,
                             java.util.Hashtable terms,
                             java.lang.String definition,
                             java.lang.String comment,
                             java.util.Vector refs,
                             CompoundGOFlatFileParseException defExceptions,
                             java.net.URL filename,
                             java.lang.String startline,
                             int startlineNumber)
                      throws DataAdapterException

populateDefinitions

public void populateDefinitions(java.util.Hashtable allterms,
                                java.net.URL filename)
                         throws DataAdapterException

findStartOfDefFieldData

private int findStartOfDefFieldData(java.lang.String in)

init

public void init()

setPath

public void setPath(java.lang.String filename)

setPath

public void setPath(java.util.Vector filenames)

addPath

protected void addPath(java.lang.String path)

getURLForPath

protected java.net.URL getURLForPath(java.lang.String path)

setDefinitionPath

public void setDefinitionPath(java.lang.String defFilename)

getLinesInFile

protected int getLinesInFile(java.net.URL filename)
                      throws java.io.IOException

importTerms

public org.bdgp.apps.dagedit.datamodel.Term importTerms(org.bdgp.apps.dagedit.datamodel.Term root,
                                                        boolean stripIds)
                                                 throws DataAdapterException

wipeOutIDs

private void wipeOutIDs(org.bdgp.apps.dagedit.datamodel.Term term)

getRoot

public org.bdgp.apps.dagedit.datamodel.DEEditHistory getRoot()
                                                      throws DataAdapterException
Specified by:
getRoot in interface DEDataAdapterI

getRoot

public org.bdgp.apps.dagedit.datamodel.Term getRoot(java.util.Hashtable allterms)
                                             throws DataAdapterException

println

protected static void println(java.io.PrintStream stream)

println

protected static void println(java.io.PrintStream stream,
                              java.lang.String string)

checkParentage

public void checkParentage(java.util.Hashtable allterms,
                           java.util.Vector parentageList,
                           java.net.URL filename)
                    throws DataAdapterException

contains

protected static boolean contains(org.bdgp.apps.dagedit.datamodel.Term a,
                                  org.bdgp.apps.dagedit.datamodel.Term b)

contains

private static boolean contains(org.bdgp.apps.dagedit.datamodel.Term a,
                                org.bdgp.apps.dagedit.datamodel.Term b,
                                java.util.Hashtable lookedAt)

getTRsForParentWithID

public java.util.Vector getTRsForParentWithID(org.bdgp.apps.dagedit.datamodel.Term child,
                                              java.lang.String id)

findTermInHash

public org.bdgp.apps.dagedit.datamodel.Term findTermInHash(org.bdgp.apps.dagedit.datamodel.Term term,
                                                           java.util.Hashtable hash)

putTermInHash

public void putTermInHash(org.bdgp.apps.dagedit.datamodel.Term term,
                          java.util.Hashtable hash)

getTerms

public org.bdgp.apps.dagedit.datamodel.Term getTerms(java.util.Hashtable allterms,
                                                     java.net.URL filename)
                                              throws DataAdapterException

isComment

protected boolean isComment(java.lang.String in)

parseLine

protected org.bdgp.apps.dagedit.datamodel.Term parseLine(java.net.URL filename,
                                                         java.lang.String line,
                                                         int lineNum)
                                                  throws GOFlatFileParseException

getTermFromTokens

protected org.bdgp.apps.dagedit.datamodel.Term getTermFromTokens(Queue tokens,
                                                                 java.net.URL filename,
                                                                 java.lang.String line,
                                                                 int lineNum)
                                                          throws GOFlatFileParseException

pullOffValues

protected java.lang.String pullOffValues(Queue tokens)

discardParentageTokens

protected void discardParentageTokens(GOToken typeToken,
                                      java.lang.String id,
                                      Queue tokens)
                               throws GOFlatFileParseException

pullOffIDList

protected java.util.Vector pullOffIDList(Queue tokens)
                                  throws GOFlatFileParseException

pullOffType

protected java.lang.String pullOffType(Queue tokens)
                                throws GOFlatFileParseException

pullOffTerm

protected java.lang.String pullOffTerm(Queue tokens)

isNextItemID

protected boolean isNextItemID(Queue tokens)

pullOffID

protected GOFlatFileAdapter.IDWrapper pullOffID(Queue tokens,
                                                CompoundGOFlatFileParseException exList)
                                         throws GOFlatFileParseException

getQueueForLine

protected Queue getQueueForLine(java.net.URL filename,
                                java.lang.String in,
                                int lineNum)
                         throws GOFlatFileParseException

countLeadingSpaces

protected int countLeadingSpaces(java.lang.String line)

getName

public java.lang.String getName()

getType

public java.lang.String getType()

getSupportedOperations

public IOOperation[] getSupportedOperations()

init

public void init(java.lang.Object params)
          throws DataAdapterException

write

public org.bdgp.apps.dagedit.datamodel.DEEditHistory write(org.bdgp.apps.dagedit.datamodel.DEEditHistory history)
                                                    throws DataAdapterException
Specified by:
write in interface DEDataAdapterI

exportTerms

public void exportTerms(org.bdgp.apps.dagedit.datamodel.Term term,
                        java.util.Vector relationshipTypes,
                        org.bdgp.apps.dagedit.datamodel.TermRelationshipType defaultType,
                        boolean showPathToRoot)
                 throws DataAdapterException

getDefaultType

public org.bdgp.apps.dagedit.datamodel.TermRelationshipType getDefaultType()

write

public void write(java.lang.String filename,
                  java.lang.String defFilename,
                  org.bdgp.apps.dagedit.datamodel.Term root,
                  java.util.Vector relationshipTypes,
                  org.bdgp.apps.dagedit.datamodel.TermRelationshipType defaultType)
           throws DataAdapterException

writeDefinitions

public void writeDefinitions(org.bdgp.apps.dagedit.datamodel.Term root)
                      throws DataAdapterException

writeDefs

protected void writeDefs(java.lang.String filename,
                         java.io.PrintStream stream,
                         org.bdgp.apps.dagedit.datamodel.Term root)

unescapeDefText

protected static java.lang.String unescapeDefText(java.lang.String def)

escapeDefText

protected static java.lang.String escapeDefText(java.lang.String def)

writeDef

protected void writeDef(java.io.PrintStream stream,
                        org.bdgp.apps.dagedit.datamodel.Term term)

writeHeader

protected void writeHeader(org.bdgp.apps.dagedit.datamodel.Term root,
                           java.util.Vector relationshipTypes,
                           org.bdgp.apps.dagedit.datamodel.TermRelationshipType defaultType,
                           java.io.PrintStream stream)
                    throws DataAdapterException

writeTypeLine

public void writeTypeLine(org.bdgp.apps.dagedit.datamodel.TermRelationshipType trt,
                          java.io.PrintStream stream)
                   throws DataAdapterException

setUseLegacyTypes

public void setUseLegacyTypes(boolean useLegacyTypes)

useLegacyTypes

public boolean useLegacyTypes()

writeTerm

protected void writeTerm(java.lang.String filename,
                         java.io.PrintStream stream,
                         int spaceDepth,
                         java.lang.String leaderChar,
                         org.bdgp.apps.dagedit.datamodel.Term term,
                         org.bdgp.apps.dagedit.datamodel.Term currentParent,
                         boolean treatAsRoot,
                         java.util.Hashtable lookedAt,
                         int termCount)
                  throws DataAdapterException

writeLineForTerm

protected void writeLineForTerm(java.io.PrintStream stream,
                                int spaceDepth,
                                java.lang.String leaderChar,
                                org.bdgp.apps.dagedit.datamodel.Term term,
                                org.bdgp.apps.dagedit.datamodel.Term currentParent,
                                boolean treatAsRoot)

getDbxrefString

protected java.lang.String getDbxrefString(org.bdgp.apps.dagedit.datamodel.Term term)

getSynonymString

protected java.lang.String getSynonymString(org.bdgp.apps.dagedit.datamodel.Term term,
                                            boolean id)

formatSynonymForID

protected java.lang.String formatSynonymForID(org.bdgp.apps.dagedit.datamodel.Synonym syn)

formatSynonym

protected java.lang.String formatSynonym(org.bdgp.apps.dagedit.datamodel.Synonym syn)

getParentString

protected java.lang.String getParentString(org.bdgp.apps.dagedit.datamodel.Term term,
                                           org.bdgp.apps.dagedit.datamodel.Term parent)

getCharForRelationship

protected java.lang.String getCharForRelationship(org.bdgp.apps.dagedit.datamodel.TermRelationshipType type)

getCharForRelationship

protected java.lang.String getCharForRelationship(org.bdgp.apps.dagedit.datamodel.TermRelationship tr)

escape

protected java.lang.String escape(java.lang.String text)

delegateToIDAdapter

public void delegateToIDAdapter(DEDataAdapterI idAdapter)
Specified by:
delegateToIDAdapter in interface DEDataAdapterI

getTermString

protected java.lang.String getTermString(org.bdgp.apps.dagedit.datamodel.Term term)

getTermString

protected java.lang.String getTermString(org.bdgp.apps.dagedit.datamodel.DanglingRelationship dr)

getNChars

protected java.lang.String getNChars(int n,
                                     char c)

getStateInformation

public java.util.Properties getStateInformation()
Specified by:
getStateInformation in interface DEDataAdapterI

setStateInformation

public void setStateInformation(java.util.Properties props)
Specified by:
setStateInformation in interface DEDataAdapterI