Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First pass at moving from JNA to JNI inchi - some tests need adjusting.
- Loading branch information
Showing
10 changed files
with
527 additions
and
458 deletions.
There are no files selected for viewing
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
102 changes: 102 additions & 0 deletions
102
storage/inchi/src/main/java/net/sf/jniinchi/INCHI_OPTION.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,102 @@ | ||
/* | ||
* Copyright (C) 2021 John Mayfield | ||
* | ||
* 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. | ||
* | ||
* 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 net.sf.jniinchi; | ||
|
||
import io.github.dan2097.jnainchi.InchiFlag; | ||
|
||
/** | ||
* This class provides backwards compatibility of JNA-INCHI with JNI-INCHI, this enum was exposed in the CDK API. | ||
* @author John Mayfield | ||
*/ | ||
public enum INCHI_OPTION { | ||
SUCF, | ||
ChiralFlagON, | ||
ChiralFlagOFF, | ||
SNon, | ||
SAbs, | ||
SRel, | ||
SRac, | ||
SUU, | ||
NEWPS, | ||
RecMet, | ||
FixedH, | ||
AuxNone, | ||
NoADP, | ||
Compress, | ||
DoNotAddH, | ||
Wnumber, | ||
OutputSDF, | ||
WarnOnEmptyStructure, | ||
FixSp3Bug, | ||
FB, | ||
SPXYZ, | ||
SAsXYZ; | ||
|
||
public static INCHI_OPTION wrap(InchiFlag flag) { | ||
switch (flag) { | ||
case SUCF: return SUCF; | ||
case ChiralFlagON: return ChiralFlagON; | ||
case ChiralFlagOFF: return ChiralFlagOFF; | ||
case SNon: return SNon; | ||
case SRel: return SRel; | ||
case SRac: return SRac; | ||
case SUU: return SUU; | ||
case RecMet: return RecMet; | ||
case FixedH: return FixedH; | ||
case AuxNone: return AuxNone; | ||
case DoNotAddH: return DoNotAddH; | ||
case WarnOnEmptyStructure: return WarnOnEmptyStructure; | ||
|
||
default: throw new IllegalArgumentException(flag + " not supported?"); | ||
} | ||
} | ||
|
||
public static InchiFlag wrap(INCHI_OPTION flag) { | ||
switch (flag) { | ||
case SUCF: return InchiFlag.SUCF; | ||
case ChiralFlagON: return InchiFlag.ChiralFlagON; | ||
case ChiralFlagOFF: return InchiFlag.ChiralFlagOFF; | ||
case SNon: return InchiFlag.SNon; | ||
case SRel: return InchiFlag.SRel; | ||
case SRac: return InchiFlag.SRac; | ||
case SUU: return InchiFlag.SUU; | ||
case RecMet: return InchiFlag.RecMet; | ||
case FixedH: return InchiFlag.FixedH; | ||
case AuxNone: return InchiFlag.AuxNone; | ||
case DoNotAddH: return InchiFlag.DoNotAddH; | ||
case WarnOnEmptyStructure: return InchiFlag.WarnOnEmptyStructure; | ||
default: | ||
System.err.println("Unsupported flag: " + flag); | ||
return null; | ||
} | ||
|
||
// case SAbs: return SAbs; | ||
// case NEWPS: return NEWPS; | ||
// case NoADP: return NoADP; | ||
// case Compress: return Compress; | ||
// case Wnumber: return Wnumber; | ||
// case OutputSDF: return OutputSDF; | ||
// case FixSp3Bug: return FixSp3Bug; | ||
// case FB: return FB; | ||
// case SPXYZ: return SPXYZ; | ||
// case SAsXYZ: return SAsXYZ; | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
storage/inchi/src/main/java/net/sf/jniinchi/INCHI_RET.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,48 @@ | ||
/* | ||
* Copyright (C) 2021 John Mayfield | ||
* | ||
* 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. | ||
* | ||
* 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 net.sf.jniinchi; | ||
|
||
import io.github.dan2097.jnainchi.InchiStatus; | ||
|
||
/** | ||
* This class provides backwards compatibility of JNA-INCHI with JNI-INCHI, this enum was exposed in the CDK API. | ||
* @author John Mayfield | ||
*/ | ||
public enum INCHI_RET { | ||
SKIP, | ||
EOF, | ||
OKAY, | ||
WARNING, | ||
ERROR, | ||
FATAL, | ||
UNKNOWN, | ||
BUSY; | ||
|
||
public static INCHI_RET wrap(InchiStatus status) { | ||
switch (status) { | ||
case SUCCESS: return INCHI_RET.OKAY; | ||
case WARNING: return INCHI_RET.WARNING; | ||
case ERROR: return INCHI_RET.ERROR; | ||
default: | ||
throw new IllegalArgumentException("Unexpected status!"); | ||
} | ||
} | ||
} |
Oops, something went wrong.