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
{
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)
builder.append(this.ignored[0].getTotal());
if (this.totalTokens.length > 0)
this.totalTokens[0].getStartIgnored(builder);
if (index >= 0)
return this.ignored[index * 2 + 1];
else
return this.ignored[this.ignored.length + (index * 2)];
}
private void getEndIgnored(StringBuilder builder)
public Result getInnerIgnored(int index)
{
if (this.ignored.length > 0)
builder.append(this.ignored[this.ignored.length - 1].getTotal());
if (this.totalTokens.length > 0)
this.totalTokens[this.totalTokens.length - 1].getEndIgnored(builder);
if (index >= 0)
return this.ignored[index * 2];
else
return this.ignored[this.ignored.length + (index * 2) + 1];
}
@Override
......
......@@ -133,9 +133,26 @@ public class TokenBuilder extends Builder
resultWithoutIgnore.add(new Result(s, r.toArray(new Result[r.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]);
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)
{
......@@ -146,8 +163,8 @@ public class TokenBuilder extends Builder
}
else
{
if (results[position].getArray() == null)
ignoredResults.add(results[position]);
if (results[position] == null)
ignoredResults.add(null);
else
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