1*04ea5bd4SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*04ea5bd4SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*04ea5bd4SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*04ea5bd4SAndrew Rist  * distributed with this work for additional information
6*04ea5bd4SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*04ea5bd4SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*04ea5bd4SAndrew Rist  * "License"); you may not use this file except in compliance
9*04ea5bd4SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*04ea5bd4SAndrew Rist  *
11*04ea5bd4SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*04ea5bd4SAndrew Rist  *
13*04ea5bd4SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*04ea5bd4SAndrew Rist  * software distributed under the License is distributed on an
15*04ea5bd4SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*04ea5bd4SAndrew Rist  * KIND, either express or implied.  See the License for the
17*04ea5bd4SAndrew Rist  * specific language governing permissions and limitations
18*04ea5bd4SAndrew Rist  * under the License.
19*04ea5bd4SAndrew Rist  *
20*04ea5bd4SAndrew Rist  *************************************************************/
21*04ea5bd4SAndrew Rist 
22*04ea5bd4SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir /*
25cdf0e10cSrcweir  * SimplePdbCompare.java
26cdf0e10cSrcweir  *
27cdf0e10cSrcweir  * Created on September 21, 2001, 10:23 AM
28cdf0e10cSrcweir  */
29cdf0e10cSrcweir 
30cdf0e10cSrcweir /**
31cdf0e10cSrcweir  *
32cdf0e10cSrcweir  * @author  mh101528
33cdf0e10cSrcweir  * @version
34cdf0e10cSrcweir  */
35cdf0e10cSrcweir public final class SimplePdbCompare {
36cdf0e10cSrcweir 
37cdf0e10cSrcweir     /** Creates new SimplePdbCompare */
SimplePdbCompare()38cdf0e10cSrcweir     public SimplePdbCompare() {
39cdf0e10cSrcweir     }
40cdf0e10cSrcweir 
41cdf0e10cSrcweir     /**
42cdf0e10cSrcweir     * @param args the command line arguments
43cdf0e10cSrcweir     */
main(String args[])44cdf0e10cSrcweir     public static void main (String args[])
45cdf0e10cSrcweir     {
46cdf0e10cSrcweir         SimplePdbCompare comparator = new SimplePdbCompare();
47cdf0e10cSrcweir         if (comparator.comparePDB(args[0], args[1]))
48cdf0e10cSrcweir             System.exit(2);
49cdf0e10cSrcweir         else
50cdf0e10cSrcweir             System.exit(3);
51cdf0e10cSrcweir     }
52cdf0e10cSrcweir 
comparePDB(String pdbname1, String pdbname2)53cdf0e10cSrcweir     public boolean  comparePDB(String pdbname1, String pdbname2)
54cdf0e10cSrcweir     {
55cdf0e10cSrcweir         PalmDB pdb1=null, pdb2=null;
56cdf0e10cSrcweir         PDBDecoder decoder = new PDBDecoder();
57cdf0e10cSrcweir         try
58cdf0e10cSrcweir         {
59cdf0e10cSrcweir             pdb1 = decoder.parse(pdbname1);
60cdf0e10cSrcweir         }
61cdf0e10cSrcweir         catch (Exception e)
62cdf0e10cSrcweir         {
63cdf0e10cSrcweir             System.out.println("Could not parse PDB " + pdbname1);
64cdf0e10cSrcweir             return false;
65cdf0e10cSrcweir         }
66cdf0e10cSrcweir 
67cdf0e10cSrcweir         try
68cdf0e10cSrcweir         {
69cdf0e10cSrcweir             pdb2 = decoder.parse(pdbname2);
70cdf0e10cSrcweir         }
71cdf0e10cSrcweir         catch (Exception e)
72cdf0e10cSrcweir         {
73cdf0e10cSrcweir             System.out.println("Could not parse PDB " + pdbname2);
74cdf0e10cSrcweir             return false;
75cdf0e10cSrcweir         }
76cdf0e10cSrcweir 
77cdf0e10cSrcweir         if (pdb1.equals(pdb2))
78cdf0e10cSrcweir         {
79cdf0e10cSrcweir             //writeToLog("PDB " + pdbname1 + "  and PDB " + pdbname2 + " are equal");
80cdf0e10cSrcweir             System.out.println("PDB " + pdbname1 + "  and PDB " + pdbname2 + " are equal");
81cdf0e10cSrcweir             return true;
82cdf0e10cSrcweir         }
83cdf0e10cSrcweir         else
84cdf0e10cSrcweir         {
85cdf0e10cSrcweir             //writeToLog("PDB " + pdbname1 + "  and PDB " + pdbname2 + " are not equal");
86cdf0e10cSrcweir             System.out.println("PDB " + pdbname1 + "  and PDB " + pdbname2 + " are not equal");
87cdf0e10cSrcweir             return false;
88cdf0e10cSrcweir         }
89cdf0e10cSrcweir     }
90cdf0e10cSrcweir }
91