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
147,900
mlhartme/sushi
src/main/java/net/oneandone/sushi/util/Strings.java
Strings.toArray
public static String[] toArray(Collection<String> coll) { String[] ar; ar = new String[coll.size()]; coll.toArray(ar); return ar; }
java
public static String[] toArray(Collection<String> coll) { String[] ar; ar = new String[coll.size()]; coll.toArray(ar); return ar; }
[ "public", "static", "String", "[", "]", "toArray", "(", "Collection", "<", "String", ">", "coll", ")", "{", "String", "[", "]", "ar", ";", "ar", "=", "new", "String", "[", "coll", ".", "size", "(", ")", "]", ";", "coll", ".", "toArray", "(", "ar", ")", ";", "return", "ar", ";", "}" ]
Turns a list of Strings into an array. @param coll collection of Strings @return never null
[ "Turns", "a", "list", "of", "Strings", "into", "an", "array", "." ]
4af33414b04bd58584d4febe5cc63ef6c7346a75
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/util/Strings.java#L282-L288
147,901
mlhartme/sushi
src/main/java/net/oneandone/sushi/util/Strings.java
Strings.escape
public static String escape(String str) { int i, max; StringBuilder result; char c; max = str.length(); for (i = 0; i < max; i++) { if (str.charAt(i) < 32) { break; } } if (i == max) { return str; } result = new StringBuilder(max + 10); for (i = 0; i < max; i++) { c = str.charAt(i); switch (c) { case '\n': result.append("\\n"); break; case '\r': result.append("\\r"); break; case '\t': result.append("\\t"); break; case '\\': result.append("\\\\"); break; default: if (c < 32) { result.append("\\u").append(Strings.padLeft(Integer.toHexString(c), 4, '0')); } else { result.append(c); } } } return result.toString(); }
java
public static String escape(String str) { int i, max; StringBuilder result; char c; max = str.length(); for (i = 0; i < max; i++) { if (str.charAt(i) < 32) { break; } } if (i == max) { return str; } result = new StringBuilder(max + 10); for (i = 0; i < max; i++) { c = str.charAt(i); switch (c) { case '\n': result.append("\\n"); break; case '\r': result.append("\\r"); break; case '\t': result.append("\\t"); break; case '\\': result.append("\\\\"); break; default: if (c < 32) { result.append("\\u").append(Strings.padLeft(Integer.toHexString(c), 4, '0')); } else { result.append(c); } } } return result.toString(); }
[ "public", "static", "String", "escape", "(", "String", "str", ")", "{", "int", "i", ",", "max", ";", "StringBuilder", "result", ";", "char", "c", ";", "max", "=", "str", ".", "length", "(", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "max", ";", "i", "++", ")", "{", "if", "(", "str", ".", "charAt", "(", "i", ")", "<", "32", ")", "{", "break", ";", "}", "}", "if", "(", "i", "==", "max", ")", "{", "return", "str", ";", "}", "result", "=", "new", "StringBuilder", "(", "max", "+", "10", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "max", ";", "i", "++", ")", "{", "c", "=", "str", ".", "charAt", "(", "i", ")", ";", "switch", "(", "c", ")", "{", "case", "'", "'", ":", "result", ".", "append", "(", "\"\\\\n\"", ")", ";", "break", ";", "case", "'", "'", ":", "result", ".", "append", "(", "\"\\\\r\"", ")", ";", "break", ";", "case", "'", "'", ":", "result", ".", "append", "(", "\"\\\\t\"", ")", ";", "break", ";", "case", "'", "'", ":", "result", ".", "append", "(", "\"\\\\\\\\\"", ")", ";", "break", ";", "default", ":", "if", "(", "c", "<", "32", ")", "{", "result", ".", "append", "(", "\"\\\\u\"", ")", ".", "append", "(", "Strings", ".", "padLeft", "(", "Integer", ".", "toHexString", "(", "c", ")", ",", "4", ",", "'", "'", ")", ")", ";", "}", "else", "{", "result", ".", "append", "(", "c", ")", ";", "}", "}", "}", "return", "result", ".", "toString", "(", ")", ";", "}" ]
escape Strings as in Java String literals
[ "escape", "Strings", "as", "in", "Java", "String", "literals" ]
4af33414b04bd58584d4febe5cc63ef6c7346a75
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/util/Strings.java#L344-L383
147,902
opendatatrentino/s-match
src/main/java/it/unitn/disi/common/components/Configurable.java
Configurable.getComponentProperties
protected static Properties getComponentProperties(String componentPrefix, Properties properties) { Properties result = new Properties(); if (null != componentPrefix) { int componentPrefixLength = componentPrefix.length(); for (String propertyName : properties.stringPropertyNames()) { if (propertyName.startsWith(componentPrefix)) { result.put(propertyName.substring(componentPrefixLength), properties.getProperty(propertyName)); } } } return result; }
java
protected static Properties getComponentProperties(String componentPrefix, Properties properties) { Properties result = new Properties(); if (null != componentPrefix) { int componentPrefixLength = componentPrefix.length(); for (String propertyName : properties.stringPropertyNames()) { if (propertyName.startsWith(componentPrefix)) { result.put(propertyName.substring(componentPrefixLength), properties.getProperty(propertyName)); } } } return result; }
[ "protected", "static", "Properties", "getComponentProperties", "(", "String", "componentPrefix", ",", "Properties", "properties", ")", "{", "Properties", "result", "=", "new", "Properties", "(", ")", ";", "if", "(", "null", "!=", "componentPrefix", ")", "{", "int", "componentPrefixLength", "=", "componentPrefix", ".", "length", "(", ")", ";", "for", "(", "String", "propertyName", ":", "properties", ".", "stringPropertyNames", "(", ")", ")", "{", "if", "(", "propertyName", ".", "startsWith", "(", "componentPrefix", ")", ")", "{", "result", ".", "put", "(", "propertyName", ".", "substring", "(", "componentPrefixLength", ")", ",", "properties", ".", "getProperty", "(", "propertyName", ")", ")", ";", "}", "}", "}", "return", "result", ";", "}" ]
Returns only properties that start with componentPrefix, removing this prefix. @param componentPrefix a prefix to search @param properties properties @return properties that start with componentPrefix
[ "Returns", "only", "properties", "that", "start", "with", "componentPrefix", "removing", "this", "prefix", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/common/components/Configurable.java#L61-L72
147,903
opendatatrentino/s-match
src/main/java/it/unitn/disi/common/components/Configurable.java
Configurable.makeComponentPrefix
protected static String makeComponentPrefix(String tokenName, String className) { String simpleClassName = className; if (null != className) { int lastDotIdx = className.lastIndexOf("."); if (lastDotIdx > -1) { simpleClassName = className.substring(lastDotIdx + 1, className.length()); } } return tokenName + "." + simpleClassName + "."; }
java
protected static String makeComponentPrefix(String tokenName, String className) { String simpleClassName = className; if (null != className) { int lastDotIdx = className.lastIndexOf("."); if (lastDotIdx > -1) { simpleClassName = className.substring(lastDotIdx + 1, className.length()); } } return tokenName + "." + simpleClassName + "."; }
[ "protected", "static", "String", "makeComponentPrefix", "(", "String", "tokenName", ",", "String", "className", ")", "{", "String", "simpleClassName", "=", "className", ";", "if", "(", "null", "!=", "className", ")", "{", "int", "lastDotIdx", "=", "className", ".", "lastIndexOf", "(", "\".\"", ")", ";", "if", "(", "lastDotIdx", ">", "-", "1", ")", "{", "simpleClassName", "=", "className", ".", "substring", "(", "lastDotIdx", "+", "1", ",", "className", ".", "length", "(", ")", ")", ";", "}", "}", "return", "tokenName", "+", "\".\"", "+", "simpleClassName", "+", "\".\"", ";", "}" ]
Creates a prefix for component to search for its properties in properties. @param tokenName a component configuration key @param className a component class name @return prefix
[ "Creates", "a", "prefix", "for", "component", "to", "search", "for", "its", "properties", "in", "properties", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/common/components/Configurable.java#L81-L90
147,904
opendatatrentino/s-match
src/main/java/it/unitn/disi/common/components/Configurable.java
Configurable.loadProperties
public static Properties loadProperties(String filename) throws ConfigurableException { log.info("Loading properties from " + filename); Properties properties = new Properties(); FileInputStream input = null; try { input = new FileInputStream(filename); properties.load(input); } catch (IOException e) { final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage(); log.error(errMessage, e); throw new ConfigurableException(errMessage, e); } finally { if (null != input) { try { input.close(); } catch (IOException e) { final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage(); log.error(errMessage, e); } } } return properties; }
java
public static Properties loadProperties(String filename) throws ConfigurableException { log.info("Loading properties from " + filename); Properties properties = new Properties(); FileInputStream input = null; try { input = new FileInputStream(filename); properties.load(input); } catch (IOException e) { final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage(); log.error(errMessage, e); throw new ConfigurableException(errMessage, e); } finally { if (null != input) { try { input.close(); } catch (IOException e) { final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage(); log.error(errMessage, e); } } } return properties; }
[ "public", "static", "Properties", "loadProperties", "(", "String", "filename", ")", "throws", "ConfigurableException", "{", "log", ".", "info", "(", "\"Loading properties from \"", "+", "filename", ")", ";", "Properties", "properties", "=", "new", "Properties", "(", ")", ";", "FileInputStream", "input", "=", "null", ";", "try", "{", "input", "=", "new", "FileInputStream", "(", "filename", ")", ";", "properties", ".", "load", "(", "input", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "final", "String", "errMessage", "=", "e", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", "+", "\": \"", "+", "e", ".", "getMessage", "(", ")", ";", "log", ".", "error", "(", "errMessage", ",", "e", ")", ";", "throw", "new", "ConfigurableException", "(", "errMessage", ",", "e", ")", ";", "}", "finally", "{", "if", "(", "null", "!=", "input", ")", "{", "try", "{", "input", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "final", "String", "errMessage", "=", "e", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", "+", "\": \"", "+", "e", ".", "getMessage", "(", ")", ";", "log", ".", "error", "(", "errMessage", ",", "e", ")", ";", "}", "}", "}", "return", "properties", ";", "}" ]
Loads the properties from the properties file. @param filename the properties file name @return Properties instance @throws ConfigurableException ConfigurableException
[ "Loads", "the", "properties", "from", "the", "properties", "file", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/common/components/Configurable.java#L192-L215
147,905
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/matchers/element/gloss/WNSemanticGlossComparison.java
WNSemanticGlossComparison.match
public char match(ISense source, ISense target) throws MatcherLibraryException { int Equals = 0; int moreGeneral = 0; int lessGeneral = 0; int Opposite = 0; String sSynset = source.getGloss(); String tSynset = target.getGloss(); StringTokenizer stSource = new StringTokenizer(sSynset, " ,.\"'()"); String lemmaS, lemmaT; while (stSource.hasMoreTokens()) { StringTokenizer stTarget = new StringTokenizer(tSynset, " ,.\"'()"); lemmaS = stSource.nextToken(); if (!meaninglessWords.contains(lemmaS)) while (stTarget.hasMoreTokens()) { lemmaT = stTarget.nextToken(); if (!meaninglessWords.contains(lemmaT)) { if (isWordLessGeneral(lemmaS, lemmaT)) lessGeneral++; else if (isWordMoreGeneral(lemmaS, lemmaT)) moreGeneral++; else if (isWordSynonym(lemmaS, lemmaT)) Equals++; else if (isWordOpposite(lemmaS, lemmaT)) Opposite++; } } } return getRelationFromInts(lessGeneral, moreGeneral, Equals, Opposite); }
java
public char match(ISense source, ISense target) throws MatcherLibraryException { int Equals = 0; int moreGeneral = 0; int lessGeneral = 0; int Opposite = 0; String sSynset = source.getGloss(); String tSynset = target.getGloss(); StringTokenizer stSource = new StringTokenizer(sSynset, " ,.\"'()"); String lemmaS, lemmaT; while (stSource.hasMoreTokens()) { StringTokenizer stTarget = new StringTokenizer(tSynset, " ,.\"'()"); lemmaS = stSource.nextToken(); if (!meaninglessWords.contains(lemmaS)) while (stTarget.hasMoreTokens()) { lemmaT = stTarget.nextToken(); if (!meaninglessWords.contains(lemmaT)) { if (isWordLessGeneral(lemmaS, lemmaT)) lessGeneral++; else if (isWordMoreGeneral(lemmaS, lemmaT)) moreGeneral++; else if (isWordSynonym(lemmaS, lemmaT)) Equals++; else if (isWordOpposite(lemmaS, lemmaT)) Opposite++; } } } return getRelationFromInts(lessGeneral, moreGeneral, Equals, Opposite); }
[ "public", "char", "match", "(", "ISense", "source", ",", "ISense", "target", ")", "throws", "MatcherLibraryException", "{", "int", "Equals", "=", "0", ";", "int", "moreGeneral", "=", "0", ";", "int", "lessGeneral", "=", "0", ";", "int", "Opposite", "=", "0", ";", "String", "sSynset", "=", "source", ".", "getGloss", "(", ")", ";", "String", "tSynset", "=", "target", ".", "getGloss", "(", ")", ";", "StringTokenizer", "stSource", "=", "new", "StringTokenizer", "(", "sSynset", ",", "\" ,.\\\"'()\"", ")", ";", "String", "lemmaS", ",", "lemmaT", ";", "while", "(", "stSource", ".", "hasMoreTokens", "(", ")", ")", "{", "StringTokenizer", "stTarget", "=", "new", "StringTokenizer", "(", "tSynset", ",", "\" ,.\\\"'()\"", ")", ";", "lemmaS", "=", "stSource", ".", "nextToken", "(", ")", ";", "if", "(", "!", "meaninglessWords", ".", "contains", "(", "lemmaS", ")", ")", "while", "(", "stTarget", ".", "hasMoreTokens", "(", ")", ")", "{", "lemmaT", "=", "stTarget", ".", "nextToken", "(", ")", ";", "if", "(", "!", "meaninglessWords", ".", "contains", "(", "lemmaT", ")", ")", "{", "if", "(", "isWordLessGeneral", "(", "lemmaS", ",", "lemmaT", ")", ")", "lessGeneral", "++", ";", "else", "if", "(", "isWordMoreGeneral", "(", "lemmaS", ",", "lemmaT", ")", ")", "moreGeneral", "++", ";", "else", "if", "(", "isWordSynonym", "(", "lemmaS", ",", "lemmaT", ")", ")", "Equals", "++", ";", "else", "if", "(", "isWordOpposite", "(", "lemmaS", ",", "lemmaT", ")", ")", "Opposite", "++", ";", "}", "}", "}", "return", "getRelationFromInts", "(", "lessGeneral", ",", "moreGeneral", ",", "Equals", ",", "Opposite", ")", ";", "}" ]
Computes the relations with WordNet semantic gloss matcher. @param source the gloss of source @param target the gloss of target @return less general, more general, equal, opposite or IDK relation
[ "Computes", "the", "relations", "with", "WordNet", "semantic", "gloss", "matcher", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/element/gloss/WNSemanticGlossComparison.java#L46-L74
147,906
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/matchers/element/string/Prefix.java
Prefix.match
public char match(String str1, String str2) { invocationCount++; char rel = IMappingElement.IDK; if (str1 == null || str2 == null) { rel = IMappingElement.IDK; } else { if ((str1.length() > 3) && (str2.length() > 3)) { if (str1.startsWith(str2)) { if (str1.contains(" ")) { rel = IMappingElement.LESS_GENERAL; } else { rel = IMappingElement.EQUIVALENCE; } } else { if (str2.startsWith(str1)) { if (str2.contains(" ")) { rel = IMappingElement.MORE_GENERAL; } else { rel = IMappingElement.EQUIVALENCE; } } } }//if ((str1.length() > 3) && (str2.length() > 3)) { } if (rel != IMappingElement.IDK) { relCount++; addCase(str1, str2, rel); } return rel; }
java
public char match(String str1, String str2) { invocationCount++; char rel = IMappingElement.IDK; if (str1 == null || str2 == null) { rel = IMappingElement.IDK; } else { if ((str1.length() > 3) && (str2.length() > 3)) { if (str1.startsWith(str2)) { if (str1.contains(" ")) { rel = IMappingElement.LESS_GENERAL; } else { rel = IMappingElement.EQUIVALENCE; } } else { if (str2.startsWith(str1)) { if (str2.contains(" ")) { rel = IMappingElement.MORE_GENERAL; } else { rel = IMappingElement.EQUIVALENCE; } } } }//if ((str1.length() > 3) && (str2.length() > 3)) { } if (rel != IMappingElement.IDK) { relCount++; addCase(str1, str2, rel); } return rel; }
[ "public", "char", "match", "(", "String", "str1", ",", "String", "str2", ")", "{", "invocationCount", "++", ";", "char", "rel", "=", "IMappingElement", ".", "IDK", ";", "if", "(", "str1", "==", "null", "||", "str2", "==", "null", ")", "{", "rel", "=", "IMappingElement", ".", "IDK", ";", "}", "else", "{", "if", "(", "(", "str1", ".", "length", "(", ")", ">", "3", ")", "&&", "(", "str2", ".", "length", "(", ")", ">", "3", ")", ")", "{", "if", "(", "str1", ".", "startsWith", "(", "str2", ")", ")", "{", "if", "(", "str1", ".", "contains", "(", "\" \"", ")", ")", "{", "rel", "=", "IMappingElement", ".", "LESS_GENERAL", ";", "}", "else", "{", "rel", "=", "IMappingElement", ".", "EQUIVALENCE", ";", "}", "}", "else", "{", "if", "(", "str2", ".", "startsWith", "(", "str1", ")", ")", "{", "if", "(", "str2", ".", "contains", "(", "\" \"", ")", ")", "{", "rel", "=", "IMappingElement", ".", "MORE_GENERAL", ";", "}", "else", "{", "rel", "=", "IMappingElement", ".", "EQUIVALENCE", ";", "}", "}", "}", "}", "//if ((str1.length() > 3) && (str2.length() > 3)) {\r", "}", "if", "(", "rel", "!=", "IMappingElement", ".", "IDK", ")", "{", "relCount", "++", ";", "addCase", "(", "str1", ",", "str2", ",", "rel", ")", ";", "}", "return", "rel", ";", "}" ]
Computes the relation with prefix matcher. @param str1 the source string @param str2 the target string @return synonym, more general, less general or IDK relation
[ "Computes", "the", "relation", "with", "prefix", "matcher", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/element/string/Prefix.java#L29-L60
147,907
Avira/couchdoop
src/main/java/com/avira/couchdoop/exp/ExportArgs.java
ExportArgs.getOperation
public static CouchbaseOperation getOperation(Configuration hadoopConfiguration) throws ArgsException { String strCouchbaseOperation = hadoopConfiguration.get(ARG_OPERATION.getPropertyName()); // Default value if (strCouchbaseOperation == null) { return CouchbaseOperation.SET; } try { return CouchbaseOperation.valueOf(strCouchbaseOperation); } catch (IllegalArgumentException e) { throw new ArgsException("Unrecognized store type '" + strCouchbaseOperation + "'. Please provide one of the following: SET, ADD, REPLACE, APPEND, PREPEND and DELETE.", e); } }
java
public static CouchbaseOperation getOperation(Configuration hadoopConfiguration) throws ArgsException { String strCouchbaseOperation = hadoopConfiguration.get(ARG_OPERATION.getPropertyName()); // Default value if (strCouchbaseOperation == null) { return CouchbaseOperation.SET; } try { return CouchbaseOperation.valueOf(strCouchbaseOperation); } catch (IllegalArgumentException e) { throw new ArgsException("Unrecognized store type '" + strCouchbaseOperation + "'. Please provide one of the following: SET, ADD, REPLACE, APPEND, PREPEND and DELETE.", e); } }
[ "public", "static", "CouchbaseOperation", "getOperation", "(", "Configuration", "hadoopConfiguration", ")", "throws", "ArgsException", "{", "String", "strCouchbaseOperation", "=", "hadoopConfiguration", ".", "get", "(", "ARG_OPERATION", ".", "getPropertyName", "(", ")", ")", ";", "// Default value", "if", "(", "strCouchbaseOperation", "==", "null", ")", "{", "return", "CouchbaseOperation", ".", "SET", ";", "}", "try", "{", "return", "CouchbaseOperation", ".", "valueOf", "(", "strCouchbaseOperation", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "throw", "new", "ArgsException", "(", "\"Unrecognized store type '\"", "+", "strCouchbaseOperation", "+", "\"'. Please provide one of the following: SET, ADD, REPLACE, APPEND, PREPEND and DELETE.\"", ",", "e", ")", ";", "}", "}" ]
Reads Couchbase store operation from the Hadoop configuration type. @param hadoopConfiguration Hadoop Configuration @return Couchbase store operation to be used @throws ArgsException in case of wrong arguments
[ "Reads", "Couchbase", "store", "operation", "from", "the", "Hadoop", "configuration", "type", "." ]
0df7792524d0cf258523c4bc510eb0df8b1132a1
https://github.com/Avira/couchdoop/blob/0df7792524d0cf258523c4bc510eb0df8b1132a1/src/main/java/com/avira/couchdoop/exp/ExportArgs.java#L96-L110
147,908
awltech/org.parallelj
parallelj-core-parent/parallelj-core-aspects/src/main/java/org/parallelj/Executables.java
Executables.attributes
public static Map<String, String> attributes(Object executable) { if (executable == null || !Aspects.hasAspect(PerExecutable.class, executable.getClass())) { return empty; } PerExecutable perExecutable = Aspects.aspectOf(PerExecutable.class, executable.getClass()); if (perExecutable.executable != null) { return perExecutable.executable.values(executable); } else { return empty; } }
java
public static Map<String, String> attributes(Object executable) { if (executable == null || !Aspects.hasAspect(PerExecutable.class, executable.getClass())) { return empty; } PerExecutable perExecutable = Aspects.aspectOf(PerExecutable.class, executable.getClass()); if (perExecutable.executable != null) { return perExecutable.executable.values(executable); } else { return empty; } }
[ "public", "static", "Map", "<", "String", ",", "String", ">", "attributes", "(", "Object", "executable", ")", "{", "if", "(", "executable", "==", "null", "||", "!", "Aspects", ".", "hasAspect", "(", "PerExecutable", ".", "class", ",", "executable", ".", "getClass", "(", ")", ")", ")", "{", "return", "empty", ";", "}", "PerExecutable", "perExecutable", "=", "Aspects", ".", "aspectOf", "(", "PerExecutable", ".", "class", ",", "executable", ".", "getClass", "(", ")", ")", ";", "if", "(", "perExecutable", ".", "executable", "!=", "null", ")", "{", "return", "perExecutable", ".", "executable", ".", "values", "(", "executable", ")", ";", "}", "else", "{", "return", "empty", ";", "}", "}" ]
Return the values of the attributes @param executable an instance of a class annotated by {@link Program} or by {@link Executable} @return the values of the attributes or an empty map if the parameter is <code>null</code> or if the class is not annotated by {@link Program} or by {@link Executable}
[ "Return", "the", "values", "of", "the", "attributes" ]
2a2498cc4ac6227df6f45d295ec568cad3cffbc4
https://github.com/awltech/org.parallelj/blob/2a2498cc4ac6227df6f45d295ec568cad3cffbc4/parallelj-core-parent/parallelj-core-aspects/src/main/java/org/parallelj/Executables.java#L120-L135
147,909
awltech/org.parallelj
parallelj-launching-parent/parallelj-launching-api/src/main/java/org/parallelj/launching/transport/jmx/DynamicLegacyProgram.java
DynamicLegacyProgram.buildJobDataMap
protected Map<String, Object> buildJobDataMap(final JmxCommand jmxCommand, final Object[] params) throws MBeanException { final Map<String, Object> jobDataMap = new HashMap<String, Object>(); try { int ind = 0; // Options are before the AdapterArguments for (JmxOption option : JmxOptions.getOptions()) { option.process(jobDataMap, String.valueOf(params[ind++])); } for (Argument arg : this.remoteProgram.getArguments()) { arg.setValueUsingParser(String.valueOf(params[ind++])); } } catch (Exception e) { throw new MBeanException(e); } return jobDataMap; }
java
protected Map<String, Object> buildJobDataMap(final JmxCommand jmxCommand, final Object[] params) throws MBeanException { final Map<String, Object> jobDataMap = new HashMap<String, Object>(); try { int ind = 0; // Options are before the AdapterArguments for (JmxOption option : JmxOptions.getOptions()) { option.process(jobDataMap, String.valueOf(params[ind++])); } for (Argument arg : this.remoteProgram.getArguments()) { arg.setValueUsingParser(String.valueOf(params[ind++])); } } catch (Exception e) { throw new MBeanException(e); } return jobDataMap; }
[ "protected", "Map", "<", "String", ",", "Object", ">", "buildJobDataMap", "(", "final", "JmxCommand", "jmxCommand", ",", "final", "Object", "[", "]", "params", ")", "throws", "MBeanException", "{", "final", "Map", "<", "String", ",", "Object", ">", "jobDataMap", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "try", "{", "int", "ind", "=", "0", ";", "// Options are before the AdapterArguments", "for", "(", "JmxOption", "option", ":", "JmxOptions", ".", "getOptions", "(", ")", ")", "{", "option", ".", "process", "(", "jobDataMap", ",", "String", ".", "valueOf", "(", "params", "[", "ind", "++", "]", ")", ")", ";", "}", "for", "(", "Argument", "arg", ":", "this", ".", "remoteProgram", ".", "getArguments", "(", ")", ")", "{", "arg", ".", "setValueUsingParser", "(", "String", ".", "valueOf", "(", "params", "[", "ind", "++", "]", ")", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "MBeanException", "(", "e", ")", ";", "}", "return", "jobDataMap", ";", "}" ]
Initialize the JobDataMap with the Program arguments @param job The JobDetail for the JobDataMap initialization @param params The parameters Objects for the Program @param signature The parameters type @throws MBeanException If an error appends when initializing the JobDataMap
[ "Initialize", "the", "JobDataMap", "with", "the", "Program", "arguments" ]
2a2498cc4ac6227df6f45d295ec568cad3cffbc4
https://github.com/awltech/org.parallelj/blob/2a2498cc4ac6227df6f45d295ec568cad3cffbc4/parallelj-launching-parent/parallelj-launching-api/src/main/java/org/parallelj/launching/transport/jmx/DynamicLegacyProgram.java#L110-L129
147,910
yfpeng/pengyifan-bioc
src/main/java/com/pengyifan/bioc/BioCRelation.java
BioCRelation.getNode
public Optional<BioCNode> getNode(String role) { return getNodes().stream().filter(n -> n.getRole().equals(role)).findFirst(); }
java
public Optional<BioCNode> getNode(String role) { return getNodes().stream().filter(n -> n.getRole().equals(role)).findFirst(); }
[ "public", "Optional", "<", "BioCNode", ">", "getNode", "(", "String", "role", ")", "{", "return", "getNodes", "(", ")", ".", "stream", "(", ")", ".", "filter", "(", "n", "->", "n", ".", "getRole", "(", ")", ".", "equals", "(", "role", ")", ")", ".", "findFirst", "(", ")", ";", "}" ]
Gets the first node based on the role. @param role the role of the node @return node that has the same role
[ "Gets", "the", "first", "node", "based", "on", "the", "role", "." ]
e09cce1969aa598ff89e7957237375715d7a1a3a
https://github.com/yfpeng/pengyifan-bioc/blob/e09cce1969aa598ff89e7957237375715d7a1a3a/src/main/java/com/pengyifan/bioc/BioCRelation.java#L116-L118
147,911
wkgcass/Style
src/main/java/net/cassite/style/util/RegEx.java
RegEx.getMatcher
public Matcher getMatcher(String str) { Matcher m; if (matchers.containsKey(str)) { m = matchers.get(str); } else { m = p.matcher(str); matchers.put(str, m); } return m; }
java
public Matcher getMatcher(String str) { Matcher m; if (matchers.containsKey(str)) { m = matchers.get(str); } else { m = p.matcher(str); matchers.put(str, m); } return m; }
[ "public", "Matcher", "getMatcher", "(", "String", "str", ")", "{", "Matcher", "m", ";", "if", "(", "matchers", ".", "containsKey", "(", "str", ")", ")", "{", "m", "=", "matchers", ".", "get", "(", "str", ")", ";", "}", "else", "{", "m", "=", "p", ".", "matcher", "(", "str", ")", ";", "matchers", ".", "put", "(", "str", ",", "m", ")", ";", "}", "return", "m", ";", "}" ]
get matcher of the given string @param str string @return matcher
[ "get", "matcher", "of", "the", "given", "string" ]
db3ea64337251f46f734279480e365293bececbd
https://github.com/wkgcass/Style/blob/db3ea64337251f46f734279480e365293bececbd/src/main/java/net/cassite/style/util/RegEx.java#L111-L120
147,912
wkgcass/Style
src/main/java/net/cassite/style/util/RegEx.java
RegEx.exec
public String[] exec(String toExec) { Matcher m = getMatcher(toExec); if (m.find()) { List<String> list = new ArrayList<>(); int count = m.groupCount(); For(1).to(count).loop(i -> { list.add(m.group(i)); }); return list.toArray(new String[list.size()]); } else { return null; } }
java
public String[] exec(String toExec) { Matcher m = getMatcher(toExec); if (m.find()) { List<String> list = new ArrayList<>(); int count = m.groupCount(); For(1).to(count).loop(i -> { list.add(m.group(i)); }); return list.toArray(new String[list.size()]); } else { return null; } }
[ "public", "String", "[", "]", "exec", "(", "String", "toExec", ")", "{", "Matcher", "m", "=", "getMatcher", "(", "toExec", ")", ";", "if", "(", "m", ".", "find", "(", ")", ")", "{", "List", "<", "String", ">", "list", "=", "new", "ArrayList", "<>", "(", ")", ";", "int", "count", "=", "m", ".", "groupCount", "(", ")", ";", "For", "(", "1", ")", ".", "to", "(", "count", ")", ".", "loop", "(", "i", "->", "{", "list", ".", "add", "(", "m", ".", "group", "(", "i", ")", ")", ";", "}", ")", ";", "return", "list", ".", "toArray", "(", "new", "String", "[", "list", ".", "size", "(", ")", "]", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
same as JavaScript exec @param toExec the string to exec @return result string array
[ "same", "as", "JavaScript", "exec" ]
db3ea64337251f46f734279480e365293bececbd
https://github.com/wkgcass/Style/blob/db3ea64337251f46f734279480e365293bececbd/src/main/java/net/cassite/style/util/RegEx.java#L140-L152
147,913
ykrasik/jaci
jaci-utils/src/main/java/com/github/ykrasik/jaci/util/trie/Tries.java
Tries.toStringTrie
public static Trie<String> toStringTrie(List<String> words) { final TrieBuilder<String> builder = new TrieBuilder<>(); for (String word : words) { builder.add(word, ""); } return builder.build(); }
java
public static Trie<String> toStringTrie(List<String> words) { final TrieBuilder<String> builder = new TrieBuilder<>(); for (String word : words) { builder.add(word, ""); } return builder.build(); }
[ "public", "static", "Trie", "<", "String", ">", "toStringTrie", "(", "List", "<", "String", ">", "words", ")", "{", "final", "TrieBuilder", "<", "String", ">", "builder", "=", "new", "TrieBuilder", "<>", "(", ")", ";", "for", "(", "String", "word", ":", "words", ")", "{", "builder", ".", "add", "(", "word", ",", "\"\"", ")", ";", "}", "return", "builder", ".", "build", "(", ")", ";", "}" ]
Sometimes a Trie's values aren't important, only the words matter. Convenience method that associates each word with an empty value. @param words Words to put in the Trie. @return A Trie where each word is associated to an empty value.
[ "Sometimes", "a", "Trie", "s", "values", "aren", "t", "important", "only", "the", "words", "matter", ".", "Convenience", "method", "that", "associates", "each", "word", "with", "an", "empty", "value", "." ]
4615edef7c76288ad5ea8d678132b161645ca1e3
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-utils/src/main/java/com/github/ykrasik/jaci/util/trie/Tries.java#L59-L65
147,914
mlhartme/sushi
src/main/java/net/oneandone/sushi/fs/http/io/ChunkedOutputStream.java
ChunkedOutputStream.flushBuffer
private void flushBuffer(byte[] append, int ofs, int len) throws IOException { int count; count = pos + len; if (count > 0) { dest.writeAsciiLn(Integer.toHexString(count)); dest.write(buffer, 0, pos); dest.write(append, ofs, len); dest.writeAsciiLn(); pos = 0; } }
java
private void flushBuffer(byte[] append, int ofs, int len) throws IOException { int count; count = pos + len; if (count > 0) { dest.writeAsciiLn(Integer.toHexString(count)); dest.write(buffer, 0, pos); dest.write(append, ofs, len); dest.writeAsciiLn(); pos = 0; } }
[ "private", "void", "flushBuffer", "(", "byte", "[", "]", "append", ",", "int", "ofs", ",", "int", "len", ")", "throws", "IOException", "{", "int", "count", ";", "count", "=", "pos", "+", "len", ";", "if", "(", "count", ">", "0", ")", "{", "dest", ".", "writeAsciiLn", "(", "Integer", ".", "toHexString", "(", "count", ")", ")", ";", "dest", ".", "write", "(", "buffer", ",", "0", ",", "pos", ")", ";", "dest", ".", "write", "(", "append", ",", "ofs", ",", "len", ")", ";", "dest", ".", "writeAsciiLn", "(", ")", ";", "pos", "=", "0", ";", "}", "}" ]
flush buffer and bytes in append
[ "flush", "buffer", "and", "bytes", "in", "append" ]
4af33414b04bd58584d4febe5cc63ef6c7346a75
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/fs/http/io/ChunkedOutputStream.java#L102-L113
147,915
pulse00/Composer-Java-Bindings
java-api/src/main/java/com/dubture/getcomposer/packages/AsyncDownloader.java
AsyncDownloader.download
public int download() { try { //if (url.startsWith("https://packagist.org") || url.startsWith("https://getcomposer.org")) { if (url.startsWith("https://")) { registerSSLContext(client.getBackend()); } final HttpGet httpGet = new HttpGet(url); if (httpGet.isAborted()) { httpGet.abort(); } client.execute(httpGet, new FutureCallback<HttpResponse>() { @Override public void failed(Exception e) { for (DownloadListenerInterface listener : listeners) { listener.errorOccured(e); } } @Override public void completed(HttpResponse response) { for (DownloadListenerInterface listener : listeners) { try { listener.dataReceived(response.getEntity().getContent(), httpGet.getURI().toString()); } catch (Exception e) { listener.errorOccured(e); } } } @Override public void cancelled() { for (DownloadListenerInterface listener : listeners) { listener.aborted(httpGet.getURI().toString()); } } }); httpGets.add(httpGet); // client.shutdown(); lastSlot = httpGets.size() - 1; return lastSlot; } catch (Exception e) { for (DownloadListenerInterface listener : listeners) { listener.errorOccured(e); } } return -1; }
java
public int download() { try { //if (url.startsWith("https://packagist.org") || url.startsWith("https://getcomposer.org")) { if (url.startsWith("https://")) { registerSSLContext(client.getBackend()); } final HttpGet httpGet = new HttpGet(url); if (httpGet.isAborted()) { httpGet.abort(); } client.execute(httpGet, new FutureCallback<HttpResponse>() { @Override public void failed(Exception e) { for (DownloadListenerInterface listener : listeners) { listener.errorOccured(e); } } @Override public void completed(HttpResponse response) { for (DownloadListenerInterface listener : listeners) { try { listener.dataReceived(response.getEntity().getContent(), httpGet.getURI().toString()); } catch (Exception e) { listener.errorOccured(e); } } } @Override public void cancelled() { for (DownloadListenerInterface listener : listeners) { listener.aborted(httpGet.getURI().toString()); } } }); httpGets.add(httpGet); // client.shutdown(); lastSlot = httpGets.size() - 1; return lastSlot; } catch (Exception e) { for (DownloadListenerInterface listener : listeners) { listener.errorOccured(e); } } return -1; }
[ "public", "int", "download", "(", ")", "{", "try", "{", "//if (url.startsWith(\"https://packagist.org\") || url.startsWith(\"https://getcomposer.org\")) {", "if", "(", "url", ".", "startsWith", "(", "\"https://\"", ")", ")", "{", "registerSSLContext", "(", "client", ".", "getBackend", "(", ")", ")", ";", "}", "final", "HttpGet", "httpGet", "=", "new", "HttpGet", "(", "url", ")", ";", "if", "(", "httpGet", ".", "isAborted", "(", ")", ")", "{", "httpGet", ".", "abort", "(", ")", ";", "}", "client", ".", "execute", "(", "httpGet", ",", "new", "FutureCallback", "<", "HttpResponse", ">", "(", ")", "{", "@", "Override", "public", "void", "failed", "(", "Exception", "e", ")", "{", "for", "(", "DownloadListenerInterface", "listener", ":", "listeners", ")", "{", "listener", ".", "errorOccured", "(", "e", ")", ";", "}", "}", "@", "Override", "public", "void", "completed", "(", "HttpResponse", "response", ")", "{", "for", "(", "DownloadListenerInterface", "listener", ":", "listeners", ")", "{", "try", "{", "listener", ".", "dataReceived", "(", "response", ".", "getEntity", "(", ")", ".", "getContent", "(", ")", ",", "httpGet", ".", "getURI", "(", ")", ".", "toString", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "listener", ".", "errorOccured", "(", "e", ")", ";", "}", "}", "}", "@", "Override", "public", "void", "cancelled", "(", ")", "{", "for", "(", "DownloadListenerInterface", "listener", ":", "listeners", ")", "{", "listener", ".", "aborted", "(", "httpGet", ".", "getURI", "(", ")", ".", "toString", "(", ")", ")", ";", "}", "}", "}", ")", ";", "httpGets", ".", "add", "(", "httpGet", ")", ";", "//\t\t\tclient.shutdown();", "lastSlot", "=", "httpGets", ".", "size", "(", ")", "-", "1", ";", "return", "lastSlot", ";", "}", "catch", "(", "Exception", "e", ")", "{", "for", "(", "DownloadListenerInterface", "listener", ":", "listeners", ")", "{", "listener", ".", "errorOccured", "(", "e", ")", ";", "}", "}", "return", "-", "1", ";", "}" ]
Starts the async download. The returned number is the internal slot for this download transfer, which can be used as parameter in abort to stop this specific transfer. @return slot
[ "Starts", "the", "async", "download", ".", "The", "returned", "number", "is", "the", "internal", "slot", "for", "this", "download", "transfer", "which", "can", "be", "used", "as", "parameter", "in", "abort", "to", "stop", "this", "specific", "transfer", "." ]
0aa572567db37d047a41a57c32ede7c7fd5d4938
https://github.com/pulse00/Composer-Java-Bindings/blob/0aa572567db37d047a41a57c32ede7c7fd5d4938/java-api/src/main/java/com/dubture/getcomposer/packages/AsyncDownloader.java#L61-L117
147,916
pulse00/Composer-Java-Bindings
java-api/src/main/java/com/dubture/getcomposer/packages/AsyncDownloader.java
AsyncDownloader.abort
public void abort(int slot) { try { HttpGet httpGet = httpGets.get(slot); httpGet.abort(); abortListeners(httpGet.getURI().toString()); } catch(Exception e) { log.error(e.getMessage()); } }
java
public void abort(int slot) { try { HttpGet httpGet = httpGets.get(slot); httpGet.abort(); abortListeners(httpGet.getURI().toString()); } catch(Exception e) { log.error(e.getMessage()); } }
[ "public", "void", "abort", "(", "int", "slot", ")", "{", "try", "{", "HttpGet", "httpGet", "=", "httpGets", ".", "get", "(", "slot", ")", ";", "httpGet", ".", "abort", "(", ")", ";", "abortListeners", "(", "httpGet", ".", "getURI", "(", ")", ".", "toString", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "error", "(", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}" ]
Aborts a transfer at the given slot @param slot
[ "Aborts", "a", "transfer", "at", "the", "given", "slot" ]
0aa572567db37d047a41a57c32ede7c7fd5d4938
https://github.com/pulse00/Composer-Java-Bindings/blob/0aa572567db37d047a41a57c32ede7c7fd5d4938/java-api/src/main/java/com/dubture/getcomposer/packages/AsyncDownloader.java#L154-L162
147,917
awltech/org.parallelj
parallelj-core-parent/parallelj-core-api/src/main/java/org/parallelj/internal/reflect/ElementBuilderFactory.java
ElementBuilderFactory.newBuilders
public static ElementBuilder[] newBuilders(Class<?> type) { List<ElementBuilder> builders = new ArrayList<ElementBuilder>(); for (ElementBuilderFactory factory : loader) { ElementBuilder b = factory.newBuilder(type); if (b != null) { builders.add(b); } } return builders.toArray(new ElementBuilder[0]); }
java
public static ElementBuilder[] newBuilders(Class<?> type) { List<ElementBuilder> builders = new ArrayList<ElementBuilder>(); for (ElementBuilderFactory factory : loader) { ElementBuilder b = factory.newBuilder(type); if (b != null) { builders.add(b); } } return builders.toArray(new ElementBuilder[0]); }
[ "public", "static", "ElementBuilder", "[", "]", "newBuilders", "(", "Class", "<", "?", ">", "type", ")", "{", "List", "<", "ElementBuilder", ">", "builders", "=", "new", "ArrayList", "<", "ElementBuilder", ">", "(", ")", ";", "for", "(", "ElementBuilderFactory", "factory", ":", "loader", ")", "{", "ElementBuilder", "b", "=", "factory", ".", "newBuilder", "(", "type", ")", ";", "if", "(", "b", "!=", "null", ")", "{", "builders", ".", "add", "(", "b", ")", ";", "}", "}", "return", "builders", ".", "toArray", "(", "new", "ElementBuilder", "[", "0", "]", ")", ";", "}" ]
Return an array of builders that will build one part of the program. @param type the type of the program. @return an array of {@link ElementBuilder} or an empty array if none is found.
[ "Return", "an", "array", "of", "builders", "that", "will", "build", "one", "part", "of", "the", "program", "." ]
2a2498cc4ac6227df6f45d295ec568cad3cffbc4
https://github.com/awltech/org.parallelj/blob/2a2498cc4ac6227df6f45d295ec568cad3cffbc4/parallelj-core-parent/parallelj-core-api/src/main/java/org/parallelj/internal/reflect/ElementBuilderFactory.java#L66-L77
147,918
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/MatchManager.java
MatchManager.convertWordNetToFlat
private void convertWordNetToFlat(Properties properties) throws SMatchException { InMemoryWordNetBinaryArray.createWordNetCaches(GLOBAL_PREFIX + SENSE_MATCHER_KEY, properties); WordNet.createWordNetCaches(GLOBAL_PREFIX + LINGUISTIC_ORACLE_KEY, properties); }
java
private void convertWordNetToFlat(Properties properties) throws SMatchException { InMemoryWordNetBinaryArray.createWordNetCaches(GLOBAL_PREFIX + SENSE_MATCHER_KEY, properties); WordNet.createWordNetCaches(GLOBAL_PREFIX + LINGUISTIC_ORACLE_KEY, properties); }
[ "private", "void", "convertWordNetToFlat", "(", "Properties", "properties", ")", "throws", "SMatchException", "{", "InMemoryWordNetBinaryArray", ".", "createWordNetCaches", "(", "GLOBAL_PREFIX", "+", "SENSE_MATCHER_KEY", ",", "properties", ")", ";", "WordNet", ".", "createWordNetCaches", "(", "GLOBAL_PREFIX", "+", "LINGUISTIC_ORACLE_KEY", ",", "properties", ")", ";", "}" ]
Converts WordNet dictionary to binary format for fast searching. @param properties configuration @throws SMatchException SMatchException
[ "Converts", "WordNet", "dictionary", "to", "binary", "format", "for", "fast", "searching", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/MatchManager.java#L353-L356
147,919
wkgcass/Style
src/main/java/net/cassite/style/aggregation/CollectionFuncSup.java
CollectionFuncSup.add
@SuppressWarnings("unchecked") public <Coll extends CollectionFuncSup<T>> Coll add(T t) { Collection<T> coll = (Collection<T>) iterable; coll.add(t); return (Coll) this; }
java
@SuppressWarnings("unchecked") public <Coll extends CollectionFuncSup<T>> Coll add(T t) { Collection<T> coll = (Collection<T>) iterable; coll.add(t); return (Coll) this; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "Coll", "extends", "CollectionFuncSup", "<", "T", ">", ">", "Coll", "add", "(", "T", "t", ")", "{", "Collection", "<", "T", ">", "coll", "=", "(", "Collection", "<", "T", ">", ")", "iterable", ";", "coll", ".", "add", "(", "t", ")", ";", "return", "(", "Coll", ")", "this", ";", "}" ]
a chain to simplify 'add' process <pre> $(collection).add(e1).add(e2).add(e3) </pre> @param t the element to add @return <code>this</code>
[ "a", "chain", "to", "simplify", "add", "process" ]
db3ea64337251f46f734279480e365293bececbd
https://github.com/wkgcass/Style/blob/db3ea64337251f46f734279480e365293bececbd/src/main/java/net/cassite/style/aggregation/CollectionFuncSup.java#L29-L34
147,920
ykrasik/jaci
jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/Cli.java
Cli.assist
public boolean assist() { // Read the command line and provide assistance for the command line before the caret. final String commandLine = commandLineManager.getCommandLine(); final int caret = commandLineManager.getCaret(); final String commandLineToAssist = commandLine.substring(0, caret); final Opt<String> autoCompletedSuffix = shell.assist(commandLineToAssist); if (!autoCompletedSuffix.isPresent()) { return false; } // Don't overwrite any extra characters on the command line that came after the caret. final String extraCommandLine = commandLine.substring(caret); final String autoCompletedCommandLine = commandLineToAssist + autoCompletedSuffix.get(); commandLineManager.setCommandLine(autoCompletedCommandLine + extraCommandLine); commandLineManager.setCaret(autoCompletedCommandLine.length()); return true; }
java
public boolean assist() { // Read the command line and provide assistance for the command line before the caret. final String commandLine = commandLineManager.getCommandLine(); final int caret = commandLineManager.getCaret(); final String commandLineToAssist = commandLine.substring(0, caret); final Opt<String> autoCompletedSuffix = shell.assist(commandLineToAssist); if (!autoCompletedSuffix.isPresent()) { return false; } // Don't overwrite any extra characters on the command line that came after the caret. final String extraCommandLine = commandLine.substring(caret); final String autoCompletedCommandLine = commandLineToAssist + autoCompletedSuffix.get(); commandLineManager.setCommandLine(autoCompletedCommandLine + extraCommandLine); commandLineManager.setCaret(autoCompletedCommandLine.length()); return true; }
[ "public", "boolean", "assist", "(", ")", "{", "// Read the command line and provide assistance for the command line before the caret.", "final", "String", "commandLine", "=", "commandLineManager", ".", "getCommandLine", "(", ")", ";", "final", "int", "caret", "=", "commandLineManager", ".", "getCaret", "(", ")", ";", "final", "String", "commandLineToAssist", "=", "commandLine", ".", "substring", "(", "0", ",", "caret", ")", ";", "final", "Opt", "<", "String", ">", "autoCompletedSuffix", "=", "shell", ".", "assist", "(", "commandLineToAssist", ")", ";", "if", "(", "!", "autoCompletedSuffix", ".", "isPresent", "(", ")", ")", "{", "return", "false", ";", "}", "// Don't overwrite any extra characters on the command line that came after the caret.", "final", "String", "extraCommandLine", "=", "commandLine", ".", "substring", "(", "caret", ")", ";", "final", "String", "autoCompletedCommandLine", "=", "commandLineToAssist", "+", "autoCompletedSuffix", ".", "get", "(", ")", ";", "commandLineManager", ".", "setCommandLine", "(", "autoCompletedCommandLine", "+", "extraCommandLine", ")", ";", "commandLineManager", ".", "setCaret", "(", "autoCompletedCommandLine", ".", "length", "(", ")", ")", ";", "return", "true", ";", "}" ]
Provide assistance for the command line. @return {@code true} if assistance could be provided for the command line.
[ "Provide", "assistance", "for", "the", "command", "line", "." ]
4615edef7c76288ad5ea8d678132b161645ca1e3
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/Cli.java#L60-L76
147,921
kmi/iserve
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ServiceManagerIndexRdf.java
ServiceManagerIndexRdf.listOutputs
@Override public Set<URI> listOutputs(URI operationUri) { if (operationUri == null) { return ImmutableSet.of(); } return ImmutableSet.copyOf(this.opOutputMap.get(operationUri)); }
java
@Override public Set<URI> listOutputs(URI operationUri) { if (operationUri == null) { return ImmutableSet.of(); } return ImmutableSet.copyOf(this.opOutputMap.get(operationUri)); }
[ "@", "Override", "public", "Set", "<", "URI", ">", "listOutputs", "(", "URI", "operationUri", ")", "{", "if", "(", "operationUri", "==", "null", ")", "{", "return", "ImmutableSet", ".", "of", "(", ")", ";", "}", "return", "ImmutableSet", ".", "copyOf", "(", "this", ".", "opOutputMap", ".", "get", "(", "operationUri", ")", ")", ";", "}" ]
Obtains the list of output URIs for a given Operation @param operationUri the operation URI @return a List of URIs with the outputs of the operation. If no output is provided the List should be empty NOT null.
[ "Obtains", "the", "list", "of", "output", "URIs", "for", "a", "given", "Operation" ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ServiceManagerIndexRdf.java#L155-L162
147,922
kmi/iserve
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ServiceManagerIndexRdf.java
ServiceManagerIndexRdf.listOptionalParts
@Override public Set<URI> listOptionalParts(URI messageContent) { if (messageContent == null) { return ImmutableSet.of(); } return ImmutableSet.copyOf(this.messageOptionalPartsMap.get(messageContent)); }
java
@Override public Set<URI> listOptionalParts(URI messageContent) { if (messageContent == null) { return ImmutableSet.of(); } return ImmutableSet.copyOf(this.messageOptionalPartsMap.get(messageContent)); }
[ "@", "Override", "public", "Set", "<", "URI", ">", "listOptionalParts", "(", "URI", "messageContent", ")", "{", "if", "(", "messageContent", "==", "null", ")", "{", "return", "ImmutableSet", ".", "of", "(", ")", ";", "}", "return", "ImmutableSet", ".", "copyOf", "(", "this", ".", "messageOptionalPartsMap", ".", "get", "(", "messageContent", ")", ")", ";", "}" ]
Obtains the list of optional parts for a given Message Content @param messageContent the message content URI @return a Set of URIs with the optional parts of the message content. If there are no parts the Set should be empty NOT null.
[ "Obtains", "the", "list", "of", "optional", "parts", "for", "a", "given", "Message", "Content" ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ServiceManagerIndexRdf.java#L206-L213
147,923
kmi/iserve
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ServiceManagerIndexRdf.java
ServiceManagerIndexRdf.initialise
private void initialise() { Stopwatch stopwatch = new Stopwatch(); stopwatch.start(); populateCache(); stopwatch.stop(); log.info("Cache populated. Time taken {}", stopwatch); }
java
private void initialise() { Stopwatch stopwatch = new Stopwatch(); stopwatch.start(); populateCache(); stopwatch.stop(); log.info("Cache populated. Time taken {}", stopwatch); }
[ "private", "void", "initialise", "(", ")", "{", "Stopwatch", "stopwatch", "=", "new", "Stopwatch", "(", ")", ";", "stopwatch", ".", "start", "(", ")", ";", "populateCache", "(", ")", ";", "stopwatch", ".", "stop", "(", ")", ";", "log", ".", "info", "(", "\"Cache populated. Time taken {}\"", ",", "stopwatch", ")", ";", "}" ]
This method will be called when the server is initialised. If necessary it should take care of updating any indexes on boot time.
[ "This", "method", "will", "be", "called", "when", "the", "server", "is", "initialised", ".", "If", "necessary", "it", "should", "take", "care", "of", "updating", "any", "indexes", "on", "boot", "time", "." ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ServiceManagerIndexRdf.java#L331-L337
147,924
kmi/iserve
iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/impl/SparqlIndexedLogicConceptMatcher.java
SparqlIndexedLogicConceptMatcher.handleOntologyCreated
@Subscribe @AllowConcurrentEvents public synchronized void handleOntologyCreated(OntologyCreatedEvent event) { log.info("Processing Ontology Created Event - {}", event.getOntologyUri()); // Obtain the concepts in the ontology uploaded Set<URI> conceptUris = this.manager.getKnowledgeBaseManager().listConcepts(event.getOntologyUri()); log.info("Fetching matches for all the {} concepts present in the ontology - {}", conceptUris.size(), event.getOntologyUri()); // For each of them update their entries in the index (matched concepts will be updated later within the loop) for (URI c : conceptUris) { indexedMatches.put(c, new ConcurrentHashMap<URI, MatchResult>(sparqlMatcher.listMatchesAtLeastOfType(c, LogicConceptMatchType.Subsume))); } }
java
@Subscribe @AllowConcurrentEvents public synchronized void handleOntologyCreated(OntologyCreatedEvent event) { log.info("Processing Ontology Created Event - {}", event.getOntologyUri()); // Obtain the concepts in the ontology uploaded Set<URI> conceptUris = this.manager.getKnowledgeBaseManager().listConcepts(event.getOntologyUri()); log.info("Fetching matches for all the {} concepts present in the ontology - {}", conceptUris.size(), event.getOntologyUri()); // For each of them update their entries in the index (matched concepts will be updated later within the loop) for (URI c : conceptUris) { indexedMatches.put(c, new ConcurrentHashMap<URI, MatchResult>(sparqlMatcher.listMatchesAtLeastOfType(c, LogicConceptMatchType.Subsume))); } }
[ "@", "Subscribe", "@", "AllowConcurrentEvents", "public", "synchronized", "void", "handleOntologyCreated", "(", "OntologyCreatedEvent", "event", ")", "{", "log", ".", "info", "(", "\"Processing Ontology Created Event - {}\"", ",", "event", ".", "getOntologyUri", "(", ")", ")", ";", "// Obtain the concepts in the ontology uploaded", "Set", "<", "URI", ">", "conceptUris", "=", "this", ".", "manager", ".", "getKnowledgeBaseManager", "(", ")", ".", "listConcepts", "(", "event", ".", "getOntologyUri", "(", ")", ")", ";", "log", ".", "info", "(", "\"Fetching matches for all the {} concepts present in the ontology - {}\"", ",", "conceptUris", ".", "size", "(", ")", ",", "event", ".", "getOntologyUri", "(", ")", ")", ";", "// For each of them update their entries in the index (matched concepts will be updated later within the loop)", "for", "(", "URI", "c", ":", "conceptUris", ")", "{", "indexedMatches", ".", "put", "(", "c", ",", "new", "ConcurrentHashMap", "<", "URI", ",", "MatchResult", ">", "(", "sparqlMatcher", ".", "listMatchesAtLeastOfType", "(", "c", ",", "LogicConceptMatchType", ".", "Subsume", ")", ")", ")", ";", "}", "}" ]
A new ontology has been uploaded to the server and we need to update the indexes @param event the actual event that was triggered
[ "A", "new", "ontology", "has", "been", "uploaded", "to", "the", "server", "and", "we", "need", "to", "update", "the", "indexes" ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/impl/SparqlIndexedLogicConceptMatcher.java#L206-L220
147,925
kmi/iserve
iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/impl/SparqlIndexedLogicConceptMatcher.java
SparqlIndexedLogicConceptMatcher.handleOntologyDeleted
@Subscribe @AllowConcurrentEvents public synchronized void handleOntologyDeleted(OntologyDeletedEvent event) { log.info("Processing Ontology Deleted Event - {}", event.getOntologyUri()); // Obtain all concepts in the KB Set<URI> conceptUris = this.manager.getKnowledgeBaseManager().listConcepts(null); // Cross reference them with those for which we have entries. The ones unmatched were defined in the previous // ontology (note that tse of namespaces could be abused and therefore may not be a guarantee). Set<URI> difference = Sets.difference(conceptUris, this.indexedMatches.keySet()); for (URI conceptUri : difference) { this.indexedMatches.remove(conceptUri); } for (URI indexedConcept : indexedMatches.keySet()) { Map<URI, MatchResult> matchResultMap = indexedMatches.get(indexedConcept); for (URI conceptUri : difference) { matchResultMap.remove(conceptUri); } indexedMatches.put(indexedConcept, new ConcurrentHashMap<URI, MatchResult>(matchResultMap)); } }
java
@Subscribe @AllowConcurrentEvents public synchronized void handleOntologyDeleted(OntologyDeletedEvent event) { log.info("Processing Ontology Deleted Event - {}", event.getOntologyUri()); // Obtain all concepts in the KB Set<URI> conceptUris = this.manager.getKnowledgeBaseManager().listConcepts(null); // Cross reference them with those for which we have entries. The ones unmatched were defined in the previous // ontology (note that tse of namespaces could be abused and therefore may not be a guarantee). Set<URI> difference = Sets.difference(conceptUris, this.indexedMatches.keySet()); for (URI conceptUri : difference) { this.indexedMatches.remove(conceptUri); } for (URI indexedConcept : indexedMatches.keySet()) { Map<URI, MatchResult> matchResultMap = indexedMatches.get(indexedConcept); for (URI conceptUri : difference) { matchResultMap.remove(conceptUri); } indexedMatches.put(indexedConcept, new ConcurrentHashMap<URI, MatchResult>(matchResultMap)); } }
[ "@", "Subscribe", "@", "AllowConcurrentEvents", "public", "synchronized", "void", "handleOntologyDeleted", "(", "OntologyDeletedEvent", "event", ")", "{", "log", ".", "info", "(", "\"Processing Ontology Deleted Event - {}\"", ",", "event", ".", "getOntologyUri", "(", ")", ")", ";", "// Obtain all concepts in the KB", "Set", "<", "URI", ">", "conceptUris", "=", "this", ".", "manager", ".", "getKnowledgeBaseManager", "(", ")", ".", "listConcepts", "(", "null", ")", ";", "// Cross reference them with those for which we have entries. The ones unmatched were defined in the previous", "// ontology (note that tse of namespaces could be abused and therefore may not be a guarantee).", "Set", "<", "URI", ">", "difference", "=", "Sets", ".", "difference", "(", "conceptUris", ",", "this", ".", "indexedMatches", ".", "keySet", "(", ")", ")", ";", "for", "(", "URI", "conceptUri", ":", "difference", ")", "{", "this", ".", "indexedMatches", ".", "remove", "(", "conceptUri", ")", ";", "}", "for", "(", "URI", "indexedConcept", ":", "indexedMatches", ".", "keySet", "(", ")", ")", "{", "Map", "<", "URI", ",", "MatchResult", ">", "matchResultMap", "=", "indexedMatches", ".", "get", "(", "indexedConcept", ")", ";", "for", "(", "URI", "conceptUri", ":", "difference", ")", "{", "matchResultMap", ".", "remove", "(", "conceptUri", ")", ";", "}", "indexedMatches", ".", "put", "(", "indexedConcept", ",", "new", "ConcurrentHashMap", "<", "URI", ",", "MatchResult", ">", "(", "matchResultMap", ")", ")", ";", "}", "}" ]
An ontology has been deleted from the KB and we should thus update the indexes. By the time we want to process this event we won't know any longer which concepts need to be removed unless we keep this somewhere. @param event the ontology deletion event
[ "An", "ontology", "has", "been", "deleted", "from", "the", "KB", "and", "we", "should", "thus", "update", "the", "indexes", ".", "By", "the", "time", "we", "want", "to", "process", "this", "event", "we", "won", "t", "know", "any", "longer", "which", "concepts", "need", "to", "be", "removed", "unless", "we", "keep", "this", "somewhere", "." ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/impl/SparqlIndexedLogicConceptMatcher.java#L228-L253
147,926
ZenHarbinger/l2fprod-properties-editor
src/main/java/com/l2fprod/common/swing/IconPool.java
IconPool.get
public Icon get(String url) { StackTraceElement[] stacks = new Exception().getStackTrace(); try { Class callerClazz = Class.forName(stacks[1].getClassName()); return get(callerClazz.getResource(url)); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } }
java
public Icon get(String url) { StackTraceElement[] stacks = new Exception().getStackTrace(); try { Class callerClazz = Class.forName(stacks[1].getClassName()); return get(callerClazz.getResource(url)); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } }
[ "public", "Icon", "get", "(", "String", "url", ")", "{", "StackTraceElement", "[", "]", "stacks", "=", "new", "Exception", "(", ")", ".", "getStackTrace", "(", ")", ";", "try", "{", "Class", "callerClazz", "=", "Class", ".", "forName", "(", "stacks", "[", "1", "]", ".", "getClassName", "(", ")", ")", ";", "return", "get", "(", "callerClazz", ".", "getResource", "(", "url", ")", ")", ";", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
Gets the icon denoted by url. If url is relative, it is relative to the caller. @param url @return an icon
[ "Gets", "the", "icon", "denoted", "by", "url", ".", "If", "url", "is", "relative", "it", "is", "relative", "to", "the", "caller", "." ]
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/swing/IconPool.java#L50-L58
147,927
synchronoss/cpo-api
cpo-core/src/main/java/org/synchronoss/cpo/jta/CpoBaseXaResource.java
CpoBaseXaResource.closeAssociated
public void closeAssociated() throws XAException { Xid associatedXid = cpoXaStateMap.getXaResourceMap().get(this); if ( associatedXid != null) { close(associatedXid); } }
java
public void closeAssociated() throws XAException { Xid associatedXid = cpoXaStateMap.getXaResourceMap().get(this); if ( associatedXid != null) { close(associatedXid); } }
[ "public", "void", "closeAssociated", "(", ")", "throws", "XAException", "{", "Xid", "associatedXid", "=", "cpoXaStateMap", ".", "getXaResourceMap", "(", ")", ".", "get", "(", "this", ")", ";", "if", "(", "associatedXid", "!=", "null", ")", "{", "close", "(", "associatedXid", ")", ";", "}", "}" ]
Closes the resource associated with this instance @throws XAException
[ "Closes", "the", "resource", "associated", "with", "this", "instance" ]
dc745aca3b3206abf80b85d9689b0132f5baa694
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-core/src/main/java/org/synchronoss/cpo/jta/CpoBaseXaResource.java#L79-L84
147,928
synchronoss/cpo-api
cpo-core/src/main/java/org/synchronoss/cpo/jta/CpoBaseXaResource.java
CpoBaseXaResource.close
public void close(Xid xid) throws XAException { synchronized (cpoXaStateMap) { CpoXaState<T> cpoXaState = cpoXaStateMap.getXidStateMap().get(xid); if (cpoXaState == null) throw CpoXaError.createXAException(CpoXaError.XAER_NOTA, "Unknown XID"); // close the resource closeResource(cpoXaState.getResource()); // unassociate cpoXaStateMap.getXaResourceMap().remove(cpoXaState.getAssignedResourceManager()); // remove the xid reference cpoXaStateMap.getXidStateMap().remove(xid); } }
java
public void close(Xid xid) throws XAException { synchronized (cpoXaStateMap) { CpoXaState<T> cpoXaState = cpoXaStateMap.getXidStateMap().get(xid); if (cpoXaState == null) throw CpoXaError.createXAException(CpoXaError.XAER_NOTA, "Unknown XID"); // close the resource closeResource(cpoXaState.getResource()); // unassociate cpoXaStateMap.getXaResourceMap().remove(cpoXaState.getAssignedResourceManager()); // remove the xid reference cpoXaStateMap.getXidStateMap().remove(xid); } }
[ "public", "void", "close", "(", "Xid", "xid", ")", "throws", "XAException", "{", "synchronized", "(", "cpoXaStateMap", ")", "{", "CpoXaState", "<", "T", ">", "cpoXaState", "=", "cpoXaStateMap", ".", "getXidStateMap", "(", ")", ".", "get", "(", "xid", ")", ";", "if", "(", "cpoXaState", "==", "null", ")", "throw", "CpoXaError", ".", "createXAException", "(", "CpoXaError", ".", "XAER_NOTA", ",", "\"Unknown XID\"", ")", ";", "// close the resource", "closeResource", "(", "cpoXaState", ".", "getResource", "(", ")", ")", ";", "// unassociate", "cpoXaStateMap", ".", "getXaResourceMap", "(", ")", ".", "remove", "(", "cpoXaState", ".", "getAssignedResourceManager", "(", ")", ")", ";", "// remove the xid reference", "cpoXaStateMap", ".", "getXidStateMap", "(", ")", ".", "remove", "(", "xid", ")", ";", "}", "}" ]
Closes the resource for the specified xid @param xid of the global transaction @throws XAException
[ "Closes", "the", "resource", "for", "the", "specified", "xid" ]
dc745aca3b3206abf80b85d9689b0132f5baa694
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-core/src/main/java/org/synchronoss/cpo/jta/CpoBaseXaResource.java#L92-L108
147,929
awltech/org.parallelj
parallelj-core-parent/parallelj-core-api/src/main/java/org/parallelj/internal/kernel/KProcessor.java
KProcessor.execute
public void execute(org.parallelj.mirror.Process process) { if (!(process instanceof KProcess)) { return; } this.execute((KProcess) process); }
java
public void execute(org.parallelj.mirror.Process process) { if (!(process instanceof KProcess)) { return; } this.execute((KProcess) process); }
[ "public", "void", "execute", "(", "org", ".", "parallelj", ".", "mirror", ".", "Process", "process", ")", "{", "if", "(", "!", "(", "process", "instanceof", "KProcess", ")", ")", "{", "return", ";", "}", "this", ".", "execute", "(", "(", "KProcess", ")", "process", ")", ";", "}" ]
Execute a process. @param process the process to execute
[ "Execute", "a", "process", "." ]
2a2498cc4ac6227df6f45d295ec568cad3cffbc4
https://github.com/awltech/org.parallelj/blob/2a2498cc4ac6227df6f45d295ec568cad3cffbc4/parallelj-core-parent/parallelj-core-api/src/main/java/org/parallelj/internal/kernel/KProcessor.java#L112-L118
147,930
eurekaclinical/aiw-i2b2-etl
src/main/java/edu/emory/cci/aiw/i2b2etl/dest/metadata/conceptid/SimpleConceptId.java
SimpleConceptId.getInstance
public static ConceptId getInstance(String id, Metadata metadata) { List<Object> key = new ArrayList<>(1); key.add(id); ConceptId result = metadata.getFromConceptIdCache(key); if (result != null) { return result; } else { result = new SimpleConceptId(id, metadata); metadata.putInConceptIdCache(key, result); return result; } }
java
public static ConceptId getInstance(String id, Metadata metadata) { List<Object> key = new ArrayList<>(1); key.add(id); ConceptId result = metadata.getFromConceptIdCache(key); if (result != null) { return result; } else { result = new SimpleConceptId(id, metadata); metadata.putInConceptIdCache(key, result); return result; } }
[ "public", "static", "ConceptId", "getInstance", "(", "String", "id", ",", "Metadata", "metadata", ")", "{", "List", "<", "Object", ">", "key", "=", "new", "ArrayList", "<>", "(", "1", ")", ";", "key", ".", "add", "(", "id", ")", ";", "ConceptId", "result", "=", "metadata", ".", "getFromConceptIdCache", "(", "key", ")", ";", "if", "(", "result", "!=", "null", ")", "{", "return", "result", ";", "}", "else", "{", "result", "=", "new", "SimpleConceptId", "(", "id", ",", "metadata", ")", ";", "metadata", ".", "putInConceptIdCache", "(", "key", ",", "result", ")", ";", "return", "result", ";", "}", "}" ]
Returns a concept propId with the given string identifier. @param id a concept identifier {@link String}. Cannot be <code>null</code>. @return a {@link PropDefConceptId}.
[ "Returns", "a", "concept", "propId", "with", "the", "given", "string", "identifier", "." ]
3eed6bda7755919cb9466d2930723a0f4748341a
https://github.com/eurekaclinical/aiw-i2b2-etl/blob/3eed6bda7755919cb9466d2930723a0f4748341a/src/main/java/edu/emory/cci/aiw/i2b2etl/dest/metadata/conceptid/SimpleConceptId.java#L42-L53
147,931
ykrasik/jaci
jaci-reflection-api/src/main/java/com/github/ykrasik/jaci/reflection/ReflectionSuppliers.java
ReflectionSuppliers.reflectionSupplier
public static <T> Spplr<T> reflectionSupplier(Object instance, String methodName, Class<T> suppliedClass) { final ReflectionMethod method = ReflectionUtils.getNoArgsMethod(instance.getClass(), methodName); ReflectionUtils.assertReturnValue(method, suppliedClass); return new ReflectionSupplier<>(instance, method); }
java
public static <T> Spplr<T> reflectionSupplier(Object instance, String methodName, Class<T> suppliedClass) { final ReflectionMethod method = ReflectionUtils.getNoArgsMethod(instance.getClass(), methodName); ReflectionUtils.assertReturnValue(method, suppliedClass); return new ReflectionSupplier<>(instance, method); }
[ "public", "static", "<", "T", ">", "Spplr", "<", "T", ">", "reflectionSupplier", "(", "Object", "instance", ",", "String", "methodName", ",", "Class", "<", "T", ">", "suppliedClass", ")", "{", "final", "ReflectionMethod", "method", "=", "ReflectionUtils", ".", "getNoArgsMethod", "(", "instance", ".", "getClass", "(", ")", ",", "methodName", ")", ";", "ReflectionUtils", ".", "assertReturnValue", "(", "method", ",", "suppliedClass", ")", ";", "return", "new", "ReflectionSupplier", "<>", "(", "instance", ",", "method", ")", ";", "}" ]
Create a supplier that will invoke the method specified by the give method name on the given object instance through reflection. The method must be no-args and must return a value of the specified type. The method may be private, in which case it will be made accessible outside it's class. @param instance Instance to invoke the method one. @param methodName Method name to invoke. Method must be no-args and return a value of the specified type. @param suppliedClass Expected return type of the method. @param <T> Supplier return type. @return A {@link Spplr} that will invoke the no-args method specified by the given name on the given instance.
[ "Create", "a", "supplier", "that", "will", "invoke", "the", "method", "specified", "by", "the", "give", "method", "name", "on", "the", "given", "object", "instance", "through", "reflection", ".", "The", "method", "must", "be", "no", "-", "args", "and", "must", "return", "a", "value", "of", "the", "specified", "type", ".", "The", "method", "may", "be", "private", "in", "which", "case", "it", "will", "be", "made", "accessible", "outside", "it", "s", "class", "." ]
4615edef7c76288ad5ea8d678132b161645ca1e3
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-reflection-api/src/main/java/com/github/ykrasik/jaci/reflection/ReflectionSuppliers.java#L45-L51
147,932
Avira/couchdoop
src/main/java/com/avira/couchdoop/imp/PageFileWriter.java
PageFileWriter.write
public void write(String key, String document) throws IOException { try { // Write the key. outputStream.write(key.getBytes("UTF-8")); // Write the key-document keyDocumentDelimiter. outputStream.write(keyDocumentDelimiter.getBytes("UTF-8")); // Write the document. outputStream.write(document.getBytes("UTF-8")); // Write the row keyDocumentDelimiter. outputStream.write(rowDelimiter.getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { LOGGER.error("Shouldn't happen."); } }
java
public void write(String key, String document) throws IOException { try { // Write the key. outputStream.write(key.getBytes("UTF-8")); // Write the key-document keyDocumentDelimiter. outputStream.write(keyDocumentDelimiter.getBytes("UTF-8")); // Write the document. outputStream.write(document.getBytes("UTF-8")); // Write the row keyDocumentDelimiter. outputStream.write(rowDelimiter.getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { LOGGER.error("Shouldn't happen."); } }
[ "public", "void", "write", "(", "String", "key", ",", "String", "document", ")", "throws", "IOException", "{", "try", "{", "// Write the key.", "outputStream", ".", "write", "(", "key", ".", "getBytes", "(", "\"UTF-8\"", ")", ")", ";", "// Write the key-document keyDocumentDelimiter.", "outputStream", ".", "write", "(", "keyDocumentDelimiter", ".", "getBytes", "(", "\"UTF-8\"", ")", ")", ";", "// Write the document.", "outputStream", ".", "write", "(", "document", ".", "getBytes", "(", "\"UTF-8\"", ")", ")", ";", "// Write the row keyDocumentDelimiter.", "outputStream", ".", "write", "(", "rowDelimiter", ".", "getBytes", "(", "\"UTF-8\"", ")", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "LOGGER", ".", "error", "(", "\"Shouldn't happen.\"", ")", ";", "}", "}" ]
Write a Couchbase document @param key Couchbase document ID @param document Couchbase document value @throws IOException in case of issues while writing to a file
[ "Write", "a", "Couchbase", "document" ]
0df7792524d0cf258523c4bc510eb0df8b1132a1
https://github.com/Avira/couchdoop/blob/0df7792524d0cf258523c4bc510eb0df8b1132a1/src/main/java/com/avira/couchdoop/imp/PageFileWriter.java#L72-L86
147,933
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/matchers/element/MatcherLibrary.java
MatcherLibrary.getRelation
protected char getRelation(IAtomicConceptOfLabel sourceACoL, IAtomicConceptOfLabel targetACoL) throws MatcherLibraryException { try { char relation = senseMatcher.getRelation(sourceACoL.getSenseList(), targetACoL.getSenseList()); //if WN matcher did not find relation if (IMappingElement.IDK == relation) { if (useWeakSemanticsElementLevelMatchersLibrary) { //use string based matchers relation = getRelationFromStringMatchers(sourceACoL.getLemma(), targetACoL.getLemma()); //if they did not find relation if (IMappingElement.IDK == relation) { //use sense and gloss based matchers relation = getRelationFromSenseGlossMatchers(sourceACoL.getSenseList(), targetACoL.getSenseList()); } } } return relation; } catch (SenseMatcherException e) { final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage(); log.error(errMessage, e); throw new MatcherLibraryException(errMessage, e); } }
java
protected char getRelation(IAtomicConceptOfLabel sourceACoL, IAtomicConceptOfLabel targetACoL) throws MatcherLibraryException { try { char relation = senseMatcher.getRelation(sourceACoL.getSenseList(), targetACoL.getSenseList()); //if WN matcher did not find relation if (IMappingElement.IDK == relation) { if (useWeakSemanticsElementLevelMatchersLibrary) { //use string based matchers relation = getRelationFromStringMatchers(sourceACoL.getLemma(), targetACoL.getLemma()); //if they did not find relation if (IMappingElement.IDK == relation) { //use sense and gloss based matchers relation = getRelationFromSenseGlossMatchers(sourceACoL.getSenseList(), targetACoL.getSenseList()); } } } return relation; } catch (SenseMatcherException e) { final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage(); log.error(errMessage, e); throw new MatcherLibraryException(errMessage, e); } }
[ "protected", "char", "getRelation", "(", "IAtomicConceptOfLabel", "sourceACoL", ",", "IAtomicConceptOfLabel", "targetACoL", ")", "throws", "MatcherLibraryException", "{", "try", "{", "char", "relation", "=", "senseMatcher", ".", "getRelation", "(", "sourceACoL", ".", "getSenseList", "(", ")", ",", "targetACoL", ".", "getSenseList", "(", ")", ")", ";", "//if WN matcher did not find relation\r", "if", "(", "IMappingElement", ".", "IDK", "==", "relation", ")", "{", "if", "(", "useWeakSemanticsElementLevelMatchersLibrary", ")", "{", "//use string based matchers\r", "relation", "=", "getRelationFromStringMatchers", "(", "sourceACoL", ".", "getLemma", "(", ")", ",", "targetACoL", ".", "getLemma", "(", ")", ")", ";", "//if they did not find relation\r", "if", "(", "IMappingElement", ".", "IDK", "==", "relation", ")", "{", "//use sense and gloss based matchers\r", "relation", "=", "getRelationFromSenseGlossMatchers", "(", "sourceACoL", ".", "getSenseList", "(", ")", ",", "targetACoL", ".", "getSenseList", "(", ")", ")", ";", "}", "}", "}", "return", "relation", ";", "}", "catch", "(", "SenseMatcherException", "e", ")", "{", "final", "String", "errMessage", "=", "e", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", "+", "\": \"", "+", "e", ".", "getMessage", "(", ")", ";", "log", ".", "error", "(", "errMessage", ",", "e", ")", ";", "throw", "new", "MatcherLibraryException", "(", "errMessage", ",", "e", ")", ";", "}", "}" ]
Returns a semantic relation between two atomic concepts. @param sourceACoL source concept @param targetACoL target concept @return relation between concepts @throws MatcherLibraryException MatcherLibraryException
[ "Returns", "a", "semantic", "relation", "between", "two", "atomic", "concepts", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/element/MatcherLibrary.java#L178-L201
147,934
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/matchers/element/MatcherLibrary.java
MatcherLibrary.getRelationFromStringMatchers
private char getRelationFromStringMatchers(String sourceLabel, String targetLabel) { char relation = IMappingElement.IDK; int i = 0; while ((relation == IMappingElement.IDK) && (i < stringMatchers.size())) { relation = stringMatchers.get(i).match(sourceLabel, targetLabel); i++; } return relation; }
java
private char getRelationFromStringMatchers(String sourceLabel, String targetLabel) { char relation = IMappingElement.IDK; int i = 0; while ((relation == IMappingElement.IDK) && (i < stringMatchers.size())) { relation = stringMatchers.get(i).match(sourceLabel, targetLabel); i++; } return relation; }
[ "private", "char", "getRelationFromStringMatchers", "(", "String", "sourceLabel", ",", "String", "targetLabel", ")", "{", "char", "relation", "=", "IMappingElement", ".", "IDK", ";", "int", "i", "=", "0", ";", "while", "(", "(", "relation", "==", "IMappingElement", ".", "IDK", ")", "&&", "(", "i", "<", "stringMatchers", ".", "size", "(", ")", ")", ")", "{", "relation", "=", "stringMatchers", ".", "get", "(", "i", ")", ".", "match", "(", "sourceLabel", ",", "targetLabel", ")", ";", "i", "++", ";", "}", "return", "relation", ";", "}" ]
Returns semantic relation holding between two labels as computed by string based matchers. @param sourceLabel the string of the source label @param targetLabel the string of the target label @return semantic relation holding between two labels as computed by string based matchers
[ "Returns", "semantic", "relation", "holding", "between", "two", "labels", "as", "computed", "by", "string", "based", "matchers", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/element/MatcherLibrary.java#L210-L218
147,935
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/matchers/element/MatcherLibrary.java
MatcherLibrary.getRelationFromSenseGlossMatchers
private char getRelationFromSenseGlossMatchers(List<ISense> sourceSenses, List<ISense> targetSenses) throws MatcherLibraryException { char relation = IMappingElement.IDK; if (0 < senseGlossMatchers.size()) { for (ISense sourceSense : sourceSenses) { //noinspection LoopStatementThatDoesntLoop for (ISense targetSense : targetSenses) { int k = 0; while ((relation == IMappingElement.IDK) && (k < senseGlossMatchers.size())) { relation = senseGlossMatchers.get(k).match(sourceSense, targetSense); k++; } return relation; } } } return relation; }
java
private char getRelationFromSenseGlossMatchers(List<ISense> sourceSenses, List<ISense> targetSenses) throws MatcherLibraryException { char relation = IMappingElement.IDK; if (0 < senseGlossMatchers.size()) { for (ISense sourceSense : sourceSenses) { //noinspection LoopStatementThatDoesntLoop for (ISense targetSense : targetSenses) { int k = 0; while ((relation == IMappingElement.IDK) && (k < senseGlossMatchers.size())) { relation = senseGlossMatchers.get(k).match(sourceSense, targetSense); k++; } return relation; } } } return relation; }
[ "private", "char", "getRelationFromSenseGlossMatchers", "(", "List", "<", "ISense", ">", "sourceSenses", ",", "List", "<", "ISense", ">", "targetSenses", ")", "throws", "MatcherLibraryException", "{", "char", "relation", "=", "IMappingElement", ".", "IDK", ";", "if", "(", "0", "<", "senseGlossMatchers", ".", "size", "(", ")", ")", "{", "for", "(", "ISense", "sourceSense", ":", "sourceSenses", ")", "{", "//noinspection LoopStatementThatDoesntLoop\r", "for", "(", "ISense", "targetSense", ":", "targetSenses", ")", "{", "int", "k", "=", "0", ";", "while", "(", "(", "relation", "==", "IMappingElement", ".", "IDK", ")", "&&", "(", "k", "<", "senseGlossMatchers", ".", "size", "(", ")", ")", ")", "{", "relation", "=", "senseGlossMatchers", ".", "get", "(", "k", ")", ".", "match", "(", "sourceSense", ",", "targetSense", ")", ";", "k", "++", ";", "}", "return", "relation", ";", "}", "}", "}", "return", "relation", ";", "}" ]
Returns semantic relation between two sets of senses by WordNet sense-based matchers. @param sourceSenses source senses @param targetSenses target senses @return semantic relation between two sets of senses @throws MatcherLibraryException MatcherLibraryException
[ "Returns", "semantic", "relation", "between", "two", "sets", "of", "senses", "by", "WordNet", "sense", "-", "based", "matchers", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/element/MatcherLibrary.java#L228-L244
147,936
mlhartme/sushi
src/main/java/net/oneandone/sushi/xml/Dom.java
Dom.getChildElements
public static List<Element> getChildElements(Element root, String ... steps) { List<Element> lst; lst = new ArrayList<>(); doGetChildElements(root, steps, 0, lst); return lst; }
java
public static List<Element> getChildElements(Element root, String ... steps) { List<Element> lst; lst = new ArrayList<>(); doGetChildElements(root, steps, 0, lst); return lst; }
[ "public", "static", "List", "<", "Element", ">", "getChildElements", "(", "Element", "root", ",", "String", "...", "steps", ")", "{", "List", "<", "Element", ">", "lst", ";", "lst", "=", "new", "ArrayList", "<>", "(", ")", ";", "doGetChildElements", "(", "root", ",", "steps", ",", "0", ",", "lst", ")", ";", "return", "lst", ";", "}" ]
Steps may be empty strings
[ "Steps", "may", "be", "empty", "strings" ]
4af33414b04bd58584d4febe5cc63ef6c7346a75
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/xml/Dom.java#L99-L105
147,937
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/preprocessors/NLPToolsContextPreprocessor.java
NLPToolsContextPreprocessor.processNode
private ILabel processNode(INode currentNode, ArrayList<ILabel> pathToRootPhrases) throws ContextPreprocessorException { if (debugLabels) { log.debug("preprocessing node: " + currentNode.getNodeData().getId() + ", label: " + currentNode.getNodeData().getName()); } // reset old preprocessing currentNode.getNodeData().setcLabFormula(""); currentNode.getNodeData().setcNodeFormula(""); while (0 < currentNode.getNodeData().getACoLCount()) { currentNode.getNodeData().removeACoL(0); } String label = currentNode.getNodeData().getName(); ILabel result = new Label(label); result.setContext(pathToRootPhrases); try { pipeline.process(result); //should contain only token indexes. including not recognized, but except closed class tokens. //something like // 1 & 2 // 1 & (3 | 4) String formula = result.getFormula(); currentNode.getNodeData().setIsPreprocessed(true); //create acols. one acol for each concept (meaningful) token //non-concept tokens should not make it up to a formula. String[] tokenIndexes = formula.split("[ ()&|~]"); Set<String> indexes = new HashSet<String>(Arrays.asList(tokenIndexes)); List<IToken> tokens = result.getTokens(); for (int i = 0; i < tokens.size(); i++) { IToken token = tokens.get(i); String tokenIdx = Integer.toString(i); if (indexes.contains(tokenIdx)) { IAtomicConceptOfLabel acol = currentNode.getNodeData().createACoL(); acol.setId(i); acol.setToken(token.getText()); acol.setLemma(token.getLemma()); for (ISense sense : token.getSenses()) { acol.addSense(sense); } currentNode.getNodeData().addACoL(acol); } } //prepend all token references with node id formula = formula.replaceAll("(\\d+)", currentNode.getNodeData().getId() + ".$1"); formula = formula.trim(); //set it to the node currentNode.getNodeData().setcLabFormula(formula); } catch (PipelineComponentException e) { if (log.isEnabledFor(Level.WARN)) { log.warn("Falling back to heuristic parser for label (" + result.getText() + "): " + e.getMessage(), e); fallbackCount++; dcp.processNode(currentNode); } } return result; }
java
private ILabel processNode(INode currentNode, ArrayList<ILabel> pathToRootPhrases) throws ContextPreprocessorException { if (debugLabels) { log.debug("preprocessing node: " + currentNode.getNodeData().getId() + ", label: " + currentNode.getNodeData().getName()); } // reset old preprocessing currentNode.getNodeData().setcLabFormula(""); currentNode.getNodeData().setcNodeFormula(""); while (0 < currentNode.getNodeData().getACoLCount()) { currentNode.getNodeData().removeACoL(0); } String label = currentNode.getNodeData().getName(); ILabel result = new Label(label); result.setContext(pathToRootPhrases); try { pipeline.process(result); //should contain only token indexes. including not recognized, but except closed class tokens. //something like // 1 & 2 // 1 & (3 | 4) String formula = result.getFormula(); currentNode.getNodeData().setIsPreprocessed(true); //create acols. one acol for each concept (meaningful) token //non-concept tokens should not make it up to a formula. String[] tokenIndexes = formula.split("[ ()&|~]"); Set<String> indexes = new HashSet<String>(Arrays.asList(tokenIndexes)); List<IToken> tokens = result.getTokens(); for (int i = 0; i < tokens.size(); i++) { IToken token = tokens.get(i); String tokenIdx = Integer.toString(i); if (indexes.contains(tokenIdx)) { IAtomicConceptOfLabel acol = currentNode.getNodeData().createACoL(); acol.setId(i); acol.setToken(token.getText()); acol.setLemma(token.getLemma()); for (ISense sense : token.getSenses()) { acol.addSense(sense); } currentNode.getNodeData().addACoL(acol); } } //prepend all token references with node id formula = formula.replaceAll("(\\d+)", currentNode.getNodeData().getId() + ".$1"); formula = formula.trim(); //set it to the node currentNode.getNodeData().setcLabFormula(formula); } catch (PipelineComponentException e) { if (log.isEnabledFor(Level.WARN)) { log.warn("Falling back to heuristic parser for label (" + result.getText() + "): " + e.getMessage(), e); fallbackCount++; dcp.processNode(currentNode); } } return result; }
[ "private", "ILabel", "processNode", "(", "INode", "currentNode", ",", "ArrayList", "<", "ILabel", ">", "pathToRootPhrases", ")", "throws", "ContextPreprocessorException", "{", "if", "(", "debugLabels", ")", "{", "log", ".", "debug", "(", "\"preprocessing node: \"", "+", "currentNode", ".", "getNodeData", "(", ")", ".", "getId", "(", ")", "+", "\", label: \"", "+", "currentNode", ".", "getNodeData", "(", ")", ".", "getName", "(", ")", ")", ";", "}", "// reset old preprocessing\r", "currentNode", ".", "getNodeData", "(", ")", ".", "setcLabFormula", "(", "\"\"", ")", ";", "currentNode", ".", "getNodeData", "(", ")", ".", "setcNodeFormula", "(", "\"\"", ")", ";", "while", "(", "0", "<", "currentNode", ".", "getNodeData", "(", ")", ".", "getACoLCount", "(", ")", ")", "{", "currentNode", ".", "getNodeData", "(", ")", ".", "removeACoL", "(", "0", ")", ";", "}", "String", "label", "=", "currentNode", ".", "getNodeData", "(", ")", ".", "getName", "(", ")", ";", "ILabel", "result", "=", "new", "Label", "(", "label", ")", ";", "result", ".", "setContext", "(", "pathToRootPhrases", ")", ";", "try", "{", "pipeline", ".", "process", "(", "result", ")", ";", "//should contain only token indexes. including not recognized, but except closed class tokens.\r", "//something like\r", "// 1 & 2\r", "// 1 & (3 | 4)\r", "String", "formula", "=", "result", ".", "getFormula", "(", ")", ";", "currentNode", ".", "getNodeData", "(", ")", ".", "setIsPreprocessed", "(", "true", ")", ";", "//create acols. one acol for each concept (meaningful) token\r", "//non-concept tokens should not make it up to a formula.\r", "String", "[", "]", "tokenIndexes", "=", "formula", ".", "split", "(", "\"[ ()&|~]\"", ")", ";", "Set", "<", "String", ">", "indexes", "=", "new", "HashSet", "<", "String", ">", "(", "Arrays", ".", "asList", "(", "tokenIndexes", ")", ")", ";", "List", "<", "IToken", ">", "tokens", "=", "result", ".", "getTokens", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "tokens", ".", "size", "(", ")", ";", "i", "++", ")", "{", "IToken", "token", "=", "tokens", ".", "get", "(", "i", ")", ";", "String", "tokenIdx", "=", "Integer", ".", "toString", "(", "i", ")", ";", "if", "(", "indexes", ".", "contains", "(", "tokenIdx", ")", ")", "{", "IAtomicConceptOfLabel", "acol", "=", "currentNode", ".", "getNodeData", "(", ")", ".", "createACoL", "(", ")", ";", "acol", ".", "setId", "(", "i", ")", ";", "acol", ".", "setToken", "(", "token", ".", "getText", "(", ")", ")", ";", "acol", ".", "setLemma", "(", "token", ".", "getLemma", "(", ")", ")", ";", "for", "(", "ISense", "sense", ":", "token", ".", "getSenses", "(", ")", ")", "{", "acol", ".", "addSense", "(", "sense", ")", ";", "}", "currentNode", ".", "getNodeData", "(", ")", ".", "addACoL", "(", "acol", ")", ";", "}", "}", "//prepend all token references with node id\r", "formula", "=", "formula", ".", "replaceAll", "(", "\"(\\\\d+)\"", ",", "currentNode", ".", "getNodeData", "(", ")", ".", "getId", "(", ")", "+", "\".$1\"", ")", ";", "formula", "=", "formula", ".", "trim", "(", ")", ";", "//set it to the node\r", "currentNode", ".", "getNodeData", "(", ")", ".", "setcLabFormula", "(", "formula", ")", ";", "}", "catch", "(", "PipelineComponentException", "e", ")", "{", "if", "(", "log", ".", "isEnabledFor", "(", "Level", ".", "WARN", ")", ")", "{", "log", ".", "warn", "(", "\"Falling back to heuristic parser for label (\"", "+", "result", ".", "getText", "(", ")", "+", "\"): \"", "+", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "fallbackCount", "++", ";", "dcp", ".", "processNode", "(", "currentNode", ")", ";", "}", "}", "return", "result", ";", "}" ]
Converts current node label into a formula using path to root as a context @param currentNode a node to process @param pathToRootPhrases phrases in the path to root @return phrase instance for a current node label @throws ContextPreprocessorException ContextPreprocessorException
[ "Converts", "current", "node", "label", "into", "a", "formula", "using", "path", "to", "root", "as", "a", "context" ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/preprocessors/NLPToolsContextPreprocessor.java#L131-L189
147,938
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/matchers/element/gloss/WNLemma.java
WNLemma.match
public char match(ISense source, ISense target) throws MatcherLibraryException { List<String> sourceLemmas = source.getLemmas(); List<String> targetLemmas = target.getLemmas(); for (String sourceLemma : sourceLemmas) { for (String targetLemma : targetLemmas) { if (sourceLemma.equals(targetLemma)) { return IMappingElement.EQUIVALENCE; } } } return IMappingElement.IDK; }
java
public char match(ISense source, ISense target) throws MatcherLibraryException { List<String> sourceLemmas = source.getLemmas(); List<String> targetLemmas = target.getLemmas(); for (String sourceLemma : sourceLemmas) { for (String targetLemma : targetLemmas) { if (sourceLemma.equals(targetLemma)) { return IMappingElement.EQUIVALENCE; } } } return IMappingElement.IDK; }
[ "public", "char", "match", "(", "ISense", "source", ",", "ISense", "target", ")", "throws", "MatcherLibraryException", "{", "List", "<", "String", ">", "sourceLemmas", "=", "source", ".", "getLemmas", "(", ")", ";", "List", "<", "String", ">", "targetLemmas", "=", "target", ".", "getLemmas", "(", ")", ";", "for", "(", "String", "sourceLemma", ":", "sourceLemmas", ")", "{", "for", "(", "String", "targetLemma", ":", "targetLemmas", ")", "{", "if", "(", "sourceLemma", ".", "equals", "(", "targetLemma", ")", ")", "{", "return", "IMappingElement", ".", "EQUIVALENCE", ";", "}", "}", "}", "return", "IMappingElement", ".", "IDK", ";", "}" ]
Computes the relation with WordNet lemma matcher. @param source the gloss of source @param target the gloss of target @return synonym or IDk relation
[ "Computes", "the", "relation", "with", "WordNet", "lemma", "matcher", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/element/gloss/WNLemma.java#L28-L39
147,939
netceteragroup/trema-core
src/main/java/com/netcetera/trema/core/exporting/AndroidExporter.java
AndroidExporter.resolveIOSPlaceholders
protected String resolveIOSPlaceholders(String original) { int index = 1; String resolved = original; final Pattern pattern = Pattern.compile("%[a-zA-Z@]"); final Matcher matcher = pattern.matcher(original); while (matcher.find()) { String placeholderIOS = matcher.group(); String placeholderAndroid = placeholderMap.get(placeholderIOS); if (placeholderAndroid != null) { placeholderAndroid = String.format(placeholderAndroid, index++); resolved = resolved.replaceFirst(placeholderIOS, placeholderAndroid); } } return resolved; }
java
protected String resolveIOSPlaceholders(String original) { int index = 1; String resolved = original; final Pattern pattern = Pattern.compile("%[a-zA-Z@]"); final Matcher matcher = pattern.matcher(original); while (matcher.find()) { String placeholderIOS = matcher.group(); String placeholderAndroid = placeholderMap.get(placeholderIOS); if (placeholderAndroid != null) { placeholderAndroid = String.format(placeholderAndroid, index++); resolved = resolved.replaceFirst(placeholderIOS, placeholderAndroid); } } return resolved; }
[ "protected", "String", "resolveIOSPlaceholders", "(", "String", "original", ")", "{", "int", "index", "=", "1", ";", "String", "resolved", "=", "original", ";", "final", "Pattern", "pattern", "=", "Pattern", ".", "compile", "(", "\"%[a-zA-Z@]\"", ")", ";", "final", "Matcher", "matcher", "=", "pattern", ".", "matcher", "(", "original", ")", ";", "while", "(", "matcher", ".", "find", "(", ")", ")", "{", "String", "placeholderIOS", "=", "matcher", ".", "group", "(", ")", ";", "String", "placeholderAndroid", "=", "placeholderMap", ".", "get", "(", "placeholderIOS", ")", ";", "if", "(", "placeholderAndroid", "!=", "null", ")", "{", "placeholderAndroid", "=", "String", ".", "format", "(", "placeholderAndroid", ",", "index", "++", ")", ";", "resolved", "=", "resolved", ".", "replaceFirst", "(", "placeholderIOS", ",", "placeholderAndroid", ")", ";", "}", "}", "return", "resolved", ";", "}" ]
Returns a string with resolved iOS placeholders. @param original the original text @return The text with resolved iOS placeholders (if there were some).
[ "Returns", "a", "string", "with", "resolved", "iOS", "placeholders", "." ]
e5367f4b80b38038d462627aa146a62bc34fc489
https://github.com/netceteragroup/trema-core/blob/e5367f4b80b38038d462627aa146a62bc34fc489/src/main/java/com/netcetera/trema/core/exporting/AndroidExporter.java#L130-L146
147,940
kmi/iserve
iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/impl/GenericLogicDiscoverer.java
GenericLogicDiscoverer.findSome
private Map<URI, MatchResult> findSome(URI entityType, URI relationship, Set<URI> types, MatchType matchType) { // Ensure that we have been given correct parameters if (types == null || types.isEmpty() || (!entityType.toASCIIString().equals(MSM.Service.getURI()) && !entityType.toASCIIString().equals(MSM.Operation.getURI())) || (!relationship.toASCIIString().equals(MSM.hasInput.getURI()) && !relationship.toASCIIString().equals(MSM.hasOutput.getURI()) && !relationship.toASCIIString().equals(SAWSDL.modelReference.getURI()))) { return ImmutableMap.of(); } // Expand the input types to get all that match enough to be consumed // The structure is: <OriginalType, MatchingType, MatchResult> Table<URI, URI, MatchResult> expandedTypes; if (matchType.equals(LogicConceptMatchType.Subsume)) { expandedTypes = HashBasedTable.create(); for (URI type : types) { expandedTypes.putAll(this.conceptMatcher.listMatchesAtMostOfType(ImmutableSet.of(type), LogicConceptMatchType.Subsume)); expandedTypes.putAll(this.conceptMatcher.listMatchesOfType(ImmutableSet.of(type), LogicConceptMatchType.Exact)); } } else if (matchType.equals(LogicConceptMatchType.Plugin)) { expandedTypes = this.conceptMatcher.listMatchesAtLeastOfType(types, LogicConceptMatchType.Plugin); } else { expandedTypes = HashBasedTable.create(); for (URI type : types) { expandedTypes.putAll(this.conceptMatcher.listMatchesOfType(ImmutableSet.of(type), LogicConceptMatchType.Exact)); } } // Track all the results in a multimap to push the details up the stack Multimap<URI, MatchResult> result = ArrayListMultimap.create(); // Find all the entities with modelReferences to the expanded types // The column view is the one with all the possible matches since a class will always match itself Map<URI, Map<URI, MatchResult>> columnMap = expandedTypes.columnMap(); for (URI type : columnMap.keySet()) { Set<URI> entities = ImmutableSet.of(); if (relationship.toASCIIString().equals(SAWSDL.modelReference.getURI())) { entities = listEntitesWithModelReference(entityType, type); } else if (relationship.toASCIIString().equals(MSM.hasInput.getURI()) || relationship.toASCIIString().equals(MSM.hasOutput.getURI())) { entities = listEntitiesWithType(entityType, relationship, type); } for (URI entity : entities) { result.putAll(entity, columnMap.get(type).values()); } } // Merge the results into a single map using Union return Maps.transformValues(result.asMap(), MatchResultsMerger.UNION); }
java
private Map<URI, MatchResult> findSome(URI entityType, URI relationship, Set<URI> types, MatchType matchType) { // Ensure that we have been given correct parameters if (types == null || types.isEmpty() || (!entityType.toASCIIString().equals(MSM.Service.getURI()) && !entityType.toASCIIString().equals(MSM.Operation.getURI())) || (!relationship.toASCIIString().equals(MSM.hasInput.getURI()) && !relationship.toASCIIString().equals(MSM.hasOutput.getURI()) && !relationship.toASCIIString().equals(SAWSDL.modelReference.getURI()))) { return ImmutableMap.of(); } // Expand the input types to get all that match enough to be consumed // The structure is: <OriginalType, MatchingType, MatchResult> Table<URI, URI, MatchResult> expandedTypes; if (matchType.equals(LogicConceptMatchType.Subsume)) { expandedTypes = HashBasedTable.create(); for (URI type : types) { expandedTypes.putAll(this.conceptMatcher.listMatchesAtMostOfType(ImmutableSet.of(type), LogicConceptMatchType.Subsume)); expandedTypes.putAll(this.conceptMatcher.listMatchesOfType(ImmutableSet.of(type), LogicConceptMatchType.Exact)); } } else if (matchType.equals(LogicConceptMatchType.Plugin)) { expandedTypes = this.conceptMatcher.listMatchesAtLeastOfType(types, LogicConceptMatchType.Plugin); } else { expandedTypes = HashBasedTable.create(); for (URI type : types) { expandedTypes.putAll(this.conceptMatcher.listMatchesOfType(ImmutableSet.of(type), LogicConceptMatchType.Exact)); } } // Track all the results in a multimap to push the details up the stack Multimap<URI, MatchResult> result = ArrayListMultimap.create(); // Find all the entities with modelReferences to the expanded types // The column view is the one with all the possible matches since a class will always match itself Map<URI, Map<URI, MatchResult>> columnMap = expandedTypes.columnMap(); for (URI type : columnMap.keySet()) { Set<URI> entities = ImmutableSet.of(); if (relationship.toASCIIString().equals(SAWSDL.modelReference.getURI())) { entities = listEntitesWithModelReference(entityType, type); } else if (relationship.toASCIIString().equals(MSM.hasInput.getURI()) || relationship.toASCIIString().equals(MSM.hasOutput.getURI())) { entities = listEntitiesWithType(entityType, relationship, type); } for (URI entity : entities) { result.putAll(entity, columnMap.get(type).values()); } } // Merge the results into a single map using Union return Maps.transformValues(result.asMap(), MatchResultsMerger.UNION); }
[ "private", "Map", "<", "URI", ",", "MatchResult", ">", "findSome", "(", "URI", "entityType", ",", "URI", "relationship", ",", "Set", "<", "URI", ">", "types", ",", "MatchType", "matchType", ")", "{", "// Ensure that we have been given correct parameters", "if", "(", "types", "==", "null", "||", "types", ".", "isEmpty", "(", ")", "||", "(", "!", "entityType", ".", "toASCIIString", "(", ")", ".", "equals", "(", "MSM", ".", "Service", ".", "getURI", "(", ")", ")", "&&", "!", "entityType", ".", "toASCIIString", "(", ")", ".", "equals", "(", "MSM", ".", "Operation", ".", "getURI", "(", ")", ")", ")", "||", "(", "!", "relationship", ".", "toASCIIString", "(", ")", ".", "equals", "(", "MSM", ".", "hasInput", ".", "getURI", "(", ")", ")", "&&", "!", "relationship", ".", "toASCIIString", "(", ")", ".", "equals", "(", "MSM", ".", "hasOutput", ".", "getURI", "(", ")", ")", "&&", "!", "relationship", ".", "toASCIIString", "(", ")", ".", "equals", "(", "SAWSDL", ".", "modelReference", ".", "getURI", "(", ")", ")", ")", ")", "{", "return", "ImmutableMap", ".", "of", "(", ")", ";", "}", "// Expand the input types to get all that match enough to be consumed", "// The structure is: <OriginalType, MatchingType, MatchResult>", "Table", "<", "URI", ",", "URI", ",", "MatchResult", ">", "expandedTypes", ";", "if", "(", "matchType", ".", "equals", "(", "LogicConceptMatchType", ".", "Subsume", ")", ")", "{", "expandedTypes", "=", "HashBasedTable", ".", "create", "(", ")", ";", "for", "(", "URI", "type", ":", "types", ")", "{", "expandedTypes", ".", "putAll", "(", "this", ".", "conceptMatcher", ".", "listMatchesAtMostOfType", "(", "ImmutableSet", ".", "of", "(", "type", ")", ",", "LogicConceptMatchType", ".", "Subsume", ")", ")", ";", "expandedTypes", ".", "putAll", "(", "this", ".", "conceptMatcher", ".", "listMatchesOfType", "(", "ImmutableSet", ".", "of", "(", "type", ")", ",", "LogicConceptMatchType", ".", "Exact", ")", ")", ";", "}", "}", "else", "if", "(", "matchType", ".", "equals", "(", "LogicConceptMatchType", ".", "Plugin", ")", ")", "{", "expandedTypes", "=", "this", ".", "conceptMatcher", ".", "listMatchesAtLeastOfType", "(", "types", ",", "LogicConceptMatchType", ".", "Plugin", ")", ";", "}", "else", "{", "expandedTypes", "=", "HashBasedTable", ".", "create", "(", ")", ";", "for", "(", "URI", "type", ":", "types", ")", "{", "expandedTypes", ".", "putAll", "(", "this", ".", "conceptMatcher", ".", "listMatchesOfType", "(", "ImmutableSet", ".", "of", "(", "type", ")", ",", "LogicConceptMatchType", ".", "Exact", ")", ")", ";", "}", "}", "// Track all the results in a multimap to push the details up the stack", "Multimap", "<", "URI", ",", "MatchResult", ">", "result", "=", "ArrayListMultimap", ".", "create", "(", ")", ";", "// Find all the entities with modelReferences to the expanded types", "// The column view is the one with all the possible matches since a class will always match itself", "Map", "<", "URI", ",", "Map", "<", "URI", ",", "MatchResult", ">", ">", "columnMap", "=", "expandedTypes", ".", "columnMap", "(", ")", ";", "for", "(", "URI", "type", ":", "columnMap", ".", "keySet", "(", ")", ")", "{", "Set", "<", "URI", ">", "entities", "=", "ImmutableSet", ".", "of", "(", ")", ";", "if", "(", "relationship", ".", "toASCIIString", "(", ")", ".", "equals", "(", "SAWSDL", ".", "modelReference", ".", "getURI", "(", ")", ")", ")", "{", "entities", "=", "listEntitesWithModelReference", "(", "entityType", ",", "type", ")", ";", "}", "else", "if", "(", "relationship", ".", "toASCIIString", "(", ")", ".", "equals", "(", "MSM", ".", "hasInput", ".", "getURI", "(", ")", ")", "||", "relationship", ".", "toASCIIString", "(", ")", ".", "equals", "(", "MSM", ".", "hasOutput", ".", "getURI", "(", ")", ")", ")", "{", "entities", "=", "listEntitiesWithType", "(", "entityType", ",", "relationship", ",", "type", ")", ";", "}", "for", "(", "URI", "entity", ":", "entities", ")", "{", "result", ".", "putAll", "(", "entity", ",", "columnMap", ".", "get", "(", "type", ")", ".", "values", "(", ")", ")", ";", "}", "}", "// Merge the results into a single map using Union", "return", "Maps", ".", "transformValues", "(", "result", ".", "asMap", "(", ")", ",", "MatchResultsMerger", ".", "UNION", ")", ";", "}" ]
Generic implementation for finding all the Services or Operations that have SOME of the given types as inputs or outputs. @param entityType the MSM URI of the type of entity we are looking for. Only supports Service and Operation. @param relationship the MSM URI of the relationship we are looking for. Only supports hasInput and hasOutput. @param types the input/output types (modelReferences that is) we are looking for @param matchType @return a Map mapping operation/services URIs to MatchResults.
[ "Generic", "implementation", "for", "finding", "all", "the", "Services", "or", "Operations", "that", "have", "SOME", "of", "the", "given", "types", "as", "inputs", "or", "outputs", "." ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/impl/GenericLogicDiscoverer.java#L134-L184
147,941
kmi/iserve
iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/impl/GenericLogicDiscoverer.java
GenericLogicDiscoverer.listEntitesWithModelReference
private Set<URI> listEntitesWithModelReference(URI entityType, URI modelReference) { Set<URI> entities = ImmutableSet.of(); // Deal with services if (entityType.toASCIIString().equals(MSM.Service.getURI())) { entities = this.serviceManager.listServicesWithModelReference(modelReference); } else if (entityType.toASCIIString().equals(MSM.Operation.getURI())) { entities = this.serviceManager.listOperationsWithModelReference(modelReference); } return entities; }
java
private Set<URI> listEntitesWithModelReference(URI entityType, URI modelReference) { Set<URI> entities = ImmutableSet.of(); // Deal with services if (entityType.toASCIIString().equals(MSM.Service.getURI())) { entities = this.serviceManager.listServicesWithModelReference(modelReference); } else if (entityType.toASCIIString().equals(MSM.Operation.getURI())) { entities = this.serviceManager.listOperationsWithModelReference(modelReference); } return entities; }
[ "private", "Set", "<", "URI", ">", "listEntitesWithModelReference", "(", "URI", "entityType", ",", "URI", "modelReference", ")", "{", "Set", "<", "URI", ">", "entities", "=", "ImmutableSet", ".", "of", "(", ")", ";", "// Deal with services", "if", "(", "entityType", ".", "toASCIIString", "(", ")", ".", "equals", "(", "MSM", ".", "Service", ".", "getURI", "(", ")", ")", ")", "{", "entities", "=", "this", ".", "serviceManager", ".", "listServicesWithModelReference", "(", "modelReference", ")", ";", "}", "else", "if", "(", "entityType", ".", "toASCIIString", "(", ")", ".", "equals", "(", "MSM", ".", "Operation", ".", "getURI", "(", ")", ")", ")", "{", "entities", "=", "this", ".", "serviceManager", ".", "listOperationsWithModelReference", "(", "modelReference", ")", ";", "}", "return", "entities", ";", "}" ]
Generic implementation for finding all the Services or Operations that have one specific model reference. @param entityType the MSM URI of the type of entity we are looking for. Only supports Service and Operation. @param modelReference the model reference URI we are looking for. @returns a Set of URIs of matching services/operations. Note that this method makes no use of reasoning and therefore the match will always be exact in this case.
[ "Generic", "implementation", "for", "finding", "all", "the", "Services", "or", "Operations", "that", "have", "one", "specific", "model", "reference", "." ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/impl/GenericLogicDiscoverer.java#L195-L204
147,942
kmi/iserve
iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/impl/GenericLogicDiscoverer.java
GenericLogicDiscoverer.listEntitiesWithType
private Set<URI> listEntitiesWithType(URI entityType, URI relationship, URI type) { Set<URI> entities = ImmutableSet.of(); // Deal with services if (entityType.toASCIIString().equals(MSM.Service.getURI())) { // Get the adequate type if (relationship.toASCIIString().equals(MSM.hasInput.getURI())) { entities = this.serviceManager.listServicesWithInputType(type); } else if (relationship.toASCIIString().equals(MSM.hasOutput.getURI())) { entities = this.serviceManager.listServicesWithOutputType(type); } // Deal with operations } else if (entityType.toASCIIString().equals(MSM.Operation.getURI())) { // Get the adequate type if (relationship.toASCIIString().equals(MSM.hasInput.getURI())) { entities = this.serviceManager.listOperationsWithInputType(type); } else if (relationship.toASCIIString().equals(MSM.hasOutput.getURI())) { entities = this.serviceManager.listOperationsWithOutputType(type); } } return entities; }
java
private Set<URI> listEntitiesWithType(URI entityType, URI relationship, URI type) { Set<URI> entities = ImmutableSet.of(); // Deal with services if (entityType.toASCIIString().equals(MSM.Service.getURI())) { // Get the adequate type if (relationship.toASCIIString().equals(MSM.hasInput.getURI())) { entities = this.serviceManager.listServicesWithInputType(type); } else if (relationship.toASCIIString().equals(MSM.hasOutput.getURI())) { entities = this.serviceManager.listServicesWithOutputType(type); } // Deal with operations } else if (entityType.toASCIIString().equals(MSM.Operation.getURI())) { // Get the adequate type if (relationship.toASCIIString().equals(MSM.hasInput.getURI())) { entities = this.serviceManager.listOperationsWithInputType(type); } else if (relationship.toASCIIString().equals(MSM.hasOutput.getURI())) { entities = this.serviceManager.listOperationsWithOutputType(type); } } return entities; }
[ "private", "Set", "<", "URI", ">", "listEntitiesWithType", "(", "URI", "entityType", ",", "URI", "relationship", ",", "URI", "type", ")", "{", "Set", "<", "URI", ">", "entities", "=", "ImmutableSet", ".", "of", "(", ")", ";", "// Deal with services", "if", "(", "entityType", ".", "toASCIIString", "(", ")", ".", "equals", "(", "MSM", ".", "Service", ".", "getURI", "(", ")", ")", ")", "{", "// Get the adequate type", "if", "(", "relationship", ".", "toASCIIString", "(", ")", ".", "equals", "(", "MSM", ".", "hasInput", ".", "getURI", "(", ")", ")", ")", "{", "entities", "=", "this", ".", "serviceManager", ".", "listServicesWithInputType", "(", "type", ")", ";", "}", "else", "if", "(", "relationship", ".", "toASCIIString", "(", ")", ".", "equals", "(", "MSM", ".", "hasOutput", ".", "getURI", "(", ")", ")", ")", "{", "entities", "=", "this", ".", "serviceManager", ".", "listServicesWithOutputType", "(", "type", ")", ";", "}", "// Deal with operations", "}", "else", "if", "(", "entityType", ".", "toASCIIString", "(", ")", ".", "equals", "(", "MSM", ".", "Operation", ".", "getURI", "(", ")", ")", ")", "{", "// Get the adequate type", "if", "(", "relationship", ".", "toASCIIString", "(", ")", ".", "equals", "(", "MSM", ".", "hasInput", ".", "getURI", "(", ")", ")", ")", "{", "entities", "=", "this", ".", "serviceManager", ".", "listOperationsWithInputType", "(", "type", ")", ";", "}", "else", "if", "(", "relationship", ".", "toASCIIString", "(", ")", ".", "equals", "(", "MSM", ".", "hasOutput", ".", "getURI", "(", ")", ")", ")", "{", "entities", "=", "this", ".", "serviceManager", ".", "listOperationsWithOutputType", "(", "type", ")", ";", "}", "}", "return", "entities", ";", "}" ]
Generic implementation for finding all the Services or Operations that have one specific type as input or output. @param entityType the MSM URI of the type of entity we are looking for. Only supports Service and Operation. @param relationship the MSM URI of the relationship we are looking for. Only supports hasInput and hasOutput. @param type the input/output type (modelReference that is) we are looking for. @returns a Set of URIs of matching services/operations. Note that this method makes no use of reasoning and therefore the match will always be exact in this case.
[ "Generic", "implementation", "for", "finding", "all", "the", "Services", "or", "Operations", "that", "have", "one", "specific", "type", "as", "input", "or", "output", "." ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/impl/GenericLogicDiscoverer.java#L215-L238
147,943
kmi/iserve
iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/impl/GenericLogicDiscoverer.java
GenericLogicDiscoverer.findOperationsConsumingAll
@Override public Map<URI, MatchResult> findOperationsConsumingAll(Set<URI> inputTypes) { return findOperationsConsumingAll(inputTypes, LogicConceptMatchType.Plugin); }
java
@Override public Map<URI, MatchResult> findOperationsConsumingAll(Set<URI> inputTypes) { return findOperationsConsumingAll(inputTypes, LogicConceptMatchType.Plugin); }
[ "@", "Override", "public", "Map", "<", "URI", ",", "MatchResult", ">", "findOperationsConsumingAll", "(", "Set", "<", "URI", ">", "inputTypes", ")", "{", "return", "findOperationsConsumingAll", "(", "inputTypes", ",", "LogicConceptMatchType", ".", "Plugin", ")", ";", "}" ]
Discover registered operations that consume all the types of input provided. That is, all those that have as input the types provided. All the input types should be matched to different inputs. @param inputTypes the types of input to be consumed @return a Set containing all the matching operations. If there are no solutions, the Set should be empty, not null.
[ "Discover", "registered", "operations", "that", "consume", "all", "the", "types", "of", "input", "provided", ".", "That", "is", "all", "those", "that", "have", "as", "input", "the", "types", "provided", ".", "All", "the", "input", "types", "should", "be", "matched", "to", "different", "inputs", "." ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/impl/GenericLogicDiscoverer.java#L248-L251
147,944
kmi/iserve
iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/impl/GenericLogicDiscoverer.java
GenericLogicDiscoverer.findServicesClassifiedByAll
@Override public Map<URI, MatchResult> findServicesClassifiedByAll(Set<URI> modelReferences) { return findServicesClassifiedByAll(modelReferences, LogicConceptMatchType.Subsume); }
java
@Override public Map<URI, MatchResult> findServicesClassifiedByAll(Set<URI> modelReferences) { return findServicesClassifiedByAll(modelReferences, LogicConceptMatchType.Subsume); }
[ "@", "Override", "public", "Map", "<", "URI", ",", "MatchResult", ">", "findServicesClassifiedByAll", "(", "Set", "<", "URI", ">", "modelReferences", ")", "{", "return", "findServicesClassifiedByAll", "(", "modelReferences", ",", "LogicConceptMatchType", ".", "Subsume", ")", ";", "}" ]
Discover the services that are classified by all the types given. That is, all those that have some level of matching with respect to all services provided in the model references. @param modelReferences the classifications to match against @return a Set containing all the matching services. If there are no solutions, the Set should be empty, not null.
[ "Discover", "the", "services", "that", "are", "classified", "by", "all", "the", "types", "given", ".", "That", "is", "all", "those", "that", "have", "some", "level", "of", "matching", "with", "respect", "to", "all", "services", "provided", "in", "the", "model", "references", "." ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/impl/GenericLogicDiscoverer.java#L435-L438
147,945
udoprog/ffwd-client-java
src/main/java/com/google/protobuf250/FieldSet.java
FieldSet.getAllFields
public Map<FieldDescriptorType, Object> getAllFields() { if (hasLazyField) { SmallSortedMap<FieldDescriptorType, Object> result = SmallSortedMap.newFieldMap(16); for (int i = 0; i < fields.getNumArrayEntries(); i++) { cloneFieldEntry(result, fields.getArrayEntryAt(i)); } for (Map.Entry<FieldDescriptorType, Object> entry : fields.getOverflowEntries()) { cloneFieldEntry(result, entry); } if (fields.isImmutable()) { result.makeImmutable(); } return result; } return fields.isImmutable() ? fields : Collections.unmodifiableMap(fields); }
java
public Map<FieldDescriptorType, Object> getAllFields() { if (hasLazyField) { SmallSortedMap<FieldDescriptorType, Object> result = SmallSortedMap.newFieldMap(16); for (int i = 0; i < fields.getNumArrayEntries(); i++) { cloneFieldEntry(result, fields.getArrayEntryAt(i)); } for (Map.Entry<FieldDescriptorType, Object> entry : fields.getOverflowEntries()) { cloneFieldEntry(result, entry); } if (fields.isImmutable()) { result.makeImmutable(); } return result; } return fields.isImmutable() ? fields : Collections.unmodifiableMap(fields); }
[ "public", "Map", "<", "FieldDescriptorType", ",", "Object", ">", "getAllFields", "(", ")", "{", "if", "(", "hasLazyField", ")", "{", "SmallSortedMap", "<", "FieldDescriptorType", ",", "Object", ">", "result", "=", "SmallSortedMap", ".", "newFieldMap", "(", "16", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "fields", ".", "getNumArrayEntries", "(", ")", ";", "i", "++", ")", "{", "cloneFieldEntry", "(", "result", ",", "fields", ".", "getArrayEntryAt", "(", "i", ")", ")", ";", "}", "for", "(", "Map", ".", "Entry", "<", "FieldDescriptorType", ",", "Object", ">", "entry", ":", "fields", ".", "getOverflowEntries", "(", ")", ")", "{", "cloneFieldEntry", "(", "result", ",", "entry", ")", ";", "}", "if", "(", "fields", ".", "isImmutable", "(", ")", ")", "{", "result", ".", "makeImmutable", "(", ")", ";", "}", "return", "result", ";", "}", "return", "fields", ".", "isImmutable", "(", ")", "?", "fields", ":", "Collections", ".", "unmodifiableMap", "(", "fields", ")", ";", "}" ]
Get a simple map containing all the fields.
[ "Get", "a", "simple", "map", "containing", "all", "the", "fields", "." ]
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/FieldSet.java#L160-L177
147,946
udoprog/ffwd-client-java
src/main/java/com/google/protobuf250/FieldSet.java
FieldSet.iterator
public Iterator<Map.Entry<FieldDescriptorType, Object>> iterator() { if (hasLazyField) { return new LazyIterator<FieldDescriptorType>( fields.entrySet().iterator()); } return fields.entrySet().iterator(); }
java
public Iterator<Map.Entry<FieldDescriptorType, Object>> iterator() { if (hasLazyField) { return new LazyIterator<FieldDescriptorType>( fields.entrySet().iterator()); } return fields.entrySet().iterator(); }
[ "public", "Iterator", "<", "Map", ".", "Entry", "<", "FieldDescriptorType", ",", "Object", ">", ">", "iterator", "(", ")", "{", "if", "(", "hasLazyField", ")", "{", "return", "new", "LazyIterator", "<", "FieldDescriptorType", ">", "(", "fields", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ")", ";", "}", "return", "fields", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "}" ]
Get an iterator to the field map. This iterator should not be leaked out of the protobuf library as it is not protected from mutation when fields is not immutable.
[ "Get", "an", "iterator", "to", "the", "field", "map", ".", "This", "iterator", "should", "not", "be", "leaked", "out", "of", "the", "protobuf", "library", "as", "it", "is", "not", "protected", "from", "mutation", "when", "fields", "is", "not", "immutable", "." ]
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/FieldSet.java#L195-L201
147,947
udoprog/ffwd-client-java
src/main/java/com/google/protobuf250/FieldSet.java
FieldSet.writeElementNoTag
private static void writeElementNoTag( final CodedOutputStream output, final WireFormat.FieldType type, final Object value) throws IOException { switch (type) { case DOUBLE : output.writeDoubleNoTag ((Double ) value); break; case FLOAT : output.writeFloatNoTag ((Float ) value); break; case INT64 : output.writeInt64NoTag ((Long ) value); break; case UINT64 : output.writeUInt64NoTag ((Long ) value); break; case INT32 : output.writeInt32NoTag ((Integer ) value); break; case FIXED64 : output.writeFixed64NoTag ((Long ) value); break; case FIXED32 : output.writeFixed32NoTag ((Integer ) value); break; case BOOL : output.writeBoolNoTag ((Boolean ) value); break; case STRING : output.writeStringNoTag ((String ) value); break; case GROUP : output.writeGroupNoTag ((MessageLite) value); break; case MESSAGE : output.writeMessageNoTag ((MessageLite) value); break; case BYTES : output.writeBytesNoTag ((ByteString ) value); break; case UINT32 : output.writeUInt32NoTag ((Integer ) value); break; case SFIXED32: output.writeSFixed32NoTag((Integer ) value); break; case SFIXED64: output.writeSFixed64NoTag((Long ) value); break; case SINT32 : output.writeSInt32NoTag ((Integer ) value); break; case SINT64 : output.writeSInt64NoTag ((Long ) value); break; case ENUM: output.writeEnumNoTag(((Internal.EnumLite) value).getNumber()); break; } }
java
private static void writeElementNoTag( final CodedOutputStream output, final WireFormat.FieldType type, final Object value) throws IOException { switch (type) { case DOUBLE : output.writeDoubleNoTag ((Double ) value); break; case FLOAT : output.writeFloatNoTag ((Float ) value); break; case INT64 : output.writeInt64NoTag ((Long ) value); break; case UINT64 : output.writeUInt64NoTag ((Long ) value); break; case INT32 : output.writeInt32NoTag ((Integer ) value); break; case FIXED64 : output.writeFixed64NoTag ((Long ) value); break; case FIXED32 : output.writeFixed32NoTag ((Integer ) value); break; case BOOL : output.writeBoolNoTag ((Boolean ) value); break; case STRING : output.writeStringNoTag ((String ) value); break; case GROUP : output.writeGroupNoTag ((MessageLite) value); break; case MESSAGE : output.writeMessageNoTag ((MessageLite) value); break; case BYTES : output.writeBytesNoTag ((ByteString ) value); break; case UINT32 : output.writeUInt32NoTag ((Integer ) value); break; case SFIXED32: output.writeSFixed32NoTag((Integer ) value); break; case SFIXED64: output.writeSFixed64NoTag((Long ) value); break; case SINT32 : output.writeSInt32NoTag ((Integer ) value); break; case SINT64 : output.writeSInt64NoTag ((Long ) value); break; case ENUM: output.writeEnumNoTag(((Internal.EnumLite) value).getNumber()); break; } }
[ "private", "static", "void", "writeElementNoTag", "(", "final", "CodedOutputStream", "output", ",", "final", "WireFormat", ".", "FieldType", "type", ",", "final", "Object", "value", ")", "throws", "IOException", "{", "switch", "(", "type", ")", "{", "case", "DOUBLE", ":", "output", ".", "writeDoubleNoTag", "(", "(", "Double", ")", "value", ")", ";", "break", ";", "case", "FLOAT", ":", "output", ".", "writeFloatNoTag", "(", "(", "Float", ")", "value", ")", ";", "break", ";", "case", "INT64", ":", "output", ".", "writeInt64NoTag", "(", "(", "Long", ")", "value", ")", ";", "break", ";", "case", "UINT64", ":", "output", ".", "writeUInt64NoTag", "(", "(", "Long", ")", "value", ")", ";", "break", ";", "case", "INT32", ":", "output", ".", "writeInt32NoTag", "(", "(", "Integer", ")", "value", ")", ";", "break", ";", "case", "FIXED64", ":", "output", ".", "writeFixed64NoTag", "(", "(", "Long", ")", "value", ")", ";", "break", ";", "case", "FIXED32", ":", "output", ".", "writeFixed32NoTag", "(", "(", "Integer", ")", "value", ")", ";", "break", ";", "case", "BOOL", ":", "output", ".", "writeBoolNoTag", "(", "(", "Boolean", ")", "value", ")", ";", "break", ";", "case", "STRING", ":", "output", ".", "writeStringNoTag", "(", "(", "String", ")", "value", ")", ";", "break", ";", "case", "GROUP", ":", "output", ".", "writeGroupNoTag", "(", "(", "MessageLite", ")", "value", ")", ";", "break", ";", "case", "MESSAGE", ":", "output", ".", "writeMessageNoTag", "(", "(", "MessageLite", ")", "value", ")", ";", "break", ";", "case", "BYTES", ":", "output", ".", "writeBytesNoTag", "(", "(", "ByteString", ")", "value", ")", ";", "break", ";", "case", "UINT32", ":", "output", ".", "writeUInt32NoTag", "(", "(", "Integer", ")", "value", ")", ";", "break", ";", "case", "SFIXED32", ":", "output", ".", "writeSFixed32NoTag", "(", "(", "Integer", ")", "value", ")", ";", "break", ";", "case", "SFIXED64", ":", "output", ".", "writeSFixed64NoTag", "(", "(", "Long", ")", "value", ")", ";", "break", ";", "case", "SINT32", ":", "output", ".", "writeSInt32NoTag", "(", "(", "Integer", ")", "value", ")", ";", "break", ";", "case", "SINT64", ":", "output", ".", "writeSInt64NoTag", "(", "(", "Long", ")", "value", ")", ";", "break", ";", "case", "ENUM", ":", "output", ".", "writeEnumNoTag", "(", "(", "(", "Internal", ".", "EnumLite", ")", "value", ")", ".", "getNumber", "(", ")", ")", ";", "break", ";", "}", "}" ]
Write a field of arbitrary type, without its tag, to the stream. @param output The output stream. @param type The field's type. @param value Object representing the field's value. Must be of the exact type which would be returned by {@link Message#getField(Descriptors.FieldDescriptor)} for this field.
[ "Write", "a", "field", "of", "arbitrary", "type", "without", "its", "tag", "to", "the", "stream", "." ]
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/FieldSet.java#L650-L677
147,948
udoprog/ffwd-client-java
src/main/java/com/google/protobuf250/FieldSet.java
FieldSet.writeField
public static void writeField(final FieldDescriptorLite<?> descriptor, final Object value, final CodedOutputStream output) throws IOException { WireFormat.FieldType type = descriptor.getLiteType(); int number = descriptor.getNumber(); if (descriptor.isRepeated()) { final List<?> valueList = (List<?>)value; if (descriptor.isPacked()) { output.writeTag(number, WireFormat.WIRETYPE_LENGTH_DELIMITED); // Compute the total data size so the length can be written. int dataSize = 0; for (final Object element : valueList) { dataSize += computeElementSizeNoTag(type, element); } output.writeRawVarint32(dataSize); // Write the data itself, without any tags. for (final Object element : valueList) { writeElementNoTag(output, type, element); } } else { for (final Object element : valueList) { writeElement(output, type, number, element); } } } else { if (value instanceof LazyField) { writeElement(output, type, number, ((LazyField) value).getValue()); } else { writeElement(output, type, number, value); } } }
java
public static void writeField(final FieldDescriptorLite<?> descriptor, final Object value, final CodedOutputStream output) throws IOException { WireFormat.FieldType type = descriptor.getLiteType(); int number = descriptor.getNumber(); if (descriptor.isRepeated()) { final List<?> valueList = (List<?>)value; if (descriptor.isPacked()) { output.writeTag(number, WireFormat.WIRETYPE_LENGTH_DELIMITED); // Compute the total data size so the length can be written. int dataSize = 0; for (final Object element : valueList) { dataSize += computeElementSizeNoTag(type, element); } output.writeRawVarint32(dataSize); // Write the data itself, without any tags. for (final Object element : valueList) { writeElementNoTag(output, type, element); } } else { for (final Object element : valueList) { writeElement(output, type, number, element); } } } else { if (value instanceof LazyField) { writeElement(output, type, number, ((LazyField) value).getValue()); } else { writeElement(output, type, number, value); } } }
[ "public", "static", "void", "writeField", "(", "final", "FieldDescriptorLite", "<", "?", ">", "descriptor", ",", "final", "Object", "value", ",", "final", "CodedOutputStream", "output", ")", "throws", "IOException", "{", "WireFormat", ".", "FieldType", "type", "=", "descriptor", ".", "getLiteType", "(", ")", ";", "int", "number", "=", "descriptor", ".", "getNumber", "(", ")", ";", "if", "(", "descriptor", ".", "isRepeated", "(", ")", ")", "{", "final", "List", "<", "?", ">", "valueList", "=", "(", "List", "<", "?", ">", ")", "value", ";", "if", "(", "descriptor", ".", "isPacked", "(", ")", ")", "{", "output", ".", "writeTag", "(", "number", ",", "WireFormat", ".", "WIRETYPE_LENGTH_DELIMITED", ")", ";", "// Compute the total data size so the length can be written.", "int", "dataSize", "=", "0", ";", "for", "(", "final", "Object", "element", ":", "valueList", ")", "{", "dataSize", "+=", "computeElementSizeNoTag", "(", "type", ",", "element", ")", ";", "}", "output", ".", "writeRawVarint32", "(", "dataSize", ")", ";", "// Write the data itself, without any tags.", "for", "(", "final", "Object", "element", ":", "valueList", ")", "{", "writeElementNoTag", "(", "output", ",", "type", ",", "element", ")", ";", "}", "}", "else", "{", "for", "(", "final", "Object", "element", ":", "valueList", ")", "{", "writeElement", "(", "output", ",", "type", ",", "number", ",", "element", ")", ";", "}", "}", "}", "else", "{", "if", "(", "value", "instanceof", "LazyField", ")", "{", "writeElement", "(", "output", ",", "type", ",", "number", ",", "(", "(", "LazyField", ")", "value", ")", ".", "getValue", "(", ")", ")", ";", "}", "else", "{", "writeElement", "(", "output", ",", "type", ",", "number", ",", "value", ")", ";", "}", "}", "}" ]
Write a single field.
[ "Write", "a", "single", "field", "." ]
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/FieldSet.java#L680-L712
147,949
udoprog/ffwd-client-java
src/main/java/com/google/protobuf250/FieldSet.java
FieldSet.computeFieldSize
public static int computeFieldSize(final FieldDescriptorLite<?> descriptor, final Object value) { WireFormat.FieldType type = descriptor.getLiteType(); int number = descriptor.getNumber(); if (descriptor.isRepeated()) { if (descriptor.isPacked()) { int dataSize = 0; for (final Object element : (List<?>)value) { dataSize += computeElementSizeNoTag(type, element); } return dataSize + CodedOutputStream.computeTagSize(number) + CodedOutputStream.computeRawVarint32Size(dataSize); } else { int size = 0; for (final Object element : (List<?>)value) { size += computeElementSize(type, number, element); } return size; } } else { return computeElementSize(type, number, value); } }
java
public static int computeFieldSize(final FieldDescriptorLite<?> descriptor, final Object value) { WireFormat.FieldType type = descriptor.getLiteType(); int number = descriptor.getNumber(); if (descriptor.isRepeated()) { if (descriptor.isPacked()) { int dataSize = 0; for (final Object element : (List<?>)value) { dataSize += computeElementSizeNoTag(type, element); } return dataSize + CodedOutputStream.computeTagSize(number) + CodedOutputStream.computeRawVarint32Size(dataSize); } else { int size = 0; for (final Object element : (List<?>)value) { size += computeElementSize(type, number, element); } return size; } } else { return computeElementSize(type, number, value); } }
[ "public", "static", "int", "computeFieldSize", "(", "final", "FieldDescriptorLite", "<", "?", ">", "descriptor", ",", "final", "Object", "value", ")", "{", "WireFormat", ".", "FieldType", "type", "=", "descriptor", ".", "getLiteType", "(", ")", ";", "int", "number", "=", "descriptor", ".", "getNumber", "(", ")", ";", "if", "(", "descriptor", ".", "isRepeated", "(", ")", ")", "{", "if", "(", "descriptor", ".", "isPacked", "(", ")", ")", "{", "int", "dataSize", "=", "0", ";", "for", "(", "final", "Object", "element", ":", "(", "List", "<", "?", ">", ")", "value", ")", "{", "dataSize", "+=", "computeElementSizeNoTag", "(", "type", ",", "element", ")", ";", "}", "return", "dataSize", "+", "CodedOutputStream", ".", "computeTagSize", "(", "number", ")", "+", "CodedOutputStream", ".", "computeRawVarint32Size", "(", "dataSize", ")", ";", "}", "else", "{", "int", "size", "=", "0", ";", "for", "(", "final", "Object", "element", ":", "(", "List", "<", "?", ">", ")", "value", ")", "{", "size", "+=", "computeElementSize", "(", "type", ",", "number", ",", "element", ")", ";", "}", "return", "size", ";", "}", "}", "else", "{", "return", "computeElementSize", "(", "type", ",", "number", ",", "value", ")", ";", "}", "}" ]
Compute the number of bytes needed to encode a particular field.
[ "Compute", "the", "number", "of", "bytes", "needed", "to", "encode", "a", "particular", "field", "." ]
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/FieldSet.java#L837-L860
147,950
eurekaclinical/aiw-i2b2-etl
src/main/java/edu/emory/cci/aiw/i2b2etl/dest/table/ActiveStatusCode.java
ActiveStatusCode.getInstance
public static String getInstance( Date startDate, Granularity startGran, Date endDate, Granularity endGran) { ActiveStatusCodeStartDate codeStartDate; if (startDate == null) { codeStartDate = ActiveStatusCodeStartDate.UNKNOWN; } else if (startGran == AbsoluteTimeGranularity.YEAR) { codeStartDate = ActiveStatusCodeStartDate.YEAR; } else if (startGran == AbsoluteTimeGranularity.MONTH) { codeStartDate = ActiveStatusCodeStartDate.MONTH; } else if (startGran == AbsoluteTimeGranularity.DAY) { codeStartDate = ActiveStatusCodeStartDate.DAY; } else if (startGran == AbsoluteTimeGranularity.HOUR) { codeStartDate = ActiveStatusCodeStartDate.HOUR; } else if (startGran == AbsoluteTimeGranularity.MINUTE) { codeStartDate = ActiveStatusCodeStartDate.MINUTE; } else if (startGran == AbsoluteTimeGranularity.SECOND) { codeStartDate = ActiveStatusCodeStartDate.SECOND; } else { codeStartDate = ActiveStatusCodeStartDate.NULL; } ActiveStatusCodeEndDate codeEndDate; if (startDate == null) { codeEndDate = ActiveStatusCodeEndDate.UNKNOWN; } else if (startGran == AbsoluteTimeGranularity.YEAR) { codeEndDate = ActiveStatusCodeEndDate.YEAR; } else if (startGran == AbsoluteTimeGranularity.MONTH) { codeEndDate = ActiveStatusCodeEndDate.MONTH; } else if (startGran == AbsoluteTimeGranularity.DAY) { codeEndDate = ActiveStatusCodeEndDate.DAY; } else if (startGran == AbsoluteTimeGranularity.HOUR) { codeEndDate = ActiveStatusCodeEndDate.HOUR; } else if (startGran == AbsoluteTimeGranularity.MINUTE) { codeEndDate = ActiveStatusCodeEndDate.MINUTE; } else if (startGran == AbsoluteTimeGranularity.SECOND) { codeEndDate = ActiveStatusCodeEndDate.SECOND; } else { codeEndDate = ActiveStatusCodeEndDate.NULL; } return codeEndDate.getCode() + codeStartDate.getCode(); }
java
public static String getInstance( Date startDate, Granularity startGran, Date endDate, Granularity endGran) { ActiveStatusCodeStartDate codeStartDate; if (startDate == null) { codeStartDate = ActiveStatusCodeStartDate.UNKNOWN; } else if (startGran == AbsoluteTimeGranularity.YEAR) { codeStartDate = ActiveStatusCodeStartDate.YEAR; } else if (startGran == AbsoluteTimeGranularity.MONTH) { codeStartDate = ActiveStatusCodeStartDate.MONTH; } else if (startGran == AbsoluteTimeGranularity.DAY) { codeStartDate = ActiveStatusCodeStartDate.DAY; } else if (startGran == AbsoluteTimeGranularity.HOUR) { codeStartDate = ActiveStatusCodeStartDate.HOUR; } else if (startGran == AbsoluteTimeGranularity.MINUTE) { codeStartDate = ActiveStatusCodeStartDate.MINUTE; } else if (startGran == AbsoluteTimeGranularity.SECOND) { codeStartDate = ActiveStatusCodeStartDate.SECOND; } else { codeStartDate = ActiveStatusCodeStartDate.NULL; } ActiveStatusCodeEndDate codeEndDate; if (startDate == null) { codeEndDate = ActiveStatusCodeEndDate.UNKNOWN; } else if (startGran == AbsoluteTimeGranularity.YEAR) { codeEndDate = ActiveStatusCodeEndDate.YEAR; } else if (startGran == AbsoluteTimeGranularity.MONTH) { codeEndDate = ActiveStatusCodeEndDate.MONTH; } else if (startGran == AbsoluteTimeGranularity.DAY) { codeEndDate = ActiveStatusCodeEndDate.DAY; } else if (startGran == AbsoluteTimeGranularity.HOUR) { codeEndDate = ActiveStatusCodeEndDate.HOUR; } else if (startGran == AbsoluteTimeGranularity.MINUTE) { codeEndDate = ActiveStatusCodeEndDate.MINUTE; } else if (startGran == AbsoluteTimeGranularity.SECOND) { codeEndDate = ActiveStatusCodeEndDate.SECOND; } else { codeEndDate = ActiveStatusCodeEndDate.NULL; } return codeEndDate.getCode() + codeStartDate.getCode(); }
[ "public", "static", "String", "getInstance", "(", "Date", "startDate", ",", "Granularity", "startGran", ",", "Date", "endDate", ",", "Granularity", "endGran", ")", "{", "ActiveStatusCodeStartDate", "codeStartDate", ";", "if", "(", "startDate", "==", "null", ")", "{", "codeStartDate", "=", "ActiveStatusCodeStartDate", ".", "UNKNOWN", ";", "}", "else", "if", "(", "startGran", "==", "AbsoluteTimeGranularity", ".", "YEAR", ")", "{", "codeStartDate", "=", "ActiveStatusCodeStartDate", ".", "YEAR", ";", "}", "else", "if", "(", "startGran", "==", "AbsoluteTimeGranularity", ".", "MONTH", ")", "{", "codeStartDate", "=", "ActiveStatusCodeStartDate", ".", "MONTH", ";", "}", "else", "if", "(", "startGran", "==", "AbsoluteTimeGranularity", ".", "DAY", ")", "{", "codeStartDate", "=", "ActiveStatusCodeStartDate", ".", "DAY", ";", "}", "else", "if", "(", "startGran", "==", "AbsoluteTimeGranularity", ".", "HOUR", ")", "{", "codeStartDate", "=", "ActiveStatusCodeStartDate", ".", "HOUR", ";", "}", "else", "if", "(", "startGran", "==", "AbsoluteTimeGranularity", ".", "MINUTE", ")", "{", "codeStartDate", "=", "ActiveStatusCodeStartDate", ".", "MINUTE", ";", "}", "else", "if", "(", "startGran", "==", "AbsoluteTimeGranularity", ".", "SECOND", ")", "{", "codeStartDate", "=", "ActiveStatusCodeStartDate", ".", "SECOND", ";", "}", "else", "{", "codeStartDate", "=", "ActiveStatusCodeStartDate", ".", "NULL", ";", "}", "ActiveStatusCodeEndDate", "codeEndDate", ";", "if", "(", "startDate", "==", "null", ")", "{", "codeEndDate", "=", "ActiveStatusCodeEndDate", ".", "UNKNOWN", ";", "}", "else", "if", "(", "startGran", "==", "AbsoluteTimeGranularity", ".", "YEAR", ")", "{", "codeEndDate", "=", "ActiveStatusCodeEndDate", ".", "YEAR", ";", "}", "else", "if", "(", "startGran", "==", "AbsoluteTimeGranularity", ".", "MONTH", ")", "{", "codeEndDate", "=", "ActiveStatusCodeEndDate", ".", "MONTH", ";", "}", "else", "if", "(", "startGran", "==", "AbsoluteTimeGranularity", ".", "DAY", ")", "{", "codeEndDate", "=", "ActiveStatusCodeEndDate", ".", "DAY", ";", "}", "else", "if", "(", "startGran", "==", "AbsoluteTimeGranularity", ".", "HOUR", ")", "{", "codeEndDate", "=", "ActiveStatusCodeEndDate", ".", "HOUR", ";", "}", "else", "if", "(", "startGran", "==", "AbsoluteTimeGranularity", ".", "MINUTE", ")", "{", "codeEndDate", "=", "ActiveStatusCodeEndDate", ".", "MINUTE", ";", "}", "else", "if", "(", "startGran", "==", "AbsoluteTimeGranularity", ".", "SECOND", ")", "{", "codeEndDate", "=", "ActiveStatusCodeEndDate", ".", "SECOND", ";", "}", "else", "{", "codeEndDate", "=", "ActiveStatusCodeEndDate", ".", "NULL", ";", "}", "return", "codeEndDate", ".", "getCode", "(", ")", "+", "codeStartDate", ".", "getCode", "(", ")", ";", "}" ]
Infer the correct active status code given what dates are available and whether or not the encounter information is finalized. @param bFinal <code>true</code> if the visit information is finalized according to the EHR, <code>false</code> if not. This parameter is ignored if the visit has neither a start date nor an end date. @param startDate the start date of the visit. May be <code>null</code>. @param endDate the end date of the visit. May be <code>null</code>. @return the appropriate active status code.
[ "Infer", "the", "correct", "active", "status", "code", "given", "what", "dates", "are", "available", "and", "whether", "or", "not", "the", "encounter", "information", "is", "finalized", "." ]
3eed6bda7755919cb9466d2930723a0f4748341a
https://github.com/eurekaclinical/aiw-i2b2-etl/blob/3eed6bda7755919cb9466d2930723a0f4748341a/src/main/java/edu/emory/cci/aiw/i2b2etl/dest/table/ActiveStatusCode.java#L47-L89
147,951
awltech/org.parallelj
parallelj-legacy-launching-parent/parallelj-legacy-launching-api/src/main/java/org/parallelj/launching/quartz/Launch.java
Launch.synchLaunch
public Launch synchLaunch() throws LaunchException { JobDataMap jobDataMap = new JobDataMap(); jobDataMap.put(Launch.PARAMETERS, this.launch.getParameters()); jobDataMap.put(Launch.DEFAULT_EXECUTOR_KEY, this.launch.getExecutorService()); try { this.launch.synchLaunch(); } catch (org.parallelj.launching.LaunchException e) { throw new LaunchException(e); } org.parallelj.launching.LaunchResult result = this.launch.getLaunchResult(); jobDataMap.put(QuartzUtils.RETURN_CODE, result.getStatusCode()); jobDataMap.put(QuartzUtils.USER_RETURN_CODE, result.getReturnCode()); jobDataMap.put(QuartzUtils.PROCEDURES_IN_ERROR, result.getProceduresInError()); jobDataMap.put(Launch.OUTPUTS, this.launch.getLaunchResult().getOutputParameters()); this.legacyLaunchResult = new LaunchResult(launch.getLaunchId(), jobDataMap); return this; }
java
public Launch synchLaunch() throws LaunchException { JobDataMap jobDataMap = new JobDataMap(); jobDataMap.put(Launch.PARAMETERS, this.launch.getParameters()); jobDataMap.put(Launch.DEFAULT_EXECUTOR_KEY, this.launch.getExecutorService()); try { this.launch.synchLaunch(); } catch (org.parallelj.launching.LaunchException e) { throw new LaunchException(e); } org.parallelj.launching.LaunchResult result = this.launch.getLaunchResult(); jobDataMap.put(QuartzUtils.RETURN_CODE, result.getStatusCode()); jobDataMap.put(QuartzUtils.USER_RETURN_CODE, result.getReturnCode()); jobDataMap.put(QuartzUtils.PROCEDURES_IN_ERROR, result.getProceduresInError()); jobDataMap.put(Launch.OUTPUTS, this.launch.getLaunchResult().getOutputParameters()); this.legacyLaunchResult = new LaunchResult(launch.getLaunchId(), jobDataMap); return this; }
[ "public", "Launch", "synchLaunch", "(", ")", "throws", "LaunchException", "{", "JobDataMap", "jobDataMap", "=", "new", "JobDataMap", "(", ")", ";", "jobDataMap", ".", "put", "(", "Launch", ".", "PARAMETERS", ",", "this", ".", "launch", ".", "getParameters", "(", ")", ")", ";", "jobDataMap", ".", "put", "(", "Launch", ".", "DEFAULT_EXECUTOR_KEY", ",", "this", ".", "launch", ".", "getExecutorService", "(", ")", ")", ";", "try", "{", "this", ".", "launch", ".", "synchLaunch", "(", ")", ";", "}", "catch", "(", "org", ".", "parallelj", ".", "launching", ".", "LaunchException", "e", ")", "{", "throw", "new", "LaunchException", "(", "e", ")", ";", "}", "org", ".", "parallelj", ".", "launching", ".", "LaunchResult", "result", "=", "this", ".", "launch", ".", "getLaunchResult", "(", ")", ";", "jobDataMap", ".", "put", "(", "QuartzUtils", ".", "RETURN_CODE", ",", "result", ".", "getStatusCode", "(", ")", ")", ";", "jobDataMap", ".", "put", "(", "QuartzUtils", ".", "USER_RETURN_CODE", ",", "result", ".", "getReturnCode", "(", ")", ")", ";", "jobDataMap", ".", "put", "(", "QuartzUtils", ".", "PROCEDURES_IN_ERROR", ",", "result", ".", "getProceduresInError", "(", ")", ")", ";", "jobDataMap", ".", "put", "(", "Launch", ".", "OUTPUTS", ",", "this", ".", "launch", ".", "getLaunchResult", "(", ")", ".", "getOutputParameters", "(", ")", ")", ";", "this", ".", "legacyLaunchResult", "=", "new", "LaunchResult", "(", "launch", ".", "getLaunchId", "(", ")", ",", "jobDataMap", ")", ";", "return", "this", ";", "}" ]
Launch a Program and wait until it's terminated. @return A Launch instance. @throws LaunchException When a SchedulerException occurred.
[ "Launch", "a", "Program", "and", "wait", "until", "it", "s", "terminated", "." ]
2a2498cc4ac6227df6f45d295ec568cad3cffbc4
https://github.com/awltech/org.parallelj/blob/2a2498cc4ac6227df6f45d295ec568cad3cffbc4/parallelj-legacy-launching-parent/parallelj-legacy-launching-api/src/main/java/org/parallelj/launching/quartz/Launch.java#L87-L105
147,952
awltech/org.parallelj
parallelj-legacy-launching-parent/parallelj-legacy-launching-api/src/main/java/org/parallelj/launching/quartz/Launch.java
Launch.aSynchLaunch
public Launch aSynchLaunch() throws LaunchException { JobDataMap jobDataMap = new JobDataMap(); jobDataMap.put(Launch.PARAMETERS, this.launch.getParameters()); jobDataMap.put(Launch.DEFAULT_EXECUTOR_KEY, this.launch.getExecutorService()); try { this.launch.aSynchLaunch(); } catch (org.parallelj.launching.LaunchException e) { throw new LaunchException(e); } this.legacyLaunchResult = new LaunchResult(launch.getLaunchId(), jobDataMap); return this; }
java
public Launch aSynchLaunch() throws LaunchException { JobDataMap jobDataMap = new JobDataMap(); jobDataMap.put(Launch.PARAMETERS, this.launch.getParameters()); jobDataMap.put(Launch.DEFAULT_EXECUTOR_KEY, this.launch.getExecutorService()); try { this.launch.aSynchLaunch(); } catch (org.parallelj.launching.LaunchException e) { throw new LaunchException(e); } this.legacyLaunchResult = new LaunchResult(launch.getLaunchId(), jobDataMap); return this; }
[ "public", "Launch", "aSynchLaunch", "(", ")", "throws", "LaunchException", "{", "JobDataMap", "jobDataMap", "=", "new", "JobDataMap", "(", ")", ";", "jobDataMap", ".", "put", "(", "Launch", ".", "PARAMETERS", ",", "this", ".", "launch", ".", "getParameters", "(", ")", ")", ";", "jobDataMap", ".", "put", "(", "Launch", ".", "DEFAULT_EXECUTOR_KEY", ",", "this", ".", "launch", ".", "getExecutorService", "(", ")", ")", ";", "try", "{", "this", ".", "launch", ".", "aSynchLaunch", "(", ")", ";", "}", "catch", "(", "org", ".", "parallelj", ".", "launching", ".", "LaunchException", "e", ")", "{", "throw", "new", "LaunchException", "(", "e", ")", ";", "}", "this", ".", "legacyLaunchResult", "=", "new", "LaunchResult", "(", "launch", ".", "getLaunchId", "(", ")", ",", "jobDataMap", ")", ";", "return", "this", ";", "}" ]
Launch a Program and continue. @return A Launch instance. @throws LaunchException When an Exception occurred.
[ "Launch", "a", "Program", "and", "continue", "." ]
2a2498cc4ac6227df6f45d295ec568cad3cffbc4
https://github.com/awltech/org.parallelj/blob/2a2498cc4ac6227df6f45d295ec568cad3cffbc4/parallelj-legacy-launching-parent/parallelj-legacy-launching-api/src/main/java/org/parallelj/launching/quartz/Launch.java#L114-L126
147,953
awltech/org.parallelj
parallelj-legacy-launching-parent/parallelj-legacy-launching-api/src/main/java/org/parallelj/launching/quartz/Launch.java
Launch.addDatas
@SuppressWarnings("unchecked") public synchronized Launch addDatas(final JobDataMap jobDataMap) { Map<String,Object> data = new HashMap<>(); for (String key:jobDataMap.getKeys()) { data.put(key, jobDataMap.get(key)); } this.launch.addParameters(data); return this; }
java
@SuppressWarnings("unchecked") public synchronized Launch addDatas(final JobDataMap jobDataMap) { Map<String,Object> data = new HashMap<>(); for (String key:jobDataMap.getKeys()) { data.put(key, jobDataMap.get(key)); } this.launch.addParameters(data); return this; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "synchronized", "Launch", "addDatas", "(", "final", "JobDataMap", "jobDataMap", ")", "{", "Map", "<", "String", ",", "Object", ">", "data", "=", "new", "HashMap", "<>", "(", ")", ";", "for", "(", "String", "key", ":", "jobDataMap", ".", "getKeys", "(", ")", ")", "{", "data", ".", "put", "(", "key", ",", "jobDataMap", ".", "get", "(", "key", ")", ")", ";", "}", "this", ".", "launch", ".", "addParameters", "(", "data", ")", ";", "return", "this", ";", "}" ]
Add a Quartz JobData to the one used to launch the Program. This JobData is used to initialize Programs arguments for launching. @param jobDataMap A JobDatamap @return This Launch instance.
[ "Add", "a", "Quartz", "JobData", "to", "the", "one", "used", "to", "launch", "the", "Program", ".", "This", "JobData", "is", "used", "to", "initialize", "Programs", "arguments", "for", "launching", "." ]
2a2498cc4ac6227df6f45d295ec568cad3cffbc4
https://github.com/awltech/org.parallelj/blob/2a2498cc4ac6227df6f45d295ec568cad3cffbc4/parallelj-legacy-launching-parent/parallelj-legacy-launching-api/src/main/java/org/parallelj/launching/quartz/Launch.java#L136-L144
147,954
mlhartme/sushi
src/main/java/net/oneandone/sushi/util/IntBitRelation.java
IntBitRelation.add
public boolean add(int left, int right) { if (line[left] == null) { line[left] = new IntBitSet(); } else { if (line[left].contains(right)) { return false; } } line[left].add(right); return true; }
java
public boolean add(int left, int right) { if (line[left] == null) { line[left] = new IntBitSet(); } else { if (line[left].contains(right)) { return false; } } line[left].add(right); return true; }
[ "public", "boolean", "add", "(", "int", "left", ",", "int", "right", ")", "{", "if", "(", "line", "[", "left", "]", "==", "null", ")", "{", "line", "[", "left", "]", "=", "new", "IntBitSet", "(", ")", ";", "}", "else", "{", "if", "(", "line", "[", "left", "]", ".", "contains", "(", "right", ")", ")", "{", "return", "false", ";", "}", "}", "line", "[", "left", "]", ".", "add", "(", "right", ")", ";", "return", "true", ";", "}" ]
Adds a new pair to the relation. @param left left value of the pair @param right right value of the pair @return false, if the pair was already element of the relation
[ "Adds", "a", "new", "pair", "to", "the", "relation", "." ]
4af33414b04bd58584d4febe5cc63ef6c7346a75
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/util/IntBitRelation.java#L52-L63
147,955
mlhartme/sushi
src/main/java/net/oneandone/sushi/util/IntBitRelation.java
IntBitRelation.add
public void add(int left, IntBitSet right) { if (line[left] == null) { line[left] = new IntBitSet(); } line[left].addAll(right); }
java
public void add(int left, IntBitSet right) { if (line[left] == null) { line[left] = new IntBitSet(); } line[left].addAll(right); }
[ "public", "void", "add", "(", "int", "left", ",", "IntBitSet", "right", ")", "{", "if", "(", "line", "[", "left", "]", "==", "null", ")", "{", "line", "[", "left", "]", "=", "new", "IntBitSet", "(", ")", ";", "}", "line", "[", "left", "]", ".", "addAll", "(", "right", ")", ";", "}" ]
Adds a set of pairs. @param left left value of all pairs to add @param right right values of the pairs to add. If empty, no pair is added
[ "Adds", "a", "set", "of", "pairs", "." ]
4af33414b04bd58584d4febe5cc63ef6c7346a75
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/util/IntBitRelation.java#L71-L76
147,956
mlhartme/sushi
src/main/java/net/oneandone/sushi/util/IntBitRelation.java
IntBitRelation.addAll
public void addAll(IntBitRelation right) { int i, max; max = right.line.length; for (i = 0; i < max; i++) { if (right.line[i] != null) { add(i, right.line[i]); } } }
java
public void addAll(IntBitRelation right) { int i, max; max = right.line.length; for (i = 0; i < max; i++) { if (right.line[i] != null) { add(i, right.line[i]); } } }
[ "public", "void", "addAll", "(", "IntBitRelation", "right", ")", "{", "int", "i", ",", "max", ";", "max", "=", "right", ".", "line", ".", "length", ";", "for", "(", "i", "=", "0", ";", "i", "<", "max", ";", "i", "++", ")", "{", "if", "(", "right", ".", "line", "[", "i", "]", "!=", "null", ")", "{", "add", "(", "i", ",", "right", ".", "line", "[", "i", "]", ")", ";", "}", "}", "}" ]
Adds all element from the relation specified. @param right relation to add.
[ "Adds", "all", "element", "from", "the", "relation", "specified", "." ]
4af33414b04bd58584d4febe5cc63ef6c7346a75
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/util/IntBitRelation.java#L82-L91
147,957
mlhartme/sushi
src/main/java/net/oneandone/sushi/util/IntBitRelation.java
IntBitRelation.contains
public boolean contains(int left, int right) { if (line[left] == null) { return false; } return line[left].contains(right); }
java
public boolean contains(int left, int right) { if (line[left] == null) { return false; } return line[left].contains(right); }
[ "public", "boolean", "contains", "(", "int", "left", ",", "int", "right", ")", "{", "if", "(", "line", "[", "left", "]", "==", "null", ")", "{", "return", "false", ";", "}", "return", "line", "[", "left", "]", ".", "contains", "(", "right", ")", ";", "}" ]
Element test. @param left left value of the pair to test. @param right right value of the pair to test. @return true, if (left, right) is element of the relation.
[ "Element", "test", "." ]
4af33414b04bd58584d4febe5cc63ef6c7346a75
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/util/IntBitRelation.java#L99-L104
147,958
mlhartme/sushi
src/main/java/net/oneandone/sushi/util/IntBitRelation.java
IntBitRelation.addRightWhere
public void addRightWhere(int left, IntBitSet result) { if (line[left] != null) { result.addAll(line[left]); } }
java
public void addRightWhere(int left, IntBitSet result) { if (line[left] != null) { result.addAll(line[left]); } }
[ "public", "void", "addRightWhere", "(", "int", "left", ",", "IntBitSet", "result", ")", "{", "if", "(", "line", "[", "left", "]", "!=", "null", ")", "{", "result", ".", "addAll", "(", "line", "[", "left", "]", ")", ";", "}", "}" ]
Returns all right values from the relation that have the left value specified. @param left left value required @param result where to return the result
[ "Returns", "all", "right", "values", "from", "the", "relation", "that", "have", "the", "left", "value", "specified", "." ]
4af33414b04bd58584d4febe5cc63ef6c7346a75
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/util/IntBitRelation.java#L112-L116
147,959
mlhartme/sushi
src/main/java/net/oneandone/sushi/util/IntBitRelation.java
IntBitRelation.contains
public boolean contains(IntBitRelation sub) { int i; if (line.length != sub.line.length) { return false; } for (i = 0; i < line.length; i++) { if (line[i] == null) { if (sub.line[i] != null) { return false; } } else { if ((sub.line[i] != null) && !line[i].containsAll(sub.line[i])) { return false; } } } return true; }
java
public boolean contains(IntBitRelation sub) { int i; if (line.length != sub.line.length) { return false; } for (i = 0; i < line.length; i++) { if (line[i] == null) { if (sub.line[i] != null) { return false; } } else { if ((sub.line[i] != null) && !line[i].containsAll(sub.line[i])) { return false; } } } return true; }
[ "public", "boolean", "contains", "(", "IntBitRelation", "sub", ")", "{", "int", "i", ";", "if", "(", "line", ".", "length", "!=", "sub", ".", "line", ".", "length", ")", "{", "return", "false", ";", "}", "for", "(", "i", "=", "0", ";", "i", "<", "line", ".", "length", ";", "i", "++", ")", "{", "if", "(", "line", "[", "i", "]", "==", "null", ")", "{", "if", "(", "sub", ".", "line", "[", "i", "]", "!=", "null", ")", "{", "return", "false", ";", "}", "}", "else", "{", "if", "(", "(", "sub", ".", "line", "[", "i", "]", "!=", "null", ")", "&&", "!", "line", "[", "i", "]", ".", "containsAll", "(", "sub", ".", "line", "[", "i", "]", ")", ")", "{", "return", "false", ";", "}", "}", "}", "return", "true", ";", "}" ]
Subset test. @param sub relation to compare with. @return true, if every element of sub is element of this
[ "Subset", "test", "." ]
4af33414b04bd58584d4febe5cc63ef6c7346a75
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/util/IntBitRelation.java#L206-L226
147,960
mlhartme/sushi
src/main/java/net/oneandone/sushi/util/IntBitRelation.java
IntBitRelation.transitiveClosure
public void transitiveClosure() { IntBitRelation next; while (true) { next = new IntBitRelation(getMax()); next.composeRightLeft(this, this); if (contains(next)) { return; } addAll(next); } }
java
public void transitiveClosure() { IntBitRelation next; while (true) { next = new IntBitRelation(getMax()); next.composeRightLeft(this, this); if (contains(next)) { return; } addAll(next); } }
[ "public", "void", "transitiveClosure", "(", ")", "{", "IntBitRelation", "next", ";", "while", "(", "true", ")", "{", "next", "=", "new", "IntBitRelation", "(", "getMax", "(", ")", ")", ";", "next", ".", "composeRightLeft", "(", "this", ",", "this", ")", ";", "if", "(", "contains", "(", "next", ")", ")", "{", "return", ";", "}", "addAll", "(", "next", ")", ";", "}", "}" ]
Transitive closure.
[ "Transitive", "closure", "." ]
4af33414b04bd58584d4febe5cc63ef6c7346a75
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/util/IntBitRelation.java#L229-L240
147,961
ykrasik/jaci
jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/directory/CliDirectory.java
CliDirectory.autoCompleteDirectory
public AutoComplete autoCompleteDirectory(String prefix) { final Trie<CliValueType> possibilities = childDirectories.subTrie(prefix).mapValues(CliValueType.DIRECTORY.<CliDirectory>getMapper()); return new AutoComplete(prefix, possibilities); }
java
public AutoComplete autoCompleteDirectory(String prefix) { final Trie<CliValueType> possibilities = childDirectories.subTrie(prefix).mapValues(CliValueType.DIRECTORY.<CliDirectory>getMapper()); return new AutoComplete(prefix, possibilities); }
[ "public", "AutoComplete", "autoCompleteDirectory", "(", "String", "prefix", ")", "{", "final", "Trie", "<", "CliValueType", ">", "possibilities", "=", "childDirectories", ".", "subTrie", "(", "prefix", ")", ".", "mapValues", "(", "CliValueType", ".", "DIRECTORY", ".", "<", "CliDirectory", ">", "getMapper", "(", ")", ")", ";", "return", "new", "AutoComplete", "(", "prefix", ",", "possibilities", ")", ";", "}" ]
Auto complete the given prefix with child directory possibilities. @param prefix Prefix to offer auto complete for. @return Auto complete for child {@link CliDirectory}s that starts with the given prefix. Case insensitive.
[ "Auto", "complete", "the", "given", "prefix", "with", "child", "directory", "possibilities", "." ]
4615edef7c76288ad5ea8d678132b161645ca1e3
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/directory/CliDirectory.java#L122-L125
147,962
ykrasik/jaci
jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/directory/CliDirectory.java
CliDirectory.autoCompleteCommand
public AutoComplete autoCompleteCommand(String prefix) { final Trie<CliValueType> possibilities = childCommands.subTrie(prefix).mapValues(CliValueType.COMMAND.<CliCommand>getMapper()); return new AutoComplete(prefix, possibilities); }
java
public AutoComplete autoCompleteCommand(String prefix) { final Trie<CliValueType> possibilities = childCommands.subTrie(prefix).mapValues(CliValueType.COMMAND.<CliCommand>getMapper()); return new AutoComplete(prefix, possibilities); }
[ "public", "AutoComplete", "autoCompleteCommand", "(", "String", "prefix", ")", "{", "final", "Trie", "<", "CliValueType", ">", "possibilities", "=", "childCommands", ".", "subTrie", "(", "prefix", ")", ".", "mapValues", "(", "CliValueType", ".", "COMMAND", ".", "<", "CliCommand", ">", "getMapper", "(", ")", ")", ";", "return", "new", "AutoComplete", "(", "prefix", ",", "possibilities", ")", ";", "}" ]
Auto complete the given prefix with child command possibilities. @param prefix Prefix to offer auto complete for. @return Auto complete for the child {@link CliCommand}s that starts with the given prefix. Case insensitive.
[ "Auto", "complete", "the", "given", "prefix", "with", "child", "command", "possibilities", "." ]
4615edef7c76288ad5ea8d678132b161645ca1e3
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/directory/CliDirectory.java#L133-L136
147,963
ykrasik/jaci
jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/directory/CliDirectory.java
CliDirectory.autoCompleteEntry
public AutoComplete autoCompleteEntry(String prefix) { final AutoComplete directoryAutoComplete = autoCompleteDirectory(prefix); final AutoComplete commandAutoComplete = autoCompleteCommand(prefix); return directoryAutoComplete.union(commandAutoComplete); }
java
public AutoComplete autoCompleteEntry(String prefix) { final AutoComplete directoryAutoComplete = autoCompleteDirectory(prefix); final AutoComplete commandAutoComplete = autoCompleteCommand(prefix); return directoryAutoComplete.union(commandAutoComplete); }
[ "public", "AutoComplete", "autoCompleteEntry", "(", "String", "prefix", ")", "{", "final", "AutoComplete", "directoryAutoComplete", "=", "autoCompleteDirectory", "(", "prefix", ")", ";", "final", "AutoComplete", "commandAutoComplete", "=", "autoCompleteCommand", "(", "prefix", ")", ";", "return", "directoryAutoComplete", ".", "union", "(", "commandAutoComplete", ")", ";", "}" ]
Auto complete the given prefix with child directory or command possibilities. @param prefix Prefix to offer auto complete for. @return Auto complete for child entries (either {@link CliDirectory} or {@link CliCommand}) that start with the given prefix. Case insensitive.
[ "Auto", "complete", "the", "given", "prefix", "with", "child", "directory", "or", "command", "possibilities", "." ]
4615edef7c76288ad5ea8d678132b161645ca1e3
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/directory/CliDirectory.java#L145-L149
147,964
ykrasik/jaci
jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/directory/CliDirectory.java
CliDirectory.from
public static CliDirectory from(Identifier identifier, CliCommand... commands) { final Trie<CliCommand> childCommands = createChildCommands(commands); return new CliDirectory(identifier, Tries.<CliDirectory>emptyTrie(), childCommands); }
java
public static CliDirectory from(Identifier identifier, CliCommand... commands) { final Trie<CliCommand> childCommands = createChildCommands(commands); return new CliDirectory(identifier, Tries.<CliDirectory>emptyTrie(), childCommands); }
[ "public", "static", "CliDirectory", "from", "(", "Identifier", "identifier", ",", "CliCommand", "...", "commands", ")", "{", "final", "Trie", "<", "CliCommand", ">", "childCommands", "=", "createChildCommands", "(", "commands", ")", ";", "return", "new", "CliDirectory", "(", "identifier", ",", "Tries", ".", "<", "CliDirectory", ">", "emptyTrie", "(", ")", ",", "childCommands", ")", ";", "}" ]
Construct a CLI directory from the given parameters. @param identifier Directory identifier. @param commands Child CLI commands. @return A CLI directory constructed from the given parameters.
[ "Construct", "a", "CLI", "directory", "from", "the", "given", "parameters", "." ]
4615edef7c76288ad5ea8d678132b161645ca1e3
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/directory/CliDirectory.java#L211-L214
147,965
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/preprocessors/ContextPreprocessorIt.java
ContextPreprocessorIt.findMultiwordsInContextStructure
private IContext findMultiwordsInContextStructure(IContext context) throws ContextPreprocessorException { for (Iterator<INode> i = context.getNodes(); i.hasNext(); ) { INode sourceNode = i.next(); // sense disambiguation within the context structure // for all ACoLs in the source node for (Iterator<IAtomicConceptOfLabel> j = sourceNode.getNodeData().getACoLs(); j.hasNext(); ) { IAtomicConceptOfLabel synSource = j.next(); // in all descendants and ancestors findMultiwordsAmong(sourceNode.getDescendants(), synSource); findMultiwordsAmong(sourceNode.getAncestors(), synSource); } } return context; }
java
private IContext findMultiwordsInContextStructure(IContext context) throws ContextPreprocessorException { for (Iterator<INode> i = context.getNodes(); i.hasNext(); ) { INode sourceNode = i.next(); // sense disambiguation within the context structure // for all ACoLs in the source node for (Iterator<IAtomicConceptOfLabel> j = sourceNode.getNodeData().getACoLs(); j.hasNext(); ) { IAtomicConceptOfLabel synSource = j.next(); // in all descendants and ancestors findMultiwordsAmong(sourceNode.getDescendants(), synSource); findMultiwordsAmong(sourceNode.getAncestors(), synSource); } } return context; }
[ "private", "IContext", "findMultiwordsInContextStructure", "(", "IContext", "context", ")", "throws", "ContextPreprocessorException", "{", "for", "(", "Iterator", "<", "INode", ">", "i", "=", "context", ".", "getNodes", "(", ")", ";", "i", ".", "hasNext", "(", ")", ";", ")", "{", "INode", "sourceNode", "=", "i", ".", "next", "(", ")", ";", "// sense disambiguation within the context structure", "// for all ACoLs in the source node", "for", "(", "Iterator", "<", "IAtomicConceptOfLabel", ">", "j", "=", "sourceNode", ".", "getNodeData", "(", ")", ".", "getACoLs", "(", ")", ";", "j", ".", "hasNext", "(", ")", ";", ")", "{", "IAtomicConceptOfLabel", "synSource", "=", "j", ".", "next", "(", ")", ";", "// in all descendants and ancestors", "findMultiwordsAmong", "(", "sourceNode", ".", "getDescendants", "(", ")", ",", "synSource", ")", ";", "findMultiwordsAmong", "(", "sourceNode", ".", "getAncestors", "(", ")", ",", "synSource", ")", ";", "}", "}", "return", "context", ";", "}" ]
Finds multiwords in context. @param context data structure of input label @return context with multiwords @throws ContextPreprocessorException ContextPreprocessorException
[ "Finds", "multiwords", "in", "context", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/preprocessors/ContextPreprocessorIt.java#L599-L612
147,966
kmi/iserve
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ServiceManagerSparql.java
ServiceManagerSparql.listServices
@Override public Set<URI> listServices() { String queryStr = new StringBuilder() .append("SELECT DISTINCT ?svc WHERE { \n") .append(" GRAPH ?g { \n") .append("?svc ").append("<").append(RDF.type.getURI()).append(">").append(" ").append("<").append(MSM.Service.getURI()).append("> . \n") .append(" } \n") .append("} \n") .toString(); return this.graphStoreManager.listResourcesByQuery(queryStr, "svc"); }
java
@Override public Set<URI> listServices() { String queryStr = new StringBuilder() .append("SELECT DISTINCT ?svc WHERE { \n") .append(" GRAPH ?g { \n") .append("?svc ").append("<").append(RDF.type.getURI()).append(">").append(" ").append("<").append(MSM.Service.getURI()).append("> . \n") .append(" } \n") .append("} \n") .toString(); return this.graphStoreManager.listResourcesByQuery(queryStr, "svc"); }
[ "@", "Override", "public", "Set", "<", "URI", ">", "listServices", "(", ")", "{", "String", "queryStr", "=", "new", "StringBuilder", "(", ")", ".", "append", "(", "\"SELECT DISTINCT ?svc WHERE { \\n\"", ")", ".", "append", "(", "\" GRAPH ?g { \\n\"", ")", ".", "append", "(", "\"?svc \"", ")", ".", "append", "(", "\"<\"", ")", ".", "append", "(", "RDF", ".", "type", ".", "getURI", "(", ")", ")", ".", "append", "(", "\">\"", ")", ".", "append", "(", "\" \"", ")", ".", "append", "(", "\"<\"", ")", ".", "append", "(", "MSM", ".", "Service", ".", "getURI", "(", ")", ")", ".", "append", "(", "\"> . \\n\"", ")", ".", "append", "(", "\" } \\n\"", ")", ".", "append", "(", "\"} \\n\"", ")", ".", "toString", "(", ")", ";", "return", "this", ".", "graphStoreManager", ".", "listResourcesByQuery", "(", "queryStr", ",", "\"svc\"", ")", ";", "}" ]
Obtains a list of service URIs with all the services known to the system @return list of URIs with all the services in the registry
[ "Obtains", "a", "list", "of", "service", "URIs", "with", "all", "the", "services", "known", "to", "the", "system" ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ServiceManagerSparql.java#L145-L156
147,967
kmi/iserve
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ServiceManagerSparql.java
ServiceManagerSparql.getService
@Override public Service getService(URI serviceUri) throws ServiceException { if (serviceUri == null || !serviceUri.isAbsolute()) { log.warn("The Service URI is either absent or relative. Provide an absolute URI"); return null; } OntModel model = null; try { model = this.graphStoreManager.getGraph(URIUtil.getNameSpace(serviceUri)); } catch (URISyntaxException e) { log.error("The namespace of the service is not a correct URI", e); return null; } // Parse the service. There should only be one in the response ServiceReaderImpl reader = new ServiceReaderImpl(); List<Service> services = reader.parseService(model); if (services != null && !services.isEmpty()) { return services.get(0); } return null; }
java
@Override public Service getService(URI serviceUri) throws ServiceException { if (serviceUri == null || !serviceUri.isAbsolute()) { log.warn("The Service URI is either absent or relative. Provide an absolute URI"); return null; } OntModel model = null; try { model = this.graphStoreManager.getGraph(URIUtil.getNameSpace(serviceUri)); } catch (URISyntaxException e) { log.error("The namespace of the service is not a correct URI", e); return null; } // Parse the service. There should only be one in the response ServiceReaderImpl reader = new ServiceReaderImpl(); List<Service> services = reader.parseService(model); if (services != null && !services.isEmpty()) { return services.get(0); } return null; }
[ "@", "Override", "public", "Service", "getService", "(", "URI", "serviceUri", ")", "throws", "ServiceException", "{", "if", "(", "serviceUri", "==", "null", "||", "!", "serviceUri", ".", "isAbsolute", "(", ")", ")", "{", "log", ".", "warn", "(", "\"The Service URI is either absent or relative. Provide an absolute URI\"", ")", ";", "return", "null", ";", "}", "OntModel", "model", "=", "null", ";", "try", "{", "model", "=", "this", ".", "graphStoreManager", ".", "getGraph", "(", "URIUtil", ".", "getNameSpace", "(", "serviceUri", ")", ")", ";", "}", "catch", "(", "URISyntaxException", "e", ")", "{", "log", ".", "error", "(", "\"The namespace of the service is not a correct URI\"", ",", "e", ")", ";", "return", "null", ";", "}", "// Parse the service. There should only be one in the response", "ServiceReaderImpl", "reader", "=", "new", "ServiceReaderImpl", "(", ")", ";", "List", "<", "Service", ">", "services", "=", "reader", ".", "parseService", "(", "model", ")", ";", "if", "(", "services", "!=", "null", "&&", "!", "services", ".", "isEmpty", "(", ")", ")", "{", "return", "services", ".", "get", "(", "0", ")", ";", "}", "return", "null", ";", "}" ]
Obtains the service description of the service identified by the URI @param serviceUri the URI of the service to obtain @return the service description if it exists or null otherwise @throws uk.ac.open.kmi.iserve.sal.exception.ServiceException
[ "Obtains", "the", "service", "description", "of", "the", "service", "identified", "by", "the", "URI" ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ServiceManagerSparql.java#L384-L407
147,968
kmi/iserve
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ServiceManagerSparql.java
ServiceManagerSparql.getServices
@Override public Set<Service> getServices(Set<URI> serviceUris) throws ServiceException { ImmutableSet.Builder<Service> result = ImmutableSet.builder(); Service svc; for (URI svcUri : serviceUris) { svc = this.getService(svcUri); if (svc != null) { result.add(svc); } } return result.build(); }
java
@Override public Set<Service> getServices(Set<URI> serviceUris) throws ServiceException { ImmutableSet.Builder<Service> result = ImmutableSet.builder(); Service svc; for (URI svcUri : serviceUris) { svc = this.getService(svcUri); if (svc != null) { result.add(svc); } } return result.build(); }
[ "@", "Override", "public", "Set", "<", "Service", ">", "getServices", "(", "Set", "<", "URI", ">", "serviceUris", ")", "throws", "ServiceException", "{", "ImmutableSet", ".", "Builder", "<", "Service", ">", "result", "=", "ImmutableSet", ".", "builder", "(", ")", ";", "Service", "svc", ";", "for", "(", "URI", "svcUri", ":", "serviceUris", ")", "{", "svc", "=", "this", ".", "getService", "(", "svcUri", ")", ";", "if", "(", "svc", "!=", "null", ")", "{", "result", ".", "add", "(", "svc", ")", ";", "}", "}", "return", "result", ".", "build", "(", ")", ";", "}" ]
Obtains the service descriptions for all the services identified by the URI Set @param serviceUris the URIs of the service to obtain @return the list of all services that could be obtained. If none could be obtained the list will be empty. @throws uk.ac.open.kmi.iserve.sal.exception.ServiceException
[ "Obtains", "the", "service", "descriptions", "for", "all", "the", "services", "identified", "by", "the", "URI", "Set" ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ServiceManagerSparql.java#L416-L427
147,969
kmi/iserve
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ServiceManagerSparql.java
ServiceManagerSparql.clearServices
@Override public boolean clearServices() throws ServiceException { if (!this.graphStoreManager.canBeModified()) { log.warn("The dataset cannot be modified."); return false; } log.info("Clearing services registry."); this.graphStoreManager.clearDataset(); // Generate Event this.getEventBus().post(new ServicesClearedEvent(new Date())); return true; }
java
@Override public boolean clearServices() throws ServiceException { if (!this.graphStoreManager.canBeModified()) { log.warn("The dataset cannot be modified."); return false; } log.info("Clearing services registry."); this.graphStoreManager.clearDataset(); // Generate Event this.getEventBus().post(new ServicesClearedEvent(new Date())); return true; }
[ "@", "Override", "public", "boolean", "clearServices", "(", ")", "throws", "ServiceException", "{", "if", "(", "!", "this", ".", "graphStoreManager", ".", "canBeModified", "(", ")", ")", "{", "log", ".", "warn", "(", "\"The dataset cannot be modified.\"", ")", ";", "return", "false", ";", "}", "log", ".", "info", "(", "\"Clearing services registry.\"", ")", ";", "this", ".", "graphStoreManager", ".", "clearDataset", "(", ")", ";", "// Generate Event", "this", ".", "getEventBus", "(", ")", ".", "post", "(", "new", "ServicesClearedEvent", "(", "new", "Date", "(", ")", ")", ")", ";", "return", "true", ";", "}" ]
Deletes all the services on the registry. This operation cannot be undone. Use with care. @return @throws uk.ac.open.kmi.iserve.sal.exception.ServiceException
[ "Deletes", "all", "the", "services", "on", "the", "registry", ".", "This", "operation", "cannot", "be", "undone", ".", "Use", "with", "care", "." ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ServiceManagerSparql.java#L553-L568
147,970
kmi/iserve
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ServiceManagerSparql.java
ServiceManagerSparql.serviceExists
@Override public boolean serviceExists(URI serviceUri) throws ServiceException { if (serviceUri == null || !serviceUri.isAbsolute()) { log.warn("The Service URI is either absent or relative. Provide an absolute URI"); return false; } URI graphUri; try { graphUri = getGraphUriForElement(serviceUri); } catch (URISyntaxException e) { log.warn("The namespace of the URI of the message content is incorrect.", e); return Boolean.FALSE; } if (graphUri == null) { log.warn("Could not obtain a graph URI for the element. The URI may not be managed by the server - " + serviceUri); return Boolean.FALSE; } String queryStr = new StringBuilder() .append("ASK { \n") .append("GRAPH <").append(graphUri.toASCIIString()).append("> {") .append("<").append(serviceUri.toASCIIString()).append("> <").append(RDF.type.getURI()).append("> <").append(MSM.Service).append("> }\n}").toString(); Query query = QueryFactory.create(queryStr); QueryExecution qe = QueryExecutionFactory.sparqlService(this.graphStoreManager.getSparqlQueryEndpoint().toASCIIString(), query); MonitoredQueryExecution qexec = new MonitoredQueryExecution(qe); try { return qexec.execAsk(); } finally { qexec.close(); } }
java
@Override public boolean serviceExists(URI serviceUri) throws ServiceException { if (serviceUri == null || !serviceUri.isAbsolute()) { log.warn("The Service URI is either absent or relative. Provide an absolute URI"); return false; } URI graphUri; try { graphUri = getGraphUriForElement(serviceUri); } catch (URISyntaxException e) { log.warn("The namespace of the URI of the message content is incorrect.", e); return Boolean.FALSE; } if (graphUri == null) { log.warn("Could not obtain a graph URI for the element. The URI may not be managed by the server - " + serviceUri); return Boolean.FALSE; } String queryStr = new StringBuilder() .append("ASK { \n") .append("GRAPH <").append(graphUri.toASCIIString()).append("> {") .append("<").append(serviceUri.toASCIIString()).append("> <").append(RDF.type.getURI()).append("> <").append(MSM.Service).append("> }\n}").toString(); Query query = QueryFactory.create(queryStr); QueryExecution qe = QueryExecutionFactory.sparqlService(this.graphStoreManager.getSparqlQueryEndpoint().toASCIIString(), query); MonitoredQueryExecution qexec = new MonitoredQueryExecution(qe); try { return qexec.execAsk(); } finally { qexec.close(); } }
[ "@", "Override", "public", "boolean", "serviceExists", "(", "URI", "serviceUri", ")", "throws", "ServiceException", "{", "if", "(", "serviceUri", "==", "null", "||", "!", "serviceUri", ".", "isAbsolute", "(", ")", ")", "{", "log", ".", "warn", "(", "\"The Service URI is either absent or relative. Provide an absolute URI\"", ")", ";", "return", "false", ";", "}", "URI", "graphUri", ";", "try", "{", "graphUri", "=", "getGraphUriForElement", "(", "serviceUri", ")", ";", "}", "catch", "(", "URISyntaxException", "e", ")", "{", "log", ".", "warn", "(", "\"The namespace of the URI of the message content is incorrect.\"", ",", "e", ")", ";", "return", "Boolean", ".", "FALSE", ";", "}", "if", "(", "graphUri", "==", "null", ")", "{", "log", ".", "warn", "(", "\"Could not obtain a graph URI for the element. The URI may not be managed by the server - \"", "+", "serviceUri", ")", ";", "return", "Boolean", ".", "FALSE", ";", "}", "String", "queryStr", "=", "new", "StringBuilder", "(", ")", ".", "append", "(", "\"ASK { \\n\"", ")", ".", "append", "(", "\"GRAPH <\"", ")", ".", "append", "(", "graphUri", ".", "toASCIIString", "(", ")", ")", ".", "append", "(", "\"> {\"", ")", ".", "append", "(", "\"<\"", ")", ".", "append", "(", "serviceUri", ".", "toASCIIString", "(", ")", ")", ".", "append", "(", "\"> <\"", ")", ".", "append", "(", "RDF", ".", "type", ".", "getURI", "(", ")", ")", ".", "append", "(", "\"> <\"", ")", ".", "append", "(", "MSM", ".", "Service", ")", ".", "append", "(", "\"> }\\n}\"", ")", ".", "toString", "(", ")", ";", "Query", "query", "=", "QueryFactory", ".", "create", "(", "queryStr", ")", ";", "QueryExecution", "qe", "=", "QueryExecutionFactory", ".", "sparqlService", "(", "this", ".", "graphStoreManager", ".", "getSparqlQueryEndpoint", "(", ")", ".", "toASCIIString", "(", ")", ",", "query", ")", ";", "MonitoredQueryExecution", "qexec", "=", "new", "MonitoredQueryExecution", "(", "qe", ")", ";", "try", "{", "return", "qexec", ".", "execAsk", "(", ")", ";", "}", "finally", "{", "qexec", ".", "close", "(", ")", ";", "}", "}" ]
Determines whether a service is known to the registry @param serviceUri the URI of the service being looked up @return True if it is registered in the server @throws uk.ac.open.kmi.iserve.sal.exception.ServiceException
[ "Determines", "whether", "a", "service", "is", "known", "to", "the", "registry" ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ServiceManagerSparql.java#L577-L610
147,971
kmi/iserve
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ServiceManagerSparql.java
ServiceManagerSparql.listServicesWithModelReference
@Override public Set<URI> listServicesWithModelReference(URI modelReference) { if (modelReference == null) { return ImmutableSet.of(); } StringBuilder queryBuilder = new StringBuilder(); queryBuilder .append("PREFIX msm: <").append(MSM.getURI()).append("> ") .append("PREFIX rdf: <").append(RDF.getURI()).append("> ") .append("PREFIX sawsdl: <").append(SAWSDL.getURI()).append("> ") .append("SELECT ?service WHERE { ?service rdf:type msm:Service . ?service sawsdl:modelReference <").append(modelReference).append("> . }"); String query = queryBuilder.toString(); return this.graphStoreManager.listResourcesByQuery(query, "service"); }
java
@Override public Set<URI> listServicesWithModelReference(URI modelReference) { if (modelReference == null) { return ImmutableSet.of(); } StringBuilder queryBuilder = new StringBuilder(); queryBuilder .append("PREFIX msm: <").append(MSM.getURI()).append("> ") .append("PREFIX rdf: <").append(RDF.getURI()).append("> ") .append("PREFIX sawsdl: <").append(SAWSDL.getURI()).append("> ") .append("SELECT ?service WHERE { ?service rdf:type msm:Service . ?service sawsdl:modelReference <").append(modelReference).append("> . }"); String query = queryBuilder.toString(); return this.graphStoreManager.listResourcesByQuery(query, "service"); }
[ "@", "Override", "public", "Set", "<", "URI", ">", "listServicesWithModelReference", "(", "URI", "modelReference", ")", "{", "if", "(", "modelReference", "==", "null", ")", "{", "return", "ImmutableSet", ".", "of", "(", ")", ";", "}", "StringBuilder", "queryBuilder", "=", "new", "StringBuilder", "(", ")", ";", "queryBuilder", ".", "append", "(", "\"PREFIX msm: <\"", ")", ".", "append", "(", "MSM", ".", "getURI", "(", ")", ")", ".", "append", "(", "\"> \"", ")", ".", "append", "(", "\"PREFIX rdf: <\"", ")", ".", "append", "(", "RDF", ".", "getURI", "(", ")", ")", ".", "append", "(", "\"> \"", ")", ".", "append", "(", "\"PREFIX sawsdl: <\"", ")", ".", "append", "(", "SAWSDL", ".", "getURI", "(", ")", ")", ".", "append", "(", "\"> \"", ")", ".", "append", "(", "\"SELECT ?service WHERE { ?service rdf:type msm:Service . ?service sawsdl:modelReference <\"", ")", ".", "append", "(", "modelReference", ")", ".", "append", "(", "\"> . }\"", ")", ";", "String", "query", "=", "queryBuilder", ".", "toString", "(", ")", ";", "return", "this", ".", "graphStoreManager", ".", "listResourcesByQuery", "(", "query", ",", "\"service\"", ")", ";", "}" ]
Given the URI of a modelReference, this method figures out all the services that have this as model references. This method uses SPARQL 1.1 to avoid using regexs for performance. @param modelReference the type of output sought for @return a Set of URIs of operations that generate this output type.
[ "Given", "the", "URI", "of", "a", "modelReference", "this", "method", "figures", "out", "all", "the", "services", "that", "have", "this", "as", "model", "references", ".", "This", "method", "uses", "SPARQL", "1", ".", "1", "to", "avoid", "using", "regexs", "for", "performance", "." ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ServiceManagerSparql.java#L621-L635
147,972
kmi/iserve
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ServiceManagerSparql.java
ServiceManagerSparql.getMsmType
@Override public Set<URI> getMsmType(URI elementUri) { if (elementUri == null || !elementUri.isAbsolute()) { log.warn("The Element URI is either absent or relative. Provide an absolute URI"); return ImmutableSet.of(); } URI graphUri; try { graphUri = getGraphUriForElement(elementUri); } catch (URISyntaxException e) { log.warn("The namespace of the URI of the message content is incorrect.", e); return ImmutableSet.of(); } if (graphUri == null) { log.warn("Could not obtain a graph URI for the element. The URI may not be managed by the server - " + elementUri); return ImmutableSet.of(); } String queryStr = new StringBuilder() .append("SELECT * WHERE { \n") .append(" GRAPH <").append(graphUri.toASCIIString()).append("> { \n") .append("<").append(elementUri.toASCIIString()).append("> <").append(RDF.type.getURI()).append("> ?type .") .append("FILTER(STRSTARTS(STR(?type), \"").append(MSM.NAMESPACE.getURI()).append("\"))") .append(" } \n ") .append("} \n ") .toString(); return this.graphStoreManager.listResourcesByQuery(queryStr, "type"); }
java
@Override public Set<URI> getMsmType(URI elementUri) { if (elementUri == null || !elementUri.isAbsolute()) { log.warn("The Element URI is either absent or relative. Provide an absolute URI"); return ImmutableSet.of(); } URI graphUri; try { graphUri = getGraphUriForElement(elementUri); } catch (URISyntaxException e) { log.warn("The namespace of the URI of the message content is incorrect.", e); return ImmutableSet.of(); } if (graphUri == null) { log.warn("Could not obtain a graph URI for the element. The URI may not be managed by the server - " + elementUri); return ImmutableSet.of(); } String queryStr = new StringBuilder() .append("SELECT * WHERE { \n") .append(" GRAPH <").append(graphUri.toASCIIString()).append("> { \n") .append("<").append(elementUri.toASCIIString()).append("> <").append(RDF.type.getURI()).append("> ?type .") .append("FILTER(STRSTARTS(STR(?type), \"").append(MSM.NAMESPACE.getURI()).append("\"))") .append(" } \n ") .append("} \n ") .toString(); return this.graphStoreManager.listResourcesByQuery(queryStr, "type"); }
[ "@", "Override", "public", "Set", "<", "URI", ">", "getMsmType", "(", "URI", "elementUri", ")", "{", "if", "(", "elementUri", "==", "null", "||", "!", "elementUri", ".", "isAbsolute", "(", ")", ")", "{", "log", ".", "warn", "(", "\"The Element URI is either absent or relative. Provide an absolute URI\"", ")", ";", "return", "ImmutableSet", ".", "of", "(", ")", ";", "}", "URI", "graphUri", ";", "try", "{", "graphUri", "=", "getGraphUriForElement", "(", "elementUri", ")", ";", "}", "catch", "(", "URISyntaxException", "e", ")", "{", "log", ".", "warn", "(", "\"The namespace of the URI of the message content is incorrect.\"", ",", "e", ")", ";", "return", "ImmutableSet", ".", "of", "(", ")", ";", "}", "if", "(", "graphUri", "==", "null", ")", "{", "log", ".", "warn", "(", "\"Could not obtain a graph URI for the element. The URI may not be managed by the server - \"", "+", "elementUri", ")", ";", "return", "ImmutableSet", ".", "of", "(", ")", ";", "}", "String", "queryStr", "=", "new", "StringBuilder", "(", ")", ".", "append", "(", "\"SELECT * WHERE { \\n\"", ")", ".", "append", "(", "\" GRAPH <\"", ")", ".", "append", "(", "graphUri", ".", "toASCIIString", "(", ")", ")", ".", "append", "(", "\"> { \\n\"", ")", ".", "append", "(", "\"<\"", ")", ".", "append", "(", "elementUri", ".", "toASCIIString", "(", ")", ")", ".", "append", "(", "\"> <\"", ")", ".", "append", "(", "RDF", ".", "type", ".", "getURI", "(", ")", ")", ".", "append", "(", "\"> ?type .\"", ")", ".", "append", "(", "\"FILTER(STRSTARTS(STR(?type), \\\"\"", ")", ".", "append", "(", "MSM", ".", "NAMESPACE", ".", "getURI", "(", ")", ")", ".", "append", "(", "\"\\\"))\"", ")", ".", "append", "(", "\" } \\n \"", ")", ".", "append", "(", "\"} \\n \"", ")", ".", "toString", "(", ")", ";", "return", "this", ".", "graphStoreManager", ".", "listResourcesByQuery", "(", "queryStr", ",", "\"type\"", ")", ";", "}" ]
Given the URI of an element, this method returns the URI of the element from the Minimal Service Model it corresponds to. That is, it will say if it is a service, operation, etc. This method uses SPARQL 1.1 to avoid using regexs for performance. @param elementUri the URI to get the element type for. @return the URI of the MSM type it corresponds to.
[ "Given", "the", "URI", "of", "an", "element", "this", "method", "returns", "the", "URI", "of", "the", "element", "from", "the", "Minimal", "Service", "Model", "it", "corresponds", "to", ".", "That", "is", "it", "will", "say", "if", "it", "is", "a", "service", "operation", "etc", ".", "This", "method", "uses", "SPARQL", "1", ".", "1", "to", "avoid", "using", "regexs", "for", "performance", "." ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ServiceManagerSparql.java#L671-L701
147,973
kmi/iserve
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ServiceManagerSparql.java
ServiceManagerSparql.listElementsAnnotatedWith
@Override public Set<URI> listElementsAnnotatedWith(URI modelReference) { if (modelReference == null) { return ImmutableSet.of(); } String queryStr = new StringBuilder() .append("SELECT DISTINCT ?element WHERE { \n") .append(" GRAPH ?g { \n") .append(" ?element <").append(SAWSDL.modelReference.getURI()).append("> <").append(modelReference.toASCIIString()).append("> .") .append(" } \n ") .append("} \n ") .toString(); return this.graphStoreManager.listResourcesByQuery(queryStr, "element"); }
java
@Override public Set<URI> listElementsAnnotatedWith(URI modelReference) { if (modelReference == null) { return ImmutableSet.of(); } String queryStr = new StringBuilder() .append("SELECT DISTINCT ?element WHERE { \n") .append(" GRAPH ?g { \n") .append(" ?element <").append(SAWSDL.modelReference.getURI()).append("> <").append(modelReference.toASCIIString()).append("> .") .append(" } \n ") .append("} \n ") .toString(); return this.graphStoreManager.listResourcesByQuery(queryStr, "element"); }
[ "@", "Override", "public", "Set", "<", "URI", ">", "listElementsAnnotatedWith", "(", "URI", "modelReference", ")", "{", "if", "(", "modelReference", "==", "null", ")", "{", "return", "ImmutableSet", ".", "of", "(", ")", ";", "}", "String", "queryStr", "=", "new", "StringBuilder", "(", ")", ".", "append", "(", "\"SELECT DISTINCT ?element WHERE { \\n\"", ")", ".", "append", "(", "\" GRAPH ?g { \\n\"", ")", ".", "append", "(", "\" ?element <\"", ")", ".", "append", "(", "SAWSDL", ".", "modelReference", ".", "getURI", "(", ")", ")", ".", "append", "(", "\"> <\"", ")", ".", "append", "(", "modelReference", ".", "toASCIIString", "(", ")", ")", ".", "append", "(", "\"> .\"", ")", ".", "append", "(", "\" } \\n \"", ")", ".", "append", "(", "\"} \\n \"", ")", ".", "toString", "(", ")", ";", "return", "this", ".", "graphStoreManager", ".", "listResourcesByQuery", "(", "queryStr", ",", "\"element\"", ")", ";", "}" ]
Given a modelReference, this method finds all the elements that have been annotated with it. This method finds exact annotations. Note that the elements can be services, operations, inputs, etc. @param modelReference the actual annotation we are looking for @return a set of URIs for elements that have been annotated with the requested modelReferences.
[ "Given", "a", "modelReference", "this", "method", "finds", "all", "the", "elements", "that", "have", "been", "annotated", "with", "it", ".", "This", "method", "finds", "exact", "annotations", ".", "Note", "that", "the", "elements", "can", "be", "services", "operations", "inputs", "etc", "." ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ServiceManagerSparql.java#L746-L761
147,974
kmi/iserve
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ServiceManagerSparql.java
ServiceManagerSparql.replaceUris
private void replaceUris(uk.ac.open.kmi.msm4j.Resource resource, URI newUriBase) throws URISyntaxException { // Exit early if (resource == null || newUriBase == null || !newUriBase.isAbsolute()) return; resource.setUri(URIUtil.replaceNamespace(resource.getUri(), newUriBase)); // Replace recursively each of the URLs of the inner elements // Handling of Service if (resource instanceof Service) { // Replace Operations List<Operation> operations = ((Service) resource).getOperations(); for (Operation op : operations) { replaceUris(op, resource.getUri()); } } // Handling of Operation if (resource instanceof Operation) { List<MessageContent> mcs; // Replace Inputs, Outputs, InFaults, and Outfaults mcs = ((Operation) resource).getInputs(); for (MessageContent mc : mcs) { replaceUris(mc, resource.getUri()); } mcs = ((Operation) resource).getInputFaults(); for (MessageContent mc : mcs) { replaceUris(mc, resource.getUri()); } mcs = ((Operation) resource).getOutputs(); for (MessageContent mc : mcs) { replaceUris(mc, resource.getUri()); } mcs = ((Operation) resource).getOutputFaults(); for (MessageContent mc : mcs) { replaceUris(mc, resource.getUri()); } mcs = ((Operation) resource).getFaults(); for (MessageContent mc : mcs) { replaceUris(mc, resource.getUri()); } } // Handling for MessageParts if (resource instanceof MessagePart) { // Deal with optional and mandatory parts List<MessagePart> mps; mps = ((MessagePart) resource).getMandatoryParts(); for (MessagePart mp : mps) { replaceUris(mp, resource.getUri()); } mps = ((MessagePart) resource).getOptionalParts(); for (MessagePart mp : mps) { replaceUris(mp, resource.getUri()); } } // Handling for Invocable Entities if (resource instanceof InvocableEntity) { // Replace Effects List<Effect> effects = ((InvocableEntity) resource).getEffects(); for (Effect effect : effects) { replaceUris(effect, resource.getUri()); } // Replace Conditions List<Condition> conditions = ((InvocableEntity) resource).getConditions(); for (Condition condition : conditions) { replaceUris(condition, resource.getUri()); } } // Handling for Annotable Resources if (resource instanceof AnnotableResource) { // Replace NFPs List<NonFunctionalProperty> nfps = ((AnnotableResource) resource).getNfps(); for (NonFunctionalProperty nfp : nfps) { replaceUris(nfp, resource.getUri()); } } }
java
private void replaceUris(uk.ac.open.kmi.msm4j.Resource resource, URI newUriBase) throws URISyntaxException { // Exit early if (resource == null || newUriBase == null || !newUriBase.isAbsolute()) return; resource.setUri(URIUtil.replaceNamespace(resource.getUri(), newUriBase)); // Replace recursively each of the URLs of the inner elements // Handling of Service if (resource instanceof Service) { // Replace Operations List<Operation> operations = ((Service) resource).getOperations(); for (Operation op : operations) { replaceUris(op, resource.getUri()); } } // Handling of Operation if (resource instanceof Operation) { List<MessageContent> mcs; // Replace Inputs, Outputs, InFaults, and Outfaults mcs = ((Operation) resource).getInputs(); for (MessageContent mc : mcs) { replaceUris(mc, resource.getUri()); } mcs = ((Operation) resource).getInputFaults(); for (MessageContent mc : mcs) { replaceUris(mc, resource.getUri()); } mcs = ((Operation) resource).getOutputs(); for (MessageContent mc : mcs) { replaceUris(mc, resource.getUri()); } mcs = ((Operation) resource).getOutputFaults(); for (MessageContent mc : mcs) { replaceUris(mc, resource.getUri()); } mcs = ((Operation) resource).getFaults(); for (MessageContent mc : mcs) { replaceUris(mc, resource.getUri()); } } // Handling for MessageParts if (resource instanceof MessagePart) { // Deal with optional and mandatory parts List<MessagePart> mps; mps = ((MessagePart) resource).getMandatoryParts(); for (MessagePart mp : mps) { replaceUris(mp, resource.getUri()); } mps = ((MessagePart) resource).getOptionalParts(); for (MessagePart mp : mps) { replaceUris(mp, resource.getUri()); } } // Handling for Invocable Entities if (resource instanceof InvocableEntity) { // Replace Effects List<Effect> effects = ((InvocableEntity) resource).getEffects(); for (Effect effect : effects) { replaceUris(effect, resource.getUri()); } // Replace Conditions List<Condition> conditions = ((InvocableEntity) resource).getConditions(); for (Condition condition : conditions) { replaceUris(condition, resource.getUri()); } } // Handling for Annotable Resources if (resource instanceof AnnotableResource) { // Replace NFPs List<NonFunctionalProperty> nfps = ((AnnotableResource) resource).getNfps(); for (NonFunctionalProperty nfp : nfps) { replaceUris(nfp, resource.getUri()); } } }
[ "private", "void", "replaceUris", "(", "uk", ".", "ac", ".", "open", ".", "kmi", ".", "msm4j", ".", "Resource", "resource", ",", "URI", "newUriBase", ")", "throws", "URISyntaxException", "{", "// Exit early", "if", "(", "resource", "==", "null", "||", "newUriBase", "==", "null", "||", "!", "newUriBase", ".", "isAbsolute", "(", ")", ")", "return", ";", "resource", ".", "setUri", "(", "URIUtil", ".", "replaceNamespace", "(", "resource", ".", "getUri", "(", ")", ",", "newUriBase", ")", ")", ";", "// Replace recursively each of the URLs of the inner elements", "// Handling of Service", "if", "(", "resource", "instanceof", "Service", ")", "{", "// Replace Operations", "List", "<", "Operation", ">", "operations", "=", "(", "(", "Service", ")", "resource", ")", ".", "getOperations", "(", ")", ";", "for", "(", "Operation", "op", ":", "operations", ")", "{", "replaceUris", "(", "op", ",", "resource", ".", "getUri", "(", ")", ")", ";", "}", "}", "// Handling of Operation", "if", "(", "resource", "instanceof", "Operation", ")", "{", "List", "<", "MessageContent", ">", "mcs", ";", "// Replace Inputs, Outputs, InFaults, and Outfaults", "mcs", "=", "(", "(", "Operation", ")", "resource", ")", ".", "getInputs", "(", ")", ";", "for", "(", "MessageContent", "mc", ":", "mcs", ")", "{", "replaceUris", "(", "mc", ",", "resource", ".", "getUri", "(", ")", ")", ";", "}", "mcs", "=", "(", "(", "Operation", ")", "resource", ")", ".", "getInputFaults", "(", ")", ";", "for", "(", "MessageContent", "mc", ":", "mcs", ")", "{", "replaceUris", "(", "mc", ",", "resource", ".", "getUri", "(", ")", ")", ";", "}", "mcs", "=", "(", "(", "Operation", ")", "resource", ")", ".", "getOutputs", "(", ")", ";", "for", "(", "MessageContent", "mc", ":", "mcs", ")", "{", "replaceUris", "(", "mc", ",", "resource", ".", "getUri", "(", ")", ")", ";", "}", "mcs", "=", "(", "(", "Operation", ")", "resource", ")", ".", "getOutputFaults", "(", ")", ";", "for", "(", "MessageContent", "mc", ":", "mcs", ")", "{", "replaceUris", "(", "mc", ",", "resource", ".", "getUri", "(", ")", ")", ";", "}", "mcs", "=", "(", "(", "Operation", ")", "resource", ")", ".", "getFaults", "(", ")", ";", "for", "(", "MessageContent", "mc", ":", "mcs", ")", "{", "replaceUris", "(", "mc", ",", "resource", ".", "getUri", "(", ")", ")", ";", "}", "}", "// Handling for MessageParts", "if", "(", "resource", "instanceof", "MessagePart", ")", "{", "// Deal with optional and mandatory parts", "List", "<", "MessagePart", ">", "mps", ";", "mps", "=", "(", "(", "MessagePart", ")", "resource", ")", ".", "getMandatoryParts", "(", ")", ";", "for", "(", "MessagePart", "mp", ":", "mps", ")", "{", "replaceUris", "(", "mp", ",", "resource", ".", "getUri", "(", ")", ")", ";", "}", "mps", "=", "(", "(", "MessagePart", ")", "resource", ")", ".", "getOptionalParts", "(", ")", ";", "for", "(", "MessagePart", "mp", ":", "mps", ")", "{", "replaceUris", "(", "mp", ",", "resource", ".", "getUri", "(", ")", ")", ";", "}", "}", "// Handling for Invocable Entities", "if", "(", "resource", "instanceof", "InvocableEntity", ")", "{", "// Replace Effects", "List", "<", "Effect", ">", "effects", "=", "(", "(", "InvocableEntity", ")", "resource", ")", ".", "getEffects", "(", ")", ";", "for", "(", "Effect", "effect", ":", "effects", ")", "{", "replaceUris", "(", "effect", ",", "resource", ".", "getUri", "(", ")", ")", ";", "}", "// Replace Conditions", "List", "<", "Condition", ">", "conditions", "=", "(", "(", "InvocableEntity", ")", "resource", ")", ".", "getConditions", "(", ")", ";", "for", "(", "Condition", "condition", ":", "conditions", ")", "{", "replaceUris", "(", "condition", ",", "resource", ".", "getUri", "(", ")", ")", ";", "}", "}", "// Handling for Annotable Resources", "if", "(", "resource", "instanceof", "AnnotableResource", ")", "{", "// Replace NFPs", "List", "<", "NonFunctionalProperty", ">", "nfps", "=", "(", "(", "AnnotableResource", ")", "resource", ")", ".", "getNfps", "(", ")", ";", "for", "(", "NonFunctionalProperty", "nfp", ":", "nfps", ")", "{", "replaceUris", "(", "nfp", ",", "resource", ".", "getUri", "(", ")", ")", ";", "}", "}", "}" ]
Given a Resource and the new Uri base to use, modify each and every URL accordingly. This methods maintains the naming used by the service already. Recursive implementation that traverses the entire graph @param resource The service that will be modified @param newUriBase The new URI base
[ "Given", "a", "Resource", "and", "the", "new", "Uri", "base", "to", "use", "modify", "each", "and", "every", "URL", "accordingly", ".", "This", "methods", "maintains", "the", "naming", "used", "by", "the", "service", "already", ".", "Recursive", "implementation", "that", "traverses", "the", "entire", "graph" ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ServiceManagerSparql.java#L883-L970
147,975
synchronoss/cpo-api
cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/jta/JdbcCpoXaAdapter.java
JdbcCpoXaAdapter.commit
@Override public void commit() throws CpoException { JdbcCpoAdapter currentResource = getCurrentResource(); if (currentResource != getLocalResource()) ((JdbcCpoTrxAdapter)currentResource).commit(); }
java
@Override public void commit() throws CpoException { JdbcCpoAdapter currentResource = getCurrentResource(); if (currentResource != getLocalResource()) ((JdbcCpoTrxAdapter)currentResource).commit(); }
[ "@", "Override", "public", "void", "commit", "(", ")", "throws", "CpoException", "{", "JdbcCpoAdapter", "currentResource", "=", "getCurrentResource", "(", ")", ";", "if", "(", "currentResource", "!=", "getLocalResource", "(", ")", ")", "(", "(", "JdbcCpoTrxAdapter", ")", "currentResource", ")", ".", "commit", "(", ")", ";", "}" ]
Commits the current transaction behind the CpoTrxAdapter
[ "Commits", "the", "current", "transaction", "behind", "the", "CpoTrxAdapter" ]
dc745aca3b3206abf80b85d9689b0132f5baa694
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/jta/JdbcCpoXaAdapter.java#L71-L76
147,976
synchronoss/cpo-api
cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/jta/JdbcCpoXaAdapter.java
JdbcCpoXaAdapter.rollback
@Override public void rollback() throws CpoException { JdbcCpoAdapter currentResource = getCurrentResource(); if (currentResource != getLocalResource()) ((JdbcCpoTrxAdapter)currentResource).rollback(); }
java
@Override public void rollback() throws CpoException { JdbcCpoAdapter currentResource = getCurrentResource(); if (currentResource != getLocalResource()) ((JdbcCpoTrxAdapter)currentResource).rollback(); }
[ "@", "Override", "public", "void", "rollback", "(", ")", "throws", "CpoException", "{", "JdbcCpoAdapter", "currentResource", "=", "getCurrentResource", "(", ")", ";", "if", "(", "currentResource", "!=", "getLocalResource", "(", ")", ")", "(", "(", "JdbcCpoTrxAdapter", ")", "currentResource", ")", ".", "rollback", "(", ")", ";", "}" ]
Rollback the current transaction behind the CpoTrxAdapter
[ "Rollback", "the", "current", "transaction", "behind", "the", "CpoTrxAdapter" ]
dc745aca3b3206abf80b85d9689b0132f5baa694
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/jta/JdbcCpoXaAdapter.java#L81-L86
147,977
synchronoss/cpo-api
cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/jta/JdbcCpoXaAdapter.java
JdbcCpoXaAdapter.isClosed
@Override public boolean isClosed() throws CpoException { JdbcCpoAdapter currentResource = getCurrentResource(); if (currentResource != getLocalResource()) return ((JdbcCpoTrxAdapter)currentResource).isClosed(); else return true; }
java
@Override public boolean isClosed() throws CpoException { JdbcCpoAdapter currentResource = getCurrentResource(); if (currentResource != getLocalResource()) return ((JdbcCpoTrxAdapter)currentResource).isClosed(); else return true; }
[ "@", "Override", "public", "boolean", "isClosed", "(", ")", "throws", "CpoException", "{", "JdbcCpoAdapter", "currentResource", "=", "getCurrentResource", "(", ")", ";", "if", "(", "currentResource", "!=", "getLocalResource", "(", ")", ")", "return", "(", "(", "JdbcCpoTrxAdapter", ")", "currentResource", ")", ".", "isClosed", "(", ")", ";", "else", "return", "true", ";", "}" ]
Returns true if the TrxAdapter has been closed, false if it is still active
[ "Returns", "true", "if", "the", "TrxAdapter", "has", "been", "closed", "false", "if", "it", "is", "still", "active" ]
dc745aca3b3206abf80b85d9689b0132f5baa694
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/jta/JdbcCpoXaAdapter.java#L104-L111
147,978
synchronoss/cpo-api
cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/jta/JdbcCpoXaAdapter.java
JdbcCpoXaAdapter.isBusy
@Override public boolean isBusy() throws CpoException { JdbcCpoAdapter currentResource = getCurrentResource(); if (currentResource != getLocalResource()) return ((JdbcCpoTrxAdapter)currentResource).isBusy(); else return false; }
java
@Override public boolean isBusy() throws CpoException { JdbcCpoAdapter currentResource = getCurrentResource(); if (currentResource != getLocalResource()) return ((JdbcCpoTrxAdapter)currentResource).isBusy(); else return false; }
[ "@", "Override", "public", "boolean", "isBusy", "(", ")", "throws", "CpoException", "{", "JdbcCpoAdapter", "currentResource", "=", "getCurrentResource", "(", ")", ";", "if", "(", "currentResource", "!=", "getLocalResource", "(", ")", ")", "return", "(", "(", "JdbcCpoTrxAdapter", ")", "currentResource", ")", ".", "isBusy", "(", ")", ";", "else", "return", "false", ";", "}" ]
Returns true if the TrxAdapter is processing a request, false if it is not
[ "Returns", "true", "if", "the", "TrxAdapter", "is", "processing", "a", "request", "false", "if", "it", "is", "not" ]
dc745aca3b3206abf80b85d9689b0132f5baa694
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/jta/JdbcCpoXaAdapter.java#L116-L123
147,979
synchronoss/cpo-api
cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/jta/JdbcCpoXaAdapter.java
JdbcCpoXaAdapter.retrieveBean
@Override public <T> T retrieveBean(T bean) throws CpoException { return getCurrentResource().retrieveBean(bean); }
java
@Override public <T> T retrieveBean(T bean) throws CpoException { return getCurrentResource().retrieveBean(bean); }
[ "@", "Override", "public", "<", "T", ">", "T", "retrieveBean", "(", "T", "bean", ")", "throws", "CpoException", "{", "return", "getCurrentResource", "(", ")", ".", "retrieveBean", "(", "bean", ")", ";", "}" ]
Retrieves the Bean from the datasource. The assumption is that the bean exists in the datasource. If the retrieve function defined for these beans returns more than one row, an exception will be thrown. @param bean This is a bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. The input bean is used to specify the search criteria, the output bean is populated with the results of the function. @return A bean of the same type as the result parameter that is filled in as specified the metadata for the retireve. @throws CpoException Thrown if there are errors accessing the datasource
[ "Retrieves", "the", "Bean", "from", "the", "datasource", ".", "The", "assumption", "is", "that", "the", "bean", "exists", "in", "the", "datasource", ".", "If", "the", "retrieve", "function", "defined", "for", "these", "beans", "returns", "more", "than", "one", "row", "an", "exception", "will", "be", "thrown", "." ]
dc745aca3b3206abf80b85d9689b0132f5baa694
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/jta/JdbcCpoXaAdapter.java#L1273-L1276
147,980
mlhartme/sushi
src/main/java/net/oneandone/sushi/launcher/Launcher.java
Launcher.dir
public Launcher dir(FileNode dir) { return dir(dir.toPath().toFile(), dir.getWorld().getSettings().encoding); }
java
public Launcher dir(FileNode dir) { return dir(dir.toPath().toFile(), dir.getWorld().getSettings().encoding); }
[ "public", "Launcher", "dir", "(", "FileNode", "dir", ")", "{", "return", "dir", "(", "dir", ".", "toPath", "(", ")", ".", "toFile", "(", ")", ",", "dir", ".", "getWorld", "(", ")", ".", "getSettings", "(", ")", ".", "encoding", ")", ";", "}" ]
initializes the directory to execute the command in
[ "initializes", "the", "directory", "to", "execute", "the", "command", "in" ]
4af33414b04bd58584d4febe5cc63ef6c7346a75
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/launcher/Launcher.java#L85-L87
147,981
mlhartme/sushi
src/main/java/net/oneandone/sushi/launcher/Launcher.java
Launcher.exec
public void exec(Writer stdout, Writer stderr, boolean flushDest, Reader stdin, boolean stdinInherit) throws Failure { launch(stdout, stderr, flushDest, stdin, stdinInherit).await(); }
java
public void exec(Writer stdout, Writer stderr, boolean flushDest, Reader stdin, boolean stdinInherit) throws Failure { launch(stdout, stderr, flushDest, stdin, stdinInherit).await(); }
[ "public", "void", "exec", "(", "Writer", "stdout", ",", "Writer", "stderr", ",", "boolean", "flushDest", ",", "Reader", "stdin", ",", "boolean", "stdinInherit", ")", "throws", "Failure", "{", "launch", "(", "stdout", ",", "stderr", ",", "flushDest", ",", "stdin", ",", "stdinInherit", ")", ".", "await", "(", ")", ";", "}" ]
Executes a command in this directory, wired with the specified streams. None of the argument stream is closed. @param stdout never null @param stderr may be null (which will redirect the error stream to stdout. @param flushDest true to flush stdout/stderr after every chunk read from the process @param stdin has to be null when stdinInherit is true. Otherwise: may be null, which starts a process without input
[ "Executes", "a", "command", "in", "this", "directory", "wired", "with", "the", "specified", "streams", ".", "None", "of", "the", "argument", "stream", "is", "closed", "." ]
4af33414b04bd58584d4febe5cc63ef6c7346a75
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/launcher/Launcher.java#L131-L133
147,982
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/matchers/element/WNHierarchy.java
WNHierarchy.match
public char match(ISense source, ISense target) throws MatcherLibraryException { List<ISense> sourceList = getAncestors(source, depth); List<ISense> targetList = getAncestors(target, depth); targetList.retainAll(sourceList); if (targetList.size() > 0) return IMappingElement.EQUIVALENCE; else return IMappingElement.IDK; }
java
public char match(ISense source, ISense target) throws MatcherLibraryException { List<ISense> sourceList = getAncestors(source, depth); List<ISense> targetList = getAncestors(target, depth); targetList.retainAll(sourceList); if (targetList.size() > 0) return IMappingElement.EQUIVALENCE; else return IMappingElement.IDK; }
[ "public", "char", "match", "(", "ISense", "source", ",", "ISense", "target", ")", "throws", "MatcherLibraryException", "{", "List", "<", "ISense", ">", "sourceList", "=", "getAncestors", "(", "source", ",", "depth", ")", ";", "List", "<", "ISense", ">", "targetList", "=", "getAncestors", "(", "target", ",", "depth", ")", ";", "targetList", ".", "retainAll", "(", "sourceList", ")", ";", "if", "(", "targetList", ".", "size", "(", ")", ">", "0", ")", "return", "IMappingElement", ".", "EQUIVALENCE", ";", "else", "return", "IMappingElement", ".", "IDK", ";", "}" ]
Matches two strings with WNHeirarchy matcher. @param source gloss of source label @param target gloss of target label @return synonym or IDk relation
[ "Matches", "two", "strings", "with", "WNHeirarchy", "matcher", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/element/WNHierarchy.java#L50-L58
147,983
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/matchers/element/string/NGram.java
NGram.match
public char match(String str1, String str2) { if (null == str1 || null == str2 || 0 == str1.length() || 0 == str2.length()) { return IMappingElement.IDK; } String[] grams1 = generateNGrams(str1, gramlength); String[] grams2 = generateNGrams(str2, gramlength); int count = 0; for (String aGrams1 : grams1) for (String aGrams2 : grams2) { if (aGrams1.equals(aGrams2)) { count++; break; } } float sim = (float) 2 * count / (grams1.length + grams2.length); // Dice-Coefficient if (threshold <= sim) { return IMappingElement.EQUIVALENCE; } else { return IMappingElement.IDK; } }
java
public char match(String str1, String str2) { if (null == str1 || null == str2 || 0 == str1.length() || 0 == str2.length()) { return IMappingElement.IDK; } String[] grams1 = generateNGrams(str1, gramlength); String[] grams2 = generateNGrams(str2, gramlength); int count = 0; for (String aGrams1 : grams1) for (String aGrams2 : grams2) { if (aGrams1.equals(aGrams2)) { count++; break; } } float sim = (float) 2 * count / (grams1.length + grams2.length); // Dice-Coefficient if (threshold <= sim) { return IMappingElement.EQUIVALENCE; } else { return IMappingElement.IDK; } }
[ "public", "char", "match", "(", "String", "str1", ",", "String", "str2", ")", "{", "if", "(", "null", "==", "str1", "||", "null", "==", "str2", "||", "0", "==", "str1", ".", "length", "(", ")", "||", "0", "==", "str2", ".", "length", "(", ")", ")", "{", "return", "IMappingElement", ".", "IDK", ";", "}", "String", "[", "]", "grams1", "=", "generateNGrams", "(", "str1", ",", "gramlength", ")", ";", "String", "[", "]", "grams2", "=", "generateNGrams", "(", "str2", ",", "gramlength", ")", ";", "int", "count", "=", "0", ";", "for", "(", "String", "aGrams1", ":", "grams1", ")", "for", "(", "String", "aGrams2", ":", "grams2", ")", "{", "if", "(", "aGrams1", ".", "equals", "(", "aGrams2", ")", ")", "{", "count", "++", ";", "break", ";", "}", "}", "float", "sim", "=", "(", "float", ")", "2", "*", "count", "/", "(", "grams1", ".", "length", "+", "grams2", ".", "length", ")", ";", "// Dice-Coefficient\r", "if", "(", "threshold", "<=", "sim", ")", "{", "return", "IMappingElement", ".", "EQUIVALENCE", ";", "}", "else", "{", "return", "IMappingElement", ".", "IDK", ";", "}", "}" ]
Computes the relation with NGram matcher. @param str1 the source input @param str2 the target input @return synonym or IDK relation
[ "Computes", "the", "relation", "with", "NGram", "matcher", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/element/string/NGram.java#L54-L74
147,984
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/matchers/element/string/NGram.java
NGram.generateNGrams
private static String[] generateNGrams(String str, int gramlength) { if (str == null || str.length() == 0) return null; ArrayList<String> grams = new ArrayList<String>(); int length = str.length(); String gram; if (length < gramlength) { for (int i = 1; i <= length; i++) { gram = str.substring(0, i); if (grams.indexOf(gram) == -1) grams.add(gram); } gram = str.substring(length - 1, length); if (grams.indexOf(gram) == -1) grams.add(gram); } else { for (int i = 1; i <= gramlength - 1; i++) { gram = str.substring(0, i); if (grams.indexOf(gram) == -1) grams.add(gram); } for (int i = 0; i < length - gramlength + 1; i++) { gram = str.substring(i, i + gramlength); if (grams.indexOf(gram) == -1) grams.add(gram); } for (int i = length - gramlength + 1; i < length; i++) { gram = str.substring(i, length); if (grams.indexOf(gram) == -1) grams.add(gram); } } return grams.toArray(new String[grams.size()]); }
java
private static String[] generateNGrams(String str, int gramlength) { if (str == null || str.length() == 0) return null; ArrayList<String> grams = new ArrayList<String>(); int length = str.length(); String gram; if (length < gramlength) { for (int i = 1; i <= length; i++) { gram = str.substring(0, i); if (grams.indexOf(gram) == -1) grams.add(gram); } gram = str.substring(length - 1, length); if (grams.indexOf(gram) == -1) grams.add(gram); } else { for (int i = 1; i <= gramlength - 1; i++) { gram = str.substring(0, i); if (grams.indexOf(gram) == -1) grams.add(gram); } for (int i = 0; i < length - gramlength + 1; i++) { gram = str.substring(i, i + gramlength); if (grams.indexOf(gram) == -1) grams.add(gram); } for (int i = length - gramlength + 1; i < length; i++) { gram = str.substring(i, length); if (grams.indexOf(gram) == -1) grams.add(gram); } } return grams.toArray(new String[grams.size()]); }
[ "private", "static", "String", "[", "]", "generateNGrams", "(", "String", "str", ",", "int", "gramlength", ")", "{", "if", "(", "str", "==", "null", "||", "str", ".", "length", "(", ")", "==", "0", ")", "return", "null", ";", "ArrayList", "<", "String", ">", "grams", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "int", "length", "=", "str", ".", "length", "(", ")", ";", "String", "gram", ";", "if", "(", "length", "<", "gramlength", ")", "{", "for", "(", "int", "i", "=", "1", ";", "i", "<=", "length", ";", "i", "++", ")", "{", "gram", "=", "str", ".", "substring", "(", "0", ",", "i", ")", ";", "if", "(", "grams", ".", "indexOf", "(", "gram", ")", "==", "-", "1", ")", "grams", ".", "add", "(", "gram", ")", ";", "}", "gram", "=", "str", ".", "substring", "(", "length", "-", "1", ",", "length", ")", ";", "if", "(", "grams", ".", "indexOf", "(", "gram", ")", "==", "-", "1", ")", "grams", ".", "add", "(", "gram", ")", ";", "}", "else", "{", "for", "(", "int", "i", "=", "1", ";", "i", "<=", "gramlength", "-", "1", ";", "i", "++", ")", "{", "gram", "=", "str", ".", "substring", "(", "0", ",", "i", ")", ";", "if", "(", "grams", ".", "indexOf", "(", "gram", ")", "==", "-", "1", ")", "grams", ".", "add", "(", "gram", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", "-", "gramlength", "+", "1", ";", "i", "++", ")", "{", "gram", "=", "str", ".", "substring", "(", "i", ",", "i", "+", "gramlength", ")", ";", "if", "(", "grams", ".", "indexOf", "(", "gram", ")", "==", "-", "1", ")", "grams", ".", "add", "(", "gram", ")", ";", "}", "for", "(", "int", "i", "=", "length", "-", "gramlength", "+", "1", ";", "i", "<", "length", ";", "i", "++", ")", "{", "gram", "=", "str", ".", "substring", "(", "i", ",", "length", ")", ";", "if", "(", "grams", ".", "indexOf", "(", "gram", ")", "==", "-", "1", ")", "grams", ".", "add", "(", "gram", ")", ";", "}", "}", "return", "grams", ".", "toArray", "(", "new", "String", "[", "grams", ".", "size", "(", ")", "]", ")", ";", "}" ]
Produces nGrams for nGram matcher. @param str source string @param gramlength gram length @return ngrams
[ "Produces", "nGrams", "for", "nGram", "matcher", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/element/string/NGram.java#L83-L110
147,985
ykrasik/jaci
jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/commandline/CommandLine.java
CommandLine.forExecute
public static CommandLine forExecute(String rawCommandLine) { final List<String> elements = splitCommandLine(rawCommandLine); return new CommandLine(elements); }
java
public static CommandLine forExecute(String rawCommandLine) { final List<String> elements = splitCommandLine(rawCommandLine); return new CommandLine(elements); }
[ "public", "static", "CommandLine", "forExecute", "(", "String", "rawCommandLine", ")", "{", "final", "List", "<", "String", ">", "elements", "=", "splitCommandLine", "(", "rawCommandLine", ")", ";", "return", "new", "CommandLine", "(", "elements", ")", ";", "}" ]
Parse the command line for execution. If the given command line is empty, an empty command line will be returned. @param rawCommandLine Command line to parse. @return Parsed command line for execution.
[ "Parse", "the", "command", "line", "for", "execution", ".", "If", "the", "given", "command", "line", "is", "empty", "an", "empty", "command", "line", "will", "be", "returned", "." ]
4615edef7c76288ad5ea8d678132b161645ca1e3
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/commandline/CommandLine.java#L108-L111
147,986
ykrasik/jaci
jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/commandline/CommandLine.java
CommandLine.splitCommandLine
static List<String> splitCommandLine(String commandLine) { // Split the commandLine by whitespace. // Allow escaping single and double quoted strings. if (Objects.requireNonNull(commandLine, "commandLine").isEmpty()) { return new LinkedList<>(); } final List<String> elements = new ArrayList<>(); final QuoteStack quoteStack = new QuoteStack(); char c = commandLine.charAt(0); boolean matching = !isWhitespace(c); int matchStart = 0; if (isQuote(c)) { quoteStack.push(c); matchStart = 1; } for (int i = 1; i < commandLine.length(); i++) { c = commandLine.charAt(i); if (matching) { if (isWhitespace(c) && quoteStack.isEmpty()) { // Detected a whitespace after matching, and we're not in a quote - // this is a word boundary. elements.add(commandLine.substring(matchStart, i)); matching = false; } else if (isQuote(c) && quoteStack.quoteMatches(c)) { // Quote closes a previous section of quoted text. elements.add(commandLine.substring(matchStart, i)); quoteStack.pop(); matching = false; } } else if (isQuote(c)) { // We're not matching - Quote opens a new section of quoted text. quoteStack.push(c); matchStart = i + 1; matching = true; } else if (!isWhitespace(c)) { // Done slurping whitespaces - non-whitespace detected, start matching. matching = true; matchStart = i; } } if (matching) { // Finished processing commandLine, but we're still matching - add the last word. elements.add(commandLine.substring(matchStart, commandLine.length())); } return elements; }
java
static List<String> splitCommandLine(String commandLine) { // Split the commandLine by whitespace. // Allow escaping single and double quoted strings. if (Objects.requireNonNull(commandLine, "commandLine").isEmpty()) { return new LinkedList<>(); } final List<String> elements = new ArrayList<>(); final QuoteStack quoteStack = new QuoteStack(); char c = commandLine.charAt(0); boolean matching = !isWhitespace(c); int matchStart = 0; if (isQuote(c)) { quoteStack.push(c); matchStart = 1; } for (int i = 1; i < commandLine.length(); i++) { c = commandLine.charAt(i); if (matching) { if (isWhitespace(c) && quoteStack.isEmpty()) { // Detected a whitespace after matching, and we're not in a quote - // this is a word boundary. elements.add(commandLine.substring(matchStart, i)); matching = false; } else if (isQuote(c) && quoteStack.quoteMatches(c)) { // Quote closes a previous section of quoted text. elements.add(commandLine.substring(matchStart, i)); quoteStack.pop(); matching = false; } } else if (isQuote(c)) { // We're not matching - Quote opens a new section of quoted text. quoteStack.push(c); matchStart = i + 1; matching = true; } else if (!isWhitespace(c)) { // Done slurping whitespaces - non-whitespace detected, start matching. matching = true; matchStart = i; } } if (matching) { // Finished processing commandLine, but we're still matching - add the last word. elements.add(commandLine.substring(matchStart, commandLine.length())); } return elements; }
[ "static", "List", "<", "String", ">", "splitCommandLine", "(", "String", "commandLine", ")", "{", "// Split the commandLine by whitespace.", "// Allow escaping single and double quoted strings.", "if", "(", "Objects", ".", "requireNonNull", "(", "commandLine", ",", "\"commandLine\"", ")", ".", "isEmpty", "(", ")", ")", "{", "return", "new", "LinkedList", "<>", "(", ")", ";", "}", "final", "List", "<", "String", ">", "elements", "=", "new", "ArrayList", "<>", "(", ")", ";", "final", "QuoteStack", "quoteStack", "=", "new", "QuoteStack", "(", ")", ";", "char", "c", "=", "commandLine", ".", "charAt", "(", "0", ")", ";", "boolean", "matching", "=", "!", "isWhitespace", "(", "c", ")", ";", "int", "matchStart", "=", "0", ";", "if", "(", "isQuote", "(", "c", ")", ")", "{", "quoteStack", ".", "push", "(", "c", ")", ";", "matchStart", "=", "1", ";", "}", "for", "(", "int", "i", "=", "1", ";", "i", "<", "commandLine", ".", "length", "(", ")", ";", "i", "++", ")", "{", "c", "=", "commandLine", ".", "charAt", "(", "i", ")", ";", "if", "(", "matching", ")", "{", "if", "(", "isWhitespace", "(", "c", ")", "&&", "quoteStack", ".", "isEmpty", "(", ")", ")", "{", "// Detected a whitespace after matching, and we're not in a quote -", "// this is a word boundary.", "elements", ".", "add", "(", "commandLine", ".", "substring", "(", "matchStart", ",", "i", ")", ")", ";", "matching", "=", "false", ";", "}", "else", "if", "(", "isQuote", "(", "c", ")", "&&", "quoteStack", ".", "quoteMatches", "(", "c", ")", ")", "{", "// Quote closes a previous section of quoted text.", "elements", ".", "add", "(", "commandLine", ".", "substring", "(", "matchStart", ",", "i", ")", ")", ";", "quoteStack", ".", "pop", "(", ")", ";", "matching", "=", "false", ";", "}", "}", "else", "if", "(", "isQuote", "(", "c", ")", ")", "{", "// We're not matching - Quote opens a new section of quoted text.", "quoteStack", ".", "push", "(", "c", ")", ";", "matchStart", "=", "i", "+", "1", ";", "matching", "=", "true", ";", "}", "else", "if", "(", "!", "isWhitespace", "(", "c", ")", ")", "{", "// Done slurping whitespaces - non-whitespace detected, start matching.", "matching", "=", "true", ";", "matchStart", "=", "i", ";", "}", "}", "if", "(", "matching", ")", "{", "// Finished processing commandLine, but we're still matching - add the last word.", "elements", ".", "add", "(", "commandLine", ".", "substring", "(", "matchStart", ",", "commandLine", ".", "length", "(", ")", ")", ")", ";", "}", "return", "elements", ";", "}" ]
Package-protected for testing
[ "Package", "-", "protected", "for", "testing" ]
4615edef7c76288ad5ea8d678132b161645ca1e3
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/commandline/CommandLine.java#L119-L166
147,987
eurekaclinical/aiw-i2b2-etl
src/main/java/edu/emory/cci/aiw/i2b2etl/dest/config/DatabaseSpec.java
DatabaseSpec.toConnectionSpec
public ConnectionSpec toConnectionSpec() { try { return getDatabaseAPI().newConnectionSpecInstance(getConnect(), getUser(), getPasswd(), false); } catch (InvalidConnectionSpecArguments ex) { throw new AssertionError(ex); } }
java
public ConnectionSpec toConnectionSpec() { try { return getDatabaseAPI().newConnectionSpecInstance(getConnect(), getUser(), getPasswd(), false); } catch (InvalidConnectionSpecArguments ex) { throw new AssertionError(ex); } }
[ "public", "ConnectionSpec", "toConnectionSpec", "(", ")", "{", "try", "{", "return", "getDatabaseAPI", "(", ")", ".", "newConnectionSpecInstance", "(", "getConnect", "(", ")", ",", "getUser", "(", ")", ",", "getPasswd", "(", ")", ",", "false", ")", ";", "}", "catch", "(", "InvalidConnectionSpecArguments", "ex", ")", "{", "throw", "new", "AssertionError", "(", "ex", ")", ";", "}", "}" ]
Gets a connection spec configured with the user, password and connection string specified. Connections created from this connection spec will have auto commit turned off. @return a {@link ConnectionSpec}.
[ "Gets", "a", "connection", "spec", "configured", "with", "the", "user", "password", "and", "connection", "string", "specified", ".", "Connections", "created", "from", "this", "connection", "spec", "will", "have", "auto", "commit", "turned", "off", "." ]
3eed6bda7755919cb9466d2930723a0f4748341a
https://github.com/eurekaclinical/aiw-i2b2-etl/blob/3eed6bda7755919cb9466d2930723a0f4748341a/src/main/java/edu/emory/cci/aiw/i2b2etl/dest/config/DatabaseSpec.java#L59-L65
147,988
pulse00/Composer-Java-Bindings
java-api/src/main/java/com/dubture/getcomposer/core/collection/Psr.java
Psr.add
public void add(Namespace namespace) { if (has(namespace)) { get(namespace.getNamespace()).addPaths(namespace.getPaths()); } else { namespace.addPropertyChangeListener(listener); set(namespace.getNamespace(), namespace); } }
java
public void add(Namespace namespace) { if (has(namespace)) { get(namespace.getNamespace()).addPaths(namespace.getPaths()); } else { namespace.addPropertyChangeListener(listener); set(namespace.getNamespace(), namespace); } }
[ "public", "void", "add", "(", "Namespace", "namespace", ")", "{", "if", "(", "has", "(", "namespace", ")", ")", "{", "get", "(", "namespace", ".", "getNamespace", "(", ")", ")", ".", "addPaths", "(", "namespace", ".", "getPaths", "(", ")", ")", ";", "}", "else", "{", "namespace", ".", "addPropertyChangeListener", "(", "listener", ")", ";", "set", "(", "namespace", ".", "getNamespace", "(", ")", ",", "namespace", ")", ";", "}", "}" ]
Adds a new dependency. @param dependency the new dependency @return this
[ "Adds", "a", "new", "dependency", "." ]
0aa572567db37d047a41a57c32ede7c7fd5d4938
https://github.com/pulse00/Composer-Java-Bindings/blob/0aa572567db37d047a41a57c32ede7c7fd5d4938/java-api/src/main/java/com/dubture/getcomposer/core/collection/Psr.java#L83-L90
147,989
pulse00/Composer-Java-Bindings
java-api/src/main/java/com/dubture/getcomposer/core/collection/Psr.java
Psr.getNamespaceForPath
public Namespace getNamespaceForPath(String path) { for (Namespace nmspc : properties.values()) { if (nmspc.has(path)) { return nmspc; } } return null; }
java
public Namespace getNamespaceForPath(String path) { for (Namespace nmspc : properties.values()) { if (nmspc.has(path)) { return nmspc; } } return null; }
[ "public", "Namespace", "getNamespaceForPath", "(", "String", "path", ")", "{", "for", "(", "Namespace", "nmspc", ":", "properties", ".", "values", "(", ")", ")", "{", "if", "(", "nmspc", ".", "has", "(", "path", ")", ")", "{", "return", "nmspc", ";", "}", "}", "return", "null", ";", "}" ]
Returns the namespace for a given path or null if the path isn't found @param path the path @return the related namespace
[ "Returns", "the", "namespace", "for", "a", "given", "path", "or", "null", "if", "the", "path", "isn", "t", "found" ]
0aa572567db37d047a41a57c32ede7c7fd5d4938
https://github.com/pulse00/Composer-Java-Bindings/blob/0aa572567db37d047a41a57c32ede7c7fd5d4938/java-api/src/main/java/com/dubture/getcomposer/core/collection/Psr.java#L146-L154
147,990
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/matchers/element/gloss/WNGlossComparison.java
WNGlossComparison.match
public char match(ISense source, ISense target) { String sSynset = source.getGloss(); String tSynset = target.getGloss(); StringTokenizer stSource = new StringTokenizer(sSynset, " ,.\"'();"); String lemmaS, lemmaT; int counter = 0; while (stSource.hasMoreTokens()) { StringTokenizer stTarget = new StringTokenizer(tSynset, " ,.\"'();"); lemmaS = stSource.nextToken(); if (!meaninglessWords.contains(lemmaS)) while (stTarget.hasMoreTokens()) { lemmaT = stTarget.nextToken(); if (!meaninglessWords.contains(lemmaT)) if (lemmaS.equals(lemmaT)) counter++; } } if (counter >= threshold) return IMappingElement.EQUIVALENCE; else return IMappingElement.IDK; }
java
public char match(ISense source, ISense target) { String sSynset = source.getGloss(); String tSynset = target.getGloss(); StringTokenizer stSource = new StringTokenizer(sSynset, " ,.\"'();"); String lemmaS, lemmaT; int counter = 0; while (stSource.hasMoreTokens()) { StringTokenizer stTarget = new StringTokenizer(tSynset, " ,.\"'();"); lemmaS = stSource.nextToken(); if (!meaninglessWords.contains(lemmaS)) while (stTarget.hasMoreTokens()) { lemmaT = stTarget.nextToken(); if (!meaninglessWords.contains(lemmaT)) if (lemmaS.equals(lemmaT)) counter++; } } if (counter >= threshold) return IMappingElement.EQUIVALENCE; else return IMappingElement.IDK; }
[ "public", "char", "match", "(", "ISense", "source", ",", "ISense", "target", ")", "{", "String", "sSynset", "=", "source", ".", "getGloss", "(", ")", ";", "String", "tSynset", "=", "target", ".", "getGloss", "(", ")", ";", "StringTokenizer", "stSource", "=", "new", "StringTokenizer", "(", "sSynset", ",", "\" ,.\\\"'();\"", ")", ";", "String", "lemmaS", ",", "lemmaT", ";", "int", "counter", "=", "0", ";", "while", "(", "stSource", ".", "hasMoreTokens", "(", ")", ")", "{", "StringTokenizer", "stTarget", "=", "new", "StringTokenizer", "(", "tSynset", ",", "\" ,.\\\"'();\"", ")", ";", "lemmaS", "=", "stSource", ".", "nextToken", "(", ")", ";", "if", "(", "!", "meaninglessWords", ".", "contains", "(", "lemmaS", ")", ")", "while", "(", "stTarget", ".", "hasMoreTokens", "(", ")", ")", "{", "lemmaT", "=", "stTarget", ".", "nextToken", "(", ")", ";", "if", "(", "!", "meaninglessWords", ".", "contains", "(", "lemmaT", ")", ")", "if", "(", "lemmaS", ".", "equals", "(", "lemmaT", ")", ")", "counter", "++", ";", "}", "}", "if", "(", "counter", ">=", "threshold", ")", "return", "IMappingElement", ".", "EQUIVALENCE", ";", "else", "return", "IMappingElement", ".", "IDK", ";", "}" ]
Computes the relations with WordNet gloss comparison matcher. @param source gloss of source @param target gloss of target @return synonym or IDK relation
[ "Computes", "the", "relations", "with", "WordNet", "gloss", "comparison", "matcher", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/element/gloss/WNGlossComparison.java#L55-L76
147,991
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/matchers/element/string/Synonym.java
Synonym.match
public char match(String str1, String str2) { if (str1 == null || str2 == null) return IMappingElement.IDK; if (str1.equals(str2)) { return IMappingElement.EQUIVALENCE; } else return IMappingElement.IDK; }
java
public char match(String str1, String str2) { if (str1 == null || str2 == null) return IMappingElement.IDK; if (str1.equals(str2)) { return IMappingElement.EQUIVALENCE; } else return IMappingElement.IDK; }
[ "public", "char", "match", "(", "String", "str1", ",", "String", "str2", ")", "{", "if", "(", "str1", "==", "null", "||", "str2", "==", "null", ")", "return", "IMappingElement", ".", "IDK", ";", "if", "(", "str1", ".", "equals", "(", "str2", ")", ")", "{", "return", "IMappingElement", ".", "EQUIVALENCE", ";", "}", "else", "return", "IMappingElement", ".", "IDK", ";", "}" ]
Computes relation with synonym matcher @param str1 the source string @param str2 the target string @return synonym or IDK relation
[ "Computes", "relation", "with", "synonym", "matcher" ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/element/string/Synonym.java#L23-L30
147,992
kmi/iserve
iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/impl/SparqlLogicConceptMatcher.java
SparqlLogicConceptMatcher.getMatchType
private MatchType getMatchType(QuerySolution soln) { if (soln.contains(EXACT_VAR)) return LogicConceptMatchType.Exact; if (soln.contains(SUPER_VAR)) return LogicConceptMatchType.Plugin; if (soln.contains(SUB_VAR)) return LogicConceptMatchType.Subsume; return LogicConceptMatchType.Fail; }
java
private MatchType getMatchType(QuerySolution soln) { if (soln.contains(EXACT_VAR)) return LogicConceptMatchType.Exact; if (soln.contains(SUPER_VAR)) return LogicConceptMatchType.Plugin; if (soln.contains(SUB_VAR)) return LogicConceptMatchType.Subsume; return LogicConceptMatchType.Fail; }
[ "private", "MatchType", "getMatchType", "(", "QuerySolution", "soln", ")", "{", "if", "(", "soln", ".", "contains", "(", "EXACT_VAR", ")", ")", "return", "LogicConceptMatchType", ".", "Exact", ";", "if", "(", "soln", ".", "contains", "(", "SUPER_VAR", ")", ")", "return", "LogicConceptMatchType", ".", "Plugin", ";", "if", "(", "soln", ".", "contains", "(", "SUB_VAR", ")", ")", "return", "LogicConceptMatchType", ".", "Subsume", ";", "return", "LogicConceptMatchType", ".", "Fail", ";", "}" ]
Obtain the type of Match. The bindings indicate the relationship between the destination and the origin That is, the subclasses of 'origin' will have a true value at binding 'sub' @param soln @return
[ "Obtain", "the", "type", "of", "Match", ".", "The", "bindings", "indicate", "the", "relationship", "between", "the", "destination", "and", "the", "origin", "That", "is", "the", "subclasses", "of", "origin", "will", "have", "a", "true", "value", "at", "binding", "sub" ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/impl/SparqlLogicConceptMatcher.java#L359-L371
147,993
mlhartme/sushi
src/main/java/net/oneandone/sushi/xml/Builder.java
Builder.parseString
public Document parseString(String text) throws SAXException { try { return parse(new InputSource(new StringReader(text))); } catch (IOException e) { throw new RuntimeException("unexpected world exception while reading memory stream", e); } }
java
public Document parseString(String text) throws SAXException { try { return parse(new InputSource(new StringReader(text))); } catch (IOException e) { throw new RuntimeException("unexpected world exception while reading memory stream", e); } }
[ "public", "Document", "parseString", "(", "String", "text", ")", "throws", "SAXException", "{", "try", "{", "return", "parse", "(", "new", "InputSource", "(", "new", "StringReader", "(", "text", ")", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"unexpected world exception while reading memory stream\"", ",", "e", ")", ";", "}", "}" ]
This method is not called "parse" to avoid confusion with file parsing methods
[ "This", "method", "is", "not", "called", "parse", "to", "avoid", "confusion", "with", "file", "parsing", "methods" ]
4af33414b04bd58584d4febe5cc63ef6c7346a75
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/xml/Builder.java#L53-L59
147,994
mlhartme/sushi
src/main/java/net/oneandone/sushi/xml/Builder.java
Builder.literal
public Document literal(String text) { try { return parseString(text); } catch (SAXException e) { throw new RuntimeException(text, e); } }
java
public Document literal(String text) { try { return parseString(text); } catch (SAXException e) { throw new RuntimeException(text, e); } }
[ "public", "Document", "literal", "(", "String", "text", ")", "{", "try", "{", "return", "parseString", "(", "text", ")", ";", "}", "catch", "(", "SAXException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "text", ",", "e", ")", ";", "}", "}" ]
asserts a valid document
[ "asserts", "a", "valid", "document" ]
4af33414b04bd58584d4febe5cc63ef6c7346a75
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/xml/Builder.java#L62-L68
147,995
ykrasik/jaci
jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/command/CliCommand.java
CliCommand.from
public static CliCommand from(Identifier identifier, List<CliParam> params, CommandExecutor executor) { final CliParamManager paramManager = new CliParamManagerImpl(params); return new CliCommand(identifier, paramManager, executor); }
java
public static CliCommand from(Identifier identifier, List<CliParam> params, CommandExecutor executor) { final CliParamManager paramManager = new CliParamManagerImpl(params); return new CliCommand(identifier, paramManager, executor); }
[ "public", "static", "CliCommand", "from", "(", "Identifier", "identifier", ",", "List", "<", "CliParam", ">", "params", ",", "CommandExecutor", "executor", ")", "{", "final", "CliParamManager", "paramManager", "=", "new", "CliParamManagerImpl", "(", "params", ")", ";", "return", "new", "CliCommand", "(", "identifier", ",", "paramManager", ",", "executor", ")", ";", "}" ]
Construct a CLI command from the given parameters. @param identifier Command identifier. @param params CLI parameters to use. @param executor Command executor. @return A CLI command constructed from the given parameters.
[ "Construct", "a", "CLI", "command", "from", "the", "given", "parameters", "." ]
4615edef7c76288ad5ea8d678132b161645ca1e3
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/command/CliCommand.java#L118-L121
147,996
pulse00/Composer-Java-Bindings
java-api/src/main/java/com/dubture/getcomposer/core/ComposerPackage.java
ComposerPackage.getMinimumStability
public String getMinimumStability() { String stabi = getAsString("minimum-stability"); if (stabi == null) { return ComposerConstants.STABILITIES[0]; } else { return stabi; } }
java
public String getMinimumStability() { String stabi = getAsString("minimum-stability"); if (stabi == null) { return ComposerConstants.STABILITIES[0]; } else { return stabi; } }
[ "public", "String", "getMinimumStability", "(", ")", "{", "String", "stabi", "=", "getAsString", "(", "\"minimum-stability\"", ")", ";", "if", "(", "stabi", "==", "null", ")", "{", "return", "ComposerConstants", ".", "STABILITIES", "[", "0", "]", ";", "}", "else", "{", "return", "stabi", ";", "}", "}" ]
Returns the minimum-stability property @return the minimum-stability
[ "Returns", "the", "minimum", "-", "stability", "property" ]
0aa572567db37d047a41a57c32ede7c7fd5d4938
https://github.com/pulse00/Composer-Java-Bindings/blob/0aa572567db37d047a41a57c32ede7c7fd5d4938/java-api/src/main/java/com/dubture/getcomposer/core/ComposerPackage.java#L177-L184
147,997
synchronoss/cpo-api
cpo-core/src/main/java/org/synchronoss/cpo/CpoAdapterFactoryManager.java
CpoAdapterFactoryManager.loadAdapters
synchronized public static void loadAdapters(String configFile) { InputStream is = CpoClassLoader.getResourceAsStream(configFile); if (is == null) { logger.info("Resource Not Found: " + configFile); try { is = new FileInputStream(configFile); } catch (FileNotFoundException fnfe) { logger.info("File Not Found: " + configFile); is = null; } } try { CpoConfigDocument configDoc; if (is == null) { configDoc = CpoConfigDocument.Factory.parse(configFile); } else { configDoc = CpoConfigDocument.Factory.parse(is); } String errMsg = XmlBeansHelper.validateXml(configDoc); if (errMsg != null) { logger.error("Invalid CPO Config file: " + configFile + ":" + errMsg); } else { logger.info("Processing Config File: " + configFile); // Moving the clear to here to make sure we get a good file before we just blow away all the adapters. // We are doing a load clear all the caches first, in case the load gets called more than once. CpoMetaDescriptor.clearAllInstances(); clearCpoAdapterFactoryCache(); CtCpoConfig cpoConfig = configDoc.getCpoConfig(); // Set the default context. if (cpoConfig.isSetDefaultConfig()) { defaultContext = cpoConfig.getDefaultConfig(); } else { // make the first listed config the default. defaultContext = cpoConfig.getDataConfigArray(0).getName(); } for (CtMetaDescriptor metaDescriptor : cpoConfig.getMetaConfigArray()) { boolean caseSensitive = true; if (metaDescriptor.isSetCaseSensitive()) { caseSensitive = metaDescriptor.getCaseSensitive(); } // this will create and cache, so we don't need the return CpoMetaDescriptor.getInstance(metaDescriptor.getName(), metaDescriptor.getMetaXmlArray(), caseSensitive); } // now lets loop through all the adapters and get them cached. for (CtDataSourceConfig dataSourceConfig : cpoConfig.getDataConfigArray()) { CpoAdapterFactory cpoAdapterFactory = makeCpoAdapterFactory(dataSourceConfig); if (cpoAdapterFactory != null) { addCpoAdapterFactory(dataSourceConfig.getName(), cpoAdapterFactory); } } } } catch (IOException ioe) { logger.error("Error reading " + configFile + ": ", ioe); } catch (XmlException xe) { logger.error("Error processing " + configFile + ": Invalid XML"); } catch (CpoException ce) { logger.error("Error processing " + configFile + ": ", ce); } }
java
synchronized public static void loadAdapters(String configFile) { InputStream is = CpoClassLoader.getResourceAsStream(configFile); if (is == null) { logger.info("Resource Not Found: " + configFile); try { is = new FileInputStream(configFile); } catch (FileNotFoundException fnfe) { logger.info("File Not Found: " + configFile); is = null; } } try { CpoConfigDocument configDoc; if (is == null) { configDoc = CpoConfigDocument.Factory.parse(configFile); } else { configDoc = CpoConfigDocument.Factory.parse(is); } String errMsg = XmlBeansHelper.validateXml(configDoc); if (errMsg != null) { logger.error("Invalid CPO Config file: " + configFile + ":" + errMsg); } else { logger.info("Processing Config File: " + configFile); // Moving the clear to here to make sure we get a good file before we just blow away all the adapters. // We are doing a load clear all the caches first, in case the load gets called more than once. CpoMetaDescriptor.clearAllInstances(); clearCpoAdapterFactoryCache(); CtCpoConfig cpoConfig = configDoc.getCpoConfig(); // Set the default context. if (cpoConfig.isSetDefaultConfig()) { defaultContext = cpoConfig.getDefaultConfig(); } else { // make the first listed config the default. defaultContext = cpoConfig.getDataConfigArray(0).getName(); } for (CtMetaDescriptor metaDescriptor : cpoConfig.getMetaConfigArray()) { boolean caseSensitive = true; if (metaDescriptor.isSetCaseSensitive()) { caseSensitive = metaDescriptor.getCaseSensitive(); } // this will create and cache, so we don't need the return CpoMetaDescriptor.getInstance(metaDescriptor.getName(), metaDescriptor.getMetaXmlArray(), caseSensitive); } // now lets loop through all the adapters and get them cached. for (CtDataSourceConfig dataSourceConfig : cpoConfig.getDataConfigArray()) { CpoAdapterFactory cpoAdapterFactory = makeCpoAdapterFactory(dataSourceConfig); if (cpoAdapterFactory != null) { addCpoAdapterFactory(dataSourceConfig.getName(), cpoAdapterFactory); } } } } catch (IOException ioe) { logger.error("Error reading " + configFile + ": ", ioe); } catch (XmlException xe) { logger.error("Error processing " + configFile + ": Invalid XML"); } catch (CpoException ce) { logger.error("Error processing " + configFile + ": ", ce); } }
[ "synchronized", "public", "static", "void", "loadAdapters", "(", "String", "configFile", ")", "{", "InputStream", "is", "=", "CpoClassLoader", ".", "getResourceAsStream", "(", "configFile", ")", ";", "if", "(", "is", "==", "null", ")", "{", "logger", ".", "info", "(", "\"Resource Not Found: \"", "+", "configFile", ")", ";", "try", "{", "is", "=", "new", "FileInputStream", "(", "configFile", ")", ";", "}", "catch", "(", "FileNotFoundException", "fnfe", ")", "{", "logger", ".", "info", "(", "\"File Not Found: \"", "+", "configFile", ")", ";", "is", "=", "null", ";", "}", "}", "try", "{", "CpoConfigDocument", "configDoc", ";", "if", "(", "is", "==", "null", ")", "{", "configDoc", "=", "CpoConfigDocument", ".", "Factory", ".", "parse", "(", "configFile", ")", ";", "}", "else", "{", "configDoc", "=", "CpoConfigDocument", ".", "Factory", ".", "parse", "(", "is", ")", ";", "}", "String", "errMsg", "=", "XmlBeansHelper", ".", "validateXml", "(", "configDoc", ")", ";", "if", "(", "errMsg", "!=", "null", ")", "{", "logger", ".", "error", "(", "\"Invalid CPO Config file: \"", "+", "configFile", "+", "\":\"", "+", "errMsg", ")", ";", "}", "else", "{", "logger", ".", "info", "(", "\"Processing Config File: \"", "+", "configFile", ")", ";", "// Moving the clear to here to make sure we get a good file before we just blow away all the adapters.", "// We are doing a load clear all the caches first, in case the load gets called more than once.", "CpoMetaDescriptor", ".", "clearAllInstances", "(", ")", ";", "clearCpoAdapterFactoryCache", "(", ")", ";", "CtCpoConfig", "cpoConfig", "=", "configDoc", ".", "getCpoConfig", "(", ")", ";", "// Set the default context.", "if", "(", "cpoConfig", ".", "isSetDefaultConfig", "(", ")", ")", "{", "defaultContext", "=", "cpoConfig", ".", "getDefaultConfig", "(", ")", ";", "}", "else", "{", "// make the first listed config the default.", "defaultContext", "=", "cpoConfig", ".", "getDataConfigArray", "(", "0", ")", ".", "getName", "(", ")", ";", "}", "for", "(", "CtMetaDescriptor", "metaDescriptor", ":", "cpoConfig", ".", "getMetaConfigArray", "(", ")", ")", "{", "boolean", "caseSensitive", "=", "true", ";", "if", "(", "metaDescriptor", ".", "isSetCaseSensitive", "(", ")", ")", "{", "caseSensitive", "=", "metaDescriptor", ".", "getCaseSensitive", "(", ")", ";", "}", "// this will create and cache, so we don't need the return", "CpoMetaDescriptor", ".", "getInstance", "(", "metaDescriptor", ".", "getName", "(", ")", ",", "metaDescriptor", ".", "getMetaXmlArray", "(", ")", ",", "caseSensitive", ")", ";", "}", "// now lets loop through all the adapters and get them cached.", "for", "(", "CtDataSourceConfig", "dataSourceConfig", ":", "cpoConfig", ".", "getDataConfigArray", "(", ")", ")", "{", "CpoAdapterFactory", "cpoAdapterFactory", "=", "makeCpoAdapterFactory", "(", "dataSourceConfig", ")", ";", "if", "(", "cpoAdapterFactory", "!=", "null", ")", "{", "addCpoAdapterFactory", "(", "dataSourceConfig", ".", "getName", "(", ")", ",", "cpoAdapterFactory", ")", ";", "}", "}", "}", "}", "catch", "(", "IOException", "ioe", ")", "{", "logger", ".", "error", "(", "\"Error reading \"", "+", "configFile", "+", "\": \"", ",", "ioe", ")", ";", "}", "catch", "(", "XmlException", "xe", ")", "{", "logger", ".", "error", "(", "\"Error processing \"", "+", "configFile", "+", "\": Invalid XML\"", ")", ";", "}", "catch", "(", "CpoException", "ce", ")", "{", "logger", ".", "error", "(", "\"Error processing \"", "+", "configFile", "+", "\": \"", ",", "ce", ")", ";", "}", "}" ]
LoadAdapters is responsible for loading the config file and then subsequently loading all the metadata. @param configFile
[ "LoadAdapters", "is", "responsible", "for", "loading", "the", "config", "file", "and", "then", "subsequently", "loading", "all", "the", "metadata", "." ]
dc745aca3b3206abf80b85d9689b0132f5baa694
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-core/src/main/java/org/synchronoss/cpo/CpoAdapterFactoryManager.java#L93-L159
147,998
ykrasik/jaci
jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/output/CliPrinter.java
CliPrinter.printCommandInfo
public void printCommandInfo(CommandInfo info) { final PrintContext context = new PrintContext(); // Print command name : description final CliCommand command = info.getCommand(); printIdentifiable(context, command); // Print bound params. final BoundParams boundParams = info.getBoundParams(); printBoundParams(context, command, boundParams); }
java
public void printCommandInfo(CommandInfo info) { final PrintContext context = new PrintContext(); // Print command name : description final CliCommand command = info.getCommand(); printIdentifiable(context, command); // Print bound params. final BoundParams boundParams = info.getBoundParams(); printBoundParams(context, command, boundParams); }
[ "public", "void", "printCommandInfo", "(", "CommandInfo", "info", ")", "{", "final", "PrintContext", "context", "=", "new", "PrintContext", "(", ")", ";", "// Print command name : description", "final", "CliCommand", "command", "=", "info", ".", "getCommand", "(", ")", ";", "printIdentifiable", "(", "context", ",", "command", ")", ";", "// Print bound params.", "final", "BoundParams", "boundParams", "=", "info", ".", "getBoundParams", "(", ")", ";", "printBoundParams", "(", "context", ",", "command", ",", "boundParams", ")", ";", "}" ]
Print information about a command. Called to display assistance information about a command, or if a parse error occurred while parsing the command's parameters. @param info Command info to print.
[ "Print", "information", "about", "a", "command", ".", "Called", "to", "display", "assistance", "information", "about", "a", "command", "or", "if", "a", "parse", "error", "occurred", "while", "parsing", "the", "command", "s", "parameters", "." ]
4615edef7c76288ad5ea8d678132b161645ca1e3
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/output/CliPrinter.java#L204-L214
147,999
ykrasik/jaci
jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/output/CliPrinter.java
CliPrinter.printSuggestions
public void printSuggestions(Suggestions suggestions) { final PrintContext context = new PrintContext(); context.append("Suggestions:").println(); context.incIndent(); printSuggestions0(context, suggestions.getDirectorySuggestions(), "Directories"); printSuggestions0(context, suggestions.getCommandSuggestions(), "Commands"); printSuggestions0(context, suggestions.getParamNameSuggestions(), "Parameter names"); printSuggestions0(context, suggestions.getParamValueSuggestions(), "Parameter values"); context.decIndent(); }
java
public void printSuggestions(Suggestions suggestions) { final PrintContext context = new PrintContext(); context.append("Suggestions:").println(); context.incIndent(); printSuggestions0(context, suggestions.getDirectorySuggestions(), "Directories"); printSuggestions0(context, suggestions.getCommandSuggestions(), "Commands"); printSuggestions0(context, suggestions.getParamNameSuggestions(), "Parameter names"); printSuggestions0(context, suggestions.getParamValueSuggestions(), "Parameter values"); context.decIndent(); }
[ "public", "void", "printSuggestions", "(", "Suggestions", "suggestions", ")", "{", "final", "PrintContext", "context", "=", "new", "PrintContext", "(", ")", ";", "context", ".", "append", "(", "\"Suggestions:\"", ")", ".", "println", "(", ")", ";", "context", ".", "incIndent", "(", ")", ";", "printSuggestions0", "(", "context", ",", "suggestions", ".", "getDirectorySuggestions", "(", ")", ",", "\"Directories\"", ")", ";", "printSuggestions0", "(", "context", ",", "suggestions", ".", "getCommandSuggestions", "(", ")", ",", "\"Commands\"", ")", ";", "printSuggestions0", "(", "context", ",", "suggestions", ".", "getParamNameSuggestions", "(", ")", ",", "\"Parameter names\"", ")", ";", "printSuggestions0", "(", "context", ",", "suggestions", ".", "getParamValueSuggestions", "(", ")", ",", "\"Parameter values\"", ")", ";", "context", ".", "decIndent", "(", ")", ";", "}" ]
Print suggestions. @param suggestions Suggestions to print.
[ "Print", "suggestions", "." ]
4615edef7c76288ad5ea8d678132b161645ca1e3
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/output/CliPrinter.java#L248-L258