repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
grpc/grpc-java
okhttp/third_party/okhttp/main/java/io/grpc/okhttp/internal/Platform.java
Platform.getAppEngineProvider
private static Provider getAppEngineProvider() { try { // Forcibly load conscrypt as it is unlikely to be an installed provider on AppEngine return (Provider) Class.forName("org.conscrypt.OpenSSLProvider") .getConstructor().newInstance(); } catch (Throwable t) { throw new RuntimeException("Unable to load conscrypt security provider", t); } }
java
private static Provider getAppEngineProvider() { try { // Forcibly load conscrypt as it is unlikely to be an installed provider on AppEngine return (Provider) Class.forName("org.conscrypt.OpenSSLProvider") .getConstructor().newInstance(); } catch (Throwable t) { throw new RuntimeException("Unable to load conscrypt security provider", t); } }
[ "private", "static", "Provider", "getAppEngineProvider", "(", ")", "{", "try", "{", "// Forcibly load conscrypt as it is unlikely to be an installed provider on AppEngine", "return", "(", "Provider", ")", "Class", ".", "forName", "(", "\"org.conscrypt.OpenSSLProvider\"", ")", ...
Forcibly load the conscrypt security provider on AppEngine if it's available. If not fail.
[ "Forcibly", "load", "the", "conscrypt", "security", "provider", "on", "AppEngine", "if", "it", "s", "available", ".", "If", "not", "fail", "." ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/okhttp/third_party/okhttp/main/java/io/grpc/okhttp/internal/Platform.java#L305-L313
apache/incubator-druid
server/src/main/java/org/apache/druid/server/coordinator/DataSourceCompactionConfig.java
DataSourceCompactionConfig.getValidTargetCompactionSizeBytes
@Nullable private static Long getValidTargetCompactionSizeBytes( @Nullable Long targetCompactionSizeBytes, @Nullable Integer maxRowsPerSegment, @Nullable UserCompactTuningConfig tuningConfig ) { if (targetCompactionSizeBytes != null) { Preconditions.checkArgument( !hasPartitionConfig(maxRowsPerSegment, tuningConfig), "targetCompactionSizeBytes[%s] cannot be used with maxRowsPerSegment[%s] and maxTotalRows[%s]", targetCompactionSizeBytes, maxRowsPerSegment, tuningConfig == null ? null : tuningConfig.getMaxTotalRows() ); return targetCompactionSizeBytes; } else { return hasPartitionConfig(maxRowsPerSegment, tuningConfig) ? null : DEFAULT_TARGET_COMPACTION_SIZE_BYTES; } }
java
@Nullable private static Long getValidTargetCompactionSizeBytes( @Nullable Long targetCompactionSizeBytes, @Nullable Integer maxRowsPerSegment, @Nullable UserCompactTuningConfig tuningConfig ) { if (targetCompactionSizeBytes != null) { Preconditions.checkArgument( !hasPartitionConfig(maxRowsPerSegment, tuningConfig), "targetCompactionSizeBytes[%s] cannot be used with maxRowsPerSegment[%s] and maxTotalRows[%s]", targetCompactionSizeBytes, maxRowsPerSegment, tuningConfig == null ? null : tuningConfig.getMaxTotalRows() ); return targetCompactionSizeBytes; } else { return hasPartitionConfig(maxRowsPerSegment, tuningConfig) ? null : DEFAULT_TARGET_COMPACTION_SIZE_BYTES; } }
[ "@", "Nullable", "private", "static", "Long", "getValidTargetCompactionSizeBytes", "(", "@", "Nullable", "Long", "targetCompactionSizeBytes", ",", "@", "Nullable", "Integer", "maxRowsPerSegment", ",", "@", "Nullable", "UserCompactTuningConfig", "tuningConfig", ")", "{", ...
This method is copied from {@code CompactionTask#getValidTargetCompactionSizeBytes}. The only difference is this method doesn't check 'numShards' which is not supported by {@link UserCompactTuningConfig}. Currently, we can't use the same method here because it's in a different module. Until we figure out how to reuse the same method, this method must be synced with {@code CompactionTask#getValidTargetCompactionSizeBytes}.
[ "This", "method", "is", "copied", "from", "{", "@code", "CompactionTask#getValidTargetCompactionSizeBytes", "}", ".", "The", "only", "difference", "is", "this", "method", "doesn", "t", "check", "numShards", "which", "is", "not", "supported", "by", "{", "@link", ...
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/server/coordinator/DataSourceCompactionConfig.java#L110-L129
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/ZipUtil.java
ZipUtil.pack
public static void pack(File rootDir, File zip, int compressionLevel) { pack(rootDir, zip, IdentityNameMapper.INSTANCE, compressionLevel); }
java
public static void pack(File rootDir, File zip, int compressionLevel) { pack(rootDir, zip, IdentityNameMapper.INSTANCE, compressionLevel); }
[ "public", "static", "void", "pack", "(", "File", "rootDir", ",", "File", "zip", ",", "int", "compressionLevel", ")", "{", "pack", "(", "rootDir", ",", "zip", ",", "IdentityNameMapper", ".", "INSTANCE", ",", "compressionLevel", ")", ";", "}" ]
Compresses the given directory and all its sub-directories into a ZIP file. <p> The ZIP file must not be a directory and its parent directory must exist. Will not include the root directory name in the archive. @param rootDir root directory. @param zip ZIP file that will be created or overwritten. @param compressionLevel compression level
[ "Compresses", "the", "given", "directory", "and", "all", "its", "sub", "-", "directories", "into", "a", "ZIP", "file", ".", "<p", ">", "The", "ZIP", "file", "must", "not", "be", "a", "directory", "and", "its", "parent", "directory", "must", "exist", ".",...
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L1402-L1404
kiegroup/drools
drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderImpl.java
KnowledgeBuilderImpl.addPackage
public void addPackage(final PackageDescr packageDescr) { PackageRegistry pkgRegistry = getOrCreatePackageRegistry(packageDescr); if (pkgRegistry == null) { return; } // merge into existing package mergePackage(pkgRegistry, packageDescr); compileKnowledgePackages(packageDescr, pkgRegistry); wireAllRules(); compileRete(packageDescr); }
java
public void addPackage(final PackageDescr packageDescr) { PackageRegistry pkgRegistry = getOrCreatePackageRegistry(packageDescr); if (pkgRegistry == null) { return; } // merge into existing package mergePackage(pkgRegistry, packageDescr); compileKnowledgePackages(packageDescr, pkgRegistry); wireAllRules(); compileRete(packageDescr); }
[ "public", "void", "addPackage", "(", "final", "PackageDescr", "packageDescr", ")", "{", "PackageRegistry", "pkgRegistry", "=", "getOrCreatePackageRegistry", "(", "packageDescr", ")", ";", "if", "(", "pkgRegistry", "==", "null", ")", "{", "return", ";", "}", "// ...
This adds a package from a Descr/AST This will also trigger a compile, if there are any generated classes to compile of course.
[ "This", "adds", "a", "package", "from", "a", "Descr", "/", "AST", "This", "will", "also", "trigger", "a", "compile", "if", "there", "are", "any", "generated", "classes", "to", "compile", "of", "course", "." ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderImpl.java#L939-L951
xm-online/xm-commons
xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/domain/mapper/PrivilegeMapper.java
PrivilegeMapper.privilegesMapToYml
public String privilegesMapToYml(Map<String, Collection<Privilege>> privileges) { try { return mapper.writeValueAsString(privileges); } catch (Exception e) { log.error("Failed to create privileges YML file from map, error: {}", e.getMessage(), e); } return null; }
java
public String privilegesMapToYml(Map<String, Collection<Privilege>> privileges) { try { return mapper.writeValueAsString(privileges); } catch (Exception e) { log.error("Failed to create privileges YML file from map, error: {}", e.getMessage(), e); } return null; }
[ "public", "String", "privilegesMapToYml", "(", "Map", "<", "String", ",", "Collection", "<", "Privilege", ">", ">", "privileges", ")", "{", "try", "{", "return", "mapper", ".", "writeValueAsString", "(", "privileges", ")", ";", "}", "catch", "(", "Exception"...
Convert privileges map to yml string. @param privileges map @return yml string
[ "Convert", "privileges", "map", "to", "yml", "string", "." ]
train
https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/domain/mapper/PrivilegeMapper.java#L49-L56
spring-projects/spring-boot
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java
ConfigurationPropertyName.of
static ConfigurationPropertyName of(CharSequence name, boolean returnNullIfInvalid) { Elements elements = elementsOf(name, returnNullIfInvalid); return (elements != null) ? new ConfigurationPropertyName(elements) : null; }
java
static ConfigurationPropertyName of(CharSequence name, boolean returnNullIfInvalid) { Elements elements = elementsOf(name, returnNullIfInvalid); return (elements != null) ? new ConfigurationPropertyName(elements) : null; }
[ "static", "ConfigurationPropertyName", "of", "(", "CharSequence", "name", ",", "boolean", "returnNullIfInvalid", ")", "{", "Elements", "elements", "=", "elementsOf", "(", "name", ",", "returnNullIfInvalid", ")", ";", "return", "(", "elements", "!=", "null", ")", ...
Return a {@link ConfigurationPropertyName} for the specified string. @param name the source name @param returnNullIfInvalid if null should be returned if the name is not valid @return a {@link ConfigurationPropertyName} instance @throws InvalidConfigurationPropertyNameException if the name is not valid and {@code returnNullIfInvalid} is {@code false}
[ "Return", "a", "{" ]
train
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java#L490-L493
Azure/azure-sdk-for-java
policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java
PolicyStatesInner.listQueryResultsForPolicyDefinition
public PolicyStatesQueryResultsInner listQueryResultsForPolicyDefinition(PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName) { return listQueryResultsForPolicyDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policyDefinitionName).toBlocking().single().body(); }
java
public PolicyStatesQueryResultsInner listQueryResultsForPolicyDefinition(PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName) { return listQueryResultsForPolicyDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policyDefinitionName).toBlocking().single().body(); }
[ "public", "PolicyStatesQueryResultsInner", "listQueryResultsForPolicyDefinition", "(", "PolicyStatesResource", "policyStatesResource", ",", "String", "subscriptionId", ",", "String", "policyDefinitionName", ")", "{", "return", "listQueryResultsForPolicyDefinitionWithServiceResponseAsyn...
Queries policy states for the subscription level policy definition. @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' @param subscriptionId Microsoft Azure subscription ID. @param policyDefinitionName Policy definition name. @throws IllegalArgumentException thrown if parameters fail the validation @throws QueryFailureException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PolicyStatesQueryResultsInner object if successful.
[ "Queries", "policy", "states", "for", "the", "subscription", "level", "policy", "definition", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java#L2069-L2071
apache/groovy
src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java
ResourceGroovyMethods.newWriter
public static BufferedWriter newWriter(File file, boolean append) throws IOException { return new BufferedWriter(new FileWriter(file, append)); }
java
public static BufferedWriter newWriter(File file, boolean append) throws IOException { return new BufferedWriter(new FileWriter(file, append)); }
[ "public", "static", "BufferedWriter", "newWriter", "(", "File", "file", ",", "boolean", "append", ")", "throws", "IOException", "{", "return", "new", "BufferedWriter", "(", "new", "FileWriter", "(", "file", ",", "append", ")", ")", ";", "}" ]
Creates a buffered writer for this file, optionally appending to the existing file content. @param file a File @param append true if data should be appended to the file @return a BufferedWriter @throws IOException if an IOException occurs. @since 1.0
[ "Creates", "a", "buffered", "writer", "for", "this", "file", "optionally", "appending", "to", "the", "existing", "file", "content", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L1913-L1915
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java
SeleniumHelper.findByXPath
public T findByXPath(String pattern, String... parameters) { By by = byXpath(pattern, parameters); return findElement(by); }
java
public T findByXPath(String pattern, String... parameters) { By by = byXpath(pattern, parameters); return findElement(by); }
[ "public", "T", "findByXPath", "(", "String", "pattern", ",", "String", "...", "parameters", ")", "{", "By", "by", "=", "byXpath", "(", "pattern", ",", "parameters", ")", ";", "return", "findElement", "(", "by", ")", ";", "}" ]
Finds element using xPath, supporting placeholder replacement. @param pattern basic XPATH, possibly with placeholders. @param parameters values for placeholders. @return element if found, null if none could be found.
[ "Finds", "element", "using", "xPath", "supporting", "placeholder", "replacement", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java#L698-L701
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/ImageButton.java
ImageButton.setAttribute
public void setAttribute(String name, String value, String facet) throws JspException { if (name != null) { if (name.equals(SRC) || name.equals(VALUE)) { String s = Bundle.getString("Tags_AttributeMayNotBeSet", new Object[]{name}); registerTagError(s, null); } else { if (name.equals(DISABLED)) { setDisabled(Boolean.parseBoolean(value)); return; } } } super.setAttribute(name, value, facet); }
java
public void setAttribute(String name, String value, String facet) throws JspException { if (name != null) { if (name.equals(SRC) || name.equals(VALUE)) { String s = Bundle.getString("Tags_AttributeMayNotBeSet", new Object[]{name}); registerTagError(s, null); } else { if (name.equals(DISABLED)) { setDisabled(Boolean.parseBoolean(value)); return; } } } super.setAttribute(name, value, facet); }
[ "public", "void", "setAttribute", "(", "String", "name", ",", "String", "value", ",", "String", "facet", ")", "throws", "JspException", "{", "if", "(", "name", "!=", "null", ")", "{", "if", "(", "name", ".", "equals", "(", "SRC", ")", "||", "name", "...
Base support for the attribute tag. This is overridden to prevent setting the <code>src</code> and <code>value</code> attributes @param name The name of the attribute. This value may not be null or the empty string. @param value The value of the attribute. This may contain an expression. @param facet The name of a facet to which the attribute will be applied. This is optional. @throws JspException A JspException may be thrown if there is an error setting the attribute.
[ "Base", "support", "for", "the", "attribute", "tag", ".", "This", "is", "overridden", "to", "prevent", "setting", "the", "<code", ">", "src<", "/", "code", ">", "and", "<code", ">", "value<", "/", "code", ">", "attributes" ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/ImageButton.java#L95-L111
undertow-io/undertow
core/src/main/java/io/undertow/util/FlexBase64.java
FlexBase64.encodeStringURL
public static String encodeStringURL(ByteBuffer source, boolean wrap) { return Encoder.encodeString(source, wrap, true); }
java
public static String encodeStringURL(ByteBuffer source, boolean wrap) { return Encoder.encodeString(source, wrap, true); }
[ "public", "static", "String", "encodeStringURL", "(", "ByteBuffer", "source", ",", "boolean", "wrap", ")", "{", "return", "Encoder", ".", "encodeString", "(", "source", ",", "wrap", ",", "true", ")", ";", "}" ]
Encodes a fixed and complete byte buffer into a Base64url String. <p>This method is only useful for applications which require a String and have all data to be encoded up-front. Note that byte arrays or buffers are almost always a better storage choice. They consume half the memory and can be reused (modified). In other words, it is almost always better to use {@link #encodeBytes}, {@link #createEncoder}, or {@link #createEncoderOutputStream} instead.</p> <pre><code> // Encodes "hello" FlexBase64.encodeStringURL(ByteBuffer.wrap("hello".getBytes("US-ASCII")), false); </code></pre> @param source the byte buffer to encode from @param wrap whether or not to wrap the output at 76 chars with CRLFs @return a new String representing the Base64url output
[ "Encodes", "a", "fixed", "and", "complete", "byte", "buffer", "into", "a", "Base64url", "String", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/util/FlexBase64.java#L253-L255
strator-dev/greenpepper
greenpepper-open/greenpepper-maven-runner/src/main/java/com/greenpepper/maven/runner/util/ReflectionUtils.java
ReflectionUtils.setDebugEnabled
public static void setDebugEnabled(ClassLoader classLoader, boolean isDebug) throws Exception { Class<?> greenPepperClass = classLoader.loadClass("com.greenpepper.GreenPepper"); Method setDebugEnabledMethod = greenPepperClass.getMethod("setDebugEnabled", boolean.class); setDebugEnabledMethod.invoke( null, isDebug ); }
java
public static void setDebugEnabled(ClassLoader classLoader, boolean isDebug) throws Exception { Class<?> greenPepperClass = classLoader.loadClass("com.greenpepper.GreenPepper"); Method setDebugEnabledMethod = greenPepperClass.getMethod("setDebugEnabled", boolean.class); setDebugEnabledMethod.invoke( null, isDebug ); }
[ "public", "static", "void", "setDebugEnabled", "(", "ClassLoader", "classLoader", ",", "boolean", "isDebug", ")", "throws", "Exception", "{", "Class", "<", "?", ">", "greenPepperClass", "=", "classLoader", ".", "loadClass", "(", "\"com.greenpepper.GreenPepper\"", ")...
<p>setDebugEnabled.</p> @param classLoader a {@link java.lang.ClassLoader} object. @param isDebug a boolean. @throws java.lang.Exception if any.
[ "<p", ">", "setDebugEnabled", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/greenpepper-maven-runner/src/main/java/com/greenpepper/maven/runner/util/ReflectionUtils.java#L73-L79
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WNumberFieldRenderer.java
WNumberFieldRenderer.doRender
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WNumberField field = (WNumberField) component; XmlStringBuilder xml = renderContext.getWriter(); boolean readOnly = field.isReadOnly(); BigDecimal value = field.getValue(); String userText = field.getText(); xml.appendTagOpen("ui:numberfield"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendOptionalAttribute("hidden", component.isHidden(), "true"); if (readOnly) { xml.appendAttribute("readOnly", "true"); } else { WComponent submitControl = field.getDefaultSubmitButton(); String submitControlId = submitControl == null ? null : submitControl.getId(); BigDecimal min = field.getMinValue(); BigDecimal max = field.getMaxValue(); BigDecimal step = field.getStep(); int decimals = field.getDecimalPlaces(); xml.appendOptionalAttribute("disabled", field.isDisabled(), "true"); xml.appendOptionalAttribute("required", field.isMandatory(), "true"); xml.appendOptionalAttribute("toolTip", field.getToolTip()); xml.appendOptionalAttribute("accessibleText", field.getAccessibleText()); xml.appendOptionalAttribute("min", min != null, String.valueOf(min)); xml.appendOptionalAttribute("max", max != null, String.valueOf(max)); xml.appendOptionalAttribute("step", step != null, String.valueOf(step)); xml.appendOptionalAttribute("decimals", decimals > 0, decimals); xml.appendOptionalAttribute("buttonId", submitControlId); String autocomplete = field.getAutocomplete(); xml.appendOptionalAttribute("autocomplete", !Util.empty(autocomplete), autocomplete); } xml.appendClose(); xml.appendEscaped(value == null ? userText : value.toString()); if (!readOnly) { DiagnosticRenderUtil.renderDiagnostics(field, renderContext); } xml.appendEndTag("ui:numberfield"); }
java
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WNumberField field = (WNumberField) component; XmlStringBuilder xml = renderContext.getWriter(); boolean readOnly = field.isReadOnly(); BigDecimal value = field.getValue(); String userText = field.getText(); xml.appendTagOpen("ui:numberfield"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendOptionalAttribute("hidden", component.isHidden(), "true"); if (readOnly) { xml.appendAttribute("readOnly", "true"); } else { WComponent submitControl = field.getDefaultSubmitButton(); String submitControlId = submitControl == null ? null : submitControl.getId(); BigDecimal min = field.getMinValue(); BigDecimal max = field.getMaxValue(); BigDecimal step = field.getStep(); int decimals = field.getDecimalPlaces(); xml.appendOptionalAttribute("disabled", field.isDisabled(), "true"); xml.appendOptionalAttribute("required", field.isMandatory(), "true"); xml.appendOptionalAttribute("toolTip", field.getToolTip()); xml.appendOptionalAttribute("accessibleText", field.getAccessibleText()); xml.appendOptionalAttribute("min", min != null, String.valueOf(min)); xml.appendOptionalAttribute("max", max != null, String.valueOf(max)); xml.appendOptionalAttribute("step", step != null, String.valueOf(step)); xml.appendOptionalAttribute("decimals", decimals > 0, decimals); xml.appendOptionalAttribute("buttonId", submitControlId); String autocomplete = field.getAutocomplete(); xml.appendOptionalAttribute("autocomplete", !Util.empty(autocomplete), autocomplete); } xml.appendClose(); xml.appendEscaped(value == null ? userText : value.toString()); if (!readOnly) { DiagnosticRenderUtil.renderDiagnostics(field, renderContext); } xml.appendEndTag("ui:numberfield"); }
[ "@", "Override", "public", "void", "doRender", "(", "final", "WComponent", "component", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "WNumberField", "field", "=", "(", "WNumberField", ")", "component", ";", "XmlStringBuilder", "xml", "=", "rende...
Paints the given WNumberField. @param component the WNumberField to paint. @param renderContext the RenderContext to paint to.
[ "Paints", "the", "given", "WNumberField", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WNumberFieldRenderer.java#L25-L69
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderService.java
SpiderService.deleteBatch
public BatchResult deleteBatch(TableDefinition tableDef, DBObjectBatch batch) { checkServiceState(); List<String> objIDs = new ArrayList<>(); for (DBObject dbObj : batch.getObjects()) { Utils.require(!Utils.isEmpty(dbObj.getObjectID()), "All objects must have _ID defined"); objIDs.add(dbObj.getObjectID()); } BatchObjectUpdater batchUpdater = new BatchObjectUpdater(tableDef); return batchUpdater.deleteBatch(objIDs); }
java
public BatchResult deleteBatch(TableDefinition tableDef, DBObjectBatch batch) { checkServiceState(); List<String> objIDs = new ArrayList<>(); for (DBObject dbObj : batch.getObjects()) { Utils.require(!Utils.isEmpty(dbObj.getObjectID()), "All objects must have _ID defined"); objIDs.add(dbObj.getObjectID()); } BatchObjectUpdater batchUpdater = new BatchObjectUpdater(tableDef); return batchUpdater.deleteBatch(objIDs); }
[ "public", "BatchResult", "deleteBatch", "(", "TableDefinition", "tableDef", ",", "DBObjectBatch", "batch", ")", "{", "checkServiceState", "(", ")", ";", "List", "<", "String", ">", "objIDs", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "DBObject...
Delete a batch of objects from the given table. All objects must have an ID assigned. Deleting an already-deleted object is a no-op. @param tableDef Table containing objects to be deleted. @param batch {@link DBObjectBatch} defining objects to be deleted. Only the _ID field of each DBObject is used. @return {@link BatchResult} indicating results of the delete.
[ "Delete", "a", "batch", "of", "objects", "from", "the", "given", "table", ".", "All", "objects", "must", "have", "an", "ID", "assigned", ".", "Deleting", "an", "already", "-", "deleted", "object", "is", "a", "no", "-", "op", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderService.java#L254-L263
netty/netty
example/src/main/java/io/netty/example/http2/helloworld/frame/server/HelloWorldHttp2Handler.java
HelloWorldHttp2Handler.onDataRead
private static void onDataRead(ChannelHandlerContext ctx, Http2DataFrame data) throws Exception { Http2FrameStream stream = data.stream(); if (data.isEndStream()) { sendResponse(ctx, stream, data.content()); } else { // We do not send back the response to the remote-peer, so we need to release it. data.release(); } // Update the flowcontroller ctx.write(new DefaultHttp2WindowUpdateFrame(data.initialFlowControlledBytes()).stream(stream)); }
java
private static void onDataRead(ChannelHandlerContext ctx, Http2DataFrame data) throws Exception { Http2FrameStream stream = data.stream(); if (data.isEndStream()) { sendResponse(ctx, stream, data.content()); } else { // We do not send back the response to the remote-peer, so we need to release it. data.release(); } // Update the flowcontroller ctx.write(new DefaultHttp2WindowUpdateFrame(data.initialFlowControlledBytes()).stream(stream)); }
[ "private", "static", "void", "onDataRead", "(", "ChannelHandlerContext", "ctx", ",", "Http2DataFrame", "data", ")", "throws", "Exception", "{", "Http2FrameStream", "stream", "=", "data", ".", "stream", "(", ")", ";", "if", "(", "data", ".", "isEndStream", "(",...
If receive a frame with end-of-stream set, send a pre-canned response.
[ "If", "receive", "a", "frame", "with", "end", "-", "of", "-", "stream", "set", "send", "a", "pre", "-", "canned", "response", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/example/src/main/java/io/netty/example/http2/helloworld/frame/server/HelloWorldHttp2Handler.java#L73-L85
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/util/Position.java
Position.encodePosition
public static int encodePosition(int line, int col) { if (line < 1) throw new IllegalArgumentException("line must be greater than 0"); if (col < 1) throw new IllegalArgumentException("column must be greater than 0"); if (line > MAXLINE || col > MAXCOLUMN) { return NOPOS; } return (line << LINESHIFT) + col; }
java
public static int encodePosition(int line, int col) { if (line < 1) throw new IllegalArgumentException("line must be greater than 0"); if (col < 1) throw new IllegalArgumentException("column must be greater than 0"); if (line > MAXLINE || col > MAXCOLUMN) { return NOPOS; } return (line << LINESHIFT) + col; }
[ "public", "static", "int", "encodePosition", "(", "int", "line", ",", "int", "col", ")", "{", "if", "(", "line", "<", "1", ")", "throw", "new", "IllegalArgumentException", "(", "\"line must be greater than 0\"", ")", ";", "if", "(", "col", "<", "1", ")", ...
Encode line and column numbers in an integer as: {@code line-number << LINESHIFT + column-number }. {@link Position#NOPOS} represents an undefined position. @param line number of line (first is 1) @param col number of character on line (first is 1) @return an encoded position or {@link Position#NOPOS} if the line or column number is too big to represent in the encoded format @throws IllegalArgumentException if line or col is less than 1
[ "Encode", "line", "and", "column", "numbers", "in", "an", "integer", "as", ":", "{", "@code", "line", "-", "number", "<<", "LINESHIFT", "+", "column", "-", "number", "}", ".", "{", "@link", "Position#NOPOS", "}", "represents", "an", "undefined", "position"...
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/util/Position.java#L92-L102
m-m-m/util
core/src/main/java/net/sf/mmm/util/filter/base/FilterRuleChainXmlParser.java
FilterRuleChainXmlParser.parseChain
public FilterRuleChain<String> parseChain(InputStream inStream) throws IOException, SAXException { try { Document xmlDoc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(inStream); return parseChain(xmlDoc.getDocumentElement()); } catch (ParserConfigurationException e) { throw new IllegalStateException("XML configuration error!", e); } finally { inStream.close(); } }
java
public FilterRuleChain<String> parseChain(InputStream inStream) throws IOException, SAXException { try { Document xmlDoc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(inStream); return parseChain(xmlDoc.getDocumentElement()); } catch (ParserConfigurationException e) { throw new IllegalStateException("XML configuration error!", e); } finally { inStream.close(); } }
[ "public", "FilterRuleChain", "<", "String", ">", "parseChain", "(", "InputStream", "inStream", ")", "throws", "IOException", ",", "SAXException", "{", "try", "{", "Document", "xmlDoc", "=", "DocumentBuilderFactory", ".", "newInstance", "(", ")", ".", "newDocumentB...
This method parses the chain from the given {@code inStream}. The XML contained in {@code inStream} needs to contain the chain rules as child-nodes of the {@link Document#getDocumentElement() root-element}. The name of the root-element is ignored (use e.g. "chain"). @param inStream is the stream containing the XML to parse. It will be closed by this method (on success as well as in an exceptional state). @return the parsed filter rule. @throws IOException if an input/output error occurred. @throws SAXException if the {@code inStream} contains invalid XML.
[ "This", "method", "parses", "the", "chain", "from", "the", "given", "{", "@code", "inStream", "}", ".", "The", "XML", "contained", "in", "{", "@code", "inStream", "}", "needs", "to", "contain", "the", "chain", "rules", "as", "child", "-", "nodes", "of", ...
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/core/src/main/java/net/sf/mmm/util/filter/base/FilterRuleChainXmlParser.java#L110-L120
grails/grails-core
grails-spring/src/main/groovy/grails/spring/BeanBuilder.java
BeanBuilder.loadBeans
public void loadBeans(Resource[] resources) { @SuppressWarnings("rawtypes") Closure beans = new Closure(this) { private static final long serialVersionUID = -2778328821635253740L; @Override public Object call(Object... args) { invokeBeanDefiningClosure((Closure)args[0]); return null; } }; Binding b = new Binding() { @Override public void setVariable(String name, Object value) { if (currentBeanConfig == null) { super.setVariable(name, value); } else { setPropertyOnBeanConfig(name, value); } } }; b.setVariable("beans", beans); for (Resource resource : resources) { try { GroovyShell shell = classLoader == null ? new GroovyShell(b) : new GroovyShell(classLoader, b); shell.evaluate(new InputStreamReader(resource.getInputStream(), "UTF-8")); } catch (Throwable e) { throw new BeanDefinitionParsingException( new Problem("Error evaluating bean definition script: " + e.getMessage(), new Location(resource), null, e)); } } }
java
public void loadBeans(Resource[] resources) { @SuppressWarnings("rawtypes") Closure beans = new Closure(this) { private static final long serialVersionUID = -2778328821635253740L; @Override public Object call(Object... args) { invokeBeanDefiningClosure((Closure)args[0]); return null; } }; Binding b = new Binding() { @Override public void setVariable(String name, Object value) { if (currentBeanConfig == null) { super.setVariable(name, value); } else { setPropertyOnBeanConfig(name, value); } } }; b.setVariable("beans", beans); for (Resource resource : resources) { try { GroovyShell shell = classLoader == null ? new GroovyShell(b) : new GroovyShell(classLoader, b); shell.evaluate(new InputStreamReader(resource.getInputStream(), "UTF-8")); } catch (Throwable e) { throw new BeanDefinitionParsingException( new Problem("Error evaluating bean definition script: " + e.getMessage(), new Location(resource), null, e)); } } }
[ "public", "void", "loadBeans", "(", "Resource", "[", "]", "resources", ")", "{", "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "Closure", "beans", "=", "new", "Closure", "(", "this", ")", "{", "private", "static", "final", "long", "serialVersionUID", "=...
Loads a set of given beans @param resources The resources to load @throws IOException Thrown if there is an error reading one of the passes resources
[ "Loads", "a", "set", "of", "given", "beans" ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-spring/src/main/groovy/grails/spring/BeanBuilder.java#L453-L487
citiususc/hipster
hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java
Maze2D.putObstacleRectangle
public void putObstacleRectangle(Point a, Point b) { updateRectangle(a, b, Symbol.OCCUPIED); }
java
public void putObstacleRectangle(Point a, Point b) { updateRectangle(a, b, Symbol.OCCUPIED); }
[ "public", "void", "putObstacleRectangle", "(", "Point", "a", ",", "Point", "b", ")", "{", "updateRectangle", "(", "a", ",", "b", ",", "Symbol", ".", "OCCUPIED", ")", ";", "}" ]
Fill a rectangle defined by points a and b with occupied tiles. @param a point a of the rectangle. @param b point b of the rectangle.
[ "Fill", "a", "rectangle", "defined", "by", "points", "a", "and", "b", "with", "occupied", "tiles", "." ]
train
https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java#L296-L298
sshtools/j2ssh-maverick
j2ssh-maverick/src/main/java/com/sshtools/publickey/AbstractKnownHostsKeyVerification.java
AbstractKnownHostsKeyVerification.verifyHost
public boolean verifyHost(String host, SshPublicKey pk) throws SshException { return verifyHost(host, pk, true); }
java
public boolean verifyHost(String host, SshPublicKey pk) throws SshException { return verifyHost(host, pk, true); }
[ "public", "boolean", "verifyHost", "(", "String", "host", ",", "SshPublicKey", "pk", ")", "throws", "SshException", "{", "return", "verifyHost", "(", "host", ",", "pk", ",", "true", ")", ";", "}" ]
<p> Verifies a host key against the list of known_hosts. </p> <p> If the host unknown or the key does not match the currently allowed host key the abstract <code>onUnknownHost</code> or <code>onHostKeyMismatch</code> methods are called so that the caller may identify and allow the host. </p> @param host the name of the host @param pk the host key supplied @return true if the host is accepted, otherwise false @throws SshException if an error occurs @since 0.2.0
[ "<p", ">", "Verifies", "a", "host", "key", "against", "the", "list", "of", "known_hosts", ".", "<", "/", "p", ">" ]
train
https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/publickey/AbstractKnownHostsKeyVerification.java#L419-L421
alkacon/opencms-core
src/org/opencms/db/CmsUserSettings.java
CmsUserSettings.setPreferredEditor
public void setPreferredEditor(String resourceType, String editorUri) { if (editorUri == null) { m_editorSettings.remove(resourceType); } else { m_editorSettings.put(resourceType, editorUri); } }
java
public void setPreferredEditor(String resourceType, String editorUri) { if (editorUri == null) { m_editorSettings.remove(resourceType); } else { m_editorSettings.put(resourceType, editorUri); } }
[ "public", "void", "setPreferredEditor", "(", "String", "resourceType", ",", "String", "editorUri", ")", "{", "if", "(", "editorUri", "==", "null", ")", "{", "m_editorSettings", ".", "remove", "(", "resourceType", ")", ";", "}", "else", "{", "m_editorSettings",...
Sets the preferred editor for the given resource type of the user.<p> @param resourceType the resource type @param editorUri the editor URI
[ "Sets", "the", "preferred", "editor", "for", "the", "given", "resource", "type", "of", "the", "user", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsUserSettings.java#L1969-L1976
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/ControlMessageFactoryImpl.java
ControlMessageFactoryImpl.createInboundControlMessage
public final ControlMessage createInboundControlMessage(byte rawMessage[], int offset, int length) throws MessageDecodeFailedException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())SibTr.entry(tc, "createInboundControlMessage", new Object[]{ rawMessage, Integer.valueOf(offset), Integer.valueOf(length)}); JsMsgObject jmo = new JsMsgObject(ControlAccess.schema, rawMessage, offset, length); /* We need to return an instance of the appropriate specialisation. */ ControlMessage message = makeInboundControlMessage(jmo, ((Byte)jmo.getField(ControlAccess.SUBTYPE)).intValue()); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createInboundControlMessage", message); return message; }
java
public final ControlMessage createInboundControlMessage(byte rawMessage[], int offset, int length) throws MessageDecodeFailedException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())SibTr.entry(tc, "createInboundControlMessage", new Object[]{ rawMessage, Integer.valueOf(offset), Integer.valueOf(length)}); JsMsgObject jmo = new JsMsgObject(ControlAccess.schema, rawMessage, offset, length); /* We need to return an instance of the appropriate specialisation. */ ControlMessage message = makeInboundControlMessage(jmo, ((Byte)jmo.getField(ControlAccess.SUBTYPE)).intValue()); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createInboundControlMessage", message); return message; }
[ "public", "final", "ControlMessage", "createInboundControlMessage", "(", "byte", "rawMessage", "[", "]", ",", "int", "offset", ",", "int", "length", ")", "throws", "MessageDecodeFailedException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")"...
Create a ControlMessage of appropriate specialization to represent an inbound message. (To be called by the Communications component.) @param rawMessage The inbound byte array containging a complete message @param offset The offset within the byte array at which the message begins @param length The length of the message within the byte array @return An new instance of a sub-class of ControlMessage @exception MessageDecodeFailedException Thrown if the inbound message could not be decoded
[ "Create", "a", "ControlMessage", "of", "appropriate", "specialization", "to", "represent", "an", "inbound", "message", ".", "(", "To", "be", "called", "by", "the", "Communications", "component", ".", ")" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/ControlMessageFactoryImpl.java#L787-L800
facebook/fresco
fbcore/src/main/java/com/facebook/common/activitylistener/ActivityListenerManager.java
ActivityListenerManager.register
public static void register(ActivityListener activityListener, Context context) { ListenableActivity activity = getListenableActivity(context); if (activity != null) { Listener listener = new Listener(activityListener); activity.addActivityListener(listener); } }
java
public static void register(ActivityListener activityListener, Context context) { ListenableActivity activity = getListenableActivity(context); if (activity != null) { Listener listener = new Listener(activityListener); activity.addActivityListener(listener); } }
[ "public", "static", "void", "register", "(", "ActivityListener", "activityListener", ",", "Context", "context", ")", "{", "ListenableActivity", "activity", "=", "getListenableActivity", "(", "context", ")", ";", "if", "(", "activity", "!=", "null", ")", "{", "Li...
If given context is an instance of ListenableActivity then creates new instance of WeakReferenceActivityListenerAdapter and adds it to activity's listeners
[ "If", "given", "context", "is", "an", "instance", "of", "ListenableActivity", "then", "creates", "new", "instance", "of", "WeakReferenceActivityListenerAdapter", "and", "adds", "it", "to", "activity", "s", "listeners" ]
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/fbcore/src/main/java/com/facebook/common/activitylistener/ActivityListenerManager.java#L29-L35
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodePolynomialMath.java
QrCodePolynomialMath.decodeFormatMessage
public static void decodeFormatMessage(int message , QrCode qr ) { int error = message >> 3; qr.error = QrCode.ErrorLevel.lookup(error); qr.mask = QrCodeMaskPattern.lookupMask(message&0x07); }
java
public static void decodeFormatMessage(int message , QrCode qr ) { int error = message >> 3; qr.error = QrCode.ErrorLevel.lookup(error); qr.mask = QrCodeMaskPattern.lookupMask(message&0x07); }
[ "public", "static", "void", "decodeFormatMessage", "(", "int", "message", ",", "QrCode", "qr", ")", "{", "int", "error", "=", "message", ">>", "3", ";", "qr", ".", "error", "=", "QrCode", ".", "ErrorLevel", ".", "lookup", "(", "error", ")", ";", "qr", ...
Assumes that the format message has no errors in it and decodes its data and saves it into the qr code @param message format data bits after the mask has been remove and shifted over 10 bits @param qr Where the results are written to
[ "Assumes", "that", "the", "format", "message", "has", "no", "errors", "in", "it", "and", "decodes", "its", "data", "and", "saves", "it", "into", "the", "qr", "code" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodePolynomialMath.java#L94-L99
jmeetsma/Iglu-Util
src/main/java/org/ijsberg/iglu/util/misc/StringSupport.java
StringSupport.isAlphaNumericOrContainsOnlyCharacters
public static boolean isAlphaNumericOrContainsOnlyCharacters(String in, String chars) { char c = 0; for (int i = 0; i < in.length(); i++) { c = in.charAt(i); if (Character.isLetterOrDigit(c) == (chars.indexOf(c) != -1)) { return false; } } return true; }
java
public static boolean isAlphaNumericOrContainsOnlyCharacters(String in, String chars) { char c = 0; for (int i = 0; i < in.length(); i++) { c = in.charAt(i); if (Character.isLetterOrDigit(c) == (chars.indexOf(c) != -1)) { return false; } } return true; }
[ "public", "static", "boolean", "isAlphaNumericOrContainsOnlyCharacters", "(", "String", "in", ",", "String", "chars", ")", "{", "char", "c", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "in", ".", "length", "(", ")", ";", "i", "++"...
tells whether all characters in a String are letters or digits or part of a given String @param in String to evaluate @param chars characters which are allowed in the given String
[ "tells", "whether", "all", "characters", "in", "a", "String", "are", "letters", "or", "digits", "or", "part", "of", "a", "given", "String" ]
train
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/misc/StringSupport.java#L397-L406
nostra13/Android-Universal-Image-Loader
library/src/main/java/com/nostra13/universalimageloader/core/ImageLoaderEngine.java
ImageLoaderEngine.prepareDisplayTaskFor
void prepareDisplayTaskFor(ImageAware imageAware, String memoryCacheKey) { cacheKeysForImageAwares.put(imageAware.getId(), memoryCacheKey); }
java
void prepareDisplayTaskFor(ImageAware imageAware, String memoryCacheKey) { cacheKeysForImageAwares.put(imageAware.getId(), memoryCacheKey); }
[ "void", "prepareDisplayTaskFor", "(", "ImageAware", "imageAware", ",", "String", "memoryCacheKey", ")", "{", "cacheKeysForImageAwares", ".", "put", "(", "imageAware", ".", "getId", "(", ")", ",", "memoryCacheKey", ")", ";", "}" ]
Associates <b>memoryCacheKey</b> with <b>imageAware</b>. Then it helps to define image URI is loaded into View at exact moment.
[ "Associates", "<b", ">", "memoryCacheKey<", "/", "b", ">", "with", "<b", ">", "imageAware<", "/", "b", ">", ".", "Then", "it", "helps", "to", "define", "image", "URI", "is", "loaded", "into", "View", "at", "exact", "moment", "." ]
train
https://github.com/nostra13/Android-Universal-Image-Loader/blob/fc3c5f6779bb4f702e233653b61bd9d559e345cc/library/src/main/java/com/nostra13/universalimageloader/core/ImageLoaderEngine.java#L117-L119
igniterealtime/Smack
smack-core/src/main/java/org/jivesoftware/smack/packet/AbstractError.java
AbstractError.getExtension
public <PE extends ExtensionElement> PE getExtension(String elementName, String namespace) { return PacketUtil.extensionElementFrom(extensions, elementName, namespace); }
java
public <PE extends ExtensionElement> PE getExtension(String elementName, String namespace) { return PacketUtil.extensionElementFrom(extensions, elementName, namespace); }
[ "public", "<", "PE", "extends", "ExtensionElement", ">", "PE", "getExtension", "(", "String", "elementName", ",", "String", "namespace", ")", "{", "return", "PacketUtil", ".", "extensionElementFrom", "(", "extensions", ",", "elementName", ",", "namespace", ")", ...
Returns the first stanza extension that matches the specified element name and namespace, or <tt>null</tt> if it doesn't exist. @param elementName the XML element name of the stanza extension. @param namespace the XML element namespace of the stanza extension. @param <PE> type of the ExtensionElement. @return the extension, or <tt>null</tt> if it doesn't exist.
[ "Returns", "the", "first", "stanza", "extension", "that", "matches", "the", "specified", "element", "name", "and", "namespace", "or", "<tt", ">", "null<", "/", "tt", ">", "if", "it", "doesn", "t", "exist", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/packet/AbstractError.java#L103-L105
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/KeyArea.java
KeyArea.setupKeyBuffer
public void setupKeyBuffer(BaseBuffer destBuffer, int iAreaDesc, boolean bMoveToField) { boolean bForceUniqueKey = true; int iKeyFieldCount = this.getKeyFields(bForceUniqueKey, false); for (int iKeyFieldSeq = DBConstants.MAIN_KEY_FIELD; iKeyFieldSeq < iKeyFieldCount; iKeyFieldSeq++) { KeyField keyField = this.getKeyField(iKeyFieldSeq, bForceUniqueKey); BaseField field = keyField.getField(DBConstants.FILE_KEY_AREA); BaseField paramField = keyField.getField(iAreaDesc); if (bMoveToField) if (iAreaDesc != DBConstants.FILE_KEY_AREA) // Don't move this they are the same field { paramField.moveFieldToThis(field, DBConstants.DONT_DISPLAY, DBConstants.INIT_MOVE); // opy the value boolean bIsModified = field.isModified(); paramField.setModified(bIsModified); } if (destBuffer != null) { // Copy to buffer also? destBuffer.addNextField(paramField); } } if (destBuffer != null) destBuffer.finishBuffer(); }
java
public void setupKeyBuffer(BaseBuffer destBuffer, int iAreaDesc, boolean bMoveToField) { boolean bForceUniqueKey = true; int iKeyFieldCount = this.getKeyFields(bForceUniqueKey, false); for (int iKeyFieldSeq = DBConstants.MAIN_KEY_FIELD; iKeyFieldSeq < iKeyFieldCount; iKeyFieldSeq++) { KeyField keyField = this.getKeyField(iKeyFieldSeq, bForceUniqueKey); BaseField field = keyField.getField(DBConstants.FILE_KEY_AREA); BaseField paramField = keyField.getField(iAreaDesc); if (bMoveToField) if (iAreaDesc != DBConstants.FILE_KEY_AREA) // Don't move this they are the same field { paramField.moveFieldToThis(field, DBConstants.DONT_DISPLAY, DBConstants.INIT_MOVE); // opy the value boolean bIsModified = field.isModified(); paramField.setModified(bIsModified); } if (destBuffer != null) { // Copy to buffer also? destBuffer.addNextField(paramField); } } if (destBuffer != null) destBuffer.finishBuffer(); }
[ "public", "void", "setupKeyBuffer", "(", "BaseBuffer", "destBuffer", ",", "int", "iAreaDesc", ",", "boolean", "bMoveToField", ")", "{", "boolean", "bForceUniqueKey", "=", "true", ";", "int", "iKeyFieldCount", "=", "this", ".", "getKeyFields", "(", "bForceUniqueKey...
Set up the key area indicated. Remember to clear the destBuffer first. @param destBuffer A BaseBuffer to fill with data (ignore if null). @param iAreaDesc The (optional) temporary area to copy the current fields to. @param bMoveToField If true, move the param field to the field (default).
[ "Set", "up", "the", "key", "area", "indicated", ".", "Remember", "to", "clear", "the", "destBuffer", "first", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/KeyArea.java#L481-L504
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/util/Components.java
Components.getComponentClasses
public static List<Class<?>> getComponentClasses(URL jar) throws IOException { JarInputStream jarFile = new JarInputStream(jar.openStream()); URLClassLoader cl = new URLClassLoader(new URL[]{jar}, Thread.currentThread().getContextClassLoader()); List<Class<?>> idx = new ArrayList<Class<?>>(); JarEntry jarEntry = jarFile.getNextJarEntry(); while (jarEntry != null) { String classname = jarEntry.getName(); // System.out.println(classname); if (classname.endsWith(".class")) { classname = classname.substring(0, classname.indexOf(".class")).replace('/', '.'); try { Class<?> c = Class.forName(classname, false, cl); for (Method method : c.getMethods()) { if ((method.getAnnotation(Execute.class)) != null) { idx.add(c); break; } } } catch (ClassNotFoundException ex) { ex.printStackTrace(); } } jarEntry = jarFile.getNextJarEntry(); } jarFile.close(); return idx; }
java
public static List<Class<?>> getComponentClasses(URL jar) throws IOException { JarInputStream jarFile = new JarInputStream(jar.openStream()); URLClassLoader cl = new URLClassLoader(new URL[]{jar}, Thread.currentThread().getContextClassLoader()); List<Class<?>> idx = new ArrayList<Class<?>>(); JarEntry jarEntry = jarFile.getNextJarEntry(); while (jarEntry != null) { String classname = jarEntry.getName(); // System.out.println(classname); if (classname.endsWith(".class")) { classname = classname.substring(0, classname.indexOf(".class")).replace('/', '.'); try { Class<?> c = Class.forName(classname, false, cl); for (Method method : c.getMethods()) { if ((method.getAnnotation(Execute.class)) != null) { idx.add(c); break; } } } catch (ClassNotFoundException ex) { ex.printStackTrace(); } } jarEntry = jarFile.getNextJarEntry(); } jarFile.close(); return idx; }
[ "public", "static", "List", "<", "Class", "<", "?", ">", ">", "getComponentClasses", "(", "URL", "jar", ")", "throws", "IOException", "{", "JarInputStream", "jarFile", "=", "new", "JarInputStream", "(", "jar", ".", "openStream", "(", ")", ")", ";", "URLCla...
Get all components from a jar file @param jar @return the list of components from the jar. (Implement 'Execute' annotation) @throws IOException @throws ClassNotFoundException
[ "Get", "all", "components", "from", "a", "jar", "file" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/util/Components.java#L304-L331
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/ZipUtil.java
ZipUtil.getCompressionMethodOfEntry
public static int getCompressionMethodOfEntry(File zip, String name) { ZipFile zf = null; try { zf = new ZipFile(zip); ZipEntry zipEntry = zf.getEntry(name); if (zipEntry == null) { return -1; } return zipEntry.getMethod(); } catch (IOException e) { throw ZipExceptionUtil.rethrow(e); } finally { closeQuietly(zf); } }
java
public static int getCompressionMethodOfEntry(File zip, String name) { ZipFile zf = null; try { zf = new ZipFile(zip); ZipEntry zipEntry = zf.getEntry(name); if (zipEntry == null) { return -1; } return zipEntry.getMethod(); } catch (IOException e) { throw ZipExceptionUtil.rethrow(e); } finally { closeQuietly(zf); } }
[ "public", "static", "int", "getCompressionMethodOfEntry", "(", "File", "zip", ",", "String", "name", ")", "{", "ZipFile", "zf", "=", "null", ";", "try", "{", "zf", "=", "new", "ZipFile", "(", "zip", ")", ";", "ZipEntry", "zipEntry", "=", "zf", ".", "ge...
Returns the compression method of a given entry of the ZIP file. @param zip ZIP file. @param name entry name. @return Returns <code>ZipEntry.STORED</code>, <code>ZipEntry.DEFLATED</code> or -1 if the ZIP file does not contain the given entry.
[ "Returns", "the", "compression", "method", "of", "a", "given", "entry", "of", "the", "ZIP", "file", "." ]
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L127-L143
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/mbeans/MeterMetric.java
MeterMetric.newMeter
public static MeterMetric newMeter(ScheduledExecutorService tickThread, String eventType, TimeUnit rateUnit) { return new MeterMetric(tickThread, eventType, rateUnit); }
java
public static MeterMetric newMeter(ScheduledExecutorService tickThread, String eventType, TimeUnit rateUnit) { return new MeterMetric(tickThread, eventType, rateUnit); }
[ "public", "static", "MeterMetric", "newMeter", "(", "ScheduledExecutorService", "tickThread", ",", "String", "eventType", ",", "TimeUnit", "rateUnit", ")", "{", "return", "new", "MeterMetric", "(", "tickThread", ",", "eventType", ",", "rateUnit", ")", ";", "}" ]
Creates a new {@link MeterMetric}. @param tickThread background thread for updating the rates @param eventType the plural name of the event the meter is measuring (e.g., {@code "requests"}) @param rateUnit the rate unit of the new meter @return a new {@link MeterMetric}
[ "Creates", "a", "new", "{", "@link", "MeterMetric", "}", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/mbeans/MeterMetric.java#L44-L46
cdk/cdk
base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/matchers/Expr.java
Expr.setRecursive
private void setRecursive(Type type, IAtomContainer mol) { switch (type) { case RECURSIVE: this.type = type; this.value = 0; this.left = null; this.right = null; this.query = mol; this.ptrn = null; break; default: throw new IllegalArgumentException(); } }
java
private void setRecursive(Type type, IAtomContainer mol) { switch (type) { case RECURSIVE: this.type = type; this.value = 0; this.left = null; this.right = null; this.query = mol; this.ptrn = null; break; default: throw new IllegalArgumentException(); } }
[ "private", "void", "setRecursive", "(", "Type", "type", ",", "IAtomContainer", "mol", ")", "{", "switch", "(", "type", ")", "{", "case", "RECURSIVE", ":", "this", ".", "type", "=", "type", ";", "this", ".", "value", "=", "0", ";", "this", ".", "left"...
Set the recursive value of this atom expression. @param type the type of expression @param mol the recursive pattern
[ "Set", "the", "recursive", "value", "of", "this", "atom", "expression", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/matchers/Expr.java#L631-L644
gosu-lang/gosu-lang
gosu-core-api/src/main/java/gw/util/GosuStringUtil.java
GosuStringUtil.deleteWhitespace
public static String deleteWhitespace(String str) { if (isEmpty(str)) { return str; } int sz = str.length(); char[] chs = new char[sz]; int count = 0; for (int i = 0; i < sz; i++) { if (!Character.isWhitespace(str.charAt(i))) { chs[count++] = str.charAt(i); } } if (count == sz) { return str; } return new String(chs, 0, count); }
java
public static String deleteWhitespace(String str) { if (isEmpty(str)) { return str; } int sz = str.length(); char[] chs = new char[sz]; int count = 0; for (int i = 0; i < sz; i++) { if (!Character.isWhitespace(str.charAt(i))) { chs[count++] = str.charAt(i); } } if (count == sz) { return str; } return new String(chs, 0, count); }
[ "public", "static", "String", "deleteWhitespace", "(", "String", "str", ")", "{", "if", "(", "isEmpty", "(", "str", ")", ")", "{", "return", "str", ";", "}", "int", "sz", "=", "str", ".", "length", "(", ")", ";", "char", "[", "]", "chs", "=", "ne...
<p>Deletes all whitespaces from a String as defined by {@link Character#isWhitespace(char)}.</p> <pre> GosuStringUtil.deleteWhitespace(null) = null GosuStringUtil.deleteWhitespace("") = "" GosuStringUtil.deleteWhitespace("abc") = "abc" GosuStringUtil.deleteWhitespace(" ab c ") = "abc" </pre> @param str the String to delete whitespace from, may be null @return the String without whitespaces, <code>null</code> if null String input
[ "<p", ">", "Deletes", "all", "whitespaces", "from", "a", "String", "as", "defined", "by", "{", "@link", "Character#isWhitespace", "(", "char", ")", "}", ".", "<", "/", "p", ">" ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/GosuStringUtil.java#L3121-L3137
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/Base.java
Base.withDb
public static <T> T withDb(String jndiName, Supplier<T> supplier) { return new DB(DB.DEFAULT_NAME).withDb(jndiName, supplier); }
java
public static <T> T withDb(String jndiName, Supplier<T> supplier) { return new DB(DB.DEFAULT_NAME).withDb(jndiName, supplier); }
[ "public", "static", "<", "T", ">", "T", "withDb", "(", "String", "jndiName", ",", "Supplier", "<", "T", ">", "supplier", ")", "{", "return", "new", "DB", "(", "DB", ".", "DEFAULT_NAME", ")", ".", "withDb", "(", "jndiName", ",", "supplier", ")", ";", ...
Same as {@link DB#withDb(String, Supplier)}, but with db name {@link DB#DEFAULT_NAME}.
[ "Same", "as", "{" ]
train
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/Base.java#L406-L408
auth0/Auth0.Android
auth0/src/main/java/com/auth0/android/authentication/storage/CryptoUtil.java
CryptoUtil.RSADecrypt
@VisibleForTesting byte[] RSADecrypt(byte[] encryptedInput) throws IncompatibleDeviceException, CryptoException { try { PrivateKey privateKey = getRSAKeyEntry().getPrivateKey(); Cipher cipher = Cipher.getInstance(RSA_TRANSFORMATION); cipher.init(Cipher.DECRYPT_MODE, privateKey); return cipher.doFinal(encryptedInput); } catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException e) { /* * This exceptions are safe to be ignored: * * - NoSuchPaddingException: * Thrown if PKCS1Padding is not available. Was introduced in API 1. * - NoSuchAlgorithmException: * Thrown if the transformation is null, empty or invalid, or if no security provider * implements it. Was introduced in API 1. * - InvalidKeyException: * Thrown if the given key is inappropriate for initializing this cipher. * * Read more in https://developer.android.com/reference/javax/crypto/Cipher */ Log.e(TAG, "The device can't decrypt input using a RSA Key.", e); throw new IncompatibleDeviceException(e); } catch (IllegalBlockSizeException | BadPaddingException e) { /* * Any of this exceptions mean the encrypted input is somehow corrupted and cannot be recovered. * Delete the AES keys since those originated the input. * * - IllegalBlockSizeException: * Thrown only on encrypt mode. * - BadPaddingException: * Thrown if the input doesn't contain the proper padding bytes. * */ deleteAESKeys(); throw new CryptoException("The RSA encrypted input is corrupted and cannot be recovered. Please discard it.", e); } }
java
@VisibleForTesting byte[] RSADecrypt(byte[] encryptedInput) throws IncompatibleDeviceException, CryptoException { try { PrivateKey privateKey = getRSAKeyEntry().getPrivateKey(); Cipher cipher = Cipher.getInstance(RSA_TRANSFORMATION); cipher.init(Cipher.DECRYPT_MODE, privateKey); return cipher.doFinal(encryptedInput); } catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException e) { /* * This exceptions are safe to be ignored: * * - NoSuchPaddingException: * Thrown if PKCS1Padding is not available. Was introduced in API 1. * - NoSuchAlgorithmException: * Thrown if the transformation is null, empty or invalid, or if no security provider * implements it. Was introduced in API 1. * - InvalidKeyException: * Thrown if the given key is inappropriate for initializing this cipher. * * Read more in https://developer.android.com/reference/javax/crypto/Cipher */ Log.e(TAG, "The device can't decrypt input using a RSA Key.", e); throw new IncompatibleDeviceException(e); } catch (IllegalBlockSizeException | BadPaddingException e) { /* * Any of this exceptions mean the encrypted input is somehow corrupted and cannot be recovered. * Delete the AES keys since those originated the input. * * - IllegalBlockSizeException: * Thrown only on encrypt mode. * - BadPaddingException: * Thrown if the input doesn't contain the proper padding bytes. * */ deleteAESKeys(); throw new CryptoException("The RSA encrypted input is corrupted and cannot be recovered. Please discard it.", e); } }
[ "@", "VisibleForTesting", "byte", "[", "]", "RSADecrypt", "(", "byte", "[", "]", "encryptedInput", ")", "throws", "IncompatibleDeviceException", ",", "CryptoException", "{", "try", "{", "PrivateKey", "privateKey", "=", "getRSAKeyEntry", "(", ")", ".", "getPrivateK...
Decrypts the given input using a generated RSA Private Key. Used to decrypt the AES key for later usage. @param encryptedInput the input bytes to decrypt @return the decrypted bytes output @throws IncompatibleDeviceException in the event the device can't understand the cryptographic settings required @throws CryptoException if the stored RSA keys can't be recovered and should be deemed invalid
[ "Decrypts", "the", "given", "input", "using", "a", "generated", "RSA", "Private", "Key", ".", "Used", "to", "decrypt", "the", "AES", "key", "for", "later", "usage", "." ]
train
https://github.com/auth0/Auth0.Android/blob/ee37b7f94d989c1fbab2cb1378c87fdcaf7a8156/auth0/src/main/java/com/auth0/android/authentication/storage/CryptoUtil.java#L246-L283
cdk/cdk
tool/smarts/src/main/java/org/openscience/cdk/smarts/SmartsFragmentExtractor.java
SmartsFragmentExtractor.markRings
private void markRings(int idx, int bprev) { avisit[idx] = numVisit++; final int d = deg[idx]; for (int j = 0; j < d; j++) { int nbr = atomAdj[idx][j]; int bidx = bondAdj[idx][j]; if (avisit[nbr] == 0 || bidx == bprev) continue; // ignored else if (avisit[nbr] < 0) markRings(nbr, bidx); else if (avisit[nbr] < avisit[idx]) rbnds[bidx] = -1; // ring closure } }
java
private void markRings(int idx, int bprev) { avisit[idx] = numVisit++; final int d = deg[idx]; for (int j = 0; j < d; j++) { int nbr = atomAdj[idx][j]; int bidx = bondAdj[idx][j]; if (avisit[nbr] == 0 || bidx == bprev) continue; // ignored else if (avisit[nbr] < 0) markRings(nbr, bidx); else if (avisit[nbr] < avisit[idx]) rbnds[bidx] = -1; // ring closure } }
[ "private", "void", "markRings", "(", "int", "idx", ",", "int", "bprev", ")", "{", "avisit", "[", "idx", "]", "=", "numVisit", "++", ";", "final", "int", "d", "=", "deg", "[", "idx", "]", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "...
Recursively marks ring closures (back edges) in the {@link #rbnds} array in a depth first order. @param idx atom index @param bprev previous bond
[ "Recursively", "marks", "ring", "closures", "(", "back", "edges", ")", "in", "the", "{", "@link", "#rbnds", "}", "array", "in", "a", "depth", "first", "order", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/smarts/src/main/java/org/openscience/cdk/smarts/SmartsFragmentExtractor.java#L244-L257
op4j/op4j
src/main/java/org/op4j/Op.java
Op.onArray
public static <T> Level0ArrayOperator<BigDecimal[],BigDecimal> onArray(final BigDecimal[] target) { return onArrayOf(Types.BIG_DECIMAL, target); }
java
public static <T> Level0ArrayOperator<BigDecimal[],BigDecimal> onArray(final BigDecimal[] target) { return onArrayOf(Types.BIG_DECIMAL, target); }
[ "public", "static", "<", "T", ">", "Level0ArrayOperator", "<", "BigDecimal", "[", "]", ",", "BigDecimal", ">", "onArray", "(", "final", "BigDecimal", "[", "]", "target", ")", "{", "return", "onArrayOf", "(", "Types", ".", "BIG_DECIMAL", ",", "target", ")",...
<p> Creates an <i>operation expression</i> on the specified target object. </p> @param target the target object on which the expression will execute @return an operator, ready for chaining
[ "<p", ">", "Creates", "an", "<i", ">", "operation", "expression<", "/", "i", ">", "on", "the", "specified", "target", "object", ".", "<", "/", "p", ">" ]
train
https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/Op.java#L793-L795
WiQuery/wiquery
wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/themes/ThemeUiHelper.java
ThemeUiHelper.iconComponent
public static void iconComponent(Component component, IconEnum iconEnum) { component.add(AttributeModifier.append("class", "ui-icon " + iconEnum.getCssClass())); }
java
public static void iconComponent(Component component, IconEnum iconEnum) { component.add(AttributeModifier.append("class", "ui-icon " + iconEnum.getCssClass())); }
[ "public", "static", "void", "iconComponent", "(", "Component", "component", ",", "IconEnum", "iconEnum", ")", "{", "component", ".", "add", "(", "AttributeModifier", ".", "append", "(", "\"class\"", ",", "\"ui-icon \"", "+", "iconEnum", ".", "getCssClass", "(", ...
Method to display your composant as an icon @param component Wicket component @param iconEnum Icon to display
[ "Method", "to", "display", "your", "composant", "as", "an", "icon" ]
train
https://github.com/WiQuery/wiquery/blob/1b8d60c7a3c37b90fd68c9cd0ff97178fcbcbb08/wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/themes/ThemeUiHelper.java#L345-L348
astrapi69/jaulp-wicket
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/form/checkbox/CheckGroupSelectorPanel.java
CheckGroupSelectorPanel.newChoices
protected ListView<T> newChoices(final String id, final IModel<CheckboxModelBean<T>> model) { final ListView<T> choices = new ListView<T>("choices", model.getObject().getChoices()) { /** The serialVersionUID. */ private static final long serialVersionUID = 1L; /** * {@inheritDoc} */ @Override protected void populateItem(final ListItem<T> item) { item.add(new Check<>("checkbox", item.getModel())); item.add(new Label("label", new PropertyModel<String>(item.getDefaultModel(), model.getObject().getLabelPropertyExpression()))); } }; choices.setReuseItems(true); return choices; }
java
protected ListView<T> newChoices(final String id, final IModel<CheckboxModelBean<T>> model) { final ListView<T> choices = new ListView<T>("choices", model.getObject().getChoices()) { /** The serialVersionUID. */ private static final long serialVersionUID = 1L; /** * {@inheritDoc} */ @Override protected void populateItem(final ListItem<T> item) { item.add(new Check<>("checkbox", item.getModel())); item.add(new Label("label", new PropertyModel<String>(item.getDefaultModel(), model.getObject().getLabelPropertyExpression()))); } }; choices.setReuseItems(true); return choices; }
[ "protected", "ListView", "<", "T", ">", "newChoices", "(", "final", "String", "id", ",", "final", "IModel", "<", "CheckboxModelBean", "<", "T", ">", ">", "model", ")", "{", "final", "ListView", "<", "T", ">", "choices", "=", "new", "ListView", "<", "T"...
Factory method for creating the new {@link ListView} for the choices. This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of the new {@link ListView} for the choices. @param id the id @param model the model @return the new {@link ListView} for the choices.
[ "Factory", "method", "for", "creating", "the", "new", "{", "@link", "ListView", "}", "for", "the", "choices", ".", "This", "method", "is", "invoked", "in", "the", "constructor", "from", "the", "derived", "classes", "and", "can", "be", "overridden", "so", "...
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/form/checkbox/CheckGroupSelectorPanel.java#L186-L206
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/attributedefinition/attributes/AttributeVocabularyValueUrl.java
AttributeVocabularyValueUrl.addAttributeVocabularyValueUrl
public static MozuUrl addAttributeVocabularyValueUrl(String attributeFQN, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/VocabularyValues?responseFields={responseFields}"); formatter.formatUrl("attributeFQN", attributeFQN); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl addAttributeVocabularyValueUrl(String attributeFQN, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/VocabularyValues?responseFields={responseFields}"); formatter.formatUrl("attributeFQN", attributeFQN); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "addAttributeVocabularyValueUrl", "(", "String", "attributeFQN", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/Vo...
Get Resource Url for AddAttributeVocabularyValue @param attributeFQN Fully qualified name for an attribute. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "AddAttributeVocabularyValue" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/attributedefinition/attributes/AttributeVocabularyValueUrl.java#L98-L104
etnetera/seb
src/main/java/cz/etnetera/seb/SebContextWait.java
SebContextWait.untilValid
public <V> V untilValid(Function<SebContext, V> isTrue) { return super.until(new com.google.common.base.Function<SebContext, V>() { @Override public V apply(SebContext input) { return isTrue.apply(input); } }); }
java
public <V> V untilValid(Function<SebContext, V> isTrue) { return super.until(new com.google.common.base.Function<SebContext, V>() { @Override public V apply(SebContext input) { return isTrue.apply(input); } }); }
[ "public", "<", "V", ">", "V", "untilValid", "(", "Function", "<", "SebContext", ",", "V", ">", "isTrue", ")", "{", "return", "super", ".", "until", "(", "new", "com", ".", "google", ".", "common", ".", "base", ".", "Function", "<", "SebContext", ",",...
Until method using function functional interface. It solves ambiguity when using basic until method without typed parameter. Repeatedly applies this instance's input value to the given function until one of the following occurs: <ol> <li>the function returns neither null nor false,</li> <li>the function throws an unignored exception,</li> <li>the timeout expires, <li> <li>the current thread is interrupted</li> </ol> @param isTrue the parameter to pass to the {@link ExpectedCondition} @param <V> The function's expected return type. @return The functions' return value if the function returned something different from null or false before the timeout expired. @throws TimeoutException If the timeout expires.
[ "Until", "method", "using", "function", "functional", "interface", ".", "It", "solves", "ambiguity", "when", "using", "basic", "until", "method", "without", "typed", "parameter", "." ]
train
https://github.com/etnetera/seb/blob/6aed29c7726db12f440c60cfd253de229064ed04/src/main/java/cz/etnetera/seb/SebContextWait.java#L125-L132
Ordinastie/MalisisCore
src/main/java/net/malisis/core/item/MalisisItemBlock.java
MalisisItemBlock.onItemUse
@Override public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { ItemStack itemStack = player.getHeldItem(hand); if (itemStack.isEmpty()) return EnumActionResult.FAIL; if (!player.canPlayerEdit(pos.offset(side), side, itemStack)) return EnumActionResult.FAIL; //first check if the block clicked can be merged with the one in hand IBlockState placedState = checkMerge(itemStack, player, world, pos, side, hitX, hitY, hitZ); BlockPos p = pos; //can't merge, offset the placed position to where the block should be placed in the world if (placedState == null) { p = pos.offset(side); float x = hitX - side.getFrontOffsetX(); float y = hitY - side.getFrontOffsetY(); float z = hitZ - side.getFrontOffsetZ(); //check for merge at the new position too placedState = checkMerge(itemStack, player, world, p, side, x, y, z); } if (placedState == null) return super.onItemUse(player, world, pos, hand, side, hitX, hitY, hitZ); //block can be merged Block block = placedState.getBlock(); if (world.checkNoEntityCollision(placedState.getCollisionBoundingBox(world, p)) && world.setBlockState(p, placedState, 3)) { SoundType soundType = block.getSoundType(placedState, world, pos, player); world.playSound(player, pos, soundType.getPlaceSound(), SoundCategory.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F); itemStack.shrink(1); } return EnumActionResult.SUCCESS; }
java
@Override public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { ItemStack itemStack = player.getHeldItem(hand); if (itemStack.isEmpty()) return EnumActionResult.FAIL; if (!player.canPlayerEdit(pos.offset(side), side, itemStack)) return EnumActionResult.FAIL; //first check if the block clicked can be merged with the one in hand IBlockState placedState = checkMerge(itemStack, player, world, pos, side, hitX, hitY, hitZ); BlockPos p = pos; //can't merge, offset the placed position to where the block should be placed in the world if (placedState == null) { p = pos.offset(side); float x = hitX - side.getFrontOffsetX(); float y = hitY - side.getFrontOffsetY(); float z = hitZ - side.getFrontOffsetZ(); //check for merge at the new position too placedState = checkMerge(itemStack, player, world, p, side, x, y, z); } if (placedState == null) return super.onItemUse(player, world, pos, hand, side, hitX, hitY, hitZ); //block can be merged Block block = placedState.getBlock(); if (world.checkNoEntityCollision(placedState.getCollisionBoundingBox(world, p)) && world.setBlockState(p, placedState, 3)) { SoundType soundType = block.getSoundType(placedState, world, pos, player); world.playSound(player, pos, soundType.getPlaceSound(), SoundCategory.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F); itemStack.shrink(1); } return EnumActionResult.SUCCESS; }
[ "@", "Override", "public", "EnumActionResult", "onItemUse", "(", "EntityPlayer", "player", ",", "World", "world", ",", "BlockPos", "pos", ",", "EnumHand", "hand", ",", "EnumFacing", "side", ",", "float", "hitX", ",", "float", "hitY", ",", "float", "hitZ", ")...
onItemUse needs to be overriden to be able to handle merged blocks and components.
[ "onItemUse", "needs", "to", "be", "overriden", "to", "be", "able", "to", "handle", "merged", "blocks", "and", "components", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/item/MalisisItemBlock.java#L92-L133
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/util/Interval.java
Interval.isIntervalComparable
public boolean isIntervalComparable(Interval<E> other) { int flags = getRelationFlags(other); if (checkMultipleBitSet(flags & REL_FLAGS_INTERVAL_UNKNOWN)) { return false; } return checkFlagSet(flags, REL_FLAGS_INTERVAL_BEFORE) || checkFlagSet(flags, REL_FLAGS_INTERVAL_AFTER); }
java
public boolean isIntervalComparable(Interval<E> other) { int flags = getRelationFlags(other); if (checkMultipleBitSet(flags & REL_FLAGS_INTERVAL_UNKNOWN)) { return false; } return checkFlagSet(flags, REL_FLAGS_INTERVAL_BEFORE) || checkFlagSet(flags, REL_FLAGS_INTERVAL_AFTER); }
[ "public", "boolean", "isIntervalComparable", "(", "Interval", "<", "E", ">", "other", ")", "{", "int", "flags", "=", "getRelationFlags", "(", "other", ")", ";", "if", "(", "checkMultipleBitSet", "(", "flags", "&", "REL_FLAGS_INTERVAL_UNKNOWN", ")", ")", "{", ...
Checks whether this interval is comparable with another interval comes before or after @param other interval to compare with
[ "Checks", "whether", "this", "interval", "is", "comparable", "with", "another", "interval", "comes", "before", "or", "after" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/Interval.java#L590-L597
DataArt/CalculationEngine
calculation-engine/engine-converters/src/main/java/com/dataart/spreadsheetanalytics/engine/DataModelConverters.java
DataModelConverters.toXlsxFile
static OutputStream toXlsxFile(final IDataModel dataModel, final InputStream formatting) { ByteArrayOutputStream xlsx = new ByteArrayOutputStream(); try { toWorkbook(dataModel, ConverterUtils.newWorkbook(formatting)).write(xlsx); } catch (IOException e) { throw new CalculationEngineException(e); } return xlsx; }
java
static OutputStream toXlsxFile(final IDataModel dataModel, final InputStream formatting) { ByteArrayOutputStream xlsx = new ByteArrayOutputStream(); try { toWorkbook(dataModel, ConverterUtils.newWorkbook(formatting)).write(xlsx); } catch (IOException e) { throw new CalculationEngineException(e); } return xlsx; }
[ "static", "OutputStream", "toXlsxFile", "(", "final", "IDataModel", "dataModel", ",", "final", "InputStream", "formatting", ")", "{", "ByteArrayOutputStream", "xlsx", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "try", "{", "toWorkbook", "(", "dataModel", "...
Uses {@link DataModelConverters#toWorkbook(IDataModel, InputStream)} with {@link ByteArrayOutputStream} as out stream and new {@link XSSFWorkbook} as {@link InputStream} wrapper.
[ "Uses", "{" ]
train
https://github.com/DataArt/CalculationEngine/blob/34ce1d9c1f9b57a502906b274311d28580b134e5/calculation-engine/engine-converters/src/main/java/com/dataart/spreadsheetanalytics/engine/DataModelConverters.java#L154-L161
aws/aws-sdk-java
aws-java-sdk-batch/src/main/java/com/amazonaws/services/batch/model/JobDefinition.java
JobDefinition.withParameters
public JobDefinition withParameters(java.util.Map<String, String> parameters) { setParameters(parameters); return this; }
java
public JobDefinition withParameters(java.util.Map<String, String> parameters) { setParameters(parameters); return this; }
[ "public", "JobDefinition", "withParameters", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "parameters", ")", "{", "setParameters", "(", "parameters", ")", ";", "return", "this", ";", "}" ]
<p> Default parameters or parameter substitution placeholders that are set in the job definition. Parameters are specified as a key-value pair mapping. Parameters in a <code>SubmitJob</code> request override any corresponding parameter defaults from the job definition. For more information about specifying parameters, see <a href="https://docs.aws.amazon.com/batch/latest/userguide/job_definition_parameters.html">Job Definition Parameters</a> in the <i>AWS Batch User Guide</i>. </p> @param parameters Default parameters or parameter substitution placeholders that are set in the job definition. Parameters are specified as a key-value pair mapping. Parameters in a <code>SubmitJob</code> request override any corresponding parameter defaults from the job definition. For more information about specifying parameters, see <a href="https://docs.aws.amazon.com/batch/latest/userguide/job_definition_parameters.html">Job Definition Parameters</a> in the <i>AWS Batch User Guide</i>. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Default", "parameters", "or", "parameter", "substitution", "placeholders", "that", "are", "set", "in", "the", "job", "definition", ".", "Parameters", "are", "specified", "as", "a", "key", "-", "value", "pair", "mapping", ".", "Parameters", "in", ...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-batch/src/main/java/com/amazonaws/services/batch/model/JobDefinition.java#L359-L362
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/util/BuildUniqueIdentifierHelper.java
BuildUniqueIdentifierHelper.isPassIdentifiedDownstream
public static boolean isPassIdentifiedDownstream(AbstractBuild<?, ?> build) { ArtifactoryRedeployPublisher publisher = ActionableHelper.getPublisher(build.getProject(), ArtifactoryRedeployPublisher.class); if (publisher != null) { return publisher.isPassIdentifiedDownstream(); } ArtifactoryGradleConfigurator wrapper = ActionableHelper .getBuildWrapper((BuildableItemWithBuildWrappers) build.getProject(), ArtifactoryGradleConfigurator.class); return wrapper != null && wrapper.isPassIdentifiedDownstream(); }
java
public static boolean isPassIdentifiedDownstream(AbstractBuild<?, ?> build) { ArtifactoryRedeployPublisher publisher = ActionableHelper.getPublisher(build.getProject(), ArtifactoryRedeployPublisher.class); if (publisher != null) { return publisher.isPassIdentifiedDownstream(); } ArtifactoryGradleConfigurator wrapper = ActionableHelper .getBuildWrapper((BuildableItemWithBuildWrappers) build.getProject(), ArtifactoryGradleConfigurator.class); return wrapper != null && wrapper.isPassIdentifiedDownstream(); }
[ "public", "static", "boolean", "isPassIdentifiedDownstream", "(", "AbstractBuild", "<", "?", ",", "?", ">", "build", ")", "{", "ArtifactoryRedeployPublisher", "publisher", "=", "ActionableHelper", ".", "getPublisher", "(", "build", ".", "getProject", "(", ")", ","...
Check whether to pass the the downstream identifier according to the <b>root</b> build's descriptor @param build The current build @return True if to pass the downstream identifier to the child projects.
[ "Check", "whether", "to", "pass", "the", "the", "downstream", "identifier", "according", "to", "the", "<b", ">", "root<", "/", "b", ">", "build", "s", "descriptor" ]
train
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/util/BuildUniqueIdentifierHelper.java#L89-L99
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
PersistenceBrokerImpl.doGetObjectByIdentity
public Object doGetObjectByIdentity(Identity id) throws PersistenceBrokerException { if (logger.isDebugEnabled()) logger.debug("getObjectByIdentity " + id); // check if object is present in ObjectCache: Object obj = objectCache.lookup(id); // only perform a db lookup if necessary (object not cached yet) if (obj == null) { obj = getDBObject(id); } else { ClassDescriptor cld = getClassDescriptor(obj.getClass()); // if specified in the ClassDescriptor the instance must be refreshed if (cld.isAlwaysRefresh()) { refreshInstance(obj, id, cld); } // now refresh all references checkRefreshRelationships(obj, id, cld); } // Invoke events on PersistenceBrokerAware instances and listeners AFTER_LOOKUP_EVENT.setTarget(obj); fireBrokerEvent(AFTER_LOOKUP_EVENT); AFTER_LOOKUP_EVENT.setTarget(null); //logger.info("RETRIEVING object " + obj); return obj; }
java
public Object doGetObjectByIdentity(Identity id) throws PersistenceBrokerException { if (logger.isDebugEnabled()) logger.debug("getObjectByIdentity " + id); // check if object is present in ObjectCache: Object obj = objectCache.lookup(id); // only perform a db lookup if necessary (object not cached yet) if (obj == null) { obj = getDBObject(id); } else { ClassDescriptor cld = getClassDescriptor(obj.getClass()); // if specified in the ClassDescriptor the instance must be refreshed if (cld.isAlwaysRefresh()) { refreshInstance(obj, id, cld); } // now refresh all references checkRefreshRelationships(obj, id, cld); } // Invoke events on PersistenceBrokerAware instances and listeners AFTER_LOOKUP_EVENT.setTarget(obj); fireBrokerEvent(AFTER_LOOKUP_EVENT); AFTER_LOOKUP_EVENT.setTarget(null); //logger.info("RETRIEVING object " + obj); return obj; }
[ "public", "Object", "doGetObjectByIdentity", "(", "Identity", "id", ")", "throws", "PersistenceBrokerException", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "logger", ".", "debug", "(", "\"getObjectByIdentity \"", "+", "id", ")", ";", "// che...
Internal used method to retrieve object based on Identity. @param id @return @throws PersistenceBrokerException
[ "Internal", "used", "method", "to", "retrieve", "object", "based", "on", "Identity", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L1702-L1732
chr78rm/tracelogger
src/main/java/de/christofreichardt/diagnosis/file/FileTracerLog4jTee.java
FileTracerLog4jTee.adapt
@Override protected void adapt(LogLevel logLevel, String message, Class clazz) { Logger logger = Logger.getLogger(clazz); Level level = convertToLog4jLevel(logLevel); logger.log(DebugLogTee.class.getName(), level, message, null); }
java
@Override protected void adapt(LogLevel logLevel, String message, Class clazz) { Logger logger = Logger.getLogger(clazz); Level level = convertToLog4jLevel(logLevel); logger.log(DebugLogTee.class.getName(), level, message, null); }
[ "@", "Override", "protected", "void", "adapt", "(", "LogLevel", "logLevel", ",", "String", "message", ",", "Class", "clazz", ")", "{", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "clazz", ")", ";", "Level", "level", "=", "convertToLog4jLevel", ...
Routes the given information to the log4j system. @param logLevel {@inheritDoc} @param message {@inheritDoc} @param clazz {@inheritDoc}
[ "Routes", "the", "given", "information", "to", "the", "log4j", "system", "." ]
train
https://github.com/chr78rm/tracelogger/blob/ad22452b20f8111ad4d367302c2b26a100a20200/src/main/java/de/christofreichardt/diagnosis/file/FileTracerLog4jTee.java#L62-L68
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java
AppServiceCertificateOrdersInner.beginCreateOrUpdateCertificateAsync
public Observable<AppServiceCertificateResourceInner> beginCreateOrUpdateCertificateAsync(String resourceGroupName, String certificateOrderName, String name, AppServiceCertificateResourceInner keyVaultCertificate) { return beginCreateOrUpdateCertificateWithServiceResponseAsync(resourceGroupName, certificateOrderName, name, keyVaultCertificate).map(new Func1<ServiceResponse<AppServiceCertificateResourceInner>, AppServiceCertificateResourceInner>() { @Override public AppServiceCertificateResourceInner call(ServiceResponse<AppServiceCertificateResourceInner> response) { return response.body(); } }); }
java
public Observable<AppServiceCertificateResourceInner> beginCreateOrUpdateCertificateAsync(String resourceGroupName, String certificateOrderName, String name, AppServiceCertificateResourceInner keyVaultCertificate) { return beginCreateOrUpdateCertificateWithServiceResponseAsync(resourceGroupName, certificateOrderName, name, keyVaultCertificate).map(new Func1<ServiceResponse<AppServiceCertificateResourceInner>, AppServiceCertificateResourceInner>() { @Override public AppServiceCertificateResourceInner call(ServiceResponse<AppServiceCertificateResourceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "AppServiceCertificateResourceInner", ">", "beginCreateOrUpdateCertificateAsync", "(", "String", "resourceGroupName", ",", "String", "certificateOrderName", ",", "String", "name", ",", "AppServiceCertificateResourceInner", "keyVaultCertificate", ")", ...
Creates or updates a certificate and associates with key vault secret. Creates or updates a certificate and associates with key vault secret. @param resourceGroupName Name of the resource group to which the resource belongs. @param certificateOrderName Name of the certificate order. @param name Name of the certificate. @param keyVaultCertificate Key vault certificate resource Id. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the AppServiceCertificateResourceInner object
[ "Creates", "or", "updates", "a", "certificate", "and", "associates", "with", "key", "vault", "secret", ".", "Creates", "or", "updates", "a", "certificate", "and", "associates", "with", "key", "vault", "secret", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java#L1308-L1315
alkacon/opencms-core
src/org/opencms/search/CmsSearchIndex.java
CmsSearchIndex.getResource
protected CmsResource getResource(CmsObject cms, I_CmsSearchDocument doc) { // check if the resource exits in the VFS, // this will implicitly check read permission and if the resource was deleted CmsResourceFilter filter = CmsResourceFilter.DEFAULT; if (isRequireViewPermission()) { filter = CmsResourceFilter.DEFAULT_ONLY_VISIBLE; } else if (isIgnoreExpiration()) { filter = CmsResourceFilter.IGNORE_EXPIRATION; } return getResource(cms, doc, filter); }
java
protected CmsResource getResource(CmsObject cms, I_CmsSearchDocument doc) { // check if the resource exits in the VFS, // this will implicitly check read permission and if the resource was deleted CmsResourceFilter filter = CmsResourceFilter.DEFAULT; if (isRequireViewPermission()) { filter = CmsResourceFilter.DEFAULT_ONLY_VISIBLE; } else if (isIgnoreExpiration()) { filter = CmsResourceFilter.IGNORE_EXPIRATION; } return getResource(cms, doc, filter); }
[ "protected", "CmsResource", "getResource", "(", "CmsObject", "cms", ",", "I_CmsSearchDocument", "doc", ")", "{", "// check if the resource exits in the VFS,", "// this will implicitly check read permission and if the resource was deleted", "CmsResourceFilter", "filter", "=", "CmsReso...
Checks if the OpenCms resource referenced by the result document can be read by the user of the given OpenCms context. Returns the referenced <code>CmsResource</code> or <code>null</code> if the user is not permitted to read the resource.<p> @param cms the OpenCms user context to use for permission testing @param doc the search result document to check @return the referenced <code>CmsResource</code> or <code>null</code> if the user is not permitted
[ "Checks", "if", "the", "OpenCms", "resource", "referenced", "by", "the", "result", "document", "can", "be", "read", "by", "the", "user", "of", "the", "given", "OpenCms", "context", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsSearchIndex.java#L1697-L1709
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/util/ScriptUtil.java
ScriptUtil.getScriptFromSource
public static ExecutableScript getScriptFromSource(String language, String source, ScriptFactory scriptFactory) { ensureNotEmpty(NotValidException.class, "Script language", language); ensureNotNull(NotValidException.class, "Script source", source); return scriptFactory.createScriptFromSource(language, source); }
java
public static ExecutableScript getScriptFromSource(String language, String source, ScriptFactory scriptFactory) { ensureNotEmpty(NotValidException.class, "Script language", language); ensureNotNull(NotValidException.class, "Script source", source); return scriptFactory.createScriptFromSource(language, source); }
[ "public", "static", "ExecutableScript", "getScriptFromSource", "(", "String", "language", ",", "String", "source", ",", "ScriptFactory", "scriptFactory", ")", "{", "ensureNotEmpty", "(", "NotValidException", ".", "class", ",", "\"Script language\"", ",", "language", "...
Creates a new {@link ExecutableScript} from a static source. @param language the language of the script @param source the source code of the script @param scriptFactory the script factory used to create the script @return the newly created script @throws NotValidException if language is null or empty or source is null
[ "Creates", "a", "new", "{", "@link", "ExecutableScript", "}", "from", "a", "static", "source", "." ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/util/ScriptUtil.java#L109-L113
openengsb/openengsb
ui/admin/src/main/java/org/openengsb/ui/admin/wiringPage/WiringPage.java
WiringPage.setLocation
private boolean setLocation(String global, String context, Map<String, Object> properties) { String locationKey = "location." + context; Object propvalue = properties.get(locationKey); if (propvalue == null) { properties.put(locationKey, global); } else if (propvalue.getClass().isArray()) { Object[] locations = (Object[]) propvalue; if (ArrayUtils.contains(locations, global)) { return false; } Object[] newArray = Arrays.copyOf(locations, locations.length + 1); newArray[locations.length] = global; properties.put(locationKey, newArray); } else { if (((String) propvalue).equals(global)) { return false; } Object[] newArray = new Object[2]; newArray[0] = propvalue; newArray[1] = global; properties.put(locationKey, newArray); } return true; }
java
private boolean setLocation(String global, String context, Map<String, Object> properties) { String locationKey = "location." + context; Object propvalue = properties.get(locationKey); if (propvalue == null) { properties.put(locationKey, global); } else if (propvalue.getClass().isArray()) { Object[] locations = (Object[]) propvalue; if (ArrayUtils.contains(locations, global)) { return false; } Object[] newArray = Arrays.copyOf(locations, locations.length + 1); newArray[locations.length] = global; properties.put(locationKey, newArray); } else { if (((String) propvalue).equals(global)) { return false; } Object[] newArray = new Object[2]; newArray[0] = propvalue; newArray[1] = global; properties.put(locationKey, newArray); } return true; }
[ "private", "boolean", "setLocation", "(", "String", "global", ",", "String", "context", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "String", "locationKey", "=", "\"location.\"", "+", "context", ";", "Object", "propvalue", "=", "pr...
returns true if location is not already set in the properties, otherwise false
[ "returns", "true", "if", "location", "is", "not", "already", "set", "in", "the", "properties", "otherwise", "false" ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/ui/admin/src/main/java/org/openengsb/ui/admin/wiringPage/WiringPage.java#L259-L282
linkedin/PalDB
paldb/src/main/java/com/linkedin/paldb/utils/LongPacker.java
LongPacker.unpackLong
static public long unpackLong(byte[] ba, int index) { long result = 0; for (int offset = 0; offset < 64; offset += 7) { long b = ba[index++]; result |= (b & 0x7F) << offset; if ((b & 0x80) == 0) { return result; } } throw new Error("Malformed long."); }
java
static public long unpackLong(byte[] ba, int index) { long result = 0; for (int offset = 0; offset < 64; offset += 7) { long b = ba[index++]; result |= (b & 0x7F) << offset; if ((b & 0x80) == 0) { return result; } } throw new Error("Malformed long."); }
[ "static", "public", "long", "unpackLong", "(", "byte", "[", "]", "ba", ",", "int", "index", ")", "{", "long", "result", "=", "0", ";", "for", "(", "int", "offset", "=", "0", ";", "offset", "<", "64", ";", "offset", "+=", "7", ")", "{", "long", ...
Unpack positive long value from the byte array. <p> The index value indicates the index in the given byte array. @param ba byte array @param index index in ba @return the long value
[ "Unpack", "positive", "long", "value", "from", "the", "byte", "array", ".", "<p", ">", "The", "index", "value", "indicates", "the", "index", "in", "the", "given", "byte", "array", "." ]
train
https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/utils/LongPacker.java#L128-L138
hawkular/hawkular-apm
client/opentracing/src/main/java/io/opentracing/impl/APMSpan.java
APMSpan.initFollowsFrom
protected void initFollowsFrom(APMSpanBuilder builder, TraceRecorder recorder, Reference ref, ContextSampler sampler) { APMSpan referenced = (APMSpan) ref.getReferredTo(); initTopLevelState(referenced.getTraceContext().getTopSpan(), recorder, sampler); // Top level node in spawned fragment should be a Consumer with correlation id // referencing back to the 'spawned' node String nodeId = referenced.getNodePath(); getNodeBuilder().addCorrelationId(new CorrelationIdentifier(Scope.CausedBy, nodeId)); // Propagate trace id, transaction name and reporting level as creating a // separate trace fragment to represent the 'follows from' activity traceContext.initTraceState(referenced.state()); makeInternalLink(builder); }
java
protected void initFollowsFrom(APMSpanBuilder builder, TraceRecorder recorder, Reference ref, ContextSampler sampler) { APMSpan referenced = (APMSpan) ref.getReferredTo(); initTopLevelState(referenced.getTraceContext().getTopSpan(), recorder, sampler); // Top level node in spawned fragment should be a Consumer with correlation id // referencing back to the 'spawned' node String nodeId = referenced.getNodePath(); getNodeBuilder().addCorrelationId(new CorrelationIdentifier(Scope.CausedBy, nodeId)); // Propagate trace id, transaction name and reporting level as creating a // separate trace fragment to represent the 'follows from' activity traceContext.initTraceState(referenced.state()); makeInternalLink(builder); }
[ "protected", "void", "initFollowsFrom", "(", "APMSpanBuilder", "builder", ",", "TraceRecorder", "recorder", ",", "Reference", "ref", ",", "ContextSampler", "sampler", ")", "{", "APMSpan", "referenced", "=", "(", "APMSpan", ")", "ref", ".", "getReferredTo", "(", ...
This method initialises the span based on a 'follows-from' relationship. @param builder The span builder @param recorder The trace recorder @param ref The 'follows-from' relationship @param sampler The sampler
[ "This", "method", "initialises", "the", "span", "based", "on", "a", "follows", "-", "from", "relationship", "." ]
train
https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/client/opentracing/src/main/java/io/opentracing/impl/APMSpan.java#L235-L250
mapfish/mapfish-print
core/src/main/java/org/mapfish/print/wrapper/json/PJsonArray.java
PJsonArray.getBool
@Override public final boolean getBool(final int i) { try { return this.array.getBoolean(i); } catch (JSONException e) { throw new ObjectMissingException(this, "[" + i + "]"); } }
java
@Override public final boolean getBool(final int i) { try { return this.array.getBoolean(i); } catch (JSONException e) { throw new ObjectMissingException(this, "[" + i + "]"); } }
[ "@", "Override", "public", "final", "boolean", "getBool", "(", "final", "int", "i", ")", "{", "try", "{", "return", "this", ".", "array", ".", "getBoolean", "(", "i", ")", ";", "}", "catch", "(", "JSONException", "e", ")", "{", "throw", "new", "Objec...
Get the element as a boolean. @param i the index of the element to access
[ "Get", "the", "element", "as", "a", "boolean", "." ]
train
https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/wrapper/json/PJsonArray.java#L162-L169
beanshell/beanshell
src/main/java/bsh/org/objectweb/asm/SymbolTable.java
SymbolTable.addConstantLong
private void addConstantLong(final int index, final int tag, final long value) { add(new Entry(index, tag, value, hash(tag, value))); }
java
private void addConstantLong(final int index, final int tag, final long value) { add(new Entry(index, tag, value, hash(tag, value))); }
[ "private", "void", "addConstantLong", "(", "final", "int", "index", ",", "final", "int", "tag", ",", "final", "long", "value", ")", "{", "add", "(", "new", "Entry", "(", "index", ",", "tag", ",", "value", ",", "hash", "(", "tag", ",", "value", ")", ...
Adds a new CONSTANT_Double_info to the constant pool of this symbol table. @param index the constant pool index of the new Symbol. @param tag one of {@link Symbol#CONSTANT_LONG_TAG} or {@link Symbol#CONSTANT_DOUBLE_TAG}. @param value a long or double.
[ "Adds", "a", "new", "CONSTANT_Double_info", "to", "the", "constant", "pool", "of", "this", "symbol", "table", "." ]
train
https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/org/objectweb/asm/SymbolTable.java#L572-L574
ist-dresden/composum
sling/core/commons/src/main/java/com/composum/sling/core/util/ResponseUtil.java
ResponseUtil.writeJsonProperty
public static void writeJsonProperty(SlingHttpServletResponse response, Node node, String name) throws RepositoryException, IOException { JsonWriter jsonWriter = getJsonWriter(response); javax.jcr.Property property = node.getProperty(name); if (property != null) { JsonUtil.writeJsonProperty(jsonWriter, node, property, getDefaultJsonMapping()); } }
java
public static void writeJsonProperty(SlingHttpServletResponse response, Node node, String name) throws RepositoryException, IOException { JsonWriter jsonWriter = getJsonWriter(response); javax.jcr.Property property = node.getProperty(name); if (property != null) { JsonUtil.writeJsonProperty(jsonWriter, node, property, getDefaultJsonMapping()); } }
[ "public", "static", "void", "writeJsonProperty", "(", "SlingHttpServletResponse", "response", ",", "Node", "node", ",", "String", "name", ")", "throws", "RepositoryException", ",", "IOException", "{", "JsonWriter", "jsonWriter", "=", "getJsonWriter", "(", "response", ...
Write one JCR property as JSON object back using the writer of the response (used for GET and PUT). @param response the HTTP response with the writer @param node the JCR node of the referenced resource @param name the name of the property requested @throws RepositoryException error on accessing JCR @throws IOException error on write JSON
[ "Write", "one", "JCR", "property", "as", "JSON", "object", "back", "using", "the", "writer", "of", "the", "response", "(", "used", "for", "GET", "and", "PUT", ")", "." ]
train
https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/core/util/ResponseUtil.java#L90-L99
JodaOrg/joda-beans
src/main/java/org/joda/beans/impl/flexi/FlexiBean.java
FlexiBean.getDouble
public double getDouble(String propertyName, double defaultValue) { Object obj = get(propertyName); return obj != null ? ((Number) get(propertyName)).doubleValue() : defaultValue; }
java
public double getDouble(String propertyName, double defaultValue) { Object obj = get(propertyName); return obj != null ? ((Number) get(propertyName)).doubleValue() : defaultValue; }
[ "public", "double", "getDouble", "(", "String", "propertyName", ",", "double", "defaultValue", ")", "{", "Object", "obj", "=", "get", "(", "propertyName", ")", ";", "return", "obj", "!=", "null", "?", "(", "(", "Number", ")", "get", "(", "propertyName", ...
Gets the value of the property as a {@code double} using a default value. @param propertyName the property name, not empty @param defaultValue the default value for null or invalid property @return the value of the property @throws ClassCastException if the value is not compatible
[ "Gets", "the", "value", "of", "the", "property", "as", "a", "{", "@code", "double", "}", "using", "a", "default", "value", "." ]
train
https://github.com/JodaOrg/joda-beans/blob/f07dbe42947150b23a173f35984c6ab33c5529bf/src/main/java/org/joda/beans/impl/flexi/FlexiBean.java#L247-L250
lessthanoptimal/ddogleg
src/org/ddogleg/optimization/FactoryOptimization.java
FactoryOptimization.doglegBFGS
public static UnconstrainedMinimization doglegBFGS( @Nullable ConfigTrustRegion config ) { if( config == null ) config = new ConfigTrustRegion(); HessianBFGS hessian = new HessianBFGS_DDRM(true); TrustRegionUpdateDogleg_F64<DMatrixRMaj> update = new TrustRegionUpdateDogleg_F64<>(); UnconMinTrustRegionBFGS_F64 alg = new UnconMinTrustRegionBFGS_F64(update,hessian); alg.configure(config); return alg; }
java
public static UnconstrainedMinimization doglegBFGS( @Nullable ConfigTrustRegion config ) { if( config == null ) config = new ConfigTrustRegion(); HessianBFGS hessian = new HessianBFGS_DDRM(true); TrustRegionUpdateDogleg_F64<DMatrixRMaj> update = new TrustRegionUpdateDogleg_F64<>(); UnconMinTrustRegionBFGS_F64 alg = new UnconMinTrustRegionBFGS_F64(update,hessian); alg.configure(config); return alg; }
[ "public", "static", "UnconstrainedMinimization", "doglegBFGS", "(", "@", "Nullable", "ConfigTrustRegion", "config", ")", "{", "if", "(", "config", "==", "null", ")", "config", "=", "new", "ConfigTrustRegion", "(", ")", ";", "HessianBFGS", "hessian", "=", "new", ...
Dense trust-region unconstrained minimization using Dogleg steps and BFGS to estimate the Hessian. @param config Trust region configuration @return The new optimization routine
[ "Dense", "trust", "-", "region", "unconstrained", "minimization", "using", "Dogleg", "steps", "and", "BFGS", "to", "estimate", "the", "Hessian", "." ]
train
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/optimization/FactoryOptimization.java#L158-L167
martinwithaar/Encryptor4j
src/main/java/org/encryptor4j/Encryptor.java
Encryptor.wrapOutputStream
public CipherOutputStream wrapOutputStream(OutputStream os, byte[] iv) throws GeneralSecurityException, IOException { Cipher cipher = getCipher(true); if(iv == null && generateIV && ivLength > 0) { iv = generateIV(); } if(iv != null) { cipher.init(Cipher.ENCRYPT_MODE, getKey(), getAlgorithmParameterSpec(iv)); } else { cipher.init(Cipher.ENCRYPT_MODE, getKey()); iv = cipher.getIV(); } ivThreadLocal.set(iv); if(prependIV && iv != null) { os.write(iv); } return new CipherOutputStream(os, cipher); }
java
public CipherOutputStream wrapOutputStream(OutputStream os, byte[] iv) throws GeneralSecurityException, IOException { Cipher cipher = getCipher(true); if(iv == null && generateIV && ivLength > 0) { iv = generateIV(); } if(iv != null) { cipher.init(Cipher.ENCRYPT_MODE, getKey(), getAlgorithmParameterSpec(iv)); } else { cipher.init(Cipher.ENCRYPT_MODE, getKey()); iv = cipher.getIV(); } ivThreadLocal.set(iv); if(prependIV && iv != null) { os.write(iv); } return new CipherOutputStream(os, cipher); }
[ "public", "CipherOutputStream", "wrapOutputStream", "(", "OutputStream", "os", ",", "byte", "[", "]", "iv", ")", "throws", "GeneralSecurityException", ",", "IOException", "{", "Cipher", "cipher", "=", "getCipher", "(", "true", ")", ";", "if", "(", "iv", "==", ...
<p>Wraps an <code>OutputStream</code> with a <code>CipherOutputStream</code> using this encryptor's cipher.</p> <p>If an <code>ivLength</code> has been specified or an explicit IV has been set during construction and <code>prependIV</code> is set to <code>true</code> this method will write an IV to the <code>OutputStream</code> before wrapping it.</p> @param os @return @throws GeneralSecurityException @throws IOException
[ "<p", ">", "Wraps", "an", "<code", ">", "OutputStream<", "/", "code", ">", "with", "a", "<code", ">", "CipherOutputStream<", "/", "code", ">", "using", "this", "encryptor", "s", "cipher", ".", "<", "/", "p", ">", "<p", ">", "If", "an", "<code", ">", ...
train
https://github.com/martinwithaar/Encryptor4j/blob/8c31d84d9136309f59d810323ed68d902b9bac55/src/main/java/org/encryptor4j/Encryptor.java#L387-L403
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/SecurityRulesInner.java
SecurityRulesInner.getAsync
public Observable<SecurityRuleInner> getAsync(String resourceGroupName, String networkSecurityGroupName, String securityRuleName) { return getWithServiceResponseAsync(resourceGroupName, networkSecurityGroupName, securityRuleName).map(new Func1<ServiceResponse<SecurityRuleInner>, SecurityRuleInner>() { @Override public SecurityRuleInner call(ServiceResponse<SecurityRuleInner> response) { return response.body(); } }); }
java
public Observable<SecurityRuleInner> getAsync(String resourceGroupName, String networkSecurityGroupName, String securityRuleName) { return getWithServiceResponseAsync(resourceGroupName, networkSecurityGroupName, securityRuleName).map(new Func1<ServiceResponse<SecurityRuleInner>, SecurityRuleInner>() { @Override public SecurityRuleInner call(ServiceResponse<SecurityRuleInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "SecurityRuleInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "networkSecurityGroupName", ",", "String", "securityRuleName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "networkS...
Get the specified network security rule. @param resourceGroupName The name of the resource group. @param networkSecurityGroupName The name of the network security group. @param securityRuleName The name of the security rule. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the SecurityRuleInner object
[ "Get", "the", "specified", "network", "security", "rule", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/SecurityRulesInner.java#L297-L304
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/Validate.java
Validate.notEmpty
public static <T extends Collection<?>> T notEmpty(final T collection, final String message, final Object... values) { if (collection == null) { throw new NullPointerException(StringUtils.simpleFormat(message, values)); } if (collection.isEmpty()) { throw new IllegalArgumentException(StringUtils.simpleFormat(message, values)); } return collection; }
java
public static <T extends Collection<?>> T notEmpty(final T collection, final String message, final Object... values) { if (collection == null) { throw new NullPointerException(StringUtils.simpleFormat(message, values)); } if (collection.isEmpty()) { throw new IllegalArgumentException(StringUtils.simpleFormat(message, values)); } return collection; }
[ "public", "static", "<", "T", "extends", "Collection", "<", "?", ">", ">", "T", "notEmpty", "(", "final", "T", "collection", ",", "final", "String", "message", ",", "final", "Object", "...", "values", ")", "{", "if", "(", "collection", "==", "null", ")...
<p>Validate that the specified argument collection is neither {@code null} nor a size of zero (no elements); otherwise throwing an exception with the specified message. <pre>Validate.notEmpty(myCollection, "The collection must not be empty");</pre> @param <T> the collection type @param collection the collection to check, validated not null by this method @param message the {@link String#format(String, Object...)} exception message if invalid, not null @param values the optional values for the formatted exception message, null array not recommended @return the validated collection (never {@code null} method for chaining) @throws NullPointerException if the collection is {@code null} @throws IllegalArgumentException if the collection is empty @see #notEmpty(Object[])
[ "<p", ">", "Validate", "that", "the", "specified", "argument", "collection", "is", "neither", "{", "@code", "null", "}", "nor", "a", "size", "of", "zero", "(", "no", "elements", ")", ";", "otherwise", "throwing", "an", "exception", "with", "the", "specifie...
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/Validate.java#L300-L308
dkpro/dkpro-jwpl
de.tudarmstadt.ukp.wikipedia.util/src/main/java/de/tudarmstadt/ukp/wikipedia/util/templates/WikipediaTemplateInfo.java
WikipediaTemplateInfo.getRevisionIdsContainingTemplateNames
public List<Integer> getRevisionIdsContainingTemplateNames(List<String> templateNames) throws WikiApiException{ return getFilteredRevisionIds(templateNames, true); }
java
public List<Integer> getRevisionIdsContainingTemplateNames(List<String> templateNames) throws WikiApiException{ return getFilteredRevisionIds(templateNames, true); }
[ "public", "List", "<", "Integer", ">", "getRevisionIdsContainingTemplateNames", "(", "List", "<", "String", ">", "templateNames", ")", "throws", "WikiApiException", "{", "return", "getFilteredRevisionIds", "(", "templateNames", ",", "true", ")", ";", "}" ]
Returns a list containing the ids of all revisions that contain a template the name of which equals any of the given Strings. @param templateNames the names of the template that we want to match @return A list with the ids of all revisions that contain any of the the specified templates @throws WikiApiException If there was any error retrieving the page object (most likely if the templates are corrupted)
[ "Returns", "a", "list", "containing", "the", "ids", "of", "all", "revisions", "that", "contain", "a", "template", "the", "name", "of", "which", "equals", "any", "of", "the", "given", "Strings", "." ]
train
https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.util/src/main/java/de/tudarmstadt/ukp/wikipedia/util/templates/WikipediaTemplateInfo.java#L1080-L1082
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java
VirtualMachinesInner.getByResourceGroup
public VirtualMachineInner getByResourceGroup(String resourceGroupName, String vmName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, vmName).toBlocking().single().body(); }
java
public VirtualMachineInner getByResourceGroup(String resourceGroupName, String vmName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, vmName).toBlocking().single().body(); }
[ "public", "VirtualMachineInner", "getByResourceGroup", "(", "String", "resourceGroupName", ",", "String", "vmName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmName", ")", ".", "toBlocking", "(", ")", ".", "single"...
Retrieves information about the model view or the instance view of a virtual machine. @param resourceGroupName The name of the resource group. @param vmName The name of the virtual machine. @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 VirtualMachineInner object if successful.
[ "Retrieves", "information", "about", "the", "model", "view", "or", "the", "instance", "view", "of", "a", "virtual", "machine", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java#L878-L880
alkacon/opencms-core
src/org/opencms/xml/content/CmsDefaultXmlContentHandler.java
CmsDefaultXmlContentHandler.createVisibilityConfiguration
protected VisibilityConfiguration createVisibilityConfiguration(String className, String params) { I_CmsXmlContentVisibilityHandler handler = this; if (className != null) { try { handler = (I_CmsXmlContentVisibilityHandler)(Class.forName(className).newInstance()); } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); } } VisibilityConfiguration result = new VisibilityConfiguration(handler, params); return result; }
java
protected VisibilityConfiguration createVisibilityConfiguration(String className, String params) { I_CmsXmlContentVisibilityHandler handler = this; if (className != null) { try { handler = (I_CmsXmlContentVisibilityHandler)(Class.forName(className).newInstance()); } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); } } VisibilityConfiguration result = new VisibilityConfiguration(handler, params); return result; }
[ "protected", "VisibilityConfiguration", "createVisibilityConfiguration", "(", "String", "className", ",", "String", "params", ")", "{", "I_CmsXmlContentVisibilityHandler", "handler", "=", "this", ";", "if", "(", "className", "!=", "null", ")", "{", "try", "{", "hand...
Helper method to create a visibility configuration.<p> @param className the visibility handler class name @param params the parameters for the visibility @return the visibility configuration
[ "Helper", "method", "to", "create", "a", "visibility", "configuration", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsDefaultXmlContentHandler.java#L2242-L2254
groovy/groovy-core
src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java
StringGroovyMethods.getAt
public static String getAt(String text, IntRange range) { return getAt(text, (Range) range); }
java
public static String getAt(String text, IntRange range) { return getAt(text, (Range) range); }
[ "public", "static", "String", "getAt", "(", "String", "text", ",", "IntRange", "range", ")", "{", "return", "getAt", "(", "text", ",", "(", "Range", ")", "range", ")", ";", "}" ]
Support the range subscript operator for String with IntRange @param text a String @param range an IntRange @return the resulting String @since 1.0
[ "Support", "the", "range", "subscript", "operator", "for", "String", "with", "IntRange" ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1462-L1464
lucee/Lucee
core/src/main/java/lucee/transformer/library/function/FunctionLib.java
FunctionLib.duplicate
private HashMap duplicate(HashMap funcs, boolean deepCopy) { if (deepCopy) throw new PageRuntimeException(new ExpressionException("deep copy not supported")); Iterator it = funcs.entrySet().iterator(); Map.Entry entry; HashMap cm = new HashMap(); while (it.hasNext()) { entry = (Entry) it.next(); cm.put(entry.getKey(), deepCopy ? entry.getValue() : // TODO add support for deepcopy ((FunctionLibFunction)entry.getValue()).duplicate(deepCopy): entry.getValue()); } return cm; }
java
private HashMap duplicate(HashMap funcs, boolean deepCopy) { if (deepCopy) throw new PageRuntimeException(new ExpressionException("deep copy not supported")); Iterator it = funcs.entrySet().iterator(); Map.Entry entry; HashMap cm = new HashMap(); while (it.hasNext()) { entry = (Entry) it.next(); cm.put(entry.getKey(), deepCopy ? entry.getValue() : // TODO add support for deepcopy ((FunctionLibFunction)entry.getValue()).duplicate(deepCopy): entry.getValue()); } return cm; }
[ "private", "HashMap", "duplicate", "(", "HashMap", "funcs", ",", "boolean", "deepCopy", ")", "{", "if", "(", "deepCopy", ")", "throw", "new", "PageRuntimeException", "(", "new", "ExpressionException", "(", "\"deep copy not supported\"", ")", ")", ";", "Iterator", ...
duplcate a hashmap with FunctionLibFunction's @param funcs @param deepCopy @return cloned map
[ "duplcate", "a", "hashmap", "with", "FunctionLibFunction", "s" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/library/function/FunctionLib.java#L239-L251
grycap/coreutils
coreutils-fiber/src/main/java/es/upv/grycap/coreutils/fiber/http/Http2Client.java
Http2Client.asyncGetJson
public void asyncGetJson(final String url, final boolean nocache, final Callback callback) { asyncGet(url, newArrayList("application/json"), nocache, callback); }
java
public void asyncGetJson(final String url, final boolean nocache, final Callback callback) { asyncGet(url, newArrayList("application/json"), nocache, callback); }
[ "public", "void", "asyncGetJson", "(", "final", "String", "url", ",", "final", "boolean", "nocache", ",", "final", "Callback", "callback", ")", "{", "asyncGet", "(", "url", ",", "newArrayList", "(", "\"application/json\"", ")", ",", "nocache", ",", "callback",...
Retrieve information from a server via a HTTP GET request. @param url - URL target of this request @param nocache - don't accept an invalidated cached response, and don't store the server's response in any cache @param callback - is called back when the response is readable
[ "Retrieve", "information", "from", "a", "server", "via", "a", "HTTP", "GET", "request", "." ]
train
https://github.com/grycap/coreutils/blob/e6db61dc50b49ea7276c0c29c7401204681a10c2/coreutils-fiber/src/main/java/es/upv/grycap/coreutils/fiber/http/Http2Client.java#L82-L84
Clivern/Racter
src/main/java/com/clivern/racter/senders/templates/ReceiptTemplate.java
ReceiptTemplate.setAddress
public void setAddress(String street_1, String street_2, String city, String postal_code, String state, String country) { this.address.put("street_1", street_1); this.address.put("street_2", street_2); this.address.put("city", city); this.address.put("postal_code", postal_code); this.address.put("state", state); this.address.put("country", country); }
java
public void setAddress(String street_1, String street_2, String city, String postal_code, String state, String country) { this.address.put("street_1", street_1); this.address.put("street_2", street_2); this.address.put("city", city); this.address.put("postal_code", postal_code); this.address.put("state", state); this.address.put("country", country); }
[ "public", "void", "setAddress", "(", "String", "street_1", ",", "String", "street_2", ",", "String", "city", ",", "String", "postal_code", ",", "String", "state", ",", "String", "country", ")", "{", "this", ".", "address", ".", "put", "(", "\"street_1\"", ...
Set Address @param street_1 the street address 1 @param street_2 the street address 2 @param city the city @param postal_code the postal code @param state the state @param country the country
[ "Set", "Address" ]
train
https://github.com/Clivern/Racter/blob/bbde02f0c2a8a80653ad6b1607376d8408acd71c/src/main/java/com/clivern/racter/senders/templates/ReceiptTemplate.java#L154-L162
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/MediaApi.java
MediaApi.deleteMediaUserData
public ApiSuccessResponse deleteMediaUserData(String mediatype, String id, UserData1 userData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = deleteMediaUserDataWithHttpInfo(mediatype, id, userData); return resp.getData(); }
java
public ApiSuccessResponse deleteMediaUserData(String mediatype, String id, UserData1 userData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = deleteMediaUserDataWithHttpInfo(mediatype, id, userData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "deleteMediaUserData", "(", "String", "mediatype", ",", "String", "id", ",", "UserData1", "userData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "deleteMediaUserDataWithHttpInfo", "(", ...
Remove key/value pairs from user data Delete data with the specified keys from the interaction&#39;s user data. @param mediatype The media channel. (required) @param id The ID of the interaction. (required) @param userData The keys of the data to remove. (required) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Remove", "key", "/", "value", "pairs", "from", "user", "data", "Delete", "data", "with", "the", "specified", "keys", "from", "the", "interaction&#39", ";", "s", "user", "data", "." ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/MediaApi.java#L1569-L1572
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java
SeaGlassSynthPainterImpl.paintSplitPaneDragDivider
public void paintSplitPaneDragDivider(SynthContext context, Graphics g, int x, int y, int w, int h, int orientation) { paintBackground(context, g, x, y, w, h, null); }
java
public void paintSplitPaneDragDivider(SynthContext context, Graphics g, int x, int y, int w, int h, int orientation) { paintBackground(context, g, x, y, w, h, null); }
[ "public", "void", "paintSplitPaneDragDivider", "(", "SynthContext", "context", ",", "Graphics", "g", ",", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ",", "int", "orientation", ")", "{", "paintBackground", "(", "context", ",", "g", ","...
Paints the divider, when the user is dragging the divider, of a split pane. @param context SynthContext identifying the <code>JComponent</code> and <code>Region</code> to paint to @param g <code>Graphics</code> to paint to @param x X coordinate of the area to paint to @param y Y coordinate of the area to paint to @param w Width of the area to paint to @param h Height of the area to paint to @param orientation One of <code>JSplitPane.HORIZONTAL_SPLIT</code> or <code>JSplitPane.VERTICAL_SPLIT</code>
[ "Paints", "the", "divider", "when", "the", "user", "is", "dragging", "the", "divider", "of", "a", "split", "pane", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java#L1881-L1883
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/enhance/impl/ImplEnhanceHistogram.java
ImplEnhanceHistogram.localHistogram
public static void localHistogram( GrayU16 input , int x0 , int y0 , int x1, int y1 , int histogram[] ) { for( int i = 0; i < histogram.length; i++ ) histogram[i] = 0; for( int i = y0; i < y1; i++ ) { int index = input.startIndex + i*input.stride + x0; int end = index + x1-x0; for( ; index < end; index++ ) { histogram[input.data[index] & 0xFFFF]++; } } }
java
public static void localHistogram( GrayU16 input , int x0 , int y0 , int x1, int y1 , int histogram[] ) { for( int i = 0; i < histogram.length; i++ ) histogram[i] = 0; for( int i = y0; i < y1; i++ ) { int index = input.startIndex + i*input.stride + x0; int end = index + x1-x0; for( ; index < end; index++ ) { histogram[input.data[index] & 0xFFFF]++; } } }
[ "public", "static", "void", "localHistogram", "(", "GrayU16", "input", ",", "int", "x0", ",", "int", "y0", ",", "int", "x1", ",", "int", "y1", ",", "int", "histogram", "[", "]", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "histogra...
Computes the local histogram just for the specified inner region
[ "Computes", "the", "local", "histogram", "just", "for", "the", "specified", "inner", "region" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/enhance/impl/ImplEnhanceHistogram.java#L718-L729
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/TrueTypeFontUnicode.java
TrueTypeFontUnicode.getToUnicode
private PdfStream getToUnicode(Object metrics[]) { metrics = filterCmapMetrics(metrics); if (metrics.length == 0) return null; StringBuffer buf = new StringBuffer( "/CIDInit /ProcSet findresource begin\n" + "12 dict begin\n" + "begincmap\n" + "/CIDSystemInfo\n" + "<< /Registry (TTX+0)\n" + "/Ordering (T42UV)\n" + "/Supplement 0\n" + ">> def\n" + "/CMapName /TTX+0 def\n" + "/CMapType 2 def\n" + "1 begincodespacerange\n" + "<0000><FFFF>\n" + "endcodespacerange\n"); int size = 0; for (int k = 0; k < metrics.length; ++k) { if (size == 0) { if (k != 0) { buf.append("endbfrange\n"); } size = Math.min(100, metrics.length - k); buf.append(size).append(" beginbfrange\n"); } --size; int metric[] = (int[])metrics[k]; String fromTo = toHex(metric[0]); buf.append(fromTo).append(fromTo).append(toHex(metric[2])).append('\n'); } buf.append( "endbfrange\n" + "endcmap\n" + "CMapName currentdict /CMap defineresource pop\n" + "end end\n"); String s = buf.toString(); PdfStream stream = new PdfStream(PdfEncodings.convertToBytes(s, null)); stream.flateCompress(compressionLevel); return stream; }
java
private PdfStream getToUnicode(Object metrics[]) { metrics = filterCmapMetrics(metrics); if (metrics.length == 0) return null; StringBuffer buf = new StringBuffer( "/CIDInit /ProcSet findresource begin\n" + "12 dict begin\n" + "begincmap\n" + "/CIDSystemInfo\n" + "<< /Registry (TTX+0)\n" + "/Ordering (T42UV)\n" + "/Supplement 0\n" + ">> def\n" + "/CMapName /TTX+0 def\n" + "/CMapType 2 def\n" + "1 begincodespacerange\n" + "<0000><FFFF>\n" + "endcodespacerange\n"); int size = 0; for (int k = 0; k < metrics.length; ++k) { if (size == 0) { if (k != 0) { buf.append("endbfrange\n"); } size = Math.min(100, metrics.length - k); buf.append(size).append(" beginbfrange\n"); } --size; int metric[] = (int[])metrics[k]; String fromTo = toHex(metric[0]); buf.append(fromTo).append(fromTo).append(toHex(metric[2])).append('\n'); } buf.append( "endbfrange\n" + "endcmap\n" + "CMapName currentdict /CMap defineresource pop\n" + "end end\n"); String s = buf.toString(); PdfStream stream = new PdfStream(PdfEncodings.convertToBytes(s, null)); stream.flateCompress(compressionLevel); return stream; }
[ "private", "PdfStream", "getToUnicode", "(", "Object", "metrics", "[", "]", ")", "{", "metrics", "=", "filterCmapMetrics", "(", "metrics", ")", ";", "if", "(", "metrics", ".", "length", "==", "0", ")", "return", "null", ";", "StringBuffer", "buf", "=", "...
Creates a ToUnicode CMap to allow copy and paste from Acrobat. @param metrics metrics[0] contains the glyph index and metrics[2] contains the Unicode code @return the stream representing this CMap or <CODE>null</CODE>
[ "Creates", "a", "ToUnicode", "CMap", "to", "allow", "copy", "and", "paste", "from", "Acrobat", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/TrueTypeFontUnicode.java#L209-L250
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/utils/GrassLegacyUtilities.java
GrassLegacyUtilities.rowColToCenterCoordinates
public static Coordinate rowColToCenterCoordinates( Window active, int row, int col ) { double north = active.getNorth(); double west = active.getWest(); double nsres = active.getNSResolution(); double ewres = active.getWEResolution(); double northing = north - row * nsres - nsres / 2.0; double easting = west + col * ewres + ewres / 2.0; return new Coordinate(easting, northing); }
java
public static Coordinate rowColToCenterCoordinates( Window active, int row, int col ) { double north = active.getNorth(); double west = active.getWest(); double nsres = active.getNSResolution(); double ewres = active.getWEResolution(); double northing = north - row * nsres - nsres / 2.0; double easting = west + col * ewres + ewres / 2.0; return new Coordinate(easting, northing); }
[ "public", "static", "Coordinate", "rowColToCenterCoordinates", "(", "Window", "active", ",", "int", "row", ",", "int", "col", ")", "{", "double", "north", "=", "active", ".", "getNorth", "(", ")", ";", "double", "west", "=", "active", ".", "getWest", "(", ...
<p> Transforms row and column index of the active region into the regarding northing and easting coordinates. The center of the cell is taken. </p> <p> NOTE: basically the inverse of {@link GrassLegacyUtilities#coordinateToNearestRowCol(Window, Coordinate)} </p> @param active - the active region (can be null) @param row - row number of the point to transform @param col - column number of the point to transform @return the point in N/E coordinates of the supplied row and column
[ "<p", ">", "Transforms", "row", "and", "column", "index", "of", "the", "active", "region", "into", "the", "regarding", "northing", "and", "easting", "coordinates", ".", "The", "center", "of", "the", "cell", "is", "taken", ".", "<", "/", "p", ">", "<p", ...
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/utils/GrassLegacyUtilities.java#L507-L518
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/utils/Utils.java
Utils.copyStreamUnsafelyUseWithCaution
public static void copyStreamUnsafelyUseWithCaution( InputStream in, OutputStream os ) throws IOException { byte[] buf = new byte[ 1024 ]; int len; while((len = in.read( buf )) > 0) { os.write( buf, 0, len ); } }
java
public static void copyStreamUnsafelyUseWithCaution( InputStream in, OutputStream os ) throws IOException { byte[] buf = new byte[ 1024 ]; int len; while((len = in.read( buf )) > 0) { os.write( buf, 0, len ); } }
[ "public", "static", "void", "copyStreamUnsafelyUseWithCaution", "(", "InputStream", "in", ",", "OutputStream", "os", ")", "throws", "IOException", "{", "byte", "[", "]", "buf", "=", "new", "byte", "[", "1024", "]", ";", "int", "len", ";", "while", "(", "("...
Copies the content from in into os. <p> Neither <i>in</i> nor <i>os</i> are closed by this method.<br> They must be explicitly closed after this method is called. </p> <p> Be careful, this method should be avoided when possible. It was responsible for memory leaks. See #489. </p> @param in an input stream (not null) @param os an output stream (not null) @throws IOException if an error occurred
[ "Copies", "the", "content", "from", "in", "into", "os", ".", "<p", ">", "Neither", "<i", ">", "in<", "/", "i", ">", "nor", "<i", ">", "os<", "/", "i", ">", "are", "closed", "by", "this", "method", ".", "<br", ">", "They", "must", "be", "explicitl...
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/utils/Utils.java#L311-L318
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.cdn_dedicated_serviceName_backend_GET
public ArrayList<String> cdn_dedicated_serviceName_backend_GET(String serviceName, Long backend) throws IOException { String qPath = "/order/cdn/dedicated/{serviceName}/backend"; StringBuilder sb = path(qPath, serviceName); query(sb, "backend", backend); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
java
public ArrayList<String> cdn_dedicated_serviceName_backend_GET(String serviceName, Long backend) throws IOException { String qPath = "/order/cdn/dedicated/{serviceName}/backend"; StringBuilder sb = path(qPath, serviceName); query(sb, "backend", backend); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "String", ">", "cdn_dedicated_serviceName_backend_GET", "(", "String", "serviceName", ",", "Long", "backend", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/cdn/dedicated/{serviceName}/backend\"", ";", "StringBuilder", "sb...
Get allowed durations for 'backend' option REST: GET /order/cdn/dedicated/{serviceName}/backend @param backend [required] Backend number that will be ordered @param serviceName [required] The internal name of your CDN offer
[ "Get", "allowed", "durations", "for", "backend", "option" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L5261-L5267
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/util/MainApplication.java
MainApplication.createRemoteTask
public RemoteTask createRemoteTask(String strServer, String strRemoteApp, String strUserID, String strPassword) { RemoteTask remoteTask = super.createRemoteTask(strServer, strRemoteApp, strUserID, strPassword); return remoteTask; }
java
public RemoteTask createRemoteTask(String strServer, String strRemoteApp, String strUserID, String strPassword) { RemoteTask remoteTask = super.createRemoteTask(strServer, strRemoteApp, strUserID, strPassword); return remoteTask; }
[ "public", "RemoteTask", "createRemoteTask", "(", "String", "strServer", ",", "String", "strRemoteApp", ",", "String", "strUserID", ",", "String", "strPassword", ")", "{", "RemoteTask", "remoteTask", "=", "super", ".", "createRemoteTask", "(", "strServer", ",", "st...
Connect to the remote server and get the remote server object. @param strServer The (rmi) server. @param The remote application name in jndi index. @return The remote server object.
[ "Connect", "to", "the", "remote", "server", "and", "get", "the", "remote", "server", "object", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/util/MainApplication.java#L636-L640
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/linsol/qr/AdjLinearSolverQr_DDRM.java
AdjLinearSolverQr_DDRM.getA
@Override public DMatrixRMaj getA() { if( A.data.length < numRows*numCols ) { A = new DMatrixRMaj(numRows,numCols); } A.reshape(numRows,numCols, false); CommonOps_DDRM.mult(Q,R,A); return A; }
java
@Override public DMatrixRMaj getA() { if( A.data.length < numRows*numCols ) { A = new DMatrixRMaj(numRows,numCols); } A.reshape(numRows,numCols, false); CommonOps_DDRM.mult(Q,R,A); return A; }
[ "@", "Override", "public", "DMatrixRMaj", "getA", "(", ")", "{", "if", "(", "A", ".", "data", ".", "length", "<", "numRows", "*", "numCols", ")", "{", "A", "=", "new", "DMatrixRMaj", "(", "numRows", ",", "numCols", ")", ";", "}", "A", ".", "reshape...
Compute the A matrix from the Q and R matrices. @return The A matrix.
[ "Compute", "the", "A", "matrix", "from", "the", "Q", "and", "R", "matrices", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/linsol/qr/AdjLinearSolverQr_DDRM.java#L60-L69
sshtools/j2ssh-maverick
j2ssh-maverick/src/main/java/com/sshtools/publickey/ConsoleKnownHostsKeyVerification.java
ConsoleKnownHostsKeyVerification.onUnknownHost
public void onUnknownHost(String host, SshPublicKey pk) { try { System.out.println("The host " + host + " is currently unknown to the system"); System.out.println("The MD5 host key " + "(" + pk.getAlgorithm() + ") fingerprint is: " + pk.getFingerprint()); System.out.println("The SHA1 host key " + "(" + pk.getAlgorithm() + ") fingerprint is: " + SshKeyFingerprint.getFingerprint(pk.getEncoded(), SshKeyFingerprint.SHA1_FINGERPRINT)); try { System.out.println("The SHA256 host key " + "(" + pk.getAlgorithm() + ") fingerprint is: " + SshKeyFingerprint.getFingerprint(pk.getEncoded(), SshKeyFingerprint.SHA256_FINGERPRINT)); } catch (Exception ex) { } getResponse(host, pk); } catch (Exception e) { e.printStackTrace(); } }
java
public void onUnknownHost(String host, SshPublicKey pk) { try { System.out.println("The host " + host + " is currently unknown to the system"); System.out.println("The MD5 host key " + "(" + pk.getAlgorithm() + ") fingerprint is: " + pk.getFingerprint()); System.out.println("The SHA1 host key " + "(" + pk.getAlgorithm() + ") fingerprint is: " + SshKeyFingerprint.getFingerprint(pk.getEncoded(), SshKeyFingerprint.SHA1_FINGERPRINT)); try { System.out.println("The SHA256 host key " + "(" + pk.getAlgorithm() + ") fingerprint is: " + SshKeyFingerprint.getFingerprint(pk.getEncoded(), SshKeyFingerprint.SHA256_FINGERPRINT)); } catch (Exception ex) { } getResponse(host, pk); } catch (Exception e) { e.printStackTrace(); } }
[ "public", "void", "onUnknownHost", "(", "String", "host", ",", "SshPublicKey", "pk", ")", "{", "try", "{", "System", ".", "out", ".", "println", "(", "\"The host \"", "+", "host", "+", "\" is currently unknown to the system\"", ")", ";", "System", ".", "out", ...
<p> Prompts the user through the console to verify the host key. </p> @param host the name of the host @param pk the public key supplied by the host @since 0.2.0
[ "<p", ">", "Prompts", "the", "user", "through", "the", "console", "to", "verify", "the", "host", "key", ".", "<", "/", "p", ">" ]
train
https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/publickey/ConsoleKnownHostsKeyVerification.java#L115-L141
m-m-m/util
datatype/src/main/java/net/sf/mmm/util/datatype/api/color/GenericColor.java
GenericColor.valueOf
public static GenericColor valueOf(Hue hue, Saturation saturation, Lightness lightness, Alpha alpha) { Objects.requireNonNull(hue, "hue"); Objects.requireNonNull(saturation, "saturation"); Objects.requireNonNull(lightness, "lightness"); Objects.requireNonNull(alpha, "alpha"); GenericColor genericColor = new GenericColor(); genericColor.hue = hue; genericColor.saturationHsl = saturation; genericColor.lightness = lightness; genericColor.alpha = alpha; double l = lightness.getValueAsFactor(); double chroma; if (l >= 0.5) { chroma = saturation.getValueAsFactor() * (2 - 2 * l); } else { chroma = saturation.getValueAsFactor() * 2 * l; } double m = l - (chroma / 2); double saturationHsb; double b = chroma + m; genericColor.brightness = new Brightness(b); if (l == 0) { saturationHsb = 0; } else { saturationHsb = chroma / b; } genericColor.saturationHsb = new Saturation(saturationHsb); calculateRgb(genericColor, hue, m, chroma); return genericColor; }
java
public static GenericColor valueOf(Hue hue, Saturation saturation, Lightness lightness, Alpha alpha) { Objects.requireNonNull(hue, "hue"); Objects.requireNonNull(saturation, "saturation"); Objects.requireNonNull(lightness, "lightness"); Objects.requireNonNull(alpha, "alpha"); GenericColor genericColor = new GenericColor(); genericColor.hue = hue; genericColor.saturationHsl = saturation; genericColor.lightness = lightness; genericColor.alpha = alpha; double l = lightness.getValueAsFactor(); double chroma; if (l >= 0.5) { chroma = saturation.getValueAsFactor() * (2 - 2 * l); } else { chroma = saturation.getValueAsFactor() * 2 * l; } double m = l - (chroma / 2); double saturationHsb; double b = chroma + m; genericColor.brightness = new Brightness(b); if (l == 0) { saturationHsb = 0; } else { saturationHsb = chroma / b; } genericColor.saturationHsb = new Saturation(saturationHsb); calculateRgb(genericColor, hue, m, chroma); return genericColor; }
[ "public", "static", "GenericColor", "valueOf", "(", "Hue", "hue", ",", "Saturation", "saturation", ",", "Lightness", "lightness", ",", "Alpha", "alpha", ")", "{", "Objects", ".", "requireNonNull", "(", "hue", ",", "\"hue\"", ")", ";", "Objects", ".", "requir...
Creates a {@link GenericColor} from the given {@link Segment}s of {@link ColorModel#HSL}. @param hue is the {@link Hue} part. @param saturation is the {@link Saturation} part. @param lightness is the {@link Lightness} part. @param alpha is the {@link Alpha} value. @return the {@link GenericColor}.
[ "Creates", "a", "{", "@link", "GenericColor", "}", "from", "the", "given", "{", "@link", "Segment", "}", "s", "of", "{", "@link", "ColorModel#HSL", "}", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/datatype/src/main/java/net/sf/mmm/util/datatype/api/color/GenericColor.java#L296-L326
Azure/azure-sdk-for-java
resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java
ResourcesInner.checkExistence
public boolean checkExistence(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { return checkExistenceWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).toBlocking().single().body(); }
java
public boolean checkExistence(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { return checkExistenceWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).toBlocking().single().body(); }
[ "public", "boolean", "checkExistence", "(", "String", "resourceGroupName", ",", "String", "resourceProviderNamespace", ",", "String", "parentResourcePath", ",", "String", "resourceType", ",", "String", "resourceName", ",", "String", "apiVersion", ")", "{", "return", "...
Checks whether a resource exists. @param resourceGroupName The name of the resource group containing the resource to check. The name is case insensitive. @param resourceProviderNamespace The resource provider of the resource to check. @param parentResourcePath The parent resource identity. @param resourceType The resource type. @param resourceName The name of the resource to check whether it exists. @param apiVersion The API version to use for the operation. @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 boolean object if successful.
[ "Checks", "whether", "a", "resource", "exists", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java#L976-L978
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java
DocTreeScanner.visitDocComment
@Override public R visitDocComment(DocCommentTree node, P p) { R r = scan(node.getFirstSentence(), p); r = scanAndReduce(node.getBody(), p, r); r = scanAndReduce(node.getBlockTags(), p, r); return r; }
java
@Override public R visitDocComment(DocCommentTree node, P p) { R r = scan(node.getFirstSentence(), p); r = scanAndReduce(node.getBody(), p, r); r = scanAndReduce(node.getBlockTags(), p, r); return r; }
[ "@", "Override", "public", "R", "visitDocComment", "(", "DocCommentTree", "node", ",", "P", "p", ")", "{", "R", "r", "=", "scan", "(", "node", ".", "getFirstSentence", "(", ")", ",", "p", ")", ";", "r", "=", "scanAndReduce", "(", "node", ".", "getBod...
{@inheritDoc} This implementation scans the children in left to right order. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of scanning
[ "{", "@inheritDoc", "}", "This", "implementation", "scans", "the", "children", "in", "left", "to", "right", "order", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java#L181-L187
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/RunbookDraftsInner.java
RunbookDraftsInner.undoEdit
public RunbookDraftUndoEditResultInner undoEdit(String resourceGroupName, String automationAccountName, String runbookName) { return undoEditWithServiceResponseAsync(resourceGroupName, automationAccountName, runbookName).toBlocking().single().body(); }
java
public RunbookDraftUndoEditResultInner undoEdit(String resourceGroupName, String automationAccountName, String runbookName) { return undoEditWithServiceResponseAsync(resourceGroupName, automationAccountName, runbookName).toBlocking().single().body(); }
[ "public", "RunbookDraftUndoEditResultInner", "undoEdit", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "String", "runbookName", ")", "{", "return", "undoEditWithServiceResponseAsync", "(", "resourceGroupName", ",", "automationAccountName", "...
Undo draft edit to last known published state identified by runbook name. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param runbookName The runbook name. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the RunbookDraftUndoEditResultInner object if successful.
[ "Undo", "draft", "edit", "to", "last", "known", "published", "state", "identified", "by", "runbook", "name", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/RunbookDraftsInner.java#L627-L629
amaembo/streamex
src/main/java/one/util/streamex/EntryStream.java
EntryStream.toCustomMap
public <M extends Map<K, V>> M toCustomMap(Supplier<M> mapSupplier) { M map = mapSupplier.get(); if (isParallel() && !(map instanceof ConcurrentMap)) { return collect(mapSupplier, (m, t) -> addToMap(m, t.getKey(), Objects.requireNonNull(t.getValue())), (m1, m2) -> m2.forEach((k, v) -> addToMap(m1, k, v))); } forEach(toMapConsumer(map)); return map; }
java
public <M extends Map<K, V>> M toCustomMap(Supplier<M> mapSupplier) { M map = mapSupplier.get(); if (isParallel() && !(map instanceof ConcurrentMap)) { return collect(mapSupplier, (m, t) -> addToMap(m, t.getKey(), Objects.requireNonNull(t.getValue())), (m1, m2) -> m2.forEach((k, v) -> addToMap(m1, k, v))); } forEach(toMapConsumer(map)); return map; }
[ "public", "<", "M", "extends", "Map", "<", "K", ",", "V", ">", ">", "M", "toCustomMap", "(", "Supplier", "<", "M", ">", "mapSupplier", ")", "{", "M", "map", "=", "mapSupplier", ".", "get", "(", ")", ";", "if", "(", "isParallel", "(", ")", "&&", ...
Returns a {@link Map} containing the elements of this stream. The {@code Map} is created by a provided supplier function. <p> This is a <a href="package-summary.html#StreamOps">terminal</a> operation. @param <M> the type of the resulting map @param mapSupplier a function which returns a new, empty {@code Map} into which the results will be inserted @return a {@code Map} containing the elements of this stream @throws IllegalStateException if this stream contains duplicate keys (according to {@link Object#equals(Object)}) @see Collectors#toMap(Function, Function) @see Collectors#toConcurrentMap(Function, Function)
[ "Returns", "a", "{", "@link", "Map", "}", "containing", "the", "elements", "of", "this", "stream", ".", "The", "{", "@code", "Map", "}", "is", "created", "by", "a", "provided", "supplier", "function", "." ]
train
https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/EntryStream.java#L1237-L1245
Erudika/para
para-server/src/main/java/com/erudika/para/utils/HttpUtils.java
HttpUtils.setRawCookie
public static void setRawCookie(String name, String value, HttpServletRequest req, HttpServletResponse res, boolean httpOnly, int maxAge) { if (StringUtils.isBlank(name) || value == null || req == null || res == null) { return; } Cookie cookie = new Cookie(name, value); cookie.setHttpOnly(httpOnly); cookie.setMaxAge(maxAge < 0 ? Config.SESSION_TIMEOUT_SEC : maxAge); cookie.setPath("/"); cookie.setSecure(req.isSecure()); res.addCookie(cookie); }
java
public static void setRawCookie(String name, String value, HttpServletRequest req, HttpServletResponse res, boolean httpOnly, int maxAge) { if (StringUtils.isBlank(name) || value == null || req == null || res == null) { return; } Cookie cookie = new Cookie(name, value); cookie.setHttpOnly(httpOnly); cookie.setMaxAge(maxAge < 0 ? Config.SESSION_TIMEOUT_SEC : maxAge); cookie.setPath("/"); cookie.setSecure(req.isSecure()); res.addCookie(cookie); }
[ "public", "static", "void", "setRawCookie", "(", "String", "name", ",", "String", "value", ",", "HttpServletRequest", "req", ",", "HttpServletResponse", "res", ",", "boolean", "httpOnly", ",", "int", "maxAge", ")", "{", "if", "(", "StringUtils", ".", "isBlank"...
Sets a cookie. @param name the name @param value the value @param req HTTP request @param res HTTP response @param httpOnly HTTP only flag @param maxAge max age
[ "Sets", "a", "cookie", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/utils/HttpUtils.java#L104-L115
tvesalainen/lpg
src/main/java/org/vesalainen/parser/util/Input.java
Input.getInstance
public static <T> InputReader getInstance(T input, int size, Set<ParserFeature> features) throws IOException { return getInstance(input, size, UTF_8, features); }
java
public static <T> InputReader getInstance(T input, int size, Set<ParserFeature> features) throws IOException { return getInstance(input, size, UTF_8, features); }
[ "public", "static", "<", "T", ">", "InputReader", "getInstance", "(", "T", "input", ",", "int", "size", ",", "Set", "<", "ParserFeature", ">", "features", ")", "throws", "IOException", "{", "return", "getInstance", "(", "input", ",", "size", ",", "UTF_8", ...
Returns InputReader for input @param <T> @param input Any supported input type @param size Ring-buffer size @param features Needed features @return @throws IOException
[ "Returns", "InputReader", "for", "input" ]
train
https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/parser/util/Input.java#L217-L220
UrielCh/ovh-java-sdk
ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java
ApiOvhSms.serviceName_seeOffers_GET
public ArrayList<OvhPackOffer> serviceName_seeOffers_GET(String serviceName, OvhCountryEnum countryCurrencyPrice, net.minidev.ovh.api.sms.OvhCountryEnum countryDestination, OvhPackQuantityEnum quantity) throws IOException { String qPath = "/sms/{serviceName}/seeOffers"; StringBuilder sb = path(qPath, serviceName); query(sb, "countryCurrencyPrice", countryCurrencyPrice); query(sb, "countryDestination", countryDestination); query(sb, "quantity", quantity); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t5); }
java
public ArrayList<OvhPackOffer> serviceName_seeOffers_GET(String serviceName, OvhCountryEnum countryCurrencyPrice, net.minidev.ovh.api.sms.OvhCountryEnum countryDestination, OvhPackQuantityEnum quantity) throws IOException { String qPath = "/sms/{serviceName}/seeOffers"; StringBuilder sb = path(qPath, serviceName); query(sb, "countryCurrencyPrice", countryCurrencyPrice); query(sb, "countryDestination", countryDestination); query(sb, "quantity", quantity); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t5); }
[ "public", "ArrayList", "<", "OvhPackOffer", ">", "serviceName_seeOffers_GET", "(", "String", "serviceName", ",", "OvhCountryEnum", "countryCurrencyPrice", ",", "net", ".", "minidev", ".", "ovh", ".", "api", ".", "sms", ".", "OvhCountryEnum", "countryDestination", ",...
Describe SMS offers available. REST: GET /sms/{serviceName}/seeOffers @param countryCurrencyPrice [required] Filter to have the currency country prices @param countryDestination [required] Filter to have the country destination @param quantity [required] Sms pack offer quantity @param serviceName [required] The internal name of your SMS offer
[ "Describe", "SMS", "offers", "available", "." ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L1457-L1465
lightbend/config
config/src/main/java/com/typesafe/config/parser/ConfigDocumentFactory.java
ConfigDocumentFactory.parseFile
public static ConfigDocument parseFile(File file, ConfigParseOptions options) { return Parseable.newFile(file, options).parseConfigDocument(); }
java
public static ConfigDocument parseFile(File file, ConfigParseOptions options) { return Parseable.newFile(file, options).parseConfigDocument(); }
[ "public", "static", "ConfigDocument", "parseFile", "(", "File", "file", ",", "ConfigParseOptions", "options", ")", "{", "return", "Parseable", ".", "newFile", "(", "file", ",", "options", ")", ".", "parseConfigDocument", "(", ")", ";", "}" ]
Parses a file into a ConfigDocument instance. @param file the file to parse @param options parse options to control how the file is interpreted @return the parsed configuration @throws com.typesafe.config.ConfigException on IO or parse errors
[ "Parses", "a", "file", "into", "a", "ConfigDocument", "instance", "." ]
train
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/parser/ConfigDocumentFactory.java#L54-L56
stratosphere/stratosphere
stratosphere-core/src/main/java/eu/stratosphere/types/StringValue.java
StringValue.setValue
public void setValue(char[] chars, int offset, int len) { Validate.notNull(chars); if (offset < 0 || len < 0 || offset > chars.length - len) { throw new IndexOutOfBoundsException(); } ensureSize(len); System.arraycopy(chars, offset, this.value, 0, len); this.len = len; this.hashCode = 0; }
java
public void setValue(char[] chars, int offset, int len) { Validate.notNull(chars); if (offset < 0 || len < 0 || offset > chars.length - len) { throw new IndexOutOfBoundsException(); } ensureSize(len); System.arraycopy(chars, offset, this.value, 0, len); this.len = len; this.hashCode = 0; }
[ "public", "void", "setValue", "(", "char", "[", "]", "chars", ",", "int", "offset", ",", "int", "len", ")", "{", "Validate", ".", "notNull", "(", "chars", ")", ";", "if", "(", "offset", "<", "0", "||", "len", "<", "0", "||", "offset", ">", "chars...
Sets the value of the StringValue to a substring of the given value. @param chars The new string value (as a character array). @param offset The position to start the substring. @param len The length of the substring.
[ "Sets", "the", "value", "of", "the", "StringValue", "to", "a", "substring", "of", "the", "given", "value", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-core/src/main/java/eu/stratosphere/types/StringValue.java#L216-L226
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/topic/topicAccess/TopicAccessManager.java
TopicAccessManager.checkAccessTopicFromJsTopicControls
boolean checkAccessTopicFromJsTopicControls(UserContext ctx, String topic) throws IllegalAccessException { logger.debug("Looking for accessController for topic '{}' from JsTopicControls annotation", topic); Instance<JsTopicAccessController> select = topicAccessController.select(new JsTopicCtrlsAnnotationLiteral()); if(select.isUnsatisfied()) { return false; } return checkAccessTopicFromJsTopicAccessControllers(ctx, topic, select); }
java
boolean checkAccessTopicFromJsTopicControls(UserContext ctx, String topic) throws IllegalAccessException { logger.debug("Looking for accessController for topic '{}' from JsTopicControls annotation", topic); Instance<JsTopicAccessController> select = topicAccessController.select(new JsTopicCtrlsAnnotationLiteral()); if(select.isUnsatisfied()) { return false; } return checkAccessTopicFromJsTopicAccessControllers(ctx, topic, select); }
[ "boolean", "checkAccessTopicFromJsTopicControls", "(", "UserContext", "ctx", ",", "String", "topic", ")", "throws", "IllegalAccessException", "{", "logger", ".", "debug", "(", "\"Looking for accessController for topic '{}' from JsTopicControls annotation\"", ",", "topic", ")", ...
Check if specific access control is allowed @param ctx @param topic @return true if at least one specific topicAccessControl exist @throws IllegalAccessException
[ "Check", "if", "specific", "access", "control", "is", "allowed" ]
train
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/topicAccess/TopicAccessManager.java#L93-L100
Mozu/mozu-java
mozu-javaasync-core/src/main/java/com/mozu/api/urls/platform/ReferenceDataUrl.java
ReferenceDataUrl.getAddressSchemaUrl
public static MozuUrl getAddressSchemaUrl(String countryCode, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/platform/reference/addressschema/{countryCode}?responseFields={responseFields}"); formatter.formatUrl("countryCode", countryCode); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.HOME_POD) ; }
java
public static MozuUrl getAddressSchemaUrl(String countryCode, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/platform/reference/addressschema/{countryCode}?responseFields={responseFields}"); formatter.formatUrl("countryCode", countryCode); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.HOME_POD) ; }
[ "public", "static", "MozuUrl", "getAddressSchemaUrl", "(", "String", "countryCode", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/platform/reference/addressschema/{countryCode}?responseFields={responseFields}\"", ...
Get Resource Url for GetAddressSchema @param countryCode The 2-letter country code used to retrieve a specified address schema. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetAddressSchema" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/platform/ReferenceDataUrl.java#L22-L28
DV8FromTheWorld/JDA
src/main/java/com/iwebpp/crypto/TweetNaclFast.java
Box.after
public byte [] after(byte [] message, final int moff, final int mlen, byte [] theNonce) { // check message if (!(message!=null && message.length>=(moff+mlen) && theNonce!=null && theNonce.length==nonceLength)) return null; // message buffer byte [] m = new byte[mlen + zerobytesLength]; // cipher buffer byte [] c = new byte[m.length]; for (int i = 0; i < mlen; i ++) m[i+zerobytesLength] = message[i+moff]; if (0 != crypto_box_afternm(c, m, m.length, theNonce, sharedKey)) return null; // wrap byte_buf_t on c offset@boxzerobytesLength ///return new byte_buf_t(c, boxzerobytesLength, c.length-boxzerobytesLength); byte [] ret = new byte[c.length-boxzerobytesLength]; for (int i = 0; i < ret.length; i ++) ret[i] = c[i+boxzerobytesLength]; return ret; }
java
public byte [] after(byte [] message, final int moff, final int mlen, byte [] theNonce) { // check message if (!(message!=null && message.length>=(moff+mlen) && theNonce!=null && theNonce.length==nonceLength)) return null; // message buffer byte [] m = new byte[mlen + zerobytesLength]; // cipher buffer byte [] c = new byte[m.length]; for (int i = 0; i < mlen; i ++) m[i+zerobytesLength] = message[i+moff]; if (0 != crypto_box_afternm(c, m, m.length, theNonce, sharedKey)) return null; // wrap byte_buf_t on c offset@boxzerobytesLength ///return new byte_buf_t(c, boxzerobytesLength, c.length-boxzerobytesLength); byte [] ret = new byte[c.length-boxzerobytesLength]; for (int i = 0; i < ret.length; i ++) ret[i] = c[i+boxzerobytesLength]; return ret; }
[ "public", "byte", "[", "]", "after", "(", "byte", "[", "]", "message", ",", "final", "int", "moff", ",", "final", "int", "mlen", ",", "byte", "[", "]", "theNonce", ")", "{", "// check message", "if", "(", "!", "(", "message", "!=", "null", "&&", "m...
/* @description Same as nacl.box, but uses a shared key precomputed with nacl.box.before, and passes a nonce explicitly.
[ "/", "*" ]
train
https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/com/iwebpp/crypto/TweetNaclFast.java#L238-L264
looly/hutool
hutool-http/src/main/java/cn/hutool/http/HttpRequest.java
HttpRequest.appendPart
private void appendPart(String formFieldName, Resource resource, OutputStream out) { if (resource instanceof MultiResource) { // 多资源 for (Resource subResource : (MultiResource) resource) { appendPart(formFieldName, subResource, out); } } else { // 普通资源 final StringBuilder builder = StrUtil.builder().append("--").append(BOUNDARY).append(StrUtil.CRLF); final String fileName = resource.getName(); builder.append(StrUtil.format(CONTENT_DISPOSITION_FILE_TEMPLATE, formFieldName, ObjectUtil.defaultIfNull(fileName, formFieldName))); builder.append(StrUtil.format(CONTENT_TYPE_FILE_TEMPLATE, HttpUtil.getMimeType(fileName))); IoUtil.write(out, this.charset, false, builder); InputStream in = null; try { in = resource.getStream(); IoUtil.copy(in, out); } finally { IoUtil.close(in); } IoUtil.write(out, this.charset, false, StrUtil.CRLF); } }
java
private void appendPart(String formFieldName, Resource resource, OutputStream out) { if (resource instanceof MultiResource) { // 多资源 for (Resource subResource : (MultiResource) resource) { appendPart(formFieldName, subResource, out); } } else { // 普通资源 final StringBuilder builder = StrUtil.builder().append("--").append(BOUNDARY).append(StrUtil.CRLF); final String fileName = resource.getName(); builder.append(StrUtil.format(CONTENT_DISPOSITION_FILE_TEMPLATE, formFieldName, ObjectUtil.defaultIfNull(fileName, formFieldName))); builder.append(StrUtil.format(CONTENT_TYPE_FILE_TEMPLATE, HttpUtil.getMimeType(fileName))); IoUtil.write(out, this.charset, false, builder); InputStream in = null; try { in = resource.getStream(); IoUtil.copy(in, out); } finally { IoUtil.close(in); } IoUtil.write(out, this.charset, false, StrUtil.CRLF); } }
[ "private", "void", "appendPart", "(", "String", "formFieldName", ",", "Resource", "resource", ",", "OutputStream", "out", ")", "{", "if", "(", "resource", "instanceof", "MultiResource", ")", "{", "// 多资源\r", "for", "(", "Resource", "subResource", ":", "(", "Mu...
添加Multipart表单的数据项 @param formFieldName 表单名 @param resource 资源,可以是文件等 @param out Http流 @since 4.1.0
[ "添加Multipart表单的数据项" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpRequest.java#L1075-L1098
Azure/azure-sdk-for-java
sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsInner.java
FailoverGroupsInner.beginForceFailoverAllowDataLoss
public FailoverGroupInner beginForceFailoverAllowDataLoss(String resourceGroupName, String serverName, String failoverGroupName) { return beginForceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).toBlocking().single().body(); }
java
public FailoverGroupInner beginForceFailoverAllowDataLoss(String resourceGroupName, String serverName, String failoverGroupName) { return beginForceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).toBlocking().single().body(); }
[ "public", "FailoverGroupInner", "beginForceFailoverAllowDataLoss", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "failoverGroupName", ")", "{", "return", "beginForceFailoverAllowDataLossWithServiceResponseAsync", "(", "resourceGroupName", ",", ...
Fails over from the current primary server to this server. This operation might result in data loss. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server containing the failover group. @param failoverGroupName The name of the failover group. @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 FailoverGroupInner object if successful.
[ "Fails", "over", "from", "the", "current", "primary", "server", "to", "this", "server", ".", "This", "operation", "might", "result", "in", "data", "loss", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsInner.java#L1136-L1138
dmerkushov/os-helper
src/main/java/ru/dmerkushov/oshelper/OSHelper.java
OSHelper.procWait
public static int procWait (Process process, final long timeout) throws OSHelperException { long endTime = Calendar.getInstance ().getTimeInMillis () + timeout; boolean terminatedByItself = false; int toReturn = 0; while (Calendar.getInstance ().getTimeInMillis () < endTime) { try { process.exitValue (); terminatedByItself = true; toReturn = osh_PROCESS_EXITED_BY_ITSELF; } catch (IllegalThreadStateException ex) { terminatedByItself = false; } if (terminatedByItself) { break; } } if (!terminatedByItself) { process.destroy (); try { process.waitFor (); } catch (InterruptedException ex) { throw new OSHelperException (ex); } toReturn = osh_PROCESS_KILLED_BY_TIMEOUT; } return toReturn; }
java
public static int procWait (Process process, final long timeout) throws OSHelperException { long endTime = Calendar.getInstance ().getTimeInMillis () + timeout; boolean terminatedByItself = false; int toReturn = 0; while (Calendar.getInstance ().getTimeInMillis () < endTime) { try { process.exitValue (); terminatedByItself = true; toReturn = osh_PROCESS_EXITED_BY_ITSELF; } catch (IllegalThreadStateException ex) { terminatedByItself = false; } if (terminatedByItself) { break; } } if (!terminatedByItself) { process.destroy (); try { process.waitFor (); } catch (InterruptedException ex) { throw new OSHelperException (ex); } toReturn = osh_PROCESS_KILLED_BY_TIMEOUT; } return toReturn; }
[ "public", "static", "int", "procWait", "(", "Process", "process", ",", "final", "long", "timeout", ")", "throws", "OSHelperException", "{", "long", "endTime", "=", "Calendar", ".", "getInstance", "(", ")", ".", "getTimeInMillis", "(", ")", "+", "timeout", ";...
Waits for a specified process to terminate for the specified amount of milliseconds. If it is not terminated in the desired time, it is terminated explicitly. NOT TESTED!!! @param process @param timeout @return either <code>osh_PROCESS_EXITED_BY_ITSELF</code> * * * or <code>osh_PROCESS_KILLED_BY_TIMEOUT</code> @throws OSHelperException @deprecated Use ProcessReturn procWaitWithProcessReturn () instead
[ "Waits", "for", "a", "specified", "process", "to", "terminate", "for", "the", "specified", "amount", "of", "milliseconds", ".", "If", "it", "is", "not", "terminated", "in", "the", "desired", "time", "it", "is", "terminated", "explicitly", "." ]
train
https://github.com/dmerkushov/os-helper/blob/a7c2b72d289d9bc23ae106d1c5e11769cf3463d6/src/main/java/ru/dmerkushov/oshelper/OSHelper.java#L181-L212
aspectran/aspectran
shell/src/main/java/com/aspectran/shell/command/option/ParsedOptions.java
ParsedOptions.getValue
public String getValue(String name, String defaultValue) { return getValue(resolveOption(name), defaultValue); }
java
public String getValue(String name, String defaultValue) { return getValue(resolveOption(name), defaultValue); }
[ "public", "String", "getValue", "(", "String", "name", ",", "String", "defaultValue", ")", "{", "return", "getValue", "(", "resolveOption", "(", "name", ")", ",", "defaultValue", ")", ";", "}" ]
Retrieve the first argument, if any, of an option. @param name the name of the option @param defaultValue the default value to be returned if the option is not specified @return the value of the argument if option is set, and has an argument, otherwise {@code defaultValue}
[ "Retrieve", "the", "first", "argument", "if", "any", "of", "an", "option", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/shell/src/main/java/com/aspectran/shell/command/option/ParsedOptions.java#L272-L274
kiswanij/jk-util
src/main/java/com/jk/util/security/JKSecurityManager.java
JKSecurityManager.createPrivilige
public static JKPrivilige createPrivilige(String name, JKPrivilige parent, int number) { logger.trace("createPriviligeObject(): Id : ", ".name", name, ", Parent:[", parent, "] , ", number); JKPrivilige p = new JKPrivilige(name, parent, number); p.setDesc(p.getFullName()); return p; }
java
public static JKPrivilige createPrivilige(String name, JKPrivilige parent, int number) { logger.trace("createPriviligeObject(): Id : ", ".name", name, ", Parent:[", parent, "] , ", number); JKPrivilige p = new JKPrivilige(name, parent, number); p.setDesc(p.getFullName()); return p; }
[ "public", "static", "JKPrivilige", "createPrivilige", "(", "String", "name", ",", "JKPrivilige", "parent", ",", "int", "number", ")", "{", "logger", ".", "trace", "(", "\"createPriviligeObject(): Id : \"", ",", "\".name\"", ",", "name", ",", "\", Parent:[\"", ",",...
Creates the privilige. @param name the name @param parent the parent @param number the number @return the JK privilige
[ "Creates", "the", "privilige", "." ]
train
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/security/JKSecurityManager.java#L163-L168
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.getCreditPayments
public CreditPayments getCreditPayments(final String accountCode, final QueryParams params) { final String path = Accounts.ACCOUNTS_RESOURCE + "/" + accountCode + CreditPayments.CREDIT_PAYMENTS_RESOURCE; return doGET(path, CreditPayments.class, params); }
java
public CreditPayments getCreditPayments(final String accountCode, final QueryParams params) { final String path = Accounts.ACCOUNTS_RESOURCE + "/" + accountCode + CreditPayments.CREDIT_PAYMENTS_RESOURCE; return doGET(path, CreditPayments.class, params); }
[ "public", "CreditPayments", "getCreditPayments", "(", "final", "String", "accountCode", ",", "final", "QueryParams", "params", ")", "{", "final", "String", "path", "=", "Accounts", ".", "ACCOUNTS_RESOURCE", "+", "\"/\"", "+", "accountCode", "+", "CreditPayments", ...
Get Credit Payments for a given account <p> Returns information about all credit payments. @param accountCode The account code to filter @param params {@link QueryParams} @return CreditPayments on success, null otherwise
[ "Get", "Credit", "Payments", "for", "a", "given", "account", "<p", ">", "Returns", "information", "about", "all", "credit", "payments", "." ]
train
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L2037-L2040
goldmansachs/reladomo
reladomo/src/main/java/com/gs/fw/common/mithra/cacheloader/AbstractLoaderFactory.java
AbstractLoaderFactory.createLoadTasksPerBusinessDate
public void createLoadTasksPerBusinessDate(CacheLoaderContext context, Object sourceAttribute, BooleanFilter postLoadFilter) { if (context.getRefreshInterval() != null) { this.createLoadTasksForRefresh(context, sourceAttribute, postLoadFilter); } else { this.createLoadTasksForInitialLoad(context, sourceAttribute, postLoadFilter); } }
java
public void createLoadTasksPerBusinessDate(CacheLoaderContext context, Object sourceAttribute, BooleanFilter postLoadFilter) { if (context.getRefreshInterval() != null) { this.createLoadTasksForRefresh(context, sourceAttribute, postLoadFilter); } else { this.createLoadTasksForInitialLoad(context, sourceAttribute, postLoadFilter); } }
[ "public", "void", "createLoadTasksPerBusinessDate", "(", "CacheLoaderContext", "context", ",", "Object", "sourceAttribute", ",", "BooleanFilter", "postLoadFilter", ")", "{", "if", "(", "context", ".", "getRefreshInterval", "(", ")", "!=", "null", ")", "{", "this", ...
combine business date (from this.buildLoadOperation), source attribute (from this.addSourceAttributeOperation) and processing time (from this.buildRefreshOperations)
[ "combine", "business", "date", "(", "from", "this", ".", "buildLoadOperation", ")", "source", "attribute", "(", "from", "this", ".", "addSourceAttributeOperation", ")", "and", "processing", "time", "(", "from", "this", ".", "buildRefreshOperations", ")" ]
train
https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/cacheloader/AbstractLoaderFactory.java#L86-L96
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java
ApiOvhDedicatedserver.serviceName_intervention_interventionId_GET
public OvhIntervention serviceName_intervention_interventionId_GET(String serviceName, Long interventionId) throws IOException { String qPath = "/dedicated/server/{serviceName}/intervention/{interventionId}"; StringBuilder sb = path(qPath, serviceName, interventionId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhIntervention.class); }
java
public OvhIntervention serviceName_intervention_interventionId_GET(String serviceName, Long interventionId) throws IOException { String qPath = "/dedicated/server/{serviceName}/intervention/{interventionId}"; StringBuilder sb = path(qPath, serviceName, interventionId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhIntervention.class); }
[ "public", "OvhIntervention", "serviceName_intervention_interventionId_GET", "(", "String", "serviceName", ",", "Long", "interventionId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/server/{serviceName}/intervention/{interventionId}\"", ";", "StringBui...
Get this object properties REST: GET /dedicated/server/{serviceName}/intervention/{interventionId} @param serviceName [required] The internal name of your dedicated server @param interventionId [required] The intervention 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#L650-L655