Skip to content

Commit

Permalink
Additional code smells - unused functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmay authored and egonw committed Apr 10, 2024
1 parent bbdafb4 commit 01d7ab0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 51 deletions.
18 changes: 6 additions & 12 deletions storage/ctab/src/main/java/org/openscience/cdk/io/SDFWriter.java
Expand Up @@ -71,9 +71,7 @@ public class SDFWriter extends DefaultChemObjectWriter {


private BufferedWriter writer;
private BooleanIOSetting paramWriteData;
private BooleanIOSetting paramWriteV3000;
private BooleanIOSetting truncateData;
private Set<String> acceptedSdTags;

/**
Expand Down Expand Up @@ -255,10 +253,6 @@ private void writeChemModel(IChemModel model) throws Exception {
}
}

private static String replaceInvalidHeaderChars(String headerKey) {
return headerKey.replaceAll("[-<>.=% ]", "_");
}

private void writeMolecule(IAtomContainer container) throws CDKException {
try {
// write the MDL molfile bits
Expand Down Expand Up @@ -335,15 +329,15 @@ private void initIOSettings() {
addSettings(mdlv3.getSettings());
} catch (IOException ignored) {
}
paramWriteData = addSetting(new BooleanIOSetting(OptWriteData,
IOSetting.Importance.LOW,
"Should molecule properties be written as non-structural data", "true"));
addSetting(new BooleanIOSetting(OptWriteData,
IOSetting.Importance.LOW,
"Should molecule properties be written as non-structural data", "true"));
addSetting(new BooleanIOSetting(OptTruncateLongData,
IOSetting.Importance.LOW,
"Truncate long data files >200 characters", "false"));
paramWriteV3000 = addSetting(new BooleanIOSetting(OptAlwaysV3000,
IOSetting.Importance.LOW,
"Write all records as V3000", "false"));
truncateData = addSetting(new BooleanIOSetting(OptTruncateLongData,
IOSetting.Importance.LOW,
"Truncate long data files >200 characters", "false"));
}

public void setAlwaysV3000(boolean val) {
Expand Down
Expand Up @@ -108,7 +108,6 @@ public class IteratingSDFReader extends DefaultIteratingChemObjectReader<IAtomCo

// patterns to match
private static final Pattern MDL_VERSION = Pattern.compile("[vV](2000|3000)");
private static final String M_END = "M END";
private static final String SDF_RECORD_SEPARATOR = "$$$$";
private static final String SDF_DATA_HEADER = "> ";

Expand Down Expand Up @@ -294,44 +293,6 @@ public void setSkip(boolean skip) {
this.skip = skip;
}

private String extractFieldData(StringBuilder data) throws IOException {
data.setLength(0);
while (currentLine != null && !currentLine.startsWith(SDF_RECORD_SEPARATOR)) {
if (currentLine.startsWith(SDF_DATA_HEADER))
break;
logger.debug("data line: ", currentLine);
if (data.length() > 0)
data.append('\n');
data.append(currentLine);
currentLine = input.readLine();
}
// trim trailing newline
int len = data.length();
if (len > 1 && data.charAt(len-1) == '\n')
data.setLength(len-1);
return data.toString();
}

private String skipOtherFieldHeaderLines(String str) throws IOException {
while (str.startsWith(SDF_DATA_HEADER)) {
logger.debug("data header line: ", currentLine);
currentLine = input.readLine();
str = currentLine;
}
return str;
}

private String extractFieldName(String str) {
int index = str.indexOf('<');
if (index != -1) {
int index2 = str.indexOf('>', index);
if (index2 != -1) {
return str.substring(index + 1, index2);
}
}
return null;
}

/**
* Returns the next {@link IAtomContainer}.
*/
Expand Down

0 comments on commit 01d7ab0

Please sign in to comment.