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
andi12/msbuild-maven-plugin
msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/AbstractMSBuildPluginMojo.java
AbstractMSBuildPluginMojo.getParsedProject
protected VCProject getParsedProject( String targetName, BuildPlatform platform, BuildConfiguration configuration ) throws MojoExecutionException { """ Return the project configuration for the specified target, platform and configuration Note: This is only valid for solutions as target names don't apply for a standalone project file @param targetName the target to look for @param platform the platform to parse for @param configuration the configuration to parse for @return the VCProject for the specified target @throws MojoExecutionException if the requested project cannot be identified """ List<VCProject> projects = getParsedProjects( platform, configuration ); for ( VCProject project : projects ) { if ( targetName.equals( project.getTargetName() ) ) { return project; } } throw new MojoExecutionException( "Target '" + targetName + "' not found in project files" ); }
java
protected VCProject getParsedProject( String targetName, BuildPlatform platform, BuildConfiguration configuration ) throws MojoExecutionException { List<VCProject> projects = getParsedProjects( platform, configuration ); for ( VCProject project : projects ) { if ( targetName.equals( project.getTargetName() ) ) { return project; } } throw new MojoExecutionException( "Target '" + targetName + "' not found in project files" ); }
[ "protected", "VCProject", "getParsedProject", "(", "String", "targetName", ",", "BuildPlatform", "platform", ",", "BuildConfiguration", "configuration", ")", "throws", "MojoExecutionException", "{", "List", "<", "VCProject", ">", "projects", "=", "getParsedProjects", "(...
Return the project configuration for the specified target, platform and configuration Note: This is only valid for solutions as target names don't apply for a standalone project file @param targetName the target to look for @param platform the platform to parse for @param configuration the configuration to parse for @return the VCProject for the specified target @throws MojoExecutionException if the requested project cannot be identified
[ "Return", "the", "project", "configuration", "for", "the", "specified", "target", "platform", "and", "configuration", "Note", ":", "This", "is", "only", "valid", "for", "solutions", "as", "target", "names", "don", "t", "apply", "for", "a", "standalone", "proje...
train
https://github.com/andi12/msbuild-maven-plugin/blob/224159c15efba20d482f8c630f7947339b1a1b86/msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/AbstractMSBuildPluginMojo.java#L397-L409
rundeck/rundeck
rundeck-storage/rundeck-storage-api/src/main/java/org/rundeck/storage/api/PathUtil.java
PathUtil.appendPath
public static String appendPath(String prefixPath, String subpath) { """ Append one path to another @param prefixPath prefix @param subpath sub path @return sub path appended to the prefix """ return cleanPath(prefixPath) + SEPARATOR + cleanPath(subpath); }
java
public static String appendPath(String prefixPath, String subpath) { return cleanPath(prefixPath) + SEPARATOR + cleanPath(subpath); }
[ "public", "static", "String", "appendPath", "(", "String", "prefixPath", ",", "String", "subpath", ")", "{", "return", "cleanPath", "(", "prefixPath", ")", "+", "SEPARATOR", "+", "cleanPath", "(", "subpath", ")", ";", "}" ]
Append one path to another @param prefixPath prefix @param subpath sub path @return sub path appended to the prefix
[ "Append", "one", "path", "to", "another" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/rundeck-storage/rundeck-storage-api/src/main/java/org/rundeck/storage/api/PathUtil.java#L255-L257
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java
AppServiceEnvironmentsInner.resumeWithServiceResponseAsync
public Observable<ServiceResponse<Page<SiteInner>>> resumeWithServiceResponseAsync(final String resourceGroupName, final String name) { """ Resume an App Service Environment. Resume an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;SiteInner&gt; object """ return resumeSinglePageAsync(resourceGroupName, name) .concatMap(new Func1<ServiceResponse<Page<SiteInner>>, Observable<ServiceResponse<Page<SiteInner>>>>() { @Override public Observable<ServiceResponse<Page<SiteInner>>> call(ServiceResponse<Page<SiteInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(resumeNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<SiteInner>>> resumeWithServiceResponseAsync(final String resourceGroupName, final String name) { return resumeSinglePageAsync(resourceGroupName, name) .concatMap(new Func1<ServiceResponse<Page<SiteInner>>, Observable<ServiceResponse<Page<SiteInner>>>>() { @Override public Observable<ServiceResponse<Page<SiteInner>>> call(ServiceResponse<Page<SiteInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(resumeNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "SiteInner", ">", ">", ">", "resumeWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "name", ")", "{", "return", "resumeSinglePageAsync", "(", "resourceGr...
Resume an App Service Environment. Resume an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;SiteInner&gt; object
[ "Resume", "an", "App", "Service", "Environment", ".", "Resume", "an", "App", "Service", "Environment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L3869-L3881
biezhi/anima
src/main/java/io/github/biezhi/anima/core/AnimaQuery.java
AnimaQuery.queryOne
public <S> S queryOne(Class<S> type, String sql, Object[] params) { """ Querying a model @param type model type @param sql sql statement @param params params @param <S> @return S """ Connection conn = getConn(); try { Query query = conn.createQuery(sql) .withParams(params) .setAutoDeriveColumnNames(true) .throwOnMappingFailure(false); return ifReturn(AnimaUtils.isBasicType(type), () -> query.executeScalar(type), () -> query.executeAndFetchFirst(type)); } finally { this.closeConn(conn); this.clean(null); } }
java
public <S> S queryOne(Class<S> type, String sql, Object[] params) { Connection conn = getConn(); try { Query query = conn.createQuery(sql) .withParams(params) .setAutoDeriveColumnNames(true) .throwOnMappingFailure(false); return ifReturn(AnimaUtils.isBasicType(type), () -> query.executeScalar(type), () -> query.executeAndFetchFirst(type)); } finally { this.closeConn(conn); this.clean(null); } }
[ "public", "<", "S", ">", "S", "queryOne", "(", "Class", "<", "S", ">", "type", ",", "String", "sql", ",", "Object", "[", "]", "params", ")", "{", "Connection", "conn", "=", "getConn", "(", ")", ";", "try", "{", "Query", "query", "=", "conn", ".",...
Querying a model @param type model type @param sql sql statement @param params params @param <S> @return S
[ "Querying", "a", "model" ]
train
https://github.com/biezhi/anima/blob/d6655e47ac4c08d9d7f961ac0569062bead8b1ed/src/main/java/io/github/biezhi/anima/core/AnimaQuery.java#L1072-L1087
lucee/Lucee
core/src/main/java/lucee/commons/sql/SQLUtil.java
SQLUtil.toClob
public static Clob toClob(Connection conn, Object value) throws PageException, SQLException { """ create a clob Object @param conn @param value @return @throws PageException @throws SQLException """ if (value instanceof Clob) return (Clob) value; // Java >= 1.6 if (SystemUtil.JAVA_VERSION >= SystemUtil.JAVA_VERSION_6) { Clob clob = conn.createClob(); clob.setString(1, Caster.toString(value)); return clob; } // Java < 1.6 if (isOracle(conn)) { Clob clob = OracleClob.createClob(conn, Caster.toString(value), null); if (clob != null) return clob; } return ClobImpl.toClob(value); }
java
public static Clob toClob(Connection conn, Object value) throws PageException, SQLException { if (value instanceof Clob) return (Clob) value; // Java >= 1.6 if (SystemUtil.JAVA_VERSION >= SystemUtil.JAVA_VERSION_6) { Clob clob = conn.createClob(); clob.setString(1, Caster.toString(value)); return clob; } // Java < 1.6 if (isOracle(conn)) { Clob clob = OracleClob.createClob(conn, Caster.toString(value), null); if (clob != null) return clob; } return ClobImpl.toClob(value); }
[ "public", "static", "Clob", "toClob", "(", "Connection", "conn", ",", "Object", "value", ")", "throws", "PageException", ",", "SQLException", "{", "if", "(", "value", "instanceof", "Clob", ")", "return", "(", "Clob", ")", "value", ";", "// Java >= 1.6", "if"...
create a clob Object @param conn @param value @return @throws PageException @throws SQLException
[ "create", "a", "clob", "Object" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/sql/SQLUtil.java#L157-L172
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
NodeIndexer.addPathValue
protected void addPathValue(Document doc, String fieldName, Object pathString) { """ Adds the path value to the document as the named field. The path value is converted to an indexable string value using the name space mappings with which this class has been created. @param doc The document to which to add the field @param fieldName The name of the field to add @param pathString The value for the field to add to the document. """ doc.add(createFieldWithoutNorms(fieldName, pathString.toString(), PropertyType.PATH)); }
java
protected void addPathValue(Document doc, String fieldName, Object pathString) { doc.add(createFieldWithoutNorms(fieldName, pathString.toString(), PropertyType.PATH)); }
[ "protected", "void", "addPathValue", "(", "Document", "doc", ",", "String", "fieldName", ",", "Object", "pathString", ")", "{", "doc", ".", "add", "(", "createFieldWithoutNorms", "(", "fieldName", ",", "pathString", ".", "toString", "(", ")", ",", "PropertyTyp...
Adds the path value to the document as the named field. The path value is converted to an indexable string value using the name space mappings with which this class has been created. @param doc The document to which to add the field @param fieldName The name of the field to add @param pathString The value for the field to add to the document.
[ "Adds", "the", "path", "value", "to", "the", "document", "as", "the", "named", "field", ".", "The", "path", "value", "is", "converted", "to", "an", "indexable", "string", "value", "using", "the", "name", "space", "mappings", "with", "which", "this", "class...
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java#L807-L811
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.getPrebuiltEntityRole
public EntityRole getPrebuiltEntityRole(UUID appId, String versionId, UUID entityId, UUID roleId) { """ Get one entity role for a given entity. @param appId The application ID. @param versionId The version ID. @param entityId entity ID. @param roleId entity role ID. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the EntityRole object if successful. """ return getPrebuiltEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).toBlocking().single().body(); }
java
public EntityRole getPrebuiltEntityRole(UUID appId, String versionId, UUID entityId, UUID roleId) { return getPrebuiltEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).toBlocking().single().body(); }
[ "public", "EntityRole", "getPrebuiltEntityRole", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "entityId", ",", "UUID", "roleId", ")", "{", "return", "getPrebuiltEntityRoleWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "entityId", "...
Get one entity role for a given entity. @param appId The application ID. @param versionId The version ID. @param entityId entity ID. @param roleId entity role ID. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the EntityRole object if successful.
[ "Get", "one", "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#L11145-L11147
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java
SerializedFormBuilder.buildFieldSubHeader
public void buildFieldSubHeader(XMLNode node, Content fieldsContentTree) { """ Build the field sub header. @param node the XML element that specifies which components to document @param fieldsContentTree content tree to which the documentation will be added """ if (!utils.definesSerializableFields(currentTypeElement)) { VariableElement field = (VariableElement) currentMember; fieldWriter.addMemberHeader(utils.asTypeElement(field.asType()), utils.getTypeName(field.asType(), false), utils.getDimension(field.asType()), utils.getSimpleName(field), fieldsContentTree); } }
java
public void buildFieldSubHeader(XMLNode node, Content fieldsContentTree) { if (!utils.definesSerializableFields(currentTypeElement)) { VariableElement field = (VariableElement) currentMember; fieldWriter.addMemberHeader(utils.asTypeElement(field.asType()), utils.getTypeName(field.asType(), false), utils.getDimension(field.asType()), utils.getSimpleName(field), fieldsContentTree); } }
[ "public", "void", "buildFieldSubHeader", "(", "XMLNode", "node", ",", "Content", "fieldsContentTree", ")", "{", "if", "(", "!", "utils", ".", "definesSerializableFields", "(", "currentTypeElement", ")", ")", "{", "VariableElement", "field", "=", "(", "VariableElem...
Build the field sub header. @param node the XML element that specifies which components to document @param fieldsContentTree content tree to which the documentation will be added
[ "Build", "the", "field", "sub", "header", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java#L454-L462
Stratio/bdt
src/main/java/com/stratio/qa/specs/KafkaSpec.java
KafkaSpec.topicToFile
@When("^I copy the kafka topic '(.*?)' to file '(.*?)' with headers '(.*?)'$") public void topicToFile(String topic_name, String filename, String header) throws Exception { """ Copy Kafka Topic content to file @param topic_name @param filename @param header @throws Exception """ commonspec.getKafkaUtils().resultsToFile(topic_name, filename, header); }
java
@When("^I copy the kafka topic '(.*?)' to file '(.*?)' with headers '(.*?)'$") public void topicToFile(String topic_name, String filename, String header) throws Exception { commonspec.getKafkaUtils().resultsToFile(topic_name, filename, header); }
[ "@", "When", "(", "\"^I copy the kafka topic '(.*?)' to file '(.*?)' with headers '(.*?)'$\"", ")", "public", "void", "topicToFile", "(", "String", "topic_name", ",", "String", "filename", ",", "String", "header", ")", "throws", "Exception", "{", "commonspec", ".", "get...
Copy Kafka Topic content to file @param topic_name @param filename @param header @throws Exception
[ "Copy", "Kafka", "Topic", "content", "to", "file" ]
train
https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/KafkaSpec.java#L85-L88
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/dsl/functions/PatternMatchingFunctions.java
PatternMatchingFunctions.regexpReplace
public static Expression regexpReplace(Expression expression, String pattern, String repl) { """ Returned expression results in a new string with all occurrences of pattern replaced with repl. """ return x("REGEXP_REPLACE(" + expression.toString() + ", \"" + pattern + "\", \"" + repl + "\")"); }
java
public static Expression regexpReplace(Expression expression, String pattern, String repl) { return x("REGEXP_REPLACE(" + expression.toString() + ", \"" + pattern + "\", \"" + repl + "\")"); }
[ "public", "static", "Expression", "regexpReplace", "(", "Expression", "expression", ",", "String", "pattern", ",", "String", "repl", ")", "{", "return", "x", "(", "\"REGEXP_REPLACE(\"", "+", "expression", ".", "toString", "(", ")", "+", "\", \\\"\"", "+", "pat...
Returned expression results in a new string with all occurrences of pattern replaced with repl.
[ "Returned", "expression", "results", "in", "a", "new", "string", "with", "all", "occurrences", "of", "pattern", "replaced", "with", "repl", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/PatternMatchingFunctions.java#L100-L102
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCameraRig.java
GVRCameraRig.setVec4
public void setVec4(String key, float x, float y, float z, float w) { """ Map a four-component {@code float} vector to {@code key}. @param key Key to map the vector to. @param x 'X' component of vector. @param y 'Y' component of vector. @param z 'Z' component of vector. @param w 'W' component of vector. """ checkStringNotNullOrEmpty("key", key); NativeCameraRig.setVec4(getNative(), key, x, y, z, w); }
java
public void setVec4(String key, float x, float y, float z, float w) { checkStringNotNullOrEmpty("key", key); NativeCameraRig.setVec4(getNative(), key, x, y, z, w); }
[ "public", "void", "setVec4", "(", "String", "key", ",", "float", "x", ",", "float", "y", ",", "float", "z", ",", "float", "w", ")", "{", "checkStringNotNullOrEmpty", "(", "\"key\"", ",", "key", ")", ";", "NativeCameraRig", ".", "setVec4", "(", "getNative...
Map a four-component {@code float} vector to {@code key}. @param key Key to map the vector to. @param x 'X' component of vector. @param y 'Y' component of vector. @param z 'Z' component of vector. @param w 'W' component of vector.
[ "Map", "a", "four", "-", "component", "{", "@code", "float", "}", "vector", "to", "{", "@code", "key", "}", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCameraRig.java#L305-L308
allure-framework/allure-java
allure-java-commons/src/main/java/io/qameta/allure/AllureLifecycle.java
AllureLifecycle.updateFixture
public void updateFixture(final String uuid, final Consumer<FixtureResult> update) { """ Updates fixture by given uuid. @param uuid the uuid of fixture. @param update the update function. """ final Optional<FixtureResult> found = storage.getFixture(uuid); if (!found.isPresent()) { LOGGER.error("Could not update test fixture: test fixture with uuid {} not found", uuid); return; } final FixtureResult fixture = found.get(); notifier.beforeFixtureUpdate(fixture); update.accept(fixture); notifier.afterFixtureUpdate(fixture); }
java
public void updateFixture(final String uuid, final Consumer<FixtureResult> update) { final Optional<FixtureResult> found = storage.getFixture(uuid); if (!found.isPresent()) { LOGGER.error("Could not update test fixture: test fixture with uuid {} not found", uuid); return; } final FixtureResult fixture = found.get(); notifier.beforeFixtureUpdate(fixture); update.accept(fixture); notifier.afterFixtureUpdate(fixture); }
[ "public", "void", "updateFixture", "(", "final", "String", "uuid", ",", "final", "Consumer", "<", "FixtureResult", ">", "update", ")", "{", "final", "Optional", "<", "FixtureResult", ">", "found", "=", "storage", ".", "getFixture", "(", "uuid", ")", ";", "...
Updates fixture by given uuid. @param uuid the uuid of fixture. @param update the update function.
[ "Updates", "fixture", "by", "given", "uuid", "." ]
train
https://github.com/allure-framework/allure-java/blob/64015ca2b789aa6f7b19c793f1512e2f11d0174e/allure-java-commons/src/main/java/io/qameta/allure/AllureLifecycle.java#L248-L259
ZieIony/Carbon
carbon/src/main/java/carbon/drawable/ripple/LayerDrawable.java
LayerDrawable.setPadding
public void setPadding(int left, int top, int right, int bottom) { """ Sets the absolute padding. <p/> If padding in a dimension is specified as {@code -1}, the resolved padding will use the value computed according to the padding mode (see {@link #setPaddingMode(int)}). <p/> Calling this method clears any relative padding values previously set using {@link #setPaddingRelative(int, int, int, int)}. @param left the left padding in pixels, or -1 to use computed padding @param top the top padding in pixels, or -1 to use computed padding @param right the right padding in pixels, or -1 to use computed padding @param bottom the bottom padding in pixels, or -1 to use computed padding @attr ref android.R.styleable#LayerDrawable_paddingLeft @attr ref android.R.styleable#LayerDrawable_paddingTop @attr ref android.R.styleable#LayerDrawable_paddingRight @attr ref android.R.styleable#LayerDrawable_paddingBottom @see #setPaddingRelative(int, int, int, int) """ final LayerState layerState = mLayerState; layerState.mPaddingLeft = left; layerState.mPaddingTop = top; layerState.mPaddingRight = right; layerState.mPaddingBottom = bottom; // Clear relative padding values. layerState.mPaddingStart = -1; layerState.mPaddingEnd = -1; }
java
public void setPadding(int left, int top, int right, int bottom) { final LayerState layerState = mLayerState; layerState.mPaddingLeft = left; layerState.mPaddingTop = top; layerState.mPaddingRight = right; layerState.mPaddingBottom = bottom; // Clear relative padding values. layerState.mPaddingStart = -1; layerState.mPaddingEnd = -1; }
[ "public", "void", "setPadding", "(", "int", "left", ",", "int", "top", ",", "int", "right", ",", "int", "bottom", ")", "{", "final", "LayerState", "layerState", "=", "mLayerState", ";", "layerState", ".", "mPaddingLeft", "=", "left", ";", "layerState", "."...
Sets the absolute padding. <p/> If padding in a dimension is specified as {@code -1}, the resolved padding will use the value computed according to the padding mode (see {@link #setPaddingMode(int)}). <p/> Calling this method clears any relative padding values previously set using {@link #setPaddingRelative(int, int, int, int)}. @param left the left padding in pixels, or -1 to use computed padding @param top the top padding in pixels, or -1 to use computed padding @param right the right padding in pixels, or -1 to use computed padding @param bottom the bottom padding in pixels, or -1 to use computed padding @attr ref android.R.styleable#LayerDrawable_paddingLeft @attr ref android.R.styleable#LayerDrawable_paddingTop @attr ref android.R.styleable#LayerDrawable_paddingRight @attr ref android.R.styleable#LayerDrawable_paddingBottom @see #setPaddingRelative(int, int, int, int)
[ "Sets", "the", "absolute", "padding", ".", "<p", "/", ">", "If", "padding", "in", "a", "dimension", "is", "specified", "as", "{", "@code", "-", "1", "}", "the", "resolved", "padding", "will", "use", "the", "value", "computed", "according", "to", "the", ...
train
https://github.com/ZieIony/Carbon/blob/78b0a432bd49edc7a6a13ce111cab274085d1693/carbon/src/main/java/carbon/drawable/ripple/LayerDrawable.java#L940-L950
apache/incubator-heron
heron/api/src/java/org/apache/heron/api/topology/TopologyBuilder.java
TopologyBuilder.setBolt
@SuppressWarnings("rawtypes") public <K extends Serializable, V extends Serializable> BoltDeclarer setBolt( String id, IStatefulWindowedBolt<K, V> bolt) throws IllegalArgumentException { """ Define a new bolt in this topology. This defines a stateful windowed bolt, intended for stateful windowing operations. The {@link IStatefulWindowedBolt#execute(TupleWindow)} method is triggered for each window interval with the list of current events in the window. During initialization of this bolt (potentially after failure) {@link IStatefulWindowedBolt#initState(State)} is invoked with its previously saved state. @param id the id of this component. This id is referenced by other components that want to consume this bolt's outputs. @param bolt the stateful windowed bolt @param <K> Type of key for {@link org.apache.heron.api.state.HashMapState} @param <V> Type of value for {@link org.apache.heron.api.state.HashMapState} @return use the returned object to declare the inputs to this component @throws IllegalArgumentException {@code parallelism_hint} is not positive """ return setBolt(id, bolt, null); }
java
@SuppressWarnings("rawtypes") public <K extends Serializable, V extends Serializable> BoltDeclarer setBolt( String id, IStatefulWindowedBolt<K, V> bolt) throws IllegalArgumentException { return setBolt(id, bolt, null); }
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "public", "<", "K", "extends", "Serializable", ",", "V", "extends", "Serializable", ">", "BoltDeclarer", "setBolt", "(", "String", "id", ",", "IStatefulWindowedBolt", "<", "K", ",", "V", ">", "bolt", ")", "t...
Define a new bolt in this topology. This defines a stateful windowed bolt, intended for stateful windowing operations. The {@link IStatefulWindowedBolt#execute(TupleWindow)} method is triggered for each window interval with the list of current events in the window. During initialization of this bolt (potentially after failure) {@link IStatefulWindowedBolt#initState(State)} is invoked with its previously saved state. @param id the id of this component. This id is referenced by other components that want to consume this bolt's outputs. @param bolt the stateful windowed bolt @param <K> Type of key for {@link org.apache.heron.api.state.HashMapState} @param <V> Type of value for {@link org.apache.heron.api.state.HashMapState} @return use the returned object to declare the inputs to this component @throws IllegalArgumentException {@code parallelism_hint} is not positive
[ "Define", "a", "new", "bolt", "in", "this", "topology", ".", "This", "defines", "a", "stateful", "windowed", "bolt", "intended", "for", "stateful", "windowing", "operations", ".", "The", "{" ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/api/src/java/org/apache/heron/api/topology/TopologyBuilder.java#L210-L215
spotify/ssh-agent-proxy
src/main/java/com/spotify/sshagentproxy/AgentOutput.java
AgentOutput.writeField
private static void writeField(final OutputStream out, final byte[] bytes) throws IOException { """ Write bytes to an {@link OutputStream} and prepend with four bytes indicating their length. @param out {@link OutputStream} @param bytes Array of bytes. """ // All protocol messages are prefixed with their length in bytes, encoded // as a 32 bit unsigned integer. final ByteBuffer buffer = ByteBuffer.allocate(INT_BYTES + bytes.length); buffer.putInt(bytes.length); buffer.put(bytes); out.write(buffer.array()); out.flush(); }
java
private static void writeField(final OutputStream out, final byte[] bytes) throws IOException { // All protocol messages are prefixed with their length in bytes, encoded // as a 32 bit unsigned integer. final ByteBuffer buffer = ByteBuffer.allocate(INT_BYTES + bytes.length); buffer.putInt(bytes.length); buffer.put(bytes); out.write(buffer.array()); out.flush(); }
[ "private", "static", "void", "writeField", "(", "final", "OutputStream", "out", ",", "final", "byte", "[", "]", "bytes", ")", "throws", "IOException", "{", "// All protocol messages are prefixed with their length in bytes, encoded", "// as a 32 bit unsigned integer.", "final"...
Write bytes to an {@link OutputStream} and prepend with four bytes indicating their length. @param out {@link OutputStream} @param bytes Array of bytes.
[ "Write", "bytes", "to", "an", "{" ]
train
https://github.com/spotify/ssh-agent-proxy/blob/b678792750c0157bd5ed3fb6a18895ff95effbc4/src/main/java/com/spotify/sshagentproxy/AgentOutput.java#L96-L105
ModeShape/modeshape
modeshape-common/src/main/java/org/modeshape/common/util/SecureHash.java
SecureHash.createHashingReader
public static HashingReader createHashingReader( String digestName, Reader reader, Charset charset ) throws NoSuchAlgorithmException { """ Create an Reader instance that wraps another reader and that computes the secure hash (using the algorithm with the supplied name) as the returned Reader is used. This can be used to compute the hash while the content is being processed, and saves from having to process the same content twice. @param digestName the name of the hashing function (or {@link MessageDigest message digest}) that should be used @param reader the reader containing the content that is to be hashed @param charset the character set used within the supplied reader; may not be null @return the hash of the contents as a byte array @throws NoSuchAlgorithmException """ MessageDigest digest = MessageDigest.getInstance(digestName); return new HashingReader(digest, reader, charset); }
java
public static HashingReader createHashingReader( String digestName, Reader reader, Charset charset ) throws NoSuchAlgorithmException { MessageDigest digest = MessageDigest.getInstance(digestName); return new HashingReader(digest, reader, charset); }
[ "public", "static", "HashingReader", "createHashingReader", "(", "String", "digestName", ",", "Reader", "reader", ",", "Charset", "charset", ")", "throws", "NoSuchAlgorithmException", "{", "MessageDigest", "digest", "=", "MessageDigest", ".", "getInstance", "(", "dige...
Create an Reader instance that wraps another reader and that computes the secure hash (using the algorithm with the supplied name) as the returned Reader is used. This can be used to compute the hash while the content is being processed, and saves from having to process the same content twice. @param digestName the name of the hashing function (or {@link MessageDigest message digest}) that should be used @param reader the reader containing the content that is to be hashed @param charset the character set used within the supplied reader; may not be null @return the hash of the contents as a byte array @throws NoSuchAlgorithmException
[ "Create", "an", "Reader", "instance", "that", "wraps", "another", "reader", "and", "that", "computes", "the", "secure", "hash", "(", "using", "the", "algorithm", "with", "the", "supplied", "name", ")", "as", "the", "returned", "Reader", "is", "used", ".", ...
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/SecureHash.java#L314-L319
SonarSource/sonarqube
sonar-plugin-api/src/main/java/org/sonar/api/notifications/Notification.java
Notification.setFieldValue
public Notification setFieldValue(String field, @Nullable String value) { """ Adds a field (kind of property) to the notification @param field the name of the field (= the key) @param value the value of the field @return the notification itself """ fields.put(field, value); return this; }
java
public Notification setFieldValue(String field, @Nullable String value) { fields.put(field, value); return this; }
[ "public", "Notification", "setFieldValue", "(", "String", "field", ",", "@", "Nullable", "String", "value", ")", "{", "fields", ".", "put", "(", "field", ",", "value", ")", ";", "return", "this", ";", "}" ]
Adds a field (kind of property) to the notification @param field the name of the field (= the key) @param value the value of the field @return the notification itself
[ "Adds", "a", "field", "(", "kind", "of", "property", ")", "to", "the", "notification" ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/notifications/Notification.java#L104-L107
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/bcp/FieldAccess.java
FieldAccess.checkConsistent
protected MatchResult checkConsistent(Variable field, Variable value, BindingSet bindingSet) { """ Check that the Variables determined for the field and the value loaded/stored are consistent with previous variable definitions. @param field Variable representing the field @param value Variable representing the value loaded/stored @param bindingSet previous definitions @return a MatchResult containing an updated BindingSet if successful, or null if unsuccessful """ // Ensure that the field and value variables are consistent with // previous definitions (if any) bindingSet = addOrCheckDefinition(fieldVarName, field, bindingSet); if (bindingSet == null) { return null; } bindingSet = addOrCheckDefinition(valueVarName, value, bindingSet); if (bindingSet == null) { return null; } return new MatchResult(this, bindingSet); }
java
protected MatchResult checkConsistent(Variable field, Variable value, BindingSet bindingSet) { // Ensure that the field and value variables are consistent with // previous definitions (if any) bindingSet = addOrCheckDefinition(fieldVarName, field, bindingSet); if (bindingSet == null) { return null; } bindingSet = addOrCheckDefinition(valueVarName, value, bindingSet); if (bindingSet == null) { return null; } return new MatchResult(this, bindingSet); }
[ "protected", "MatchResult", "checkConsistent", "(", "Variable", "field", ",", "Variable", "value", ",", "BindingSet", "bindingSet", ")", "{", "// Ensure that the field and value variables are consistent with", "// previous definitions (if any)", "bindingSet", "=", "addOrCheckDefi...
Check that the Variables determined for the field and the value loaded/stored are consistent with previous variable definitions. @param field Variable representing the field @param value Variable representing the value loaded/stored @param bindingSet previous definitions @return a MatchResult containing an updated BindingSet if successful, or null if unsuccessful
[ "Check", "that", "the", "Variables", "determined", "for", "the", "field", "and", "the", "value", "loaded", "/", "stored", "are", "consistent", "with", "previous", "variable", "definitions", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/bcp/FieldAccess.java#L71-L83
Impetus/Kundera
src/kundera-couchbase/src/main/java/com/impetus/client/couchbase/CouchbaseClient.java
CouchbaseClient.executeNativeQuery
public List executeNativeQuery(String n1qlQuery, EntityMetadata em) { """ Execute native query. @param n1qlQuery the n1ql query @param em the entity manager @return the list """ N1qlQueryResult result = bucket .query(N1qlQuery.simple(n1qlQuery, N1qlParams.build().consistency(ScanConsistency.REQUEST_PLUS))); LOGGER.debug("Executed query : " + n1qlQuery + " on the " + bucket.name() + " Bucket"); validateQueryResults(n1qlQuery, result); return result.allRows(); }
java
public List executeNativeQuery(String n1qlQuery, EntityMetadata em) { N1qlQueryResult result = bucket .query(N1qlQuery.simple(n1qlQuery, N1qlParams.build().consistency(ScanConsistency.REQUEST_PLUS))); LOGGER.debug("Executed query : " + n1qlQuery + " on the " + bucket.name() + " Bucket"); validateQueryResults(n1qlQuery, result); return result.allRows(); }
[ "public", "List", "executeNativeQuery", "(", "String", "n1qlQuery", ",", "EntityMetadata", "em", ")", "{", "N1qlQueryResult", "result", "=", "bucket", ".", "query", "(", "N1qlQuery", ".", "simple", "(", "n1qlQuery", ",", "N1qlParams", ".", "build", "(", ")", ...
Execute native query. @param n1qlQuery the n1ql query @param em the entity manager @return the list
[ "Execute", "native", "query", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-couchbase/src/main/java/com/impetus/client/couchbase/CouchbaseClient.java#L357-L366
facebookarchive/hadoop-20
src/contrib/gridmix/src/java/org/apache/hadoop/mapred/gridmix/FilePool.java
FilePool.getInputFiles
public long getInputFiles(long minSize, Collection<FileStatus> files) throws IOException { """ Gather a collection of files at least as large as minSize. @return The total size of files returned. """ updateLock.readLock().lock(); try { return root.selectFiles(minSize, files); } finally { updateLock.readLock().unlock(); } }
java
public long getInputFiles(long minSize, Collection<FileStatus> files) throws IOException { updateLock.readLock().lock(); try { return root.selectFiles(minSize, files); } finally { updateLock.readLock().unlock(); } }
[ "public", "long", "getInputFiles", "(", "long", "minSize", ",", "Collection", "<", "FileStatus", ">", "files", ")", "throws", "IOException", "{", "updateLock", ".", "readLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "return", "root", ".", "sel...
Gather a collection of files at least as large as minSize. @return The total size of files returned.
[ "Gather", "a", "collection", "of", "files", "at", "least", "as", "large", "as", "minSize", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/gridmix/src/java/org/apache/hadoop/mapred/gridmix/FilePool.java#L82-L90
KyoriPowered/lunar
src/main/java/net/kyori/lunar/exception/Exceptions.java
Exceptions.getOrRethrow
public static <T, E extends Throwable> @NonNull T getOrRethrow(final @NonNull ThrowingSupplier<T, E> supplier) { """ Gets the result of {@code supplier}, or re-throws an exception, sneakily. @param supplier the supplier @param <T> the result type @param <E> the exception type @return the result """ return supplier.get(); // get() rethrows for us }
java
public static <T, E extends Throwable> @NonNull T getOrRethrow(final @NonNull ThrowingSupplier<T, E> supplier) { return supplier.get(); // get() rethrows for us }
[ "public", "static", "<", "T", ",", "E", "extends", "Throwable", ">", "@", "NonNull", "T", "getOrRethrow", "(", "final", "@", "NonNull", "ThrowingSupplier", "<", "T", ",", "E", ">", "supplier", ")", "{", "return", "supplier", ".", "get", "(", ")", ";", ...
Gets the result of {@code supplier}, or re-throws an exception, sneakily. @param supplier the supplier @param <T> the result type @param <E> the exception type @return the result
[ "Gets", "the", "result", "of", "{", "@code", "supplier", "}", "or", "re", "-", "throws", "an", "exception", "sneakily", "." ]
train
https://github.com/KyoriPowered/lunar/blob/6856747d9034a2fe0c8d0a8a0150986797732b5c/src/main/java/net/kyori/lunar/exception/Exceptions.java#L258-L260
impossibl/stencil
engine/src/main/java/com/impossibl/stencil/engine/internal/StencilOperands.java
StencilOperands.narrowBigDecimal
protected Number narrowBigDecimal(Object lhs, Object rhs, BigDecimal bigd) { """ Given a BigDecimal, attempt to narrow it to an Integer or Long if it fits if one of the arguments is a numberable. @param lhs the left hand side operand that lead to the bigd result @param rhs the right hand side operand that lead to the bigd result @param bigd the BigDecimal to narrow @return an Integer or Long if narrowing is possible, the original BigInteger otherwise """ if (isNumberable(lhs) || isNumberable(rhs)) { try { long l = bigd.longValueExact(); // coerce to int when possible (int being so often used in method parms) if (l <= Integer.MAX_VALUE && l >= Integer.MIN_VALUE) { return Integer.valueOf((int) l); } else { return Long.valueOf(l); } } catch (ArithmeticException xa) { // ignore, no exact value possible } } return bigd; }
java
protected Number narrowBigDecimal(Object lhs, Object rhs, BigDecimal bigd) { if (isNumberable(lhs) || isNumberable(rhs)) { try { long l = bigd.longValueExact(); // coerce to int when possible (int being so often used in method parms) if (l <= Integer.MAX_VALUE && l >= Integer.MIN_VALUE) { return Integer.valueOf((int) l); } else { return Long.valueOf(l); } } catch (ArithmeticException xa) { // ignore, no exact value possible } } return bigd; }
[ "protected", "Number", "narrowBigDecimal", "(", "Object", "lhs", ",", "Object", "rhs", ",", "BigDecimal", "bigd", ")", "{", "if", "(", "isNumberable", "(", "lhs", ")", "||", "isNumberable", "(", "rhs", ")", ")", "{", "try", "{", "long", "l", "=", "bigd...
Given a BigDecimal, attempt to narrow it to an Integer or Long if it fits if one of the arguments is a numberable. @param lhs the left hand side operand that lead to the bigd result @param rhs the right hand side operand that lead to the bigd result @param bigd the BigDecimal to narrow @return an Integer or Long if narrowing is possible, the original BigInteger otherwise
[ "Given", "a", "BigDecimal", "attempt", "to", "narrow", "it", "to", "an", "Integer", "or", "Long", "if", "it", "fits", "if", "one", "of", "the", "arguments", "is", "a", "numberable", "." ]
train
https://github.com/impossibl/stencil/blob/4aac1be605542b4248be95bf8916be4e2f755d1c/engine/src/main/java/com/impossibl/stencil/engine/internal/StencilOperands.java#L208-L225
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPlot.java
SVGPlot.cloneDocument
protected SVGDocument cloneDocument() { """ Clone the SVGPlot document for transcoding. This will usually be necessary for exporting the SVG document if it is currently being displayed: otherwise, we break the Batik rendering trees. (Discovered by Simon). @return cloned document """ return (SVGDocument) new CloneInlineImages() { @Override public Node cloneNode(Document doc, Node eold) { // Skip elements with noexport attribute set if(eold instanceof Element) { Element eeold = (Element) eold; String vis = eeold.getAttribute(NO_EXPORT_ATTRIBUTE); if(vis != null && vis.length() > 0) { return null; } } return super.cloneNode(doc, eold); } }.cloneDocument(getDomImpl(), document); }
java
protected SVGDocument cloneDocument() { return (SVGDocument) new CloneInlineImages() { @Override public Node cloneNode(Document doc, Node eold) { // Skip elements with noexport attribute set if(eold instanceof Element) { Element eeold = (Element) eold; String vis = eeold.getAttribute(NO_EXPORT_ATTRIBUTE); if(vis != null && vis.length() > 0) { return null; } } return super.cloneNode(doc, eold); } }.cloneDocument(getDomImpl(), document); }
[ "protected", "SVGDocument", "cloneDocument", "(", ")", "{", "return", "(", "SVGDocument", ")", "new", "CloneInlineImages", "(", ")", "{", "@", "Override", "public", "Node", "cloneNode", "(", "Document", "doc", ",", "Node", "eold", ")", "{", "// Skip elements w...
Clone the SVGPlot document for transcoding. This will usually be necessary for exporting the SVG document if it is currently being displayed: otherwise, we break the Batik rendering trees. (Discovered by Simon). @return cloned document
[ "Clone", "the", "SVGPlot", "document", "for", "transcoding", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPlot.java#L436-L451
buschmais/jqa-core-framework
rule/src/main/java/com/buschmais/jqassistant/core/rule/api/RuleHelper.java
RuleHelper.getAllRules
private CollectRulesVisitor getAllRules(RuleSet ruleSet, RuleSelection ruleSelection) throws RuleException { """ Determines all rules. @param ruleSet The rule set. @return The visitor with all valid and missing rules. @throws RuleException If the rules cannot be evaluated. """ CollectRulesVisitor visitor = new CollectRulesVisitor(); RuleSetExecutor executor = new RuleSetExecutor(visitor, new RuleSetExecutorConfiguration()); executor.execute(ruleSet, ruleSelection); return visitor; }
java
private CollectRulesVisitor getAllRules(RuleSet ruleSet, RuleSelection ruleSelection) throws RuleException { CollectRulesVisitor visitor = new CollectRulesVisitor(); RuleSetExecutor executor = new RuleSetExecutor(visitor, new RuleSetExecutorConfiguration()); executor.execute(ruleSet, ruleSelection); return visitor; }
[ "private", "CollectRulesVisitor", "getAllRules", "(", "RuleSet", "ruleSet", ",", "RuleSelection", "ruleSelection", ")", "throws", "RuleException", "{", "CollectRulesVisitor", "visitor", "=", "new", "CollectRulesVisitor", "(", ")", ";", "RuleSetExecutor", "executor", "="...
Determines all rules. @param ruleSet The rule set. @return The visitor with all valid and missing rules. @throws RuleException If the rules cannot be evaluated.
[ "Determines", "all", "rules", "." ]
train
https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/rule/src/main/java/com/buschmais/jqassistant/core/rule/api/RuleHelper.java#L86-L91
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/ExpressRouteCircuitsInner.java
ExpressRouteCircuitsInner.getByResourceGroupAsync
public Observable<ExpressRouteCircuitInner> getByResourceGroupAsync(String resourceGroupName, String circuitName) { """ Gets information about the specified express route circuit. @param resourceGroupName The name of the resource group. @param circuitName The name of express route circuit. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ExpressRouteCircuitInner object """ return getByResourceGroupWithServiceResponseAsync(resourceGroupName, circuitName).map(new Func1<ServiceResponse<ExpressRouteCircuitInner>, ExpressRouteCircuitInner>() { @Override public ExpressRouteCircuitInner call(ServiceResponse<ExpressRouteCircuitInner> response) { return response.body(); } }); }
java
public Observable<ExpressRouteCircuitInner> getByResourceGroupAsync(String resourceGroupName, String circuitName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, circuitName).map(new Func1<ServiceResponse<ExpressRouteCircuitInner>, ExpressRouteCircuitInner>() { @Override public ExpressRouteCircuitInner call(ServiceResponse<ExpressRouteCircuitInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ExpressRouteCircuitInner", ">", "getByResourceGroupAsync", "(", "String", "resourceGroupName", ",", "String", "circuitName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "circuitName", ")", "....
Gets information about the specified express route circuit. @param resourceGroupName The name of the resource group. @param circuitName The name of express route circuit. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ExpressRouteCircuitInner object
[ "Gets", "information", "about", "the", "specified", "express", "route", "circuit", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/ExpressRouteCircuitsInner.java#L335-L342
raydac/java-binary-block-parser
jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java
JBBPUtils.double2str
public static String double2str(final double doubleValue, final int radix) { """ Convert double value into string representation with defined radix base. @param doubleValue value to be converted in string @param radix radix base to be used for conversion, must be 10 or 16 @return converted value as upper case string @throws IllegalArgumentException for wrong radix base @since 1.4.0 """ if (radix != 10 && radix != 16) { throw new IllegalArgumentException("Illegal radix [" + radix + ']'); } final String result; if (radix == 16) { String converted = Double.toHexString(doubleValue); boolean minus = converted.startsWith("-"); if (minus) { converted = converted.substring(1); } if (converted.startsWith("0x")) { converted = converted.substring(2); } result = (minus ? '-' + converted : converted).toUpperCase(Locale.ENGLISH); } else { result = Double.toString(doubleValue); } return result; }
java
public static String double2str(final double doubleValue, final int radix) { if (radix != 10 && radix != 16) { throw new IllegalArgumentException("Illegal radix [" + radix + ']'); } final String result; if (radix == 16) { String converted = Double.toHexString(doubleValue); boolean minus = converted.startsWith("-"); if (minus) { converted = converted.substring(1); } if (converted.startsWith("0x")) { converted = converted.substring(2); } result = (minus ? '-' + converted : converted).toUpperCase(Locale.ENGLISH); } else { result = Double.toString(doubleValue); } return result; }
[ "public", "static", "String", "double2str", "(", "final", "double", "doubleValue", ",", "final", "int", "radix", ")", "{", "if", "(", "radix", "!=", "10", "&&", "radix", "!=", "16", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Illegal radix ...
Convert double value into string representation with defined radix base. @param doubleValue value to be converted in string @param radix radix base to be used for conversion, must be 10 or 16 @return converted value as upper case string @throws IllegalArgumentException for wrong radix base @since 1.4.0
[ "Convert", "double", "value", "into", "string", "representation", "with", "defined", "radix", "base", "." ]
train
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L706-L726
apache/flink
flink-core/src/main/java/org/apache/flink/util/StringValueUtils.java
StringValueUtils.replaceNonWordChars
public static void replaceNonWordChars(StringValue string, char replacement) { """ Replaces all non-word characters in a string by a given character. The only characters not replaced are the characters that qualify as word characters or digit characters with respect to {@link Character#isLetter(char)} or {@link Character#isDigit(char)}, as well as the underscore character. <p>This operation is intended to simplify strings for counting distinct words. @param string The string value to have the non-word characters replaced. @param replacement The character to use as the replacement. """ final char[] chars = string.getCharArray(); final int len = string.length(); for (int i = 0; i < len; i++) { final char c = chars[i]; if (!(Character.isLetter(c) || Character.isDigit(c) || c == '_')) { chars[i] = replacement; } } }
java
public static void replaceNonWordChars(StringValue string, char replacement) { final char[] chars = string.getCharArray(); final int len = string.length(); for (int i = 0; i < len; i++) { final char c = chars[i]; if (!(Character.isLetter(c) || Character.isDigit(c) || c == '_')) { chars[i] = replacement; } } }
[ "public", "static", "void", "replaceNonWordChars", "(", "StringValue", "string", ",", "char", "replacement", ")", "{", "final", "char", "[", "]", "chars", "=", "string", ".", "getCharArray", "(", ")", ";", "final", "int", "len", "=", "string", ".", "length...
Replaces all non-word characters in a string by a given character. The only characters not replaced are the characters that qualify as word characters or digit characters with respect to {@link Character#isLetter(char)} or {@link Character#isDigit(char)}, as well as the underscore character. <p>This operation is intended to simplify strings for counting distinct words. @param string The string value to have the non-word characters replaced. @param replacement The character to use as the replacement.
[ "Replaces", "all", "non", "-", "word", "characters", "in", "a", "string", "by", "a", "given", "character", ".", "The", "only", "characters", "not", "replaced", "are", "the", "characters", "that", "qualify", "as", "word", "characters", "or", "digit", "charact...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/StringValueUtils.java#L62-L72
lucee/Lucee
core/src/main/java/lucee/runtime/type/util/ListUtil.java
ListUtil.listContainsNoCase
public static int listContainsNoCase(String list, String value, String delimiter, boolean includeEmptyFields, boolean multiCharacterDelimiter) { """ returns if a value of the list contains given value, ignore case @param list list to search in @param value value to serach @param delimiter delimiter of the list @return position in list or 0 """ if (StringUtil.isEmpty(value)) return -1; Array arr = listToArray(list, delimiter, includeEmptyFields, multiCharacterDelimiter); int len = arr.size(); for (int i = 1; i <= len; i++) { if (StringUtil.indexOfIgnoreCase(arr.get(i, "").toString(), value) != -1) return i - 1; } return -1; }
java
public static int listContainsNoCase(String list, String value, String delimiter, boolean includeEmptyFields, boolean multiCharacterDelimiter) { if (StringUtil.isEmpty(value)) return -1; Array arr = listToArray(list, delimiter, includeEmptyFields, multiCharacterDelimiter); int len = arr.size(); for (int i = 1; i <= len; i++) { if (StringUtil.indexOfIgnoreCase(arr.get(i, "").toString(), value) != -1) return i - 1; } return -1; }
[ "public", "static", "int", "listContainsNoCase", "(", "String", "list", ",", "String", "value", ",", "String", "delimiter", ",", "boolean", "includeEmptyFields", ",", "boolean", "multiCharacterDelimiter", ")", "{", "if", "(", "StringUtil", ".", "isEmpty", "(", "...
returns if a value of the list contains given value, ignore case @param list list to search in @param value value to serach @param delimiter delimiter of the list @return position in list or 0
[ "returns", "if", "a", "value", "of", "the", "list", "contains", "given", "value", "ignore", "case" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/ListUtil.java#L814-L824
jamel/dbf
dbf-reader/src/main/java/org/jamel/dbf/structure/DbfRow.java
DbfRow.getString
public String getString(String fieldName, Charset charset) throws DbfException { """ Retrieves the value of the designated field as String using given charset. @param fieldName the name of the field @param charset the charset to be used to decode field value @return the field value, or null (if the dbf value is NULL) @throws DbfException if there's no field with name fieldName """ Object value = get(fieldName); return value == null ? null : new String(trimLeftSpaces((byte[]) value), charset); }
java
public String getString(String fieldName, Charset charset) throws DbfException { Object value = get(fieldName); return value == null ? null : new String(trimLeftSpaces((byte[]) value), charset); }
[ "public", "String", "getString", "(", "String", "fieldName", ",", "Charset", "charset", ")", "throws", "DbfException", "{", "Object", "value", "=", "get", "(", "fieldName", ")", ";", "return", "value", "==", "null", "?", "null", ":", "new", "String", "(", ...
Retrieves the value of the designated field as String using given charset. @param fieldName the name of the field @param charset the charset to be used to decode field value @return the field value, or null (if the dbf value is NULL) @throws DbfException if there's no field with name fieldName
[ "Retrieves", "the", "value", "of", "the", "designated", "field", "as", "String", "using", "given", "charset", "." ]
train
https://github.com/jamel/dbf/blob/5f065f8a13d9a4ffe27c617e7ec321771c95da7f/dbf-reader/src/main/java/org/jamel/dbf/structure/DbfRow.java#L75-L80
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSetDTM.java
NodeSetDTM.insertNode
public void insertNode(int n, int pos) { """ Insert a node at a given position. @param n Node to be added @param pos Offset at which the node is to be inserted, with 0 being the first position. @throws RuntimeException thrown if this NodeSetDTM is not of a mutable type. """ if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); insertElementAt(n, pos); }
java
public void insertNode(int n, int pos) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); insertElementAt(n, pos); }
[ "public", "void", "insertNode", "(", "int", "n", ",", "int", "pos", ")", "{", "if", "(", "!", "m_mutable", ")", "throw", "new", "RuntimeException", "(", "XSLMessages", ".", "createXPATHMessage", "(", "XPATHErrorResources", ".", "ER_NODESETDTM_NOT_MUTABLE", ",", ...
Insert a node at a given position. @param n Node to be added @param pos Offset at which the node is to be inserted, with 0 being the first position. @throws RuntimeException thrown if this NodeSetDTM is not of a mutable type.
[ "Insert", "a", "node", "at", "a", "given", "position", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSetDTM.java#L553-L560
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-ui-parent/deeplearning4j-ui-components/src/main/java/org/deeplearning4j/ui/standalone/StaticPageUtil.java
StaticPageUtil.saveHTMLFile
public static void saveHTMLFile(File outputFile, Component... components) throws IOException { """ A version of {@link #renderHTML(Component...)} that exports the resulting HTML to the specified File. @param outputFile Output path @param components Components to render """ FileUtils.writeStringToFile(outputFile, renderHTML(components)); }
java
public static void saveHTMLFile(File outputFile, Component... components) throws IOException { FileUtils.writeStringToFile(outputFile, renderHTML(components)); }
[ "public", "static", "void", "saveHTMLFile", "(", "File", "outputFile", ",", "Component", "...", "components", ")", "throws", "IOException", "{", "FileUtils", ".", "writeStringToFile", "(", "outputFile", ",", "renderHTML", "(", "components", ")", ")", ";", "}" ]
A version of {@link #renderHTML(Component...)} that exports the resulting HTML to the specified File. @param outputFile Output path @param components Components to render
[ "A", "version", "of", "{", "@link", "#renderHTML", "(", "Component", "...", ")", "}", "that", "exports", "the", "resulting", "HTML", "to", "the", "specified", "File", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-ui-parent/deeplearning4j-ui-components/src/main/java/org/deeplearning4j/ui/standalone/StaticPageUtil.java#L131-L133
lessthanoptimal/ejml
main/ejml-zdense/src/org/ejml/dense/row/CommonOps_ZDRM.java
CommonOps_ZDRM.multAddTransAB
public static void multAddTransAB(ZMatrixRMaj a , ZMatrixRMaj b , ZMatrixRMaj c ) { """ <p> Performs the following operation:<br> <br> c = c + a<sup>H</sup> * b<sup>H</sup><br> c<sub>ij</sub> = c<sub>ij</sub> + &sum;<sub>k=1:n</sub> { a<sub>ki</sub> * b<sub>jk</sub>} </p> @param a The left matrix in the multiplication operation. Not Modified. @param b The right matrix in the multiplication operation. Not Modified. @param c Where the results of the operation are stored. Modified. """ if( a.numCols >= EjmlParameters.CMULT_TRANAB_COLUMN_SWITCH ) { MatrixMatrixMult_ZDRM.multAddTransAB_aux(a,b,c,null); } else { MatrixMatrixMult_ZDRM.multAddTransAB(a,b,c); } }
java
public static void multAddTransAB(ZMatrixRMaj a , ZMatrixRMaj b , ZMatrixRMaj c ) { if( a.numCols >= EjmlParameters.CMULT_TRANAB_COLUMN_SWITCH ) { MatrixMatrixMult_ZDRM.multAddTransAB_aux(a,b,c,null); } else { MatrixMatrixMult_ZDRM.multAddTransAB(a,b,c); } }
[ "public", "static", "void", "multAddTransAB", "(", "ZMatrixRMaj", "a", ",", "ZMatrixRMaj", "b", ",", "ZMatrixRMaj", "c", ")", "{", "if", "(", "a", ".", "numCols", ">=", "EjmlParameters", ".", "CMULT_TRANAB_COLUMN_SWITCH", ")", "{", "MatrixMatrixMult_ZDRM", ".", ...
<p> Performs the following operation:<br> <br> c = c + a<sup>H</sup> * b<sup>H</sup><br> c<sub>ij</sub> = c<sub>ij</sub> + &sum;<sub>k=1:n</sub> { a<sub>ki</sub> * b<sub>jk</sub>} </p> @param a The left matrix in the multiplication operation. Not Modified. @param b The right matrix in the multiplication operation. Not Modified. @param c Where the results of the operation are stored. Modified.
[ "<p", ">", "Performs", "the", "following", "operation", ":", "<br", ">", "<br", ">", "c", "=", "c", "+", "a<sup", ">", "H<", "/", "sup", ">", "*", "b<sup", ">", "H<", "/", "sup", ">", "<br", ">", "c<sub", ">", "ij<", "/", "sub", ">", "=", "c<...
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/CommonOps_ZDRM.java#L668-L675
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/disparity/impl/StereoDisparityWtoNaiveFive.java
StereoDisparityWtoNaiveFive.computeScore
protected double computeScore( int leftX , int rightX , int centerY ) { """ Compute the score for five local regions and just use the center + the two best @param leftX X-axis center left image @param rightX X-axis center left image @param centerY Y-axis center for both images @return Fit score for both regions. """ double center = computeScoreRect(leftX,rightX,centerY); four[0] = computeScoreRect(leftX-radiusX,rightX-radiusX,centerY-radiusY); four[1] = computeScoreRect(leftX+radiusX,rightX+radiusX,centerY-radiusY); four[2] = computeScoreRect(leftX-radiusX,rightX-radiusX,centerY+radiusY); four[3] = computeScoreRect(leftX+radiusX,rightX+radiusX,centerY+radiusY); Arrays.sort(four); return four[0] + four[1] + center; }
java
protected double computeScore( int leftX , int rightX , int centerY ) { double center = computeScoreRect(leftX,rightX,centerY); four[0] = computeScoreRect(leftX-radiusX,rightX-radiusX,centerY-radiusY); four[1] = computeScoreRect(leftX+radiusX,rightX+radiusX,centerY-radiusY); four[2] = computeScoreRect(leftX-radiusX,rightX-radiusX,centerY+radiusY); four[3] = computeScoreRect(leftX+radiusX,rightX+radiusX,centerY+radiusY); Arrays.sort(four); return four[0] + four[1] + center; }
[ "protected", "double", "computeScore", "(", "int", "leftX", ",", "int", "rightX", ",", "int", "centerY", ")", "{", "double", "center", "=", "computeScoreRect", "(", "leftX", ",", "rightX", ",", "centerY", ")", ";", "four", "[", "0", "]", "=", "computeSco...
Compute the score for five local regions and just use the center + the two best @param leftX X-axis center left image @param rightX X-axis center left image @param centerY Y-axis center for both images @return Fit score for both regions.
[ "Compute", "the", "score", "for", "five", "local", "regions", "and", "just", "use", "the", "center", "+", "the", "two", "best" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/disparity/impl/StereoDisparityWtoNaiveFive.java#L139-L150
wkgcass/Style
src/main/java/net/cassite/style/aggregation/MapFuncSup.java
MapFuncSup.forThose
public <R> R forThose(RFunc2<Boolean, K, V> predicate, RFunc2<R, K, V> func) { """ define a function to deal with each element in the map @param predicate a function takes in each element from map and returns true or false(or null) @param func a function takes in each element from map and returns 'last loop info' @return return 'last loop value'.<br> check <a href="https://github.com/wkgcass/Style/">tutorial</a> for more info about 'last loop value' """ return forThose(predicate, Style.$(func)); }
java
public <R> R forThose(RFunc2<Boolean, K, V> predicate, RFunc2<R, K, V> func) { return forThose(predicate, Style.$(func)); }
[ "public", "<", "R", ">", "R", "forThose", "(", "RFunc2", "<", "Boolean", ",", "K", ",", "V", ">", "predicate", ",", "RFunc2", "<", "R", ",", "K", ",", "V", ">", "func", ")", "{", "return", "forThose", "(", "predicate", ",", "Style", ".", "$", "...
define a function to deal with each element in the map @param predicate a function takes in each element from map and returns true or false(or null) @param func a function takes in each element from map and returns 'last loop info' @return return 'last loop value'.<br> check <a href="https://github.com/wkgcass/Style/">tutorial</a> for more info about 'last loop value'
[ "define", "a", "function", "to", "deal", "with", "each", "element", "in", "the", "map" ]
train
https://github.com/wkgcass/Style/blob/db3ea64337251f46f734279480e365293bececbd/src/main/java/net/cassite/style/aggregation/MapFuncSup.java#L146-L148
SonarSource/sonarqube
server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/ChangesOnMyIssueNotificationHandler.java
ChangesOnMyIssueNotificationHandler.isPeerChanged
private static boolean isPeerChanged(Change change, ChangedIssue issue) { """ Is the author of the change the assignee of the specified issue? If not, it means the issue has been changed by a peer of the author of the change. """ Optional<User> assignee = issue.getAssignee(); return !assignee.isPresent() || !change.isAuthorLogin(assignee.get().getLogin()); }
java
private static boolean isPeerChanged(Change change, ChangedIssue issue) { Optional<User> assignee = issue.getAssignee(); return !assignee.isPresent() || !change.isAuthorLogin(assignee.get().getLogin()); }
[ "private", "static", "boolean", "isPeerChanged", "(", "Change", "change", ",", "ChangedIssue", "issue", ")", "{", "Optional", "<", "User", ">", "assignee", "=", "issue", ".", "getAssignee", "(", ")", ";", "return", "!", "assignee", ".", "isPresent", "(", "...
Is the author of the change the assignee of the specified issue? If not, it means the issue has been changed by a peer of the author of the change.
[ "Is", "the", "author", "of", "the", "change", "the", "assignee", "of", "the", "specified", "issue?", "If", "not", "it", "means", "the", "issue", "has", "been", "changed", "by", "a", "peer", "of", "the", "author", "of", "the", "change", "." ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/ChangesOnMyIssueNotificationHandler.java#L174-L177
astrapi69/jaulp-wicket
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/url/WicketUrlExtensions.java
WicketUrlExtensions.getCanonicalPageUrl
public static Url getCanonicalPageUrl(final Class<? extends Page> pageClass, final PageParameters parameters) { """ Gets the canonical page url. Try to reduce url by eliminating '..' and '.' from the path where appropriate (this is somehow similar to {@link java.io.File#getCanonicalPath()}). @param pageClass the page class @param parameters the parameters @return the page url @see Url#canonical() """ return getPageUrl(pageClass, parameters).canonical(); }
java
public static Url getCanonicalPageUrl(final Class<? extends Page> pageClass, final PageParameters parameters) { return getPageUrl(pageClass, parameters).canonical(); }
[ "public", "static", "Url", "getCanonicalPageUrl", "(", "final", "Class", "<", "?", "extends", "Page", ">", "pageClass", ",", "final", "PageParameters", "parameters", ")", "{", "return", "getPageUrl", "(", "pageClass", ",", "parameters", ")", ".", "canonical", ...
Gets the canonical page url. Try to reduce url by eliminating '..' and '.' from the path where appropriate (this is somehow similar to {@link java.io.File#getCanonicalPath()}). @param pageClass the page class @param parameters the parameters @return the page url @see Url#canonical()
[ "Gets", "the", "canonical", "page", "url", ".", "Try", "to", "reduce", "url", "by", "eliminating", "..", "and", ".", "from", "the", "path", "where", "appropriate", "(", "this", "is", "somehow", "similar", "to", "{", "@link", "java", ".", "io", ".", "Fi...
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/url/WicketUrlExtensions.java#L160-L164
Javacord/Javacord
javacord-core/src/main/java/org/javacord/core/entity/message/MessageSetImpl.java
MessageSetImpl.getMessagesAfter
public static CompletableFuture<MessageSet> getMessagesAfter(TextChannel channel, int limit, long after) { """ Gets up to a given amount of messages in the given channel after a given message in any channel. @param channel The channel of the messages. @param limit The limit of messages to get. @param after Get messages after the message with this id. @return The messages. @see #getMessagesAfterAsStream(TextChannel, long) """ return getMessages(channel, limit, -1, after); }
java
public static CompletableFuture<MessageSet> getMessagesAfter(TextChannel channel, int limit, long after) { return getMessages(channel, limit, -1, after); }
[ "public", "static", "CompletableFuture", "<", "MessageSet", ">", "getMessagesAfter", "(", "TextChannel", "channel", ",", "int", "limit", ",", "long", "after", ")", "{", "return", "getMessages", "(", "channel", ",", "limit", ",", "-", "1", ",", "after", ")", ...
Gets up to a given amount of messages in the given channel after a given message in any channel. @param channel The channel of the messages. @param limit The limit of messages to get. @param after Get messages after the message with this id. @return The messages. @see #getMessagesAfterAsStream(TextChannel, long)
[ "Gets", "up", "to", "a", "given", "amount", "of", "messages", "in", "the", "given", "channel", "after", "a", "given", "message", "in", "any", "channel", "." ]
train
https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/entity/message/MessageSetImpl.java#L376-L378
codeprimate-software/cp-elements
src/main/java/org/cp/elements/io/FileSystemUtils.java
FileSystemUtils.deleteRecursive
public static boolean deleteRecursive(File path, FileFilter fileFilter) { """ Deletes the given {@link File} from the file system if accepted by the given {@link FileFilter}. If the {@link File} is a directory, then this method recursively deletes all files and subdirectories accepted by the {@link FileFilter} in the given directory along with the directory itself. If the {@link File} is just a plain old file, then only the given file will be deleted if accepted by the {@link FileFilter}. This method attempts to delete as many files as possible. @param path the {@link File} to delete from the file system. @param fileFilter the {@link FileFilter} used to identify the {@link File}s to delete. @return a boolean value indicating whether the given {@link File} was successfully deleted from the file system. @see java.io.File @see java.io.FileFilter @see #safeListFiles(File) @see #isDirectory(File) @see #delete(File) """ boolean success = true; for (File file : safeListFiles(path, fileFilter)) { success &= (isDirectory(file) ? deleteRecursive(file, fileFilter) : delete(file)); } return (success && fileFilter.accept(path) && delete(path)); }
java
public static boolean deleteRecursive(File path, FileFilter fileFilter) { boolean success = true; for (File file : safeListFiles(path, fileFilter)) { success &= (isDirectory(file) ? deleteRecursive(file, fileFilter) : delete(file)); } return (success && fileFilter.accept(path) && delete(path)); }
[ "public", "static", "boolean", "deleteRecursive", "(", "File", "path", ",", "FileFilter", "fileFilter", ")", "{", "boolean", "success", "=", "true", ";", "for", "(", "File", "file", ":", "safeListFiles", "(", "path", ",", "fileFilter", ")", ")", "{", "succ...
Deletes the given {@link File} from the file system if accepted by the given {@link FileFilter}. If the {@link File} is a directory, then this method recursively deletes all files and subdirectories accepted by the {@link FileFilter} in the given directory along with the directory itself. If the {@link File} is just a plain old file, then only the given file will be deleted if accepted by the {@link FileFilter}. This method attempts to delete as many files as possible. @param path the {@link File} to delete from the file system. @param fileFilter the {@link FileFilter} used to identify the {@link File}s to delete. @return a boolean value indicating whether the given {@link File} was successfully deleted from the file system. @see java.io.File @see java.io.FileFilter @see #safeListFiles(File) @see #isDirectory(File) @see #delete(File)
[ "Deletes", "the", "given", "{", "@link", "File", "}", "from", "the", "file", "system", "if", "accepted", "by", "the", "given", "{", "@link", "FileFilter", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/io/FileSystemUtils.java#L192-L200
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/vna/MergeTree.java
MergeTree.mapInputToOutput
public void mapInputToOutput(ValueNumber input, ValueNumber output) { """ Map an input ValueNumber to an output ValueNumber. @param input the input ValueNumber @param output the output ValueNumber """ BitSet inputSet = getInputSet(output); inputSet.set(input.getNumber()); if (DEBUG) { System.out.println(input.getNumber() + "->" + output.getNumber()); System.out.println("Input set for " + output.getNumber() + " is now " + inputSet); } }
java
public void mapInputToOutput(ValueNumber input, ValueNumber output) { BitSet inputSet = getInputSet(output); inputSet.set(input.getNumber()); if (DEBUG) { System.out.println(input.getNumber() + "->" + output.getNumber()); System.out.println("Input set for " + output.getNumber() + " is now " + inputSet); } }
[ "public", "void", "mapInputToOutput", "(", "ValueNumber", "input", ",", "ValueNumber", "output", ")", "{", "BitSet", "inputSet", "=", "getInputSet", "(", "output", ")", ";", "inputSet", ".", "set", "(", "input", ".", "getNumber", "(", ")", ")", ";", "if", ...
Map an input ValueNumber to an output ValueNumber. @param input the input ValueNumber @param output the output ValueNumber
[ "Map", "an", "input", "ValueNumber", "to", "an", "output", "ValueNumber", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/vna/MergeTree.java#L62-L69
Azure/azure-sdk-for-java
recoveryservices.backup/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_12_01/implementation/ProtectionContainersInner.java
ProtectionContainersInner.refreshAsync
public Observable<Void> refreshAsync(String vaultName, String resourceGroupName, String fabricName, String filter) { """ Discovers all the containers in the subscription that can be backed up to Recovery Services Vault. This is an asynchronous operation. To know the status of the operation, call GetRefreshOperationResult API. @param vaultName The name of the recovery services vault. @param resourceGroupName The name of the resource group where the recovery services vault is present. @param fabricName Fabric name associated the container. @param filter OData filter options. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful. """ return refreshWithServiceResponseAsync(vaultName, resourceGroupName, fabricName, filter).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> refreshAsync(String vaultName, String resourceGroupName, String fabricName, String filter) { return refreshWithServiceResponseAsync(vaultName, resourceGroupName, fabricName, filter).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "refreshAsync", "(", "String", "vaultName", ",", "String", "resourceGroupName", ",", "String", "fabricName", ",", "String", "filter", ")", "{", "return", "refreshWithServiceResponseAsync", "(", "vaultName", ",", "resourceGro...
Discovers all the containers in the subscription that can be backed up to Recovery Services Vault. This is an asynchronous operation. To know the status of the operation, call GetRefreshOperationResult API. @param vaultName The name of the recovery services vault. @param resourceGroupName The name of the resource group where the recovery services vault is present. @param fabricName Fabric name associated the container. @param filter OData filter options. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Discovers", "all", "the", "containers", "in", "the", "subscription", "that", "can", "be", "backed", "up", "to", "Recovery", "Services", "Vault", ".", "This", "is", "an", "asynchronous", "operation", ".", "To", "know", "the", "status", "of", "the", "operatio...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices.backup/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_12_01/implementation/ProtectionContainersInner.java#L728-L735
foundation-runtime/service-directory
2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java
DirectoryServiceClient.updateServiceInstanceUri
public void updateServiceInstanceUri(String serviceName, String instanceId, String uri) { """ Update ServiceInstance URI. @param serviceName the service name. @param instanceId the instance id. @param uri the new URI. """ ProtocolHeader header = new ProtocolHeader(); header.setType(ProtocolType.UpdateServiceInstanceUri); UpdateServiceInstanceUriProtocol p = new UpdateServiceInstanceUriProtocol(serviceName, instanceId, uri); connection.submitRequest(header, p, null); }
java
public void updateServiceInstanceUri(String serviceName, String instanceId, String uri){ ProtocolHeader header = new ProtocolHeader(); header.setType(ProtocolType.UpdateServiceInstanceUri); UpdateServiceInstanceUriProtocol p = new UpdateServiceInstanceUriProtocol(serviceName, instanceId, uri); connection.submitRequest(header, p, null); }
[ "public", "void", "updateServiceInstanceUri", "(", "String", "serviceName", ",", "String", "instanceId", ",", "String", "uri", ")", "{", "ProtocolHeader", "header", "=", "new", "ProtocolHeader", "(", ")", ";", "header", ".", "setType", "(", "ProtocolType", ".", ...
Update ServiceInstance URI. @param serviceName the service name. @param instanceId the instance id. @param uri the new URI.
[ "Update", "ServiceInstance", "URI", "." ]
train
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java#L592-L598
Alluxio/alluxio
core/server/worker/src/main/java/alluxio/worker/block/UnderFileSystemBlockStore.java
UnderFileSystemBlockStore.acquireAccess
public boolean acquireAccess(long sessionId, long blockId, Protocol.OpenUfsBlockOptions options) throws BlockAlreadyExistsException { """ Acquires access for a UFS block given a {@link UnderFileSystemBlockMeta} and the limit on the maximum concurrency on the block. If the number of concurrent readers on this UFS block exceeds a threshold, the token is not granted and this method returns false. @param sessionId the session ID @param blockId maximum concurrency @param options the options @return whether an access token is acquired @throws BlockAlreadyExistsException if the block already exists for a session ID """ UnderFileSystemBlockMeta blockMeta = new UnderFileSystemBlockMeta(sessionId, blockId, options); try (LockResource lr = new LockResource(mLock)) { Key key = new Key(sessionId, blockId); if (mBlocks.containsKey(key)) { throw new BlockAlreadyExistsException(ExceptionMessage.UFS_BLOCK_ALREADY_EXISTS_FOR_SESSION, blockId, blockMeta.getUnderFileSystemPath(), sessionId); } Set<Long> sessionIds = mBlockIdToSessionIds.get(blockId); if (sessionIds != null && sessionIds.size() >= options.getMaxUfsReadConcurrency()) { return false; } if (sessionIds == null) { sessionIds = new HashSet<>(); mBlockIdToSessionIds.put(blockId, sessionIds); } sessionIds.add(sessionId); mBlocks.put(key, new BlockInfo(blockMeta)); Set<Long> blockIds = mSessionIdToBlockIds.get(sessionId); if (blockIds == null) { blockIds = new HashSet<>(); mSessionIdToBlockIds.put(sessionId, blockIds); } blockIds.add(blockId); } return true; }
java
public boolean acquireAccess(long sessionId, long blockId, Protocol.OpenUfsBlockOptions options) throws BlockAlreadyExistsException { UnderFileSystemBlockMeta blockMeta = new UnderFileSystemBlockMeta(sessionId, blockId, options); try (LockResource lr = new LockResource(mLock)) { Key key = new Key(sessionId, blockId); if (mBlocks.containsKey(key)) { throw new BlockAlreadyExistsException(ExceptionMessage.UFS_BLOCK_ALREADY_EXISTS_FOR_SESSION, blockId, blockMeta.getUnderFileSystemPath(), sessionId); } Set<Long> sessionIds = mBlockIdToSessionIds.get(blockId); if (sessionIds != null && sessionIds.size() >= options.getMaxUfsReadConcurrency()) { return false; } if (sessionIds == null) { sessionIds = new HashSet<>(); mBlockIdToSessionIds.put(blockId, sessionIds); } sessionIds.add(sessionId); mBlocks.put(key, new BlockInfo(blockMeta)); Set<Long> blockIds = mSessionIdToBlockIds.get(sessionId); if (blockIds == null) { blockIds = new HashSet<>(); mSessionIdToBlockIds.put(sessionId, blockIds); } blockIds.add(blockId); } return true; }
[ "public", "boolean", "acquireAccess", "(", "long", "sessionId", ",", "long", "blockId", ",", "Protocol", ".", "OpenUfsBlockOptions", "options", ")", "throws", "BlockAlreadyExistsException", "{", "UnderFileSystemBlockMeta", "blockMeta", "=", "new", "UnderFileSystemBlockMet...
Acquires access for a UFS block given a {@link UnderFileSystemBlockMeta} and the limit on the maximum concurrency on the block. If the number of concurrent readers on this UFS block exceeds a threshold, the token is not granted and this method returns false. @param sessionId the session ID @param blockId maximum concurrency @param options the options @return whether an access token is acquired @throws BlockAlreadyExistsException if the block already exists for a session ID
[ "Acquires", "access", "for", "a", "UFS", "block", "given", "a", "{", "@link", "UnderFileSystemBlockMeta", "}", "and", "the", "limit", "on", "the", "maximum", "concurrency", "on", "the", "block", ".", "If", "the", "number", "of", "concurrent", "readers", "on"...
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/worker/block/UnderFileSystemBlockStore.java#L104-L133
sothawo/mapjfx
src/main/java/com/sothawo/mapjfx/MapView.java
JavaConnector.extentChanged
public void extentChanged(double latMin, double lonMin, double latMax, double lonMax) { """ called when the map extent changed by changing the center or zoom of the map. @param latMin latitude of upper left corner @param lonMin longitude of upper left corner @param latMax latitude of lower right corner @param lonMax longitude of lower right corner """ final Extent extent = Extent.forCoordinates(new Coordinate(latMin, lonMin), new Coordinate(latMax, lonMax)); if (logger.isTraceEnabled()) { logger.trace("JS reports extend change: {}", extent); } fireEvent(new MapViewEvent(MapViewEvent.MAP_BOUNDING_EXTENT, extent)); }
java
public void extentChanged(double latMin, double lonMin, double latMax, double lonMax) { final Extent extent = Extent.forCoordinates(new Coordinate(latMin, lonMin), new Coordinate(latMax, lonMax)); if (logger.isTraceEnabled()) { logger.trace("JS reports extend change: {}", extent); } fireEvent(new MapViewEvent(MapViewEvent.MAP_BOUNDING_EXTENT, extent)); }
[ "public", "void", "extentChanged", "(", "double", "latMin", ",", "double", "lonMin", ",", "double", "latMax", ",", "double", "lonMax", ")", "{", "final", "Extent", "extent", "=", "Extent", ".", "forCoordinates", "(", "new", "Coordinate", "(", "latMin", ",", ...
called when the map extent changed by changing the center or zoom of the map. @param latMin latitude of upper left corner @param lonMin longitude of upper left corner @param latMax latitude of lower right corner @param lonMax longitude of lower right corner
[ "called", "when", "the", "map", "extent", "changed", "by", "changing", "the", "center", "or", "zoom", "of", "the", "map", "." ]
train
https://github.com/sothawo/mapjfx/blob/202091de492ab7a8b000c77efd833029f7f0ef92/src/main/java/com/sothawo/mapjfx/MapView.java#L1673-L1679
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLSelect.java
OCommandExecutorSQLSelect.createIndexedProperty
private static OIndexSearchResult createIndexedProperty(final OSQLFilterCondition iCondition, final Object iItem) { """ Add SQL filter field to the search candidate list. @param iCondition Condition item @param iItem Value to search @return true if the property was indexed and found, otherwise false """ if (iItem == null || !(iItem instanceof OSQLFilterItemField)) return null; if (iCondition.getLeft() instanceof OSQLFilterItemField && iCondition.getRight() instanceof OSQLFilterItemField) return null; final OSQLFilterItemField item = (OSQLFilterItemField) iItem; if (item.hasChainOperators() && !item.isFieldChain()) return null; final Object origValue = iCondition.getLeft() == iItem ? iCondition.getRight() : iCondition.getLeft(); if (iCondition.getOperator() instanceof OQueryOperatorBetween || iCondition.getOperator() instanceof OQueryOperatorIn) { return new OIndexSearchResult(iCondition.getOperator(), item.getFieldChain(), origValue); } final Object value = OSQLHelper.getValue(origValue); if (value == null) return null; return new OIndexSearchResult(iCondition.getOperator(), item.getFieldChain(), value); }
java
private static OIndexSearchResult createIndexedProperty(final OSQLFilterCondition iCondition, final Object iItem) { if (iItem == null || !(iItem instanceof OSQLFilterItemField)) return null; if (iCondition.getLeft() instanceof OSQLFilterItemField && iCondition.getRight() instanceof OSQLFilterItemField) return null; final OSQLFilterItemField item = (OSQLFilterItemField) iItem; if (item.hasChainOperators() && !item.isFieldChain()) return null; final Object origValue = iCondition.getLeft() == iItem ? iCondition.getRight() : iCondition.getLeft(); if (iCondition.getOperator() instanceof OQueryOperatorBetween || iCondition.getOperator() instanceof OQueryOperatorIn) { return new OIndexSearchResult(iCondition.getOperator(), item.getFieldChain(), origValue); } final Object value = OSQLHelper.getValue(origValue); if (value == null) return null; return new OIndexSearchResult(iCondition.getOperator(), item.getFieldChain(), value); }
[ "private", "static", "OIndexSearchResult", "createIndexedProperty", "(", "final", "OSQLFilterCondition", "iCondition", ",", "final", "Object", "iItem", ")", "{", "if", "(", "iItem", "==", "null", "||", "!", "(", "iItem", "instanceof", "OSQLFilterItemField", ")", "...
Add SQL filter field to the search candidate list. @param iCondition Condition item @param iItem Value to search @return true if the property was indexed and found, otherwise false
[ "Add", "SQL", "filter", "field", "to", "the", "search", "candidate", "list", "." ]
train
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLSelect.java#L519-L543
yidongnan/grpc-spring-boot-starter
grpc-client-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/client/channelfactory/AbstractChannelFactory.java
AbstractChannelFactory.configureLimits
protected void configureLimits(final T builder, final String name) { """ Configures limits such as max message sizes that should be used by the channel. @param builder The channel builder to configure. @param name The name of the client to configure. """ final GrpcChannelProperties properties = getPropertiesFor(name); final Integer maxInboundMessageSize = properties.getMaxInboundMessageSize(); if (maxInboundMessageSize != null) { builder.maxInboundMessageSize(maxInboundMessageSize); } }
java
protected void configureLimits(final T builder, final String name) { final GrpcChannelProperties properties = getPropertiesFor(name); final Integer maxInboundMessageSize = properties.getMaxInboundMessageSize(); if (maxInboundMessageSize != null) { builder.maxInboundMessageSize(maxInboundMessageSize); } }
[ "protected", "void", "configureLimits", "(", "final", "T", "builder", ",", "final", "String", "name", ")", "{", "final", "GrpcChannelProperties", "properties", "=", "getPropertiesFor", "(", "name", ")", ";", "final", "Integer", "maxInboundMessageSize", "=", "prope...
Configures limits such as max message sizes that should be used by the channel. @param builder The channel builder to configure. @param name The name of the client to configure.
[ "Configures", "limits", "such", "as", "max", "message", "sizes", "that", "should", "be", "used", "by", "the", "channel", "." ]
train
https://github.com/yidongnan/grpc-spring-boot-starter/blob/07f8853cfafc9707584f2371aff012e590217b85/grpc-client-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/client/channelfactory/AbstractChannelFactory.java#L230-L236
LGoodDatePicker/LGoodDatePicker
Project/src/main/java/com/github/lgooddatepicker/components/DatePicker.java
DatePicker.getBaseline
@Override public int getBaseline(int width, int height) { """ getBaseline, This returns the baseline value of the dateTextField. """ if (dateTextField.isVisible()) { return dateTextField.getBaseline(width, height); } return super.getBaseline(width, height); }
java
@Override public int getBaseline(int width, int height) { if (dateTextField.isVisible()) { return dateTextField.getBaseline(width, height); } return super.getBaseline(width, height); }
[ "@", "Override", "public", "int", "getBaseline", "(", "int", "width", ",", "int", "height", ")", "{", "if", "(", "dateTextField", ".", "isVisible", "(", ")", ")", "{", "return", "dateTextField", ".", "getBaseline", "(", "width", ",", "height", ")", ";", ...
getBaseline, This returns the baseline value of the dateTextField.
[ "getBaseline", "This", "returns", "the", "baseline", "value", "of", "the", "dateTextField", "." ]
train
https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/github/lgooddatepicker/components/DatePicker.java#L261-L267
groovy/groovy-core
src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java
StringGroovyMethods.getAt
public static List getAt(Matcher self, Collection indices) { """ Select a List of values from a Matcher using a Collection to identify the indices to be selected. @param self a Matcher @param indices a Collection of indices @return a String of the values at the given indices @since 1.6.0 """ List result = new ArrayList(); for (Object value : indices) { if (value instanceof Range) { result.addAll(getAt(self, (Range) value)); } else { int idx = DefaultTypeTransformation.intUnbox(value); result.add(getAt(self, idx)); } } return result; }
java
public static List getAt(Matcher self, Collection indices) { List result = new ArrayList(); for (Object value : indices) { if (value instanceof Range) { result.addAll(getAt(self, (Range) value)); } else { int idx = DefaultTypeTransformation.intUnbox(value); result.add(getAt(self, idx)); } } return result; }
[ "public", "static", "List", "getAt", "(", "Matcher", "self", ",", "Collection", "indices", ")", "{", "List", "result", "=", "new", "ArrayList", "(", ")", ";", "for", "(", "Object", "value", ":", "indices", ")", "{", "if", "(", "value", "instanceof", "R...
Select a List of values from a Matcher using a Collection to identify the indices to be selected. @param self a Matcher @param indices a Collection of indices @return a String of the values at the given indices @since 1.6.0
[ "Select", "a", "List", "of", "values", "from", "a", "Matcher", "using", "a", "Collection", "to", "identify", "the", "indices", "to", "be", "selected", "." ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1316-L1327
feedzai/pdb
src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java
AbstractDatabaseEngine.setSchema
protected void setSchema(final String schema) throws DatabaseEngineException { """ Sets the schema for the current {@link #conn connection}. @throws DatabaseEngineException If schema doesn't exist, a database access error occurs or this method is called on a closed connection. @since 2.1.13 """ try { this.conn.setSchema(schema); } catch (final Exception e) { throw new DatabaseEngineException(String.format("Could not set current schema to '%s'", schema), e); } }
java
protected void setSchema(final String schema) throws DatabaseEngineException { try { this.conn.setSchema(schema); } catch (final Exception e) { throw new DatabaseEngineException(String.format("Could not set current schema to '%s'", schema), e); } }
[ "protected", "void", "setSchema", "(", "final", "String", "schema", ")", "throws", "DatabaseEngineException", "{", "try", "{", "this", ".", "conn", ".", "setSchema", "(", "schema", ")", ";", "}", "catch", "(", "final", "Exception", "e", ")", "{", "throw", ...
Sets the schema for the current {@link #conn connection}. @throws DatabaseEngineException If schema doesn't exist, a database access error occurs or this method is called on a closed connection. @since 2.1.13
[ "Sets", "the", "schema", "for", "the", "current", "{", "@link", "#conn", "connection", "}", "." ]
train
https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java#L1369-L1375
alkacon/opencms-core
src/org/opencms/search/CmsSearch.java
CmsSearch.addFieldQueryMust
public void addFieldQueryMust(String fieldName, String searchQuery) { """ Adds an individual query for a search field that MUST occur.<p> If this is used, any setting made with {@link #setQuery(String)} and {@link #setField(String[])} will be ignored and only the individual field search settings will be used.<p> When combining occurrences of SHOULD, MUST and MUST_NOT, keep the following in mind: All SHOULD clauses will be grouped and wrapped in one query, all MUST and MUST_NOT clauses will be grouped in another query. This means that at least one of the terms which are given as a SHOULD query must occur in the search result.<p> @param fieldName the field name @param searchQuery the search query @since 7.5.1 """ addFieldQuery(fieldName, searchQuery, BooleanClause.Occur.MUST); }
java
public void addFieldQueryMust(String fieldName, String searchQuery) { addFieldQuery(fieldName, searchQuery, BooleanClause.Occur.MUST); }
[ "public", "void", "addFieldQueryMust", "(", "String", "fieldName", ",", "String", "searchQuery", ")", "{", "addFieldQuery", "(", "fieldName", ",", "searchQuery", ",", "BooleanClause", ".", "Occur", ".", "MUST", ")", ";", "}" ]
Adds an individual query for a search field that MUST occur.<p> If this is used, any setting made with {@link #setQuery(String)} and {@link #setField(String[])} will be ignored and only the individual field search settings will be used.<p> When combining occurrences of SHOULD, MUST and MUST_NOT, keep the following in mind: All SHOULD clauses will be grouped and wrapped in one query, all MUST and MUST_NOT clauses will be grouped in another query. This means that at least one of the terms which are given as a SHOULD query must occur in the search result.<p> @param fieldName the field name @param searchQuery the search query @since 7.5.1
[ "Adds", "an", "individual", "query", "for", "a", "search", "field", "that", "MUST", "occur", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsSearch.java#L187-L190
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/util/LightWeightHashSet.java
LightWeightHashSet.addElem
protected boolean addElem(final T element) { """ Add given element to the hash table @return true if the element was not present in the table, false otherwise """ // validate element if (element == null) { throw new IllegalArgumentException("Null element is not supported."); } // find hashCode & index final int hashCode = element.hashCode(); final int index = getIndex(hashCode); // return false if already present if (containsElem(index, element, hashCode)) { return false; } modification++; size++; // update bucket linked list LinkedElement<T> le = new LinkedElement<T>(element, hashCode); le.next = entries[index]; entries[index] = le; return true; }
java
protected boolean addElem(final T element) { // validate element if (element == null) { throw new IllegalArgumentException("Null element is not supported."); } // find hashCode & index final int hashCode = element.hashCode(); final int index = getIndex(hashCode); // return false if already present if (containsElem(index, element, hashCode)) { return false; } modification++; size++; // update bucket linked list LinkedElement<T> le = new LinkedElement<T>(element, hashCode); le.next = entries[index]; entries[index] = le; return true; }
[ "protected", "boolean", "addElem", "(", "final", "T", "element", ")", "{", "// validate element", "if", "(", "element", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Null element is not supported.\"", ")", ";", "}", "// find hashCode & ...
Add given element to the hash table @return true if the element was not present in the table, false otherwise
[ "Add", "given", "element", "to", "the", "hash", "table" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/util/LightWeightHashSet.java#L236-L257
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnServerConfigurationsInner.java
P2sVpnServerConfigurationsInner.listByVirtualWanWithServiceResponseAsync
public Observable<ServiceResponse<Page<P2SVpnServerConfigurationInner>>> listByVirtualWanWithServiceResponseAsync(final String resourceGroupName, final String virtualWanName) { """ Retrieves all P2SVpnServerConfigurations for a particular VirtualWan. @param resourceGroupName The resource group name of the VirtualWan. @param virtualWanName The name of the VirtualWan. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;P2SVpnServerConfigurationInner&gt; object """ return listByVirtualWanSinglePageAsync(resourceGroupName, virtualWanName) .concatMap(new Func1<ServiceResponse<Page<P2SVpnServerConfigurationInner>>, Observable<ServiceResponse<Page<P2SVpnServerConfigurationInner>>>>() { @Override public Observable<ServiceResponse<Page<P2SVpnServerConfigurationInner>>> call(ServiceResponse<Page<P2SVpnServerConfigurationInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listByVirtualWanNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<P2SVpnServerConfigurationInner>>> listByVirtualWanWithServiceResponseAsync(final String resourceGroupName, final String virtualWanName) { return listByVirtualWanSinglePageAsync(resourceGroupName, virtualWanName) .concatMap(new Func1<ServiceResponse<Page<P2SVpnServerConfigurationInner>>, Observable<ServiceResponse<Page<P2SVpnServerConfigurationInner>>>>() { @Override public Observable<ServiceResponse<Page<P2SVpnServerConfigurationInner>>> call(ServiceResponse<Page<P2SVpnServerConfigurationInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listByVirtualWanNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "P2SVpnServerConfigurationInner", ">", ">", ">", "listByVirtualWanWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "virtualWanName", ")", "{", "return", "lis...
Retrieves all P2SVpnServerConfigurations for a particular VirtualWan. @param resourceGroupName The resource group name of the VirtualWan. @param virtualWanName The name of the VirtualWan. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;P2SVpnServerConfigurationInner&gt; object
[ "Retrieves", "all", "P2SVpnServerConfigurations", "for", "a", "particular", "VirtualWan", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnServerConfigurationsInner.java#L599-L611
jayantk/jklol
src/com/jayantkrish/jklol/models/DiscreteVariable.java
DiscreteVariable.fromCsvColumn
public static DiscreteVariable fromCsvColumn(String variableName, String filename, String delimiter, int columnNumber) { """ Constructs a variable containing all of the values in {@code columnNumber} of the delimited file {@code filename}. {@code delimiter} separates the columns of the file. @param variableName @param filename @param delimiter @param columnNumber @return """ List<String> values = IoUtils.readColumnFromDelimitedFile(filename, columnNumber, delimiter); return new DiscreteVariable(variableName, values); }
java
public static DiscreteVariable fromCsvColumn(String variableName, String filename, String delimiter, int columnNumber) { List<String> values = IoUtils.readColumnFromDelimitedFile(filename, columnNumber, delimiter); return new DiscreteVariable(variableName, values); }
[ "public", "static", "DiscreteVariable", "fromCsvColumn", "(", "String", "variableName", ",", "String", "filename", ",", "String", "delimiter", ",", "int", "columnNumber", ")", "{", "List", "<", "String", ">", "values", "=", "IoUtils", ".", "readColumnFromDelimited...
Constructs a variable containing all of the values in {@code columnNumber} of the delimited file {@code filename}. {@code delimiter} separates the columns of the file. @param variableName @param filename @param delimiter @param columnNumber @return
[ "Constructs", "a", "variable", "containing", "all", "of", "the", "values", "in", "{", "@code", "columnNumber", "}", "of", "the", "delimited", "file", "{", "@code", "filename", "}", ".", "{", "@code", "delimiter", "}", "separates", "the", "columns", "of", "...
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/models/DiscreteVariable.java#L69-L73
DDTH/ddth-dao
ddth-dao-core/src/main/java/com/github/ddth/dao/BaseDataJsonFieldBo.java
BaseDataJsonFieldBo.getDataAttr
public <T> T getDataAttr(String dPath, Class<T> clazz) { """ Get a "data"'s sub-attribute using d-path. @param dPath @param clazz @return @see DPathUtils """ Lock lock = lockForRead(); try { return DPathUtils.getValue(dataJson, dPath, clazz); } finally { lock.unlock(); } }
java
public <T> T getDataAttr(String dPath, Class<T> clazz) { Lock lock = lockForRead(); try { return DPathUtils.getValue(dataJson, dPath, clazz); } finally { lock.unlock(); } }
[ "public", "<", "T", ">", "T", "getDataAttr", "(", "String", "dPath", ",", "Class", "<", "T", ">", "clazz", ")", "{", "Lock", "lock", "=", "lockForRead", "(", ")", ";", "try", "{", "return", "DPathUtils", ".", "getValue", "(", "dataJson", ",", "dPath"...
Get a "data"'s sub-attribute using d-path. @param dPath @param clazz @return @see DPathUtils
[ "Get", "a", "data", "s", "sub", "-", "attribute", "using", "d", "-", "path", "." ]
train
https://github.com/DDTH/ddth-dao/blob/8d059ddf641a1629aa53851f9d1b41abf175a180/ddth-dao-core/src/main/java/com/github/ddth/dao/BaseDataJsonFieldBo.java#L142-L149
hdbeukel/james-core
src/main/java/org/jamesframework/core/subset/neigh/SinglePerturbationNeighbourhood.java
SinglePerturbationNeighbourhood.canAdd
private boolean canAdd(SubsetSolution solution, Set<Integer> addCandidates) { """ Check if it is allowed to add one more item to the selection. @param solution solution for which moves are generated @param addCandidates set of candidate IDs to be added @return <code>true</code> if it is allowed to add an item to the selection """ return !addCandidates.isEmpty() && isValidSubsetSize(solution.getNumSelectedIDs()+1); }
java
private boolean canAdd(SubsetSolution solution, Set<Integer> addCandidates){ return !addCandidates.isEmpty() && isValidSubsetSize(solution.getNumSelectedIDs()+1); }
[ "private", "boolean", "canAdd", "(", "SubsetSolution", "solution", ",", "Set", "<", "Integer", ">", "addCandidates", ")", "{", "return", "!", "addCandidates", ".", "isEmpty", "(", ")", "&&", "isValidSubsetSize", "(", "solution", ".", "getNumSelectedIDs", "(", ...
Check if it is allowed to add one more item to the selection. @param solution solution for which moves are generated @param addCandidates set of candidate IDs to be added @return <code>true</code> if it is allowed to add an item to the selection
[ "Check", "if", "it", "is", "allowed", "to", "add", "one", "more", "item", "to", "the", "selection", "." ]
train
https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/subset/neigh/SinglePerturbationNeighbourhood.java#L221-L224
apache/groovy
src/main/groovy/groovy/lang/GroovyClassLoader.java
GroovyClassLoader.loadClass
protected Class loadClass(final String name, boolean resolve) throws ClassNotFoundException { """ Implemented here to check package access prior to returning an already loaded class. @throws CompilationFailedException if the compilation failed @throws ClassNotFoundException if the class was not found @see java.lang.ClassLoader#loadClass(java.lang.String, boolean) """ return loadClass(name, true, true, resolve); }
java
protected Class loadClass(final String name, boolean resolve) throws ClassNotFoundException { return loadClass(name, true, true, resolve); }
[ "protected", "Class", "loadClass", "(", "final", "String", "name", ",", "boolean", "resolve", ")", "throws", "ClassNotFoundException", "{", "return", "loadClass", "(", "name", ",", "true", ",", "true", ",", "resolve", ")", ";", "}" ]
Implemented here to check package access prior to returning an already loaded class. @throws CompilationFailedException if the compilation failed @throws ClassNotFoundException if the class was not found @see java.lang.ClassLoader#loadClass(java.lang.String, boolean)
[ "Implemented", "here", "to", "check", "package", "access", "prior", "to", "returning", "an", "already", "loaded", "class", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/GroovyClassLoader.java#L870-L872
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/io/file/PathHelper.java
PathHelper.isFileNewer
public static boolean isFileNewer (@Nonnull final Path aFile1, @Nonnull final Path aFile2) { """ Returns <code>true</code> if the first file is newer than the second file. Returns <code>true</code> if the first file exists and the second file does not exist. Returns <code>false</code> if the first file is older than the second file. Returns <code>false</code> if the first file does not exists but the second does. Returns <code>false</code> if none of the files exist. @param aFile1 First file. May not be <code>null</code>. @param aFile2 Second file. May not be <code>null</code>. @return <code>true</code> if the first file is newer than the second file, <code>false</code> otherwise. """ ValueEnforcer.notNull (aFile1, "File1"); ValueEnforcer.notNull (aFile2, "aFile2"); // The Files API seem to be slow return FileHelper.isFileNewer (aFile1.toFile (), aFile2.toFile ()); // // Compare with the same file? // if (aFile1.equals (aFile2)) // return false; // // // if the first file does not exists, always false // if (!Files.exists (aFile1)) // return false; // // // first file exists, but second file does not // if (!Files.exists (aFile2)) // return true; // // try // { // // both exist, compare file times // return Files.getLastModifiedTime (aFile1).compareTo // (Files.getLastModifiedTime (aFile2)) > 0; // } // catch (final IOException ex) // { // throw new UncheckedIOException (ex); // } }
java
public static boolean isFileNewer (@Nonnull final Path aFile1, @Nonnull final Path aFile2) { ValueEnforcer.notNull (aFile1, "File1"); ValueEnforcer.notNull (aFile2, "aFile2"); // The Files API seem to be slow return FileHelper.isFileNewer (aFile1.toFile (), aFile2.toFile ()); // // Compare with the same file? // if (aFile1.equals (aFile2)) // return false; // // // if the first file does not exists, always false // if (!Files.exists (aFile1)) // return false; // // // first file exists, but second file does not // if (!Files.exists (aFile2)) // return true; // // try // { // // both exist, compare file times // return Files.getLastModifiedTime (aFile1).compareTo // (Files.getLastModifiedTime (aFile2)) > 0; // } // catch (final IOException ex) // { // throw new UncheckedIOException (ex); // } }
[ "public", "static", "boolean", "isFileNewer", "(", "@", "Nonnull", "final", "Path", "aFile1", ",", "@", "Nonnull", "final", "Path", "aFile2", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aFile1", ",", "\"File1\"", ")", ";", "ValueEnforcer", ".", "notNull...
Returns <code>true</code> if the first file is newer than the second file. Returns <code>true</code> if the first file exists and the second file does not exist. Returns <code>false</code> if the first file is older than the second file. Returns <code>false</code> if the first file does not exists but the second does. Returns <code>false</code> if none of the files exist. @param aFile1 First file. May not be <code>null</code>. @param aFile2 Second file. May not be <code>null</code>. @return <code>true</code> if the first file is newer than the second file, <code>false</code> otherwise.
[ "Returns", "<code", ">", "true<", "/", "code", ">", "if", "the", "first", "file", "is", "newer", "than", "the", "second", "file", ".", "Returns", "<code", ">", "true<", "/", "code", ">", "if", "the", "first", "file", "exists", "and", "the", "second", ...
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/file/PathHelper.java#L421-L451
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java
UnicodeSet.indexOf
public int indexOf(int c) { """ Returns the index of the given character within this set, where the set is ordered by ascending code point. If the character is not in this set, return -1. The inverse of this method is <code>charAt()</code>. @return an index from 0..size()-1, or -1 """ if (c < MIN_VALUE || c > MAX_VALUE) { throw new IllegalArgumentException("Invalid code point U+" + Utility.hex(c, 6)); } int i = 0; int n = 0; for (;;) { int start = list[i++]; if (c < start) { return -1; } int limit = list[i++]; if (c < limit) { return n + c - start; } n += limit - start; } }
java
public int indexOf(int c) { if (c < MIN_VALUE || c > MAX_VALUE) { throw new IllegalArgumentException("Invalid code point U+" + Utility.hex(c, 6)); } int i = 0; int n = 0; for (;;) { int start = list[i++]; if (c < start) { return -1; } int limit = list[i++]; if (c < limit) { return n + c - start; } n += limit - start; } }
[ "public", "int", "indexOf", "(", "int", "c", ")", "{", "if", "(", "c", "<", "MIN_VALUE", "||", "c", ">", "MAX_VALUE", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Invalid code point U+\"", "+", "Utility", ".", "hex", "(", "c", ",", "6", ...
Returns the index of the given character within this set, where the set is ordered by ascending code point. If the character is not in this set, return -1. The inverse of this method is <code>charAt()</code>. @return an index from 0..size()-1, or -1
[ "Returns", "the", "index", "of", "the", "given", "character", "within", "this", "set", "where", "the", "set", "is", "ordered", "by", "ascending", "code", "point", ".", "If", "the", "character", "is", "not", "in", "this", "set", "return", "-", "1", ".", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java#L1091-L1108
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/StringUtils.java
StringUtils.abbreviateMiddle
public static String abbreviateMiddle(final String str, final String middle, final int length) { """ <p>Abbreviates a String to the length passed, replacing the middle characters with the supplied replacement String.</p> <p>This abbreviation only occurs if the following criteria is met:</p> <ul> <li>Neither the String for abbreviation nor the replacement String are null or empty </li> <li>The length to truncate to is less than the length of the supplied String</li> <li>The length to truncate to is greater than 0</li> <li>The abbreviated String will have enough room for the length supplied replacement String and the first and last characters of the supplied String for abbreviation</li> </ul> <p>Otherwise, the returned String will be the same as the supplied String for abbreviation. </p> <pre> StringUtils.abbreviateMiddle(null, null, 0) = null StringUtils.abbreviateMiddle("abc", null, 0) = "abc" StringUtils.abbreviateMiddle("abc", ".", 0) = "abc" StringUtils.abbreviateMiddle("abc", ".", 3) = "abc" StringUtils.abbreviateMiddle("abcdef", ".", 4) = "ab.f" </pre> @param str the String to abbreviate, may be null @param middle the String to replace the middle characters with, may be null @param length the length to abbreviate {@code str} to. @return the abbreviated String if the above criteria is met, or the original String supplied for abbreviation. @since 2.5 """ if (isEmpty(str) || isEmpty(middle)) { return str; } if (length >= str.length() || length < middle.length()+2) { return str; } final int targetSting = length-middle.length(); final int startOffset = targetSting/2+targetSting%2; final int endOffset = str.length()-targetSting/2; return str.substring(0, startOffset) + middle + str.substring(endOffset); }
java
public static String abbreviateMiddle(final String str, final String middle, final int length) { if (isEmpty(str) || isEmpty(middle)) { return str; } if (length >= str.length() || length < middle.length()+2) { return str; } final int targetSting = length-middle.length(); final int startOffset = targetSting/2+targetSting%2; final int endOffset = str.length()-targetSting/2; return str.substring(0, startOffset) + middle + str.substring(endOffset); }
[ "public", "static", "String", "abbreviateMiddle", "(", "final", "String", "str", ",", "final", "String", "middle", ",", "final", "int", "length", ")", "{", "if", "(", "isEmpty", "(", "str", ")", "||", "isEmpty", "(", "middle", ")", ")", "{", "return", ...
<p>Abbreviates a String to the length passed, replacing the middle characters with the supplied replacement String.</p> <p>This abbreviation only occurs if the following criteria is met:</p> <ul> <li>Neither the String for abbreviation nor the replacement String are null or empty </li> <li>The length to truncate to is less than the length of the supplied String</li> <li>The length to truncate to is greater than 0</li> <li>The abbreviated String will have enough room for the length supplied replacement String and the first and last characters of the supplied String for abbreviation</li> </ul> <p>Otherwise, the returned String will be the same as the supplied String for abbreviation. </p> <pre> StringUtils.abbreviateMiddle(null, null, 0) = null StringUtils.abbreviateMiddle("abc", null, 0) = "abc" StringUtils.abbreviateMiddle("abc", ".", 0) = "abc" StringUtils.abbreviateMiddle("abc", ".", 3) = "abc" StringUtils.abbreviateMiddle("abcdef", ".", 4) = "ab.f" </pre> @param str the String to abbreviate, may be null @param middle the String to replace the middle characters with, may be null @param length the length to abbreviate {@code str} to. @return the abbreviated String if the above criteria is met, or the original String supplied for abbreviation. @since 2.5
[ "<p", ">", "Abbreviates", "a", "String", "to", "the", "length", "passed", "replacing", "the", "middle", "characters", "with", "the", "supplied", "replacement", "String", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L7759-L7775
jbundle/jbundle
base/remote/src/main/java/org/jbundle/base/remote/db/TaskSession.java
TaskSession.createRemoteSendQueue
public RemoteSendQueue createRemoteSendQueue(String strQueueName, String strQueueType) throws RemoteException { """ Create the remote send queue. @param strQueueName The queue name to service. @param strQueueType The queue type. @return The RemoteSendQueue. """ MessageManager messageManager = this.getEnvironment().getMessageManager(this.getApplication(), true); BaseMessageSender sender = (BaseMessageSender)messageManager.getMessageQueue(strQueueName, strQueueType).getMessageSender(); SendQueueSession remoteQueue = new SendQueueSession(this, sender); return remoteQueue; }
java
public RemoteSendQueue createRemoteSendQueue(String strQueueName, String strQueueType) throws RemoteException { MessageManager messageManager = this.getEnvironment().getMessageManager(this.getApplication(), true); BaseMessageSender sender = (BaseMessageSender)messageManager.getMessageQueue(strQueueName, strQueueType).getMessageSender(); SendQueueSession remoteQueue = new SendQueueSession(this, sender); return remoteQueue; }
[ "public", "RemoteSendQueue", "createRemoteSendQueue", "(", "String", "strQueueName", ",", "String", "strQueueType", ")", "throws", "RemoteException", "{", "MessageManager", "messageManager", "=", "this", ".", "getEnvironment", "(", ")", ".", "getMessageManager", "(", ...
Create the remote send queue. @param strQueueName The queue name to service. @param strQueueType The queue type. @return The RemoteSendQueue.
[ "Create", "the", "remote", "send", "queue", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/db/TaskSession.java#L274-L280
yidongnan/grpc-spring-boot-starter
grpc-common-spring-boot/src/main/java/net/devh/boot/grpc/common/metric/AbstractMetricCollectingInterceptor.java
AbstractMetricCollectingInterceptor.newMetricsFor
protected MetricSet newMetricsFor(final MethodDescriptor<?, ?> method) { """ Creates a {@link MetricSet} for the given gRPC method. This will initialize all default counters and timers for that method. @param method The method to get the metric set for. @return The newly created metric set for the given method. """ log.debug("Creating new metrics for {}", method.getFullMethodName()); return new MetricSet(newRequestCounterFor(method), newResponseCounterFor(method), newTimerFunction(method)); }
java
protected MetricSet newMetricsFor(final MethodDescriptor<?, ?> method) { log.debug("Creating new metrics for {}", method.getFullMethodName()); return new MetricSet(newRequestCounterFor(method), newResponseCounterFor(method), newTimerFunction(method)); }
[ "protected", "MetricSet", "newMetricsFor", "(", "final", "MethodDescriptor", "<", "?", ",", "?", ">", "method", ")", "{", "log", ".", "debug", "(", "\"Creating new metrics for {}\"", ",", "method", ".", "getFullMethodName", "(", ")", ")", ";", "return", "new",...
Creates a {@link MetricSet} for the given gRPC method. This will initialize all default counters and timers for that method. @param method The method to get the metric set for. @return The newly created metric set for the given method.
[ "Creates", "a", "{", "@link", "MetricSet", "}", "for", "the", "given", "gRPC", "method", ".", "This", "will", "initialize", "all", "default", "counters", "and", "timers", "for", "that", "method", "." ]
train
https://github.com/yidongnan/grpc-spring-boot-starter/blob/07f8853cfafc9707584f2371aff012e590217b85/grpc-common-spring-boot/src/main/java/net/devh/boot/grpc/common/metric/AbstractMetricCollectingInterceptor.java#L123-L126
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/scoping/batch/FeatureScopes.java
FeatureScopes.createStaticFeatureScope
protected IScope createStaticFeatureScope( XAbstractFeatureCall featureCall, XExpression receiver, LightweightTypeReference receiverType, TypeBucket receiverBucket, IScope parent, IFeatureScopeSession session) { """ Create a scope that contains static features. The features may be obtained implicitly from a given type ({@code receiver} is {@code null}), or the features may be obtained from a concrete instance. @param featureCall the feature call that is currently processed by the scoping infrastructure @param receiver an optionally available receiver expression @param receiverType the type of the receiver. It may be available even if the receiver itself is null, which indicates an implicit receiver. @param receiverBucket the types that contribute the static features. @param parent the parent scope. Is never null. @param session the currently known scope session. Is never null. """ return new StaticFeatureScope(parent, session, featureCall, receiver, receiverType, receiverBucket, operatorMapping); }
java
protected IScope createStaticFeatureScope( XAbstractFeatureCall featureCall, XExpression receiver, LightweightTypeReference receiverType, TypeBucket receiverBucket, IScope parent, IFeatureScopeSession session) { return new StaticFeatureScope(parent, session, featureCall, receiver, receiverType, receiverBucket, operatorMapping); }
[ "protected", "IScope", "createStaticFeatureScope", "(", "XAbstractFeatureCall", "featureCall", ",", "XExpression", "receiver", ",", "LightweightTypeReference", "receiverType", ",", "TypeBucket", "receiverBucket", ",", "IScope", "parent", ",", "IFeatureScopeSession", "session"...
Create a scope that contains static features. The features may be obtained implicitly from a given type ({@code receiver} is {@code null}), or the features may be obtained from a concrete instance. @param featureCall the feature call that is currently processed by the scoping infrastructure @param receiver an optionally available receiver expression @param receiverType the type of the receiver. It may be available even if the receiver itself is null, which indicates an implicit receiver. @param receiverBucket the types that contribute the static features. @param parent the parent scope. Is never null. @param session the currently known scope session. Is never null.
[ "Create", "a", "scope", "that", "contains", "static", "features", ".", "The", "features", "may", "be", "obtained", "implicitly", "from", "a", "given", "type", "(", "{", "@code", "receiver", "}", "is", "{", "@code", "null", "}", ")", "or", "the", "feature...
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/scoping/batch/FeatureScopes.java#L507-L515
bbottema/simple-java-mail
modules/simple-java-mail/src/main/java/org/simplejavamail/converter/internal/mimemessage/MimeMessageProducer.java
MimeMessageProducer.populateMimeMessage
final MimeMessage populateMimeMessage(@Nonnull final Email email, @Nonnull Session session) throws MessagingException, UnsupportedEncodingException { """ Performs a standard population and then delegates multipart specifics to the subclass. """ checkArgumentNotEmpty(email, "email is missing"); checkArgumentNotEmpty(session, "session is needed, it cannot be attached later"); final MimeMessage message = new MimeMessage(session) { @Override protected void updateMessageID() throws MessagingException { if (valueNullOrEmpty(email.getId())) { super.updateMessageID(); } else { setHeader("Message-ID", email.getId()); } } @Override public String toString() { try { return "MimeMessage<id:" + super.getMessageID() + ", subject:" + super.getSubject() + ">"; } catch (MessagingException e) { throw new AssertionError("should not reach here"); } } }; // set basic email properties MimeMessageHelper.setSubject(email, message); MimeMessageHelper.setFrom(email, message); MimeMessageHelper.setReplyTo(email, message); MimeMessageHelper.setRecipients(email, message); populateMimeMessageMultipartStructure(message, email); MimeMessageHelper.setHeaders(email, message); message.setSentDate(new Date()); if (!valueNullOrEmpty(email.getDkimSigningDomain())) { return signMessageWithDKIM(message, email); } return message; }
java
final MimeMessage populateMimeMessage(@Nonnull final Email email, @Nonnull Session session) throws MessagingException, UnsupportedEncodingException { checkArgumentNotEmpty(email, "email is missing"); checkArgumentNotEmpty(session, "session is needed, it cannot be attached later"); final MimeMessage message = new MimeMessage(session) { @Override protected void updateMessageID() throws MessagingException { if (valueNullOrEmpty(email.getId())) { super.updateMessageID(); } else { setHeader("Message-ID", email.getId()); } } @Override public String toString() { try { return "MimeMessage<id:" + super.getMessageID() + ", subject:" + super.getSubject() + ">"; } catch (MessagingException e) { throw new AssertionError("should not reach here"); } } }; // set basic email properties MimeMessageHelper.setSubject(email, message); MimeMessageHelper.setFrom(email, message); MimeMessageHelper.setReplyTo(email, message); MimeMessageHelper.setRecipients(email, message); populateMimeMessageMultipartStructure(message, email); MimeMessageHelper.setHeaders(email, message); message.setSentDate(new Date()); if (!valueNullOrEmpty(email.getDkimSigningDomain())) { return signMessageWithDKIM(message, email); } return message; }
[ "final", "MimeMessage", "populateMimeMessage", "(", "@", "Nonnull", "final", "Email", "email", ",", "@", "Nonnull", "Session", "session", ")", "throws", "MessagingException", ",", "UnsupportedEncodingException", "{", "checkArgumentNotEmpty", "(", "email", ",", "\"emai...
Performs a standard population and then delegates multipart specifics to the subclass.
[ "Performs", "a", "standard", "population", "and", "then", "delegates", "multipart", "specifics", "to", "the", "subclass", "." ]
train
https://github.com/bbottema/simple-java-mail/blob/b03635328aeecd525e35eddfef8f5b9a184559d8/modules/simple-java-mail/src/main/java/org/simplejavamail/converter/internal/mimemessage/MimeMessageProducer.java#L32-L73
Azure/azure-sdk-for-java
iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java
IotHubResourcesInner.createEventHubConsumerGroup
public EventHubConsumerGroupInfoInner createEventHubConsumerGroup(String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { """ Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. @param resourceGroupName The name of the resource group that contains the IoT hub. @param resourceName The name of the IoT hub. @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. @param name The name of the consumer group to add. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorDetailsException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the EventHubConsumerGroupInfoInner object if successful. """ return createEventHubConsumerGroupWithServiceResponseAsync(resourceGroupName, resourceName, eventHubEndpointName, name).toBlocking().single().body(); }
java
public EventHubConsumerGroupInfoInner createEventHubConsumerGroup(String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { return createEventHubConsumerGroupWithServiceResponseAsync(resourceGroupName, resourceName, eventHubEndpointName, name).toBlocking().single().body(); }
[ "public", "EventHubConsumerGroupInfoInner", "createEventHubConsumerGroup", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "String", "eventHubEndpointName", ",", "String", "name", ")", "{", "return", "createEventHubConsumerGroupWithServiceResponseAsync", ...
Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. @param resourceGroupName The name of the resource group that contains the IoT hub. @param resourceName The name of the IoT hub. @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. @param name The name of the consumer group to add. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorDetailsException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the EventHubConsumerGroupInfoInner object if successful.
[ "Add", "a", "consumer", "group", "to", "an", "Event", "Hub", "-", "compatible", "endpoint", "in", "an", "IoT", "hub", ".", "Add", "a", "consumer", "group", "to", "an", "Event", "Hub", "-", "compatible", "endpoint", "in", "an", "IoT", "hub", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java#L1874-L1876
jbundle/jbundle
main/calendar/src/main/java/org/jbundle/main/calendar/db/AnnivMasterHandler.java
AnnivMasterHandler.doRecordChange
public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { """ Called when a change is the record status is about to happen/has happened. @param field If this file change is due to a field, this is the field. @param iChangeType The type of change that occurred. @param bDisplayOption If true, display any changes. @return an error code. ADD_TYPE - Before a write. UPDATE_TYPE - Before an update. DELETE_TYPE - Before a delete. AFTER_UPDATE_TYPE - After a write or update. LOCK_TYPE - Before a lock. SELECT_TYPE - After a select. DESELECT_TYPE - After a deselect. MOVE_NEXT_TYPE - After a move. AFTER_REQUERY_TYPE - Record opened. SELECT_EOF_TYPE - EOF Hit. """ AnnivMaster recAnnivMaster = (AnnivMaster)this.getOwner(); if (iChangeType == DBConstants.AFTER_ADD_TYPE) { Object bookmark = recAnnivMaster.getLastModified(DBConstants.BOOKMARK_HANDLE); try { recAnnivMaster.setHandle(bookmark, DBConstants.BOOKMARK_HANDLE); Calendar calStart = ((DateTimeField)this.getCalendarControl().getField(CalendarControl.START_ANNIV_DATE)).getCalendar(); Calendar calEnd = ((DateTimeField)this.getCalendarControl().getField(CalendarControl.END_ANNIV_DATE)).getCalendar(); recAnnivMaster.addAppointments(this.getAnniversary(), calStart, calEnd); recAnnivMaster.addNew(); } catch (DBException ex) { ex.printStackTrace(); } } if (iChangeType == DBConstants.AFTER_UPDATE_TYPE) { Calendar calStart = ((DateTimeField)this.getCalendarControl().getField(CalendarControl.START_ANNIV_DATE)).getCalendar(); Calendar calEnd = ((DateTimeField)this.getCalendarControl().getField(CalendarControl.END_ANNIV_DATE)).getCalendar(); recAnnivMaster.removeAppointments(this.getAnniversary()); recAnnivMaster.addAppointments(this.getAnniversary(), calStart, calEnd); } if (iChangeType == DBConstants.AFTER_DELETE_TYPE) { recAnnivMaster.removeAppointments(this.getAnniversary()); } return super.doRecordChange(field, iChangeType, bDisplayOption); }
java
public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { AnnivMaster recAnnivMaster = (AnnivMaster)this.getOwner(); if (iChangeType == DBConstants.AFTER_ADD_TYPE) { Object bookmark = recAnnivMaster.getLastModified(DBConstants.BOOKMARK_HANDLE); try { recAnnivMaster.setHandle(bookmark, DBConstants.BOOKMARK_HANDLE); Calendar calStart = ((DateTimeField)this.getCalendarControl().getField(CalendarControl.START_ANNIV_DATE)).getCalendar(); Calendar calEnd = ((DateTimeField)this.getCalendarControl().getField(CalendarControl.END_ANNIV_DATE)).getCalendar(); recAnnivMaster.addAppointments(this.getAnniversary(), calStart, calEnd); recAnnivMaster.addNew(); } catch (DBException ex) { ex.printStackTrace(); } } if (iChangeType == DBConstants.AFTER_UPDATE_TYPE) { Calendar calStart = ((DateTimeField)this.getCalendarControl().getField(CalendarControl.START_ANNIV_DATE)).getCalendar(); Calendar calEnd = ((DateTimeField)this.getCalendarControl().getField(CalendarControl.END_ANNIV_DATE)).getCalendar(); recAnnivMaster.removeAppointments(this.getAnniversary()); recAnnivMaster.addAppointments(this.getAnniversary(), calStart, calEnd); } if (iChangeType == DBConstants.AFTER_DELETE_TYPE) { recAnnivMaster.removeAppointments(this.getAnniversary()); } return super.doRecordChange(field, iChangeType, bDisplayOption); }
[ "public", "int", "doRecordChange", "(", "FieldInfo", "field", ",", "int", "iChangeType", ",", "boolean", "bDisplayOption", ")", "{", "AnnivMaster", "recAnnivMaster", "=", "(", "AnnivMaster", ")", "this", ".", "getOwner", "(", ")", ";", "if", "(", "iChangeType"...
Called when a change is the record status is about to happen/has happened. @param field If this file change is due to a field, this is the field. @param iChangeType The type of change that occurred. @param bDisplayOption If true, display any changes. @return an error code. ADD_TYPE - Before a write. UPDATE_TYPE - Before an update. DELETE_TYPE - Before a delete. AFTER_UPDATE_TYPE - After a write or update. LOCK_TYPE - Before a lock. SELECT_TYPE - After a select. DESELECT_TYPE - After a deselect. MOVE_NEXT_TYPE - After a move. AFTER_REQUERY_TYPE - Record opened. SELECT_EOF_TYPE - EOF Hit.
[ "Called", "when", "a", "change", "is", "the", "record", "status", "is", "about", "to", "happen", "/", "has", "happened", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/calendar/src/main/java/org/jbundle/main/calendar/db/AnnivMasterHandler.java#L75-L107
lukas-krecan/JsonUnit
json-unit-assertj/src/main/java/net/javacrumbs/jsonunit/assertj/JsonAssert.java
JsonAssert.isObject
public MapAssert<String, Object> isObject() { """ Asserts that given node is present and is of type object. @return MapAssert where the object is serialized as Map """ Node node = assertType(OBJECT); return new JsonMapAssert((Map<String, Object>) node.getValue(), path.asPrefix(), configuration) .as("Different value found in node \"%s\"", path); }
java
public MapAssert<String, Object> isObject() { Node node = assertType(OBJECT); return new JsonMapAssert((Map<String, Object>) node.getValue(), path.asPrefix(), configuration) .as("Different value found in node \"%s\"", path); }
[ "public", "MapAssert", "<", "String", ",", "Object", ">", "isObject", "(", ")", "{", "Node", "node", "=", "assertType", "(", "OBJECT", ")", ";", "return", "new", "JsonMapAssert", "(", "(", "Map", "<", "String", ",", "Object", ">", ")", "node", ".", "...
Asserts that given node is present and is of type object. @return MapAssert where the object is serialized as Map
[ "Asserts", "that", "given", "node", "is", "present", "and", "is", "of", "type", "object", "." ]
train
https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-assertj/src/main/java/net/javacrumbs/jsonunit/assertj/JsonAssert.java#L130-L134
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinksInner.java
ReplicationLinksInner.failover
public void failover(String resourceGroupName, String serverName, String databaseName, String linkId) { """ Sets which replica database is primary by failing over from the current primary replica database. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database that has the replication link to be failed over. @param linkId The ID of the replication link to be failed over. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent """ failoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).toBlocking().last().body(); }
java
public void failover(String resourceGroupName, String serverName, String databaseName, String linkId) { failoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).toBlocking().last().body(); }
[ "public", "void", "failover", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "String", "linkId", ")", "{", "failoverWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "databaseName", ",", ...
Sets which replica database is primary by failing over from the current primary replica database. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database that has the replication link to be failed over. @param linkId The ID of the replication link to be failed over. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Sets", "which", "replica", "database", "is", "primary", "by", "failing", "over", "from", "the", "current", "primary", "replica", "database", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinksInner.java#L298-L300
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/KeyEncoder.java
KeyEncoder.encodeDesc
public static int encodeDesc(BigDecimal value, byte[] dst, int dstOffset) { """ Encodes the given optional BigDecimal into a variable amount of bytes for descending order. If the BigDecimal is null, exactly 1 byte is written. Otherwise, the amount written can be determined by calling calculateEncodedLength. <p><i>Note:</i> It is recommended that value be normalized by stripping trailing zeros. This makes searching by value much simpler. @param value BigDecimal value to encode, may be null @param dst destination for encoded bytes @param dstOffset offset into destination array @return amount of bytes written @since 1.2 """ if (value == null) { dst[dstOffset] = NULL_BYTE_LOW; return 1; } if (value.signum() == 0) { dst[dstOffset] = (byte) 0x7f; return 1; } return encode(value).copyDescTo(dst, dstOffset); }
java
public static int encodeDesc(BigDecimal value, byte[] dst, int dstOffset) { if (value == null) { dst[dstOffset] = NULL_BYTE_LOW; return 1; } if (value.signum() == 0) { dst[dstOffset] = (byte) 0x7f; return 1; } return encode(value).copyDescTo(dst, dstOffset); }
[ "public", "static", "int", "encodeDesc", "(", "BigDecimal", "value", ",", "byte", "[", "]", "dst", ",", "int", "dstOffset", ")", "{", "if", "(", "value", "==", "null", ")", "{", "dst", "[", "dstOffset", "]", "=", "NULL_BYTE_LOW", ";", "return", "1", ...
Encodes the given optional BigDecimal into a variable amount of bytes for descending order. If the BigDecimal is null, exactly 1 byte is written. Otherwise, the amount written can be determined by calling calculateEncodedLength. <p><i>Note:</i> It is recommended that value be normalized by stripping trailing zeros. This makes searching by value much simpler. @param value BigDecimal value to encode, may be null @param dst destination for encoded bytes @param dstOffset offset into destination array @return amount of bytes written @since 1.2
[ "Encodes", "the", "given", "optional", "BigDecimal", "into", "a", "variable", "amount", "of", "bytes", "for", "descending", "order", ".", "If", "the", "BigDecimal", "is", "null", "exactly", "1", "byte", "is", "written", ".", "Otherwise", "the", "amount", "wr...
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/KeyEncoder.java#L467-L479
tzaeschke/zoodb
src/org/zoodb/internal/server/index/AbstractIndexPage.java
AbstractIndexPage.writeToPreallocated
final int writeToPreallocated(StorageChannelOutput out, Map<AbstractIndexPage, Integer> map) { """ This method takes as argument a map generated by createWriteMap(). These methods are especially created for the free space manager. But it also enables other indices to first write the inner nodes followed by leaf nodes. This write method does not allocate any pages, but takes pre-allocated pages from the supplied map. This is necessary for the free space manager, because allocating new pages during the write() process would change the free space manager again, because allocation is often associated with releasing a previously used page. @param map @return new page ID """ if (!isDirty()) { return pageId; } Integer pageIdpre = map.get(this); if (pageIdpre == null) { throw DBLogger.newFatalInternal("Page not preallocated: " + pageId + " / " + this); } if (isLeaf) { //Page was already reported to FSM during map build-up out.seekPageForWrite(ind.getDataType(), pageId); out.writeShort((short) 0); writeData(out); } else { //now write the sub pages for (int i = 0; i < getNKeys()+1; i++) { AbstractIndexPage p = subPages[i]; if (p == null) { //This can happen if pages are not loaded yet continue; } subPageIds[i] = p.writeToPreallocated(out, map); } //now write the page index out.seekPageForWrite(ind.getDataType(), pageId); out.writeShort((short) subPages.length); out.noCheckWrite(subPageIds); writeKeys(out); } out.flush(); setDirty( false ); ind.statNWrittenPages++; return pageId; }
java
final int writeToPreallocated(StorageChannelOutput out, Map<AbstractIndexPage, Integer> map) { if (!isDirty()) { return pageId; } Integer pageIdpre = map.get(this); if (pageIdpre == null) { throw DBLogger.newFatalInternal("Page not preallocated: " + pageId + " / " + this); } if (isLeaf) { //Page was already reported to FSM during map build-up out.seekPageForWrite(ind.getDataType(), pageId); out.writeShort((short) 0); writeData(out); } else { //now write the sub pages for (int i = 0; i < getNKeys()+1; i++) { AbstractIndexPage p = subPages[i]; if (p == null) { //This can happen if pages are not loaded yet continue; } subPageIds[i] = p.writeToPreallocated(out, map); } //now write the page index out.seekPageForWrite(ind.getDataType(), pageId); out.writeShort((short) subPages.length); out.noCheckWrite(subPageIds); writeKeys(out); } out.flush(); setDirty( false ); ind.statNWrittenPages++; return pageId; }
[ "final", "int", "writeToPreallocated", "(", "StorageChannelOutput", "out", ",", "Map", "<", "AbstractIndexPage", ",", "Integer", ">", "map", ")", "{", "if", "(", "!", "isDirty", "(", ")", ")", "{", "return", "pageId", ";", "}", "Integer", "pageIdpre", "=",...
This method takes as argument a map generated by createWriteMap(). These methods are especially created for the free space manager. But it also enables other indices to first write the inner nodes followed by leaf nodes. This write method does not allocate any pages, but takes pre-allocated pages from the supplied map. This is necessary for the free space manager, because allocating new pages during the write() process would change the free space manager again, because allocation is often associated with releasing a previously used page. @param map @return new page ID
[ "This", "method", "takes", "as", "argument", "a", "map", "generated", "by", "createWriteMap", "()", ".", "These", "methods", "are", "especially", "created", "for", "the", "free", "space", "manager", ".", "But", "it", "also", "enables", "other", "indices", "t...
train
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/server/index/AbstractIndexPage.java#L247-L283
ravendb/ravendb-jvm-client
src/main/java/net/ravendb/client/documents/subscriptions/DocumentSubscriptions.java
DocumentSubscriptions.getSubscriptionWorkerForRevisions
public <T> SubscriptionWorker<Revision<T>> getSubscriptionWorkerForRevisions(Class<T> clazz, String subscriptionName) { """ It opens a subscription and starts pulling documents since a last processed document for that subscription. The connection options determine client and server cooperation rules like document batch sizes or a timeout in a matter of which a client needs to acknowledge that batch has been processed. The acknowledgment is sent after all documents are processed by subscription's handlers. There can be only a single client that is connected to a subscription. @param clazz Entity class @param subscriptionName The name of subscription @param <T> Entity class @return Subscription object that allows to add/remove subscription handlers. """ return getSubscriptionWorkerForRevisions(clazz, subscriptionName, null); }
java
public <T> SubscriptionWorker<Revision<T>> getSubscriptionWorkerForRevisions(Class<T> clazz, String subscriptionName) { return getSubscriptionWorkerForRevisions(clazz, subscriptionName, null); }
[ "public", "<", "T", ">", "SubscriptionWorker", "<", "Revision", "<", "T", ">", ">", "getSubscriptionWorkerForRevisions", "(", "Class", "<", "T", ">", "clazz", ",", "String", "subscriptionName", ")", "{", "return", "getSubscriptionWorkerForRevisions", "(", "clazz",...
It opens a subscription and starts pulling documents since a last processed document for that subscription. The connection options determine client and server cooperation rules like document batch sizes or a timeout in a matter of which a client needs to acknowledge that batch has been processed. The acknowledgment is sent after all documents are processed by subscription's handlers. There can be only a single client that is connected to a subscription. @param clazz Entity class @param subscriptionName The name of subscription @param <T> Entity class @return Subscription object that allows to add/remove subscription handlers.
[ "It", "opens", "a", "subscription", "and", "starts", "pulling", "documents", "since", "a", "last", "processed", "document", "for", "that", "subscription", ".", "The", "connection", "options", "determine", "client", "and", "server", "cooperation", "rules", "like", ...
train
https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/subscriptions/DocumentSubscriptions.java#L317-L319
ButterFaces/ButterFaces
components/src/main/java/org/butterfaces/component/html/table/HtmlTable.java
HtmlTable.clearMetaInfo
public void clearMetaInfo(FacesContext context, UIComponent table) { """ Removes the cached TableColumnCache from the specified component. @param context the <code>FacesContext</code> for the current request @param table the table from which the TableColumnCache will be removed """ context.getAttributes().remove(createKey(table)); }
java
public void clearMetaInfo(FacesContext context, UIComponent table) { context.getAttributes().remove(createKey(table)); }
[ "public", "void", "clearMetaInfo", "(", "FacesContext", "context", ",", "UIComponent", "table", ")", "{", "context", ".", "getAttributes", "(", ")", ".", "remove", "(", "createKey", "(", "table", ")", ")", ";", "}" ]
Removes the cached TableColumnCache from the specified component. @param context the <code>FacesContext</code> for the current request @param table the table from which the TableColumnCache will be removed
[ "Removes", "the", "cached", "TableColumnCache", "from", "the", "specified", "component", "." ]
train
https://github.com/ButterFaces/ButterFaces/blob/e8c2bb340c89dcdbac409fcfc7a2a0e07f2462fc/components/src/main/java/org/butterfaces/component/html/table/HtmlTable.java#L113-L115
betfair/cougar
cougar-framework/jetty-transport/src/main/java/com/betfair/cougar/transport/impl/protocol/http/AbstractHttpCommandProcessor.java
AbstractHttpCommandProcessor.resolveExecutionContext
protected DehydratedExecutionContext resolveExecutionContext(HttpCommand http, CredentialsContainer cc) { """ Resolves an HttpCommand to an ExecutionContext, which provides contextual information to the ExecutionVenue that the command will be executed in. @param http contains the HttpServletRequest from which the contextual information is derived @return the ExecutionContext, populated with information from the HttpCommend """ return contextResolution.resolveExecutionContext(protocol, http, cc); }
java
protected DehydratedExecutionContext resolveExecutionContext(HttpCommand http, CredentialsContainer cc) { return contextResolution.resolveExecutionContext(protocol, http, cc); }
[ "protected", "DehydratedExecutionContext", "resolveExecutionContext", "(", "HttpCommand", "http", ",", "CredentialsContainer", "cc", ")", "{", "return", "contextResolution", ".", "resolveExecutionContext", "(", "protocol", ",", "http", ",", "cc", ")", ";", "}" ]
Resolves an HttpCommand to an ExecutionContext, which provides contextual information to the ExecutionVenue that the command will be executed in. @param http contains the HttpServletRequest from which the contextual information is derived @return the ExecutionContext, populated with information from the HttpCommend
[ "Resolves", "an", "HttpCommand", "to", "an", "ExecutionContext", "which", "provides", "contextual", "information", "to", "the", "ExecutionVenue", "that", "the", "command", "will", "be", "executed", "in", "." ]
train
https://github.com/betfair/cougar/blob/08d1fe338fbd0e8572a9c2305bb5796402d5b1f5/cougar-framework/jetty-transport/src/main/java/com/betfair/cougar/transport/impl/protocol/http/AbstractHttpCommandProcessor.java#L254-L256
oboehm/jfachwert
src/main/java/de/jfachwert/math/Nummer.java
Nummer.validate
public static String validate(String nummer) { """ Ueberprueft, ob der uebergebene String auch tatsaechlich eine Zahl ist. @param nummer z.B. "4711" @return validierter String zur Weiterverarbeitung """ try { return new BigInteger(nummer).toString(); } catch (NumberFormatException nfe) { throw new InvalidValueException(nummer, "number"); } }
java
public static String validate(String nummer) { try { return new BigInteger(nummer).toString(); } catch (NumberFormatException nfe) { throw new InvalidValueException(nummer, "number"); } }
[ "public", "static", "String", "validate", "(", "String", "nummer", ")", "{", "try", "{", "return", "new", "BigInteger", "(", "nummer", ")", ".", "toString", "(", ")", ";", "}", "catch", "(", "NumberFormatException", "nfe", ")", "{", "throw", "new", "Inva...
Ueberprueft, ob der uebergebene String auch tatsaechlich eine Zahl ist. @param nummer z.B. "4711" @return validierter String zur Weiterverarbeitung
[ "Ueberprueft", "ob", "der", "uebergebene", "String", "auch", "tatsaechlich", "eine", "Zahl", "ist", "." ]
train
https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/math/Nummer.java#L148-L154
carewebframework/carewebframework-core
org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpViewBase.java
HelpViewBase.createView
public static HelpViewBase createView(HelpViewer viewer, HelpViewType viewType) { """ Creates a new tab for the specified view type. @param viewer The help viewer instance. @param viewType The view type supported by the created tab. @return The help tab that supports the specified view type. """ Class<? extends HelpViewBase> viewClass = viewType == null ? null : getViewClass(viewType); if (viewClass == null) { return null; } try { return viewClass.getConstructor(HelpViewer.class, HelpViewType.class).newInstance(viewer, viewType); } catch (Exception e) { throw MiscUtil.toUnchecked(e); } }
java
public static HelpViewBase createView(HelpViewer viewer, HelpViewType viewType) { Class<? extends HelpViewBase> viewClass = viewType == null ? null : getViewClass(viewType); if (viewClass == null) { return null; } try { return viewClass.getConstructor(HelpViewer.class, HelpViewType.class).newInstance(viewer, viewType); } catch (Exception e) { throw MiscUtil.toUnchecked(e); } }
[ "public", "static", "HelpViewBase", "createView", "(", "HelpViewer", "viewer", ",", "HelpViewType", "viewType", ")", "{", "Class", "<", "?", "extends", "HelpViewBase", ">", "viewClass", "=", "viewType", "==", "null", "?", "null", ":", "getViewClass", "(", "vie...
Creates a new tab for the specified view type. @param viewer The help viewer instance. @param viewType The view type supported by the created tab. @return The help tab that supports the specified view type.
[ "Creates", "a", "new", "tab", "for", "the", "specified", "view", "type", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpViewBase.java#L59-L71
gallandarakhneorg/afc
core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3d.java
AlignedBox3d.setFromCornersProperties
public void setFromCornersProperties(Point3d p1, Point3d p2) { """ Change the frame of the box. @param p1 is the coordinate of the first corner. @param p2 is the coordinate of the second corner. """ if (p1.getX()<p2.getX()) { this.minxProperty = p1.xProperty; this.maxxProperty = p2.xProperty; } else { this.minxProperty = p2.xProperty; this.maxxProperty = p1.xProperty; } if (p1.getY()<p2.getY()) { this.minyProperty = p1.yProperty; this.maxyProperty = p2.yProperty; } else { this.minyProperty = p2.yProperty; this.maxyProperty = p1.yProperty; } if (p1.getZ()<p2.getZ()) { this.minzProperty = p1.zProperty; this.maxzProperty = p2.zProperty; } else { this.minzProperty = p2.zProperty; this.maxzProperty = p1.zProperty; } }
java
public void setFromCornersProperties(Point3d p1, Point3d p2) { if (p1.getX()<p2.getX()) { this.minxProperty = p1.xProperty; this.maxxProperty = p2.xProperty; } else { this.minxProperty = p2.xProperty; this.maxxProperty = p1.xProperty; } if (p1.getY()<p2.getY()) { this.minyProperty = p1.yProperty; this.maxyProperty = p2.yProperty; } else { this.minyProperty = p2.yProperty; this.maxyProperty = p1.yProperty; } if (p1.getZ()<p2.getZ()) { this.minzProperty = p1.zProperty; this.maxzProperty = p2.zProperty; } else { this.minzProperty = p2.zProperty; this.maxzProperty = p1.zProperty; } }
[ "public", "void", "setFromCornersProperties", "(", "Point3d", "p1", ",", "Point3d", "p2", ")", "{", "if", "(", "p1", ".", "getX", "(", ")", "<", "p2", ".", "getX", "(", ")", ")", "{", "this", ".", "minxProperty", "=", "p1", ".", "xProperty", ";", "...
Change the frame of the box. @param p1 is the coordinate of the first corner. @param p2 is the coordinate of the second corner.
[ "Change", "the", "frame", "of", "the", "box", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3d.java#L332-L357
VoltDB/voltdb
examples/callcenter/procedures/callcenter/BeginCall.java
BeginCall.run
public long run(int agent_id, String phone_no, long call_id, TimestampType start_ts) { """ Procedure main logic. @param uuid Column value for tuple insertion and partitioning key for this procedure. @param val Column value for tuple insertion. @param update_ts Column value for tuple insertion. @param newestToDiscard Try to remove any tuples as old or older than this value. @param targetMaxRowsToDelete The upper limit on the number of rows to delete per transaction. @return The number of deleted rows. @throws VoltAbortException on bad input. """ voltQueueSQL(findOpenCall, EXPECT_ZERO_OR_ONE_ROW, call_id, agent_id, phone_no); voltQueueSQL(findCompletedCall, EXPECT_ZERO_OR_ONE_ROW, call_id, agent_id, phone_no); VoltTable[] results = voltExecuteSQL(); boolean completedCall = results[1].getRowCount() > 0; if (completedCall) { return -1; } VoltTable openRowTable = results[0]; if (openRowTable.getRowCount() > 0) { VoltTableRow existingCall = openRowTable.fetchRow(0); // check if this is the second begin we've seen for this open call existingCall.getTimestampAsTimestamp("start_ts"); if (existingCall.wasNull() == false) { return -1; } // check if this completes the call TimestampType end_ts = existingCall.getTimestampAsTimestamp("end_ts"); if (existingCall.wasNull() == false) { int durationms = (int) ((end_ts.getTime() - start_ts.getTime()) / 1000); // update per-day running stddev calculation computeRunningStdDev(agent_id, end_ts, durationms); // completes the call voltQueueSQL(deleteOpenCall, EXPECT_SCALAR_MATCH(1), call_id, agent_id, phone_no); voltQueueSQL(insertCompletedCall, EXPECT_SCALAR_MATCH(1), call_id, agent_id, phone_no, start_ts, end_ts, durationms); voltExecuteSQL(true); return 0; } } voltQueueSQL(upsertOpenCall, EXPECT_SCALAR_MATCH(1), call_id, agent_id, phone_no, start_ts); voltExecuteSQL(true); return 0; }
java
public long run(int agent_id, String phone_no, long call_id, TimestampType start_ts) { voltQueueSQL(findOpenCall, EXPECT_ZERO_OR_ONE_ROW, call_id, agent_id, phone_no); voltQueueSQL(findCompletedCall, EXPECT_ZERO_OR_ONE_ROW, call_id, agent_id, phone_no); VoltTable[] results = voltExecuteSQL(); boolean completedCall = results[1].getRowCount() > 0; if (completedCall) { return -1; } VoltTable openRowTable = results[0]; if (openRowTable.getRowCount() > 0) { VoltTableRow existingCall = openRowTable.fetchRow(0); // check if this is the second begin we've seen for this open call existingCall.getTimestampAsTimestamp("start_ts"); if (existingCall.wasNull() == false) { return -1; } // check if this completes the call TimestampType end_ts = existingCall.getTimestampAsTimestamp("end_ts"); if (existingCall.wasNull() == false) { int durationms = (int) ((end_ts.getTime() - start_ts.getTime()) / 1000); // update per-day running stddev calculation computeRunningStdDev(agent_id, end_ts, durationms); // completes the call voltQueueSQL(deleteOpenCall, EXPECT_SCALAR_MATCH(1), call_id, agent_id, phone_no); voltQueueSQL(insertCompletedCall, EXPECT_SCALAR_MATCH(1), call_id, agent_id, phone_no, start_ts, end_ts, durationms); voltExecuteSQL(true); return 0; } } voltQueueSQL(upsertOpenCall, EXPECT_SCALAR_MATCH(1), call_id, agent_id, phone_no, start_ts); voltExecuteSQL(true); return 0; }
[ "public", "long", "run", "(", "int", "agent_id", ",", "String", "phone_no", ",", "long", "call_id", ",", "TimestampType", "start_ts", ")", "{", "voltQueueSQL", "(", "findOpenCall", ",", "EXPECT_ZERO_OR_ONE_ROW", ",", "call_id", ",", "agent_id", ",", "phone_no", ...
Procedure main logic. @param uuid Column value for tuple insertion and partitioning key for this procedure. @param val Column value for tuple insertion. @param update_ts Column value for tuple insertion. @param newestToDiscard Try to remove any tuples as old or older than this value. @param targetMaxRowsToDelete The upper limit on the number of rows to delete per transaction. @return The number of deleted rows. @throws VoltAbortException on bad input.
[ "Procedure", "main", "logic", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/examples/callcenter/procedures/callcenter/BeginCall.java#L82-L125
aws/aws-sdk-java
aws-java-sdk-elastictranscoder/src/main/java/com/amazonaws/services/elastictranscoder/model/CreateJobRequest.java
CreateJobRequest.withUserMetadata
public CreateJobRequest withUserMetadata(java.util.Map<String, String> userMetadata) { """ <p> User-defined metadata that you want to associate with an Elastic Transcoder job. You specify metadata in <code>key/value</code> pairs, and you can add up to 10 <code>key/value</code> pairs per job. Elastic Transcoder does not guarantee that <code>key/value</code> pairs are returned in the same order in which you specify them. </p> @param userMetadata User-defined metadata that you want to associate with an Elastic Transcoder job. You specify metadata in <code>key/value</code> pairs, and you can add up to 10 <code>key/value</code> pairs per job. Elastic Transcoder does not guarantee that <code>key/value</code> pairs are returned in the same order in which you specify them. @return Returns a reference to this object so that method calls can be chained together. """ setUserMetadata(userMetadata); return this; }
java
public CreateJobRequest withUserMetadata(java.util.Map<String, String> userMetadata) { setUserMetadata(userMetadata); return this; }
[ "public", "CreateJobRequest", "withUserMetadata", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "userMetadata", ")", "{", "setUserMetadata", "(", "userMetadata", ")", ";", "return", "this", ";", "}" ]
<p> User-defined metadata that you want to associate with an Elastic Transcoder job. You specify metadata in <code>key/value</code> pairs, and you can add up to 10 <code>key/value</code> pairs per job. Elastic Transcoder does not guarantee that <code>key/value</code> pairs are returned in the same order in which you specify them. </p> @param userMetadata User-defined metadata that you want to associate with an Elastic Transcoder job. You specify metadata in <code>key/value</code> pairs, and you can add up to 10 <code>key/value</code> pairs per job. Elastic Transcoder does not guarantee that <code>key/value</code> pairs are returned in the same order in which you specify them. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "User", "-", "defined", "metadata", "that", "you", "want", "to", "associate", "with", "an", "Elastic", "Transcoder", "job", ".", "You", "specify", "metadata", "in", "<code", ">", "key", "/", "value<", "/", "code", ">", "pairs", "and", "you", ...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-elastictranscoder/src/main/java/com/amazonaws/services/elastictranscoder/model/CreateJobRequest.java#L589-L592
groupon/odo
proxylib/src/main/java/com/groupon/odo/proxylib/PathOverrideService.java
PathOverrideService.createOverride
public void createOverride(int groupId, String methodName, String className) throws Exception { """ given the groupId, and 2 string arrays, adds the name-responses pair to the table_override @param groupId ID of group @param methodName name of method @param className name of class @throws Exception exception """ // first make sure this doesn't already exist for (Method method : EditService.getInstance().getMethodsFromGroupId(groupId, null)) { if (method.getMethodName().equals(methodName) && method.getClassName().equals(className)) { // don't add if it already exists in the group return; } } try (Connection sqlConnection = sqlService.getConnection()) { PreparedStatement statement = sqlConnection.prepareStatement( "INSERT INTO " + Constants.DB_TABLE_OVERRIDE + "(" + Constants.OVERRIDE_METHOD_NAME + "," + Constants.OVERRIDE_CLASS_NAME + "," + Constants.OVERRIDE_GROUP_ID + ")" + " VALUES (?, ?, ?)" ); statement.setString(1, methodName); statement.setString(2, className); statement.setInt(3, groupId); statement.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } }
java
public void createOverride(int groupId, String methodName, String className) throws Exception { // first make sure this doesn't already exist for (Method method : EditService.getInstance().getMethodsFromGroupId(groupId, null)) { if (method.getMethodName().equals(methodName) && method.getClassName().equals(className)) { // don't add if it already exists in the group return; } } try (Connection sqlConnection = sqlService.getConnection()) { PreparedStatement statement = sqlConnection.prepareStatement( "INSERT INTO " + Constants.DB_TABLE_OVERRIDE + "(" + Constants.OVERRIDE_METHOD_NAME + "," + Constants.OVERRIDE_CLASS_NAME + "," + Constants.OVERRIDE_GROUP_ID + ")" + " VALUES (?, ?, ?)" ); statement.setString(1, methodName); statement.setString(2, className); statement.setInt(3, groupId); statement.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } }
[ "public", "void", "createOverride", "(", "int", "groupId", ",", "String", "methodName", ",", "String", "className", ")", "throws", "Exception", "{", "// first make sure this doesn't already exist", "for", "(", "Method", "method", ":", "EditService", ".", "getInstance"...
given the groupId, and 2 string arrays, adds the name-responses pair to the table_override @param groupId ID of group @param methodName name of method @param className name of class @throws Exception exception
[ "given", "the", "groupId", "and", "2", "string", "arrays", "adds", "the", "name", "-", "responses", "pair", "to", "the", "table_override" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/PathOverrideService.java#L400-L425
lessthanoptimal/ddogleg
src/org/ddogleg/struct/LinkedList.java
LinkedList.addAll
public void addAll( T[] array , int first , int length ) { """ Adds the specified elements from array into this list @param array The array @param first First element to be added @param length The number of elements to be added """ if( length <= 0 ) return; Element<T> a = requestNew(); a.object = array[first]; if( this.first == null ) { this.first = a; } else if( last != null ) { last.next = a; a.previous = last; } for (int i = 1; i < length; i++) { Element<T> b = requestNew(); b.object = array[first+i]; a.next = b; b.previous = a; a = b; } last = a; size += length; }
java
public void addAll( T[] array , int first , int length ) { if( length <= 0 ) return; Element<T> a = requestNew(); a.object = array[first]; if( this.first == null ) { this.first = a; } else if( last != null ) { last.next = a; a.previous = last; } for (int i = 1; i < length; i++) { Element<T> b = requestNew(); b.object = array[first+i]; a.next = b; b.previous = a; a = b; } last = a; size += length; }
[ "public", "void", "addAll", "(", "T", "[", "]", "array", ",", "int", "first", ",", "int", "length", ")", "{", "if", "(", "length", "<=", "0", ")", "return", ";", "Element", "<", "T", ">", "a", "=", "requestNew", "(", ")", ";", "a", ".", "object...
Adds the specified elements from array into this list @param array The array @param first First element to be added @param length The number of elements to be added
[ "Adds", "the", "specified", "elements", "from", "array", "into", "this", "list" ]
train
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/struct/LinkedList.java#L387-L412
structurizr/java
structurizr-core/src/com/structurizr/view/ViewSet.java
ViewSet.createFilteredView
public FilteredView createFilteredView(StaticView view, String key, String description, FilterMode mode, String... tags) { """ Creates a FilteredView on top of an existing static view. @param view the static view to base the FilteredView upon @param key the key for the filtered view (must be unique) @param description a description @param mode whether to Include or Exclude elements/relationships based upon their tag @param tags the tags to include or exclude @return a FilteredView object """ assertThatTheViewIsNotNull(view); assertThatTheViewKeyIsSpecifiedAndUnique(key); FilteredView filteredView = new FilteredView(view, key, description, mode, tags); filteredViews.add(filteredView); return filteredView; }
java
public FilteredView createFilteredView(StaticView view, String key, String description, FilterMode mode, String... tags) { assertThatTheViewIsNotNull(view); assertThatTheViewKeyIsSpecifiedAndUnique(key); FilteredView filteredView = new FilteredView(view, key, description, mode, tags); filteredViews.add(filteredView); return filteredView; }
[ "public", "FilteredView", "createFilteredView", "(", "StaticView", "view", ",", "String", "key", ",", "String", "description", ",", "FilterMode", "mode", ",", "String", "...", "tags", ")", "{", "assertThatTheViewIsNotNull", "(", "view", ")", ";", "assertThatTheVie...
Creates a FilteredView on top of an existing static view. @param view the static view to base the FilteredView upon @param key the key for the filtered view (must be unique) @param description a description @param mode whether to Include or Exclude elements/relationships based upon their tag @param tags the tags to include or exclude @return a FilteredView object
[ "Creates", "a", "FilteredView", "on", "top", "of", "an", "existing", "static", "view", "." ]
train
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/view/ViewSet.java#L235-L242
apache/incubator-heron
heron/schedulers/src/java/org/apache/heron/scheduler/mesos/framework/LaunchableTask.java
LaunchableTask.constructMesosTaskInfo
public Protos.TaskInfo constructMesosTaskInfo(Config heronConfig, Config heronRuntime) { """ Construct the Mesos TaskInfo in Protos to launch basing on the LaunchableTask @param heronConfig the heron config @param heronRuntime the heron runtime @return Mesos TaskInfo in Protos to launch """ //String taskIdStr, BaseContainer task, Offer offer String taskIdStr = this.taskId; Protos.TaskID mesosTaskID = Protos.TaskID.newBuilder().setValue(taskIdStr).build(); Protos.TaskInfo.Builder taskInfo = Protos.TaskInfo.newBuilder() .setName(baseContainer.name) .setTaskId(mesosTaskID); Protos.Environment.Builder environment = Protos.Environment.newBuilder(); // If the job defines custom environment variables, add them to the builder // Don't add them if they already exist to prevent overwriting the defaults Set<String> builtinEnvNames = new HashSet<>(); for (Protos.Environment.Variable variable : environment.getVariablesList()) { builtinEnvNames.add(variable.getName()); } for (BaseContainer.EnvironmentVariable ev : baseContainer.environmentVariables) { environment.addVariables( Protos.Environment.Variable.newBuilder().setName(ev.name).setValue(ev.value)); } taskInfo .addResources(scalarResource(TaskResources.CPUS_RESOURCE_NAME, baseContainer.cpu)) .addResources(scalarResource(TaskResources.MEM_RESOURCE_NAME, baseContainer.memInMB)) .addResources(scalarResource(TaskResources.DISK_RESOURCE_NAME, baseContainer.diskInMB)) .addResources(rangeResource(TaskResources.PORT_RESOURCE_NAME, this.freePorts.get(0), this.freePorts.get(this.freePorts.size() - 1))). setSlaveId(this.offer.getSlaveId()); int containerIndex = TaskUtils.getContainerIndexForTaskId(taskIdStr); String commandStr = executorCommand(heronConfig, heronRuntime, containerIndex); Protos.CommandInfo.Builder command = Protos.CommandInfo.newBuilder(); List<Protos.CommandInfo.URI> uriProtos = new ArrayList<>(); for (String uri : baseContainer.dependencies) { uriProtos.add(Protos.CommandInfo.URI.newBuilder() .setValue(uri) .setExtract(true) .build()); } command.setValue(commandStr) .setShell(baseContainer.shell) .setEnvironment(environment) .addAllUris(uriProtos); if (!baseContainer.runAsUser.isEmpty()) { command.setUser(baseContainer.runAsUser); } taskInfo.setCommand(command); return taskInfo.build(); }
java
public Protos.TaskInfo constructMesosTaskInfo(Config heronConfig, Config heronRuntime) { //String taskIdStr, BaseContainer task, Offer offer String taskIdStr = this.taskId; Protos.TaskID mesosTaskID = Protos.TaskID.newBuilder().setValue(taskIdStr).build(); Protos.TaskInfo.Builder taskInfo = Protos.TaskInfo.newBuilder() .setName(baseContainer.name) .setTaskId(mesosTaskID); Protos.Environment.Builder environment = Protos.Environment.newBuilder(); // If the job defines custom environment variables, add them to the builder // Don't add them if they already exist to prevent overwriting the defaults Set<String> builtinEnvNames = new HashSet<>(); for (Protos.Environment.Variable variable : environment.getVariablesList()) { builtinEnvNames.add(variable.getName()); } for (BaseContainer.EnvironmentVariable ev : baseContainer.environmentVariables) { environment.addVariables( Protos.Environment.Variable.newBuilder().setName(ev.name).setValue(ev.value)); } taskInfo .addResources(scalarResource(TaskResources.CPUS_RESOURCE_NAME, baseContainer.cpu)) .addResources(scalarResource(TaskResources.MEM_RESOURCE_NAME, baseContainer.memInMB)) .addResources(scalarResource(TaskResources.DISK_RESOURCE_NAME, baseContainer.diskInMB)) .addResources(rangeResource(TaskResources.PORT_RESOURCE_NAME, this.freePorts.get(0), this.freePorts.get(this.freePorts.size() - 1))). setSlaveId(this.offer.getSlaveId()); int containerIndex = TaskUtils.getContainerIndexForTaskId(taskIdStr); String commandStr = executorCommand(heronConfig, heronRuntime, containerIndex); Protos.CommandInfo.Builder command = Protos.CommandInfo.newBuilder(); List<Protos.CommandInfo.URI> uriProtos = new ArrayList<>(); for (String uri : baseContainer.dependencies) { uriProtos.add(Protos.CommandInfo.URI.newBuilder() .setValue(uri) .setExtract(true) .build()); } command.setValue(commandStr) .setShell(baseContainer.shell) .setEnvironment(environment) .addAllUris(uriProtos); if (!baseContainer.runAsUser.isEmpty()) { command.setUser(baseContainer.runAsUser); } taskInfo.setCommand(command); return taskInfo.build(); }
[ "public", "Protos", ".", "TaskInfo", "constructMesosTaskInfo", "(", "Config", "heronConfig", ",", "Config", "heronRuntime", ")", "{", "//String taskIdStr, BaseContainer task, Offer offer", "String", "taskIdStr", "=", "this", ".", "taskId", ";", "Protos", ".", "TaskID", ...
Construct the Mesos TaskInfo in Protos to launch basing on the LaunchableTask @param heronConfig the heron config @param heronRuntime the heron runtime @return Mesos TaskInfo in Protos to launch
[ "Construct", "the", "Mesos", "TaskInfo", "in", "Protos", "to", "launch", "basing", "on", "the", "LaunchableTask" ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/schedulers/src/java/org/apache/heron/scheduler/mesos/framework/LaunchableTask.java#L143-L197
apereo/cas
support/cas-server-support-pac4j-webflow/src/main/java/org/apereo/cas/web/flow/DelegatedClientAuthenticationAction.java
DelegatedClientAuthenticationAction.findDelegatedClientByName
protected BaseClient<Credentials, CommonProfile> findDelegatedClientByName(final HttpServletRequest request, final String clientName, final Service service) { """ Find delegated client by name base client. @param request the request @param clientName the client name @param service the service @return the base client """ val client = (BaseClient<Credentials, CommonProfile>) this.clients.findClient(clientName); LOGGER.debug("Delegated authentication client is [{}] with service [{}}", client, service); if (service != null) { request.setAttribute(CasProtocolConstants.PARAMETER_SERVICE, service.getId()); if (!isDelegatedClientAuthorizedForService(client, service)) { LOGGER.warn("Delegated client [{}] is not authorized by service [{}]", client, service); throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, StringUtils.EMPTY); } } return client; }
java
protected BaseClient<Credentials, CommonProfile> findDelegatedClientByName(final HttpServletRequest request, final String clientName, final Service service) { val client = (BaseClient<Credentials, CommonProfile>) this.clients.findClient(clientName); LOGGER.debug("Delegated authentication client is [{}] with service [{}}", client, service); if (service != null) { request.setAttribute(CasProtocolConstants.PARAMETER_SERVICE, service.getId()); if (!isDelegatedClientAuthorizedForService(client, service)) { LOGGER.warn("Delegated client [{}] is not authorized by service [{}]", client, service); throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, StringUtils.EMPTY); } } return client; }
[ "protected", "BaseClient", "<", "Credentials", ",", "CommonProfile", ">", "findDelegatedClientByName", "(", "final", "HttpServletRequest", "request", ",", "final", "String", "clientName", ",", "final", "Service", "service", ")", "{", "val", "client", "=", "(", "Ba...
Find delegated client by name base client. @param request the request @param clientName the client name @param service the service @return the base client
[ "Find", "delegated", "client", "by", "name", "base", "client", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-pac4j-webflow/src/main/java/org/apereo/cas/web/flow/DelegatedClientAuthenticationAction.java#L286-L297
samskivert/samskivert
src/main/java/com/samskivert/swing/GroupLayout.java
GroupLayout.makeButtonBox
public static JPanel makeButtonBox (Justification justification, Component... buttons) { """ Creates a {@link JPanel} that is configured with an {@link HGroupLayout} with a configuration conducive to containing a row of buttons. Any supplied buttons are added to the box. """ JPanel box = new JPanel(new HGroupLayout(NONE, justification)); for (Component button : buttons) { box.add(button); box.setOpaque(false); } return box; }
java
public static JPanel makeButtonBox (Justification justification, Component... buttons) { JPanel box = new JPanel(new HGroupLayout(NONE, justification)); for (Component button : buttons) { box.add(button); box.setOpaque(false); } return box; }
[ "public", "static", "JPanel", "makeButtonBox", "(", "Justification", "justification", ",", "Component", "...", "buttons", ")", "{", "JPanel", "box", "=", "new", "JPanel", "(", "new", "HGroupLayout", "(", "NONE", ",", "justification", ")", ")", ";", "for", "(...
Creates a {@link JPanel} that is configured with an {@link HGroupLayout} with a configuration conducive to containing a row of buttons. Any supplied buttons are added to the box.
[ "Creates", "a", "{" ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/GroupLayout.java#L320-L328
apereo/cas
support/cas-server-support-aup-jdbc/src/main/java/org/apereo/cas/aup/JdbcAcceptableUsagePolicyRepository.java
JdbcAcceptableUsagePolicyRepository.determinePrincipalId
protected String determinePrincipalId(final RequestContext requestContext, final Credential credential) { """ Extracts principal ID from a principal attribute or the provided credentials. @param requestContext the context @param credential the credential @return the principal ID to update the AUP setting in the database for """ if (StringUtils.isBlank(properties.getJdbc().getPrincipalIdAttribute())) { return credential.getId(); } val principal = WebUtils.getAuthentication(requestContext).getPrincipal(); val pIdAttribName = properties.getJdbc().getPrincipalIdAttribute(); if (!principal.getAttributes().containsKey(pIdAttribName)) { throw new IllegalStateException("Principal attribute [" + pIdAttribName + "] cannot be found"); } val pIdAttributeValue = principal.getAttributes().get(pIdAttribName); val pIdAttributeValues = CollectionUtils.toCollection(pIdAttributeValue); var principalId = StringUtils.EMPTY; if (!pIdAttributeValues.isEmpty()) { principalId = pIdAttributeValues.iterator().next().toString().trim(); } if (pIdAttributeValues.size() > 1) { LOGGER.warn("Principal attribute [{}] was found, but its value [{}] is multi-valued. " + "Proceeding with the first element [{}]", pIdAttribName, pIdAttributeValue, principalId); } if (principalId.isEmpty()) { throw new IllegalStateException("Principal attribute [" + pIdAttribName + "] was found, but it is either empty" + " or multi-valued with an empty element"); } return principalId; }
java
protected String determinePrincipalId(final RequestContext requestContext, final Credential credential) { if (StringUtils.isBlank(properties.getJdbc().getPrincipalIdAttribute())) { return credential.getId(); } val principal = WebUtils.getAuthentication(requestContext).getPrincipal(); val pIdAttribName = properties.getJdbc().getPrincipalIdAttribute(); if (!principal.getAttributes().containsKey(pIdAttribName)) { throw new IllegalStateException("Principal attribute [" + pIdAttribName + "] cannot be found"); } val pIdAttributeValue = principal.getAttributes().get(pIdAttribName); val pIdAttributeValues = CollectionUtils.toCollection(pIdAttributeValue); var principalId = StringUtils.EMPTY; if (!pIdAttributeValues.isEmpty()) { principalId = pIdAttributeValues.iterator().next().toString().trim(); } if (pIdAttributeValues.size() > 1) { LOGGER.warn("Principal attribute [{}] was found, but its value [{}] is multi-valued. " + "Proceeding with the first element [{}]", pIdAttribName, pIdAttributeValue, principalId); } if (principalId.isEmpty()) { throw new IllegalStateException("Principal attribute [" + pIdAttribName + "] was found, but it is either empty" + " or multi-valued with an empty element"); } return principalId; }
[ "protected", "String", "determinePrincipalId", "(", "final", "RequestContext", "requestContext", ",", "final", "Credential", "credential", ")", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "properties", ".", "getJdbc", "(", ")", ".", "getPrincipalIdAttribute"...
Extracts principal ID from a principal attribute or the provided credentials. @param requestContext the context @param credential the credential @return the principal ID to update the AUP setting in the database for
[ "Extracts", "principal", "ID", "from", "a", "principal", "attribute", "or", "the", "provided", "credentials", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-aup-jdbc/src/main/java/org/apereo/cas/aup/JdbcAcceptableUsagePolicyRepository.java#L68-L92
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/StringUtil.java
StringUtil.boxify
public static String boxify(final char boxing, final String text) { """ Returns a String which is surrounded by a box made of boxing char. @param boxing boxing character, eg '+' @param text @return """ if (boxing != 0 && StringUtils.isNotBlank(text)) { final StringBuilder b = new StringBuilder(); b.append(NEW_LINE); final String line = StringUtils.repeat(String.valueOf(boxing), text.length() + 4); b.append(line).append(NEW_LINE); b.append(boxing).append(SPACE).append(text).append(SPACE).append(boxing).append(NEW_LINE); b.append(line).append(NEW_LINE); return b.toString(); } return EMPTY; }
java
public static String boxify(final char boxing, final String text) { if (boxing != 0 && StringUtils.isNotBlank(text)) { final StringBuilder b = new StringBuilder(); b.append(NEW_LINE); final String line = StringUtils.repeat(String.valueOf(boxing), text.length() + 4); b.append(line).append(NEW_LINE); b.append(boxing).append(SPACE).append(text).append(SPACE).append(boxing).append(NEW_LINE); b.append(line).append(NEW_LINE); return b.toString(); } return EMPTY; }
[ "public", "static", "String", "boxify", "(", "final", "char", "boxing", ",", "final", "String", "text", ")", "{", "if", "(", "boxing", "!=", "0", "&&", "StringUtils", ".", "isNotBlank", "(", "text", ")", ")", "{", "final", "StringBuilder", "b", "=", "n...
Returns a String which is surrounded by a box made of boxing char. @param boxing boxing character, eg '+' @param text @return
[ "Returns", "a", "String", "which", "is", "surrounded", "by", "a", "box", "made", "of", "boxing", "char", "." ]
train
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/StringUtil.java#L544-L555
jbundle/jbundle
base/remote/src/main/java/org/jbundle/base/remote/server/RemoteSessionServer.java
RemoteSessionServer.createRemoteTask
public RemoteTask createRemoteTask(Map<String, Object> properties) throws RemoteException { """ Build a new remote session and initialize it. @return The remote Task. """ Utility.getLogger().info("createRemoteTask()"); RemoteTask remoteTask = this.getNewRemoteTask(properties); return remoteTask; }
java
public RemoteTask createRemoteTask(Map<String, Object> properties) throws RemoteException { Utility.getLogger().info("createRemoteTask()"); RemoteTask remoteTask = this.getNewRemoteTask(properties); return remoteTask; }
[ "public", "RemoteTask", "createRemoteTask", "(", "Map", "<", "String", ",", "Object", ">", "properties", ")", "throws", "RemoteException", "{", "Utility", ".", "getLogger", "(", ")", ".", "info", "(", "\"createRemoteTask()\"", ")", ";", "RemoteTask", "remoteTask...
Build a new remote session and initialize it. @return The remote Task.
[ "Build", "a", "new", "remote", "session", "and", "initialize", "it", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/server/RemoteSessionServer.java#L142-L147
mygreen/super-csv-annotation
src/main/java/com/github/mygreen/supercsv/builder/BeanMappingFactory.java
BeanMappingFactory.createColumnMapping
@SuppressWarnings( { """ カラム情報を組み立てる @param field フィールド情報 @param columnAnno 設定されているカラムのアノテーション @param groups グループ情報 @return 組み立てたカラム """"rawtypes", "unchecked"}) protected ColumnMapping createColumnMapping(final Field field, final CsvColumn columnAnno, final Class<?>[] groups) { final FieldAccessor fieldAccessor = new FieldAccessor(field, configuration.getAnnoationComparator()); final ColumnMapping columnMapping = new ColumnMapping(); columnMapping.setField(fieldAccessor); columnMapping.setNumber(columnAnno.number()); if(columnAnno.label().isEmpty()) { columnMapping.setLabel(field.getName()); } else { columnMapping.setLabel(columnAnno.label()); } // ProcessorBuilderの取得 ProcessorBuilder builder; if(columnAnno.builder().length == 0) { builder = configuration.getBuilderResolver().resolve(fieldAccessor.getType()); if(builder == null) { // 不明なタイプの場合 builder = new GeneralProcessorBuilder(); } } else { // 直接Builderクラスが指定されている場合 try { builder = (ProcessorBuilder) configuration.getBeanFactory().create(columnAnno.builder()[0]); } catch(Throwable e) { throw new SuperCsvReflectionException( String.format("Fail create instance of %s with attribute 'builderClass' of @CsvColumn", columnAnno.builder()[0].getCanonicalName()), e); } } // CellProcessorの作成 columnMapping.setCellProcessorForReading( (CellProcessor)builder.buildForReading(field.getType(), fieldAccessor, configuration, groups).orElse(null)); columnMapping.setCellProcessorForWriting( (CellProcessor)builder.buildForWriting(field.getType(), fieldAccessor, configuration, groups).orElse(null)); if(builder instanceof AbstractProcessorBuilder) { columnMapping.setFormatter(((AbstractProcessorBuilder)builder).getFormatter(fieldAccessor, configuration)); } return columnMapping; }
java
@SuppressWarnings({"rawtypes", "unchecked"}) protected ColumnMapping createColumnMapping(final Field field, final CsvColumn columnAnno, final Class<?>[] groups) { final FieldAccessor fieldAccessor = new FieldAccessor(field, configuration.getAnnoationComparator()); final ColumnMapping columnMapping = new ColumnMapping(); columnMapping.setField(fieldAccessor); columnMapping.setNumber(columnAnno.number()); if(columnAnno.label().isEmpty()) { columnMapping.setLabel(field.getName()); } else { columnMapping.setLabel(columnAnno.label()); } // ProcessorBuilderの取得 ProcessorBuilder builder; if(columnAnno.builder().length == 0) { builder = configuration.getBuilderResolver().resolve(fieldAccessor.getType()); if(builder == null) { // 不明なタイプの場合 builder = new GeneralProcessorBuilder(); } } else { // 直接Builderクラスが指定されている場合 try { builder = (ProcessorBuilder) configuration.getBeanFactory().create(columnAnno.builder()[0]); } catch(Throwable e) { throw new SuperCsvReflectionException( String.format("Fail create instance of %s with attribute 'builderClass' of @CsvColumn", columnAnno.builder()[0].getCanonicalName()), e); } } // CellProcessorの作成 columnMapping.setCellProcessorForReading( (CellProcessor)builder.buildForReading(field.getType(), fieldAccessor, configuration, groups).orElse(null)); columnMapping.setCellProcessorForWriting( (CellProcessor)builder.buildForWriting(field.getType(), fieldAccessor, configuration, groups).orElse(null)); if(builder instanceof AbstractProcessorBuilder) { columnMapping.setFormatter(((AbstractProcessorBuilder)builder).getFormatter(fieldAccessor, configuration)); } return columnMapping; }
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "protected", "ColumnMapping", "createColumnMapping", "(", "final", "Field", "field", ",", "final", "CsvColumn", "columnAnno", ",", "final", "Class", "<", "?", ">", "[", "]", "gr...
カラム情報を組み立てる @param field フィールド情報 @param columnAnno 設定されているカラムのアノテーション @param groups グループ情報 @return 組み立てたカラム
[ "カラム情報を組み立てる" ]
train
https://github.com/mygreen/super-csv-annotation/blob/9910320cb6dc143be972c7d10d9ab5ffb09c3b84/src/main/java/com/github/mygreen/supercsv/builder/BeanMappingFactory.java#L162-L212
javagl/ND
nd-tuples/src/main/java/de/javagl/nd/tuples/d/DoubleTuples.java
DoubleTuples.createRandom
public static MutableDoubleTuple createRandom(int size, Random random) { """ Creates a tuple with the given size that is filled with random values in [0,1) @param size The size @param random The random number generator @return The new tuple """ MutableDoubleTuple t = create(size); randomize(t, random); return t; }
java
public static MutableDoubleTuple createRandom(int size, Random random) { MutableDoubleTuple t = create(size); randomize(t, random); return t; }
[ "public", "static", "MutableDoubleTuple", "createRandom", "(", "int", "size", ",", "Random", "random", ")", "{", "MutableDoubleTuple", "t", "=", "create", "(", "size", ")", ";", "randomize", "(", "t", ",", "random", ")", ";", "return", "t", ";", "}" ]
Creates a tuple with the given size that is filled with random values in [0,1) @param size The size @param random The random number generator @return The new tuple
[ "Creates", "a", "tuple", "with", "the", "given", "size", "that", "is", "filled", "with", "random", "values", "in", "[", "0", "1", ")" ]
train
https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-tuples/src/main/java/de/javagl/nd/tuples/d/DoubleTuples.java#L1485-L1490
Azure/autorest-clientruntime-for-java
azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/Node.java
Node.setOwner
public void setOwner(Graph<DataT, NodeT> ownerGraph) { """ Sets reference to the graph owning this node. @param ownerGraph the owning graph """ if (this.ownerGraph != null) { throw new RuntimeException("Changing owner graph is not allowed"); } this.ownerGraph = ownerGraph; }
java
public void setOwner(Graph<DataT, NodeT> ownerGraph) { if (this.ownerGraph != null) { throw new RuntimeException("Changing owner graph is not allowed"); } this.ownerGraph = ownerGraph; }
[ "public", "void", "setOwner", "(", "Graph", "<", "DataT", ",", "NodeT", ">", "ownerGraph", ")", "{", "if", "(", "this", ".", "ownerGraph", "!=", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"Changing owner graph is not allowed\"", ")", ";", "...
Sets reference to the graph owning this node. @param ownerGraph the owning graph
[ "Sets", "reference", "to", "the", "graph", "owning", "this", "node", "." ]
train
https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/Node.java#L96-L101
alkacon/opencms-core
src-modules/org/opencms/workplace/commons/CmsPreferences.java
CmsPreferences.buildSelectLanguage
public String buildSelectLanguage(String htmlAttributes) { """ Builds the html for the language select box of the start settings.<p> @param htmlAttributes optional html attributes for the &lgt;select&gt; tag @return the html for the language select box """ SelectOptions selectOptions = getOptionsForLanguage(); return buildSelect(htmlAttributes, selectOptions); }
java
public String buildSelectLanguage(String htmlAttributes) { SelectOptions selectOptions = getOptionsForLanguage(); return buildSelect(htmlAttributes, selectOptions); }
[ "public", "String", "buildSelectLanguage", "(", "String", "htmlAttributes", ")", "{", "SelectOptions", "selectOptions", "=", "getOptionsForLanguage", "(", ")", ";", "return", "buildSelect", "(", "htmlAttributes", ",", "selectOptions", ")", ";", "}" ]
Builds the html for the language select box of the start settings.<p> @param htmlAttributes optional html attributes for the &lgt;select&gt; tag @return the html for the language select box
[ "Builds", "the", "html", "for", "the", "language", "select", "box", "of", "the", "start", "settings", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsPreferences.java#L713-L717
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java
DomHelper.drawGroup
public void drawGroup(Object parent, Object object, Matrix transformation) { """ Creates a group element in the technology (SVG/VML/...) of this context. A group is meant to group other elements together, possibly applying a transformation upon them. @param parent parent group object @param object group object @param transformation On each group, it is possible to apply a matrix transformation (currently translation only). This is the real strength of a group element. """ createOrUpdateGroup(parent, object, transformation, null); }
java
public void drawGroup(Object parent, Object object, Matrix transformation) { createOrUpdateGroup(parent, object, transformation, null); }
[ "public", "void", "drawGroup", "(", "Object", "parent", ",", "Object", "object", ",", "Matrix", "transformation", ")", "{", "createOrUpdateGroup", "(", "parent", ",", "object", ",", "transformation", ",", "null", ")", ";", "}" ]
Creates a group element in the technology (SVG/VML/...) of this context. A group is meant to group other elements together, possibly applying a transformation upon them. @param parent parent group object @param object group object @param transformation On each group, it is possible to apply a matrix transformation (currently translation only). This is the real strength of a group element.
[ "Creates", "a", "group", "element", "in", "the", "technology", "(", "SVG", "/", "VML", "/", "...", ")", "of", "this", "context", ".", "A", "group", "is", "meant", "to", "group", "other", "elements", "together", "possibly", "applying", "a", "transformation"...
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java#L236-L238
alibaba/jstorm
jstorm-core/src/main/java/com/alibaba/jstorm/utils/JStormSignalHandler.java
JStormSignalHandler.registerSignal
public synchronized void registerSignal(int signalNumber, Runnable callback, boolean replace) { """ Register signal to system if callback is null, then the current process will ignore this signal """ String signalName = signalMap.get(signalNumber); if (signalName == null) { LOG.warn("Invalid signalNumber " + signalNumber); return; } LOG.info("Begin to register signal of {}", signalName); try { SignalHandler oldHandler = Signal.handle(new Signal(signalName), this); LOG.info("Successfully register {} handler", signalName); Runnable old = signalHandlers.put(signalNumber, callback); if (old != null) { if (!replace) { oldSignalHandlers.put(signalNumber, oldHandler); } else { LOG.info("Successfully old {} handler will be replaced", signalName); } } LOG.info("Successfully register signal of {}", signalName); } catch (Exception e) { LOG.error("Failed to register " + signalName + ":" + signalNumber + ", Signal already used by VM or OS: SIGILL"); } }
java
public synchronized void registerSignal(int signalNumber, Runnable callback, boolean replace) { String signalName = signalMap.get(signalNumber); if (signalName == null) { LOG.warn("Invalid signalNumber " + signalNumber); return; } LOG.info("Begin to register signal of {}", signalName); try { SignalHandler oldHandler = Signal.handle(new Signal(signalName), this); LOG.info("Successfully register {} handler", signalName); Runnable old = signalHandlers.put(signalNumber, callback); if (old != null) { if (!replace) { oldSignalHandlers.put(signalNumber, oldHandler); } else { LOG.info("Successfully old {} handler will be replaced", signalName); } } LOG.info("Successfully register signal of {}", signalName); } catch (Exception e) { LOG.error("Failed to register " + signalName + ":" + signalNumber + ", Signal already used by VM or OS: SIGILL"); } }
[ "public", "synchronized", "void", "registerSignal", "(", "int", "signalNumber", ",", "Runnable", "callback", ",", "boolean", "replace", ")", "{", "String", "signalName", "=", "signalMap", ".", "get", "(", "signalNumber", ")", ";", "if", "(", "signalName", "=="...
Register signal to system if callback is null, then the current process will ignore this signal
[ "Register", "signal", "to", "system", "if", "callback", "is", "null", "then", "the", "current", "process", "will", "ignore", "this", "signal" ]
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/com/alibaba/jstorm/utils/JStormSignalHandler.java#L111-L138
MaxLeap/SDK-CloudCode-Java
cloud-code-sdk/src/main/java/com/maxleap/code/impl/WebUtils.java
WebUtils.doDelete
public static String doDelete(String url, Map<String, String> header, Map<String, String> params) throws IOException { """ 执行HTTP DELETE请求。 @param url 请求地址 @param params 请求参数 @return 响应字符串 @throws IOException """ return doRequestWithUrl(url, METHOD_DELETE, header, params, DEFAULT_CHARSET); }
java
public static String doDelete(String url, Map<String, String> header, Map<String, String> params) throws IOException { return doRequestWithUrl(url, METHOD_DELETE, header, params, DEFAULT_CHARSET); }
[ "public", "static", "String", "doDelete", "(", "String", "url", ",", "Map", "<", "String", ",", "String", ">", "header", ",", "Map", "<", "String", ",", "String", ">", "params", ")", "throws", "IOException", "{", "return", "doRequestWithUrl", "(", "url", ...
执行HTTP DELETE请求。 @param url 请求地址 @param params 请求参数 @return 响应字符串 @throws IOException
[ "执行HTTP", "DELETE请求。" ]
train
https://github.com/MaxLeap/SDK-CloudCode-Java/blob/756064c65dd613919c377bf136cf8710c7507968/cloud-code-sdk/src/main/java/com/maxleap/code/impl/WebUtils.java#L151-L153
deeplearning4j/deeplearning4j
nd4j/nd4j-serde/nd4j-gson/src/main/java/org/nd4j/serde/gson/GsonDeserializationUtils.java
GsonDeserializationUtils.getSizeMultiDimensionalArray
private static void getSizeMultiDimensionalArray(JsonArray jsonArray, List<Integer> dimensions) { """ /* The below method works under the following assumption which is an INDArray can not have a row such as [ 1 , 2, [3, 4] ] and either all elements of an INDArray are either INDArrays themselves or scalars. So if that is the case, then it suffices to only check the first element of each JsonArray to see if that first element is itself an JsonArray. If it is an array, then we must check the first element of that array to see if it's a scalar or array. """ Iterator<JsonElement> iterator = jsonArray.iterator(); if (iterator.hasNext()) { JsonElement jsonElement = iterator.next(); if (jsonElement.isJsonArray()) { JsonArray shapeArray = jsonElement.getAsJsonArray(); dimensions.add(shapeArray.size()); getSizeMultiDimensionalArray(shapeArray, dimensions); } } }
java
private static void getSizeMultiDimensionalArray(JsonArray jsonArray, List<Integer> dimensions) { Iterator<JsonElement> iterator = jsonArray.iterator(); if (iterator.hasNext()) { JsonElement jsonElement = iterator.next(); if (jsonElement.isJsonArray()) { JsonArray shapeArray = jsonElement.getAsJsonArray(); dimensions.add(shapeArray.size()); getSizeMultiDimensionalArray(shapeArray, dimensions); } } }
[ "private", "static", "void", "getSizeMultiDimensionalArray", "(", "JsonArray", "jsonArray", ",", "List", "<", "Integer", ">", "dimensions", ")", "{", "Iterator", "<", "JsonElement", ">", "iterator", "=", "jsonArray", ".", "iterator", "(", ")", ";", "if", "(", ...
/* The below method works under the following assumption which is an INDArray can not have a row such as [ 1 , 2, [3, 4] ] and either all elements of an INDArray are either INDArrays themselves or scalars. So if that is the case, then it suffices to only check the first element of each JsonArray to see if that first element is itself an JsonArray. If it is an array, then we must check the first element of that array to see if it's a scalar or array.
[ "/", "*", "The", "below", "method", "works", "under", "the", "following", "assumption", "which", "is", "an", "INDArray", "can", "not", "have", "a", "row", "such", "as", "[", "1", "2", "[", "3", "4", "]", "]", "and", "either", "all", "elements", "of",...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-serde/nd4j-gson/src/main/java/org/nd4j/serde/gson/GsonDeserializationUtils.java#L75-L86
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/preview/CmsPreviewUtil.java
CmsPreviewUtil.setImage
public static void setImage(String path, Map<String, String> attributes) { """ Sets the image tag within the rich text editor (FCKEditor, CKEditor, ...).<p> @param path the image path @param attributes the image tag attributes """ CmsJSONMap attributesJS = CmsJSONMap.createJSONMap(); for (Entry<String, String> entry : attributes.entrySet()) { attributesJS.put(entry.getKey(), entry.getValue()); } nativeSetImage(path, attributesJS); }
java
public static void setImage(String path, Map<String, String> attributes) { CmsJSONMap attributesJS = CmsJSONMap.createJSONMap(); for (Entry<String, String> entry : attributes.entrySet()) { attributesJS.put(entry.getKey(), entry.getValue()); } nativeSetImage(path, attributesJS); }
[ "public", "static", "void", "setImage", "(", "String", "path", ",", "Map", "<", "String", ",", "String", ">", "attributes", ")", "{", "CmsJSONMap", "attributesJS", "=", "CmsJSONMap", ".", "createJSONMap", "(", ")", ";", "for", "(", "Entry", "<", "String", ...
Sets the image tag within the rich text editor (FCKEditor, CKEditor, ...).<p> @param path the image path @param attributes the image tag attributes
[ "Sets", "the", "image", "tag", "within", "the", "rich", "text", "editor", "(", "FCKEditor", "CKEditor", "...", ")", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/preview/CmsPreviewUtil.java#L222-L229
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/common/UpdateUtils.java
UpdateUtils.updateFileFromUrl
public static void updateFileFromUrl(final String sourceUrl, final String destinationFilePath) throws UpdateException { """ Get the source URL and store it to a destination file path @param sourceUrl url @param destinationFilePath destination @throws UpdateException on error """ updateFileFromUrl(sourceUrl, destinationFilePath, null, null); }
java
public static void updateFileFromUrl(final String sourceUrl, final String destinationFilePath) throws UpdateException { updateFileFromUrl(sourceUrl, destinationFilePath, null, null); }
[ "public", "static", "void", "updateFileFromUrl", "(", "final", "String", "sourceUrl", ",", "final", "String", "destinationFilePath", ")", "throws", "UpdateException", "{", "updateFileFromUrl", "(", "sourceUrl", ",", "destinationFilePath", ",", "null", ",", "null", "...
Get the source URL and store it to a destination file path @param sourceUrl url @param destinationFilePath destination @throws UpdateException on error
[ "Get", "the", "source", "URL", "and", "store", "it", "to", "a", "destination", "file", "path" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/common/UpdateUtils.java#L57-L60
infinispan/infinispan
lucene/directory-provider/src/main/java/org/infinispan/hibernate/search/impl/InfinispanConfigurationParser.java
InfinispanConfigurationParser.patchTransportConfiguration
private void patchTransportConfiguration(ConfigurationBuilderHolder builderHolder, String transportOverrideResource) throws IOException { """ After having parsed the Infinispan configuration file, we might want to override the specified JGroups configuration file. @param builderHolder @param transportOverrideResource The alternative JGroups configuration file to be used, or null """ if (transportOverrideResource != null) { try (InputStream xml = FileLookupFactory.newInstance().lookupFileStrict(transportOverrideResource, ispnClassLoadr)) { Properties p = new Properties(); FileJGroupsChannelConfigurator configurator = new FileJGroupsChannelConfigurator("override", transportOverrideResource, xml, System.getProperties()); p.put(JGroupsTransport.CHANNEL_CONFIGURATOR, configurator); builderHolder.getGlobalConfigurationBuilder().transport().withProperties(p); } } }
java
private void patchTransportConfiguration(ConfigurationBuilderHolder builderHolder, String transportOverrideResource) throws IOException { if (transportOverrideResource != null) { try (InputStream xml = FileLookupFactory.newInstance().lookupFileStrict(transportOverrideResource, ispnClassLoadr)) { Properties p = new Properties(); FileJGroupsChannelConfigurator configurator = new FileJGroupsChannelConfigurator("override", transportOverrideResource, xml, System.getProperties()); p.put(JGroupsTransport.CHANNEL_CONFIGURATOR, configurator); builderHolder.getGlobalConfigurationBuilder().transport().withProperties(p); } } }
[ "private", "void", "patchTransportConfiguration", "(", "ConfigurationBuilderHolder", "builderHolder", ",", "String", "transportOverrideResource", ")", "throws", "IOException", "{", "if", "(", "transportOverrideResource", "!=", "null", ")", "{", "try", "(", "InputStream", ...
After having parsed the Infinispan configuration file, we might want to override the specified JGroups configuration file. @param builderHolder @param transportOverrideResource The alternative JGroups configuration file to be used, or null
[ "After", "having", "parsed", "the", "Infinispan", "configuration", "file", "we", "might", "want", "to", "override", "the", "specified", "JGroups", "configuration", "file", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/lucene/directory-provider/src/main/java/org/infinispan/hibernate/search/impl/InfinispanConfigurationParser.java#L87-L96
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/core/PeerGroup.java
PeerGroup.addDataEventListenerToPeer
private static void addDataEventListenerToPeer(Executor executor, Peer peer, PeerDataEventListener downloadListener) { """ Register a data event listener against a single peer (i.e. for blockchain download). Handling registration/deregistration on peer death/add is outside the scope of these methods. """ peer.addBlocksDownloadedEventListener(executor, downloadListener); peer.addChainDownloadStartedEventListener(executor, downloadListener); peer.addGetDataEventListener(executor, downloadListener); peer.addPreMessageReceivedEventListener(executor, downloadListener); }
java
private static void addDataEventListenerToPeer(Executor executor, Peer peer, PeerDataEventListener downloadListener) { peer.addBlocksDownloadedEventListener(executor, downloadListener); peer.addChainDownloadStartedEventListener(executor, downloadListener); peer.addGetDataEventListener(executor, downloadListener); peer.addPreMessageReceivedEventListener(executor, downloadListener); }
[ "private", "static", "void", "addDataEventListenerToPeer", "(", "Executor", "executor", ",", "Peer", "peer", ",", "PeerDataEventListener", "downloadListener", ")", "{", "peer", ".", "addBlocksDownloadedEventListener", "(", "executor", ",", "downloadListener", ")", ";", ...
Register a data event listener against a single peer (i.e. for blockchain download). Handling registration/deregistration on peer death/add is outside the scope of these methods.
[ "Register", "a", "data", "event", "listener", "against", "a", "single", "peer", "(", "i", ".", "e", ".", "for", "blockchain", "download", ")", ".", "Handling", "registration", "/", "deregistration", "on", "peer", "death", "/", "add", "is", "outside", "the"...
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/PeerGroup.java#L1430-L1435
google/closure-compiler
src/com/google/javascript/rhino/jstype/JSType.java
JSType.getLeastSupertype
@SuppressWarnings("AmbiguousMethodReference") static JSType getLeastSupertype(JSType thisType, JSType thatType) { """ A generic implementation meant to be used as a helper for common getLeastSupertype implementations. """ boolean areEquivalent = thisType.isEquivalentTo(thatType); return areEquivalent ? thisType : filterNoResolvedType( thisType.registry.createUnionType(thisType, thatType)); }
java
@SuppressWarnings("AmbiguousMethodReference") static JSType getLeastSupertype(JSType thisType, JSType thatType) { boolean areEquivalent = thisType.isEquivalentTo(thatType); return areEquivalent ? thisType : filterNoResolvedType( thisType.registry.createUnionType(thisType, thatType)); }
[ "@", "SuppressWarnings", "(", "\"AmbiguousMethodReference\"", ")", "static", "JSType", "getLeastSupertype", "(", "JSType", "thisType", ",", "JSType", "thatType", ")", "{", "boolean", "areEquivalent", "=", "thisType", ".", "isEquivalentTo", "(", "thatType", ")", ";",...
A generic implementation meant to be used as a helper for common getLeastSupertype implementations.
[ "A", "generic", "implementation", "meant", "to", "be", "used", "as", "a", "helper", "for", "common", "getLeastSupertype", "implementations", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSType.java#L1168-L1174
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionPersistenceImpl.java
CPDefinitionPersistenceImpl.findByC_S
@Override public List<CPDefinition> findByC_S(long CProductId, int status, int start, int end) { """ Returns a range of all the cp definitions where CProductId = &#63; and status = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPDefinitionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param CProductId the c product ID @param status the status @param start the lower bound of the range of cp definitions @param end the upper bound of the range of cp definitions (not inclusive) @return the range of matching cp definitions """ return findByC_S(CProductId, status, start, end, null); }
java
@Override public List<CPDefinition> findByC_S(long CProductId, int status, int start, int end) { return findByC_S(CProductId, status, start, end, null); }
[ "@", "Override", "public", "List", "<", "CPDefinition", ">", "findByC_S", "(", "long", "CProductId", ",", "int", "status", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByC_S", "(", "CProductId", ",", "status", ",", "start", ",", "end"...
Returns a range of all the cp definitions where CProductId = &#63; and status = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPDefinitionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param CProductId the c product ID @param status the status @param start the lower bound of the range of cp definitions @param end the upper bound of the range of cp definitions (not inclusive) @return the range of matching cp definitions
[ "Returns", "a", "range", "of", "all", "the", "cp", "definitions", "where", "CProductId", "=", "&#63", ";", "and", "status", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionPersistenceImpl.java#L4119-L4123
m-m-m/util
pojopath/src/main/java/net/sf/mmm/util/pojo/path/base/AbstractPojoPathNavigator.java
AbstractPojoPathNavigator.getFunction
@SuppressWarnings("rawtypes") protected PojoPathFunction getFunction(String functionName, PojoPathContext context) throws ObjectNotFoundException { """ This method gets the {@link PojoPathFunction} for the given {@code functionName}. @param functionName is the {@link PojoPathFunctionManager#getFunction(String) name} of the requested {@link PojoPathFunction}. @param context is the {@link PojoPathContext context} for this operation. @return the requested {@link PojoPathFunction}. @throws ObjectNotFoundException if no {@link PojoPathFunction} is defined for the given {@code functionName}. """ PojoPathFunction function = null; // context overrides functions... PojoPathFunctionManager manager = context.getAdditionalFunctionManager(); if (manager != null) { function = manager.getFunction(functionName); } if (function == null) { // global functions as fallback... manager = getFunctionManager(); if (manager != null) { function = manager.getFunction(functionName); } } if (function == null) { throw new ObjectNotFoundException(PojoPathFunction.class, functionName); } return function; }
java
@SuppressWarnings("rawtypes") protected PojoPathFunction getFunction(String functionName, PojoPathContext context) throws ObjectNotFoundException { PojoPathFunction function = null; // context overrides functions... PojoPathFunctionManager manager = context.getAdditionalFunctionManager(); if (manager != null) { function = manager.getFunction(functionName); } if (function == null) { // global functions as fallback... manager = getFunctionManager(); if (manager != null) { function = manager.getFunction(functionName); } } if (function == null) { throw new ObjectNotFoundException(PojoPathFunction.class, functionName); } return function; }
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "protected", "PojoPathFunction", "getFunction", "(", "String", "functionName", ",", "PojoPathContext", "context", ")", "throws", "ObjectNotFoundException", "{", "PojoPathFunction", "function", "=", "null", ";", "// cont...
This method gets the {@link PojoPathFunction} for the given {@code functionName}. @param functionName is the {@link PojoPathFunctionManager#getFunction(String) name} of the requested {@link PojoPathFunction}. @param context is the {@link PojoPathContext context} for this operation. @return the requested {@link PojoPathFunction}. @throws ObjectNotFoundException if no {@link PojoPathFunction} is defined for the given {@code functionName}.
[ "This", "method", "gets", "the", "{", "@link", "PojoPathFunction", "}", "for", "the", "given", "{", "@code", "functionName", "}", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/pojopath/src/main/java/net/sf/mmm/util/pojo/path/base/AbstractPojoPathNavigator.java#L608-L628