public FeatureStructure createFS(int addr, CASImpl cas) { if (Figure_Type.this.useExistingInstance) { // Return eq fs instance if already created FeatureStructure fs = Figure_Type.this.jcas.getJfsFromCaddr(addr); if (null == fs) { fs = new Figure(addr, Figure_Type.this); Figure_Type.this.jcas.putJfsFromCaddr(addr, fs); return fs; } return fs; } else return new Figure(addr, Figure_Type.this); } };
@Override public void process(JCas cas) throws AnalysisEngineProcessException { for (Pattern pattern : patterns) { Matcher matcher = pattern.matcher(cas.getDocumentText()); if (matcher.find()) { int matchesCount = matcher.groupCount(); for (int i = 0; i < matchesCount; i++) { int begin = matcher.start(i); int end = matcher.end(i); new Figure(cas, begin, end).addToIndexes(); } } } }