mesquite.lib.duties
Class FileInterpreter

java.lang.Object
  extended by mesquite.lib.MenuOwner
      extended by mesquite.lib.EmployerEmployee
          extended by mesquite.lib.MesquiteModule
              extended by mesquite.lib.duties.FileInterpreter
All Implemented Interfaces:
Commandable, Doomable, Explainable, FileDirtier, FunctionExplainable, HNode, Identifiable, Listable, Logger, MesquiteListener, Showable
Direct Known Subclasses:
FileInterpreterI, NexusFileInterpreter

public abstract class FileInterpreter
extends MesquiteModule

Superclass of file interpreting modules (e.g., NEXUS file reader/writer). Different subclasses are expected to read different data file formats. Example module: "Interpret NEXUS files" (class InterpretNexus). Example of use: see BasicFileCoordinator.


Field Summary
static int CURRENTDELIMITER
           
 int lineDelimiter
           
static int MACOSDELIMITER
           
static int UNIXDELIMITER
           
static int WINDOWSDELIMITER
           
 boolean writeOnlySelectedData
           
 boolean writeOnlySelectedTaxa
           
 
Fields inherited from class mesquite.lib.MesquiteModule
author, browserString, checkMethodsAtStartup, hiredAsDefaultInScripting, lastResult, lastResultString, logWindow, mesquiteDirectory, mesquiteDirectoryPath, mesquiteTrunk, moduleInfo, prefsDirectory, proj, textEdgeCompensationHeight, textEdgeCompensationWidth, totalFinalized, userDirectory
 
Fields inherited from class mesquite.lib.EmployerEmployee
employees, employer, startupBailOut, stringPos, suppressHireQueries, totalCreated, totalDisposed, useOtherChoices
 
Fields inherited from class mesquite.lib.MenuOwner
considerPriorities, doomed, MAXPRIORITY, menuCompositionTime, menuCompositionTime1, menuCompositionTime2, menuCompositionTime2a, menuCompositionTime2b, menuCompositionTime2c, menuCompositionTime3, menuCompositionTime4, menuCompositionTime5, menuCompositionTime6, menuCompositionTime7, menuCompositionTime8, menuCompositionTime9, menuTracing, module, parser
 
Fields inherited from interface mesquite.lib.MesquiteListener
ANNOTATION_ADDED, ANNOTATION_CHANGED, ANNOTATION_DELETED, ASSOCIATED_CHANGED, BRANCHES_REARRANGED, BRANCHLENGTHS_CHANGED, COMMAND_CANCELLED, DATA_CHANGED, ELEMENT_CHANGED, ITEMS_ADDED, NAMES_CHANGED, OBJECT_DESTROYED, PARTS_ADDED, PARTS_CHANGED, PARTS_DELETED, PARTS_MOVED, SELECTION_CHANGED, TAXA_SUBSTITUTED, TEXTFIELD_EDITED, UNKNOWN, VALUE_CHANGED
 
Fields inherited from interface mesquite.lib.HNode
MOUSEDOWN, MOUSEEXIT, MOUSEMOVE
 
Constructor Summary
FileInterpreter()
           
 
Method Summary
 boolean canExport()
          This is deprecated and should not be overridden.
 boolean canExportData(java.lang.Class dataClass)
          returns whether module can export a character data matrix of the given type.
 boolean canExportEver()
          returns whether module is able ever to export.
 boolean canExportProject(MesquiteProject project)
          returns whether module has something it can export in the project.
 boolean canImport()
          Returns whether the module can read (import) files
 boolean canImport(java.lang.Class dataClass)
          Returns whether the module can read (import) files with data of class dataClass
 boolean canImport(java.lang.String arguments)
          Returns whether the module can read (import) files considering the passed argument string (e.g., fuse)
 boolean canImport(java.lang.String arguments, java.lang.Class dataClass)
          Returns whether the module can read (import) files considering the passed argument string (e.g., fuse)
 void finishImport(ProgressIndicator progIndicator, MesquiteFile file, boolean abort)
           
 java.lang.Class getDutyClass()
          Returns duty Class the module belongs to; should be defined not by module itself but by abstract class representing duty
 java.lang.String getDutyName()
          Returns the name of the duty; set by the duty-defining library classes.
 java.lang.String getFunctionIconPath()
          returns an icon to accompany the explanation of what the module does.
 java.lang.String getLineEnding()
           
 java.lang.String getPathForExport(java.lang.String arguments, java.lang.String suggestedFileName, MesquiteString dir, MesquiteString fn)
           
 boolean isSubstantive()
          returns whether this module does substantive calculations affecting analysis results, or only a graphical/UI/input-output module
 java.lang.String preferredDataFileExtension()
           
abstract  void readFile(MesquiteProject mf, MesquiteFile mNF, java.lang.String arguments)
          reads a file using the methods of MesquiteFile and places its data into the given MesquiteProject which will already have been instantiated.
 boolean requestPrimaryChoice()
          returns whether this module is requesting to appear as a primary choice
 void saveExportedFile(java.lang.String output, java.lang.String arguments, java.lang.String suggestedFileName)
           
 void saveExportedFileWithExtension(java.lang.StringBuffer outputBuffer, java.lang.String arguments, java.lang.String suggestedFileEnding)
           
 void setLineDelimiter(int newDelimiter)
           
protected  java.lang.String stripNex(java.lang.String name)
           
 
Methods inherited from class mesquite.lib.MesquiteModule
accumulateParameters, addNEXUSBlock, alert, alert, anySubstantivePrereleases, broadCastAssignedID, changed, classFieldChanged, clearLastResult, clearResultAndLastResult, compatibleWithSystem, containerOfModule, createSupportDirectory, deleteSupportDirectory, discreetAlert, discreetAlert, dispose, disposing, doCommand, echoStringToFile, employeeOutputInvalid, employeeParametersChanged, employeeQuit, employerWithWindow, endJob, fileAboutToBeWritten, fileDirtiedByCommand, fileElementAdded, fileReadIn, finalize, findNEXUSBlock, getAppletInfo, getAuthors, getAutoSaveMacros, getBrowserManualPath, getBrowserPanel, getBuildDate, getBuildVersion, getCitation, getCommandPagePath, getCompatibilityTest, getDateReleased, getDefaultModule, getDocsPath, getExpectedPath, getExplanation, getHireSubchoice, getHTMLExplanation, getID, getIfLastEmployee, getKeywords, getManualPath, getMesquiteVersion, getModuleInfo, getName, getNameAndParameters, getNameForMenuItem, getNexusBlockTest, getNexusCommands, getNexusCommandTest, getPackageImagesPath, getPackageIntroModule, getPackagePath, getParameters, getParametersChangedNotifier, getPath, getPermanentIDString, getProject, getRootImageDirectoryPath, getRootPath, getShortClassName, getShortClassName, getSizedRootImageFilePath, getSnapshot, getSubfunctions, getSubfunctionsVector, getURLString, getUserChooseable, getVersion, getVersionInt, getVersionOfFirstRelease, getVeryShortName, getXMLPrefsVersion, iQuit, iQuit, isCorrectRootTag, isPrerelease, listEmployeeParameters, listEmployees, loadPreferences, log, log, logln, logln, loglnNoEcho, logNoEcho, makeCommand, mesquiteStartup, nameIsInstanceOf, nameMatches, offHold, okToDispose, onHold, outputInvalid, pageModule, panelGoAway, parametersChanged, parametersChanged, parseFullXMLDocument, permanentIDExists, preparePreferencesForFile, preparePreferencesForXML, processPreferencesFromFile, processPreferencesFromXML, processSingleXMLPreference, projectEstablished, quittingConditions, readNexusBlock, readNexusCommand, readUnrecognizedCommand, registerSubfunction, removeNEXUSBlock, removePaging, reportProfiling, respondToPaging, returningPage, saveLastResult, saveLastResult, saveLastResult, saveLastResult, saveLastResultString, saveLastResultString, setAutoSaveMacros, setProject, setToLastEmployee, showCitation, showHTMLSnippet, showLogWindow, showLogWindow, showManual, showMe, showWebPage, showWebPage, sorry, startJob, startProfiling, storePreferences, superStartJob, supportDirectoryPath, toString, URLinPackageIntro, windowGoAway, writeNexusCommands, xmlPrefsVersionMustMatch
 
Methods inherited from class mesquite.lib.EmployerEmployee
canHireMoreThanOnce, closeDownAllEmployees, decrementEmployeeBrowserRefreshSuppression, deferBranchPriority, employeeOfWhichEmployee, findCharacterDataEditor, findCharacterDataEditorRec, findElementManager, findEmployee, findEmployee, findEmployeeNeed, findEmployeeWithDuty, findEmployeeWithDuty, findEmployeeWithIDNumber, findEmployeeWithName, findEmployeeWithName, findEmployeeWithName, findEmployeeWithPermanentID, findEmployerWithDuty, findImmediateEmployeeWithDuty, findModelCurator, findModelCuratorRec, findModules, findModulesWithDuty, findNearestColleagueWithDuty, findNearestColleagueWithName, findNearestModuleWithDuty, findNextEmployeeWithDuty, fireEmployee, getClonableEmployeeCommand, getEmployeeNeeds, getEmployeeNeedsVector, getEmployeeReference, getEmployeeVector, getEmployer, getEmployerPath, getExplanationByWhichHired, getFileCoordinator, getHColor, getHDaughters, getHImage, getHiredAs, getHiringCommand, getHiringCondition, getHMother, getHShow, getImmediateEmployeesWithDuty, getNextEmployeeWithDuty, getNumberOfEmployees, getNumSupplements, getSearchableAsModule, getSupplementName, getTypeName, hireAllCompatibleEmployees, hireAllEmployees, hireAllOtherCompatibleEmployees, hireAllOtherEmployees, hireCompatibleEmployee, hireEmployee, hireEmployeeFromModuleInfo, hireNamedEmployee, hireNamedEmployee, hireNamedEmployee, hNodeAction, hSupplementTouched, incrementEmployeeBrowserRefreshSuppression, instantiateEmployee, instantiateModule, internalStartUp, isEmployerOf, isMacroAnchor, isPriorityFixed, listEmployees, listNeeds, makeEmployeeVector, moduleActiveWord, moveEmployeeToFront, numCompatibleModulesAvailable, numModulesAvailable, purposeOfEmployee, queryChooseModule, refreshBrowser, registerEmployeeNeed, registerEmployeeNeed, replaceCompatibleEmployee, replaceEmployee, replaceEmployeeWithNext, setHiringCommand, setPriorityFixed, setShowHiringPath, whatIsMyPurpose
 
Methods inherited from class mesquite.lib.MenuOwner
addAuxiliaryMenu, addCheckMenuItem, addCheckMenuItemToSubmenu, addItemToSubmenu, addItemToSubmenu, addLineToSubmenu, addMenuItem, addMenuItem, addMenuItem, addMenuLine, addModuleMenuItems, addSubmenu, addSubmenu, addSubmenu, addSubmenu, addSubmenu, checkMISVector, composeMenuBar, decrementMenuResetSuppression, defineMenus, deleteAllMenuItems, deleteMenuItem, destroyMenu, disposeMenuSpecifications, doom, findMenuAmongEmployers, getContainingMenuSpec, getMenu, getMenuItemSpecs, getMenuResetSuppression, getModuleWindow, getUseMenubar, incrementMenuResetSuppression, isDoomed, makeMenu, needsMenu, recomposeWindowsMenu, resetAllMenuBars, resetAllWindowsMenus, resetContainingMenuBar, setMenuResetSuppression, setMenuToUse, setModule, setModuleWindow, setUndoMenuItemEnabled, setUseMenubar, showPopUp, zeroMenuResetSuppression
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CURRENTDELIMITER

public static final int CURRENTDELIMITER
See Also:
Constant Field Values

MACOSDELIMITER

public static final int MACOSDELIMITER
See Also:
Constant Field Values

WINDOWSDELIMITER

public static final int WINDOWSDELIMITER
See Also:
Constant Field Values

UNIXDELIMITER

public static final int UNIXDELIMITER
See Also:
Constant Field Values

lineDelimiter

public int lineDelimiter

writeOnlySelectedData

public boolean writeOnlySelectedData

writeOnlySelectedTaxa

public boolean writeOnlySelectedTaxa
Constructor Detail

FileInterpreter

public FileInterpreter()
Method Detail

getDutyClass

public java.lang.Class getDutyClass()
Description copied from class: MesquiteModule
Returns duty Class the module belongs to; should be defined not by module itself but by abstract class representing duty

Specified by:
getDutyClass in class MesquiteModule

getFunctionIconPath

public java.lang.String getFunctionIconPath()
Description copied from class: MesquiteModule
returns an icon to accompany the explanation of what the module does.

Specified by:
getFunctionIconPath in interface FunctionExplainable
Overrides:
getFunctionIconPath in class MesquiteModule

requestPrimaryChoice

public boolean requestPrimaryChoice()
returns whether this module is requesting to appear as a primary choice

Overrides:
requestPrimaryChoice in class MesquiteModule

canExport

public boolean canExport()
This is deprecated and should not be overridden. The subsequent methods should be used instead.


canExportEver

public boolean canExportEver()
returns whether module is able ever to export.


canExportProject

public boolean canExportProject(MesquiteProject project)
returns whether module has something it can export in the project. Should be overridden


canExportData

public boolean canExportData(java.lang.Class dataClass)
returns whether module can export a character data matrix of the given type. Should be overridden


canImport

public boolean canImport(java.lang.Class dataClass)
Returns whether the module can read (import) files with data of class dataClass


canImport

public boolean canImport()
Returns whether the module can read (import) files


canImport

public boolean canImport(java.lang.String arguments,
                         java.lang.Class dataClass)
Returns whether the module can read (import) files considering the passed argument string (e.g., fuse)


canImport

public boolean canImport(java.lang.String arguments)
Returns whether the module can read (import) files considering the passed argument string (e.g., fuse)


readFile

public abstract void readFile(MesquiteProject mf,
                              MesquiteFile mNF,
                              java.lang.String arguments)
reads a file using the methods of MesquiteFile and places its data into the given MesquiteProject which will already have been instantiated. Recall that a MesquiteProject is not the external file on disk or server, but is rather the collection of taxa, data, trees, etc. that together typically make up the information in a NEXUS file. The external file is referred to by the MesquiteFile.


getDutyName

public java.lang.String getDutyName()
Description copied from class: MesquiteModule
Returns the name of the duty; set by the duty-defining library classes.

Overrides:
getDutyName in class MesquiteModule

getLineEnding

public java.lang.String getLineEnding()

preferredDataFileExtension

public java.lang.String preferredDataFileExtension()

stripNex

protected java.lang.String stripNex(java.lang.String name)

setLineDelimiter

public void setLineDelimiter(int newDelimiter)

isSubstantive

public boolean isSubstantive()
Description copied from class: MesquiteModule
returns whether this module does substantive calculations affecting analysis results, or only a graphical/UI/input-output module

Overrides:
isSubstantive in class MesquiteModule

finishImport

public void finishImport(ProgressIndicator progIndicator,
                         MesquiteFile file,
                         boolean abort)

saveExportedFileWithExtension

public void saveExportedFileWithExtension(java.lang.StringBuffer outputBuffer,
                                          java.lang.String arguments,
                                          java.lang.String suggestedFileEnding)

getPathForExport

public java.lang.String getPathForExport(java.lang.String arguments,
                                         java.lang.String suggestedFileName,
                                         MesquiteString dir,
                                         MesquiteString fn)

saveExportedFile

public void saveExportedFile(java.lang.String output,
                             java.lang.String arguments,
                             java.lang.String suggestedFileName)