Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a format definition for the output of the MoSS software
Signed-off-by: Rajarshi Guha <rajarshi.guha@gmail.com>
- Loading branch information
Showing
3 changed files
with
141 additions
and
0 deletions.
There are no files selected for viewing
106 changes: 106 additions & 0 deletions
106
src/main/org/openscience/cdk/io/formats/MoSSOutputFormat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
/* Copyright (C) 2010 Egon Willighagen <egonw@users.sf.net> | ||
* | ||
* Contact: cdk-devel@lists.sourceforge.net | ||
* | ||
* This program is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU Lesser General Public License as published by the Free | ||
* Software Foundation; either version 2.1 of the License, or (at your option) | ||
* any later version. All we ask is that proper credit is given for our work, | ||
* which includes - but is not limited to - adding the above copyright notice to | ||
* the beginning of your source code files, and to any copyright notice that you | ||
* may distribute with programs based on this work. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | ||
* details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program; if not, write to the Free Software Foundation, Inc., | ||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
package org.openscience.cdk.io.formats; | ||
|
||
import org.openscience.cdk.annotations.TestClass; | ||
import org.openscience.cdk.annotations.TestMethod; | ||
import org.openscience.cdk.tools.DataFeatures; | ||
|
||
/** | ||
* @cdk.module ioformats | ||
* @cdk.githash | ||
* @cdk.set io-formats | ||
*/ | ||
@TestClass("org.openscience.cdk.io.formats.MoSSOutputFormatTest") | ||
public class MoSSOutputFormat implements IChemFormatMatcher { | ||
|
||
private static IResourceFormat myself = null; | ||
|
||
private MoSSOutputFormat() {} | ||
|
||
/** {@inheritDoc} */ | ||
@TestMethod("testResourceFormatSet") | ||
public static IResourceFormat getInstance() { | ||
if (myself == null) myself = new MoSSOutputFormat(); | ||
return myself; | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@TestMethod("testGetFormatName") | ||
public String getFormatName() { | ||
return "MoSS Output Format"; | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@TestMethod("testGetMIMEType") | ||
public String getMIMEType() { | ||
return "text/csv"; | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@TestMethod("testGetPreferredNameExtension") | ||
public String getPreferredNameExtension() { | ||
return getNameExtensions()[0]; | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@TestMethod("testGetNameExtensions") | ||
public String[] getNameExtensions() { | ||
return new String[]{"mossoutput"}; | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@TestMethod("testGetReaderClassName") | ||
public String getReaderClassName() { | ||
return null; | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@TestMethod("testGetWriterClassName") | ||
public String getWriterClassName() { return null; } | ||
|
||
/** {@inheritDoc} */ | ||
public boolean matches(int lineNumber, String line) { | ||
if (lineNumber == 1 && line.equals("id,description,nodes,edges,s_abs,s_rel,c_abs,c_rel")) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@TestMethod("testIsXMLBased") | ||
public boolean isXMLBased() { | ||
return false; | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@TestMethod("testGetSupportedDataFeatures") | ||
public int getSupportedDataFeatures() { | ||
return DataFeatures.HAS_GRAPH_REPRESENTATION; | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@TestMethod("testGetRequiredDataFeatures") | ||
public int getRequiredDataFeatures() { | ||
return DataFeatures.HAS_GRAPH_REPRESENTATION; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/test/org/openscience/cdk/io/formats/MoSSOutputFormatTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* Copyright (C) 2010 Egon Willighagen <egonw@users.sf.net> | ||
* | ||
* Contact: cdk-devel@slists.sourceforge.net | ||
* | ||
* This program is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU Lesser General Public License as published by the Free | ||
* Software Foundation; either version 2.1 of the License, or (at your option) | ||
* any later version. All we ask is that proper credit is given for our work, | ||
* which includes - but is not limited to - adding the above copyright notice to | ||
* the beginning of your source code files, and to any copyright notice that you | ||
* may distribute with programs based on this work. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | ||
* details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program; if not, write to the Free Software Foundation, Inc., | ||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
package org.openscience.cdk.io.formats; | ||
|
||
/** | ||
* @cdk.module test-ioformats | ||
*/ | ||
public class MoSSOutputFormatTest extends ChemFormatMatcherTest { | ||
|
||
public MoSSOutputFormatTest() { | ||
super.setChemFormatMatcher((IChemFormatMatcher)MoSSOutputFormat.getInstance()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters