id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
10,100
cogroo/cogroo4
cogroo-nlp/src/main/java/org/cogroo/tools/featurizer/DefaultFeaturizerContextGenerator.java
DefaultFeaturizerContextGenerator.createWindowFeats
private void createWindowFeats(int i, String[] toks, String[] tags, String[] preds, List<String> feats) { // Words in a 5-word window String w_2, w_1, w0, w1, w2; // Tags in a 5-word window String t_2, t_1, t0, t1, t2; // Previous predictions String p_2, p_1; w_2 = w_1 = w0 = w1 = w2 = null; t_2 = t_1 = t0 = t1 = t2 = null; p_1 = p_2 = null; if (i < 2) { w_2 = "w_2=bos"; t_2 = "t_2=bos"; p_2 = "p_2=bos"; } else { w_2 = "w_2=" + toks[i - 2]; t_2 = "t_2=" + tags[i - 2]; p_2 = "p_2" + preds[i - 2]; } if (i < 1) { w_1 = "w_1=bos"; t_1 = "t_1=bos"; p_1 = "p_1=bos"; } else { w_1 = "w_1=" + toks[i - 1]; t_1 = "t_1=" + tags[i - 1]; p_1 = "p_1=" + preds[i - 1]; } w0 = "w0=" + toks[i]; t0 = "t0=" + tags[i]; if (i + 1 >= toks.length) { w1 = "w1=eos"; t1 = "t1=eos"; } else { w1 = "w1=" + toks[i + 1]; t1 = "t1=" + tags[i + 1]; } if (i + 2 >= toks.length) { w2 = "w2=eos"; t2 = "t2=eos"; } else { w2 = "w2=" + toks[i + 2]; t2 = "t2=" + tags[i + 2]; } String[] features = new String[] { // add word features w_2, w_1, w0, w1, w2, w_1 + w0, w0 + w1, // add tag features t_2, t_1, t0, t1, t2, t_2 + t_1, t_1 + t0, t0 + t1, t1 + t2, t_2 + t_1 + t0, t_1 + t0 + t1, t0 + t1 + t2, // add pred tags p_2, p_1, p_2 + p_1, // add pred and tag p_1 + t_2, p_1 + t_1, p_1 + t0, p_1 + t1, p_1 + t2, p_1 + t_2 + t_1, p_1 + t_1 + t0, p_1 + t0 + t1, p_1 + t1 + t2, p_1 + t_2 + t_1 + t0, p_1 + t_1 + t0 + t1, p_1 + t0 + t1 + t2, // add pred and word p_1 + w_2, p_1 + w_1, p_1 + w0, p_1 + w1, p_1 + w2, p_1 + w_1 + w0, p_1 + w0 + w1 }; feats.addAll(Arrays.asList(features)); }
java
private void createWindowFeats(int i, String[] toks, String[] tags, String[] preds, List<String> feats) { // Words in a 5-word window String w_2, w_1, w0, w1, w2; // Tags in a 5-word window String t_2, t_1, t0, t1, t2; // Previous predictions String p_2, p_1; w_2 = w_1 = w0 = w1 = w2 = null; t_2 = t_1 = t0 = t1 = t2 = null; p_1 = p_2 = null; if (i < 2) { w_2 = "w_2=bos"; t_2 = "t_2=bos"; p_2 = "p_2=bos"; } else { w_2 = "w_2=" + toks[i - 2]; t_2 = "t_2=" + tags[i - 2]; p_2 = "p_2" + preds[i - 2]; } if (i < 1) { w_1 = "w_1=bos"; t_1 = "t_1=bos"; p_1 = "p_1=bos"; } else { w_1 = "w_1=" + toks[i - 1]; t_1 = "t_1=" + tags[i - 1]; p_1 = "p_1=" + preds[i - 1]; } w0 = "w0=" + toks[i]; t0 = "t0=" + tags[i]; if (i + 1 >= toks.length) { w1 = "w1=eos"; t1 = "t1=eos"; } else { w1 = "w1=" + toks[i + 1]; t1 = "t1=" + tags[i + 1]; } if (i + 2 >= toks.length) { w2 = "w2=eos"; t2 = "t2=eos"; } else { w2 = "w2=" + toks[i + 2]; t2 = "t2=" + tags[i + 2]; } String[] features = new String[] { // add word features w_2, w_1, w0, w1, w2, w_1 + w0, w0 + w1, // add tag features t_2, t_1, t0, t1, t2, t_2 + t_1, t_1 + t0, t0 + t1, t1 + t2, t_2 + t_1 + t0, t_1 + t0 + t1, t0 + t1 + t2, // add pred tags p_2, p_1, p_2 + p_1, // add pred and tag p_1 + t_2, p_1 + t_1, p_1 + t0, p_1 + t1, p_1 + t2, p_1 + t_2 + t_1, p_1 + t_1 + t0, p_1 + t0 + t1, p_1 + t1 + t2, p_1 + t_2 + t_1 + t0, p_1 + t_1 + t0 + t1, p_1 + t0 + t1 + t2, // add pred and word p_1 + w_2, p_1 + w_1, p_1 + w0, p_1 + w1, p_1 + w2, p_1 + w_1 + w0, p_1 + w0 + w1 }; feats.addAll(Arrays.asList(features)); }
[ "private", "void", "createWindowFeats", "(", "int", "i", ",", "String", "[", "]", "toks", ",", "String", "[", "]", "tags", ",", "String", "[", "]", "preds", ",", "List", "<", "String", ">", "feats", ")", "{", "// Words in a 5-word window", "String", "w_2", ",", "w_1", ",", "w0", ",", "w1", ",", "w2", ";", "// Tags in a 5-word window", "String", "t_2", ",", "t_1", ",", "t0", ",", "t1", ",", "t2", ";", "// Previous predictions", "String", "p_2", ",", "p_1", ";", "w_2", "=", "w_1", "=", "w0", "=", "w1", "=", "w2", "=", "null", ";", "t_2", "=", "t_1", "=", "t0", "=", "t1", "=", "t2", "=", "null", ";", "p_1", "=", "p_2", "=", "null", ";", "if", "(", "i", "<", "2", ")", "{", "w_2", "=", "\"w_2=bos\"", ";", "t_2", "=", "\"t_2=bos\"", ";", "p_2", "=", "\"p_2=bos\"", ";", "}", "else", "{", "w_2", "=", "\"w_2=\"", "+", "toks", "[", "i", "-", "2", "]", ";", "t_2", "=", "\"t_2=\"", "+", "tags", "[", "i", "-", "2", "]", ";", "p_2", "=", "\"p_2\"", "+", "preds", "[", "i", "-", "2", "]", ";", "}", "if", "(", "i", "<", "1", ")", "{", "w_1", "=", "\"w_1=bos\"", ";", "t_1", "=", "\"t_1=bos\"", ";", "p_1", "=", "\"p_1=bos\"", ";", "}", "else", "{", "w_1", "=", "\"w_1=\"", "+", "toks", "[", "i", "-", "1", "]", ";", "t_1", "=", "\"t_1=\"", "+", "tags", "[", "i", "-", "1", "]", ";", "p_1", "=", "\"p_1=\"", "+", "preds", "[", "i", "-", "1", "]", ";", "}", "w0", "=", "\"w0=\"", "+", "toks", "[", "i", "]", ";", "t0", "=", "\"t0=\"", "+", "tags", "[", "i", "]", ";", "if", "(", "i", "+", "1", ">=", "toks", ".", "length", ")", "{", "w1", "=", "\"w1=eos\"", ";", "t1", "=", "\"t1=eos\"", ";", "}", "else", "{", "w1", "=", "\"w1=\"", "+", "toks", "[", "i", "+", "1", "]", ";", "t1", "=", "\"t1=\"", "+", "tags", "[", "i", "+", "1", "]", ";", "}", "if", "(", "i", "+", "2", ">=", "toks", ".", "length", ")", "{", "w2", "=", "\"w2=eos\"", ";", "t2", "=", "\"t2=eos\"", ";", "}", "else", "{", "w2", "=", "\"w2=\"", "+", "toks", "[", "i", "+", "2", "]", ";", "t2", "=", "\"t2=\"", "+", "tags", "[", "i", "+", "2", "]", ";", "}", "String", "[", "]", "features", "=", "new", "String", "[", "]", "{", "// add word features", "w_2", ",", "w_1", ",", "w0", ",", "w1", ",", "w2", ",", "w_1", "+", "w0", ",", "w0", "+", "w1", ",", "// add tag features", "t_2", ",", "t_1", ",", "t0", ",", "t1", ",", "t2", ",", "t_2", "+", "t_1", ",", "t_1", "+", "t0", ",", "t0", "+", "t1", ",", "t1", "+", "t2", ",", "t_2", "+", "t_1", "+", "t0", ",", "t_1", "+", "t0", "+", "t1", ",", "t0", "+", "t1", "+", "t2", ",", "// add pred tags", "p_2", ",", "p_1", ",", "p_2", "+", "p_1", ",", "// add pred and tag", "p_1", "+", "t_2", ",", "p_1", "+", "t_1", ",", "p_1", "+", "t0", ",", "p_1", "+", "t1", ",", "p_1", "+", "t2", ",", "p_1", "+", "t_2", "+", "t_1", ",", "p_1", "+", "t_1", "+", "t0", ",", "p_1", "+", "t0", "+", "t1", ",", "p_1", "+", "t1", "+", "t2", ",", "p_1", "+", "t_2", "+", "t_1", "+", "t0", ",", "p_1", "+", "t_1", "+", "t0", "+", "t1", ",", "p_1", "+", "t0", "+", "t1", "+", "t2", ",", "// add pred and word", "p_1", "+", "w_2", ",", "p_1", "+", "w_1", ",", "p_1", "+", "w0", ",", "p_1", "+", "w1", ",", "p_1", "+", "w2", ",", "p_1", "+", "w_1", "+", "w0", ",", "p_1", "+", "w0", "+", "w1", "}", ";", "feats", ".", "addAll", "(", "Arrays", ".", "asList", "(", "features", ")", ")", ";", "}" ]
0.9674293472168595
[ "0", ".", "9674293472168595" ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-nlp/src/main/java/org/cogroo/tools/featurizer/DefaultFeaturizerContextGenerator.java#L234-L317
10,101
cogroo/cogroo4
cogroo-nlp/src/main/java/org/cogroo/tools/featurizer/DefaultFeaturizerContextGenerator.java
DefaultFeaturizerContextGenerator.create3WindowFeats
private void create3WindowFeats(int i, String[] toks, String[] tags, String[] preds, List<String> feats) { // Words in a 5-word window String w_1, w0, w1; // Tags in a 5-word window String t_1, t0, t1; // Previous predictions String p_2, p_1; w0 = w1 = null; t_1 = t0 = t1 = null; p_1 = p_2 = null; if (i < 2) { p_2 = "p_2=bos"; } else { p_2 = "p_2" + preds[i - 2]; } if (i < 1) { w_1 = "w_1=bos"; t_1 = "t_1=bos"; p_1 = "p_1=bos"; } else { w_1 = "w_1=" + toks[i - 1]; t_1 = "t_1=" + tags[i - 1]; p_1 = "p_1=" + preds[i - 1]; } w0 = "w0=" + toks[i]; t0 = "t0=" + tags[i]; if (i + 1 >= toks.length) { w1 = "w1=eos"; t1 = "t1=eos"; } else { w1 = "w1=" + toks[i + 1]; t1 = "t1=" + tags[i + 1]; } String[] features = new String[] { // add word features w_1, w0, w1, w_1 + w0, w0 + w1, // add tag features t_1, t0, t1, t_1 + t0, t0 + t1, t_1 + t0 + t1, // add pred tags p_2, p_1, p_2 + p_1, // add pred and tag p_1 + t_1, p_1 + t0, p_1 + t1, p_1 + t_1 + t0, p_1 + t0 + t1, p_1 + t_1 + t0 + t1, // add pred and word p_1 + w_1, p_1 + w0, p_1 + w1, p_1 + w_1 + w0, p_1 + w0 + w1 }; feats.addAll(Arrays.asList(features)); }
java
private void create3WindowFeats(int i, String[] toks, String[] tags, String[] preds, List<String> feats) { // Words in a 5-word window String w_1, w0, w1; // Tags in a 5-word window String t_1, t0, t1; // Previous predictions String p_2, p_1; w0 = w1 = null; t_1 = t0 = t1 = null; p_1 = p_2 = null; if (i < 2) { p_2 = "p_2=bos"; } else { p_2 = "p_2" + preds[i - 2]; } if (i < 1) { w_1 = "w_1=bos"; t_1 = "t_1=bos"; p_1 = "p_1=bos"; } else { w_1 = "w_1=" + toks[i - 1]; t_1 = "t_1=" + tags[i - 1]; p_1 = "p_1=" + preds[i - 1]; } w0 = "w0=" + toks[i]; t0 = "t0=" + tags[i]; if (i + 1 >= toks.length) { w1 = "w1=eos"; t1 = "t1=eos"; } else { w1 = "w1=" + toks[i + 1]; t1 = "t1=" + tags[i + 1]; } String[] features = new String[] { // add word features w_1, w0, w1, w_1 + w0, w0 + w1, // add tag features t_1, t0, t1, t_1 + t0, t0 + t1, t_1 + t0 + t1, // add pred tags p_2, p_1, p_2 + p_1, // add pred and tag p_1 + t_1, p_1 + t0, p_1 + t1, p_1 + t_1 + t0, p_1 + t0 + t1, p_1 + t_1 + t0 + t1, // add pred and word p_1 + w_1, p_1 + w0, p_1 + w1, p_1 + w_1 + w0, p_1 + w0 + w1 }; feats.addAll(Arrays.asList(features)); }
[ "private", "void", "create3WindowFeats", "(", "int", "i", ",", "String", "[", "]", "toks", ",", "String", "[", "]", "tags", ",", "String", "[", "]", "preds", ",", "List", "<", "String", ">", "feats", ")", "{", "// Words in a 5-word window", "String", "w_1", ",", "w0", ",", "w1", ";", "// Tags in a 5-word window", "String", "t_1", ",", "t0", ",", "t1", ";", "// Previous predictions", "String", "p_2", ",", "p_1", ";", "w0", "=", "w1", "=", "null", ";", "t_1", "=", "t0", "=", "t1", "=", "null", ";", "p_1", "=", "p_2", "=", "null", ";", "if", "(", "i", "<", "2", ")", "{", "p_2", "=", "\"p_2=bos\"", ";", "}", "else", "{", "p_2", "=", "\"p_2\"", "+", "preds", "[", "i", "-", "2", "]", ";", "}", "if", "(", "i", "<", "1", ")", "{", "w_1", "=", "\"w_1=bos\"", ";", "t_1", "=", "\"t_1=bos\"", ";", "p_1", "=", "\"p_1=bos\"", ";", "}", "else", "{", "w_1", "=", "\"w_1=\"", "+", "toks", "[", "i", "-", "1", "]", ";", "t_1", "=", "\"t_1=\"", "+", "tags", "[", "i", "-", "1", "]", ";", "p_1", "=", "\"p_1=\"", "+", "preds", "[", "i", "-", "1", "]", ";", "}", "w0", "=", "\"w0=\"", "+", "toks", "[", "i", "]", ";", "t0", "=", "\"t0=\"", "+", "tags", "[", "i", "]", ";", "if", "(", "i", "+", "1", ">=", "toks", ".", "length", ")", "{", "w1", "=", "\"w1=eos\"", ";", "t1", "=", "\"t1=eos\"", ";", "}", "else", "{", "w1", "=", "\"w1=\"", "+", "toks", "[", "i", "+", "1", "]", ";", "t1", "=", "\"t1=\"", "+", "tags", "[", "i", "+", "1", "]", ";", "}", "String", "[", "]", "features", "=", "new", "String", "[", "]", "{", "// add word features", "w_1", ",", "w0", ",", "w1", ",", "w_1", "+", "w0", ",", "w0", "+", "w1", ",", "// add tag features", "t_1", ",", "t0", ",", "t1", ",", "t_1", "+", "t0", ",", "t0", "+", "t1", ",", "t_1", "+", "t0", "+", "t1", ",", "// add pred tags", "p_2", ",", "p_1", ",", "p_2", "+", "p_1", ",", "// add pred and tag", "p_1", "+", "t_1", ",", "p_1", "+", "t0", ",", "p_1", "+", "t1", ",", "p_1", "+", "t_1", "+", "t0", ",", "p_1", "+", "t0", "+", "t1", ",", "p_1", "+", "t_1", "+", "t0", "+", "t1", ",", "// add pred and word", "p_1", "+", "w_1", ",", "p_1", "+", "w0", ",", "p_1", "+", "w1", ",", "p_1", "+", "w_1", "+", "w0", ",", "p_1", "+", "w0", "+", "w1", "}", ";", "feats", ".", "addAll", "(", "Arrays", ".", "asList", "(", "features", ")", ")", ";", "}" ]
0.9670307770871996
[ "0", ".", "9670307770871996" ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-nlp/src/main/java/org/cogroo/tools/featurizer/DefaultFeaturizerContextGenerator.java#L320-L390
10,102
DataArt/CalculationEngine
calculation-engine/engine-converters/src/main/java/com/dataart/spreadsheetanalytics/engine/DependencyExtractors.java
DependencyExtractors.resolveCellDependencies
static List<IA1Address> resolveCellDependencies(IA1Address cellAddress, Sheet sheet, FormulaParsingWorkbook workbook) { Row row = sheet.getRow(cellAddress.row()); if (row == null) { return emptyList(); } Cell cell = row.getCell(cellAddress.column()); if (cell == null) { return emptyList(); } if (CELL_TYPE_FORMULA != cell.getCellType()) { return singletonList(cellAddress); } List<IA1Address> dependencies = new LinkedList<>(); for (Ptg ptg : parse(cell.getCellFormula(), workbook, CELL, 0)) { /* TODO: only one sheet is supported */ if (ptg instanceof RefPtg) { RefPtg ref = (RefPtg) ptg; dependencies.addAll(resolveCellDependencies(fromRowColumn(ref.getRow(), ref.getColumn()), sheet, workbook)); } else if (ptg instanceof AreaPtg) { AreaPtg area = (AreaPtg) ptg; for (int r = area.getFirstRow(); r <= area.getLastRow(); r++) { for (int c = area.getFirstColumn(); c <= area.getLastColumn(); c++) { dependencies.addAll(resolveCellDependencies(fromRowColumn(r, c), sheet, workbook)); } } } dependencies.add(cellAddress); } return dependencies; }
java
static List<IA1Address> resolveCellDependencies(IA1Address cellAddress, Sheet sheet, FormulaParsingWorkbook workbook) { Row row = sheet.getRow(cellAddress.row()); if (row == null) { return emptyList(); } Cell cell = row.getCell(cellAddress.column()); if (cell == null) { return emptyList(); } if (CELL_TYPE_FORMULA != cell.getCellType()) { return singletonList(cellAddress); } List<IA1Address> dependencies = new LinkedList<>(); for (Ptg ptg : parse(cell.getCellFormula(), workbook, CELL, 0)) { /* TODO: only one sheet is supported */ if (ptg instanceof RefPtg) { RefPtg ref = (RefPtg) ptg; dependencies.addAll(resolveCellDependencies(fromRowColumn(ref.getRow(), ref.getColumn()), sheet, workbook)); } else if (ptg instanceof AreaPtg) { AreaPtg area = (AreaPtg) ptg; for (int r = area.getFirstRow(); r <= area.getLastRow(); r++) { for (int c = area.getFirstColumn(); c <= area.getLastColumn(); c++) { dependencies.addAll(resolveCellDependencies(fromRowColumn(r, c), sheet, workbook)); } } } dependencies.add(cellAddress); } return dependencies; }
[ "static", "List", "<", "IA1Address", ">", "resolveCellDependencies", "(", "IA1Address", "cellAddress", ",", "Sheet", "sheet", ",", "FormulaParsingWorkbook", "workbook", ")", "{", "Row", "row", "=", "sheet", ".", "getRow", "(", "cellAddress", ".", "row", "(", ")", ")", ";", "if", "(", "row", "==", "null", ")", "{", "return", "emptyList", "(", ")", ";", "}", "Cell", "cell", "=", "row", ".", "getCell", "(", "cellAddress", ".", "column", "(", ")", ")", ";", "if", "(", "cell", "==", "null", ")", "{", "return", "emptyList", "(", ")", ";", "}", "if", "(", "CELL_TYPE_FORMULA", "!=", "cell", ".", "getCellType", "(", ")", ")", "{", "return", "singletonList", "(", "cellAddress", ")", ";", "}", "List", "<", "IA1Address", ">", "dependencies", "=", "new", "LinkedList", "<>", "(", ")", ";", "for", "(", "Ptg", "ptg", ":", "parse", "(", "cell", ".", "getCellFormula", "(", ")", ",", "workbook", ",", "CELL", ",", "0", ")", ")", "{", "/* TODO: only one sheet is supported */", "if", "(", "ptg", "instanceof", "RefPtg", ")", "{", "RefPtg", "ref", "=", "(", "RefPtg", ")", "ptg", ";", "dependencies", ".", "addAll", "(", "resolveCellDependencies", "(", "fromRowColumn", "(", "ref", ".", "getRow", "(", ")", ",", "ref", ".", "getColumn", "(", ")", ")", ",", "sheet", ",", "workbook", ")", ")", ";", "}", "else", "if", "(", "ptg", "instanceof", "AreaPtg", ")", "{", "AreaPtg", "area", "=", "(", "AreaPtg", ")", "ptg", ";", "for", "(", "int", "r", "=", "area", ".", "getFirstRow", "(", ")", ";", "r", "<=", "area", ".", "getLastRow", "(", ")", ";", "r", "++", ")", "{", "for", "(", "int", "c", "=", "area", ".", "getFirstColumn", "(", ")", ";", "c", "<=", "area", ".", "getLastColumn", "(", ")", ";", "c", "++", ")", "{", "dependencies", ".", "addAll", "(", "resolveCellDependencies", "(", "fromRowColumn", "(", "r", ",", "c", ")", ",", "sheet", ",", "workbook", ")", ")", ";", "}", "}", "}", "dependencies", ".", "add", "(", "cellAddress", ")", ";", "}", "return", "dependencies", ";", "}" ]
For given cell address gives a list of this cell's dependencies.
[ "For", "given", "cell", "address", "gives", "a", "list", "of", "this", "cell", "s", "dependencies", "." ]
34ce1d9c1f9b57a502906b274311d28580b134e5
https://github.com/DataArt/CalculationEngine/blob/34ce1d9c1f9b57a502906b274311d28580b134e5/calculation-engine/engine-converters/src/main/java/com/dataart/spreadsheetanalytics/engine/DependencyExtractors.java#L176-L207
10,103
cogroo/cogroo4
cogroo-gc/src/main/java/org/cogroo/entities/Sentence.java
Sentence.getSentence
public String getSentence() { if(sentence != null) return this.sentence; else if(doc != null) { return span.getCoveredText(doc).toString(); } else { return null; } }
java
public String getSentence() { if(sentence != null) return this.sentence; else if(doc != null) { return span.getCoveredText(doc).toString(); } else { return null; } }
[ "public", "String", "getSentence", "(", ")", "{", "if", "(", "sentence", "!=", "null", ")", "return", "this", ".", "sentence", ";", "else", "if", "(", "doc", "!=", "null", ")", "{", "return", "span", ".", "getCoveredText", "(", "doc", ")", ".", "toString", "(", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Gets the original sentence. @return the original sentence
[ "Gets", "the", "original", "sentence", "." ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-gc/src/main/java/org/cogroo/entities/Sentence.java#L90-L98
10,104
cogroo/cogroo4
lang/pt_br/cogroo-addon/src/org/cogroo/addon/util/SecurityUtil.java
SecurityUtil.encrypt
public byte[] encrypt(PrivateKey privateKey, byte[] encryptedSecretKey, String data) throws InvalidKeyException { byte[] encryptedData = null; try { byte[] chave = privateKey.getEncoded(); // Decrypt secret symmetric key with private key Cipher rsacf = Cipher.getInstance("RSA"); rsacf.init(Cipher.DECRYPT_MODE, privateKey); byte[] secretKey = rsacf.doFinal(encryptedSecretKey); encryptedData = encrypt(secretKey, data); } catch (Exception e) { LOG.log(Level.SEVERE, "Exception encrypting data", e); } return encryptedData; }
java
public byte[] encrypt(PrivateKey privateKey, byte[] encryptedSecretKey, String data) throws InvalidKeyException { byte[] encryptedData = null; try { byte[] chave = privateKey.getEncoded(); // Decrypt secret symmetric key with private key Cipher rsacf = Cipher.getInstance("RSA"); rsacf.init(Cipher.DECRYPT_MODE, privateKey); byte[] secretKey = rsacf.doFinal(encryptedSecretKey); encryptedData = encrypt(secretKey, data); } catch (Exception e) { LOG.log(Level.SEVERE, "Exception encrypting data", e); } return encryptedData; }
[ "public", "byte", "[", "]", "encrypt", "(", "PrivateKey", "privateKey", ",", "byte", "[", "]", "encryptedSecretKey", ",", "String", "data", ")", "throws", "InvalidKeyException", "{", "byte", "[", "]", "encryptedData", "=", "null", ";", "try", "{", "byte", "[", "]", "chave", "=", "privateKey", ".", "getEncoded", "(", ")", ";", "// Decrypt secret symmetric key with private key", "Cipher", "rsacf", "=", "Cipher", ".", "getInstance", "(", "\"RSA\"", ")", ";", "rsacf", ".", "init", "(", "Cipher", ".", "DECRYPT_MODE", ",", "privateKey", ")", ";", "byte", "[", "]", "secretKey", "=", "rsacf", ".", "doFinal", "(", "encryptedSecretKey", ")", ";", "encryptedData", "=", "encrypt", "(", "secretKey", ",", "data", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "LOG", ".", "log", "(", "Level", ".", "SEVERE", ",", "\"Exception encrypting data\"", ",", "e", ")", ";", "}", "return", "encryptedData", ";", "}" ]
Encrypt data using an key encrypted with a private key. @param privateKey the private key to decrypt the secret key @param encryptedSecretKey a encrypted secret key @param data the data to encrypt @return the encrypted data @throws InvalidKeyException one of the keys is invalid
[ "Encrypt", "data", "using", "an", "key", "encrypted", "with", "a", "private", "key", "." ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/lang/pt_br/cogroo-addon/src/org/cogroo/addon/util/SecurityUtil.java#L55-L70
10,105
cogroo/cogroo4
lang/pt_br/cogroo-addon/src/org/cogroo/addon/util/SecurityUtil.java
SecurityUtil.encrypt
public synchronized String encrypt(String plaintext) { MessageDigest md = null; try { md = MessageDigest.getInstance("SHA"); md.update(plaintext.getBytes(UTF8)); } catch (Exception e) { LOG.log(Level.SEVERE, "Should not happen!", e); } byte raw[] = md.digest(); return encode(raw); }
java
public synchronized String encrypt(String plaintext) { MessageDigest md = null; try { md = MessageDigest.getInstance("SHA"); md.update(plaintext.getBytes(UTF8)); } catch (Exception e) { LOG.log(Level.SEVERE, "Should not happen!", e); } byte raw[] = md.digest(); return encode(raw); }
[ "public", "synchronized", "String", "encrypt", "(", "String", "plaintext", ")", "{", "MessageDigest", "md", "=", "null", ";", "try", "{", "md", "=", "MessageDigest", ".", "getInstance", "(", "\"SHA\"", ")", ";", "md", ".", "update", "(", "plaintext", ".", "getBytes", "(", "UTF8", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "LOG", ".", "log", "(", "Level", ".", "SEVERE", ",", "\"Should not happen!\"", ",", "e", ")", ";", "}", "byte", "raw", "[", "]", "=", "md", ".", "digest", "(", ")", ";", "return", "encode", "(", "raw", ")", ";", "}" ]
Encrypt a string using SHA @param plaintext the original text @return resultant hash
[ "Encrypt", "a", "string", "using", "SHA" ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/lang/pt_br/cogroo-addon/src/org/cogroo/addon/util/SecurityUtil.java#L189-L200
10,106
DataArt/CalculationEngine
calculation-engine/engine-converters/src/main/java/com/dataart/spreadsheetanalytics/engine/ConverterUtils.java
ConverterUtils.isFunctionInFormula
static boolean isFunctionInFormula(String formula, String function) { String filteredFormula = formula.replace(POI_FUNCTION_PREFIX, ""); return filteredFormula.startsWith(function) && filteredFormula.replace(function, "").startsWith("("); }
java
static boolean isFunctionInFormula(String formula, String function) { String filteredFormula = formula.replace(POI_FUNCTION_PREFIX, ""); return filteredFormula.startsWith(function) && filteredFormula.replace(function, "").startsWith("("); }
[ "static", "boolean", "isFunctionInFormula", "(", "String", "formula", ",", "String", "function", ")", "{", "String", "filteredFormula", "=", "formula", ".", "replace", "(", "POI_FUNCTION_PREFIX", ",", "\"\"", ")", ";", "return", "filteredFormula", ".", "startsWith", "(", "function", ")", "&&", "filteredFormula", ".", "replace", "(", "function", ",", "\"\"", ")", ".", "startsWith", "(", "\"(\"", ")", ";", "}" ]
Checks if formula string contains given function.
[ "Checks", "if", "formula", "string", "contains", "given", "function", "." ]
34ce1d9c1f9b57a502906b274311d28580b134e5
https://github.com/DataArt/CalculationEngine/blob/34ce1d9c1f9b57a502906b274311d28580b134e5/calculation-engine/engine-converters/src/main/java/com/dataart/spreadsheetanalytics/engine/ConverterUtils.java#L165-L168
10,107
DataArt/CalculationEngine
calculation-engine/engine-converters/src/main/java/com/dataart/spreadsheetanalytics/engine/ConverterUtils.java
ConverterUtils.isFormula
static boolean isFormula(String value, EvaluationWorkbook workbook) { try { return FormulaParser.parse(value, (FormulaParsingWorkbook) workbook, 0, 0).length > 1; } // TODO: formulaType and sheet index are 0 catch (FormulaParseException e) { return false; } }
java
static boolean isFormula(String value, EvaluationWorkbook workbook) { try { return FormulaParser.parse(value, (FormulaParsingWorkbook) workbook, 0, 0).length > 1; } // TODO: formulaType and sheet index are 0 catch (FormulaParseException e) { return false; } }
[ "static", "boolean", "isFormula", "(", "String", "value", ",", "EvaluationWorkbook", "workbook", ")", "{", "try", "{", "return", "FormulaParser", ".", "parse", "(", "value", ",", "(", "FormulaParsingWorkbook", ")", "workbook", ",", "0", ",", "0", ")", ".", "length", ">", "1", ";", "}", "// TODO: formulaType and sheet index are 0", "catch", "(", "FormulaParseException", "e", ")", "{", "return", "false", ";", "}", "}" ]
Returns true if value string is formula
[ "Returns", "true", "if", "value", "string", "is", "formula" ]
34ce1d9c1f9b57a502906b274311d28580b134e5
https://github.com/DataArt/CalculationEngine/blob/34ce1d9c1f9b57a502906b274311d28580b134e5/calculation-engine/engine-converters/src/main/java/com/dataart/spreadsheetanalytics/engine/ConverterUtils.java#L260-L263
10,108
cogroo/cogroo4
cogroo-nlp/src/main/java/org/cogroo/dictionary/impl/FSAFeatureDictionary.java
FSAFeatureDictionary.getFeatures
public String[] getFeatures(String word, String pos) { return lookup(new WordTag(word, pos)); }
java
public String[] getFeatures(String word, String pos) { return lookup(new WordTag(word, pos)); }
[ "public", "String", "[", "]", "getFeatures", "(", "String", "word", ",", "String", "pos", ")", "{", "return", "lookup", "(", "new", "WordTag", "(", "word", ",", "pos", ")", ")", ";", "}" ]
add all features if pos == null
[ "add", "all", "features", "if", "pos", "==", "null" ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-nlp/src/main/java/org/cogroo/dictionary/impl/FSAFeatureDictionary.java#L76-L78
10,109
cogroo/cogroo4
cogroo-eval/UIMAWrappers/UIMAFeaturizer/src/main/java/opennlp/uima/featurizer/Featurizer.java
Featurizer.process
public void process(CAS tcas) { final AnnotationComboIterator comboIterator = new AnnotationComboIterator(tcas, mSentenceType, mTokenType); for (AnnotationIteratorPair annotationIteratorPair : comboIterator) { final List<AnnotationFS> sentenceTokenAnnotationList = new LinkedList<AnnotationFS>(); final List<String> sentenceTokenList = new LinkedList<String>(); final List<String> sentenceTagsList = new LinkedList<String>(); for (AnnotationFS tokenAnnotation : annotationIteratorPair.getSubIterator()) { sentenceTokenAnnotationList.add(tokenAnnotation); sentenceTokenList.add(tokenAnnotation.getFeatureValueAsString(mLexemeFeature)); sentenceTagsList.add(tokenAnnotation.getFeatureValueAsString(mPosFeature)); } String[] toks = sentenceTokenList.toArray(new String[sentenceTokenList.size()]); String[] tags = sentenceTagsList.toArray(new String[sentenceTagsList.size()]); String[] featureTag = mFeaturizer.featurize(toks, tags); final Iterator<AnnotationFS> sentenceTokenIterator = sentenceTokenAnnotationList.iterator(); int index = 0; while (sentenceTokenIterator.hasNext()) { final AnnotationFS tokenAnnotation = sentenceTokenIterator.next(); tokenAnnotation.setStringValue(mFeaturizerFeature, featureTag[index]); index++; } } }
java
public void process(CAS tcas) { final AnnotationComboIterator comboIterator = new AnnotationComboIterator(tcas, mSentenceType, mTokenType); for (AnnotationIteratorPair annotationIteratorPair : comboIterator) { final List<AnnotationFS> sentenceTokenAnnotationList = new LinkedList<AnnotationFS>(); final List<String> sentenceTokenList = new LinkedList<String>(); final List<String> sentenceTagsList = new LinkedList<String>(); for (AnnotationFS tokenAnnotation : annotationIteratorPair.getSubIterator()) { sentenceTokenAnnotationList.add(tokenAnnotation); sentenceTokenList.add(tokenAnnotation.getFeatureValueAsString(mLexemeFeature)); sentenceTagsList.add(tokenAnnotation.getFeatureValueAsString(mPosFeature)); } String[] toks = sentenceTokenList.toArray(new String[sentenceTokenList.size()]); String[] tags = sentenceTagsList.toArray(new String[sentenceTagsList.size()]); String[] featureTag = mFeaturizer.featurize(toks, tags); final Iterator<AnnotationFS> sentenceTokenIterator = sentenceTokenAnnotationList.iterator(); int index = 0; while (sentenceTokenIterator.hasNext()) { final AnnotationFS tokenAnnotation = sentenceTokenIterator.next(); tokenAnnotation.setStringValue(mFeaturizerFeature, featureTag[index]); index++; } } }
[ "public", "void", "process", "(", "CAS", "tcas", ")", "{", "final", "AnnotationComboIterator", "comboIterator", "=", "new", "AnnotationComboIterator", "(", "tcas", ",", "mSentenceType", ",", "mTokenType", ")", ";", "for", "(", "AnnotationIteratorPair", "annotationIteratorPair", ":", "comboIterator", ")", "{", "final", "List", "<", "AnnotationFS", ">", "sentenceTokenAnnotationList", "=", "new", "LinkedList", "<", "AnnotationFS", ">", "(", ")", ";", "final", "List", "<", "String", ">", "sentenceTokenList", "=", "new", "LinkedList", "<", "String", ">", "(", ")", ";", "final", "List", "<", "String", ">", "sentenceTagsList", "=", "new", "LinkedList", "<", "String", ">", "(", ")", ";", "for", "(", "AnnotationFS", "tokenAnnotation", ":", "annotationIteratorPair", ".", "getSubIterator", "(", ")", ")", "{", "sentenceTokenAnnotationList", ".", "add", "(", "tokenAnnotation", ")", ";", "sentenceTokenList", ".", "add", "(", "tokenAnnotation", ".", "getFeatureValueAsString", "(", "mLexemeFeature", ")", ")", ";", "sentenceTagsList", ".", "add", "(", "tokenAnnotation", ".", "getFeatureValueAsString", "(", "mPosFeature", ")", ")", ";", "}", "String", "[", "]", "toks", "=", "sentenceTokenList", ".", "toArray", "(", "new", "String", "[", "sentenceTokenList", ".", "size", "(", ")", "]", ")", ";", "String", "[", "]", "tags", "=", "sentenceTagsList", ".", "toArray", "(", "new", "String", "[", "sentenceTagsList", ".", "size", "(", ")", "]", ")", ";", "String", "[", "]", "featureTag", "=", "mFeaturizer", ".", "featurize", "(", "toks", ",", "tags", ")", ";", "final", "Iterator", "<", "AnnotationFS", ">", "sentenceTokenIterator", "=", "sentenceTokenAnnotationList", ".", "iterator", "(", ")", ";", "int", "index", "=", "0", ";", "while", "(", "sentenceTokenIterator", ".", "hasNext", "(", ")", ")", "{", "final", "AnnotationFS", "tokenAnnotation", "=", "sentenceTokenIterator", ".", "next", "(", ")", ";", "tokenAnnotation", ".", "setStringValue", "(", "mFeaturizerFeature", ",", "featureTag", "[", "index", "]", ")", ";", "index", "++", ";", "}", "}", "}" ]
Performs featurizer on the given tcas object.
[ "Performs", "featurizer", "on", "the", "given", "tcas", "object", "." ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-eval/UIMAWrappers/UIMAFeaturizer/src/main/java/opennlp/uima/featurizer/Featurizer.java#L138-L175
10,110
cogroo/cogroo4
cogroo-gc/src/main/java/org/cogroo/tools/checker/rules/util/EqualsUtils.java
EqualsUtils.areElementEquals
public static boolean areElementEquals(Element element1, Element element2) { for (Mask mask1 : element1.getMask()) { if (!areBooleanEquals(element1.isNegated(), element2.isNegated())) { // Negated. return false; } for (Mask mask2 : element2.getMask()) { if (!areStringEquals(mask1.getLexemeMask(), mask2.getLexemeMask())) { // LexemeMask. return false; } else if (!areStringEquals(mask1.getPrimitiveMask(), mask2.getPrimitiveMask())) { // PrimitiveMask. return false; } else if (!areTagMaskEquals(mask1.getTagMask(), mask2.getTagMask())) { // TagMask. return false; } } } return true; }
java
public static boolean areElementEquals(Element element1, Element element2) { for (Mask mask1 : element1.getMask()) { if (!areBooleanEquals(element1.isNegated(), element2.isNegated())) { // Negated. return false; } for (Mask mask2 : element2.getMask()) { if (!areStringEquals(mask1.getLexemeMask(), mask2.getLexemeMask())) { // LexemeMask. return false; } else if (!areStringEquals(mask1.getPrimitiveMask(), mask2.getPrimitiveMask())) { // PrimitiveMask. return false; } else if (!areTagMaskEquals(mask1.getTagMask(), mask2.getTagMask())) { // TagMask. return false; } } } return true; }
[ "public", "static", "boolean", "areElementEquals", "(", "Element", "element1", ",", "Element", "element2", ")", "{", "for", "(", "Mask", "mask1", ":", "element1", ".", "getMask", "(", ")", ")", "{", "if", "(", "!", "areBooleanEquals", "(", "element1", ".", "isNegated", "(", ")", ",", "element2", ".", "isNegated", "(", ")", ")", ")", "{", "// Negated.\r", "return", "false", ";", "}", "for", "(", "Mask", "mask2", ":", "element2", ".", "getMask", "(", ")", ")", "{", "if", "(", "!", "areStringEquals", "(", "mask1", ".", "getLexemeMask", "(", ")", ",", "mask2", ".", "getLexemeMask", "(", ")", ")", ")", "{", "// LexemeMask.\r", "return", "false", ";", "}", "else", "if", "(", "!", "areStringEquals", "(", "mask1", ".", "getPrimitiveMask", "(", ")", ",", "mask2", ".", "getPrimitiveMask", "(", ")", ")", ")", "{", "// PrimitiveMask.\r", "return", "false", ";", "}", "else", "if", "(", "!", "areTagMaskEquals", "(", "mask1", ".", "getTagMask", "(", ")", ",", "mask2", ".", "getTagMask", "(", ")", ")", ")", "{", "// TagMask.\r", "return", "false", ";", "}", "}", "}", "return", "true", ";", "}" ]
Checks if two elements are equals. @param element1 from tree element {@link Element} @param element2 from rule element {@link Element} @return true if the elements are equal, false otherwise
[ "Checks", "if", "two", "elements", "are", "equals", "." ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-gc/src/main/java/org/cogroo/tools/checker/rules/util/EqualsUtils.java#L68-L88
10,111
cogroo/cogroo4
cogroo-gc/src/main/java/org/cogroo/tools/checker/rules/util/EqualsUtils.java
EqualsUtils.areTagMaskEquals
public static boolean areTagMaskEquals(TagMask tagMask1, TagMask tagMask2) { if ((tagMask1 == null && tagMask2 != null) || (tagMask1 != null && tagMask2 == null)) { return false; } else if (tagMask1 != null && tagMask2 != null) { if (tagMask1.getCase() != tagMask2.getCase()) { return false; } else if (tagMask1.getClazz() != tagMask2.getClazz()) { return false; } else if (tagMask1.getGender() != tagMask2.getGender()) { return false; } else if (tagMask1.getMood() != tagMask2.getMood()) { return false; } else if (tagMask1.getNumber() != tagMask2.getNumber()) { return false; } else if (tagMask1.getPerson() != tagMask2.getPerson()) { return false; } else if (tagMask1.getPunctuation() != tagMask2.getPunctuation()) { return false; } else if (tagMask1.getSyntacticFunction() != tagMask2.getSyntacticFunction()) { return false; } else if (tagMask1.getTense() != tagMask2.getTense()) { return false; } // TODO complete with the rest of the tag masks (if any) } return true; }
java
public static boolean areTagMaskEquals(TagMask tagMask1, TagMask tagMask2) { if ((tagMask1 == null && tagMask2 != null) || (tagMask1 != null && tagMask2 == null)) { return false; } else if (tagMask1 != null && tagMask2 != null) { if (tagMask1.getCase() != tagMask2.getCase()) { return false; } else if (tagMask1.getClazz() != tagMask2.getClazz()) { return false; } else if (tagMask1.getGender() != tagMask2.getGender()) { return false; } else if (tagMask1.getMood() != tagMask2.getMood()) { return false; } else if (tagMask1.getNumber() != tagMask2.getNumber()) { return false; } else if (tagMask1.getPerson() != tagMask2.getPerson()) { return false; } else if (tagMask1.getPunctuation() != tagMask2.getPunctuation()) { return false; } else if (tagMask1.getSyntacticFunction() != tagMask2.getSyntacticFunction()) { return false; } else if (tagMask1.getTense() != tagMask2.getTense()) { return false; } // TODO complete with the rest of the tag masks (if any) } return true; }
[ "public", "static", "boolean", "areTagMaskEquals", "(", "TagMask", "tagMask1", ",", "TagMask", "tagMask2", ")", "{", "if", "(", "(", "tagMask1", "==", "null", "&&", "tagMask2", "!=", "null", ")", "||", "(", "tagMask1", "!=", "null", "&&", "tagMask2", "==", "null", ")", ")", "{", "return", "false", ";", "}", "else", "if", "(", "tagMask1", "!=", "null", "&&", "tagMask2", "!=", "null", ")", "{", "if", "(", "tagMask1", ".", "getCase", "(", ")", "!=", "tagMask2", ".", "getCase", "(", ")", ")", "{", "return", "false", ";", "}", "else", "if", "(", "tagMask1", ".", "getClazz", "(", ")", "!=", "tagMask2", ".", "getClazz", "(", ")", ")", "{", "return", "false", ";", "}", "else", "if", "(", "tagMask1", ".", "getGender", "(", ")", "!=", "tagMask2", ".", "getGender", "(", ")", ")", "{", "return", "false", ";", "}", "else", "if", "(", "tagMask1", ".", "getMood", "(", ")", "!=", "tagMask2", ".", "getMood", "(", ")", ")", "{", "return", "false", ";", "}", "else", "if", "(", "tagMask1", ".", "getNumber", "(", ")", "!=", "tagMask2", ".", "getNumber", "(", ")", ")", "{", "return", "false", ";", "}", "else", "if", "(", "tagMask1", ".", "getPerson", "(", ")", "!=", "tagMask2", ".", "getPerson", "(", ")", ")", "{", "return", "false", ";", "}", "else", "if", "(", "tagMask1", ".", "getPunctuation", "(", ")", "!=", "tagMask2", ".", "getPunctuation", "(", ")", ")", "{", "return", "false", ";", "}", "else", "if", "(", "tagMask1", ".", "getSyntacticFunction", "(", ")", "!=", "tagMask2", ".", "getSyntacticFunction", "(", ")", ")", "{", "return", "false", ";", "}", "else", "if", "(", "tagMask1", ".", "getTense", "(", ")", "!=", "tagMask2", ".", "getTense", "(", ")", ")", "{", "return", "false", ";", "}", "// TODO complete with the rest of the tag masks (if any)\r", "}", "return", "true", ";", "}" ]
Checks if two tag masks are equals. The tag masks can be both null, one of them null or none of them null. @param tagMask1 from tree element {@link TagMask} @param tagMask2 from rule element {@link TagMask} @return true if equals, otherwise
[ "Checks", "if", "two", "tag", "masks", "are", "equals", ".", "The", "tag", "masks", "can", "be", "both", "null", "one", "of", "them", "null", "or", "none", "of", "them", "null", "." ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-gc/src/main/java/org/cogroo/tools/checker/rules/util/EqualsUtils.java#L98-L125
10,112
cogroo/cogroo4
cogroo-gc/src/main/java/org/cogroo/tools/checker/rules/util/EqualsUtils.java
EqualsUtils.areBooleanEquals
public static boolean areBooleanEquals(Boolean boolean1, Boolean boolean2) { if (boolean1 != null && !boolean1.equals(boolean2)) { return false; } else if (boolean2 != null && !boolean2.equals(boolean1)) { return false; } return true; }
java
public static boolean areBooleanEquals(Boolean boolean1, Boolean boolean2) { if (boolean1 != null && !boolean1.equals(boolean2)) { return false; } else if (boolean2 != null && !boolean2.equals(boolean1)) { return false; } return true; }
[ "public", "static", "boolean", "areBooleanEquals", "(", "Boolean", "boolean1", ",", "Boolean", "boolean2", ")", "{", "if", "(", "boolean1", "!=", "null", "&&", "!", "boolean1", ".", "equals", "(", "boolean2", ")", ")", "{", "return", "false", ";", "}", "else", "if", "(", "boolean2", "!=", "null", "&&", "!", "boolean2", ".", "equals", "(", "boolean1", ")", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}" ]
Checks if two Booleans are equals. The booleans can be both null, one of them null or none of them null. @param boolean1 from tree tree element @param boolean2 from rule element @return true if and only if the two booleans are equal (both equal or both null)
[ "Checks", "if", "two", "Booleans", "are", "equals", ".", "The", "booleans", "can", "be", "both", "null", "one", "of", "them", "null", "or", "none", "of", "them", "null", "." ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-gc/src/main/java/org/cogroo/tools/checker/rules/util/EqualsUtils.java#L135-L142
10,113
cogroo/cogroo4
cogroo-gc/src/main/java/org/cogroo/tools/checker/rules/util/EqualsUtils.java
EqualsUtils.areStringEquals
public static boolean areStringEquals(String string1, String string2) { /* string1 string2 outcome * null null true * null x false * x null false * x y false * x x true */ // XXX both null must be unequal? If yes, boolean must be too? if (string1 == null && string2 == null) { return false; } else if (string1 != null && !string1.equals(string2)) { return false; } else if (string2 != null && !string2.equals(string1)) { return false; } return true; }
java
public static boolean areStringEquals(String string1, String string2) { /* string1 string2 outcome * null null true * null x false * x null false * x y false * x x true */ // XXX both null must be unequal? If yes, boolean must be too? if (string1 == null && string2 == null) { return false; } else if (string1 != null && !string1.equals(string2)) { return false; } else if (string2 != null && !string2.equals(string1)) { return false; } return true; }
[ "public", "static", "boolean", "areStringEquals", "(", "String", "string1", ",", "String", "string2", ")", "{", "/* string1\tstring2\toutcome\r\n\t\t * null\t\tnull\ttrue\r\n\t\t * null\t\tx\t\tfalse\r\n\t\t * x\t\tnull\tfalse\r\n\t\t * x\t\ty\t\tfalse\r\n\t\t * x\t\tx\t\ttrue\r\n\t\t */", "// XXX both null must be unequal? If yes, boolean must be too?\r", "if", "(", "string1", "==", "null", "&&", "string2", "==", "null", ")", "{", "return", "false", ";", "}", "else", "if", "(", "string1", "!=", "null", "&&", "!", "string1", ".", "equals", "(", "string2", ")", ")", "{", "return", "false", ";", "}", "else", "if", "(", "string2", "!=", "null", "&&", "!", "string2", ".", "equals", "(", "string1", ")", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}" ]
Checks if two strings are equals. The strings can be both null, one of them null or none of them null. @param string1 from tree element @param string2 from rule element @return true if and only if the two strings are equal (both equal or both null)
[ "Checks", "if", "two", "strings", "are", "equals", ".", "The", "strings", "can", "be", "both", "null", "one", "of", "them", "null", "or", "none", "of", "them", "null", "." ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-gc/src/main/java/org/cogroo/tools/checker/rules/util/EqualsUtils.java#L152-L169
10,114
cogroo/cogroo4
cogroo-gc/src/main/java/org/cogroo/tools/checker/rules/applier/SuggestionBuilder.java
SuggestionBuilder.discardBeginningHyphen
private static String discardBeginningHyphen(String string) { String noHyphenString = string; if (string.startsWith("-")) { noHyphenString = string.substring(1); // Oh well, just throw away // the awful "-". No one // will ever notice... } return noHyphenString; }
java
private static String discardBeginningHyphen(String string) { String noHyphenString = string; if (string.startsWith("-")) { noHyphenString = string.substring(1); // Oh well, just throw away // the awful "-". No one // will ever notice... } return noHyphenString; }
[ "private", "static", "String", "discardBeginningHyphen", "(", "String", "string", ")", "{", "String", "noHyphenString", "=", "string", ";", "if", "(", "string", ".", "startsWith", "(", "\"-\"", ")", ")", "{", "noHyphenString", "=", "string", ".", "substring", "(", "1", ")", ";", "// Oh well, just throw away\r", "// the awful \"-\". No one\r", "// will ever notice...\r", "}", "return", "noHyphenString", ";", "}" ]
Removes the beginning hyphen from the string, if any. @param string the string that will have the beginning hyphen removed @return the string without the beginning hyphen
[ "Removes", "the", "beginning", "hyphen", "from", "the", "string", "if", "any", "." ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-gc/src/main/java/org/cogroo/tools/checker/rules/applier/SuggestionBuilder.java#L666-L674
10,115
cogroo/cogroo4
lang/pt_br/cogroo-addon/src/org/cogroo/addon/addon/conf/DefaultConfiguration.java
DefaultConfiguration.commit
public void commit(Object root) { try { XChangesBatch xUpdateControl = (XChangesBatch) UnoRuntime .queryInterface(XChangesBatch.class, root); xUpdateControl.commitChanges(); } catch (WrappedTargetException e) { e.printStackTrace(); } }
java
public void commit(Object root) { try { XChangesBatch xUpdateControl = (XChangesBatch) UnoRuntime .queryInterface(XChangesBatch.class, root); xUpdateControl.commitChanges(); } catch (WrappedTargetException e) { e.printStackTrace(); } }
[ "public", "void", "commit", "(", "Object", "root", ")", "{", "try", "{", "XChangesBatch", "xUpdateControl", "=", "(", "XChangesBatch", ")", "UnoRuntime", ".", "queryInterface", "(", "XChangesBatch", ".", "class", ",", "root", ")", ";", "xUpdateControl", ".", "commitChanges", "(", ")", ";", "}", "catch", "(", "WrappedTargetException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}" ]
Commit the XChangeBatch control @param root
[ "Commit", "the", "XChangeBatch", "control" ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/lang/pt_br/cogroo-addon/src/org/cogroo/addon/addon/conf/DefaultConfiguration.java#L185-L193
10,116
cogroo/cogroo4
cogroo-ann/src/main/java/org/cogroo/config/LanguageConfigurationUtil.java
LanguageConfigurationUtil.generateName
private static String generateName(Locale locale) { StringBuilder str = new StringBuilder(); str.append("models_").append(locale.getLanguage()); if (locale.getCountry() != null && !locale.getCountry().isEmpty()) str.append("_").append(locale.getCountry()); str.append(".xml"); return str.toString(); }
java
private static String generateName(Locale locale) { StringBuilder str = new StringBuilder(); str.append("models_").append(locale.getLanguage()); if (locale.getCountry() != null && !locale.getCountry().isEmpty()) str.append("_").append(locale.getCountry()); str.append(".xml"); return str.toString(); }
[ "private", "static", "String", "generateName", "(", "Locale", "locale", ")", "{", "StringBuilder", "str", "=", "new", "StringBuilder", "(", ")", ";", "str", ".", "append", "(", "\"models_\"", ")", ".", "append", "(", "locale", ".", "getLanguage", "(", ")", ")", ";", "if", "(", "locale", ".", "getCountry", "(", ")", "!=", "null", "&&", "!", "locale", ".", "getCountry", "(", ")", ".", "isEmpty", "(", ")", ")", "str", ".", "append", "(", "\"_\"", ")", ".", "append", "(", "locale", ".", "getCountry", "(", ")", ")", ";", "str", ".", "append", "(", "\".xml\"", ")", ";", "return", "str", ".", "toString", "(", ")", ";", "}" ]
Generates the name of the file to be used according to the language chosen. @param locale contains the language that will be used @return the <code>String</code> which names the .xml file to be used according to the language
[ "Generates", "the", "name", "of", "the", "file", "to", "be", "used", "according", "to", "the", "language", "chosen", "." ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-ann/src/main/java/org/cogroo/config/LanguageConfigurationUtil.java#L85-L95
10,117
cogroo/cogroo4
cogroo-eval/GramEval/src/main/java/cogroo/uima/eval/Error.java
Error.getCoveredText
public CharSequence getCoveredText(CharSequence text) { if (getEnd() > text.length()) { throw new IllegalArgumentException("The span " + toString() + " is outside the given text!"); } return text.subSequence(getStart(), getEnd()); }
java
public CharSequence getCoveredText(CharSequence text) { if (getEnd() > text.length()) { throw new IllegalArgumentException("The span " + toString() + " is outside the given text!"); } return text.subSequence(getStart(), getEnd()); }
[ "public", "CharSequence", "getCoveredText", "(", "CharSequence", "text", ")", "{", "if", "(", "getEnd", "(", ")", ">", "text", ".", "length", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The span \"", "+", "toString", "(", ")", "+", "\" is outside the given text!\"", ")", ";", "}", "return", "text", ".", "subSequence", "(", "getStart", "(", ")", ",", "getEnd", "(", ")", ")", ";", "}" ]
Retrieves the string covered by the current span of the specified text. @param text @return the substring covered by the current span
[ "Retrieves", "the", "string", "covered", "by", "the", "current", "span", "of", "the", "specified", "text", "." ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-eval/GramEval/src/main/java/cogroo/uima/eval/Error.java#L199-L206
10,118
kenyee/android-ddp-client
src/com/keysolutions/ddpclient/android/DDPStateSingleton.java
DDPStateSingleton.connectIfNeeded
public boolean connectIfNeeded() { if (getDDP().getState() == CONNSTATE.Disconnected) { // make connection to Meteor server getDDP().connect(); return true; } else if (getDDP().getState() == CONNSTATE.Closed) { // try to reconnect w/ a new connection createDDPClient(); getDDP().connect(); } return false; }
java
public boolean connectIfNeeded() { if (getDDP().getState() == CONNSTATE.Disconnected) { // make connection to Meteor server getDDP().connect(); return true; } else if (getDDP().getState() == CONNSTATE.Closed) { // try to reconnect w/ a new connection createDDPClient(); getDDP().connect(); } return false; }
[ "public", "boolean", "connectIfNeeded", "(", ")", "{", "if", "(", "getDDP", "(", ")", ".", "getState", "(", ")", "==", "CONNSTATE", ".", "Disconnected", ")", "{", "// make connection to Meteor server", "getDDP", "(", ")", ".", "connect", "(", ")", ";", "return", "true", ";", "}", "else", "if", "(", "getDDP", "(", ")", ".", "getState", "(", ")", "==", "CONNSTATE", ".", "Closed", ")", "{", "// try to reconnect w/ a new connection", "createDDPClient", "(", ")", ";", "getDDP", "(", ")", ".", "connect", "(", ")", ";", "}", "return", "false", ";", "}" ]
Requests DDP connect if needed @return true if connect was issue, otherwise false
[ "Requests", "DDP", "connect", "if", "needed" ]
6ab416e415570a03f96c383497144dd742de3f08
https://github.com/kenyee/android-ddp-client/blob/6ab416e415570a03f96c383497144dd742de3f08/src/com/keysolutions/ddpclient/android/DDPStateSingleton.java#L324-L335
10,119
kenyee/android-ddp-client
src/com/keysolutions/ddpclient/android/DDPStateSingleton.java
DDPStateSingleton.logout
public void logout() { saveResumeToken(null); mDDPState = DDPSTATE.NotLoggedIn; mUserId = null; broadcastConnectionState(mDDPState); }
java
public void logout() { saveResumeToken(null); mDDPState = DDPSTATE.NotLoggedIn; mUserId = null; broadcastConnectionState(mDDPState); }
[ "public", "void", "logout", "(", ")", "{", "saveResumeToken", "(", "null", ")", ";", "mDDPState", "=", "DDPSTATE", ".", "NotLoggedIn", ";", "mUserId", "=", "null", ";", "broadcastConnectionState", "(", "mDDPState", ")", ";", "}" ]
Logs out from server and removes the resume token
[ "Logs", "out", "from", "server", "and", "removes", "the", "resume", "token" ]
6ab416e415570a03f96c383497144dd742de3f08
https://github.com/kenyee/android-ddp-client/blob/6ab416e415570a03f96c383497144dd742de3f08/src/com/keysolutions/ddpclient/android/DDPStateSingleton.java#L357-L362
10,120
kenyee/android-ddp-client
src/com/keysolutions/ddpclient/android/DDPStateSingleton.java
DDPStateSingleton.saveResumeToken
public void saveResumeToken(String token) { SharedPreferences settings = mContext.getSharedPreferences(PREF_DDPINFO, Context.MODE_PRIVATE); SharedPreferences.Editor editor = settings.edit(); //REVIEW: should token be encrypted? editor.putString(PREF_RESUMETOKEN, token); editor.apply(); }
java
public void saveResumeToken(String token) { SharedPreferences settings = mContext.getSharedPreferences(PREF_DDPINFO, Context.MODE_PRIVATE); SharedPreferences.Editor editor = settings.edit(); //REVIEW: should token be encrypted? editor.putString(PREF_RESUMETOKEN, token); editor.apply(); }
[ "public", "void", "saveResumeToken", "(", "String", "token", ")", "{", "SharedPreferences", "settings", "=", "mContext", ".", "getSharedPreferences", "(", "PREF_DDPINFO", ",", "Context", ".", "MODE_PRIVATE", ")", ";", "SharedPreferences", ".", "Editor", "editor", "=", "settings", ".", "edit", "(", ")", ";", "//REVIEW: should token be encrypted?", "editor", ".", "putString", "(", "PREF_RESUMETOKEN", ",", "token", ")", ";", "editor", ".", "apply", "(", ")", ";", "}" ]
Saves resume token to Android's internal app storage @param token resume token
[ "Saves", "resume", "token", "to", "Android", "s", "internal", "app", "storage" ]
6ab416e415570a03f96c383497144dd742de3f08
https://github.com/kenyee/android-ddp-client/blob/6ab416e415570a03f96c383497144dd742de3f08/src/com/keysolutions/ddpclient/android/DDPStateSingleton.java#L368-L374
10,121
kenyee/android-ddp-client
src/com/keysolutions/ddpclient/android/DDPStateSingleton.java
DDPStateSingleton.getResumeToken
public String getResumeToken() { SharedPreferences settings = mContext.getSharedPreferences(PREF_DDPINFO, Context.MODE_PRIVATE); return settings.getString(PREF_RESUMETOKEN, null); }
java
public String getResumeToken() { SharedPreferences settings = mContext.getSharedPreferences(PREF_DDPINFO, Context.MODE_PRIVATE); return settings.getString(PREF_RESUMETOKEN, null); }
[ "public", "String", "getResumeToken", "(", ")", "{", "SharedPreferences", "settings", "=", "mContext", ".", "getSharedPreferences", "(", "PREF_DDPINFO", ",", "Context", ".", "MODE_PRIVATE", ")", ";", "return", "settings", ".", "getString", "(", "PREF_RESUMETOKEN", ",", "null", ")", ";", "}" ]
Gets resume token from Android's internal app storage @return resume token or null if not found
[ "Gets", "resume", "token", "from", "Android", "s", "internal", "app", "storage" ]
6ab416e415570a03f96c383497144dd742de3f08
https://github.com/kenyee/android-ddp-client/blob/6ab416e415570a03f96c383497144dd742de3f08/src/com/keysolutions/ddpclient/android/DDPStateSingleton.java#L380-L383
10,122
kenyee/android-ddp-client
src/com/keysolutions/ddpclient/android/DDPStateSingleton.java
DDPStateSingleton.handleLoginResult
@SuppressWarnings("unchecked") public void handleLoginResult(Map<String, Object> jsonFields) { if (jsonFields.containsKey("result")) { Map<String, Object> result = (Map<String, Object>) jsonFields .get(DdpMessageField.RESULT); mResumeToken = (String) result.get("token"); saveResumeToken(mResumeToken); mUserId = (String) result.get("id"); mDDPState = DDPSTATE.LoggedIn; broadcastConnectionState(mDDPState); } else if (jsonFields.containsKey("error")) { Map<String, Object> error = (Map<String, Object>) jsonFields .get(DdpMessageField.ERROR); broadcastDDPError((String) error.get("message")); } }
java
@SuppressWarnings("unchecked") public void handleLoginResult(Map<String, Object> jsonFields) { if (jsonFields.containsKey("result")) { Map<String, Object> result = (Map<String, Object>) jsonFields .get(DdpMessageField.RESULT); mResumeToken = (String) result.get("token"); saveResumeToken(mResumeToken); mUserId = (String) result.get("id"); mDDPState = DDPSTATE.LoggedIn; broadcastConnectionState(mDDPState); } else if (jsonFields.containsKey("error")) { Map<String, Object> error = (Map<String, Object>) jsonFields .get(DdpMessageField.ERROR); broadcastDDPError((String) error.get("message")); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "handleLoginResult", "(", "Map", "<", "String", ",", "Object", ">", "jsonFields", ")", "{", "if", "(", "jsonFields", ".", "containsKey", "(", "\"result\"", ")", ")", "{", "Map", "<", "String", ",", "Object", ">", "result", "=", "(", "Map", "<", "String", ",", "Object", ">", ")", "jsonFields", ".", "get", "(", "DdpMessageField", ".", "RESULT", ")", ";", "mResumeToken", "=", "(", "String", ")", "result", ".", "get", "(", "\"token\"", ")", ";", "saveResumeToken", "(", "mResumeToken", ")", ";", "mUserId", "=", "(", "String", ")", "result", ".", "get", "(", "\"id\"", ")", ";", "mDDPState", "=", "DDPSTATE", ".", "LoggedIn", ";", "broadcastConnectionState", "(", "mDDPState", ")", ";", "}", "else", "if", "(", "jsonFields", ".", "containsKey", "(", "\"error\"", ")", ")", "{", "Map", "<", "String", ",", "Object", ">", "error", "=", "(", "Map", "<", "String", ",", "Object", ">", ")", "jsonFields", ".", "get", "(", "DdpMessageField", ".", "ERROR", ")", ";", "broadcastDDPError", "(", "(", "String", ")", "error", ".", "get", "(", "\"message\"", ")", ")", ";", "}", "}" ]
Handles callback from login command @param jsonFields fields from result
[ "Handles", "callback", "from", "login", "command" ]
6ab416e415570a03f96c383497144dd742de3f08
https://github.com/kenyee/android-ddp-client/blob/6ab416e415570a03f96c383497144dd742de3f08/src/com/keysolutions/ddpclient/android/DDPStateSingleton.java#L389-L404
10,123
kenyee/android-ddp-client
src/com/keysolutions/ddpclient/android/DDPStateSingleton.java
DDPStateSingleton.broadcastConnectionState
public void broadcastConnectionState(DDPSTATE ddpstate) { Intent broadcastIntent = new Intent(); broadcastIntent.setAction(MESSAGE_CONNECTION); broadcastIntent.putExtra(MESSAGE_EXTRA_STATE, ddpstate.ordinal()); broadcastIntent.putExtra(MESSAGE_EXTRA_USERID, mUserId); broadcastIntent.putExtra(MESSAGE_EXTRA_USERTOKEN, mResumeToken); LocalBroadcastManager.getInstance(mContext) .sendBroadcast(broadcastIntent); }
java
public void broadcastConnectionState(DDPSTATE ddpstate) { Intent broadcastIntent = new Intent(); broadcastIntent.setAction(MESSAGE_CONNECTION); broadcastIntent.putExtra(MESSAGE_EXTRA_STATE, ddpstate.ordinal()); broadcastIntent.putExtra(MESSAGE_EXTRA_USERID, mUserId); broadcastIntent.putExtra(MESSAGE_EXTRA_USERTOKEN, mResumeToken); LocalBroadcastManager.getInstance(mContext) .sendBroadcast(broadcastIntent); }
[ "public", "void", "broadcastConnectionState", "(", "DDPSTATE", "ddpstate", ")", "{", "Intent", "broadcastIntent", "=", "new", "Intent", "(", ")", ";", "broadcastIntent", ".", "setAction", "(", "MESSAGE_CONNECTION", ")", ";", "broadcastIntent", ".", "putExtra", "(", "MESSAGE_EXTRA_STATE", ",", "ddpstate", ".", "ordinal", "(", ")", ")", ";", "broadcastIntent", ".", "putExtra", "(", "MESSAGE_EXTRA_USERID", ",", "mUserId", ")", ";", "broadcastIntent", ".", "putExtra", "(", "MESSAGE_EXTRA_USERTOKEN", ",", "mResumeToken", ")", ";", "LocalBroadcastManager", ".", "getInstance", "(", "mContext", ")", ".", "sendBroadcast", "(", "broadcastIntent", ")", ";", "}" ]
Used to notify event system of connection events. Default behavior uses Android's LocalBroadcastManager. Override if you want to use a different eventbus. @param ddpstate current DDP state
[ "Used", "to", "notify", "event", "system", "of", "connection", "events", ".", "Default", "behavior", "uses", "Android", "s", "LocalBroadcastManager", ".", "Override", "if", "you", "want", "to", "use", "a", "different", "eventbus", "." ]
6ab416e415570a03f96c383497144dd742de3f08
https://github.com/kenyee/android-ddp-client/blob/6ab416e415570a03f96c383497144dd742de3f08/src/com/keysolutions/ddpclient/android/DDPStateSingleton.java#L581-L589
10,124
kenyee/android-ddp-client
src/com/keysolutions/ddpclient/android/DDPStateSingleton.java
DDPStateSingleton.broadcastDDPError
public void broadcastDDPError(String errorMsg) { // let core know there was an error subscribing to a collection Intent broadcastIntent = new Intent(); broadcastIntent.setAction(MESSAGE_ERROR); broadcastIntent.putExtra(MESSAGE_EXTRA_MSG, errorMsg); LocalBroadcastManager.getInstance(mContext) .sendBroadcast(broadcastIntent); }
java
public void broadcastDDPError(String errorMsg) { // let core know there was an error subscribing to a collection Intent broadcastIntent = new Intent(); broadcastIntent.setAction(MESSAGE_ERROR); broadcastIntent.putExtra(MESSAGE_EXTRA_MSG, errorMsg); LocalBroadcastManager.getInstance(mContext) .sendBroadcast(broadcastIntent); }
[ "public", "void", "broadcastDDPError", "(", "String", "errorMsg", ")", "{", "// let core know there was an error subscribing to a collection", "Intent", "broadcastIntent", "=", "new", "Intent", "(", ")", ";", "broadcastIntent", ".", "setAction", "(", "MESSAGE_ERROR", ")", ";", "broadcastIntent", ".", "putExtra", "(", "MESSAGE_EXTRA_MSG", ",", "errorMsg", ")", ";", "LocalBroadcastManager", ".", "getInstance", "(", "mContext", ")", ".", "sendBroadcast", "(", "broadcastIntent", ")", ";", "}" ]
Used to notify event system of error events. Default behavior uses Android's LocalBroadcastManager. Override if you want to use a different eventbus. @param errorMsg error message
[ "Used", "to", "notify", "event", "system", "of", "error", "events", ".", "Default", "behavior", "uses", "Android", "s", "LocalBroadcastManager", ".", "Override", "if", "you", "want", "to", "use", "a", "different", "eventbus", "." ]
6ab416e415570a03f96c383497144dd742de3f08
https://github.com/kenyee/android-ddp-client/blob/6ab416e415570a03f96c383497144dd742de3f08/src/com/keysolutions/ddpclient/android/DDPStateSingleton.java#L597-L604
10,125
kenyee/android-ddp-client
src/com/keysolutions/ddpclient/android/DDPStateSingleton.java
DDPStateSingleton.broadcastSubscriptionChanged
public void broadcastSubscriptionChanged(String subscriptionName, String changetype, String docId) { Intent broadcastIntent = new Intent(); broadcastIntent.setAction(MESSAGE_SUBUPDATED); broadcastIntent.putExtra(MESSAGE_EXTRA_SUBNAME, subscriptionName); broadcastIntent.putExtra(MESSAGE_EXTRA_CHANGETYPE, changetype); broadcastIntent.putExtra(MESSAGE_EXTRA_CHANGEID, docId); LocalBroadcastManager.getInstance(mContext) .sendBroadcast(broadcastIntent); }
java
public void broadcastSubscriptionChanged(String subscriptionName, String changetype, String docId) { Intent broadcastIntent = new Intent(); broadcastIntent.setAction(MESSAGE_SUBUPDATED); broadcastIntent.putExtra(MESSAGE_EXTRA_SUBNAME, subscriptionName); broadcastIntent.putExtra(MESSAGE_EXTRA_CHANGETYPE, changetype); broadcastIntent.putExtra(MESSAGE_EXTRA_CHANGEID, docId); LocalBroadcastManager.getInstance(mContext) .sendBroadcast(broadcastIntent); }
[ "public", "void", "broadcastSubscriptionChanged", "(", "String", "subscriptionName", ",", "String", "changetype", ",", "String", "docId", ")", "{", "Intent", "broadcastIntent", "=", "new", "Intent", "(", ")", ";", "broadcastIntent", ".", "setAction", "(", "MESSAGE_SUBUPDATED", ")", ";", "broadcastIntent", ".", "putExtra", "(", "MESSAGE_EXTRA_SUBNAME", ",", "subscriptionName", ")", ";", "broadcastIntent", ".", "putExtra", "(", "MESSAGE_EXTRA_CHANGETYPE", ",", "changetype", ")", ";", "broadcastIntent", ".", "putExtra", "(", "MESSAGE_EXTRA_CHANGEID", ",", "docId", ")", ";", "LocalBroadcastManager", ".", "getInstance", "(", "mContext", ")", ".", "sendBroadcast", "(", "broadcastIntent", ")", ";", "}" ]
Used to notify event system of subscription change events. Default behavior uses Android's LocalBroadcastManager. Override if you want to use a different eventbus. @param subscriptionName subscription name (this can be different from collection name) @param changetype "change", "add" or "remove" @param docId document ID of change/remove or null if add
[ "Used", "to", "notify", "event", "system", "of", "subscription", "change", "events", ".", "Default", "behavior", "uses", "Android", "s", "LocalBroadcastManager", ".", "Override", "if", "you", "want", "to", "use", "a", "different", "eventbus", "." ]
6ab416e415570a03f96c383497144dd742de3f08
https://github.com/kenyee/android-ddp-client/blob/6ab416e415570a03f96c383497144dd742de3f08/src/com/keysolutions/ddpclient/android/DDPStateSingleton.java#L614-L623
10,126
kenyee/android-ddp-client
src/com/keysolutions/ddpclient/android/DDPStateSingleton.java
DDPStateSingleton.update
@SuppressWarnings("unchecked") @Override public void update(Observable client, Object msg) { // handle subscription updates and othre messages that aren't associated // w/ a specific command if (msg instanceof Map<?, ?>) { Map<String, Object> jsonFields = (Map<String, Object>) msg; // handle msg types for DDP server->client msgs: // https://github.com/meteor/meteor/blob/master/packages/livedata/DDP.md String msgtype = (String) jsonFields .get(DDPClient.DdpMessageField.MSG); String collName = (String) jsonFields.get(DdpMessageField.COLLECTION); String docId = (String) jsonFields.get(DdpMessageField.ID); // ignore {"server_id":"GqrKrbcSeDfTYDkzQ"} web socket msgs if (msgtype != null) { switch (msgtype) { case DdpMessageType.ERROR: broadcastDDPError((String) jsonFields.get(DdpMessageField.ERRORMSG)); break; case DdpMessageType.CONNECTED: mDDPState = DDPSTATE.Connected; broadcastConnectionState(mDDPState); break; case DdpMessageType.ADDED: addDoc(jsonFields, collName, docId); // broadcast that subscription has been updated broadcastSubscriptionChanged(collName, DdpMessageType.ADDED, docId); break; case DdpMessageType.REMOVED: if (removeDoc(collName, docId)) { // broadcast that subscription has been updated broadcastSubscriptionChanged(collName, DdpMessageType.REMOVED, docId); } break; case DdpMessageType.CHANGED: // handle document updates if (updateDoc(jsonFields, collName, docId)) { // broadcast that subscription has been updated broadcastSubscriptionChanged(collName, DdpMessageType.CHANGED, docId); } break; case DdpMessageType.CLOSED: mDDPState = DDPSTATE.Closed; broadcastConnectionState(DDPSTATE.Closed); break; } } } }
java
@SuppressWarnings("unchecked") @Override public void update(Observable client, Object msg) { // handle subscription updates and othre messages that aren't associated // w/ a specific command if (msg instanceof Map<?, ?>) { Map<String, Object> jsonFields = (Map<String, Object>) msg; // handle msg types for DDP server->client msgs: // https://github.com/meteor/meteor/blob/master/packages/livedata/DDP.md String msgtype = (String) jsonFields .get(DDPClient.DdpMessageField.MSG); String collName = (String) jsonFields.get(DdpMessageField.COLLECTION); String docId = (String) jsonFields.get(DdpMessageField.ID); // ignore {"server_id":"GqrKrbcSeDfTYDkzQ"} web socket msgs if (msgtype != null) { switch (msgtype) { case DdpMessageType.ERROR: broadcastDDPError((String) jsonFields.get(DdpMessageField.ERRORMSG)); break; case DdpMessageType.CONNECTED: mDDPState = DDPSTATE.Connected; broadcastConnectionState(mDDPState); break; case DdpMessageType.ADDED: addDoc(jsonFields, collName, docId); // broadcast that subscription has been updated broadcastSubscriptionChanged(collName, DdpMessageType.ADDED, docId); break; case DdpMessageType.REMOVED: if (removeDoc(collName, docId)) { // broadcast that subscription has been updated broadcastSubscriptionChanged(collName, DdpMessageType.REMOVED, docId); } break; case DdpMessageType.CHANGED: // handle document updates if (updateDoc(jsonFields, collName, docId)) { // broadcast that subscription has been updated broadcastSubscriptionChanged(collName, DdpMessageType.CHANGED, docId); } break; case DdpMessageType.CLOSED: mDDPState = DDPSTATE.Closed; broadcastConnectionState(DDPSTATE.Closed); break; } } } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "@", "Override", "public", "void", "update", "(", "Observable", "client", ",", "Object", "msg", ")", "{", "// handle subscription updates and othre messages that aren't associated", "// w/ a specific command", "if", "(", "msg", "instanceof", "Map", "<", "?", ",", "?", ">", ")", "{", "Map", "<", "String", ",", "Object", ">", "jsonFields", "=", "(", "Map", "<", "String", ",", "Object", ">", ")", "msg", ";", "// handle msg types for DDP server->client msgs:", "// https://github.com/meteor/meteor/blob/master/packages/livedata/DDP.md", "String", "msgtype", "=", "(", "String", ")", "jsonFields", ".", "get", "(", "DDPClient", ".", "DdpMessageField", ".", "MSG", ")", ";", "String", "collName", "=", "(", "String", ")", "jsonFields", ".", "get", "(", "DdpMessageField", ".", "COLLECTION", ")", ";", "String", "docId", "=", "(", "String", ")", "jsonFields", ".", "get", "(", "DdpMessageField", ".", "ID", ")", ";", "// ignore {\"server_id\":\"GqrKrbcSeDfTYDkzQ\"} web socket msgs", "if", "(", "msgtype", "!=", "null", ")", "{", "switch", "(", "msgtype", ")", "{", "case", "DdpMessageType", ".", "ERROR", ":", "broadcastDDPError", "(", "(", "String", ")", "jsonFields", ".", "get", "(", "DdpMessageField", ".", "ERRORMSG", ")", ")", ";", "break", ";", "case", "DdpMessageType", ".", "CONNECTED", ":", "mDDPState", "=", "DDPSTATE", ".", "Connected", ";", "broadcastConnectionState", "(", "mDDPState", ")", ";", "break", ";", "case", "DdpMessageType", ".", "ADDED", ":", "addDoc", "(", "jsonFields", ",", "collName", ",", "docId", ")", ";", "// broadcast that subscription has been updated", "broadcastSubscriptionChanged", "(", "collName", ",", "DdpMessageType", ".", "ADDED", ",", "docId", ")", ";", "break", ";", "case", "DdpMessageType", ".", "REMOVED", ":", "if", "(", "removeDoc", "(", "collName", ",", "docId", ")", ")", "{", "// broadcast that subscription has been updated", "broadcastSubscriptionChanged", "(", "collName", ",", "DdpMessageType", ".", "REMOVED", ",", "docId", ")", ";", "}", "break", ";", "case", "DdpMessageType", ".", "CHANGED", ":", "// handle document updates", "if", "(", "updateDoc", "(", "jsonFields", ",", "collName", ",", "docId", ")", ")", "{", "// broadcast that subscription has been updated", "broadcastSubscriptionChanged", "(", "collName", ",", "DdpMessageType", ".", "CHANGED", ",", "docId", ")", ";", "}", "break", ";", "case", "DdpMessageType", ".", "CLOSED", ":", "mDDPState", "=", "DDPSTATE", ".", "Closed", ";", "broadcastConnectionState", "(", "DDPSTATE", ".", "Closed", ")", ";", "break", ";", "}", "}", "}", "}" ]
handles callbacks from DDP client websocket callbacks
[ "handles", "callbacks", "from", "DDP", "client", "websocket", "callbacks" ]
6ab416e415570a03f96c383497144dd742de3f08
https://github.com/kenyee/android-ddp-client/blob/6ab416e415570a03f96c383497144dd742de3f08/src/com/keysolutions/ddpclient/android/DDPStateSingleton.java#L628-L679
10,127
kenyee/android-ddp-client
src/com/keysolutions/ddpclient/android/DDPStateSingleton.java
DDPStateSingleton.updateDoc
@SuppressWarnings("unchecked") public boolean updateDoc(Map<String, Object> jsonFields, String collName, String docId) { if (mCollections.containsKey(collName)) { Map<String, Map<String,Object>> collection = mCollections.get(collName); Map<String, Object> doc = collection.get(docId); if (doc != null) { // take care of field updates Map<String, Object> fields = (Map<String, Object>) jsonFields .get(DdpMessageField.FIELDS); if (fields != null) { for (Map.Entry<String, Object> field : fields .entrySet()) { String fieldname = field.getKey(); doc.put(fieldname, field.getValue()); } } // take care of clearing fields List<String> clearfields = ((List<String>) jsonFields.get(DdpMessageField.CLEARED)); if (clearfields != null) { for (String fieldname : clearfields) { if (doc.containsKey(fieldname)) { doc.remove(fieldname); } } } return true; } } else { log.warn("Received invalid changed msg for collection " + collName); } return false; }
java
@SuppressWarnings("unchecked") public boolean updateDoc(Map<String, Object> jsonFields, String collName, String docId) { if (mCollections.containsKey(collName)) { Map<String, Map<String,Object>> collection = mCollections.get(collName); Map<String, Object> doc = collection.get(docId); if (doc != null) { // take care of field updates Map<String, Object> fields = (Map<String, Object>) jsonFields .get(DdpMessageField.FIELDS); if (fields != null) { for (Map.Entry<String, Object> field : fields .entrySet()) { String fieldname = field.getKey(); doc.put(fieldname, field.getValue()); } } // take care of clearing fields List<String> clearfields = ((List<String>) jsonFields.get(DdpMessageField.CLEARED)); if (clearfields != null) { for (String fieldname : clearfields) { if (doc.containsKey(fieldname)) { doc.remove(fieldname); } } } return true; } } else { log.warn("Received invalid changed msg for collection " + collName); } return false; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "boolean", "updateDoc", "(", "Map", "<", "String", ",", "Object", ">", "jsonFields", ",", "String", "collName", ",", "String", "docId", ")", "{", "if", "(", "mCollections", ".", "containsKey", "(", "collName", ")", ")", "{", "Map", "<", "String", ",", "Map", "<", "String", ",", "Object", ">", ">", "collection", "=", "mCollections", ".", "get", "(", "collName", ")", ";", "Map", "<", "String", ",", "Object", ">", "doc", "=", "collection", ".", "get", "(", "docId", ")", ";", "if", "(", "doc", "!=", "null", ")", "{", "// take care of field updates", "Map", "<", "String", ",", "Object", ">", "fields", "=", "(", "Map", "<", "String", ",", "Object", ">", ")", "jsonFields", ".", "get", "(", "DdpMessageField", ".", "FIELDS", ")", ";", "if", "(", "fields", "!=", "null", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "Object", ">", "field", ":", "fields", ".", "entrySet", "(", ")", ")", "{", "String", "fieldname", "=", "field", ".", "getKey", "(", ")", ";", "doc", ".", "put", "(", "fieldname", ",", "field", ".", "getValue", "(", ")", ")", ";", "}", "}", "// take care of clearing fields", "List", "<", "String", ">", "clearfields", "=", "(", "(", "List", "<", "String", ">", ")", "jsonFields", ".", "get", "(", "DdpMessageField", ".", "CLEARED", ")", ")", ";", "if", "(", "clearfields", "!=", "null", ")", "{", "for", "(", "String", "fieldname", ":", "clearfields", ")", "{", "if", "(", "doc", ".", "containsKey", "(", "fieldname", ")", ")", "{", "doc", ".", "remove", "(", "fieldname", ")", ";", "}", "}", "}", "return", "true", ";", "}", "}", "else", "{", "log", ".", "warn", "(", "\"Received invalid changed msg for collection \"", "+", "collName", ")", ";", "}", "return", "false", ";", "}" ]
Handles updating a document in a collection. Override if you want to use your own collection data store. @param jsonFields fields for document @param collName collection name @param docId documement ID for update @return true if changed; false if document not found
[ "Handles", "updating", "a", "document", "in", "a", "collection", ".", "Override", "if", "you", "want", "to", "use", "your", "own", "collection", "data", "store", "." ]
6ab416e415570a03f96c383497144dd742de3f08
https://github.com/kenyee/android-ddp-client/blob/6ab416e415570a03f96c383497144dd742de3f08/src/com/keysolutions/ddpclient/android/DDPStateSingleton.java#L689-L722
10,128
kenyee/android-ddp-client
src/com/keysolutions/ddpclient/android/DDPStateSingleton.java
DDPStateSingleton.removeDoc
public boolean removeDoc(String collName, String docId) { if (mCollections.containsKey(collName)) { // remove IDs from collection Map<String, Map<String,Object>> collection = mCollections.get(collName); if (BuildConfig.DEBUG) { log.debug("Removed doc: " + docId); } collection.remove(docId); return true; } else { log.warn("Received invalid removed msg for collection " + collName); return false; } }
java
public boolean removeDoc(String collName, String docId) { if (mCollections.containsKey(collName)) { // remove IDs from collection Map<String, Map<String,Object>> collection = mCollections.get(collName); if (BuildConfig.DEBUG) { log.debug("Removed doc: " + docId); } collection.remove(docId); return true; } else { log.warn("Received invalid removed msg for collection " + collName); return false; } }
[ "public", "boolean", "removeDoc", "(", "String", "collName", ",", "String", "docId", ")", "{", "if", "(", "mCollections", ".", "containsKey", "(", "collName", ")", ")", "{", "// remove IDs from collection", "Map", "<", "String", ",", "Map", "<", "String", ",", "Object", ">", ">", "collection", "=", "mCollections", ".", "get", "(", "collName", ")", ";", "if", "(", "BuildConfig", ".", "DEBUG", ")", "{", "log", ".", "debug", "(", "\"Removed doc: \"", "+", "docId", ")", ";", "}", "collection", ".", "remove", "(", "docId", ")", ";", "return", "true", ";", "}", "else", "{", "log", ".", "warn", "(", "\"Received invalid removed msg for collection \"", "+", "collName", ")", ";", "return", "false", ";", "}", "}" ]
Handles deleting a document in a collection. Override if you want to use your own collection data store. @param collName collection name @param docId document ID @return true if doc was deleted, false otherwise
[ "Handles", "deleting", "a", "document", "in", "a", "collection", ".", "Override", "if", "you", "want", "to", "use", "your", "own", "collection", "data", "store", "." ]
6ab416e415570a03f96c383497144dd742de3f08
https://github.com/kenyee/android-ddp-client/blob/6ab416e415570a03f96c383497144dd742de3f08/src/com/keysolutions/ddpclient/android/DDPStateSingleton.java#L731-L745
10,129
kenyee/android-ddp-client
src/com/keysolutions/ddpclient/android/DDPStateSingleton.java
DDPStateSingleton.addDoc
@SuppressWarnings("unchecked") public void addDoc(Map<String, Object> jsonFields, String collName, String docId) { if (!mCollections.containsKey(collName)) { // add new collection log.debug("Added collection " + collName); mCollections.put(collName, new ConcurrentHashMap<String, Map<String,Object>>()); } Map<String, Map<String,Object>> collection = mCollections.get(collName); Map<String, Object> fields; if(jsonFields.get(DdpMessageField.FIELDS) == null) { fields = new ConcurrentHashMap<>(); } else { fields = (Map<String, Object>) jsonFields.get(DdpMessageField.FIELDS); } collection.put(docId, fields); if (BuildConfig.DEBUG) { log.debug("Added docid " + docId + " to collection " + collName); } }
java
@SuppressWarnings("unchecked") public void addDoc(Map<String, Object> jsonFields, String collName, String docId) { if (!mCollections.containsKey(collName)) { // add new collection log.debug("Added collection " + collName); mCollections.put(collName, new ConcurrentHashMap<String, Map<String,Object>>()); } Map<String, Map<String,Object>> collection = mCollections.get(collName); Map<String, Object> fields; if(jsonFields.get(DdpMessageField.FIELDS) == null) { fields = new ConcurrentHashMap<>(); } else { fields = (Map<String, Object>) jsonFields.get(DdpMessageField.FIELDS); } collection.put(docId, fields); if (BuildConfig.DEBUG) { log.debug("Added docid " + docId + " to collection " + collName); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "addDoc", "(", "Map", "<", "String", ",", "Object", ">", "jsonFields", ",", "String", "collName", ",", "String", "docId", ")", "{", "if", "(", "!", "mCollections", ".", "containsKey", "(", "collName", ")", ")", "{", "// add new collection", "log", ".", "debug", "(", "\"Added collection \"", "+", "collName", ")", ";", "mCollections", ".", "put", "(", "collName", ",", "new", "ConcurrentHashMap", "<", "String", ",", "Map", "<", "String", ",", "Object", ">", ">", "(", ")", ")", ";", "}", "Map", "<", "String", ",", "Map", "<", "String", ",", "Object", ">", ">", "collection", "=", "mCollections", ".", "get", "(", "collName", ")", ";", "Map", "<", "String", ",", "Object", ">", "fields", ";", "if", "(", "jsonFields", ".", "get", "(", "DdpMessageField", ".", "FIELDS", ")", "==", "null", ")", "{", "fields", "=", "new", "ConcurrentHashMap", "<>", "(", ")", ";", "}", "else", "{", "fields", "=", "(", "Map", "<", "String", ",", "Object", ">", ")", "jsonFields", ".", "get", "(", "DdpMessageField", ".", "FIELDS", ")", ";", "}", "collection", ".", "put", "(", "docId", ",", "fields", ")", ";", "if", "(", "BuildConfig", ".", "DEBUG", ")", "{", "log", ".", "debug", "(", "\"Added docid \"", "+", "docId", "+", "\" to collection \"", "+", "collName", ")", ";", "}", "}" ]
Handles adding a document to collection. Override if you want to use your own collection data store. @param jsonFields fields for document @param collName collection name @param docId document ID
[ "Handles", "adding", "a", "document", "to", "collection", ".", "Override", "if", "you", "want", "to", "use", "your", "own", "collection", "data", "store", "." ]
6ab416e415570a03f96c383497144dd742de3f08
https://github.com/kenyee/android-ddp-client/blob/6ab416e415570a03f96c383497144dd742de3f08/src/com/keysolutions/ddpclient/android/DDPStateSingleton.java#L754-L777
10,130
kenyee/android-ddp-client
src/com/keysolutions/ddpclient/android/DDPStateSingleton.java
DDPStateSingleton.getCollection
public Map<String, Map<String,Object>> getCollection(String collectionName) { // return specified collection Map which is indexed by document ID return mCollections.get(collectionName); }
java
public Map<String, Map<String,Object>> getCollection(String collectionName) { // return specified collection Map which is indexed by document ID return mCollections.get(collectionName); }
[ "public", "Map", "<", "String", ",", "Map", "<", "String", ",", "Object", ">", ">", "getCollection", "(", "String", "collectionName", ")", "{", "// return specified collection Map which is indexed by document ID", "return", "mCollections", ".", "get", "(", "collectionName", ")", ";", "}" ]
Gets local Meteor collection @param collectionName collection name @return collection as a Map or null if not found
[ "Gets", "local", "Meteor", "collection" ]
6ab416e415570a03f96c383497144dd742de3f08
https://github.com/kenyee/android-ddp-client/blob/6ab416e415570a03f96c383497144dd742de3f08/src/com/keysolutions/ddpclient/android/DDPStateSingleton.java#L784-L787
10,131
kenyee/android-ddp-client
src/com/keysolutions/ddpclient/android/DDPStateSingleton.java
DDPStateSingleton.getDocument
public Map<String, Object> getDocument(String collectionName, String docId) { Map<String, Map<String,Object>> docs = DDPStateSingleton.getInstance() .getCollection(collectionName); if (docs != null) { return docs.get(docId); } return null; }
java
public Map<String, Object> getDocument(String collectionName, String docId) { Map<String, Map<String,Object>> docs = DDPStateSingleton.getInstance() .getCollection(collectionName); if (docs != null) { return docs.get(docId); } return null; }
[ "public", "Map", "<", "String", ",", "Object", ">", "getDocument", "(", "String", "collectionName", ",", "String", "docId", ")", "{", "Map", "<", "String", ",", "Map", "<", "String", ",", "Object", ">", ">", "docs", "=", "DDPStateSingleton", ".", "getInstance", "(", ")", ".", "getCollection", "(", "collectionName", ")", ";", "if", "(", "docs", "!=", "null", ")", "{", "return", "docs", ".", "get", "(", "docId", ")", ";", "}", "return", "null", ";", "}" ]
Gets a document out of a collection @param collectionName collection name @param docId document ID @return null if not found or a collection of the document's fields
[ "Gets", "a", "document", "out", "of", "a", "collection" ]
6ab416e415570a03f96c383497144dd742de3f08
https://github.com/kenyee/android-ddp-client/blob/6ab416e415570a03f96c383497144dd742de3f08/src/com/keysolutions/ddpclient/android/DDPStateSingleton.java#L795-L802
10,132
kenyee/android-ddp-client
src/com/keysolutions/ddpclient/android/DDPStateSingleton.java
DDPStateSingleton.getUser
public Map<String, Object> getUser() { Map<String, Object> userFields = DDPStateSingleton.getInstance() .getDocument("users", getUserId()); if (userFields != null) { return userFields; } return null; }
java
public Map<String, Object> getUser() { Map<String, Object> userFields = DDPStateSingleton.getInstance() .getDocument("users", getUserId()); if (userFields != null) { return userFields; } return null; }
[ "public", "Map", "<", "String", ",", "Object", ">", "getUser", "(", ")", "{", "Map", "<", "String", ",", "Object", ">", "userFields", "=", "DDPStateSingleton", ".", "getInstance", "(", ")", ".", "getDocument", "(", "\"users\"", ",", "getUserId", "(", ")", ")", ";", "if", "(", "userFields", "!=", "null", ")", "{", "return", "userFields", ";", "}", "return", "null", ";", "}" ]
Gets current Meteor user info @return user Info or null if not logged in
[ "Gets", "current", "Meteor", "user", "info" ]
6ab416e415570a03f96c383497144dd742de3f08
https://github.com/kenyee/android-ddp-client/blob/6ab416e415570a03f96c383497144dd742de3f08/src/com/keysolutions/ddpclient/android/DDPStateSingleton.java#L808-L815
10,133
kenyee/android-ddp-client
src/com/keysolutions/ddpclient/android/DDPStateSingleton.java
DDPStateSingleton.getUserEmail
@SuppressWarnings("unchecked") public String getUserEmail(String userId) { if (userId == null) { return null; } // map userId to email // NOTE: this gets convoluted if they use OAuth logins because the email // field is in the service! Map<String, Object> user = getDocument("users", userId); String email = userId; if (user != null) { ArrayList<Map<String, String>> emails = (ArrayList<Map<String, String>>) user .get("emails"); if ((emails != null) && (emails.size() > 0)) { // get first email address Map<String, String> emailFields = emails.get(0); email = emailFields.get("address"); } } return email; }
java
@SuppressWarnings("unchecked") public String getUserEmail(String userId) { if (userId == null) { return null; } // map userId to email // NOTE: this gets convoluted if they use OAuth logins because the email // field is in the service! Map<String, Object> user = getDocument("users", userId); String email = userId; if (user != null) { ArrayList<Map<String, String>> emails = (ArrayList<Map<String, String>>) user .get("emails"); if ((emails != null) && (emails.size() > 0)) { // get first email address Map<String, String> emailFields = emails.get(0); email = emailFields.get("address"); } } return email; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "String", "getUserEmail", "(", "String", "userId", ")", "{", "if", "(", "userId", "==", "null", ")", "{", "return", "null", ";", "}", "// map userId to email", "// NOTE: this gets convoluted if they use OAuth logins because the email", "// field is in the service!", "Map", "<", "String", ",", "Object", ">", "user", "=", "getDocument", "(", "\"users\"", ",", "userId", ")", ";", "String", "email", "=", "userId", ";", "if", "(", "user", "!=", "null", ")", "{", "ArrayList", "<", "Map", "<", "String", ",", "String", ">", ">", "emails", "=", "(", "ArrayList", "<", "Map", "<", "String", ",", "String", ">", ">", ")", "user", ".", "get", "(", "\"emails\"", ")", ";", "if", "(", "(", "emails", "!=", "null", ")", "&&", "(", "emails", ".", "size", "(", ")", ">", "0", ")", ")", "{", "// get first email address", "Map", "<", "String", ",", "String", ">", "emailFields", "=", "emails", ".", "get", "(", "0", ")", ";", "email", "=", "emailFields", ".", "get", "(", "\"address\"", ")", ";", "}", "}", "return", "email", ";", "}" ]
Gets email address for user @param userId user ID @return email address for that user (lookup via users collection)
[ "Gets", "email", "address", "for", "user" ]
6ab416e415570a03f96c383497144dd742de3f08
https://github.com/kenyee/android-ddp-client/blob/6ab416e415570a03f96c383497144dd742de3f08/src/com/keysolutions/ddpclient/android/DDPStateSingleton.java#L830-L850
10,134
kenyee/android-ddp-client
src/com/keysolutions/ddpclient/android/DDPStateSingleton.java
DDPStateSingleton.call
public int call(String method, Object[] params, DDPListener resultListener) { return getDDP().call(method, params, resultListener); }
java
public int call(String method, Object[] params, DDPListener resultListener) { return getDDP().call(method, params, resultListener); }
[ "public", "int", "call", "(", "String", "method", ",", "Object", "[", "]", "params", ",", "DDPListener", "resultListener", ")", "{", "return", "getDDP", "(", ")", ".", "call", "(", "method", ",", "params", ",", "resultListener", ")", ";", "}" ]
Calls a Meteor method @param method name of corresponding Meteor method @param params arguments to be passed to the Meteor method @param resultListener DDP command listener for this method call @return command ID
[ "Calls", "a", "Meteor", "method" ]
6ab416e415570a03f96c383497144dd742de3f08
https://github.com/kenyee/android-ddp-client/blob/6ab416e415570a03f96c383497144dd742de3f08/src/com/keysolutions/ddpclient/android/DDPStateSingleton.java#L859-L862
10,135
cogroo/cogroo4
cogroo-gc/src/main/java/org/cogroo/tools/checker/rules/util/TagMaskUtils.java
TagMaskUtils.createTagMaskFromToken
public static TagMask createTagMaskFromToken(Token token, String text) { TagMask tm = new TagMask(); Matcher m = REPLACE_R2.matcher(text); while (m.find()) { String property = m.group(1); switch (property) { case "number": tm.setNumber(token.getMorphologicalTag().getNumberE()); break; case "gender": tm.setGender(token.getMorphologicalTag().getGenderE()); break; case "class": tm.setClazz(token.getMorphologicalTag().getClazzE()); break; case "person": tm.setPerson(token.getMorphologicalTag().getPersonE()); break; case "tense": tm.setTense(token.getMorphologicalTag().getTense()); break; case "mood": tm.setMood(token.getMorphologicalTag().getMood()); break; default: break; } } return tm; }
java
public static TagMask createTagMaskFromToken(Token token, String text) { TagMask tm = new TagMask(); Matcher m = REPLACE_R2.matcher(text); while (m.find()) { String property = m.group(1); switch (property) { case "number": tm.setNumber(token.getMorphologicalTag().getNumberE()); break; case "gender": tm.setGender(token.getMorphologicalTag().getGenderE()); break; case "class": tm.setClazz(token.getMorphologicalTag().getClazzE()); break; case "person": tm.setPerson(token.getMorphologicalTag().getPersonE()); break; case "tense": tm.setTense(token.getMorphologicalTag().getTense()); break; case "mood": tm.setMood(token.getMorphologicalTag().getMood()); break; default: break; } } return tm; }
[ "public", "static", "TagMask", "createTagMaskFromToken", "(", "Token", "token", ",", "String", "text", ")", "{", "TagMask", "tm", "=", "new", "TagMask", "(", ")", ";", "Matcher", "m", "=", "REPLACE_R2", ".", "matcher", "(", "text", ")", ";", "while", "(", "m", ".", "find", "(", ")", ")", "{", "String", "property", "=", "m", ".", "group", "(", "1", ")", ";", "switch", "(", "property", ")", "{", "case", "\"number\"", ":", "tm", ".", "setNumber", "(", "token", ".", "getMorphologicalTag", "(", ")", ".", "getNumberE", "(", ")", ")", ";", "break", ";", "case", "\"gender\"", ":", "tm", ".", "setGender", "(", "token", ".", "getMorphologicalTag", "(", ")", ".", "getGenderE", "(", ")", ")", ";", "break", ";", "case", "\"class\"", ":", "tm", ".", "setClazz", "(", "token", ".", "getMorphologicalTag", "(", ")", ".", "getClazzE", "(", ")", ")", ";", "break", ";", "case", "\"person\"", ":", "tm", ".", "setPerson", "(", "token", ".", "getMorphologicalTag", "(", ")", ".", "getPersonE", "(", ")", ")", ";", "break", ";", "case", "\"tense\"", ":", "tm", ".", "setTense", "(", "token", ".", "getMorphologicalTag", "(", ")", ".", "getTense", "(", ")", ")", ";", "break", ";", "case", "\"mood\"", ":", "tm", ".", "setMood", "(", "token", ".", "getMorphologicalTag", "(", ")", ".", "getMood", "(", ")", ")", ";", "break", ";", "default", ":", "break", ";", "}", "}", "return", "tm", ";", "}" ]
Returns a TagMask with the attributes collected from the given token. @param token the token whose attributes will be collected. @param text a string containing the attributes to get from the token, e.g., "number gender" @returna a TagMask object with the attributes collected
[ "Returns", "a", "TagMask", "with", "the", "attributes", "collected", "from", "the", "given", "token", "." ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-gc/src/main/java/org/cogroo/tools/checker/rules/util/TagMaskUtils.java#L115-L146
10,136
cogroo/cogroo4
cogroo-gc/src/main/java/org/cogroo/tools/checker/rules/applier/RulesXmlAccess.java
RulesXmlAccess.validate
public void validate() { Validator validator = this.schema.newValidator(); InputStream in = null; try { if(this.xmlFile != null) { in = this.xmlFile.openStream(); } else { // TODO: check if we need to specify the encoding in = new ByteArrayInputStream(this.serializedRule.getBytes()) ; } validator.validate(new StreamSource(in)); } catch (SAXException e) { throw new RulesException("Rules file does not conform to the schema", e); } catch (IOException e) { if(this.xmlFile != null) { throw new RulesException("Could not read file " + this.xmlFile, e); } else { throw new RulesException("Could not read serialized rule " + this.serializedRule, e); } } finally { Closeables.closeQuietly(in); } }
java
public void validate() { Validator validator = this.schema.newValidator(); InputStream in = null; try { if(this.xmlFile != null) { in = this.xmlFile.openStream(); } else { // TODO: check if we need to specify the encoding in = new ByteArrayInputStream(this.serializedRule.getBytes()) ; } validator.validate(new StreamSource(in)); } catch (SAXException e) { throw new RulesException("Rules file does not conform to the schema", e); } catch (IOException e) { if(this.xmlFile != null) { throw new RulesException("Could not read file " + this.xmlFile, e); } else { throw new RulesException("Could not read serialized rule " + this.serializedRule, e); } } finally { Closeables.closeQuietly(in); } }
[ "public", "void", "validate", "(", ")", "{", "Validator", "validator", "=", "this", ".", "schema", ".", "newValidator", "(", ")", ";", "InputStream", "in", "=", "null", ";", "try", "{", "if", "(", "this", ".", "xmlFile", "!=", "null", ")", "{", "in", "=", "this", ".", "xmlFile", ".", "openStream", "(", ")", ";", "}", "else", "{", "// TODO: check if we need to specify the encoding", "in", "=", "new", "ByteArrayInputStream", "(", "this", ".", "serializedRule", ".", "getBytes", "(", ")", ")", ";", "}", "validator", ".", "validate", "(", "new", "StreamSource", "(", "in", ")", ")", ";", "}", "catch", "(", "SAXException", "e", ")", "{", "throw", "new", "RulesException", "(", "\"Rules file does not conform to the schema\"", ",", "e", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "if", "(", "this", ".", "xmlFile", "!=", "null", ")", "{", "throw", "new", "RulesException", "(", "\"Could not read file \"", "+", "this", ".", "xmlFile", ",", "e", ")", ";", "}", "else", "{", "throw", "new", "RulesException", "(", "\"Could not read serialized rule \"", "+", "this", ".", "serializedRule", ",", "e", ")", ";", "}", "}", "finally", "{", "Closeables", ".", "closeQuietly", "(", "in", ")", ";", "}", "}" ]
Checks the xml against the xsd.
[ "Checks", "the", "xml", "against", "the", "xsd", "." ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-gc/src/main/java/org/cogroo/tools/checker/rules/applier/RulesXmlAccess.java#L111-L134
10,137
cogroo/cogroo4
cogroo-gc/src/main/java/org/cogroo/tools/checker/rules/applier/RulesXmlAccess.java
RulesXmlAccess.getRule
public Rule getRule(int id) { Rule returnRule = null; for (Rule rule : this.getRules().getRule()) { if (rule.getId() == id) { returnRule = rule; break; } } return returnRule; }
java
public Rule getRule(int id) { Rule returnRule = null; for (Rule rule : this.getRules().getRule()) { if (rule.getId() == id) { returnRule = rule; break; } } return returnRule; }
[ "public", "Rule", "getRule", "(", "int", "id", ")", "{", "Rule", "returnRule", "=", "null", ";", "for", "(", "Rule", "rule", ":", "this", ".", "getRules", "(", ")", ".", "getRule", "(", ")", ")", "{", "if", "(", "rule", ".", "getId", "(", ")", "==", "id", ")", "{", "returnRule", "=", "rule", ";", "break", ";", "}", "}", "return", "returnRule", ";", "}" ]
Gets a rule by its id. @param id the id of the rule @param rereadRules states if the rules must be read from the file or to reuse the in-memory representation, if it already exists @return the rule
[ "Gets", "a", "rule", "by", "its", "id", "." ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-gc/src/main/java/org/cogroo/tools/checker/rules/applier/RulesXmlAccess.java#L146-L155
10,138
cogroo/cogroo4
lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/DialogBuilder.java
DialogBuilder.addTextField
public XTextComponent addTextField(String content, String name, int x, int y, int width, int height) throws Exception { Object labelModel = multiServiceFactory.createInstance("com.sun.star.awt.UnoControlEditModel"); XPropertySet textFieldProperties = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, labelModel); textFieldProperties.setPropertyValue("PositionX", new Integer(x)); textFieldProperties.setPropertyValue("PositionY", new Integer(y)); textFieldProperties.setPropertyValue("Width", new Integer(width)); textFieldProperties.setPropertyValue("Height", new Integer(height)); textFieldProperties.setPropertyValue("Name", name); textFieldProperties.setPropertyValue("TabIndex", new Short( (short) tabcount++)); textFieldProperties.setPropertyValue("MultiLine", new Boolean(false)); textFieldProperties.setPropertyValue("Text", content); // insert the control models into the dialog model this.nameContainer.insertByName(name, labelModel); XControlContainer controlContainer = (XControlContainer) UnoRuntime.queryInterface(XControlContainer.class, this.oUnoDialog); Object obj = controlContainer.getControl(name); XTextComponent field = (XTextComponent) UnoRuntime.queryInterface( XTextComponent.class, obj); return field; }
java
public XTextComponent addTextField(String content, String name, int x, int y, int width, int height) throws Exception { Object labelModel = multiServiceFactory.createInstance("com.sun.star.awt.UnoControlEditModel"); XPropertySet textFieldProperties = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, labelModel); textFieldProperties.setPropertyValue("PositionX", new Integer(x)); textFieldProperties.setPropertyValue("PositionY", new Integer(y)); textFieldProperties.setPropertyValue("Width", new Integer(width)); textFieldProperties.setPropertyValue("Height", new Integer(height)); textFieldProperties.setPropertyValue("Name", name); textFieldProperties.setPropertyValue("TabIndex", new Short( (short) tabcount++)); textFieldProperties.setPropertyValue("MultiLine", new Boolean(false)); textFieldProperties.setPropertyValue("Text", content); // insert the control models into the dialog model this.nameContainer.insertByName(name, labelModel); XControlContainer controlContainer = (XControlContainer) UnoRuntime.queryInterface(XControlContainer.class, this.oUnoDialog); Object obj = controlContainer.getControl(name); XTextComponent field = (XTextComponent) UnoRuntime.queryInterface( XTextComponent.class, obj); return field; }
[ "public", "XTextComponent", "addTextField", "(", "String", "content", ",", "String", "name", ",", "int", "x", ",", "int", "y", ",", "int", "width", ",", "int", "height", ")", "throws", "Exception", "{", "Object", "labelModel", "=", "multiServiceFactory", ".", "createInstance", "(", "\"com.sun.star.awt.UnoControlEditModel\"", ")", ";", "XPropertySet", "textFieldProperties", "=", "(", "XPropertySet", ")", "UnoRuntime", ".", "queryInterface", "(", "XPropertySet", ".", "class", ",", "labelModel", ")", ";", "textFieldProperties", ".", "setPropertyValue", "(", "\"PositionX\"", ",", "new", "Integer", "(", "x", ")", ")", ";", "textFieldProperties", ".", "setPropertyValue", "(", "\"PositionY\"", ",", "new", "Integer", "(", "y", ")", ")", ";", "textFieldProperties", ".", "setPropertyValue", "(", "\"Width\"", ",", "new", "Integer", "(", "width", ")", ")", ";", "textFieldProperties", ".", "setPropertyValue", "(", "\"Height\"", ",", "new", "Integer", "(", "height", ")", ")", ";", "textFieldProperties", ".", "setPropertyValue", "(", "\"Name\"", ",", "name", ")", ";", "textFieldProperties", ".", "setPropertyValue", "(", "\"TabIndex\"", ",", "new", "Short", "(", "(", "short", ")", "tabcount", "++", ")", ")", ";", "textFieldProperties", ".", "setPropertyValue", "(", "\"MultiLine\"", ",", "new", "Boolean", "(", "false", ")", ")", ";", "textFieldProperties", ".", "setPropertyValue", "(", "\"Text\"", ",", "content", ")", ";", "// insert the control models into the dialog model", "this", ".", "nameContainer", ".", "insertByName", "(", "name", ",", "labelModel", ")", ";", "XControlContainer", "controlContainer", "=", "(", "XControlContainer", ")", "UnoRuntime", ".", "queryInterface", "(", "XControlContainer", ".", "class", ",", "this", ".", "oUnoDialog", ")", ";", "Object", "obj", "=", "controlContainer", ".", "getControl", "(", "name", ")", ";", "XTextComponent", "field", "=", "(", "XTextComponent", ")", "UnoRuntime", ".", "queryInterface", "(", "XTextComponent", ".", "class", ",", "obj", ")", ";", "return", "field", ";", "}" ]
Create a single line textfield with the given content. @param content @param name @param x @param y @param width @param height @return @throws Exception
[ "Create", "a", "single", "line", "textfield", "with", "the", "given", "content", "." ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/DialogBuilder.java#L314-L337
10,139
cogroo/cogroo4
lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/DialogBuilder.java
DialogBuilder.addPasswordField
public XTextComponent addPasswordField(char[] password, String name, int x, int y, int width, int height) throws Exception { Object labelModel = multiServiceFactory.createInstance("com.sun.star.awt.UnoControlEditModel"); XPropertySet passwordFieldProperties = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, labelModel); passwordFieldProperties.setPropertyValue("PositionX", new Integer(x)); passwordFieldProperties.setPropertyValue("PositionY", new Integer(y)); passwordFieldProperties.setPropertyValue("Width", new Integer(width)); passwordFieldProperties.setPropertyValue("Height", new Integer(height)); passwordFieldProperties.setPropertyValue("Name", name); passwordFieldProperties.setPropertyValue("TabIndex", new Short( (short) tabcount++)); passwordFieldProperties.setPropertyValue("MultiLine", new Boolean(false)); passwordFieldProperties.setPropertyValue("EchoChar", new Short( (short) 42)); passwordFieldProperties.setPropertyValue("Text", new String(password)); // override the content for (int i = 0; i < password.length; i++) { password[i] = Character.DIRECTIONALITY_WHITESPACE; } // insert the control models into the dialog model this.nameContainer.insertByName(name, labelModel); XControlContainer controlContainer = (XControlContainer) UnoRuntime.queryInterface(XControlContainer.class, this.oUnoDialog); Object obj = controlContainer.getControl(name); XTextComponent field = (XTextComponent) UnoRuntime.queryInterface( XTextComponent.class, obj); return field; }
java
public XTextComponent addPasswordField(char[] password, String name, int x, int y, int width, int height) throws Exception { Object labelModel = multiServiceFactory.createInstance("com.sun.star.awt.UnoControlEditModel"); XPropertySet passwordFieldProperties = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, labelModel); passwordFieldProperties.setPropertyValue("PositionX", new Integer(x)); passwordFieldProperties.setPropertyValue("PositionY", new Integer(y)); passwordFieldProperties.setPropertyValue("Width", new Integer(width)); passwordFieldProperties.setPropertyValue("Height", new Integer(height)); passwordFieldProperties.setPropertyValue("Name", name); passwordFieldProperties.setPropertyValue("TabIndex", new Short( (short) tabcount++)); passwordFieldProperties.setPropertyValue("MultiLine", new Boolean(false)); passwordFieldProperties.setPropertyValue("EchoChar", new Short( (short) 42)); passwordFieldProperties.setPropertyValue("Text", new String(password)); // override the content for (int i = 0; i < password.length; i++) { password[i] = Character.DIRECTIONALITY_WHITESPACE; } // insert the control models into the dialog model this.nameContainer.insertByName(name, labelModel); XControlContainer controlContainer = (XControlContainer) UnoRuntime.queryInterface(XControlContainer.class, this.oUnoDialog); Object obj = controlContainer.getControl(name); XTextComponent field = (XTextComponent) UnoRuntime.queryInterface( XTextComponent.class, obj); return field; }
[ "public", "XTextComponent", "addPasswordField", "(", "char", "[", "]", "password", ",", "String", "name", ",", "int", "x", ",", "int", "y", ",", "int", "width", ",", "int", "height", ")", "throws", "Exception", "{", "Object", "labelModel", "=", "multiServiceFactory", ".", "createInstance", "(", "\"com.sun.star.awt.UnoControlEditModel\"", ")", ";", "XPropertySet", "passwordFieldProperties", "=", "(", "XPropertySet", ")", "UnoRuntime", ".", "queryInterface", "(", "XPropertySet", ".", "class", ",", "labelModel", ")", ";", "passwordFieldProperties", ".", "setPropertyValue", "(", "\"PositionX\"", ",", "new", "Integer", "(", "x", ")", ")", ";", "passwordFieldProperties", ".", "setPropertyValue", "(", "\"PositionY\"", ",", "new", "Integer", "(", "y", ")", ")", ";", "passwordFieldProperties", ".", "setPropertyValue", "(", "\"Width\"", ",", "new", "Integer", "(", "width", ")", ")", ";", "passwordFieldProperties", ".", "setPropertyValue", "(", "\"Height\"", ",", "new", "Integer", "(", "height", ")", ")", ";", "passwordFieldProperties", ".", "setPropertyValue", "(", "\"Name\"", ",", "name", ")", ";", "passwordFieldProperties", ".", "setPropertyValue", "(", "\"TabIndex\"", ",", "new", "Short", "(", "(", "short", ")", "tabcount", "++", ")", ")", ";", "passwordFieldProperties", ".", "setPropertyValue", "(", "\"MultiLine\"", ",", "new", "Boolean", "(", "false", ")", ")", ";", "passwordFieldProperties", ".", "setPropertyValue", "(", "\"EchoChar\"", ",", "new", "Short", "(", "(", "short", ")", "42", ")", ")", ";", "passwordFieldProperties", ".", "setPropertyValue", "(", "\"Text\"", ",", "new", "String", "(", "password", ")", ")", ";", "// override the content", "for", "(", "int", "i", "=", "0", ";", "i", "<", "password", ".", "length", ";", "i", "++", ")", "{", "password", "[", "i", "]", "=", "Character", ".", "DIRECTIONALITY_WHITESPACE", ";", "}", "// insert the control models into the dialog model", "this", ".", "nameContainer", ".", "insertByName", "(", "name", ",", "labelModel", ")", ";", "XControlContainer", "controlContainer", "=", "(", "XControlContainer", ")", "UnoRuntime", ".", "queryInterface", "(", "XControlContainer", ".", "class", ",", "this", ".", "oUnoDialog", ")", ";", "Object", "obj", "=", "controlContainer", ".", "getControl", "(", "name", ")", ";", "XTextComponent", "field", "=", "(", "XTextComponent", ")", "UnoRuntime", ".", "queryInterface", "(", "XTextComponent", ".", "class", ",", "obj", ")", ";", "return", "field", ";", "}" ]
Create a password field @param password , the content will be overriden after setting to the field @param name @param x @param y @param width @param height @return @throws Exception
[ "Create", "a", "password", "field" ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/DialogBuilder.java#L430-L461
10,140
cogroo/cogroo4
lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/DialogBuilder.java
DialogBuilder.createUniqueName
public static String createUniqueName(XNameAccess _xElementContainer, String _sElementName) { boolean bElementexists = true; int i = 1; String sIncSuffix = ""; String BaseName = _sElementName; while (bElementexists) { bElementexists = _xElementContainer.hasByName(_sElementName); if (bElementexists) { i += 1; _sElementName = BaseName + Integer.toString(i); } } return _sElementName; }
java
public static String createUniqueName(XNameAccess _xElementContainer, String _sElementName) { boolean bElementexists = true; int i = 1; String sIncSuffix = ""; String BaseName = _sElementName; while (bElementexists) { bElementexists = _xElementContainer.hasByName(_sElementName); if (bElementexists) { i += 1; _sElementName = BaseName + Integer.toString(i); } } return _sElementName; }
[ "public", "static", "String", "createUniqueName", "(", "XNameAccess", "_xElementContainer", ",", "String", "_sElementName", ")", "{", "boolean", "bElementexists", "=", "true", ";", "int", "i", "=", "1", ";", "String", "sIncSuffix", "=", "\"\"", ";", "String", "BaseName", "=", "_sElementName", ";", "while", "(", "bElementexists", ")", "{", "bElementexists", "=", "_xElementContainer", ".", "hasByName", "(", "_sElementName", ")", ";", "if", "(", "bElementexists", ")", "{", "i", "+=", "1", ";", "_sElementName", "=", "BaseName", "+", "Integer", ".", "toString", "(", "i", ")", ";", "}", "}", "return", "_sElementName", ";", "}" ]
makes a String unique by appending a numerical suffix @param _xElementContainer the com.sun.star.container.XNameAccess container that the new Element is going to be inserted to @param _sElementName the StemName of the Element
[ "makes", "a", "String", "unique", "by", "appending", "a", "numerical", "suffix" ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/DialogBuilder.java#L579-L592
10,141
cogroo/cogroo4
cogroo-gc/src/main/java/org/cogroo/tools/checker/rules/verbs/VerbPlusPreps.java
VerbPlusPreps.findWord
public Prep findWord(String word) { if (prepsMap.containsKey("*")) { word = "*"; } return prepsMap.get(word); }
java
public Prep findWord(String word) { if (prepsMap.containsKey("*")) { word = "*"; } return prepsMap.get(word); }
[ "public", "Prep", "findWord", "(", "String", "word", ")", "{", "if", "(", "prepsMap", ".", "containsKey", "(", "\"*\"", ")", ")", "{", "word", "=", "\"*\"", ";", "}", "return", "prepsMap", ".", "get", "(", "word", ")", ";", "}" ]
that should be linking them, otherwise returns null
[ "that", "should", "be", "linking", "them", "otherwise", "returns", "null" ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-gc/src/main/java/org/cogroo/tools/checker/rules/verbs/VerbPlusPreps.java#L42-L49
10,142
cogroo/cogroo4
cogroo-nlp/src/main/java/org/cogroo/tools/sentdetect/PortugueseSDContextGenerator.java
PortugueseSDContextGenerator.collectFeatures
protected void collectFeatures(String prefix, String suffix, String previous, String next, char eosChar) { buf.append("x="); buf.append(prefix); collectFeats.add(buf.toString()); buf.setLength(0); if (!prefix.equals("")) { collectFeats.add(Integer.toString(prefix.length())); if (isFirstUpper(prefix)) { collectFeats.add("xcap"); } if (inducedAbbreviations.contains(prefix + eosChar)) { collectFeats.add("xabbrev"); } char c = prefix.charAt(0); if (prefix.length() == 1 && Character.isLetter(c) && Character.isUpperCase(c) && eosChar == '.') { // looks like name abb collectFeats.add("xnabb"); } } buf.append("v="); buf.append(previous); collectFeats.add(buf.toString()); buf.setLength(0); if (!previous.equals("")) { if (isFirstUpper(previous)) { collectFeats.add("vcap"); } if (inducedAbbreviations.contains(previous)) { collectFeats.add("vabbrev"); } } buf.append("s="); buf.append(suffix); collectFeats.add(buf.toString()); buf.setLength(0); if (!suffix.equals("")) { if (isFirstUpper(suffix)) { collectFeats.add("scap"); } if (inducedAbbreviations.contains(suffix)) { collectFeats.add("sabbrev"); } } buf.append("n="); buf.append(next); collectFeats.add(buf.toString()); buf.setLength(0); if (!next.equals("")) { if (isFirstUpper(next)) { collectFeats.add("ncap"); } if (inducedAbbreviations.contains(next)) { collectFeats.add("nabbrev"); } } }
java
protected void collectFeatures(String prefix, String suffix, String previous, String next, char eosChar) { buf.append("x="); buf.append(prefix); collectFeats.add(buf.toString()); buf.setLength(0); if (!prefix.equals("")) { collectFeats.add(Integer.toString(prefix.length())); if (isFirstUpper(prefix)) { collectFeats.add("xcap"); } if (inducedAbbreviations.contains(prefix + eosChar)) { collectFeats.add("xabbrev"); } char c = prefix.charAt(0); if (prefix.length() == 1 && Character.isLetter(c) && Character.isUpperCase(c) && eosChar == '.') { // looks like name abb collectFeats.add("xnabb"); } } buf.append("v="); buf.append(previous); collectFeats.add(buf.toString()); buf.setLength(0); if (!previous.equals("")) { if (isFirstUpper(previous)) { collectFeats.add("vcap"); } if (inducedAbbreviations.contains(previous)) { collectFeats.add("vabbrev"); } } buf.append("s="); buf.append(suffix); collectFeats.add(buf.toString()); buf.setLength(0); if (!suffix.equals("")) { if (isFirstUpper(suffix)) { collectFeats.add("scap"); } if (inducedAbbreviations.contains(suffix)) { collectFeats.add("sabbrev"); } } buf.append("n="); buf.append(next); collectFeats.add(buf.toString()); buf.setLength(0); if (!next.equals("")) { if (isFirstUpper(next)) { collectFeats.add("ncap"); } if (inducedAbbreviations.contains(next)) { collectFeats.add("nabbrev"); } } }
[ "protected", "void", "collectFeatures", "(", "String", "prefix", ",", "String", "suffix", ",", "String", "previous", ",", "String", "next", ",", "char", "eosChar", ")", "{", "buf", ".", "append", "(", "\"x=\"", ")", ";", "buf", ".", "append", "(", "prefix", ")", ";", "collectFeats", ".", "add", "(", "buf", ".", "toString", "(", ")", ")", ";", "buf", ".", "setLength", "(", "0", ")", ";", "if", "(", "!", "prefix", ".", "equals", "(", "\"\"", ")", ")", "{", "collectFeats", ".", "add", "(", "Integer", ".", "toString", "(", "prefix", ".", "length", "(", ")", ")", ")", ";", "if", "(", "isFirstUpper", "(", "prefix", ")", ")", "{", "collectFeats", ".", "add", "(", "\"xcap\"", ")", ";", "}", "if", "(", "inducedAbbreviations", ".", "contains", "(", "prefix", "+", "eosChar", ")", ")", "{", "collectFeats", ".", "add", "(", "\"xabbrev\"", ")", ";", "}", "char", "c", "=", "prefix", ".", "charAt", "(", "0", ")", ";", "if", "(", "prefix", ".", "length", "(", ")", "==", "1", "&&", "Character", ".", "isLetter", "(", "c", ")", "&&", "Character", ".", "isUpperCase", "(", "c", ")", "&&", "eosChar", "==", "'", "'", ")", "{", "// looks like name abb", "collectFeats", ".", "add", "(", "\"xnabb\"", ")", ";", "}", "}", "buf", ".", "append", "(", "\"v=\"", ")", ";", "buf", ".", "append", "(", "previous", ")", ";", "collectFeats", ".", "add", "(", "buf", ".", "toString", "(", ")", ")", ";", "buf", ".", "setLength", "(", "0", ")", ";", "if", "(", "!", "previous", ".", "equals", "(", "\"\"", ")", ")", "{", "if", "(", "isFirstUpper", "(", "previous", ")", ")", "{", "collectFeats", ".", "add", "(", "\"vcap\"", ")", ";", "}", "if", "(", "inducedAbbreviations", ".", "contains", "(", "previous", ")", ")", "{", "collectFeats", ".", "add", "(", "\"vabbrev\"", ")", ";", "}", "}", "buf", ".", "append", "(", "\"s=\"", ")", ";", "buf", ".", "append", "(", "suffix", ")", ";", "collectFeats", ".", "add", "(", "buf", ".", "toString", "(", ")", ")", ";", "buf", ".", "setLength", "(", "0", ")", ";", "if", "(", "!", "suffix", ".", "equals", "(", "\"\"", ")", ")", "{", "if", "(", "isFirstUpper", "(", "suffix", ")", ")", "{", "collectFeats", ".", "add", "(", "\"scap\"", ")", ";", "}", "if", "(", "inducedAbbreviations", ".", "contains", "(", "suffix", ")", ")", "{", "collectFeats", ".", "add", "(", "\"sabbrev\"", ")", ";", "}", "}", "buf", ".", "append", "(", "\"n=\"", ")", ";", "buf", ".", "append", "(", "next", ")", ";", "collectFeats", ".", "add", "(", "buf", ".", "toString", "(", ")", ")", ";", "buf", ".", "setLength", "(", "0", ")", ";", "if", "(", "!", "next", ".", "equals", "(", "\"\"", ")", ")", "{", "if", "(", "isFirstUpper", "(", "next", ")", ")", "{", "collectFeats", ".", "add", "(", "\"ncap\"", ")", ";", "}", "if", "(", "inducedAbbreviations", ".", "contains", "(", "next", ")", ")", "{", "collectFeats", ".", "add", "(", "\"nabbrev\"", ")", ";", "}", "}", "}" ]
Determines some of the features for the sentence detector and adds them to list features. @param prefix String preceeding the eos character in the eos token. @param suffix String following the eos character in the eos token. @param previous Space delimited token preceeding token containing eos character. @param next Space delimited token following token containsing eos character.
[ "Determines", "some", "of", "the", "features", "for", "the", "sentence", "detector", "and", "adds", "them", "to", "list", "features", "." ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-nlp/src/main/java/org/cogroo/tools/sentdetect/PortugueseSDContextGenerator.java#L181-L241
10,143
cogroo/cogroo4
cogroo-nlp/src/main/java/org/cogroo/tools/sentdetect/PortugueseSDContextGenerator.java
PortugueseSDContextGenerator.previousSpaceIndex
private static final int previousSpaceIndex(CharSequence sb, int seek) { seek--; while (seek > 0 && !StringUtil.isWhitespace(sb.charAt(seek))) { seek--; } if (seek > 0 && StringUtil.isWhitespace(sb.charAt(seek))) { while (seek > 0 && StringUtil.isWhitespace(sb.charAt(seek - 1))) seek--; return seek; } return 0; }
java
private static final int previousSpaceIndex(CharSequence sb, int seek) { seek--; while (seek > 0 && !StringUtil.isWhitespace(sb.charAt(seek))) { seek--; } if (seek > 0 && StringUtil.isWhitespace(sb.charAt(seek))) { while (seek > 0 && StringUtil.isWhitespace(sb.charAt(seek - 1))) seek--; return seek; } return 0; }
[ "private", "static", "final", "int", "previousSpaceIndex", "(", "CharSequence", "sb", ",", "int", "seek", ")", "{", "seek", "--", ";", "while", "(", "seek", ">", "0", "&&", "!", "StringUtil", ".", "isWhitespace", "(", "sb", ".", "charAt", "(", "seek", ")", ")", ")", "{", "seek", "--", ";", "}", "if", "(", "seek", ">", "0", "&&", "StringUtil", ".", "isWhitespace", "(", "sb", ".", "charAt", "(", "seek", ")", ")", ")", "{", "while", "(", "seek", ">", "0", "&&", "StringUtil", ".", "isWhitespace", "(", "sb", ".", "charAt", "(", "seek", "-", "1", ")", ")", ")", "seek", "--", ";", "return", "seek", ";", "}", "return", "0", ";", "}" ]
Finds the index of the nearest space before a specified index which is not itself preceded by a space. @param sb The string buffer which contains the text being examined. @param seek The index to begin searching from. @return The index which contains the nearest space.
[ "Finds", "the", "index", "of", "the", "nearest", "space", "before", "a", "specified", "index", "which", "is", "not", "itself", "preceded", "by", "a", "space", "." ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-nlp/src/main/java/org/cogroo/tools/sentdetect/PortugueseSDContextGenerator.java#L257-L268
10,144
cogroo/cogroo4
cogroo-nlp/src/main/java/org/cogroo/tools/sentdetect/PortugueseSDContextGenerator.java
PortugueseSDContextGenerator.addCharPreds
private void addCharPreds(String key, char c, List<String> preds) { preds.add(key + "=" + c); if (Character.isLetter(c)) { preds.add(key + "_alpha"); if (Character.isUpperCase(c)) { preds.add(key + "_caps"); } } else if (Character.isDigit(c)) { preds.add(key + "_num"); } else if (StringUtil.isWhitespace(c)) { preds.add(key + "_ws"); } else { if (c == '.' || c == '?' || c == '!') { preds.add(key + "_eos"); } else if (c == ',' || c == ';' || c == ':') { preds.add(key + "_reos"); } else if (c == '`' || c == '"' || c == '\'') { preds.add(key + "_quote"); } else if (c == '[' || c == '{' || c == '(') { preds.add(key + "_lp"); } else if (c == ']' || c == '}' || c == ')') { preds.add(key + "_rp"); } } }
java
private void addCharPreds(String key, char c, List<String> preds) { preds.add(key + "=" + c); if (Character.isLetter(c)) { preds.add(key + "_alpha"); if (Character.isUpperCase(c)) { preds.add(key + "_caps"); } } else if (Character.isDigit(c)) { preds.add(key + "_num"); } else if (StringUtil.isWhitespace(c)) { preds.add(key + "_ws"); } else { if (c == '.' || c == '?' || c == '!') { preds.add(key + "_eos"); } else if (c == ',' || c == ';' || c == ':') { preds.add(key + "_reos"); } else if (c == '`' || c == '"' || c == '\'') { preds.add(key + "_quote"); } else if (c == '[' || c == '{' || c == '(') { preds.add(key + "_lp"); } else if (c == ']' || c == '}' || c == ')') { preds.add(key + "_rp"); } } }
[ "private", "void", "addCharPreds", "(", "String", "key", ",", "char", "c", ",", "List", "<", "String", ">", "preds", ")", "{", "preds", ".", "add", "(", "key", "+", "\"=\"", "+", "c", ")", ";", "if", "(", "Character", ".", "isLetter", "(", "c", ")", ")", "{", "preds", ".", "add", "(", "key", "+", "\"_alpha\"", ")", ";", "if", "(", "Character", ".", "isUpperCase", "(", "c", ")", ")", "{", "preds", ".", "add", "(", "key", "+", "\"_caps\"", ")", ";", "}", "}", "else", "if", "(", "Character", ".", "isDigit", "(", "c", ")", ")", "{", "preds", ".", "add", "(", "key", "+", "\"_num\"", ")", ";", "}", "else", "if", "(", "StringUtil", ".", "isWhitespace", "(", "c", ")", ")", "{", "preds", ".", "add", "(", "key", "+", "\"_ws\"", ")", ";", "}", "else", "{", "if", "(", "c", "==", "'", "'", "||", "c", "==", "'", "'", "||", "c", "==", "'", "'", ")", "{", "preds", ".", "add", "(", "key", "+", "\"_eos\"", ")", ";", "}", "else", "if", "(", "c", "==", "'", "'", "||", "c", "==", "'", "'", "||", "c", "==", "'", "'", ")", "{", "preds", ".", "add", "(", "key", "+", "\"_reos\"", ")", ";", "}", "else", "if", "(", "c", "==", "'", "'", "||", "c", "==", "'", "'", "||", "c", "==", "'", "'", ")", "{", "preds", ".", "add", "(", "key", "+", "\"_quote\"", ")", ";", "}", "else", "if", "(", "c", "==", "'", "'", "||", "c", "==", "'", "'", "||", "c", "==", "'", "'", ")", "{", "preds", ".", "add", "(", "key", "+", "\"_lp\"", ")", ";", "}", "else", "if", "(", "c", "==", "'", "'", "||", "c", "==", "'", "'", "||", "c", "==", "'", "'", ")", "{", "preds", ".", "add", "(", "key", "+", "\"_rp\"", ")", ";", "}", "}", "}" ]
Helper function for getContext.
[ "Helper", "function", "for", "getContext", "." ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-nlp/src/main/java/org/cogroo/tools/sentdetect/PortugueseSDContextGenerator.java#L331-L355
10,145
cogroo/cogroo4
cogroo-gc/src/main/java/org/cogroo/tools/checker/checkers/SpaceChecker.java
SpaceChecker.getsSupposedAbbreviation
private boolean getsSupposedAbbreviation(String text, int position) { int ini; boolean end = false; String word = text; // Indicates where the position of the supposed abbreviation begins for (ini = position; ini >= 0; ini--) if (Character.isWhitespace(text.charAt(ini)) || isOpenBracket(text.charAt(ini)) ) break; // Indicates where the supposed abbreviation should end for (int i = position + 1; i < text.length() - 1 && end == false; i++) { switch (text.charAt(i)) { // Possible end of the sentence or just part of the supposed // abbreviation case '.': if (Character.isWhitespace(text.charAt(i + 1)) || isEnding(text.charAt(i + 1)) ) { word = word.substring(ini + 1, i + 1); end = true; } break; // Character that is part of the abbreviation default: break; } } if (end == true) { if (INITIALS.matcher(word).find()) return true; else if (this.dic.contains(new StringList(word))) return true; } return false; }
java
private boolean getsSupposedAbbreviation(String text, int position) { int ini; boolean end = false; String word = text; // Indicates where the position of the supposed abbreviation begins for (ini = position; ini >= 0; ini--) if (Character.isWhitespace(text.charAt(ini)) || isOpenBracket(text.charAt(ini)) ) break; // Indicates where the supposed abbreviation should end for (int i = position + 1; i < text.length() - 1 && end == false; i++) { switch (text.charAt(i)) { // Possible end of the sentence or just part of the supposed // abbreviation case '.': if (Character.isWhitespace(text.charAt(i + 1)) || isEnding(text.charAt(i + 1)) ) { word = word.substring(ini + 1, i + 1); end = true; } break; // Character that is part of the abbreviation default: break; } } if (end == true) { if (INITIALS.matcher(word).find()) return true; else if (this.dic.contains(new StringList(word))) return true; } return false; }
[ "private", "boolean", "getsSupposedAbbreviation", "(", "String", "text", ",", "int", "position", ")", "{", "int", "ini", ";", "boolean", "end", "=", "false", ";", "String", "word", "=", "text", ";", "// Indicates where the position of the supposed abbreviation begins\r", "for", "(", "ini", "=", "position", ";", "ini", ">=", "0", ";", "ini", "--", ")", "if", "(", "Character", ".", "isWhitespace", "(", "text", ".", "charAt", "(", "ini", ")", ")", "||", "isOpenBracket", "(", "text", ".", "charAt", "(", "ini", ")", ")", ")", "break", ";", "// Indicates where the supposed abbreviation should end\r", "for", "(", "int", "i", "=", "position", "+", "1", ";", "i", "<", "text", ".", "length", "(", ")", "-", "1", "&&", "end", "==", "false", ";", "i", "++", ")", "{", "switch", "(", "text", ".", "charAt", "(", "i", ")", ")", "{", "// Possible end of the sentence or just part of the supposed\r", "// abbreviation\r", "case", "'", "'", ":", "if", "(", "Character", ".", "isWhitespace", "(", "text", ".", "charAt", "(", "i", "+", "1", ")", ")", "||", "isEnding", "(", "text", ".", "charAt", "(", "i", "+", "1", ")", ")", ")", "{", "word", "=", "word", ".", "substring", "(", "ini", "+", "1", ",", "i", "+", "1", ")", ";", "end", "=", "true", ";", "}", "break", ";", "// Character that is part of the abbreviation\r", "default", ":", "break", ";", "}", "}", "if", "(", "end", "==", "true", ")", "{", "if", "(", "INITIALS", ".", "matcher", "(", "word", ")", ".", "find", "(", ")", ")", "return", "true", ";", "else", "if", "(", "this", ".", "dic", ".", "contains", "(", "new", "StringList", "(", "word", ")", ")", ")", "return", "true", ";", "}", "return", "false", ";", "}" ]
Analyze a sentence and gets the word which contains the position of the error in the parameter and tells if it is an initial or if the abbreviation dictionary contains it or not. @param text the entire sentence to be analyzed @param position where in the sentence the supposed error was found @return true if the error is actually an initial, and false if not.
[ "Analyze", "a", "sentence", "and", "gets", "the", "word", "which", "contains", "the", "position", "of", "the", "error", "in", "the", "parameter", "and", "tells", "if", "it", "is", "an", "initial", "or", "if", "the", "abbreviation", "dictionary", "contains", "it", "or", "not", "." ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-gc/src/main/java/org/cogroo/tools/checker/checkers/SpaceChecker.java#L286-L326
10,146
DataArt/CalculationEngine
calculation-engine/engine-functions/src/main/java/com/dataart/spreadsheetanalytics/functions/poi/data/DefineFunction.java
DefineFunction.evaluate
@Override public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) { log.debug("In evaluate() of DEFINE function. Args = {}", Arrays.toString(args)); return new StringEval(DefineFunction.class.getAnnotation(CustomFunctionMeta.class).value()); }
java
@Override public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) { log.debug("In evaluate() of DEFINE function. Args = {}", Arrays.toString(args)); return new StringEval(DefineFunction.class.getAnnotation(CustomFunctionMeta.class).value()); }
[ "@", "Override", "public", "ValueEval", "evaluate", "(", "ValueEval", "[", "]", "args", ",", "OperationEvaluationContext", "ec", ")", "{", "log", ".", "debug", "(", "\"In evaluate() of DEFINE function. Args = {}\"", ",", "Arrays", ".", "toString", "(", "args", ")", ")", ";", "return", "new", "StringEval", "(", "DefineFunction", ".", "class", ".", "getAnnotation", "(", "CustomFunctionMeta", ".", "class", ")", ".", "value", "(", ")", ")", ";", "}" ]
This function does nothing, since it should never be evaluated. DEFINE function is a spreadsheet metadata and it cannot have a value.
[ "This", "function", "does", "nothing", "since", "it", "should", "never", "be", "evaluated", ".", "DEFINE", "function", "is", "a", "spreadsheet", "metadata", "and", "it", "cannot", "have", "a", "value", "." ]
34ce1d9c1f9b57a502906b274311d28580b134e5
https://github.com/DataArt/CalculationEngine/blob/34ce1d9c1f9b57a502906b274311d28580b134e5/calculation-engine/engine-functions/src/main/java/com/dataart/spreadsheetanalytics/functions/poi/data/DefineFunction.java#L40-L45
10,147
cogroo/cogroo4
cogroo-eval/GramEval/src/main/java/cogroo/uima/XmiWriterCasConsumer.java
XmiWriterCasConsumer.writeXmi
private void writeXmi(CAS aCas, File name, String modelFileName) throws IOException, SAXException { FileOutputStream out = null; try { // write XMI out = new FileOutputStream(name); XmiCasSerializer ser = new XmiCasSerializer(aCas.getTypeSystem()); XMLSerializer xmlSer = new XMLSerializer(out, false); ser.serialize(aCas, xmlSer.getContentHandler()); } finally { if (out != null) { out.close(); } } }
java
private void writeXmi(CAS aCas, File name, String modelFileName) throws IOException, SAXException { FileOutputStream out = null; try { // write XMI out = new FileOutputStream(name); XmiCasSerializer ser = new XmiCasSerializer(aCas.getTypeSystem()); XMLSerializer xmlSer = new XMLSerializer(out, false); ser.serialize(aCas, xmlSer.getContentHandler()); } finally { if (out != null) { out.close(); } } }
[ "private", "void", "writeXmi", "(", "CAS", "aCas", ",", "File", "name", ",", "String", "modelFileName", ")", "throws", "IOException", ",", "SAXException", "{", "FileOutputStream", "out", "=", "null", ";", "try", "{", "// write XMI", "out", "=", "new", "FileOutputStream", "(", "name", ")", ";", "XmiCasSerializer", "ser", "=", "new", "XmiCasSerializer", "(", "aCas", ".", "getTypeSystem", "(", ")", ")", ";", "XMLSerializer", "xmlSer", "=", "new", "XMLSerializer", "(", "out", ",", "false", ")", ";", "ser", ".", "serialize", "(", "aCas", ",", "xmlSer", ".", "getContentHandler", "(", ")", ")", ";", "}", "finally", "{", "if", "(", "out", "!=", "null", ")", "{", "out", ".", "close", "(", ")", ";", "}", "}", "}" ]
Serialize a CAS to a file in XMI format @param aCas CAS to serialize @param name output file @throws SAXException @throws Exception @throws ResourceProcessException
[ "Serialize", "a", "CAS", "to", "a", "file", "in", "XMI", "format" ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-eval/GramEval/src/main/java/cogroo/uima/XmiWriterCasConsumer.java#L147-L162
10,148
cogroo/cogroo4
cogroo-eval/TypeSystem/src/main/java/cogroo/uima/GrammarError.java
GrammarError.getRuleId
public String getRuleId() { if (GrammarError_Type.featOkTst && ((GrammarError_Type) jcasType).casFeat_ruleId == null) jcasType.jcas.throwFeatMissing("ruleId", "cogroo.uima.GrammarError"); return jcasType.ll_cas.ll_getStringValue(addr, ((GrammarError_Type) jcasType).casFeatCode_ruleId); }
java
public String getRuleId() { if (GrammarError_Type.featOkTst && ((GrammarError_Type) jcasType).casFeat_ruleId == null) jcasType.jcas.throwFeatMissing("ruleId", "cogroo.uima.GrammarError"); return jcasType.ll_cas.ll_getStringValue(addr, ((GrammarError_Type) jcasType).casFeatCode_ruleId); }
[ "public", "String", "getRuleId", "(", ")", "{", "if", "(", "GrammarError_Type", ".", "featOkTst", "&&", "(", "(", "GrammarError_Type", ")", "jcasType", ")", ".", "casFeat_ruleId", "==", "null", ")", "jcasType", ".", "jcas", ".", "throwFeatMissing", "(", "\"ruleId\"", ",", "\"cogroo.uima.GrammarError\"", ")", ";", "return", "jcasType", ".", "ll_cas", ".", "ll_getStringValue", "(", "addr", ",", "(", "(", "GrammarError_Type", ")", "jcasType", ")", ".", "casFeatCode_ruleId", ")", ";", "}" ]
getter for ruleId - gets @generated
[ "getter", "for", "ruleId", "-", "gets" ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-eval/TypeSystem/src/main/java/cogroo/uima/GrammarError.java#L99-L105
10,149
cogroo/cogroo4
cogroo-eval/TypeSystem/src/main/java/cogroo/uima/GrammarError.java
GrammarError.setRuleId
public void setRuleId(String v) { if (GrammarError_Type.featOkTst && ((GrammarError_Type) jcasType).casFeat_ruleId == null) jcasType.jcas.throwFeatMissing("ruleId", "cogroo.uima.GrammarError"); jcasType.ll_cas.ll_setStringValue(addr, ((GrammarError_Type) jcasType).casFeatCode_ruleId, v); }
java
public void setRuleId(String v) { if (GrammarError_Type.featOkTst && ((GrammarError_Type) jcasType).casFeat_ruleId == null) jcasType.jcas.throwFeatMissing("ruleId", "cogroo.uima.GrammarError"); jcasType.ll_cas.ll_setStringValue(addr, ((GrammarError_Type) jcasType).casFeatCode_ruleId, v); }
[ "public", "void", "setRuleId", "(", "String", "v", ")", "{", "if", "(", "GrammarError_Type", ".", "featOkTst", "&&", "(", "(", "GrammarError_Type", ")", "jcasType", ")", ".", "casFeat_ruleId", "==", "null", ")", "jcasType", ".", "jcas", ".", "throwFeatMissing", "(", "\"ruleId\"", ",", "\"cogroo.uima.GrammarError\"", ")", ";", "jcasType", ".", "ll_cas", ".", "ll_setStringValue", "(", "addr", ",", "(", "(", "GrammarError_Type", ")", "jcasType", ")", ".", "casFeatCode_ruleId", ",", "v", ")", ";", "}" ]
setter for ruleId - sets @generated
[ "setter", "for", "ruleId", "-", "sets" ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-eval/TypeSystem/src/main/java/cogroo/uima/GrammarError.java#L112-L118
10,150
cogroo/cogroo4
cogroo-eval/TypeSystem/src/main/java/cogroo/uima/GrammarError.java
GrammarError.setError
public void setError(String v) { if (GrammarError_Type.featOkTst && ((GrammarError_Type) jcasType).casFeat_error == null) jcasType.jcas.throwFeatMissing("error", "cogroo.uima.GrammarError"); jcasType.ll_cas.ll_setStringValue(addr, ((GrammarError_Type) jcasType).casFeatCode_error, v); }
java
public void setError(String v) { if (GrammarError_Type.featOkTst && ((GrammarError_Type) jcasType).casFeat_error == null) jcasType.jcas.throwFeatMissing("error", "cogroo.uima.GrammarError"); jcasType.ll_cas.ll_setStringValue(addr, ((GrammarError_Type) jcasType).casFeatCode_error, v); }
[ "public", "void", "setError", "(", "String", "v", ")", "{", "if", "(", "GrammarError_Type", ".", "featOkTst", "&&", "(", "(", "GrammarError_Type", ")", "jcasType", ")", ".", "casFeat_error", "==", "null", ")", "jcasType", ".", "jcas", ".", "throwFeatMissing", "(", "\"error\"", ",", "\"cogroo.uima.GrammarError\"", ")", ";", "jcasType", ".", "ll_cas", ".", "ll_setStringValue", "(", "addr", ",", "(", "(", "GrammarError_Type", ")", "jcasType", ")", ".", "casFeatCode_error", ",", "v", ")", ";", "}" ]
setter for error - sets @generated
[ "setter", "for", "error", "-", "sets" ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-eval/TypeSystem/src/main/java/cogroo/uima/GrammarError.java#L170-L176
10,151
cogroo/cogroo4
cogroo-eval/TypeSystem/src/main/java/cogroo/uima/GrammarError.java
GrammarError.getReplace
public String getReplace() { if (GrammarError_Type.featOkTst && ((GrammarError_Type) jcasType).casFeat_replace == null) jcasType.jcas.throwFeatMissing("replace", "cogroo.uima.GrammarError"); return jcasType.ll_cas.ll_getStringValue(addr, ((GrammarError_Type) jcasType).casFeatCode_replace); }
java
public String getReplace() { if (GrammarError_Type.featOkTst && ((GrammarError_Type) jcasType).casFeat_replace == null) jcasType.jcas.throwFeatMissing("replace", "cogroo.uima.GrammarError"); return jcasType.ll_cas.ll_getStringValue(addr, ((GrammarError_Type) jcasType).casFeatCode_replace); }
[ "public", "String", "getReplace", "(", ")", "{", "if", "(", "GrammarError_Type", ".", "featOkTst", "&&", "(", "(", "GrammarError_Type", ")", "jcasType", ")", ".", "casFeat_replace", "==", "null", ")", "jcasType", ".", "jcas", ".", "throwFeatMissing", "(", "\"replace\"", ",", "\"cogroo.uima.GrammarError\"", ")", ";", "return", "jcasType", ".", "ll_cas", ".", "ll_getStringValue", "(", "addr", ",", "(", "(", "GrammarError_Type", ")", "jcasType", ")", ".", "casFeatCode_replace", ")", ";", "}" ]
getter for replace - gets @generated
[ "getter", "for", "replace", "-", "gets" ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-eval/TypeSystem/src/main/java/cogroo/uima/GrammarError.java#L186-L192
10,152
DataArt/CalculationEngine
calculation-engine/engine-evaluation/src/main/java/com/dataart/spreadsheetanalytics/engine/graph/PoiExecutionGraphBuilder.java
PoiExecutionGraphBuilder.createVertex
@Override public ExecutionGraphVertex createVertex(String address) { // create new vertex object ExecutionGraphVertex v = ExecutionGraph.createVertex(removeSymbol(address, '$')); // add vertex to actual graph this.graph.addVertex(v); // put new vertex to set of vertices with the same address, since they // all must have the same set of properties and values Set<ExecutionGraphVertex> vs = this.addressToVertices.getOrDefault(address, new HashSet<>()); vs.add(v); if (vs.size() - 1 == 0) { this.addressToVertices.put(address, vs); } return v; }
java
@Override public ExecutionGraphVertex createVertex(String address) { // create new vertex object ExecutionGraphVertex v = ExecutionGraph.createVertex(removeSymbol(address, '$')); // add vertex to actual graph this.graph.addVertex(v); // put new vertex to set of vertices with the same address, since they // all must have the same set of properties and values Set<ExecutionGraphVertex> vs = this.addressToVertices.getOrDefault(address, new HashSet<>()); vs.add(v); if (vs.size() - 1 == 0) { this.addressToVertices.put(address, vs); } return v; }
[ "@", "Override", "public", "ExecutionGraphVertex", "createVertex", "(", "String", "address", ")", "{", "// create new vertex object\r", "ExecutionGraphVertex", "v", "=", "ExecutionGraph", ".", "createVertex", "(", "removeSymbol", "(", "address", ",", "'", "'", ")", ")", ";", "// add vertex to actual graph\r", "this", ".", "graph", ".", "addVertex", "(", "v", ")", ";", "// put new vertex to set of vertices with the same address, since they\r", "// all must have the same set of properties and values\r", "Set", "<", "ExecutionGraphVertex", ">", "vs", "=", "this", ".", "addressToVertices", ".", "getOrDefault", "(", "address", ",", "new", "HashSet", "<>", "(", ")", ")", ";", "vs", ".", "add", "(", "v", ")", ";", "if", "(", "vs", ".", "size", "(", ")", "-", "1", "==", "0", ")", "{", "this", ".", "addressToVertices", ".", "put", "(", "address", ",", "vs", ")", ";", "}", "return", "v", ";", "}" ]
This method should be used when creating a new vertex from a cell, so vertex name is a cell's address. New Vertex will be created any time this method is invoked. New vertex will be stored in address-to-set-of-vertices map.
[ "This", "method", "should", "be", "used", "when", "creating", "a", "new", "vertex", "from", "a", "cell", "so", "vertex", "name", "is", "a", "cell", "s", "address", ".", "New", "Vertex", "will", "be", "created", "any", "time", "this", "method", "is", "invoked", ".", "New", "vertex", "will", "be", "stored", "in", "address", "-", "to", "-", "set", "-", "of", "-", "vertices", "map", "." ]
34ce1d9c1f9b57a502906b274311d28580b134e5
https://github.com/DataArt/CalculationEngine/blob/34ce1d9c1f9b57a502906b274311d28580b134e5/calculation-engine/engine-evaluation/src/main/java/com/dataart/spreadsheetanalytics/engine/graph/PoiExecutionGraphBuilder.java#L94-L109
10,153
DataArt/CalculationEngine
calculation-engine/engine-evaluation/src/main/java/com/dataart/spreadsheetanalytics/engine/graph/PoiExecutionGraphBuilder.java
PoiExecutionGraphBuilder.runPostProcessing
public void runPostProcessing(boolean multiRoot) { // make identical vertices have the same set of properties // two vertices are identical if they have the same address value. // Id for every vertex is unique, so this is not a flag here for (Set<ExecutionGraphVertex> vs : this.addressToVertices.values()) { // the logic below is very fragile and based on some empirical model // and may not work for other type of graphs if (vs != null && vs.size() > 1) { for (ExecutionGraphVertex vertex : vs) { if (CELL_WITH_FORMULA == vertex.properties().getType() || null != vertex.properties().getAlias()) { copyProperties(vertex, vs); break; } } } } // copy or link subgraphs to identical vertices and modify Formula field with additional values Map<String, AtomicInteger> adressToCount = new HashMap<>(); for (ExecutionGraphVertex vertex : this.graph.getVertices()) { // restore/add subgraphs to identical vertices Type type = vertex.properties().getType(); if (isCell(type)) { String address = vertex.properties().getName(); adressToCount.putIfAbsent(address, new AtomicInteger(0)); if (adressToCount.get(address).incrementAndGet() > 1) { // count > 1 // need to link Set<ExecutionGraphVertex> subgraphTops = new HashSet<>(); this.graph.getVertices().stream() .filter(v -> address.equals(v.properties.getName())) // check for subgraph .forEach(v -> this.graph.getIncomingEdgesOf(v).forEach(e -> subgraphTops.add(this.graph.getEdgeSource(e)))); for (ExecutionGraphVertex subVertex : subgraphTops) { if (!this.addressToVertices.containsKey(address)) { continue; } this.addressToVertices.get(address).forEach(v -> this.graph.addEdge(subVertex, v)); } } } if (RANGE == type) { connectValuesToRange(vertex, this); } /* Adding IF Value */ if (IF == type) { Collection<ExecutionGraphEdge> two = this.graph.getIncomingEdgesOf(vertex); if (two.size() != 2) { throw new CalculationEngineException("IF must have only two incoming edges."); } Object ifBranchValue = null; for (ExecutionGraphEdge e : two) { ExecutionGraphVertex oneOfTwo = this.graph.getEdgeSource(e); if (!isCompareOperand(oneOfTwo.getName())) { ifBranchValue = oneOfTwo.properties().getValue(); break; } } vertex.properties().setValue(ifBranchValue); } } if (this.config.getDuplicatesNumberThreshold() != -1) { removeAllDuplicates(this); } }
java
public void runPostProcessing(boolean multiRoot) { // make identical vertices have the same set of properties // two vertices are identical if they have the same address value. // Id for every vertex is unique, so this is not a flag here for (Set<ExecutionGraphVertex> vs : this.addressToVertices.values()) { // the logic below is very fragile and based on some empirical model // and may not work for other type of graphs if (vs != null && vs.size() > 1) { for (ExecutionGraphVertex vertex : vs) { if (CELL_WITH_FORMULA == vertex.properties().getType() || null != vertex.properties().getAlias()) { copyProperties(vertex, vs); break; } } } } // copy or link subgraphs to identical vertices and modify Formula field with additional values Map<String, AtomicInteger> adressToCount = new HashMap<>(); for (ExecutionGraphVertex vertex : this.graph.getVertices()) { // restore/add subgraphs to identical vertices Type type = vertex.properties().getType(); if (isCell(type)) { String address = vertex.properties().getName(); adressToCount.putIfAbsent(address, new AtomicInteger(0)); if (adressToCount.get(address).incrementAndGet() > 1) { // count > 1 // need to link Set<ExecutionGraphVertex> subgraphTops = new HashSet<>(); this.graph.getVertices().stream() .filter(v -> address.equals(v.properties.getName())) // check for subgraph .forEach(v -> this.graph.getIncomingEdgesOf(v).forEach(e -> subgraphTops.add(this.graph.getEdgeSource(e)))); for (ExecutionGraphVertex subVertex : subgraphTops) { if (!this.addressToVertices.containsKey(address)) { continue; } this.addressToVertices.get(address).forEach(v -> this.graph.addEdge(subVertex, v)); } } } if (RANGE == type) { connectValuesToRange(vertex, this); } /* Adding IF Value */ if (IF == type) { Collection<ExecutionGraphEdge> two = this.graph.getIncomingEdgesOf(vertex); if (two.size() != 2) { throw new CalculationEngineException("IF must have only two incoming edges."); } Object ifBranchValue = null; for (ExecutionGraphEdge e : two) { ExecutionGraphVertex oneOfTwo = this.graph.getEdgeSource(e); if (!isCompareOperand(oneOfTwo.getName())) { ifBranchValue = oneOfTwo.properties().getValue(); break; } } vertex.properties().setValue(ifBranchValue); } } if (this.config.getDuplicatesNumberThreshold() != -1) { removeAllDuplicates(this); } }
[ "public", "void", "runPostProcessing", "(", "boolean", "multiRoot", ")", "{", "// make identical vertices have the same set of properties\r", "// two vertices are identical if they have the same address value.\r", "// Id for every vertex is unique, so this is not a flag here\r", "for", "(", "Set", "<", "ExecutionGraphVertex", ">", "vs", ":", "this", ".", "addressToVertices", ".", "values", "(", ")", ")", "{", "// the logic below is very fragile and based on some empirical model\r", "// and may not work for other type of graphs\r", "if", "(", "vs", "!=", "null", "&&", "vs", ".", "size", "(", ")", ">", "1", ")", "{", "for", "(", "ExecutionGraphVertex", "vertex", ":", "vs", ")", "{", "if", "(", "CELL_WITH_FORMULA", "==", "vertex", ".", "properties", "(", ")", ".", "getType", "(", ")", "||", "null", "!=", "vertex", ".", "properties", "(", ")", ".", "getAlias", "(", ")", ")", "{", "copyProperties", "(", "vertex", ",", "vs", ")", ";", "break", ";", "}", "}", "}", "}", "// copy or link subgraphs to identical vertices and modify Formula field with additional values\r", "Map", "<", "String", ",", "AtomicInteger", ">", "adressToCount", "=", "new", "HashMap", "<>", "(", ")", ";", "for", "(", "ExecutionGraphVertex", "vertex", ":", "this", ".", "graph", ".", "getVertices", "(", ")", ")", "{", "// restore/add subgraphs to identical vertices\r", "Type", "type", "=", "vertex", ".", "properties", "(", ")", ".", "getType", "(", ")", ";", "if", "(", "isCell", "(", "type", ")", ")", "{", "String", "address", "=", "vertex", ".", "properties", "(", ")", ".", "getName", "(", ")", ";", "adressToCount", ".", "putIfAbsent", "(", "address", ",", "new", "AtomicInteger", "(", "0", ")", ")", ";", "if", "(", "adressToCount", ".", "get", "(", "address", ")", ".", "incrementAndGet", "(", ")", ">", "1", ")", "{", "// count > 1\r", "// need to link\r", "Set", "<", "ExecutionGraphVertex", ">", "subgraphTops", "=", "new", "HashSet", "<>", "(", ")", ";", "this", ".", "graph", ".", "getVertices", "(", ")", ".", "stream", "(", ")", ".", "filter", "(", "v", "->", "address", ".", "equals", "(", "v", ".", "properties", ".", "getName", "(", ")", ")", ")", "// check for subgraph\r", ".", "forEach", "(", "v", "->", "this", ".", "graph", ".", "getIncomingEdgesOf", "(", "v", ")", ".", "forEach", "(", "e", "->", "subgraphTops", ".", "add", "(", "this", ".", "graph", ".", "getEdgeSource", "(", "e", ")", ")", ")", ")", ";", "for", "(", "ExecutionGraphVertex", "subVertex", ":", "subgraphTops", ")", "{", "if", "(", "!", "this", ".", "addressToVertices", ".", "containsKey", "(", "address", ")", ")", "{", "continue", ";", "}", "this", ".", "addressToVertices", ".", "get", "(", "address", ")", ".", "forEach", "(", "v", "->", "this", ".", "graph", ".", "addEdge", "(", "subVertex", ",", "v", ")", ")", ";", "}", "}", "}", "if", "(", "RANGE", "==", "type", ")", "{", "connectValuesToRange", "(", "vertex", ",", "this", ")", ";", "}", "/* Adding IF Value */", "if", "(", "IF", "==", "type", ")", "{", "Collection", "<", "ExecutionGraphEdge", ">", "two", "=", "this", ".", "graph", ".", "getIncomingEdgesOf", "(", "vertex", ")", ";", "if", "(", "two", ".", "size", "(", ")", "!=", "2", ")", "{", "throw", "new", "CalculationEngineException", "(", "\"IF must have only two incoming edges.\"", ")", ";", "}", "Object", "ifBranchValue", "=", "null", ";", "for", "(", "ExecutionGraphEdge", "e", ":", "two", ")", "{", "ExecutionGraphVertex", "oneOfTwo", "=", "this", ".", "graph", ".", "getEdgeSource", "(", "e", ")", ";", "if", "(", "!", "isCompareOperand", "(", "oneOfTwo", ".", "getName", "(", ")", ")", ")", "{", "ifBranchValue", "=", "oneOfTwo", ".", "properties", "(", ")", ".", "getValue", "(", ")", ";", "break", ";", "}", "}", "vertex", ".", "properties", "(", ")", ".", "setValue", "(", "ifBranchValue", ")", ";", "}", "}", "if", "(", "this", ".", "config", ".", "getDuplicatesNumberThreshold", "(", ")", "!=", "-", "1", ")", "{", "removeAllDuplicates", "(", "this", ")", ";", "}", "}" ]
Do anything you want here. After graph is completed and we are out of POI context you can add\remove\etc any information you want.
[ "Do", "anything", "you", "want", "here", ".", "After", "graph", "is", "completed", "and", "we", "are", "out", "of", "POI", "context", "you", "can", "add", "\\", "remove", "\\", "etc", "any", "information", "you", "want", "." ]
34ce1d9c1f9b57a502906b274311d28580b134e5
https://github.com/DataArt/CalculationEngine/blob/34ce1d9c1f9b57a502906b274311d28580b134e5/calculation-engine/engine-evaluation/src/main/java/com/dataart/spreadsheetanalytics/engine/graph/PoiExecutionGraphBuilder.java#L187-L253
10,154
cogroo/cogroo4
cogroo-eval/TypeSystem/src/main/java/cogroo/uima/GoldenGrammarError.java
GoldenGrammarError.getCategory
public String getCategory() { if (GoldenGrammarError_Type.featOkTst && ((GoldenGrammarError_Type) jcasType).casFeat_category == null) jcasType.jcas.throwFeatMissing("category", "cogroo.uima.GoldenGrammarError"); return jcasType.ll_cas.ll_getStringValue(addr, ((GoldenGrammarError_Type) jcasType).casFeatCode_category); }
java
public String getCategory() { if (GoldenGrammarError_Type.featOkTst && ((GoldenGrammarError_Type) jcasType).casFeat_category == null) jcasType.jcas.throwFeatMissing("category", "cogroo.uima.GoldenGrammarError"); return jcasType.ll_cas.ll_getStringValue(addr, ((GoldenGrammarError_Type) jcasType).casFeatCode_category); }
[ "public", "String", "getCategory", "(", ")", "{", "if", "(", "GoldenGrammarError_Type", ".", "featOkTst", "&&", "(", "(", "GoldenGrammarError_Type", ")", "jcasType", ")", ".", "casFeat_category", "==", "null", ")", "jcasType", ".", "jcas", ".", "throwFeatMissing", "(", "\"category\"", ",", "\"cogroo.uima.GoldenGrammarError\"", ")", ";", "return", "jcasType", ".", "ll_cas", ".", "ll_getStringValue", "(", "addr", ",", "(", "(", "GoldenGrammarError_Type", ")", "jcasType", ")", ".", "casFeatCode_category", ")", ";", "}" ]
getter for category - gets @generated
[ "getter", "for", "category", "-", "gets" ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-eval/TypeSystem/src/main/java/cogroo/uima/GoldenGrammarError.java#L99-L106
10,155
cogroo/cogroo4
cogroo-eval/TypeSystem/src/main/java/cogroo/uima/GoldenGrammarError.java
GoldenGrammarError.setCategory
public void setCategory(String v) { if (GoldenGrammarError_Type.featOkTst && ((GoldenGrammarError_Type) jcasType).casFeat_category == null) jcasType.jcas.throwFeatMissing("category", "cogroo.uima.GoldenGrammarError"); jcasType.ll_cas.ll_setStringValue(addr, ((GoldenGrammarError_Type) jcasType).casFeatCode_category, v); }
java
public void setCategory(String v) { if (GoldenGrammarError_Type.featOkTst && ((GoldenGrammarError_Type) jcasType).casFeat_category == null) jcasType.jcas.throwFeatMissing("category", "cogroo.uima.GoldenGrammarError"); jcasType.ll_cas.ll_setStringValue(addr, ((GoldenGrammarError_Type) jcasType).casFeatCode_category, v); }
[ "public", "void", "setCategory", "(", "String", "v", ")", "{", "if", "(", "GoldenGrammarError_Type", ".", "featOkTst", "&&", "(", "(", "GoldenGrammarError_Type", ")", "jcasType", ")", ".", "casFeat_category", "==", "null", ")", "jcasType", ".", "jcas", ".", "throwFeatMissing", "(", "\"category\"", ",", "\"cogroo.uima.GoldenGrammarError\"", ")", ";", "jcasType", ".", "ll_cas", ".", "ll_setStringValue", "(", "addr", ",", "(", "(", "GoldenGrammarError_Type", ")", "jcasType", ")", ".", "casFeatCode_category", ",", "v", ")", ";", "}" ]
setter for category - sets @generated
[ "setter", "for", "category", "-", "sets" ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-eval/TypeSystem/src/main/java/cogroo/uima/GoldenGrammarError.java#L113-L120
10,156
cogroo/cogroo4
cogroo-eval/TypeSystem/src/main/java/cogroo/uima/GoldenGrammarError.java
GoldenGrammarError.getError
public String getError() { if (GoldenGrammarError_Type.featOkTst && ((GoldenGrammarError_Type) jcasType).casFeat_error == null) jcasType.jcas.throwFeatMissing("error", "cogroo.uima.GoldenGrammarError"); return jcasType.ll_cas.ll_getStringValue(addr, ((GoldenGrammarError_Type) jcasType).casFeatCode_error); }
java
public String getError() { if (GoldenGrammarError_Type.featOkTst && ((GoldenGrammarError_Type) jcasType).casFeat_error == null) jcasType.jcas.throwFeatMissing("error", "cogroo.uima.GoldenGrammarError"); return jcasType.ll_cas.ll_getStringValue(addr, ((GoldenGrammarError_Type) jcasType).casFeatCode_error); }
[ "public", "String", "getError", "(", ")", "{", "if", "(", "GoldenGrammarError_Type", ".", "featOkTst", "&&", "(", "(", "GoldenGrammarError_Type", ")", "jcasType", ")", ".", "casFeat_error", "==", "null", ")", "jcasType", ".", "jcas", ".", "throwFeatMissing", "(", "\"error\"", ",", "\"cogroo.uima.GoldenGrammarError\"", ")", ";", "return", "jcasType", ".", "ll_cas", ".", "ll_getStringValue", "(", "addr", ",", "(", "(", "GoldenGrammarError_Type", ")", "jcasType", ")", ".", "casFeatCode_error", ")", ";", "}" ]
getter for error - gets @generated
[ "getter", "for", "error", "-", "gets" ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-eval/TypeSystem/src/main/java/cogroo/uima/GoldenGrammarError.java#L130-L136
10,157
cogroo/cogroo4
cogroo-eval/TypeSystem/src/main/java/cogroo/uima/GoldenGrammarError.java
GoldenGrammarError.setReplace
public void setReplace(String v) { if (GoldenGrammarError_Type.featOkTst && ((GoldenGrammarError_Type) jcasType).casFeat_replace == null) jcasType.jcas.throwFeatMissing("replace", "cogroo.uima.GoldenGrammarError"); jcasType.ll_cas.ll_setStringValue(addr, ((GoldenGrammarError_Type) jcasType).casFeatCode_replace, v); }
java
public void setReplace(String v) { if (GoldenGrammarError_Type.featOkTst && ((GoldenGrammarError_Type) jcasType).casFeat_replace == null) jcasType.jcas.throwFeatMissing("replace", "cogroo.uima.GoldenGrammarError"); jcasType.ll_cas.ll_setStringValue(addr, ((GoldenGrammarError_Type) jcasType).casFeatCode_replace, v); }
[ "public", "void", "setReplace", "(", "String", "v", ")", "{", "if", "(", "GoldenGrammarError_Type", ".", "featOkTst", "&&", "(", "(", "GoldenGrammarError_Type", ")", "jcasType", ")", ".", "casFeat_replace", "==", "null", ")", "jcasType", ".", "jcas", ".", "throwFeatMissing", "(", "\"replace\"", ",", "\"cogroo.uima.GoldenGrammarError\"", ")", ";", "jcasType", ".", "ll_cas", ".", "ll_setStringValue", "(", "addr", ",", "(", "(", "GoldenGrammarError_Type", ")", "jcasType", ")", ".", "casFeatCode_replace", ",", "v", ")", ";", "}" ]
setter for replace - sets @generated
[ "setter", "for", "replace", "-", "sets" ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-eval/TypeSystem/src/main/java/cogroo/uima/GoldenGrammarError.java#L173-L180
10,158
DataArt/CalculationEngine
calculation-engine/engine-evaluation/src/main/java/com/dataart/spreadsheetanalytics/engine/graph/CellFormulaExpression.java
CellFormulaExpression.copyOf
public static CellFormulaExpression copyOf(CellFormulaExpression formula) { if (formula == null) { return null; } CellFormulaExpression copy = new CellFormulaExpression(); copy.formulaStr = formula.formulaStr().intern(); copy.formulaValues = formula.formulaValues().intern(); copy.formulaPtgStr = formula.formulaPtgStr().intern(); copy.ptgStr = formula.ptgStr().intern(); copy.iptg = formula.iptg(); copy.rootFormulaId = formula.rootFormulaId; copy.ptgs(formula.ptgs); copy.formulaPtg(formula.formulaPtg()); return copy; }
java
public static CellFormulaExpression copyOf(CellFormulaExpression formula) { if (formula == null) { return null; } CellFormulaExpression copy = new CellFormulaExpression(); copy.formulaStr = formula.formulaStr().intern(); copy.formulaValues = formula.formulaValues().intern(); copy.formulaPtgStr = formula.formulaPtgStr().intern(); copy.ptgStr = formula.ptgStr().intern(); copy.iptg = formula.iptg(); copy.rootFormulaId = formula.rootFormulaId; copy.ptgs(formula.ptgs); copy.formulaPtg(formula.formulaPtg()); return copy; }
[ "public", "static", "CellFormulaExpression", "copyOf", "(", "CellFormulaExpression", "formula", ")", "{", "if", "(", "formula", "==", "null", ")", "{", "return", "null", ";", "}", "CellFormulaExpression", "copy", "=", "new", "CellFormulaExpression", "(", ")", ";", "copy", ".", "formulaStr", "=", "formula", ".", "formulaStr", "(", ")", ".", "intern", "(", ")", ";", "copy", ".", "formulaValues", "=", "formula", ".", "formulaValues", "(", ")", ".", "intern", "(", ")", ";", "copy", ".", "formulaPtgStr", "=", "formula", ".", "formulaPtgStr", "(", ")", ".", "intern", "(", ")", ";", "copy", ".", "ptgStr", "=", "formula", ".", "ptgStr", "(", ")", ".", "intern", "(", ")", ";", "copy", ".", "iptg", "=", "formula", ".", "iptg", "(", ")", ";", "copy", ".", "rootFormulaId", "=", "formula", ".", "rootFormulaId", ";", "copy", ".", "ptgs", "(", "formula", ".", "ptgs", ")", ";", "copy", ".", "formulaPtg", "(", "formula", ".", "formulaPtg", "(", ")", ")", ";", "return", "copy", ";", "}" ]
Does copy of provided instance.
[ "Does", "copy", "of", "provided", "instance", "." ]
34ce1d9c1f9b57a502906b274311d28580b134e5
https://github.com/DataArt/CalculationEngine/blob/34ce1d9c1f9b57a502906b274311d28580b134e5/calculation-engine/engine-evaluation/src/main/java/com/dataart/spreadsheetanalytics/engine/graph/CellFormulaExpression.java#L74-L88
10,159
cogroo/cogroo4
lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/ErrorReportDialog.java
ErrorReportDialog.initialize
public void initialize(String selectedText) { LOG.finest(">>> initialize"); try { this.theCommunityLogic = new CommunityLogic(m_xContext, selectedText); // set properties of the dialog String[] propNames = new String[] { "Height", // 0 "Moveable", // 1 "Name", // 2 "PositionX",// 3 "PositionY",// 4 "Step", // 5 "TabIndex", // 6 "Title", // 7 "Width" // 8 }; Object[] propValues = new Object[] { new Integer(DEFAULT_DIALOG_HEIGHT), // 0 Boolean.TRUE, // 1 I18nLabelsLoader.ADDON_REPORT_ERROR, // 2 new Integer(102), // 3 new Integer(41), // 4 new Integer(-1), // 5 new Short((short) 0),// 6 I18nLabelsLoader.ADDON_REPORT_ERROR + " - CoGrOO Comunidade", // 7 new Integer(DEFAULT_DIALOG_WIDTH) // 8 }; super.initialize(propNames, propValues); this.createWindowPeer(); this.addRoadmap(new RoadmapItemStateChangeListener(m_xMSFDialogModel)); populateStep1(); populateStep2(); populateStep3(); populateStep4(); addButtons(); new CheckTokenAndGetCategoriesThread().start(); setCurrentStep(STEP_LOGIN); setControlsState(); LOG.finest("<<< initialize"); } catch(BasicErrorException e ) { LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e); throw new CogrooRuntimeException(CogrooExceptionMessages.INTERNAL_ERROR, new String[]{e.getLocalizedMessage()}); } }
java
public void initialize(String selectedText) { LOG.finest(">>> initialize"); try { this.theCommunityLogic = new CommunityLogic(m_xContext, selectedText); // set properties of the dialog String[] propNames = new String[] { "Height", // 0 "Moveable", // 1 "Name", // 2 "PositionX",// 3 "PositionY",// 4 "Step", // 5 "TabIndex", // 6 "Title", // 7 "Width" // 8 }; Object[] propValues = new Object[] { new Integer(DEFAULT_DIALOG_HEIGHT), // 0 Boolean.TRUE, // 1 I18nLabelsLoader.ADDON_REPORT_ERROR, // 2 new Integer(102), // 3 new Integer(41), // 4 new Integer(-1), // 5 new Short((short) 0),// 6 I18nLabelsLoader.ADDON_REPORT_ERROR + " - CoGrOO Comunidade", // 7 new Integer(DEFAULT_DIALOG_WIDTH) // 8 }; super.initialize(propNames, propValues); this.createWindowPeer(); this.addRoadmap(new RoadmapItemStateChangeListener(m_xMSFDialogModel)); populateStep1(); populateStep2(); populateStep3(); populateStep4(); addButtons(); new CheckTokenAndGetCategoriesThread().start(); setCurrentStep(STEP_LOGIN); setControlsState(); LOG.finest("<<< initialize"); } catch(BasicErrorException e ) { LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e); throw new CogrooRuntimeException(CogrooExceptionMessages.INTERNAL_ERROR, new String[]{e.getLocalizedMessage()}); } }
[ "public", "void", "initialize", "(", "String", "selectedText", ")", "{", "LOG", ".", "finest", "(", "\">>> initialize\"", ")", ";", "try", "{", "this", ".", "theCommunityLogic", "=", "new", "CommunityLogic", "(", "m_xContext", ",", "selectedText", ")", ";", "// set properties of the dialog", "String", "[", "]", "propNames", "=", "new", "String", "[", "]", "{", "\"Height\"", ",", "// 0", "\"Moveable\"", ",", "// 1", "\"Name\"", ",", "// 2", "\"PositionX\"", ",", "// 3", "\"PositionY\"", ",", "// 4", "\"Step\"", ",", "// 5", "\"TabIndex\"", ",", "// 6", "\"Title\"", ",", "// 7", "\"Width\"", "// 8", "}", ";", "Object", "[", "]", "propValues", "=", "new", "Object", "[", "]", "{", "new", "Integer", "(", "DEFAULT_DIALOG_HEIGHT", ")", ",", "// 0", "Boolean", ".", "TRUE", ",", "// 1", "I18nLabelsLoader", ".", "ADDON_REPORT_ERROR", ",", "// 2", "new", "Integer", "(", "102", ")", ",", "// 3", "new", "Integer", "(", "41", ")", ",", "// 4", "new", "Integer", "(", "-", "1", ")", ",", "// 5", "new", "Short", "(", "(", "short", ")", "0", ")", ",", "// 6", "I18nLabelsLoader", ".", "ADDON_REPORT_ERROR", "+", "\" - CoGrOO Comunidade\"", ",", "// 7", "new", "Integer", "(", "DEFAULT_DIALOG_WIDTH", ")", "// 8", "}", ";", "super", ".", "initialize", "(", "propNames", ",", "propValues", ")", ";", "this", ".", "createWindowPeer", "(", ")", ";", "this", ".", "addRoadmap", "(", "new", "RoadmapItemStateChangeListener", "(", "m_xMSFDialogModel", ")", ")", ";", "populateStep1", "(", ")", ";", "populateStep2", "(", ")", ";", "populateStep3", "(", ")", ";", "populateStep4", "(", ")", ";", "addButtons", "(", ")", ";", "new", "CheckTokenAndGetCategoriesThread", "(", ")", ".", "start", "(", ")", ";", "setCurrentStep", "(", "STEP_LOGIN", ")", ";", "setControlsState", "(", ")", ";", "LOG", ".", "finest", "(", "\"<<< initialize\"", ")", ";", "}", "catch", "(", "BasicErrorException", "e", ")", "{", "LOGGER", ".", "log", "(", "Level", ".", "SEVERE", ",", "e", ".", "getLocalizedMessage", "(", ")", ",", "e", ")", ";", "throw", "new", "CogrooRuntimeException", "(", "CogrooExceptionMessages", ".", "INTERNAL_ERROR", ",", "new", "String", "[", "]", "{", "e", ".", "getLocalizedMessage", "(", ")", "}", ")", ";", "}", "}" ]
Initializes the dialog with a selected text. The selected text can't be enpty or null. @param selectedText the selected text
[ "Initializes", "the", "dialog", "with", "a", "selected", "text", ".", "The", "selected", "text", "can", "t", "be", "enpty", "or", "null", "." ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/ErrorReportDialog.java#L161-L216
10,160
cogroo/cogroo4
lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/ErrorReportDialog.java
ErrorReportDialog.populateStep1
private void populateStep1() { this.insertRoadmapItem(0, true, I18nLabelsLoader.REPORT_STEP_LOGIN, 1); int y = 6; this.insertFixedTextBold(this, DEFAULT_PosX, y, DEFAULT_WIDTH_LARGE, STEP_LOGIN, I18nLabelsLoader.REPORT_STEP_LOGIN); y += 12; // plus one line this.insertMultilineFixedText(this, DEFAULT_PosX, y, DEFAULT_WIDTH_LARGE, 8*18, STEP_LOGIN, I18nLabelsLoader.ADDON_LOGIN_INFO); y += 8*18; // plus 15 lines this.insertFixedHyperlink(this, DEFAULT_PosX, y, DEFAULT_WIDTH_LARGE, STEP_LOGIN, I18nLabelsLoader.ADDON_REPORT_FROM_BROWSER, Resources.getProperty("COMMUNITY_ROOT") + "/reports/new/" + theCommunityLogic.getEscapedText()); y += 18; this.insertFixedHyperlink(this, DEFAULT_PosX, y, DEFAULT_WIDTH_LARGE, STEP_LOGIN, I18nLabelsLoader.ADDON_LOGIN_REGISTER, Resources.getProperty("COMMUNITY_ROOT") + "/register"); y += 12; this.insertFixedHyperlink(this, DEFAULT_PosX, y, DEFAULT_WIDTH_LARGE, STEP_LOGIN, I18nLabelsLoader.ADDON_LOGIN_LICENSE, I18nLabelsLoader.ADDON_LOGIN_LICENSEURL); y += 12; this.insertFixedText(this, DEFAULT_PosX, y + 2, 40, 1, I18nLabelsLoader.ADDON_LOGIN_USER); String userName = getCommunityUsername(); if(userName == null) { userName = ""; } XTextListener textListener = new AuthUserPasswdTextListener(); userNameText = this.insertEditField(textListener, this, DEFAULT_PosX + 40, y, 60, STEP_LOGIN, userName); y += 14; this.insertFixedText(this, DEFAULT_PosX, y + 2, 40, 1, I18nLabelsLoader.ADDON_LOGIN_PASSWORD); userPasswordText = this.insertSecretEditField(textListener, this, DEFAULT_PosX + 40, y, 60, STEP_LOGIN, ""); y += 14; authButton = this.insertButton(new AuthLoginButtonListener(), DEFAULT_PosX + 40 + 60 + 10, y - 12, 40, STEP_LOGIN, I18nLabelsLoader.ADDON_LOGIN_ALLOW, ((short) PushButtonType.STANDARD_value)); y += 4; this.insertFixedText(this, DEFAULT_PosX, y, DEFAULT_WIDTH_LARGE, STEP_LOGIN, I18nLabelsLoader.ADDON_LOGIN_STATUS); authStatusLabel = this.insertHiddenFixedStatusText(this, DEFAULT_PosX + 40, y, DEFAULT_WIDTH_LARGE, STEP_LOGIN, I18nLabelsLoader.ADDON_LOGIN_STATUS_NOTAUTH, false); authProgressBar = this.insertProgressBar(DEFAULT_PosX, DEFAULT_DIALOG_HEIGHT - 26 - 8, DEFAULT_WIDTH_LARGE, 1, 100); }
java
private void populateStep1() { this.insertRoadmapItem(0, true, I18nLabelsLoader.REPORT_STEP_LOGIN, 1); int y = 6; this.insertFixedTextBold(this, DEFAULT_PosX, y, DEFAULT_WIDTH_LARGE, STEP_LOGIN, I18nLabelsLoader.REPORT_STEP_LOGIN); y += 12; // plus one line this.insertMultilineFixedText(this, DEFAULT_PosX, y, DEFAULT_WIDTH_LARGE, 8*18, STEP_LOGIN, I18nLabelsLoader.ADDON_LOGIN_INFO); y += 8*18; // plus 15 lines this.insertFixedHyperlink(this, DEFAULT_PosX, y, DEFAULT_WIDTH_LARGE, STEP_LOGIN, I18nLabelsLoader.ADDON_REPORT_FROM_BROWSER, Resources.getProperty("COMMUNITY_ROOT") + "/reports/new/" + theCommunityLogic.getEscapedText()); y += 18; this.insertFixedHyperlink(this, DEFAULT_PosX, y, DEFAULT_WIDTH_LARGE, STEP_LOGIN, I18nLabelsLoader.ADDON_LOGIN_REGISTER, Resources.getProperty("COMMUNITY_ROOT") + "/register"); y += 12; this.insertFixedHyperlink(this, DEFAULT_PosX, y, DEFAULT_WIDTH_LARGE, STEP_LOGIN, I18nLabelsLoader.ADDON_LOGIN_LICENSE, I18nLabelsLoader.ADDON_LOGIN_LICENSEURL); y += 12; this.insertFixedText(this, DEFAULT_PosX, y + 2, 40, 1, I18nLabelsLoader.ADDON_LOGIN_USER); String userName = getCommunityUsername(); if(userName == null) { userName = ""; } XTextListener textListener = new AuthUserPasswdTextListener(); userNameText = this.insertEditField(textListener, this, DEFAULT_PosX + 40, y, 60, STEP_LOGIN, userName); y += 14; this.insertFixedText(this, DEFAULT_PosX, y + 2, 40, 1, I18nLabelsLoader.ADDON_LOGIN_PASSWORD); userPasswordText = this.insertSecretEditField(textListener, this, DEFAULT_PosX + 40, y, 60, STEP_LOGIN, ""); y += 14; authButton = this.insertButton(new AuthLoginButtonListener(), DEFAULT_PosX + 40 + 60 + 10, y - 12, 40, STEP_LOGIN, I18nLabelsLoader.ADDON_LOGIN_ALLOW, ((short) PushButtonType.STANDARD_value)); y += 4; this.insertFixedText(this, DEFAULT_PosX, y, DEFAULT_WIDTH_LARGE, STEP_LOGIN, I18nLabelsLoader.ADDON_LOGIN_STATUS); authStatusLabel = this.insertHiddenFixedStatusText(this, DEFAULT_PosX + 40, y, DEFAULT_WIDTH_LARGE, STEP_LOGIN, I18nLabelsLoader.ADDON_LOGIN_STATUS_NOTAUTH, false); authProgressBar = this.insertProgressBar(DEFAULT_PosX, DEFAULT_DIALOG_HEIGHT - 26 - 8, DEFAULT_WIDTH_LARGE, 1, 100); }
[ "private", "void", "populateStep1", "(", ")", "{", "this", ".", "insertRoadmapItem", "(", "0", ",", "true", ",", "I18nLabelsLoader", ".", "REPORT_STEP_LOGIN", ",", "1", ")", ";", "int", "y", "=", "6", ";", "this", ".", "insertFixedTextBold", "(", "this", ",", "DEFAULT_PosX", ",", "y", ",", "DEFAULT_WIDTH_LARGE", ",", "STEP_LOGIN", ",", "I18nLabelsLoader", ".", "REPORT_STEP_LOGIN", ")", ";", "y", "+=", "12", ";", "// plus one line", "this", ".", "insertMultilineFixedText", "(", "this", ",", "DEFAULT_PosX", ",", "y", ",", "DEFAULT_WIDTH_LARGE", ",", "8", "*", "18", ",", "STEP_LOGIN", ",", "I18nLabelsLoader", ".", "ADDON_LOGIN_INFO", ")", ";", "y", "+=", "8", "*", "18", ";", "// plus 15 lines", "this", ".", "insertFixedHyperlink", "(", "this", ",", "DEFAULT_PosX", ",", "y", ",", "DEFAULT_WIDTH_LARGE", ",", "STEP_LOGIN", ",", "I18nLabelsLoader", ".", "ADDON_REPORT_FROM_BROWSER", ",", "Resources", ".", "getProperty", "(", "\"COMMUNITY_ROOT\"", ")", "+", "\"/reports/new/\"", "+", "theCommunityLogic", ".", "getEscapedText", "(", ")", ")", ";", "y", "+=", "18", ";", "this", ".", "insertFixedHyperlink", "(", "this", ",", "DEFAULT_PosX", ",", "y", ",", "DEFAULT_WIDTH_LARGE", ",", "STEP_LOGIN", ",", "I18nLabelsLoader", ".", "ADDON_LOGIN_REGISTER", ",", "Resources", ".", "getProperty", "(", "\"COMMUNITY_ROOT\"", ")", "+", "\"/register\"", ")", ";", "y", "+=", "12", ";", "this", ".", "insertFixedHyperlink", "(", "this", ",", "DEFAULT_PosX", ",", "y", ",", "DEFAULT_WIDTH_LARGE", ",", "STEP_LOGIN", ",", "I18nLabelsLoader", ".", "ADDON_LOGIN_LICENSE", ",", "I18nLabelsLoader", ".", "ADDON_LOGIN_LICENSEURL", ")", ";", "y", "+=", "12", ";", "this", ".", "insertFixedText", "(", "this", ",", "DEFAULT_PosX", ",", "y", "+", "2", ",", "40", ",", "1", ",", "I18nLabelsLoader", ".", "ADDON_LOGIN_USER", ")", ";", "String", "userName", "=", "getCommunityUsername", "(", ")", ";", "if", "(", "userName", "==", "null", ")", "{", "userName", "=", "\"\"", ";", "}", "XTextListener", "textListener", "=", "new", "AuthUserPasswdTextListener", "(", ")", ";", "userNameText", "=", "this", ".", "insertEditField", "(", "textListener", ",", "this", ",", "DEFAULT_PosX", "+", "40", ",", "y", ",", "60", ",", "STEP_LOGIN", ",", "userName", ")", ";", "y", "+=", "14", ";", "this", ".", "insertFixedText", "(", "this", ",", "DEFAULT_PosX", ",", "y", "+", "2", ",", "40", ",", "1", ",", "I18nLabelsLoader", ".", "ADDON_LOGIN_PASSWORD", ")", ";", "userPasswordText", "=", "this", ".", "insertSecretEditField", "(", "textListener", ",", "this", ",", "DEFAULT_PosX", "+", "40", ",", "y", ",", "60", ",", "STEP_LOGIN", ",", "\"\"", ")", ";", "y", "+=", "14", ";", "authButton", "=", "this", ".", "insertButton", "(", "new", "AuthLoginButtonListener", "(", ")", ",", "DEFAULT_PosX", "+", "40", "+", "60", "+", "10", ",", "y", "-", "12", ",", "40", ",", "STEP_LOGIN", ",", "I18nLabelsLoader", ".", "ADDON_LOGIN_ALLOW", ",", "(", "(", "short", ")", "PushButtonType", ".", "STANDARD_value", ")", ")", ";", "y", "+=", "4", ";", "this", ".", "insertFixedText", "(", "this", ",", "DEFAULT_PosX", ",", "y", ",", "DEFAULT_WIDTH_LARGE", ",", "STEP_LOGIN", ",", "I18nLabelsLoader", ".", "ADDON_LOGIN_STATUS", ")", ";", "authStatusLabel", "=", "this", ".", "insertHiddenFixedStatusText", "(", "this", ",", "DEFAULT_PosX", "+", "40", ",", "y", ",", "DEFAULT_WIDTH_LARGE", ",", "STEP_LOGIN", ",", "I18nLabelsLoader", ".", "ADDON_LOGIN_STATUS_NOTAUTH", ",", "false", ")", ";", "authProgressBar", "=", "this", ".", "insertProgressBar", "(", "DEFAULT_PosX", ",", "DEFAULT_DIALOG_HEIGHT", "-", "26", "-", "8", ",", "DEFAULT_WIDTH_LARGE", ",", "1", ",", "100", ")", ";", "}" ]
Populate the step one, that we put loggin stuf
[ "Populate", "the", "step", "one", "that", "we", "put", "loggin", "stuf" ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/ErrorReportDialog.java#L228-L262
10,161
cogroo/cogroo4
lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/ErrorReportDialog.java
ErrorReportDialog.populateStep2
private void populateStep2() { this.insertRoadmapItem(1, true, I18nLabelsLoader.REPORT_STEP_FALSE_ERRORS, 2); // Bad intervention int y = 6; this.insertFixedTextBold(this, DEFAULT_PosX, y, DEFAULT_WIDTH_LARGE, STEP_FALSE_ERRORS, I18nLabelsLoader.REPORT_STEP_FALSE_ERRORS); y += 12; // help text this.insertMultilineFixedText(this, DEFAULT_PosX, y, DEFAULT_WIDTH_LARGE, 8*4 , STEP_FALSE_ERRORS, I18nLabelsLoader.ADDON_BADINT_INFO); y += 8*3 + 4; // label ADDON_BADINT_ERRORSLIST this.insertMultilineFixedText(this, DEFAULT_PosX, y, DEFAULT_WIDTH_LARGE, 8*2, STEP_FALSE_ERRORS, I18nLabelsLoader.ADDON_BADINT_ERRORSLIST); y += 8 + 12; // list BadInt this.badIntListBox = this.insertListBox(new BadIntListSelectonListener(), DEFAULT_PosX, y, 3*12, DEFAULT_WIDTH_LARGE, STEP_FALSE_ERRORS, theCommunityLogic.getBadInterventions()); y += 3*12 + 4; // label ADDON_BADINT_ERRORSFOUND this.insertFixedText(this, DEFAULT_PosX, y, DEFAULT_WIDTH_LARGE, STEP_FALSE_ERRORS, I18nLabelsLoader.ADDON_BADINT_ERRORSFOUND); y += 8; // plus one line // field TEXT this.badIntErrorsText = this.insertMultilineEditField(this, this, DEFAULT_PosX, y, 3*12, DEFAULT_WIDTH_LARGE, STEP_FALSE_ERRORS, "", true); y += 3*12 + 4; // label ADDON_BADINT_DETAILS this.insertFixedText(this, DEFAULT_PosX, y, DEFAULT_WIDTH_LARGE, STEP_FALSE_ERRORS, I18nLabelsLoader.ADDON_BADINT_DETAILS); y += 8; // plus one line // field Details this.badIntDetails = this.insertMultilineEditField(this, this, DEFAULT_PosX, y, 3*12, DEFAULT_WIDTH_LARGE, STEP_FALSE_ERRORS, "", true); y += 3*12 + 4; // label / field ADDON_BADINT_TYPE this.insertFixedText(this, DEFAULT_PosX, y + 2, 40, STEP_FALSE_ERRORS, I18nLabelsLoader.ADDON_BADINT_TYPE); this.badIntClassificationDropBox = this.insertDropBox(new BadIntClassificationDropBoxSelectionListener(), DEFAULT_PosX + 40, y, DEFAULT_WIDTH_LARGE - 40, STEP_FALSE_ERRORS, theCommunityLogic.getClassifications()); y += 14; // label ADDON_BADINT_COMMENTS this.badIntCommentsLabel = this.insertFixedText(this, DEFAULT_PosX, y, 40, STEP_FALSE_ERRORS, I18nLabelsLoader.ADDON_BADINT_COMMENTS); y += 12; // field Comments this.badIntComments = this.insertMultilineEditField(new BadIntCommentsTextListener(), this, DEFAULT_PosX, y, 2*12, DEFAULT_WIDTH_LARGE, STEP_FALSE_ERRORS, "", false); y += 2*12 + 4; // button Apply this.badIntApplyButton = this.insertButton(new BadIntApplyButtonListener(), DEFAULT_PosX + DEFAULT_WIDTH_LARGE - 40, y, 40, STEP_FALSE_ERRORS, I18nLabelsLoader.ADDON_BADINT_APPLY, ((short) PushButtonType.STANDARD_value)); setIsControlEnable(badIntApplyButton, false); }
java
private void populateStep2() { this.insertRoadmapItem(1, true, I18nLabelsLoader.REPORT_STEP_FALSE_ERRORS, 2); // Bad intervention int y = 6; this.insertFixedTextBold(this, DEFAULT_PosX, y, DEFAULT_WIDTH_LARGE, STEP_FALSE_ERRORS, I18nLabelsLoader.REPORT_STEP_FALSE_ERRORS); y += 12; // help text this.insertMultilineFixedText(this, DEFAULT_PosX, y, DEFAULT_WIDTH_LARGE, 8*4 , STEP_FALSE_ERRORS, I18nLabelsLoader.ADDON_BADINT_INFO); y += 8*3 + 4; // label ADDON_BADINT_ERRORSLIST this.insertMultilineFixedText(this, DEFAULT_PosX, y, DEFAULT_WIDTH_LARGE, 8*2, STEP_FALSE_ERRORS, I18nLabelsLoader.ADDON_BADINT_ERRORSLIST); y += 8 + 12; // list BadInt this.badIntListBox = this.insertListBox(new BadIntListSelectonListener(), DEFAULT_PosX, y, 3*12, DEFAULT_WIDTH_LARGE, STEP_FALSE_ERRORS, theCommunityLogic.getBadInterventions()); y += 3*12 + 4; // label ADDON_BADINT_ERRORSFOUND this.insertFixedText(this, DEFAULT_PosX, y, DEFAULT_WIDTH_LARGE, STEP_FALSE_ERRORS, I18nLabelsLoader.ADDON_BADINT_ERRORSFOUND); y += 8; // plus one line // field TEXT this.badIntErrorsText = this.insertMultilineEditField(this, this, DEFAULT_PosX, y, 3*12, DEFAULT_WIDTH_LARGE, STEP_FALSE_ERRORS, "", true); y += 3*12 + 4; // label ADDON_BADINT_DETAILS this.insertFixedText(this, DEFAULT_PosX, y, DEFAULT_WIDTH_LARGE, STEP_FALSE_ERRORS, I18nLabelsLoader.ADDON_BADINT_DETAILS); y += 8; // plus one line // field Details this.badIntDetails = this.insertMultilineEditField(this, this, DEFAULT_PosX, y, 3*12, DEFAULT_WIDTH_LARGE, STEP_FALSE_ERRORS, "", true); y += 3*12 + 4; // label / field ADDON_BADINT_TYPE this.insertFixedText(this, DEFAULT_PosX, y + 2, 40, STEP_FALSE_ERRORS, I18nLabelsLoader.ADDON_BADINT_TYPE); this.badIntClassificationDropBox = this.insertDropBox(new BadIntClassificationDropBoxSelectionListener(), DEFAULT_PosX + 40, y, DEFAULT_WIDTH_LARGE - 40, STEP_FALSE_ERRORS, theCommunityLogic.getClassifications()); y += 14; // label ADDON_BADINT_COMMENTS this.badIntCommentsLabel = this.insertFixedText(this, DEFAULT_PosX, y, 40, STEP_FALSE_ERRORS, I18nLabelsLoader.ADDON_BADINT_COMMENTS); y += 12; // field Comments this.badIntComments = this.insertMultilineEditField(new BadIntCommentsTextListener(), this, DEFAULT_PosX, y, 2*12, DEFAULT_WIDTH_LARGE, STEP_FALSE_ERRORS, "", false); y += 2*12 + 4; // button Apply this.badIntApplyButton = this.insertButton(new BadIntApplyButtonListener(), DEFAULT_PosX + DEFAULT_WIDTH_LARGE - 40, y, 40, STEP_FALSE_ERRORS, I18nLabelsLoader.ADDON_BADINT_APPLY, ((short) PushButtonType.STANDARD_value)); setIsControlEnable(badIntApplyButton, false); }
[ "private", "void", "populateStep2", "(", ")", "{", "this", ".", "insertRoadmapItem", "(", "1", ",", "true", ",", "I18nLabelsLoader", ".", "REPORT_STEP_FALSE_ERRORS", ",", "2", ")", ";", "// Bad intervention", "int", "y", "=", "6", ";", "this", ".", "insertFixedTextBold", "(", "this", ",", "DEFAULT_PosX", ",", "y", ",", "DEFAULT_WIDTH_LARGE", ",", "STEP_FALSE_ERRORS", ",", "I18nLabelsLoader", ".", "REPORT_STEP_FALSE_ERRORS", ")", ";", "y", "+=", "12", ";", "// help text", "this", ".", "insertMultilineFixedText", "(", "this", ",", "DEFAULT_PosX", ",", "y", ",", "DEFAULT_WIDTH_LARGE", ",", "8", "*", "4", ",", "STEP_FALSE_ERRORS", ",", "I18nLabelsLoader", ".", "ADDON_BADINT_INFO", ")", ";", "y", "+=", "8", "*", "3", "+", "4", ";", "// label ADDON_BADINT_ERRORSLIST", "this", ".", "insertMultilineFixedText", "(", "this", ",", "DEFAULT_PosX", ",", "y", ",", "DEFAULT_WIDTH_LARGE", ",", "8", "*", "2", ",", "STEP_FALSE_ERRORS", ",", "I18nLabelsLoader", ".", "ADDON_BADINT_ERRORSLIST", ")", ";", "y", "+=", "8", "+", "12", ";", "// list BadInt", "this", ".", "badIntListBox", "=", "this", ".", "insertListBox", "(", "new", "BadIntListSelectonListener", "(", ")", ",", "DEFAULT_PosX", ",", "y", ",", "3", "*", "12", ",", "DEFAULT_WIDTH_LARGE", ",", "STEP_FALSE_ERRORS", ",", "theCommunityLogic", ".", "getBadInterventions", "(", ")", ")", ";", "y", "+=", "3", "*", "12", "+", "4", ";", "// label ADDON_BADINT_ERRORSFOUND", "this", ".", "insertFixedText", "(", "this", ",", "DEFAULT_PosX", ",", "y", ",", "DEFAULT_WIDTH_LARGE", ",", "STEP_FALSE_ERRORS", ",", "I18nLabelsLoader", ".", "ADDON_BADINT_ERRORSFOUND", ")", ";", "y", "+=", "8", ";", "// plus one line", "// field TEXT", "this", ".", "badIntErrorsText", "=", "this", ".", "insertMultilineEditField", "(", "this", ",", "this", ",", "DEFAULT_PosX", ",", "y", ",", "3", "*", "12", ",", "DEFAULT_WIDTH_LARGE", ",", "STEP_FALSE_ERRORS", ",", "\"\"", ",", "true", ")", ";", "y", "+=", "3", "*", "12", "+", "4", ";", "// label ADDON_BADINT_DETAILS", "this", ".", "insertFixedText", "(", "this", ",", "DEFAULT_PosX", ",", "y", ",", "DEFAULT_WIDTH_LARGE", ",", "STEP_FALSE_ERRORS", ",", "I18nLabelsLoader", ".", "ADDON_BADINT_DETAILS", ")", ";", "y", "+=", "8", ";", "// plus one line", "// field Details", "this", ".", "badIntDetails", "=", "this", ".", "insertMultilineEditField", "(", "this", ",", "this", ",", "DEFAULT_PosX", ",", "y", ",", "3", "*", "12", ",", "DEFAULT_WIDTH_LARGE", ",", "STEP_FALSE_ERRORS", ",", "\"\"", ",", "true", ")", ";", "y", "+=", "3", "*", "12", "+", "4", ";", "// label / field ADDON_BADINT_TYPE", "this", ".", "insertFixedText", "(", "this", ",", "DEFAULT_PosX", ",", "y", "+", "2", ",", "40", ",", "STEP_FALSE_ERRORS", ",", "I18nLabelsLoader", ".", "ADDON_BADINT_TYPE", ")", ";", "this", ".", "badIntClassificationDropBox", "=", "this", ".", "insertDropBox", "(", "new", "BadIntClassificationDropBoxSelectionListener", "(", ")", ",", "DEFAULT_PosX", "+", "40", ",", "y", ",", "DEFAULT_WIDTH_LARGE", "-", "40", ",", "STEP_FALSE_ERRORS", ",", "theCommunityLogic", ".", "getClassifications", "(", ")", ")", ";", "y", "+=", "14", ";", "// label ADDON_BADINT_COMMENTS", "this", ".", "badIntCommentsLabel", "=", "this", ".", "insertFixedText", "(", "this", ",", "DEFAULT_PosX", ",", "y", ",", "40", ",", "STEP_FALSE_ERRORS", ",", "I18nLabelsLoader", ".", "ADDON_BADINT_COMMENTS", ")", ";", "y", "+=", "12", ";", "// field Comments", "this", ".", "badIntComments", "=", "this", ".", "insertMultilineEditField", "(", "new", "BadIntCommentsTextListener", "(", ")", ",", "this", ",", "DEFAULT_PosX", ",", "y", ",", "2", "*", "12", ",", "DEFAULT_WIDTH_LARGE", ",", "STEP_FALSE_ERRORS", ",", "\"\"", ",", "false", ")", ";", "y", "+=", "2", "*", "12", "+", "4", ";", "// button Apply", "this", ".", "badIntApplyButton", "=", "this", ".", "insertButton", "(", "new", "BadIntApplyButtonListener", "(", ")", ",", "DEFAULT_PosX", "+", "DEFAULT_WIDTH_LARGE", "-", "40", ",", "y", ",", "40", ",", "STEP_FALSE_ERRORS", ",", "I18nLabelsLoader", ".", "ADDON_BADINT_APPLY", ",", "(", "(", "short", ")", "PushButtonType", ".", "STANDARD_value", ")", ")", ";", "setIsControlEnable", "(", "badIntApplyButton", ",", "false", ")", ";", "}" ]
Populate with omissions
[ "Populate", "with", "omissions" ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/ErrorReportDialog.java#L267-L320
10,162
cogroo/cogroo4
lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/ErrorReportDialog.java
ErrorReportDialog.populateStep4
private void populateStep4() { this.insertRoadmapItem(3, true, I18nLabelsLoader.REPORT_STEP_THANKS, 4); int y = 6; // thanks this.insertFixedTextBold(this, DEFAULT_PosX, y, DEFAULT_WIDTH_LARGE, STEP_THANKS, I18nLabelsLoader.REPORT_STEP_THANKS); y += 12; // plus one line // thanks msg this.insertMultilineFixedText(this, DEFAULT_PosX, y, DEFAULT_WIDTH_LARGE, 8*5, STEP_THANKS, I18nLabelsLoader.ADDON_THANKS_MESSAGE); y += 8*5 + 12; // plus 15 lines // status this.insertFixedText(this, DEFAULT_PosX, y, DEFAULT_WIDTH_LARGE, STEP_THANKS, I18nLabelsLoader.ADDON_THANKS_STATUS); this.thanksStatusLabel = this.insertHiddenFixedStatusText(this, DEFAULT_PosX + 40, y, DEFAULT_WIDTH_LARGE, STEP_THANKS, I18nLabelsLoader.ADDON_THANKS_STATUS, false); y += 12; // link this.thanksReportLink = this.insertFixedHyperlink(this, DEFAULT_PosX, y, DEFAULT_WIDTH_LARGE, STEP_THANKS, I18nLabelsLoader.ADDON_THANKS_LINK, Resources.getProperty("COMMUNITY_ROOT") + "/reports"); this.thanksProgressBar = this.insertProgressBar(DEFAULT_PosX, DEFAULT_DIALOG_HEIGHT - 26 - 8, DEFAULT_WIDTH_LARGE, STEP_THANKS, 100); }
java
private void populateStep4() { this.insertRoadmapItem(3, true, I18nLabelsLoader.REPORT_STEP_THANKS, 4); int y = 6; // thanks this.insertFixedTextBold(this, DEFAULT_PosX, y, DEFAULT_WIDTH_LARGE, STEP_THANKS, I18nLabelsLoader.REPORT_STEP_THANKS); y += 12; // plus one line // thanks msg this.insertMultilineFixedText(this, DEFAULT_PosX, y, DEFAULT_WIDTH_LARGE, 8*5, STEP_THANKS, I18nLabelsLoader.ADDON_THANKS_MESSAGE); y += 8*5 + 12; // plus 15 lines // status this.insertFixedText(this, DEFAULT_PosX, y, DEFAULT_WIDTH_LARGE, STEP_THANKS, I18nLabelsLoader.ADDON_THANKS_STATUS); this.thanksStatusLabel = this.insertHiddenFixedStatusText(this, DEFAULT_PosX + 40, y, DEFAULT_WIDTH_LARGE, STEP_THANKS, I18nLabelsLoader.ADDON_THANKS_STATUS, false); y += 12; // link this.thanksReportLink = this.insertFixedHyperlink(this, DEFAULT_PosX, y, DEFAULT_WIDTH_LARGE, STEP_THANKS, I18nLabelsLoader.ADDON_THANKS_LINK, Resources.getProperty("COMMUNITY_ROOT") + "/reports"); this.thanksProgressBar = this.insertProgressBar(DEFAULT_PosX, DEFAULT_DIALOG_HEIGHT - 26 - 8, DEFAULT_WIDTH_LARGE, STEP_THANKS, 100); }
[ "private", "void", "populateStep4", "(", ")", "{", "this", ".", "insertRoadmapItem", "(", "3", ",", "true", ",", "I18nLabelsLoader", ".", "REPORT_STEP_THANKS", ",", "4", ")", ";", "int", "y", "=", "6", ";", "// thanks", "this", ".", "insertFixedTextBold", "(", "this", ",", "DEFAULT_PosX", ",", "y", ",", "DEFAULT_WIDTH_LARGE", ",", "STEP_THANKS", ",", "I18nLabelsLoader", ".", "REPORT_STEP_THANKS", ")", ";", "y", "+=", "12", ";", "// plus one line", "// thanks msg", "this", ".", "insertMultilineFixedText", "(", "this", ",", "DEFAULT_PosX", ",", "y", ",", "DEFAULT_WIDTH_LARGE", ",", "8", "*", "5", ",", "STEP_THANKS", ",", "I18nLabelsLoader", ".", "ADDON_THANKS_MESSAGE", ")", ";", "y", "+=", "8", "*", "5", "+", "12", ";", "// plus 15 lines", "// status", "this", ".", "insertFixedText", "(", "this", ",", "DEFAULT_PosX", ",", "y", ",", "DEFAULT_WIDTH_LARGE", ",", "STEP_THANKS", ",", "I18nLabelsLoader", ".", "ADDON_THANKS_STATUS", ")", ";", "this", ".", "thanksStatusLabel", "=", "this", ".", "insertHiddenFixedStatusText", "(", "this", ",", "DEFAULT_PosX", "+", "40", ",", "y", ",", "DEFAULT_WIDTH_LARGE", ",", "STEP_THANKS", ",", "I18nLabelsLoader", ".", "ADDON_THANKS_STATUS", ",", "false", ")", ";", "y", "+=", "12", ";", "// link", "this", ".", "thanksReportLink", "=", "this", ".", "insertFixedHyperlink", "(", "this", ",", "DEFAULT_PosX", ",", "y", ",", "DEFAULT_WIDTH_LARGE", ",", "STEP_THANKS", ",", "I18nLabelsLoader", ".", "ADDON_THANKS_LINK", ",", "Resources", ".", "getProperty", "(", "\"COMMUNITY_ROOT\"", ")", "+", "\"/reports\"", ")", ";", "this", ".", "thanksProgressBar", "=", "this", ".", "insertProgressBar", "(", "DEFAULT_PosX", ",", "DEFAULT_DIALOG_HEIGHT", "-", "26", "-", "8", ",", "DEFAULT_WIDTH_LARGE", ",", "STEP_THANKS", ",", "100", ")", ";", "}" ]
Populate with thanks
[ "Populate", "with", "thanks" ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/ErrorReportDialog.java#L383-L405
10,163
cogroo/cogroo4
lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/ErrorReportDialog.java
ErrorReportDialog.setCurrentStep
private void setCurrentStep(int nNewID) { try { XPropertySet xDialogModelPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, m_xMSFDialogModel); int nOldStep = getCurrentStep(); // in the following line "ID" and "Step" are mixed together. // In fact in this case they denot the same if (nNewID != nOldStep){ xDialogModelPropertySet.setPropertyValue("Step", new Integer(nNewID)); } } catch (com.sun.star.uno.Exception exception) { exception.printStackTrace(System.out); } }
java
private void setCurrentStep(int nNewID) { try { XPropertySet xDialogModelPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, m_xMSFDialogModel); int nOldStep = getCurrentStep(); // in the following line "ID" and "Step" are mixed together. // In fact in this case they denot the same if (nNewID != nOldStep){ xDialogModelPropertySet.setPropertyValue("Step", new Integer(nNewID)); } } catch (com.sun.star.uno.Exception exception) { exception.printStackTrace(System.out); } }
[ "private", "void", "setCurrentStep", "(", "int", "nNewID", ")", "{", "try", "{", "XPropertySet", "xDialogModelPropertySet", "=", "(", "XPropertySet", ")", "UnoRuntime", ".", "queryInterface", "(", "XPropertySet", ".", "class", ",", "m_xMSFDialogModel", ")", ";", "int", "nOldStep", "=", "getCurrentStep", "(", ")", ";", "// in the following line \"ID\" and \"Step\" are mixed together.", "// In fact in this case they denot the same", "if", "(", "nNewID", "!=", "nOldStep", ")", "{", "xDialogModelPropertySet", ".", "setPropertyValue", "(", "\"Step\"", ",", "new", "Integer", "(", "nNewID", ")", ")", ";", "}", "}", "catch", "(", "com", ".", "sun", ".", "star", ".", "uno", ".", "Exception", "exception", ")", "{", "exception", ".", "printStackTrace", "(", "System", ".", "out", ")", ";", "}", "}" ]
Moves to another step @param nNewID the step to move to.
[ "Moves", "to", "another", "step" ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/ErrorReportDialog.java#L491-L503
10,164
cogroo/cogroo4
lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/ErrorReportDialog.java
ErrorReportDialog.getCurrentStep
private int getCurrentStep() { int step = -1; try { XPropertySet xDialogModelPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, m_xMSFDialogModel); step = ((Integer) xDialogModelPropertySet.getPropertyValue("Step")).intValue(); } catch (com.sun.star.uno.Exception exception) { exception.printStackTrace(System.out); } return step; }
java
private int getCurrentStep() { int step = -1; try { XPropertySet xDialogModelPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, m_xMSFDialogModel); step = ((Integer) xDialogModelPropertySet.getPropertyValue("Step")).intValue(); } catch (com.sun.star.uno.Exception exception) { exception.printStackTrace(System.out); } return step; }
[ "private", "int", "getCurrentStep", "(", ")", "{", "int", "step", "=", "-", "1", ";", "try", "{", "XPropertySet", "xDialogModelPropertySet", "=", "(", "XPropertySet", ")", "UnoRuntime", ".", "queryInterface", "(", "XPropertySet", ".", "class", ",", "m_xMSFDialogModel", ")", ";", "step", "=", "(", "(", "Integer", ")", "xDialogModelPropertySet", ".", "getPropertyValue", "(", "\"Step\"", ")", ")", ".", "intValue", "(", ")", ";", "}", "catch", "(", "com", ".", "sun", ".", "star", ".", "uno", ".", "Exception", "exception", ")", "{", "exception", ".", "printStackTrace", "(", "System", ".", "out", ")", ";", "}", "return", "step", ";", "}" ]
Get the current step
[ "Get", "the", "current", "step" ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/ErrorReportDialog.java#L508-L517
10,165
cogroo/cogroo4
lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/ErrorReportDialog.java
ErrorReportDialog.setIsStepEnabled
private void setIsStepEnabled(int step, boolean isEnabled) { try { Object oRoadmapItem = m_xRMIndexCont.getByIndex(step - 1); XPropertySet xRMItemPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oRoadmapItem); xRMItemPSet.setPropertyValue("Enabled", new Boolean(isEnabled)); } catch (com.sun.star.uno.Exception e) { LOGGER.log(Level.SEVERE, "Error in setIsStepEnabled", e); throw new CogrooRuntimeException(e); } }
java
private void setIsStepEnabled(int step, boolean isEnabled) { try { Object oRoadmapItem = m_xRMIndexCont.getByIndex(step - 1); XPropertySet xRMItemPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oRoadmapItem); xRMItemPSet.setPropertyValue("Enabled", new Boolean(isEnabled)); } catch (com.sun.star.uno.Exception e) { LOGGER.log(Level.SEVERE, "Error in setIsStepEnabled", e); throw new CogrooRuntimeException(e); } }
[ "private", "void", "setIsStepEnabled", "(", "int", "step", ",", "boolean", "isEnabled", ")", "{", "try", "{", "Object", "oRoadmapItem", "=", "m_xRMIndexCont", ".", "getByIndex", "(", "step", "-", "1", ")", ";", "XPropertySet", "xRMItemPSet", "=", "(", "XPropertySet", ")", "UnoRuntime", ".", "queryInterface", "(", "XPropertySet", ".", "class", ",", "oRoadmapItem", ")", ";", "xRMItemPSet", ".", "setPropertyValue", "(", "\"Enabled\"", ",", "new", "Boolean", "(", "isEnabled", ")", ")", ";", "}", "catch", "(", "com", ".", "sun", ".", "star", ".", "uno", ".", "Exception", "e", ")", "{", "LOGGER", ".", "log", "(", "Level", ".", "SEVERE", ",", "\"Error in setIsStepEnabled\"", ",", "e", ")", ";", "throw", "new", "CogrooRuntimeException", "(", "e", ")", ";", "}", "}" ]
Configure the steps that are enabled. @param step step to configure @param isEnabled if it is enabled
[ "Configure", "the", "steps", "that", "are", "enabled", "." ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/ErrorReportDialog.java#L524-L533
10,166
cogroo/cogroo4
lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/ErrorReportDialog.java
ErrorReportDialog.isStepEnabled
private boolean isStepEnabled(int step) { if(step < 0) { return false; } boolean isStepEnabled = false; try { Object oRoadmapItem = m_xRMIndexCont.getByIndex(step - 1); XPropertySet xRMItemPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oRoadmapItem); isStepEnabled = ((Boolean)xRMItemPSet.getPropertyValue("Enabled")).booleanValue(); } catch (com.sun.star.uno.Exception e) { LOGGER.log(Level.SEVERE, "Error in isStepEnabled", e); throw new CogrooRuntimeException(e); } return isStepEnabled; }
java
private boolean isStepEnabled(int step) { if(step < 0) { return false; } boolean isStepEnabled = false; try { Object oRoadmapItem = m_xRMIndexCont.getByIndex(step - 1); XPropertySet xRMItemPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oRoadmapItem); isStepEnabled = ((Boolean)xRMItemPSet.getPropertyValue("Enabled")).booleanValue(); } catch (com.sun.star.uno.Exception e) { LOGGER.log(Level.SEVERE, "Error in isStepEnabled", e); throw new CogrooRuntimeException(e); } return isStepEnabled; }
[ "private", "boolean", "isStepEnabled", "(", "int", "step", ")", "{", "if", "(", "step", "<", "0", ")", "{", "return", "false", ";", "}", "boolean", "isStepEnabled", "=", "false", ";", "try", "{", "Object", "oRoadmapItem", "=", "m_xRMIndexCont", ".", "getByIndex", "(", "step", "-", "1", ")", ";", "XPropertySet", "xRMItemPSet", "=", "(", "XPropertySet", ")", "UnoRuntime", ".", "queryInterface", "(", "XPropertySet", ".", "class", ",", "oRoadmapItem", ")", ";", "isStepEnabled", "=", "(", "(", "Boolean", ")", "xRMItemPSet", ".", "getPropertyValue", "(", "\"Enabled\"", ")", ")", ".", "booleanValue", "(", ")", ";", "}", "catch", "(", "com", ".", "sun", ".", "star", ".", "uno", ".", "Exception", "e", ")", "{", "LOGGER", ".", "log", "(", "Level", ".", "SEVERE", ",", "\"Error in isStepEnabled\"", ",", "e", ")", ";", "throw", "new", "CogrooRuntimeException", "(", "e", ")", ";", "}", "return", "isStepEnabled", ";", "}" ]
Checks if step is enabled. @param step step to check @return if the step is enabled
[ "Checks", "if", "step", "is", "enabled", "." ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/ErrorReportDialog.java#L540-L554
10,167
cogroo/cogroo4
lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/ErrorReportDialog.java
ErrorReportDialog.setEnabledSteps
private void setEnabledSteps() { // gets the important data boolean isAuth = isAuthenticated(); boolean hasFalseErrors = badIntListBox.getItemCount() > 0; int currentStep = getCurrentStep(); boolean login = true; boolean falseErrors = false; boolean omissions = false; boolean thanks = false; if(currentStep == STEP_THANKS) { login = falseErrors = omissions = false; thanks = true; } else if(isAuth) { if(hasFalseErrors) { falseErrors = true; } login = omissions = true; } setIsStepEnabled(STEP_LOGIN, login); setIsStepEnabled(STEP_FALSE_ERRORS, falseErrors); setIsStepEnabled(STEP_OMISSIONS, omissions); setIsStepEnabled(STEP_THANKS, thanks); }
java
private void setEnabledSteps() { // gets the important data boolean isAuth = isAuthenticated(); boolean hasFalseErrors = badIntListBox.getItemCount() > 0; int currentStep = getCurrentStep(); boolean login = true; boolean falseErrors = false; boolean omissions = false; boolean thanks = false; if(currentStep == STEP_THANKS) { login = falseErrors = omissions = false; thanks = true; } else if(isAuth) { if(hasFalseErrors) { falseErrors = true; } login = omissions = true; } setIsStepEnabled(STEP_LOGIN, login); setIsStepEnabled(STEP_FALSE_ERRORS, falseErrors); setIsStepEnabled(STEP_OMISSIONS, omissions); setIsStepEnabled(STEP_THANKS, thanks); }
[ "private", "void", "setEnabledSteps", "(", ")", "{", "// gets the important data", "boolean", "isAuth", "=", "isAuthenticated", "(", ")", ";", "boolean", "hasFalseErrors", "=", "badIntListBox", ".", "getItemCount", "(", ")", ">", "0", ";", "int", "currentStep", "=", "getCurrentStep", "(", ")", ";", "boolean", "login", "=", "true", ";", "boolean", "falseErrors", "=", "false", ";", "boolean", "omissions", "=", "false", ";", "boolean", "thanks", "=", "false", ";", "if", "(", "currentStep", "==", "STEP_THANKS", ")", "{", "login", "=", "falseErrors", "=", "omissions", "=", "false", ";", "thanks", "=", "true", ";", "}", "else", "if", "(", "isAuth", ")", "{", "if", "(", "hasFalseErrors", ")", "{", "falseErrors", "=", "true", ";", "}", "login", "=", "omissions", "=", "true", ";", "}", "setIsStepEnabled", "(", "STEP_LOGIN", ",", "login", ")", ";", "setIsStepEnabled", "(", "STEP_FALSE_ERRORS", ",", "falseErrors", ")", ";", "setIsStepEnabled", "(", "STEP_OMISSIONS", ",", "omissions", ")", ";", "setIsStepEnabled", "(", "STEP_THANKS", ",", "thanks", ")", ";", "}" ]
Sets the enabled steps acording to the current state
[ "Sets", "the", "enabled", "steps", "acording", "to", "the", "current", "state" ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/ErrorReportDialog.java#L559-L591
10,168
cogroo/cogroo4
lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/ErrorReportDialog.java
ErrorReportDialog.getNextStep
private int getNextStep(int currentStep) { int nextStep = -1; // we find the next available step. for (int i = currentStep + 1; i <= STEP_THANKS; i++) { if(isStepEnabled(i)) { nextStep = i; break; } } return nextStep; }
java
private int getNextStep(int currentStep) { int nextStep = -1; // we find the next available step. for (int i = currentStep + 1; i <= STEP_THANKS; i++) { if(isStepEnabled(i)) { nextStep = i; break; } } return nextStep; }
[ "private", "int", "getNextStep", "(", "int", "currentStep", ")", "{", "int", "nextStep", "=", "-", "1", ";", "// we find the next available step.", "for", "(", "int", "i", "=", "currentStep", "+", "1", ";", "i", "<=", "STEP_THANKS", ";", "i", "++", ")", "{", "if", "(", "isStepEnabled", "(", "i", ")", ")", "{", "nextStep", "=", "i", ";", "break", ";", "}", "}", "return", "nextStep", ";", "}" ]
Get the next step given the current. Will check available steps to confirm. @param currentStep @return
[ "Get", "the", "next", "step", "given", "the", "current", ".", "Will", "check", "available", "steps", "to", "confirm", "." ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/ErrorReportDialog.java#L637-L649
10,169
cogroo/cogroo4
lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/ErrorReportDialog.java
ErrorReportDialog.getPreviousStep
private int getPreviousStep(int currentStep) { int prevStep = -1; // we find the next available step. for (int i = currentStep - 1; i >= STEP_LOGIN; i--) { if(isStepEnabled(i)) { prevStep = i; break; } } return prevStep; }
java
private int getPreviousStep(int currentStep) { int prevStep = -1; // we find the next available step. for (int i = currentStep - 1; i >= STEP_LOGIN; i--) { if(isStepEnabled(i)) { prevStep = i; break; } } return prevStep; }
[ "private", "int", "getPreviousStep", "(", "int", "currentStep", ")", "{", "int", "prevStep", "=", "-", "1", ";", "// we find the next available step.", "for", "(", "int", "i", "=", "currentStep", "-", "1", ";", "i", ">=", "STEP_LOGIN", ";", "i", "--", ")", "{", "if", "(", "isStepEnabled", "(", "i", ")", ")", "{", "prevStep", "=", "i", ";", "break", ";", "}", "}", "return", "prevStep", ";", "}" ]
Get the previous step given the current. Will check available steps to confirm. @param currentStep @return
[ "Get", "the", "previous", "step", "given", "the", "current", ".", "Will", "check", "available", "steps", "to", "confirm", "." ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/ErrorReportDialog.java#L656-L668
10,170
cogroo/cogroo4
cogroo-gc/src/main/java/org/cogroo/tools/checker/rules/applier/RulesTreesBuilder.java
RulesTreesBuilder.printRulesTree
public void printRulesTree(State rootState) { List<State> nextStates = rootState.getNextStates(); if (nextStates.isEmpty()) { return; } for (int i = 0; i < rootState.getNextStates().size(); i++) { State currState = nextStates.get(i); String accept = ""; if (currState instanceof AcceptState) { accept = Long.toString(((AcceptState) currState).getRule().getId()); } System.out.printf("state[%4d], parent[%4d], rule[%4s], element[%s]\n", Integer.valueOf(currState.getName()), Integer.valueOf(rootState.getName()), accept, RuleUtils.getPatternElementAsString(currState.getElement())); this.printRulesTree(nextStates.get(i)); } }
java
public void printRulesTree(State rootState) { List<State> nextStates = rootState.getNextStates(); if (nextStates.isEmpty()) { return; } for (int i = 0; i < rootState.getNextStates().size(); i++) { State currState = nextStates.get(i); String accept = ""; if (currState instanceof AcceptState) { accept = Long.toString(((AcceptState) currState).getRule().getId()); } System.out.printf("state[%4d], parent[%4d], rule[%4s], element[%s]\n", Integer.valueOf(currState.getName()), Integer.valueOf(rootState.getName()), accept, RuleUtils.getPatternElementAsString(currState.getElement())); this.printRulesTree(nextStates.get(i)); } }
[ "public", "void", "printRulesTree", "(", "State", "rootState", ")", "{", "List", "<", "State", ">", "nextStates", "=", "rootState", ".", "getNextStates", "(", ")", ";", "if", "(", "nextStates", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "rootState", ".", "getNextStates", "(", ")", ".", "size", "(", ")", ";", "i", "++", ")", "{", "State", "currState", "=", "nextStates", ".", "get", "(", "i", ")", ";", "String", "accept", "=", "\"\"", ";", "if", "(", "currState", "instanceof", "AcceptState", ")", "{", "accept", "=", "Long", ".", "toString", "(", "(", "(", "AcceptState", ")", "currState", ")", ".", "getRule", "(", ")", ".", "getId", "(", ")", ")", ";", "}", "System", ".", "out", ".", "printf", "(", "\"state[%4d], parent[%4d], rule[%4s], element[%s]\\n\"", ",", "Integer", ".", "valueOf", "(", "currState", ".", "getName", "(", ")", ")", ",", "Integer", ".", "valueOf", "(", "rootState", ".", "getName", "(", ")", ")", ",", "accept", ",", "RuleUtils", ".", "getPatternElementAsString", "(", "currState", ".", "getElement", "(", ")", ")", ")", ";", "this", ".", "printRulesTree", "(", "nextStates", ".", "get", "(", "i", ")", ")", ";", "}", "}" ]
Prints the contents of a rules tree. @param rootState the top state of the rules DFA
[ "Prints", "the", "contents", "of", "a", "rules", "tree", "." ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-gc/src/main/java/org/cogroo/tools/checker/rules/applier/RulesTreesBuilder.java#L188-L202
10,171
cogroo/cogroo4
cogroo-gc/src/main/java/org/cogroo/tools/checker/rules/util/RuleUtils.java
RuleUtils.getElementAsString
public static String getElementAsString(Element element) { StringBuilder sb = new StringBuilder(); if (element.isNegated() != null && element.isNegated().booleanValue()) { sb.append("~"); } int masks = element.getMask().size(); if (masks > 1) { sb.append("("); } int maskCounter = 0; for (Mask mask : element.getMask()) { // Encloses lexemes between quotes. if (mask.getLexemeMask() != null) { sb.append("\"").append(mask.getLexemeMask()).append("\""); } else if (mask.getPrimitiveMask() != null) { // Primitives are enclosed between curly brackets. sb.append("{").append(mask.getPrimitiveMask()).append("}"); } else if (mask.getTagMask() != null) { sb.append(getTagMaskAsString(mask.getTagMask())); } else if (mask.getTagReference() != null) { sb.append(getTagReferenceAsString(mask.getTagReference())); } if (maskCounter < masks - 1) { sb.append("|"); } maskCounter++; } if (masks > 1) { sb.append(")"); } return sb.toString(); }
java
public static String getElementAsString(Element element) { StringBuilder sb = new StringBuilder(); if (element.isNegated() != null && element.isNegated().booleanValue()) { sb.append("~"); } int masks = element.getMask().size(); if (masks > 1) { sb.append("("); } int maskCounter = 0; for (Mask mask : element.getMask()) { // Encloses lexemes between quotes. if (mask.getLexemeMask() != null) { sb.append("\"").append(mask.getLexemeMask()).append("\""); } else if (mask.getPrimitiveMask() != null) { // Primitives are enclosed between curly brackets. sb.append("{").append(mask.getPrimitiveMask()).append("}"); } else if (mask.getTagMask() != null) { sb.append(getTagMaskAsString(mask.getTagMask())); } else if (mask.getTagReference() != null) { sb.append(getTagReferenceAsString(mask.getTagReference())); } if (maskCounter < masks - 1) { sb.append("|"); } maskCounter++; } if (masks > 1) { sb.append(")"); } return sb.toString(); }
[ "public", "static", "String", "getElementAsString", "(", "Element", "element", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "element", ".", "isNegated", "(", ")", "!=", "null", "&&", "element", ".", "isNegated", "(", ")", ".", "booleanValue", "(", ")", ")", "{", "sb", ".", "append", "(", "\"~\"", ")", ";", "}", "int", "masks", "=", "element", ".", "getMask", "(", ")", ".", "size", "(", ")", ";", "if", "(", "masks", ">", "1", ")", "{", "sb", ".", "append", "(", "\"(\"", ")", ";", "}", "int", "maskCounter", "=", "0", ";", "for", "(", "Mask", "mask", ":", "element", ".", "getMask", "(", ")", ")", "{", "// Encloses lexemes between quotes.\r", "if", "(", "mask", ".", "getLexemeMask", "(", ")", "!=", "null", ")", "{", "sb", ".", "append", "(", "\"\\\"\"", ")", ".", "append", "(", "mask", ".", "getLexemeMask", "(", ")", ")", ".", "append", "(", "\"\\\"\"", ")", ";", "}", "else", "if", "(", "mask", ".", "getPrimitiveMask", "(", ")", "!=", "null", ")", "{", "// Primitives are enclosed between curly brackets.\r", "sb", ".", "append", "(", "\"{\"", ")", ".", "append", "(", "mask", ".", "getPrimitiveMask", "(", ")", ")", ".", "append", "(", "\"}\"", ")", ";", "}", "else", "if", "(", "mask", ".", "getTagMask", "(", ")", "!=", "null", ")", "{", "sb", ".", "append", "(", "getTagMaskAsString", "(", "mask", ".", "getTagMask", "(", ")", ")", ")", ";", "}", "else", "if", "(", "mask", ".", "getTagReference", "(", ")", "!=", "null", ")", "{", "sb", ".", "append", "(", "getTagReferenceAsString", "(", "mask", ".", "getTagReference", "(", ")", ")", ")", ";", "}", "if", "(", "maskCounter", "<", "masks", "-", "1", ")", "{", "sb", ".", "append", "(", "\"|\"", ")", ";", "}", "maskCounter", "++", ";", "}", "if", "(", "masks", ">", "1", ")", "{", "sb", ".", "append", "(", "\")\"", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Gets the string representation of an element. @param element the element to be planified to a string @return the element as a string
[ "Gets", "the", "string", "representation", "of", "an", "element", "." ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-gc/src/main/java/org/cogroo/tools/checker/rules/util/RuleUtils.java#L136-L172
10,172
cogroo/cogroo4
cogroo-gc/src/main/java/org/cogroo/tools/checker/checkers/GovernmentChecker.java
GovernmentChecker.findNouns
public List<Token> findNouns(Sentence sentence) { List<Token> nouns = new ArrayList<Token>(); List<SyntacticChunk> syntChunks = sentence.getSyntacticChunks(); for (int i = 0; i < syntChunks.size(); i++) { String tag = syntChunks.get(i).getTag(); if (tag.equals("PIV") || tag.equals("ACC") || tag.equals("SC")) { for (Token token : syntChunks.get(i).getTokens()) { if (token.getPOSTag().equals("n") || token.getPOSTag().equals("pron-pers") || token.getPOSTag().equals("prop")) { nouns.add(token); } } } } return nouns; }
java
public List<Token> findNouns(Sentence sentence) { List<Token> nouns = new ArrayList<Token>(); List<SyntacticChunk> syntChunks = sentence.getSyntacticChunks(); for (int i = 0; i < syntChunks.size(); i++) { String tag = syntChunks.get(i).getTag(); if (tag.equals("PIV") || tag.equals("ACC") || tag.equals("SC")) { for (Token token : syntChunks.get(i).getTokens()) { if (token.getPOSTag().equals("n") || token.getPOSTag().equals("pron-pers") || token.getPOSTag().equals("prop")) { nouns.add(token); } } } } return nouns; }
[ "public", "List", "<", "Token", ">", "findNouns", "(", "Sentence", "sentence", ")", "{", "List", "<", "Token", ">", "nouns", "=", "new", "ArrayList", "<", "Token", ">", "(", ")", ";", "List", "<", "SyntacticChunk", ">", "syntChunks", "=", "sentence", ".", "getSyntacticChunks", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "syntChunks", ".", "size", "(", ")", ";", "i", "++", ")", "{", "String", "tag", "=", "syntChunks", ".", "get", "(", "i", ")", ".", "getTag", "(", ")", ";", "if", "(", "tag", ".", "equals", "(", "\"PIV\"", ")", "||", "tag", ".", "equals", "(", "\"ACC\"", ")", "||", "tag", ".", "equals", "(", "\"SC\"", ")", ")", "{", "for", "(", "Token", "token", ":", "syntChunks", ".", "get", "(", "i", ")", ".", "getTokens", "(", ")", ")", "{", "if", "(", "token", ".", "getPOSTag", "(", ")", ".", "equals", "(", "\"n\"", ")", "||", "token", ".", "getPOSTag", "(", ")", ".", "equals", "(", "\"pron-pers\"", ")", "||", "token", ".", "getPOSTag", "(", ")", ".", "equals", "(", "\"prop\"", ")", ")", "{", "nouns", ".", "add", "(", "token", ")", ";", "}", "}", "}", "}", "return", "nouns", ";", "}" ]
Looks for a noun in the sentence's objects. @param sentence entered by the user @return a <tt>List></tt> of every noun found in the sentence's objects and its location in the sentence
[ "Looks", "for", "a", "noun", "in", "the", "sentence", "s", "objects", "." ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-gc/src/main/java/org/cogroo/tools/checker/checkers/GovernmentChecker.java#L136-L156
10,173
cogroo/cogroo4
cogroo-gc/src/main/java/org/cogroo/tools/checker/checkers/GovernmentChecker.java
GovernmentChecker.findVerb
public Token findVerb(Sentence sentence) { List<SyntacticChunk> syntChunks = sentence.getSyntacticChunks(); for (int i = 0; i < syntChunks.size(); i++) { String tag = syntChunks.get(i).getTag(); if (tag.equals("P") || tag.equals("MV") || tag.equals("PMV") || tag.equals("AUX") || tag.equals("PAUX")) return syntChunks.get(i).getTokens().get(0); } return null; }
java
public Token findVerb(Sentence sentence) { List<SyntacticChunk> syntChunks = sentence.getSyntacticChunks(); for (int i = 0; i < syntChunks.size(); i++) { String tag = syntChunks.get(i).getTag(); if (tag.equals("P") || tag.equals("MV") || tag.equals("PMV") || tag.equals("AUX") || tag.equals("PAUX")) return syntChunks.get(i).getTokens().get(0); } return null; }
[ "public", "Token", "findVerb", "(", "Sentence", "sentence", ")", "{", "List", "<", "SyntacticChunk", ">", "syntChunks", "=", "sentence", ".", "getSyntacticChunks", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "syntChunks", ".", "size", "(", ")", ";", "i", "++", ")", "{", "String", "tag", "=", "syntChunks", ".", "get", "(", "i", ")", ".", "getTag", "(", ")", ";", "if", "(", "tag", ".", "equals", "(", "\"P\"", ")", "||", "tag", ".", "equals", "(", "\"MV\"", ")", "||", "tag", ".", "equals", "(", "\"PMV\"", ")", "||", "tag", ".", "equals", "(", "\"AUX\"", ")", "||", "tag", ".", "equals", "(", "\"PAUX\"", ")", ")", "return", "syntChunks", ".", "get", "(", "i", ")", ".", "getTokens", "(", ")", ".", "get", "(", "0", ")", ";", "}", "return", "null", ";", "}" ]
Looks in a sentence for a verb. @param sentence entered by the user @return the <tt>Token</tt> which contains the searched verb, in case none was found returns <tt>null</tt>
[ "Looks", "in", "a", "sentence", "for", "a", "verb", "." ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-gc/src/main/java/org/cogroo/tools/checker/checkers/GovernmentChecker.java#L166-L178
10,174
cogroo/cogroo4
cogroo-gc/src/main/java/org/cogroo/tools/checker/rules/applier/RulesApplier.java
RulesApplier.check
public List<Mistake> check(Sentence sentence) { long start = 0; if(LOGGER.isDebugEnabled()) { start = System.nanoTime(); } insertOutOfBounds(sentence); // mistakes will hold mistakes found in the sentence. List<Mistake> mistakes = new ArrayList<Mistake>(); // rules will hold the tree being used to seek for mistakes. RulesTree rulesTree; if(RulesProperties.APPLY_LOCAL) { // Seeks for errors that can occur anywhere in the sentence (general). rulesTree = this.rulesTreesProvider.getTrees().getGeneral(); // For each token in the sentence. for (int i = 0; i < sentence.getTokens().size(); i++) { // For each token, gets back to the initial state (hence 0). List<State> nextStates = rulesTree.getRoot().getNextStates(); // i is the index of the token that began the rule applying process. mistakes = this.getMistakes(mistakes, nextStates, sentence, i, i, new ArrayList<Token>(), sentence); } } // remove aux tokens sentence.setTokens(sentence.getTokens().subList(1, sentence.getTokens().size() - 1)); if(RulesProperties.APPLY_PHRASE_LOCAL) { // Seeks for errors inside a chunk (phrase local). rulesTree = this.rulesTreesProvider.getTrees().getPhraseLocal(); // For each chunk in the sentence. List<Chunk> chunks = sentence.getChunks(); for (int i = 0; i < chunks.size(); i++) { for (int j = 0; j < chunks.get(i).getTokens().size(); j++) { // For each token, gets back to the initial state (hence 0). List<State> nextStates = rulesTree.getRoot().getNextStates(); // j is the index of the token that began the rule applying process. mistakes = this.getMistakes(mistakes, nextStates, chunks.get(i), j, j, new ArrayList<Token>(), sentence); } } } if(RulesProperties.APPLY_SUBJECT_VERB) { // Seeks for errors between a subject and a main verb. rulesTree = this.rulesTreesProvider.getTrees().getSubjectVerb(); // For each chunk in the sentence. List<SyntacticChunk> syntacticChunks = sentence.getSyntacticChunks(); for (int i = 0; i < syntacticChunks.size(); i++) { List<State> nextStates = rulesTree.getRoot().getNextStates(); mistakes = this.getMistakes(mistakes, nextStates, syntacticChunks, i, i, new ArrayList<SyntacticChunk>(), sentence); } } if(LOGGER.isDebugEnabled()) { LOGGER.debug("Rules applied in " + (System.nanoTime() - start) / 1000 + "us"); } filterIgnoredRules(mistakes); return mistakes; }
java
public List<Mistake> check(Sentence sentence) { long start = 0; if(LOGGER.isDebugEnabled()) { start = System.nanoTime(); } insertOutOfBounds(sentence); // mistakes will hold mistakes found in the sentence. List<Mistake> mistakes = new ArrayList<Mistake>(); // rules will hold the tree being used to seek for mistakes. RulesTree rulesTree; if(RulesProperties.APPLY_LOCAL) { // Seeks for errors that can occur anywhere in the sentence (general). rulesTree = this.rulesTreesProvider.getTrees().getGeneral(); // For each token in the sentence. for (int i = 0; i < sentence.getTokens().size(); i++) { // For each token, gets back to the initial state (hence 0). List<State> nextStates = rulesTree.getRoot().getNextStates(); // i is the index of the token that began the rule applying process. mistakes = this.getMistakes(mistakes, nextStates, sentence, i, i, new ArrayList<Token>(), sentence); } } // remove aux tokens sentence.setTokens(sentence.getTokens().subList(1, sentence.getTokens().size() - 1)); if(RulesProperties.APPLY_PHRASE_LOCAL) { // Seeks for errors inside a chunk (phrase local). rulesTree = this.rulesTreesProvider.getTrees().getPhraseLocal(); // For each chunk in the sentence. List<Chunk> chunks = sentence.getChunks(); for (int i = 0; i < chunks.size(); i++) { for (int j = 0; j < chunks.get(i).getTokens().size(); j++) { // For each token, gets back to the initial state (hence 0). List<State> nextStates = rulesTree.getRoot().getNextStates(); // j is the index of the token that began the rule applying process. mistakes = this.getMistakes(mistakes, nextStates, chunks.get(i), j, j, new ArrayList<Token>(), sentence); } } } if(RulesProperties.APPLY_SUBJECT_VERB) { // Seeks for errors between a subject and a main verb. rulesTree = this.rulesTreesProvider.getTrees().getSubjectVerb(); // For each chunk in the sentence. List<SyntacticChunk> syntacticChunks = sentence.getSyntacticChunks(); for (int i = 0; i < syntacticChunks.size(); i++) { List<State> nextStates = rulesTree.getRoot().getNextStates(); mistakes = this.getMistakes(mistakes, nextStates, syntacticChunks, i, i, new ArrayList<SyntacticChunk>(), sentence); } } if(LOGGER.isDebugEnabled()) { LOGGER.debug("Rules applied in " + (System.nanoTime() - start) / 1000 + "us"); } filterIgnoredRules(mistakes); return mistakes; }
[ "public", "List", "<", "Mistake", ">", "check", "(", "Sentence", "sentence", ")", "{", "long", "start", "=", "0", ";", "if", "(", "LOGGER", ".", "isDebugEnabled", "(", ")", ")", "{", "start", "=", "System", ".", "nanoTime", "(", ")", ";", "}", "insertOutOfBounds", "(", "sentence", ")", ";", "// mistakes will hold mistakes found in the sentence.\r", "List", "<", "Mistake", ">", "mistakes", "=", "new", "ArrayList", "<", "Mistake", ">", "(", ")", ";", "// rules will hold the tree being used to seek for mistakes.\r", "RulesTree", "rulesTree", ";", "if", "(", "RulesProperties", ".", "APPLY_LOCAL", ")", "{", "// Seeks for errors that can occur anywhere in the sentence (general).\r", "rulesTree", "=", "this", ".", "rulesTreesProvider", ".", "getTrees", "(", ")", ".", "getGeneral", "(", ")", ";", "// For each token in the sentence.\r", "for", "(", "int", "i", "=", "0", ";", "i", "<", "sentence", ".", "getTokens", "(", ")", ".", "size", "(", ")", ";", "i", "++", ")", "{", "// For each token, gets back to the initial state (hence 0).\r", "List", "<", "State", ">", "nextStates", "=", "rulesTree", ".", "getRoot", "(", ")", ".", "getNextStates", "(", ")", ";", "// i is the index of the token that began the rule applying process.\r", "mistakes", "=", "this", ".", "getMistakes", "(", "mistakes", ",", "nextStates", ",", "sentence", ",", "i", ",", "i", ",", "new", "ArrayList", "<", "Token", ">", "(", ")", ",", "sentence", ")", ";", "}", "}", "// remove aux tokens\r", "sentence", ".", "setTokens", "(", "sentence", ".", "getTokens", "(", ")", ".", "subList", "(", "1", ",", "sentence", ".", "getTokens", "(", ")", ".", "size", "(", ")", "-", "1", ")", ")", ";", "if", "(", "RulesProperties", ".", "APPLY_PHRASE_LOCAL", ")", "{", "// Seeks for errors inside a chunk (phrase local).\r", "rulesTree", "=", "this", ".", "rulesTreesProvider", ".", "getTrees", "(", ")", ".", "getPhraseLocal", "(", ")", ";", "// For each chunk in the sentence.\r", "List", "<", "Chunk", ">", "chunks", "=", "sentence", ".", "getChunks", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "chunks", ".", "size", "(", ")", ";", "i", "++", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "chunks", ".", "get", "(", "i", ")", ".", "getTokens", "(", ")", ".", "size", "(", ")", ";", "j", "++", ")", "{", "// For each token, gets back to the initial state (hence 0).\r", "List", "<", "State", ">", "nextStates", "=", "rulesTree", ".", "getRoot", "(", ")", ".", "getNextStates", "(", ")", ";", "// j is the index of the token that began the rule applying process.\r", "mistakes", "=", "this", ".", "getMistakes", "(", "mistakes", ",", "nextStates", ",", "chunks", ".", "get", "(", "i", ")", ",", "j", ",", "j", ",", "new", "ArrayList", "<", "Token", ">", "(", ")", ",", "sentence", ")", ";", "}", "}", "}", "if", "(", "RulesProperties", ".", "APPLY_SUBJECT_VERB", ")", "{", "// Seeks for errors between a subject and a main verb.\r", "rulesTree", "=", "this", ".", "rulesTreesProvider", ".", "getTrees", "(", ")", ".", "getSubjectVerb", "(", ")", ";", "// For each chunk in the sentence.", "List", "<", "SyntacticChunk", ">", "syntacticChunks", "=", "sentence", ".", "getSyntacticChunks", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "syntacticChunks", ".", "size", "(", ")", ";", "i", "++", ")", "{", "List", "<", "State", ">", "nextStates", "=", "rulesTree", ".", "getRoot", "(", ")", ".", "getNextStates", "(", ")", ";", "mistakes", "=", "this", ".", "getMistakes", "(", "mistakes", ",", "nextStates", ",", "syntacticChunks", ",", "i", ",", "i", ",", "new", "ArrayList", "<", "SyntacticChunk", ">", "(", ")", ",", "sentence", ")", ";", "}", "}", "if", "(", "LOGGER", ".", "isDebugEnabled", "(", ")", ")", "{", "LOGGER", ".", "debug", "(", "\"Rules applied in \"", "+", "(", "System", ".", "nanoTime", "(", ")", "-", "start", ")", "/", "1000", "+", "\"us\"", ")", ";", "}", "filterIgnoredRules", "(", "mistakes", ")", ";", "return", "mistakes", ";", "}" ]
Applies all active rules described in Rules.xml given a sentence properly tokenized, tagged, chunked and shallow parsed. @param sentence a tokenized, tagged, chunked and shallow parsed sentence. @param dictionary a word and tag dictionary @return a list containing all the mistakes found in the sentence. Each mistake can be localized between the character indexes given in the span field of the mistake.
[ "Applies", "all", "active", "rules", "described", "in", "Rules", ".", "xml", "given", "a", "sentence", "properly", "tokenized", "tagged", "chunked", "and", "shallow", "parsed", "." ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-gc/src/main/java/org/cogroo/tools/checker/rules/applier/RulesApplier.java#L97-L158
10,175
cogroo/cogroo4
cogroo-gc/src/main/java/org/cogroo/tools/checker/rules/applier/RulesApplier.java
RulesApplier.getMistakes
private List<Mistake> getMistakes(List<Mistake> mistakes, List<State> currentStates, List<SyntacticChunk> syntacticChunks, int baseChunkIndex, int currentChunkIndex, ArrayList<SyntacticChunk> matched, Sentence sentence) { for (State state : currentStates) { PatternElement patternElement = state.getElement(); SyntacticChunk sc = syntacticChunks.get(currentChunkIndex); boolean chunkAndElementMatched = this.match(sc, patternElement, baseChunkIndex, sentence); if (chunkAndElementMatched) { // need to clone due to recursive implementation ArrayList<SyntacticChunk> matchedClone = cloneList(matched); matchedClone.add(sc); if (state instanceof AcceptState) { // Got a mistake! Rule rule = ((AcceptState) state).getRule(); // The mistake is located between the chunks indicated by lower and upper. // Gets the lower index by chars. Boundaries b = rule.getBoundaries(); int start = matchedClone.get(b.getLower()).getTokens().get(0).getSpan().getStart() + sentence.getOffset(); List<Token> lastChk = matchedClone.get(matchedClone.size() - 1 + b.getUpper()).getTokens(); int end = lastChk.get(lastChk.size() - 1).getSpan().getEnd() + sentence.getOffset(); // Suggestions. String[] suggestions = suggestionBuilder.getSyntacticSuggestions(sentence, matchedClone, null, rule); Mistake mistake = new MistakeImpl(ID_PREFIX + rule.getId(), getPriority(rule), rule.getMessage(), rule.getShortMessage(), suggestions, start, end, rule.getExample(), sentence.getDocumentText()); mistakes.add(mistake); } else if (currentChunkIndex + 1 < syntacticChunks.size()) { // Keep looking: recurse. this.getMistakes(mistakes, state.getNextStates(), syntacticChunks, baseChunkIndex, currentChunkIndex + 1, matchedClone, sentence); } } else if(isOptional(patternElement)) { // need to clone due to recursive implementation ArrayList<SyntacticChunk> matchedClone = cloneList(matched); matchedClone.add(NullSyntacticChunk.instance()); // it is valid only if the next is valid here! // just keep looking without movin to the next token this.getMistakes(mistakes, state.getNextStates(), syntacticChunks, baseChunkIndex, currentChunkIndex, matchedClone, sentence); } } return mistakes; }
java
private List<Mistake> getMistakes(List<Mistake> mistakes, List<State> currentStates, List<SyntacticChunk> syntacticChunks, int baseChunkIndex, int currentChunkIndex, ArrayList<SyntacticChunk> matched, Sentence sentence) { for (State state : currentStates) { PatternElement patternElement = state.getElement(); SyntacticChunk sc = syntacticChunks.get(currentChunkIndex); boolean chunkAndElementMatched = this.match(sc, patternElement, baseChunkIndex, sentence); if (chunkAndElementMatched) { // need to clone due to recursive implementation ArrayList<SyntacticChunk> matchedClone = cloneList(matched); matchedClone.add(sc); if (state instanceof AcceptState) { // Got a mistake! Rule rule = ((AcceptState) state).getRule(); // The mistake is located between the chunks indicated by lower and upper. // Gets the lower index by chars. Boundaries b = rule.getBoundaries(); int start = matchedClone.get(b.getLower()).getTokens().get(0).getSpan().getStart() + sentence.getOffset(); List<Token> lastChk = matchedClone.get(matchedClone.size() - 1 + b.getUpper()).getTokens(); int end = lastChk.get(lastChk.size() - 1).getSpan().getEnd() + sentence.getOffset(); // Suggestions. String[] suggestions = suggestionBuilder.getSyntacticSuggestions(sentence, matchedClone, null, rule); Mistake mistake = new MistakeImpl(ID_PREFIX + rule.getId(), getPriority(rule), rule.getMessage(), rule.getShortMessage(), suggestions, start, end, rule.getExample(), sentence.getDocumentText()); mistakes.add(mistake); } else if (currentChunkIndex + 1 < syntacticChunks.size()) { // Keep looking: recurse. this.getMistakes(mistakes, state.getNextStates(), syntacticChunks, baseChunkIndex, currentChunkIndex + 1, matchedClone, sentence); } } else if(isOptional(patternElement)) { // need to clone due to recursive implementation ArrayList<SyntacticChunk> matchedClone = cloneList(matched); matchedClone.add(NullSyntacticChunk.instance()); // it is valid only if the next is valid here! // just keep looking without movin to the next token this.getMistakes(mistakes, state.getNextStates(), syntacticChunks, baseChunkIndex, currentChunkIndex, matchedClone, sentence); } } return mistakes; }
[ "private", "List", "<", "Mistake", ">", "getMistakes", "(", "List", "<", "Mistake", ">", "mistakes", ",", "List", "<", "State", ">", "currentStates", ",", "List", "<", "SyntacticChunk", ">", "syntacticChunks", ",", "int", "baseChunkIndex", ",", "int", "currentChunkIndex", ",", "ArrayList", "<", "SyntacticChunk", ">", "matched", ",", "Sentence", "sentence", ")", "{", "for", "(", "State", "state", ":", "currentStates", ")", "{", "PatternElement", "patternElement", "=", "state", ".", "getElement", "(", ")", ";", "SyntacticChunk", "sc", "=", "syntacticChunks", ".", "get", "(", "currentChunkIndex", ")", ";", "boolean", "chunkAndElementMatched", "=", "this", ".", "match", "(", "sc", ",", "patternElement", ",", "baseChunkIndex", ",", "sentence", ")", ";", "if", "(", "chunkAndElementMatched", ")", "{", "// need to clone due to recursive implementation\r", "ArrayList", "<", "SyntacticChunk", ">", "matchedClone", "=", "cloneList", "(", "matched", ")", ";", "matchedClone", ".", "add", "(", "sc", ")", ";", "if", "(", "state", "instanceof", "AcceptState", ")", "{", "// Got a mistake!\r", "Rule", "rule", "=", "(", "(", "AcceptState", ")", "state", ")", ".", "getRule", "(", ")", ";", "// The mistake is located between the chunks indicated by lower and upper.\r", "// Gets the lower index by chars.\r", "Boundaries", "b", "=", "rule", ".", "getBoundaries", "(", ")", ";", "int", "start", "=", "matchedClone", ".", "get", "(", "b", ".", "getLower", "(", ")", ")", ".", "getTokens", "(", ")", ".", "get", "(", "0", ")", ".", "getSpan", "(", ")", ".", "getStart", "(", ")", "+", "sentence", ".", "getOffset", "(", ")", ";", "List", "<", "Token", ">", "lastChk", "=", "matchedClone", ".", "get", "(", "matchedClone", ".", "size", "(", ")", "-", "1", "+", "b", ".", "getUpper", "(", ")", ")", ".", "getTokens", "(", ")", ";", "int", "end", "=", "lastChk", ".", "get", "(", "lastChk", ".", "size", "(", ")", "-", "1", ")", ".", "getSpan", "(", ")", ".", "getEnd", "(", ")", "+", "sentence", ".", "getOffset", "(", ")", ";", "// Suggestions.\r", "String", "[", "]", "suggestions", "=", "suggestionBuilder", ".", "getSyntacticSuggestions", "(", "sentence", ",", "matchedClone", ",", "null", ",", "rule", ")", ";", "Mistake", "mistake", "=", "new", "MistakeImpl", "(", "ID_PREFIX", "+", "rule", ".", "getId", "(", ")", ",", "getPriority", "(", "rule", ")", ",", "rule", ".", "getMessage", "(", ")", ",", "rule", ".", "getShortMessage", "(", ")", ",", "suggestions", ",", "start", ",", "end", ",", "rule", ".", "getExample", "(", ")", ",", "sentence", ".", "getDocumentText", "(", ")", ")", ";", "mistakes", ".", "add", "(", "mistake", ")", ";", "}", "else", "if", "(", "currentChunkIndex", "+", "1", "<", "syntacticChunks", ".", "size", "(", ")", ")", "{", "// Keep looking: recurse.\r", "this", ".", "getMistakes", "(", "mistakes", ",", "state", ".", "getNextStates", "(", ")", ",", "syntacticChunks", ",", "baseChunkIndex", ",", "currentChunkIndex", "+", "1", ",", "matchedClone", ",", "sentence", ")", ";", "}", "}", "else", "if", "(", "isOptional", "(", "patternElement", ")", ")", "{", "// need to clone due to recursive implementation\r", "ArrayList", "<", "SyntacticChunk", ">", "matchedClone", "=", "cloneList", "(", "matched", ")", ";", "matchedClone", ".", "add", "(", "NullSyntacticChunk", ".", "instance", "(", ")", ")", ";", "// it is valid only if the next is valid here!\r", "// just keep looking without movin to the next token\r", "this", ".", "getMistakes", "(", "mistakes", ",", "state", ".", "getNextStates", "(", ")", ",", "syntacticChunks", ",", "baseChunkIndex", ",", "currentChunkIndex", ",", "matchedClone", ",", "sentence", ")", ";", "}", "}", "return", "mistakes", ";", "}" ]
A recursive method that iterates the sentence given a base chunk. Used to match subject-verb rules. @param mistakes a list of mistakes found in the process of checking the sentence @param currentStates the applier will check if these states match the current token @param syntacticChunks an array of chunks @param baseChunkIndex the index of the chunk in which the process of searching for mistakes began @param currentChunkIndex the index of the current chunk @param sentence the complete sentence, used to get the location of the mistake counted by chars inside the sentence @return the mistakes in the parameter <code>mistakes</code> plus the mistakes found in this invocation, if any
[ "A", "recursive", "method", "that", "iterates", "the", "sentence", "given", "a", "base", "chunk", ".", "Used", "to", "match", "subject", "-", "verb", "rules", "." ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-gc/src/main/java/org/cogroo/tools/checker/rules/applier/RulesApplier.java#L314-L359
10,176
cogroo/cogroo4
cogroo-gc/src/main/java/org/cogroo/tools/checker/rules/applier/RulesApplier.java
RulesApplier.match
private boolean match(Token token, Element element, int baseTokenIndex, Sentence sentence) { boolean match; boolean negated; // Sees if the mask must or not match. // Negated is optional, so it can be null, true or false. // If null, consider as false. if (element.isNegated() == null) { match = false; negated = false; } else { match = element.isNegated().booleanValue(); negated = element.isNegated().booleanValue(); } for (Mask mask : element.getMask()) { // If the token must match the mask. if (!negated) { // If not negated, match starts as false and just one match is needed to make it true. if (mask.getLexemeMask() != null && mask.getLexemeMask().equalsIgnoreCase(token.getLexeme())) { match = true; } else if (mask.getPrimitiveMask() != null && matchLemma(token, mask.getPrimitiveMask())) { match = true; } else if (mask.getTagMask() != null && token.getMorphologicalTag() != null) { match = match | token.getMorphologicalTag().matchExact(mask.getTagMask(), false); } else if (mask.getTagReference() != null && token.getMorphologicalTag() != null) { match = match | token.getMorphologicalTag().match(RuleUtils.createTagMaskFromReference(mask.getTagReference(), sentence, baseTokenIndex), false); } else if (mask.getOutOfBounds() != null && (baseTokenIndex == 0 || baseTokenIndex == sentence.getTokens().size() -1)) { match = false; } } else { // The token must NOT match the mask. // If negated, match starts as true and just one match is needed to make it false. if (mask.getLexemeMask() != null && mask.getLexemeMask().equalsIgnoreCase(token.getLexeme())) { match = false; } else if (mask.getPrimitiveMask() != null && matchLemma(token, mask.getPrimitiveMask())) { match = false; } else if (mask.getTagMask() != null && token!=null && token.getMorphologicalTag() != null) { match = match & !token.getMorphologicalTag().matchExact(mask.getTagMask(),false); } else if (mask.getTagReference() != null && token!=null && token.getMorphologicalTag() != null) { match = match & !token.getMorphologicalTag().match(RuleUtils.createTagMaskFromReference(mask.getTagReference(), sentence, baseTokenIndex), false); } else if (mask.getOutOfBounds() != null && (baseTokenIndex == 0 || baseTokenIndex == sentence.getTokens().size() -1)) { match = false; } } } return match; }
java
private boolean match(Token token, Element element, int baseTokenIndex, Sentence sentence) { boolean match; boolean negated; // Sees if the mask must or not match. // Negated is optional, so it can be null, true or false. // If null, consider as false. if (element.isNegated() == null) { match = false; negated = false; } else { match = element.isNegated().booleanValue(); negated = element.isNegated().booleanValue(); } for (Mask mask : element.getMask()) { // If the token must match the mask. if (!negated) { // If not negated, match starts as false and just one match is needed to make it true. if (mask.getLexemeMask() != null && mask.getLexemeMask().equalsIgnoreCase(token.getLexeme())) { match = true; } else if (mask.getPrimitiveMask() != null && matchLemma(token, mask.getPrimitiveMask())) { match = true; } else if (mask.getTagMask() != null && token.getMorphologicalTag() != null) { match = match | token.getMorphologicalTag().matchExact(mask.getTagMask(), false); } else if (mask.getTagReference() != null && token.getMorphologicalTag() != null) { match = match | token.getMorphologicalTag().match(RuleUtils.createTagMaskFromReference(mask.getTagReference(), sentence, baseTokenIndex), false); } else if (mask.getOutOfBounds() != null && (baseTokenIndex == 0 || baseTokenIndex == sentence.getTokens().size() -1)) { match = false; } } else { // The token must NOT match the mask. // If negated, match starts as true and just one match is needed to make it false. if (mask.getLexemeMask() != null && mask.getLexemeMask().equalsIgnoreCase(token.getLexeme())) { match = false; } else if (mask.getPrimitiveMask() != null && matchLemma(token, mask.getPrimitiveMask())) { match = false; } else if (mask.getTagMask() != null && token!=null && token.getMorphologicalTag() != null) { match = match & !token.getMorphologicalTag().matchExact(mask.getTagMask(),false); } else if (mask.getTagReference() != null && token!=null && token.getMorphologicalTag() != null) { match = match & !token.getMorphologicalTag().match(RuleUtils.createTagMaskFromReference(mask.getTagReference(), sentence, baseTokenIndex), false); } else if (mask.getOutOfBounds() != null && (baseTokenIndex == 0 || baseTokenIndex == sentence.getTokens().size() -1)) { match = false; } } } return match; }
[ "private", "boolean", "match", "(", "Token", "token", ",", "Element", "element", ",", "int", "baseTokenIndex", ",", "Sentence", "sentence", ")", "{", "boolean", "match", ";", "boolean", "negated", ";", "// Sees if the mask must or not match.\r", "// Negated is optional, so it can be null, true or false.\r", "// If null, consider as false.\r", "if", "(", "element", ".", "isNegated", "(", ")", "==", "null", ")", "{", "match", "=", "false", ";", "negated", "=", "false", ";", "}", "else", "{", "match", "=", "element", ".", "isNegated", "(", ")", ".", "booleanValue", "(", ")", ";", "negated", "=", "element", ".", "isNegated", "(", ")", ".", "booleanValue", "(", ")", ";", "}", "for", "(", "Mask", "mask", ":", "element", ".", "getMask", "(", ")", ")", "{", "// If the token must match the mask.\r", "if", "(", "!", "negated", ")", "{", "// If not negated, match starts as false and just one match is needed to make it true.\r", "if", "(", "mask", ".", "getLexemeMask", "(", ")", "!=", "null", "&&", "mask", ".", "getLexemeMask", "(", ")", ".", "equalsIgnoreCase", "(", "token", ".", "getLexeme", "(", ")", ")", ")", "{", "match", "=", "true", ";", "}", "else", "if", "(", "mask", ".", "getPrimitiveMask", "(", ")", "!=", "null", "&&", "matchLemma", "(", "token", ",", "mask", ".", "getPrimitiveMask", "(", ")", ")", ")", "{", "match", "=", "true", ";", "}", "else", "if", "(", "mask", ".", "getTagMask", "(", ")", "!=", "null", "&&", "token", ".", "getMorphologicalTag", "(", ")", "!=", "null", ")", "{", "match", "=", "match", "|", "token", ".", "getMorphologicalTag", "(", ")", ".", "matchExact", "(", "mask", ".", "getTagMask", "(", ")", ",", "false", ")", ";", "}", "else", "if", "(", "mask", ".", "getTagReference", "(", ")", "!=", "null", "&&", "token", ".", "getMorphologicalTag", "(", ")", "!=", "null", ")", "{", "match", "=", "match", "|", "token", ".", "getMorphologicalTag", "(", ")", ".", "match", "(", "RuleUtils", ".", "createTagMaskFromReference", "(", "mask", ".", "getTagReference", "(", ")", ",", "sentence", ",", "baseTokenIndex", ")", ",", "false", ")", ";", "}", "else", "if", "(", "mask", ".", "getOutOfBounds", "(", ")", "!=", "null", "&&", "(", "baseTokenIndex", "==", "0", "||", "baseTokenIndex", "==", "sentence", ".", "getTokens", "(", ")", ".", "size", "(", ")", "-", "1", ")", ")", "{", "match", "=", "false", ";", "}", "}", "else", "{", "// The token must NOT match the mask.\r", "// If negated, match starts as true and just one match is needed to make it false.\r", "if", "(", "mask", ".", "getLexemeMask", "(", ")", "!=", "null", "&&", "mask", ".", "getLexemeMask", "(", ")", ".", "equalsIgnoreCase", "(", "token", ".", "getLexeme", "(", ")", ")", ")", "{", "match", "=", "false", ";", "}", "else", "if", "(", "mask", ".", "getPrimitiveMask", "(", ")", "!=", "null", "&&", "matchLemma", "(", "token", ",", "mask", ".", "getPrimitiveMask", "(", ")", ")", ")", "{", "match", "=", "false", ";", "}", "else", "if", "(", "mask", ".", "getTagMask", "(", ")", "!=", "null", "&&", "token", "!=", "null", "&&", "token", ".", "getMorphologicalTag", "(", ")", "!=", "null", ")", "{", "match", "=", "match", "&", "!", "token", ".", "getMorphologicalTag", "(", ")", ".", "matchExact", "(", "mask", ".", "getTagMask", "(", ")", ",", "false", ")", ";", "}", "else", "if", "(", "mask", ".", "getTagReference", "(", ")", "!=", "null", "&&", "token", "!=", "null", "&&", "token", ".", "getMorphologicalTag", "(", ")", "!=", "null", ")", "{", "match", "=", "match", "&", "!", "token", ".", "getMorphologicalTag", "(", ")", ".", "match", "(", "RuleUtils", ".", "createTagMaskFromReference", "(", "mask", ".", "getTagReference", "(", ")", ",", "sentence", ",", "baseTokenIndex", ")", ",", "false", ")", ";", "}", "else", "if", "(", "mask", ".", "getOutOfBounds", "(", ")", "!=", "null", "&&", "(", "baseTokenIndex", "==", "0", "||", "baseTokenIndex", "==", "sentence", ".", "getTokens", "(", ")", ".", "size", "(", ")", "-", "1", ")", ")", "{", "match", "=", "false", ";", "}", "}", "}", "return", "match", ";", "}" ]
Determines if a token is matched by a rule element. @param token the token to be matched by the element @param element the element to be matched against the token @return <code>true</code> if there's a match, <code>false</code> otherwise
[ "Determines", "if", "a", "token", "is", "matched", "by", "a", "rule", "element", "." ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-gc/src/main/java/org/cogroo/tools/checker/rules/applier/RulesApplier.java#L433-L477
10,177
cogroo/cogroo4
lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/WizardDialog.java
WizardDialog.createWindowPeer
public XWindowPeer createWindowPeer(XWindowPeer _xWindowParentPeer) throws com.sun.star.script.BasicErrorException{ try{ if (_xWindowParentPeer == null){ XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, m_xDlgContainer); xWindow.setVisible(false); Object tk = m_xMCF.createInstanceWithContext("com.sun.star.awt.Toolkit", m_xContext); XToolkit xToolkit = (XToolkit) UnoRuntime.queryInterface(XToolkit.class, tk); mxReschedule = (XReschedule) UnoRuntime.queryInterface(XReschedule.class, xToolkit); m_xDialogControl.createPeer(xToolkit, _xWindowParentPeer); m_xWindowPeer = m_xDialogControl.getPeer(); return m_xWindowPeer; } } catch (com.sun.star.uno.Exception exception) { exception.printStackTrace(System.out); } return null; }
java
public XWindowPeer createWindowPeer(XWindowPeer _xWindowParentPeer) throws com.sun.star.script.BasicErrorException{ try{ if (_xWindowParentPeer == null){ XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, m_xDlgContainer); xWindow.setVisible(false); Object tk = m_xMCF.createInstanceWithContext("com.sun.star.awt.Toolkit", m_xContext); XToolkit xToolkit = (XToolkit) UnoRuntime.queryInterface(XToolkit.class, tk); mxReschedule = (XReschedule) UnoRuntime.queryInterface(XReschedule.class, xToolkit); m_xDialogControl.createPeer(xToolkit, _xWindowParentPeer); m_xWindowPeer = m_xDialogControl.getPeer(); return m_xWindowPeer; } } catch (com.sun.star.uno.Exception exception) { exception.printStackTrace(System.out); } return null; }
[ "public", "XWindowPeer", "createWindowPeer", "(", "XWindowPeer", "_xWindowParentPeer", ")", "throws", "com", ".", "sun", ".", "star", ".", "script", ".", "BasicErrorException", "{", "try", "{", "if", "(", "_xWindowParentPeer", "==", "null", ")", "{", "XWindow", "xWindow", "=", "(", "XWindow", ")", "UnoRuntime", ".", "queryInterface", "(", "XWindow", ".", "class", ",", "m_xDlgContainer", ")", ";", "xWindow", ".", "setVisible", "(", "false", ")", ";", "Object", "tk", "=", "m_xMCF", ".", "createInstanceWithContext", "(", "\"com.sun.star.awt.Toolkit\"", ",", "m_xContext", ")", ";", "XToolkit", "xToolkit", "=", "(", "XToolkit", ")", "UnoRuntime", ".", "queryInterface", "(", "XToolkit", ".", "class", ",", "tk", ")", ";", "mxReschedule", "=", "(", "XReschedule", ")", "UnoRuntime", ".", "queryInterface", "(", "XReschedule", ".", "class", ",", "xToolkit", ")", ";", "m_xDialogControl", ".", "createPeer", "(", "xToolkit", ",", "_xWindowParentPeer", ")", ";", "m_xWindowPeer", "=", "m_xDialogControl", ".", "getPeer", "(", ")", ";", "return", "m_xWindowPeer", ";", "}", "}", "catch", "(", "com", ".", "sun", ".", "star", ".", "uno", ".", "Exception", "exception", ")", "{", "exception", ".", "printStackTrace", "(", "System", ".", "out", ")", ";", "}", "return", "null", ";", "}" ]
create a peer for this dialog, using the given peer as a parent. @param parentPeer @return @throws java.lang.Exception
[ "create", "a", "peer", "for", "this", "dialog", "using", "the", "given", "peer", "as", "a", "parent", "." ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/WizardDialog.java#L198-L214
10,178
cogroo/cogroo4
lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/WizardDialog.java
WizardDialog.getWindowPeer
public XWindowPeer getWindowPeer(XTextDocument _xTextDocument){ XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, _xTextDocument); XFrame xFrame = xModel.getCurrentController().getFrame(); XWindow xWindow = xFrame.getContainerWindow(); XWindowPeer xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xWindow); return xWindowPeer; }
java
public XWindowPeer getWindowPeer(XTextDocument _xTextDocument){ XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, _xTextDocument); XFrame xFrame = xModel.getCurrentController().getFrame(); XWindow xWindow = xFrame.getContainerWindow(); XWindowPeer xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xWindow); return xWindowPeer; }
[ "public", "XWindowPeer", "getWindowPeer", "(", "XTextDocument", "_xTextDocument", ")", "{", "XModel", "xModel", "=", "(", "XModel", ")", "UnoRuntime", ".", "queryInterface", "(", "XModel", ".", "class", ",", "_xTextDocument", ")", ";", "XFrame", "xFrame", "=", "xModel", ".", "getCurrentController", "(", ")", ".", "getFrame", "(", ")", ";", "XWindow", "xWindow", "=", "xFrame", ".", "getContainerWindow", "(", ")", ";", "XWindowPeer", "xWindowPeer", "=", "(", "XWindowPeer", ")", "UnoRuntime", ".", "queryInterface", "(", "XWindowPeer", ".", "class", ",", "xWindow", ")", ";", "return", "xWindowPeer", ";", "}" ]
gets the WindowPeer of a frame @param _XTextDocument the instance of a textdocument @return the windowpeer of the frame
[ "gets", "the", "WindowPeer", "of", "a", "frame" ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/WizardDialog.java#L1212-L1218
10,179
cogroo/cogroo4
lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/WizardDialog.java
WizardDialog.insertRoadmapItem
public void insertRoadmapItem(int Index, boolean _bEnabled, String _sLabel, int _ID) { try { // a roadmap is a SingleServiceFactory that can only create roadmapitems that are the only possible // element types of the container Object oRoadmapItem = m_xSSFRoadmap.createInstance(); XPropertySet xRMItemPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oRoadmapItem); xRMItemPSet.setPropertyValue("Label", _sLabel); // sometimes steps are supposed to be set disabled depending on the program logic... xRMItemPSet.setPropertyValue("Enabled", new Boolean(_bEnabled)); // in this context the "ID" is meant to refer to a step of the dialog xRMItemPSet.setPropertyValue("ID", new Integer(_ID)); m_xRMIndexCont.insertByIndex(Index, oRoadmapItem); } catch (com.sun.star.uno.Exception exception) { exception.printStackTrace(System.out); } }
java
public void insertRoadmapItem(int Index, boolean _bEnabled, String _sLabel, int _ID) { try { // a roadmap is a SingleServiceFactory that can only create roadmapitems that are the only possible // element types of the container Object oRoadmapItem = m_xSSFRoadmap.createInstance(); XPropertySet xRMItemPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oRoadmapItem); xRMItemPSet.setPropertyValue("Label", _sLabel); // sometimes steps are supposed to be set disabled depending on the program logic... xRMItemPSet.setPropertyValue("Enabled", new Boolean(_bEnabled)); // in this context the "ID" is meant to refer to a step of the dialog xRMItemPSet.setPropertyValue("ID", new Integer(_ID)); m_xRMIndexCont.insertByIndex(Index, oRoadmapItem); } catch (com.sun.star.uno.Exception exception) { exception.printStackTrace(System.out); } }
[ "public", "void", "insertRoadmapItem", "(", "int", "Index", ",", "boolean", "_bEnabled", ",", "String", "_sLabel", ",", "int", "_ID", ")", "{", "try", "{", "// a roadmap is a SingleServiceFactory that can only create roadmapitems that are the only possible", "// element types of the container", "Object", "oRoadmapItem", "=", "m_xSSFRoadmap", ".", "createInstance", "(", ")", ";", "XPropertySet", "xRMItemPSet", "=", "(", "XPropertySet", ")", "UnoRuntime", ".", "queryInterface", "(", "XPropertySet", ".", "class", ",", "oRoadmapItem", ")", ";", "xRMItemPSet", ".", "setPropertyValue", "(", "\"Label\"", ",", "_sLabel", ")", ";", "// sometimes steps are supposed to be set disabled depending on the program logic...", "xRMItemPSet", ".", "setPropertyValue", "(", "\"Enabled\"", ",", "new", "Boolean", "(", "_bEnabled", ")", ")", ";", "// in this context the \"ID\" is meant to refer to a step of the dialog", "xRMItemPSet", ".", "setPropertyValue", "(", "\"ID\"", ",", "new", "Integer", "(", "_ID", ")", ")", ";", "m_xRMIndexCont", ".", "insertByIndex", "(", "Index", ",", "oRoadmapItem", ")", ";", "}", "catch", "(", "com", ".", "sun", ".", "star", ".", "uno", ".", "Exception", "exception", ")", "{", "exception", ".", "printStackTrace", "(", "System", ".", "out", ")", ";", "}", "}" ]
To fully understand the example one has to be aware that the passed ???Index??? parameter refers to the position of the roadmap item in the roadmapmodel container whereas the variable ???_ID??? directyl references to a certain step of dialog.
[ "To", "fully", "understand", "the", "example", "one", "has", "to", "be", "aware", "that", "the", "passed", "???Index???", "parameter", "refers", "to", "the", "position", "of", "the", "roadmap", "item", "in", "the", "roadmapmodel", "container", "whereas", "the", "variable", "???_ID???", "directyl", "references", "to", "a", "certain", "step", "of", "dialog", "." ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/WizardDialog.java#L1489-L1504
10,180
cogroo/cogroo4
cogroo-eval/TypeSystem/src/main/java/cogroo/uima/GoldenSentence.java
GoldenSentence.getGoldenGrammarErrors
public FSArray getGoldenGrammarErrors() { if (GoldenSentence_Type.featOkTst && ((GoldenSentence_Type) jcasType).casFeat_goldenGrammarErrors == null) jcasType.jcas.throwFeatMissing("goldenGrammarErrors", "cogroo.uima.GoldenSentence"); return (FSArray) (jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas .ll_getRefValue(addr, ((GoldenSentence_Type) jcasType).casFeatCode_goldenGrammarErrors))); }
java
public FSArray getGoldenGrammarErrors() { if (GoldenSentence_Type.featOkTst && ((GoldenSentence_Type) jcasType).casFeat_goldenGrammarErrors == null) jcasType.jcas.throwFeatMissing("goldenGrammarErrors", "cogroo.uima.GoldenSentence"); return (FSArray) (jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas .ll_getRefValue(addr, ((GoldenSentence_Type) jcasType).casFeatCode_goldenGrammarErrors))); }
[ "public", "FSArray", "getGoldenGrammarErrors", "(", ")", "{", "if", "(", "GoldenSentence_Type", ".", "featOkTst", "&&", "(", "(", "GoldenSentence_Type", ")", "jcasType", ")", ".", "casFeat_goldenGrammarErrors", "==", "null", ")", "jcasType", ".", "jcas", ".", "throwFeatMissing", "(", "\"goldenGrammarErrors\"", ",", "\"cogroo.uima.GoldenSentence\"", ")", ";", "return", "(", "FSArray", ")", "(", "jcasType", ".", "ll_cas", ".", "ll_getFSForRef", "(", "jcasType", ".", "ll_cas", ".", "ll_getRefValue", "(", "addr", ",", "(", "(", "GoldenSentence_Type", ")", "jcasType", ")", ".", "casFeatCode_goldenGrammarErrors", ")", ")", ")", ";", "}" ]
getter for goldenGrammarErrors - gets @generated
[ "getter", "for", "goldenGrammarErrors", "-", "gets" ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-eval/TypeSystem/src/main/java/cogroo/uima/GoldenSentence.java#L129-L137
10,181
cogroo/cogroo4
cogroo-eval/TypeSystem/src/main/java/cogroo/uima/GoldenSentence.java
GoldenSentence.setGoldenGrammarErrors
public void setGoldenGrammarErrors(FSArray v) { if (GoldenSentence_Type.featOkTst && ((GoldenSentence_Type) jcasType).casFeat_goldenGrammarErrors == null) jcasType.jcas.throwFeatMissing("goldenGrammarErrors", "cogroo.uima.GoldenSentence"); jcasType.ll_cas.ll_setRefValue(addr, ((GoldenSentence_Type) jcasType).casFeatCode_goldenGrammarErrors, jcasType.ll_cas.ll_getFSRef(v)); }
java
public void setGoldenGrammarErrors(FSArray v) { if (GoldenSentence_Type.featOkTst && ((GoldenSentence_Type) jcasType).casFeat_goldenGrammarErrors == null) jcasType.jcas.throwFeatMissing("goldenGrammarErrors", "cogroo.uima.GoldenSentence"); jcasType.ll_cas.ll_setRefValue(addr, ((GoldenSentence_Type) jcasType).casFeatCode_goldenGrammarErrors, jcasType.ll_cas.ll_getFSRef(v)); }
[ "public", "void", "setGoldenGrammarErrors", "(", "FSArray", "v", ")", "{", "if", "(", "GoldenSentence_Type", ".", "featOkTst", "&&", "(", "(", "GoldenSentence_Type", ")", "jcasType", ")", ".", "casFeat_goldenGrammarErrors", "==", "null", ")", "jcasType", ".", "jcas", ".", "throwFeatMissing", "(", "\"goldenGrammarErrors\"", ",", "\"cogroo.uima.GoldenSentence\"", ")", ";", "jcasType", ".", "ll_cas", ".", "ll_setRefValue", "(", "addr", ",", "(", "(", "GoldenSentence_Type", ")", "jcasType", ")", ".", "casFeatCode_goldenGrammarErrors", ",", "jcasType", ".", "ll_cas", ".", "ll_getFSRef", "(", "v", ")", ")", ";", "}" ]
setter for goldenGrammarErrors - sets @generated
[ "setter", "for", "goldenGrammarErrors", "-", "sets" ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-eval/TypeSystem/src/main/java/cogroo/uima/GoldenSentence.java#L144-L152
10,182
cogroo/cogroo4
cogroo-eval/TypeSystem/src/main/java/cogroo/uima/GoldenSentence.java
GoldenSentence.getGoldenGrammarErrors
public GoldenGrammarError getGoldenGrammarErrors(int i) { if (GoldenSentence_Type.featOkTst && ((GoldenSentence_Type) jcasType).casFeat_goldenGrammarErrors == null) jcasType.jcas.throwFeatMissing("goldenGrammarErrors", "cogroo.uima.GoldenSentence"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((GoldenSentence_Type) jcasType).casFeatCode_goldenGrammarErrors), i); return (GoldenGrammarError) (jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas .ll_getRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((GoldenSentence_Type) jcasType).casFeatCode_goldenGrammarErrors), i))); }
java
public GoldenGrammarError getGoldenGrammarErrors(int i) { if (GoldenSentence_Type.featOkTst && ((GoldenSentence_Type) jcasType).casFeat_goldenGrammarErrors == null) jcasType.jcas.throwFeatMissing("goldenGrammarErrors", "cogroo.uima.GoldenSentence"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((GoldenSentence_Type) jcasType).casFeatCode_goldenGrammarErrors), i); return (GoldenGrammarError) (jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas .ll_getRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((GoldenSentence_Type) jcasType).casFeatCode_goldenGrammarErrors), i))); }
[ "public", "GoldenGrammarError", "getGoldenGrammarErrors", "(", "int", "i", ")", "{", "if", "(", "GoldenSentence_Type", ".", "featOkTst", "&&", "(", "(", "GoldenSentence_Type", ")", "jcasType", ")", ".", "casFeat_goldenGrammarErrors", "==", "null", ")", "jcasType", ".", "jcas", ".", "throwFeatMissing", "(", "\"goldenGrammarErrors\"", ",", "\"cogroo.uima.GoldenSentence\"", ")", ";", "jcasType", ".", "jcas", ".", "checkArrayBounds", "(", "jcasType", ".", "ll_cas", ".", "ll_getRefValue", "(", "addr", ",", "(", "(", "GoldenSentence_Type", ")", "jcasType", ")", ".", "casFeatCode_goldenGrammarErrors", ")", ",", "i", ")", ";", "return", "(", "GoldenGrammarError", ")", "(", "jcasType", ".", "ll_cas", ".", "ll_getFSForRef", "(", "jcasType", ".", "ll_cas", ".", "ll_getRefArrayValue", "(", "jcasType", ".", "ll_cas", ".", "ll_getRefValue", "(", "addr", ",", "(", "(", "GoldenSentence_Type", ")", "jcasType", ")", ".", "casFeatCode_goldenGrammarErrors", ")", ",", "i", ")", ")", ")", ";", "}" ]
indexed getter for goldenGrammarErrors - gets an indexed value - @generated
[ "indexed", "getter", "for", "goldenGrammarErrors", "-", "gets", "an", "indexed", "value", "-" ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-eval/TypeSystem/src/main/java/cogroo/uima/GoldenSentence.java#L159-L170
10,183
cogroo/cogroo4
cogroo-eval/TypeSystem/src/main/java/cogroo/uima/GoldenSentence.java
GoldenSentence.setGoldenGrammarErrors
public void setGoldenGrammarErrors(int i, GoldenGrammarError v) { if (GoldenSentence_Type.featOkTst && ((GoldenSentence_Type) jcasType).casFeat_goldenGrammarErrors == null) jcasType.jcas.throwFeatMissing("goldenGrammarErrors", "cogroo.uima.GoldenSentence"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((GoldenSentence_Type) jcasType).casFeatCode_goldenGrammarErrors), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((GoldenSentence_Type) jcasType).casFeatCode_goldenGrammarErrors), i, jcasType.ll_cas.ll_getFSRef(v)); }
java
public void setGoldenGrammarErrors(int i, GoldenGrammarError v) { if (GoldenSentence_Type.featOkTst && ((GoldenSentence_Type) jcasType).casFeat_goldenGrammarErrors == null) jcasType.jcas.throwFeatMissing("goldenGrammarErrors", "cogroo.uima.GoldenSentence"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((GoldenSentence_Type) jcasType).casFeatCode_goldenGrammarErrors), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((GoldenSentence_Type) jcasType).casFeatCode_goldenGrammarErrors), i, jcasType.ll_cas.ll_getFSRef(v)); }
[ "public", "void", "setGoldenGrammarErrors", "(", "int", "i", ",", "GoldenGrammarError", "v", ")", "{", "if", "(", "GoldenSentence_Type", ".", "featOkTst", "&&", "(", "(", "GoldenSentence_Type", ")", "jcasType", ")", ".", "casFeat_goldenGrammarErrors", "==", "null", ")", "jcasType", ".", "jcas", ".", "throwFeatMissing", "(", "\"goldenGrammarErrors\"", ",", "\"cogroo.uima.GoldenSentence\"", ")", ";", "jcasType", ".", "jcas", ".", "checkArrayBounds", "(", "jcasType", ".", "ll_cas", ".", "ll_getRefValue", "(", "addr", ",", "(", "(", "GoldenSentence_Type", ")", "jcasType", ")", ".", "casFeatCode_goldenGrammarErrors", ")", ",", "i", ")", ";", "jcasType", ".", "ll_cas", ".", "ll_setRefArrayValue", "(", "jcasType", ".", "ll_cas", ".", "ll_getRefValue", "(", "addr", ",", "(", "(", "GoldenSentence_Type", ")", "jcasType", ")", ".", "casFeatCode_goldenGrammarErrors", ")", ",", "i", ",", "jcasType", ".", "ll_cas", ".", "ll_getFSRef", "(", "v", ")", ")", ";", "}" ]
indexed setter for goldenGrammarErrors - sets an indexed value - @generated
[ "indexed", "setter", "for", "goldenGrammarErrors", "-", "sets", "an", "indexed", "value", "-" ]
b6228900c20c6b37eac10a03708a9669dd562f52
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-eval/TypeSystem/src/main/java/cogroo/uima/GoldenSentence.java#L177-L187
10,184
opsmatters/newrelic-api
src/main/java/com/opsmatters/newrelic/api/util/Utils.java
Utils.getFormattedDateTime
static public String getFormattedDateTime(long dt, TimeZone tz, String format) { SimpleDateFormat df = new SimpleDateFormat(format); if(tz != null) df.setTimeZone(tz); return df.format(new Date(dt)); }
java
static public String getFormattedDateTime(long dt, TimeZone tz, String format) { SimpleDateFormat df = new SimpleDateFormat(format); if(tz != null) df.setTimeZone(tz); return df.format(new Date(dt)); }
[ "static", "public", "String", "getFormattedDateTime", "(", "long", "dt", ",", "TimeZone", "tz", ",", "String", "format", ")", "{", "SimpleDateFormat", "df", "=", "new", "SimpleDateFormat", "(", "format", ")", ";", "if", "(", "tz", "!=", "null", ")", "df", ".", "setTimeZone", "(", "tz", ")", ";", "return", "df", ".", "format", "(", "new", "Date", "(", "dt", ")", ")", ";", "}" ]
Returns the given date time formatted using the given format and timezone. @param dt The date to format (in milliseconds) @param tz The timezone for the date (or null) @param format The format to use for the date @return The formatted date
[ "Returns", "the", "given", "date", "time", "formatted", "using", "the", "given", "format", "and", "timezone", "." ]
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/util/Utils.java#L59-L65
10,185
Sciss/abc4j
abc/src/main/java/abc/notation/Accidental.java
Accidental.getNearestOccidentalValue
public byte getNearestOccidentalValue() { if (m_value == _NONE || m_value == _NATURAL) return 0; if ((m_value == _DOUBLE_FLAT) || (m_value == _DOUBLE_SHARP)) return (byte)m_value; if (m_value < 0) return -1;//flat if (m_value > 0) return 1;//sharp return 0; }
java
public byte getNearestOccidentalValue() { if (m_value == _NONE || m_value == _NATURAL) return 0; if ((m_value == _DOUBLE_FLAT) || (m_value == _DOUBLE_SHARP)) return (byte)m_value; if (m_value < 0) return -1;//flat if (m_value > 0) return 1;//sharp return 0; }
[ "public", "byte", "getNearestOccidentalValue", "(", ")", "{", "if", "(", "m_value", "==", "_NONE", "||", "m_value", "==", "_NATURAL", ")", "return", "0", ";", "if", "(", "(", "m_value", "==", "_DOUBLE_FLAT", ")", "||", "(", "m_value", "==", "_DOUBLE_SHARP", ")", ")", "return", "(", "byte", ")", "m_value", ";", "if", "(", "m_value", "<", "0", ")", "return", "-", "1", ";", "//flat", "if", "(", "m_value", ">", "0", ")", "return", "1", ";", "//sharp", "return", "0", ";", "}" ]
Return the nearest non microtonal semitone e.g. flat (-1) for a half-flat or flat-and-half
[ "Return", "the", "nearest", "non", "microtonal", "semitone" ]
117b405642c84a7bfca4e3e13668838258b90ca7
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/Accidental.java#L120-L130
10,186
opsmatters/newrelic-api
src/main/java/com/opsmatters/newrelic/api/util/QueryParameterList.java
QueryParameterList.add
public boolean add(String name, Object value) { if(name == null) throw new NullPointerException("name == null"); add(name); add(value.toString()); return true; }
java
public boolean add(String name, Object value) { if(name == null) throw new NullPointerException("name == null"); add(name); add(value.toString()); return true; }
[ "public", "boolean", "add", "(", "String", "name", ",", "Object", "value", ")", "{", "if", "(", "name", "==", "null", ")", "throw", "new", "NullPointerException", "(", "\"name == null\"", ")", ";", "add", "(", "name", ")", ";", "add", "(", "value", ".", "toString", "(", ")", ")", ";", "return", "true", ";", "}" ]
Adds the given query parameter name and value. @param name The name of the parameter @param value The value of the parameter @return <CODE>true</CODE> if the add was successful
[ "Adds", "the", "given", "query", "parameter", "name", "and", "value", "." ]
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/util/QueryParameterList.java#L35-L42
10,187
Sciss/abc4j
abc/src/main/java/abc/notation/TuneInfos.java
TuneInfos.add
public void add(byte b, Collection c) { if ((c != null) && (c.size() > 0)) { String s2 = get(b); for (Object aC : c) { String s = (String) aC; if (s2 == null) s2 = s; else s2 += lineSeparator + s; } set(b, s2); } }
java
public void add(byte b, Collection c) { if ((c != null) && (c.size() > 0)) { String s2 = get(b); for (Object aC : c) { String s = (String) aC; if (s2 == null) s2 = s; else s2 += lineSeparator + s; } set(b, s2); } }
[ "public", "void", "add", "(", "byte", "b", ",", "Collection", "c", ")", "{", "if", "(", "(", "c", "!=", "null", ")", "&&", "(", "c", ".", "size", "(", ")", ">", "0", ")", ")", "{", "String", "s2", "=", "get", "(", "b", ")", ";", "for", "(", "Object", "aC", ":", "c", ")", "{", "String", "s", "=", "(", "String", ")", "aC", ";", "if", "(", "s2", "==", "null", ")", "s2", "=", "s", ";", "else", "s2", "+=", "lineSeparator", "+", "s", ";", "}", "set", "(", "b", ",", "s2", ")", ";", "}", "}" ]
Add each element of collection c as new lines in field b
[ "Add", "each", "element", "of", "collection", "c", "as", "new", "lines", "in", "field", "b" ]
117b405642c84a7bfca4e3e13668838258b90ca7
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/TuneInfos.java#L124-L136
10,188
Sciss/abc4j
abc/src/main/java/abc/notation/TuneInfos.java
TuneInfos.add
public void add(byte b, String s) { if (s != null) { String s2 = get(b); if (s2 == null) s2 = s; else s2 += lineSeparator + s; set(b, s2); } }
java
public void add(byte b, String s) { if (s != null) { String s2 = get(b); if (s2 == null) s2 = s; else s2 += lineSeparator + s; set(b, s2); } }
[ "public", "void", "add", "(", "byte", "b", ",", "String", "s", ")", "{", "if", "(", "s", "!=", "null", ")", "{", "String", "s2", "=", "get", "(", "b", ")", ";", "if", "(", "s2", "==", "null", ")", "s2", "=", "s", ";", "else", "s2", "+=", "lineSeparator", "+", "s", ";", "set", "(", "b", ",", "s2", ")", ";", "}", "}" ]
Add the string s as new line to field b
[ "Add", "the", "string", "s", "as", "new", "line", "to", "field", "b" ]
117b405642c84a7bfca4e3e13668838258b90ca7
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/TuneInfos.java#L139-L148
10,189
Sciss/abc4j
abc/src/main/java/abc/notation/TuneInfos.java
TuneInfos.get
public String get(byte b) { Object o = m_infos.get(key(b)); String o2 = null; if (m_bookInfos != null) o2 = m_bookInfos.get(b); if ((o == null) && (o2 == null)) return null; else { String ret = ""; if (o != null) { ret += (String)o; if (o2 != null) ret += lineSeparator; } if (o2 != null) ret += o2; return ret; } }
java
public String get(byte b) { Object o = m_infos.get(key(b)); String o2 = null; if (m_bookInfos != null) o2 = m_bookInfos.get(b); if ((o == null) && (o2 == null)) return null; else { String ret = ""; if (o != null) { ret += (String)o; if (o2 != null) ret += lineSeparator; } if (o2 != null) ret += o2; return ret; } }
[ "public", "String", "get", "(", "byte", "b", ")", "{", "Object", "o", "=", "m_infos", ".", "get", "(", "key", "(", "b", ")", ")", ";", "String", "o2", "=", "null", ";", "if", "(", "m_bookInfos", "!=", "null", ")", "o2", "=", "m_bookInfos", ".", "get", "(", "b", ")", ";", "if", "(", "(", "o", "==", "null", ")", "&&", "(", "o2", "==", "null", ")", ")", "return", "null", ";", "else", "{", "String", "ret", "=", "\"\"", ";", "if", "(", "o", "!=", "null", ")", "{", "ret", "+=", "(", "String", ")", "o", ";", "if", "(", "o2", "!=", "null", ")", "ret", "+=", "lineSeparator", ";", "}", "if", "(", "o2", "!=", "null", ")", "ret", "+=", "o2", ";", "return", "ret", ";", "}", "}" ]
Returns the whole content of field b, null if not defined
[ "Returns", "the", "whole", "content", "of", "field", "b", "null", "if", "not", "defined" ]
117b405642c84a7bfca4e3e13668838258b90ca7
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/TuneInfos.java#L168-L186
10,190
Sciss/abc4j
abc/src/main/java/abc/notation/TuneInfos.java
TuneInfos.getAsCollection
public Collection getAsCollection(byte b) { String[] lines = getAsStringArray(b); if (lines == null) return new ArrayList(); else return arrayToCollection(lines); }
java
public Collection getAsCollection(byte b) { String[] lines = getAsStringArray(b); if (lines == null) return new ArrayList(); else return arrayToCollection(lines); }
[ "public", "Collection", "getAsCollection", "(", "byte", "b", ")", "{", "String", "[", "]", "lines", "=", "getAsStringArray", "(", "b", ")", ";", "if", "(", "lines", "==", "null", ")", "return", "new", "ArrayList", "(", ")", ";", "else", "return", "arrayToCollection", "(", "lines", ")", ";", "}" ]
Returns the content of field b, as a collection, each line is an element of the collection
[ "Returns", "the", "content", "of", "field", "b", "as", "a", "collection", "each", "line", "is", "an", "element", "of", "the", "collection" ]
117b405642c84a7bfca4e3e13668838258b90ca7
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/TuneInfos.java#L192-L198
10,191
Sciss/abc4j
abc/src/main/java/abc/notation/TuneInfos.java
TuneInfos.getAsStringArray
public String[] getAsStringArray(byte b) { String s = get(b); if (s == null) return null; else return s.split(lineSeparator+""); }
java
public String[] getAsStringArray(byte b) { String s = get(b); if (s == null) return null; else return s.split(lineSeparator+""); }
[ "public", "String", "[", "]", "getAsStringArray", "(", "byte", "b", ")", "{", "String", "s", "=", "get", "(", "b", ")", ";", "if", "(", "s", "==", "null", ")", "return", "null", ";", "else", "return", "s", ".", "split", "(", "lineSeparator", "+", "\"\"", ")", ";", "}" ]
Returns the content of field b, as a string array, each line is an element in the array
[ "Returns", "the", "content", "of", "field", "b", "as", "a", "string", "array", "each", "line", "is", "an", "element", "in", "the", "array" ]
117b405642c84a7bfca4e3e13668838258b90ca7
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/TuneInfos.java#L204-L210
10,192
Sciss/abc4j
abc/src/main/java/abc/notation/TuneInfos.java
TuneInfos.remove
public void remove(byte b, String s) { Collection c = getAsCollection(b); c.remove(s); set(b, c); }
java
public void remove(byte b, String s) { Collection c = getAsCollection(b); c.remove(s); set(b, c); }
[ "public", "void", "remove", "(", "byte", "b", ",", "String", "s", ")", "{", "Collection", "c", "=", "getAsCollection", "(", "b", ")", ";", "c", ".", "remove", "(", "s", ")", ";", "set", "(", "b", ",", "c", ")", ";", "}" ]
Remove the line s from the field b
[ "Remove", "the", "line", "s", "from", "the", "field", "b" ]
117b405642c84a7bfca4e3e13668838258b90ca7
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/TuneInfos.java#L229-L233
10,193
Sciss/abc4j
abc/src/main/java/abc/notation/TuneInfos.java
TuneInfos.set
public void set(byte b, String s) { if ((s != null) && (s.length() > 0)) m_infos.put(key(b), s); else remove(b); }
java
public void set(byte b, String s) { if ((s != null) && (s.length() > 0)) m_infos.put(key(b), s); else remove(b); }
[ "public", "void", "set", "(", "byte", "b", ",", "String", "s", ")", "{", "if", "(", "(", "s", "!=", "null", ")", "&&", "(", "s", ".", "length", "(", ")", ">", "0", ")", ")", "m_infos", ".", "put", "(", "key", "(", "b", ")", ",", "s", ")", ";", "else", "remove", "(", "b", ")", ";", "}" ]
Set the whole content of field b
[ "Set", "the", "whole", "content", "of", "field", "b" ]
117b405642c84a7bfca4e3e13668838258b90ca7
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/TuneInfos.java#L255-L260
10,194
opsmatters/newrelic-api
src/main/java/com/opsmatters/newrelic/api/services/MobileApplicationService.java
MobileApplicationService.list
public Collection<MobileApplication> list(List<String> queryParams) { return HTTP.GET("/v2/mobile_applications.json", null, queryParams, MOBILE_APPLICATIONS).get(); }
java
public Collection<MobileApplication> list(List<String> queryParams) { return HTTP.GET("/v2/mobile_applications.json", null, queryParams, MOBILE_APPLICATIONS).get(); }
[ "public", "Collection", "<", "MobileApplication", ">", "list", "(", "List", "<", "String", ">", "queryParams", ")", "{", "return", "HTTP", ".", "GET", "(", "\"/v2/mobile_applications.json\"", ",", "null", ",", "queryParams", ",", "MOBILE_APPLICATIONS", ")", ".", "get", "(", ")", ";", "}" ]
Returns the set of Mobile applications with the given query parameters. @param queryParams The query parameters @return The set of applications
[ "Returns", "the", "set", "of", "Mobile", "applications", "with", "the", "given", "query", "parameters", "." ]
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/MobileApplicationService.java#L51-L54
10,195
opsmatters/newrelic-api
src/main/java/com/opsmatters/newrelic/api/services/MobileApplicationService.java
MobileApplicationService.list
public Collection<MobileApplication> list(String name) { List<MobileApplication> ret = new ArrayList<MobileApplication>(); Collection<MobileApplication> applications = list(); for(MobileApplication application : applications) { if(name == null || application.getName().equals(name)) ret.add(application); } return ret; }
java
public Collection<MobileApplication> list(String name) { List<MobileApplication> ret = new ArrayList<MobileApplication>(); Collection<MobileApplication> applications = list(); for(MobileApplication application : applications) { if(name == null || application.getName().equals(name)) ret.add(application); } return ret; }
[ "public", "Collection", "<", "MobileApplication", ">", "list", "(", "String", "name", ")", "{", "List", "<", "MobileApplication", ">", "ret", "=", "new", "ArrayList", "<", "MobileApplication", ">", "(", ")", ";", "Collection", "<", "MobileApplication", ">", "applications", "=", "list", "(", ")", ";", "for", "(", "MobileApplication", "application", ":", "applications", ")", "{", "if", "(", "name", "==", "null", "||", "application", ".", "getName", "(", ")", ".", "equals", "(", "name", ")", ")", "ret", ".", "add", "(", "application", ")", ";", "}", "return", "ret", ";", "}" ]
Returns the set of Mobile applications for the given name. @param name The name of the applications @return The set of applications
[ "Returns", "the", "set", "of", "Mobile", "applications", "for", "the", "given", "name", "." ]
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/MobileApplicationService.java#L72-L82
10,196
opsmatters/newrelic-api
src/main/java/com/opsmatters/newrelic/api/services/MobileApplicationService.java
MobileApplicationService.show
public Optional<MobileApplication> show(long applicationId) { return HTTP.GET(String.format("/v2/mobile_applications/%d.json", applicationId), MOBILE_APPLICATION); }
java
public Optional<MobileApplication> show(long applicationId) { return HTTP.GET(String.format("/v2/mobile_applications/%d.json", applicationId), MOBILE_APPLICATION); }
[ "public", "Optional", "<", "MobileApplication", ">", "show", "(", "long", "applicationId", ")", "{", "return", "HTTP", ".", "GET", "(", "String", ".", "format", "(", "\"/v2/mobile_applications/%d.json\"", ",", "applicationId", ")", ",", "MOBILE_APPLICATION", ")", ";", "}" ]
Returns the Mobile application for the given application id. @param applicationId The id for the application to return @return The application
[ "Returns", "the", "Mobile", "application", "for", "the", "given", "application", "id", "." ]
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/MobileApplicationService.java#L89-L92
10,197
opsmatters/newrelic-api
src/main/java/com/opsmatters/newrelic/api/services/MobileApplicationService.java
MobileApplicationService.metricNames
public Collection<Metric> metricNames(long applicationId, String name) { QueryParameterList queryParams = new QueryParameterList(); if(name != null && name.length() > 0) queryParams.add("name", name); return HTTP.GET(String.format("/v2/mobile_applications/%d/metrics.json", applicationId), null, queryParams, METRICS).get(); }
java
public Collection<Metric> metricNames(long applicationId, String name) { QueryParameterList queryParams = new QueryParameterList(); if(name != null && name.length() > 0) queryParams.add("name", name); return HTTP.GET(String.format("/v2/mobile_applications/%d/metrics.json", applicationId), null, queryParams, METRICS).get(); }
[ "public", "Collection", "<", "Metric", ">", "metricNames", "(", "long", "applicationId", ",", "String", "name", ")", "{", "QueryParameterList", "queryParams", "=", "new", "QueryParameterList", "(", ")", ";", "if", "(", "name", "!=", "null", "&&", "name", ".", "length", "(", ")", ">", "0", ")", "queryParams", ".", "add", "(", "\"name\"", ",", "name", ")", ";", "return", "HTTP", ".", "GET", "(", "String", ".", "format", "(", "\"/v2/mobile_applications/%d/metrics.json\"", ",", "applicationId", ")", ",", "null", ",", "queryParams", ",", "METRICS", ")", ".", "get", "(", ")", ";", "}" ]
Returns the set of metrics for the given application. @param applicationId The id of the application to return metrics for @param name Filter metrics by name (or part of name) @return The set of metrics
[ "Returns", "the", "set", "of", "metrics", "for", "the", "given", "application", "." ]
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/MobileApplicationService.java#L100-L106
10,198
opsmatters/newrelic-api
src/main/java/com/opsmatters/newrelic/api/services/MobileApplicationService.java
MobileApplicationService.metricData
public Optional<MetricData> metricData(long applicationId, List<String> queryParams) { return HTTP.GET(String.format("/v2/mobile_applications/%d/metrics/data.json", applicationId), null, queryParams, METRIC_DATA); }
java
public Optional<MetricData> metricData(long applicationId, List<String> queryParams) { return HTTP.GET(String.format("/v2/mobile_applications/%d/metrics/data.json", applicationId), null, queryParams, METRIC_DATA); }
[ "public", "Optional", "<", "MetricData", ">", "metricData", "(", "long", "applicationId", ",", "List", "<", "String", ">", "queryParams", ")", "{", "return", "HTTP", ".", "GET", "(", "String", ".", "format", "(", "\"/v2/mobile_applications/%d/metrics/data.json\"", ",", "applicationId", ")", ",", "null", ",", "queryParams", ",", "METRIC_DATA", ")", ";", "}" ]
Returns the set of metric data for the given application. @param applicationId The id of the application to return metric data for @param queryParams The query parameters @return The set of metric data
[ "Returns", "the", "set", "of", "metric", "data", "for", "the", "given", "application", "." ]
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/MobileApplicationService.java#L124-L127
10,199
opsmatters/newrelic-api
src/main/java/com/opsmatters/newrelic/api/services/BaseFluent.java
BaseFluent.encode
public static String encode(String str) { String encodedValue = str; try { encodedValue = URLEncoder.encode(encodedValue, "UTF-8"); // Spaces in NRQL queries expected to be encoded as "%20" instead of "+". encodedValue = encodedValue.replace("+", "%20"); } catch (UnsupportedEncodingException e) { logger.severe("Failed to encode value: "+str); } return encodedValue; }
java
public static String encode(String str) { String encodedValue = str; try { encodedValue = URLEncoder.encode(encodedValue, "UTF-8"); // Spaces in NRQL queries expected to be encoded as "%20" instead of "+". encodedValue = encodedValue.replace("+", "%20"); } catch (UnsupportedEncodingException e) { logger.severe("Failed to encode value: "+str); } return encodedValue; }
[ "public", "static", "String", "encode", "(", "String", "str", ")", "{", "String", "encodedValue", "=", "str", ";", "try", "{", "encodedValue", "=", "URLEncoder", ".", "encode", "(", "encodedValue", ",", "\"UTF-8\"", ")", ";", "// Spaces in NRQL queries expected to be encoded as \"%20\" instead of \"+\".", "encodedValue", "=", "encodedValue", ".", "replace", "(", "\"+\"", ",", "\"%20\"", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "logger", ".", "severe", "(", "\"Failed to encode value: \"", "+", "str", ")", ";", "}", "return", "encodedValue", ";", "}" ]
Encode special character in query string to the URL encoded representation. @param str The input string @return The encoded String
[ "Encode", "special", "character", "in", "query", "string", "to", "the", "URL", "encoded", "representation", "." ]
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/BaseFluent.java#L196-L213