Package org.pathvisio.libgpml.io
Class AbstractPathwayModelFormat
java.lang.Object
org.pathvisio.libgpml.io.AbstractPathwayModelFormat
- All Implemented Interfaces:
PathwayModelExporter
,PathwayModelImporter
,PathwayModelIO
- Direct Known Subclasses:
GPMLFormat
public abstract class AbstractPathwayModelFormat extends java.lang.Object implements PathwayModelImporter, PathwayModelExporter
base implementation of PathwayImporter and PathwayExporter warnings
mechanism.
- Author:
- unknown
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<java.lang.String>
warnings
-
Constructor Summary
Constructors Constructor Description AbstractPathwayModelFormat()
-
Method Summary
Modifier and Type Method Description protected void
clearWarnings()
protected void
emitWarning(java.lang.String warning)
Can be used by overriding classes to add to the list of warnings.java.util.List<java.lang.String>
getWarnings()
After import or export, this can be used to check if there are any warningsboolean
isCorrectType(java.io.File f)
Inspects the file and determine if the file is suitable for import using this importer.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.pathvisio.libgpml.io.PathwayModelExporter
doExport, doExport
Methods inherited from interface org.pathvisio.libgpml.io.PathwayModelImporter
doImport
Methods inherited from interface org.pathvisio.libgpml.io.PathwayModelIO
getExtensions, getName
-
Field Details
-
warnings
private java.util.List<java.lang.String> warnings
-
-
Constructor Details
-
AbstractPathwayModelFormat
public AbstractPathwayModelFormat()
-
-
Method Details
-
clearWarnings
protected void clearWarnings() -
emitWarning
protected void emitWarning(java.lang.String warning)Can be used by overriding classes to add to the list of warnings. Don't forget to callclearWarnings()
at the start of conversion.- Parameters:
warning
- the warning.
-
isCorrectType
public boolean isCorrectType(java.io.File f)Description copied from interface:PathwayModelImporter
Inspects the file and determine if the file is suitable for import using this importer. For example, files ending in .xml could be examined for the local name and namespace of the root element. This function is invoked when multiple importers apply to a given file.Implementations should check the file only superficially if at all. This function is merely a "tie-breaker" in case there are conflicting importers. A return value of true doesn't automatically mean that the file is guaranteed to be valid, so no complex validation is required. For naive implementations, it's always OK to simply return "true".
- Specified by:
isCorrectType
in interfacePathwayModelImporter
- Parameters:
f
- the file to check- Returns:
- true if the file appears superficially to be of the correct file type.
-
getWarnings
public java.util.List<java.lang.String> getWarnings()Description copied from interface:PathwayModelIO
After import or export, this can be used to check if there are any warnings- Specified by:
getWarnings
in interfacePathwayModelIO
- Returns:
- a list of warning messages, or an empty list if there are none.
-