public BasicSequenceMatchResult<T> copy() { BasicSequenceMatchResult<T> res = new BasicSequenceMatchResult<>(); res.pattern = pattern; res.elements = elements; res.matchedGroups = new MatchedGroup[matchedGroups.length]; res.nodesToStringConverter = nodesToStringConverter; res.score = score; res.priority = priority; res.order = order; res.varGroupBindings = varGroupBindings; for (int i = 0; i < matchedGroups.length; i++ ) { if (matchedGroups[i] != null) { res.matchedGroups[i] = new MatchedGroup(matchedGroups[i]); } } if (matchedResults != null) { res.matchedResults = new Object[matchedResults.length]; System.arraycopy(res.matchedResults, 0, matchedResults, 0, matchedResults.length); } return res; }
bestbid = state.bid; bestMatched = branchStates.getMatchedGroup(bestbid, 0); bestMatchedLength = (bestMatched != null)? bestMatched.matchLength() : -1; } else { int matchLength = (mg != null)? mg.matchLength() : -1; best = i; bestMatched = branchStates.getMatchedGroup(bestbid, 0); bestMatchedLength = (bestMatched != null)? bestMatched.matchLength() : -1;
bestbid = state.bid; bestMatched = branchStates.getMatchedGroup(bestbid, 0); bestMatchedLength = (bestMatched != null)? bestMatched.matchLength() : -1; } else { int matchLength = (mg != null)? mg.matchLength() : -1; best = i; bestMatched = branchStates.getMatchedGroup(bestbid, 0); bestMatchedLength = (bestMatched != null)? bestMatched.matchLength() : -1;
bestbid = state.bid; bestMatched = branchStates.getMatchedGroup(bestbid, 0); bestMatchedLength = (bestMatched != null)? bestMatched.matchLength() : -1; } else { int matchLength = (mg != null)? mg.matchLength() : -1; best = i; bestMatched = branchStates.getMatchedGroup(bestbid, 0); bestMatchedLength = (bestMatched != null)? bestMatched.matchLength() : -1;
public BasicSequenceMatchResult<T> copy() { BasicSequenceMatchResult<T> res = new BasicSequenceMatchResult<>(); res.pattern = pattern; res.elements = elements; res.matchedGroups = new MatchedGroup[matchedGroups.length]; res.nodesToStringConverter = nodesToStringConverter; res.score = score; res.priority = priority; res.order = order; res.varGroupBindings = varGroupBindings; for (int i = 0; i < matchedGroups.length; i++ ) { if (matchedGroups[i] != null) { res.matchedGroups[i] = new MatchedGroup(matchedGroups[i]); } } if (matchedResults != null) { res.matchedResults = new Object[matchedResults.length]; System.arraycopy(res.matchedResults, 0, matchedResults, 0, matchedResults.length); } return res; }
protected void setGroupEnd(int bid, int captureGroupId) { if (captureGroupId >= 0) { Map<Integer,MatchedGroup> matchedGroups = getMatchedGroups(bid, true); MatchedGroup mg = matchedGroups.get(captureGroupId); int end = curPosition+1; if (mg != null) { if (mg.matchEnd == -1) { matchedGroups.put(captureGroupId, new MatchedGroup(mg.matchBegin, end)); } else { if (mg.matchEnd != end) { logger.warning("Cannot set matchEnd=" + end + ": Capture group " + captureGroupId + " already ended: " + mg); } } } else { logger.warning("Cannot set matchEnd=" + end + ": Capture group " + captureGroupId + " is null"); } } }
protected void setGroupEnd(int bid, int captureGroupId, int curPosition, Object value) { if (captureGroupId >= 0) { Map<Integer,MatchedGroup> matchedGroups = getMatchedGroups(bid, true); MatchedGroup mg = matchedGroups.get(captureGroupId); int end = curPosition+1; if (mg != null) { if (mg.matchEnd == -1) { matchedGroups.put(captureGroupId, new MatchedGroup(mg.matchBegin, end, value)); } else { if (mg.matchEnd != end) { logger.warning("Cannot set matchEnd=" + end + ": Capture group " + captureGroupId + " already ended: " + mg); } } } else { logger.warning("Cannot set matchEnd=" + end + ": Capture group " + captureGroupId + " is null"); } } }
public BasicSequenceMatchResult<T> copy() { BasicSequenceMatchResult<T> res = new BasicSequenceMatchResult<>(); res.pattern = pattern; res.elements = elements; res.matchedGroups = new MatchedGroup[matchedGroups.length]; res.nodesToStringConverter = nodesToStringConverter; res.score = score; res.priority = priority; res.order = order; res.varGroupBindings = varGroupBindings; for (int i = 0; i < matchedGroups.length; i++ ) { if (matchedGroups[i] != null) { res.matchedGroups[i] = new MatchedGroup(matchedGroups[i]); } } if (matchedResults != null) { res.matchedResults = new Object[matchedResults.length]; System.arraycopy(res.matchedResults, 0, matchedResults, 0, matchedResults.length); } return res; }
protected void setGroupEnd(int bid, int captureGroupId, int curPosition, Object value) { if (captureGroupId >= 0) { Map<Integer,MatchedGroup> matchedGroups = getMatchedGroups(bid, true); MatchedGroup mg = matchedGroups.get(captureGroupId); int end = curPosition+1; if (mg != null) { if (mg.matchEnd == -1) { matchedGroups.put(captureGroupId, new MatchedGroup(mg.matchBegin, end, value)); } else { if (mg.matchEnd != end) { logger.warning("Cannot set matchEnd=" + end + ": Capture group " + captureGroupId + " already ended: " + mg); } } } else { logger.warning("Cannot set matchEnd=" + end + ": Capture group " + captureGroupId + " is null"); } } }
protected void setGroupEnd(int bid, int captureGroupId, int curPosition, Object value) { if (captureGroupId >= 0) { Map<Integer,MatchedGroup> matchedGroups = getMatchedGroups(bid, true); MatchedGroup mg = matchedGroups.get(captureGroupId); int end = curPosition+1; if (mg != null) { if (mg.matchEnd == -1) { matchedGroups.put(captureGroupId, new MatchedGroup(mg.matchBegin, end, value)); } else { if (mg.matchEnd != end) { logger.warning("Cannot set matchEnd=" + end + ": Capture group " + captureGroupId + " already ended: " + mg); } } } else { logger.warning("Cannot set matchEnd=" + end + ": Capture group " + captureGroupId + " is null"); } } }
public BasicSequenceMatchResult<T> copy() { BasicSequenceMatchResult res = new BasicSequenceMatchResult<T>(); res.pattern = pattern; res.elements = elements; res.matchedGroups = new MatchedGroup[matchedGroups.length]; res.nodesToStringConverter = nodesToStringConverter; res.score = score; res.order = order; res.varGroupBindings = varGroupBindings; for (int i = 0; i < matchedGroups.length; i++ ) { if (matchedGroups[i] != null) { res.matchedGroups[i] = new MatchedGroup(matchedGroups[i]); } } if (matchedResults != null) { res.matchedResults = new Object[res.matchedResults.length]; System.arraycopy(res.matchedResults, 0, matchedResults, 0, matchedResults.length); } return res; }
public BasicSequenceMatchResult<T> copy() { BasicSequenceMatchResult res = new BasicSequenceMatchResult<T>(); res.elements = elements; res.matchedGroups = new MatchedGroup[matchedGroups.length]; res.nodesToStringConverter = nodesToStringConverter; res.score = score; res.order = order; res.varGroupBindings = varGroupBindings; for (int i = 0; i < matchedGroups.length; i++ ) { if (matchedGroups[i] != null) { res.matchedGroups[i] = new MatchedGroup(matchedGroups[i]); } } return res; }
protected void setGroupStart(int bid, int captureGroupId, int curPosition) { if (captureGroupId >= 0) { Map<Integer,MatchedGroup> matchedGroups = getMatchedGroups(bid, true); MatchedGroup mg = matchedGroups.get(captureGroupId); if (mg != null) { // This is possible if we have patterns like "( ... )+" in which case multiple nodes can match as the subgroup // We will match the first occurence and use that as the subgroup (Java uses the last match as the subgroup) logger.fine("Setting matchBegin=" + curPosition + ": Capture group " + captureGroupId + " already exists: " + mg); } matchedGroups.put(captureGroupId, new MatchedGroup(curPosition, -1, null)); } }
protected void setGroupStart(int bid, int captureGroupId, int curPosition) { if (captureGroupId >= 0) { Map<Integer,MatchedGroup> matchedGroups = getMatchedGroups(bid, true); MatchedGroup mg = matchedGroups.get(captureGroupId); if (mg != null) { // This is possible if we have patterns like "( ... )+" in which case multiple nodes can match as the subgroup // We will match the first occurrence and use that as the subgroup (Java uses the last match as the subgroup) logger.fine("Setting matchBegin=" + curPosition + ": Capture group " + captureGroupId + " already exists: " + mg); } matchedGroups.put(captureGroupId, new MatchedGroup(curPosition, -1, null)); } }
protected void setGroupStart(int bid, int captureGroupId) { if (captureGroupId >= 0) { Map<Integer,MatchedGroup> matchedGroups = getMatchedGroups(bid, true); MatchedGroup mg = matchedGroups.get(captureGroupId); if (mg != null) { // This is possible if we have patterns like "( ... )+" in which case multiple nodes can match as the subgroup // We will match the first occurence and use that as the subgroup (Java uses the last match as the subgroup) logger.fine("Setting matchBegin=" + curPosition + ": Capture group " + captureGroupId + " already exists: " + mg); } matchedGroups.put(captureGroupId, new MatchedGroup(curPosition, -1)); } }
protected void setGroupStart(int bid, int captureGroupId, int curPosition) { if (captureGroupId >= 0) { Map<Integer,MatchedGroup> matchedGroups = getMatchedGroups(bid, true); MatchedGroup mg = matchedGroups.get(captureGroupId); if (mg != null) { // This is possible if we have patterns like "( ... )+" in which case multiple nodes can match as the subgroup // We will match the first occurrence and use that as the subgroup (Java uses the last match as the subgroup) logger.fine("Setting matchBegin=" + curPosition + ": Capture group " + captureGroupId + " already exists: " + mg); } matchedGroups.put(captureGroupId, new MatchedGroup(curPosition, -1, null)); } }
protected void setGroupEnd(int bid, int captureGroupId, int curPosition, Object value) { if (captureGroupId >= 0) { Map<Integer,MatchedGroup> matchedGroups = getMatchedGroups(bid, true); MatchedGroup mg = matchedGroups.get(captureGroupId); int end = curPosition+1; if (mg != null) { if (mg.matchEnd == -1) { matchedGroups.put(captureGroupId, new MatchedGroup(mg.matchBegin, end, value)); } else { if (mg.matchEnd != end) { logger.warning("Cannot set matchEnd=" + end + ": Capture group " + captureGroupId + " already ended: " + mg); } } } else { logger.warning("Cannot set matchEnd=" + end + ": Capture group " + captureGroupId + " is null"); } } }
protected void setGroupStart(int bid, int captureGroupId, int curPosition) { if (captureGroupId >= 0) { Map<Integer,MatchedGroup> matchedGroups = getMatchedGroups(bid, true); MatchedGroup mg = matchedGroups.get(captureGroupId); if (mg != null) { // This is possible if we have patterns like "( ... )+" in which case multiple nodes can match as the subgroup // We will match the first occurrence and use that as the subgroup (Java uses the last match as the subgroup) logger.fine("Setting matchBegin=" + curPosition + ": Capture group " + captureGroupId + " already exists: " + mg); } matchedGroups.put(captureGroupId, new MatchedGroup(curPosition, -1, null)); } }