Skip to content

Commit 1767e85

Browse files
committed
refactoring
1 parent 8071524 commit 1767e85

File tree

4 files changed

+26
-3
lines changed

4 files changed

+26
-3
lines changed

src/main/java/com/igormaznitsa/prologparser/PrologParser.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ private PrologTerm readBlock(final Koi7CharOpMap endOperators) {
432432
readAtom = readOperators.findSimilar(leftPresented, rightPresented);
433433

434434
if (readAtom == null) {
435-
if (currentTreeItem == null && !(leftPresented || rightPresented)) {
435+
if (currentTreeItem == null && !rightPresented) {
436436
// alone operator, it is an atom
437437
return new PrologAtom(readOperators.getText(), Quotation.SINGLE, readOperators.getLine(), readOperators.getPos());
438438
}
@@ -455,7 +455,6 @@ private PrologTerm readBlock(final Koi7CharOpMap endOperators) {
455455
readAtom = readList(readAtomContainer);
456456
readAtom.setPos(readAtomContainer.getPos());
457457
readAtom.setLine(readAtomContainer.getLine());
458-
readAtomPrecedence = 0;
459458
}
460459
break;
461460
case '{':

src/main/java/com/igormaznitsa/prologparser/terms/PrologInt.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ public Number getNumber() {
110110
return this.value;
111111
}
112112

113+
/**
114+
* Get the value as BigInteger
115+
* @return the value as BigInteger
116+
*/
113117
public BigInteger getIntValue() {
114118
return this.value;
115119
}

src/main/java/com/igormaznitsa/prologparser/terms/PrologList.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,28 +115,49 @@ public boolean isEmpty() {
115115
return this.elements[0] == null && this.elements[1] == null;
116116
}
117117

118+
/**
119+
* Get the current head element of the list.
120+
* @return the head element, can be null
121+
*/
118122
public PrologTerm getHead() {
119123
return this.elements[0];
120124
}
121125

126+
/**
127+
* Replace the head element.
128+
* @param term the new head term, can be null
129+
*/
122130
public void setHead(final PrologTerm term) {
123131
this.setElementAt(0, term);
124132
if (this.elements[1] == null) {
125133
setTail(new PrologList());
126134
}
127135
}
128136

137+
/**
138+
* Get the current tail element
139+
* @return the current tail element, can be null
140+
*/
129141
public PrologTerm getTail() {
130142
return this.elements[1];
131143
}
132144

145+
/**
146+
* Set the current tail element
147+
* @param term the new tail element, can be null
148+
*/
133149
public void setTail(final PrologTerm term) {
134150
this.setElementAt(1, term);
135151
if (this.elements[0] == null) {
136152
setHead(EMPTY_ATOM);
137153
}
138154
}
139155

156+
/**
157+
* Add term as new list into the end of the list chain.
158+
* @param term to be added as new list in the end of chain
159+
* @return generated list (may be this)
160+
*/
140161
public PrologList addAsNewListToEndOfListChain(final PrologTerm term) {
141162

142163
PrologList result = this;

src/main/java/com/igormaznitsa/prologparser/utils/StringUtils.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
/**
2727
* Miscelaneous utils to work with strings.
2828
*/
29-
@SuppressWarnings("serial")
3029
public final class StringUtils {
3130

3231
private StringUtils() {

0 commit comments

Comments
 (0)