repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
infinispan/infinispan
core/src/main/java/org/infinispan/configuration/global/SerializationConfigurationBuilder.java
SerializationConfigurationBuilder.addAdvancedExternalizer
public <T> SerializationConfigurationBuilder addAdvancedExternalizer(int id, AdvancedExternalizer<T> advancedExternalizer) { """ Helper method that allows for quick registration of an {@link AdvancedExternalizer} implementation alongside its corresponding identifier. Remember that the identifier needs to a be positive number, including 0, and cannot clash with other identifiers in the system. @param id @param advancedExternalizer """ AdvancedExternalizer<?> ext = advancedExternalizers.get(id); if (ext != null) throw new CacheConfigurationException(String.format( "Duplicate externalizer id found! Externalizer id=%d for %s is shared by another externalizer (%s)", id, advancedExternalizer.getClass().getName(), ext.getClass().getName())); advancedExternalizers.put(id, advancedExternalizer); return this; }
java
public <T> SerializationConfigurationBuilder addAdvancedExternalizer(int id, AdvancedExternalizer<T> advancedExternalizer) { AdvancedExternalizer<?> ext = advancedExternalizers.get(id); if (ext != null) throw new CacheConfigurationException(String.format( "Duplicate externalizer id found! Externalizer id=%d for %s is shared by another externalizer (%s)", id, advancedExternalizer.getClass().getName(), ext.getClass().getName())); advancedExternalizers.put(id, advancedExternalizer); return this; }
[ "public", "<", "T", ">", "SerializationConfigurationBuilder", "addAdvancedExternalizer", "(", "int", "id", ",", "AdvancedExternalizer", "<", "T", ">", "advancedExternalizer", ")", "{", "AdvancedExternalizer", "<", "?", ">", "ext", "=", "advancedExternalizers", ".", "get", "(", "id", ")", ";", "if", "(", "ext", "!=", "null", ")", "throw", "new", "CacheConfigurationException", "(", "String", ".", "format", "(", "\"Duplicate externalizer id found! Externalizer id=%d for %s is shared by another externalizer (%s)\"", ",", "id", ",", "advancedExternalizer", ".", "getClass", "(", ")", ".", "getName", "(", ")", ",", "ext", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ")", ";", "advancedExternalizers", ".", "put", "(", "id", ",", "advancedExternalizer", ")", ";", "return", "this", ";", "}" ]
Helper method that allows for quick registration of an {@link AdvancedExternalizer} implementation alongside its corresponding identifier. Remember that the identifier needs to a be positive number, including 0, and cannot clash with other identifiers in the system. @param id @param advancedExternalizer
[ "Helper", "method", "that", "allows", "for", "quick", "registration", "of", "an", "{", "@link", "AdvancedExternalizer", "}", "implementation", "alongside", "its", "corresponding", "identifier", ".", "Remember", "that", "the", "identifier", "needs", "to", "a", "be", "positive", "number", "including", "0", "and", "cannot", "clash", "with", "other", "identifiers", "in", "the", "system", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/global/SerializationConfigurationBuilder.java#L77-L86
Wadpam/guja
guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java
GeneratedDContactDaoImpl.queryByOtherEmail
public Iterable<DContact> queryByOtherEmail(Object parent, java.lang.String otherEmail) { """ query-by method for field otherEmail @param otherEmail the specified attribute @return an Iterable of DContacts for the specified otherEmail """ return queryByField(parent, DContactMapper.Field.OTHEREMAIL.getFieldName(), otherEmail); }
java
public Iterable<DContact> queryByOtherEmail(Object parent, java.lang.String otherEmail) { return queryByField(parent, DContactMapper.Field.OTHEREMAIL.getFieldName(), otherEmail); }
[ "public", "Iterable", "<", "DContact", ">", "queryByOtherEmail", "(", "Object", "parent", ",", "java", ".", "lang", ".", "String", "otherEmail", ")", "{", "return", "queryByField", "(", "parent", ",", "DContactMapper", ".", "Field", ".", "OTHEREMAIL", ".", "getFieldName", "(", ")", ",", "otherEmail", ")", ";", "}" ]
query-by method for field otherEmail @param otherEmail the specified attribute @return an Iterable of DContacts for the specified otherEmail
[ "query", "-", "by", "method", "for", "field", "otherEmail" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L232-L234
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/StringUtils.java
StringUtils.trimTrailingCharacter
public static String trimTrailingCharacter(String str, char trailingCharacter) { """ Trim all occurrences of the supplied trailing character from the given {@code String}. @param str the {@code String} to check @param trailingCharacter the trailing character to be trimmed @return the trimmed {@code String} """ if (!hasLength(str)) { return str; } StringBuilder buf = new StringBuilder(str); while (buf.length() > 0 && buf.charAt(buf.length() - 1) == trailingCharacter) { buf.deleteCharAt(buf.length() - 1); } return buf.toString(); }
java
public static String trimTrailingCharacter(String str, char trailingCharacter) { if (!hasLength(str)) { return str; } StringBuilder buf = new StringBuilder(str); while (buf.length() > 0 && buf.charAt(buf.length() - 1) == trailingCharacter) { buf.deleteCharAt(buf.length() - 1); } return buf.toString(); }
[ "public", "static", "String", "trimTrailingCharacter", "(", "String", "str", ",", "char", "trailingCharacter", ")", "{", "if", "(", "!", "hasLength", "(", "str", ")", ")", "{", "return", "str", ";", "}", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", "str", ")", ";", "while", "(", "buf", ".", "length", "(", ")", ">", "0", "&&", "buf", ".", "charAt", "(", "buf", ".", "length", "(", ")", "-", "1", ")", "==", "trailingCharacter", ")", "{", "buf", ".", "deleteCharAt", "(", "buf", ".", "length", "(", ")", "-", "1", ")", ";", "}", "return", "buf", ".", "toString", "(", ")", ";", "}" ]
Trim all occurrences of the supplied trailing character from the given {@code String}. @param str the {@code String} to check @param trailingCharacter the trailing character to be trimmed @return the trimmed {@code String}
[ "Trim", "all", "occurrences", "of", "the", "supplied", "trailing", "character", "from", "the", "given", "{", "@code", "String", "}", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/StringUtils.java#L252-L261
padrig64/ValidationFramework
validationframework-swing/src/main/java/com/google/code/validationframework/swing/utils/ColorUtils.java
ColorUtils.alphaBlend
public static Color alphaBlend(Color src, Color dst) { """ Blends the two colors taking into account their alpha.<br>If one of the two input colors implements the {@link UIResource} interface, the result color will also implement this interface. @param src Source color to be blended into the destination color. @param dst Destination color on which the source color is to be blended. @return Color resulting from the color blending. """ Color blend; float srcA = (float) src.getAlpha() / 255.0f; float dstA = (float) dst.getAlpha() / 255.0f; float outA = srcA + dstA * (1 - srcA); if (outA > 0) { float outR = ((float) src.getRed() * srcA + (float) dst.getRed() * dstA * (1.0f - srcA)) / outA; float outG = ((float) src.getGreen() * srcA + (float) dst.getGreen() * dstA * (1.0f - srcA)) / outA; float outB = ((float) src.getBlue() * srcA + (float) dst.getBlue() * dstA * (1.0f - srcA)) / outA; blend = new Color((int) outR, (int) outG, (int) outB, (int) (outA * 255.0f)); } else { blend = new Color(0, 0, 0, 0); } if ((src instanceof UIResource) || (dst instanceof UIResource)) { blend = new ColorUIResource(blend); } return blend; }
java
public static Color alphaBlend(Color src, Color dst) { Color blend; float srcA = (float) src.getAlpha() / 255.0f; float dstA = (float) dst.getAlpha() / 255.0f; float outA = srcA + dstA * (1 - srcA); if (outA > 0) { float outR = ((float) src.getRed() * srcA + (float) dst.getRed() * dstA * (1.0f - srcA)) / outA; float outG = ((float) src.getGreen() * srcA + (float) dst.getGreen() * dstA * (1.0f - srcA)) / outA; float outB = ((float) src.getBlue() * srcA + (float) dst.getBlue() * dstA * (1.0f - srcA)) / outA; blend = new Color((int) outR, (int) outG, (int) outB, (int) (outA * 255.0f)); } else { blend = new Color(0, 0, 0, 0); } if ((src instanceof UIResource) || (dst instanceof UIResource)) { blend = new ColorUIResource(blend); } return blend; }
[ "public", "static", "Color", "alphaBlend", "(", "Color", "src", ",", "Color", "dst", ")", "{", "Color", "blend", ";", "float", "srcA", "=", "(", "float", ")", "src", ".", "getAlpha", "(", ")", "/", "255.0f", ";", "float", "dstA", "=", "(", "float", ")", "dst", ".", "getAlpha", "(", ")", "/", "255.0f", ";", "float", "outA", "=", "srcA", "+", "dstA", "*", "(", "1", "-", "srcA", ")", ";", "if", "(", "outA", ">", "0", ")", "{", "float", "outR", "=", "(", "(", "float", ")", "src", ".", "getRed", "(", ")", "*", "srcA", "+", "(", "float", ")", "dst", ".", "getRed", "(", ")", "*", "dstA", "*", "(", "1.0f", "-", "srcA", ")", ")", "/", "outA", ";", "float", "outG", "=", "(", "(", "float", ")", "src", ".", "getGreen", "(", ")", "*", "srcA", "+", "(", "float", ")", "dst", ".", "getGreen", "(", ")", "*", "dstA", "*", "(", "1.0f", "-", "srcA", ")", ")", "/", "outA", ";", "float", "outB", "=", "(", "(", "float", ")", "src", ".", "getBlue", "(", ")", "*", "srcA", "+", "(", "float", ")", "dst", ".", "getBlue", "(", ")", "*", "dstA", "*", "(", "1.0f", "-", "srcA", ")", ")", "/", "outA", ";", "blend", "=", "new", "Color", "(", "(", "int", ")", "outR", ",", "(", "int", ")", "outG", ",", "(", "int", ")", "outB", ",", "(", "int", ")", "(", "outA", "*", "255.0f", ")", ")", ";", "}", "else", "{", "blend", "=", "new", "Color", "(", "0", ",", "0", ",", "0", ",", "0", ")", ";", "}", "if", "(", "(", "src", "instanceof", "UIResource", ")", "||", "(", "dst", "instanceof", "UIResource", ")", ")", "{", "blend", "=", "new", "ColorUIResource", "(", "blend", ")", ";", "}", "return", "blend", ";", "}" ]
Blends the two colors taking into account their alpha.<br>If one of the two input colors implements the {@link UIResource} interface, the result color will also implement this interface. @param src Source color to be blended into the destination color. @param dst Destination color on which the source color is to be blended. @return Color resulting from the color blending.
[ "Blends", "the", "two", "colors", "taking", "into", "account", "their", "alpha", ".", "<br", ">", "If", "one", "of", "the", "two", "input", "colors", "implements", "the", "{", "@link", "UIResource", "}", "interface", "the", "result", "color", "will", "also", "implement", "this", "interface", "." ]
train
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-swing/src/main/java/com/google/code/validationframework/swing/utils/ColorUtils.java#L53-L74
jasminb/jsonapi-converter
src/main/java/com/github/jasminb/jsonapi/JSONAPIDocument.java
JSONAPIDocument.addLink
public void addLink(String linkName, Link link) { """ Adds a named link. @param linkName the named link to add @param link the link to add """ if (links == null) { links = new Links(new HashMap<String, Link>()); } links.addLink(linkName, link); }
java
public void addLink(String linkName, Link link) { if (links == null) { links = new Links(new HashMap<String, Link>()); } links.addLink(linkName, link); }
[ "public", "void", "addLink", "(", "String", "linkName", ",", "Link", "link", ")", "{", "if", "(", "links", "==", "null", ")", "{", "links", "=", "new", "Links", "(", "new", "HashMap", "<", "String", ",", "Link", ">", "(", ")", ")", ";", "}", "links", ".", "addLink", "(", "linkName", ",", "link", ")", ";", "}" ]
Adds a named link. @param linkName the named link to add @param link the link to add
[ "Adds", "a", "named", "link", "." ]
train
https://github.com/jasminb/jsonapi-converter/blob/73b41c3b9274e70e62b3425071ca8afdc7bddaf6/src/main/java/com/github/jasminb/jsonapi/JSONAPIDocument.java#L173-L178
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/NetworkEnvironmentConfiguration.java
NetworkEnvironmentConfiguration.calculateNumberOfNetworkBuffers
@SuppressWarnings("deprecation") private static int calculateNumberOfNetworkBuffers(Configuration configuration, long maxJvmHeapMemory) { """ Calculates the number of network buffers based on configuration and jvm heap size. @param configuration configuration object @param maxJvmHeapMemory the maximum JVM heap size (in bytes) @return the number of network buffers """ final int numberOfNetworkBuffers; if (!hasNewNetworkConfig(configuration)) { // fallback: number of network buffers numberOfNetworkBuffers = configuration.getInteger(TaskManagerOptions.NETWORK_NUM_BUFFERS); checkOldNetworkConfig(numberOfNetworkBuffers); } else { if (configuration.contains(TaskManagerOptions.NETWORK_NUM_BUFFERS)) { LOG.info("Ignoring old (but still present) network buffer configuration via {}.", TaskManagerOptions.NETWORK_NUM_BUFFERS.key()); } final long networkMemorySize = calculateNewNetworkBufferMemory(configuration, maxJvmHeapMemory); // tolerate offcuts between intended and allocated memory due to segmentation (will be available to the user-space memory) long numberOfNetworkBuffersLong = networkMemorySize / getPageSize(configuration); if (numberOfNetworkBuffersLong > Integer.MAX_VALUE) { throw new IllegalArgumentException("The given number of memory bytes (" + networkMemorySize + ") corresponds to more than MAX_INT pages."); } numberOfNetworkBuffers = (int) numberOfNetworkBuffersLong; } return numberOfNetworkBuffers; }
java
@SuppressWarnings("deprecation") private static int calculateNumberOfNetworkBuffers(Configuration configuration, long maxJvmHeapMemory) { final int numberOfNetworkBuffers; if (!hasNewNetworkConfig(configuration)) { // fallback: number of network buffers numberOfNetworkBuffers = configuration.getInteger(TaskManagerOptions.NETWORK_NUM_BUFFERS); checkOldNetworkConfig(numberOfNetworkBuffers); } else { if (configuration.contains(TaskManagerOptions.NETWORK_NUM_BUFFERS)) { LOG.info("Ignoring old (but still present) network buffer configuration via {}.", TaskManagerOptions.NETWORK_NUM_BUFFERS.key()); } final long networkMemorySize = calculateNewNetworkBufferMemory(configuration, maxJvmHeapMemory); // tolerate offcuts between intended and allocated memory due to segmentation (will be available to the user-space memory) long numberOfNetworkBuffersLong = networkMemorySize / getPageSize(configuration); if (numberOfNetworkBuffersLong > Integer.MAX_VALUE) { throw new IllegalArgumentException("The given number of memory bytes (" + networkMemorySize + ") corresponds to more than MAX_INT pages."); } numberOfNetworkBuffers = (int) numberOfNetworkBuffersLong; } return numberOfNetworkBuffers; }
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "private", "static", "int", "calculateNumberOfNetworkBuffers", "(", "Configuration", "configuration", ",", "long", "maxJvmHeapMemory", ")", "{", "final", "int", "numberOfNetworkBuffers", ";", "if", "(", "!", "hasNewNetworkConfig", "(", "configuration", ")", ")", "{", "// fallback: number of network buffers", "numberOfNetworkBuffers", "=", "configuration", ".", "getInteger", "(", "TaskManagerOptions", ".", "NETWORK_NUM_BUFFERS", ")", ";", "checkOldNetworkConfig", "(", "numberOfNetworkBuffers", ")", ";", "}", "else", "{", "if", "(", "configuration", ".", "contains", "(", "TaskManagerOptions", ".", "NETWORK_NUM_BUFFERS", ")", ")", "{", "LOG", ".", "info", "(", "\"Ignoring old (but still present) network buffer configuration via {}.\"", ",", "TaskManagerOptions", ".", "NETWORK_NUM_BUFFERS", ".", "key", "(", ")", ")", ";", "}", "final", "long", "networkMemorySize", "=", "calculateNewNetworkBufferMemory", "(", "configuration", ",", "maxJvmHeapMemory", ")", ";", "// tolerate offcuts between intended and allocated memory due to segmentation (will be available to the user-space memory)", "long", "numberOfNetworkBuffersLong", "=", "networkMemorySize", "/", "getPageSize", "(", "configuration", ")", ";", "if", "(", "numberOfNetworkBuffersLong", ">", "Integer", ".", "MAX_VALUE", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The given number of memory bytes (\"", "+", "networkMemorySize", "+", "\") corresponds to more than MAX_INT pages.\"", ")", ";", "}", "numberOfNetworkBuffers", "=", "(", "int", ")", "numberOfNetworkBuffersLong", ";", "}", "return", "numberOfNetworkBuffers", ";", "}" ]
Calculates the number of network buffers based on configuration and jvm heap size. @param configuration configuration object @param maxJvmHeapMemory the maximum JVM heap size (in bytes) @return the number of network buffers
[ "Calculates", "the", "number", "of", "network", "buffers", "based", "on", "configuration", "and", "jvm", "heap", "size", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/NetworkEnvironmentConfiguration.java#L387-L413
infinispan/infinispan
core/src/main/java/org/infinispan/interceptors/impl/EntryWrappingInterceptor.java
EntryWrappingInterceptor.setSkipRemoteGetsAndInvokeNextForManyEntriesCommand
protected Object setSkipRemoteGetsAndInvokeNextForManyEntriesCommand(InvocationContext ctx, WriteCommand command) { """ Locks the value for the keys accessed by the command to avoid being override from a remote get. """ return invokeNextThenApply(ctx, command, applyAndFixVersionForMany); }
java
protected Object setSkipRemoteGetsAndInvokeNextForManyEntriesCommand(InvocationContext ctx, WriteCommand command) { return invokeNextThenApply(ctx, command, applyAndFixVersionForMany); }
[ "protected", "Object", "setSkipRemoteGetsAndInvokeNextForManyEntriesCommand", "(", "InvocationContext", "ctx", ",", "WriteCommand", "command", ")", "{", "return", "invokeNextThenApply", "(", "ctx", ",", "command", ",", "applyAndFixVersionForMany", ")", ";", "}" ]
Locks the value for the keys accessed by the command to avoid being override from a remote get.
[ "Locks", "the", "value", "for", "the", "keys", "accessed", "by", "the", "command", "to", "avoid", "being", "override", "from", "a", "remote", "get", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/interceptors/impl/EntryWrappingInterceptor.java#L643-L645
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/BindContentProviderBuilder.java
BindContentProviderBuilder.hasOperationOfType
private boolean hasOperationOfType(SQLiteDatabaseSchema schema, MethodSpec.Builder methodBuilder, JQLType jqlType) { """ iterate methods, selecting only jqlType and contains @BindContentProviderEntry annotation. @param schema the schema @param methodBuilder the method builder @param jqlType the jql type @return true, if successful """ boolean hasOperation = false; for (SQLiteDaoDefinition daoDefinition : schema.getCollection()) { if (daoDefinition.getElement().getAnnotation(BindContentProviderPath.class) == null) continue; for (SQLiteModelMethod daoMethod : daoDefinition.getCollection()) { if (daoMethod.jql.operationType != jqlType) { continue; } if (!daoMethod.hasAnnotation(BindContentProviderEntry.class)) { continue; } hasOperation = true; // methodBuilder.addJavadoc("method $L.$L\n", // daoDefinition.getName(), daoMethod.getName()); } } return hasOperation; }
java
private boolean hasOperationOfType(SQLiteDatabaseSchema schema, MethodSpec.Builder methodBuilder, JQLType jqlType) { boolean hasOperation = false; for (SQLiteDaoDefinition daoDefinition : schema.getCollection()) { if (daoDefinition.getElement().getAnnotation(BindContentProviderPath.class) == null) continue; for (SQLiteModelMethod daoMethod : daoDefinition.getCollection()) { if (daoMethod.jql.operationType != jqlType) { continue; } if (!daoMethod.hasAnnotation(BindContentProviderEntry.class)) { continue; } hasOperation = true; // methodBuilder.addJavadoc("method $L.$L\n", // daoDefinition.getName(), daoMethod.getName()); } } return hasOperation; }
[ "private", "boolean", "hasOperationOfType", "(", "SQLiteDatabaseSchema", "schema", ",", "MethodSpec", ".", "Builder", "methodBuilder", ",", "JQLType", "jqlType", ")", "{", "boolean", "hasOperation", "=", "false", ";", "for", "(", "SQLiteDaoDefinition", "daoDefinition", ":", "schema", ".", "getCollection", "(", ")", ")", "{", "if", "(", "daoDefinition", ".", "getElement", "(", ")", ".", "getAnnotation", "(", "BindContentProviderPath", ".", "class", ")", "==", "null", ")", "continue", ";", "for", "(", "SQLiteModelMethod", "daoMethod", ":", "daoDefinition", ".", "getCollection", "(", ")", ")", "{", "if", "(", "daoMethod", ".", "jql", ".", "operationType", "!=", "jqlType", ")", "{", "continue", ";", "}", "if", "(", "!", "daoMethod", ".", "hasAnnotation", "(", "BindContentProviderEntry", ".", "class", ")", ")", "{", "continue", ";", "}", "hasOperation", "=", "true", ";", "// methodBuilder.addJavadoc(\"method $L.$L\\n\",", "// daoDefinition.getName(), daoMethod.getName());", "}", "}", "return", "hasOperation", ";", "}" ]
iterate methods, selecting only jqlType and contains @BindContentProviderEntry annotation. @param schema the schema @param methodBuilder the method builder @param jqlType the jql type @return true, if successful
[ "iterate", "methods", "selecting", "only", "jqlType", "and", "contains", "@BindContentProviderEntry", "annotation", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/BindContentProviderBuilder.java#L678-L699
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UnboundMethodTemplateParameter.java
UnboundMethodTemplateParameter.visitMethod
@Override public void visitMethod(Method obj) { """ implements the visitor to find methods that declare template parameters that are not bound to any parameter. @param obj the context object of the currently parsed method """ Attribute[] attributes = obj.getAttributes(); for (Attribute a : attributes) { if ("Signature".equals(a.getName())) { TemplateSignature ts = parseSignatureAttribute((Signature) a); if (ts != null) { for (TemplateItem templateParm : ts.templateParameters) { if (!ts.signature.contains(Values.SIG_GENERIC_TEMPLATE + templateParm.templateType + Values.SIG_QUALIFIED_CLASS_SUFFIX_CHAR) && !isTemplateParent(templateParm.templateType, ts.templateParameters)) { bugReporter.reportBug(new BugInstance(this, BugType.UMTP_UNBOUND_METHOD_TEMPLATE_PARAMETER.name(), NORMAL_PRIORITY).addClass(this) .addMethod(this).addString("Template Parameter: " + templateParm.templateType)); return; } } } return; } } }
java
@Override public void visitMethod(Method obj) { Attribute[] attributes = obj.getAttributes(); for (Attribute a : attributes) { if ("Signature".equals(a.getName())) { TemplateSignature ts = parseSignatureAttribute((Signature) a); if (ts != null) { for (TemplateItem templateParm : ts.templateParameters) { if (!ts.signature.contains(Values.SIG_GENERIC_TEMPLATE + templateParm.templateType + Values.SIG_QUALIFIED_CLASS_SUFFIX_CHAR) && !isTemplateParent(templateParm.templateType, ts.templateParameters)) { bugReporter.reportBug(new BugInstance(this, BugType.UMTP_UNBOUND_METHOD_TEMPLATE_PARAMETER.name(), NORMAL_PRIORITY).addClass(this) .addMethod(this).addString("Template Parameter: " + templateParm.templateType)); return; } } } return; } } }
[ "@", "Override", "public", "void", "visitMethod", "(", "Method", "obj", ")", "{", "Attribute", "[", "]", "attributes", "=", "obj", ".", "getAttributes", "(", ")", ";", "for", "(", "Attribute", "a", ":", "attributes", ")", "{", "if", "(", "\"Signature\"", ".", "equals", "(", "a", ".", "getName", "(", ")", ")", ")", "{", "TemplateSignature", "ts", "=", "parseSignatureAttribute", "(", "(", "Signature", ")", "a", ")", ";", "if", "(", "ts", "!=", "null", ")", "{", "for", "(", "TemplateItem", "templateParm", ":", "ts", ".", "templateParameters", ")", "{", "if", "(", "!", "ts", ".", "signature", ".", "contains", "(", "Values", ".", "SIG_GENERIC_TEMPLATE", "+", "templateParm", ".", "templateType", "+", "Values", ".", "SIG_QUALIFIED_CLASS_SUFFIX_CHAR", ")", "&&", "!", "isTemplateParent", "(", "templateParm", ".", "templateType", ",", "ts", ".", "templateParameters", ")", ")", "{", "bugReporter", ".", "reportBug", "(", "new", "BugInstance", "(", "this", ",", "BugType", ".", "UMTP_UNBOUND_METHOD_TEMPLATE_PARAMETER", ".", "name", "(", ")", ",", "NORMAL_PRIORITY", ")", ".", "addClass", "(", "this", ")", ".", "addMethod", "(", "this", ")", ".", "addString", "(", "\"Template Parameter: \"", "+", "templateParm", ".", "templateType", ")", ")", ";", "return", ";", "}", "}", "}", "return", ";", "}", "}", "}" ]
implements the visitor to find methods that declare template parameters that are not bound to any parameter. @param obj the context object of the currently parsed method
[ "implements", "the", "visitor", "to", "find", "methods", "that", "declare", "template", "parameters", "that", "are", "not", "bound", "to", "any", "parameter", "." ]
train
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UnboundMethodTemplateParameter.java#L75-L94
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java
HtmlTree.IFRAME
public static HtmlTree IFRAME(String src, String name, String title) { """ Generates a IFRAME tag. @param src the url of the document to be shown in the frame @param name specifies the name of the frame @param title the title for the frame @return an HtmlTree object for the IFRAME tag """ HtmlTree htmltree = new HtmlTree(HtmlTag.IFRAME); htmltree.addAttr(HtmlAttr.SRC, nullCheck(src)); htmltree.addAttr(HtmlAttr.NAME, nullCheck(name)); htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title)); return htmltree; }
java
public static HtmlTree IFRAME(String src, String name, String title) { HtmlTree htmltree = new HtmlTree(HtmlTag.IFRAME); htmltree.addAttr(HtmlAttr.SRC, nullCheck(src)); htmltree.addAttr(HtmlAttr.NAME, nullCheck(name)); htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title)); return htmltree; }
[ "public", "static", "HtmlTree", "IFRAME", "(", "String", "src", ",", "String", "name", ",", "String", "title", ")", "{", "HtmlTree", "htmltree", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "IFRAME", ")", ";", "htmltree", ".", "addAttr", "(", "HtmlAttr", ".", "SRC", ",", "nullCheck", "(", "src", ")", ")", ";", "htmltree", ".", "addAttr", "(", "HtmlAttr", ".", "NAME", ",", "nullCheck", "(", "name", ")", ")", ";", "htmltree", ".", "addAttr", "(", "HtmlAttr", ".", "TITLE", ",", "nullCheck", "(", "title", ")", ")", ";", "return", "htmltree", ";", "}" ]
Generates a IFRAME tag. @param src the url of the document to be shown in the frame @param name specifies the name of the frame @param title the title for the frame @return an HtmlTree object for the IFRAME tag
[ "Generates", "a", "IFRAME", "tag", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java#L464-L470
wwadge/bonecp
bonecp/src/main/java/com/jolbox/bonecp/MemorizeTransactionProxy.java
MemorizeTransactionProxy.memorize
protected static PreparedStatement memorize(final PreparedStatement target, final ConnectionHandle connectionHandle) { """ Wrap PreparedStatement with a proxy. @param target statement handle @param connectionHandle originating bonecp connection @return Proxy to a Preparedstatement. """ return (PreparedStatement) Proxy.newProxyInstance( PreparedStatementProxy.class.getClassLoader(), new Class[] {PreparedStatementProxy.class}, new MemorizeTransactionProxy(target, connectionHandle)); }
java
protected static PreparedStatement memorize(final PreparedStatement target, final ConnectionHandle connectionHandle) { return (PreparedStatement) Proxy.newProxyInstance( PreparedStatementProxy.class.getClassLoader(), new Class[] {PreparedStatementProxy.class}, new MemorizeTransactionProxy(target, connectionHandle)); }
[ "protected", "static", "PreparedStatement", "memorize", "(", "final", "PreparedStatement", "target", ",", "final", "ConnectionHandle", "connectionHandle", ")", "{", "return", "(", "PreparedStatement", ")", "Proxy", ".", "newProxyInstance", "(", "PreparedStatementProxy", ".", "class", ".", "getClassLoader", "(", ")", ",", "new", "Class", "[", "]", "{", "PreparedStatementProxy", ".", "class", "}", ",", "new", "MemorizeTransactionProxy", "(", "target", ",", "connectionHandle", ")", ")", ";", "}" ]
Wrap PreparedStatement with a proxy. @param target statement handle @param connectionHandle originating bonecp connection @return Proxy to a Preparedstatement.
[ "Wrap", "PreparedStatement", "with", "a", "proxy", "." ]
train
https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/MemorizeTransactionProxy.java#L104-L109
prestodb/presto
presto-hive/src/main/java/com/facebook/presto/hive/metastore/SemiTransactionalHiveMetastore.java
SemiTransactionalHiveMetastore.createTable
public synchronized void createTable( ConnectorSession session, Table table, PrincipalPrivileges principalPrivileges, Optional<Path> currentPath, boolean ignoreExisting, PartitionStatistics statistics) { """ {@code currentLocation} needs to be supplied if a writePath exists for the table. """ setShared(); // When creating a table, it should never have partition actions. This is just a sanity check. checkNoPartitionAction(table.getDatabaseName(), table.getTableName()); SchemaTableName schemaTableName = new SchemaTableName(table.getDatabaseName(), table.getTableName()); Action<TableAndMore> oldTableAction = tableActions.get(schemaTableName); TableAndMore tableAndMore = new TableAndMore(table, Optional.of(principalPrivileges), currentPath, Optional.empty(), ignoreExisting, statistics, statistics); if (oldTableAction == null) { HdfsContext context = new HdfsContext(session, table.getDatabaseName(), table.getTableName()); tableActions.put(schemaTableName, new Action<>(ActionType.ADD, tableAndMore, context)); return; } switch (oldTableAction.getType()) { case DROP: throw new PrestoException(TRANSACTION_CONFLICT, "Dropping and then recreating the same table in a transaction is not supported"); case ADD: case ALTER: case INSERT_EXISTING: throw new TableAlreadyExistsException(schemaTableName); default: throw new IllegalStateException("Unknown action type"); } }
java
public synchronized void createTable( ConnectorSession session, Table table, PrincipalPrivileges principalPrivileges, Optional<Path> currentPath, boolean ignoreExisting, PartitionStatistics statistics) { setShared(); // When creating a table, it should never have partition actions. This is just a sanity check. checkNoPartitionAction(table.getDatabaseName(), table.getTableName()); SchemaTableName schemaTableName = new SchemaTableName(table.getDatabaseName(), table.getTableName()); Action<TableAndMore> oldTableAction = tableActions.get(schemaTableName); TableAndMore tableAndMore = new TableAndMore(table, Optional.of(principalPrivileges), currentPath, Optional.empty(), ignoreExisting, statistics, statistics); if (oldTableAction == null) { HdfsContext context = new HdfsContext(session, table.getDatabaseName(), table.getTableName()); tableActions.put(schemaTableName, new Action<>(ActionType.ADD, tableAndMore, context)); return; } switch (oldTableAction.getType()) { case DROP: throw new PrestoException(TRANSACTION_CONFLICT, "Dropping and then recreating the same table in a transaction is not supported"); case ADD: case ALTER: case INSERT_EXISTING: throw new TableAlreadyExistsException(schemaTableName); default: throw new IllegalStateException("Unknown action type"); } }
[ "public", "synchronized", "void", "createTable", "(", "ConnectorSession", "session", ",", "Table", "table", ",", "PrincipalPrivileges", "principalPrivileges", ",", "Optional", "<", "Path", ">", "currentPath", ",", "boolean", "ignoreExisting", ",", "PartitionStatistics", "statistics", ")", "{", "setShared", "(", ")", ";", "// When creating a table, it should never have partition actions. This is just a sanity check.", "checkNoPartitionAction", "(", "table", ".", "getDatabaseName", "(", ")", ",", "table", ".", "getTableName", "(", ")", ")", ";", "SchemaTableName", "schemaTableName", "=", "new", "SchemaTableName", "(", "table", ".", "getDatabaseName", "(", ")", ",", "table", ".", "getTableName", "(", ")", ")", ";", "Action", "<", "TableAndMore", ">", "oldTableAction", "=", "tableActions", ".", "get", "(", "schemaTableName", ")", ";", "TableAndMore", "tableAndMore", "=", "new", "TableAndMore", "(", "table", ",", "Optional", ".", "of", "(", "principalPrivileges", ")", ",", "currentPath", ",", "Optional", ".", "empty", "(", ")", ",", "ignoreExisting", ",", "statistics", ",", "statistics", ")", ";", "if", "(", "oldTableAction", "==", "null", ")", "{", "HdfsContext", "context", "=", "new", "HdfsContext", "(", "session", ",", "table", ".", "getDatabaseName", "(", ")", ",", "table", ".", "getTableName", "(", ")", ")", ";", "tableActions", ".", "put", "(", "schemaTableName", ",", "new", "Action", "<>", "(", "ActionType", ".", "ADD", ",", "tableAndMore", ",", "context", ")", ")", ";", "return", ";", "}", "switch", "(", "oldTableAction", ".", "getType", "(", ")", ")", "{", "case", "DROP", ":", "throw", "new", "PrestoException", "(", "TRANSACTION_CONFLICT", ",", "\"Dropping and then recreating the same table in a transaction is not supported\"", ")", ";", "case", "ADD", ":", "case", "ALTER", ":", "case", "INSERT_EXISTING", ":", "throw", "new", "TableAlreadyExistsException", "(", "schemaTableName", ")", ";", "default", ":", "throw", "new", "IllegalStateException", "(", "\"Unknown action type\"", ")", ";", "}", "}" ]
{@code currentLocation} needs to be supplied if a writePath exists for the table.
[ "{" ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-hive/src/main/java/com/facebook/presto/hive/metastore/SemiTransactionalHiveMetastore.java#L360-L389
netty/netty
common/src/main/java/io/netty/util/internal/PlatformDependent.java
PlatformDependent.hashCodeAsciiCompute
private static int hashCodeAsciiCompute(CharSequence value, int offset, int hash) { """ Identical to {@link PlatformDependent0#hashCodeAsciiCompute(long, int)} but for {@link CharSequence}. """ if (BIG_ENDIAN_NATIVE_ORDER) { return hash * HASH_CODE_C1 + // Low order int hashCodeAsciiSanitizeInt(value, offset + 4) * HASH_CODE_C2 + // High order int hashCodeAsciiSanitizeInt(value, offset); } return hash * HASH_CODE_C1 + // Low order int hashCodeAsciiSanitizeInt(value, offset) * HASH_CODE_C2 + // High order int hashCodeAsciiSanitizeInt(value, offset + 4); }
java
private static int hashCodeAsciiCompute(CharSequence value, int offset, int hash) { if (BIG_ENDIAN_NATIVE_ORDER) { return hash * HASH_CODE_C1 + // Low order int hashCodeAsciiSanitizeInt(value, offset + 4) * HASH_CODE_C2 + // High order int hashCodeAsciiSanitizeInt(value, offset); } return hash * HASH_CODE_C1 + // Low order int hashCodeAsciiSanitizeInt(value, offset) * HASH_CODE_C2 + // High order int hashCodeAsciiSanitizeInt(value, offset + 4); }
[ "private", "static", "int", "hashCodeAsciiCompute", "(", "CharSequence", "value", ",", "int", "offset", ",", "int", "hash", ")", "{", "if", "(", "BIG_ENDIAN_NATIVE_ORDER", ")", "{", "return", "hash", "*", "HASH_CODE_C1", "+", "// Low order int", "hashCodeAsciiSanitizeInt", "(", "value", ",", "offset", "+", "4", ")", "*", "HASH_CODE_C2", "+", "// High order int", "hashCodeAsciiSanitizeInt", "(", "value", ",", "offset", ")", ";", "}", "return", "hash", "*", "HASH_CODE_C1", "+", "// Low order int", "hashCodeAsciiSanitizeInt", "(", "value", ",", "offset", ")", "*", "HASH_CODE_C2", "+", "// High order int", "hashCodeAsciiSanitizeInt", "(", "value", ",", "offset", "+", "4", ")", ";", "}" ]
Identical to {@link PlatformDependent0#hashCodeAsciiCompute(long, int)} but for {@link CharSequence}.
[ "Identical", "to", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/PlatformDependent.java#L503-L516
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/annotations/Annotation.java
Annotation.fillOppositeField
public static void fillOppositeField(Class<?> configuredClass, MappedField configuredField, MappedField targetField) { """ Fill target field with custom methods if occur all these conditions:<br> <ul> <li>It's defined a JMapAccessor by configured field to target</li> <li>The target of the configuration hasn't the custom methods defined</li> </ul> @param configuredClass configured class @param configuredField configured field @param targetField target field """ JMapAccessor accessor = getClassAccessors(configuredClass, targetField.getValue().getName(),true); if(isNull(accessor)) accessor = getFieldAccessors(configuredClass, configuredField.getValue(),true, targetField.getValue().getName()); if(isNull(accessor)) return; if( targetField.getMethod().equals(Constants.DEFAULT_ACCESSOR_VALUE) && !accessor.get().equals(Constants.DEFAULT_ACCESSOR_VALUE)) targetField.getMethod(accessor.get()); if( targetField.setMethod().equals(Constants.DEFAULT_ACCESSOR_VALUE) && !accessor.set().equals(Constants.DEFAULT_ACCESSOR_VALUE)) targetField.setMethod(accessor.set()); }
java
public static void fillOppositeField(Class<?> configuredClass, MappedField configuredField, MappedField targetField) { JMapAccessor accessor = getClassAccessors(configuredClass, targetField.getValue().getName(),true); if(isNull(accessor)) accessor = getFieldAccessors(configuredClass, configuredField.getValue(),true, targetField.getValue().getName()); if(isNull(accessor)) return; if( targetField.getMethod().equals(Constants.DEFAULT_ACCESSOR_VALUE) && !accessor.get().equals(Constants.DEFAULT_ACCESSOR_VALUE)) targetField.getMethod(accessor.get()); if( targetField.setMethod().equals(Constants.DEFAULT_ACCESSOR_VALUE) && !accessor.set().equals(Constants.DEFAULT_ACCESSOR_VALUE)) targetField.setMethod(accessor.set()); }
[ "public", "static", "void", "fillOppositeField", "(", "Class", "<", "?", ">", "configuredClass", ",", "MappedField", "configuredField", ",", "MappedField", "targetField", ")", "{", "JMapAccessor", "accessor", "=", "getClassAccessors", "(", "configuredClass", ",", "targetField", ".", "getValue", "(", ")", ".", "getName", "(", ")", ",", "true", ")", ";", "if", "(", "isNull", "(", "accessor", ")", ")", "accessor", "=", "getFieldAccessors", "(", "configuredClass", ",", "configuredField", ".", "getValue", "(", ")", ",", "true", ",", "targetField", ".", "getValue", "(", ")", ".", "getName", "(", ")", ")", ";", "if", "(", "isNull", "(", "accessor", ")", ")", "return", ";", "if", "(", "targetField", ".", "getMethod", "(", ")", ".", "equals", "(", "Constants", ".", "DEFAULT_ACCESSOR_VALUE", ")", "&&", "!", "accessor", ".", "get", "(", ")", ".", "equals", "(", "Constants", ".", "DEFAULT_ACCESSOR_VALUE", ")", ")", "targetField", ".", "getMethod", "(", "accessor", ".", "get", "(", ")", ")", ";", "if", "(", "targetField", ".", "setMethod", "(", ")", ".", "equals", "(", "Constants", ".", "DEFAULT_ACCESSOR_VALUE", ")", "&&", "!", "accessor", ".", "set", "(", ")", ".", "equals", "(", "Constants", ".", "DEFAULT_ACCESSOR_VALUE", ")", ")", "targetField", ".", "setMethod", "(", "accessor", ".", "set", "(", ")", ")", ";", "}" ]
Fill target field with custom methods if occur all these conditions:<br> <ul> <li>It's defined a JMapAccessor by configured field to target</li> <li>The target of the configuration hasn't the custom methods defined</li> </ul> @param configuredClass configured class @param configuredField configured field @param targetField target field
[ "Fill", "target", "field", "with", "custom", "methods", "if", "occur", "all", "these", "conditions", ":", "<br", ">", "<ul", ">", "<li", ">", "It", "s", "defined", "a", "JMapAccessor", "by", "configured", "field", "to", "target<", "/", "li", ">", "<li", ">", "The", "target", "of", "the", "configuration", "hasn", "t", "the", "custom", "methods", "defined<", "/", "li", ">", "<", "/", "ul", ">" ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/annotations/Annotation.java#L55-L72
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/lock/ExclusiveLockStrategy.java
ExclusiveLockStrategy.unlock
@Override public void unlock(EJSContainer c, Object lockName, Locker locker) { """ Release the lock identified by the given lock name and held by the given locker. <p> """ c.getLockManager().unlock(lockName, locker); }
java
@Override public void unlock(EJSContainer c, Object lockName, Locker locker) { c.getLockManager().unlock(lockName, locker); }
[ "@", "Override", "public", "void", "unlock", "(", "EJSContainer", "c", ",", "Object", "lockName", ",", "Locker", "locker", ")", "{", "c", ".", "getLockManager", "(", ")", ".", "unlock", "(", "lockName", ",", "locker", ")", ";", "}" ]
Release the lock identified by the given lock name and held by the given locker. <p>
[ "Release", "the", "lock", "identified", "by", "the", "given", "lock", "name", "and", "held", "by", "the", "given", "locker", ".", "<p", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/lock/ExclusiveLockStrategy.java#L71-L75
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/features/FeatureInfoBuilder.java
FeatureInfoBuilder.buildResultsInfoMessage
public String buildResultsInfoMessage(FeatureIndexResults results, double tolerance, LatLng clickLocation) { """ Build a feature results information message @param results feature index results @param tolerance distance tolerance @param clickLocation map click location @return results message or null if no results """ return buildResultsInfoMessage(results, tolerance, clickLocation, null); }
java
public String buildResultsInfoMessage(FeatureIndexResults results, double tolerance, LatLng clickLocation) { return buildResultsInfoMessage(results, tolerance, clickLocation, null); }
[ "public", "String", "buildResultsInfoMessage", "(", "FeatureIndexResults", "results", ",", "double", "tolerance", ",", "LatLng", "clickLocation", ")", "{", "return", "buildResultsInfoMessage", "(", "results", ",", "tolerance", ",", "clickLocation", ",", "null", ")", ";", "}" ]
Build a feature results information message @param results feature index results @param tolerance distance tolerance @param clickLocation map click location @return results message or null if no results
[ "Build", "a", "feature", "results", "information", "message" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/features/FeatureInfoBuilder.java#L319-L321
Codearte/catch-exception
catch-throwable/src/main/java/com/googlecode/catchexception/throwable/apis/CatchThrowableHamcrestMatchers.java
CatchThrowableHamcrestMatchers.hasMessageThat
public static <T extends Throwable> org.hamcrest.Matcher<T> hasMessageThat(Matcher<String> stringMatcher) { """ EXAMPLES: <code>assertThat(caughtThrowable(), hasMessageThat(is("Index: 9, Size: 9"))); assertThat(caughtThrowable(), hasMessageThat(containsString("Index: 9"))); // using JUnitMatchers assertThat(caughtThrowable(), hasMessageThat(containsPattern("Index: \\d+"))); // using Mockito's Find</code> @param <T> the throwable subclass @param stringMatcher a string matcher @return Returns a matcher that matches an throwable if the given string matcher matches the throwable message. """ return new ThrowableMessageMatcher<>(stringMatcher); }
java
public static <T extends Throwable> org.hamcrest.Matcher<T> hasMessageThat(Matcher<String> stringMatcher) { return new ThrowableMessageMatcher<>(stringMatcher); }
[ "public", "static", "<", "T", "extends", "Throwable", ">", "org", ".", "hamcrest", ".", "Matcher", "<", "T", ">", "hasMessageThat", "(", "Matcher", "<", "String", ">", "stringMatcher", ")", "{", "return", "new", "ThrowableMessageMatcher", "<>", "(", "stringMatcher", ")", ";", "}" ]
EXAMPLES: <code>assertThat(caughtThrowable(), hasMessageThat(is("Index: 9, Size: 9"))); assertThat(caughtThrowable(), hasMessageThat(containsString("Index: 9"))); // using JUnitMatchers assertThat(caughtThrowable(), hasMessageThat(containsPattern("Index: \\d+"))); // using Mockito's Find</code> @param <T> the throwable subclass @param stringMatcher a string matcher @return Returns a matcher that matches an throwable if the given string matcher matches the throwable message.
[ "EXAMPLES", ":", "<code", ">", "assertThat", "(", "caughtThrowable", "()", "hasMessageThat", "(", "is", "(", "Index", ":", "9", "Size", ":", "9", ")))", ";", "assertThat", "(", "caughtThrowable", "()", "hasMessageThat", "(", "containsString", "(", "Index", ":", "9", ")))", ";", "//", "using", "JUnitMatchers", "assertThat", "(", "caughtThrowable", "()", "hasMessageThat", "(", "containsPattern", "(", "Index", ":", "\\\\", "d", "+", ")))", ";", "//", "using", "Mockito", "s", "Find<", "/", "code", ">" ]
train
https://github.com/Codearte/catch-exception/blob/8cfb1c0a68661ef622011484ff0061b41796b165/catch-throwable/src/main/java/com/googlecode/catchexception/throwable/apis/CatchThrowableHamcrestMatchers.java#L80-L82
OpenTSDB/opentsdb
src/tools/ConfigArgP.java
ConfigArgP.loadConfigSource
protected static void loadConfigSource(ConfigArgP config, String source) { """ Applies the properties from the named source to the main configuration @param config the main configuration to apply to @param source the name of the source to apply properties from """ Properties p = loadConfig(source); Config c = config.getConfig(); for(String key: p.stringPropertyNames()) { String value = p.getProperty(key); ConfigurationItem ci = config.getConfigurationItem(key); if(ci!=null) { // if we recognize the key, validate it ci.setValue(processConfigValue(value)); } c.overrideConfig(key, processConfigValue(value)); } }
java
protected static void loadConfigSource(ConfigArgP config, String source) { Properties p = loadConfig(source); Config c = config.getConfig(); for(String key: p.stringPropertyNames()) { String value = p.getProperty(key); ConfigurationItem ci = config.getConfigurationItem(key); if(ci!=null) { // if we recognize the key, validate it ci.setValue(processConfigValue(value)); } c.overrideConfig(key, processConfigValue(value)); } }
[ "protected", "static", "void", "loadConfigSource", "(", "ConfigArgP", "config", ",", "String", "source", ")", "{", "Properties", "p", "=", "loadConfig", "(", "source", ")", ";", "Config", "c", "=", "config", ".", "getConfig", "(", ")", ";", "for", "(", "String", "key", ":", "p", ".", "stringPropertyNames", "(", ")", ")", "{", "String", "value", "=", "p", ".", "getProperty", "(", "key", ")", ";", "ConfigurationItem", "ci", "=", "config", ".", "getConfigurationItem", "(", "key", ")", ";", "if", "(", "ci", "!=", "null", ")", "{", "// if we recognize the key, validate it", "ci", ".", "setValue", "(", "processConfigValue", "(", "value", ")", ")", ";", "}", "c", ".", "overrideConfig", "(", "key", ",", "processConfigValue", "(", "value", ")", ")", ";", "}", "}" ]
Applies the properties from the named source to the main configuration @param config the main configuration to apply to @param source the name of the source to apply properties from
[ "Applies", "the", "properties", "from", "the", "named", "source", "to", "the", "main", "configuration" ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/ConfigArgP.java#L207-L218
mapbox/mapbox-java
services-geojson/src/main/java/com/mapbox/geojson/MultiPolygon.java
MultiPolygon.fromLngLats
public static MultiPolygon fromLngLats(@NonNull List<List<List<Point>>> points) { """ Create a new instance of this class by defining a list of a list of a list of {@link Point}s which follow the correct specifications described in the Point documentation. @param points a list of {@link Point}s which make up the MultiPolygon geometry @return a new instance of this class defined by the values passed inside this static factory method @since 3.0.0 """ return new MultiPolygon(TYPE, null, points); }
java
public static MultiPolygon fromLngLats(@NonNull List<List<List<Point>>> points) { return new MultiPolygon(TYPE, null, points); }
[ "public", "static", "MultiPolygon", "fromLngLats", "(", "@", "NonNull", "List", "<", "List", "<", "List", "<", "Point", ">", ">", ">", "points", ")", "{", "return", "new", "MultiPolygon", "(", "TYPE", ",", "null", ",", "points", ")", ";", "}" ]
Create a new instance of this class by defining a list of a list of a list of {@link Point}s which follow the correct specifications described in the Point documentation. @param points a list of {@link Point}s which make up the MultiPolygon geometry @return a new instance of this class defined by the values passed inside this static factory method @since 3.0.0
[ "Create", "a", "new", "instance", "of", "this", "class", "by", "defining", "a", "list", "of", "a", "list", "of", "a", "list", "of", "{", "@link", "Point", "}", "s", "which", "follow", "the", "correct", "specifications", "described", "in", "the", "Point", "documentation", "." ]
train
https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/MultiPolygon.java#L178-L180
drinkjava2/jDialects
core/src/main/java/com/github/drinkjava2/jdialects/DialectFunctionTranslator.java
DialectFunctionTranslator.doTranslate
public String doTranslate(Dialect d, String sql) { """ Translate universal SQL to native SQL, all #xxx() format universal SQL functions will be translate to xxx() native SQL functions """ if (StrUtils.isEmpty(sql)) return sql; // if prefix not empty and SQL not include prefix, directly return if (!StrUtils.isEmpty(Dialect.getGlobalSqlFunctionPrefix()) && !StrUtils.containsIgnoreCase(sql, Dialect.getGlobalSqlFunctionPrefix())) return sql; char[] chars = (" " + sql + " ").toCharArray(); DialectSqlItem[] items = seperateCharsToItems(chars, 1, chars.length - 2); for (DialectSqlItem item : items) { correctType(item); } String result = join(d, true, null, items); if (Dialect.getGlobalAllowShowSql()) Dialect.logger.info("Translated sql: " + result); return result; }
java
public String doTranslate(Dialect d, String sql) { if (StrUtils.isEmpty(sql)) return sql; // if prefix not empty and SQL not include prefix, directly return if (!StrUtils.isEmpty(Dialect.getGlobalSqlFunctionPrefix()) && !StrUtils.containsIgnoreCase(sql, Dialect.getGlobalSqlFunctionPrefix())) return sql; char[] chars = (" " + sql + " ").toCharArray(); DialectSqlItem[] items = seperateCharsToItems(chars, 1, chars.length - 2); for (DialectSqlItem item : items) { correctType(item); } String result = join(d, true, null, items); if (Dialect.getGlobalAllowShowSql()) Dialect.logger.info("Translated sql: " + result); return result; }
[ "public", "String", "doTranslate", "(", "Dialect", "d", ",", "String", "sql", ")", "{", "if", "(", "StrUtils", ".", "isEmpty", "(", "sql", ")", ")", "return", "sql", ";", "// if prefix not empty and SQL not include prefix, directly return", "if", "(", "!", "StrUtils", ".", "isEmpty", "(", "Dialect", ".", "getGlobalSqlFunctionPrefix", "(", ")", ")", "&&", "!", "StrUtils", ".", "containsIgnoreCase", "(", "sql", ",", "Dialect", ".", "getGlobalSqlFunctionPrefix", "(", ")", ")", ")", "return", "sql", ";", "char", "[", "]", "chars", "=", "(", "\" \"", "+", "sql", "+", "\" \"", ")", ".", "toCharArray", "(", ")", ";", "DialectSqlItem", "[", "]", "items", "=", "seperateCharsToItems", "(", "chars", ",", "1", ",", "chars", ".", "length", "-", "2", ")", ";", "for", "(", "DialectSqlItem", "item", ":", "items", ")", "{", "correctType", "(", "item", ")", ";", "}", "String", "result", "=", "join", "(", "d", ",", "true", ",", "null", ",", "items", ")", ";", "if", "(", "Dialect", ".", "getGlobalAllowShowSql", "(", ")", ")", "Dialect", ".", "logger", ".", "info", "(", "\"Translated sql: \"", "+", "result", ")", ";", "return", "result", ";", "}" ]
Translate universal SQL to native SQL, all #xxx() format universal SQL functions will be translate to xxx() native SQL functions
[ "Translate", "universal", "SQL", "to", "native", "SQL", "all", "#xxx", "()", "format", "universal", "SQL", "functions", "will", "be", "translate", "to", "xxx", "()", "native", "SQL", "functions" ]
train
https://github.com/drinkjava2/jDialects/blob/1c165f09c6042a599b681c279024abcc1b848b88/core/src/main/java/com/github/drinkjava2/jdialects/DialectFunctionTranslator.java#L284-L300
netheosgithub/pcs_api
java/src/main/java/net/netheos/pcsapi/utils/PcsUtils.java
PcsUtils.randomString
public static String randomString( char[] values, int len ) { """ Generate a random String @param values The characters list to use in the randomization @param len The number of characters in the output String @return The randomized String """ Random rnd = new SecureRandom(); StringBuilder sb = new StringBuilder( len ); for ( int i = 0; i < len; i++ ) { sb.append( values[ rnd.nextInt( values.length )] ); } return sb.toString(); }
java
public static String randomString( char[] values, int len ) { Random rnd = new SecureRandom(); StringBuilder sb = new StringBuilder( len ); for ( int i = 0; i < len; i++ ) { sb.append( values[ rnd.nextInt( values.length )] ); } return sb.toString(); }
[ "public", "static", "String", "randomString", "(", "char", "[", "]", "values", ",", "int", "len", ")", "{", "Random", "rnd", "=", "new", "SecureRandom", "(", ")", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "len", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "{", "sb", ".", "append", "(", "values", "[", "rnd", ".", "nextInt", "(", "values", ".", "length", ")", "]", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Generate a random String @param values The characters list to use in the randomization @param len The number of characters in the output String @return The randomized String
[ "Generate", "a", "random", "String" ]
train
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/utils/PcsUtils.java#L242-L250
alipay/sofa-rpc
core/api/src/main/java/com/alipay/sofa/rpc/config/ConfigValueHelper.java
ConfigValueHelper.checkNormal
protected static void checkNormal(String configKey, String configValue) throws SofaRpcRuntimeException { """ 检查字符串是否是正常值,不是则抛出异常 @param configKey 配置项 @param configValue 配置值 @throws SofaRpcRuntimeException 非法异常 """ checkPattern(configKey, configValue, NORMAL, "only allow a-zA-Z0-9 '-' '_' '.'"); }
java
protected static void checkNormal(String configKey, String configValue) throws SofaRpcRuntimeException { checkPattern(configKey, configValue, NORMAL, "only allow a-zA-Z0-9 '-' '_' '.'"); }
[ "protected", "static", "void", "checkNormal", "(", "String", "configKey", ",", "String", "configValue", ")", "throws", "SofaRpcRuntimeException", "{", "checkPattern", "(", "configKey", ",", "configValue", ",", "NORMAL", ",", "\"only allow a-zA-Z0-9 '-' '_' '.'\"", ")", ";", "}" ]
检查字符串是否是正常值,不是则抛出异常 @param configKey 配置项 @param configValue 配置值 @throws SofaRpcRuntimeException 非法异常
[ "检查字符串是否是正常值,不是则抛出异常" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/config/ConfigValueHelper.java#L97-L99
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java
TransformerHandlerImpl.startDTD
public void startDTD(String name, String publicId, String systemId) throws SAXException { """ Report the start of DTD declarations, if any. <p>Any declarations are assumed to be in the internal subset unless otherwise indicated by a {@link #startEntity startEntity} event.</p> <p>Note that the start/endDTD events will appear within the start/endDocument events from ContentHandler and before the first startElement event.</p> @param name The document type name. @param publicId The declared public identifier for the external DTD subset, or null if none was declared. @param systemId The declared system identifier for the external DTD subset, or null if none was declared. @throws SAXException The application may raise an exception. @see #endDTD @see #startEntity """ if (DEBUG) System.out.println("TransformerHandlerImpl#startDTD: " + name + ", " + publicId + ", " + systemId); if (null != m_lexicalHandler) { m_lexicalHandler.startDTD(name, publicId, systemId); } }
java
public void startDTD(String name, String publicId, String systemId) throws SAXException { if (DEBUG) System.out.println("TransformerHandlerImpl#startDTD: " + name + ", " + publicId + ", " + systemId); if (null != m_lexicalHandler) { m_lexicalHandler.startDTD(name, publicId, systemId); } }
[ "public", "void", "startDTD", "(", "String", "name", ",", "String", "publicId", ",", "String", "systemId", ")", "throws", "SAXException", "{", "if", "(", "DEBUG", ")", "System", ".", "out", ".", "println", "(", "\"TransformerHandlerImpl#startDTD: \"", "+", "name", "+", "\", \"", "+", "publicId", "+", "\", \"", "+", "systemId", ")", ";", "if", "(", "null", "!=", "m_lexicalHandler", ")", "{", "m_lexicalHandler", ".", "startDTD", "(", "name", ",", "publicId", ",", "systemId", ")", ";", "}", "}" ]
Report the start of DTD declarations, if any. <p>Any declarations are assumed to be in the internal subset unless otherwise indicated by a {@link #startEntity startEntity} event.</p> <p>Note that the start/endDTD events will appear within the start/endDocument events from ContentHandler and before the first startElement event.</p> @param name The document type name. @param publicId The declared public identifier for the external DTD subset, or null if none was declared. @param systemId The declared system identifier for the external DTD subset, or null if none was declared. @throws SAXException The application may raise an exception. @see #endDTD @see #startEntity
[ "Report", "the", "start", "of", "DTD", "declarations", "if", "any", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java#L768-L780
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java
SynchronousRequest.getAllEmblemInfo
public List<Emblem> getAllEmblemInfo(Emblem.Type type, int[] ids) throws GuildWars2Exception { """ For more info on Finishers API go <a href="https://wiki.guildwars2.com/wiki/API:2/finishers">here</a><br/> Get finisher info for the given finisher id(s) @param type foregrounds/backgrounds @param ids list of finisher id @return list of finisher info @throws GuildWars2Exception see {@link ErrorCode} for detail @see Finisher finisher info """ isParamValid(new ParamChecker(ids)); if (ids.length > 200) throw new GuildWars2Exception(ErrorCode.ID, "id list too long; this endpoint is limited to 200 ids at once"); try { Response<List<Emblem>> response = gw2API.getAllEmblemInfo(type.name(), processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); } }
java
public List<Emblem> getAllEmblemInfo(Emblem.Type type, int[] ids) throws GuildWars2Exception { isParamValid(new ParamChecker(ids)); if (ids.length > 200) throw new GuildWars2Exception(ErrorCode.ID, "id list too long; this endpoint is limited to 200 ids at once"); try { Response<List<Emblem>> response = gw2API.getAllEmblemInfo(type.name(), processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); } }
[ "public", "List", "<", "Emblem", ">", "getAllEmblemInfo", "(", "Emblem", ".", "Type", "type", ",", "int", "[", "]", "ids", ")", "throws", "GuildWars2Exception", "{", "isParamValid", "(", "new", "ParamChecker", "(", "ids", ")", ")", ";", "if", "(", "ids", ".", "length", ">", "200", ")", "throw", "new", "GuildWars2Exception", "(", "ErrorCode", ".", "ID", ",", "\"id list too long; this endpoint is limited to 200 ids at once\"", ")", ";", "try", "{", "Response", "<", "List", "<", "Emblem", ">>", "response", "=", "gw2API", ".", "getAllEmblemInfo", "(", "type", ".", "name", "(", ")", ",", "processIds", "(", "ids", ")", ")", ".", "execute", "(", ")", ";", "if", "(", "!", "response", ".", "isSuccessful", "(", ")", ")", "throwError", "(", "response", ".", "code", "(", ")", ",", "response", ".", "errorBody", "(", ")", ")", ";", "return", "response", ".", "body", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "GuildWars2Exception", "(", "ErrorCode", ".", "Network", ",", "\"Network Error: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}" ]
For more info on Finishers API go <a href="https://wiki.guildwars2.com/wiki/API:2/finishers">here</a><br/> Get finisher info for the given finisher id(s) @param type foregrounds/backgrounds @param ids list of finisher id @return list of finisher info @throws GuildWars2Exception see {@link ErrorCode} for detail @see Finisher finisher info
[ "For", "more", "info", "on", "Finishers", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "finishers", ">", "here<", "/", "a", ">", "<br", "/", ">", "Get", "finisher", "info", "for", "the", "given", "finisher", "id", "(", "s", ")" ]
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java#L1784-L1795
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/Deflater.java
Deflater.setInput
public void setInput(byte[] b, int off, int len) { """ Sets input data for compression. This should be called whenever needsInput() returns true indicating that more input data is required. @param b the input data bytes @param off the start offset of the data @param len the length of the data @see Deflater#needsInput """ if (b== null) { throw new NullPointerException(); } if (off < 0 || len < 0 || off > b.length - len) { throw new ArrayIndexOutOfBoundsException(); } synchronized (zsRef) { this.buf = b; this.off = off; this.len = len; } }
java
public void setInput(byte[] b, int off, int len) { if (b== null) { throw new NullPointerException(); } if (off < 0 || len < 0 || off > b.length - len) { throw new ArrayIndexOutOfBoundsException(); } synchronized (zsRef) { this.buf = b; this.off = off; this.len = len; } }
[ "public", "void", "setInput", "(", "byte", "[", "]", "b", ",", "int", "off", ",", "int", "len", ")", "{", "if", "(", "b", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";", "}", "if", "(", "off", "<", "0", "||", "len", "<", "0", "||", "off", ">", "b", ".", "length", "-", "len", ")", "{", "throw", "new", "ArrayIndexOutOfBoundsException", "(", ")", ";", "}", "synchronized", "(", "zsRef", ")", "{", "this", ".", "buf", "=", "b", ";", "this", ".", "off", "=", "off", ";", "this", ".", "len", "=", "len", ";", "}", "}" ]
Sets input data for compression. This should be called whenever needsInput() returns true indicating that more input data is required. @param b the input data bytes @param off the start offset of the data @param len the length of the data @see Deflater#needsInput
[ "Sets", "input", "data", "for", "compression", ".", "This", "should", "be", "called", "whenever", "needsInput", "()", "returns", "true", "indicating", "that", "more", "input", "data", "is", "required", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/Deflater.java#L201-L213
Impetus/Kundera
src/kundera-mongo/src/main/java/com/impetus/client/mongodb/MongoDBClient.java
MongoDBClient.onFlushBatch
private void onFlushBatch(Map<String, BulkWriteOperation> bulkWriteOperationMap) { """ On flush batch. @param bulkWriteOperationMap the bulk write operation map """ if (!bulkWriteOperationMap.isEmpty()) { for (BulkWriteOperation builder : bulkWriteOperationMap.values()) { try { builder.execute(getWriteConcern()); } catch (BulkWriteException bwex) { log.error("Batch insertion is not performed due to error in write command. Caused By: ", bwex); throw new KunderaException( "Batch insertion is not performed due to error in write command. Caused By: ", bwex); } catch (MongoException mex) { log.error("Batch insertion is not performed. Caused By: ", mex); throw new KunderaException("Batch insertion is not performed. Caused By: ", mex); } } } }
java
private void onFlushBatch(Map<String, BulkWriteOperation> bulkWriteOperationMap) { if (!bulkWriteOperationMap.isEmpty()) { for (BulkWriteOperation builder : bulkWriteOperationMap.values()) { try { builder.execute(getWriteConcern()); } catch (BulkWriteException bwex) { log.error("Batch insertion is not performed due to error in write command. Caused By: ", bwex); throw new KunderaException( "Batch insertion is not performed due to error in write command. Caused By: ", bwex); } catch (MongoException mex) { log.error("Batch insertion is not performed. Caused By: ", mex); throw new KunderaException("Batch insertion is not performed. Caused By: ", mex); } } } }
[ "private", "void", "onFlushBatch", "(", "Map", "<", "String", ",", "BulkWriteOperation", ">", "bulkWriteOperationMap", ")", "{", "if", "(", "!", "bulkWriteOperationMap", ".", "isEmpty", "(", ")", ")", "{", "for", "(", "BulkWriteOperation", "builder", ":", "bulkWriteOperationMap", ".", "values", "(", ")", ")", "{", "try", "{", "builder", ".", "execute", "(", "getWriteConcern", "(", ")", ")", ";", "}", "catch", "(", "BulkWriteException", "bwex", ")", "{", "log", ".", "error", "(", "\"Batch insertion is not performed due to error in write command. Caused By: \"", ",", "bwex", ")", ";", "throw", "new", "KunderaException", "(", "\"Batch insertion is not performed due to error in write command. Caused By: \"", ",", "bwex", ")", ";", "}", "catch", "(", "MongoException", "mex", ")", "{", "log", ".", "error", "(", "\"Batch insertion is not performed. Caused By: \"", ",", "mex", ")", ";", "throw", "new", "KunderaException", "(", "\"Batch insertion is not performed. Caused By: \"", ",", "mex", ")", ";", "}", "}", "}", "}" ]
On flush batch. @param bulkWriteOperationMap the bulk write operation map
[ "On", "flush", "batch", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-mongo/src/main/java/com/impetus/client/mongodb/MongoDBClient.java#L1329-L1352
windup/windup
utils/src/main/java/org/jboss/windup/util/Logging.java
Logging.printMap
public static String printMap(Map<? extends Object, ? extends Object> tagCountForAllApps, boolean valueFirst) { """ Formats a Map to a String, each entry as one line, using toString() of keys and values. """ StringBuilder sb = new StringBuilder(); for (Map.Entry<? extends Object, ? extends Object> e : tagCountForAllApps.entrySet()) { sb.append(" "); sb.append(valueFirst ? e.getValue() : e.getKey()); sb.append(": "); sb.append(valueFirst ? e.getKey() : e.getValue()); sb.append(Util.NL); } return sb.toString(); }
java
public static String printMap(Map<? extends Object, ? extends Object> tagCountForAllApps, boolean valueFirst) { StringBuilder sb = new StringBuilder(); for (Map.Entry<? extends Object, ? extends Object> e : tagCountForAllApps.entrySet()) { sb.append(" "); sb.append(valueFirst ? e.getValue() : e.getKey()); sb.append(": "); sb.append(valueFirst ? e.getKey() : e.getValue()); sb.append(Util.NL); } return sb.toString(); }
[ "public", "static", "String", "printMap", "(", "Map", "<", "?", "extends", "Object", ",", "?", "extends", "Object", ">", "tagCountForAllApps", ",", "boolean", "valueFirst", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "?", "extends", "Object", ",", "?", "extends", "Object", ">", "e", ":", "tagCountForAllApps", ".", "entrySet", "(", ")", ")", "{", "sb", ".", "append", "(", "\" \"", ")", ";", "sb", ".", "append", "(", "valueFirst", "?", "e", ".", "getValue", "(", ")", ":", "e", ".", "getKey", "(", ")", ")", ";", "sb", ".", "append", "(", "\": \"", ")", ";", "sb", ".", "append", "(", "valueFirst", "?", "e", ".", "getKey", "(", ")", ":", "e", ".", "getValue", "(", ")", ")", ";", "sb", ".", "append", "(", "Util", ".", "NL", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Formats a Map to a String, each entry as one line, using toString() of keys and values.
[ "Formats", "a", "Map", "to", "a", "String", "each", "entry", "as", "one", "line", "using", "toString", "()", "of", "keys", "and", "values", "." ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/utils/src/main/java/org/jboss/windup/util/Logging.java#L24-L36
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/TemplateConfigurationHelper.java
TemplateConfigurationHelper.fillTemplate
public InputStream fillTemplate(String filename, Collection<SimpleParameterEntry> parameters) throws IOException { """ Reads configuration file from file-system and replaces all the occurrences of template-variables (like : "${parameter.name}") with values provided in the map. @param filename @param parameters @return @throws IOException """ Map<String, String> map = new HashMap<String, String>(); for (SimpleParameterEntry parameterEntry : parameters) { map.put(parameterEntry.getName(), parameterEntry.getValue()); } return fillTemplate(filename, map); }
java
public InputStream fillTemplate(String filename, Collection<SimpleParameterEntry> parameters) throws IOException { Map<String, String> map = new HashMap<String, String>(); for (SimpleParameterEntry parameterEntry : parameters) { map.put(parameterEntry.getName(), parameterEntry.getValue()); } return fillTemplate(filename, map); }
[ "public", "InputStream", "fillTemplate", "(", "String", "filename", ",", "Collection", "<", "SimpleParameterEntry", ">", "parameters", ")", "throws", "IOException", "{", "Map", "<", "String", ",", "String", ">", "map", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "for", "(", "SimpleParameterEntry", "parameterEntry", ":", "parameters", ")", "{", "map", ".", "put", "(", "parameterEntry", ".", "getName", "(", ")", ",", "parameterEntry", ".", "getValue", "(", ")", ")", ";", "}", "return", "fillTemplate", "(", "filename", ",", "map", ")", ";", "}" ]
Reads configuration file from file-system and replaces all the occurrences of template-variables (like : "${parameter.name}") with values provided in the map. @param filename @param parameters @return @throws IOException
[ "Reads", "configuration", "file", "from", "file", "-", "system", "and", "replaces", "all", "the", "occurrences", "of", "template", "-", "variables", "(", "like", ":", "$", "{", "parameter", ".", "name", "}", ")", "with", "values", "provided", "in", "the", "map", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/TemplateConfigurationHelper.java#L87-L95
deeplearning4j/deeplearning4j
datavec/datavec-spark/src/main/java/org/datavec/spark/transform/AnalyzeSpark.java
AnalyzeSpark.getUniqueSequence
public static List<Writable> getUniqueSequence(String columnName, Schema schema, JavaRDD<List<List<Writable>>> sequenceData) { """ Get a list of unique values from the specified column of a sequence @param columnName Name of the column to get unique values from @param schema Data schema @param sequenceData Sequence data to get unique values from @return """ JavaRDD<List<Writable>> flattenedSequence = sequenceData.flatMap(new SequenceFlatMapFunction()); return getUnique(columnName, schema, flattenedSequence); }
java
public static List<Writable> getUniqueSequence(String columnName, Schema schema, JavaRDD<List<List<Writable>>> sequenceData) { JavaRDD<List<Writable>> flattenedSequence = sequenceData.flatMap(new SequenceFlatMapFunction()); return getUnique(columnName, schema, flattenedSequence); }
[ "public", "static", "List", "<", "Writable", ">", "getUniqueSequence", "(", "String", "columnName", ",", "Schema", "schema", ",", "JavaRDD", "<", "List", "<", "List", "<", "Writable", ">", ">", ">", "sequenceData", ")", "{", "JavaRDD", "<", "List", "<", "Writable", ">>", "flattenedSequence", "=", "sequenceData", ".", "flatMap", "(", "new", "SequenceFlatMapFunction", "(", ")", ")", ";", "return", "getUnique", "(", "columnName", ",", "schema", ",", "flattenedSequence", ")", ";", "}" ]
Get a list of unique values from the specified column of a sequence @param columnName Name of the column to get unique values from @param schema Data schema @param sequenceData Sequence data to get unique values from @return
[ "Get", "a", "list", "of", "unique", "values", "from", "the", "specified", "column", "of", "a", "sequence" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/transform/AnalyzeSpark.java#L229-L233
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java
TypeHandlerUtils.createArrayOf
public static Object createArrayOf(Connection conn, String typeName, Object[] elements) throws MjdbcSQLException { """ Creates new {@link java.sql.Array} instance. Can be invoked only for JDBC4 driver @param conn SQL connection @param typeName array type name @param elements array of elements @return new {@link java.sql.Array} instance @throws org.midao.jdbc.core.exception.MjdbcSQLException """ Object result = null; try { result = MappingUtils.invokeFunction(conn, "createArrayOf", new Class[]{String.class, Object[].class}, new Object[]{typeName, elements}); } catch (MjdbcException ex) { throw new MjdbcSQLException("createArrayOf is not supported by JDBC Driver", ex); } return result; }
java
public static Object createArrayOf(Connection conn, String typeName, Object[] elements) throws MjdbcSQLException { Object result = null; try { result = MappingUtils.invokeFunction(conn, "createArrayOf", new Class[]{String.class, Object[].class}, new Object[]{typeName, elements}); } catch (MjdbcException ex) { throw new MjdbcSQLException("createArrayOf is not supported by JDBC Driver", ex); } return result; }
[ "public", "static", "Object", "createArrayOf", "(", "Connection", "conn", ",", "String", "typeName", ",", "Object", "[", "]", "elements", ")", "throws", "MjdbcSQLException", "{", "Object", "result", "=", "null", ";", "try", "{", "result", "=", "MappingUtils", ".", "invokeFunction", "(", "conn", ",", "\"createArrayOf\"", ",", "new", "Class", "[", "]", "{", "String", ".", "class", ",", "Object", "[", "]", ".", "class", "}", ",", "new", "Object", "[", "]", "{", "typeName", ",", "elements", "}", ")", ";", "}", "catch", "(", "MjdbcException", "ex", ")", "{", "throw", "new", "MjdbcSQLException", "(", "\"createArrayOf is not supported by JDBC Driver\"", ",", "ex", ")", ";", "}", "return", "result", ";", "}" ]
Creates new {@link java.sql.Array} instance. Can be invoked only for JDBC4 driver @param conn SQL connection @param typeName array type name @param elements array of elements @return new {@link java.sql.Array} instance @throws org.midao.jdbc.core.exception.MjdbcSQLException
[ "Creates", "new", "{", "@link", "java", ".", "sql", ".", "Array", "}", "instance", ".", "Can", "be", "invoked", "only", "for", "JDBC4", "driver" ]
train
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java#L671-L681
apache/flink
flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/plan/util/KeySelectorUtil.java
KeySelectorUtil.getBaseRowSelector
public static BaseRowKeySelector getBaseRowSelector(int[] keyFields, BaseRowTypeInfo rowType) { """ Create a BaseRowKeySelector to extract keys from DataStream which type is BaseRowTypeInfo. @param keyFields key fields @param rowType type of DataStream to extract keys @return the BaseRowKeySelector to extract keys from DataStream which type is BaseRowTypeInfo. """ if (keyFields.length > 0) { InternalType[] inputFieldTypes = rowType.getInternalTypes(); String[] inputFieldNames = rowType.getFieldNames(); InternalType[] keyFieldTypes = new InternalType[keyFields.length]; String[] keyFieldNames = new String[keyFields.length]; for (int i = 0; i < keyFields.length; ++i) { keyFieldTypes[i] = inputFieldTypes[keyFields[i]]; keyFieldNames[i] = inputFieldNames[keyFields[i]]; } RowType returnType = new RowType(keyFieldTypes, keyFieldNames); RowType inputType = new RowType(inputFieldTypes, rowType.getFieldNames()); GeneratedProjection generatedProjection = ProjectionCodeGenerator.generateProjection( CodeGeneratorContext.apply(new TableConfig()), "KeyProjection", inputType, returnType, keyFields); BaseRowTypeInfo keyRowType = returnType.toTypeInfo(); // check if type implements proper equals/hashCode TypeCheckUtils.validateEqualsHashCode("grouping", keyRowType); return new BinaryRowKeySelector(keyRowType, generatedProjection); } else { return NullBinaryRowKeySelector.INSTANCE; } }
java
public static BaseRowKeySelector getBaseRowSelector(int[] keyFields, BaseRowTypeInfo rowType) { if (keyFields.length > 0) { InternalType[] inputFieldTypes = rowType.getInternalTypes(); String[] inputFieldNames = rowType.getFieldNames(); InternalType[] keyFieldTypes = new InternalType[keyFields.length]; String[] keyFieldNames = new String[keyFields.length]; for (int i = 0; i < keyFields.length; ++i) { keyFieldTypes[i] = inputFieldTypes[keyFields[i]]; keyFieldNames[i] = inputFieldNames[keyFields[i]]; } RowType returnType = new RowType(keyFieldTypes, keyFieldNames); RowType inputType = new RowType(inputFieldTypes, rowType.getFieldNames()); GeneratedProjection generatedProjection = ProjectionCodeGenerator.generateProjection( CodeGeneratorContext.apply(new TableConfig()), "KeyProjection", inputType, returnType, keyFields); BaseRowTypeInfo keyRowType = returnType.toTypeInfo(); // check if type implements proper equals/hashCode TypeCheckUtils.validateEqualsHashCode("grouping", keyRowType); return new BinaryRowKeySelector(keyRowType, generatedProjection); } else { return NullBinaryRowKeySelector.INSTANCE; } }
[ "public", "static", "BaseRowKeySelector", "getBaseRowSelector", "(", "int", "[", "]", "keyFields", ",", "BaseRowTypeInfo", "rowType", ")", "{", "if", "(", "keyFields", ".", "length", ">", "0", ")", "{", "InternalType", "[", "]", "inputFieldTypes", "=", "rowType", ".", "getInternalTypes", "(", ")", ";", "String", "[", "]", "inputFieldNames", "=", "rowType", ".", "getFieldNames", "(", ")", ";", "InternalType", "[", "]", "keyFieldTypes", "=", "new", "InternalType", "[", "keyFields", ".", "length", "]", ";", "String", "[", "]", "keyFieldNames", "=", "new", "String", "[", "keyFields", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "keyFields", ".", "length", ";", "++", "i", ")", "{", "keyFieldTypes", "[", "i", "]", "=", "inputFieldTypes", "[", "keyFields", "[", "i", "]", "]", ";", "keyFieldNames", "[", "i", "]", "=", "inputFieldNames", "[", "keyFields", "[", "i", "]", "]", ";", "}", "RowType", "returnType", "=", "new", "RowType", "(", "keyFieldTypes", ",", "keyFieldNames", ")", ";", "RowType", "inputType", "=", "new", "RowType", "(", "inputFieldTypes", ",", "rowType", ".", "getFieldNames", "(", ")", ")", ";", "GeneratedProjection", "generatedProjection", "=", "ProjectionCodeGenerator", ".", "generateProjection", "(", "CodeGeneratorContext", ".", "apply", "(", "new", "TableConfig", "(", ")", ")", ",", "\"KeyProjection\"", ",", "inputType", ",", "returnType", ",", "keyFields", ")", ";", "BaseRowTypeInfo", "keyRowType", "=", "returnType", ".", "toTypeInfo", "(", ")", ";", "// check if type implements proper equals/hashCode", "TypeCheckUtils", ".", "validateEqualsHashCode", "(", "\"grouping\"", ",", "keyRowType", ")", ";", "return", "new", "BinaryRowKeySelector", "(", "keyRowType", ",", "generatedProjection", ")", ";", "}", "else", "{", "return", "NullBinaryRowKeySelector", ".", "INSTANCE", ";", "}", "}" ]
Create a BaseRowKeySelector to extract keys from DataStream which type is BaseRowTypeInfo. @param keyFields key fields @param rowType type of DataStream to extract keys @return the BaseRowKeySelector to extract keys from DataStream which type is BaseRowTypeInfo.
[ "Create", "a", "BaseRowKeySelector", "to", "extract", "keys", "from", "DataStream", "which", "type", "is", "BaseRowTypeInfo", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/plan/util/KeySelectorUtil.java#L45-L69
lightblue-platform/lightblue-esb-hook
publish-hook/src/main/java/com/redhat/lightblue/hook/publish/EventExctractionUtil.java
EventExctractionUtil.compareAndExtractEvents
public static Set<Event> compareAndExtractEvents(String pre, String post, String ids) throws JSONException, IllegalArgumentException { """ /* Accepts JSONObject / JSONArray and returns the Events for the required permutations. NOTE: this doesn't check if the objects are actually different, call this only if an event is to be created for sure, just to find out what events are to be created. """ Object preObject = null, postObject = null, idsObject = null; if (pre != null) { preObject = JSONParser.parseJSON(pre); } if (post != null && ids != null) { postObject = JSONParser.parseJSON(post); idsObject = JSONParser.parseJSON(ids); } else { throw new IllegalArgumentException("post state and projected ids cannot be null:: " + getErrorSignature(pre, post, ids)); } if (!(preObject == null || preObject.getClass().equals(postObject.getClass())) || !postObject.getClass().equals(idsObject.getClass())) { throw new IllegalArgumentException("pre state (optional), post state and projected ids need to be valid JSON of the same type:: " + getErrorSignature(pre, post, ids)); } // JSONParser only returns JSONArray/ JSONObject/ JSONString if (!postObject.getClass().equals(JSONArray.class) && !postObject.getClass().equals(JSONObject.class)) { throw new IllegalArgumentException("Identities can only extracted from JSONArrays or JSONObjects:: " + getErrorSignature(pre, post, ids)); } return compareAndGetEvents(preObject, postObject, idsObject); }
java
public static Set<Event> compareAndExtractEvents(String pre, String post, String ids) throws JSONException, IllegalArgumentException { Object preObject = null, postObject = null, idsObject = null; if (pre != null) { preObject = JSONParser.parseJSON(pre); } if (post != null && ids != null) { postObject = JSONParser.parseJSON(post); idsObject = JSONParser.parseJSON(ids); } else { throw new IllegalArgumentException("post state and projected ids cannot be null:: " + getErrorSignature(pre, post, ids)); } if (!(preObject == null || preObject.getClass().equals(postObject.getClass())) || !postObject.getClass().equals(idsObject.getClass())) { throw new IllegalArgumentException("pre state (optional), post state and projected ids need to be valid JSON of the same type:: " + getErrorSignature(pre, post, ids)); } // JSONParser only returns JSONArray/ JSONObject/ JSONString if (!postObject.getClass().equals(JSONArray.class) && !postObject.getClass().equals(JSONObject.class)) { throw new IllegalArgumentException("Identities can only extracted from JSONArrays or JSONObjects:: " + getErrorSignature(pre, post, ids)); } return compareAndGetEvents(preObject, postObject, idsObject); }
[ "public", "static", "Set", "<", "Event", ">", "compareAndExtractEvents", "(", "String", "pre", ",", "String", "post", ",", "String", "ids", ")", "throws", "JSONException", ",", "IllegalArgumentException", "{", "Object", "preObject", "=", "null", ",", "postObject", "=", "null", ",", "idsObject", "=", "null", ";", "if", "(", "pre", "!=", "null", ")", "{", "preObject", "=", "JSONParser", ".", "parseJSON", "(", "pre", ")", ";", "}", "if", "(", "post", "!=", "null", "&&", "ids", "!=", "null", ")", "{", "postObject", "=", "JSONParser", ".", "parseJSON", "(", "post", ")", ";", "idsObject", "=", "JSONParser", ".", "parseJSON", "(", "ids", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "\"post state and projected ids cannot be null:: \"", "+", "getErrorSignature", "(", "pre", ",", "post", ",", "ids", ")", ")", ";", "}", "if", "(", "!", "(", "preObject", "==", "null", "||", "preObject", ".", "getClass", "(", ")", ".", "equals", "(", "postObject", ".", "getClass", "(", ")", ")", ")", "||", "!", "postObject", ".", "getClass", "(", ")", ".", "equals", "(", "idsObject", ".", "getClass", "(", ")", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"pre state (optional), post state and projected ids need to be valid JSON of the same type:: \"", "+", "getErrorSignature", "(", "pre", ",", "post", ",", "ids", ")", ")", ";", "}", "// JSONParser only returns JSONArray/ JSONObject/ JSONString", "if", "(", "!", "postObject", ".", "getClass", "(", ")", ".", "equals", "(", "JSONArray", ".", "class", ")", "&&", "!", "postObject", ".", "getClass", "(", ")", ".", "equals", "(", "JSONObject", ".", "class", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Identities can only extracted from JSONArrays or JSONObjects:: \"", "+", "getErrorSignature", "(", "pre", ",", "post", ",", "ids", ")", ")", ";", "}", "return", "compareAndGetEvents", "(", "preObject", ",", "postObject", ",", "idsObject", ")", ";", "}" ]
/* Accepts JSONObject / JSONArray and returns the Events for the required permutations. NOTE: this doesn't check if the objects are actually different, call this only if an event is to be created for sure, just to find out what events are to be created.
[ "/", "*", "Accepts", "JSONObject", "/", "JSONArray", "and", "returns", "the", "Events", "for", "the", "required", "permutations", "." ]
train
https://github.com/lightblue-platform/lightblue-esb-hook/blob/71afc88b595a629291a1a46da1a745348ddee428/publish-hook/src/main/java/com/redhat/lightblue/hook/publish/EventExctractionUtil.java#L28-L50
JOML-CI/JOML
src/org/joml/Matrix4x3f.java
Matrix4x3f.orthoSymmetric
public Matrix4x3f orthoSymmetric(float width, float height, float zNear, float zFar, boolean zZeroToOne) { """ Apply a symmetric orthographic projection transformation for a right-handed coordinate system using the given NDC z range to this matrix. <p> This method is equivalent to calling {@link #ortho(float, float, float, float, float, float, boolean) ortho()} with <code>left=-width/2</code>, <code>right=+width/2</code>, <code>bottom=-height/2</code> and <code>top=+height/2</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>O</code> the orthographic projection matrix, then the new matrix will be <code>M * O</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * O * v</code>, the orthographic projection transformation will be applied first! <p> In order to set the matrix to a symmetric orthographic projection without post-multiplying it, use {@link #setOrthoSymmetric(float, float, float, float, boolean) setOrthoSymmetric()}. <p> Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a> @see #setOrthoSymmetric(float, float, float, float, boolean) @param width the distance between the right and left frustum edges @param height the distance between the top and bottom frustum edges @param zNear near clipping plane distance @param zFar far clipping plane distance @param zZeroToOne whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code> or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code> @return this """ return orthoSymmetric(width, height, zNear, zFar, zZeroToOne, this); }
java
public Matrix4x3f orthoSymmetric(float width, float height, float zNear, float zFar, boolean zZeroToOne) { return orthoSymmetric(width, height, zNear, zFar, zZeroToOne, this); }
[ "public", "Matrix4x3f", "orthoSymmetric", "(", "float", "width", ",", "float", "height", ",", "float", "zNear", ",", "float", "zFar", ",", "boolean", "zZeroToOne", ")", "{", "return", "orthoSymmetric", "(", "width", ",", "height", ",", "zNear", ",", "zFar", ",", "zZeroToOne", ",", "this", ")", ";", "}" ]
Apply a symmetric orthographic projection transformation for a right-handed coordinate system using the given NDC z range to this matrix. <p> This method is equivalent to calling {@link #ortho(float, float, float, float, float, float, boolean) ortho()} with <code>left=-width/2</code>, <code>right=+width/2</code>, <code>bottom=-height/2</code> and <code>top=+height/2</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>O</code> the orthographic projection matrix, then the new matrix will be <code>M * O</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * O * v</code>, the orthographic projection transformation will be applied first! <p> In order to set the matrix to a symmetric orthographic projection without post-multiplying it, use {@link #setOrthoSymmetric(float, float, float, float, boolean) setOrthoSymmetric()}. <p> Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a> @see #setOrthoSymmetric(float, float, float, float, boolean) @param width the distance between the right and left frustum edges @param height the distance between the top and bottom frustum edges @param zNear near clipping plane distance @param zFar far clipping plane distance @param zZeroToOne whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code> or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code> @return this
[ "Apply", "a", "symmetric", "orthographic", "projection", "transformation", "for", "a", "right", "-", "handed", "coordinate", "system", "using", "the", "given", "NDC", "z", "range", "to", "this", "matrix", ".", "<p", ">", "This", "method", "is", "equivalent", "to", "calling", "{", "@link", "#ortho", "(", "float", "float", "float", "float", "float", "float", "boolean", ")", "ortho", "()", "}", "with", "<code", ">", "left", "=", "-", "width", "/", "2<", "/", "code", ">", "<code", ">", "right", "=", "+", "width", "/", "2<", "/", "code", ">", "<code", ">", "bottom", "=", "-", "height", "/", "2<", "/", "code", ">", "and", "<code", ">", "top", "=", "+", "height", "/", "2<", "/", "code", ">", ".", "<p", ">", "If", "<code", ">", "M<", "/", "code", ">", "is", "<code", ">", "this<", "/", "code", ">", "matrix", "and", "<code", ">", "O<", "/", "code", ">", "the", "orthographic", "projection", "matrix", "then", "the", "new", "matrix", "will", "be", "<code", ">", "M", "*", "O<", "/", "code", ">", ".", "So", "when", "transforming", "a", "vector", "<code", ">", "v<", "/", "code", ">", "with", "the", "new", "matrix", "by", "using", "<code", ">", "M", "*", "O", "*", "v<", "/", "code", ">", "the", "orthographic", "projection", "transformation", "will", "be", "applied", "first!", "<p", ">", "In", "order", "to", "set", "the", "matrix", "to", "a", "symmetric", "orthographic", "projection", "without", "post", "-", "multiplying", "it", "use", "{", "@link", "#setOrthoSymmetric", "(", "float", "float", "float", "float", "boolean", ")", "setOrthoSymmetric", "()", "}", ".", "<p", ">", "Reference", ":", "<a", "href", "=", "http", ":", "//", "www", ".", "songho", ".", "ca", "/", "opengl", "/", "gl_projectionmatrix", ".", "html#ortho", ">", "http", ":", "//", "www", ".", "songho", ".", "ca<", "/", "a", ">" ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3f.java#L5323-L5325
OwlPlatform/java-owl-worldmodel
src/main/java/com/owlplatform/worldmodel/client/ClientWorldConnection.java
ClientWorldConnection.getSnapshot
public synchronized Response getSnapshot(final String idRegex, final long start, final long end, String... attributes) { """ Sends a snapshot request to the world model for the specified Identifier regular expression and Attribute regular expressions, between the start and end timestamps. @param idRegex regular expression for matching the identifier. @param start the begin time for the snapshot. @param end the ending time for the snapshot. @param attributes the attribute regular expressions to request @return a {@code Response} for the request. """ SnapshotRequestMessage req = new SnapshotRequestMessage(); req.setIdRegex(idRegex); req.setBeginTimestamp(start); req.setEndTimestamp(end); if (attributes != null) { req.setAttributeRegexes(attributes); } Response resp = new Response(this, 0); try { while (!this.isReady) { log.debug("Trying to wait until connection is ready."); synchronized (this) { try { this.wait(); } catch (InterruptedException ie) { // Ignored } } } long reqId = this.wmi.sendMessage(req); resp.setTicketNumber(reqId); this.outstandingSnapshots.put(Long.valueOf(reqId), resp); WorldState ws = new WorldState(); this.outstandingStates.put(Long.valueOf(reqId), ws); log.info("Binding Tix #{} to {}", Long.valueOf(reqId), resp); return resp; } catch (Exception e) { log.error("Unable to send " + req + ".", e); resp.setError(e); return resp; } }
java
public synchronized Response getSnapshot(final String idRegex, final long start, final long end, String... attributes) { SnapshotRequestMessage req = new SnapshotRequestMessage(); req.setIdRegex(idRegex); req.setBeginTimestamp(start); req.setEndTimestamp(end); if (attributes != null) { req.setAttributeRegexes(attributes); } Response resp = new Response(this, 0); try { while (!this.isReady) { log.debug("Trying to wait until connection is ready."); synchronized (this) { try { this.wait(); } catch (InterruptedException ie) { // Ignored } } } long reqId = this.wmi.sendMessage(req); resp.setTicketNumber(reqId); this.outstandingSnapshots.put(Long.valueOf(reqId), resp); WorldState ws = new WorldState(); this.outstandingStates.put(Long.valueOf(reqId), ws); log.info("Binding Tix #{} to {}", Long.valueOf(reqId), resp); return resp; } catch (Exception e) { log.error("Unable to send " + req + ".", e); resp.setError(e); return resp; } }
[ "public", "synchronized", "Response", "getSnapshot", "(", "final", "String", "idRegex", ",", "final", "long", "start", ",", "final", "long", "end", ",", "String", "...", "attributes", ")", "{", "SnapshotRequestMessage", "req", "=", "new", "SnapshotRequestMessage", "(", ")", ";", "req", ".", "setIdRegex", "(", "idRegex", ")", ";", "req", ".", "setBeginTimestamp", "(", "start", ")", ";", "req", ".", "setEndTimestamp", "(", "end", ")", ";", "if", "(", "attributes", "!=", "null", ")", "{", "req", ".", "setAttributeRegexes", "(", "attributes", ")", ";", "}", "Response", "resp", "=", "new", "Response", "(", "this", ",", "0", ")", ";", "try", "{", "while", "(", "!", "this", ".", "isReady", ")", "{", "log", ".", "debug", "(", "\"Trying to wait until connection is ready.\"", ")", ";", "synchronized", "(", "this", ")", "{", "try", "{", "this", ".", "wait", "(", ")", ";", "}", "catch", "(", "InterruptedException", "ie", ")", "{", "// Ignored", "}", "}", "}", "long", "reqId", "=", "this", ".", "wmi", ".", "sendMessage", "(", "req", ")", ";", "resp", ".", "setTicketNumber", "(", "reqId", ")", ";", "this", ".", "outstandingSnapshots", ".", "put", "(", "Long", ".", "valueOf", "(", "reqId", ")", ",", "resp", ")", ";", "WorldState", "ws", "=", "new", "WorldState", "(", ")", ";", "this", ".", "outstandingStates", ".", "put", "(", "Long", ".", "valueOf", "(", "reqId", ")", ",", "ws", ")", ";", "log", ".", "info", "(", "\"Binding Tix #{} to {}\"", ",", "Long", ".", "valueOf", "(", "reqId", ")", ",", "resp", ")", ";", "return", "resp", ";", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "error", "(", "\"Unable to send \"", "+", "req", "+", "\".\"", ",", "e", ")", ";", "resp", ".", "setError", "(", "e", ")", ";", "return", "resp", ";", "}", "}" ]
Sends a snapshot request to the world model for the specified Identifier regular expression and Attribute regular expressions, between the start and end timestamps. @param idRegex regular expression for matching the identifier. @param start the begin time for the snapshot. @param end the ending time for the snapshot. @param attributes the attribute regular expressions to request @return a {@code Response} for the request.
[ "Sends", "a", "snapshot", "request", "to", "the", "world", "model", "for", "the", "specified", "Identifier", "regular", "expression", "and", "Attribute", "regular", "expressions", "between", "the", "start", "and", "end", "timestamps", "." ]
train
https://github.com/OwlPlatform/java-owl-worldmodel/blob/a850e8b930c6e9787c7cad30c0de887858ca563d/src/main/java/com/owlplatform/worldmodel/client/ClientWorldConnection.java#L282-L316
GwtMaterialDesign/gwt-material
gwt-material/src/main/java/gwt/material/design/client/ui/MaterialListValueBox.java
MaterialListValueBox.insertItem
public void insertItem(T value, Direction dir, int index, boolean reload) { """ Inserts an item into the list box, specifying its direction. Has the same effect as <pre>insertItem(value, dir, item, index)</pre> @param value the item's value, to be submitted if it is part of a {@link FormPanel}. @param dir the item's direction @param index the index at which to insert it @param reload perform a 'material select' reload to update the DOM. """ index += getIndexOffset(); insertItemInternal(value, dir, index, reload); }
java
public void insertItem(T value, Direction dir, int index, boolean reload) { index += getIndexOffset(); insertItemInternal(value, dir, index, reload); }
[ "public", "void", "insertItem", "(", "T", "value", ",", "Direction", "dir", ",", "int", "index", ",", "boolean", "reload", ")", "{", "index", "+=", "getIndexOffset", "(", ")", ";", "insertItemInternal", "(", "value", ",", "dir", ",", "index", ",", "reload", ")", ";", "}" ]
Inserts an item into the list box, specifying its direction. Has the same effect as <pre>insertItem(value, dir, item, index)</pre> @param value the item's value, to be submitted if it is part of a {@link FormPanel}. @param dir the item's direction @param index the index at which to insert it @param reload perform a 'material select' reload to update the DOM.
[ "Inserts", "an", "item", "into", "the", "list", "box", "specifying", "its", "direction", ".", "Has", "the", "same", "effect", "as", "<pre", ">", "insertItem", "(", "value", "dir", "item", "index", ")", "<", "/", "pre", ">" ]
train
https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialListValueBox.java#L359-L362
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java
ApiOvhDedicatedserver.serviceName_serviceMonitoring_monitoringId_alert_email_alertId_GET
public OvhEmailAlert serviceName_serviceMonitoring_monitoringId_alert_email_alertId_GET(String serviceName, Long monitoringId, Long alertId) throws IOException { """ Get this object properties REST: GET /dedicated/server/{serviceName}/serviceMonitoring/{monitoringId}/alert/email/{alertId} @param serviceName [required] The internal name of your dedicated server @param monitoringId [required] This monitoring id @param alertId [required] This monitoring id """ String qPath = "/dedicated/server/{serviceName}/serviceMonitoring/{monitoringId}/alert/email/{alertId}"; StringBuilder sb = path(qPath, serviceName, monitoringId, alertId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhEmailAlert.class); }
java
public OvhEmailAlert serviceName_serviceMonitoring_monitoringId_alert_email_alertId_GET(String serviceName, Long monitoringId, Long alertId) throws IOException { String qPath = "/dedicated/server/{serviceName}/serviceMonitoring/{monitoringId}/alert/email/{alertId}"; StringBuilder sb = path(qPath, serviceName, monitoringId, alertId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhEmailAlert.class); }
[ "public", "OvhEmailAlert", "serviceName_serviceMonitoring_monitoringId_alert_email_alertId_GET", "(", "String", "serviceName", ",", "Long", "monitoringId", ",", "Long", "alertId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/server/{serviceName}/serviceMonitoring/{monitoringId}/alert/email/{alertId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "monitoringId", ",", "alertId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhEmailAlert", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /dedicated/server/{serviceName}/serviceMonitoring/{monitoringId}/alert/email/{alertId} @param serviceName [required] The internal name of your dedicated server @param monitoringId [required] This monitoring id @param alertId [required] This monitoring id
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L2192-L2197
nostra13/Android-Universal-Image-Loader
library/src/main/java/com/nostra13/universalimageloader/core/download/BaseImageDownloader.java
BaseImageDownloader.createConnection
protected HttpURLConnection createConnection(String url, Object extra) throws IOException { """ Create {@linkplain HttpURLConnection HTTP connection} for incoming URL @param url URL to connect to @param extra Auxiliary object which was passed to {@link DisplayImageOptions.Builder#extraForDownloader(Object) DisplayImageOptions.extraForDownloader(Object)}; can be null @return {@linkplain HttpURLConnection Connection} for incoming URL. Connection isn't established so it still configurable. @throws IOException if some I/O error occurs during network request or if no InputStream could be created for URL. """ String encodedUrl = Uri.encode(url, ALLOWED_URI_CHARS); HttpURLConnection conn = (HttpURLConnection) new URL(encodedUrl).openConnection(); conn.setConnectTimeout(connectTimeout); conn.setReadTimeout(readTimeout); return conn; }
java
protected HttpURLConnection createConnection(String url, Object extra) throws IOException { String encodedUrl = Uri.encode(url, ALLOWED_URI_CHARS); HttpURLConnection conn = (HttpURLConnection) new URL(encodedUrl).openConnection(); conn.setConnectTimeout(connectTimeout); conn.setReadTimeout(readTimeout); return conn; }
[ "protected", "HttpURLConnection", "createConnection", "(", "String", "url", ",", "Object", "extra", ")", "throws", "IOException", "{", "String", "encodedUrl", "=", "Uri", ".", "encode", "(", "url", ",", "ALLOWED_URI_CHARS", ")", ";", "HttpURLConnection", "conn", "=", "(", "HttpURLConnection", ")", "new", "URL", "(", "encodedUrl", ")", ".", "openConnection", "(", ")", ";", "conn", ".", "setConnectTimeout", "(", "connectTimeout", ")", ";", "conn", ".", "setReadTimeout", "(", "readTimeout", ")", ";", "return", "conn", ";", "}" ]
Create {@linkplain HttpURLConnection HTTP connection} for incoming URL @param url URL to connect to @param extra Auxiliary object which was passed to {@link DisplayImageOptions.Builder#extraForDownloader(Object) DisplayImageOptions.extraForDownloader(Object)}; can be null @return {@linkplain HttpURLConnection Connection} for incoming URL. Connection isn't established so it still configurable. @throws IOException if some I/O error occurs during network request or if no InputStream could be created for URL.
[ "Create", "{", "@linkplain", "HttpURLConnection", "HTTP", "connection", "}", "for", "incoming", "URL" ]
train
https://github.com/nostra13/Android-Universal-Image-Loader/blob/fc3c5f6779bb4f702e233653b61bd9d559e345cc/library/src/main/java/com/nostra13/universalimageloader/core/download/BaseImageDownloader.java#L158-L164
couchbase/couchbase-lite-java
src/main/java/com/couchbase/lite/MutableArray.java
MutableArray.insertBlob
@NonNull @Override public MutableArray insertBlob(int index, Blob value) { """ Inserts a Blob object at the given index. @param index the index. This value must not exceed the bounds of the array. @param value the Blob object @return The self object """ return insertValue(index, value); }
java
@NonNull @Override public MutableArray insertBlob(int index, Blob value) { return insertValue(index, value); }
[ "@", "NonNull", "@", "Override", "public", "MutableArray", "insertBlob", "(", "int", "index", ",", "Blob", "value", ")", "{", "return", "insertValue", "(", "index", ",", "value", ")", ";", "}" ]
Inserts a Blob object at the given index. @param index the index. This value must not exceed the bounds of the array. @param value the Blob object @return The self object
[ "Inserts", "a", "Blob", "object", "at", "the", "given", "index", "." ]
train
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/MutableArray.java#L514-L518
molgenis/molgenis
molgenis-data-index/src/main/java/org/molgenis/data/index/IndexDependencyModel.java
IndexDependencyModel.hasAttributeThatReferences
private boolean hasAttributeThatReferences(EntityType candidate, String entityTypeId) { """ Determines if an entityType has an attribute that references another entity @param candidate the EntityType that is examined @param entityTypeId the ID of the entity that may be referenced @return indication if candidate references entityTypeID """ Iterable<Attribute> attributes = candidate.getOwnAtomicAttributes(); return stream(attributes) .filter(Attribute::hasRefEntity) .map(attribute -> attribute.getRefEntity().getId()) .anyMatch(entityTypeId::equals); }
java
private boolean hasAttributeThatReferences(EntityType candidate, String entityTypeId) { Iterable<Attribute> attributes = candidate.getOwnAtomicAttributes(); return stream(attributes) .filter(Attribute::hasRefEntity) .map(attribute -> attribute.getRefEntity().getId()) .anyMatch(entityTypeId::equals); }
[ "private", "boolean", "hasAttributeThatReferences", "(", "EntityType", "candidate", ",", "String", "entityTypeId", ")", "{", "Iterable", "<", "Attribute", ">", "attributes", "=", "candidate", ".", "getOwnAtomicAttributes", "(", ")", ";", "return", "stream", "(", "attributes", ")", ".", "filter", "(", "Attribute", "::", "hasRefEntity", ")", ".", "map", "(", "attribute", "->", "attribute", ".", "getRefEntity", "(", ")", ".", "getId", "(", ")", ")", ".", "anyMatch", "(", "entityTypeId", "::", "equals", ")", ";", "}" ]
Determines if an entityType has an attribute that references another entity @param candidate the EntityType that is examined @param entityTypeId the ID of the entity that may be referenced @return indication if candidate references entityTypeID
[ "Determines", "if", "an", "entityType", "has", "an", "attribute", "that", "references", "another", "entity" ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-index/src/main/java/org/molgenis/data/index/IndexDependencyModel.java#L97-L103
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java
MultiUserChat.kickParticipant
public void kickParticipant(Resourcepart nickname, String reason) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException { """ Kicks a visitor or participant from the room. The kicked occupant will receive a presence of type "unavailable" including a status code 307 and optionally along with the reason (if provided) and the bare JID of the user who initiated the kick. After the occupant was kicked from the room, the rest of the occupants will receive a presence of type "unavailable". The presence will include a status code 307 which means that the occupant was kicked from the room. @param nickname the nickname of the participant or visitor to kick from the room (e.g. "john"). @param reason the reason why the participant or visitor is being kicked from the room. @throws XMPPErrorException if an error occurs kicking the occupant. In particular, a 405 error can occur if a moderator or a user with an affiliation of "owner" or "admin" was intended to be kicked (i.e. Not Allowed error); or a 403 error can occur if the occupant that intended to kick another occupant does not have kicking privileges (i.e. Forbidden error); or a 400 error can occur if the provided nickname is not present in the room. @throws NoResponseException if there was no response from the server. @throws NotConnectedException @throws InterruptedException """ changeRole(nickname, MUCRole.none, reason); }
java
public void kickParticipant(Resourcepart nickname, String reason) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException { changeRole(nickname, MUCRole.none, reason); }
[ "public", "void", "kickParticipant", "(", "Resourcepart", "nickname", ",", "String", "reason", ")", "throws", "XMPPErrorException", ",", "NoResponseException", ",", "NotConnectedException", ",", "InterruptedException", "{", "changeRole", "(", "nickname", ",", "MUCRole", ".", "none", ",", "reason", ")", ";", "}" ]
Kicks a visitor or participant from the room. The kicked occupant will receive a presence of type "unavailable" including a status code 307 and optionally along with the reason (if provided) and the bare JID of the user who initiated the kick. After the occupant was kicked from the room, the rest of the occupants will receive a presence of type "unavailable". The presence will include a status code 307 which means that the occupant was kicked from the room. @param nickname the nickname of the participant or visitor to kick from the room (e.g. "john"). @param reason the reason why the participant or visitor is being kicked from the room. @throws XMPPErrorException if an error occurs kicking the occupant. In particular, a 405 error can occur if a moderator or a user with an affiliation of "owner" or "admin" was intended to be kicked (i.e. Not Allowed error); or a 403 error can occur if the occupant that intended to kick another occupant does not have kicking privileges (i.e. Forbidden error); or a 400 error can occur if the provided nickname is not present in the room. @throws NoResponseException if there was no response from the server. @throws NotConnectedException @throws InterruptedException
[ "Kicks", "a", "visitor", "or", "participant", "from", "the", "room", ".", "The", "kicked", "occupant", "will", "receive", "a", "presence", "of", "type", "unavailable", "including", "a", "status", "code", "307", "and", "optionally", "along", "with", "the", "reason", "(", "if", "provided", ")", "and", "the", "bare", "JID", "of", "the", "user", "who", "initiated", "the", "kick", ".", "After", "the", "occupant", "was", "kicked", "from", "the", "room", "the", "rest", "of", "the", "occupants", "will", "receive", "a", "presence", "of", "type", "unavailable", ".", "The", "presence", "will", "include", "a", "status", "code", "307", "which", "means", "that", "the", "occupant", "was", "kicked", "from", "the", "room", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java#L1200-L1202
jenkinsci/java-client-api
jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java
JenkinsServer.enableJob
public JenkinsServer enableJob(String jobName, boolean crumbFlag) throws IOException { """ Enable a job from Jenkins. @param jobName The name of the job to be deleted. @param crumbFlag <code>true</code> to add <b>crumbIssuer</b> <code>false</code> otherwise. @throws IOException In case of an failure. """ client.post("/job/" + EncodingUtils.encode(jobName) + "/enable", crumbFlag); return this; }
java
public JenkinsServer enableJob(String jobName, boolean crumbFlag) throws IOException { client.post("/job/" + EncodingUtils.encode(jobName) + "/enable", crumbFlag); return this; }
[ "public", "JenkinsServer", "enableJob", "(", "String", "jobName", ",", "boolean", "crumbFlag", ")", "throws", "IOException", "{", "client", ".", "post", "(", "\"/job/\"", "+", "EncodingUtils", ".", "encode", "(", "jobName", ")", "+", "\"/enable\"", ",", "crumbFlag", ")", ";", "return", "this", ";", "}" ]
Enable a job from Jenkins. @param jobName The name of the job to be deleted. @param crumbFlag <code>true</code> to add <b>crumbIssuer</b> <code>false</code> otherwise. @throws IOException In case of an failure.
[ "Enable", "a", "job", "from", "Jenkins", "." ]
train
https://github.com/jenkinsci/java-client-api/blob/c4f5953d3d4dda92cd946ad3bf2b811524c32da9/jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java#L773-L776
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/plugins/JarPluginProviderLoader.java
JarPluginProviderLoader.createProviderForClass
static <T,X extends T> T createProviderForClass(final PluggableService<T> service, final Class<X> cls) throws PluginException, ProviderCreationException { """ Attempt to create an instance of thea provider for the given service @param cls class @return created instance """ debug("Try loading provider " + cls.getName()); if(!(service instanceof JavaClassProviderLoadable)){ return null; } JavaClassProviderLoadable<T> loadable = (JavaClassProviderLoadable<T>) service; final Plugin annotation = getPluginMetadata(cls); final String pluginname = annotation.name(); if (!loadable.isValidProviderClass(cls)) { throw new PluginException("Class " + cls.getName() + " was not a valid plugin class for service: " + service.getName() + ". Expected class " + cls.getName() + ", with a public constructor with no parameter"); } debug("Succeeded loading plugin " + cls.getName() + " for service: " + service.getName()); return loadable.createProviderInstance(cls, pluginname); }
java
static <T,X extends T> T createProviderForClass(final PluggableService<T> service, final Class<X> cls) throws PluginException, ProviderCreationException { debug("Try loading provider " + cls.getName()); if(!(service instanceof JavaClassProviderLoadable)){ return null; } JavaClassProviderLoadable<T> loadable = (JavaClassProviderLoadable<T>) service; final Plugin annotation = getPluginMetadata(cls); final String pluginname = annotation.name(); if (!loadable.isValidProviderClass(cls)) { throw new PluginException("Class " + cls.getName() + " was not a valid plugin class for service: " + service.getName() + ". Expected class " + cls.getName() + ", with a public constructor with no parameter"); } debug("Succeeded loading plugin " + cls.getName() + " for service: " + service.getName()); return loadable.createProviderInstance(cls, pluginname); }
[ "static", "<", "T", ",", "X", "extends", "T", ">", "T", "createProviderForClass", "(", "final", "PluggableService", "<", "T", ">", "service", ",", "final", "Class", "<", "X", ">", "cls", ")", "throws", "PluginException", ",", "ProviderCreationException", "{", "debug", "(", "\"Try loading provider \"", "+", "cls", ".", "getName", "(", ")", ")", ";", "if", "(", "!", "(", "service", "instanceof", "JavaClassProviderLoadable", ")", ")", "{", "return", "null", ";", "}", "JavaClassProviderLoadable", "<", "T", ">", "loadable", "=", "(", "JavaClassProviderLoadable", "<", "T", ">", ")", "service", ";", "final", "Plugin", "annotation", "=", "getPluginMetadata", "(", "cls", ")", ";", "final", "String", "pluginname", "=", "annotation", ".", "name", "(", ")", ";", "if", "(", "!", "loadable", ".", "isValidProviderClass", "(", "cls", ")", ")", "{", "throw", "new", "PluginException", "(", "\"Class \"", "+", "cls", ".", "getName", "(", ")", "+", "\" was not a valid plugin class for service: \"", "+", "service", ".", "getName", "(", ")", "+", "\". Expected class \"", "+", "cls", ".", "getName", "(", ")", "+", "\", with a public constructor with no parameter\"", ")", ";", "}", "debug", "(", "\"Succeeded loading plugin \"", "+", "cls", ".", "getName", "(", ")", "+", "\" for service: \"", "+", "service", ".", "getName", "(", ")", ")", ";", "return", "loadable", ".", "createProviderInstance", "(", "cls", ",", "pluginname", ")", ";", "}" ]
Attempt to create an instance of thea provider for the given service @param cls class @return created instance
[ "Attempt", "to", "create", "an", "instance", "of", "thea", "provider", "for", "the", "given", "service" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/plugins/JarPluginProviderLoader.java#L308-L325
tzaeschke/zoodb
src/org/zoodb/internal/GenericObject.java
GenericObject.newEmptyInstance
static GenericObject newEmptyInstance(ZooClassDef def, AbstractCache cache) { """ Creates new instances. @param def @return A new empty generic object. """ long oid = def.getProvidedContext().getNode().getOidBuffer().allocateOid(); return newEmptyInstance(oid, def, cache); }
java
static GenericObject newEmptyInstance(ZooClassDef def, AbstractCache cache) { long oid = def.getProvidedContext().getNode().getOidBuffer().allocateOid(); return newEmptyInstance(oid, def, cache); }
[ "static", "GenericObject", "newEmptyInstance", "(", "ZooClassDef", "def", ",", "AbstractCache", "cache", ")", "{", "long", "oid", "=", "def", ".", "getProvidedContext", "(", ")", ".", "getNode", "(", ")", ".", "getOidBuffer", "(", ")", ".", "allocateOid", "(", ")", ";", "return", "newEmptyInstance", "(", "oid", ",", "def", ",", "cache", ")", ";", "}" ]
Creates new instances. @param def @return A new empty generic object.
[ "Creates", "new", "instances", "." ]
train
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/GenericObject.java#L135-L138
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLLiteralImplNoCompression_CustomFieldSerializer.java
OWLLiteralImplNoCompression_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLLiteralImplNoCompression instance) throws SerializationException { """ Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful """ serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLLiteralImplNoCompression instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLLiteralImplNoCompression", "instance", ")", "throws", "SerializationException", "{", "serialize", "(", "streamWriter", ",", "instance", ")", ";", "}" ]
Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful
[ "Serializes", "the", "content", "of", "the", "object", "into", "the", "{" ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLLiteralImplNoCompression_CustomFieldSerializer.java#L68-L71
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/DateField.java
DateField.setCalendar
public int setCalendar(Calendar value, boolean bDisplayOption, int moveMode) { """ SetValue in current calendar. @param value The date (as a calendar value) to set (only date portion is used). @param bDisplayOption Display changed fields if true. @param iMoveMode The move mode. @return The error code (or NORMAL_RETURN). """ // Set this field's value if (value != null) { value.set(Calendar.HOUR_OF_DAY, 0); value.set(Calendar.MINUTE, 0); value.set(Calendar.SECOND, 0); value.set(Calendar.MILLISECOND, 0); } return super.setCalendar(value, bDisplayOption, moveMode); }
java
public int setCalendar(Calendar value, boolean bDisplayOption, int moveMode) { // Set this field's value if (value != null) { value.set(Calendar.HOUR_OF_DAY, 0); value.set(Calendar.MINUTE, 0); value.set(Calendar.SECOND, 0); value.set(Calendar.MILLISECOND, 0); } return super.setCalendar(value, bDisplayOption, moveMode); }
[ "public", "int", "setCalendar", "(", "Calendar", "value", ",", "boolean", "bDisplayOption", ",", "int", "moveMode", ")", "{", "// Set this field's value", "if", "(", "value", "!=", "null", ")", "{", "value", ".", "set", "(", "Calendar", ".", "HOUR_OF_DAY", ",", "0", ")", ";", "value", ".", "set", "(", "Calendar", ".", "MINUTE", ",", "0", ")", ";", "value", ".", "set", "(", "Calendar", ".", "SECOND", ",", "0", ")", ";", "value", ".", "set", "(", "Calendar", ".", "MILLISECOND", ",", "0", ")", ";", "}", "return", "super", ".", "setCalendar", "(", "value", ",", "bDisplayOption", ",", "moveMode", ")", ";", "}" ]
SetValue in current calendar. @param value The date (as a calendar value) to set (only date portion is used). @param bDisplayOption Display changed fields if true. @param iMoveMode The move mode. @return The error code (or NORMAL_RETURN).
[ "SetValue", "in", "current", "calendar", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/DateField.java#L156-L166
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/topic/TopicManagerImpl.java
TopicManagerImpl.isInconsistenceContext
boolean isInconsistenceContext(String topic, Session session) { """ Return if argument is inconsistent for context : topic and session null or empty @param topic @param session @return """ return null == topic || null == session || topic.isEmpty(); }
java
boolean isInconsistenceContext(String topic, Session session) { return null == topic || null == session || topic.isEmpty(); }
[ "boolean", "isInconsistenceContext", "(", "String", "topic", ",", "Session", "session", ")", "{", "return", "null", "==", "topic", "||", "null", "==", "session", "||", "topic", ".", "isEmpty", "(", ")", ";", "}" ]
Return if argument is inconsistent for context : topic and session null or empty @param topic @param session @return
[ "Return", "if", "argument", "is", "inconsistent", "for", "context", ":", "topic", "and", "session", "null", "or", "empty" ]
train
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/TopicManagerImpl.java#L119-L121
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java
BoundedLocalCache.expireAfterCreate
long expireAfterCreate(@Nullable K key, @Nullable V value, Expiry<K, V> expiry, long now) { """ Returns the expiration time for the entry after being created. @param key the key of the entry that was created @param value the value of the entry that was created @param expiry the calculator for the expiration time @param now the current time, in nanoseconds @return the expiration time """ if (expiresVariable() && (key != null) && (value != null)) { long duration = expiry.expireAfterCreate(key, value, now); return isAsync ? (now + duration) : (now + Math.min(duration, MAXIMUM_EXPIRY)); } return 0L; }
java
long expireAfterCreate(@Nullable K key, @Nullable V value, Expiry<K, V> expiry, long now) { if (expiresVariable() && (key != null) && (value != null)) { long duration = expiry.expireAfterCreate(key, value, now); return isAsync ? (now + duration) : (now + Math.min(duration, MAXIMUM_EXPIRY)); } return 0L; }
[ "long", "expireAfterCreate", "(", "@", "Nullable", "K", "key", ",", "@", "Nullable", "V", "value", ",", "Expiry", "<", "K", ",", "V", ">", "expiry", ",", "long", "now", ")", "{", "if", "(", "expiresVariable", "(", ")", "&&", "(", "key", "!=", "null", ")", "&&", "(", "value", "!=", "null", ")", ")", "{", "long", "duration", "=", "expiry", ".", "expireAfterCreate", "(", "key", ",", "value", ",", "now", ")", ";", "return", "isAsync", "?", "(", "now", "+", "duration", ")", ":", "(", "now", "+", "Math", ".", "min", "(", "duration", ",", "MAXIMUM_EXPIRY", ")", ")", ";", "}", "return", "0L", ";", "}" ]
Returns the expiration time for the entry after being created. @param key the key of the entry that was created @param value the value of the entry that was created @param expiry the calculator for the expiration time @param now the current time, in nanoseconds @return the expiration time
[ "Returns", "the", "expiration", "time", "for", "the", "entry", "after", "being", "created", "." ]
train
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java#L1210-L1216
salesforce/Argus
ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/DashboardService.java
DashboardService.updateDashboard
public Dashboard updateDashboard(BigInteger dashboardId, Dashboard dashboard) throws IOException, TokenExpiredException { """ Creates a new dashboard. @param dashboardId The ID of the dashboard to update. @param dashboard The dashboard to create. @return The persisted dashboard. @throws IOException If the server cannot be reached. @throws TokenExpiredException If the token sent along with the request has expired """ String requestUrl = RESOURCE + "/" + dashboardId.toString(); ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.PUT, requestUrl, dashboard); assertValidResponse(response, requestUrl); return fromJson(response.getResult(), Dashboard.class); }
java
public Dashboard updateDashboard(BigInteger dashboardId, Dashboard dashboard) throws IOException, TokenExpiredException { String requestUrl = RESOURCE + "/" + dashboardId.toString(); ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.PUT, requestUrl, dashboard); assertValidResponse(response, requestUrl); return fromJson(response.getResult(), Dashboard.class); }
[ "public", "Dashboard", "updateDashboard", "(", "BigInteger", "dashboardId", ",", "Dashboard", "dashboard", ")", "throws", "IOException", ",", "TokenExpiredException", "{", "String", "requestUrl", "=", "RESOURCE", "+", "\"/\"", "+", "dashboardId", ".", "toString", "(", ")", ";", "ArgusResponse", "response", "=", "getClient", "(", ")", ".", "executeHttpRequest", "(", "ArgusHttpClient", ".", "RequestType", ".", "PUT", ",", "requestUrl", ",", "dashboard", ")", ";", "assertValidResponse", "(", "response", ",", "requestUrl", ")", ";", "return", "fromJson", "(", "response", ".", "getResult", "(", ")", ",", "Dashboard", ".", "class", ")", ";", "}" ]
Creates a new dashboard. @param dashboardId The ID of the dashboard to update. @param dashboard The dashboard to create. @return The persisted dashboard. @throws IOException If the server cannot be reached. @throws TokenExpiredException If the token sent along with the request has expired
[ "Creates", "a", "new", "dashboard", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/DashboardService.java#L96-L102
Harium/keel
src/main/java/com/harium/keel/catalano/math/distance/Distance.java
Distance.QuasiEuclidean
public static double QuasiEuclidean(double x1, double y1, double x2, double y2) { """ Gets the Quasi-Euclidean distance between two points. @param x1 X1 axis coordinates. @param y1 Y1 axis coordinates. @param x2 X2 axis coordinates. @param y2 Y2 axis coordinates. @return The Quasi-Euclidean distance between x and y. """ if (Math.abs(x1 - x2) > Math.abs(y1 - y2)) { return Math.abs(x1 - x2) + (Constants.Sqrt2 - 1) * Math.abs(y1 - y2); } return (Constants.Sqrt2 - 1) * Math.abs(x1 - x2) + Math.abs(y1 - y2); }
java
public static double QuasiEuclidean(double x1, double y1, double x2, double y2) { if (Math.abs(x1 - x2) > Math.abs(y1 - y2)) { return Math.abs(x1 - x2) + (Constants.Sqrt2 - 1) * Math.abs(y1 - y2); } return (Constants.Sqrt2 - 1) * Math.abs(x1 - x2) + Math.abs(y1 - y2); }
[ "public", "static", "double", "QuasiEuclidean", "(", "double", "x1", ",", "double", "y1", ",", "double", "x2", ",", "double", "y2", ")", "{", "if", "(", "Math", ".", "abs", "(", "x1", "-", "x2", ")", ">", "Math", ".", "abs", "(", "y1", "-", "y2", ")", ")", "{", "return", "Math", ".", "abs", "(", "x1", "-", "x2", ")", "+", "(", "Constants", ".", "Sqrt2", "-", "1", ")", "*", "Math", ".", "abs", "(", "y1", "-", "y2", ")", ";", "}", "return", "(", "Constants", ".", "Sqrt2", "-", "1", ")", "*", "Math", ".", "abs", "(", "x1", "-", "x2", ")", "+", "Math", ".", "abs", "(", "y1", "-", "y2", ")", ";", "}" ]
Gets the Quasi-Euclidean distance between two points. @param x1 X1 axis coordinates. @param y1 Y1 axis coordinates. @param x2 X2 axis coordinates. @param y2 Y2 axis coordinates. @return The Quasi-Euclidean distance between x and y.
[ "Gets", "the", "Quasi", "-", "Euclidean", "distance", "between", "two", "points", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/distance/Distance.java#L774-L781
Stratio/bdt
src/main/java/com/stratio/qa/specs/DatabaseSpec.java
DatabaseSpec.assertValuesOfTableMongo
@Then("^a Mongo dataBase '(.+?)' contains a table '(.+?)' with values:") public void assertValuesOfTableMongo(String dataBase, String tableName, DataTable data) { """ Checks the values of a MongoDB table. @param dataBase @param tableName @param data """ commonspec.getMongoDBClient().connectToMongoDBDataBase(dataBase); ArrayList<DBObject> result = (ArrayList<DBObject>) commonspec.getMongoDBClient().readFromMongoDBCollection( tableName, data); DBObjectsAssert.assertThat(result).containedInMongoDBResult(data); }
java
@Then("^a Mongo dataBase '(.+?)' contains a table '(.+?)' with values:") public void assertValuesOfTableMongo(String dataBase, String tableName, DataTable data) { commonspec.getMongoDBClient().connectToMongoDBDataBase(dataBase); ArrayList<DBObject> result = (ArrayList<DBObject>) commonspec.getMongoDBClient().readFromMongoDBCollection( tableName, data); DBObjectsAssert.assertThat(result).containedInMongoDBResult(data); }
[ "@", "Then", "(", "\"^a Mongo dataBase '(.+?)' contains a table '(.+?)' with values:\"", ")", "public", "void", "assertValuesOfTableMongo", "(", "String", "dataBase", ",", "String", "tableName", ",", "DataTable", "data", ")", "{", "commonspec", ".", "getMongoDBClient", "(", ")", ".", "connectToMongoDBDataBase", "(", "dataBase", ")", ";", "ArrayList", "<", "DBObject", ">", "result", "=", "(", "ArrayList", "<", "DBObject", ">", ")", "commonspec", ".", "getMongoDBClient", "(", ")", ".", "readFromMongoDBCollection", "(", "tableName", ",", "data", ")", ";", "DBObjectsAssert", ".", "assertThat", "(", "result", ")", ".", "containedInMongoDBResult", "(", "data", ")", ";", "}" ]
Checks the values of a MongoDB table. @param dataBase @param tableName @param data
[ "Checks", "the", "values", "of", "a", "MongoDB", "table", "." ]
train
https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/DatabaseSpec.java#L786-L793
ologolo/streamline-api
src/org/daisy/streamline/api/tasks/ReadWriteTask.java
ReadWriteTask.execute
public ModifiableFileSet execute(FileSet input, BaseFolder output) throws InternalTaskException { """ <p>Apply the task to <code>input</code> and place the result in <code>output</code>.</p> <p>Note: Resources in the input file set that are not modified, but should be included in the output file set, should preferably keep their locations in the input file set for performance reasons. This may not always be possible, depending on the processing requirements in the implementation of this method.</p> @param input input file set @param output output location @return the output file set @throws InternalTaskException throws InternalTaskException if something goes wrong. """ try { AnnotatedFile f = execute(input.getManifest(), Files.createTempFile(output.getPath(), "file", ".tmp").toFile()); return DefaultFileSet.with(output, f).build(); } catch (IOException e) { throw new InternalTaskException(e); } }
java
public ModifiableFileSet execute(FileSet input, BaseFolder output) throws InternalTaskException { try { AnnotatedFile f = execute(input.getManifest(), Files.createTempFile(output.getPath(), "file", ".tmp").toFile()); return DefaultFileSet.with(output, f).build(); } catch (IOException e) { throw new InternalTaskException(e); } }
[ "public", "ModifiableFileSet", "execute", "(", "FileSet", "input", ",", "BaseFolder", "output", ")", "throws", "InternalTaskException", "{", "try", "{", "AnnotatedFile", "f", "=", "execute", "(", "input", ".", "getManifest", "(", ")", ",", "Files", ".", "createTempFile", "(", "output", ".", "getPath", "(", ")", ",", "\"file\"", ",", "\".tmp\"", ")", ".", "toFile", "(", ")", ")", ";", "return", "DefaultFileSet", ".", "with", "(", "output", ",", "f", ")", ".", "build", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "InternalTaskException", "(", "e", ")", ";", "}", "}" ]
<p>Apply the task to <code>input</code> and place the result in <code>output</code>.</p> <p>Note: Resources in the input file set that are not modified, but should be included in the output file set, should preferably keep their locations in the input file set for performance reasons. This may not always be possible, depending on the processing requirements in the implementation of this method.</p> @param input input file set @param output output location @return the output file set @throws InternalTaskException throws InternalTaskException if something goes wrong.
[ "<p", ">", "Apply", "the", "task", "to", "<code", ">", "input<", "/", "code", ">", "and", "place", "the", "result", "in", "<code", ">", "output<", "/", "code", ">", ".", "<", "/", "p", ">", "<p", ">", "Note", ":", "Resources", "in", "the", "input", "file", "set", "that", "are", "not", "modified", "but", "should", "be", "included", "in", "the", "output", "file", "set", "should", "preferably", "keep", "their", "locations", "in", "the", "input", "file", "set", "for", "performance", "reasons", ".", "This", "may", "not", "always", "be", "possible", "depending", "on", "the", "processing", "requirements", "in", "the", "implementation", "of", "this", "method", ".", "<", "/", "p", ">" ]
train
https://github.com/ologolo/streamline-api/blob/4934b6da1de06e364ae90d6ea9b0929500da9cdb/src/org/daisy/streamline/api/tasks/ReadWriteTask.java#L60-L67
FasterXML/jackson-jr
jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/JSONObjectException.java
JSONObjectException.prependPath
public void prependPath(Object referrer, int index) { """ Method called to prepend a reference information in front of current path """ Reference ref = new Reference(referrer, index); prependPath(ref); }
java
public void prependPath(Object referrer, int index) { Reference ref = new Reference(referrer, index); prependPath(ref); }
[ "public", "void", "prependPath", "(", "Object", "referrer", ",", "int", "index", ")", "{", "Reference", "ref", "=", "new", "Reference", "(", "referrer", ",", "index", ")", ";", "prependPath", "(", "ref", ")", ";", "}" ]
Method called to prepend a reference information in front of current path
[ "Method", "called", "to", "prepend", "a", "reference", "information", "in", "front", "of", "current", "path" ]
train
https://github.com/FasterXML/jackson-jr/blob/62ca7a82bd90a9be77028e0b62364307d7532837/jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/JSONObjectException.java#L288-L292
lucee/Lucee
core/src/main/java/lucee/runtime/interpreter/CFMLExpressionInterpreter.java
CFMLExpressionInterpreter.startElement
private Ref startElement(String name) throws PageException { """ Extrahiert den Start Element einer Variale, dies ist entweder eine Funktion, eine Scope Definition oder eine undefinierte Variable. <br /> EBNF:<br /> <code>identifier "(" functionArg ")" | scope | identifier;</code> @param name Einstiegsname @return CFXD Element @throws PageException """ // check function if (!limited && cfml.isCurrent('(')) { FunctionLibFunction function = fld.getFunction(name); Ref[] arguments = functionArg(name, true, function, ')'); if (function != null) return new BIFCall(function, arguments); Ref ref = new lucee.runtime.interpreter.ref.var.Scope(Scope.SCOPE_UNDEFINED); return new UDFCall(ref, name, arguments); } // check scope return scope(name); }
java
private Ref startElement(String name) throws PageException { // check function if (!limited && cfml.isCurrent('(')) { FunctionLibFunction function = fld.getFunction(name); Ref[] arguments = functionArg(name, true, function, ')'); if (function != null) return new BIFCall(function, arguments); Ref ref = new lucee.runtime.interpreter.ref.var.Scope(Scope.SCOPE_UNDEFINED); return new UDFCall(ref, name, arguments); } // check scope return scope(name); }
[ "private", "Ref", "startElement", "(", "String", "name", ")", "throws", "PageException", "{", "// check function", "if", "(", "!", "limited", "&&", "cfml", ".", "isCurrent", "(", "'", "'", ")", ")", "{", "FunctionLibFunction", "function", "=", "fld", ".", "getFunction", "(", "name", ")", ";", "Ref", "[", "]", "arguments", "=", "functionArg", "(", "name", ",", "true", ",", "function", ",", "'", "'", ")", ";", "if", "(", "function", "!=", "null", ")", "return", "new", "BIFCall", "(", "function", ",", "arguments", ")", ";", "Ref", "ref", "=", "new", "lucee", ".", "runtime", ".", "interpreter", ".", "ref", ".", "var", ".", "Scope", "(", "Scope", ".", "SCOPE_UNDEFINED", ")", ";", "return", "new", "UDFCall", "(", "ref", ",", "name", ",", "arguments", ")", ";", "}", "// check scope", "return", "scope", "(", "name", ")", ";", "}" ]
Extrahiert den Start Element einer Variale, dies ist entweder eine Funktion, eine Scope Definition oder eine undefinierte Variable. <br /> EBNF:<br /> <code>identifier "(" functionArg ")" | scope | identifier;</code> @param name Einstiegsname @return CFXD Element @throws PageException
[ "Extrahiert", "den", "Start", "Element", "einer", "Variale", "dies", "ist", "entweder", "eine", "Funktion", "eine", "Scope", "Definition", "oder", "eine", "undefinierte", "Variable", ".", "<br", "/", ">", "EBNF", ":", "<br", "/", ">", "<code", ">", "identifier", "(", "functionArg", ")", "|", "scope", "|", "identifier", ";", "<", "/", "code", ">" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/interpreter/CFMLExpressionInterpreter.java#L1277-L1290
alkacon/opencms-core
src/org/opencms/i18n/CmsLocaleGroupService.java
CmsLocaleGroupService.attachLocaleGroupIndirect
public void attachLocaleGroupIndirect(CmsResource first, CmsResource second) throws CmsException { """ Smarter method to connect a resource to a locale group.<p> Exactly one of the resources given as an argument must represent a locale group, while the other should be the locale that you wish to attach to the locale group.<p> @param first a resource @param second a resource @throws CmsException if something goes wrong """ CmsResource firstResourceCorrected = getDefaultFileOrSelf(first); CmsResource secondResourceCorrected = getDefaultFileOrSelf(second); if ((firstResourceCorrected == null) || (secondResourceCorrected == null)) { throw new IllegalArgumentException("no default file"); } CmsLocaleGroup group1 = readLocaleGroup(firstResourceCorrected); CmsLocaleGroup group2 = readLocaleGroup(secondResourceCorrected); int numberOfRealGroups = (group1.isRealGroupOrPotentialGroupHead() ? 1 : 0) + (group2.isRealGroupOrPotentialGroupHead() ? 1 : 0); if (numberOfRealGroups != 1) { throw new IllegalArgumentException("more than one real groups"); } CmsResource main = null; CmsResource secondary = null; if (group1.isRealGroupOrPotentialGroupHead()) { main = group1.getPrimaryResource(); secondary = group2.getPrimaryResource(); } else if (group2.isRealGroupOrPotentialGroupHead()) { main = group2.getPrimaryResource(); secondary = group1.getPrimaryResource(); } attachLocaleGroup(secondary, main); }
java
public void attachLocaleGroupIndirect(CmsResource first, CmsResource second) throws CmsException { CmsResource firstResourceCorrected = getDefaultFileOrSelf(first); CmsResource secondResourceCorrected = getDefaultFileOrSelf(second); if ((firstResourceCorrected == null) || (secondResourceCorrected == null)) { throw new IllegalArgumentException("no default file"); } CmsLocaleGroup group1 = readLocaleGroup(firstResourceCorrected); CmsLocaleGroup group2 = readLocaleGroup(secondResourceCorrected); int numberOfRealGroups = (group1.isRealGroupOrPotentialGroupHead() ? 1 : 0) + (group2.isRealGroupOrPotentialGroupHead() ? 1 : 0); if (numberOfRealGroups != 1) { throw new IllegalArgumentException("more than one real groups"); } CmsResource main = null; CmsResource secondary = null; if (group1.isRealGroupOrPotentialGroupHead()) { main = group1.getPrimaryResource(); secondary = group2.getPrimaryResource(); } else if (group2.isRealGroupOrPotentialGroupHead()) { main = group2.getPrimaryResource(); secondary = group1.getPrimaryResource(); } attachLocaleGroup(secondary, main); }
[ "public", "void", "attachLocaleGroupIndirect", "(", "CmsResource", "first", ",", "CmsResource", "second", ")", "throws", "CmsException", "{", "CmsResource", "firstResourceCorrected", "=", "getDefaultFileOrSelf", "(", "first", ")", ";", "CmsResource", "secondResourceCorrected", "=", "getDefaultFileOrSelf", "(", "second", ")", ";", "if", "(", "(", "firstResourceCorrected", "==", "null", ")", "||", "(", "secondResourceCorrected", "==", "null", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"no default file\"", ")", ";", "}", "CmsLocaleGroup", "group1", "=", "readLocaleGroup", "(", "firstResourceCorrected", ")", ";", "CmsLocaleGroup", "group2", "=", "readLocaleGroup", "(", "secondResourceCorrected", ")", ";", "int", "numberOfRealGroups", "=", "(", "group1", ".", "isRealGroupOrPotentialGroupHead", "(", ")", "?", "1", ":", "0", ")", "+", "(", "group2", ".", "isRealGroupOrPotentialGroupHead", "(", ")", "?", "1", ":", "0", ")", ";", "if", "(", "numberOfRealGroups", "!=", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"more than one real groups\"", ")", ";", "}", "CmsResource", "main", "=", "null", ";", "CmsResource", "secondary", "=", "null", ";", "if", "(", "group1", ".", "isRealGroupOrPotentialGroupHead", "(", ")", ")", "{", "main", "=", "group1", ".", "getPrimaryResource", "(", ")", ";", "secondary", "=", "group2", ".", "getPrimaryResource", "(", ")", ";", "}", "else", "if", "(", "group2", ".", "isRealGroupOrPotentialGroupHead", "(", ")", ")", "{", "main", "=", "group2", ".", "getPrimaryResource", "(", ")", ";", "secondary", "=", "group1", ".", "getPrimaryResource", "(", ")", ";", "}", "attachLocaleGroup", "(", "secondary", ",", "main", ")", ";", "}" ]
Smarter method to connect a resource to a locale group.<p> Exactly one of the resources given as an argument must represent a locale group, while the other should be the locale that you wish to attach to the locale group.<p> @param first a resource @param second a resource @throws CmsException if something goes wrong
[ "Smarter", "method", "to", "connect", "a", "resource", "to", "a", "locale", "group", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/CmsLocaleGroupService.java#L218-L243
Netflix/eureka
eureka-core/src/main/java/com/netflix/eureka/registry/AbstractInstanceRegistry.java
AbstractInstanceRegistry.getInstanceByAppAndId
@Override public InstanceInfo getInstanceByAppAndId(String appName, String id, boolean includeRemoteRegions) { """ Gets the {@link InstanceInfo} information. @param appName the application name for which the information is requested. @param id the unique identifier of the instance. @param includeRemoteRegions true, if we need to include applications from remote regions as indicated by the region {@link URL} by this property {@link EurekaServerConfig#getRemoteRegionUrls()}, false otherwise @return the information about the instance. """ Map<String, Lease<InstanceInfo>> leaseMap = registry.get(appName); Lease<InstanceInfo> lease = null; if (leaseMap != null) { lease = leaseMap.get(id); } if (lease != null && (!isLeaseExpirationEnabled() || !lease.isExpired())) { return decorateInstanceInfo(lease); } else if (includeRemoteRegions) { for (RemoteRegionRegistry remoteRegistry : this.regionNameVSRemoteRegistry.values()) { Application application = remoteRegistry.getApplication(appName); if (application != null) { return application.getByInstanceId(id); } } } return null; }
java
@Override public InstanceInfo getInstanceByAppAndId(String appName, String id, boolean includeRemoteRegions) { Map<String, Lease<InstanceInfo>> leaseMap = registry.get(appName); Lease<InstanceInfo> lease = null; if (leaseMap != null) { lease = leaseMap.get(id); } if (lease != null && (!isLeaseExpirationEnabled() || !lease.isExpired())) { return decorateInstanceInfo(lease); } else if (includeRemoteRegions) { for (RemoteRegionRegistry remoteRegistry : this.regionNameVSRemoteRegistry.values()) { Application application = remoteRegistry.getApplication(appName); if (application != null) { return application.getByInstanceId(id); } } } return null; }
[ "@", "Override", "public", "InstanceInfo", "getInstanceByAppAndId", "(", "String", "appName", ",", "String", "id", ",", "boolean", "includeRemoteRegions", ")", "{", "Map", "<", "String", ",", "Lease", "<", "InstanceInfo", ">", ">", "leaseMap", "=", "registry", ".", "get", "(", "appName", ")", ";", "Lease", "<", "InstanceInfo", ">", "lease", "=", "null", ";", "if", "(", "leaseMap", "!=", "null", ")", "{", "lease", "=", "leaseMap", ".", "get", "(", "id", ")", ";", "}", "if", "(", "lease", "!=", "null", "&&", "(", "!", "isLeaseExpirationEnabled", "(", ")", "||", "!", "lease", ".", "isExpired", "(", ")", ")", ")", "{", "return", "decorateInstanceInfo", "(", "lease", ")", ";", "}", "else", "if", "(", "includeRemoteRegions", ")", "{", "for", "(", "RemoteRegionRegistry", "remoteRegistry", ":", "this", ".", "regionNameVSRemoteRegistry", ".", "values", "(", ")", ")", "{", "Application", "application", "=", "remoteRegistry", ".", "getApplication", "(", "appName", ")", ";", "if", "(", "application", "!=", "null", ")", "{", "return", "application", ".", "getByInstanceId", "(", "id", ")", ";", "}", "}", "}", "return", "null", ";", "}" ]
Gets the {@link InstanceInfo} information. @param appName the application name for which the information is requested. @param id the unique identifier of the instance. @param includeRemoteRegions true, if we need to include applications from remote regions as indicated by the region {@link URL} by this property {@link EurekaServerConfig#getRemoteRegionUrls()}, false otherwise @return the information about the instance.
[ "Gets", "the", "{", "@link", "InstanceInfo", "}", "information", "." ]
train
https://github.com/Netflix/eureka/blob/48446d956be09df6650a3c00b7ebd7e2d1e1544f/eureka-core/src/main/java/com/netflix/eureka/registry/AbstractInstanceRegistry.java#L1022-L1041
SonarSource/sonarqube
server/sonar-server/src/main/java/org/sonar/server/platform/BackendCleanup.java
BackendCleanup.truncateInternalProperties
private static void truncateInternalProperties(String tableName, Statement ddlStatement, Connection connection) throws SQLException { """ Internal property {@link InternalProperties#DEFAULT_ORGANIZATION} must never be deleted. """ try (PreparedStatement preparedStatement = connection.prepareStatement("delete from internal_properties where kee not in (?,?)")) { preparedStatement.setString(1, InternalProperties.DEFAULT_ORGANIZATION); preparedStatement.setString(2, InternalProperties.SERVER_ID_CHECKSUM); preparedStatement.execute(); // commit is useless on some databases connection.commit(); } }
java
private static void truncateInternalProperties(String tableName, Statement ddlStatement, Connection connection) throws SQLException { try (PreparedStatement preparedStatement = connection.prepareStatement("delete from internal_properties where kee not in (?,?)")) { preparedStatement.setString(1, InternalProperties.DEFAULT_ORGANIZATION); preparedStatement.setString(2, InternalProperties.SERVER_ID_CHECKSUM); preparedStatement.execute(); // commit is useless on some databases connection.commit(); } }
[ "private", "static", "void", "truncateInternalProperties", "(", "String", "tableName", ",", "Statement", "ddlStatement", ",", "Connection", "connection", ")", "throws", "SQLException", "{", "try", "(", "PreparedStatement", "preparedStatement", "=", "connection", ".", "prepareStatement", "(", "\"delete from internal_properties where kee not in (?,?)\"", ")", ")", "{", "preparedStatement", ".", "setString", "(", "1", ",", "InternalProperties", ".", "DEFAULT_ORGANIZATION", ")", ";", "preparedStatement", ".", "setString", "(", "2", ",", "InternalProperties", ".", "SERVER_ID_CHECKSUM", ")", ";", "preparedStatement", ".", "execute", "(", ")", ";", "// commit is useless on some databases", "connection", ".", "commit", "(", ")", ";", "}", "}" ]
Internal property {@link InternalProperties#DEFAULT_ORGANIZATION} must never be deleted.
[ "Internal", "property", "{" ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/platform/BackendCleanup.java#L232-L240
iipc/webarchive-commons
src/main/java/org/archive/net/PublicSuffixes.java
PublicSuffixes.readPublishedFileToSurtTrie
protected static Node readPublishedFileToSurtTrie(BufferedReader reader) throws IOException { """ Reads a file of the format promulgated by publicsuffix.org, ignoring comments and '!' exceptions/notations, converting domain segments to SURT-ordering. Leaves glob-style '*' wildcarding in place. Returns root node of SURT-ordered prefix tree. @param reader @return root of prefix tree node. @throws IOException """ // initializing with empty Alt list prevents empty pattern from being // created for the first addBranch() Node alt = new Node(null, new ArrayList<Node>()); String line; while ((line = reader.readLine()) != null) { // discard whitespace, empty lines, comments, exceptions line = line.trim(); if (line.length() == 0 || line.startsWith("//")) continue; // discard utf8 notation after entry line = line.split("\\s+")[0]; // TODO: maybe we don't need to create lower-cased String line = line.toLowerCase(); // SURT-order domain segments String[] segs = line.split("\\."); StringBuilder sb = new StringBuilder(); for (int i = segs.length - 1; i >= 0; i--) { if (segs[i].length() == 0) continue; sb.append(segs[i]).append(','); } alt.addBranch(sb.toString()); } return alt; }
java
protected static Node readPublishedFileToSurtTrie(BufferedReader reader) throws IOException { // initializing with empty Alt list prevents empty pattern from being // created for the first addBranch() Node alt = new Node(null, new ArrayList<Node>()); String line; while ((line = reader.readLine()) != null) { // discard whitespace, empty lines, comments, exceptions line = line.trim(); if (line.length() == 0 || line.startsWith("//")) continue; // discard utf8 notation after entry line = line.split("\\s+")[0]; // TODO: maybe we don't need to create lower-cased String line = line.toLowerCase(); // SURT-order domain segments String[] segs = line.split("\\."); StringBuilder sb = new StringBuilder(); for (int i = segs.length - 1; i >= 0; i--) { if (segs[i].length() == 0) continue; sb.append(segs[i]).append(','); } alt.addBranch(sb.toString()); } return alt; }
[ "protected", "static", "Node", "readPublishedFileToSurtTrie", "(", "BufferedReader", "reader", ")", "throws", "IOException", "{", "// initializing with empty Alt list prevents empty pattern from being", "// created for the first addBranch()", "Node", "alt", "=", "new", "Node", "(", "null", ",", "new", "ArrayList", "<", "Node", ">", "(", ")", ")", ";", "String", "line", ";", "while", "(", "(", "line", "=", "reader", ".", "readLine", "(", ")", ")", "!=", "null", ")", "{", "// discard whitespace, empty lines, comments, exceptions", "line", "=", "line", ".", "trim", "(", ")", ";", "if", "(", "line", ".", "length", "(", ")", "==", "0", "||", "line", ".", "startsWith", "(", "\"//\"", ")", ")", "continue", ";", "// discard utf8 notation after entry", "line", "=", "line", ".", "split", "(", "\"\\\\s+\"", ")", "[", "0", "]", ";", "// TODO: maybe we don't need to create lower-cased String", "line", "=", "line", ".", "toLowerCase", "(", ")", ";", "// SURT-order domain segments", "String", "[", "]", "segs", "=", "line", ".", "split", "(", "\"\\\\.\"", ")", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "int", "i", "=", "segs", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "if", "(", "segs", "[", "i", "]", ".", "length", "(", ")", "==", "0", ")", "continue", ";", "sb", ".", "append", "(", "segs", "[", "i", "]", ")", ".", "append", "(", "'", "'", ")", ";", "}", "alt", ".", "addBranch", "(", "sb", ".", "toString", "(", ")", ")", ";", "}", "return", "alt", ";", "}" ]
Reads a file of the format promulgated by publicsuffix.org, ignoring comments and '!' exceptions/notations, converting domain segments to SURT-ordering. Leaves glob-style '*' wildcarding in place. Returns root node of SURT-ordered prefix tree. @param reader @return root of prefix tree node. @throws IOException
[ "Reads", "a", "file", "of", "the", "format", "promulgated", "by", "publicsuffix", ".", "org", "ignoring", "comments", "and", "!", "exceptions", "/", "notations", "converting", "domain", "segments", "to", "SURT", "-", "ordering", ".", "Leaves", "glob", "-", "style", "*", "wildcarding", "in", "place", ".", "Returns", "root", "node", "of", "SURT", "-", "ordered", "prefix", "tree", "." ]
train
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/net/PublicSuffixes.java#L210-L233
GCRC/nunaliit
nunaliit2-auth-common/src/main/java/ca/carleton/gcrc/auth/common/AuthenticationUtils.java
AuthenticationUtils.userToCookieString
static public String userToCookieString(boolean loggedIn, User user) throws Exception { """ Converts an instance of User to JSON object, fit for a cookie @param user Instance of User to convert @return JSON string containing the user state @throws Exception """ JSONObject cookieObj = new JSONObject(); cookieObj.put("logged", loggedIn); JSONObject userObj = user.toJSON(); cookieObj.put("user", userObj); StringWriter sw = new StringWriter(); cookieObj.write(sw); String cookieRaw = sw.toString(); String cookieStr = URLEncoder.encode(cookieRaw,"UTF-8"); cookieStr = cookieStr.replace("+", "%20"); return cookieStr; }
java
static public String userToCookieString(boolean loggedIn, User user) throws Exception { JSONObject cookieObj = new JSONObject(); cookieObj.put("logged", loggedIn); JSONObject userObj = user.toJSON(); cookieObj.put("user", userObj); StringWriter sw = new StringWriter(); cookieObj.write(sw); String cookieRaw = sw.toString(); String cookieStr = URLEncoder.encode(cookieRaw,"UTF-8"); cookieStr = cookieStr.replace("+", "%20"); return cookieStr; }
[ "static", "public", "String", "userToCookieString", "(", "boolean", "loggedIn", ",", "User", "user", ")", "throws", "Exception", "{", "JSONObject", "cookieObj", "=", "new", "JSONObject", "(", ")", ";", "cookieObj", ".", "put", "(", "\"logged\"", ",", "loggedIn", ")", ";", "JSONObject", "userObj", "=", "user", ".", "toJSON", "(", ")", ";", "cookieObj", ".", "put", "(", "\"user\"", ",", "userObj", ")", ";", "StringWriter", "sw", "=", "new", "StringWriter", "(", ")", ";", "cookieObj", ".", "write", "(", "sw", ")", ";", "String", "cookieRaw", "=", "sw", ".", "toString", "(", ")", ";", "String", "cookieStr", "=", "URLEncoder", ".", "encode", "(", "cookieRaw", ",", "\"UTF-8\"", ")", ";", "cookieStr", "=", "cookieStr", ".", "replace", "(", "\"+\"", ",", "\"%20\"", ")", ";", "return", "cookieStr", ";", "}" ]
Converts an instance of User to JSON object, fit for a cookie @param user Instance of User to convert @return JSON string containing the user state @throws Exception
[ "Converts", "an", "instance", "of", "User", "to", "JSON", "object", "fit", "for", "a", "cookie" ]
train
https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-auth-common/src/main/java/ca/carleton/gcrc/auth/common/AuthenticationUtils.java#L110-L126
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/HerokuAPI.java
HerokuAPI.removeAddon
public AddonChange removeAddon(String appName, String addonName) { """ Remove an addon from an app. @param appName App name. See {@link #listApps} for a list of apps that can be used. @param addonName Addon name. See {@link #listAppAddons} for a list of addons that can be used. @return the request object """ return connection.execute(new AddonRemove(appName, addonName), apiKey); }
java
public AddonChange removeAddon(String appName, String addonName) { return connection.execute(new AddonRemove(appName, addonName), apiKey); }
[ "public", "AddonChange", "removeAddon", "(", "String", "appName", ",", "String", "addonName", ")", "{", "return", "connection", ".", "execute", "(", "new", "AddonRemove", "(", "appName", ",", "addonName", ")", ",", "apiKey", ")", ";", "}" ]
Remove an addon from an app. @param appName App name. See {@link #listApps} for a list of apps that can be used. @param addonName Addon name. See {@link #listAppAddons} for a list of addons that can be used. @return the request object
[ "Remove", "an", "addon", "from", "an", "app", "." ]
train
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L252-L254
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/types/ExpressionUtils.java
ExpressionUtils.notIn
public static <D> Predicate notIn(Expression<D> left, SubQueryExpression<? extends D> right) { """ Create a {@code left not in right} expression @param <D> type of expressions @param left lhs of expression @param right rhs of expression @return left not in right """ return predicate(Ops.NOT_IN, left, right); }
java
public static <D> Predicate notIn(Expression<D> left, SubQueryExpression<? extends D> right) { return predicate(Ops.NOT_IN, left, right); }
[ "public", "static", "<", "D", ">", "Predicate", "notIn", "(", "Expression", "<", "D", ">", "left", ",", "SubQueryExpression", "<", "?", "extends", "D", ">", "right", ")", "{", "return", "predicate", "(", "Ops", ".", "NOT_IN", ",", "left", ",", "right", ")", ";", "}" ]
Create a {@code left not in right} expression @param <D> type of expressions @param left lhs of expression @param right rhs of expression @return left not in right
[ "Create", "a", "{", "@code", "left", "not", "in", "right", "}", "expression" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/ExpressionUtils.java#L743-L745
lessthanoptimal/BoofCV
examples/src/main/java/boofcv/examples/imageprocessing/ExamplePlanarImages.java
ExamplePlanarImages.independent
public static void independent( BufferedImage input ) { """ Many operations designed to only work on {@link ImageGray} can be applied to a Planar image by feeding in each band one at a time. """ // convert the BufferedImage into a Planar Planar<GrayU8> image = ConvertBufferedImage.convertFromPlanar(input,null,true,GrayU8.class); // declare the output blurred image Planar<GrayU8> blurred = image.createSameShape(); // Apply Gaussian blur to each band in the image for( int i = 0; i < image.getNumBands(); i++ ) { // note that the generalized version of BlurImageOps is not being used, but the type // specific version. BlurImageOps.gaussian(image.getBand(i),blurred.getBand(i),-1,5,null); } // Declare the BufferedImage manually to ensure that the color bands have the same ordering on input // and output BufferedImage output = new BufferedImage(image.width,image.height,input.getType()); ConvertBufferedImage.convertTo(blurred, output,true); gui.addImage(input,"Input"); gui.addImage(output,"Gaussian Blur"); }
java
public static void independent( BufferedImage input ) { // convert the BufferedImage into a Planar Planar<GrayU8> image = ConvertBufferedImage.convertFromPlanar(input,null,true,GrayU8.class); // declare the output blurred image Planar<GrayU8> blurred = image.createSameShape(); // Apply Gaussian blur to each band in the image for( int i = 0; i < image.getNumBands(); i++ ) { // note that the generalized version of BlurImageOps is not being used, but the type // specific version. BlurImageOps.gaussian(image.getBand(i),blurred.getBand(i),-1,5,null); } // Declare the BufferedImage manually to ensure that the color bands have the same ordering on input // and output BufferedImage output = new BufferedImage(image.width,image.height,input.getType()); ConvertBufferedImage.convertTo(blurred, output,true); gui.addImage(input,"Input"); gui.addImage(output,"Gaussian Blur"); }
[ "public", "static", "void", "independent", "(", "BufferedImage", "input", ")", "{", "// convert the BufferedImage into a Planar", "Planar", "<", "GrayU8", ">", "image", "=", "ConvertBufferedImage", ".", "convertFromPlanar", "(", "input", ",", "null", ",", "true", ",", "GrayU8", ".", "class", ")", ";", "// declare the output blurred image", "Planar", "<", "GrayU8", ">", "blurred", "=", "image", ".", "createSameShape", "(", ")", ";", "// Apply Gaussian blur to each band in the image", "for", "(", "int", "i", "=", "0", ";", "i", "<", "image", ".", "getNumBands", "(", ")", ";", "i", "++", ")", "{", "// note that the generalized version of BlurImageOps is not being used, but the type", "// specific version.", "BlurImageOps", ".", "gaussian", "(", "image", ".", "getBand", "(", "i", ")", ",", "blurred", ".", "getBand", "(", "i", ")", ",", "-", "1", ",", "5", ",", "null", ")", ";", "}", "// Declare the BufferedImage manually to ensure that the color bands have the same ordering on input", "// and output", "BufferedImage", "output", "=", "new", "BufferedImage", "(", "image", ".", "width", ",", "image", ".", "height", ",", "input", ".", "getType", "(", ")", ")", ";", "ConvertBufferedImage", ".", "convertTo", "(", "blurred", ",", "output", ",", "true", ")", ";", "gui", ".", "addImage", "(", "input", ",", "\"Input\"", ")", ";", "gui", ".", "addImage", "(", "output", ",", "\"Gaussian Blur\"", ")", ";", "}" ]
Many operations designed to only work on {@link ImageGray} can be applied to a Planar image by feeding in each band one at a time.
[ "Many", "operations", "designed", "to", "only", "work", "on", "{" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/imageprocessing/ExamplePlanarImages.java#L60-L81
sawano/java-commons
src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java
AbstractValidate.exclusiveBetween
public long exclusiveBetween(long start, long end, long value) { """ Validate that the specified primitive value falls between the two exclusive values specified; otherwise, throws an exception. <pre>Validate.exclusiveBetween(0, 2, 1);</pre> @param start the exclusive start value @param end the exclusive end value @param value the value to validate @return the value @throws IllegalArgumentValidationException if the value falls out of the boundaries """ if (value <= start || value >= end) { fail(String.format(DEFAULT_EXCLUSIVE_BETWEEN_EX_MESSAGE, value, start, end)); } return value; }
java
public long exclusiveBetween(long start, long end, long value) { if (value <= start || value >= end) { fail(String.format(DEFAULT_EXCLUSIVE_BETWEEN_EX_MESSAGE, value, start, end)); } return value; }
[ "public", "long", "exclusiveBetween", "(", "long", "start", ",", "long", "end", ",", "long", "value", ")", "{", "if", "(", "value", "<=", "start", "||", "value", ">=", "end", ")", "{", "fail", "(", "String", ".", "format", "(", "DEFAULT_EXCLUSIVE_BETWEEN_EX_MESSAGE", ",", "value", ",", "start", ",", "end", ")", ")", ";", "}", "return", "value", ";", "}" ]
Validate that the specified primitive value falls between the two exclusive values specified; otherwise, throws an exception. <pre>Validate.exclusiveBetween(0, 2, 1);</pre> @param start the exclusive start value @param end the exclusive end value @param value the value to validate @return the value @throws IllegalArgumentValidationException if the value falls out of the boundaries
[ "Validate", "that", "the", "specified", "primitive", "value", "falls", "between", "the", "two", "exclusive", "values", "specified", ";", "otherwise", "throws", "an", "exception", ".", "<pre", ">", "Validate", ".", "exclusiveBetween", "(", "0", "2", "1", ")", ";", "<", "/", "pre", ">" ]
train
https://github.com/sawano/java-commons/blob/6f219c9e8dec4401dbe528d17ae6ec1ef9c0d284/src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java#L1442-L1447
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2017_06_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2017_06_01_preview/implementation/ReplicationsInner.java
ReplicationsInner.beginCreate
public ReplicationInner beginCreate(String resourceGroupName, String registryName, String replicationName, ReplicationInner replication) { """ Creates a replication for a container registry with the specified parameters. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param replicationName The name of the replication. @param replication The parameters for creating a replication. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ReplicationInner object if successful. """ return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, replicationName, replication).toBlocking().single().body(); }
java
public ReplicationInner beginCreate(String resourceGroupName, String registryName, String replicationName, ReplicationInner replication) { return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, replicationName, replication).toBlocking().single().body(); }
[ "public", "ReplicationInner", "beginCreate", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "String", "replicationName", ",", "ReplicationInner", "replication", ")", "{", "return", "beginCreateWithServiceResponseAsync", "(", "resourceGroupName", ",", "registryName", ",", "replicationName", ",", "replication", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Creates a replication for a container registry with the specified parameters. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param replicationName The name of the replication. @param replication The parameters for creating a replication. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ReplicationInner object if successful.
[ "Creates", "a", "replication", "for", "a", "container", "registry", "with", "the", "specified", "parameters", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2017_06_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2017_06_01_preview/implementation/ReplicationsInner.java#L294-L296
micronaut-projects/micronaut-core
runtime/src/main/java/io/micronaut/jackson/JacksonConfiguration.java
JacksonConfiguration.setParser
public void setParser(Map<JsonParser.Feature, Boolean> parser) { """ Sets the parser features to use. @param parser The parser features """ if (CollectionUtils.isNotEmpty(parser)) { this.parser = parser; } }
java
public void setParser(Map<JsonParser.Feature, Boolean> parser) { if (CollectionUtils.isNotEmpty(parser)) { this.parser = parser; } }
[ "public", "void", "setParser", "(", "Map", "<", "JsonParser", ".", "Feature", ",", "Boolean", ">", "parser", ")", "{", "if", "(", "CollectionUtils", ".", "isNotEmpty", "(", "parser", ")", ")", "{", "this", ".", "parser", "=", "parser", ";", "}", "}" ]
Sets the parser features to use. @param parser The parser features
[ "Sets", "the", "parser", "features", "to", "use", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/runtime/src/main/java/io/micronaut/jackson/JacksonConfiguration.java#L265-L269
logic-ng/LogicNG
src/main/java/org/logicng/graphs/datastructures/Graph.java
Graph.disconnect
public void disconnect(Node<T> o, Node<T> t) { """ Removes the edge between two given nodes. (Does nothing if the nodes are not connected) @param o the first given node @param t the second given node """ if (!o.equals(t)) { o.disconnectFrom(t); t.disconnectFrom(o); } }
java
public void disconnect(Node<T> o, Node<T> t) { if (!o.equals(t)) { o.disconnectFrom(t); t.disconnectFrom(o); } }
[ "public", "void", "disconnect", "(", "Node", "<", "T", ">", "o", ",", "Node", "<", "T", ">", "t", ")", "{", "if", "(", "!", "o", ".", "equals", "(", "t", ")", ")", "{", "o", ".", "disconnectFrom", "(", "t", ")", ";", "t", ".", "disconnectFrom", "(", "o", ")", ";", "}", "}" ]
Removes the edge between two given nodes. (Does nothing if the nodes are not connected) @param o the first given node @param t the second given node
[ "Removes", "the", "edge", "between", "two", "given", "nodes", ".", "(", "Does", "nothing", "if", "the", "nodes", "are", "not", "connected", ")" ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/graphs/datastructures/Graph.java#L102-L107
walkmod/walkmod-core
src/main/java/org/walkmod/util/location/LocationAttributes.java
LocationAttributes.addLocationAttributes
public static Attributes addLocationAttributes(Locator locator, Attributes attrs) { """ Add location attributes to a set of SAX attributes. @param locator the <code>Locator</code> (can be null) @param attrs the <code>Attributes</code> where locator information should be added @return Location enabled Attributes. """ if (locator == null || attrs.getIndex(URI, SRC_ATTR) != -1) { return attrs; } AttributesImpl newAttrs = attrs instanceof AttributesImpl ? (AttributesImpl) attrs : new AttributesImpl(attrs); return newAttrs; }
java
public static Attributes addLocationAttributes(Locator locator, Attributes attrs) { if (locator == null || attrs.getIndex(URI, SRC_ATTR) != -1) { return attrs; } AttributesImpl newAttrs = attrs instanceof AttributesImpl ? (AttributesImpl) attrs : new AttributesImpl(attrs); return newAttrs; }
[ "public", "static", "Attributes", "addLocationAttributes", "(", "Locator", "locator", ",", "Attributes", "attrs", ")", "{", "if", "(", "locator", "==", "null", "||", "attrs", ".", "getIndex", "(", "URI", ",", "SRC_ATTR", ")", "!=", "-", "1", ")", "{", "return", "attrs", ";", "}", "AttributesImpl", "newAttrs", "=", "attrs", "instanceof", "AttributesImpl", "?", "(", "AttributesImpl", ")", "attrs", ":", "new", "AttributesImpl", "(", "attrs", ")", ";", "return", "newAttrs", ";", "}" ]
Add location attributes to a set of SAX attributes. @param locator the <code>Locator</code> (can be null) @param attrs the <code>Attributes</code> where locator information should be added @return Location enabled Attributes.
[ "Add", "location", "attributes", "to", "a", "set", "of", "SAX", "attributes", "." ]
train
https://github.com/walkmod/walkmod-core/blob/fa79b836894fa00ca4b3e2bd26326a44b778f46f/src/main/java/org/walkmod/util/location/LocationAttributes.java#L67-L74
sputnikdev/bluetooth-utils
src/main/java/org/sputnikdev/bluetooth/URL.java
URL.getDeviceURL
public URL getDeviceURL() { """ Returns a copy of a given URL truncated to its device component. Service, characteristic and field components will be null. @return a copy of a given URL truncated to the device component """ return new URL(this.protocol, this.adapterAddress, this.deviceAddress, this.deviceAttributes, null, null, null); }
java
public URL getDeviceURL() { return new URL(this.protocol, this.adapterAddress, this.deviceAddress, this.deviceAttributes, null, null, null); }
[ "public", "URL", "getDeviceURL", "(", ")", "{", "return", "new", "URL", "(", "this", ".", "protocol", ",", "this", ".", "adapterAddress", ",", "this", ".", "deviceAddress", ",", "this", ".", "deviceAttributes", ",", "null", ",", "null", ",", "null", ")", ";", "}" ]
Returns a copy of a given URL truncated to its device component. Service, characteristic and field components will be null. @return a copy of a given URL truncated to the device component
[ "Returns", "a", "copy", "of", "a", "given", "URL", "truncated", "to", "its", "device", "component", ".", "Service", "characteristic", "and", "field", "components", "will", "be", "null", "." ]
train
https://github.com/sputnikdev/bluetooth-utils/blob/794e4a8644c1eed54cd043de2bc967f4ef58acca/src/main/java/org/sputnikdev/bluetooth/URL.java#L341-L343
VoltDB/voltdb
src/frontend/org/voltdb/ProcedureRunner.java
ProcedureRunner.isProcedureStackTraceElement
public static boolean isProcedureStackTraceElement(String procedureName, StackTraceElement stel) { """ Test whether or not the given stack frame is within a procedure invocation @param The name of the procedure @param stel a stack trace element @return true if it is, false it is not """ int lastPeriodPos = stel.getClassName().lastIndexOf('.'); if (lastPeriodPos == -1) { lastPeriodPos = 0; } else { ++lastPeriodPos; } // Account for inner classes too. Inner classes names comprise of the parent // class path followed by a dollar sign String simpleName = stel.getClassName().substring(lastPeriodPos); return simpleName.equals(procedureName) || (simpleName.startsWith(procedureName) && simpleName.charAt(procedureName.length()) == '$'); }
java
public static boolean isProcedureStackTraceElement(String procedureName, StackTraceElement stel) { int lastPeriodPos = stel.getClassName().lastIndexOf('.'); if (lastPeriodPos == -1) { lastPeriodPos = 0; } else { ++lastPeriodPos; } // Account for inner classes too. Inner classes names comprise of the parent // class path followed by a dollar sign String simpleName = stel.getClassName().substring(lastPeriodPos); return simpleName.equals(procedureName) || (simpleName.startsWith(procedureName) && simpleName.charAt(procedureName.length()) == '$'); }
[ "public", "static", "boolean", "isProcedureStackTraceElement", "(", "String", "procedureName", ",", "StackTraceElement", "stel", ")", "{", "int", "lastPeriodPos", "=", "stel", ".", "getClassName", "(", ")", ".", "lastIndexOf", "(", "'", "'", ")", ";", "if", "(", "lastPeriodPos", "==", "-", "1", ")", "{", "lastPeriodPos", "=", "0", ";", "}", "else", "{", "++", "lastPeriodPos", ";", "}", "// Account for inner classes too. Inner classes names comprise of the parent", "// class path followed by a dollar sign", "String", "simpleName", "=", "stel", ".", "getClassName", "(", ")", ".", "substring", "(", "lastPeriodPos", ")", ";", "return", "simpleName", ".", "equals", "(", "procedureName", ")", "||", "(", "simpleName", ".", "startsWith", "(", "procedureName", ")", "&&", "simpleName", ".", "charAt", "(", "procedureName", ".", "length", "(", ")", ")", "==", "'", "'", ")", ";", "}" ]
Test whether or not the given stack frame is within a procedure invocation @param The name of the procedure @param stel a stack trace element @return true if it is, false it is not
[ "Test", "whether", "or", "not", "the", "given", "stack", "frame", "is", "within", "a", "procedure", "invocation" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/ProcedureRunner.java#L1174-L1188
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassButtonUI.java
SeaGlassButtonUI.getPressedIcon
private Icon getPressedIcon(AbstractButton b, Icon defaultIcon) { """ DOCUMENT ME! @param b DOCUMENT ME! @param defaultIcon DOCUMENT ME! @return DOCUMENT ME! """ return getIcon(b, b.getPressedIcon(), defaultIcon, SynthConstants.PRESSED); }
java
private Icon getPressedIcon(AbstractButton b, Icon defaultIcon) { return getIcon(b, b.getPressedIcon(), defaultIcon, SynthConstants.PRESSED); }
[ "private", "Icon", "getPressedIcon", "(", "AbstractButton", "b", ",", "Icon", "defaultIcon", ")", "{", "return", "getIcon", "(", "b", ",", "b", ".", "getPressedIcon", "(", ")", ",", "defaultIcon", ",", "SynthConstants", ".", "PRESSED", ")", ";", "}" ]
DOCUMENT ME! @param b DOCUMENT ME! @param defaultIcon DOCUMENT ME! @return DOCUMENT ME!
[ "DOCUMENT", "ME!" ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassButtonUI.java#L500-L502
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/style/Color.java
Color.setColorByHSL
public void setColorByHSL(float hue, float saturation, float lightness) { """ Set the color with HSL (hue, saturation, lightness) values @param hue hue value inclusively between 0.0 and 360.0 @param saturation saturation inclusively between 0.0 and 1.0 @param lightness lightness inclusively between 0.0 and 1.0 """ float[] arithmeticRGB = ColorUtils.toArithmeticRGB(hue, saturation, lightness); setRed(arithmeticRGB[0]); setGreen(arithmeticRGB[1]); setBlue(arithmeticRGB[2]); }
java
public void setColorByHSL(float hue, float saturation, float lightness) { float[] arithmeticRGB = ColorUtils.toArithmeticRGB(hue, saturation, lightness); setRed(arithmeticRGB[0]); setGreen(arithmeticRGB[1]); setBlue(arithmeticRGB[2]); }
[ "public", "void", "setColorByHSL", "(", "float", "hue", ",", "float", "saturation", ",", "float", "lightness", ")", "{", "float", "[", "]", "arithmeticRGB", "=", "ColorUtils", ".", "toArithmeticRGB", "(", "hue", ",", "saturation", ",", "lightness", ")", ";", "setRed", "(", "arithmeticRGB", "[", "0", "]", ")", ";", "setGreen", "(", "arithmeticRGB", "[", "1", "]", ")", ";", "setBlue", "(", "arithmeticRGB", "[", "2", "]", ")", ";", "}" ]
Set the color with HSL (hue, saturation, lightness) values @param hue hue value inclusively between 0.0 and 360.0 @param saturation saturation inclusively between 0.0 and 1.0 @param lightness lightness inclusively between 0.0 and 1.0
[ "Set", "the", "color", "with", "HSL", "(", "hue", "saturation", "lightness", ")", "values" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/style/Color.java#L424-L430
ops4j/org.ops4j.base
ops4j-base-monitors/src/main/java/org/ops4j/monitors/stream/StreamMonitorRouter.java
StreamMonitorRouter.notifyUpdate
public void notifyUpdate( URL resource, int expected, int count ) { """ Notify all subscribing monitors of a updated event. @param resource the url of the updated resource @param expected the size in bytes of the download @param count the progress in bytes """ synchronized( m_Monitors ) { for( StreamMonitor monitor : m_Monitors ) { monitor.notifyUpdate( resource, expected, count ); } } }
java
public void notifyUpdate( URL resource, int expected, int count ) { synchronized( m_Monitors ) { for( StreamMonitor monitor : m_Monitors ) { monitor.notifyUpdate( resource, expected, count ); } } }
[ "public", "void", "notifyUpdate", "(", "URL", "resource", ",", "int", "expected", ",", "int", "count", ")", "{", "synchronized", "(", "m_Monitors", ")", "{", "for", "(", "StreamMonitor", "monitor", ":", "m_Monitors", ")", "{", "monitor", ".", "notifyUpdate", "(", "resource", ",", "expected", ",", "count", ")", ";", "}", "}", "}" ]
Notify all subscribing monitors of a updated event. @param resource the url of the updated resource @param expected the size in bytes of the download @param count the progress in bytes
[ "Notify", "all", "subscribing", "monitors", "of", "a", "updated", "event", "." ]
train
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-monitors/src/main/java/org/ops4j/monitors/stream/StreamMonitorRouter.java#L54-L63
graphhopper/graphhopper
core/src/main/java/com/graphhopper/storage/GraphEdgeIdFinder.java
GraphEdgeIdFinder.findEdgesInShape
public void findEdgesInShape(final GHIntHashSet edgeIds, final Shape shape, EdgeFilter filter) { """ This method fills the edgeIds hash with edgeIds found inside the specified shape """ GHPoint center = shape.getCenter(); QueryResult qr = locationIndex.findClosest(center.getLat(), center.getLon(), filter); // TODO: if there is no street close to the center it'll fail although there are roads covered. Maybe we should check edge points or some random points in the Shape instead? if (!qr.isValid()) throw new IllegalArgumentException("Shape " + shape + " does not cover graph"); if (shape.contains(qr.getSnappedPoint().lat, qr.getSnappedPoint().lon)) edgeIds.add(qr.getClosestEdge().getEdge()); final boolean isPolygon = shape instanceof Polygon; BreadthFirstSearch bfs = new BreadthFirstSearch() { final NodeAccess na = graph.getNodeAccess(); final Shape localShape = shape; @Override protected boolean goFurther(int nodeId) { if (isPolygon) return isInsideBBox(nodeId); return localShape.contains(na.getLatitude(nodeId), na.getLongitude(nodeId)); } @Override protected boolean checkAdjacent(EdgeIteratorState edge) { int adjNodeId = edge.getAdjNode(); if (localShape.contains(na.getLatitude(adjNodeId), na.getLongitude(adjNodeId))) { edgeIds.add(edge.getEdge()); return true; } return isPolygon && isInsideBBox(adjNodeId); } private boolean isInsideBBox(int nodeId) { BBox bbox = localShape.getBounds(); double lat = na.getLatitude(nodeId); double lon = na.getLongitude(nodeId); return lat <= bbox.maxLat && lat >= bbox.minLat && lon <= bbox.maxLon && lon >= bbox.minLon; } }; bfs.start(graph.createEdgeExplorer(filter), qr.getClosestNode()); }
java
public void findEdgesInShape(final GHIntHashSet edgeIds, final Shape shape, EdgeFilter filter) { GHPoint center = shape.getCenter(); QueryResult qr = locationIndex.findClosest(center.getLat(), center.getLon(), filter); // TODO: if there is no street close to the center it'll fail although there are roads covered. Maybe we should check edge points or some random points in the Shape instead? if (!qr.isValid()) throw new IllegalArgumentException("Shape " + shape + " does not cover graph"); if (shape.contains(qr.getSnappedPoint().lat, qr.getSnappedPoint().lon)) edgeIds.add(qr.getClosestEdge().getEdge()); final boolean isPolygon = shape instanceof Polygon; BreadthFirstSearch bfs = new BreadthFirstSearch() { final NodeAccess na = graph.getNodeAccess(); final Shape localShape = shape; @Override protected boolean goFurther(int nodeId) { if (isPolygon) return isInsideBBox(nodeId); return localShape.contains(na.getLatitude(nodeId), na.getLongitude(nodeId)); } @Override protected boolean checkAdjacent(EdgeIteratorState edge) { int adjNodeId = edge.getAdjNode(); if (localShape.contains(na.getLatitude(adjNodeId), na.getLongitude(adjNodeId))) { edgeIds.add(edge.getEdge()); return true; } return isPolygon && isInsideBBox(adjNodeId); } private boolean isInsideBBox(int nodeId) { BBox bbox = localShape.getBounds(); double lat = na.getLatitude(nodeId); double lon = na.getLongitude(nodeId); return lat <= bbox.maxLat && lat >= bbox.minLat && lon <= bbox.maxLon && lon >= bbox.minLon; } }; bfs.start(graph.createEdgeExplorer(filter), qr.getClosestNode()); }
[ "public", "void", "findEdgesInShape", "(", "final", "GHIntHashSet", "edgeIds", ",", "final", "Shape", "shape", ",", "EdgeFilter", "filter", ")", "{", "GHPoint", "center", "=", "shape", ".", "getCenter", "(", ")", ";", "QueryResult", "qr", "=", "locationIndex", ".", "findClosest", "(", "center", ".", "getLat", "(", ")", ",", "center", ".", "getLon", "(", ")", ",", "filter", ")", ";", "// TODO: if there is no street close to the center it'll fail although there are roads covered. Maybe we should check edge points or some random points in the Shape instead?", "if", "(", "!", "qr", ".", "isValid", "(", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"Shape \"", "+", "shape", "+", "\" does not cover graph\"", ")", ";", "if", "(", "shape", ".", "contains", "(", "qr", ".", "getSnappedPoint", "(", ")", ".", "lat", ",", "qr", ".", "getSnappedPoint", "(", ")", ".", "lon", ")", ")", "edgeIds", ".", "add", "(", "qr", ".", "getClosestEdge", "(", ")", ".", "getEdge", "(", ")", ")", ";", "final", "boolean", "isPolygon", "=", "shape", "instanceof", "Polygon", ";", "BreadthFirstSearch", "bfs", "=", "new", "BreadthFirstSearch", "(", ")", "{", "final", "NodeAccess", "na", "=", "graph", ".", "getNodeAccess", "(", ")", ";", "final", "Shape", "localShape", "=", "shape", ";", "@", "Override", "protected", "boolean", "goFurther", "(", "int", "nodeId", ")", "{", "if", "(", "isPolygon", ")", "return", "isInsideBBox", "(", "nodeId", ")", ";", "return", "localShape", ".", "contains", "(", "na", ".", "getLatitude", "(", "nodeId", ")", ",", "na", ".", "getLongitude", "(", "nodeId", ")", ")", ";", "}", "@", "Override", "protected", "boolean", "checkAdjacent", "(", "EdgeIteratorState", "edge", ")", "{", "int", "adjNodeId", "=", "edge", ".", "getAdjNode", "(", ")", ";", "if", "(", "localShape", ".", "contains", "(", "na", ".", "getLatitude", "(", "adjNodeId", ")", ",", "na", ".", "getLongitude", "(", "adjNodeId", ")", ")", ")", "{", "edgeIds", ".", "add", "(", "edge", ".", "getEdge", "(", ")", ")", ";", "return", "true", ";", "}", "return", "isPolygon", "&&", "isInsideBBox", "(", "adjNodeId", ")", ";", "}", "private", "boolean", "isInsideBBox", "(", "int", "nodeId", ")", "{", "BBox", "bbox", "=", "localShape", ".", "getBounds", "(", ")", ";", "double", "lat", "=", "na", ".", "getLatitude", "(", "nodeId", ")", ";", "double", "lon", "=", "na", ".", "getLongitude", "(", "nodeId", ")", ";", "return", "lat", "<=", "bbox", ".", "maxLat", "&&", "lat", ">=", "bbox", ".", "minLat", "&&", "lon", "<=", "bbox", ".", "maxLon", "&&", "lon", ">=", "bbox", ".", "minLon", ";", "}", "}", ";", "bfs", ".", "start", "(", "graph", ".", "createEdgeExplorer", "(", "filter", ")", ",", "qr", ".", "getClosestNode", "(", ")", ")", ";", "}" ]
This method fills the edgeIds hash with edgeIds found inside the specified shape
[ "This", "method", "fills", "the", "edgeIds", "hash", "with", "edgeIds", "found", "inside", "the", "specified", "shape" ]
train
https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/storage/GraphEdgeIdFinder.java#L71-L113
brianwhu/xillium
data/src/main/java/org/xillium/data/persistence/Persistence.java
Persistence.doReadOnly
public <T, F> T doReadOnly(F facility, Task<T, F> task) { """ Executes a task within a read-only transaction. Any exception rolls back the transaction and gets rethrown as a RuntimeException. """ return doTransaction(facility, task, _readonly); }
java
public <T, F> T doReadOnly(F facility, Task<T, F> task) { return doTransaction(facility, task, _readonly); }
[ "public", "<", "T", ",", "F", ">", "T", "doReadOnly", "(", "F", "facility", ",", "Task", "<", "T", ",", "F", ">", "task", ")", "{", "return", "doTransaction", "(", "facility", ",", "task", ",", "_readonly", ")", ";", "}" ]
Executes a task within a read-only transaction. Any exception rolls back the transaction and gets rethrown as a RuntimeException.
[ "Executes", "a", "task", "within", "a", "read", "-", "only", "transaction", ".", "Any", "exception", "rolls", "back", "the", "transaction", "and", "gets", "rethrown", "as", "a", "RuntimeException", "." ]
train
https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/data/src/main/java/org/xillium/data/persistence/Persistence.java#L36-L38
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/FreightStreamer.java
FreightStreamer.tail
private void tail(String[] cmd, int pos) throws IOException { """ Parse the incoming command string @param cmd @param pos ignore anything before this pos in cmd @throws IOException """ CommandFormat c = new CommandFormat("tail", 1, 1, "f"); String src = null; Path path = null; try { List<String> parameters = c.parse(cmd, pos); src = parameters.get(0); } catch(IllegalArgumentException iae) { System.err.println("Usage: java FreightStreamer " + TAIL_USAGE); throw iae; } boolean foption = c.getOpt("f") ? true: false; path = new Path(src); FileSystem srcFs = path.getFileSystem(getConf()); if (srcFs.isDirectory(path)) { throw new IOException("Source must be a file."); } long fileSize = srcFs.getFileStatus(path).getLen(); long offset = (fileSize > 1024) ? fileSize - 1024: 0; while (true) { FSDataInputStream in = srcFs.open(path); in.seek(offset); IOUtils.copyBytes(in, System.out, 1024, false); offset = in.getPos(); in.close(); if (!foption) { break; } fileSize = srcFs.getFileStatus(path).getLen(); offset = (fileSize > offset) ? offset: fileSize; try { Thread.sleep(5000); } catch (InterruptedException e) { break; } } }
java
private void tail(String[] cmd, int pos) throws IOException { CommandFormat c = new CommandFormat("tail", 1, 1, "f"); String src = null; Path path = null; try { List<String> parameters = c.parse(cmd, pos); src = parameters.get(0); } catch(IllegalArgumentException iae) { System.err.println("Usage: java FreightStreamer " + TAIL_USAGE); throw iae; } boolean foption = c.getOpt("f") ? true: false; path = new Path(src); FileSystem srcFs = path.getFileSystem(getConf()); if (srcFs.isDirectory(path)) { throw new IOException("Source must be a file."); } long fileSize = srcFs.getFileStatus(path).getLen(); long offset = (fileSize > 1024) ? fileSize - 1024: 0; while (true) { FSDataInputStream in = srcFs.open(path); in.seek(offset); IOUtils.copyBytes(in, System.out, 1024, false); offset = in.getPos(); in.close(); if (!foption) { break; } fileSize = srcFs.getFileStatus(path).getLen(); offset = (fileSize > offset) ? offset: fileSize; try { Thread.sleep(5000); } catch (InterruptedException e) { break; } } }
[ "private", "void", "tail", "(", "String", "[", "]", "cmd", ",", "int", "pos", ")", "throws", "IOException", "{", "CommandFormat", "c", "=", "new", "CommandFormat", "(", "\"tail\"", ",", "1", ",", "1", ",", "\"f\"", ")", ";", "String", "src", "=", "null", ";", "Path", "path", "=", "null", ";", "try", "{", "List", "<", "String", ">", "parameters", "=", "c", ".", "parse", "(", "cmd", ",", "pos", ")", ";", "src", "=", "parameters", ".", "get", "(", "0", ")", ";", "}", "catch", "(", "IllegalArgumentException", "iae", ")", "{", "System", ".", "err", ".", "println", "(", "\"Usage: java FreightStreamer \"", "+", "TAIL_USAGE", ")", ";", "throw", "iae", ";", "}", "boolean", "foption", "=", "c", ".", "getOpt", "(", "\"f\"", ")", "?", "true", ":", "false", ";", "path", "=", "new", "Path", "(", "src", ")", ";", "FileSystem", "srcFs", "=", "path", ".", "getFileSystem", "(", "getConf", "(", ")", ")", ";", "if", "(", "srcFs", ".", "isDirectory", "(", "path", ")", ")", "{", "throw", "new", "IOException", "(", "\"Source must be a file.\"", ")", ";", "}", "long", "fileSize", "=", "srcFs", ".", "getFileStatus", "(", "path", ")", ".", "getLen", "(", ")", ";", "long", "offset", "=", "(", "fileSize", ">", "1024", ")", "?", "fileSize", "-", "1024", ":", "0", ";", "while", "(", "true", ")", "{", "FSDataInputStream", "in", "=", "srcFs", ".", "open", "(", "path", ")", ";", "in", ".", "seek", "(", "offset", ")", ";", "IOUtils", ".", "copyBytes", "(", "in", ",", "System", ".", "out", ",", "1024", ",", "false", ")", ";", "offset", "=", "in", ".", "getPos", "(", ")", ";", "in", ".", "close", "(", ")", ";", "if", "(", "!", "foption", ")", "{", "break", ";", "}", "fileSize", "=", "srcFs", ".", "getFileStatus", "(", "path", ")", ".", "getLen", "(", ")", ";", "offset", "=", "(", "fileSize", ">", "offset", ")", "?", "offset", ":", "fileSize", ";", "try", "{", "Thread", ".", "sleep", "(", "5000", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "break", ";", "}", "}", "}" ]
Parse the incoming command string @param cmd @param pos ignore anything before this pos in cmd @throws IOException
[ "Parse", "the", "incoming", "command", "string" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FreightStreamer.java#L546-L585
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/data/ArtFinder.java
ArtFinder.getArtwork
AlbumArt getArtwork(int artworkId, SlotReference slot, CdjStatus.TrackType trackType, Client client) throws IOException { """ Request the artwork with a particular artwork ID, given a connection to a player that has already been set up. @param artworkId identifies the album art to retrieve @param slot the slot identifier from which the associated track was loaded @param trackType the kind of track that owns the artwork @param client the dbserver client that is communicating with the appropriate player @return the track's artwork, or null if none is available @throws IOException if there is a problem communicating with the player """ // Send the artwork request Message response = client.simpleRequest(Message.KnownType.ALBUM_ART_REQ, Message.KnownType.ALBUM_ART, client.buildRMST(Message.MenuIdentifier.DATA, slot.slot, trackType), new NumberField((long)artworkId)); // Create an image from the response bytes return new AlbumArt(new DataReference(slot, artworkId), ((BinaryField)response.arguments.get(3)).getValue()); }
java
AlbumArt getArtwork(int artworkId, SlotReference slot, CdjStatus.TrackType trackType, Client client) throws IOException { // Send the artwork request Message response = client.simpleRequest(Message.KnownType.ALBUM_ART_REQ, Message.KnownType.ALBUM_ART, client.buildRMST(Message.MenuIdentifier.DATA, slot.slot, trackType), new NumberField((long)artworkId)); // Create an image from the response bytes return new AlbumArt(new DataReference(slot, artworkId), ((BinaryField)response.arguments.get(3)).getValue()); }
[ "AlbumArt", "getArtwork", "(", "int", "artworkId", ",", "SlotReference", "slot", ",", "CdjStatus", ".", "TrackType", "trackType", ",", "Client", "client", ")", "throws", "IOException", "{", "// Send the artwork request", "Message", "response", "=", "client", ".", "simpleRequest", "(", "Message", ".", "KnownType", ".", "ALBUM_ART_REQ", ",", "Message", ".", "KnownType", ".", "ALBUM_ART", ",", "client", ".", "buildRMST", "(", "Message", ".", "MenuIdentifier", ".", "DATA", ",", "slot", ".", "slot", ",", "trackType", ")", ",", "new", "NumberField", "(", "(", "long", ")", "artworkId", ")", ")", ";", "// Create an image from the response bytes", "return", "new", "AlbumArt", "(", "new", "DataReference", "(", "slot", ",", "artworkId", ")", ",", "(", "(", "BinaryField", ")", "response", ".", "arguments", ".", "get", "(", "3", ")", ")", ".", "getValue", "(", ")", ")", ";", "}" ]
Request the artwork with a particular artwork ID, given a connection to a player that has already been set up. @param artworkId identifies the album art to retrieve @param slot the slot identifier from which the associated track was loaded @param trackType the kind of track that owns the artwork @param client the dbserver client that is communicating with the appropriate player @return the track's artwork, or null if none is available @throws IOException if there is a problem communicating with the player
[ "Request", "the", "artwork", "with", "a", "particular", "artwork", "ID", "given", "a", "connection", "to", "a", "player", "that", "has", "already", "been", "set", "up", "." ]
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/ArtFinder.java#L360-L369
assertthat/selenium-shutterbug
src/main/java/com/assertthat/selenium_shutterbug/core/Shutterbug.java
Shutterbug.shootPage
public static PageSnapshot shootPage(WebDriver driver, ScrollStrategy scroll) { """ To be used when screen shooting the page and need to scroll while making screen shots, either vertically or horizontally or both directions (Chrome). @param driver WebDriver instance @param scroll ScrollStrategy How you need to scroll @return PageSnapshot instance """ return shootPage(driver, scroll, DEFAULT_SCROLL_TIMEOUT); }
java
public static PageSnapshot shootPage(WebDriver driver, ScrollStrategy scroll) { return shootPage(driver, scroll, DEFAULT_SCROLL_TIMEOUT); }
[ "public", "static", "PageSnapshot", "shootPage", "(", "WebDriver", "driver", ",", "ScrollStrategy", "scroll", ")", "{", "return", "shootPage", "(", "driver", ",", "scroll", ",", "DEFAULT_SCROLL_TIMEOUT", ")", ";", "}" ]
To be used when screen shooting the page and need to scroll while making screen shots, either vertically or horizontally or both directions (Chrome). @param driver WebDriver instance @param scroll ScrollStrategy How you need to scroll @return PageSnapshot instance
[ "To", "be", "used", "when", "screen", "shooting", "the", "page", "and", "need", "to", "scroll", "while", "making", "screen", "shots", "either", "vertically", "or", "horizontally", "or", "both", "directions", "(", "Chrome", ")", "." ]
train
https://github.com/assertthat/selenium-shutterbug/blob/770d9b92423200d262c9ab70e40405921d81e262/src/main/java/com/assertthat/selenium_shutterbug/core/Shutterbug.java#L57-L59
gallandarakhneorg/afc
advanced/bootique/bootique-log4j/src/main/java/org/arakhne/afc/bootique/log4j/modules/Log4jIntegrationModule.java
Log4jIntegrationModule.getLog4jIntegrationConfig
@SuppressWarnings("static-method") @Provides @Singleton public Log4jIntegrationConfig getLog4jIntegrationConfig(ConfigurationFactory configFactory, Injector injector) { """ Replies the instance of the log4j integration configuration.. @param configFactory accessor to the bootique factory. @param injector the current injector. @return the configuration accessor. """ final Log4jIntegrationConfig config = Log4jIntegrationConfig.getConfiguration(configFactory); injector.injectMembers(config); return config; }
java
@SuppressWarnings("static-method") @Provides @Singleton public Log4jIntegrationConfig getLog4jIntegrationConfig(ConfigurationFactory configFactory, Injector injector) { final Log4jIntegrationConfig config = Log4jIntegrationConfig.getConfiguration(configFactory); injector.injectMembers(config); return config; }
[ "@", "SuppressWarnings", "(", "\"static-method\"", ")", "@", "Provides", "@", "Singleton", "public", "Log4jIntegrationConfig", "getLog4jIntegrationConfig", "(", "ConfigurationFactory", "configFactory", ",", "Injector", "injector", ")", "{", "final", "Log4jIntegrationConfig", "config", "=", "Log4jIntegrationConfig", ".", "getConfiguration", "(", "configFactory", ")", ";", "injector", ".", "injectMembers", "(", "config", ")", ";", "return", "config", ";", "}" ]
Replies the instance of the log4j integration configuration.. @param configFactory accessor to the bootique factory. @param injector the current injector. @return the configuration accessor.
[ "Replies", "the", "instance", "of", "the", "log4j", "integration", "configuration", ".." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/bootique/bootique-log4j/src/main/java/org/arakhne/afc/bootique/log4j/modules/Log4jIntegrationModule.java#L74-L81
ops4j/org.ops4j.pax.wicket
spi/blueprint/src/main/java/org/ops4j/pax/wicket/spi/blueprint/injection/blueprint/AbstractBlueprintBeanDefinitionParser.java
AbstractBlueprintBeanDefinitionParser.createRef
protected RefMetadata createRef(ParserContext context, String id) { """ <p>createRef.</p> @param context a {@link org.apache.aries.blueprint.ParserContext} object. @param id a {@link java.lang.String} object. @return a {@link org.osgi.service.blueprint.reflect.RefMetadata} object. """ MutableRefMetadata idref = context.createMetadata(MutableRefMetadata.class); idref.setComponentId(id); return idref; }
java
protected RefMetadata createRef(ParserContext context, String id) { MutableRefMetadata idref = context.createMetadata(MutableRefMetadata.class); idref.setComponentId(id); return idref; }
[ "protected", "RefMetadata", "createRef", "(", "ParserContext", "context", ",", "String", "id", ")", "{", "MutableRefMetadata", "idref", "=", "context", ".", "createMetadata", "(", "MutableRefMetadata", ".", "class", ")", ";", "idref", ".", "setComponentId", "(", "id", ")", ";", "return", "idref", ";", "}" ]
<p>createRef.</p> @param context a {@link org.apache.aries.blueprint.ParserContext} object. @param id a {@link java.lang.String} object. @return a {@link org.osgi.service.blueprint.reflect.RefMetadata} object.
[ "<p", ">", "createRef", ".", "<", "/", "p", ">" ]
train
https://github.com/ops4j/org.ops4j.pax.wicket/blob/ef7cb4bdf918e9e61ec69789b9c690567616faa9/spi/blueprint/src/main/java/org/ops4j/pax/wicket/spi/blueprint/injection/blueprint/AbstractBlueprintBeanDefinitionParser.java#L187-L191
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.cut
public static BufferedImage cut(Image srcImage, int x, int y) { """ 图像切割(按指定起点坐标和宽高切割),填充满整个图片(直径取长宽最小值) @param srcImage 源图像 @param x 原图的x坐标起始位置 @param y 原图的y坐标起始位置 @return {@link BufferedImage} @since 4.1.15 """ return cut(srcImage, x, y, -1); }
java
public static BufferedImage cut(Image srcImage, int x, int y) { return cut(srcImage, x, y, -1); }
[ "public", "static", "BufferedImage", "cut", "(", "Image", "srcImage", ",", "int", "x", ",", "int", "y", ")", "{", "return", "cut", "(", "srcImage", ",", "x", ",", "y", ",", "-", "1", ")", ";", "}" ]
图像切割(按指定起点坐标和宽高切割),填充满整个图片(直径取长宽最小值) @param srcImage 源图像 @param x 原图的x坐标起始位置 @param y 原图的y坐标起始位置 @return {@link BufferedImage} @since 4.1.15
[ "图像切割", "(", "按指定起点坐标和宽高切割", ")", ",填充满整个图片(直径取长宽最小值)" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L344-L346
spockframework/spock
spock-core/src/main/java/spock/lang/Specification.java
Specification.noExceptionThrown
public void noExceptionThrown() { """ Specifies that no exception should be thrown, failing with a {@link UnallowedExceptionThrownError} otherwise. """ Throwable thrown = getSpecificationContext().getThrownException(); if (thrown == null) return; throw new UnallowedExceptionThrownError(null, thrown); }
java
public void noExceptionThrown() { Throwable thrown = getSpecificationContext().getThrownException(); if (thrown == null) return; throw new UnallowedExceptionThrownError(null, thrown); }
[ "public", "void", "noExceptionThrown", "(", ")", "{", "Throwable", "thrown", "=", "getSpecificationContext", "(", ")", ".", "getThrownException", "(", ")", ";", "if", "(", "thrown", "==", "null", ")", "return", ";", "throw", "new", "UnallowedExceptionThrownError", "(", "null", ",", "thrown", ")", ";", "}" ]
Specifies that no exception should be thrown, failing with a {@link UnallowedExceptionThrownError} otherwise.
[ "Specifies", "that", "no", "exception", "should", "be", "thrown", "failing", "with", "a", "{" ]
train
https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/spock/lang/Specification.java#L115-L119
youngmonkeys/ezyfox-sfs2x
src/main/java/com/tvd12/ezyfox/sfs2x/serverhandler/ServerRoomEventHandler.java
ServerRoomEventHandler.notifyHandlers
private void notifyHandlers(Room sfsRoom, User sfsUser) { """ Propagate event to handlers @param sfsRoom smartfox room object @param sfsUser smartfox user object """ ApiRoom apiRoom = AgentUtil.getRoomAgent(sfsRoom); ApiUser apiUser = AgentUtil.getUserAgent(sfsUser); for(RoomHandlerClass handler : handlers) { Object userAgent = checkUserAgent(handler, apiUser); if(!checkHandler(handler, apiRoom, userAgent)) continue; Object instance = handler.newInstance(); callHandleMethod(handler.getHandleMethod(), instance, apiRoom, userAgent); } }
java
private void notifyHandlers(Room sfsRoom, User sfsUser) { ApiRoom apiRoom = AgentUtil.getRoomAgent(sfsRoom); ApiUser apiUser = AgentUtil.getUserAgent(sfsUser); for(RoomHandlerClass handler : handlers) { Object userAgent = checkUserAgent(handler, apiUser); if(!checkHandler(handler, apiRoom, userAgent)) continue; Object instance = handler.newInstance(); callHandleMethod(handler.getHandleMethod(), instance, apiRoom, userAgent); } }
[ "private", "void", "notifyHandlers", "(", "Room", "sfsRoom", ",", "User", "sfsUser", ")", "{", "ApiRoom", "apiRoom", "=", "AgentUtil", ".", "getRoomAgent", "(", "sfsRoom", ")", ";", "ApiUser", "apiUser", "=", "AgentUtil", ".", "getUserAgent", "(", "sfsUser", ")", ";", "for", "(", "RoomHandlerClass", "handler", ":", "handlers", ")", "{", "Object", "userAgent", "=", "checkUserAgent", "(", "handler", ",", "apiUser", ")", ";", "if", "(", "!", "checkHandler", "(", "handler", ",", "apiRoom", ",", "userAgent", ")", ")", "continue", ";", "Object", "instance", "=", "handler", ".", "newInstance", "(", ")", ";", "callHandleMethod", "(", "handler", ".", "getHandleMethod", "(", ")", ",", "instance", ",", "apiRoom", ",", "userAgent", ")", ";", "}", "}" ]
Propagate event to handlers @param sfsRoom smartfox room object @param sfsUser smartfox user object
[ "Propagate", "event", "to", "handlers" ]
train
https://github.com/youngmonkeys/ezyfox-sfs2x/blob/7e004033a3b551c3ae970a0c8f45db7b1ec144de/src/main/java/com/tvd12/ezyfox/sfs2x/serverhandler/ServerRoomEventHandler.java#L72-L83
TheHortonMachine/hortonmachine
dbs/src/main/java/org/hortonmachine/dbs/h2gis/H2GisServer.java
H2GisServer.startTcpServerMode
public static Server startTcpServerMode( String port, boolean doSSL, String tcpPassword, boolean ifExists, String baseDir ) throws SQLException { """ Start the server mode. <p>This calls: <pre> Server server = Server.createTcpServer( "-tcpPort", "9123", "-tcpAllowOthers").start(); </pre> Supported options are: -tcpPort, -tcpSSL, -tcpPassword, -tcpAllowOthers, -tcpDaemon, -trace, -ifExists, -baseDir, -key. See the main method for details. <p> @param port the optional port to use. @param doSSL if <code>true</code>, ssl is used. @param tcpPassword an optional tcp passowrd to use. @param ifExists is <code>true</code>, the database to connect to has to exist. @param baseDir an optional basedir into which it is allowed to connect. @return @throws SQLException """ List<String> params = new ArrayList<>(); params.add("-tcpAllowOthers"); params.add("-tcpPort"); if (port == null) { port = "9123"; } params.add(port); if (doSSL) { params.add("-tcpSSL"); } if (tcpPassword != null) { params.add("-tcpPassword"); params.add(tcpPassword); } if (ifExists) { params.add("-ifExists"); } if (baseDir != null) { params.add("-baseDir"); params.add(baseDir); } Server server = Server.createTcpServer(params.toArray(new String[0])).start(); return server; }
java
public static Server startTcpServerMode( String port, boolean doSSL, String tcpPassword, boolean ifExists, String baseDir ) throws SQLException { List<String> params = new ArrayList<>(); params.add("-tcpAllowOthers"); params.add("-tcpPort"); if (port == null) { port = "9123"; } params.add(port); if (doSSL) { params.add("-tcpSSL"); } if (tcpPassword != null) { params.add("-tcpPassword"); params.add(tcpPassword); } if (ifExists) { params.add("-ifExists"); } if (baseDir != null) { params.add("-baseDir"); params.add(baseDir); } Server server = Server.createTcpServer(params.toArray(new String[0])).start(); return server; }
[ "public", "static", "Server", "startTcpServerMode", "(", "String", "port", ",", "boolean", "doSSL", ",", "String", "tcpPassword", ",", "boolean", "ifExists", ",", "String", "baseDir", ")", "throws", "SQLException", "{", "List", "<", "String", ">", "params", "=", "new", "ArrayList", "<>", "(", ")", ";", "params", ".", "add", "(", "\"-tcpAllowOthers\"", ")", ";", "params", ".", "add", "(", "\"-tcpPort\"", ")", ";", "if", "(", "port", "==", "null", ")", "{", "port", "=", "\"9123\"", ";", "}", "params", ".", "add", "(", "port", ")", ";", "if", "(", "doSSL", ")", "{", "params", ".", "add", "(", "\"-tcpSSL\"", ")", ";", "}", "if", "(", "tcpPassword", "!=", "null", ")", "{", "params", ".", "add", "(", "\"-tcpPassword\"", ")", ";", "params", ".", "add", "(", "tcpPassword", ")", ";", "}", "if", "(", "ifExists", ")", "{", "params", ".", "add", "(", "\"-ifExists\"", ")", ";", "}", "if", "(", "baseDir", "!=", "null", ")", "{", "params", ".", "add", "(", "\"-baseDir\"", ")", ";", "params", ".", "add", "(", "baseDir", ")", ";", "}", "Server", "server", "=", "Server", ".", "createTcpServer", "(", "params", ".", "toArray", "(", "new", "String", "[", "0", "]", ")", ")", ".", "start", "(", ")", ";", "return", "server", ";", "}" ]
Start the server mode. <p>This calls: <pre> Server server = Server.createTcpServer( "-tcpPort", "9123", "-tcpAllowOthers").start(); </pre> Supported options are: -tcpPort, -tcpSSL, -tcpPassword, -tcpAllowOthers, -tcpDaemon, -trace, -ifExists, -baseDir, -key. See the main method for details. <p> @param port the optional port to use. @param doSSL if <code>true</code>, ssl is used. @param tcpPassword an optional tcp passowrd to use. @param ifExists is <code>true</code>, the database to connect to has to exist. @param baseDir an optional basedir into which it is allowed to connect. @return @throws SQLException
[ "Start", "the", "server", "mode", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/dbs/src/main/java/org/hortonmachine/dbs/h2gis/H2GisServer.java#L58-L87
bazaarvoice/emodb
sor-client-common/src/main/java/com/bazaarvoice/emodb/sor/client/DataStoreStreaming.java
DataStoreStreaming.updateAllForFacade
public static void updateAllForFacade(DataStore dataStore, Iterator<Update> updateIter, Set<String> tags) { """ Creates, updates or deletes zero or more pieces of content in the data store facades. """ // Invoke dataStore.updateAll() with smallish batches so if one batch fails due to server failure, we will // fail over to another server using the Ostrich retry/failover infrastructure and continue from the point // of the failure. // Use time-based partitioning that adjusts batch sizes dynamically in an effort to settle on a batches that // take 500 milliseconds to execute. This should make the TimeLimitedIterator used by the DataStoreClient // unnecessary, but the TimeLimitedIterator is still relevant for clients that don't use DataStoreStreaming. // For now, hard-code initial/min/max/goal values. Iterator<List<Update>> batchIter = new TimePartitioningIterator<>(updateIter, 50, 1, 2500, Duration.ofMillis(500L)); while (batchIter.hasNext()) { // Ostrich will retry each batch as necessary dataStore.updateAllForFacade(batchIter.next(), tags); } }
java
public static void updateAllForFacade(DataStore dataStore, Iterator<Update> updateIter, Set<String> tags) { // Invoke dataStore.updateAll() with smallish batches so if one batch fails due to server failure, we will // fail over to another server using the Ostrich retry/failover infrastructure and continue from the point // of the failure. // Use time-based partitioning that adjusts batch sizes dynamically in an effort to settle on a batches that // take 500 milliseconds to execute. This should make the TimeLimitedIterator used by the DataStoreClient // unnecessary, but the TimeLimitedIterator is still relevant for clients that don't use DataStoreStreaming. // For now, hard-code initial/min/max/goal values. Iterator<List<Update>> batchIter = new TimePartitioningIterator<>(updateIter, 50, 1, 2500, Duration.ofMillis(500L)); while (batchIter.hasNext()) { // Ostrich will retry each batch as necessary dataStore.updateAllForFacade(batchIter.next(), tags); } }
[ "public", "static", "void", "updateAllForFacade", "(", "DataStore", "dataStore", ",", "Iterator", "<", "Update", ">", "updateIter", ",", "Set", "<", "String", ">", "tags", ")", "{", "// Invoke dataStore.updateAll() with smallish batches so if one batch fails due to server failure, we will", "// fail over to another server using the Ostrich retry/failover infrastructure and continue from the point", "// of the failure.", "// Use time-based partitioning that adjusts batch sizes dynamically in an effort to settle on a batches that", "// take 500 milliseconds to execute. This should make the TimeLimitedIterator used by the DataStoreClient", "// unnecessary, but the TimeLimitedIterator is still relevant for clients that don't use DataStoreStreaming.", "// For now, hard-code initial/min/max/goal values.", "Iterator", "<", "List", "<", "Update", ">>", "batchIter", "=", "new", "TimePartitioningIterator", "<>", "(", "updateIter", ",", "50", ",", "1", ",", "2500", ",", "Duration", ".", "ofMillis", "(", "500L", ")", ")", ";", "while", "(", "batchIter", ".", "hasNext", "(", ")", ")", "{", "// Ostrich will retry each batch as necessary", "dataStore", ".", "updateAllForFacade", "(", "batchIter", ".", "next", "(", ")", ",", "tags", ")", ";", "}", "}" ]
Creates, updates or deletes zero or more pieces of content in the data store facades.
[ "Creates", "updates", "or", "deletes", "zero", "or", "more", "pieces", "of", "content", "in", "the", "data", "store", "facades", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/sor-client-common/src/main/java/com/bazaarvoice/emodb/sor/client/DataStoreStreaming.java#L185-L199
james-hu/jabb-core
src/main/java/net/sf/jabb/spring/service/AbstractThreadPoolService.java
AbstractThreadPoolService.shutdownAndAwaitTermination
public static boolean shutdownAndAwaitTermination(ExecutorService pool, long waitSeconds) { """ Do a two-phase/two-attempts shutdown @param pool the thread pool @param waitSeconds number of seconds to wait in each of the shutdown attempts @return true if shutdown completed, false if not """ pool.shutdown(); // Disable new tasks from being submitted try { // Wait a while for existing tasks to terminate if(!pool.awaitTermination(waitSeconds, TimeUnit.SECONDS)) { //logger.warn("Thread pool is still running: {}", pool); pool.shutdownNow(); // Cancel currently executing tasks // Wait a while for tasks to respond to being cancelled if(!pool.awaitTermination(waitSeconds, TimeUnit.SECONDS)){ //logger.warn("Thread pool is not terminating: {}", pool); return false; }else{ return true; } }else{ return true; } } catch(InterruptedException ie) { // (Re-)Cancel if current thread also interrupted pool.shutdownNow(); // Preserve interrupt status Thread.currentThread().interrupt(); return false; } }
java
public static boolean shutdownAndAwaitTermination(ExecutorService pool, long waitSeconds) { pool.shutdown(); // Disable new tasks from being submitted try { // Wait a while for existing tasks to terminate if(!pool.awaitTermination(waitSeconds, TimeUnit.SECONDS)) { //logger.warn("Thread pool is still running: {}", pool); pool.shutdownNow(); // Cancel currently executing tasks // Wait a while for tasks to respond to being cancelled if(!pool.awaitTermination(waitSeconds, TimeUnit.SECONDS)){ //logger.warn("Thread pool is not terminating: {}", pool); return false; }else{ return true; } }else{ return true; } } catch(InterruptedException ie) { // (Re-)Cancel if current thread also interrupted pool.shutdownNow(); // Preserve interrupt status Thread.currentThread().interrupt(); return false; } }
[ "public", "static", "boolean", "shutdownAndAwaitTermination", "(", "ExecutorService", "pool", ",", "long", "waitSeconds", ")", "{", "pool", ".", "shutdown", "(", ")", ";", "// Disable new tasks from being submitted", "try", "{", "// Wait a while for existing tasks to terminate", "if", "(", "!", "pool", ".", "awaitTermination", "(", "waitSeconds", ",", "TimeUnit", ".", "SECONDS", ")", ")", "{", "//logger.warn(\"Thread pool is still running: {}\", pool);", "pool", ".", "shutdownNow", "(", ")", ";", "// Cancel currently executing tasks", "// Wait a while for tasks to respond to being cancelled", "if", "(", "!", "pool", ".", "awaitTermination", "(", "waitSeconds", ",", "TimeUnit", ".", "SECONDS", ")", ")", "{", "//logger.warn(\"Thread pool is not terminating: {}\", pool);", "return", "false", ";", "}", "else", "{", "return", "true", ";", "}", "}", "else", "{", "return", "true", ";", "}", "}", "catch", "(", "InterruptedException", "ie", ")", "{", "// (Re-)Cancel if current thread also interrupted", "pool", ".", "shutdownNow", "(", ")", ";", "// Preserve interrupt status", "Thread", ".", "currentThread", "(", ")", ".", "interrupt", "(", ")", ";", "return", "false", ";", "}", "}" ]
Do a two-phase/two-attempts shutdown @param pool the thread pool @param waitSeconds number of seconds to wait in each of the shutdown attempts @return true if shutdown completed, false if not
[ "Do", "a", "two", "-", "phase", "/", "two", "-", "attempts", "shutdown" ]
train
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/spring/service/AbstractThreadPoolService.java#L237-L261
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/CollectionsApi.java
CollectionsApi.getTree
public CollectionTree getTree(String collectionId, String userId) throws JinxException { """ Returns a tree (or sub tree) of collections belonging to a given user. <br> This method does not require authentication. @param collectionId Optional. The ID of the collection to fetch a tree for, or zero to fetch the root collection. Defaults to zero. @param userId Optional. The ID of the account to fetch the collection tree for. Deafults to the calling user. @return nested tree of collections, and the collections and sets they contain. @throws JinxException if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.collections.getTree.html">flickr.collections.getTree</a> """ Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.collections.getTree"); if (!JinxUtils.isNullOrEmpty(collectionId)) { params.put("collection_id", collectionId); } if (!JinxUtils.isNullOrEmpty(userId)) { params.put("user_id", userId); } return jinx.flickrGet(params, CollectionTree.class); }
java
public CollectionTree getTree(String collectionId, String userId) throws JinxException { Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.collections.getTree"); if (!JinxUtils.isNullOrEmpty(collectionId)) { params.put("collection_id", collectionId); } if (!JinxUtils.isNullOrEmpty(userId)) { params.put("user_id", userId); } return jinx.flickrGet(params, CollectionTree.class); }
[ "public", "CollectionTree", "getTree", "(", "String", "collectionId", ",", "String", "userId", ")", "throws", "JinxException", "{", "Map", "<", "String", ",", "String", ">", "params", "=", "new", "TreeMap", "<>", "(", ")", ";", "params", ".", "put", "(", "\"method\"", ",", "\"flickr.collections.getTree\"", ")", ";", "if", "(", "!", "JinxUtils", ".", "isNullOrEmpty", "(", "collectionId", ")", ")", "{", "params", ".", "put", "(", "\"collection_id\"", ",", "collectionId", ")", ";", "}", "if", "(", "!", "JinxUtils", ".", "isNullOrEmpty", "(", "userId", ")", ")", "{", "params", ".", "put", "(", "\"user_id\"", ",", "userId", ")", ";", "}", "return", "jinx", ".", "flickrGet", "(", "params", ",", "CollectionTree", ".", "class", ")", ";", "}" ]
Returns a tree (or sub tree) of collections belonging to a given user. <br> This method does not require authentication. @param collectionId Optional. The ID of the collection to fetch a tree for, or zero to fetch the root collection. Defaults to zero. @param userId Optional. The ID of the account to fetch the collection tree for. Deafults to the calling user. @return nested tree of collections, and the collections and sets they contain. @throws JinxException if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.collections.getTree.html">flickr.collections.getTree</a>
[ "Returns", "a", "tree", "(", "or", "sub", "tree", ")", "of", "collections", "belonging", "to", "a", "given", "user", ".", "<br", ">", "This", "method", "does", "not", "require", "authentication", "." ]
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/CollectionsApi.java#L73-L83
xvik/generics-resolver
src/main/java/ru/vyarus/java/generics/resolver/util/type/TrackedTypeFactory.java
TrackedTypeFactory.build
public static Type build(final Type type, final Type source) { """ Sub type must be either {@link ParameterizedType} or {@link WildcardType} containing parameterized types, because otherwise tracking is impossible (no source to track from) and so orignial type is simply returned as is. <p> In case of arrays, internal components are directly compared. @param type type to track generics for @param source type to track generics from (middle type) @return improved type or original type itself if nothing to track @throws IllegalArgumentException if type is not assignable for provided sub type """ if (!TypeUtils.isAssignable(type, source)) { throw new IllegalArgumentException(String.format( "Can't track type %s generics because it's not assignable to %s", TypeToStringUtils.toStringType(type), TypeToStringUtils.toStringTypeIgnoringVariables(source))); } Type res = type; if (ArrayTypeUtils.isArray(type) && ArrayTypeUtils.isArray(source)) { // for arrays track actual component types res = ArrayTypeUtils.toArrayType( build(ArrayTypeUtils.getArrayComponentType(type), ArrayTypeUtils.getArrayComponentType(source))); } else { final Class<?> target = GenericsUtils.resolveClass(type); // it make sense to track from direct parameterized type or parameterized types inside wildcard if (target.getTypeParameters().length > 0 && (source instanceof ParameterizedType || source instanceof WildcardType)) { // select the most specific generics final Map<String, Type> generics = resolveGenerics(type, target, source); // empty generics may appear from wildcard without parameterized types (no source) if (!generics.isEmpty()) { res = new ParameterizedTypeImpl(target, generics.values().toArray(new Type[0]), // intentionally not tracking owner type as redundant complication TypeUtils.getOuter(type)); } } } return res; }
java
public static Type build(final Type type, final Type source) { if (!TypeUtils.isAssignable(type, source)) { throw new IllegalArgumentException(String.format( "Can't track type %s generics because it's not assignable to %s", TypeToStringUtils.toStringType(type), TypeToStringUtils.toStringTypeIgnoringVariables(source))); } Type res = type; if (ArrayTypeUtils.isArray(type) && ArrayTypeUtils.isArray(source)) { // for arrays track actual component types res = ArrayTypeUtils.toArrayType( build(ArrayTypeUtils.getArrayComponentType(type), ArrayTypeUtils.getArrayComponentType(source))); } else { final Class<?> target = GenericsUtils.resolveClass(type); // it make sense to track from direct parameterized type or parameterized types inside wildcard if (target.getTypeParameters().length > 0 && (source instanceof ParameterizedType || source instanceof WildcardType)) { // select the most specific generics final Map<String, Type> generics = resolveGenerics(type, target, source); // empty generics may appear from wildcard without parameterized types (no source) if (!generics.isEmpty()) { res = new ParameterizedTypeImpl(target, generics.values().toArray(new Type[0]), // intentionally not tracking owner type as redundant complication TypeUtils.getOuter(type)); } } } return res; }
[ "public", "static", "Type", "build", "(", "final", "Type", "type", ",", "final", "Type", "source", ")", "{", "if", "(", "!", "TypeUtils", ".", "isAssignable", "(", "type", ",", "source", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "\"Can't track type %s generics because it's not assignable to %s\"", ",", "TypeToStringUtils", ".", "toStringType", "(", "type", ")", ",", "TypeToStringUtils", ".", "toStringTypeIgnoringVariables", "(", "source", ")", ")", ")", ";", "}", "Type", "res", "=", "type", ";", "if", "(", "ArrayTypeUtils", ".", "isArray", "(", "type", ")", "&&", "ArrayTypeUtils", ".", "isArray", "(", "source", ")", ")", "{", "// for arrays track actual component types", "res", "=", "ArrayTypeUtils", ".", "toArrayType", "(", "build", "(", "ArrayTypeUtils", ".", "getArrayComponentType", "(", "type", ")", ",", "ArrayTypeUtils", ".", "getArrayComponentType", "(", "source", ")", ")", ")", ";", "}", "else", "{", "final", "Class", "<", "?", ">", "target", "=", "GenericsUtils", ".", "resolveClass", "(", "type", ")", ";", "// it make sense to track from direct parameterized type or parameterized types inside wildcard", "if", "(", "target", ".", "getTypeParameters", "(", ")", ".", "length", ">", "0", "&&", "(", "source", "instanceof", "ParameterizedType", "||", "source", "instanceof", "WildcardType", ")", ")", "{", "// select the most specific generics", "final", "Map", "<", "String", ",", "Type", ">", "generics", "=", "resolveGenerics", "(", "type", ",", "target", ",", "source", ")", ";", "// empty generics may appear from wildcard without parameterized types (no source)", "if", "(", "!", "generics", ".", "isEmpty", "(", ")", ")", "{", "res", "=", "new", "ParameterizedTypeImpl", "(", "target", ",", "generics", ".", "values", "(", ")", ".", "toArray", "(", "new", "Type", "[", "0", "]", ")", ",", "// intentionally not tracking owner type as redundant complication", "TypeUtils", ".", "getOuter", "(", "type", ")", ")", ";", "}", "}", "}", "return", "res", ";", "}" ]
Sub type must be either {@link ParameterizedType} or {@link WildcardType} containing parameterized types, because otherwise tracking is impossible (no source to track from) and so orignial type is simply returned as is. <p> In case of arrays, internal components are directly compared. @param type type to track generics for @param source type to track generics from (middle type) @return improved type or original type itself if nothing to track @throws IllegalArgumentException if type is not assignable for provided sub type
[ "Sub", "type", "must", "be", "either", "{", "@link", "ParameterizedType", "}", "or", "{", "@link", "WildcardType", "}", "containing", "parameterized", "types", "because", "otherwise", "tracking", "is", "impossible", "(", "no", "source", "to", "track", "from", ")", "and", "so", "orignial", "type", "is", "simply", "returned", "as", "is", ".", "<p", ">", "In", "case", "of", "arrays", "internal", "components", "are", "directly", "compared", "." ]
train
https://github.com/xvik/generics-resolver/blob/d7d9d2783265df1178230e8f0b7cb6d853b67a7b/src/main/java/ru/vyarus/java/generics/resolver/util/type/TrackedTypeFactory.java#L39-L72
OpenLiberty/open-liberty
dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsConfigHelper.java
StatsConfigHelper.getTranslatedStatsName
public static String getTranslatedStatsName(String statsName, String statsType) { """ Method to translate the Stats instance/group name. Used by Admin Console """ return getTranslatedStatsName(statsName, statsType, Locale.getDefault()); }
java
public static String getTranslatedStatsName(String statsName, String statsType) { return getTranslatedStatsName(statsName, statsType, Locale.getDefault()); }
[ "public", "static", "String", "getTranslatedStatsName", "(", "String", "statsName", ",", "String", "statsType", ")", "{", "return", "getTranslatedStatsName", "(", "statsName", ",", "statsType", ",", "Locale", ".", "getDefault", "(", ")", ")", ";", "}" ]
Method to translate the Stats instance/group name. Used by Admin Console
[ "Method", "to", "translate", "the", "Stats", "instance", "/", "group", "name", ".", "Used", "by", "Admin", "Console" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsConfigHelper.java#L185-L187
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/style/StyleUtilities.java
StyleUtilities.rulesToStyle
public static Style rulesToStyle( List<Rule> rules, String name, boolean oneFeaturetypestylePerRule ) { """ Converts a list of {@link Rule}s to a {@link Style} with the given name. @param rules the list of rules. @param name the name of the new style. @param oneFeaturetypestylePerRule switch to create a {@link FeatureTypeStyle} per {@link Rule}. @return the new style created. """ Style namedStyle = StyleUtilities.sf.createStyle(); if (!oneFeaturetypestylePerRule) { FeatureTypeStyle featureTypeStyle = StyleUtilities.sf.createFeatureTypeStyle(); List<Rule> currentRules = featureTypeStyle.rules(); for( int i = 0; i < rules.size(); i++ ) { Rule rule = rules.get(i); currentRules.add(rule); } namedStyle.featureTypeStyles().add(featureTypeStyle); } else { for( int i = 0; i < rules.size(); i++ ) { FeatureTypeStyle featureTypeStyle = StyleUtilities.sf.createFeatureTypeStyle(); Rule rule = rules.get(i); featureTypeStyle.rules().add(rule); namedStyle.featureTypeStyles().add(featureTypeStyle); } } namedStyle.setName(name); return namedStyle; }
java
public static Style rulesToStyle( List<Rule> rules, String name, boolean oneFeaturetypestylePerRule ) { Style namedStyle = StyleUtilities.sf.createStyle(); if (!oneFeaturetypestylePerRule) { FeatureTypeStyle featureTypeStyle = StyleUtilities.sf.createFeatureTypeStyle(); List<Rule> currentRules = featureTypeStyle.rules(); for( int i = 0; i < rules.size(); i++ ) { Rule rule = rules.get(i); currentRules.add(rule); } namedStyle.featureTypeStyles().add(featureTypeStyle); } else { for( int i = 0; i < rules.size(); i++ ) { FeatureTypeStyle featureTypeStyle = StyleUtilities.sf.createFeatureTypeStyle(); Rule rule = rules.get(i); featureTypeStyle.rules().add(rule); namedStyle.featureTypeStyles().add(featureTypeStyle); } } namedStyle.setName(name); return namedStyle; }
[ "public", "static", "Style", "rulesToStyle", "(", "List", "<", "Rule", ">", "rules", ",", "String", "name", ",", "boolean", "oneFeaturetypestylePerRule", ")", "{", "Style", "namedStyle", "=", "StyleUtilities", ".", "sf", ".", "createStyle", "(", ")", ";", "if", "(", "!", "oneFeaturetypestylePerRule", ")", "{", "FeatureTypeStyle", "featureTypeStyle", "=", "StyleUtilities", ".", "sf", ".", "createFeatureTypeStyle", "(", ")", ";", "List", "<", "Rule", ">", "currentRules", "=", "featureTypeStyle", ".", "rules", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "rules", ".", "size", "(", ")", ";", "i", "++", ")", "{", "Rule", "rule", "=", "rules", ".", "get", "(", "i", ")", ";", "currentRules", ".", "add", "(", "rule", ")", ";", "}", "namedStyle", ".", "featureTypeStyles", "(", ")", ".", "add", "(", "featureTypeStyle", ")", ";", "}", "else", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "rules", ".", "size", "(", ")", ";", "i", "++", ")", "{", "FeatureTypeStyle", "featureTypeStyle", "=", "StyleUtilities", ".", "sf", ".", "createFeatureTypeStyle", "(", ")", ";", "Rule", "rule", "=", "rules", ".", "get", "(", "i", ")", ";", "featureTypeStyle", ".", "rules", "(", ")", ".", "add", "(", "rule", ")", ";", "namedStyle", ".", "featureTypeStyles", "(", ")", ".", "add", "(", "featureTypeStyle", ")", ";", "}", "}", "namedStyle", ".", "setName", "(", "name", ")", ";", "return", "namedStyle", ";", "}" ]
Converts a list of {@link Rule}s to a {@link Style} with the given name. @param rules the list of rules. @param name the name of the new style. @param oneFeaturetypestylePerRule switch to create a {@link FeatureTypeStyle} per {@link Rule}. @return the new style created.
[ "Converts", "a", "list", "of", "{", "@link", "Rule", "}", "s", "to", "a", "{", "@link", "Style", "}", "with", "the", "given", "name", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/style/StyleUtilities.java#L869-L889
vatbub/common
updater/src/main/java/com/github/vatbub/common/updater/UpdateChecker.java
UpdateChecker.isUpdateAvailableCompareAppVersion
public static UpdateInfo isUpdateAvailableCompareAppVersion(URL repoBaseURL, String mavenGroupID, String mavenArtifactID, String mavenClassifier) { """ Checks if a new release has been published on the website. This compares the current appVersion to the version available on the website and thus does not take into account if the user ignored that update. Assumes that the artifact has a jar-packaging. @param repoBaseURL The base url of the maven repo to use @param mavenGroupID The maven groupId of the artifact to update @param mavenArtifactID The maven artifactId of the artifact to update @param mavenClassifier The maven classifier of the artifact to update @return {@code true} if a new release is available. """ return isUpdateAvailableCompareAppVersion(repoBaseURL, mavenGroupID, mavenArtifactID, mavenClassifier, "jar"); }
java
public static UpdateInfo isUpdateAvailableCompareAppVersion(URL repoBaseURL, String mavenGroupID, String mavenArtifactID, String mavenClassifier) { return isUpdateAvailableCompareAppVersion(repoBaseURL, mavenGroupID, mavenArtifactID, mavenClassifier, "jar"); }
[ "public", "static", "UpdateInfo", "isUpdateAvailableCompareAppVersion", "(", "URL", "repoBaseURL", ",", "String", "mavenGroupID", ",", "String", "mavenArtifactID", ",", "String", "mavenClassifier", ")", "{", "return", "isUpdateAvailableCompareAppVersion", "(", "repoBaseURL", ",", "mavenGroupID", ",", "mavenArtifactID", ",", "mavenClassifier", ",", "\"jar\"", ")", ";", "}" ]
Checks if a new release has been published on the website. This compares the current appVersion to the version available on the website and thus does not take into account if the user ignored that update. Assumes that the artifact has a jar-packaging. @param repoBaseURL The base url of the maven repo to use @param mavenGroupID The maven groupId of the artifact to update @param mavenArtifactID The maven artifactId of the artifact to update @param mavenClassifier The maven classifier of the artifact to update @return {@code true} if a new release is available.
[ "Checks", "if", "a", "new", "release", "has", "been", "published", "on", "the", "website", ".", "This", "compares", "the", "current", "appVersion", "to", "the", "version", "available", "on", "the", "website", "and", "thus", "does", "not", "take", "into", "account", "if", "the", "user", "ignored", "that", "update", ".", "Assumes", "that", "the", "artifact", "has", "a", "jar", "-", "packaging", "." ]
train
https://github.com/vatbub/common/blob/8b9fd2ece0a23d520ce53b66c84cbd094e378443/updater/src/main/java/com/github/vatbub/common/updater/UpdateChecker.java#L185-L188
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/mps/sent_mails.java
sent_mails.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { """ <pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre> """ sent_mails_responses result = (sent_mails_responses) service.get_payload_formatter().string_to_resource(sent_mails_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.sent_mails_response_array); } sent_mails[] result_sent_mails = new sent_mails[result.sent_mails_response_array.length]; for(int i = 0; i < result.sent_mails_response_array.length; i++) { result_sent_mails[i] = result.sent_mails_response_array[i].sent_mails[0]; } return result_sent_mails; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { sent_mails_responses result = (sent_mails_responses) service.get_payload_formatter().string_to_resource(sent_mails_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.sent_mails_response_array); } sent_mails[] result_sent_mails = new sent_mails[result.sent_mails_response_array.length]; for(int i = 0; i < result.sent_mails_response_array.length; i++) { result_sent_mails[i] = result.sent_mails_response_array[i].sent_mails[0]; } return result_sent_mails; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "sent_mails_responses", "result", "=", "(", "sent_mails_responses", ")", "service", ".", "get_payload_formatter", "(", ")", ".", "string_to_resource", "(", "sent_mails_responses", ".", "class", ",", "response", ")", ";", "if", "(", "result", ".", "errorcode", "!=", "0", ")", "{", "if", "(", "result", ".", "errorcode", "==", "SESSION_NOT_EXISTS", ")", "service", ".", "clear_session", "(", ")", ";", "throw", "new", "nitro_exception", "(", "result", ".", "message", ",", "result", ".", "errorcode", ",", "(", "base_response", "[", "]", ")", "result", ".", "sent_mails_response_array", ")", ";", "}", "sent_mails", "[", "]", "result_sent_mails", "=", "new", "sent_mails", "[", "result", ".", "sent_mails_response_array", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "result", ".", "sent_mails_response_array", ".", "length", ";", "i", "++", ")", "{", "result_sent_mails", "[", "i", "]", "=", "result", ".", "sent_mails_response_array", "[", "i", "]", ".", "sent_mails", "[", "0", "]", ";", "}", "return", "result_sent_mails", ";", "}" ]
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/sent_mails.java#L511-L528
phax/ph-pdf-layout
src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java
PDPageContentStreamExt.setStrokingColor
public void setStrokingColor (final double g) throws IOException { """ Set the stroking color in the DeviceGray color space. Range is 0..1. @param g The gray value. @throws IOException If an IO error occurs while writing to the stream. @throws IllegalArgumentException If the parameter is invalid. """ if (_isOutsideOneInterval (g)) { throw new IllegalArgumentException ("Parameter must be within 0..1, but is " + g); } writeOperand ((float) g); writeOperator ((byte) 'G'); }
java
public void setStrokingColor (final double g) throws IOException { if (_isOutsideOneInterval (g)) { throw new IllegalArgumentException ("Parameter must be within 0..1, but is " + g); } writeOperand ((float) g); writeOperator ((byte) 'G'); }
[ "public", "void", "setStrokingColor", "(", "final", "double", "g", ")", "throws", "IOException", "{", "if", "(", "_isOutsideOneInterval", "(", "g", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter must be within 0..1, but is \"", "+", "g", ")", ";", "}", "writeOperand", "(", "(", "float", ")", "g", ")", ";", "writeOperator", "(", "(", "byte", ")", "'", "'", ")", ";", "}" ]
Set the stroking color in the DeviceGray color space. Range is 0..1. @param g The gray value. @throws IOException If an IO error occurs while writing to the stream. @throws IllegalArgumentException If the parameter is invalid.
[ "Set", "the", "stroking", "color", "in", "the", "DeviceGray", "color", "space", ".", "Range", "is", "0", "..", "1", "." ]
train
https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L861-L869
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java
ComputeNodeOperations.enableComputeNodeScheduling
public void enableComputeNodeScheduling(String poolId, String nodeId, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException { """ Enables task scheduling on the specified compute node. @param poolId The ID of the pool. @param nodeId The ID of the compute node. @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. """ ComputeNodeEnableSchedulingOptions options = new ComputeNodeEnableSchedulingOptions(); BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); bhMgr.applyRequestBehaviors(options); this.parentBatchClient.protocolLayer().computeNodes().enableScheduling(poolId, nodeId, options); }
java
public void enableComputeNodeScheduling(String poolId, String nodeId, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException { ComputeNodeEnableSchedulingOptions options = new ComputeNodeEnableSchedulingOptions(); BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); bhMgr.applyRequestBehaviors(options); this.parentBatchClient.protocolLayer().computeNodes().enableScheduling(poolId, nodeId, options); }
[ "public", "void", "enableComputeNodeScheduling", "(", "String", "poolId", ",", "String", "nodeId", ",", "Iterable", "<", "BatchClientBehavior", ">", "additionalBehaviors", ")", "throws", "BatchErrorException", ",", "IOException", "{", "ComputeNodeEnableSchedulingOptions", "options", "=", "new", "ComputeNodeEnableSchedulingOptions", "(", ")", ";", "BehaviorManager", "bhMgr", "=", "new", "BehaviorManager", "(", "this", ".", "customBehaviors", "(", ")", ",", "additionalBehaviors", ")", ";", "bhMgr", ".", "applyRequestBehaviors", "(", "options", ")", ";", "this", ".", "parentBatchClient", ".", "protocolLayer", "(", ")", ".", "computeNodes", "(", ")", ".", "enableScheduling", "(", "poolId", ",", "nodeId", ",", "options", ")", ";", "}" ]
Enables task scheduling on the specified compute node. @param poolId The ID of the pool. @param nodeId The ID of the compute node. @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Enables", "task", "scheduling", "on", "the", "specified", "compute", "node", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java#L424-L430
alkacon/opencms-core
src/org/opencms/ade/containerpage/inherited/CmsInheritedContainerState.java
CmsInheritedContainerState.addConfigurations
public void addConfigurations(CmsContainerConfigurationCache cache, String rootPath, String name) { """ Reads the configurations for a root path and its parents from a cache instance and adds them to this state.<p> @param cache the cache instance @param rootPath the root path @param name the name of the container configuration """ String currentPath = rootPath; List<CmsContainerConfiguration> configurations = new ArrayList<CmsContainerConfiguration>(); CmsContainerConfigurationCacheState state = cache.getState(); while (currentPath != null) { CmsContainerConfiguration configuration = state.getContainerConfiguration(currentPath, name); if (configuration == null) { configuration = CmsContainerConfiguration.emptyConfiguration(); } configuration.setPath(currentPath); configurations.add(configuration); currentPath = CmsResource.getParentFolder(currentPath); } Collections.reverse(configurations); for (CmsContainerConfiguration configuration : configurations) { if (configuration != null) { addConfiguration(configuration); } } }
java
public void addConfigurations(CmsContainerConfigurationCache cache, String rootPath, String name) { String currentPath = rootPath; List<CmsContainerConfiguration> configurations = new ArrayList<CmsContainerConfiguration>(); CmsContainerConfigurationCacheState state = cache.getState(); while (currentPath != null) { CmsContainerConfiguration configuration = state.getContainerConfiguration(currentPath, name); if (configuration == null) { configuration = CmsContainerConfiguration.emptyConfiguration(); } configuration.setPath(currentPath); configurations.add(configuration); currentPath = CmsResource.getParentFolder(currentPath); } Collections.reverse(configurations); for (CmsContainerConfiguration configuration : configurations) { if (configuration != null) { addConfiguration(configuration); } } }
[ "public", "void", "addConfigurations", "(", "CmsContainerConfigurationCache", "cache", ",", "String", "rootPath", ",", "String", "name", ")", "{", "String", "currentPath", "=", "rootPath", ";", "List", "<", "CmsContainerConfiguration", ">", "configurations", "=", "new", "ArrayList", "<", "CmsContainerConfiguration", ">", "(", ")", ";", "CmsContainerConfigurationCacheState", "state", "=", "cache", ".", "getState", "(", ")", ";", "while", "(", "currentPath", "!=", "null", ")", "{", "CmsContainerConfiguration", "configuration", "=", "state", ".", "getContainerConfiguration", "(", "currentPath", ",", "name", ")", ";", "if", "(", "configuration", "==", "null", ")", "{", "configuration", "=", "CmsContainerConfiguration", ".", "emptyConfiguration", "(", ")", ";", "}", "configuration", ".", "setPath", "(", "currentPath", ")", ";", "configurations", ".", "add", "(", "configuration", ")", ";", "currentPath", "=", "CmsResource", ".", "getParentFolder", "(", "currentPath", ")", ";", "}", "Collections", ".", "reverse", "(", "configurations", ")", ";", "for", "(", "CmsContainerConfiguration", "configuration", ":", "configurations", ")", "{", "if", "(", "configuration", "!=", "null", ")", "{", "addConfiguration", "(", "configuration", ")", ";", "}", "}", "}" ]
Reads the configurations for a root path and its parents from a cache instance and adds them to this state.<p> @param cache the cache instance @param rootPath the root path @param name the name of the container configuration
[ "Reads", "the", "configurations", "for", "a", "root", "path", "and", "its", "parents", "from", "a", "cache", "instance", "and", "adds", "them", "to", "this", "state", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/containerpage/inherited/CmsInheritedContainerState.java#L70-L90
wildfly/wildfly-core
request-controller/src/main/java/org/wildfly/extension/requestcontroller/ControlPoint.java
ControlPoint.forceQueueTask
public void forceQueueTask(Runnable task, Executor taskExecutor) { """ Queues a task to run when the request controller allows it. This allows tasks not to be dropped when the max request limit has been hit. If the container has been suspended then this <p/> Note that the task will be run withing the context of a {@link #beginRequest()} call, if the task is executed there is no need to invoke on the control point again. @param task The task to run @param taskExecutor The executor to run the task in """ controller.queueTask(this, task, taskExecutor, -1, null, false, true); }
java
public void forceQueueTask(Runnable task, Executor taskExecutor) { controller.queueTask(this, task, taskExecutor, -1, null, false, true); }
[ "public", "void", "forceQueueTask", "(", "Runnable", "task", ",", "Executor", "taskExecutor", ")", "{", "controller", ".", "queueTask", "(", "this", ",", "task", ",", "taskExecutor", ",", "-", "1", ",", "null", ",", "false", ",", "true", ")", ";", "}" ]
Queues a task to run when the request controller allows it. This allows tasks not to be dropped when the max request limit has been hit. If the container has been suspended then this <p/> Note that the task will be run withing the context of a {@link #beginRequest()} call, if the task is executed there is no need to invoke on the control point again. @param task The task to run @param taskExecutor The executor to run the task in
[ "Queues", "a", "task", "to", "run", "when", "the", "request", "controller", "allows", "it", ".", "This", "allows", "tasks", "not", "to", "be", "dropped", "when", "the", "max", "request", "limit", "has", "been", "hit", ".", "If", "the", "container", "has", "been", "suspended", "then", "this", "<p", "/", ">", "Note", "that", "the", "task", "will", "be", "run", "withing", "the", "context", "of", "a", "{", "@link", "#beginRequest", "()", "}", "call", "if", "the", "task", "is", "executed", "there", "is", "no", "need", "to", "invoke", "on", "the", "control", "point", "again", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/request-controller/src/main/java/org/wildfly/extension/requestcontroller/ControlPoint.java#L227-L229
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/util/FileUtils.java
FileUtils.writeToFile
public static void writeToFile(String content, File file, Charset charset) { """ Writes String content to file with given charset encoding. Automatically closes file output streams when done. @param content @param file """ if (log.isDebugEnabled()) { log.debug(String.format("Writing file resource: '%s' (encoding is '%s')", file.getName(), charset.displayName())); } if (!file.getParentFile().exists()) { if (!file.getParentFile().mkdirs()) { throw new CitrusRuntimeException("Unable to create folder structure for file: " + file.getPath()); } } try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(file))) { fos.write(content.getBytes(charset)); fos.flush(); } catch (IOException e) { throw new CitrusRuntimeException("Failed to write file", e); } }
java
public static void writeToFile(String content, File file, Charset charset) { if (log.isDebugEnabled()) { log.debug(String.format("Writing file resource: '%s' (encoding is '%s')", file.getName(), charset.displayName())); } if (!file.getParentFile().exists()) { if (!file.getParentFile().mkdirs()) { throw new CitrusRuntimeException("Unable to create folder structure for file: " + file.getPath()); } } try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(file))) { fos.write(content.getBytes(charset)); fos.flush(); } catch (IOException e) { throw new CitrusRuntimeException("Failed to write file", e); } }
[ "public", "static", "void", "writeToFile", "(", "String", "content", ",", "File", "file", ",", "Charset", "charset", ")", "{", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "log", ".", "debug", "(", "String", ".", "format", "(", "\"Writing file resource: '%s' (encoding is '%s')\"", ",", "file", ".", "getName", "(", ")", ",", "charset", ".", "displayName", "(", ")", ")", ")", ";", "}", "if", "(", "!", "file", ".", "getParentFile", "(", ")", ".", "exists", "(", ")", ")", "{", "if", "(", "!", "file", ".", "getParentFile", "(", ")", ".", "mkdirs", "(", ")", ")", "{", "throw", "new", "CitrusRuntimeException", "(", "\"Unable to create folder structure for file: \"", "+", "file", ".", "getPath", "(", ")", ")", ";", "}", "}", "try", "(", "OutputStream", "fos", "=", "new", "BufferedOutputStream", "(", "new", "FileOutputStream", "(", "file", ")", ")", ")", "{", "fos", ".", "write", "(", "content", ".", "getBytes", "(", "charset", ")", ")", ";", "fos", ".", "flush", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "CitrusRuntimeException", "(", "\"Failed to write file\"", ",", "e", ")", ";", "}", "}" ]
Writes String content to file with given charset encoding. Automatically closes file output streams when done. @param content @param file
[ "Writes", "String", "content", "to", "file", "with", "given", "charset", "encoding", ".", "Automatically", "closes", "file", "output", "streams", "when", "done", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/util/FileUtils.java#L156-L173
samskivert/pythagoras
src/main/java/pythagoras/f/Matrix4.java
Matrix4.setToRotation
public Matrix4 setToRotation (float angle, IVector3 axis) { """ Sets this to a rotation matrix. @return a reference to this matrix, for chaining. """ return setToRotation(angle, axis.x(), axis.y(), axis.z()); }
java
public Matrix4 setToRotation (float angle, IVector3 axis) { return setToRotation(angle, axis.x(), axis.y(), axis.z()); }
[ "public", "Matrix4", "setToRotation", "(", "float", "angle", ",", "IVector3", "axis", ")", "{", "return", "setToRotation", "(", "angle", ",", "axis", ".", "x", "(", ")", ",", "axis", ".", "y", "(", ")", ",", "axis", ".", "z", "(", ")", ")", ";", "}" ]
Sets this to a rotation matrix. @return a reference to this matrix, for chaining.
[ "Sets", "this", "to", "a", "rotation", "matrix", "." ]
train
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Matrix4.java#L202-L204
powermock/powermock
powermock-api/powermock-api-support/src/main/java/org/powermock/api/support/SuppressCode.java
SuppressCode.suppressSpecificConstructor
public static synchronized void suppressSpecificConstructor(Class<?> clazz, Class<?>... parameterTypes) { """ This method can be used to suppress the code in a specific constructor. @param clazz The class where the constructor is located. @param parameterTypes The parameter types of the constructor to suppress. """ MockRepository.addConstructorToSuppress(Whitebox.getConstructor(clazz, parameterTypes)); }
java
public static synchronized void suppressSpecificConstructor(Class<?> clazz, Class<?>... parameterTypes) { MockRepository.addConstructorToSuppress(Whitebox.getConstructor(clazz, parameterTypes)); }
[ "public", "static", "synchronized", "void", "suppressSpecificConstructor", "(", "Class", "<", "?", ">", "clazz", ",", "Class", "<", "?", ">", "...", "parameterTypes", ")", "{", "MockRepository", ".", "addConstructorToSuppress", "(", "Whitebox", ".", "getConstructor", "(", "clazz", ",", "parameterTypes", ")", ")", ";", "}" ]
This method can be used to suppress the code in a specific constructor. @param clazz The class where the constructor is located. @param parameterTypes The parameter types of the constructor to suppress.
[ "This", "method", "can", "be", "used", "to", "suppress", "the", "code", "in", "a", "specific", "constructor", "." ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-support/src/main/java/org/powermock/api/support/SuppressCode.java#L52-L54
Netflix/eureka
eureka-core/src/main/java/com/netflix/eureka/registry/AbstractInstanceRegistry.java
AbstractInstanceRegistry.getInstanceByAppAndId
@Override public InstanceInfo getInstanceByAppAndId(String appName, String id) { """ Gets the {@link InstanceInfo} information. @param appName the application name for which the information is requested. @param id the unique identifier of the instance. @return the information about the instance. """ return this.getInstanceByAppAndId(appName, id, true); }
java
@Override public InstanceInfo getInstanceByAppAndId(String appName, String id) { return this.getInstanceByAppAndId(appName, id, true); }
[ "@", "Override", "public", "InstanceInfo", "getInstanceByAppAndId", "(", "String", "appName", ",", "String", "id", ")", "{", "return", "this", ".", "getInstanceByAppAndId", "(", "appName", ",", "id", ",", "true", ")", ";", "}" ]
Gets the {@link InstanceInfo} information. @param appName the application name for which the information is requested. @param id the unique identifier of the instance. @return the information about the instance.
[ "Gets", "the", "{", "@link", "InstanceInfo", "}", "information", "." ]
train
https://github.com/Netflix/eureka/blob/48446d956be09df6650a3c00b7ebd7e2d1e1544f/eureka-core/src/main/java/com/netflix/eureka/registry/AbstractInstanceRegistry.java#L1007-L1010
jbundle/jbundle
base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBasePanel.java
XBasePanel.printXmlNavMenu
public void printXmlNavMenu(PrintWriter out, ResourceBundle reg) throws DBException { """ Code to display the side Menu. @param out The http output stream. @param reg Local resource bundle. @exception DBException File exception. """ String strNavMenu = reg.getString("xmlNavMenu"); if ((strNavMenu == null) || (strNavMenu.length() == 0)) strNavMenu = " <navigation-menu>" + " <navigation-item>" + " <name>Home</name>" + " <description>Home</description>" + " <link>?menu=Home</link>" + " <image>Home</image>" + " </navigation-item>" + " <navigation-item>" + " <name>My home</name>" + " <description>My home</description>" + " <link>?menu=</link>" + " <image>MyHome</image>" + " </navigation-item>" + " </navigation-menu>"; out.println(strNavMenu); }
java
public void printXmlNavMenu(PrintWriter out, ResourceBundle reg) throws DBException { String strNavMenu = reg.getString("xmlNavMenu"); if ((strNavMenu == null) || (strNavMenu.length() == 0)) strNavMenu = " <navigation-menu>" + " <navigation-item>" + " <name>Home</name>" + " <description>Home</description>" + " <link>?menu=Home</link>" + " <image>Home</image>" + " </navigation-item>" + " <navigation-item>" + " <name>My home</name>" + " <description>My home</description>" + " <link>?menu=</link>" + " <image>MyHome</image>" + " </navigation-item>" + " </navigation-menu>"; out.println(strNavMenu); }
[ "public", "void", "printXmlNavMenu", "(", "PrintWriter", "out", ",", "ResourceBundle", "reg", ")", "throws", "DBException", "{", "String", "strNavMenu", "=", "reg", ".", "getString", "(", "\"xmlNavMenu\"", ")", ";", "if", "(", "(", "strNavMenu", "==", "null", ")", "||", "(", "strNavMenu", ".", "length", "(", ")", "==", "0", ")", ")", "strNavMenu", "=", "\" <navigation-menu>\"", "+", "\" <navigation-item>\"", "+", "\" <name>Home</name>\"", "+", "\" <description>Home</description>\"", "+", "\" <link>?menu=Home</link>\"", "+", "\" <image>Home</image>\"", "+", "\" </navigation-item>\"", "+", "\" <navigation-item>\"", "+", "\" <name>My home</name>\"", "+", "\" <description>My home</description>\"", "+", "\" <link>?menu=</link>\"", "+", "\" <image>MyHome</image>\"", "+", "\" </navigation-item>\"", "+", "\" </navigation-menu>\"", ";", "out", ".", "println", "(", "strNavMenu", ")", ";", "}" ]
Code to display the side Menu. @param out The http output stream. @param reg Local resource bundle. @exception DBException File exception.
[ "Code", "to", "display", "the", "side", "Menu", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBasePanel.java#L331-L352
OpenLiberty/open-liberty
dev/com.ibm.ws.anno/src/com/ibm/ws/anno/info/internal/InfoVisitor.java
InfoVisitor.visitMethod
@Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String exceptions[]) { """ [ visitCode ( visitXInsn | visitLabel | visitTryCatchBlock | visitLocalVariable | visitLineNumber)* visitMaxs ] visitEnd. """ // skip static initializers if (name.equals("<clinit>")) { return null; } MethodInfoImpl methodInfo = new MethodInfoImpl(name, desc, exceptions, access, classInfo); if (name.equals("<init>")) { constructorInfos.add(methodInfo); } else { methodInfos.add(methodInfo); } if (logParms != null) { logParms[1] = name; logParms[2] = methodInfo.getHashText(); } methodVisitor.setMethodInfo(methodInfo); return methodVisitor; }
java
@Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String exceptions[]) { // skip static initializers if (name.equals("<clinit>")) { return null; } MethodInfoImpl methodInfo = new MethodInfoImpl(name, desc, exceptions, access, classInfo); if (name.equals("<init>")) { constructorInfos.add(methodInfo); } else { methodInfos.add(methodInfo); } if (logParms != null) { logParms[1] = name; logParms[2] = methodInfo.getHashText(); } methodVisitor.setMethodInfo(methodInfo); return methodVisitor; }
[ "@", "Override", "public", "MethodVisitor", "visitMethod", "(", "int", "access", ",", "String", "name", ",", "String", "desc", ",", "String", "signature", ",", "String", "exceptions", "[", "]", ")", "{", "// skip static initializers", "if", "(", "name", ".", "equals", "(", "\"<clinit>\"", ")", ")", "{", "return", "null", ";", "}", "MethodInfoImpl", "methodInfo", "=", "new", "MethodInfoImpl", "(", "name", ",", "desc", ",", "exceptions", ",", "access", ",", "classInfo", ")", ";", "if", "(", "name", ".", "equals", "(", "\"<init>\"", ")", ")", "{", "constructorInfos", ".", "add", "(", "methodInfo", ")", ";", "}", "else", "{", "methodInfos", ".", "add", "(", "methodInfo", ")", ";", "}", "if", "(", "logParms", "!=", "null", ")", "{", "logParms", "[", "1", "]", "=", "name", ";", "logParms", "[", "2", "]", "=", "methodInfo", ".", "getHashText", "(", ")", ";", "}", "methodVisitor", ".", "setMethodInfo", "(", "methodInfo", ")", ";", "return", "methodVisitor", ";", "}" ]
[ visitCode ( visitXInsn | visitLabel | visitTryCatchBlock | visitLocalVariable | visitLineNumber)* visitMaxs ] visitEnd.
[ "[", "visitCode", "(", "visitXInsn", "|", "visitLabel", "|", "visitTryCatchBlock", "|", "visitLocalVariable", "|", "visitLineNumber", ")", "*", "visitMaxs", "]", "visitEnd", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.anno/src/com/ibm/ws/anno/info/internal/InfoVisitor.java#L505-L527