repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
BranchMetrics/android-branch-deep-linking
Branch-SDK/src/io/branch/referral/ExtendedAnswerProvider.java
ExtendedAnswerProvider.addJsonObjectToKitEvent
private void addJsonObjectToKitEvent(KitEvent kitEvent, JSONObject jsonData, String keyPathPrepend) throws JSONException { """ <p> Converts the given JsonObject to key-value pairs and update the {@link KitEvent} </p> @param kitEvent {@link KitEvent} to update with key-value pairs from the JsonObject @param jsonData {@link JSONObject} to add to the {@link KitEvent} @param keyPathPrepend {@link String} with value to prepend to the keys adding to the {@link KitEvent} @throws JSONException {@link JSONException} on any Json converting errors """ Iterator<String> keyIterator = jsonData.keys(); while (keyIterator.hasNext()) { String key = keyIterator.next(); Object value = jsonData.get(key); if (!key.startsWith(EXTRA_PARAM_NOTATION)) { if (value instanceof JSONObject) { addJsonObjectToKitEvent(kitEvent, (JSONObject) value, keyPathPrepend + key + INNER_PARAM_NOTATION); } else if (value instanceof JSONArray) { addJsonArrayToKitEvent(kitEvent, (JSONArray) value, key + INNER_PARAM_NOTATION); } else { addBranchAttributes(kitEvent, keyPathPrepend, key, jsonData.getString(key)); } } } }
java
private void addJsonObjectToKitEvent(KitEvent kitEvent, JSONObject jsonData, String keyPathPrepend) throws JSONException { Iterator<String> keyIterator = jsonData.keys(); while (keyIterator.hasNext()) { String key = keyIterator.next(); Object value = jsonData.get(key); if (!key.startsWith(EXTRA_PARAM_NOTATION)) { if (value instanceof JSONObject) { addJsonObjectToKitEvent(kitEvent, (JSONObject) value, keyPathPrepend + key + INNER_PARAM_NOTATION); } else if (value instanceof JSONArray) { addJsonArrayToKitEvent(kitEvent, (JSONArray) value, key + INNER_PARAM_NOTATION); } else { addBranchAttributes(kitEvent, keyPathPrepend, key, jsonData.getString(key)); } } } }
[ "private", "void", "addJsonObjectToKitEvent", "(", "KitEvent", "kitEvent", ",", "JSONObject", "jsonData", ",", "String", "keyPathPrepend", ")", "throws", "JSONException", "{", "Iterator", "<", "String", ">", "keyIterator", "=", "jsonData", ".", "keys", "(", ")", ";", "while", "(", "keyIterator", ".", "hasNext", "(", ")", ")", "{", "String", "key", "=", "keyIterator", ".", "next", "(", ")", ";", "Object", "value", "=", "jsonData", ".", "get", "(", "key", ")", ";", "if", "(", "!", "key", ".", "startsWith", "(", "EXTRA_PARAM_NOTATION", ")", ")", "{", "if", "(", "value", "instanceof", "JSONObject", ")", "{", "addJsonObjectToKitEvent", "(", "kitEvent", ",", "(", "JSONObject", ")", "value", ",", "keyPathPrepend", "+", "key", "+", "INNER_PARAM_NOTATION", ")", ";", "}", "else", "if", "(", "value", "instanceof", "JSONArray", ")", "{", "addJsonArrayToKitEvent", "(", "kitEvent", ",", "(", "JSONArray", ")", "value", ",", "key", "+", "INNER_PARAM_NOTATION", ")", ";", "}", "else", "{", "addBranchAttributes", "(", "kitEvent", ",", "keyPathPrepend", ",", "key", ",", "jsonData", ".", "getString", "(", "key", ")", ")", ";", "}", "}", "}", "}" ]
<p> Converts the given JsonObject to key-value pairs and update the {@link KitEvent} </p> @param kitEvent {@link KitEvent} to update with key-value pairs from the JsonObject @param jsonData {@link JSONObject} to add to the {@link KitEvent} @param keyPathPrepend {@link String} with value to prepend to the keys adding to the {@link KitEvent} @throws JSONException {@link JSONException} on any Json converting errors
[ "<p", ">", "Converts", "the", "given", "JsonObject", "to", "key", "-", "value", "pairs", "and", "update", "the", "{", "@link", "KitEvent", "}", "<", "/", "p", ">" ]
train
https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/ExtendedAnswerProvider.java#L63-L79
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.updateRegexEntityRoleAsync
public Observable<OperationStatus> updateRegexEntityRoleAsync(UUID appId, String versionId, UUID entityId, UUID roleId, UpdateRegexEntityRoleOptionalParameter updateRegexEntityRoleOptionalParameter) { """ Update an entity role for a given entity. @param appId The application ID. @param versionId The version ID. @param entityId The entity ID. @param roleId The entity role ID. @param updateRegexEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object """ return updateRegexEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId, updateRegexEntityRoleOptionalParameter).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
java
public Observable<OperationStatus> updateRegexEntityRoleAsync(UUID appId, String versionId, UUID entityId, UUID roleId, UpdateRegexEntityRoleOptionalParameter updateRegexEntityRoleOptionalParameter) { return updateRegexEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId, updateRegexEntityRoleOptionalParameter).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatus", ">", "updateRegexEntityRoleAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "entityId", ",", "UUID", "roleId", ",", "UpdateRegexEntityRoleOptionalParameter", "updateRegexEntityRoleOptionalParameter", ")", "{", "return", "updateRegexEntityRoleWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "entityId", ",", "roleId", ",", "updateRegexEntityRoleOptionalParameter", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "OperationStatus", ">", ",", "OperationStatus", ">", "(", ")", "{", "@", "Override", "public", "OperationStatus", "call", "(", "ServiceResponse", "<", "OperationStatus", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Update an entity role for a given entity. @param appId The application ID. @param versionId The version ID. @param entityId The entity ID. @param roleId The entity role ID. @param updateRegexEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object
[ "Update", "an", "entity", "role", "for", "a", "given", "entity", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L12082-L12089
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java
Widget.addChild
protected boolean addChild(Widget child, int index, boolean preventLayout) { """ Add another {@link Widget} as a child of this one. Overload to intercept all child adds. @param child The {@code Widget} to add as a child. @param index Position at which to add the child. Pass -1 to add at end. @param preventLayout The {@code Widget} whether to call layout(). @return {@code True} if {@code child} was added; {@code false} if {@code child} was previously added to this instance. """ return addChild(child, child.getSceneObject(), index, preventLayout); }
java
protected boolean addChild(Widget child, int index, boolean preventLayout) { return addChild(child, child.getSceneObject(), index, preventLayout); }
[ "protected", "boolean", "addChild", "(", "Widget", "child", ",", "int", "index", ",", "boolean", "preventLayout", ")", "{", "return", "addChild", "(", "child", ",", "child", ".", "getSceneObject", "(", ")", ",", "index", ",", "preventLayout", ")", ";", "}" ]
Add another {@link Widget} as a child of this one. Overload to intercept all child adds. @param child The {@code Widget} to add as a child. @param index Position at which to add the child. Pass -1 to add at end. @param preventLayout The {@code Widget} whether to call layout(). @return {@code True} if {@code child} was added; {@code false} if {@code child} was previously added to this instance.
[ "Add", "another", "{", "@link", "Widget", "}", "as", "a", "child", "of", "this", "one", ".", "Overload", "to", "intercept", "all", "child", "adds", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java#L2919-L2921
GoogleCloudPlatform/bigdata-interop
gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageFileSystem.java
GoogleCloudStorageFileSystem.getPath
@Deprecated public static URI getPath(String bucketName, String objectName, boolean allowEmptyObjectName) { """ Construct a URI using the legacy path codec. @deprecated This method is deprecated as each instance of GCS FS can be configured with a codec. """ return LEGACY_PATH_CODEC.getPath(bucketName, objectName, allowEmptyObjectName); }
java
@Deprecated public static URI getPath(String bucketName, String objectName, boolean allowEmptyObjectName) { return LEGACY_PATH_CODEC.getPath(bucketName, objectName, allowEmptyObjectName); }
[ "@", "Deprecated", "public", "static", "URI", "getPath", "(", "String", "bucketName", ",", "String", "objectName", ",", "boolean", "allowEmptyObjectName", ")", "{", "return", "LEGACY_PATH_CODEC", ".", "getPath", "(", "bucketName", ",", "objectName", ",", "allowEmptyObjectName", ")", ";", "}" ]
Construct a URI using the legacy path codec. @deprecated This method is deprecated as each instance of GCS FS can be configured with a codec.
[ "Construct", "a", "URI", "using", "the", "legacy", "path", "codec", "." ]
train
https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageFileSystem.java#L1547-L1550
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4CallableStatement.java
JDBC4CallableStatement.getObject
@Override public Object getObject(String parameterName, Map<String,Class<?>> map) throws SQLException { """ Returns an object representing the value of OUT parameter parameterName and uses map for the custom mapping of the parameter value. """ checkClosed(); throw SQLError.noSupport(); }
java
@Override public Object getObject(String parameterName, Map<String,Class<?>> map) throws SQLException { checkClosed(); throw SQLError.noSupport(); }
[ "@", "Override", "public", "Object", "getObject", "(", "String", "parameterName", ",", "Map", "<", "String", ",", "Class", "<", "?", ">", ">", "map", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "throw", "SQLError", ".", "noSupport", "(", ")", ";", "}" ]
Returns an object representing the value of OUT parameter parameterName and uses map for the custom mapping of the parameter value.
[ "Returns", "an", "object", "representing", "the", "value", "of", "OUT", "parameter", "parameterName", "and", "uses", "map", "for", "the", "custom", "mapping", "of", "the", "parameter", "value", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4CallableStatement.java#L351-L356
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java
SerializedFormBuilder.serialClassInclude
private static boolean serialClassInclude(Utils utils, TypeElement te) { """ Returns true if the given TypeElement should be included in the serialized form. @param te the TypeElement object to check for serializability. """ if (utils.isEnum(te)) { return false; } if (utils.isSerializable(te)) { if (!utils.getSerialTrees(te).isEmpty()) { return serialDocInclude(utils, te); } else if (utils.isPublic(te) || utils.isProtected(te)) { return true; } else { return false; } } return false; }
java
private static boolean serialClassInclude(Utils utils, TypeElement te) { if (utils.isEnum(te)) { return false; } if (utils.isSerializable(te)) { if (!utils.getSerialTrees(te).isEmpty()) { return serialDocInclude(utils, te); } else if (utils.isPublic(te) || utils.isProtected(te)) { return true; } else { return false; } } return false; }
[ "private", "static", "boolean", "serialClassInclude", "(", "Utils", "utils", ",", "TypeElement", "te", ")", "{", "if", "(", "utils", ".", "isEnum", "(", "te", ")", ")", "{", "return", "false", ";", "}", "if", "(", "utils", ".", "isSerializable", "(", "te", ")", ")", "{", "if", "(", "!", "utils", ".", "getSerialTrees", "(", "te", ")", ".", "isEmpty", "(", ")", ")", "{", "return", "serialDocInclude", "(", "utils", ",", "te", ")", ";", "}", "else", "if", "(", "utils", ".", "isPublic", "(", "te", ")", "||", "utils", ".", "isProtected", "(", "te", ")", ")", "{", "return", "true", ";", "}", "else", "{", "return", "false", ";", "}", "}", "return", "false", ";", "}" ]
Returns true if the given TypeElement should be included in the serialized form. @param te the TypeElement object to check for serializability.
[ "Returns", "true", "if", "the", "given", "TypeElement", "should", "be", "included", "in", "the", "serialized", "form", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java#L570-L584
alipay/sofa-rpc
core/api/src/main/java/com/alipay/sofa/rpc/filter/FilterInvoker.java
FilterInvoker.buildMethodKey
private String buildMethodKey(String methodName, String key) { """ Buildmkey string. @param methodName the method name @param key the key @return the string """ return RpcConstants.HIDE_KEY_PREFIX + methodName + RpcConstants.HIDE_KEY_PREFIX + key; }
java
private String buildMethodKey(String methodName, String key) { return RpcConstants.HIDE_KEY_PREFIX + methodName + RpcConstants.HIDE_KEY_PREFIX + key; }
[ "private", "String", "buildMethodKey", "(", "String", "methodName", ",", "String", "key", ")", "{", "return", "RpcConstants", ".", "HIDE_KEY_PREFIX", "+", "methodName", "+", "RpcConstants", ".", "HIDE_KEY_PREFIX", "+", "key", ";", "}" ]
Buildmkey string. @param methodName the method name @param key the key @return the string
[ "Buildmkey", "string", "." ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/filter/FilterInvoker.java#L217-L219
Swagger2Markup/swagger2markup
src/main/java/io/github/swagger2markup/internal/component/PathOperationComponent.java
PathOperationComponent.buildSectionTitle
private void buildSectionTitle(MarkupDocBuilder markupDocBuilder, String title) { """ Adds a operation section title to the document. @param title the section title """ if (config.getPathsGroupedBy() == GroupBy.AS_IS) { markupDocBuilder.sectionTitleLevel3(title); } else { markupDocBuilder.sectionTitleLevel4(title); } }
java
private void buildSectionTitle(MarkupDocBuilder markupDocBuilder, String title) { if (config.getPathsGroupedBy() == GroupBy.AS_IS) { markupDocBuilder.sectionTitleLevel3(title); } else { markupDocBuilder.sectionTitleLevel4(title); } }
[ "private", "void", "buildSectionTitle", "(", "MarkupDocBuilder", "markupDocBuilder", ",", "String", "title", ")", "{", "if", "(", "config", ".", "getPathsGroupedBy", "(", ")", "==", "GroupBy", ".", "AS_IS", ")", "{", "markupDocBuilder", ".", "sectionTitleLevel3", "(", "title", ")", ";", "}", "else", "{", "markupDocBuilder", ".", "sectionTitleLevel4", "(", "title", ")", ";", "}", "}" ]
Adds a operation section title to the document. @param title the section title
[ "Adds", "a", "operation", "section", "title", "to", "the", "document", "." ]
train
https://github.com/Swagger2Markup/swagger2markup/blob/da83465f19a2f8a0f1fba873b5762bca8587896b/src/main/java/io/github/swagger2markup/internal/component/PathOperationComponent.java#L242-L248
alkacon/opencms-core
src/org/opencms/relations/CmsCategoryService.java
CmsCategoryService.deleteCategory
public void deleteCategory(CmsObject cms, String categoryPath, String referencePath) throws CmsException { """ Deletes the category identified by the given path.<p> Only the most global category matching the given category path for the given resource will be affected.<p> This method will try to lock the involved resource.<p> @param cms the current cms context @param categoryPath the path of the category to delete @param referencePath the reference path to find the category repositories @throws CmsException if something goes wrong """ CmsCategory category = readCategory(cms, categoryPath, referencePath); String folderPath = cms.getRequestContext().removeSiteRoot(category.getRootPath()); CmsLock lock = cms.getLock(folderPath); if (lock.isNullLock()) { cms.lockResource(folderPath); } else if (lock.isLockableBy(cms.getRequestContext().getCurrentUser())) { cms.changeLock(folderPath); } cms.deleteResource(folderPath, CmsResource.DELETE_PRESERVE_SIBLINGS); }
java
public void deleteCategory(CmsObject cms, String categoryPath, String referencePath) throws CmsException { CmsCategory category = readCategory(cms, categoryPath, referencePath); String folderPath = cms.getRequestContext().removeSiteRoot(category.getRootPath()); CmsLock lock = cms.getLock(folderPath); if (lock.isNullLock()) { cms.lockResource(folderPath); } else if (lock.isLockableBy(cms.getRequestContext().getCurrentUser())) { cms.changeLock(folderPath); } cms.deleteResource(folderPath, CmsResource.DELETE_PRESERVE_SIBLINGS); }
[ "public", "void", "deleteCategory", "(", "CmsObject", "cms", ",", "String", "categoryPath", ",", "String", "referencePath", ")", "throws", "CmsException", "{", "CmsCategory", "category", "=", "readCategory", "(", "cms", ",", "categoryPath", ",", "referencePath", ")", ";", "String", "folderPath", "=", "cms", ".", "getRequestContext", "(", ")", ".", "removeSiteRoot", "(", "category", ".", "getRootPath", "(", ")", ")", ";", "CmsLock", "lock", "=", "cms", ".", "getLock", "(", "folderPath", ")", ";", "if", "(", "lock", ".", "isNullLock", "(", ")", ")", "{", "cms", ".", "lockResource", "(", "folderPath", ")", ";", "}", "else", "if", "(", "lock", ".", "isLockableBy", "(", "cms", ".", "getRequestContext", "(", ")", ".", "getCurrentUser", "(", ")", ")", ")", "{", "cms", ".", "changeLock", "(", "folderPath", ")", ";", "}", "cms", ".", "deleteResource", "(", "folderPath", ",", "CmsResource", ".", "DELETE_PRESERVE_SIBLINGS", ")", ";", "}" ]
Deletes the category identified by the given path.<p> Only the most global category matching the given category path for the given resource will be affected.<p> This method will try to lock the involved resource.<p> @param cms the current cms context @param categoryPath the path of the category to delete @param referencePath the reference path to find the category repositories @throws CmsException if something goes wrong
[ "Deletes", "the", "category", "identified", "by", "the", "given", "path", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/relations/CmsCategoryService.java#L248-L259
alkacon/opencms-core
src-modules/org/opencms/workplace/tools/database/CmsHtmlImportConverter.java
CmsHtmlImportConverter.writeMetaTagProperty
private void writeMetaTagProperty(Node node, Hashtable properties) { """ Writes meta tags as cms properties by analyzing the meta tags nodes.<p> @param node the meta tag node in html document @param properties the properties hashtable """ NamedNodeMap attrs = node.getAttributes(); String metaName = ""; String metaContent = ""; // look through all attribs to find the name and content attributes for (int i = attrs.getLength() - 1; i >= 0; i--) { String name = attrs.item(i).getNodeName(); String value = attrs.item(i).getNodeValue(); if (name.equals(ATTRIB_NAME)) { metaName = value; } else if (name.equals(ATTRIB_CONTENT)) { metaContent = value; } } // check if we have valid entries for this <META> node, store them // in the properties if ((metaName.length() > 0) && (metaContent.length() > 0)) { properties.put(metaName, CmsStringUtil.substitute(metaContent, "{subst}", "&#")); } }
java
private void writeMetaTagProperty(Node node, Hashtable properties) { NamedNodeMap attrs = node.getAttributes(); String metaName = ""; String metaContent = ""; // look through all attribs to find the name and content attributes for (int i = attrs.getLength() - 1; i >= 0; i--) { String name = attrs.item(i).getNodeName(); String value = attrs.item(i).getNodeValue(); if (name.equals(ATTRIB_NAME)) { metaName = value; } else if (name.equals(ATTRIB_CONTENT)) { metaContent = value; } } // check if we have valid entries for this <META> node, store them // in the properties if ((metaName.length() > 0) && (metaContent.length() > 0)) { properties.put(metaName, CmsStringUtil.substitute(metaContent, "{subst}", "&#")); } }
[ "private", "void", "writeMetaTagProperty", "(", "Node", "node", ",", "Hashtable", "properties", ")", "{", "NamedNodeMap", "attrs", "=", "node", ".", "getAttributes", "(", ")", ";", "String", "metaName", "=", "\"\"", ";", "String", "metaContent", "=", "\"\"", ";", "// look through all attribs to find the name and content attributes", "for", "(", "int", "i", "=", "attrs", ".", "getLength", "(", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "String", "name", "=", "attrs", ".", "item", "(", "i", ")", ".", "getNodeName", "(", ")", ";", "String", "value", "=", "attrs", ".", "item", "(", "i", ")", ".", "getNodeValue", "(", ")", ";", "if", "(", "name", ".", "equals", "(", "ATTRIB_NAME", ")", ")", "{", "metaName", "=", "value", ";", "}", "else", "if", "(", "name", ".", "equals", "(", "ATTRIB_CONTENT", ")", ")", "{", "metaContent", "=", "value", ";", "}", "}", "// check if we have valid entries for this <META> node, store them", "// in the properties", "if", "(", "(", "metaName", ".", "length", "(", ")", ">", "0", ")", "&&", "(", "metaContent", ".", "length", "(", ")", ">", "0", ")", ")", "{", "properties", ".", "put", "(", "metaName", ",", "CmsStringUtil", ".", "substitute", "(", "metaContent", ",", "\"{subst}\"", ",", "\"&#\"", ")", ")", ";", "}", "}" ]
Writes meta tags as cms properties by analyzing the meta tags nodes.<p> @param node the meta tag node in html document @param properties the properties hashtable
[ "Writes", "meta", "tags", "as", "cms", "properties", "by", "analyzing", "the", "meta", "tags", "nodes", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/database/CmsHtmlImportConverter.java#L562-L582
apache/incubator-gobblin
gobblin-api/src/main/java/org/apache/gobblin/publisher/SingleTaskDataPublisher.java
SingleTaskDataPublisher.getInstance
public static SingleTaskDataPublisher getInstance(Class<? extends DataPublisher> dataPublisherClass, State state) throws ReflectiveOperationException { """ Get an instance of {@link SingleTaskDataPublisher}. @param dataPublisherClass A concrete class that extends {@link SingleTaskDataPublisher}. @param state A {@link State} used to instantiate the {@link SingleTaskDataPublisher}. @return A {@link SingleTaskDataPublisher} instance. @throws ReflectiveOperationException """ Preconditions.checkArgument(SingleTaskDataPublisher.class.isAssignableFrom(dataPublisherClass), String.format("Cannot instantiate %s since it does not extend %s", dataPublisherClass.getSimpleName(), SingleTaskDataPublisher.class.getSimpleName())); return (SingleTaskDataPublisher) DataPublisher.getInstance(dataPublisherClass, state); }
java
public static SingleTaskDataPublisher getInstance(Class<? extends DataPublisher> dataPublisherClass, State state) throws ReflectiveOperationException { Preconditions.checkArgument(SingleTaskDataPublisher.class.isAssignableFrom(dataPublisherClass), String.format("Cannot instantiate %s since it does not extend %s", dataPublisherClass.getSimpleName(), SingleTaskDataPublisher.class.getSimpleName())); return (SingleTaskDataPublisher) DataPublisher.getInstance(dataPublisherClass, state); }
[ "public", "static", "SingleTaskDataPublisher", "getInstance", "(", "Class", "<", "?", "extends", "DataPublisher", ">", "dataPublisherClass", ",", "State", "state", ")", "throws", "ReflectiveOperationException", "{", "Preconditions", ".", "checkArgument", "(", "SingleTaskDataPublisher", ".", "class", ".", "isAssignableFrom", "(", "dataPublisherClass", ")", ",", "String", ".", "format", "(", "\"Cannot instantiate %s since it does not extend %s\"", ",", "dataPublisherClass", ".", "getSimpleName", "(", ")", ",", "SingleTaskDataPublisher", ".", "class", ".", "getSimpleName", "(", ")", ")", ")", ";", "return", "(", "SingleTaskDataPublisher", ")", "DataPublisher", ".", "getInstance", "(", "dataPublisherClass", ",", "state", ")", ";", "}" ]
Get an instance of {@link SingleTaskDataPublisher}. @param dataPublisherClass A concrete class that extends {@link SingleTaskDataPublisher}. @param state A {@link State} used to instantiate the {@link SingleTaskDataPublisher}. @return A {@link SingleTaskDataPublisher} instance. @throws ReflectiveOperationException
[ "Get", "an", "instance", "of", "{", "@link", "SingleTaskDataPublisher", "}", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-api/src/main/java/org/apache/gobblin/publisher/SingleTaskDataPublisher.java#L70-L77
sagiegurari/fax4j
src/main/java/org/fax4j/spi/hylafax/HylaFaxJob.java
HylaFaxJob.setProperty
public void setProperty(String key,String value) { """ This function sets the fax job property. @param key The property key @param value The property value """ try { this.JOB.setProperty(key,value); } catch(Exception exception) { throw new FaxException("Error while setting job property.",exception); } }
java
public void setProperty(String key,String value) { try { this.JOB.setProperty(key,value); } catch(Exception exception) { throw new FaxException("Error while setting job property.",exception); } }
[ "public", "void", "setProperty", "(", "String", "key", ",", "String", "value", ")", "{", "try", "{", "this", ".", "JOB", ".", "setProperty", "(", "key", ",", "value", ")", ";", "}", "catch", "(", "Exception", "exception", ")", "{", "throw", "new", "FaxException", "(", "\"Error while setting job property.\"", ",", "exception", ")", ";", "}", "}" ]
This function sets the fax job property. @param key The property key @param value The property value
[ "This", "function", "sets", "the", "fax", "job", "property", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/hylafax/HylaFaxJob.java#L308-L318
opsmatters/newrelic-api
src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java
HttpContext.handleResponseError
private void handleResponseError(String method, URI uri, Response response) { """ Handle HTTP error responses if {@link #throwExceptions() throwExceptions} returns <CODE>true</CODE>. @param method The HTTP method type @param uri The URI used for the HTTP call @param response The HTTP call response """ if(throwExceptions && response.getStatus() != 200 && response.getStatus() != 201 && response.getStatus() != 204) { ErrorResponse error = null; if(response.hasEntity()) error = response.readEntity(ERROR); throw new ErrorResponseException(method, response.getStatus(), response.getStatusInfo().getReasonPhrase(), error); } }
java
private void handleResponseError(String method, URI uri, Response response) { if(throwExceptions && response.getStatus() != 200 && response.getStatus() != 201 && response.getStatus() != 204) { ErrorResponse error = null; if(response.hasEntity()) error = response.readEntity(ERROR); throw new ErrorResponseException(method, response.getStatus(), response.getStatusInfo().getReasonPhrase(), error); } }
[ "private", "void", "handleResponseError", "(", "String", "method", ",", "URI", "uri", ",", "Response", "response", ")", "{", "if", "(", "throwExceptions", "&&", "response", ".", "getStatus", "(", ")", "!=", "200", "&&", "response", ".", "getStatus", "(", ")", "!=", "201", "&&", "response", ".", "getStatus", "(", ")", "!=", "204", ")", "{", "ErrorResponse", "error", "=", "null", ";", "if", "(", "response", ".", "hasEntity", "(", ")", ")", "error", "=", "response", ".", "readEntity", "(", "ERROR", ")", ";", "throw", "new", "ErrorResponseException", "(", "method", ",", "response", ".", "getStatus", "(", ")", ",", "response", ".", "getStatusInfo", "(", ")", ".", "getReasonPhrase", "(", ")", ",", "error", ")", ";", "}", "}" ]
Handle HTTP error responses if {@link #throwExceptions() throwExceptions} returns <CODE>true</CODE>. @param method The HTTP method type @param uri The URI used for the HTTP call @param response The HTTP call response
[ "Handle", "HTTP", "error", "responses", "if", "{" ]
train
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java#L622-L635
ebean-orm/ebean-mocker
src/main/java/io/ebean/MockiEbean.java
MockiEbean.runWithMock
public static <V> V runWithMock(EbeanServer mock, Callable<V> test) throws Exception { """ Run the test runnable using the mock EbeanServer and restoring the original EbeanServer afterward. @param mock the mock instance that becomes the default EbeanServer @param test typically some test code as a callable """ return start(mock).run(test); }
java
public static <V> V runWithMock(EbeanServer mock, Callable<V> test) throws Exception { return start(mock).run(test); }
[ "public", "static", "<", "V", ">", "V", "runWithMock", "(", "EbeanServer", "mock", ",", "Callable", "<", "V", ">", "test", ")", "throws", "Exception", "{", "return", "start", "(", "mock", ")", ".", "run", "(", "test", ")", ";", "}" ]
Run the test runnable using the mock EbeanServer and restoring the original EbeanServer afterward. @param mock the mock instance that becomes the default EbeanServer @param test typically some test code as a callable
[ "Run", "the", "test", "runnable", "using", "the", "mock", "EbeanServer", "and", "restoring", "the", "original", "EbeanServer", "afterward", "." ]
train
https://github.com/ebean-orm/ebean-mocker/blob/98c14a58253e8cd40b2a0c9b49526a307079389a/src/main/java/io/ebean/MockiEbean.java#L107-L110
apache/incubator-druid
core/src/main/java/org/apache/druid/collections/CombiningIterable.java
CombiningIterable.createSplatted
@SuppressWarnings("unchecked") public static <InType> CombiningIterable<InType> createSplatted( Iterable<? extends Iterable<InType>> in, Comparator<InType> comparator ) { """ Creates a CombiningIterable around a MergeIterable such that equivalent elements are thrown away If there are multiple Iterables in parameter "in" with equivalent objects, there are no guarantees around which object will win. You will get *some* object from one of the Iterables, but which Iterable is unknown. @param in An Iterable of Iterables to be merged @param comparator the Comparator to determine sort and equality @param <InType> Type of object @return An Iterable that is the merge of all Iterables from in such that there is only one instance of equivalent objects. """ return create( new MergeIterable<InType>(comparator, (Iterable<Iterable<InType>>) in), comparator, new BinaryFn<InType, InType, InType>() { @Override public InType apply(InType arg1, InType arg2) { if (arg1 == null) { return arg2; } return arg1; } } ); }
java
@SuppressWarnings("unchecked") public static <InType> CombiningIterable<InType> createSplatted( Iterable<? extends Iterable<InType>> in, Comparator<InType> comparator ) { return create( new MergeIterable<InType>(comparator, (Iterable<Iterable<InType>>) in), comparator, new BinaryFn<InType, InType, InType>() { @Override public InType apply(InType arg1, InType arg2) { if (arg1 == null) { return arg2; } return arg1; } } ); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "InType", ">", "CombiningIterable", "<", "InType", ">", "createSplatted", "(", "Iterable", "<", "?", "extends", "Iterable", "<", "InType", ">", ">", "in", ",", "Comparator", "<", "InType", ">", "comparator", ")", "{", "return", "create", "(", "new", "MergeIterable", "<", "InType", ">", "(", "comparator", ",", "(", "Iterable", "<", "Iterable", "<", "InType", ">", ">", ")", "in", ")", ",", "comparator", ",", "new", "BinaryFn", "<", "InType", ",", "InType", ",", "InType", ">", "(", ")", "{", "@", "Override", "public", "InType", "apply", "(", "InType", "arg1", ",", "InType", "arg2", ")", "{", "if", "(", "arg1", "==", "null", ")", "{", "return", "arg2", ";", "}", "return", "arg1", ";", "}", "}", ")", ";", "}" ]
Creates a CombiningIterable around a MergeIterable such that equivalent elements are thrown away If there are multiple Iterables in parameter "in" with equivalent objects, there are no guarantees around which object will win. You will get *some* object from one of the Iterables, but which Iterable is unknown. @param in An Iterable of Iterables to be merged @param comparator the Comparator to determine sort and equality @param <InType> Type of object @return An Iterable that is the merge of all Iterables from in such that there is only one instance of equivalent objects.
[ "Creates", "a", "CombiningIterable", "around", "a", "MergeIterable", "such", "that", "equivalent", "elements", "are", "thrown", "away" ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/collections/CombiningIterable.java#L45-L66
azkaban/azkaban
azkaban-web-server/src/main/java/azkaban/scheduler/QuartzScheduler.java
QuartzScheduler.isJobPaused
public synchronized boolean isJobPaused(final String jobName, final String groupName) throws SchedulerException { """ Check if job is paused. @return true if job is paused, false otherwise. """ if (!ifJobExist(jobName, groupName)) { throw new SchedulerException(String.format("Job (job name %s, group name %s) doesn't " + "exist'", jobName, groupName)); } final JobKey jobKey = new JobKey(jobName, groupName); final JobDetail jobDetail = this.scheduler.getJobDetail(jobKey); final List<? extends Trigger> triggers = this.scheduler.getTriggersOfJob(jobDetail.getKey()); for (final Trigger trigger : triggers) { final TriggerState triggerState = this.scheduler.getTriggerState(trigger.getKey()); if (TriggerState.PAUSED.equals(triggerState)) { return true; } } return false; }
java
public synchronized boolean isJobPaused(final String jobName, final String groupName) throws SchedulerException { if (!ifJobExist(jobName, groupName)) { throw new SchedulerException(String.format("Job (job name %s, group name %s) doesn't " + "exist'", jobName, groupName)); } final JobKey jobKey = new JobKey(jobName, groupName); final JobDetail jobDetail = this.scheduler.getJobDetail(jobKey); final List<? extends Trigger> triggers = this.scheduler.getTriggersOfJob(jobDetail.getKey()); for (final Trigger trigger : triggers) { final TriggerState triggerState = this.scheduler.getTriggerState(trigger.getKey()); if (TriggerState.PAUSED.equals(triggerState)) { return true; } } return false; }
[ "public", "synchronized", "boolean", "isJobPaused", "(", "final", "String", "jobName", ",", "final", "String", "groupName", ")", "throws", "SchedulerException", "{", "if", "(", "!", "ifJobExist", "(", "jobName", ",", "groupName", ")", ")", "{", "throw", "new", "SchedulerException", "(", "String", ".", "format", "(", "\"Job (job name %s, group name %s) doesn't \"", "+", "\"exist'\"", ",", "jobName", ",", "groupName", ")", ")", ";", "}", "final", "JobKey", "jobKey", "=", "new", "JobKey", "(", "jobName", ",", "groupName", ")", ";", "final", "JobDetail", "jobDetail", "=", "this", ".", "scheduler", ".", "getJobDetail", "(", "jobKey", ")", ";", "final", "List", "<", "?", "extends", "Trigger", ">", "triggers", "=", "this", ".", "scheduler", ".", "getTriggersOfJob", "(", "jobDetail", ".", "getKey", "(", ")", ")", ";", "for", "(", "final", "Trigger", "trigger", ":", "triggers", ")", "{", "final", "TriggerState", "triggerState", "=", "this", ".", "scheduler", ".", "getTriggerState", "(", "trigger", ".", "getKey", "(", ")", ")", ";", "if", "(", "TriggerState", ".", "PAUSED", ".", "equals", "(", "triggerState", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Check if job is paused. @return true if job is paused, false otherwise.
[ "Check", "if", "job", "is", "paused", "." ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-web-server/src/main/java/azkaban/scheduler/QuartzScheduler.java#L110-L126
Talend/tesb-rt-se
sam/sam-agent/src/main/java/org/talend/esb/sam/agent/serviceclient/EventMapper.java
EventMapper.convertCustomInfo
private static CustomInfoType convertCustomInfo(Map<String, String> customInfo) { """ Convert custom info. @param customInfo the custom info map @return the custom info type """ if (customInfo == null) { return null; } CustomInfoType ciType = new CustomInfoType(); for (Entry<String, String> entry : customInfo.entrySet()) { CustomInfoType.Item cItem = new CustomInfoType.Item(); cItem.setKey(entry.getKey()); cItem.setValue(entry.getValue()); ciType.getItem().add(cItem); } return ciType; }
java
private static CustomInfoType convertCustomInfo(Map<String, String> customInfo) { if (customInfo == null) { return null; } CustomInfoType ciType = new CustomInfoType(); for (Entry<String, String> entry : customInfo.entrySet()) { CustomInfoType.Item cItem = new CustomInfoType.Item(); cItem.setKey(entry.getKey()); cItem.setValue(entry.getValue()); ciType.getItem().add(cItem); } return ciType; }
[ "private", "static", "CustomInfoType", "convertCustomInfo", "(", "Map", "<", "String", ",", "String", ">", "customInfo", ")", "{", "if", "(", "customInfo", "==", "null", ")", "{", "return", "null", ";", "}", "CustomInfoType", "ciType", "=", "new", "CustomInfoType", "(", ")", ";", "for", "(", "Entry", "<", "String", ",", "String", ">", "entry", ":", "customInfo", ".", "entrySet", "(", ")", ")", "{", "CustomInfoType", ".", "Item", "cItem", "=", "new", "CustomInfoType", ".", "Item", "(", ")", ";", "cItem", ".", "setKey", "(", "entry", ".", "getKey", "(", ")", ")", ";", "cItem", ".", "setValue", "(", "entry", ".", "getValue", "(", ")", ")", ";", "ciType", ".", "getItem", "(", ")", ".", "add", "(", "cItem", ")", ";", "}", "return", "ciType", ";", "}" ]
Convert custom info. @param customInfo the custom info map @return the custom info type
[ "Convert", "custom", "info", "." ]
train
https://github.com/Talend/tesb-rt-se/blob/0a151a6d91ffff65ac4b5ee0c5b2c882ac28d886/sam/sam-agent/src/main/java/org/talend/esb/sam/agent/serviceclient/EventMapper.java#L132-L146
korpling/ANNIS
annis-interfaces/src/main/java/annis/TimelineReconstructor.java
TimelineReconstructor.removeVirtualTokenization
public static void removeVirtualTokenization(SDocumentGraph graph, Map<String, String> spanAnno2order) { """ Removes the virtual tokenization from a {@link SDocumentGraph} and replaces it with an {@link STimeline} and multiple {@link STextualDS}. This alters the original graph. @param orig @return """ if(graph.getTimeline() != null) { // do nothing if the graph does not contain any virtual tokenization return; } TimelineReconstructor reconstructor = new TimelineReconstructor(graph, spanAnno2order); reconstructor.addTimeline(); reconstructor.createTokenFromSOrder(); reconstructor.cleanup(); }
java
public static void removeVirtualTokenization(SDocumentGraph graph, Map<String, String> spanAnno2order) { if(graph.getTimeline() != null) { // do nothing if the graph does not contain any virtual tokenization return; } TimelineReconstructor reconstructor = new TimelineReconstructor(graph, spanAnno2order); reconstructor.addTimeline(); reconstructor.createTokenFromSOrder(); reconstructor.cleanup(); }
[ "public", "static", "void", "removeVirtualTokenization", "(", "SDocumentGraph", "graph", ",", "Map", "<", "String", ",", "String", ">", "spanAnno2order", ")", "{", "if", "(", "graph", ".", "getTimeline", "(", ")", "!=", "null", ")", "{", "// do nothing if the graph does not contain any virtual tokenization", "return", ";", "}", "TimelineReconstructor", "reconstructor", "=", "new", "TimelineReconstructor", "(", "graph", ",", "spanAnno2order", ")", ";", "reconstructor", ".", "addTimeline", "(", ")", ";", "reconstructor", ".", "createTokenFromSOrder", "(", ")", ";", "reconstructor", ".", "cleanup", "(", ")", ";", "}" ]
Removes the virtual tokenization from a {@link SDocumentGraph} and replaces it with an {@link STimeline} and multiple {@link STextualDS}. This alters the original graph. @param orig @return
[ "Removes", "the", "virtual", "tokenization", "from", "a", "{", "@link", "SDocumentGraph", "}", "and", "replaces", "it", "with", "an", "{", "@link", "STimeline", "}", "and", "multiple", "{", "@link", "STextualDS", "}", "." ]
train
https://github.com/korpling/ANNIS/blob/152a2e34832e015f73ac8ce8a7d4c32641641324/annis-interfaces/src/main/java/annis/TimelineReconstructor.java#L425-L439
UrielCh/ovh-java-sdk
ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java
ApiOvhDbaaslogs.serviceName_output_elasticsearch_index_indexId_GET
public OvhIndex serviceName_output_elasticsearch_index_indexId_GET(String serviceName, String indexId) throws IOException { """ Returns specified elasticsearch index REST: GET /dbaas/logs/{serviceName}/output/elasticsearch/index/{indexId} @param serviceName [required] Service name @param indexId [required] Index ID """ String qPath = "/dbaas/logs/{serviceName}/output/elasticsearch/index/{indexId}"; StringBuilder sb = path(qPath, serviceName, indexId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhIndex.class); }
java
public OvhIndex serviceName_output_elasticsearch_index_indexId_GET(String serviceName, String indexId) throws IOException { String qPath = "/dbaas/logs/{serviceName}/output/elasticsearch/index/{indexId}"; StringBuilder sb = path(qPath, serviceName, indexId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhIndex.class); }
[ "public", "OvhIndex", "serviceName_output_elasticsearch_index_indexId_GET", "(", "String", "serviceName", ",", "String", "indexId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dbaas/logs/{serviceName}/output/elasticsearch/index/{indexId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "indexId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhIndex", ".", "class", ")", ";", "}" ]
Returns specified elasticsearch index REST: GET /dbaas/logs/{serviceName}/output/elasticsearch/index/{indexId} @param serviceName [required] Service name @param indexId [required] Index ID
[ "Returns", "specified", "elasticsearch", "index" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java#L1835-L1840
undertow-io/undertow
core/src/main/java/io/undertow/util/FlexBase64.java
FlexBase64.encodeStringURL
public static String encodeStringURL(byte[] source, boolean wrap) { """ Encodes a fixed and complete byte array 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. instead. @param source the byte array 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 """ return Encoder.encodeString(source, 0, source.length, wrap, true); }
java
public static String encodeStringURL(byte[] source, boolean wrap) { return Encoder.encodeString(source, 0, source.length, wrap, true); }
[ "public", "static", "String", "encodeStringURL", "(", "byte", "[", "]", "source", ",", "boolean", "wrap", ")", "{", "return", "Encoder", ".", "encodeString", "(", "source", ",", "0", ",", "source", ".", "length", ",", "wrap", ",", "true", ")", ";", "}" ]
Encodes a fixed and complete byte array 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. instead. @param source the byte array 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", "array", "into", "a", "Base64url", "String", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/util/FlexBase64.java#L166-L168
apache/groovy
subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java
SwingGroovyMethods.leftShift
public static JPopupMenu leftShift(JPopupMenu self, Action action) { """ Overloads the left shift operator to provide an easy way to add components to a popupMenu.<p> @param self a JPopupMenu @param action an action to be added to the popupMenu. @return same popupMenu, after the value was added to it. @since 1.6.4 """ self.add(action); return self; }
java
public static JPopupMenu leftShift(JPopupMenu self, Action action) { self.add(action); return self; }
[ "public", "static", "JPopupMenu", "leftShift", "(", "JPopupMenu", "self", ",", "Action", "action", ")", "{", "self", ".", "add", "(", "action", ")", ";", "return", "self", ";", "}" ]
Overloads the left shift operator to provide an easy way to add components to a popupMenu.<p> @param self a JPopupMenu @param action an action to be added to the popupMenu. @return same popupMenu, after the value was added to it. @since 1.6.4
[ "Overloads", "the", "left", "shift", "operator", "to", "provide", "an", "easy", "way", "to", "add", "components", "to", "a", "popupMenu", ".", "<p", ">" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java#L896-L899
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/jdbc/AbstractBlobClob.java
AbstractBlobClob.assertPosition
protected void assertPosition(long pos, long len) throws SQLException { """ Throws an exception if the pos value exceeds the max value by which the large object API can index. @param pos Position to write at. @param len number of bytes to write. @throws SQLException if something goes wrong """ checkFreed(); if (pos < 1) { throw new PSQLException(GT.tr("LOB positioning offsets start at 1."), PSQLState.INVALID_PARAMETER_VALUE); } if (pos + len - 1 > Integer.MAX_VALUE) { throw new PSQLException(GT.tr("PostgreSQL LOBs can only index to: {0}", Integer.MAX_VALUE), PSQLState.INVALID_PARAMETER_VALUE); } }
java
protected void assertPosition(long pos, long len) throws SQLException { checkFreed(); if (pos < 1) { throw new PSQLException(GT.tr("LOB positioning offsets start at 1."), PSQLState.INVALID_PARAMETER_VALUE); } if (pos + len - 1 > Integer.MAX_VALUE) { throw new PSQLException(GT.tr("PostgreSQL LOBs can only index to: {0}", Integer.MAX_VALUE), PSQLState.INVALID_PARAMETER_VALUE); } }
[ "protected", "void", "assertPosition", "(", "long", "pos", ",", "long", "len", ")", "throws", "SQLException", "{", "checkFreed", "(", ")", ";", "if", "(", "pos", "<", "1", ")", "{", "throw", "new", "PSQLException", "(", "GT", ".", "tr", "(", "\"LOB positioning offsets start at 1.\"", ")", ",", "PSQLState", ".", "INVALID_PARAMETER_VALUE", ")", ";", "}", "if", "(", "pos", "+", "len", "-", "1", ">", "Integer", ".", "MAX_VALUE", ")", "{", "throw", "new", "PSQLException", "(", "GT", ".", "tr", "(", "\"PostgreSQL LOBs can only index to: {0}\"", ",", "Integer", ".", "MAX_VALUE", ")", ",", "PSQLState", ".", "INVALID_PARAMETER_VALUE", ")", ";", "}", "}" ]
Throws an exception if the pos value exceeds the max value by which the large object API can index. @param pos Position to write at. @param len number of bytes to write. @throws SQLException if something goes wrong
[ "Throws", "an", "exception", "if", "the", "pos", "value", "exceeds", "the", "max", "value", "by", "which", "the", "large", "object", "API", "can", "index", "." ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/AbstractBlobClob.java#L224-L234
super-csv/super-csv
super-csv/src/main/java/org/supercsv/cellprocessor/constraint/Strlen.java
Strlen.execute
public Object execute(final Object value, final CsvContext context) { """ {@inheritDoc} @throws SuperCsvCellProcessorException if value is null @throws SuperCsvConstraintViolationException if the length of value isn't one of the required lengths """ validateInputNotNull(value, context); final String stringValue = value.toString(); final int length = stringValue.length(); if( !requiredLengths.contains(length) ) { throw new SuperCsvConstraintViolationException(String.format("the length (%d) of value '%s' not any of the required lengths", length, stringValue), context, this); } return next.execute(value, context); }
java
public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); final String stringValue = value.toString(); final int length = stringValue.length(); if( !requiredLengths.contains(length) ) { throw new SuperCsvConstraintViolationException(String.format("the length (%d) of value '%s' not any of the required lengths", length, stringValue), context, this); } return next.execute(value, context); }
[ "public", "Object", "execute", "(", "final", "Object", "value", ",", "final", "CsvContext", "context", ")", "{", "validateInputNotNull", "(", "value", ",", "context", ")", ";", "final", "String", "stringValue", "=", "value", ".", "toString", "(", ")", ";", "final", "int", "length", "=", "stringValue", ".", "length", "(", ")", ";", "if", "(", "!", "requiredLengths", ".", "contains", "(", "length", ")", ")", "{", "throw", "new", "SuperCsvConstraintViolationException", "(", "String", ".", "format", "(", "\"the length (%d) of value '%s' not any of the required lengths\"", ",", "length", ",", "stringValue", ")", ",", "context", ",", "this", ")", ";", "}", "return", "next", ".", "execute", "(", "value", ",", "context", ")", ";", "}" ]
{@inheritDoc} @throws SuperCsvCellProcessorException if value is null @throws SuperCsvConstraintViolationException if the length of value isn't one of the required lengths
[ "{", "@inheritDoc", "}" ]
train
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/cellprocessor/constraint/Strlen.java#L137-L148
google/closure-compiler
src/com/google/javascript/jscomp/AbstractCommandLineRunner.java
AbstractCommandLineRunner.outputSourceMap
@GwtIncompatible("Unnecessary") private void outputSourceMap(B options, String associatedName) throws IOException { """ Outputs the source map found in the compiler to the proper path if one exists. @param options The options to the Compiler. """ if (Strings.isNullOrEmpty(options.sourceMapOutputPath) || options.sourceMapOutputPath.equals("/dev/null")) { return; } String outName = expandSourceMapPath(options, null); maybeCreateDirsForPath(outName); try (Writer out = fileNameToOutputWriter2(outName)) { compiler.getSourceMap().appendTo(out, associatedName); } }
java
@GwtIncompatible("Unnecessary") private void outputSourceMap(B options, String associatedName) throws IOException { if (Strings.isNullOrEmpty(options.sourceMapOutputPath) || options.sourceMapOutputPath.equals("/dev/null")) { return; } String outName = expandSourceMapPath(options, null); maybeCreateDirsForPath(outName); try (Writer out = fileNameToOutputWriter2(outName)) { compiler.getSourceMap().appendTo(out, associatedName); } }
[ "@", "GwtIncompatible", "(", "\"Unnecessary\"", ")", "private", "void", "outputSourceMap", "(", "B", "options", ",", "String", "associatedName", ")", "throws", "IOException", "{", "if", "(", "Strings", ".", "isNullOrEmpty", "(", "options", ".", "sourceMapOutputPath", ")", "||", "options", ".", "sourceMapOutputPath", ".", "equals", "(", "\"/dev/null\"", ")", ")", "{", "return", ";", "}", "String", "outName", "=", "expandSourceMapPath", "(", "options", ",", "null", ")", ";", "maybeCreateDirsForPath", "(", "outName", ")", ";", "try", "(", "Writer", "out", "=", "fileNameToOutputWriter2", "(", "outName", ")", ")", "{", "compiler", ".", "getSourceMap", "(", ")", ".", "appendTo", "(", "out", ",", "associatedName", ")", ";", "}", "}" ]
Outputs the source map found in the compiler to the proper path if one exists. @param options The options to the Compiler.
[ "Outputs", "the", "source", "map", "found", "in", "the", "compiler", "to", "the", "proper", "path", "if", "one", "exists", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AbstractCommandLineRunner.java#L1776-L1788
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/ui/CmsCreateGalleryDialog.java
CmsCreateGalleryDialog.addInputRow
private void addInputRow(String label, Widget inputWidget) { """ Adds a row to the form.<p> @param label the label @param inputWidget the input widget """ FlowPanel row = new FlowPanel(); row.setStyleName(I_CmsLayoutBundle.INSTANCE.generalCss().simpleFormRow()); CmsLabel labelWidget = new CmsLabel(label); labelWidget.setStyleName(I_CmsLayoutBundle.INSTANCE.generalCss().simpleFormLabel()); row.add(labelWidget); inputWidget.addStyleName(I_CmsLayoutBundle.INSTANCE.generalCss().simpleFormInputBox()); row.add(inputWidget); m_dialogContent.getFieldSet().add(row); }
java
private void addInputRow(String label, Widget inputWidget) { FlowPanel row = new FlowPanel(); row.setStyleName(I_CmsLayoutBundle.INSTANCE.generalCss().simpleFormRow()); CmsLabel labelWidget = new CmsLabel(label); labelWidget.setStyleName(I_CmsLayoutBundle.INSTANCE.generalCss().simpleFormLabel()); row.add(labelWidget); inputWidget.addStyleName(I_CmsLayoutBundle.INSTANCE.generalCss().simpleFormInputBox()); row.add(inputWidget); m_dialogContent.getFieldSet().add(row); }
[ "private", "void", "addInputRow", "(", "String", "label", ",", "Widget", "inputWidget", ")", "{", "FlowPanel", "row", "=", "new", "FlowPanel", "(", ")", ";", "row", ".", "setStyleName", "(", "I_CmsLayoutBundle", ".", "INSTANCE", ".", "generalCss", "(", ")", ".", "simpleFormRow", "(", ")", ")", ";", "CmsLabel", "labelWidget", "=", "new", "CmsLabel", "(", "label", ")", ";", "labelWidget", ".", "setStyleName", "(", "I_CmsLayoutBundle", ".", "INSTANCE", ".", "generalCss", "(", ")", ".", "simpleFormLabel", "(", ")", ")", ";", "row", ".", "add", "(", "labelWidget", ")", ";", "inputWidget", ".", "addStyleName", "(", "I_CmsLayoutBundle", ".", "INSTANCE", ".", "generalCss", "(", ")", ".", "simpleFormInputBox", "(", ")", ")", ";", "row", ".", "add", "(", "inputWidget", ")", ";", "m_dialogContent", ".", "getFieldSet", "(", ")", ".", "add", "(", "row", ")", ";", "}" ]
Adds a row to the form.<p> @param label the label @param inputWidget the input widget
[ "Adds", "a", "row", "to", "the", "form", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/ui/CmsCreateGalleryDialog.java#L181-L191
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/p3/P3DatabaseReader.java
P3DatabaseReader.setFields
private void setFields(Map<String, FieldType> map, MapRow row, FieldContainer container) { """ Set the value of one or more fields based on the contents of a database row. @param map column to field map @param row database row @param container field container """ if (row != null) { for (Map.Entry<String, FieldType> entry : map.entrySet()) { container.set(entry.getValue(), row.getObject(entry.getKey())); } } }
java
private void setFields(Map<String, FieldType> map, MapRow row, FieldContainer container) { if (row != null) { for (Map.Entry<String, FieldType> entry : map.entrySet()) { container.set(entry.getValue(), row.getObject(entry.getKey())); } } }
[ "private", "void", "setFields", "(", "Map", "<", "String", ",", "FieldType", ">", "map", ",", "MapRow", "row", ",", "FieldContainer", "container", ")", "{", "if", "(", "row", "!=", "null", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "FieldType", ">", "entry", ":", "map", ".", "entrySet", "(", ")", ")", "{", "container", ".", "set", "(", "entry", ".", "getValue", "(", ")", ",", "row", ".", "getObject", "(", "entry", ".", "getKey", "(", ")", ")", ")", ";", "}", "}", "}" ]
Set the value of one or more fields based on the contents of a database row. @param map column to field map @param row database row @param container field container
[ "Set", "the", "value", "of", "one", "or", "more", "fields", "based", "on", "the", "contents", "of", "a", "database", "row", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/p3/P3DatabaseReader.java#L587-L596
gtri/bk-tree
src/main/java/edu/gatech/gtri/bktree/Metrics.java
Metrics.charSequenceMetric
public static Metric<CharSequence> charSequenceMetric(final StringMetric stringMetric) { """ Returns a {@link Metric} that delegates to the given {@link StringMetric}. """ return new Metric<CharSequence>() { @Override public int distance(CharSequence x, CharSequence y) { return stringMetric.distance(x, y); } }; }
java
public static Metric<CharSequence> charSequenceMetric(final StringMetric stringMetric) { return new Metric<CharSequence>() { @Override public int distance(CharSequence x, CharSequence y) { return stringMetric.distance(x, y); } }; }
[ "public", "static", "Metric", "<", "CharSequence", ">", "charSequenceMetric", "(", "final", "StringMetric", "stringMetric", ")", "{", "return", "new", "Metric", "<", "CharSequence", ">", "(", ")", "{", "@", "Override", "public", "int", "distance", "(", "CharSequence", "x", ",", "CharSequence", "y", ")", "{", "return", "stringMetric", ".", "distance", "(", "x", ",", "y", ")", ";", "}", "}", ";", "}" ]
Returns a {@link Metric} that delegates to the given {@link StringMetric}.
[ "Returns", "a", "{" ]
train
https://github.com/gtri/bk-tree/blob/fed9d01a85d63a8bb548995b5a455e784ed8b28d/src/main/java/edu/gatech/gtri/bktree/Metrics.java#L29-L36
elastic/elasticsearch-hadoop
mr/src/main/java/org/elasticsearch/hadoop/serialization/bulk/AbstractBulkFactory.java
AbstractBulkFactory.addExtractorOrDynamicValueAsFieldWriter
private boolean addExtractorOrDynamicValueAsFieldWriter(List<Object> list, FieldExtractor extractor, String header, boolean commaMightBeNeeded) { """ If extractor is present, this will combine the header and extractor into a FieldWriter, allowing the FieldWriter to determine when and if to write the header value based on the given document's data. If a comma is needed, it is appended to the header string before being passed to the FieldWriter. @return true if a comma may be needed on the next call """ if (extractor != null) { String head = header; if (commaMightBeNeeded) { head = "," + head; } list.add(new FieldWriter(head, extractor)); return true; } return commaMightBeNeeded; }
java
private boolean addExtractorOrDynamicValueAsFieldWriter(List<Object> list, FieldExtractor extractor, String header, boolean commaMightBeNeeded) { if (extractor != null) { String head = header; if (commaMightBeNeeded) { head = "," + head; } list.add(new FieldWriter(head, extractor)); return true; } return commaMightBeNeeded; }
[ "private", "boolean", "addExtractorOrDynamicValueAsFieldWriter", "(", "List", "<", "Object", ">", "list", ",", "FieldExtractor", "extractor", ",", "String", "header", ",", "boolean", "commaMightBeNeeded", ")", "{", "if", "(", "extractor", "!=", "null", ")", "{", "String", "head", "=", "header", ";", "if", "(", "commaMightBeNeeded", ")", "{", "head", "=", "\",\"", "+", "head", ";", "}", "list", ".", "add", "(", "new", "FieldWriter", "(", "head", ",", "extractor", ")", ")", ";", "return", "true", ";", "}", "return", "commaMightBeNeeded", ";", "}" ]
If extractor is present, this will combine the header and extractor into a FieldWriter, allowing the FieldWriter to determine when and if to write the header value based on the given document's data. If a comma is needed, it is appended to the header string before being passed to the FieldWriter. @return true if a comma may be needed on the next call
[ "If", "extractor", "is", "present", "this", "will", "combine", "the", "header", "and", "extractor", "into", "a", "FieldWriter", "allowing", "the", "FieldWriter", "to", "determine", "when", "and", "if", "to", "write", "the", "header", "value", "based", "on", "the", "given", "document", "s", "data", ".", "If", "a", "comma", "is", "needed", "it", "is", "appended", "to", "the", "header", "string", "before", "being", "passed", "to", "the", "FieldWriter", "." ]
train
https://github.com/elastic/elasticsearch-hadoop/blob/f3acaba268ff96efae8eb946088c748c777c22cc/mr/src/main/java/org/elasticsearch/hadoop/serialization/bulk/AbstractBulkFactory.java#L471-L481
kiswanij/jk-util
src/main/java/com/jk/util/model/table/JKDefaultTableModel.java
JKDefaultTableModel.moveRow
public void moveRow(final int start, final int end, final int to) { """ Moves one or more rows from the inclusive range <code>start</code> to <code>end</code> to the <code>to</code> position in the model. After the move, the row that was at index <code>start</code> will be at index <code>to</code>. This method will send a <code>tableChanged</code> notification message to all the listeners. <p> <pre> Examples of moves: <p> 1. moveRow(1,3,5); a|B|C|D|e|f|g|h|i|j|k - before a|e|f|g|h|B|C|D|i|j|k - after <p> 2. moveRow(6,7,1); a|b|c|d|e|f|G|H|i|j|k - before a|G|H|b|c|d|e|f|i|j|k - after <p> </pre> @param start the starting row index to be moved @param end the ending row index to be moved @param to the destination of the rows to be moved @exception ArrayIndexOutOfBoundsException if any of the elements would be moved out of the table's range """ final int shift = to - start; int first, last; if (shift < 0) { first = to; last = end; } else { first = start; last = to + end - start; } rotate(this.dataVector, first, last + 1, shift); fireTableRowsUpdated(first, last); }
java
public void moveRow(final int start, final int end, final int to) { final int shift = to - start; int first, last; if (shift < 0) { first = to; last = end; } else { first = start; last = to + end - start; } rotate(this.dataVector, first, last + 1, shift); fireTableRowsUpdated(first, last); }
[ "public", "void", "moveRow", "(", "final", "int", "start", ",", "final", "int", "end", ",", "final", "int", "to", ")", "{", "final", "int", "shift", "=", "to", "-", "start", ";", "int", "first", ",", "last", ";", "if", "(", "shift", "<", "0", ")", "{", "first", "=", "to", ";", "last", "=", "end", ";", "}", "else", "{", "first", "=", "start", ";", "last", "=", "to", "+", "end", "-", "start", ";", "}", "rotate", "(", "this", ".", "dataVector", ",", "first", ",", "last", "+", "1", ",", "shift", ")", ";", "fireTableRowsUpdated", "(", "first", ",", "last", ")", ";", "}" ]
Moves one or more rows from the inclusive range <code>start</code> to <code>end</code> to the <code>to</code> position in the model. After the move, the row that was at index <code>start</code> will be at index <code>to</code>. This method will send a <code>tableChanged</code> notification message to all the listeners. <p> <pre> Examples of moves: <p> 1. moveRow(1,3,5); a|B|C|D|e|f|g|h|i|j|k - before a|e|f|g|h|B|C|D|i|j|k - after <p> 2. moveRow(6,7,1); a|b|c|d|e|f|G|H|i|j|k - before a|G|H|b|c|d|e|f|i|j|k - after <p> </pre> @param start the starting row index to be moved @param end the ending row index to be moved @param to the destination of the rows to be moved @exception ArrayIndexOutOfBoundsException if any of the elements would be moved out of the table's range
[ "Moves", "one", "or", "more", "rows", "from", "the", "inclusive", "range", "<code", ">", "start<", "/", "code", ">", "to", "<code", ">", "end<", "/", "code", ">", "to", "the", "<code", ">", "to<", "/", "code", ">", "position", "in", "the", "model", ".", "After", "the", "move", "the", "row", "that", "was", "at", "index", "<code", ">", "start<", "/", "code", ">", "will", "be", "at", "index", "<code", ">", "to<", "/", "code", ">", ".", "This", "method", "will", "send", "a", "<code", ">", "tableChanged<", "/", "code", ">", "notification", "message", "to", "all", "the", "listeners", ".", "<p", ">" ]
train
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/model/table/JKDefaultTableModel.java#L509-L522
derari/cthul
log-cal10n/src/main/java/org/cthul/log/util/CLocMessageConveyor.java
CLocMessageConveyor.getMessage
@Override public <E extends Enum<?>> String getMessage(E key, Object... args) throws MessageConveyorException { """ Given an enum as key, find the corresponding resource bundle and return the corresponding internationalized. <p> The name of the resource bundle is defined via the {@link BaseName} annotation whereas the locale is specified in this MessageConveyor instance's constructor. @param key an enum instance used as message key """ String declararingClassName = key.getDeclaringClass().getName(); CAL10NResourceBundle rb = cache.get(declararingClassName); if (rb == null || rb.hasChanged()) { rb = lookup(key); cache.put(declararingClassName, rb); } String keyAsStr = key.toString(); String value = rb.getString(keyAsStr); if (value == null) { return "?" + keyAsStr + "?"; } else { if (args == null || args.length == 0) { return value; } else { return format(value, args); } } }
java
@Override public <E extends Enum<?>> String getMessage(E key, Object... args) throws MessageConveyorException { String declararingClassName = key.getDeclaringClass().getName(); CAL10NResourceBundle rb = cache.get(declararingClassName); if (rb == null || rb.hasChanged()) { rb = lookup(key); cache.put(declararingClassName, rb); } String keyAsStr = key.toString(); String value = rb.getString(keyAsStr); if (value == null) { return "?" + keyAsStr + "?"; } else { if (args == null || args.length == 0) { return value; } else { return format(value, args); } } }
[ "@", "Override", "public", "<", "E", "extends", "Enum", "<", "?", ">", ">", "String", "getMessage", "(", "E", "key", ",", "Object", "...", "args", ")", "throws", "MessageConveyorException", "{", "String", "declararingClassName", "=", "key", ".", "getDeclaringClass", "(", ")", ".", "getName", "(", ")", ";", "CAL10NResourceBundle", "rb", "=", "cache", ".", "get", "(", "declararingClassName", ")", ";", "if", "(", "rb", "==", "null", "||", "rb", ".", "hasChanged", "(", ")", ")", "{", "rb", "=", "lookup", "(", "key", ")", ";", "cache", ".", "put", "(", "declararingClassName", ",", "rb", ")", ";", "}", "String", "keyAsStr", "=", "key", ".", "toString", "(", ")", ";", "String", "value", "=", "rb", ".", "getString", "(", "keyAsStr", ")", ";", "if", "(", "value", "==", "null", ")", "{", "return", "\"?\"", "+", "keyAsStr", "+", "\"?\"", ";", "}", "else", "{", "if", "(", "args", "==", "null", "||", "args", ".", "length", "==", "0", ")", "{", "return", "value", ";", "}", "else", "{", "return", "format", "(", "value", ",", "args", ")", ";", "}", "}", "}" ]
Given an enum as key, find the corresponding resource bundle and return the corresponding internationalized. <p> The name of the resource bundle is defined via the {@link BaseName} annotation whereas the locale is specified in this MessageConveyor instance's constructor. @param key an enum instance used as message key
[ "Given", "an", "enum", "as", "key", "find", "the", "corresponding", "resource", "bundle", "and", "return", "the", "corresponding", "internationalized", "." ]
train
https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/log-cal10n/src/main/java/org/cthul/log/util/CLocMessageConveyor.java#L85-L107
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRMaterial.java
GVRMaterial.setDiffuseColor
public void setDiffuseColor(float r, float g, float b, float a) { """ Set the {@code diffuse_color} uniform for lighting. By convention, GVRF shaders can use a {@code vec4} uniform named {@code diffuse_color}. With the {@linkplain GVRShaderType.Texture shader,} this allows you to add an overlay diffuse light color on top of the texture. Values are between {@code 0.0f} and {@code 1.0f}, inclusive. @param r Red @param g Green @param b Blue @param a Alpha """ setVec4("diffuse_color", r, g, b, a); }
java
public void setDiffuseColor(float r, float g, float b, float a) { setVec4("diffuse_color", r, g, b, a); }
[ "public", "void", "setDiffuseColor", "(", "float", "r", ",", "float", "g", ",", "float", "b", ",", "float", "a", ")", "{", "setVec4", "(", "\"diffuse_color\"", ",", "r", ",", "g", ",", "b", ",", "a", ")", ";", "}" ]
Set the {@code diffuse_color} uniform for lighting. By convention, GVRF shaders can use a {@code vec4} uniform named {@code diffuse_color}. With the {@linkplain GVRShaderType.Texture shader,} this allows you to add an overlay diffuse light color on top of the texture. Values are between {@code 0.0f} and {@code 1.0f}, inclusive. @param r Red @param g Green @param b Blue @param a Alpha
[ "Set", "the", "{", "@code", "diffuse_color", "}", "uniform", "for", "lighting", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRMaterial.java#L446-L448
snowflakedb/snowflake-jdbc
src/main/java/net/snowflake/client/loader/StreamLoader.java
StreamLoader.resetOperation
@Override public void resetOperation(Operation op) { """ If operation changes, existing stage needs to be scheduled for processing. """ LOGGER.debug("Reset Loader"); if (op.equals(_op)) { //no-op return; } LOGGER.debug("Operation is changing from {} to {}", _op, op); _op = op; if (_stage != null) { try { queuePut(_stage); } catch (InterruptedException ex) { LOGGER.error(_stage.getId(), ex); } } _stage = new BufferStage(this, _op, _csvFileBucketSize, _csvFileSize); }
java
@Override public void resetOperation(Operation op) { LOGGER.debug("Reset Loader"); if (op.equals(_op)) { //no-op return; } LOGGER.debug("Operation is changing from {} to {}", _op, op); _op = op; if (_stage != null) { try { queuePut(_stage); } catch (InterruptedException ex) { LOGGER.error(_stage.getId(), ex); } } _stage = new BufferStage(this, _op, _csvFileBucketSize, _csvFileSize); }
[ "@", "Override", "public", "void", "resetOperation", "(", "Operation", "op", ")", "{", "LOGGER", ".", "debug", "(", "\"Reset Loader\"", ")", ";", "if", "(", "op", ".", "equals", "(", "_op", ")", ")", "{", "//no-op", "return", ";", "}", "LOGGER", ".", "debug", "(", "\"Operation is changing from {} to {}\"", ",", "_op", ",", "op", ")", ";", "_op", "=", "op", ";", "if", "(", "_stage", "!=", "null", ")", "{", "try", "{", "queuePut", "(", "_stage", ")", ";", "}", "catch", "(", "InterruptedException", "ex", ")", "{", "LOGGER", ".", "error", "(", "_stage", ".", "getId", "(", ")", ",", "ex", ")", ";", "}", "}", "_stage", "=", "new", "BufferStage", "(", "this", ",", "_op", ",", "_csvFileBucketSize", ",", "_csvFileSize", ")", ";", "}" ]
If operation changes, existing stage needs to be scheduled for processing.
[ "If", "operation", "changes", "existing", "stage", "needs", "to", "be", "scheduled", "for", "processing", "." ]
train
https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/loader/StreamLoader.java#L824-L852
JOML-CI/JOML
src/org/joml/Matrix3f.java
Matrix3f.scaling
public Matrix3f scaling(float x, float y, float z) { """ Set this matrix to be a simple scale matrix. @param x the scale in x @param y the scale in y @param z the scale in z @return this """ MemUtil.INSTANCE.zero(this); m00 = x; m11 = y; m22 = z; return this; }
java
public Matrix3f scaling(float x, float y, float z) { MemUtil.INSTANCE.zero(this); m00 = x; m11 = y; m22 = z; return this; }
[ "public", "Matrix3f", "scaling", "(", "float", "x", ",", "float", "y", ",", "float", "z", ")", "{", "MemUtil", ".", "INSTANCE", ".", "zero", "(", "this", ")", ";", "m00", "=", "x", ";", "m11", "=", "y", ";", "m22", "=", "z", ";", "return", "this", ";", "}" ]
Set this matrix to be a simple scale matrix. @param x the scale in x @param y the scale in y @param z the scale in z @return this
[ "Set", "this", "matrix", "to", "be", "a", "simple", "scale", "matrix", "." ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3f.java#L1325-L1331
meltmedia/cadmium
cli/src/main/java/com/meltmedia/cadmium/cli/AuthCommand.java
AuthCommand.sendRequest
private void sendRequest(HttpUriRequest request, int expectedStatus) throws Exception { """ Sends a request to the rest endpoint. @param request @param expectedStatus @throws KeyManagementException @throws UnrecoverableKeyException @throws NoSuchAlgorithmException @throws KeyStoreException @throws IOException @throws ClientProtocolException """ addAuthHeader(request); HttpClient client = httpClient(); HttpResponse response = client.execute(request); if(response.getStatusLine().getStatusCode() == HttpStatus.SC_NOT_FOUND) { EntityUtils.consume(response.getEntity()); System.err.println("Authentication has been disabled for "+args.get(1)+"."); } else if(response.getStatusLine().getStatusCode() == expectedStatus) { if(expectedStatus == HttpStatus.SC_OK) { String responseStr = EntityUtils.toString(response.getEntity()); List<String> usernames = new Gson().fromJson(responseStr, new TypeToken<List<String>>(){}.getType()); if(usernames == null || usernames.isEmpty()) { System.out.println("There have been no site specific users created."); } else { System.out.println(usernames.size() + " Users:"); for(String user : usernames) { System.out.println(user); } } } } else { System.err.println(EntityUtils.toString(response.getEntity())); System.err.println("Unexpected status code returned. "+response.getStatusLine().getStatusCode()); } }
java
private void sendRequest(HttpUriRequest request, int expectedStatus) throws Exception { addAuthHeader(request); HttpClient client = httpClient(); HttpResponse response = client.execute(request); if(response.getStatusLine().getStatusCode() == HttpStatus.SC_NOT_FOUND) { EntityUtils.consume(response.getEntity()); System.err.println("Authentication has been disabled for "+args.get(1)+"."); } else if(response.getStatusLine().getStatusCode() == expectedStatus) { if(expectedStatus == HttpStatus.SC_OK) { String responseStr = EntityUtils.toString(response.getEntity()); List<String> usernames = new Gson().fromJson(responseStr, new TypeToken<List<String>>(){}.getType()); if(usernames == null || usernames.isEmpty()) { System.out.println("There have been no site specific users created."); } else { System.out.println(usernames.size() + " Users:"); for(String user : usernames) { System.out.println(user); } } } } else { System.err.println(EntityUtils.toString(response.getEntity())); System.err.println("Unexpected status code returned. "+response.getStatusLine().getStatusCode()); } }
[ "private", "void", "sendRequest", "(", "HttpUriRequest", "request", ",", "int", "expectedStatus", ")", "throws", "Exception", "{", "addAuthHeader", "(", "request", ")", ";", "HttpClient", "client", "=", "httpClient", "(", ")", ";", "HttpResponse", "response", "=", "client", ".", "execute", "(", "request", ")", ";", "if", "(", "response", ".", "getStatusLine", "(", ")", ".", "getStatusCode", "(", ")", "==", "HttpStatus", ".", "SC_NOT_FOUND", ")", "{", "EntityUtils", ".", "consume", "(", "response", ".", "getEntity", "(", ")", ")", ";", "System", ".", "err", ".", "println", "(", "\"Authentication has been disabled for \"", "+", "args", ".", "get", "(", "1", ")", "+", "\".\"", ")", ";", "}", "else", "if", "(", "response", ".", "getStatusLine", "(", ")", ".", "getStatusCode", "(", ")", "==", "expectedStatus", ")", "{", "if", "(", "expectedStatus", "==", "HttpStatus", ".", "SC_OK", ")", "{", "String", "responseStr", "=", "EntityUtils", ".", "toString", "(", "response", ".", "getEntity", "(", ")", ")", ";", "List", "<", "String", ">", "usernames", "=", "new", "Gson", "(", ")", ".", "fromJson", "(", "responseStr", ",", "new", "TypeToken", "<", "List", "<", "String", ">", ">", "(", ")", "{", "}", ".", "getType", "(", ")", ")", ";", "if", "(", "usernames", "==", "null", "||", "usernames", ".", "isEmpty", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"There have been no site specific users created.\"", ")", ";", "}", "else", "{", "System", ".", "out", ".", "println", "(", "usernames", ".", "size", "(", ")", "+", "\" Users:\"", ")", ";", "for", "(", "String", "user", ":", "usernames", ")", "{", "System", ".", "out", ".", "println", "(", "user", ")", ";", "}", "}", "}", "}", "else", "{", "System", ".", "err", ".", "println", "(", "EntityUtils", ".", "toString", "(", "response", ".", "getEntity", "(", ")", ")", ")", ";", "System", ".", "err", ".", "println", "(", "\"Unexpected status code returned. \"", "+", "response", ".", "getStatusLine", "(", ")", ".", "getStatusCode", "(", ")", ")", ";", "}", "}" ]
Sends a request to the rest endpoint. @param request @param expectedStatus @throws KeyManagementException @throws UnrecoverableKeyException @throws NoSuchAlgorithmException @throws KeyStoreException @throws IOException @throws ClientProtocolException
[ "Sends", "a", "request", "to", "the", "rest", "endpoint", "." ]
train
https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/cli/src/main/java/com/meltmedia/cadmium/cli/AuthCommand.java#L121-L148
xiancloud/xian
xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/bean/AuthCode.java
AuthCode.loadFromMap
public static AuthCode loadFromMap(Map<String, Object> map) { """ Used to create an instance when a record from DB is loaded. @param map Map that contains the record info @return instance of AuthCode """ AuthCode authCode = new AuthCode(); authCode.code = (String) map.get("code"); authCode.clientId = (String) map.get("LOCAL_NODE_ID"); authCode.redirectUri = (String) map.get("redirectUri"); authCode.state = (String) map.get("state"); authCode.scope = (String) map.get("scope"); authCode.type = (String) map.get("type"); authCode.valid = (Boolean) map.get("valid"); authCode.userId = (String) map.get("userId"); authCode.created = (Long) map.get("created"); authCode.id = map.get("_id").toString(); return authCode; }
java
public static AuthCode loadFromMap(Map<String, Object> map) { AuthCode authCode = new AuthCode(); authCode.code = (String) map.get("code"); authCode.clientId = (String) map.get("LOCAL_NODE_ID"); authCode.redirectUri = (String) map.get("redirectUri"); authCode.state = (String) map.get("state"); authCode.scope = (String) map.get("scope"); authCode.type = (String) map.get("type"); authCode.valid = (Boolean) map.get("valid"); authCode.userId = (String) map.get("userId"); authCode.created = (Long) map.get("created"); authCode.id = map.get("_id").toString(); return authCode; }
[ "public", "static", "AuthCode", "loadFromMap", "(", "Map", "<", "String", ",", "Object", ">", "map", ")", "{", "AuthCode", "authCode", "=", "new", "AuthCode", "(", ")", ";", "authCode", ".", "code", "=", "(", "String", ")", "map", ".", "get", "(", "\"code\"", ")", ";", "authCode", ".", "clientId", "=", "(", "String", ")", "map", ".", "get", "(", "\"LOCAL_NODE_ID\"", ")", ";", "authCode", ".", "redirectUri", "=", "(", "String", ")", "map", ".", "get", "(", "\"redirectUri\"", ")", ";", "authCode", ".", "state", "=", "(", "String", ")", "map", ".", "get", "(", "\"state\"", ")", ";", "authCode", ".", "scope", "=", "(", "String", ")", "map", ".", "get", "(", "\"scope\"", ")", ";", "authCode", ".", "type", "=", "(", "String", ")", "map", ".", "get", "(", "\"type\"", ")", ";", "authCode", ".", "valid", "=", "(", "Boolean", ")", "map", ".", "get", "(", "\"valid\"", ")", ";", "authCode", ".", "userId", "=", "(", "String", ")", "map", ".", "get", "(", "\"userId\"", ")", ";", "authCode", ".", "created", "=", "(", "Long", ")", "map", ".", "get", "(", "\"created\"", ")", ";", "authCode", ".", "id", "=", "map", ".", "get", "(", "\"_id\"", ")", ".", "toString", "(", ")", ";", "return", "authCode", ";", "}" ]
Used to create an instance when a record from DB is loaded. @param map Map that contains the record info @return instance of AuthCode
[ "Used", "to", "create", "an", "instance", "when", "a", "record", "from", "DB", "is", "loaded", "." ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/bean/AuthCode.java#L166-L179
lucee/Lucee
core/src/main/java/lucee/runtime/schedule/StorageUtil.java
StorageUtil.setCredentials
public void setCredentials(Element el, String username, String password, Credentials c) { """ sets a Credentials to a XML Element @param el @param username @param password @param credentials """ if (c == null) return; if (c.getUsername() != null) el.setAttribute(username, c.getUsername()); if (c.getPassword() != null) el.setAttribute(password, c.getPassword()); }
java
public void setCredentials(Element el, String username, String password, Credentials c) { if (c == null) return; if (c.getUsername() != null) el.setAttribute(username, c.getUsername()); if (c.getPassword() != null) el.setAttribute(password, c.getPassword()); }
[ "public", "void", "setCredentials", "(", "Element", "el", ",", "String", "username", ",", "String", "password", ",", "Credentials", "c", ")", "{", "if", "(", "c", "==", "null", ")", "return", ";", "if", "(", "c", ".", "getUsername", "(", ")", "!=", "null", ")", "el", ".", "setAttribute", "(", "username", ",", "c", ".", "getUsername", "(", ")", ")", ";", "if", "(", "c", ".", "getPassword", "(", ")", "!=", "null", ")", "el", ".", "setAttribute", "(", "password", ",", "c", ".", "getPassword", "(", ")", ")", ";", "}" ]
sets a Credentials to a XML Element @param el @param username @param password @param credentials
[ "sets", "a", "Credentials", "to", "a", "XML", "Element" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/schedule/StorageUtil.java#L427-L431
google/flogger
api/src/main/java/com/google/common/flogger/backend/SimpleMessageFormatter.java
SimpleMessageFormatter.safeFormatTo
private static void safeFormatTo(Formattable value, StringBuilder out, FormatOptions options) { """ Returns a string representation of the user supplied formattable, accounting for any possible runtime exceptions. @param value the value to be formatted. @return a best-effort string representation of the given value, even if exceptions were thrown. """ // Only care about 3 specific flags for Formattable. int formatFlags = options.getFlags() & (FLAG_LEFT_ALIGN | FLAG_UPPER_CASE | FLAG_SHOW_ALT_FORM); if (formatFlags != 0) { // TODO: Maybe re-order the options flags to make this step easier or use a lookup table. // Note that reordering flags would require a rethink of how they are parsed. formatFlags = ((formatFlags & FLAG_LEFT_ALIGN) != 0 ? FormattableFlags.LEFT_JUSTIFY : 0) | ((formatFlags & FLAG_UPPER_CASE) != 0 ? FormattableFlags.UPPERCASE : 0) | ((formatFlags & FLAG_SHOW_ALT_FORM) != 0 ? FormattableFlags.ALTERNATE : 0); } // We may need to undo an arbitrary amount of appending if there is an error. int originalLength = out.length(); Formatter formatter = new Formatter(out, FORMAT_LOCALE); try { value.formatTo(formatter, formatFlags, options.getWidth(), options.getPrecision()); } catch (RuntimeException e) { out.setLength(originalLength); // We only use a StringBuilder to create the Formatter instance. try { formatter.out().append(getErrorString(value, e)); } catch (IOException impossible) { } } }
java
private static void safeFormatTo(Formattable value, StringBuilder out, FormatOptions options) { // Only care about 3 specific flags for Formattable. int formatFlags = options.getFlags() & (FLAG_LEFT_ALIGN | FLAG_UPPER_CASE | FLAG_SHOW_ALT_FORM); if (formatFlags != 0) { // TODO: Maybe re-order the options flags to make this step easier or use a lookup table. // Note that reordering flags would require a rethink of how they are parsed. formatFlags = ((formatFlags & FLAG_LEFT_ALIGN) != 0 ? FormattableFlags.LEFT_JUSTIFY : 0) | ((formatFlags & FLAG_UPPER_CASE) != 0 ? FormattableFlags.UPPERCASE : 0) | ((formatFlags & FLAG_SHOW_ALT_FORM) != 0 ? FormattableFlags.ALTERNATE : 0); } // We may need to undo an arbitrary amount of appending if there is an error. int originalLength = out.length(); Formatter formatter = new Formatter(out, FORMAT_LOCALE); try { value.formatTo(formatter, formatFlags, options.getWidth(), options.getPrecision()); } catch (RuntimeException e) { out.setLength(originalLength); // We only use a StringBuilder to create the Formatter instance. try { formatter.out().append(getErrorString(value, e)); } catch (IOException impossible) { } } }
[ "private", "static", "void", "safeFormatTo", "(", "Formattable", "value", ",", "StringBuilder", "out", ",", "FormatOptions", "options", ")", "{", "// Only care about 3 specific flags for Formattable.", "int", "formatFlags", "=", "options", ".", "getFlags", "(", ")", "&", "(", "FLAG_LEFT_ALIGN", "|", "FLAG_UPPER_CASE", "|", "FLAG_SHOW_ALT_FORM", ")", ";", "if", "(", "formatFlags", "!=", "0", ")", "{", "// TODO: Maybe re-order the options flags to make this step easier or use a lookup table.", "// Note that reordering flags would require a rethink of how they are parsed.", "formatFlags", "=", "(", "(", "formatFlags", "&", "FLAG_LEFT_ALIGN", ")", "!=", "0", "?", "FormattableFlags", ".", "LEFT_JUSTIFY", ":", "0", ")", "|", "(", "(", "formatFlags", "&", "FLAG_UPPER_CASE", ")", "!=", "0", "?", "FormattableFlags", ".", "UPPERCASE", ":", "0", ")", "|", "(", "(", "formatFlags", "&", "FLAG_SHOW_ALT_FORM", ")", "!=", "0", "?", "FormattableFlags", ".", "ALTERNATE", ":", "0", ")", ";", "}", "// We may need to undo an arbitrary amount of appending if there is an error.", "int", "originalLength", "=", "out", ".", "length", "(", ")", ";", "Formatter", "formatter", "=", "new", "Formatter", "(", "out", ",", "FORMAT_LOCALE", ")", ";", "try", "{", "value", ".", "formatTo", "(", "formatter", ",", "formatFlags", ",", "options", ".", "getWidth", "(", ")", ",", "options", ".", "getPrecision", "(", ")", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "out", ".", "setLength", "(", "originalLength", ")", ";", "// We only use a StringBuilder to create the Formatter instance.", "try", "{", "formatter", ".", "out", "(", ")", ".", "append", "(", "getErrorString", "(", "value", ",", "e", ")", ")", ";", "}", "catch", "(", "IOException", "impossible", ")", "{", "}", "}", "}" ]
Returns a string representation of the user supplied formattable, accounting for any possible runtime exceptions. @param value the value to be formatted. @return a best-effort string representation of the given value, even if exceptions were thrown.
[ "Returns", "a", "string", "representation", "of", "the", "user", "supplied", "formattable", "accounting", "for", "any", "possible", "runtime", "exceptions", "." ]
train
https://github.com/google/flogger/blob/a164967a93a9f4ce92f34319fc0cc7c91a57321c/api/src/main/java/com/google/common/flogger/backend/SimpleMessageFormatter.java#L131-L153
javamelody/javamelody
javamelody-swing/src/main/java/net/bull/javamelody/ImageIconCache.java
ImageIconCache.getScaledImageIcon
public static ImageIcon getScaledImageIcon(String fileName, int targetWidth, int targetHeight) { """ Retourne une imageIcon à partir du cache, redimensionnée. @param fileName String @param targetWidth int @param targetHeight int @return ImageIcon """ return MSwingUtilities.getScaledInstance(getImageIcon(fileName), targetWidth, targetHeight); }
java
public static ImageIcon getScaledImageIcon(String fileName, int targetWidth, int targetHeight) { return MSwingUtilities.getScaledInstance(getImageIcon(fileName), targetWidth, targetHeight); }
[ "public", "static", "ImageIcon", "getScaledImageIcon", "(", "String", "fileName", ",", "int", "targetWidth", ",", "int", "targetHeight", ")", "{", "return", "MSwingUtilities", ".", "getScaledInstance", "(", "getImageIcon", "(", "fileName", ")", ",", "targetWidth", ",", "targetHeight", ")", ";", "}" ]
Retourne une imageIcon à partir du cache, redimensionnée. @param fileName String @param targetWidth int @param targetHeight int @return ImageIcon
[ "Retourne", "une", "imageIcon", "à", "partir", "du", "cache", "redimensionnée", "." ]
train
https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-swing/src/main/java/net/bull/javamelody/ImageIconCache.java#L73-L75
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/com/read/resultset/ColumnInformation.java
ColumnInformation.create
public static ColumnInformation create(String name, ColumnType type) { """ Constructor. @param name column name @param type column type @return ColumnInformation """ byte[] nameBytes = name.getBytes(); byte[] arr = new byte[23 + 2 * nameBytes.length]; int pos = 0; //lenenc_str catalog //lenenc_str schema //lenenc_str table //lenenc_str org_table for (int i = 0; i < 4; i++) { arr[pos++] = 1; arr[pos++] = 0; } //lenenc_str name //lenenc_str org_name for (int i = 0; i < 2; i++) { arr[pos++] = (byte) name.length(); System.arraycopy(nameBytes, 0, arr, pos, nameBytes.length); pos += nameBytes.length; } //lenenc_int length of fixed-length fields [0c] arr[pos++] = 0xc; //2 character set arr[pos++] = 33; /* charset = UTF8 */ arr[pos++] = 0; int len; /* Sensible predefined length - since we're dealing with I_S here, most char fields are 64 char long */ switch (type.getSqlType()) { case Types.VARCHAR: case Types.CHAR: len = 64 * 3; /* 3 bytes per UTF8 char */ break; case Types.SMALLINT: len = 5; break; case Types.NULL: len = 0; break; default: len = 1; break; } // arr[pos] = (byte) len; /* 4 bytes : column length */ pos += 4; arr[pos++] = (byte) ColumnType.toServer(type.getSqlType()).getType(); /* 1 byte : type */ arr[pos++] = (byte) len; /* 2 bytes : flags */ arr[pos++] = 0; arr[pos++] = 0; /* decimals */ arr[pos++] = 0; /* 2 bytes filler */ arr[pos] = 0; return new ColumnInformation(new Buffer(arr)); }
java
public static ColumnInformation create(String name, ColumnType type) { byte[] nameBytes = name.getBytes(); byte[] arr = new byte[23 + 2 * nameBytes.length]; int pos = 0; //lenenc_str catalog //lenenc_str schema //lenenc_str table //lenenc_str org_table for (int i = 0; i < 4; i++) { arr[pos++] = 1; arr[pos++] = 0; } //lenenc_str name //lenenc_str org_name for (int i = 0; i < 2; i++) { arr[pos++] = (byte) name.length(); System.arraycopy(nameBytes, 0, arr, pos, nameBytes.length); pos += nameBytes.length; } //lenenc_int length of fixed-length fields [0c] arr[pos++] = 0xc; //2 character set arr[pos++] = 33; /* charset = UTF8 */ arr[pos++] = 0; int len; /* Sensible predefined length - since we're dealing with I_S here, most char fields are 64 char long */ switch (type.getSqlType()) { case Types.VARCHAR: case Types.CHAR: len = 64 * 3; /* 3 bytes per UTF8 char */ break; case Types.SMALLINT: len = 5; break; case Types.NULL: len = 0; break; default: len = 1; break; } // arr[pos] = (byte) len; /* 4 bytes : column length */ pos += 4; arr[pos++] = (byte) ColumnType.toServer(type.getSqlType()).getType(); /* 1 byte : type */ arr[pos++] = (byte) len; /* 2 bytes : flags */ arr[pos++] = 0; arr[pos++] = 0; /* decimals */ arr[pos++] = 0; /* 2 bytes filler */ arr[pos] = 0; return new ColumnInformation(new Buffer(arr)); }
[ "public", "static", "ColumnInformation", "create", "(", "String", "name", ",", "ColumnType", "type", ")", "{", "byte", "[", "]", "nameBytes", "=", "name", ".", "getBytes", "(", ")", ";", "byte", "[", "]", "arr", "=", "new", "byte", "[", "23", "+", "2", "*", "nameBytes", ".", "length", "]", ";", "int", "pos", "=", "0", ";", "//lenenc_str catalog", "//lenenc_str schema", "//lenenc_str table", "//lenenc_str org_table", "for", "(", "int", "i", "=", "0", ";", "i", "<", "4", ";", "i", "++", ")", "{", "arr", "[", "pos", "++", "]", "=", "1", ";", "arr", "[", "pos", "++", "]", "=", "0", ";", "}", "//lenenc_str name", "//lenenc_str org_name", "for", "(", "int", "i", "=", "0", ";", "i", "<", "2", ";", "i", "++", ")", "{", "arr", "[", "pos", "++", "]", "=", "(", "byte", ")", "name", ".", "length", "(", ")", ";", "System", ".", "arraycopy", "(", "nameBytes", ",", "0", ",", "arr", ",", "pos", ",", "nameBytes", ".", "length", ")", ";", "pos", "+=", "nameBytes", ".", "length", ";", "}", "//lenenc_int length of fixed-length fields [0c]", "arr", "[", "pos", "++", "]", "=", "0xc", ";", "//2 character set", "arr", "[", "pos", "++", "]", "=", "33", ";", "/* charset = UTF8 */", "arr", "[", "pos", "++", "]", "=", "0", ";", "int", "len", ";", "/* Sensible predefined length - since we're dealing with I_S here, most char fields are 64 char long */", "switch", "(", "type", ".", "getSqlType", "(", ")", ")", "{", "case", "Types", ".", "VARCHAR", ":", "case", "Types", ".", "CHAR", ":", "len", "=", "64", "*", "3", ";", "/* 3 bytes per UTF8 char */", "break", ";", "case", "Types", ".", "SMALLINT", ":", "len", "=", "5", ";", "break", ";", "case", "Types", ".", "NULL", ":", "len", "=", "0", ";", "break", ";", "default", ":", "len", "=", "1", ";", "break", ";", "}", "//", "arr", "[", "pos", "]", "=", "(", "byte", ")", "len", ";", "/* 4 bytes : column length */", "pos", "+=", "4", ";", "arr", "[", "pos", "++", "]", "=", "(", "byte", ")", "ColumnType", ".", "toServer", "(", "type", ".", "getSqlType", "(", ")", ")", ".", "getType", "(", ")", ";", "/* 1 byte : type */", "arr", "[", "pos", "++", "]", "=", "(", "byte", ")", "len", ";", "/* 2 bytes : flags */", "arr", "[", "pos", "++", "]", "=", "0", ";", "arr", "[", "pos", "++", "]", "=", "0", ";", "/* decimals */", "arr", "[", "pos", "++", "]", "=", "0", ";", "/* 2 bytes filler */", "arr", "[", "pos", "]", "=", "0", ";", "return", "new", "ColumnInformation", "(", "new", "Buffer", "(", "arr", ")", ")", ";", "}" ]
Constructor. @param name column name @param type column type @return ColumnInformation
[ "Constructor", "." ]
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/ColumnInformation.java#L164-L228
rhuss/jolokia
agent/core/src/main/java/org/jolokia/util/IpChecker.java
IpChecker.matches
public static boolean matches(String pExpected, String pToCheck) { """ Check whether a given IP Adress falls within a subnet or is equal to @param pExpected either a simple IP adress (without "/") or a net specification including a netmask (e.g "/24" or "/255.255.255.0") @param pToCheck the ip address to check @return true if either the address to check is the same as the address expected of falls within the subnet if a netmask is given """ String[] parts = pExpected.split("/",2); if (parts.length == 1) { // No Net part given, check for equality ... // Check for valid ips convertToIntTuple(pExpected); convertToIntTuple(pToCheck); return pExpected.equals(pToCheck); } else if (parts.length == 2) { int ipToCheck[] = convertToIntTuple(pToCheck); int ipPattern[] = convertToIntTuple(parts[0]); int netmask[]; if (parts[1].length() <= 2) { netmask = transformCidrToNetmask(parts[1]); } else { netmask = convertToIntTuple(parts[1]); } for (int i = 0; i<ipToCheck.length; i++) { if ((ipPattern[i] & netmask[i]) != (ipToCheck[i] & netmask[i])) { return false; } } return true; } else { throw new IllegalArgumentException("Invalid IP adress specification " + pExpected); } }
java
public static boolean matches(String pExpected, String pToCheck) { String[] parts = pExpected.split("/",2); if (parts.length == 1) { // No Net part given, check for equality ... // Check for valid ips convertToIntTuple(pExpected); convertToIntTuple(pToCheck); return pExpected.equals(pToCheck); } else if (parts.length == 2) { int ipToCheck[] = convertToIntTuple(pToCheck); int ipPattern[] = convertToIntTuple(parts[0]); int netmask[]; if (parts[1].length() <= 2) { netmask = transformCidrToNetmask(parts[1]); } else { netmask = convertToIntTuple(parts[1]); } for (int i = 0; i<ipToCheck.length; i++) { if ((ipPattern[i] & netmask[i]) != (ipToCheck[i] & netmask[i])) { return false; } } return true; } else { throw new IllegalArgumentException("Invalid IP adress specification " + pExpected); } }
[ "public", "static", "boolean", "matches", "(", "String", "pExpected", ",", "String", "pToCheck", ")", "{", "String", "[", "]", "parts", "=", "pExpected", ".", "split", "(", "\"/\"", ",", "2", ")", ";", "if", "(", "parts", ".", "length", "==", "1", ")", "{", "// No Net part given, check for equality ...", "// Check for valid ips", "convertToIntTuple", "(", "pExpected", ")", ";", "convertToIntTuple", "(", "pToCheck", ")", ";", "return", "pExpected", ".", "equals", "(", "pToCheck", ")", ";", "}", "else", "if", "(", "parts", ".", "length", "==", "2", ")", "{", "int", "ipToCheck", "[", "]", "=", "convertToIntTuple", "(", "pToCheck", ")", ";", "int", "ipPattern", "[", "]", "=", "convertToIntTuple", "(", "parts", "[", "0", "]", ")", ";", "int", "netmask", "[", "]", ";", "if", "(", "parts", "[", "1", "]", ".", "length", "(", ")", "<=", "2", ")", "{", "netmask", "=", "transformCidrToNetmask", "(", "parts", "[", "1", "]", ")", ";", "}", "else", "{", "netmask", "=", "convertToIntTuple", "(", "parts", "[", "1", "]", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "ipToCheck", ".", "length", ";", "i", "++", ")", "{", "if", "(", "(", "ipPattern", "[", "i", "]", "&", "netmask", "[", "i", "]", ")", "!=", "(", "ipToCheck", "[", "i", "]", "&", "netmask", "[", "i", "]", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "\"Invalid IP adress specification \"", "+", "pExpected", ")", ";", "}", "}" ]
Check whether a given IP Adress falls within a subnet or is equal to @param pExpected either a simple IP adress (without "/") or a net specification including a netmask (e.g "/24" or "/255.255.255.0") @param pToCheck the ip address to check @return true if either the address to check is the same as the address expected of falls within the subnet if a netmask is given
[ "Check", "whether", "a", "given", "IP", "Adress", "falls", "within", "a", "subnet", "or", "is", "equal", "to" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/util/IpChecker.java#L41-L67
square/javapoet
src/main/java/com/squareup/javapoet/ParameterizedTypeName.java
ParameterizedTypeName.get
public static ParameterizedTypeName get(ClassName rawType, TypeName... typeArguments) { """ Returns a parameterized type, applying {@code typeArguments} to {@code rawType}. """ return new ParameterizedTypeName(null, rawType, Arrays.asList(typeArguments)); }
java
public static ParameterizedTypeName get(ClassName rawType, TypeName... typeArguments) { return new ParameterizedTypeName(null, rawType, Arrays.asList(typeArguments)); }
[ "public", "static", "ParameterizedTypeName", "get", "(", "ClassName", "rawType", ",", "TypeName", "...", "typeArguments", ")", "{", "return", "new", "ParameterizedTypeName", "(", "null", ",", "rawType", ",", "Arrays", ".", "asList", "(", "typeArguments", ")", ")", ";", "}" ]
Returns a parameterized type, applying {@code typeArguments} to {@code rawType}.
[ "Returns", "a", "parameterized", "type", "applying", "{" ]
train
https://github.com/square/javapoet/blob/0f93da9a3d9a1da8d29fc993409fcf83d40452bc/src/main/java/com/squareup/javapoet/ParameterizedTypeName.java#L113-L115
btrplace/scheduler
json/src/main/java/org/btrplace/json/JSONs.java
JSONs.requiredVMs
public static List<VM> requiredVMs(Model mo, JSONObject o, String id) throws JSONConverterException { """ Read an expected list of VMs. @param mo the associated model to browse @param o the object to parse @param id the key in the map that points to the list @return the parsed list @throws JSONConverterException if the key does not point to a list of VM identifiers """ checkKeys(o, id); Object x = o.get(id); if (!(x instanceof JSONArray)) { throw new JSONConverterException("integers expected at key '" + id + "'"); } return vmsFromJSON(mo, (JSONArray) x); }
java
public static List<VM> requiredVMs(Model mo, JSONObject o, String id) throws JSONConverterException { checkKeys(o, id); Object x = o.get(id); if (!(x instanceof JSONArray)) { throw new JSONConverterException("integers expected at key '" + id + "'"); } return vmsFromJSON(mo, (JSONArray) x); }
[ "public", "static", "List", "<", "VM", ">", "requiredVMs", "(", "Model", "mo", ",", "JSONObject", "o", ",", "String", "id", ")", "throws", "JSONConverterException", "{", "checkKeys", "(", "o", ",", "id", ")", ";", "Object", "x", "=", "o", ".", "get", "(", "id", ")", ";", "if", "(", "!", "(", "x", "instanceof", "JSONArray", ")", ")", "{", "throw", "new", "JSONConverterException", "(", "\"integers expected at key '\"", "+", "id", "+", "\"'\"", ")", ";", "}", "return", "vmsFromJSON", "(", "mo", ",", "(", "JSONArray", ")", "x", ")", ";", "}" ]
Read an expected list of VMs. @param mo the associated model to browse @param o the object to parse @param id the key in the map that points to the list @return the parsed list @throws JSONConverterException if the key does not point to a list of VM identifiers
[ "Read", "an", "expected", "list", "of", "VMs", "." ]
train
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/JSONs.java#L263-L270
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/extension/NGAExtensions.java
NGAExtensions.deleteTileScaling
public static void deleteTileScaling(GeoPackageCore geoPackage, String table) { """ Delete the Tile Scaling extensions for the table @param geoPackage GeoPackage @param table table name @since 2.0.2 """ TileScalingDao tileScalingDao = geoPackage.getTileScalingDao(); ExtensionsDao extensionsDao = geoPackage.getExtensionsDao(); try { if (tileScalingDao.isTableExists()) { tileScalingDao.deleteById(table); } if (extensionsDao.isTableExists()) { extensionsDao.deleteByExtension( TileTableScaling.EXTENSION_NAME, table); } } catch (SQLException e) { throw new GeoPackageException( "Failed to delete Tile Scaling. GeoPackage: " + geoPackage.getName() + ", Table: " + table, e); } }
java
public static void deleteTileScaling(GeoPackageCore geoPackage, String table) { TileScalingDao tileScalingDao = geoPackage.getTileScalingDao(); ExtensionsDao extensionsDao = geoPackage.getExtensionsDao(); try { if (tileScalingDao.isTableExists()) { tileScalingDao.deleteById(table); } if (extensionsDao.isTableExists()) { extensionsDao.deleteByExtension( TileTableScaling.EXTENSION_NAME, table); } } catch (SQLException e) { throw new GeoPackageException( "Failed to delete Tile Scaling. GeoPackage: " + geoPackage.getName() + ", Table: " + table, e); } }
[ "public", "static", "void", "deleteTileScaling", "(", "GeoPackageCore", "geoPackage", ",", "String", "table", ")", "{", "TileScalingDao", "tileScalingDao", "=", "geoPackage", ".", "getTileScalingDao", "(", ")", ";", "ExtensionsDao", "extensionsDao", "=", "geoPackage", ".", "getExtensionsDao", "(", ")", ";", "try", "{", "if", "(", "tileScalingDao", ".", "isTableExists", "(", ")", ")", "{", "tileScalingDao", ".", "deleteById", "(", "table", ")", ";", "}", "if", "(", "extensionsDao", ".", "isTableExists", "(", ")", ")", "{", "extensionsDao", ".", "deleteByExtension", "(", "TileTableScaling", ".", "EXTENSION_NAME", ",", "table", ")", ";", "}", "}", "catch", "(", "SQLException", "e", ")", "{", "throw", "new", "GeoPackageException", "(", "\"Failed to delete Tile Scaling. GeoPackage: \"", "+", "geoPackage", ".", "getName", "(", ")", "+", "\", Table: \"", "+", "table", ",", "e", ")", ";", "}", "}" ]
Delete the Tile Scaling extensions for the table @param geoPackage GeoPackage @param table table name @since 2.0.2
[ "Delete", "the", "Tile", "Scaling", "extensions", "for", "the", "table" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/NGAExtensions.java#L195-L213
gallandarakhneorg/afc
advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/dfx/Vector3dfx.java
Vector3dfx.lengthSquaredProperty
public ReadOnlyDoubleProperty lengthSquaredProperty() { """ Replies the property that represents the length of the vector. @return the length property """ if (this.lengthSquareProperty == null) { this.lengthSquareProperty = new ReadOnlyDoubleWrapper(this, MathFXAttributeNames.LENGTH_SQUARED); this.lengthSquareProperty.bind(Bindings.createDoubleBinding(() -> Vector3dfx.this.x.doubleValue() * Vector3dfx.this.x.doubleValue() + Vector3dfx.this.y.doubleValue() * Vector3dfx.this.y.doubleValue() + Vector3dfx.this.z.doubleValue() * Vector3dfx.this.z.doubleValue(), this.x, this.y, this.z)); } return this.lengthSquareProperty.getReadOnlyProperty(); }
java
public ReadOnlyDoubleProperty lengthSquaredProperty() { if (this.lengthSquareProperty == null) { this.lengthSquareProperty = new ReadOnlyDoubleWrapper(this, MathFXAttributeNames.LENGTH_SQUARED); this.lengthSquareProperty.bind(Bindings.createDoubleBinding(() -> Vector3dfx.this.x.doubleValue() * Vector3dfx.this.x.doubleValue() + Vector3dfx.this.y.doubleValue() * Vector3dfx.this.y.doubleValue() + Vector3dfx.this.z.doubleValue() * Vector3dfx.this.z.doubleValue(), this.x, this.y, this.z)); } return this.lengthSquareProperty.getReadOnlyProperty(); }
[ "public", "ReadOnlyDoubleProperty", "lengthSquaredProperty", "(", ")", "{", "if", "(", "this", ".", "lengthSquareProperty", "==", "null", ")", "{", "this", ".", "lengthSquareProperty", "=", "new", "ReadOnlyDoubleWrapper", "(", "this", ",", "MathFXAttributeNames", ".", "LENGTH_SQUARED", ")", ";", "this", ".", "lengthSquareProperty", ".", "bind", "(", "Bindings", ".", "createDoubleBinding", "(", "(", ")", "->", "Vector3dfx", ".", "this", ".", "x", ".", "doubleValue", "(", ")", "*", "Vector3dfx", ".", "this", ".", "x", ".", "doubleValue", "(", ")", "+", "Vector3dfx", ".", "this", ".", "y", ".", "doubleValue", "(", ")", "*", "Vector3dfx", ".", "this", ".", "y", ".", "doubleValue", "(", ")", "+", "Vector3dfx", ".", "this", ".", "z", ".", "doubleValue", "(", ")", "*", "Vector3dfx", ".", "this", ".", "z", ".", "doubleValue", "(", ")", ",", "this", ".", "x", ",", "this", ".", "y", ",", "this", ".", "z", ")", ")", ";", "}", "return", "this", ".", "lengthSquareProperty", ".", "getReadOnlyProperty", "(", ")", ";", "}" ]
Replies the property that represents the length of the vector. @return the length property
[ "Replies", "the", "property", "that", "represents", "the", "length", "of", "the", "vector", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/dfx/Vector3dfx.java#L180-L189
apache/flink
flink-optimizer/src/main/java/org/apache/flink/optimizer/dag/BulkIterationNode.java
BulkIterationNode.setNextPartialSolution
public void setNextPartialSolution(OptimizerNode nextPartialSolution, OptimizerNode terminationCriterion) { """ Sets the nextPartialSolution for this BulkIterationNode. @param nextPartialSolution The nextPartialSolution to set. """ // check if the root of the step function has the same parallelism as the iteration // or if the step function has any operator at all if (nextPartialSolution.getParallelism() != getParallelism() || nextPartialSolution == partialSolution || nextPartialSolution instanceof BinaryUnionNode) { // add a no-op to the root to express the re-partitioning NoOpNode noop = new NoOpNode(); noop.setParallelism(getParallelism()); DagConnection noOpConn = new DagConnection(nextPartialSolution, noop, ExecutionMode.PIPELINED); noop.setIncomingConnection(noOpConn); nextPartialSolution.addOutgoingConnection(noOpConn); nextPartialSolution = noop; } this.nextPartialSolution = nextPartialSolution; this.terminationCriterion = terminationCriterion; if (terminationCriterion == null) { this.singleRoot = nextPartialSolution; this.rootConnection = new DagConnection(nextPartialSolution, ExecutionMode.PIPELINED); } else { // we have a termination criterion SingleRootJoiner singleRootJoiner = new SingleRootJoiner(); this.rootConnection = new DagConnection(nextPartialSolution, singleRootJoiner, ExecutionMode.PIPELINED); this.terminationCriterionRootConnection = new DagConnection(terminationCriterion, singleRootJoiner, ExecutionMode.PIPELINED); singleRootJoiner.setInputs(this.rootConnection, this.terminationCriterionRootConnection); this.singleRoot = singleRootJoiner; // add connection to terminationCriterion for interesting properties visitor terminationCriterion.addOutgoingConnection(terminationCriterionRootConnection); } nextPartialSolution.addOutgoingConnection(rootConnection); }
java
public void setNextPartialSolution(OptimizerNode nextPartialSolution, OptimizerNode terminationCriterion) { // check if the root of the step function has the same parallelism as the iteration // or if the step function has any operator at all if (nextPartialSolution.getParallelism() != getParallelism() || nextPartialSolution == partialSolution || nextPartialSolution instanceof BinaryUnionNode) { // add a no-op to the root to express the re-partitioning NoOpNode noop = new NoOpNode(); noop.setParallelism(getParallelism()); DagConnection noOpConn = new DagConnection(nextPartialSolution, noop, ExecutionMode.PIPELINED); noop.setIncomingConnection(noOpConn); nextPartialSolution.addOutgoingConnection(noOpConn); nextPartialSolution = noop; } this.nextPartialSolution = nextPartialSolution; this.terminationCriterion = terminationCriterion; if (terminationCriterion == null) { this.singleRoot = nextPartialSolution; this.rootConnection = new DagConnection(nextPartialSolution, ExecutionMode.PIPELINED); } else { // we have a termination criterion SingleRootJoiner singleRootJoiner = new SingleRootJoiner(); this.rootConnection = new DagConnection(nextPartialSolution, singleRootJoiner, ExecutionMode.PIPELINED); this.terminationCriterionRootConnection = new DagConnection(terminationCriterion, singleRootJoiner, ExecutionMode.PIPELINED); singleRootJoiner.setInputs(this.rootConnection, this.terminationCriterionRootConnection); this.singleRoot = singleRootJoiner; // add connection to terminationCriterion for interesting properties visitor terminationCriterion.addOutgoingConnection(terminationCriterionRootConnection); } nextPartialSolution.addOutgoingConnection(rootConnection); }
[ "public", "void", "setNextPartialSolution", "(", "OptimizerNode", "nextPartialSolution", ",", "OptimizerNode", "terminationCriterion", ")", "{", "// check if the root of the step function has the same parallelism as the iteration", "// or if the step function has any operator at all", "if", "(", "nextPartialSolution", ".", "getParallelism", "(", ")", "!=", "getParallelism", "(", ")", "||", "nextPartialSolution", "==", "partialSolution", "||", "nextPartialSolution", "instanceof", "BinaryUnionNode", ")", "{", "// add a no-op to the root to express the re-partitioning", "NoOpNode", "noop", "=", "new", "NoOpNode", "(", ")", ";", "noop", ".", "setParallelism", "(", "getParallelism", "(", ")", ")", ";", "DagConnection", "noOpConn", "=", "new", "DagConnection", "(", "nextPartialSolution", ",", "noop", ",", "ExecutionMode", ".", "PIPELINED", ")", ";", "noop", ".", "setIncomingConnection", "(", "noOpConn", ")", ";", "nextPartialSolution", ".", "addOutgoingConnection", "(", "noOpConn", ")", ";", "nextPartialSolution", "=", "noop", ";", "}", "this", ".", "nextPartialSolution", "=", "nextPartialSolution", ";", "this", ".", "terminationCriterion", "=", "terminationCriterion", ";", "if", "(", "terminationCriterion", "==", "null", ")", "{", "this", ".", "singleRoot", "=", "nextPartialSolution", ";", "this", ".", "rootConnection", "=", "new", "DagConnection", "(", "nextPartialSolution", ",", "ExecutionMode", ".", "PIPELINED", ")", ";", "}", "else", "{", "// we have a termination criterion", "SingleRootJoiner", "singleRootJoiner", "=", "new", "SingleRootJoiner", "(", ")", ";", "this", ".", "rootConnection", "=", "new", "DagConnection", "(", "nextPartialSolution", ",", "singleRootJoiner", ",", "ExecutionMode", ".", "PIPELINED", ")", ";", "this", ".", "terminationCriterionRootConnection", "=", "new", "DagConnection", "(", "terminationCriterion", ",", "singleRootJoiner", ",", "ExecutionMode", ".", "PIPELINED", ")", ";", "singleRootJoiner", ".", "setInputs", "(", "this", ".", "rootConnection", ",", "this", ".", "terminationCriterionRootConnection", ")", ";", "this", ".", "singleRoot", "=", "singleRootJoiner", ";", "// add connection to terminationCriterion for interesting properties visitor", "terminationCriterion", ".", "addOutgoingConnection", "(", "terminationCriterionRootConnection", ")", ";", "}", "nextPartialSolution", ".", "addOutgoingConnection", "(", "rootConnection", ")", ";", "}" ]
Sets the nextPartialSolution for this BulkIterationNode. @param nextPartialSolution The nextPartialSolution to set.
[ "Sets", "the", "nextPartialSolution", "for", "this", "BulkIterationNode", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/dag/BulkIterationNode.java#L132-L174
UrielCh/ovh-java-sdk
ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java
ApiOvhIpLoadbalancing.serviceName_instancesState_GET
public ArrayList<OvhInstancesState> serviceName_instancesState_GET(String serviceName) throws IOException { """ Get the effective state of your IPLB instances on IPLB servers REST: GET /ipLoadbalancing/{serviceName}/instancesState @param serviceName [required] The internal name of your IP load balancing @deprecated """ String qPath = "/ipLoadbalancing/{serviceName}/instancesState"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t6); }
java
public ArrayList<OvhInstancesState> serviceName_instancesState_GET(String serviceName) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/instancesState"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t6); }
[ "public", "ArrayList", "<", "OvhInstancesState", ">", "serviceName_instancesState_GET", "(", "String", "serviceName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ipLoadbalancing/{serviceName}/instancesState\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t6", ")", ";", "}" ]
Get the effective state of your IPLB instances on IPLB servers REST: GET /ipLoadbalancing/{serviceName}/instancesState @param serviceName [required] The internal name of your IP load balancing @deprecated
[ "Get", "the", "effective", "state", "of", "your", "IPLB", "instances", "on", "IPLB", "servers" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L725-L730
apereo/cas
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/serialization/SerializationUtils.java
SerializationUtils.decodeAndDeserializeObject
@SneakyThrows public static <T extends Serializable> T decodeAndDeserializeObject(final byte[] object, final CipherExecutor cipher, final Class<T> type, final Object[] parameters) { """ Decode and serialize object. @param <T> the type parameter @param object the object @param cipher the cipher @param type the type @param parameters the parameters @return the t @since 4.2 """ val decoded = (byte[]) cipher.decode(object, parameters); return deserializeAndCheckObject(decoded, type); }
java
@SneakyThrows public static <T extends Serializable> T decodeAndDeserializeObject(final byte[] object, final CipherExecutor cipher, final Class<T> type, final Object[] parameters) { val decoded = (byte[]) cipher.decode(object, parameters); return deserializeAndCheckObject(decoded, type); }
[ "@", "SneakyThrows", "public", "static", "<", "T", "extends", "Serializable", ">", "T", "decodeAndDeserializeObject", "(", "final", "byte", "[", "]", "object", ",", "final", "CipherExecutor", "cipher", ",", "final", "Class", "<", "T", ">", "type", ",", "final", "Object", "[", "]", "parameters", ")", "{", "val", "decoded", "=", "(", "byte", "[", "]", ")", "cipher", ".", "decode", "(", "object", ",", "parameters", ")", ";", "return", "deserializeAndCheckObject", "(", "decoded", ",", "type", ")", ";", "}" ]
Decode and serialize object. @param <T> the type parameter @param object the object @param cipher the cipher @param type the type @param parameters the parameters @return the t @since 4.2
[ "Decode", "and", "serialize", "object", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/serialization/SerializationUtils.java#L132-L139
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/types/SlotProfile.java
SlotProfile.preferredLocality
public static SlotProfile preferredLocality(ResourceProfile resourceProfile, Collection<TaskManagerLocation> preferredLocations) { """ Returns a slot profile for the given resource profile and the preferred locations. @param resourceProfile specifying the slot requirements @param preferredLocations specifying the preferred locations @return Slot profile with the given resource profile and preferred locations """ return new SlotProfile(resourceProfile, preferredLocations, Collections.emptyList()); }
java
public static SlotProfile preferredLocality(ResourceProfile resourceProfile, Collection<TaskManagerLocation> preferredLocations) { return new SlotProfile(resourceProfile, preferredLocations, Collections.emptyList()); }
[ "public", "static", "SlotProfile", "preferredLocality", "(", "ResourceProfile", "resourceProfile", ",", "Collection", "<", "TaskManagerLocation", ">", "preferredLocations", ")", "{", "return", "new", "SlotProfile", "(", "resourceProfile", ",", "preferredLocations", ",", "Collections", ".", "emptyList", "(", ")", ")", ";", "}" ]
Returns a slot profile for the given resource profile and the preferred locations. @param resourceProfile specifying the slot requirements @param preferredLocations specifying the preferred locations @return Slot profile with the given resource profile and preferred locations
[ "Returns", "a", "slot", "profile", "for", "the", "given", "resource", "profile", "and", "the", "preferred", "locations", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/types/SlotProfile.java#L132-L134
arnaudroger/SimpleFlatMapper
sfm-jdbc/src/main/java/org/simpleflatmapper/jdbc/JdbcMapperBuilder.java
JdbcMapperBuilder.addMapping
public JdbcMapperBuilder<T> addMapping(final String column, final int index, final int sqlType, Object... properties) { """ add a new mapping to the specified property with the specified index, the specified type. @param column the property name @param index the property index @param sqlType the property type, @see java.sql.Types @param properties the property properties @return the current builder """ return addMapping(new JdbcColumnKey(column, index, sqlType), properties); }
java
public JdbcMapperBuilder<T> addMapping(final String column, final int index, final int sqlType, Object... properties) { return addMapping(new JdbcColumnKey(column, index, sqlType), properties); }
[ "public", "JdbcMapperBuilder", "<", "T", ">", "addMapping", "(", "final", "String", "column", ",", "final", "int", "index", ",", "final", "int", "sqlType", ",", "Object", "...", "properties", ")", "{", "return", "addMapping", "(", "new", "JdbcColumnKey", "(", "column", ",", "index", ",", "sqlType", ")", ",", "properties", ")", ";", "}" ]
add a new mapping to the specified property with the specified index, the specified type. @param column the property name @param index the property index @param sqlType the property type, @see java.sql.Types @param properties the property properties @return the current builder
[ "add", "a", "new", "mapping", "to", "the", "specified", "property", "with", "the", "specified", "index", "the", "specified", "type", "." ]
train
https://github.com/arnaudroger/SimpleFlatMapper/blob/93435438c18f26c87963d5e0f3ebf0f264dcd8c2/sfm-jdbc/src/main/java/org/simpleflatmapper/jdbc/JdbcMapperBuilder.java#L175-L177
lucee/Lucee
core/src/main/java/lucee/transformer/library/tag/TagLibFactory.java
TagLibFactory.loadFromStream
public static TagLib loadFromStream(InputStream is, Identification id) throws TagLibException { """ Laedt eine einzelne TagLib. @param file TLD die geladen werden soll. @param saxParser Definition des Sax Parser mit dem die TagLib eingelsesen werden soll. @return TagLib @throws TagLibException """ return new TagLibFactory(null, is, id).getLib(); }
java
public static TagLib loadFromStream(InputStream is, Identification id) throws TagLibException { return new TagLibFactory(null, is, id).getLib(); }
[ "public", "static", "TagLib", "loadFromStream", "(", "InputStream", "is", ",", "Identification", "id", ")", "throws", "TagLibException", "{", "return", "new", "TagLibFactory", "(", "null", ",", "is", ",", "id", ")", ".", "getLib", "(", ")", ";", "}" ]
Laedt eine einzelne TagLib. @param file TLD die geladen werden soll. @param saxParser Definition des Sax Parser mit dem die TagLib eingelsesen werden soll. @return TagLib @throws TagLibException
[ "Laedt", "eine", "einzelne", "TagLib", "." ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/library/tag/TagLibFactory.java#L509-L511
passwordmaker/java-passwordmaker-lib
src/main/java/org/daveware/passwordmaker/Account.java
Account.getChild
public Account getChild(int index) throws IndexOutOfBoundsException { """ Gets a specifically indexed child. @param index The index of the child to get. @return The child at the index. @throws IndexOutOfBoundsException upon invalid index. """ if (index < 0 || index >= children.size()) throw new IndexOutOfBoundsException("Illegal child index, " + index); return children.get(index); }
java
public Account getChild(int index) throws IndexOutOfBoundsException { if (index < 0 || index >= children.size()) throw new IndexOutOfBoundsException("Illegal child index, " + index); return children.get(index); }
[ "public", "Account", "getChild", "(", "int", "index", ")", "throws", "IndexOutOfBoundsException", "{", "if", "(", "index", "<", "0", "||", "index", ">=", "children", ".", "size", "(", ")", ")", "throw", "new", "IndexOutOfBoundsException", "(", "\"Illegal child index, \"", "+", "index", ")", ";", "return", "children", ".", "get", "(", "index", ")", ";", "}" ]
Gets a specifically indexed child. @param index The index of the child to get. @return The child at the index. @throws IndexOutOfBoundsException upon invalid index.
[ "Gets", "a", "specifically", "indexed", "child", "." ]
train
https://github.com/passwordmaker/java-passwordmaker-lib/blob/18c22fca7dd9a47f08161425b85a5bd257afbb2b/src/main/java/org/daveware/passwordmaker/Account.java#L617-L621
OpenBEL/openbel-framework
org.openbel.framework.core/src/main/java/org/openbel/framework/core/protonetwork/ProtoNetworkMerger.java
ProtoNetworkMerger.remapEdges
private void remapEdges(ProtoNetwork protoNetwork1, ProtoNetwork protoNetwork2, int documentId, Map<Integer, Integer> termMap, int newStatementIndex, List<TableProtoEdge> edges, Set<Integer> edgeIndices) { """ Remaps {@link TableProtoEdge proto edges} for a {@link TableStatement statement}. A new statement index is created from a merge which requires the old {@link TableProtoEdge proto edges} to be associated with it. @see https://github.com/OpenBEL/openbel-framework/issues/49 @param protoNetwork1 {@link ProtoNetwork}; merge into @param protoNetwork2 {@link ProtoNetwork}; merge from @param documentId {@code int}; bel document id @param termMap {@link Map} of old term id to new proto node id @param newStatementIndex {@code int} new merged statement id @param edges {@link List}; merging statement's {@link TableProtoEdge edges} @param edgeIndices {@link Set}; set of old statement's edge indices """ ProtoNodeTable nt = protoNetwork2.getProtoNodeTable(); Map<Integer, Integer> nodeTermIndex = nt.getNodeTermIndex(); TableProtoEdge[] remappedEdges = new TableProtoEdge[edgeIndices.size()]; int i = 0; for (Integer edgeIndex : edgeIndices) { TableProtoEdge edge = edges.get(edgeIndex); int sourceBefore = edge.getSource(); int targetBefore = edge.getTarget(); Integer sourceTerm = nodeTermIndex.get(sourceBefore); Integer targetTerm = nodeTermIndex.get(targetBefore); Integer newSource = termMap.get(sourceTerm); if (newSource == null) { newSource = mergeTerm(sourceTerm, protoNetwork1, protoNetwork2, documentId, termMap); } Integer newTarget = termMap.get(targetTerm); if (newTarget == null) { newTarget = mergeTerm(targetTerm, protoNetwork1, protoNetwork2, documentId, termMap); } remappedEdges[i++] = new TableProtoEdge(newSource, edge.getRel(), newTarget); } ProtoEdgeTable edgeTable = protoNetwork1.getProtoEdgeTable(); edgeTable.addEdges(newStatementIndex, remappedEdges); }
java
private void remapEdges(ProtoNetwork protoNetwork1, ProtoNetwork protoNetwork2, int documentId, Map<Integer, Integer> termMap, int newStatementIndex, List<TableProtoEdge> edges, Set<Integer> edgeIndices) { ProtoNodeTable nt = protoNetwork2.getProtoNodeTable(); Map<Integer, Integer> nodeTermIndex = nt.getNodeTermIndex(); TableProtoEdge[] remappedEdges = new TableProtoEdge[edgeIndices.size()]; int i = 0; for (Integer edgeIndex : edgeIndices) { TableProtoEdge edge = edges.get(edgeIndex); int sourceBefore = edge.getSource(); int targetBefore = edge.getTarget(); Integer sourceTerm = nodeTermIndex.get(sourceBefore); Integer targetTerm = nodeTermIndex.get(targetBefore); Integer newSource = termMap.get(sourceTerm); if (newSource == null) { newSource = mergeTerm(sourceTerm, protoNetwork1, protoNetwork2, documentId, termMap); } Integer newTarget = termMap.get(targetTerm); if (newTarget == null) { newTarget = mergeTerm(targetTerm, protoNetwork1, protoNetwork2, documentId, termMap); } remappedEdges[i++] = new TableProtoEdge(newSource, edge.getRel(), newTarget); } ProtoEdgeTable edgeTable = protoNetwork1.getProtoEdgeTable(); edgeTable.addEdges(newStatementIndex, remappedEdges); }
[ "private", "void", "remapEdges", "(", "ProtoNetwork", "protoNetwork1", ",", "ProtoNetwork", "protoNetwork2", ",", "int", "documentId", ",", "Map", "<", "Integer", ",", "Integer", ">", "termMap", ",", "int", "newStatementIndex", ",", "List", "<", "TableProtoEdge", ">", "edges", ",", "Set", "<", "Integer", ">", "edgeIndices", ")", "{", "ProtoNodeTable", "nt", "=", "protoNetwork2", ".", "getProtoNodeTable", "(", ")", ";", "Map", "<", "Integer", ",", "Integer", ">", "nodeTermIndex", "=", "nt", ".", "getNodeTermIndex", "(", ")", ";", "TableProtoEdge", "[", "]", "remappedEdges", "=", "new", "TableProtoEdge", "[", "edgeIndices", ".", "size", "(", ")", "]", ";", "int", "i", "=", "0", ";", "for", "(", "Integer", "edgeIndex", ":", "edgeIndices", ")", "{", "TableProtoEdge", "edge", "=", "edges", ".", "get", "(", "edgeIndex", ")", ";", "int", "sourceBefore", "=", "edge", ".", "getSource", "(", ")", ";", "int", "targetBefore", "=", "edge", ".", "getTarget", "(", ")", ";", "Integer", "sourceTerm", "=", "nodeTermIndex", ".", "get", "(", "sourceBefore", ")", ";", "Integer", "targetTerm", "=", "nodeTermIndex", ".", "get", "(", "targetBefore", ")", ";", "Integer", "newSource", "=", "termMap", ".", "get", "(", "sourceTerm", ")", ";", "if", "(", "newSource", "==", "null", ")", "{", "newSource", "=", "mergeTerm", "(", "sourceTerm", ",", "protoNetwork1", ",", "protoNetwork2", ",", "documentId", ",", "termMap", ")", ";", "}", "Integer", "newTarget", "=", "termMap", ".", "get", "(", "targetTerm", ")", ";", "if", "(", "newTarget", "==", "null", ")", "{", "newTarget", "=", "mergeTerm", "(", "targetTerm", ",", "protoNetwork1", ",", "protoNetwork2", ",", "documentId", ",", "termMap", ")", ";", "}", "remappedEdges", "[", "i", "++", "]", "=", "new", "TableProtoEdge", "(", "newSource", ",", "edge", ".", "getRel", "(", ")", ",", "newTarget", ")", ";", "}", "ProtoEdgeTable", "edgeTable", "=", "protoNetwork1", ".", "getProtoEdgeTable", "(", ")", ";", "edgeTable", ".", "addEdges", "(", "newStatementIndex", ",", "remappedEdges", ")", ";", "}" ]
Remaps {@link TableProtoEdge proto edges} for a {@link TableStatement statement}. A new statement index is created from a merge which requires the old {@link TableProtoEdge proto edges} to be associated with it. @see https://github.com/OpenBEL/openbel-framework/issues/49 @param protoNetwork1 {@link ProtoNetwork}; merge into @param protoNetwork2 {@link ProtoNetwork}; merge from @param documentId {@code int}; bel document id @param termMap {@link Map} of old term id to new proto node id @param newStatementIndex {@code int} new merged statement id @param edges {@link List}; merging statement's {@link TableProtoEdge edges} @param edgeIndices {@link Set}; set of old statement's edge indices
[ "Remaps", "{", "@link", "TableProtoEdge", "proto", "edges", "}", "for", "a", "{", "@link", "TableStatement", "statement", "}", ".", "A", "new", "statement", "index", "is", "created", "from", "a", "merge", "which", "requires", "the", "old", "{", "@link", "TableProtoEdge", "proto", "edges", "}", "to", "be", "associated", "with", "it", "." ]
train
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.core/src/main/java/org/openbel/framework/core/protonetwork/ProtoNetworkMerger.java#L299-L332
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/DirectoryHelper.java
DirectoryHelper.renameFile
public static void renameFile(File srcFile, File dstFile) throws IOException { """ Rename file. If file can't be renamed in standard way the coping data will be used instead. @param srcFile source file @param dstFile destination file @throws IOException if any exception occurred """ // Rename the srcFile file to the new one. Unfortunately, the renameTo() // method does not work reliably under some JVMs. Therefore, if the // rename fails, we manually rename by copying the srcFile file to the new one if (!srcFile.renameTo(dstFile)) { InputStream in = null; OutputStream out = null; try { in = new FileInputStream(srcFile); out = new FileOutputStream(dstFile); transfer(in, out); } catch (IOException ioe) { IOException newExc = new IOException("Cannot rename " + srcFile + " to " + dstFile); newExc.initCause(ioe); throw newExc; } finally { if (in != null) { in.close(); } if (out != null) { out.close(); } } // delete the srcFile file. srcFile.delete(); } }
java
public static void renameFile(File srcFile, File dstFile) throws IOException { // Rename the srcFile file to the new one. Unfortunately, the renameTo() // method does not work reliably under some JVMs. Therefore, if the // rename fails, we manually rename by copying the srcFile file to the new one if (!srcFile.renameTo(dstFile)) { InputStream in = null; OutputStream out = null; try { in = new FileInputStream(srcFile); out = new FileOutputStream(dstFile); transfer(in, out); } catch (IOException ioe) { IOException newExc = new IOException("Cannot rename " + srcFile + " to " + dstFile); newExc.initCause(ioe); throw newExc; } finally { if (in != null) { in.close(); } if (out != null) { out.close(); } } // delete the srcFile file. srcFile.delete(); } }
[ "public", "static", "void", "renameFile", "(", "File", "srcFile", ",", "File", "dstFile", ")", "throws", "IOException", "{", "// Rename the srcFile file to the new one. Unfortunately, the renameTo()\r", "// method does not work reliably under some JVMs. Therefore, if the\r", "// rename fails, we manually rename by copying the srcFile file to the new one\r", "if", "(", "!", "srcFile", ".", "renameTo", "(", "dstFile", ")", ")", "{", "InputStream", "in", "=", "null", ";", "OutputStream", "out", "=", "null", ";", "try", "{", "in", "=", "new", "FileInputStream", "(", "srcFile", ")", ";", "out", "=", "new", "FileOutputStream", "(", "dstFile", ")", ";", "transfer", "(", "in", ",", "out", ")", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "IOException", "newExc", "=", "new", "IOException", "(", "\"Cannot rename \"", "+", "srcFile", "+", "\" to \"", "+", "dstFile", ")", ";", "newExc", ".", "initCause", "(", "ioe", ")", ";", "throw", "newExc", ";", "}", "finally", "{", "if", "(", "in", "!=", "null", ")", "{", "in", ".", "close", "(", ")", ";", "}", "if", "(", "out", "!=", "null", ")", "{", "out", ".", "close", "(", ")", ";", "}", "}", "// delete the srcFile file.\r", "srcFile", ".", "delete", "(", ")", ";", "}", "}" ]
Rename file. If file can't be renamed in standard way the coping data will be used instead. @param srcFile source file @param dstFile destination file @throws IOException if any exception occurred
[ "Rename", "file", ".", "If", "file", "can", "t", "be", "renamed", "in", "standard", "way", "the", "coping", "data", "will", "be", "used", "instead", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/DirectoryHelper.java#L408-L446
kaazing/gateway
server/src/main/java/org/kaazing/gateway/server/impl/GatewayCreatorImpl.java
GatewayCreatorImpl.configureGateway
@Override public void configureGateway(Gateway gateway) { """ Bootstrap the Gateway instance with a GATEWAY_HOME if not already set in System properties. """ Properties properties = new Properties(); properties.putAll(System.getProperties()); String gatewayHome = properties.getProperty(Gateway.GATEWAY_HOME_PROPERTY); if ((gatewayHome == null) || "".equals(gatewayHome)) { ClassLoader loader = Thread.currentThread().getContextClassLoader(); URL classUrl = loader.getResource("org/kaazing/gateway/server/Gateway.class"); String urlStr; try { urlStr = URLDecoder.decode(classUrl.toString(), "UTF-8"); } catch (UnsupportedEncodingException ex) { // it's not likely that UTF-8 will be unsupported, so in practice this will never occur throw new RuntimeException("Failed to configure Gateway", ex); } // The URL is coming from a JAR file. The format of that is supposed to be // jar:<url>!/<packagepath>. Normally the first part of the <url> section will be // 'file:', but could be different if somehow the JAR is loaded from the network. // We can only handle the 'file' case, so will check. int packageSeparatorIndex = urlStr.indexOf("!/"); if (packageSeparatorIndex > 0) { urlStr = urlStr.substring(0, urlStr.indexOf("!/")); urlStr = urlStr.substring(4); // remove the 'jar:' part. } if (!urlStr.startsWith("file:")) { throw new RuntimeException("The Gateway class was not loaded from a file, so we " + "cannot determine the location of GATEWAY_HOME"); } urlStr = urlStr.substring(5); // remove the 'file:' stuff. File jarFile = new File(urlStr); gatewayHome = jarFile.getParentFile().getParent(); properties.setProperty("GATEWAY_HOME", gatewayHome); } gateway.setProperties(properties); }
java
@Override public void configureGateway(Gateway gateway) { Properties properties = new Properties(); properties.putAll(System.getProperties()); String gatewayHome = properties.getProperty(Gateway.GATEWAY_HOME_PROPERTY); if ((gatewayHome == null) || "".equals(gatewayHome)) { ClassLoader loader = Thread.currentThread().getContextClassLoader(); URL classUrl = loader.getResource("org/kaazing/gateway/server/Gateway.class"); String urlStr; try { urlStr = URLDecoder.decode(classUrl.toString(), "UTF-8"); } catch (UnsupportedEncodingException ex) { // it's not likely that UTF-8 will be unsupported, so in practice this will never occur throw new RuntimeException("Failed to configure Gateway", ex); } // The URL is coming from a JAR file. The format of that is supposed to be // jar:<url>!/<packagepath>. Normally the first part of the <url> section will be // 'file:', but could be different if somehow the JAR is loaded from the network. // We can only handle the 'file' case, so will check. int packageSeparatorIndex = urlStr.indexOf("!/"); if (packageSeparatorIndex > 0) { urlStr = urlStr.substring(0, urlStr.indexOf("!/")); urlStr = urlStr.substring(4); // remove the 'jar:' part. } if (!urlStr.startsWith("file:")) { throw new RuntimeException("The Gateway class was not loaded from a file, so we " + "cannot determine the location of GATEWAY_HOME"); } urlStr = urlStr.substring(5); // remove the 'file:' stuff. File jarFile = new File(urlStr); gatewayHome = jarFile.getParentFile().getParent(); properties.setProperty("GATEWAY_HOME", gatewayHome); } gateway.setProperties(properties); }
[ "@", "Override", "public", "void", "configureGateway", "(", "Gateway", "gateway", ")", "{", "Properties", "properties", "=", "new", "Properties", "(", ")", ";", "properties", ".", "putAll", "(", "System", ".", "getProperties", "(", ")", ")", ";", "String", "gatewayHome", "=", "properties", ".", "getProperty", "(", "Gateway", ".", "GATEWAY_HOME_PROPERTY", ")", ";", "if", "(", "(", "gatewayHome", "==", "null", ")", "||", "\"\"", ".", "equals", "(", "gatewayHome", ")", ")", "{", "ClassLoader", "loader", "=", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(", ")", ";", "URL", "classUrl", "=", "loader", ".", "getResource", "(", "\"org/kaazing/gateway/server/Gateway.class\"", ")", ";", "String", "urlStr", ";", "try", "{", "urlStr", "=", "URLDecoder", ".", "decode", "(", "classUrl", ".", "toString", "(", ")", ",", "\"UTF-8\"", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "ex", ")", "{", "// it's not likely that UTF-8 will be unsupported, so in practice this will never occur", "throw", "new", "RuntimeException", "(", "\"Failed to configure Gateway\"", ",", "ex", ")", ";", "}", "// The URL is coming from a JAR file. The format of that is supposed to be", "// jar:<url>!/<packagepath>. Normally the first part of the <url> section will be", "// 'file:', but could be different if somehow the JAR is loaded from the network.", "// We can only handle the 'file' case, so will check.", "int", "packageSeparatorIndex", "=", "urlStr", ".", "indexOf", "(", "\"!/\"", ")", ";", "if", "(", "packageSeparatorIndex", ">", "0", ")", "{", "urlStr", "=", "urlStr", ".", "substring", "(", "0", ",", "urlStr", ".", "indexOf", "(", "\"!/\"", ")", ")", ";", "urlStr", "=", "urlStr", ".", "substring", "(", "4", ")", ";", "// remove the 'jar:' part.", "}", "if", "(", "!", "urlStr", ".", "startsWith", "(", "\"file:\"", ")", ")", "{", "throw", "new", "RuntimeException", "(", "\"The Gateway class was not loaded from a file, so we \"", "+", "\"cannot determine the location of GATEWAY_HOME\"", ")", ";", "}", "urlStr", "=", "urlStr", ".", "substring", "(", "5", ")", ";", "// remove the 'file:' stuff.", "File", "jarFile", "=", "new", "File", "(", "urlStr", ")", ";", "gatewayHome", "=", "jarFile", ".", "getParentFile", "(", ")", ".", "getParent", "(", ")", ";", "properties", ".", "setProperty", "(", "\"GATEWAY_HOME\"", ",", "gatewayHome", ")", ";", "}", "gateway", ".", "setProperties", "(", "properties", ")", ";", "}" ]
Bootstrap the Gateway instance with a GATEWAY_HOME if not already set in System properties.
[ "Bootstrap", "the", "Gateway", "instance", "with", "a", "GATEWAY_HOME", "if", "not", "already", "set", "in", "System", "properties", "." ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/server/src/main/java/org/kaazing/gateway/server/impl/GatewayCreatorImpl.java#L38-L77
katharsis-project/katharsis-framework
katharsis-core/src/main/java/io/katharsis/core/internal/utils/PropertyUtils.java
PropertyUtils.getPropertyClass
public static Class<?> getPropertyClass(Class<?> beanClass, String field) { """ Similar to {@link PropertyUtils#getPropertyClass(Class,List)} but returns the property class. @param beanClass bean to be accessed @param field bean's fieldName @return bean's property class """ try { return INSTANCE.findPropertyClass(beanClass, field); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(beanClass, field, e); } }
java
public static Class<?> getPropertyClass(Class<?> beanClass, String field) { try { return INSTANCE.findPropertyClass(beanClass, field); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(beanClass, field, e); } }
[ "public", "static", "Class", "<", "?", ">", "getPropertyClass", "(", "Class", "<", "?", ">", "beanClass", ",", "String", "field", ")", "{", "try", "{", "return", "INSTANCE", ".", "findPropertyClass", "(", "beanClass", ",", "field", ")", ";", "}", "catch", "(", "NoSuchMethodException", "|", "IllegalAccessException", "|", "InvocationTargetException", "e", ")", "{", "throw", "handleReflectionException", "(", "beanClass", ",", "field", ",", "e", ")", ";", "}", "}" ]
Similar to {@link PropertyUtils#getPropertyClass(Class,List)} but returns the property class. @param beanClass bean to be accessed @param field bean's fieldName @return bean's property class
[ "Similar", "to", "{", "@link", "PropertyUtils#getPropertyClass", "(", "Class", "List", ")", "}", "but", "returns", "the", "property", "class", "." ]
train
https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-core/src/main/java/io/katharsis/core/internal/utils/PropertyUtils.java#L63-L69
trellis-ldp-archive/trellis-http
src/main/java/org/trellisldp/http/impl/BaseLdpHandler.java
BaseLdpHandler.checkDeleted
protected static void checkDeleted(final Resource res, final String identifier) { """ Check if this is a deleted resource, and if so return an appropriate response @param res the resource @param identifier the identifier @throws WebApplicationException a 410 Gone exception """ if (RdfUtils.isDeleted(res)) { throw new WebApplicationException(status(GONE) .links(MementoResource.getMementoLinks(identifier, res.getMementos()) .toArray(Link[]::new)).build()); } }
java
protected static void checkDeleted(final Resource res, final String identifier) { if (RdfUtils.isDeleted(res)) { throw new WebApplicationException(status(GONE) .links(MementoResource.getMementoLinks(identifier, res.getMementos()) .toArray(Link[]::new)).build()); } }
[ "protected", "static", "void", "checkDeleted", "(", "final", "Resource", "res", ",", "final", "String", "identifier", ")", "{", "if", "(", "RdfUtils", ".", "isDeleted", "(", "res", ")", ")", "{", "throw", "new", "WebApplicationException", "(", "status", "(", "GONE", ")", ".", "links", "(", "MementoResource", ".", "getMementoLinks", "(", "identifier", ",", "res", ".", "getMementos", "(", ")", ")", ".", "toArray", "(", "Link", "[", "]", "::", "new", ")", ")", ".", "build", "(", ")", ")", ";", "}", "}" ]
Check if this is a deleted resource, and if so return an appropriate response @param res the resource @param identifier the identifier @throws WebApplicationException a 410 Gone exception
[ "Check", "if", "this", "is", "a", "deleted", "resource", "and", "if", "so", "return", "an", "appropriate", "response" ]
train
https://github.com/trellis-ldp-archive/trellis-http/blob/bc762f88602c49c2b137a7adf68d576666e55fff/src/main/java/org/trellisldp/http/impl/BaseLdpHandler.java#L89-L95
meltmedia/cadmium
core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java
WarUtils.removeNodesByTagName
public static void removeNodesByTagName(Element doc, String tagname) { """ Removes elements by a specified tag name from the xml Element passed in. @param doc The xml Element to remove from. @param tagname The tag name to remove. """ NodeList nodes = doc.getElementsByTagName(tagname); for (int i = 0; i < nodes.getLength(); i++) { Node n = nodes.item(i); doc.removeChild(n); } }
java
public static void removeNodesByTagName(Element doc, String tagname) { NodeList nodes = doc.getElementsByTagName(tagname); for (int i = 0; i < nodes.getLength(); i++) { Node n = nodes.item(i); doc.removeChild(n); } }
[ "public", "static", "void", "removeNodesByTagName", "(", "Element", "doc", ",", "String", "tagname", ")", "{", "NodeList", "nodes", "=", "doc", ".", "getElementsByTagName", "(", "tagname", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nodes", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Node", "n", "=", "nodes", ".", "item", "(", "i", ")", ";", "doc", ".", "removeChild", "(", "n", ")", ";", "}", "}" ]
Removes elements by a specified tag name from the xml Element passed in. @param doc The xml Element to remove from. @param tagname The tag name to remove.
[ "Removes", "elements", "by", "a", "specified", "tag", "name", "from", "the", "xml", "Element", "passed", "in", "." ]
train
https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java#L436-L442
codeprimate-software/cp-elements
src/main/java/org/cp/elements/data/conversion/converters/IdentifiableConverter.java
IdentifiableConverter.canConvert
@Override public boolean canConvert(Class<?> fromType, Class<?> toType) { """ Determines whether this {@link Converter} can convert {@link Object Objects} {@link Class from type} {@link Class to type}. @param fromType {@link Class type} to convert from. @param toType {@link Class type} to convert to. @return a boolean indicating whether this {@link Converter} can convert {@link Object Objects} {@link Class from type} {@link Class to type}. @see org.cp.elements.data.conversion.ConversionService#canConvert(Class, Class) @see #canConvert(Object, Class) """ return Long.class.equals(fromType) && toType != null && Identifiable.class.isAssignableFrom(toType); }
java
@Override public boolean canConvert(Class<?> fromType, Class<?> toType) { return Long.class.equals(fromType) && toType != null && Identifiable.class.isAssignableFrom(toType); }
[ "@", "Override", "public", "boolean", "canConvert", "(", "Class", "<", "?", ">", "fromType", ",", "Class", "<", "?", ">", "toType", ")", "{", "return", "Long", ".", "class", ".", "equals", "(", "fromType", ")", "&&", "toType", "!=", "null", "&&", "Identifiable", ".", "class", ".", "isAssignableFrom", "(", "toType", ")", ";", "}" ]
Determines whether this {@link Converter} can convert {@link Object Objects} {@link Class from type} {@link Class to type}. @param fromType {@link Class type} to convert from. @param toType {@link Class type} to convert to. @return a boolean indicating whether this {@link Converter} can convert {@link Object Objects} {@link Class from type} {@link Class to type}. @see org.cp.elements.data.conversion.ConversionService#canConvert(Class, Class) @see #canConvert(Object, Class)
[ "Determines", "whether", "this", "{", "@link", "Converter", "}", "can", "convert", "{", "@link", "Object", "Objects", "}", "{", "@link", "Class", "from", "type", "}", "{", "@link", "Class", "to", "type", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/data/conversion/converters/IdentifiableConverter.java#L81-L84
aol/cyclops
cyclops/src/main/java/com/oath/cyclops/util/box/MutableBoolean.java
MutableBoolean.fromExternal
public static MutableBoolean fromExternal(final BooleanSupplier s, final Consumer<Boolean> c) { """ Construct a MutableBoolean that gets and sets an external value using the provided Supplier and Consumer e.g. <pre> {@code MutableBoolean mutable = MutableBoolean.fromExternal(()->!this.value,val->!this.value); } </pre> @param s Supplier of an external value @param c Consumer that sets an external value @return MutableBoolean that gets / sets an external (mutable) value """ return new MutableBoolean() { @Override public boolean getAsBoolean() { return s.getAsBoolean(); } @Override public Boolean get() { return getAsBoolean(); } @Override public MutableBoolean set(final boolean value) { c.accept(value); return this; } }; }
java
public static MutableBoolean fromExternal(final BooleanSupplier s, final Consumer<Boolean> c) { return new MutableBoolean() { @Override public boolean getAsBoolean() { return s.getAsBoolean(); } @Override public Boolean get() { return getAsBoolean(); } @Override public MutableBoolean set(final boolean value) { c.accept(value); return this; } }; }
[ "public", "static", "MutableBoolean", "fromExternal", "(", "final", "BooleanSupplier", "s", ",", "final", "Consumer", "<", "Boolean", ">", "c", ")", "{", "return", "new", "MutableBoolean", "(", ")", "{", "@", "Override", "public", "boolean", "getAsBoolean", "(", ")", "{", "return", "s", ".", "getAsBoolean", "(", ")", ";", "}", "@", "Override", "public", "Boolean", "get", "(", ")", "{", "return", "getAsBoolean", "(", ")", ";", "}", "@", "Override", "public", "MutableBoolean", "set", "(", "final", "boolean", "value", ")", "{", "c", ".", "accept", "(", "value", ")", ";", "return", "this", ";", "}", "}", ";", "}" ]
Construct a MutableBoolean that gets and sets an external value using the provided Supplier and Consumer e.g. <pre> {@code MutableBoolean mutable = MutableBoolean.fromExternal(()->!this.value,val->!this.value); } </pre> @param s Supplier of an external value @param c Consumer that sets an external value @return MutableBoolean that gets / sets an external (mutable) value
[ "Construct", "a", "MutableBoolean", "that", "gets", "and", "sets", "an", "external", "value", "using", "the", "provided", "Supplier", "and", "Consumer" ]
train
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/util/box/MutableBoolean.java#L82-L100
molgenis/molgenis
molgenis-data-import/src/main/java/org/molgenis/data/importer/ImportRunService.java
ImportRunService.createEnglishMailText
@SuppressWarnings("squid:S3457") // do not use platform specific line ending String createEnglishMailText(ImportRun importRun, ZoneId zone) { """ Creates an English mail message describing a finished {@link ImportRun}. Formats the run's start and end times using {@link ZoneId#systemDefault()}. @param importRun the ImportRun to describe, it should have non-null start and end dates. @return String containing the mail message. """ ZonedDateTime start = importRun.getStartDate().atZone(zone); ZonedDateTime end = importRun .getEndDate() .orElseThrow(() -> new IllegalStateException("ImportRun must have an end date")) .atZone(zone); String startDateTimeString = ofLocalizedDateTime(FULL).withLocale(ENGLISH).format(start); String endTimeString = ofLocalizedTime(MEDIUM).withLocale(ENGLISH).format(end); return String.format( "The import started by you on %1s finished on %2s with status: %3s\nMessage:\n%4s", startDateTimeString, endTimeString, importRun.getStatus(), importRun.getMessage()); }
java
@SuppressWarnings("squid:S3457") // do not use platform specific line ending String createEnglishMailText(ImportRun importRun, ZoneId zone) { ZonedDateTime start = importRun.getStartDate().atZone(zone); ZonedDateTime end = importRun .getEndDate() .orElseThrow(() -> new IllegalStateException("ImportRun must have an end date")) .atZone(zone); String startDateTimeString = ofLocalizedDateTime(FULL).withLocale(ENGLISH).format(start); String endTimeString = ofLocalizedTime(MEDIUM).withLocale(ENGLISH).format(end); return String.format( "The import started by you on %1s finished on %2s with status: %3s\nMessage:\n%4s", startDateTimeString, endTimeString, importRun.getStatus(), importRun.getMessage()); }
[ "@", "SuppressWarnings", "(", "\"squid:S3457\"", ")", "// do not use platform specific line ending", "String", "createEnglishMailText", "(", "ImportRun", "importRun", ",", "ZoneId", "zone", ")", "{", "ZonedDateTime", "start", "=", "importRun", ".", "getStartDate", "(", ")", ".", "atZone", "(", "zone", ")", ";", "ZonedDateTime", "end", "=", "importRun", ".", "getEndDate", "(", ")", ".", "orElseThrow", "(", "(", ")", "->", "new", "IllegalStateException", "(", "\"ImportRun must have an end date\"", ")", ")", ".", "atZone", "(", "zone", ")", ";", "String", "startDateTimeString", "=", "ofLocalizedDateTime", "(", "FULL", ")", ".", "withLocale", "(", "ENGLISH", ")", ".", "format", "(", "start", ")", ";", "String", "endTimeString", "=", "ofLocalizedTime", "(", "MEDIUM", ")", ".", "withLocale", "(", "ENGLISH", ")", ".", "format", "(", "end", ")", ";", "return", "String", ".", "format", "(", "\"The import started by you on %1s finished on %2s with status: %3s\\nMessage:\\n%4s\"", ",", "startDateTimeString", ",", "endTimeString", ",", "importRun", ".", "getStatus", "(", ")", ",", "importRun", ".", "getMessage", "(", ")", ")", ";", "}" ]
Creates an English mail message describing a finished {@link ImportRun}. Formats the run's start and end times using {@link ZoneId#systemDefault()}. @param importRun the ImportRun to describe, it should have non-null start and end dates. @return String containing the mail message.
[ "Creates", "an", "English", "mail", "message", "describing", "a", "finished", "{", "@link", "ImportRun", "}", ".", "Formats", "the", "run", "s", "start", "and", "end", "times", "using", "{", "@link", "ZoneId#systemDefault", "()", "}", "." ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-import/src/main/java/org/molgenis/data/importer/ImportRunService.java#L109-L124
pressgang-ccms/PressGangCCMSQuery
src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java
BaseFilterQueryBuilder.addLikeIgnoresCaseCondition
protected void addLikeIgnoresCaseCondition(final String propertyName, final String value) { """ Add a Field Search Condition that will search a field for a specified value using the following SQL logic: {@code LOWER(field) LIKE LOWER('%value%')} @param propertyName The name of the field as defined in the Entity mapping class. @param value The value to search against. """ final Expression<String> propertyNameField = getCriteriaBuilder().lower(getRootPath().get(propertyName).as(String.class)); fieldConditions.add(getCriteriaBuilder().like(propertyNameField, "%" + cleanLikeCondition(value).toLowerCase() + "%")); }
java
protected void addLikeIgnoresCaseCondition(final String propertyName, final String value) { final Expression<String> propertyNameField = getCriteriaBuilder().lower(getRootPath().get(propertyName).as(String.class)); fieldConditions.add(getCriteriaBuilder().like(propertyNameField, "%" + cleanLikeCondition(value).toLowerCase() + "%")); }
[ "protected", "void", "addLikeIgnoresCaseCondition", "(", "final", "String", "propertyName", ",", "final", "String", "value", ")", "{", "final", "Expression", "<", "String", ">", "propertyNameField", "=", "getCriteriaBuilder", "(", ")", ".", "lower", "(", "getRootPath", "(", ")", ".", "get", "(", "propertyName", ")", ".", "as", "(", "String", ".", "class", ")", ")", ";", "fieldConditions", ".", "add", "(", "getCriteriaBuilder", "(", ")", ".", "like", "(", "propertyNameField", ",", "\"%\"", "+", "cleanLikeCondition", "(", "value", ")", ".", "toLowerCase", "(", ")", "+", "\"%\"", ")", ")", ";", "}" ]
Add a Field Search Condition that will search a field for a specified value using the following SQL logic: {@code LOWER(field) LIKE LOWER('%value%')} @param propertyName The name of the field as defined in the Entity mapping class. @param value The value to search against.
[ "Add", "a", "Field", "Search", "Condition", "that", "will", "search", "a", "field", "for", "a", "specified", "value", "using", "the", "following", "SQL", "logic", ":", "{", "@code", "LOWER", "(", "field", ")", "LIKE", "LOWER", "(", "%value%", ")", "}" ]
train
https://github.com/pressgang-ccms/PressGangCCMSQuery/blob/2bb23430adab956737d0301cd2ea933f986dd85b/src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java#L223-L226
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
FSNamesystem.getBlockLocations
public LocatedBlocks getBlockLocations(String src, long offset, long length) throws IOException { """ Get block locations within the specified range. @see ClientProtocol#getBlockLocations(String, long, long) """ INode[] inodes = dir.getExistingPathINodes(src); return getBlockLocations(src, inodes[inodes.length-1], offset, length, false, BlockMetaInfoType.NONE); }
java
public LocatedBlocks getBlockLocations(String src, long offset, long length) throws IOException { INode[] inodes = dir.getExistingPathINodes(src); return getBlockLocations(src, inodes[inodes.length-1], offset, length, false, BlockMetaInfoType.NONE); }
[ "public", "LocatedBlocks", "getBlockLocations", "(", "String", "src", ",", "long", "offset", ",", "long", "length", ")", "throws", "IOException", "{", "INode", "[", "]", "inodes", "=", "dir", ".", "getExistingPathINodes", "(", "src", ")", ";", "return", "getBlockLocations", "(", "src", ",", "inodes", "[", "inodes", ".", "length", "-", "1", "]", ",", "offset", ",", "length", ",", "false", ",", "BlockMetaInfoType", ".", "NONE", ")", ";", "}" ]
Get block locations within the specified range. @see ClientProtocol#getBlockLocations(String, long, long)
[ "Get", "block", "locations", "within", "the", "specified", "range", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L1396-L1400
Netflix/zeno
src/main/java/com/netflix/zeno/diff/history/DiffHistoryTracker.java
DiffHistoryTracker.addState
public void addState() { """ Call this method after new data has been loaded by the FastBlobStateEngine. This will add a historical record of the differences between the previous state and this new state. """ DiffHistoryDataState nextState = new DiffHistoryDataState(stateEngine, typeDiffInstructions); if(currentDataState != null) newHistoricalState(currentDataState, nextState); currentDataState = nextState; }
java
public void addState() { DiffHistoryDataState nextState = new DiffHistoryDataState(stateEngine, typeDiffInstructions); if(currentDataState != null) newHistoricalState(currentDataState, nextState); currentDataState = nextState; }
[ "public", "void", "addState", "(", ")", "{", "DiffHistoryDataState", "nextState", "=", "new", "DiffHistoryDataState", "(", "stateEngine", ",", "typeDiffInstructions", ")", ";", "if", "(", "currentDataState", "!=", "null", ")", "newHistoricalState", "(", "currentDataState", ",", "nextState", ")", ";", "currentDataState", "=", "nextState", ";", "}" ]
Call this method after new data has been loaded by the FastBlobStateEngine. This will add a historical record of the differences between the previous state and this new state.
[ "Call", "this", "method", "after", "new", "data", "has", "been", "loaded", "by", "the", "FastBlobStateEngine", ".", "This", "will", "add", "a", "historical", "record", "of", "the", "differences", "between", "the", "previous", "state", "and", "this", "new", "state", "." ]
train
https://github.com/Netflix/zeno/blob/e571a3f1e304942724d454408fe6417fe18c20fd/src/main/java/com/netflix/zeno/diff/history/DiffHistoryTracker.java#L76-L83
jclawson/dropwizardry
dropwizardry-config-hocon/src/main/java/io/dropwizard/configuration/HoconConfigurationFactory.java
HoconConfigurationFactory.build
public T build(ConfigurationSourceProvider provider, String path) throws IOException, ConfigurationException { """ Loads, parses, binds, and validates a configuration object. @param provider the provider to to use for reading configuration files @param path the path of the configuration file @return a validated configuration object @throws IOException if there is an error reading the file @throws ConfigurationException if there is an error parsing or validating the file """ try (InputStream input = provider.open(checkNotNull(path))) { final JsonNode node = mapper.readTree(hoconFactory.createParser(input)); return build(node, path); } catch (ConfigException e) { ConfigurationParsingException.Builder builder = ConfigurationParsingException .builder("Malformed HOCON") .setCause(e) .setDetail(e.getMessage()); ConfigOrigin origin = e.origin(); if (origin != null) { builder.setLocation(origin.lineNumber(), 0); } throw builder.build(path); } }
java
public T build(ConfigurationSourceProvider provider, String path) throws IOException, ConfigurationException { try (InputStream input = provider.open(checkNotNull(path))) { final JsonNode node = mapper.readTree(hoconFactory.createParser(input)); return build(node, path); } catch (ConfigException e) { ConfigurationParsingException.Builder builder = ConfigurationParsingException .builder("Malformed HOCON") .setCause(e) .setDetail(e.getMessage()); ConfigOrigin origin = e.origin(); if (origin != null) { builder.setLocation(origin.lineNumber(), 0); } throw builder.build(path); } }
[ "public", "T", "build", "(", "ConfigurationSourceProvider", "provider", ",", "String", "path", ")", "throws", "IOException", ",", "ConfigurationException", "{", "try", "(", "InputStream", "input", "=", "provider", ".", "open", "(", "checkNotNull", "(", "path", ")", ")", ")", "{", "final", "JsonNode", "node", "=", "mapper", ".", "readTree", "(", "hoconFactory", ".", "createParser", "(", "input", ")", ")", ";", "return", "build", "(", "node", ",", "path", ")", ";", "}", "catch", "(", "ConfigException", "e", ")", "{", "ConfigurationParsingException", ".", "Builder", "builder", "=", "ConfigurationParsingException", ".", "builder", "(", "\"Malformed HOCON\"", ")", ".", "setCause", "(", "e", ")", ".", "setDetail", "(", "e", ".", "getMessage", "(", ")", ")", ";", "ConfigOrigin", "origin", "=", "e", ".", "origin", "(", ")", ";", "if", "(", "origin", "!=", "null", ")", "{", "builder", ".", "setLocation", "(", "origin", ".", "lineNumber", "(", ")", ",", "0", ")", ";", "}", "throw", "builder", ".", "build", "(", "path", ")", ";", "}", "}" ]
Loads, parses, binds, and validates a configuration object. @param provider the provider to to use for reading configuration files @param path the path of the configuration file @return a validated configuration object @throws IOException if there is an error reading the file @throws ConfigurationException if there is an error parsing or validating the file
[ "Loads", "parses", "binds", "and", "validates", "a", "configuration", "object", "." ]
train
https://github.com/jclawson/dropwizardry/blob/3dd95da764ddd63d8959792942ce29becf43f80b/dropwizardry-config-hocon/src/main/java/io/dropwizard/configuration/HoconConfigurationFactory.java#L81-L97
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.insertCuePoint
public InsertCuePointResponse insertCuePoint(String sessionId, String callback, Map<String, String> arguments) { """ Insert a cue point into your live session by live session id. @param sessionId Live session id. @param callback Call back method name. @param arguments Call back method arguments. @return the response """ InsertCuePointRequest request = new InsertCuePointRequest() .withSessionId(sessionId).withCallback(callback).withArguments(arguments); return insertCuePoint(request); }
java
public InsertCuePointResponse insertCuePoint(String sessionId, String callback, Map<String, String> arguments) { InsertCuePointRequest request = new InsertCuePointRequest() .withSessionId(sessionId).withCallback(callback).withArguments(arguments); return insertCuePoint(request); }
[ "public", "InsertCuePointResponse", "insertCuePoint", "(", "String", "sessionId", ",", "String", "callback", ",", "Map", "<", "String", ",", "String", ">", "arguments", ")", "{", "InsertCuePointRequest", "request", "=", "new", "InsertCuePointRequest", "(", ")", ".", "withSessionId", "(", "sessionId", ")", ".", "withCallback", "(", "callback", ")", ".", "withArguments", "(", "arguments", ")", ";", "return", "insertCuePoint", "(", "request", ")", ";", "}" ]
Insert a cue point into your live session by live session id. @param sessionId Live session id. @param callback Call back method name. @param arguments Call back method arguments. @return the response
[ "Insert", "a", "cue", "point", "into", "your", "live", "session", "by", "live", "session", "id", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1092-L1096
buschmais/jqa-core-framework
plugin/src/main/java/com/buschmais/jqassistant/core/plugin/impl/AbstractPluginRepository.java
AbstractPluginRepository.getType
protected <T> Class<T> getType(String typeName) throws PluginRepositoryException { """ Get the class for the given type name. @param typeName The type name. @param <T> The type name. @return The class. @throws PluginRepositoryException If the type could not be loaded. """ try { return (Class<T>) classLoader.loadClass(typeName.trim()); } catch (ClassNotFoundException | LinkageError e) { // Catching class loader related errors for logging a message which plugin class // actually caused the problem. throw new PluginRepositoryException("Cannot find or load class " + typeName, e); } }
java
protected <T> Class<T> getType(String typeName) throws PluginRepositoryException { try { return (Class<T>) classLoader.loadClass(typeName.trim()); } catch (ClassNotFoundException | LinkageError e) { // Catching class loader related errors for logging a message which plugin class // actually caused the problem. throw new PluginRepositoryException("Cannot find or load class " + typeName, e); } }
[ "protected", "<", "T", ">", "Class", "<", "T", ">", "getType", "(", "String", "typeName", ")", "throws", "PluginRepositoryException", "{", "try", "{", "return", "(", "Class", "<", "T", ">", ")", "classLoader", ".", "loadClass", "(", "typeName", ".", "trim", "(", ")", ")", ";", "}", "catch", "(", "ClassNotFoundException", "|", "LinkageError", "e", ")", "{", "// Catching class loader related errors for logging a message which plugin class", "// actually caused the problem.", "throw", "new", "PluginRepositoryException", "(", "\"Cannot find or load class \"", "+", "typeName", ",", "e", ")", ";", "}", "}" ]
Get the class for the given type name. @param typeName The type name. @param <T> The type name. @return The class. @throws PluginRepositoryException If the type could not be loaded.
[ "Get", "the", "class", "for", "the", "given", "type", "name", "." ]
train
https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/plugin/src/main/java/com/buschmais/jqassistant/core/plugin/impl/AbstractPluginRepository.java#L51-L59
apache/flink
flink-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java
ParameterTool.createPropertiesFile
public void createPropertiesFile(String pathToFile, boolean overwrite) throws IOException { """ Create a properties file with all the known parameters (call after the last get*() call). Set the default value, if overwrite is true. @param pathToFile Location of the default properties file. @param overwrite Boolean flag indicating whether or not to overwrite the file @throws IOException If overwrite is not allowed and the file exists """ final File file = new File(pathToFile); if (file.exists()) { if (overwrite) { file.delete(); } else { throw new RuntimeException("File " + pathToFile + " exists and overwriting is not allowed"); } } final Properties defaultProps = new Properties(); defaultProps.putAll(this.defaultData); try (final OutputStream out = new FileOutputStream(file)) { defaultProps.store(out, "Default file created by Flink's ParameterUtil.createPropertiesFile()"); } }
java
public void createPropertiesFile(String pathToFile, boolean overwrite) throws IOException { final File file = new File(pathToFile); if (file.exists()) { if (overwrite) { file.delete(); } else { throw new RuntimeException("File " + pathToFile + " exists and overwriting is not allowed"); } } final Properties defaultProps = new Properties(); defaultProps.putAll(this.defaultData); try (final OutputStream out = new FileOutputStream(file)) { defaultProps.store(out, "Default file created by Flink's ParameterUtil.createPropertiesFile()"); } }
[ "public", "void", "createPropertiesFile", "(", "String", "pathToFile", ",", "boolean", "overwrite", ")", "throws", "IOException", "{", "final", "File", "file", "=", "new", "File", "(", "pathToFile", ")", ";", "if", "(", "file", ".", "exists", "(", ")", ")", "{", "if", "(", "overwrite", ")", "{", "file", ".", "delete", "(", ")", ";", "}", "else", "{", "throw", "new", "RuntimeException", "(", "\"File \"", "+", "pathToFile", "+", "\" exists and overwriting is not allowed\"", ")", ";", "}", "}", "final", "Properties", "defaultProps", "=", "new", "Properties", "(", ")", ";", "defaultProps", ".", "putAll", "(", "this", ".", "defaultData", ")", ";", "try", "(", "final", "OutputStream", "out", "=", "new", "FileOutputStream", "(", "file", ")", ")", "{", "defaultProps", ".", "store", "(", "out", ",", "\"Default file created by Flink's ParameterUtil.createPropertiesFile()\"", ")", ";", "}", "}" ]
Create a properties file with all the known parameters (call after the last get*() call). Set the default value, if overwrite is true. @param pathToFile Location of the default properties file. @param overwrite Boolean flag indicating whether or not to overwrite the file @throws IOException If overwrite is not allowed and the file exists
[ "Create", "a", "properties", "file", "with", "all", "the", "known", "parameters", "(", "call", "after", "the", "last", "get", "*", "()", "call", ")", ".", "Set", "the", "default", "value", "if", "overwrite", "is", "true", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java#L523-L537
nguyenq/tess4j
src/main/java/net/sourceforge/tess4j/util/ImageHelper.java
ImageHelper.rotateImage
public static BufferedImage rotateImage(BufferedImage image, double angle) { """ Rotates an image. @param image the original image @param angle the degree of rotation @return a rotated image """ double theta = Math.toRadians(angle); double sin = Math.abs(Math.sin(theta)); double cos = Math.abs(Math.cos(theta)); int w = image.getWidth(); int h = image.getHeight(); int newW = (int) Math.floor(w * cos + h * sin); int newH = (int) Math.floor(h * cos + w * sin); BufferedImage tmp = new BufferedImage(newW, newH, image.getType()); Graphics2D g2d = tmp.createGraphics(); g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); g2d.translate((newW - w) / 2, (newH - h) / 2); g2d.rotate(theta, w / 2, h / 2); g2d.drawImage(image, 0, 0, null); g2d.dispose(); return tmp; }
java
public static BufferedImage rotateImage(BufferedImage image, double angle) { double theta = Math.toRadians(angle); double sin = Math.abs(Math.sin(theta)); double cos = Math.abs(Math.cos(theta)); int w = image.getWidth(); int h = image.getHeight(); int newW = (int) Math.floor(w * cos + h * sin); int newH = (int) Math.floor(h * cos + w * sin); BufferedImage tmp = new BufferedImage(newW, newH, image.getType()); Graphics2D g2d = tmp.createGraphics(); g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); g2d.translate((newW - w) / 2, (newH - h) / 2); g2d.rotate(theta, w / 2, h / 2); g2d.drawImage(image, 0, 0, null); g2d.dispose(); return tmp; }
[ "public", "static", "BufferedImage", "rotateImage", "(", "BufferedImage", "image", ",", "double", "angle", ")", "{", "double", "theta", "=", "Math", ".", "toRadians", "(", "angle", ")", ";", "double", "sin", "=", "Math", ".", "abs", "(", "Math", ".", "sin", "(", "theta", ")", ")", ";", "double", "cos", "=", "Math", ".", "abs", "(", "Math", ".", "cos", "(", "theta", ")", ")", ";", "int", "w", "=", "image", ".", "getWidth", "(", ")", ";", "int", "h", "=", "image", ".", "getHeight", "(", ")", ";", "int", "newW", "=", "(", "int", ")", "Math", ".", "floor", "(", "w", "*", "cos", "+", "h", "*", "sin", ")", ";", "int", "newH", "=", "(", "int", ")", "Math", ".", "floor", "(", "h", "*", "cos", "+", "w", "*", "sin", ")", ";", "BufferedImage", "tmp", "=", "new", "BufferedImage", "(", "newW", ",", "newH", ",", "image", ".", "getType", "(", ")", ")", ";", "Graphics2D", "g2d", "=", "tmp", ".", "createGraphics", "(", ")", ";", "g2d", ".", "setRenderingHint", "(", "RenderingHints", ".", "KEY_INTERPOLATION", ",", "RenderingHints", ".", "VALUE_INTERPOLATION_BICUBIC", ")", ";", "g2d", ".", "translate", "(", "(", "newW", "-", "w", ")", "/", "2", ",", "(", "newH", "-", "h", ")", "/", "2", ")", ";", "g2d", ".", "rotate", "(", "theta", ",", "w", "/", "2", ",", "h", "/", "2", ")", ";", "g2d", ".", "drawImage", "(", "image", ",", "0", ",", "0", ",", "null", ")", ";", "g2d", ".", "dispose", "(", ")", ";", "return", "tmp", ";", "}" ]
Rotates an image. @param image the original image @param angle the degree of rotation @return a rotated image
[ "Rotates", "an", "image", "." ]
train
https://github.com/nguyenq/tess4j/blob/cfcd4a8a44042f150b4aaf7bdf5ffc485a2236e1/src/main/java/net/sourceforge/tess4j/util/ImageHelper.java#L164-L182
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/InitDateOffsetHandler.java
InitDateOffsetHandler.syncClonedListener
public boolean syncClonedListener(BaseField field, FieldListener listener, boolean bInitCalled) { """ Set this cloned listener to the same state at this listener. @param field The field this new listener will be added to. @param The new listener to sync to this. @param Has the init method been called? @return True if I called init. """ if (!bInitCalled) { BaseField fldSource = this.getSyncedListenersField(m_fldSource, listener); DateTimeField fldStartDate = (DateTimeField)this.getSyncedListenersField(m_fldStartDate, listener); ((InitDateOffsetHandler)listener).init(null, fldSource, fldStartDate, m_lYears, m_lMonths, m_lDays, m_bCalcIfNull); } return super.syncClonedListener(field, listener, true); }
java
public boolean syncClonedListener(BaseField field, FieldListener listener, boolean bInitCalled) { if (!bInitCalled) { BaseField fldSource = this.getSyncedListenersField(m_fldSource, listener); DateTimeField fldStartDate = (DateTimeField)this.getSyncedListenersField(m_fldStartDate, listener); ((InitDateOffsetHandler)listener).init(null, fldSource, fldStartDate, m_lYears, m_lMonths, m_lDays, m_bCalcIfNull); } return super.syncClonedListener(field, listener, true); }
[ "public", "boolean", "syncClonedListener", "(", "BaseField", "field", ",", "FieldListener", "listener", ",", "boolean", "bInitCalled", ")", "{", "if", "(", "!", "bInitCalled", ")", "{", "BaseField", "fldSource", "=", "this", ".", "getSyncedListenersField", "(", "m_fldSource", ",", "listener", ")", ";", "DateTimeField", "fldStartDate", "=", "(", "DateTimeField", ")", "this", ".", "getSyncedListenersField", "(", "m_fldStartDate", ",", "listener", ")", ";", "(", "(", "InitDateOffsetHandler", ")", "listener", ")", ".", "init", "(", "null", ",", "fldSource", ",", "fldStartDate", ",", "m_lYears", ",", "m_lMonths", ",", "m_lDays", ",", "m_bCalcIfNull", ")", ";", "}", "return", "super", ".", "syncClonedListener", "(", "field", ",", "listener", ",", "true", ")", ";", "}" ]
Set this cloned listener to the same state at this listener. @param field The field this new listener will be added to. @param The new listener to sync to this. @param Has the init method been called? @return True if I called init.
[ "Set", "this", "cloned", "listener", "to", "the", "same", "state", "at", "this", "listener", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/InitDateOffsetHandler.java#L104-L113
lucee/Lucee
core/src/main/java/lucee/runtime/reflection/Reflector.java
Reflector.callConstructor
public static Object callConstructor(Class clazz, Object[] args) throws PageException { """ call constructor of a class with matching arguments @param clazz Class to get Instance @param args Arguments for the Class @return invoked Instance @throws PageException """ args = cleanArgs(args); try { return getConstructorInstance(clazz, args).invoke(); } catch (InvocationTargetException e) { Throwable target = e.getTargetException(); if (target instanceof PageException) throw (PageException) target; throw Caster.toPageException(e.getTargetException()); } catch (Exception e) { throw Caster.toPageException(e); } }
java
public static Object callConstructor(Class clazz, Object[] args) throws PageException { args = cleanArgs(args); try { return getConstructorInstance(clazz, args).invoke(); } catch (InvocationTargetException e) { Throwable target = e.getTargetException(); if (target instanceof PageException) throw (PageException) target; throw Caster.toPageException(e.getTargetException()); } catch (Exception e) { throw Caster.toPageException(e); } }
[ "public", "static", "Object", "callConstructor", "(", "Class", "clazz", ",", "Object", "[", "]", "args", ")", "throws", "PageException", "{", "args", "=", "cleanArgs", "(", "args", ")", ";", "try", "{", "return", "getConstructorInstance", "(", "clazz", ",", "args", ")", ".", "invoke", "(", ")", ";", "}", "catch", "(", "InvocationTargetException", "e", ")", "{", "Throwable", "target", "=", "e", ".", "getTargetException", "(", ")", ";", "if", "(", "target", "instanceof", "PageException", ")", "throw", "(", "PageException", ")", "target", ";", "throw", "Caster", ".", "toPageException", "(", "e", ".", "getTargetException", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "Caster", ".", "toPageException", "(", "e", ")", ";", "}", "}" ]
call constructor of a class with matching arguments @param clazz Class to get Instance @param args Arguments for the Class @return invoked Instance @throws PageException
[ "call", "constructor", "of", "a", "class", "with", "matching", "arguments" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Reflector.java#L803-L816
FINRAOS/DataGenerator
dg-core/src/main/java/org/finra/datagenerator/engine/scxml/tags/boundary/BoundaryDate.java
BoundaryDate.getNextDay
public String getNextDay(String dateString, boolean onlyBusinessDays) { """ Takes a date, and retrieves the next business day @param dateString the date @param onlyBusinessDays only business days @return a string containing the next business day """ DateTimeFormatter parser = ISODateTimeFormat.date(); DateTime date = parser.parseDateTime(dateString).plusDays(1); Calendar cal = Calendar.getInstance(); cal.setTime(date.toDate()); if (onlyBusinessDays) { if (cal.get(Calendar.DAY_OF_WEEK) == 1 || cal.get(Calendar.DAY_OF_WEEK) == 7 || isHoliday(date.toString().substring(0, 10))) { return getNextDay(date.toString().substring(0, 10), true); } else { return parser.print(date); } } else { return parser.print(date); } }
java
public String getNextDay(String dateString, boolean onlyBusinessDays) { DateTimeFormatter parser = ISODateTimeFormat.date(); DateTime date = parser.parseDateTime(dateString).plusDays(1); Calendar cal = Calendar.getInstance(); cal.setTime(date.toDate()); if (onlyBusinessDays) { if (cal.get(Calendar.DAY_OF_WEEK) == 1 || cal.get(Calendar.DAY_OF_WEEK) == 7 || isHoliday(date.toString().substring(0, 10))) { return getNextDay(date.toString().substring(0, 10), true); } else { return parser.print(date); } } else { return parser.print(date); } }
[ "public", "String", "getNextDay", "(", "String", "dateString", ",", "boolean", "onlyBusinessDays", ")", "{", "DateTimeFormatter", "parser", "=", "ISODateTimeFormat", ".", "date", "(", ")", ";", "DateTime", "date", "=", "parser", ".", "parseDateTime", "(", "dateString", ")", ".", "plusDays", "(", "1", ")", ";", "Calendar", "cal", "=", "Calendar", ".", "getInstance", "(", ")", ";", "cal", ".", "setTime", "(", "date", ".", "toDate", "(", ")", ")", ";", "if", "(", "onlyBusinessDays", ")", "{", "if", "(", "cal", ".", "get", "(", "Calendar", ".", "DAY_OF_WEEK", ")", "==", "1", "||", "cal", ".", "get", "(", "Calendar", ".", "DAY_OF_WEEK", ")", "==", "7", "||", "isHoliday", "(", "date", ".", "toString", "(", ")", ".", "substring", "(", "0", ",", "10", ")", ")", ")", "{", "return", "getNextDay", "(", "date", ".", "toString", "(", ")", ".", "substring", "(", "0", ",", "10", ")", ",", "true", ")", ";", "}", "else", "{", "return", "parser", ".", "print", "(", "date", ")", ";", "}", "}", "else", "{", "return", "parser", ".", "print", "(", "date", ")", ";", "}", "}" ]
Takes a date, and retrieves the next business day @param dateString the date @param onlyBusinessDays only business days @return a string containing the next business day
[ "Takes", "a", "date", "and", "retrieves", "the", "next", "business", "day" ]
train
https://github.com/FINRAOS/DataGenerator/blob/1f69f949401cbed4db4f553c3eb8350832c4d45a/dg-core/src/main/java/org/finra/datagenerator/engine/scxml/tags/boundary/BoundaryDate.java#L98-L114
dkpro/dkpro-statistics
dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/coding/CodingAnnotationStudy.java
CodingAnnotationStudy.addMultipleItems
public void addMultipleItems(int times, final Object... values) { """ Shorthand for invoking {@link #addItem(Object...)} with the same parameters multiple times. This method is useful for modeling annotation data based on a contingency table. """ for (int i = 0; i < times; i++) { addItemAsArray(values); } }
java
public void addMultipleItems(int times, final Object... values) { for (int i = 0; i < times; i++) { addItemAsArray(values); } }
[ "public", "void", "addMultipleItems", "(", "int", "times", ",", "final", "Object", "...", "values", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "times", ";", "i", "++", ")", "{", "addItemAsArray", "(", "values", ")", ";", "}", "}" ]
Shorthand for invoking {@link #addItem(Object...)} with the same parameters multiple times. This method is useful for modeling annotation data based on a contingency table.
[ "Shorthand", "for", "invoking", "{" ]
train
https://github.com/dkpro/dkpro-statistics/blob/0b0e93dc49223984964411cbc6df420ba796a8cb/dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/coding/CodingAnnotationStudy.java#L117-L121
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/MyStringUtils.java
MyStringUtils.regexFindFirst
public static String regexFindFirst(String pattern, String str) { """ Gets the first group of a regex @param pattern Pattern @param str String to find @return the matching group """ return regexFindFirst(Pattern.compile(pattern), str, 1); }
java
public static String regexFindFirst(String pattern, String str) { return regexFindFirst(Pattern.compile(pattern), str, 1); }
[ "public", "static", "String", "regexFindFirst", "(", "String", "pattern", ",", "String", "str", ")", "{", "return", "regexFindFirst", "(", "Pattern", ".", "compile", "(", "pattern", ")", ",", "str", ",", "1", ")", ";", "}" ]
Gets the first group of a regex @param pattern Pattern @param str String to find @return the matching group
[ "Gets", "the", "first", "group", "of", "a", "regex" ]
train
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyStringUtils.java#L490-L492
apache/flink
flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractionUtils.java
TypeExtractionUtils.extractTypeArgument
public static Type extractTypeArgument(Type t, int index) throws InvalidTypesException { """ This method extracts the n-th type argument from the given type. An InvalidTypesException is thrown if the type does not have any type arguments or if the index exceeds the number of type arguments. @param t Type to extract the type arguments from @param index Index of the type argument to extract @return The extracted type argument @throws InvalidTypesException if the given type does not have any type arguments or if the index exceeds the number of type arguments. """ if (t instanceof ParameterizedType) { Type[] actualTypeArguments = ((ParameterizedType) t).getActualTypeArguments(); if (index < 0 || index >= actualTypeArguments.length) { throw new InvalidTypesException("Cannot extract the type argument with index " + index + " because the type has only " + actualTypeArguments.length + " type arguments."); } else { return actualTypeArguments[index]; } } else { throw new InvalidTypesException("The given type " + t + " is not a parameterized type."); } }
java
public static Type extractTypeArgument(Type t, int index) throws InvalidTypesException { if (t instanceof ParameterizedType) { Type[] actualTypeArguments = ((ParameterizedType) t).getActualTypeArguments(); if (index < 0 || index >= actualTypeArguments.length) { throw new InvalidTypesException("Cannot extract the type argument with index " + index + " because the type has only " + actualTypeArguments.length + " type arguments."); } else { return actualTypeArguments[index]; } } else { throw new InvalidTypesException("The given type " + t + " is not a parameterized type."); } }
[ "public", "static", "Type", "extractTypeArgument", "(", "Type", "t", ",", "int", "index", ")", "throws", "InvalidTypesException", "{", "if", "(", "t", "instanceof", "ParameterizedType", ")", "{", "Type", "[", "]", "actualTypeArguments", "=", "(", "(", "ParameterizedType", ")", "t", ")", ".", "getActualTypeArguments", "(", ")", ";", "if", "(", "index", "<", "0", "||", "index", ">=", "actualTypeArguments", ".", "length", ")", "{", "throw", "new", "InvalidTypesException", "(", "\"Cannot extract the type argument with index \"", "+", "index", "+", "\" because the type has only \"", "+", "actualTypeArguments", ".", "length", "+", "\" type arguments.\"", ")", ";", "}", "else", "{", "return", "actualTypeArguments", "[", "index", "]", ";", "}", "}", "else", "{", "throw", "new", "InvalidTypesException", "(", "\"The given type \"", "+", "t", "+", "\" is not a parameterized type.\"", ")", ";", "}", "}" ]
This method extracts the n-th type argument from the given type. An InvalidTypesException is thrown if the type does not have any type arguments or if the index exceeds the number of type arguments. @param t Type to extract the type arguments from @param index Index of the type argument to extract @return The extracted type argument @throws InvalidTypesException if the given type does not have any type arguments or if the index exceeds the number of type arguments.
[ "This", "method", "extracts", "the", "n", "-", "th", "type", "argument", "from", "the", "given", "type", ".", "An", "InvalidTypesException", "is", "thrown", "if", "the", "type", "does", "not", "have", "any", "type", "arguments", "or", "if", "the", "index", "exceeds", "the", "number", "of", "type", "arguments", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractionUtils.java#L194-L208
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/climbing/HillClimberWindowTinyLfuPolicy.java
HillClimberWindowTinyLfuPolicy.policies
public static Set<Policy> policies(Config config) { """ Returns all variations of this policy based on the configuration parameters. """ HillClimberWindowTinyLfuSettings settings = new HillClimberWindowTinyLfuSettings(config); Set<Policy> policies = new HashSet<>(); for (HillClimberType climber : settings.strategy()) { for (double percentMain : settings.percentMain()) { policies.add(new HillClimberWindowTinyLfuPolicy(climber, percentMain, settings)); } } return policies; }
java
public static Set<Policy> policies(Config config) { HillClimberWindowTinyLfuSettings settings = new HillClimberWindowTinyLfuSettings(config); Set<Policy> policies = new HashSet<>(); for (HillClimberType climber : settings.strategy()) { for (double percentMain : settings.percentMain()) { policies.add(new HillClimberWindowTinyLfuPolicy(climber, percentMain, settings)); } } return policies; }
[ "public", "static", "Set", "<", "Policy", ">", "policies", "(", "Config", "config", ")", "{", "HillClimberWindowTinyLfuSettings", "settings", "=", "new", "HillClimberWindowTinyLfuSettings", "(", "config", ")", ";", "Set", "<", "Policy", ">", "policies", "=", "new", "HashSet", "<>", "(", ")", ";", "for", "(", "HillClimberType", "climber", ":", "settings", ".", "strategy", "(", ")", ")", "{", "for", "(", "double", "percentMain", ":", "settings", ".", "percentMain", "(", ")", ")", "{", "policies", ".", "add", "(", "new", "HillClimberWindowTinyLfuPolicy", "(", "climber", ",", "percentMain", ",", "settings", ")", ")", ";", "}", "}", "return", "policies", ";", "}" ]
Returns all variations of this policy based on the configuration parameters.
[ "Returns", "all", "variations", "of", "this", "policy", "based", "on", "the", "configuration", "parameters", "." ]
train
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/climbing/HillClimberWindowTinyLfuPolicy.java#L103-L112
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/html/HtmlTableRendererBase.java
HtmlTableRendererBase.encodeChildren
public void encodeChildren(FacesContext facesContext, UIComponent component) throws IOException { """ Render the TBODY section of the html table. See also method encodeInnerHtml. @see javax.faces.render.Renderer#encodeChildren(FacesContext, UIComponent) """ RendererUtils.checkParamValidity(facesContext, component, UIData.class); beforeBody(facesContext, (UIData) component); encodeInnerHtml(facesContext, component); afterBody(facesContext, (UIData) component); }
java
public void encodeChildren(FacesContext facesContext, UIComponent component) throws IOException { RendererUtils.checkParamValidity(facesContext, component, UIData.class); beforeBody(facesContext, (UIData) component); encodeInnerHtml(facesContext, component); afterBody(facesContext, (UIData) component); }
[ "public", "void", "encodeChildren", "(", "FacesContext", "facesContext", ",", "UIComponent", "component", ")", "throws", "IOException", "{", "RendererUtils", ".", "checkParamValidity", "(", "facesContext", ",", "component", ",", "UIData", ".", "class", ")", ";", "beforeBody", "(", "facesContext", ",", "(", "UIData", ")", "component", ")", ";", "encodeInnerHtml", "(", "facesContext", ",", "component", ")", ";", "afterBody", "(", "facesContext", ",", "(", "UIData", ")", "component", ")", ";", "}" ]
Render the TBODY section of the html table. See also method encodeInnerHtml. @see javax.faces.render.Renderer#encodeChildren(FacesContext, UIComponent)
[ "Render", "the", "TBODY", "section", "of", "the", "html", "table", ".", "See", "also", "method", "encodeInnerHtml", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/html/HtmlTableRendererBase.java#L202-L211
agmip/agmip-common-functions
src/main/java/org/agmip/functions/PTSaxton2006.java
PTSaxton2006.calcSatBulk
public static String calcSatBulk(String slsnd, String slcly, String omPct, String slcf) { """ Equation 22 for calculating Saturated conductivity (bulk soil), mm/h @param slsnd Sand weight percentage by layer ([0,100]%) @param slcly Clay weight percentage by layer ([0,100]%) @param omPct Organic matter weight percentage by layer ([0,100]%), (= SLOC * 1.72) @param slcf Grave weight fraction by layer (g/g) """ String satMatric = calcSatMatric(slsnd, slcly, omPct); String slbdm = calcNormalDensity(slsnd, slcly, omPct); String alpha = divide(slbdm, "2.65"); String ratio = divide(substract("1", slcf), substract("1", slcf, product("-1.5", slcf, alpha))); String ret = product(satMatric, ratio); LOG.debug("Calculate result for Saturated conductivity (bulk soil), mm/h is {}", ret); return ret; }
java
public static String calcSatBulk(String slsnd, String slcly, String omPct, String slcf) { String satMatric = calcSatMatric(slsnd, slcly, omPct); String slbdm = calcNormalDensity(slsnd, slcly, omPct); String alpha = divide(slbdm, "2.65"); String ratio = divide(substract("1", slcf), substract("1", slcf, product("-1.5", slcf, alpha))); String ret = product(satMatric, ratio); LOG.debug("Calculate result for Saturated conductivity (bulk soil), mm/h is {}", ret); return ret; }
[ "public", "static", "String", "calcSatBulk", "(", "String", "slsnd", ",", "String", "slcly", ",", "String", "omPct", ",", "String", "slcf", ")", "{", "String", "satMatric", "=", "calcSatMatric", "(", "slsnd", ",", "slcly", ",", "omPct", ")", ";", "String", "slbdm", "=", "calcNormalDensity", "(", "slsnd", ",", "slcly", ",", "omPct", ")", ";", "String", "alpha", "=", "divide", "(", "slbdm", ",", "\"2.65\"", ")", ";", "String", "ratio", "=", "divide", "(", "substract", "(", "\"1\"", ",", "slcf", ")", ",", "substract", "(", "\"1\"", ",", "slcf", ",", "product", "(", "\"-1.5\"", ",", "slcf", ",", "alpha", ")", ")", ")", ";", "String", "ret", "=", "product", "(", "satMatric", ",", "ratio", ")", ";", "LOG", ".", "debug", "(", "\"Calculate result for Saturated conductivity (bulk soil), mm/h is {}\"", ",", "ret", ")", ";", "return", "ret", ";", "}" ]
Equation 22 for calculating Saturated conductivity (bulk soil), mm/h @param slsnd Sand weight percentage by layer ([0,100]%) @param slcly Clay weight percentage by layer ([0,100]%) @param omPct Organic matter weight percentage by layer ([0,100]%), (= SLOC * 1.72) @param slcf Grave weight fraction by layer (g/g)
[ "Equation", "22", "for", "calculating", "Saturated", "conductivity", "(", "bulk", "soil", ")", "mm", "/", "h" ]
train
https://github.com/agmip/agmip-common-functions/blob/4efa3042178841b026ca6fba9c96da02fbfb9a8e/src/main/java/org/agmip/functions/PTSaxton2006.java#L377-L387
tomgibara/bits
src/main/java/com/tomgibara/bits/Bits.java
Bits.asStore
public static BitStore asStore(SortedSet<Integer> set, int start, int finish, boolean mutable) { """ Exposes a <code>SortedSet</code> of <code>Integer</code> as {@link BitStore}. The <code>start</code> and <code>finish</code> parameters must form a valid sub-range of the set. Since it is not possible to determine whether a set is modifiable, the mutability of the generated {@link BitStore} must be specified as a call parameter. Creating a mutable {@link BitStore} over an unmodifiable set may result in unspecified errors on any attempt to mutate the bit store. @param set a sorted set of integers @param start the least integer exposed by the {@link BitStore} @param finish the least integer greater than or equal to <code>start</code> that is not exposed by the {@link BitStore} @param mutable whether the returned {@link BitStore} is mutable @throws IllegalArgumentException if the range start-to-finish does not form a valid sub-range of the supplied set. @return a {@link BitStore} view over the set """ if (set == null) throw new IllegalArgumentException("null set"); if (start < 0L) throw new IllegalArgumentException("negative start"); if (finish < start) throw new IllegalArgumentException("start exceeds finish"); set = set.subSet(start, finish); return new IntSetBitStore(set, start, finish, mutable); }
java
public static BitStore asStore(SortedSet<Integer> set, int start, int finish, boolean mutable) { if (set == null) throw new IllegalArgumentException("null set"); if (start < 0L) throw new IllegalArgumentException("negative start"); if (finish < start) throw new IllegalArgumentException("start exceeds finish"); set = set.subSet(start, finish); return new IntSetBitStore(set, start, finish, mutable); }
[ "public", "static", "BitStore", "asStore", "(", "SortedSet", "<", "Integer", ">", "set", ",", "int", "start", ",", "int", "finish", ",", "boolean", "mutable", ")", "{", "if", "(", "set", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"null set\"", ")", ";", "if", "(", "start", "<", "0L", ")", "throw", "new", "IllegalArgumentException", "(", "\"negative start\"", ")", ";", "if", "(", "finish", "<", "start", ")", "throw", "new", "IllegalArgumentException", "(", "\"start exceeds finish\"", ")", ";", "set", "=", "set", ".", "subSet", "(", "start", ",", "finish", ")", ";", "return", "new", "IntSetBitStore", "(", "set", ",", "start", ",", "finish", ",", "mutable", ")", ";", "}" ]
Exposes a <code>SortedSet</code> of <code>Integer</code> as {@link BitStore}. The <code>start</code> and <code>finish</code> parameters must form a valid sub-range of the set. Since it is not possible to determine whether a set is modifiable, the mutability of the generated {@link BitStore} must be specified as a call parameter. Creating a mutable {@link BitStore} over an unmodifiable set may result in unspecified errors on any attempt to mutate the bit store. @param set a sorted set of integers @param start the least integer exposed by the {@link BitStore} @param finish the least integer greater than or equal to <code>start</code> that is not exposed by the {@link BitStore} @param mutable whether the returned {@link BitStore} is mutable @throws IllegalArgumentException if the range start-to-finish does not form a valid sub-range of the supplied set. @return a {@link BitStore} view over the set
[ "Exposes", "a", "<code", ">", "SortedSet<", "/", "code", ">", "of", "<code", ">", "Integer<", "/", "code", ">", "as", "{", "@link", "BitStore", "}", ".", "The", "<code", ">", "start<", "/", "code", ">", "and", "<code", ">", "finish<", "/", "code", ">", "parameters", "must", "form", "a", "valid", "sub", "-", "range", "of", "the", "set", ".", "Since", "it", "is", "not", "possible", "to", "determine", "whether", "a", "set", "is", "modifiable", "the", "mutability", "of", "the", "generated", "{", "@link", "BitStore", "}", "must", "be", "specified", "as", "a", "call", "parameter", ".", "Creating", "a", "mutable", "{", "@link", "BitStore", "}", "over", "an", "unmodifiable", "set", "may", "result", "in", "unspecified", "errors", "on", "any", "attempt", "to", "mutate", "the", "bit", "store", "." ]
train
https://github.com/tomgibara/bits/blob/56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97/src/main/java/com/tomgibara/bits/Bits.java#L632-L638
neo4j-contrib/neo4j-apoc-procedures
src/main/java/apoc/load/Xml.java
Xml.handleTypeAndAttributes
private void handleTypeAndAttributes(Node node, Map<String, Object> elementMap) { """ Collects type and attributes for the node @param node @param elementMap """ // Set type if (node.getLocalName() != null) { elementMap.put("_type", node.getLocalName()); } // Set the attributes if (node.getAttributes() != null) { NamedNodeMap attributeMap = node.getAttributes(); for (int i = 0; i < attributeMap.getLength(); i++) { Node attribute = attributeMap.item(i); elementMap.put(attribute.getNodeName(), attribute.getNodeValue()); } } }
java
private void handleTypeAndAttributes(Node node, Map<String, Object> elementMap) { // Set type if (node.getLocalName() != null) { elementMap.put("_type", node.getLocalName()); } // Set the attributes if (node.getAttributes() != null) { NamedNodeMap attributeMap = node.getAttributes(); for (int i = 0; i < attributeMap.getLength(); i++) { Node attribute = attributeMap.item(i); elementMap.put(attribute.getNodeName(), attribute.getNodeValue()); } } }
[ "private", "void", "handleTypeAndAttributes", "(", "Node", "node", ",", "Map", "<", "String", ",", "Object", ">", "elementMap", ")", "{", "// Set type", "if", "(", "node", ".", "getLocalName", "(", ")", "!=", "null", ")", "{", "elementMap", ".", "put", "(", "\"_type\"", ",", "node", ".", "getLocalName", "(", ")", ")", ";", "}", "// Set the attributes", "if", "(", "node", ".", "getAttributes", "(", ")", "!=", "null", ")", "{", "NamedNodeMap", "attributeMap", "=", "node", ".", "getAttributes", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "attributeMap", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Node", "attribute", "=", "attributeMap", ".", "item", "(", "i", ")", ";", "elementMap", ".", "put", "(", "attribute", ".", "getNodeName", "(", ")", ",", "attribute", ".", "getNodeValue", "(", ")", ")", ";", "}", "}", "}" ]
Collects type and attributes for the node @param node @param elementMap
[ "Collects", "type", "and", "attributes", "for", "the", "node" ]
train
https://github.com/neo4j-contrib/neo4j-apoc-procedures/blob/e8386975d1c512c0e4388a1a61f5496121c04f86/src/main/java/apoc/load/Xml.java#L267-L281
micrometer-metrics/micrometer
micrometer-core/src/main/java/io/micrometer/core/instrument/distribution/HistogramGauges.java
HistogramGauges.registerWithCommonFormat
public static HistogramGauges registerWithCommonFormat(Timer timer, MeterRegistry registry) { """ Register a set of gauges for percentiles and histogram buckets that follow a common format when the monitoring system doesn't have an opinion about the structure of this data. @param timer the timer from which to derive gauges @param registry the registry to register the gauges @return registered {@code HistogramGauges} """ Meter.Id id = timer.getId(); return HistogramGauges.register(timer, registry, percentile -> id.getName() + ".percentile", percentile -> Tags.concat(id.getTagsAsIterable(), "phi", DoubleFormat.decimalOrNan(percentile.percentile())), percentile -> percentile.value(timer.baseTimeUnit()), bucket -> id.getName() + ".histogram", // We look for Long.MAX_VALUE to ensure a sensible tag on our +Inf bucket bucket -> Tags.concat(id.getTagsAsIterable(), "le", bucket.bucket() != Long.MAX_VALUE ? DoubleFormat.decimalOrWhole(bucket.bucket(timer.baseTimeUnit())) : "+Inf")); }
java
public static HistogramGauges registerWithCommonFormat(Timer timer, MeterRegistry registry) { Meter.Id id = timer.getId(); return HistogramGauges.register(timer, registry, percentile -> id.getName() + ".percentile", percentile -> Tags.concat(id.getTagsAsIterable(), "phi", DoubleFormat.decimalOrNan(percentile.percentile())), percentile -> percentile.value(timer.baseTimeUnit()), bucket -> id.getName() + ".histogram", // We look for Long.MAX_VALUE to ensure a sensible tag on our +Inf bucket bucket -> Tags.concat(id.getTagsAsIterable(), "le", bucket.bucket() != Long.MAX_VALUE ? DoubleFormat.decimalOrWhole(bucket.bucket(timer.baseTimeUnit())) : "+Inf")); }
[ "public", "static", "HistogramGauges", "registerWithCommonFormat", "(", "Timer", "timer", ",", "MeterRegistry", "registry", ")", "{", "Meter", ".", "Id", "id", "=", "timer", ".", "getId", "(", ")", ";", "return", "HistogramGauges", ".", "register", "(", "timer", ",", "registry", ",", "percentile", "->", "id", ".", "getName", "(", ")", "+", "\".percentile\"", ",", "percentile", "->", "Tags", ".", "concat", "(", "id", ".", "getTagsAsIterable", "(", ")", ",", "\"phi\"", ",", "DoubleFormat", ".", "decimalOrNan", "(", "percentile", ".", "percentile", "(", ")", ")", ")", ",", "percentile", "->", "percentile", ".", "value", "(", "timer", ".", "baseTimeUnit", "(", ")", ")", ",", "bucket", "->", "id", ".", "getName", "(", ")", "+", "\".histogram\"", ",", "// We look for Long.MAX_VALUE to ensure a sensible tag on our +Inf bucket", "bucket", "->", "Tags", ".", "concat", "(", "id", ".", "getTagsAsIterable", "(", ")", ",", "\"le\"", ",", "bucket", ".", "bucket", "(", ")", "!=", "Long", ".", "MAX_VALUE", "?", "DoubleFormat", ".", "decimalOrWhole", "(", "bucket", ".", "bucket", "(", "timer", ".", "baseTimeUnit", "(", ")", ")", ")", ":", "\"+Inf\"", ")", ")", ";", "}" ]
Register a set of gauges for percentiles and histogram buckets that follow a common format when the monitoring system doesn't have an opinion about the structure of this data. @param timer the timer from which to derive gauges @param registry the registry to register the gauges @return registered {@code HistogramGauges}
[ "Register", "a", "set", "of", "gauges", "for", "percentiles", "and", "histogram", "buckets", "that", "follow", "a", "common", "format", "when", "the", "monitoring", "system", "doesn", "t", "have", "an", "opinion", "about", "the", "structure", "of", "this", "data", "." ]
train
https://github.com/micrometer-metrics/micrometer/blob/127fa3265325cc894f368312ed8890b76a055d88/micrometer-core/src/main/java/io/micrometer/core/instrument/distribution/HistogramGauges.java#L44-L54
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/lang/AtomicBiInteger.java
AtomicBiInteger.compareAndSetHi
public boolean compareAndSetHi(int expectHi, int hi) { """ <p>Atomically sets the hi value to the given updated value only if the current value {@code ==} the expected value.</p> <p>Concurrent changes to the lo value result in a retry.</p> @param expectHi the expected hi value @param hi the new hi value @return {@code true} if successful. False return indicates that the actual hi value was not equal to the expected hi value. """ while (true) { long encoded = get(); if (getHi(encoded) != expectHi) return false; long update = encodeHi(encoded, hi); if (compareAndSet(encoded, update)) return true; } }
java
public boolean compareAndSetHi(int expectHi, int hi) { while (true) { long encoded = get(); if (getHi(encoded) != expectHi) return false; long update = encodeHi(encoded, hi); if (compareAndSet(encoded, update)) return true; } }
[ "public", "boolean", "compareAndSetHi", "(", "int", "expectHi", ",", "int", "hi", ")", "{", "while", "(", "true", ")", "{", "long", "encoded", "=", "get", "(", ")", ";", "if", "(", "getHi", "(", "encoded", ")", "!=", "expectHi", ")", "return", "false", ";", "long", "update", "=", "encodeHi", "(", "encoded", ",", "hi", ")", ";", "if", "(", "compareAndSet", "(", "encoded", ",", "update", ")", ")", "return", "true", ";", "}", "}" ]
<p>Atomically sets the hi value to the given updated value only if the current value {@code ==} the expected value.</p> <p>Concurrent changes to the lo value result in a retry.</p> @param expectHi the expected hi value @param hi the new hi value @return {@code true} if successful. False return indicates that the actual hi value was not equal to the expected hi value.
[ "<p", ">", "Atomically", "sets", "the", "hi", "value", "to", "the", "given", "updated", "value", "only", "if", "the", "current", "value", "{", "@code", "==", "}", "the", "expected", "value", ".", "<", "/", "p", ">", "<p", ">", "Concurrent", "changes", "to", "the", "lo", "value", "result", "in", "a", "retry", ".", "<", "/", "p", ">" ]
train
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/lang/AtomicBiInteger.java#L73-L82
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java
JobsImpl.addAsync
public Observable<Void> addAsync(JobAddParameter job, JobAddOptions jobAddOptions) { """ Adds a job to the specified account. The Batch service supports two ways to control the work done as part of a job. In the first approach, the user specifies a Job Manager task. The Batch service launches this task when it is ready to start the job. The Job Manager task controls all other tasks that run under this job, by using the Task APIs. In the second approach, the user directly controls the execution of tasks under an active job, by using the Task APIs. Also note: when naming jobs, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. @param job The job to be added. @param jobAddOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponseWithHeaders} object if successful. """ return addWithServiceResponseAsync(job, jobAddOptions).map(new Func1<ServiceResponseWithHeaders<Void, JobAddHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, JobAddHeaders> response) { return response.body(); } }); }
java
public Observable<Void> addAsync(JobAddParameter job, JobAddOptions jobAddOptions) { return addWithServiceResponseAsync(job, jobAddOptions).map(new Func1<ServiceResponseWithHeaders<Void, JobAddHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, JobAddHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "addAsync", "(", "JobAddParameter", "job", ",", "JobAddOptions", "jobAddOptions", ")", "{", "return", "addWithServiceResponseAsync", "(", "job", ",", "jobAddOptions", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponseWithHeaders", "<", "Void", ",", "JobAddHeaders", ">", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "call", "(", "ServiceResponseWithHeaders", "<", "Void", ",", "JobAddHeaders", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Adds a job to the specified account. The Batch service supports two ways to control the work done as part of a job. In the first approach, the user specifies a Job Manager task. The Batch service launches this task when it is ready to start the job. The Job Manager task controls all other tasks that run under this job, by using the Task APIs. In the second approach, the user directly controls the execution of tasks under an active job, by using the Task APIs. Also note: when naming jobs, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. @param job The job to be added. @param jobAddOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponseWithHeaders} object if successful.
[ "Adds", "a", "job", "to", "the", "specified", "account", ".", "The", "Batch", "service", "supports", "two", "ways", "to", "control", "the", "work", "done", "as", "part", "of", "a", "job", ".", "In", "the", "first", "approach", "the", "user", "specifies", "a", "Job", "Manager", "task", ".", "The", "Batch", "service", "launches", "this", "task", "when", "it", "is", "ready", "to", "start", "the", "job", ".", "The", "Job", "Manager", "task", "controls", "all", "other", "tasks", "that", "run", "under", "this", "job", "by", "using", "the", "Task", "APIs", ".", "In", "the", "second", "approach", "the", "user", "directly", "controls", "the", "execution", "of", "tasks", "under", "an", "active", "job", "by", "using", "the", "Task", "APIs", ".", "Also", "note", ":", "when", "naming", "jobs", "avoid", "including", "sensitive", "information", "such", "as", "user", "names", "or", "secret", "project", "names", ".", "This", "information", "may", "appear", "in", "telemetry", "logs", "accessible", "to", "Microsoft", "Support", "engineers", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java#L2146-L2153
nostra13/Android-Universal-Image-Loader
library/src/main/java/com/nostra13/universalimageloader/cache/disc/impl/BaseDiskCache.java
BaseDiskCache.getFile
protected File getFile(String imageUri) { """ Returns file object (not null) for incoming image URI. File object can reference to non-existing file. """ String fileName = fileNameGenerator.generate(imageUri); File dir = cacheDir; if (!cacheDir.exists() && !cacheDir.mkdirs()) { if (reserveCacheDir != null && (reserveCacheDir.exists() || reserveCacheDir.mkdirs())) { dir = reserveCacheDir; } } return new File(dir, fileName); }
java
protected File getFile(String imageUri) { String fileName = fileNameGenerator.generate(imageUri); File dir = cacheDir; if (!cacheDir.exists() && !cacheDir.mkdirs()) { if (reserveCacheDir != null && (reserveCacheDir.exists() || reserveCacheDir.mkdirs())) { dir = reserveCacheDir; } } return new File(dir, fileName); }
[ "protected", "File", "getFile", "(", "String", "imageUri", ")", "{", "String", "fileName", "=", "fileNameGenerator", ".", "generate", "(", "imageUri", ")", ";", "File", "dir", "=", "cacheDir", ";", "if", "(", "!", "cacheDir", ".", "exists", "(", ")", "&&", "!", "cacheDir", ".", "mkdirs", "(", ")", ")", "{", "if", "(", "reserveCacheDir", "!=", "null", "&&", "(", "reserveCacheDir", ".", "exists", "(", ")", "||", "reserveCacheDir", ".", "mkdirs", "(", ")", ")", ")", "{", "dir", "=", "reserveCacheDir", ";", "}", "}", "return", "new", "File", "(", "dir", ",", "fileName", ")", ";", "}" ]
Returns file object (not null) for incoming image URI. File object can reference to non-existing file.
[ "Returns", "file", "object", "(", "not", "null", ")", "for", "incoming", "image", "URI", ".", "File", "object", "can", "reference", "to", "non", "-", "existing", "file", "." ]
train
https://github.com/nostra13/Android-Universal-Image-Loader/blob/fc3c5f6779bb4f702e233653b61bd9d559e345cc/library/src/main/java/com/nostra13/universalimageloader/cache/disc/impl/BaseDiskCache.java#L166-L175
JodaOrg/joda-time
src/main/java/org/joda/time/field/UnsupportedDateTimeField.java
UnsupportedDateTimeField.getInstance
public static synchronized UnsupportedDateTimeField getInstance( DateTimeFieldType type, DurationField durationField) { """ Gets an instance of UnsupportedDateTimeField for a specific named field. Names should be of standard format, such as 'monthOfYear' or 'hourOfDay'. The returned instance is cached. @param type the type to obtain @return the instance @throws IllegalArgumentException if durationField is null """ UnsupportedDateTimeField field; if (cCache == null) { cCache = new HashMap<DateTimeFieldType, UnsupportedDateTimeField>(7); field = null; } else { field = cCache.get(type); if (field != null && field.getDurationField() != durationField) { field = null; } } if (field == null) { field = new UnsupportedDateTimeField(type, durationField); cCache.put(type, field); } return field; }
java
public static synchronized UnsupportedDateTimeField getInstance( DateTimeFieldType type, DurationField durationField) { UnsupportedDateTimeField field; if (cCache == null) { cCache = new HashMap<DateTimeFieldType, UnsupportedDateTimeField>(7); field = null; } else { field = cCache.get(type); if (field != null && field.getDurationField() != durationField) { field = null; } } if (field == null) { field = new UnsupportedDateTimeField(type, durationField); cCache.put(type, field); } return field; }
[ "public", "static", "synchronized", "UnsupportedDateTimeField", "getInstance", "(", "DateTimeFieldType", "type", ",", "DurationField", "durationField", ")", "{", "UnsupportedDateTimeField", "field", ";", "if", "(", "cCache", "==", "null", ")", "{", "cCache", "=", "new", "HashMap", "<", "DateTimeFieldType", ",", "UnsupportedDateTimeField", ">", "(", "7", ")", ";", "field", "=", "null", ";", "}", "else", "{", "field", "=", "cCache", ".", "get", "(", "type", ")", ";", "if", "(", "field", "!=", "null", "&&", "field", ".", "getDurationField", "(", ")", "!=", "durationField", ")", "{", "field", "=", "null", ";", "}", "}", "if", "(", "field", "==", "null", ")", "{", "field", "=", "new", "UnsupportedDateTimeField", "(", "type", ",", "durationField", ")", ";", "cCache", ".", "put", "(", "type", ",", "field", ")", ";", "}", "return", "field", ";", "}" ]
Gets an instance of UnsupportedDateTimeField for a specific named field. Names should be of standard format, such as 'monthOfYear' or 'hourOfDay'. The returned instance is cached. @param type the type to obtain @return the instance @throws IllegalArgumentException if durationField is null
[ "Gets", "an", "instance", "of", "UnsupportedDateTimeField", "for", "a", "specific", "named", "field", ".", "Names", "should", "be", "of", "standard", "format", "such", "as", "monthOfYear", "or", "hourOfDay", ".", "The", "returned", "instance", "is", "cached", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/field/UnsupportedDateTimeField.java#L51-L69
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/access/WSDLServlet.java
WSDLServlet.doGet
@Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { """ Respond to an HTTP GET request. The single parameter, "api", indicates which WSDL file to provide. If no parameters are given, a simple HTML index is given instead. """ String api = request.getParameter("api"); if (api == null || api.length() == 0) { response.setContentType("text/html; charset=UTF-8"); getIndex(response.getWriter()); } else { response.setContentType("text/xml; charset=UTF-8"); getWSDL(api.toUpperCase(), request.getRequestURL() .toString(), response.getWriter()); } response.flushBuffer(); }
java
@Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { String api = request.getParameter("api"); if (api == null || api.length() == 0) { response.setContentType("text/html; charset=UTF-8"); getIndex(response.getWriter()); } else { response.setContentType("text/xml; charset=UTF-8"); getWSDL(api.toUpperCase(), request.getRequestURL() .toString(), response.getWriter()); } response.flushBuffer(); }
[ "@", "Override", "public", "void", "doGet", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "IOException", ",", "ServletException", "{", "String", "api", "=", "request", ".", "getParameter", "(", "\"api\"", ")", ";", "if", "(", "api", "==", "null", "||", "api", ".", "length", "(", ")", "==", "0", ")", "{", "response", ".", "setContentType", "(", "\"text/html; charset=UTF-8\"", ")", ";", "getIndex", "(", "response", ".", "getWriter", "(", ")", ")", ";", "}", "else", "{", "response", ".", "setContentType", "(", "\"text/xml; charset=UTF-8\"", ")", ";", "getWSDL", "(", "api", ".", "toUpperCase", "(", ")", ",", "request", ".", "getRequestURL", "(", ")", ".", "toString", "(", ")", ",", "response", ".", "getWriter", "(", ")", ")", ";", "}", "response", ".", "flushBuffer", "(", ")", ";", "}" ]
Respond to an HTTP GET request. The single parameter, "api", indicates which WSDL file to provide. If no parameters are given, a simple HTML index is given instead.
[ "Respond", "to", "an", "HTTP", "GET", "request", ".", "The", "single", "parameter", "api", "indicates", "which", "WSDL", "file", "to", "provide", ".", "If", "no", "parameters", "are", "given", "a", "simple", "HTML", "index", "is", "given", "instead", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/access/WSDLServlet.java#L75-L91
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/MapHelper.java
MapHelper.contentOfEquals
public boolean contentOfEquals(Map<String, Object> one, Object two) { """ Determines whether map one's content matches two. @param one map the check content of. @param two other map to check. @return true if both maps are equal. """ if (one == null) { return two == null; } else { return one.equals(two); } }
java
public boolean contentOfEquals(Map<String, Object> one, Object two) { if (one == null) { return two == null; } else { return one.equals(two); } }
[ "public", "boolean", "contentOfEquals", "(", "Map", "<", "String", ",", "Object", ">", "one", ",", "Object", "two", ")", "{", "if", "(", "one", "==", "null", ")", "{", "return", "two", "==", "null", ";", "}", "else", "{", "return", "one", ".", "equals", "(", "two", ")", ";", "}", "}" ]
Determines whether map one's content matches two. @param one map the check content of. @param two other map to check. @return true if both maps are equal.
[ "Determines", "whether", "map", "one", "s", "content", "matches", "two", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/MapHelper.java#L151-L157
landawn/AbacusUtil
src/com/landawn/abacus/util/N.java
N.distinctBy
public static <T, E extends Exception> List<T> distinctBy(final T[] a, final Try.Function<? super T, ?, E> keyMapper) throws E { """ Distinct by the value mapped from <code>keyMapper</code>. Mostly it's designed for one-step operation to complete the operation in one step. <code>java.util.stream.Stream</code> is preferred for multiple phases operation. @param a @param keyMapper don't change value of the input parameter. @return """ if (N.isNullOrEmpty(a)) { return new ArrayList<>(); } return distinctBy(a, 0, a.length, keyMapper); }
java
public static <T, E extends Exception> List<T> distinctBy(final T[] a, final Try.Function<? super T, ?, E> keyMapper) throws E { if (N.isNullOrEmpty(a)) { return new ArrayList<>(); } return distinctBy(a, 0, a.length, keyMapper); }
[ "public", "static", "<", "T", ",", "E", "extends", "Exception", ">", "List", "<", "T", ">", "distinctBy", "(", "final", "T", "[", "]", "a", ",", "final", "Try", ".", "Function", "<", "?", "super", "T", ",", "?", ",", "E", ">", "keyMapper", ")", "throws", "E", "{", "if", "(", "N", ".", "isNullOrEmpty", "(", "a", ")", ")", "{", "return", "new", "ArrayList", "<>", "(", ")", ";", "}", "return", "distinctBy", "(", "a", ",", "0", ",", "a", ".", "length", ",", "keyMapper", ")", ";", "}" ]
Distinct by the value mapped from <code>keyMapper</code>. Mostly it's designed for one-step operation to complete the operation in one step. <code>java.util.stream.Stream</code> is preferred for multiple phases operation. @param a @param keyMapper don't change value of the input parameter. @return
[ "Distinct", "by", "the", "value", "mapped", "from", "<code", ">", "keyMapper<", "/", "code", ">", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L18020-L18026
authlete/authlete-java-common
src/main/java/com/authlete/common/util/TypedProperties.java
TypedProperties.getLong
public long getLong(Enum<?> key, long defaultValue) { """ Equivalent to {@link #getLong(String, long) getLong}{@code (key.name(), defaultValue)}. If {@code key} is null, {@code defaultValue} is returned. """ if (key == null) { return defaultValue; } return getLong(key.name(), defaultValue); }
java
public long getLong(Enum<?> key, long defaultValue) { if (key == null) { return defaultValue; } return getLong(key.name(), defaultValue); }
[ "public", "long", "getLong", "(", "Enum", "<", "?", ">", "key", ",", "long", "defaultValue", ")", "{", "if", "(", "key", "==", "null", ")", "{", "return", "defaultValue", ";", "}", "return", "getLong", "(", "key", ".", "name", "(", ")", ",", "defaultValue", ")", ";", "}" ]
Equivalent to {@link #getLong(String, long) getLong}{@code (key.name(), defaultValue)}. If {@code key} is null, {@code defaultValue} is returned.
[ "Equivalent", "to", "{" ]
train
https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/util/TypedProperties.java#L313-L321
undertow-io/undertow
core/src/main/java/io/undertow/util/Headers.java
Headers.extractTokenFromHeader
@Deprecated public static String extractTokenFromHeader(final String header, final String key) { """ Extracts a token from a header that has a given key. For instance if the header is <p> content-type=multipart/form-data boundary=myboundary and the key is boundary the myboundary will be returned. @param header The header @param key The key that identifies the token to extract @return The token, or null if it was not found """ int pos = header.indexOf(' ' + key + '='); if (pos == -1) { if(!header.startsWith(key + '=')) { return null; } pos = 0; } else { pos++; } int end; int start = pos + key.length() + 1; for (end = start; end < header.length(); ++end) { char c = header.charAt(end); if (c == ' ' || c == '\t' || c == ';') { break; } } return header.substring(start, end); }
java
@Deprecated public static String extractTokenFromHeader(final String header, final String key) { int pos = header.indexOf(' ' + key + '='); if (pos == -1) { if(!header.startsWith(key + '=')) { return null; } pos = 0; } else { pos++; } int end; int start = pos + key.length() + 1; for (end = start; end < header.length(); ++end) { char c = header.charAt(end); if (c == ' ' || c == '\t' || c == ';') { break; } } return header.substring(start, end); }
[ "@", "Deprecated", "public", "static", "String", "extractTokenFromHeader", "(", "final", "String", "header", ",", "final", "String", "key", ")", "{", "int", "pos", "=", "header", ".", "indexOf", "(", "'", "'", "+", "key", "+", "'", "'", ")", ";", "if", "(", "pos", "==", "-", "1", ")", "{", "if", "(", "!", "header", ".", "startsWith", "(", "key", "+", "'", "'", ")", ")", "{", "return", "null", ";", "}", "pos", "=", "0", ";", "}", "else", "{", "pos", "++", ";", "}", "int", "end", ";", "int", "start", "=", "pos", "+", "key", ".", "length", "(", ")", "+", "1", ";", "for", "(", "end", "=", "start", ";", "end", "<", "header", ".", "length", "(", ")", ";", "++", "end", ")", "{", "char", "c", "=", "header", ".", "charAt", "(", "end", ")", ";", "if", "(", "c", "==", "'", "'", "||", "c", "==", "'", "'", "||", "c", "==", "'", "'", ")", "{", "break", ";", "}", "}", "return", "header", ".", "substring", "(", "start", ",", "end", ")", ";", "}" ]
Extracts a token from a header that has a given key. For instance if the header is <p> content-type=multipart/form-data boundary=myboundary and the key is boundary the myboundary will be returned. @param header The header @param key The key that identifies the token to extract @return The token, or null if it was not found
[ "Extracts", "a", "token", "from", "a", "header", "that", "has", "a", "given", "key", ".", "For", "instance", "if", "the", "header", "is", "<p", ">", "content", "-", "type", "=", "multipart", "/", "form", "-", "data", "boundary", "=", "myboundary", "and", "the", "key", "is", "boundary", "the", "myboundary", "will", "be", "returned", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/util/Headers.java#L299-L319
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/HomeOfHomes.java
HomeOfHomes.updateAppLinkData
private void updateAppLinkData(AppLinkData linkData, boolean add, J2EEName j2eeName, BeanMetaData bmd) // F743-26072 { """ Updates the EJB-link and auto-link data for a bean. @param linkData @param add <tt>true</tt> if data for the bean should be added, or <tt>false</tt> if data should be removed @param bmd """ final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "updateAppLinkData: " + j2eeName + ", add=" + add); int numBeans; synchronized (linkData) { linkData.ivNumBeans += add ? 1 : -1; numBeans = linkData.ivNumBeans; // Update the table of bean names for this application, in support // of ejb-link. d429866.1 updateAppLinkDataTable(linkData.ivBeansByName, add, j2eeName.getComponent(), j2eeName, "ivBeansByName"); // Update the table of bean interfaces for this application, in support // of auto-link. d429866.2 updateAutoLink(linkData, add, j2eeName, bmd); // F743-25385CodRv d648723 // Update the table of logical-to-physical module names, in support of // ejb-link. // F743-26072 - This will redundantly add the same entry for every // bean in the module, but it will remove the entry for the first bean // to be removed. In other words, we do not support removing a single // bean from a module. updateAppLinkDataTable(linkData.ivModulesByLogicalName, add, bmd._moduleMetaData.ivLogicalName, j2eeName.getModule(), "ivModulesByLogicalName"); } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "updateAppLinkData: " + j2eeName + ", add=" + add + ", numBeans=" + numBeans); }
java
private void updateAppLinkData(AppLinkData linkData, boolean add, J2EEName j2eeName, BeanMetaData bmd) // F743-26072 { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "updateAppLinkData: " + j2eeName + ", add=" + add); int numBeans; synchronized (linkData) { linkData.ivNumBeans += add ? 1 : -1; numBeans = linkData.ivNumBeans; // Update the table of bean names for this application, in support // of ejb-link. d429866.1 updateAppLinkDataTable(linkData.ivBeansByName, add, j2eeName.getComponent(), j2eeName, "ivBeansByName"); // Update the table of bean interfaces for this application, in support // of auto-link. d429866.2 updateAutoLink(linkData, add, j2eeName, bmd); // F743-25385CodRv d648723 // Update the table of logical-to-physical module names, in support of // ejb-link. // F743-26072 - This will redundantly add the same entry for every // bean in the module, but it will remove the entry for the first bean // to be removed. In other words, we do not support removing a single // bean from a module. updateAppLinkDataTable(linkData.ivModulesByLogicalName, add, bmd._moduleMetaData.ivLogicalName, j2eeName.getModule(), "ivModulesByLogicalName"); } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "updateAppLinkData: " + j2eeName + ", add=" + add + ", numBeans=" + numBeans); }
[ "private", "void", "updateAppLinkData", "(", "AppLinkData", "linkData", ",", "boolean", "add", ",", "J2EEName", "j2eeName", ",", "BeanMetaData", "bmd", ")", "// F743-26072", "{", "final", "boolean", "isTraceOn", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"updateAppLinkData: \"", "+", "j2eeName", "+", "\", add=\"", "+", "add", ")", ";", "int", "numBeans", ";", "synchronized", "(", "linkData", ")", "{", "linkData", ".", "ivNumBeans", "+=", "add", "?", "1", ":", "-", "1", ";", "numBeans", "=", "linkData", ".", "ivNumBeans", ";", "// Update the table of bean names for this application, in support", "// of ejb-link. d429866.1", "updateAppLinkDataTable", "(", "linkData", ".", "ivBeansByName", ",", "add", ",", "j2eeName", ".", "getComponent", "(", ")", ",", "j2eeName", ",", "\"ivBeansByName\"", ")", ";", "// Update the table of bean interfaces for this application, in support", "// of auto-link. d429866.2", "updateAutoLink", "(", "linkData", ",", "add", ",", "j2eeName", ",", "bmd", ")", ";", "// F743-25385CodRv d648723", "// Update the table of logical-to-physical module names, in support of", "// ejb-link.", "// F743-26072 - This will redundantly add the same entry for every", "// bean in the module, but it will remove the entry for the first bean", "// to be removed. In other words, we do not support removing a single", "// bean from a module.", "updateAppLinkDataTable", "(", "linkData", ".", "ivModulesByLogicalName", ",", "add", ",", "bmd", ".", "_moduleMetaData", ".", "ivLogicalName", ",", "j2eeName", ".", "getModule", "(", ")", ",", "\"ivModulesByLogicalName\"", ")", ";", "}", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"updateAppLinkData: \"", "+", "j2eeName", "+", "\", add=\"", "+", "add", "+", "\", numBeans=\"", "+", "numBeans", ")", ";", "}" ]
Updates the EJB-link and auto-link data for a bean. @param linkData @param add <tt>true</tt> if data for the bean should be added, or <tt>false</tt> if data should be removed @param bmd
[ "Updates", "the", "EJB", "-", "link", "and", "auto", "-", "link", "data", "for", "a", "bean", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/HomeOfHomes.java#L918-L951
h2oai/h2o-3
h2o-core/src/main/java/water/fvec/CStrChunk.java
CStrChunk.asciiSubstring
public NewChunk asciiSubstring(NewChunk nc, int startIndex, int endIndex) { """ Optimized substring() method for a buffer of only ASCII characters. The presence of UTF-8 multi-byte characters would give incorrect results for the string length, which is required here. @param nc NewChunk to be filled with substrings in this chunk @param startIndex The beginning index of the substring, inclusive @param endIndex The ending index of the substring, exclusive @return Filled NewChunk """ // copy existing data nc = this.extractRows(nc, 0,_len); //update offsets and byte array for (int i = 0; i < _len; i++) { int off = UnsafeUtils.get4(_mem, idx(i)); if (off != NA) { int len = 0; while (_mem[_valstart + off + len] != 0) len++; //Find length nc.set_is(i,startIndex < len ? off + startIndex : off + len); for (; len > endIndex - 1; len--) { nc._ss[off + len] = 0; //Set new end } } } return nc; }
java
public NewChunk asciiSubstring(NewChunk nc, int startIndex, int endIndex) { // copy existing data nc = this.extractRows(nc, 0,_len); //update offsets and byte array for (int i = 0; i < _len; i++) { int off = UnsafeUtils.get4(_mem, idx(i)); if (off != NA) { int len = 0; while (_mem[_valstart + off + len] != 0) len++; //Find length nc.set_is(i,startIndex < len ? off + startIndex : off + len); for (; len > endIndex - 1; len--) { nc._ss[off + len] = 0; //Set new end } } } return nc; }
[ "public", "NewChunk", "asciiSubstring", "(", "NewChunk", "nc", ",", "int", "startIndex", ",", "int", "endIndex", ")", "{", "// copy existing data", "nc", "=", "this", ".", "extractRows", "(", "nc", ",", "0", ",", "_len", ")", ";", "//update offsets and byte array", "for", "(", "int", "i", "=", "0", ";", "i", "<", "_len", ";", "i", "++", ")", "{", "int", "off", "=", "UnsafeUtils", ".", "get4", "(", "_mem", ",", "idx", "(", "i", ")", ")", ";", "if", "(", "off", "!=", "NA", ")", "{", "int", "len", "=", "0", ";", "while", "(", "_mem", "[", "_valstart", "+", "off", "+", "len", "]", "!=", "0", ")", "len", "++", ";", "//Find length", "nc", ".", "set_is", "(", "i", ",", "startIndex", "<", "len", "?", "off", "+", "startIndex", ":", "off", "+", "len", ")", ";", "for", "(", ";", "len", ">", "endIndex", "-", "1", ";", "len", "--", ")", "{", "nc", ".", "_ss", "[", "off", "+", "len", "]", "=", "0", ";", "//Set new end", "}", "}", "}", "return", "nc", ";", "}" ]
Optimized substring() method for a buffer of only ASCII characters. The presence of UTF-8 multi-byte characters would give incorrect results for the string length, which is required here. @param nc NewChunk to be filled with substrings in this chunk @param startIndex The beginning index of the substring, inclusive @param endIndex The ending index of the substring, exclusive @return Filled NewChunk
[ "Optimized", "substring", "()", "method", "for", "a", "buffer", "of", "only", "ASCII", "characters", ".", "The", "presence", "of", "UTF", "-", "8", "multi", "-", "byte", "characters", "would", "give", "incorrect", "results", "for", "the", "string", "length", "which", "is", "required", "here", "." ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/fvec/CStrChunk.java#L207-L223
RestComm/sip-servlets
containers/sip-servlets-as10/src/main/java/org/mobicents/servlet/sip/startup/ConvergedServletContextImpl.java
ConvergedServletContextImpl.executeMethod
private Object executeMethod(final Method method, final ServletContextImpl context, final Object[] params) throws PrivilegedActionException, IllegalAccessException, InvocationTargetException { """ Executes the method of the specified <code>ApplicationContext</code> @param method The method object to be invoked. @param context The AppliationContext object on which the method will be invoked @param params The arguments passed to the called method. """ if (SecurityUtil.isPackageProtectionEnabled()) { return AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { public Object run() throws IllegalAccessException, InvocationTargetException { return method.invoke(context, params); } }); } else { return method.invoke(context, params); } }
java
private Object executeMethod(final Method method, final ServletContextImpl context, final Object[] params) throws PrivilegedActionException, IllegalAccessException, InvocationTargetException { if (SecurityUtil.isPackageProtectionEnabled()) { return AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { public Object run() throws IllegalAccessException, InvocationTargetException { return method.invoke(context, params); } }); } else { return method.invoke(context, params); } }
[ "private", "Object", "executeMethod", "(", "final", "Method", "method", ",", "final", "ServletContextImpl", "context", ",", "final", "Object", "[", "]", "params", ")", "throws", "PrivilegedActionException", ",", "IllegalAccessException", ",", "InvocationTargetException", "{", "if", "(", "SecurityUtil", ".", "isPackageProtectionEnabled", "(", ")", ")", "{", "return", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedExceptionAction", "<", "Object", ">", "(", ")", "{", "public", "Object", "run", "(", ")", "throws", "IllegalAccessException", ",", "InvocationTargetException", "{", "return", "method", ".", "invoke", "(", "context", ",", "params", ")", ";", "}", "}", ")", ";", "}", "else", "{", "return", "method", ".", "invoke", "(", "context", ",", "params", ")", ";", "}", "}" ]
Executes the method of the specified <code>ApplicationContext</code> @param method The method object to be invoked. @param context The AppliationContext object on which the method will be invoked @param params The arguments passed to the called method.
[ "Executes", "the", "method", "of", "the", "specified", "<code", ">", "ApplicationContext<", "/", "code", ">" ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/containers/sip-servlets-as10/src/main/java/org/mobicents/servlet/sip/startup/ConvergedServletContextImpl.java#L859-L871
alkacon/opencms-core
src-modules/org/opencms/workplace/commons/CmsTouch.java
CmsTouch.hardTouch
private static void hardTouch(CmsObject cms, CmsResource resource) throws CmsException { """ Rewrites the content of the given file.<p> @param resource the resource to rewrite the content for @throws CmsException if something goes wrong """ CmsFile file = cms.readFile(resource); file.setContents(file.getContents()); cms.writeFile(file); }
java
private static void hardTouch(CmsObject cms, CmsResource resource) throws CmsException { CmsFile file = cms.readFile(resource); file.setContents(file.getContents()); cms.writeFile(file); }
[ "private", "static", "void", "hardTouch", "(", "CmsObject", "cms", ",", "CmsResource", "resource", ")", "throws", "CmsException", "{", "CmsFile", "file", "=", "cms", ".", "readFile", "(", "resource", ")", ";", "file", ".", "setContents", "(", "file", ".", "getContents", "(", ")", ")", ";", "cms", ".", "writeFile", "(", "file", ")", ";", "}" ]
Rewrites the content of the given file.<p> @param resource the resource to rewrite the content for @throws CmsException if something goes wrong
[ "Rewrites", "the", "content", "of", "the", "given", "file", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsTouch.java#L160-L165
netheosgithub/pcs_api
java/src/main/java/net/netheos/pcsapi/providers/cloudme/CloudMe.java
CloudMe.getBasicRequestInvoker
private RequestInvoker<CResponse> getBasicRequestInvoker( HttpRequestBase request, CPath path ) { """ An invoker that does not check response content type : to be used for files downloading @param request Http request @return the request invoker for basic requests """ return new RequestInvoker<CResponse>( new HttpRequestor( request, path, sessionManager ), BASIC_RESPONSE_VALIDATOR ); }
java
private RequestInvoker<CResponse> getBasicRequestInvoker( HttpRequestBase request, CPath path ) { return new RequestInvoker<CResponse>( new HttpRequestor( request, path, sessionManager ), BASIC_RESPONSE_VALIDATOR ); }
[ "private", "RequestInvoker", "<", "CResponse", ">", "getBasicRequestInvoker", "(", "HttpRequestBase", "request", ",", "CPath", "path", ")", "{", "return", "new", "RequestInvoker", "<", "CResponse", ">", "(", "new", "HttpRequestor", "(", "request", ",", "path", ",", "sessionManager", ")", ",", "BASIC_RESPONSE_VALIDATOR", ")", ";", "}" ]
An invoker that does not check response content type : to be used for files downloading @param request Http request @return the request invoker for basic requests
[ "An", "invoker", "that", "does", "not", "check", "response", "content", "type", ":", "to", "be", "used", "for", "files", "downloading" ]
train
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/providers/cloudme/CloudMe.java#L129-L133
mgormley/pacaya
src/main/java/edu/jhu/pacaya/parse/cky/intdata/IntNaryTree.java
IntNaryTree.readTreeInPtbFormat
public static IntNaryTree readTreeInPtbFormat(IntObjectBimap<String> lexAlphabet, IntObjectBimap<String> ntAlphabet, Reader reader) throws IOException { """ Reads a full tree in Penn Treebank format. Such a tree should include an outer set of parentheses. The returned tree will have initialized the start/end fields. """ QFiles.readUntilCharacter(reader, '('); IntNaryTree root = IntNaryTree.readSubtreeInPtbFormat(lexAlphabet, ntAlphabet, reader); QFiles.readUntilCharacter(reader, ')'); if (root == null) { return null; } root.updateStartEnd(); return root; }
java
public static IntNaryTree readTreeInPtbFormat(IntObjectBimap<String> lexAlphabet, IntObjectBimap<String> ntAlphabet, Reader reader) throws IOException { QFiles.readUntilCharacter(reader, '('); IntNaryTree root = IntNaryTree.readSubtreeInPtbFormat(lexAlphabet, ntAlphabet, reader); QFiles.readUntilCharacter(reader, ')'); if (root == null) { return null; } root.updateStartEnd(); return root; }
[ "public", "static", "IntNaryTree", "readTreeInPtbFormat", "(", "IntObjectBimap", "<", "String", ">", "lexAlphabet", ",", "IntObjectBimap", "<", "String", ">", "ntAlphabet", ",", "Reader", "reader", ")", "throws", "IOException", "{", "QFiles", ".", "readUntilCharacter", "(", "reader", ",", "'", "'", ")", ";", "IntNaryTree", "root", "=", "IntNaryTree", ".", "readSubtreeInPtbFormat", "(", "lexAlphabet", ",", "ntAlphabet", ",", "reader", ")", ";", "QFiles", ".", "readUntilCharacter", "(", "reader", ",", "'", "'", ")", ";", "if", "(", "root", "==", "null", ")", "{", "return", "null", ";", "}", "root", ".", "updateStartEnd", "(", ")", ";", "return", "root", ";", "}" ]
Reads a full tree in Penn Treebank format. Such a tree should include an outer set of parentheses. The returned tree will have initialized the start/end fields.
[ "Reads", "a", "full", "tree", "in", "Penn", "Treebank", "format", ".", "Such", "a", "tree", "should", "include", "an", "outer", "set", "of", "parentheses", ".", "The", "returned", "tree", "will", "have", "initialized", "the", "start", "/", "end", "fields", "." ]
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/parse/cky/intdata/IntNaryTree.java#L133-L142
javagl/ND
nd-tuples/src/main/java/de/javagl/nd/tuples/d/DoubleTuples.java
DoubleTuples.createSubTuple
static MutableDoubleTuple createSubTuple( MutableDoubleTuple parent, int fromIndex, int toIndex) { """ Creates a new tuple that is a <i>view</i> on the specified portion of the given parent. Changes in the parent will be visible in the returned tuple, and vice versa. @param parent The parent tuple @param fromIndex The start index in the parent, inclusive @param toIndex The end index in the parent, exclusive @throws NullPointerException If the given parent is <code>null</code> @throws IllegalArgumentException If the given indices are invalid. This is the case when <code>fromIndex &lt; 0</code>, <code>fromIndex &gt; toIndex</code>, or <code>toIndex &gt; {@link Tuple#getSize() parent.getSize()}</code>, @return The new tuple """ return new MutableSubDoubleTuple(parent, fromIndex, toIndex); }
java
static MutableDoubleTuple createSubTuple( MutableDoubleTuple parent, int fromIndex, int toIndex) { return new MutableSubDoubleTuple(parent, fromIndex, toIndex); }
[ "static", "MutableDoubleTuple", "createSubTuple", "(", "MutableDoubleTuple", "parent", ",", "int", "fromIndex", ",", "int", "toIndex", ")", "{", "return", "new", "MutableSubDoubleTuple", "(", "parent", ",", "fromIndex", ",", "toIndex", ")", ";", "}" ]
Creates a new tuple that is a <i>view</i> on the specified portion of the given parent. Changes in the parent will be visible in the returned tuple, and vice versa. @param parent The parent tuple @param fromIndex The start index in the parent, inclusive @param toIndex The end index in the parent, exclusive @throws NullPointerException If the given parent is <code>null</code> @throws IllegalArgumentException If the given indices are invalid. This is the case when <code>fromIndex &lt; 0</code>, <code>fromIndex &gt; toIndex</code>, or <code>toIndex &gt; {@link Tuple#getSize() parent.getSize()}</code>, @return The new tuple
[ "Creates", "a", "new", "tuple", "that", "is", "a", "<i", ">", "view<", "/", "i", ">", "on", "the", "specified", "portion", "of", "the", "given", "parent", ".", "Changes", "in", "the", "parent", "will", "be", "visible", "in", "the", "returned", "tuple", "and", "vice", "versa", "." ]
train
https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-tuples/src/main/java/de/javagl/nd/tuples/d/DoubleTuples.java#L248-L252
atomix/atomix
protocols/raft/src/main/java/io/atomix/protocols/raft/impl/OperationResult.java
OperationResult.succeeded
public static OperationResult succeeded(long index, long eventIndex, byte[] result) { """ Returns a successful operation result. @param index the result index @param eventIndex the session's last event index @param result the operation result value @return the operation result """ return new OperationResult(index, eventIndex, null, result); }
java
public static OperationResult succeeded(long index, long eventIndex, byte[] result) { return new OperationResult(index, eventIndex, null, result); }
[ "public", "static", "OperationResult", "succeeded", "(", "long", "index", ",", "long", "eventIndex", ",", "byte", "[", "]", "result", ")", "{", "return", "new", "OperationResult", "(", "index", ",", "eventIndex", ",", "null", ",", "result", ")", ";", "}" ]
Returns a successful operation result. @param index the result index @param eventIndex the session's last event index @param result the operation result value @return the operation result
[ "Returns", "a", "successful", "operation", "result", "." ]
train
https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/protocols/raft/src/main/java/io/atomix/protocols/raft/impl/OperationResult.java#L46-L48
auth0/Auth0.Android
auth0/src/main/java/com/auth0/android/authentication/storage/CryptoUtil.java
CryptoUtil.RSAEncrypt
@VisibleForTesting byte[] RSAEncrypt(byte[] decryptedInput) throws IncompatibleDeviceException, CryptoException { """ Encrypts the given input using a generated RSA Public Key. Used to encrypt the AES key for later storage. @param decryptedInput the input bytes to encrypt @return the encrypted 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 """ try { Certificate certificate = getRSAKeyEntry().getCertificate(); Cipher cipher = Cipher.getInstance(RSA_TRANSFORMATION); cipher.init(Cipher.ENCRYPT_MODE, certificate); return cipher.doFinal(decryptedInput); } 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 encrypt input using a RSA Key.", e); throw new IncompatibleDeviceException(e); } catch (IllegalBlockSizeException | BadPaddingException e) { /* * They really should not be thrown at all since padding is requested in the transformation. * Delete the AES keys since those originated the input. * * - IllegalBlockSizeException: * Thrown if no padding has been requested and the length is not multiple of block size. * - BadPaddingException: * Thrown only on decrypt mode. */ deleteAESKeys(); throw new CryptoException("The RSA decrypted input is invalid.", e); } }
java
@VisibleForTesting byte[] RSAEncrypt(byte[] decryptedInput) throws IncompatibleDeviceException, CryptoException { try { Certificate certificate = getRSAKeyEntry().getCertificate(); Cipher cipher = Cipher.getInstance(RSA_TRANSFORMATION); cipher.init(Cipher.ENCRYPT_MODE, certificate); return cipher.doFinal(decryptedInput); } 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 encrypt input using a RSA Key.", e); throw new IncompatibleDeviceException(e); } catch (IllegalBlockSizeException | BadPaddingException e) { /* * They really should not be thrown at all since padding is requested in the transformation. * Delete the AES keys since those originated the input. * * - IllegalBlockSizeException: * Thrown if no padding has been requested and the length is not multiple of block size. * - BadPaddingException: * Thrown only on decrypt mode. */ deleteAESKeys(); throw new CryptoException("The RSA decrypted input is invalid.", e); } }
[ "@", "VisibleForTesting", "byte", "[", "]", "RSAEncrypt", "(", "byte", "[", "]", "decryptedInput", ")", "throws", "IncompatibleDeviceException", ",", "CryptoException", "{", "try", "{", "Certificate", "certificate", "=", "getRSAKeyEntry", "(", ")", ".", "getCertificate", "(", ")", ";", "Cipher", "cipher", "=", "Cipher", ".", "getInstance", "(", "RSA_TRANSFORMATION", ")", ";", "cipher", ".", "init", "(", "Cipher", ".", "ENCRYPT_MODE", ",", "certificate", ")", ";", "return", "cipher", ".", "doFinal", "(", "decryptedInput", ")", ";", "}", "catch", "(", "NoSuchAlgorithmException", "|", "NoSuchPaddingException", "|", "InvalidKeyException", "e", ")", "{", "/*\n * This exceptions are safe to be ignored:\n *\n * - NoSuchPaddingException:\n * Thrown if PKCS1Padding is not available. Was introduced in API 1.\n * - NoSuchAlgorithmException:\n * Thrown if the transformation is null, empty or invalid, or if no security provider\n * implements it. Was introduced in API 1.\n * - InvalidKeyException:\n * Thrown if the given key is inappropriate for initializing this cipher.\n *\n * Read more in https://developer.android.com/reference/javax/crypto/Cipher\n */", "Log", ".", "e", "(", "TAG", ",", "\"The device can't encrypt input using a RSA Key.\"", ",", "e", ")", ";", "throw", "new", "IncompatibleDeviceException", "(", "e", ")", ";", "}", "catch", "(", "IllegalBlockSizeException", "|", "BadPaddingException", "e", ")", "{", "/*\n * They really should not be thrown at all since padding is requested in the transformation.\n * Delete the AES keys since those originated the input.\n *\n * - IllegalBlockSizeException:\n * Thrown if no padding has been requested and the length is not multiple of block size.\n * - BadPaddingException:\n * Thrown only on decrypt mode.\n */", "deleteAESKeys", "(", ")", ";", "throw", "new", "CryptoException", "(", "\"The RSA decrypted input is invalid.\"", ",", "e", ")", ";", "}", "}" ]
Encrypts the given input using a generated RSA Public Key. Used to encrypt the AES key for later storage. @param decryptedInput the input bytes to encrypt @return the encrypted 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
[ "Encrypts", "the", "given", "input", "using", "a", "generated", "RSA", "Public", "Key", ".", "Used", "to", "encrypt", "the", "AES", "key", "for", "later", "storage", "." ]
train
https://github.com/auth0/Auth0.Android/blob/ee37b7f94d989c1fbab2cb1378c87fdcaf7a8156/auth0/src/main/java/com/auth0/android/authentication/storage/CryptoUtil.java#L294-L330
google/closure-compiler
src/com/google/javascript/jscomp/type/SemanticReverseAbstractInterpreter.java
SemanticReverseAbstractInterpreter.maybeRestrictName
@CheckReturnValue private FlowScope maybeRestrictName( FlowScope blindScope, Node node, JSType originalType, JSType restrictedType) { """ If the restrictedType differs from the originalType, then we should branch the current flow scope and create a new flow scope with the name declared with the new type. <p>We try not to create spurious child flow scopes as this makes type inference slower. <p>We also do not want spurious slots around in type inference, because we use these as a signal for "checked unknown" types. A "checked unknown" type is a symbol that the programmer has already checked and verified that it's defined, even if we don't know what it is. <p>It is OK to pass non-name nodes into this method, as long as you pass in {@code null} for a restricted type. """ if (restrictedType != null && restrictedType != originalType) { return declareNameInScope(blindScope, node, restrictedType); } return blindScope; }
java
@CheckReturnValue private FlowScope maybeRestrictName( FlowScope blindScope, Node node, JSType originalType, JSType restrictedType) { if (restrictedType != null && restrictedType != originalType) { return declareNameInScope(blindScope, node, restrictedType); } return blindScope; }
[ "@", "CheckReturnValue", "private", "FlowScope", "maybeRestrictName", "(", "FlowScope", "blindScope", ",", "Node", "node", ",", "JSType", "originalType", ",", "JSType", "restrictedType", ")", "{", "if", "(", "restrictedType", "!=", "null", "&&", "restrictedType", "!=", "originalType", ")", "{", "return", "declareNameInScope", "(", "blindScope", ",", "node", ",", "restrictedType", ")", ";", "}", "return", "blindScope", ";", "}" ]
If the restrictedType differs from the originalType, then we should branch the current flow scope and create a new flow scope with the name declared with the new type. <p>We try not to create spurious child flow scopes as this makes type inference slower. <p>We also do not want spurious slots around in type inference, because we use these as a signal for "checked unknown" types. A "checked unknown" type is a symbol that the programmer has already checked and verified that it's defined, even if we don't know what it is. <p>It is OK to pass non-name nodes into this method, as long as you pass in {@code null} for a restricted type.
[ "If", "the", "restrictedType", "differs", "from", "the", "originalType", "then", "we", "should", "branch", "the", "current", "flow", "scope", "and", "create", "a", "new", "flow", "scope", "with", "the", "name", "declared", "with", "the", "new", "type", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/type/SemanticReverseAbstractInterpreter.java#L401-L408
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/runtime/config/DefaultDataGridConfig.java
DefaultDataGridConfig.createStateCodec
public DataGridStateCodec createStateCodec(ServletRequest request, String gridName) { """ Create a {@link DataGridStateCodec} for a grid with the given name for the given {@link ServletRequest}. @param request the current request @param gridName a data grid's name @return the state encoder / decoder for a data grid's request state """ DefaultDataGridStateCodec codec = new DefaultDataGridStateCodec(this); codec.setServletRequest(request); codec.setGridName(gridName); return codec; }
java
public DataGridStateCodec createStateCodec(ServletRequest request, String gridName) { DefaultDataGridStateCodec codec = new DefaultDataGridStateCodec(this); codec.setServletRequest(request); codec.setGridName(gridName); return codec; }
[ "public", "DataGridStateCodec", "createStateCodec", "(", "ServletRequest", "request", ",", "String", "gridName", ")", "{", "DefaultDataGridStateCodec", "codec", "=", "new", "DefaultDataGridStateCodec", "(", "this", ")", ";", "codec", ".", "setServletRequest", "(", "request", ")", ";", "codec", ".", "setGridName", "(", "gridName", ")", ";", "return", "codec", ";", "}" ]
Create a {@link DataGridStateCodec} for a grid with the given name for the given {@link ServletRequest}. @param request the current request @param gridName a data grid's name @return the state encoder / decoder for a data grid's request state
[ "Create", "a", "{" ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/runtime/config/DefaultDataGridConfig.java#L118-L123