Skip to content

Commit

Permalink
converted uses of indexOf to startsWith/contains
Browse files Browse the repository at this point in the history
  • Loading branch information
rajarshi committed Apr 10, 2010
1 parent f95c632 commit 7b9d84e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main/org/openscience/cdk/io/HINReader.java
Expand Up @@ -167,7 +167,7 @@ private IChemFile readChemFile(IChemFile file) {
// read in header info
while (true) {
line = input.readLine();
if (line.indexOf("mol ") == 0) {
if (line.startsWith("mol")) {
info = getMolName(line);
break;
}
Expand All @@ -178,9 +178,9 @@ private IChemFile readChemFile(IChemFile file) {
line = input.readLine();
while(true) {
if (line == null) break; // end of file
if (line.indexOf(';') == 0) continue; // comment line
if (line.startsWith(";")) continue; // comment line

if (line.indexOf("mol ") == 0) {
if (line.startsWith("mol")) {
info = getMolName(line);
line = input.readLine();
}
Expand All @@ -196,10 +196,10 @@ private IChemFile readChemFile(IChemFile file) {
// read data for current molecule
int atomSerial = 0;
while (true) {
if (line == null || line.indexOf("endmol ") >= 0) {
if (line == null || line.contains("endmol")) {
break;
}
if (line.indexOf(';') == 0) continue; // comment line
if (line.startsWith(";")) continue; // comment line

tokenizer = new StringTokenizer(line, " ");

Expand Down Expand Up @@ -263,7 +263,7 @@ private IChemFile readChemFile(IChemFile file) {
// block
while (true) {
line = input.readLine();
if (line == null || line.indexOf("mol ") == 0) break;
if (line == null || line.startsWith("mol")) break;
}
}

Expand Down

0 comments on commit 7b9d84e

Please sign in to comment.