Commit c1807e2c authored by Custom2043's avatar Custom2043
Browse files

fixed some ignore bullshit

parent 706f0906
No preview for this file type
...@@ -93,37 +93,21 @@ public abstract class Token ...@@ -93,37 +93,21 @@ public abstract class Token
{ {
return this.ignored; return this.ignored;
} }
public Result getLastIgnoredResult()
{
return this.ignored[this.ignored.length - 1];
}
public String getStartIgnored()
{
StringBuilder builder = new StringBuilder();
this.getStartIgnored(builder);
return builder.toString();
}
public String getEndIgnored()
{
StringBuilder builder = new StringBuilder();
this.getEndIgnored(builder);
return builder.toString();
}
private void getStartIgnored(StringBuilder builder) public Result getOuterIgnored(int index)
{ {
if (this.ignored.length > 0) if (index >= 0)
builder.append(this.ignored[0].getTotal()); return this.ignored[index * 2 + 1];
if (this.totalTokens.length > 0) else
this.totalTokens[0].getStartIgnored(builder); return this.ignored[this.ignored.length + (index * 2)];
} }
private void getEndIgnored(StringBuilder builder) public Result getInnerIgnored(int index)
{ {
if (this.ignored.length > 0) if (index >= 0)
builder.append(this.ignored[this.ignored.length - 1].getTotal()); return this.ignored[index * 2];
if (this.totalTokens.length > 0) else
this.totalTokens[this.totalTokens.length - 1].getEndIgnored(builder); return this.ignored[this.ignored.length + (index * 2) + 1];
} }
@Override @Override
......
...@@ -133,9 +133,26 @@ public class TokenBuilder extends Builder ...@@ -133,9 +133,26 @@ public class TokenBuilder extends Builder
resultWithoutIgnore.add(new Result(s, r.toArray(new Result[r.size()]))); resultWithoutIgnore.add(new Result(s, r.toArray(new Result[r.size()])));
ignoredResults.add(new Result(s, rIgnored.toArray(new Result[rIgnored.size()]))); ignoredResults.add(new Result(s, rIgnored.toArray(new Result[rIgnored.size()])));
} }
else if (s instanceof OrSearch || s instanceof TokenSearch) else if (s instanceof TokenSearch)
{ {
resultWithoutIgnore.add(results[position]); resultWithoutIgnore.add(results[position]);
ignoredResults.add(new Result(this.ignore.getRealSearch(), new Result[0]));
}
else if (s instanceof OrSearch)
{
if (results[position].isToken())
{
resultWithoutIgnore.add(results[position]);
ignoredResults.add(new Result(this.ignore.getRealSearch(), new Result[0]));
}
else
{
MultipleSearch ss = (MultipleSearch) results[position].getSearch();
Result[][] sortedResults = this.separateIgnoreResults(results[position].getArray(), ss.getSearches());
resultWithoutIgnore.add(new Result(s, sortedResults[0]));
ignoredResults.add(new Result(this.ignore.getRealSearch(), sortedResults[1]));
}
} }
else if (s instanceof MultipleSearch) else if (s instanceof MultipleSearch)
{ {
...@@ -146,8 +163,8 @@ public class TokenBuilder extends Builder ...@@ -146,8 +163,8 @@ public class TokenBuilder extends Builder
} }
else else
{ {
if (results[position].getArray() == null) if (results[position] == null)
ignoredResults.add(results[position]); ignoredResults.add(null);
else else
ignoredResults.add(results[position].getArray()[0]); ignoredResults.add(results[position].getArray()[0]);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment