Skip to content

Commit

Permalink
Equality testing of IChemFormatMatchers, now different instances can …
Browse files Browse the repository at this point in the history
…be created they should implement hashcode and equals.

Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
  • Loading branch information
johnmay authored and egonw committed Jul 31, 2013
1 parent 69a4c0d commit 18d5e2a
Show file tree
Hide file tree
Showing 96 changed files with 176 additions and 102 deletions.
2 changes: 1 addition & 1 deletion src/main/org/openscience/cdk/io/formats/ABINITFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.ABINITFormatTest")
public class ABINITFormat implements IChemFormatMatcher {
public class ABINITFormat extends AbstractResourceFormat implements IChemFormatMatcher {

private static IResourceFormat myself = null;

Expand Down
2 changes: 1 addition & 1 deletion src/main/org/openscience/cdk/io/formats/ADFFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.ADFFormatTest")
public class ADFFormat implements IChemFormatMatcher {
public class ADFFormat extends AbstractResourceFormat implements IChemFormatMatcher {

private static IResourceFormat myself = null;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright (c) 2013. John May <jwmay@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 U
*/

package org.openscience.cdk.io.formats;

import org.openscience.cdk.annotations.TestMethod;

/**
* An abstract class providing {@link #hashCode()} and {@link #equals} for
* {@link org.openscience.cdk.io.formats.IResourceFormat}s. As {@link
* IResourceFormat}s are stateless this implementation uses the class for
* equality testing.
*
* @author John May
* @cdk.module ioformats
*/
public abstract class AbstractResourceFormat implements IResourceFormat {

@TestMethod("testHashCode")
@Override public int hashCode() {
return getClass().hashCode();
}

@TestMethod("testEquals,testEquals_null")
@Override public boolean equals(Object that) {
return that != null && this.getClass().equals(that.getClass());
}
}
2 changes: 1 addition & 1 deletion src/main/org/openscience/cdk/io/formats/Aces2Format.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.Aces2FormatTest")
public class Aces2Format implements IChemFormatMatcher {
public class Aces2Format extends AbstractResourceFormat implements IChemFormatMatcher {

private static IResourceFormat myself = null;

Expand Down
2 changes: 1 addition & 1 deletion src/main/org/openscience/cdk/io/formats/AlchemyFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.AlchemyFormatTest")
public class AlchemyFormat implements IChemFormat {
public class AlchemyFormat extends AbstractResourceFormat implements IChemFormat {

private static IResourceFormat myself = null;

Expand Down
2 changes: 1 addition & 1 deletion src/main/org/openscience/cdk/io/formats/BGFFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.BGFFormatTest")
public class BGFFormat implements IChemFormat {
public class BGFFormat extends AbstractResourceFormat implements IChemFormat {

private static IResourceFormat myself = null;

Expand Down
2 changes: 1 addition & 1 deletion src/main/org/openscience/cdk/io/formats/BSFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.BSFormatTest")
public class BSFormat implements IChemFormat {
public class BSFormat extends AbstractResourceFormat implements IChemFormat {

private static IResourceFormat myself = null;

Expand Down
2 changes: 1 addition & 1 deletion src/main/org/openscience/cdk/io/formats/CACheFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.CACheFormatTest")
public class CACheFormat implements IChemFormatMatcher {
public class CACheFormat extends AbstractResourceFormat implements IChemFormatMatcher {

private static IResourceFormat myself = null;

Expand Down
2 changes: 1 addition & 1 deletion src/main/org/openscience/cdk/io/formats/CDKOWLFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.CDKOWLFormatTest")
public class CDKOWLFormat implements IChemFormatMatcher {
public class CDKOWLFormat extends AbstractResourceFormat implements IChemFormatMatcher {

private static IResourceFormat myself = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.CDKSourceCodeFormatTest")
public class CDKSourceCodeFormat implements IChemFormat {
public class CDKSourceCodeFormat extends AbstractResourceFormat implements IChemFormat {

private static IResourceFormat myself = null;

Expand Down
2 changes: 1 addition & 1 deletion src/main/org/openscience/cdk/io/formats/CIFFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.CIFFormatTest")
public class CIFFormat implements IChemFormatMatcher {
public class CIFFormat extends AbstractResourceFormat implements IChemFormatMatcher {

private static IResourceFormat myself = null;

Expand Down
2 changes: 1 addition & 1 deletion src/main/org/openscience/cdk/io/formats/CMLFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.CMLFormatTest")
public class CMLFormat implements IChemFormatMatcher {
public class CMLFormat extends AbstractResourceFormat implements IChemFormatMatcher {

private static IResourceFormat myself = null;

Expand Down
2 changes: 1 addition & 1 deletion src/main/org/openscience/cdk/io/formats/CMLRSSFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.CMLRSSFormatTest")
public class CMLRSSFormat implements IChemFormat {
public class CMLRSSFormat extends AbstractResourceFormat implements IChemFormat {

private static IResourceFormat myself = null;

Expand Down
2 changes: 1 addition & 1 deletion src/main/org/openscience/cdk/io/formats/CRK2DFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.CRK2DFormatTest")
public class CRK2DFormat implements IChemFormat {
public class CRK2DFormat extends AbstractResourceFormat implements IChemFormat {

private static IResourceFormat myself = null;

Expand Down
2 changes: 1 addition & 1 deletion src/main/org/openscience/cdk/io/formats/CRK3DFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.CRK3DFormatTest")
public class CRK3DFormat implements IChemFormat {
public class CRK3DFormat extends AbstractResourceFormat implements IChemFormat {

private static IResourceFormat myself = null;

Expand Down
2 changes: 1 addition & 1 deletion src/main/org/openscience/cdk/io/formats/CTXFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.CTXFormatTest")
public class CTXFormat implements IChemFormatMatcher {
public class CTXFormat extends AbstractResourceFormat implements IChemFormatMatcher {

private static IResourceFormat myself = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.CacaoCartesianFormatTest")
public class CacaoCartesianFormat implements IChemFormat {
public class CacaoCartesianFormat extends AbstractResourceFormat implements IChemFormat {

private static IResourceFormat myself = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.CacaoInternalFormatTest")
public class CacaoInternalFormat implements IChemFormat {
public class CacaoInternalFormat extends AbstractResourceFormat implements IChemFormat {

private static IResourceFormat myself = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.Chem3D_Cartesian_1FormatTest")
public class Chem3D_Cartesian_1Format implements IChemFormat {
public class Chem3D_Cartesian_1Format extends AbstractResourceFormat implements IChemFormat {

private static IResourceFormat myself = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.Chem3D_Cartesian_2FormatTest")
public class Chem3D_Cartesian_2Format implements IChemFormat {
public class Chem3D_Cartesian_2Format extends AbstractResourceFormat implements IChemFormat {

private static IResourceFormat myself = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.ChemDrawFormatTest")
public class ChemDrawFormat implements IChemFormat {
public class ChemDrawFormat extends AbstractResourceFormat implements IChemFormat {

private static IResourceFormat myself = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.ChemtoolFormatTest")
public class ChemtoolFormat implements IChemFormat {
public class ChemtoolFormat extends AbstractResourceFormat implements IChemFormat {

private static IResourceFormat myself = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.CrystClustFormatTest")
public class CrystClustFormat implements IChemFormatMatcher {
public class CrystClustFormat extends AbstractResourceFormat implements IChemFormatMatcher {

private static IResourceFormat myself = null;

Expand Down
2 changes: 1 addition & 1 deletion src/main/org/openscience/cdk/io/formats/DMol3Format.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.DMol3FormatTest")
public class DMol3Format implements IChemFormat {
public class DMol3Format extends AbstractResourceFormat implements IChemFormat {

private static IResourceFormat myself = null;

Expand Down
2 changes: 1 addition & 1 deletion src/main/org/openscience/cdk/io/formats/DOCK5Format.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.DOCK5FormatTest")
public class DOCK5Format implements IChemFormat {
public class DOCK5Format extends AbstractResourceFormat implements IChemFormat {

private static IResourceFormat myself = null;

Expand Down
2 changes: 1 addition & 1 deletion src/main/org/openscience/cdk/io/formats/DaltonFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.DaltonFormatTest")
public class DaltonFormat implements IChemFormatMatcher {
public class DaltonFormat extends AbstractResourceFormat implements IChemFormatMatcher {

private static IResourceFormat myself = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.FenskeHall_ZMatrixFormatTest")
public class FenskeHall_ZMatrixFormat implements IChemFormat {
public class FenskeHall_ZMatrixFormat extends AbstractResourceFormat implements IChemFormat {

private static IResourceFormat myself = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.FingerprintFormatTest")
public class FingerprintFormat implements IChemFormat {
public class FingerprintFormat extends AbstractResourceFormat implements IChemFormat {

private static IResourceFormat myself = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.GROMOS96FormatTest")
public class GROMOS96Format implements IChemFormat {
public class GROMOS96Format extends AbstractResourceFormat implements IChemFormat {

private static IResourceFormat myself = null;

Expand Down
2 changes: 1 addition & 1 deletion src/main/org/openscience/cdk/io/formats/GamessFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.GamessFormatTest")
public class GamessFormat implements IChemFormatMatcher {
public class GamessFormat extends AbstractResourceFormat implements IChemFormatMatcher {

private static IResourceFormat myself = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.Gaussian03FormatTest")
public class Gaussian03Format implements IChemFormatMatcher {
public class Gaussian03Format extends AbstractResourceFormat implements IChemFormatMatcher {

private static IResourceFormat myself = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.Gaussian90FormatTest")
public class Gaussian90Format implements IChemFormatMatcher {
public class Gaussian90Format extends AbstractResourceFormat implements IChemFormatMatcher {

private static IResourceFormat myself = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.Gaussian92FormatTest")
public class Gaussian92Format implements IChemFormatMatcher {
public class Gaussian92Format extends AbstractResourceFormat implements IChemFormatMatcher {

private static IResourceFormat myself = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.Gaussian94FormatTest")
public class Gaussian94Format implements IChemFormatMatcher {
public class Gaussian94Format extends AbstractResourceFormat implements IChemFormatMatcher {

private static IResourceFormat myself = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.Gaussian95FormatTest")
public class Gaussian95Format implements IChemFormatMatcher {
public class Gaussian95Format extends AbstractResourceFormat implements IChemFormatMatcher {

private static IResourceFormat myself = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.Gaussian98FormatTest")
public class Gaussian98Format implements IChemFormatMatcher {
public class Gaussian98Format extends AbstractResourceFormat implements IChemFormatMatcher {

private static IResourceFormat myself = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.GaussianInputFormatTest")
public class GaussianInputFormat implements IChemFormat {
public class GaussianInputFormat extends AbstractResourceFormat implements IChemFormat {

private static IResourceFormat myself = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.GhemicalMMFormatTest")
public class GhemicalMMFormat implements IChemFormatMatcher {
public class GhemicalMMFormat extends AbstractResourceFormat implements IChemFormatMatcher {

private static IResourceFormat myself = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* @cdk.set io-formats
*/
@TestClass("org.openscience.cdk.io.formats.GhemicalSPMFormatTest")
public class GhemicalSPMFormat implements IChemFormatMatcher {
public class GhemicalSPMFormat extends AbstractResourceFormat implements IChemFormatMatcher {

private static IResourceFormat myself = null;

Expand Down

0 comments on commit 18d5e2a

Please sign in to comment.