The Unified and Autonomous Development Platform
midwork
robin shine5d6c498b82e1
diff --git a/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/AlternativeSpec.java b/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/AlternativeSpec.javaindex 20dc1b305c..7a1e22ecd3 100644--- a/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/AlternativeSpec.java+++ b/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/AlternativeSpec.java@@ -30,31 +30,16 @@ public class AlternativeSpec extends Spec {}@Override- public List<TokenNode> match(AssistStream stream, Node parent, Node previous,+ public Map<TokenNode, Integer> match(AssistStream stream, Node parent, Node previous,Map<String, Set<RuleRefContext>> ruleRefHistory) {parent = new Node(this, parent, previous);- List<TokenNode> paths = new ArrayList<>();- int index = stream.getIndex();+ Map<TokenNode, Integer> matches = initMatches(stream, parent, previous);for (ElementSpec elementSpec: elements) {- if (!paths.isEmpty())- previous = paths.get(paths.size()-1);- else- previous = parent;- List<TokenNode> elementPaths = elementSpec.match(stream, parent, previous, copy(ruleRefHistory));- if (elementPaths == null) {- stream.setIndex(index);- return null;- } else if (elementPaths.isEmpty()) {- if (stream.isEof())- return paths;- } else {- if (stream.isEof())- return elementPaths;- else- paths = elementPaths;- }+ matches = elementSpec.match(matches, stream, parent, copy(ruleRefHistory));+ if (matches.isEmpty())+ break;}- return paths;+ return matches;}@Overridediff --git a/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/AnyTokenElementSpec.java b/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/AnyTokenElementSpec.javaindex cef583ad85..aec876ed81 100644--- a/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/AnyTokenElementSpec.java+++ b/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/AnyTokenElementSpec.java@@ -1,14 +1,13 @@package com.pmease.commons.antlr.codeassist;import java.util.ArrayList;+import java.util.LinkedHashMap;import java.util.List;import java.util.Map;import java.util.Set;import org.antlr.v4.runtime.Token;-import com.google.common.collect.Lists;-public class AnyTokenElementSpec extends ElementSpec {private static final long serialVersionUID = 1L;@@ -29,16 +28,21 @@ public class AnyTokenElementSpec extends ElementSpec {}@Override- public List<TokenNode> matchOnce(AssistStream stream, Node parent, Node previous,+ public Map<TokenNode, Integer> matchOnce(AssistStream stream, Node parent, Node previous,Map<String, Set<RuleRefContext>> ruleRefHistory) {- if (stream.isEof()) {- return null;- } else {+ Map<TokenNode, Integer> matches = new LinkedHashMap<>();+ if (!stream.isEof()) {Token token = stream.getCurrentToken();stream.increaseIndex();TokenNode tokenNode = new TokenNode(this, parent, previous, token);- return Lists.newArrayList(tokenNode);+ if (!stream.isEof())+ matches.put(tokenNode, stream.getIndex());+ else+ matches.put(new TokenNode(null, parent, tokenNode, AssistStream.EOF), stream.getIndex());+ } else {+ matches.put(new TokenNode(null, parent, previous, AssistStream.SOF), stream.getIndex());}+ return matches;}@Overridediff --git a/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/CodeAssist.java b/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/CodeAssist.javaindex ee830b5b50..154c7ed792 100644--- a/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/CodeAssist.java+++ b/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/CodeAssist.java@@ -190,6 +190,7 @@ public abstract class CodeAssist implements Serializable {return newAltenative(label, labeledAltContext.alternative());}+ @Nullableprivate ElementSpec newElement(LexerElementContext lexerElementContext) {LabeledLexerElementContext labeledLexerElementContext = lexerElementContext.labeledLexerElement();if (labeledLexerElementContext != null) {@@ -238,6 +239,7 @@ public abstract class CodeAssist implements Serializable {}}+ @Nullableprivate ElementSpec newElement(String label, AtomContext atomContext, EbnfSuffixContext ebnfSuffixContext) {Multiplicity multiplicity = newMultiplicity(ebnfSuffixContext);if (atomContext.terminal() != null) {@@ -247,7 +249,7 @@ public abstract class CodeAssist implements Serializable {if (tokenType != Token.EOF)return new LexerRuleRefElementSpec(this ,label, multiplicity, tokenType, ruleName);else- return new EofElementSpec(this, label, multiplicity);+ return null;} else {String literal = getLiteral(atomContext.terminal().STRING_LITERAL());int tokenType = tokenTypesByLiteral.get(literal);@@ -269,6 +271,7 @@ public abstract class CodeAssist implements Serializable {return literal.substring(1, literal.length()-1);}+ @Nullableprivate ElementSpec newElement(String label, LexerAtomContext lexerAtomContext, EbnfSuffixContext ebnfSuffixContext) {Multiplicity multiplicity = newMultiplicity(ebnfSuffixContext);if (lexerAtomContext.terminal() != null) {@@ -280,7 +283,7 @@ public abstract class CodeAssist implements Serializable {if (tokenType != Token.EOF)return new LexerRuleRefElementSpec(this, label, multiplicity, tokenType, ruleName);else- return new EofElementSpec(this, label, multiplicity);+ return null;} else {String literal = getLiteral(lexerAtomContext.terminal().STRING_LITERAL());Integer tokenType = tokenTypesByLiteral.get(literal);diff --git a/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/ElementSpec.java b/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/ElementSpec.javaindex 4233c62ae7..350db23fda 100644--- a/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/ElementSpec.java+++ b/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/ElementSpec.java@@ -1,7 +1,9 @@package com.pmease.commons.antlr.codeassist;import java.util.ArrayList;+import java.util.HashMap;import java.util.HashSet;+import java.util.LinkedHashMap;import java.util.List;import java.util.Map;import java.util.Set;@@ -36,25 +38,25 @@ public abstract class ElementSpec extends Spec {}@Override- public List<TokenNode> match(AssistStream stream, Node parent, Node previous,+ public Map<TokenNode, Integer> match(AssistStream stream, Node parent, Node previous,Map<String, Set<RuleRefContext>> ruleRefHistory) {+ return match(initMatches(stream, parent, previous), stream, parent, ruleRefHistory);+ }++ public Map<TokenNode, Integer> match(Map<TokenNode, Integer> prevMatches, AssistStream stream,+ Node parent, Map<String, Set<RuleRefContext>> ruleRefHistory) {if (multiplicity == Multiplicity.ONE) {- return matchOnce(stream, parent, previous, ruleRefHistory);+ return matchOnce(prevMatches, stream, parent, ruleRefHistory);} else if (multiplicity == Multiplicity.ONE_OR_MORE) {- List<TokenNode> paths = matchOnce(stream, parent, previous, ruleRefHistory);- if (paths == null || paths.isEmpty() || stream.isEof()) {- return paths;- } else {+ Map<TokenNode, Integer> matches = matchOnce(prevMatches, stream, parent, ruleRefHistory);+ if (!matches.isEmpty()) {while (true) {- previous = paths.get(paths.size()-1);- List<TokenNode> nextPaths = matchOnce(stream, parent, previous, ruleRefHistory);- if (nextPaths == null || nextPaths.isEmpty())- return paths;- else if (stream.isEof())- return nextPaths;- else- paths = nextPaths;+ matches.putAllmatchOnce(matches, stream, parent, ruleRefHistory);+ if (matches.isEmpty())+ break;}+ } else {+ return matches;}} else if (multiplicity == Multiplicity.ZERO_OR_MORE) {List<TokenNode> paths = new ArrayList<>();@@ -76,7 +78,17 @@ public abstract class ElementSpec extends Spec {}}- public abstract List<TokenNode> matchOnce(AssistStream stream, Node parent, Node previous,+ public Map<TokenNode, Integer> matchOnce(Map<TokenNode, Integer> prevMatches, AssistStream stream,+ Node parent, Map<String, Set<RuleRefContext>> ruleRefHistory) {+ Map<TokenNode, Integer> matches = new LinkedHashMap<>();+ for (Map.Entry<TokenNode, Integer> entry: prevMatches.entrySet()) {+ stream.setIndex(entry.getValue());+ matches.putAll(matchOnce(stream, parent, entry.getKey(), copy(ruleRefHistory)));+ }+ return matches;+ }++ public abstract Map<TokenNode, Integer> matchOnce(AssistStream stream, Node parent, Node previous,Map<String, Set<RuleRefContext>> ruleRefHistory);public abstract MandatoryScan scanMandatories(Set<String> checkedRules);diff --git a/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/EofElementSpec.java b/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/EofElementSpec.javadeleted file mode 100644index 27c60cf5d6..0000000000--- a/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/EofElementSpec.java+++ /dev/null@@ -1,40 +0,0 @@-package com.pmease.commons.antlr.codeassist;--import java.util.ArrayList;-import java.util.List;-import java.util.Map;-import java.util.Set;--import org.antlr.v4.runtime.Token;--public class EofElementSpec extends TokenElementSpec {-- private static final long serialVersionUID = 1L;-- public EofElementSpec(CodeAssist codeAssist, String label, Multiplicity multiplicity) {- super(codeAssist, label, multiplicity, Token.EOF);- }-- @Override- public List<ElementSuggestion> doSuggestFirst(ParseTree parseTree, Node parent,- String matchWith, Set<String> checkedRules) {- return new ArrayList<ElementSuggestion>();- }-- @Override- public MandatoryScan scanMandatories(Set<String> checkedRules) {- return MandatoryScan.stop();- }-- @Override- public List<TokenNode> matchOnce(AssistStream stream, Node parent, Node previous,- Map<String, Set<RuleRefContext>> ruleRefHistory) {- return new ArrayList<>();- }-- @Override- protected String asString() {- return "EOF";- }--}diff --git a/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/LexerRuleRefElementSpec.java b/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/LexerRuleRefElementSpec.javaindex 00b3923d10..cda29cd874 100644--- a/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/LexerRuleRefElementSpec.java+++ b/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/LexerRuleRefElementSpec.java@@ -3,13 +3,9 @@ package com.pmease.commons.antlr.codeassist;import java.util.ArrayList;import java.util.HashSet;import java.util.List;-import java.util.Map;import java.util.Set;-import org.antlr.v4.runtime.Token;-import com.google.common.base.Optional;-import com.google.common.collect.Lists;public class LexerRuleRefElementSpec extends TokenElementSpec {@@ -85,20 +81,6 @@ public class LexerRuleRefElementSpec extends TokenElementSpec {}}- @Override- public List<TokenNode> matchOnce(AssistStream stream, Node parent, Node previous,- Map<String, Set<RuleRefContext>> ruleRefHistory) {- if (!stream.isEof()) {- Token token = stream.getCurrentToken();- if (token.getType() == type) {- stream.increaseIndex();- TokenNode tokenNode = new TokenNode(this, parent, previous, token);- return Lists.newArrayList(tokenNode);- }- }- return null;- }-@Overrideprotected String asString() {return "lexer_rule_ref: " + ruleName;diff --git a/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/LiteralElementSpec.java b/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/LiteralElementSpec.javaindex d23d8f302e..44c16d3147 100644--- a/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/LiteralElementSpec.java+++ b/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/LiteralElementSpec.java@@ -2,11 +2,8 @@ package com.pmease.commons.antlr.codeassist;import java.util.ArrayList;import java.util.List;-import java.util.Map;import java.util.Set;-import org.antlr.v4.runtime.Token;-import com.google.common.collect.Lists;public class LiteralElementSpec extends TokenElementSpec {@@ -43,20 +40,6 @@ public class LiteralElementSpec extends TokenElementSpec {return new MandatoryScan(Lists.newArrayList(literal), false);}- @Override- public List<TokenNode> matchOnce(AssistStream stream, Node parent, Node previous,- Map<String, Set<RuleRefContext>> ruleRefHistory) {- if (!stream.isEof()) {- Token token = stream.getCurrentToken();- if (token.getType() == type) {- stream.increaseIndex();- TokenNode tokenNode = new TokenNode(this, parent, previous, token);- return Lists.newArrayList(tokenNode);- }- }- return null;- }-@Overrideprotected String asString() {return "literal: '" + literal + "'";diff --git a/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/NotTokenElementSpec.java b/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/NotTokenElementSpec.javaindex bf100a01af..d1a2c8786d 100644--- a/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/NotTokenElementSpec.java+++ b/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/NotTokenElementSpec.java@@ -1,14 +1,13 @@package com.pmease.commons.antlr.codeassist;import java.util.ArrayList;+import java.util.LinkedHashMap;import java.util.List;import java.util.Map;import java.util.Set;import org.antlr.v4.runtime.Token;-import com.google.common.collect.Lists;-public class NotTokenElementSpec extends ElementSpec {private static final long serialVersionUID = 1L;@@ -38,20 +37,23 @@ public class NotTokenElementSpec extends ElementSpec {}@Override- public List<TokenNode> matchOnce(AssistStream stream, Node parent, Node previous,+ public Map<TokenNode, Integer> matchOnce(AssistStream stream, Node parent, Node previous,Map<String, Set<RuleRefContext>> ruleRefHistory) {- if (stream.isEof()) {- return null;- } else {+ Map<TokenNode, Integer> matches = new LinkedHashMap<>();+ if (!stream.isEof()) {Token token = stream.getCurrentToken();if (!notTokenTypes.contains(token.getType())) {stream.increaseIndex();TokenNode tokenNode = new TokenNode(this, parent, previous, token);- return Lists.newArrayList(tokenNode);- } else {- return null;- }+ if (!stream.isEof())+ matches.put(tokenNode, stream.getIndex());+ else+ matches.put(new TokenNode(null, parent, tokenNode, AssistStream.EOF), stream.getIndex());+ }+ } else {+ matches.put(new TokenNode(null, parent, previous, AssistStream.SOF), stream.getIndex());}+ return matches;}@Overridediff --git a/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/RuleRefContext.java b/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/RuleRefContext.javaindex f238bb0ba6..539d3192a5 100644--- a/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/RuleRefContext.java+++ b/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/RuleRefContext.java@@ -5,14 +5,21 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;class RuleRefContext {- String ruleName;+ private final String ruleName;- int alternativeIndex;+ private final int alternativeIndex;- int elementIndex;+ private final int elementIndex;- int streamIndex;+ private final int streamIndex;+ public RuleRefContext(String ruleName, int alternativeIndex, int elementIndex, int streamIndex) {+ this.ruleName = ruleName;+ this.alternativeIndex = alternativeIndex;+ this.elementIndex = elementIndex;+ this.streamIndex = streamIndex;+ }+@Overridepublic boolean equals(Object other) {if (!(other instanceof RuleRefContext))diff --git a/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/RuleRefElementSpec.java b/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/RuleRefElementSpec.javaindex 2cc291a0a7..d446c01299 100644--- a/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/RuleRefElementSpec.java+++ b/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/RuleRefElementSpec.java@@ -2,6 +2,7 @@ package com.pmease.commons.antlr.codeassist;import java.util.ArrayList;import java.util.HashSet;+import java.util.LinkedHashMap;import java.util.List;import java.util.Map;import java.util.Set;@@ -82,23 +83,23 @@ public class RuleRefElementSpec extends ElementSpec {}@Override- public List<TokenNode> matchOnce(AssistStream stream, Node parent, Node previous,+ public Map<TokenNode, Integer> matchOnce(AssistStream stream, Node parent, Node previous,Map<String, Set<RuleRefContext>> ruleRefHistory) {+ Map<TokenNode, Integer> matches = new LinkedHashMap<>();if (parent != null) {AlternativeSpec alternative = (AlternativeSpec) parent.getSpec();- RuleRefContext context = new RuleRefContext();- context.elementIndex = alternative.getElements().indexOf(this);+ int elementIndex = alternative.getElements().indexOf(this);RuleSpec rule = (RuleSpec) parent.getParent().getSpec();- context.alternativeIndex = rule.getAlternatives().indexOf(alternative);- context.ruleName = rule.getName();- context.streamIndex = stream.getIndex();+ int alternativeIndex = rule.getAlternatives().indexOf(alternative);+ RuleRefContext context = new RuleRefContext(rule.getName(),+ alternativeIndex, elementIndex, stream.getIndex());Set<RuleRefContext> ruleRefContexts = ruleRefHistory.get(ruleName);if (ruleRefContexts == null) {ruleRefContexts = new HashSet<>();ruleRefHistory.put(ruleName, ruleRefContexts);} else if (ruleRefContexts.contains(context)) {- return null;+ return matches;} else {ruleRefContexts.add(context);}diff --git a/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/RuleSpec.java b/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/RuleSpec.javaindex edb7cb632b..a3f022aaae 100644--- a/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/RuleSpec.java+++ b/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/RuleSpec.java@@ -2,6 +2,7 @@ package com.pmease.commons.antlr.codeassist;import java.util.ArrayList;import java.util.HashSet;+import java.util.LinkedHashMap;import java.util.List;import java.util.Map;import java.util.Set;@@ -40,31 +41,17 @@ public class RuleSpec extends Spec {}@Override- public List<TokenNode> match(AssistStream stream, Node parent, Node previous,+ public Map<TokenNode, Integer> match(AssistStream stream, Node parent, Node previous,Map<String, Set<RuleRefContext>> ruleRefHistory) {- List<TokenNode> paths = null;- int maxIndex = stream.getIndex();-+ Map<TokenNode, Integer> matches = new LinkedHashMap<>();int index = stream.getIndex();parent = new Node(this, parent, previous);-for (AlternativeSpec alternative: alternatives) {- List<TokenNode> alternativePaths = alternative.match(stream, parent, parent, copy(ruleRefHistory));- if (stream.getIndex() > maxIndex) {- maxIndex = stream.getIndex();- paths = alternativePaths;- } else if (stream.getIndex() == maxIndex && alternativePaths != null) {- if (paths == null)- paths = alternativePaths;- else- paths.addAll(alternativePaths);- }+ matches.putAll(alternative.match(stream, parent, parent, copy(ruleRefHistory)));stream.setIndex(index);}- stream.setIndex(maxIndex);-- return paths;+ return matches;}@Overridediff --git a/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/Spec.java b/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/Spec.javaindex dded3fda23..1e80ee78c3 100644--- a/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/Spec.java+++ b/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/Spec.java@@ -3,6 +3,7 @@ package com.pmease.commons.antlr.codeassist;import java.io.Serializable;import java.util.HashMap;import java.util.HashSet;+import java.util.LinkedHashMap;import java.util.List;import java.util.Map;import java.util.Set;@@ -28,7 +29,11 @@ public abstract class Spec implements Serializable {* true if there is an exact match between spec and stream*/public boolean matches(AssistStream stream) {- return match(stream, null, null, new HashMap<String, Set<RuleRefContext>>()) != null && stream.isEof();+ for (TokenNode match: match(stream, null, null, new HashMap<String, Set<RuleRefContext>>()).keySet()) {+ if (match.getToken() == AssistStream.EOF)+ return true;+ }+ return false;}/**@@ -48,7 +53,7 @@ public abstract class Spec implements Serializable {* that case, the paths tells to which point the match goes to*/@Nullable- public abstract List<TokenNode> match(AssistStream stream, Node parent, Node previous,+ public abstract Map<TokenNode, Integer> match(AssistStream stream, Node parent, Node previous,Map<String, Set<RuleRefContext>> ruleRefContexts);public abstract List<ElementSuggestion> suggestFirst(ParseTree parseTree, Node parent,@@ -58,6 +63,12 @@ public abstract class Spec implements Serializable {return codeAssist;}+ protected Map<TokenNode, Integer> initMatches(AssistStream stream, Node parent, Node previous) {+ Map<TokenNode, Integer> matches = new LinkedHashMap<>();+ matches.put(new TokenNode(null, parent, previous, AssistStream.SOF), stream.getIndex());+ return matches;+ }+protected Map<String, Set<RuleRefContext>> copy(Map<String, Set<RuleRefContext>> ruleRefHistory) {Map<String, Set<RuleRefContext>> copy = new HashMap<>();for (Map.Entry<String, Set<RuleRefContext>> entry: ruleRefHistory.entrySet())diff --git a/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/TokenElementSpec.java b/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/TokenElementSpec.javaindex df3cf49f32..11d03893e7 100644--- a/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/TokenElementSpec.java+++ b/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/TokenElementSpec.java@@ -1,5 +1,11 @@package com.pmease.commons.antlr.codeassist;+import java.util.LinkedHashMap;+import java.util.Map;+import java.util.Set;++import org.antlr.v4.runtime.Token;+public abstract class TokenElementSpec extends ElementSpec {private static final long serialVersionUID = 1L;@@ -22,4 +28,24 @@ public abstract class TokenElementSpec extends ElementSpec {return type;}+ @Override+ public Map<TokenNode, Integer> matchOnce(AssistStream stream, Node parent, Node previous,+ Map<String, Set<RuleRefContext>> ruleRefHistory) {+ Map<TokenNode, Integer> matches = new LinkedHashMap<>();+ if (!stream.isEof()) {+ Token token = stream.getCurrentToken();+ if (token.getType() == type) {+ stream.increaseIndex();+ TokenNode tokenNode = new TokenNode(this, parent, previous, token);+ if (!stream.isEof())+ matches.put(tokenNode, stream.getIndex());+ else+ matches.put(new TokenNode(null, parent, tokenNode, AssistStream.EOF), stream.getIndex());+ }+ } else {+ matches.put(new TokenNode(null, parent, previous, AssistStream.SOF), stream.getIndex());+ }+ return matches;+ }+}