Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rdfile reader #942

Open
wants to merge 48 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
6831b03
added first draft of RdfileReader, RdfileRecord and a test class Rdfi…
uli-f Nov 9, 2022
a2d0f9b
re-fined implementation of RdfileReader and RdfileRecord; started add…
uli-f Nov 10, 2022
ede9a39
added more tests to RdfileReaderTest
uli-f Nov 14, 2022
c35e013
refactored RdfileReader, added more tests to RdfileReaderTest
uli-f Nov 15, 2022
5ab32d7
removed package-info.java; added missing RDfile used in RdfileReaderTest
uli-f Nov 15, 2022
57654e5
re-worked test method to be able to deal with a list of records
uli-f Nov 17, 2022
28f175f
implemented skip logic for broken records (pun intended) together wit…
uli-f Nov 17, 2022
4e5882e
implemented skip logic for broken records (pun intended) together wit…
uli-f Nov 19, 2022
10c5907
added test cases to BasicMoleculeHashGeneratorTest; added javadoc to …
uli-f Nov 30, 2022
733bef1
amended test cases in RdfileReaderTest
uli-f Nov 30, 2022
bbec01e
Merge pull request #940 from uli-f/hashgenerator_tests
johnmay Nov 30, 2022
3c5f8e8
added first draft of RdfileReader, RdfileRecord and a test class Rdfi…
uli-f Nov 9, 2022
e31b874
re-fined implementation of RdfileReader and RdfileRecord; started add…
uli-f Nov 10, 2022
8c5658d
added more tests to RdfileReaderTest
uli-f Nov 14, 2022
99320a6
refactored RdfileReader, added more tests to RdfileReaderTest
uli-f Nov 15, 2022
7eb2b31
removed package-info.java; added missing RDfile used in RdfileReaderTest
uli-f Nov 15, 2022
6095454
re-worked test method to be able to deal with a list of records
uli-f Nov 17, 2022
643dd72
implemented skip logic for broken records (pun intended) together wit…
uli-f Nov 17, 2022
baabff2
implemented skip logic for broken records (pun intended) together wit…
uli-f Nov 19, 2022
b8e071a
amended test cases in RdfileReaderTest
uli-f Nov 30, 2022
cc9d3f1
Merge remote-tracking branch 'origin/rdfile_reader' into rdfile_reader
uli-f Dec 1, 2022
feeb1cd
fixed spelling of test input file
uli-f Dec 1, 2022
7c8d39e
Support non-sequential atom index ins MDL V3000 inputs, fixes #943.
johnmay Dec 1, 2022
bfdecb4
added copyright/license header
uli-f Dec 2, 2022
17cbaf1
added some basic class level documentation to RdfileReader; now checking
uli-f Dec 2, 2022
80a594d
Newer XOM version
egonw Dec 2, 2022
b42e3d8
Removed the Xerces and Xalan dependencies
egonw Dec 2, 2022
639cf83
CMLXOM 4.4
egonw Dec 2, 2022
3bafacf
Merge pull request #945 from egonw/minus/xerces
johnmay Dec 3, 2022
57ca227
Set environment as SonarCloud
johnmay Dec 5, 2022
dfbc3fc
added first draft of RdfileReader, RdfileRecord and a test class Rdfi…
uli-f Nov 9, 2022
707a62a
re-fined implementation of RdfileReader and RdfileRecord; started add…
uli-f Nov 10, 2022
caf5195
added more tests to RdfileReaderTest
uli-f Nov 14, 2022
9d0f9c7
refactored RdfileReader, added more tests to RdfileReaderTest
uli-f Nov 15, 2022
40c2d89
removed package-info.java; added missing RDfile used in RdfileReaderTest
uli-f Nov 15, 2022
b365a35
re-worked test method to be able to deal with a list of records
uli-f Nov 17, 2022
3adf55c
implemented skip logic for broken records (pun intended) together wit…
uli-f Nov 17, 2022
ddc6105
implemented skip logic for broken records (pun intended) together wit…
uli-f Nov 19, 2022
3ad573a
amended test cases in RdfileReaderTest
uli-f Nov 30, 2022
b1855a2
re-based on main
uli-f Nov 9, 2022
718d8af
re-fined implementation of RdfileReader and RdfileRecord; started add…
uli-f Nov 10, 2022
9d276ca
refactored RdfileReader, added more tests to RdfileReaderTest
uli-f Nov 15, 2022
56470e8
removed package-info.java; added missing RDfile used in RdfileReaderTest
uli-f Nov 15, 2022
e47630a
fixed spelling of test input file
uli-f Dec 1, 2022
2a82ea8
added copyright/license header
uli-f Dec 2, 2022
b09b4c8
added some basic class level documentation to RdfileReader; now checking
uli-f Dec 2, 2022
f130642
fixed javadoc error in RdfileReader
uli-f Dec 5, 2022
10eefd7
Merge remote-tracking branch 'origin/rdfile_reader' into rdfile_reader
uli-f Dec 5, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
100 changes: 100 additions & 0 deletions storage/ctab/src/main/java/org/openscience/cdk/io/CharIter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
package org.openscience.cdk.io;

/**
* Helper class that facilitates the parsing of text data.
*/
final class CharIter {
uli-f marked this conversation as resolved.
Show resolved Hide resolved
private final String string;
private int position = 0;

CharIter(String str) {
this.string = str;
}

static boolean isSpace(char c) {
uli-f marked this conversation as resolved.
Show resolved Hide resolved
return c == ' ';
}

static boolean isDigit(char c) {
return c >= '0' && c <= '9';
}

int position() {
return position;
}

char next() {
return string.charAt(position++);
}

char peek() {
return position < string.length() ? string.charAt(position) : '\0';
}

boolean hasNext() {
return position < string.length();
}

String rest() {
return string.substring(position);
}

void skipWhiteSpace() {
while (hasNext()) {
if (isSpace(string.charAt(position)))
position++;
else
break;
}
}

int nextUnsignedNumber() {
if (!hasNext())
return -1;
if (!isDigit(peek()))
return -1;
int num = next() - '0';
while (hasNext() && isDigit(peek()))
num = (10 * num) + (next() - '0');
return num;
}

boolean consume(String substring) {
if (position + substring.length() > string.length())
return false;
int mark = position;
for (int i = 0; i < substring.length(); i++) {
if (substring.charAt(i) != string.charAt(position)) {
position = mark; // reset
break;
}
position++;
}
return position - mark == substring.length();
}

String substring(int beg, int end) {
return string.substring(beg, end);
}

void seek(int position) {
this.position = position;
}

boolean nextIf(char c) {
if (peek() == c) {
next();
return true;
}
return false;
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(string, 0, position);
sb.append('|');
sb.append(string.substring(position));
return sb.toString();
}
}