repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
218
func_name
stringlengths
5
140
whole_func_string
stringlengths
79
3.99k
language
stringclasses
1 value
func_code_string
stringlengths
79
3.99k
func_code_tokens
listlengths
20
624
func_documentation_string
stringlengths
61
1.96k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
107
339
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendServiceClient.java
BackendServiceClient.deleteSignedUrlKeyBackendService
@BetaApi public final Operation deleteSignedUrlKeyBackendService(String backendService, String keyName) { DeleteSignedUrlKeyBackendServiceHttpRequest request = DeleteSignedUrlKeyBackendServiceHttpRequest.newBuilder() .setBackendService(backendService) .setKeyName(keyName) .build(); return deleteSignedUrlKeyBackendService(request); }
java
@BetaApi public final Operation deleteSignedUrlKeyBackendService(String backendService, String keyName) { DeleteSignedUrlKeyBackendServiceHttpRequest request = DeleteSignedUrlKeyBackendServiceHttpRequest.newBuilder() .setBackendService(backendService) .setKeyName(keyName) .build(); return deleteSignedUrlKeyBackendService(request); }
[ "@", "BetaApi", "public", "final", "Operation", "deleteSignedUrlKeyBackendService", "(", "String", "backendService", ",", "String", "keyName", ")", "{", "DeleteSignedUrlKeyBackendServiceHttpRequest", "request", "=", "DeleteSignedUrlKeyBackendServiceHttpRequest", ".", "newBuilde...
Deletes a key for validating requests with signed URLs for this backend service. <p>Sample code: <pre><code> try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) { ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]"); String keyName = ""; Operation response = backendServiceClient.deleteSignedUrlKeyBackendService(backendService.toString(), keyName); } </code></pre> @param backendService Name of the BackendService resource to which the Signed URL Key should be added. The name should conform to RFC1035. @param keyName The name of the Signed URL Key to delete. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Deletes", "a", "key", "for", "validating", "requests", "with", "signed", "URLs", "for", "this", "backend", "service", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendServiceClient.java#L568-L577
Impetus/Kundera
src/kundera-couchdb/src/main/java/com/impetus/client/couchdb/CouchDBObjectMapper.java
CouchDBObjectMapper.getJsonPrimitive
private static JsonElement getJsonPrimitive(Object value, Class clazz) { if (value != null) { if (clazz.isAssignableFrom(Number.class) || value instanceof Number) { return new JsonPrimitive((Number) value); } else if (clazz.isAssignableFrom(Boolean.class) || value instanceof Boolean) { return new JsonPrimitive((Boolean) value); } else if (clazz.isAssignableFrom(Character.class) || value instanceof Character) { return new JsonPrimitive((Character) value); } else if (clazz.isAssignableFrom(byte[].class) || value instanceof byte[]) { return new JsonPrimitive(PropertyAccessorFactory.STRING.fromBytes(String.class, (byte[]) value)); } else { return new JsonPrimitive(PropertyAccessorHelper.getString(value)); } }
java
private static JsonElement getJsonPrimitive(Object value, Class clazz) { if (value != null) { if (clazz.isAssignableFrom(Number.class) || value instanceof Number) { return new JsonPrimitive((Number) value); } else if (clazz.isAssignableFrom(Boolean.class) || value instanceof Boolean) { return new JsonPrimitive((Boolean) value); } else if (clazz.isAssignableFrom(Character.class) || value instanceof Character) { return new JsonPrimitive((Character) value); } else if (clazz.isAssignableFrom(byte[].class) || value instanceof byte[]) { return new JsonPrimitive(PropertyAccessorFactory.STRING.fromBytes(String.class, (byte[]) value)); } else { return new JsonPrimitive(PropertyAccessorHelper.getString(value)); } }
[ "private", "static", "JsonElement", "getJsonPrimitive", "(", "Object", "value", ",", "Class", "clazz", ")", "{", "if", "(", "value", "!=", "null", ")", "{", "if", "(", "clazz", ".", "isAssignableFrom", "(", "Number", ".", "class", ")", "||", "value", "in...
Gets the json primitive. @param value the value @param clazz the clazz @return the json primitive
[ "Gets", "the", "json", "primitive", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-couchdb/src/main/java/com/impetus/client/couchdb/CouchDBObjectMapper.java#L440-L464
looly/hutool
hutool-setting/src/main/java/cn/hutool/setting/AbsSetting.java
AbsSetting.getBool
public Boolean getBool(String key, String group, Boolean defaultValue) { return Convert.toBool(getByGroup(key, group), defaultValue); }
java
public Boolean getBool(String key, String group, Boolean defaultValue) { return Convert.toBool(getByGroup(key, group), defaultValue); }
[ "public", "Boolean", "getBool", "(", "String", "key", ",", "String", "group", ",", "Boolean", "defaultValue", ")", "{", "return", "Convert", ".", "toBool", "(", "getByGroup", "(", "key", ",", "group", ")", ",", "defaultValue", ")", ";", "}" ]
获取波尔型型属性值 @param key 属性名 @param group 分组名 @param defaultValue 默认值 @return 属性值
[ "获取波尔型型属性值" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/AbsSetting.java#L188-L190
alibaba/jstorm
jstorm-core/src/main/java/storm/trident/Stream.java
Stream.slidingWindow
public Stream slidingWindow(BaseWindowedBolt.Duration windowDuration, BaseWindowedBolt.Duration slidingInterval, WindowsStoreFactory windowStoreFactory, Fields inputFields, Aggregator aggregator, Fields functionFields) { return window(SlidingDurationWindow.of(windowDuration, slidingInterval), windowStoreFactory, inputFields, aggregator, functionFields); }
java
public Stream slidingWindow(BaseWindowedBolt.Duration windowDuration, BaseWindowedBolt.Duration slidingInterval, WindowsStoreFactory windowStoreFactory, Fields inputFields, Aggregator aggregator, Fields functionFields) { return window(SlidingDurationWindow.of(windowDuration, slidingInterval), windowStoreFactory, inputFields, aggregator, functionFields); }
[ "public", "Stream", "slidingWindow", "(", "BaseWindowedBolt", ".", "Duration", "windowDuration", ",", "BaseWindowedBolt", ".", "Duration", "slidingInterval", ",", "WindowsStoreFactory", "windowStoreFactory", ",", "Fields", "inputFields", ",", "Aggregator", "aggregator", "...
Returns a stream of tuples which are aggregated results of a window which slides at duration of {@code slidingInterval} and completes a window at {@code windowDuration} @param windowDuration represents window duration configuration @param inputFields projected fields for aggregator @param aggregator aggregator to run on the window of tuples to compute the result and emit to the stream. @param functionFields fields of values to emit with aggregation. @return the new stream with this operation.
[ "Returns", "a", "stream", "of", "tuples", "which", "are", "aggregated", "results", "of", "a", "window", "which", "slides", "at", "duration", "of", "{", "@code", "slidingInterval", "}", "and", "completes", "a", "window", "at", "{", "@code", "windowDuration", ...
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/storm/trident/Stream.java#L653-L656
Swagger2Markup/swagger2markup
src/main/java/io/github/swagger2markup/internal/adapter/PropertyAdapter.java
PropertyAdapter.convertExample
public static Object convertExample(String value, String type) { if (value == null) { return null; } try { switch (type) { case "integer": return Integer.valueOf(value); case "number": return Float.valueOf(value); case "boolean": return Boolean.valueOf(value); case "string": return value; default: return value; } } catch (NumberFormatException e) { throw new RuntimeException(String.format("Value '%s' cannot be converted to '%s'", value, type), e); } }
java
public static Object convertExample(String value, String type) { if (value == null) { return null; } try { switch (type) { case "integer": return Integer.valueOf(value); case "number": return Float.valueOf(value); case "boolean": return Boolean.valueOf(value); case "string": return value; default: return value; } } catch (NumberFormatException e) { throw new RuntimeException(String.format("Value '%s' cannot be converted to '%s'", value, type), e); } }
[ "public", "static", "Object", "convertExample", "(", "String", "value", ",", "String", "type", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "null", ";", "}", "try", "{", "switch", "(", "type", ")", "{", "case", "\"integer\"", ":", ...
Convert a string {@code value} to specified {@code type}. @param value value to convert @param type target conversion type @return converted value as object
[ "Convert", "a", "string", "{", "@code", "value", "}", "to", "specified", "{", "@code", "type", "}", "." ]
train
https://github.com/Swagger2Markup/swagger2markup/blob/da83465f19a2f8a0f1fba873b5762bca8587896b/src/main/java/io/github/swagger2markup/internal/adapter/PropertyAdapter.java#L129-L150
buschmais/jqa-rdbms-plugin
src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java
AbstractSchemaScannerPlugin.createForeignKeys
private void createForeignKeys(Set<ForeignKey> allForeignKeys, Map<Column, ColumnDescriptor> allColumns, Store store) { // Foreign keys for (ForeignKey foreignKey : allForeignKeys) { ForeignKeyDescriptor foreignKeyDescriptor = store.create(ForeignKeyDescriptor.class); foreignKeyDescriptor.setName(foreignKey.getName()); foreignKeyDescriptor.setDeferrability(foreignKey.getDeferrability().name()); foreignKeyDescriptor.setDeleteRule(foreignKey.getDeleteRule().name()); foreignKeyDescriptor.setUpdateRule(foreignKey.getUpdateRule().name()); for (ForeignKeyColumnReference columnReference : foreignKey.getColumnReferences()) { ForeignKeyReferenceDescriptor keyReferenceDescriptor = store.create(ForeignKeyReferenceDescriptor.class); // foreign key table and column Column foreignKeyColumn = columnReference.getForeignKeyColumn(); ColumnDescriptor foreignKeyColumnDescriptor = allColumns.get(foreignKeyColumn); keyReferenceDescriptor.setForeignKeyColumn(foreignKeyColumnDescriptor); // primary key table and column Column primaryKeyColumn = columnReference.getPrimaryKeyColumn(); ColumnDescriptor primaryKeyColumnDescriptor = allColumns.get(primaryKeyColumn); keyReferenceDescriptor.setPrimaryKeyColumn(primaryKeyColumnDescriptor); foreignKeyDescriptor.getForeignKeyReferences().add(keyReferenceDescriptor); } } }
java
private void createForeignKeys(Set<ForeignKey> allForeignKeys, Map<Column, ColumnDescriptor> allColumns, Store store) { // Foreign keys for (ForeignKey foreignKey : allForeignKeys) { ForeignKeyDescriptor foreignKeyDescriptor = store.create(ForeignKeyDescriptor.class); foreignKeyDescriptor.setName(foreignKey.getName()); foreignKeyDescriptor.setDeferrability(foreignKey.getDeferrability().name()); foreignKeyDescriptor.setDeleteRule(foreignKey.getDeleteRule().name()); foreignKeyDescriptor.setUpdateRule(foreignKey.getUpdateRule().name()); for (ForeignKeyColumnReference columnReference : foreignKey.getColumnReferences()) { ForeignKeyReferenceDescriptor keyReferenceDescriptor = store.create(ForeignKeyReferenceDescriptor.class); // foreign key table and column Column foreignKeyColumn = columnReference.getForeignKeyColumn(); ColumnDescriptor foreignKeyColumnDescriptor = allColumns.get(foreignKeyColumn); keyReferenceDescriptor.setForeignKeyColumn(foreignKeyColumnDescriptor); // primary key table and column Column primaryKeyColumn = columnReference.getPrimaryKeyColumn(); ColumnDescriptor primaryKeyColumnDescriptor = allColumns.get(primaryKeyColumn); keyReferenceDescriptor.setPrimaryKeyColumn(primaryKeyColumnDescriptor); foreignKeyDescriptor.getForeignKeyReferences().add(keyReferenceDescriptor); } } }
[ "private", "void", "createForeignKeys", "(", "Set", "<", "ForeignKey", ">", "allForeignKeys", ",", "Map", "<", "Column", ",", "ColumnDescriptor", ">", "allColumns", ",", "Store", "store", ")", "{", "// Foreign keys", "for", "(", "ForeignKey", "foreignKey", ":", ...
Create the foreign key descriptors. @param allForeignKeys All collected foreign keys. @param allColumns All collected columns. @param store The store.
[ "Create", "the", "foreign", "key", "descriptors", "." ]
train
https://github.com/buschmais/jqa-rdbms-plugin/blob/96c3919907deee00175cf5ab005867d76e01ba62/src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java#L233-L254
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/net/SSLUtils.java
SSLUtils.createRestClientSSLContext
@Nullable public static SSLContext createRestClientSSLContext(Configuration config) throws Exception { final RestSSLContextConfigMode configMode; if (isRestSSLAuthenticationEnabled(config)) { configMode = RestSSLContextConfigMode.MUTUAL; } else { configMode = RestSSLContextConfigMode.CLIENT; } return createRestSSLContext(config, configMode); }
java
@Nullable public static SSLContext createRestClientSSLContext(Configuration config) throws Exception { final RestSSLContextConfigMode configMode; if (isRestSSLAuthenticationEnabled(config)) { configMode = RestSSLContextConfigMode.MUTUAL; } else { configMode = RestSSLContextConfigMode.CLIENT; } return createRestSSLContext(config, configMode); }
[ "@", "Nullable", "public", "static", "SSLContext", "createRestClientSSLContext", "(", "Configuration", "config", ")", "throws", "Exception", "{", "final", "RestSSLContextConfigMode", "configMode", ";", "if", "(", "isRestSSLAuthenticationEnabled", "(", "config", ")", ")"...
Creates an SSL context for clients against the external REST endpoint.
[ "Creates", "an", "SSL", "context", "for", "clients", "against", "the", "external", "REST", "endpoint", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/net/SSLUtils.java#L343-L353
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java
IoUtil.read
public static String read(FileChannel fileChannel, Charset charset) throws IORuntimeException { MappedByteBuffer buffer; try { buffer = fileChannel.map(FileChannel.MapMode.READ_ONLY, 0, fileChannel.size()).load(); } catch (IOException e) { throw new IORuntimeException(e); } return StrUtil.str(buffer, charset); }
java
public static String read(FileChannel fileChannel, Charset charset) throws IORuntimeException { MappedByteBuffer buffer; try { buffer = fileChannel.map(FileChannel.MapMode.READ_ONLY, 0, fileChannel.size()).load(); } catch (IOException e) { throw new IORuntimeException(e); } return StrUtil.str(buffer, charset); }
[ "public", "static", "String", "read", "(", "FileChannel", "fileChannel", ",", "Charset", "charset", ")", "throws", "IORuntimeException", "{", "MappedByteBuffer", "buffer", ";", "try", "{", "buffer", "=", "fileChannel", ".", "map", "(", "FileChannel", ".", "MapMo...
从FileChannel中读取内容 @param fileChannel 文件管道 @param charset 字符集 @return 内容 @throws IORuntimeException IO异常
[ "从FileChannel中读取内容" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L505-L513
apache/groovy
subprojects/groovy-xml/src/main/java/groovy/xml/NamespaceBuilderSupport.java
NamespaceBuilderSupport.invokeMethod
@Override public Object invokeMethod(String methodName, Object args) { // detect namespace declared on the added node like xmlns:foo="http:/foo" Map attributes = findAttributes(args); for (Iterator<Map.Entry> iter = attributes.entrySet().iterator(); iter.hasNext();) { Map.Entry entry = iter.next(); String key = String.valueOf(entry.getKey()); if (key.startsWith("xmlns:")) { String prefix = key.substring(6); String uri = String.valueOf(entry.getValue()); namespace(uri, prefix); iter.remove(); } } return super.invokeMethod(methodName, args); }
java
@Override public Object invokeMethod(String methodName, Object args) { // detect namespace declared on the added node like xmlns:foo="http:/foo" Map attributes = findAttributes(args); for (Iterator<Map.Entry> iter = attributes.entrySet().iterator(); iter.hasNext();) { Map.Entry entry = iter.next(); String key = String.valueOf(entry.getKey()); if (key.startsWith("xmlns:")) { String prefix = key.substring(6); String uri = String.valueOf(entry.getValue()); namespace(uri, prefix); iter.remove(); } } return super.invokeMethod(methodName, args); }
[ "@", "Override", "public", "Object", "invokeMethod", "(", "String", "methodName", ",", "Object", "args", ")", "{", "// detect namespace declared on the added node like xmlns:foo=\"http:/foo\"", "Map", "attributes", "=", "findAttributes", "(", "args", ")", ";", "for", "(...
Allow automatic detection of namespace declared in the attributes
[ "Allow", "automatic", "detection", "of", "namespace", "declared", "in", "the", "attributes" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-xml/src/main/java/groovy/xml/NamespaceBuilderSupport.java#L119-L135
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java
VirtualNetworkGatewaysInner.resetAsync
public Observable<VirtualNetworkGatewayInner> resetAsync(String resourceGroupName, String virtualNetworkGatewayName) { return resetWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).map(new Func1<ServiceResponse<VirtualNetworkGatewayInner>, VirtualNetworkGatewayInner>() { @Override public VirtualNetworkGatewayInner call(ServiceResponse<VirtualNetworkGatewayInner> response) { return response.body(); } }); }
java
public Observable<VirtualNetworkGatewayInner> resetAsync(String resourceGroupName, String virtualNetworkGatewayName) { return resetWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).map(new Func1<ServiceResponse<VirtualNetworkGatewayInner>, VirtualNetworkGatewayInner>() { @Override public VirtualNetworkGatewayInner call(ServiceResponse<VirtualNetworkGatewayInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualNetworkGatewayInner", ">", "resetAsync", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkGatewayName", ")", "{", "return", "resetWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualNetworkGatewayName", ")", ...
Resets the primary of the virtual network gateway in the specified resource group. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayName The name of the virtual network gateway. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Resets", "the", "primary", "of", "the", "virtual", "network", "gateway", "in", "the", "specified", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L1184-L1191
doanduyhai/Achilles
achilles-core/src/main/java/info/archinnov/achilles/internals/dsl/options/AbstractOptionsForSelect.java
AbstractOptionsForSelect.withRowAsyncListeners
public T withRowAsyncListeners(List<Function<Row, Row>> rowAsyncListeners) { getOptions().setRowAsyncListeners(Optional.of(rowAsyncListeners)); return getThis(); }
java
public T withRowAsyncListeners(List<Function<Row, Row>> rowAsyncListeners) { getOptions().setRowAsyncListeners(Optional.of(rowAsyncListeners)); return getThis(); }
[ "public", "T", "withRowAsyncListeners", "(", "List", "<", "Function", "<", "Row", ",", "Row", ">", ">", "rowAsyncListeners", ")", "{", "getOptions", "(", ")", ".", "setRowAsyncListeners", "(", "Optional", ".", "of", "(", "rowAsyncListeners", ")", ")", ";", ...
Add the given list of async listeners on the {@link com.datastax.driver.core.Row} object. Example of usage: <pre class="code"><code class="java"> .withRowAsyncListeners(Arrays.asList(row -> { //Do something with the row object here })) </code></pre> Remark: <strong>You can inspect and read values from the row object</strong>
[ "Add", "the", "given", "list", "of", "async", "listeners", "on", "the", "{", "@link", "com", ".", "datastax", ".", "driver", ".", "core", ".", "Row", "}", "object", ".", "Example", "of", "usage", ":", "<pre", "class", "=", "code", ">", "<code", "clas...
train
https://github.com/doanduyhai/Achilles/blob/8281c33100e72c993e570592ae1a5306afac6813/achilles-core/src/main/java/info/archinnov/achilles/internals/dsl/options/AbstractOptionsForSelect.java#L218-L221
nakamura5akihito/six-util
src/main/java/jp/go/aist/six/util/search/RelationalBinding.java
RelationalBinding.greaterThanBinding
public static RelationalBinding greaterThanBinding( final String property, final Object value ) { return (new RelationalBinding( property, Relation.GREATER_THAN, value )); }
java
public static RelationalBinding greaterThanBinding( final String property, final Object value ) { return (new RelationalBinding( property, Relation.GREATER_THAN, value )); }
[ "public", "static", "RelationalBinding", "greaterThanBinding", "(", "final", "String", "property", ",", "final", "Object", "value", ")", "{", "return", "(", "new", "RelationalBinding", "(", "property", ",", "Relation", ".", "GREATER_THAN", ",", "value", ")", ")"...
Creates a 'GREATER_THAN' binding. @param property the property. @param value the value to which the property should be related. @return a 'GREATER_THAN' binding.
[ "Creates", "a", "GREATER_THAN", "binding", "." ]
train
https://github.com/nakamura5akihito/six-util/blob/a6db388a345e220cea2b1fa6324d15c80c6278b6/src/main/java/jp/go/aist/six/util/search/RelationalBinding.java#L130-L136
Ashok-Varma/BottomNavigation
bottom-navigation-bar/src/main/java/com/ashokvarma/bottomnavigation/BottomNavigationBar.java
BottomNavigationBar.parseAttrs
private void parseAttrs(Context context, AttributeSet attrs) { if (attrs != null) { TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.BottomNavigationBar, 0, 0); mActiveColor = typedArray.getColor(R.styleable.BottomNavigationBar_bnbActiveColor, Utils.fetchContextColor(context, R.attr.colorAccent)); mInActiveColor = typedArray.getColor(R.styleable.BottomNavigationBar_bnbInactiveColor, Color.LTGRAY); mBackgroundColor = typedArray.getColor(R.styleable.BottomNavigationBar_bnbBackgroundColor, Color.WHITE); mAutoHideEnabled = typedArray.getBoolean(R.styleable.BottomNavigationBar_bnbAutoHideEnabled, true); mElevation = typedArray.getDimension(R.styleable.BottomNavigationBar_bnbElevation, getResources().getDimension(R.dimen.bottom_navigation_elevation)); setAnimationDuration(typedArray.getInt(R.styleable.BottomNavigationBar_bnbAnimationDuration, DEFAULT_ANIMATION_DURATION)); switch (typedArray.getInt(R.styleable.BottomNavigationBar_bnbMode, MODE_DEFAULT)) { case MODE_FIXED: mMode = MODE_FIXED; break; case MODE_SHIFTING: mMode = MODE_SHIFTING; break; case MODE_FIXED_NO_TITLE: mMode = MODE_FIXED_NO_TITLE; break; case MODE_SHIFTING_NO_TITLE: mMode = MODE_SHIFTING_NO_TITLE; break; case MODE_DEFAULT: default: mMode = MODE_DEFAULT; break; } switch (typedArray.getInt(R.styleable.BottomNavigationBar_bnbBackgroundStyle, BACKGROUND_STYLE_DEFAULT)) { case BACKGROUND_STYLE_STATIC: mBackgroundStyle = BACKGROUND_STYLE_STATIC; break; case BACKGROUND_STYLE_RIPPLE: mBackgroundStyle = BACKGROUND_STYLE_RIPPLE; break; case BACKGROUND_STYLE_DEFAULT: default: mBackgroundStyle = BACKGROUND_STYLE_DEFAULT; break; } typedArray.recycle(); } else { mActiveColor = Utils.fetchContextColor(context, R.attr.colorAccent); mInActiveColor = Color.LTGRAY; mBackgroundColor = Color.WHITE; mElevation = getResources().getDimension(R.dimen.bottom_navigation_elevation); } }
java
private void parseAttrs(Context context, AttributeSet attrs) { if (attrs != null) { TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.BottomNavigationBar, 0, 0); mActiveColor = typedArray.getColor(R.styleable.BottomNavigationBar_bnbActiveColor, Utils.fetchContextColor(context, R.attr.colorAccent)); mInActiveColor = typedArray.getColor(R.styleable.BottomNavigationBar_bnbInactiveColor, Color.LTGRAY); mBackgroundColor = typedArray.getColor(R.styleable.BottomNavigationBar_bnbBackgroundColor, Color.WHITE); mAutoHideEnabled = typedArray.getBoolean(R.styleable.BottomNavigationBar_bnbAutoHideEnabled, true); mElevation = typedArray.getDimension(R.styleable.BottomNavigationBar_bnbElevation, getResources().getDimension(R.dimen.bottom_navigation_elevation)); setAnimationDuration(typedArray.getInt(R.styleable.BottomNavigationBar_bnbAnimationDuration, DEFAULT_ANIMATION_DURATION)); switch (typedArray.getInt(R.styleable.BottomNavigationBar_bnbMode, MODE_DEFAULT)) { case MODE_FIXED: mMode = MODE_FIXED; break; case MODE_SHIFTING: mMode = MODE_SHIFTING; break; case MODE_FIXED_NO_TITLE: mMode = MODE_FIXED_NO_TITLE; break; case MODE_SHIFTING_NO_TITLE: mMode = MODE_SHIFTING_NO_TITLE; break; case MODE_DEFAULT: default: mMode = MODE_DEFAULT; break; } switch (typedArray.getInt(R.styleable.BottomNavigationBar_bnbBackgroundStyle, BACKGROUND_STYLE_DEFAULT)) { case BACKGROUND_STYLE_STATIC: mBackgroundStyle = BACKGROUND_STYLE_STATIC; break; case BACKGROUND_STYLE_RIPPLE: mBackgroundStyle = BACKGROUND_STYLE_RIPPLE; break; case BACKGROUND_STYLE_DEFAULT: default: mBackgroundStyle = BACKGROUND_STYLE_DEFAULT; break; } typedArray.recycle(); } else { mActiveColor = Utils.fetchContextColor(context, R.attr.colorAccent); mInActiveColor = Color.LTGRAY; mBackgroundColor = Color.WHITE; mElevation = getResources().getDimension(R.dimen.bottom_navigation_elevation); } }
[ "private", "void", "parseAttrs", "(", "Context", "context", ",", "AttributeSet", "attrs", ")", "{", "if", "(", "attrs", "!=", "null", ")", "{", "TypedArray", "typedArray", "=", "context", ".", "getTheme", "(", ")", ".", "obtainStyledAttributes", "(", "attrs"...
This method initiates the bottomNavigationBar properties, Tries to get them form XML if not preset sets them to their default values. @param context context of the bottomNavigationBar @param attrs attributes mentioned in the layout XML by user
[ "This", "method", "initiates", "the", "bottomNavigationBar", "properties", "Tries", "to", "get", "them", "form", "XML", "if", "not", "preset", "sets", "them", "to", "their", "default", "values", "." ]
train
https://github.com/Ashok-Varma/BottomNavigation/blob/a5c486a6dfa1ebe7049e2e025e0d967111ecfd0b/bottom-navigation-bar/src/main/java/com/ashokvarma/bottomnavigation/BottomNavigationBar.java#L146-L203
kotcrab/vis-ui
ui/src/main/java/com/kotcrab/vis/ui/util/dialog/Dialogs.java
Dialogs.showDetailsDialog
public static DetailsDialog showDetailsDialog (Stage stage, String text, String title, String details) { return showDetailsDialog(stage, text, title, details, false); }
java
public static DetailsDialog showDetailsDialog (Stage stage, String text, String title, String details) { return showDetailsDialog(stage, text, title, details, false); }
[ "public", "static", "DetailsDialog", "showDetailsDialog", "(", "Stage", "stage", ",", "String", "text", ",", "String", "title", ",", "String", "details", ")", "{", "return", "showDetailsDialog", "(", "stage", ",", "text", ",", "title", ",", "details", ",", "...
Dialog with given title, provided text, and more details available after pressing 'Details' button.
[ "Dialog", "with", "given", "title", "provided", "text", "and", "more", "details", "available", "after", "pressing", "Details", "button", "." ]
train
https://github.com/kotcrab/vis-ui/blob/3b68f82d94ae32bffa2a3399c63f432e0f4908e0/ui/src/main/java/com/kotcrab/vis/ui/util/dialog/Dialogs.java#L176-L178
apache/groovy
subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java
SwingGroovyMethods.leftShift
public static JPopupMenu leftShift(JPopupMenu self, Component component) { self.add(component); return self; }
java
public static JPopupMenu leftShift(JPopupMenu self, Component component) { self.add(component); return self; }
[ "public", "static", "JPopupMenu", "leftShift", "(", "JPopupMenu", "self", ",", "Component", "component", ")", "{", "self", ".", "add", "(", "component", ")", ";", "return", "self", ";", "}" ]
Overloads the left shift operator to provide an easy way to add components to a popupMenu.<p> @param self a JPopupMenu @param component a component to be added to the popupMenu. @return same popupMenu, after the value was added to it. @since 1.6.4
[ "Overloads", "the", "left", "shift", "operator", "to", "provide", "an", "easy", "way", "to", "add", "components", "to", "a", "popupMenu", ".", "<p", ">" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java#L910-L913
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/DataTracker.java
DataTracker.replaceWithNewInstances
public void replaceWithNewInstances(Collection<SSTableReader> toReplace, Collection<SSTableReader> replaceWith) { replaceReaders(toReplace, replaceWith, true); }
java
public void replaceWithNewInstances(Collection<SSTableReader> toReplace, Collection<SSTableReader> replaceWith) { replaceReaders(toReplace, replaceWith, true); }
[ "public", "void", "replaceWithNewInstances", "(", "Collection", "<", "SSTableReader", ">", "toReplace", ",", "Collection", "<", "SSTableReader", ">", "replaceWith", ")", "{", "replaceReaders", "(", "toReplace", ",", "replaceWith", ",", "true", ")", ";", "}" ]
Replaces existing sstables with new instances, makes sure compaction strategies have the correct instance @param toReplace @param replaceWith
[ "Replaces", "existing", "sstables", "with", "new", "instances", "makes", "sure", "compaction", "strategies", "have", "the", "correct", "instance" ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/DataTracker.java#L305-L308
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/ZipUtil.java
ZipUtil.unexplode
public static void unexplode(File dir, int compressionLevel) { try { // Find a new unique name is the same directory File zip = FileUtils.getTempFileFor(dir); // Pack it pack(dir, zip, compressionLevel); // Delete the directory FileUtils.deleteDirectory(dir); // Rename the archive FileUtils.moveFile(zip, dir); } catch (IOException e) { throw ZipExceptionUtil.rethrow(e); } }
java
public static void unexplode(File dir, int compressionLevel) { try { // Find a new unique name is the same directory File zip = FileUtils.getTempFileFor(dir); // Pack it pack(dir, zip, compressionLevel); // Delete the directory FileUtils.deleteDirectory(dir); // Rename the archive FileUtils.moveFile(zip, dir); } catch (IOException e) { throw ZipExceptionUtil.rethrow(e); } }
[ "public", "static", "void", "unexplode", "(", "File", "dir", ",", "int", "compressionLevel", ")", "{", "try", "{", "// Find a new unique name is the same directory", "File", "zip", "=", "FileUtils", ".", "getTempFileFor", "(", "dir", ")", ";", "// Pack it", "pack"...
Compresses a given directory in its own location. <p> A ZIP file will be first created with a temporary name. After the compressing the directory will be deleted and the ZIP file will be renamed as the original directory. @param dir input directory as well as the target ZIP file. @param compressionLevel compression level @see #pack(File, File)
[ "Compresses", "a", "given", "directory", "in", "its", "own", "location", ".", "<p", ">", "A", "ZIP", "file", "will", "be", "first", "created", "with", "a", "temporary", "name", ".", "After", "the", "compressing", "the", "directory", "will", "be", "deleted"...
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L1935-L1952
greatman/craftconomy3
src/main/java/com/greatmancode/craftconomy3/Common.java
Common.alertOldDbVersion
private void alertOldDbVersion(int currentVersion, int newVersion) { Common.getInstance().sendConsoleMessage(Level.INFO, "Your database is out of date! (Version " + currentVersion + "). Updating it to Revision " + newVersion + "."); }
java
private void alertOldDbVersion(int currentVersion, int newVersion) { Common.getInstance().sendConsoleMessage(Level.INFO, "Your database is out of date! (Version " + currentVersion + "). Updating it to Revision " + newVersion + "."); }
[ "private", "void", "alertOldDbVersion", "(", "int", "currentVersion", ",", "int", "newVersion", ")", "{", "Common", ".", "getInstance", "(", ")", ".", "sendConsoleMessage", "(", "Level", ".", "INFO", ",", "\"Your database is out of date! (Version \"", "+", "currentV...
Alert in the console of a database update. @param currentVersion The current version @param newVersion The database update version
[ "Alert", "in", "the", "console", "of", "a", "database", "update", "." ]
train
https://github.com/greatman/craftconomy3/blob/51b1b3de7d039e20c7418d1e70b8c4b02b8cf840/src/main/java/com/greatmancode/craftconomy3/Common.java#L1013-L1015
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/customer/CreditUrl.java
CreditUrl.resendCreditCreatedEmailUrl
public static MozuUrl resendCreditCreatedEmailUrl(String code, String userId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/credits/{code}/Resend-Email?userId={userId}"); formatter.formatUrl("code", code); formatter.formatUrl("userId", userId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl resendCreditCreatedEmailUrl(String code, String userId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/credits/{code}/Resend-Email?userId={userId}"); formatter.formatUrl("code", code); formatter.formatUrl("userId", userId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "resendCreditCreatedEmailUrl", "(", "String", "code", ",", "String", "userId", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/customer/credits/{code}/Resend-Email?userId={userId}\"", ")", ";", "formatt...
Get Resource Url for ResendCreditCreatedEmail @param code User-defined code that uniqely identifies the channel group. @param userId Unique identifier of the user whose tenant scopes you want to retrieve. @return String Resource Url
[ "Get", "Resource", "Url", "for", "ResendCreditCreatedEmail" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/customer/CreditUrl.java#L84-L90
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.isSubtypes
public boolean isSubtypes(List<Type> ts, List<Type> ss) { while (ts.tail != null && ss.tail != null /*inlined: ts.nonEmpty() && ss.nonEmpty()*/ && isSubtype(ts.head, ss.head)) { ts = ts.tail; ss = ss.tail; } return ts.tail == null && ss.tail == null; /*inlined: ts.isEmpty() && ss.isEmpty();*/ }
java
public boolean isSubtypes(List<Type> ts, List<Type> ss) { while (ts.tail != null && ss.tail != null /*inlined: ts.nonEmpty() && ss.nonEmpty()*/ && isSubtype(ts.head, ss.head)) { ts = ts.tail; ss = ss.tail; } return ts.tail == null && ss.tail == null; /*inlined: ts.isEmpty() && ss.isEmpty();*/ }
[ "public", "boolean", "isSubtypes", "(", "List", "<", "Type", ">", "ts", ",", "List", "<", "Type", ">", "ss", ")", "{", "while", "(", "ts", ".", "tail", "!=", "null", "&&", "ss", ".", "tail", "!=", "null", "/*inlined: ts.nonEmpty() && ss.nonEmpty()*/", "&...
Are corresponding elements of ts subtypes of ss? If lists are of different length, return false.
[ "Are", "corresponding", "elements", "of", "ts", "subtypes", "of", "ss?", "If", "lists", "are", "of", "different", "length", "return", "false", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L926-L935
mikepenz/Materialize
library/src/main/java/com/mikepenz/materialize/util/UIUtils.java
UIUtils.setTranslucentNavigationFlag
public static void setTranslucentNavigationFlag(Activity activity, boolean on) { if (Build.VERSION.SDK_INT >= 19) { setFlag(activity, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, on); } }
java
public static void setTranslucentNavigationFlag(Activity activity, boolean on) { if (Build.VERSION.SDK_INT >= 19) { setFlag(activity, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, on); } }
[ "public", "static", "void", "setTranslucentNavigationFlag", "(", "Activity", "activity", ",", "boolean", "on", ")", "{", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", ">=", "19", ")", "{", "setFlag", "(", "activity", ",", "WindowManager", ".", "LayoutP...
helper method to set the TranslucentNavigationFlag @param on
[ "helper", "method", "to", "set", "the", "TranslucentNavigationFlag" ]
train
https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/util/UIUtils.java#L211-L215
onepf/OpenIAB
library/src/main/java/org/onepf/oms/appstore/googleUtils/Base64.java
Base64.decodeWebSafe
@NotNull public static byte[] decodeWebSafe(byte[] source, int off, int len) throws Base64DecoderException { return decode(source, off, len, WEBSAFE_DECODABET); }
java
@NotNull public static byte[] decodeWebSafe(byte[] source, int off, int len) throws Base64DecoderException { return decode(source, off, len, WEBSAFE_DECODABET); }
[ "@", "NotNull", "public", "static", "byte", "[", "]", "decodeWebSafe", "(", "byte", "[", "]", "source", ",", "int", "off", ",", "int", "len", ")", "throws", "Base64DecoderException", "{", "return", "decode", "(", "source", ",", "off", ",", "len", ",", ...
Decodes web safe Base64 content in byte array format and returns the decoded byte array. Web safe encoding uses '-' instead of '+', '_' instead of '/' @param source the Base64 encoded data @param off the offset of where to begin decoding @param len the length of characters to decode @return decoded data
[ "Decodes", "web", "safe", "Base64", "content", "in", "byte", "array", "format", "and", "returns", "the", "decoded", "byte", "array", ".", "Web", "safe", "encoding", "uses", "-", "instead", "of", "+", "_", "instead", "of", "/" ]
train
https://github.com/onepf/OpenIAB/blob/90552d53c5303b322940d96a0c4b7cb797d78760/library/src/main/java/org/onepf/oms/appstore/googleUtils/Base64.java#L514-L518
gallandarakhneorg/afc
advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItinerary.java
BusItinerary.insertBusHaltBefore
public BusItineraryHalt insertBusHaltBefore(BusItineraryHalt beforeHalt, UUID id, BusItineraryHaltType type) { return this.insertBusHaltBefore(beforeHalt, id, null, type); }
java
public BusItineraryHalt insertBusHaltBefore(BusItineraryHalt beforeHalt, UUID id, BusItineraryHaltType type) { return this.insertBusHaltBefore(beforeHalt, id, null, type); }
[ "public", "BusItineraryHalt", "insertBusHaltBefore", "(", "BusItineraryHalt", "beforeHalt", ",", "UUID", "id", ",", "BusItineraryHaltType", "type", ")", "{", "return", "this", ".", "insertBusHaltBefore", "(", "beforeHalt", ",", "id", ",", "null", ",", "type", ")",...
Insert newHalt before beforeHalt in the ordered list of {@link BusItineraryHalt}. @param beforeHalt the halt where insert the new halt @param id id of the new halt @param type the type of bus halt @return the added bus halt, otherwise <code>null</code>
[ "Insert", "newHalt", "before", "beforeHalt", "in", "the", "ordered", "list", "of", "{", "@link", "BusItineraryHalt", "}", ".", "@param", "beforeHalt", "the", "halt", "where", "insert", "the", "new", "halt", "@param", "id", "id", "of", "the", "new", "halt", ...
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItinerary.java#L1248-L1250
VoltDB/voltdb
src/frontend/org/voltdb/utils/CatalogUtil.java
CatalogUtil.getAutoGenDDLFromJar
public static String getAutoGenDDLFromJar(InMemoryJarfile jarfile) throws IOException { // Read the raw auto generated ddl bytes. byte[] ddlBytes = jarfile.get(VoltCompiler.AUTOGEN_DDL_FILE_NAME); if (ddlBytes == null) { throw new IOException("Auto generated schema DDL not found - please make sure the database is initialized with valid schema."); } String ddl = new String(ddlBytes, StandardCharsets.UTF_8); return ddl.trim(); }
java
public static String getAutoGenDDLFromJar(InMemoryJarfile jarfile) throws IOException { // Read the raw auto generated ddl bytes. byte[] ddlBytes = jarfile.get(VoltCompiler.AUTOGEN_DDL_FILE_NAME); if (ddlBytes == null) { throw new IOException("Auto generated schema DDL not found - please make sure the database is initialized with valid schema."); } String ddl = new String(ddlBytes, StandardCharsets.UTF_8); return ddl.trim(); }
[ "public", "static", "String", "getAutoGenDDLFromJar", "(", "InMemoryJarfile", "jarfile", ")", "throws", "IOException", "{", "// Read the raw auto generated ddl bytes.", "byte", "[", "]", "ddlBytes", "=", "jarfile", ".", "get", "(", "VoltCompiler", ".", "AUTOGEN_DDL_FILE...
Get the auto generated DDL from the catalog jar. @param jarfile in-memory catalog jar file @return Auto generated DDL stored in catalog.jar @throws IOException If the catalog or the auto generated ddl cannot be loaded.
[ "Get", "the", "auto", "generated", "DDL", "from", "the", "catalog", "jar", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/utils/CatalogUtil.java#L337-L347
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java
RTFEmbeddedObject.readDataBlock
private static int readDataBlock(String text, int offset, int length, List<byte[]> blocks) { int bytes = length / 2; byte[] data = new byte[bytes]; for (int index = 0; index < bytes; index++) { data[index] = (byte) Integer.parseInt(text.substring(offset, offset + 2), 16); offset += 2; } blocks.add(data); return (offset); }
java
private static int readDataBlock(String text, int offset, int length, List<byte[]> blocks) { int bytes = length / 2; byte[] data = new byte[bytes]; for (int index = 0; index < bytes; index++) { data[index] = (byte) Integer.parseInt(text.substring(offset, offset + 2), 16); offset += 2; } blocks.add(data); return (offset); }
[ "private", "static", "int", "readDataBlock", "(", "String", "text", ",", "int", "offset", ",", "int", "length", ",", "List", "<", "byte", "[", "]", ">", "blocks", ")", "{", "int", "bytes", "=", "length", "/", "2", ";", "byte", "[", "]", "data", "="...
Reads a data block and adds it to the list of blocks. @param text RTF data @param offset current offset @param length next block length @param blocks list of blocks @return next offset
[ "Reads", "a", "data", "block", "and", "adds", "it", "to", "the", "list", "of", "blocks", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java#L369-L382
astrapi69/jaulp-wicket
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/sign/up/SignupFormPanel.java
SignupFormPanel.newForm
@SuppressWarnings({ "unchecked", "rawtypes" }) protected Form<?> newForm(final String id, final IModel<? extends BaseUsernameSignUpModel> model) { return new Form(id, model); }
java
@SuppressWarnings({ "unchecked", "rawtypes" }) protected Form<?> newForm(final String id, final IModel<? extends BaseUsernameSignUpModel> model) { return new Form(id, model); }
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", ",", "\"rawtypes\"", "}", ")", "protected", "Form", "<", "?", ">", "newForm", "(", "final", "String", "id", ",", "final", "IModel", "<", "?", "extends", "BaseUsernameSignUpModel", ">", "model", ")", "{", ...
Factory method for creating the Form. This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a Form. @param id the id @param model the model @return the form
[ "Factory", "method", "for", "creating", "the", "Form", ".", "This", "method", "is", "invoked", "in", "the", "constructor", "from", "the", "derived", "classes", "and", "can", "be", "overridden", "so", "users", "can", "provide", "their", "own", "version", "of"...
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/sign/up/SignupFormPanel.java#L155-L160
googleapis/google-cloud-java
google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/ClusterControllerClient.java
ClusterControllerClient.getCluster
public final Cluster getCluster(String projectId, String region, String clusterName) { GetClusterRequest request = GetClusterRequest.newBuilder() .setProjectId(projectId) .setRegion(region) .setClusterName(clusterName) .build(); return getCluster(request); }
java
public final Cluster getCluster(String projectId, String region, String clusterName) { GetClusterRequest request = GetClusterRequest.newBuilder() .setProjectId(projectId) .setRegion(region) .setClusterName(clusterName) .build(); return getCluster(request); }
[ "public", "final", "Cluster", "getCluster", "(", "String", "projectId", ",", "String", "region", ",", "String", "clusterName", ")", "{", "GetClusterRequest", "request", "=", "GetClusterRequest", ".", "newBuilder", "(", ")", ".", "setProjectId", "(", "projectId", ...
Gets the resource representation for a cluster in a project. <p>Sample code: <pre><code> try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { String projectId = ""; String region = ""; String clusterName = ""; Cluster response = clusterControllerClient.getCluster(projectId, region, clusterName); } </code></pre> @param projectId Required. The ID of the Google Cloud Platform project that the cluster belongs to. @param region Required. The Cloud Dataproc region in which to handle the request. @param clusterName Required. The cluster name. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Gets", "the", "resource", "representation", "for", "a", "cluster", "in", "a", "project", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/ClusterControllerClient.java#L593-L602
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDataPropertyDomainAxiomImpl_CustomFieldSerializer.java
OWLDataPropertyDomainAxiomImpl_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLDataPropertyDomainAxiomImpl instance) throws SerializationException { serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLDataPropertyDomainAxiomImpl instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLDataPropertyDomainAxiomImpl", "instance", ")", "throws", "SerializationException", "{", "serialize", "(", "streamWriter", ",", "instance", ")", ";", "}" ]
Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful
[ "Serializes", "the", "content", "of", "the", "object", "into", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamWriter", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDataPropertyDomainAxiomImpl_CustomFieldSerializer.java#L76-L79
OpenNTF/JavascriptAggregator
jaggr-core/src/main/java/com/ibm/jaggr/core/impl/transport/DojoHttpTransport.java
DojoHttpTransport.endResponse
protected String endResponse(HttpServletRequest request, Object arg) { String result = ""; //$NON-NLS-1$ @SuppressWarnings("unchecked") Set<String> requiredModules = (Set<String>)request.getAttribute(ADD_REQUIRE_DEPS_REQATTRNAME); if (requiredModules != null && !requiredModules.isEmpty()) { // issue a require call for the required modules StringBuffer sb = new StringBuffer(); sb.append("require(["); //$NON-NLS-1$ int i = 0; for (String name : requiredModules) { sb.append(i++ > 0 ? "," : "").append("\"").append(name).append("\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ } sb.append("]);"); //$NON-NLS-1$ result = sb.toString(); } return result; }
java
protected String endResponse(HttpServletRequest request, Object arg) { String result = ""; //$NON-NLS-1$ @SuppressWarnings("unchecked") Set<String> requiredModules = (Set<String>)request.getAttribute(ADD_REQUIRE_DEPS_REQATTRNAME); if (requiredModules != null && !requiredModules.isEmpty()) { // issue a require call for the required modules StringBuffer sb = new StringBuffer(); sb.append("require(["); //$NON-NLS-1$ int i = 0; for (String name : requiredModules) { sb.append(i++ > 0 ? "," : "").append("\"").append(name).append("\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ } sb.append("]);"); //$NON-NLS-1$ result = sb.toString(); } return result; }
[ "protected", "String", "endResponse", "(", "HttpServletRequest", "request", ",", "Object", "arg", ")", "{", "String", "result", "=", "\"\"", ";", "//$NON-NLS-1$\r", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "Set", "<", "String", ">", "requiredModules", ...
Handles the {@link com.ibm.jaggr.core.transport.IHttpTransport.LayerContributionType#END_RESPONSE} layer listener event @param request the http request object @param arg null @return the layer contribution
[ "Handles", "the", "{", "@link", "com", ".", "ibm", ".", "jaggr", ".", "core", ".", "transport", ".", "IHttpTransport", ".", "LayerContributionType#END_RESPONSE", "}", "layer", "listener", "event" ]
train
https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/transport/DojoHttpTransport.java#L410-L426
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/tools/DFSAdmin.java
DFSAdmin.refreshNamenodes
public int refreshNamenodes(String[] argv, int i) throws IOException { ClientDatanodeProtocol datanode = null; String dnAddr = (argv.length == 2) ? argv[i] : null; try { datanode = getClientDatanodeProtocol(dnAddr); if (datanode != null) { datanode.refreshNamenodes(); return 0; } else { return -1; } } finally { if (datanode != null && Proxy.isProxyClass(datanode.getClass())) { RPC.stopProxy(datanode); } } }
java
public int refreshNamenodes(String[] argv, int i) throws IOException { ClientDatanodeProtocol datanode = null; String dnAddr = (argv.length == 2) ? argv[i] : null; try { datanode = getClientDatanodeProtocol(dnAddr); if (datanode != null) { datanode.refreshNamenodes(); return 0; } else { return -1; } } finally { if (datanode != null && Proxy.isProxyClass(datanode.getClass())) { RPC.stopProxy(datanode); } } }
[ "public", "int", "refreshNamenodes", "(", "String", "[", "]", "argv", ",", "int", "i", ")", "throws", "IOException", "{", "ClientDatanodeProtocol", "datanode", "=", "null", ";", "String", "dnAddr", "=", "(", "argv", ".", "length", "==", "2", ")", "?", "a...
Refresh the namenodes served by the {@link DataNode}. Usage: java DFSAdmin -refreshNamenodes datanodehost:port @param argv List of of command line parameters. @param idx The index of the command that is being processed. @exception IOException if an error accoured wile accessing the file or path. @return exitcode 0 on success, non-zero on failure
[ "Refresh", "the", "namenodes", "served", "by", "the", "{" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/tools/DFSAdmin.java#L832-L848
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfStream.java
PdfStream.writeLength
public void writeLength() throws IOException { if (inputStream == null) throw new UnsupportedOperationException("writeLength() can only be called in a contructed PdfStream(InputStream,PdfWriter)."); if (inputStreamLength == -1) throw new IOException("writeLength() can only be called after output of the stream body."); writer.addToBody(new PdfNumber(inputStreamLength), ref, false); }
java
public void writeLength() throws IOException { if (inputStream == null) throw new UnsupportedOperationException("writeLength() can only be called in a contructed PdfStream(InputStream,PdfWriter)."); if (inputStreamLength == -1) throw new IOException("writeLength() can only be called after output of the stream body."); writer.addToBody(new PdfNumber(inputStreamLength), ref, false); }
[ "public", "void", "writeLength", "(", ")", "throws", "IOException", "{", "if", "(", "inputStream", "==", "null", ")", "throw", "new", "UnsupportedOperationException", "(", "\"writeLength() can only be called in a contructed PdfStream(InputStream,PdfWriter).\"", ")", ";", "i...
Writes the stream length to the <CODE>PdfWriter</CODE>. <p> This method must be called and can only be called if the constructor {@link #PdfStream(InputStream,PdfWriter)} is used to create the stream. @throws IOException on error @see #PdfStream(InputStream,PdfWriter)
[ "Writes", "the", "stream", "length", "to", "the", "<CODE", ">", "PdfWriter<", "/", "CODE", ">", ".", "<p", ">", "This", "method", "must", "be", "called", "and", "can", "only", "be", "called", "if", "the", "constructor", "{" ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfStream.java#L186-L192
strator-dev/greenpepper
samples-application/src/main/java/com/greenpepper/samples/application/phonebook/Country.java
Country.addState
public void addState(String name, String code) { states.add(new State(this, name, code)); }
java
public void addState(String name, String code) { states.add(new State(this, name, code)); }
[ "public", "void", "addState", "(", "String", "name", ",", "String", "code", ")", "{", "states", ".", "add", "(", "new", "State", "(", "this", ",", "name", ",", "code", ")", ")", ";", "}" ]
<p>addState.</p> @param name a {@link java.lang.String} object. @param code a {@link java.lang.String} object.
[ "<p", ">", "addState", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/samples-application/src/main/java/com/greenpepper/samples/application/phonebook/Country.java#L107-L110
lamydev/Android-Notification
core/src/zemin/notification/NotificationBoard.java
NotificationBoard.setBoardPadding
public void setBoardPadding(int l, int t, int r, int b) { mContentView.setPadding(l, t, r, b); }
java
public void setBoardPadding(int l, int t, int r, int b) { mContentView.setPadding(l, t, r, b); }
[ "public", "void", "setBoardPadding", "(", "int", "l", ",", "int", "t", ",", "int", "r", ",", "int", "b", ")", "{", "mContentView", ".", "setPadding", "(", "l", ",", "t", ",", "r", ",", "b", ")", ";", "}" ]
Set the margin of the entire board. @param l @param t @param r @param b
[ "Set", "the", "margin", "of", "the", "entire", "board", "." ]
train
https://github.com/lamydev/Android-Notification/blob/6d6571d2862cb6edbacf9a78125418f7d621c3f8/core/src/zemin/notification/NotificationBoard.java#L1087-L1089
anotheria/moskito
moskito-integration/moskito-cdi/src/main/java/net/anotheria/moskito/integration/cdi/AbstractInterceptor.java
AbstractInterceptor.getProducer
protected final OnDemandStatsProducer getProducer(Class producerClass, String producerId, String category, String subsystem, boolean tracingSupported){ OnDemandStatsProducer<T> producer = (OnDemandStatsProducer<T>) ProducerRegistryFactory.getProducerRegistryInstance().getProducer(producerId); if (producer == null) { producer = new OnDemandStatsProducer<T>(producerId, category, subsystem, getStatsFactory()); producer.setTracingSupported(tracingSupported); ProducerRegistryFactory.getProducerRegistryInstance().registerProducer(producer); //check for annotations createClassLevelAccumulators(producer, producerClass); for (Method method : producerClass.getMethods()){ createMethodLevelAccumulators(producer, method); } } try { return (OnDemandStatsProducer) ProducerRegistryFactory.getProducerRegistryInstance().getProducer(producerId); } catch (ClassCastException e) { LOGGER.error("getProducer(): Unexpected producer type", e); return null; } }
java
protected final OnDemandStatsProducer getProducer(Class producerClass, String producerId, String category, String subsystem, boolean tracingSupported){ OnDemandStatsProducer<T> producer = (OnDemandStatsProducer<T>) ProducerRegistryFactory.getProducerRegistryInstance().getProducer(producerId); if (producer == null) { producer = new OnDemandStatsProducer<T>(producerId, category, subsystem, getStatsFactory()); producer.setTracingSupported(tracingSupported); ProducerRegistryFactory.getProducerRegistryInstance().registerProducer(producer); //check for annotations createClassLevelAccumulators(producer, producerClass); for (Method method : producerClass.getMethods()){ createMethodLevelAccumulators(producer, method); } } try { return (OnDemandStatsProducer) ProducerRegistryFactory.getProducerRegistryInstance().getProducer(producerId); } catch (ClassCastException e) { LOGGER.error("getProducer(): Unexpected producer type", e); return null; } }
[ "protected", "final", "OnDemandStatsProducer", "getProducer", "(", "Class", "producerClass", ",", "String", "producerId", ",", "String", "category", ",", "String", "subsystem", ",", "boolean", "tracingSupported", ")", "{", "OnDemandStatsProducer", "<", "T", ">", "pr...
Returns {@link OnDemandStatsProducer}. @param producerClass producer class @param producerId producer id @param category category @param subsystem subsystem @param tracingSupported is tracing supported @return {@link OnDemandStatsProducer}
[ "Returns", "{", "@link", "OnDemandStatsProducer", "}", "." ]
train
https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-integration/moskito-cdi/src/main/java/net/anotheria/moskito/integration/cdi/AbstractInterceptor.java#L58-L80
UrielCh/ovh-java-sdk
ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java
ApiOvhIpLoadbalancing.serviceName_tcp_farm_farmId_PUT
public void serviceName_tcp_farm_farmId_PUT(String serviceName, Long farmId, OvhBackendTcp body) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/tcp/farm/{farmId}"; StringBuilder sb = path(qPath, serviceName, farmId); exec(qPath, "PUT", sb.toString(), body); }
java
public void serviceName_tcp_farm_farmId_PUT(String serviceName, Long farmId, OvhBackendTcp body) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/tcp/farm/{farmId}"; StringBuilder sb = path(qPath, serviceName, farmId); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "serviceName_tcp_farm_farmId_PUT", "(", "String", "serviceName", ",", "Long", "farmId", ",", "OvhBackendTcp", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ipLoadbalancing/{serviceName}/tcp/farm/{farmId}\"", ";", "StringBuilder", ...
Alter this object properties REST: PUT /ipLoadbalancing/{serviceName}/tcp/farm/{farmId} @param body [required] New object properties @param serviceName [required] The internal name of your IP load balancing @param farmId [required] Id of your farm
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L1584-L1588
alkacon/opencms-core
src/org/opencms/jsp/CmsJspTagInclude.java
CmsJspTagInclude.includeTagAction
public static void includeTagAction( PageContext context, String target, String element, boolean editable, Map<String, String[]> paramMap, Map<String, Object> attrMap, ServletRequest req, ServletResponse res) throws JspException { // no locale and no cachable parameter are used by default includeTagAction(context, target, element, null, editable, true, paramMap, attrMap, req, res); }
java
public static void includeTagAction( PageContext context, String target, String element, boolean editable, Map<String, String[]> paramMap, Map<String, Object> attrMap, ServletRequest req, ServletResponse res) throws JspException { // no locale and no cachable parameter are used by default includeTagAction(context, target, element, null, editable, true, paramMap, attrMap, req, res); }
[ "public", "static", "void", "includeTagAction", "(", "PageContext", "context", ",", "String", "target", ",", "String", "element", ",", "boolean", "editable", ",", "Map", "<", "String", ",", "String", "[", "]", ">", "paramMap", ",", "Map", "<", "String", ",...
Includes the selected target.<p> @param context the current JSP page context @param target the target for the include, might be <code>null</code> @param element the element to select form the target might be <code>null</code> @param editable flag to indicate if the target is editable @param paramMap a map of parameters for the include, will be merged with the request parameters, might be <code>null</code> @param attrMap a map of attributes for the include, will be merged with the request attributes, might be <code>null</code> @param req the current request @param res the current response @throws JspException in case something goes wrong
[ "Includes", "the", "selected", "target", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagInclude.java#L156-L169
guardtime/ksi-java-sdk
ksi-common/src/main/java/com/guardtime/ksi/util/Util.java
Util.loadKeyStore
public static KeyStore loadKeyStore(File file, String password) throws KSIException { notNull(file, "Trust store file"); FileInputStream input = null; KeyStore keyStore = null; try { keyStore = KeyStore.getInstance("JKS"); char[] passwordCharArray = password == null ? null : password.toCharArray(); input = new FileInputStream(file); keyStore.load(input, passwordCharArray); } catch (GeneralSecurityException | IOException e) { throw new KSIException("Loading java key store with path " + file + " failed", e); } finally { closeQuietly(input); } return keyStore; }
java
public static KeyStore loadKeyStore(File file, String password) throws KSIException { notNull(file, "Trust store file"); FileInputStream input = null; KeyStore keyStore = null; try { keyStore = KeyStore.getInstance("JKS"); char[] passwordCharArray = password == null ? null : password.toCharArray(); input = new FileInputStream(file); keyStore.load(input, passwordCharArray); } catch (GeneralSecurityException | IOException e) { throw new KSIException("Loading java key store with path " + file + " failed", e); } finally { closeQuietly(input); } return keyStore; }
[ "public", "static", "KeyStore", "loadKeyStore", "(", "File", "file", ",", "String", "password", ")", "throws", "KSIException", "{", "notNull", "(", "file", ",", "\"Trust store file\"", ")", ";", "FileInputStream", "input", "=", "null", ";", "KeyStore", "keyStore...
Loads and returns the {@link java.security.KeyStore} from the file system. @param file file to load from file system. @param password password to access the keystore. @return {@link java.security.KeyStore} @throws KSIException
[ "Loads", "and", "returns", "the", "{", "@link", "java", ".", "security", ".", "KeyStore", "}", "from", "the", "file", "system", "." ]
train
https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/util/Util.java#L782-L797
elki-project/elki
elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mkcop/MkCoPTreeNode.java
MkCoPTreeNode.conservativeKnnDistanceApproximation
protected ApproximationLine conservativeKnnDistanceApproximation(int k_max) { // determine k_0, y_1, y_kmax int k_0 = k_max; double y_1 = Double.NEGATIVE_INFINITY; double y_kmax = Double.NEGATIVE_INFINITY; for(int i = 0; i < getNumEntries(); i++) { MkCoPEntry entry = getEntry(i); ApproximationLine approx = entry.getConservativeKnnDistanceApproximation(); k_0 = Math.min(approx.getK_0(), k_0); } for(int i = 0; i < getNumEntries(); i++) { MkCoPEntry entry = getEntry(i); ApproximationLine approx = entry.getConservativeKnnDistanceApproximation(); double entry_y_1 = approx.getValueAt(k_0); double entry_y_kmax = approx.getValueAt(k_max); if(!Double.isInfinite(entry_y_1)) { y_1 = Math.max(entry_y_1, y_1); } if(!Double.isInfinite(entry_y_kmax)) { y_kmax = Math.max(entry_y_kmax, y_kmax); } } // determine m and t double m = (y_kmax - y_1) / (FastMath.log(k_max) - FastMath.log(k_0)); double t = y_1 - m * FastMath.log(k_0); return new ApproximationLine(k_0, m, t); }
java
protected ApproximationLine conservativeKnnDistanceApproximation(int k_max) { // determine k_0, y_1, y_kmax int k_0 = k_max; double y_1 = Double.NEGATIVE_INFINITY; double y_kmax = Double.NEGATIVE_INFINITY; for(int i = 0; i < getNumEntries(); i++) { MkCoPEntry entry = getEntry(i); ApproximationLine approx = entry.getConservativeKnnDistanceApproximation(); k_0 = Math.min(approx.getK_0(), k_0); } for(int i = 0; i < getNumEntries(); i++) { MkCoPEntry entry = getEntry(i); ApproximationLine approx = entry.getConservativeKnnDistanceApproximation(); double entry_y_1 = approx.getValueAt(k_0); double entry_y_kmax = approx.getValueAt(k_max); if(!Double.isInfinite(entry_y_1)) { y_1 = Math.max(entry_y_1, y_1); } if(!Double.isInfinite(entry_y_kmax)) { y_kmax = Math.max(entry_y_kmax, y_kmax); } } // determine m and t double m = (y_kmax - y_1) / (FastMath.log(k_max) - FastMath.log(k_0)); double t = y_1 - m * FastMath.log(k_0); return new ApproximationLine(k_0, m, t); }
[ "protected", "ApproximationLine", "conservativeKnnDistanceApproximation", "(", "int", "k_max", ")", "{", "// determine k_0, y_1, y_kmax", "int", "k_0", "=", "k_max", ";", "double", "y_1", "=", "Double", ".", "NEGATIVE_INFINITY", ";", "double", "y_kmax", "=", "Double",...
Determines and returns the conservative approximation for the knn distances of this node as the maximum of the conservative approximations of all entries. @param k_max the maximum k parameter @return the conservative approximation for the knn distances
[ "Determines", "and", "returns", "the", "conservative", "approximation", "for", "the", "knn", "distances", "of", "this", "node", "as", "the", "maximum", "of", "the", "conservative", "approximations", "of", "all", "entries", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mkcop/MkCoPTreeNode.java#L70-L101
glookast/commons-timecode
src/main/java/com/glookast/commons/timecode/AbstractTimecode.java
AbstractTimecode.calculateInPoint
public static Timecode calculateInPoint(Timecode outPoint, TimecodeDuration duration) { if (!outPoint.isCompatible(duration)) { MutableTimecodeDuration mutableTimecodeDuration = new MutableTimecodeDuration(duration); mutableTimecodeDuration.setTimecodeBase(outPoint.getTimecodeBase()); mutableTimecodeDuration.setDropFrame(outPoint.isDropFrame()); duration = new TimecodeDuration(mutableTimecodeDuration); } MutableTimecode inPoint = new MutableTimecode(outPoint); inPoint.addFrames(-duration.getFrameNumber()); return new Timecode(inPoint); }
java
public static Timecode calculateInPoint(Timecode outPoint, TimecodeDuration duration) { if (!outPoint.isCompatible(duration)) { MutableTimecodeDuration mutableTimecodeDuration = new MutableTimecodeDuration(duration); mutableTimecodeDuration.setTimecodeBase(outPoint.getTimecodeBase()); mutableTimecodeDuration.setDropFrame(outPoint.isDropFrame()); duration = new TimecodeDuration(mutableTimecodeDuration); } MutableTimecode inPoint = new MutableTimecode(outPoint); inPoint.addFrames(-duration.getFrameNumber()); return new Timecode(inPoint); }
[ "public", "static", "Timecode", "calculateInPoint", "(", "Timecode", "outPoint", ",", "TimecodeDuration", "duration", ")", "{", "if", "(", "!", "outPoint", ".", "isCompatible", "(", "duration", ")", ")", "{", "MutableTimecodeDuration", "mutableTimecodeDuration", "="...
Calculates inPoint of a given outPoint and duration. In case duration does not have the same Timecode base and/or dropFrame flag it will convert it to the same Timecode base and dropFrame flag of the outPoint @param outPoint @param duration @return inPoint
[ "Calculates", "inPoint", "of", "a", "given", "outPoint", "and", "duration", ".", "In", "case", "duration", "does", "not", "have", "the", "same", "Timecode", "base", "and", "/", "or", "dropFrame", "flag", "it", "will", "convert", "it", "to", "the", "same", ...
train
https://github.com/glookast/commons-timecode/blob/ec2f682a51d1cc435d0b42d80de48ff15adb4ee8/src/main/java/com/glookast/commons/timecode/AbstractTimecode.java#L612-L624
sculptor/sculptor
sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/accessimpl/jpa/JpaHelper.java
JpaHelper.createResultCountQuery
public static String createResultCountQuery(String query) { String resultCountQueryString = null; int select = query.toLowerCase().indexOf("select"); int from = query.toLowerCase().indexOf("from"); if (select == -1 || from == -1) { return null; } resultCountQueryString = "select count(" + query.substring(select + 6, from).trim() + ") " + query.substring(from); // remove order by // TODO: remove more parts if (resultCountQueryString.toLowerCase().contains("order by")) { resultCountQueryString = resultCountQueryString.substring(0, resultCountQueryString.toLowerCase().indexOf("order by")); } log.debug("Created query for counting results '{}'", resultCountQueryString); return resultCountQueryString; }
java
public static String createResultCountQuery(String query) { String resultCountQueryString = null; int select = query.toLowerCase().indexOf("select"); int from = query.toLowerCase().indexOf("from"); if (select == -1 || from == -1) { return null; } resultCountQueryString = "select count(" + query.substring(select + 6, from).trim() + ") " + query.substring(from); // remove order by // TODO: remove more parts if (resultCountQueryString.toLowerCase().contains("order by")) { resultCountQueryString = resultCountQueryString.substring(0, resultCountQueryString.toLowerCase().indexOf("order by")); } log.debug("Created query for counting results '{}'", resultCountQueryString); return resultCountQueryString; }
[ "public", "static", "String", "createResultCountQuery", "(", "String", "query", ")", "{", "String", "resultCountQueryString", "=", "null", ";", "int", "select", "=", "query", ".", "toLowerCase", "(", ")", ".", "indexOf", "(", "\"select\"", ")", ";", "int", "...
Build a query based on the original query to count results @param query @return
[ "Build", "a", "query", "based", "on", "the", "original", "query", "to", "count", "results" ]
train
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/accessimpl/jpa/JpaHelper.java#L257-L276
ist-dresden/composum
sling/core/commons/src/main/java/com/composum/sling/clientlibs/servlet/ClientlibCategoryServlet.java
ClientlibCategoryServlet.makePath
public static String makePath(String category, Clientlib.Type type, boolean minified, String hash) { StringBuilder buf = new StringBuilder(PATH); if (minified) buf.append(".min"); buf.append(".").append(type.name()); if (null != hash) { buf.append("/").append(hash); } buf.append("/").append(Clientlib.sanitizeCategory(category)); buf.append(".").append(type.name()); return buf.toString(); }
java
public static String makePath(String category, Clientlib.Type type, boolean minified, String hash) { StringBuilder buf = new StringBuilder(PATH); if (minified) buf.append(".min"); buf.append(".").append(type.name()); if (null != hash) { buf.append("/").append(hash); } buf.append("/").append(Clientlib.sanitizeCategory(category)); buf.append(".").append(type.name()); return buf.toString(); }
[ "public", "static", "String", "makePath", "(", "String", "category", ",", "Clientlib", ".", "Type", "type", ",", "boolean", "minified", ",", "String", "hash", ")", "{", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", "PATH", ")", ";", "if", "(", ...
Creates an path that is rendered by this servlet containing the given parameters.
[ "Creates", "an", "path", "that", "is", "rendered", "by", "this", "servlet", "containing", "the", "given", "parameters", "." ]
train
https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/clientlibs/servlet/ClientlibCategoryServlet.java#L40-L50
liferay/com-liferay-commerce
commerce-tax-api/src/main/java/com/liferay/commerce/tax/model/CommerceTaxMethodWrapper.java
CommerceTaxMethodWrapper.setNameMap
@Override public void setNameMap(Map<java.util.Locale, String> nameMap) { _commerceTaxMethod.setNameMap(nameMap); }
java
@Override public void setNameMap(Map<java.util.Locale, String> nameMap) { _commerceTaxMethod.setNameMap(nameMap); }
[ "@", "Override", "public", "void", "setNameMap", "(", "Map", "<", "java", ".", "util", ".", "Locale", ",", "String", ">", "nameMap", ")", "{", "_commerceTaxMethod", ".", "setNameMap", "(", "nameMap", ")", ";", "}" ]
Sets the localized names of this commerce tax method from the map of locales and localized names. @param nameMap the locales and localized names of this commerce tax method
[ "Sets", "the", "localized", "names", "of", "this", "commerce", "tax", "method", "from", "the", "map", "of", "locales", "and", "localized", "names", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-tax-api/src/main/java/com/liferay/commerce/tax/model/CommerceTaxMethodWrapper.java#L709-L712
jhunters/jprotobuf
src/main/java/com/baidu/bjf/remoting/protobuf/ProtobufIDLProxy.java
ProtobufIDLProxy.createSingle
public static IDLProxyObject createSingle(InputStream is, boolean debug, boolean isUniName) throws IOException { return createSingle(is, debug, null, isUniName); }
java
public static IDLProxyObject createSingle(InputStream is, boolean debug, boolean isUniName) throws IOException { return createSingle(is, debug, null, isUniName); }
[ "public", "static", "IDLProxyObject", "createSingle", "(", "InputStream", "is", ",", "boolean", "debug", ",", "boolean", "isUniName", ")", "throws", "IOException", "{", "return", "createSingle", "(", "is", ",", "debug", ",", "null", ",", "isUniName", ")", ";",...
Creates the single. @param is the is @param debug the debug @param isUniName the is uni name @return the IDL proxy object @throws IOException Signals that an I/O exception has occurred.
[ "Creates", "the", "single", "." ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/src/main/java/com/baidu/bjf/remoting/protobuf/ProtobufIDLProxy.java#L989-L991
azkaban/azkaban
az-flow-trigger-dependency-type/kafka-event-trigger/src/main/java/trigger/kafka/KafkaEventMonitor.java
KafkaEventMonitor.triggerDependencies
private void triggerDependencies(final Set<String> matchedList, final ConsumerRecord<String, String> record) { final List<KafkaDependencyInstanceContext> deleteList = new LinkedList<>(); for (final String it : matchedList) { final List<KafkaDependencyInstanceContext> possibleAvailableDeps = this.depInstances.getDepsByTopicAndEvent(record.topic(), it); for (final KafkaDependencyInstanceContext dep : possibleAvailableDeps) { dep.getCallback().onSuccess(dep); deleteList.add(dep); } //If dependencies that need to be removed could lead to unsubscribing topics, do the topics rebalance if (!this.depInstances.removeList(record.topic(), it, deleteList)) { this.subscribedTopics.addAll(this.depInstances.getTopicList()); } } }
java
private void triggerDependencies(final Set<String> matchedList, final ConsumerRecord<String, String> record) { final List<KafkaDependencyInstanceContext> deleteList = new LinkedList<>(); for (final String it : matchedList) { final List<KafkaDependencyInstanceContext> possibleAvailableDeps = this.depInstances.getDepsByTopicAndEvent(record.topic(), it); for (final KafkaDependencyInstanceContext dep : possibleAvailableDeps) { dep.getCallback().onSuccess(dep); deleteList.add(dep); } //If dependencies that need to be removed could lead to unsubscribing topics, do the topics rebalance if (!this.depInstances.removeList(record.topic(), it, deleteList)) { this.subscribedTopics.addAll(this.depInstances.getTopicList()); } } }
[ "private", "void", "triggerDependencies", "(", "final", "Set", "<", "String", ">", "matchedList", ",", "final", "ConsumerRecord", "<", "String", ",", "String", ">", "record", ")", "{", "final", "List", "<", "KafkaDependencyInstanceContext", ">", "deleteList", "=...
If the matcher returns true, remove the dependency from collection.
[ "If", "the", "matcher", "returns", "true", "remove", "the", "dependency", "from", "collection", "." ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/az-flow-trigger-dependency-type/kafka-event-trigger/src/main/java/trigger/kafka/KafkaEventMonitor.java#L149-L163
cojen/Cojen
src/main/java/org/cojen/classfile/ConstantPool.java
ConstantPool.addConstantNameAndType
public ConstantNameAndTypeInfo addConstantNameAndType(String name, Descriptor type) { return (ConstantNameAndTypeInfo)addConstant(new ConstantNameAndTypeInfo(this, name, type)); }
java
public ConstantNameAndTypeInfo addConstantNameAndType(String name, Descriptor type) { return (ConstantNameAndTypeInfo)addConstant(new ConstantNameAndTypeInfo(this, name, type)); }
[ "public", "ConstantNameAndTypeInfo", "addConstantNameAndType", "(", "String", "name", ",", "Descriptor", "type", ")", "{", "return", "(", "ConstantNameAndTypeInfo", ")", "addConstant", "(", "new", "ConstantNameAndTypeInfo", "(", "this", ",", "name", ",", "type", ")"...
Get or create a constant name and type structure from the constant pool.
[ "Get", "or", "create", "a", "constant", "name", "and", "type", "structure", "from", "the", "constant", "pool", "." ]
train
https://github.com/cojen/Cojen/blob/ddee9a0fde83870b97e0ed04c58270aa665f3a62/src/main/java/org/cojen/classfile/ConstantPool.java#L235-L238
alipay/sofa-rpc
extension-impl/registry-local/src/main/java/com/alipay/sofa/rpc/registry/local/LocalRegistryHelper.java
LocalRegistryHelper.checkModified
public static boolean checkModified(String address, String lastDigest) { // 检查文件是否被修改了 String newDigest = calMD5Checksum(address); return !StringUtils.equals(newDigest, lastDigest); }
java
public static boolean checkModified(String address, String lastDigest) { // 检查文件是否被修改了 String newDigest = calMD5Checksum(address); return !StringUtils.equals(newDigest, lastDigest); }
[ "public", "static", "boolean", "checkModified", "(", "String", "address", ",", "String", "lastDigest", ")", "{", "// 检查文件是否被修改了", "String", "newDigest", "=", "calMD5Checksum", "(", "address", ")", ";", "return", "!", "StringUtils", ".", "equals", "(", "newDigest...
Check file's digest. @param address the address @param lastDigest the update digest @return true被修改,false未被修改
[ "Check", "file", "s", "digest", "." ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/registry-local/src/main/java/com/alipay/sofa/rpc/registry/local/LocalRegistryHelper.java#L72-L76
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/VisualizationTree.java
VisualizationTree.setVisible
public static void setVisible(VisualizerContext context, VisualizationTask task, boolean visibility) { // Hide other tools if(visibility && task.isTool()) { Hierarchy<Object> vistree = context.getVisHierarchy(); for(It<VisualizationTask> iter2 = vistree.iterAll().filter(VisualizationTask.class); iter2.valid(); iter2.advance()) { VisualizationTask other = iter2.get(); if(other != task && other.isTool() && other.isVisible()) { context.visChanged(other.visibility(false)); } } } context.visChanged(task.visibility(visibility)); }
java
public static void setVisible(VisualizerContext context, VisualizationTask task, boolean visibility) { // Hide other tools if(visibility && task.isTool()) { Hierarchy<Object> vistree = context.getVisHierarchy(); for(It<VisualizationTask> iter2 = vistree.iterAll().filter(VisualizationTask.class); iter2.valid(); iter2.advance()) { VisualizationTask other = iter2.get(); if(other != task && other.isTool() && other.isVisible()) { context.visChanged(other.visibility(false)); } } } context.visChanged(task.visibility(visibility)); }
[ "public", "static", "void", "setVisible", "(", "VisualizerContext", "context", ",", "VisualizationTask", "task", ",", "boolean", "visibility", ")", "{", "// Hide other tools", "if", "(", "visibility", "&&", "task", ".", "isTool", "(", ")", ")", "{", "Hierarchy",...
Utility function to change Visualizer visibility. @param context Visualization context @param task Visualization task @param visibility Visibility value
[ "Utility", "function", "to", "change", "Visualizer", "visibility", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/VisualizationTree.java#L221-L233
apiman/apiman
gateway/engine/es/src/main/java/io/apiman/gateway/engine/es/DefaultESClientFactory.java
DefaultESClientFactory.updateHttpConfig
protected void updateHttpConfig(Builder httpClientConfig, Map<String, String> config) { String username = config.get("client.username"); //$NON-NLS-1$ String password = config.get("client.password"); //$NON-NLS-1$ String timeout = config.get("client.timeout"); //$NON-NLS-1$ if (StringUtils.isBlank(timeout)) { timeout = "10000"; //$NON-NLS-1$ } httpClientConfig .connTimeout(new Integer(timeout)) .readTimeout(new Integer(timeout)) .maxTotalConnection(75) .defaultMaxTotalConnectionPerRoute(75) .multiThreaded(true); if (!StringUtils.isBlank(username)) { httpClientConfig.defaultCredentials(username, password); } if ("https".equals(config.get("protocol"))) { //$NON-NLS-1$ //$NON-NLS-2$ updateSslConfig(httpClientConfig, config); } }
java
protected void updateHttpConfig(Builder httpClientConfig, Map<String, String> config) { String username = config.get("client.username"); //$NON-NLS-1$ String password = config.get("client.password"); //$NON-NLS-1$ String timeout = config.get("client.timeout"); //$NON-NLS-1$ if (StringUtils.isBlank(timeout)) { timeout = "10000"; //$NON-NLS-1$ } httpClientConfig .connTimeout(new Integer(timeout)) .readTimeout(new Integer(timeout)) .maxTotalConnection(75) .defaultMaxTotalConnectionPerRoute(75) .multiThreaded(true); if (!StringUtils.isBlank(username)) { httpClientConfig.defaultCredentials(username, password); } if ("https".equals(config.get("protocol"))) { //$NON-NLS-1$ //$NON-NLS-2$ updateSslConfig(httpClientConfig, config); } }
[ "protected", "void", "updateHttpConfig", "(", "Builder", "httpClientConfig", ",", "Map", "<", "String", ",", "String", ">", "config", ")", "{", "String", "username", "=", "config", ".", "get", "(", "\"client.username\"", ")", ";", "//$NON-NLS-1$", "String", "p...
Update the http client config. @param httpClientConfig @param config
[ "Update", "the", "http", "client", "config", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/es/src/main/java/io/apiman/gateway/engine/es/DefaultESClientFactory.java#L133-L154
dkpro/dkpro-argumentation
dkpro-argumentation-preprocessing/src/main/java/org/dkpro/argumentation/preprocessing/annotation/ArgumentTokenBIOAnnotator.java
ArgumentTokenBIOAnnotator.getLabel
protected String getLabel(ArgumentComponent argumentComponent, Token token) { StringBuilder sb = new StringBuilder(argumentComponent.getClass().getSimpleName()); if ("BIO".equals(this.codingGranularity)) { // Does the component begin here? if (argumentComponent.getBegin() == token.getBegin()) { sb.append(B_SUFFIX); } else { sb.append(I_SUFFIX); } } else { sb.append(I_SUFFIX); } return sb.toString(); }
java
protected String getLabel(ArgumentComponent argumentComponent, Token token) { StringBuilder sb = new StringBuilder(argumentComponent.getClass().getSimpleName()); if ("BIO".equals(this.codingGranularity)) { // Does the component begin here? if (argumentComponent.getBegin() == token.getBegin()) { sb.append(B_SUFFIX); } else { sb.append(I_SUFFIX); } } else { sb.append(I_SUFFIX); } return sb.toString(); }
[ "protected", "String", "getLabel", "(", "ArgumentComponent", "argumentComponent", ",", "Token", "token", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "argumentComponent", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ")", ";", ...
Returns a label for the annotated token @param argumentComponent covering argument component @param token token @return BIO label
[ "Returns", "a", "label", "for", "the", "annotated", "token" ]
train
https://github.com/dkpro/dkpro-argumentation/blob/57ce6f5e73d8075b7088aeeebb107c85b3d4bbcb/dkpro-argumentation-preprocessing/src/main/java/org/dkpro/argumentation/preprocessing/annotation/ArgumentTokenBIOAnnotator.java#L69-L87
joniles/mpxj
src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java
FastTrackData.readColumn
private void readColumn(int startIndex, int length) throws Exception { if (m_currentTable != null) { int value = FastTrackUtility.getByte(m_buffer, startIndex); Class<?> klass = COLUMN_MAP[value]; if (klass == null) { klass = UnknownColumn.class; } FastTrackColumn column = (FastTrackColumn) klass.newInstance(); m_currentColumn = column; logColumnData(startIndex, length); column.read(m_currentTable.getType(), m_buffer, startIndex, length); FastTrackField type = column.getType(); // // Don't try to add this data if: // 1. We don't know what type it is // 2. We have seen the type already // if (type != null && !m_currentFields.contains(type)) { m_currentFields.add(type); m_currentTable.addColumn(column); updateDurationTimeUnit(column); updateWorkTimeUnit(column); logColumn(column); } } }
java
private void readColumn(int startIndex, int length) throws Exception { if (m_currentTable != null) { int value = FastTrackUtility.getByte(m_buffer, startIndex); Class<?> klass = COLUMN_MAP[value]; if (klass == null) { klass = UnknownColumn.class; } FastTrackColumn column = (FastTrackColumn) klass.newInstance(); m_currentColumn = column; logColumnData(startIndex, length); column.read(m_currentTable.getType(), m_buffer, startIndex, length); FastTrackField type = column.getType(); // // Don't try to add this data if: // 1. We don't know what type it is // 2. We have seen the type already // if (type != null && !m_currentFields.contains(type)) { m_currentFields.add(type); m_currentTable.addColumn(column); updateDurationTimeUnit(column); updateWorkTimeUnit(column); logColumn(column); } } }
[ "private", "void", "readColumn", "(", "int", "startIndex", ",", "int", "length", ")", "throws", "Exception", "{", "if", "(", "m_currentTable", "!=", "null", ")", "{", "int", "value", "=", "FastTrackUtility", ".", "getByte", "(", "m_buffer", ",", "startIndex"...
Read data for a single column. @param startIndex block start @param length block length
[ "Read", "data", "for", "a", "single", "column", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java#L232-L266
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PacketCapturesInner.java
PacketCapturesInner.beginCreateAsync
public Observable<PacketCaptureResultInner> beginCreateAsync(String resourceGroupName, String networkWatcherName, String packetCaptureName, PacketCaptureInner parameters) { return beginCreateWithServiceResponseAsync(resourceGroupName, networkWatcherName, packetCaptureName, parameters).map(new Func1<ServiceResponse<PacketCaptureResultInner>, PacketCaptureResultInner>() { @Override public PacketCaptureResultInner call(ServiceResponse<PacketCaptureResultInner> response) { return response.body(); } }); }
java
public Observable<PacketCaptureResultInner> beginCreateAsync(String resourceGroupName, String networkWatcherName, String packetCaptureName, PacketCaptureInner parameters) { return beginCreateWithServiceResponseAsync(resourceGroupName, networkWatcherName, packetCaptureName, parameters).map(new Func1<ServiceResponse<PacketCaptureResultInner>, PacketCaptureResultInner>() { @Override public PacketCaptureResultInner call(ServiceResponse<PacketCaptureResultInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "PacketCaptureResultInner", ">", "beginCreateAsync", "(", "String", "resourceGroupName", ",", "String", "networkWatcherName", ",", "String", "packetCaptureName", ",", "PacketCaptureInner", "parameters", ")", "{", "return", "beginCreateWithServic...
Create and start a packet capture on the specified VM. @param resourceGroupName The name of the resource group. @param networkWatcherName The name of the network watcher. @param packetCaptureName The name of the packet capture session. @param parameters Parameters that define the create packet capture operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PacketCaptureResultInner object
[ "Create", "and", "start", "a", "packet", "capture", "on", "the", "specified", "VM", "." ]
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/PacketCapturesInner.java#L229-L236
aws/aws-sdk-java
aws-java-sdk-iot1clickprojects/src/main/java/com/amazonaws/services/iot1clickprojects/model/GetDevicesInPlacementResult.java
GetDevicesInPlacementResult.withDevices
public GetDevicesInPlacementResult withDevices(java.util.Map<String, String> devices) { setDevices(devices); return this; }
java
public GetDevicesInPlacementResult withDevices(java.util.Map<String, String> devices) { setDevices(devices); return this; }
[ "public", "GetDevicesInPlacementResult", "withDevices", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "devices", ")", "{", "setDevices", "(", "devices", ")", ";", "return", "this", ";", "}" ]
<p> An object containing the devices (zero or more) within the placement. </p> @param devices An object containing the devices (zero or more) within the placement. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "An", "object", "containing", "the", "devices", "(", "zero", "or", "more", ")", "within", "the", "placement", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iot1clickprojects/src/main/java/com/amazonaws/services/iot1clickprojects/model/GetDevicesInPlacementResult.java#L68-L71
algolia/instantsearch-android
ui/src/main/java/com/algolia/instantsearch/ui/views/filters/TwoValuesToggle.java
TwoValuesToggle.setValueOn
public void setValueOn(String newValue, @Nullable String newName) { if (isChecked()) { // refining on valueOn: facetRefinement needs an update searcher.updateFacetRefinement(attribute, valueOn, false) .updateFacetRefinement(newName != null ? newName : attribute, newValue, true) .search(); } this.valueOn = newValue; applyEventualNewAttribute(newName); }
java
public void setValueOn(String newValue, @Nullable String newName) { if (isChecked()) { // refining on valueOn: facetRefinement needs an update searcher.updateFacetRefinement(attribute, valueOn, false) .updateFacetRefinement(newName != null ? newName : attribute, newValue, true) .search(); } this.valueOn = newValue; applyEventualNewAttribute(newName); }
[ "public", "void", "setValueOn", "(", "String", "newValue", ",", "@", "Nullable", "String", "newName", ")", "{", "if", "(", "isChecked", "(", ")", ")", "{", "// refining on valueOn: facetRefinement needs an update", "searcher", ".", "updateFacetRefinement", "(", "att...
Changes the Toggle's valueOn, updating facet refinements accordingly. @param newValue valueOn's new value. @param newName an eventual new attribute name.
[ "Changes", "the", "Toggle", "s", "valueOn", "updating", "facet", "refinements", "accordingly", "." ]
train
https://github.com/algolia/instantsearch-android/blob/12092ec30140df9ffc2bf916339b433372034616/ui/src/main/java/com/algolia/instantsearch/ui/views/filters/TwoValuesToggle.java#L60-L68
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/sender/TLSSyslogSenderImpl.java
TLSSyslogSenderImpl.getTLSSocket
private Socket getTLSSocket(InetAddress destination, int port) throws Exception { String key = destination.getHostAddress() + ":" + port; synchronized (socketMap){ Socket socket = socketMap.get(key); if (socket == null){ // create a new one NodeAuthModuleContext nodeAuthContext = NodeAuthModuleContext.getContext(); socket = nodeAuthContext.getSocketHandler().getSocket(destination.getHostName(), port, true); // remember it for next time // TODO: had trouble with this with Steve Moore's online ATNA server so not caching the sockets // need to worry about synchronization if we try to put this optimization back // there appears to be one AuditorModuleContext per host/port so may can pool them based on that object? socketMap.put(key, socket); } // whatever happened, now return the socket return socket; } }
java
private Socket getTLSSocket(InetAddress destination, int port) throws Exception { String key = destination.getHostAddress() + ":" + port; synchronized (socketMap){ Socket socket = socketMap.get(key); if (socket == null){ // create a new one NodeAuthModuleContext nodeAuthContext = NodeAuthModuleContext.getContext(); socket = nodeAuthContext.getSocketHandler().getSocket(destination.getHostName(), port, true); // remember it for next time // TODO: had trouble with this with Steve Moore's online ATNA server so not caching the sockets // need to worry about synchronization if we try to put this optimization back // there appears to be one AuditorModuleContext per host/port so may can pool them based on that object? socketMap.put(key, socket); } // whatever happened, now return the socket return socket; } }
[ "private", "Socket", "getTLSSocket", "(", "InetAddress", "destination", ",", "int", "port", ")", "throws", "Exception", "{", "String", "key", "=", "destination", ".", "getHostAddress", "(", ")", "+", "\":\"", "+", "port", ";", "synchronized", "(", "socketMap",...
Gets the socket tied to the address and port for this transport @param port Port to check @return Port to use
[ "Gets", "the", "socket", "tied", "to", "the", "address", "and", "port", "for", "this", "transport" ]
train
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/sender/TLSSyslogSenderImpl.java#L171-L189
Azure/azure-sdk-for-java
containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/ContainerServicesInner.java
ContainerServicesInner.createOrUpdateAsync
public Observable<ContainerServiceInner> createOrUpdateAsync(String resourceGroupName, String containerServiceName, ContainerServiceInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, containerServiceName, parameters).map(new Func1<ServiceResponse<ContainerServiceInner>, ContainerServiceInner>() { @Override public ContainerServiceInner call(ServiceResponse<ContainerServiceInner> response) { return response.body(); } }); }
java
public Observable<ContainerServiceInner> createOrUpdateAsync(String resourceGroupName, String containerServiceName, ContainerServiceInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, containerServiceName, parameters).map(new Func1<ServiceResponse<ContainerServiceInner>, ContainerServiceInner>() { @Override public ContainerServiceInner call(ServiceResponse<ContainerServiceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ContainerServiceInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "containerServiceName", ",", "ContainerServiceInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourc...
Creates or updates a container service. Creates or updates a container service with the specified configuration of orchestrator, masters, and agents. @param resourceGroupName The name of the resource group. @param containerServiceName The name of the container service in the specified subscription and resource group. @param parameters Parameters supplied to the Create or Update a Container Service operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Creates", "or", "updates", "a", "container", "service", ".", "Creates", "or", "updates", "a", "container", "service", "with", "the", "specified", "configuration", "of", "orchestrator", "masters", "and", "agents", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/ContainerServicesInner.java#L260-L267
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java
FSDirectory.getFileInfoExtended
FileStatusExtended getFileInfoExtended(String src, INode targetNode, String leaseHolder) throws IOException { readLock(); try { if (targetNode == null) { return null; } FileStatus stat = createFileStatus(src, targetNode); long hardlinkId = (targetNode instanceof INodeHardLinkFile) ? ((INodeHardLinkFile) targetNode) .getHardLinkID() : -1; return new FileStatusExtended(stat, ((INodeFile) targetNode).getBlocks(), leaseHolder, hardlinkId); } finally { readUnlock(); } }
java
FileStatusExtended getFileInfoExtended(String src, INode targetNode, String leaseHolder) throws IOException { readLock(); try { if (targetNode == null) { return null; } FileStatus stat = createFileStatus(src, targetNode); long hardlinkId = (targetNode instanceof INodeHardLinkFile) ? ((INodeHardLinkFile) targetNode) .getHardLinkID() : -1; return new FileStatusExtended(stat, ((INodeFile) targetNode).getBlocks(), leaseHolder, hardlinkId); } finally { readUnlock(); } }
[ "FileStatusExtended", "getFileInfoExtended", "(", "String", "src", ",", "INode", "targetNode", ",", "String", "leaseHolder", ")", "throws", "IOException", "{", "readLock", "(", ")", ";", "try", "{", "if", "(", "targetNode", "==", "null", ")", "{", "return", ...
Get the extended file info for a specific file. @param src The string representation of the path to the file @param targetNode the INode for the corresponding file @param leaseHolder the lease holder for the file @return object containing information regarding the file or null if file not found @throws IOException if permission to access file is denied by the system
[ "Get", "the", "extended", "file", "info", "for", "a", "specific", "file", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java#L1829-L1845
CodeNarc/CodeNarc
src/main/java/org/codenarc/util/AstUtil.java
AstUtil.isFinalVariable
public static boolean isFinalVariable(DeclarationExpression declarationExpression, SourceCode sourceCode) { if (isFromGeneratedSourceCode(declarationExpression)) { return false; } List<Expression> variableExpressions = getVariableExpressions(declarationExpression); if (!variableExpressions.isEmpty()) { Expression variableExpression = variableExpressions.get(0); int startOfDeclaration = declarationExpression.getColumnNumber(); int startOfVariableName = variableExpression.getColumnNumber(); int sourceLineNumber = findFirstNonAnnotationLine(declarationExpression, sourceCode); String sourceLine = sourceCode.getLines().get(sourceLineNumber-1); String modifiers = (startOfDeclaration >= 0 && startOfVariableName >= 0 && sourceLine.length() >= startOfVariableName) ? sourceLine.substring(startOfDeclaration - 1, startOfVariableName - 1) : ""; return modifiers.contains("final"); } return false; }
java
public static boolean isFinalVariable(DeclarationExpression declarationExpression, SourceCode sourceCode) { if (isFromGeneratedSourceCode(declarationExpression)) { return false; } List<Expression> variableExpressions = getVariableExpressions(declarationExpression); if (!variableExpressions.isEmpty()) { Expression variableExpression = variableExpressions.get(0); int startOfDeclaration = declarationExpression.getColumnNumber(); int startOfVariableName = variableExpression.getColumnNumber(); int sourceLineNumber = findFirstNonAnnotationLine(declarationExpression, sourceCode); String sourceLine = sourceCode.getLines().get(sourceLineNumber-1); String modifiers = (startOfDeclaration >= 0 && startOfVariableName >= 0 && sourceLine.length() >= startOfVariableName) ? sourceLine.substring(startOfDeclaration - 1, startOfVariableName - 1) : ""; return modifiers.contains("final"); } return false; }
[ "public", "static", "boolean", "isFinalVariable", "(", "DeclarationExpression", "declarationExpression", ",", "SourceCode", "sourceCode", ")", "{", "if", "(", "isFromGeneratedSourceCode", "(", "declarationExpression", ")", ")", "{", "return", "false", ";", "}", "List"...
Return true if the DeclarationExpression represents a 'final' variable declaration. NOTE: THIS IS A WORKAROUND. There does not seem to be an easy way to determine whether the 'final' modifier has been specified for a variable declaration. Return true if the 'final' is present before the variable name.
[ "Return", "true", "if", "the", "DeclarationExpression", "represents", "a", "final", "variable", "declaration", "." ]
train
https://github.com/CodeNarc/CodeNarc/blob/9a7cec02cb8cbaf845030f2434309e8968f5d7a7/src/main/java/org/codenarc/util/AstUtil.java#L541-L558
lucee/Lucee
core/src/main/java/lucee/runtime/crypt/BinConverter.java
BinConverter.longToByteArray
public static void longToByteArray(long lValue, byte[] buffer, int nStartIndex) { buffer[nStartIndex] = (byte) (lValue >>> 56); buffer[nStartIndex + 1] = (byte) ((lValue >>> 48) & 0x0ff); buffer[nStartIndex + 2] = (byte) ((lValue >>> 40) & 0x0ff); buffer[nStartIndex + 3] = (byte) ((lValue >>> 32) & 0x0ff); buffer[nStartIndex + 4] = (byte) ((lValue >>> 24) & 0x0ff); buffer[nStartIndex + 5] = (byte) ((lValue >>> 16) & 0x0ff); buffer[nStartIndex + 6] = (byte) ((lValue >>> 8) & 0x0ff); buffer[nStartIndex + 7] = (byte) lValue; }
java
public static void longToByteArray(long lValue, byte[] buffer, int nStartIndex) { buffer[nStartIndex] = (byte) (lValue >>> 56); buffer[nStartIndex + 1] = (byte) ((lValue >>> 48) & 0x0ff); buffer[nStartIndex + 2] = (byte) ((lValue >>> 40) & 0x0ff); buffer[nStartIndex + 3] = (byte) ((lValue >>> 32) & 0x0ff); buffer[nStartIndex + 4] = (byte) ((lValue >>> 24) & 0x0ff); buffer[nStartIndex + 5] = (byte) ((lValue >>> 16) & 0x0ff); buffer[nStartIndex + 6] = (byte) ((lValue >>> 8) & 0x0ff); buffer[nStartIndex + 7] = (byte) lValue; }
[ "public", "static", "void", "longToByteArray", "(", "long", "lValue", ",", "byte", "[", "]", "buffer", ",", "int", "nStartIndex", ")", "{", "buffer", "[", "nStartIndex", "]", "=", "(", "byte", ")", "(", "lValue", ">>>", "56", ")", ";", "buffer", "[", ...
converts a long o bytes which are put into a given array @param lValue the 64bit integer to convert @param buffer the target buffer @param nStartIndex where to place the bytes in the buffer
[ "converts", "a", "long", "o", "bytes", "which", "are", "put", "into", "a", "given", "array" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/crypt/BinConverter.java#L45-L54
amzn/ion-java
src/com/amazon/ion/util/IonStreamUtils.java
IonStreamUtils.writeFloatList
public static void writeFloatList(IonWriter writer, float[] values) throws IOException { if (writer instanceof _Private_ListWriter) { ((_Private_ListWriter)writer).writeFloatList(values); return; } writer.stepIn(IonType.LIST); for (int ii=0; ii<values.length; ii++) { writer.writeFloat(values[ii]); } writer.stepOut(); }
java
public static void writeFloatList(IonWriter writer, float[] values) throws IOException { if (writer instanceof _Private_ListWriter) { ((_Private_ListWriter)writer).writeFloatList(values); return; } writer.stepIn(IonType.LIST); for (int ii=0; ii<values.length; ii++) { writer.writeFloat(values[ii]); } writer.stepOut(); }
[ "public", "static", "void", "writeFloatList", "(", "IonWriter", "writer", ",", "float", "[", "]", "values", ")", "throws", "IOException", "{", "if", "(", "writer", "instanceof", "_Private_ListWriter", ")", "{", "(", "(", "_Private_ListWriter", ")", "writer", "...
writes an IonList with a series of IonFloat values. This starts a List, writes the values (without any annoations) and closes the list. For text and tree writers this is just a convienience, but for the binary writer it can be optimized internally. Note that since, currently, IonFloat is a 64 bit float this is a helper that simply casts the passed in floats to double before writing them. @param values 32 bit float values to populate the lists IonFloat's with
[ "writes", "an", "IonList", "with", "a", "series", "of", "IonFloat", "values", ".", "This", "starts", "a", "List", "writes", "the", "values", "(", "without", "any", "annoations", ")", "and", "closes", "the", "list", ".", "For", "text", "and", "tree", "wri...
train
https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/util/IonStreamUtils.java#L163-L176
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/deployment/reflect/ClassReflectionIndexUtil.java
ClassReflectionIndexUtil.findRequiredMethod
public static Method findRequiredMethod(final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> clazz, final MethodIdentifier methodIdentifier) throws DeploymentUnitProcessingException { Method method = findMethod(deploymentReflectionIndex, clazz, methodIdentifier); if (method == null) { throw ServerLogger.ROOT_LOGGER.noMethodFound(methodIdentifier, clazz); } return method; }
java
public static Method findRequiredMethod(final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> clazz, final MethodIdentifier methodIdentifier) throws DeploymentUnitProcessingException { Method method = findMethod(deploymentReflectionIndex, clazz, methodIdentifier); if (method == null) { throw ServerLogger.ROOT_LOGGER.noMethodFound(methodIdentifier, clazz); } return method; }
[ "public", "static", "Method", "findRequiredMethod", "(", "final", "DeploymentReflectionIndex", "deploymentReflectionIndex", ",", "final", "Class", "<", "?", ">", "clazz", ",", "final", "MethodIdentifier", "methodIdentifier", ")", "throws", "DeploymentUnitProcessingException...
Finds and returns a method corresponding to the passed <code>methodIdentifier</code>. The passed <code>classReflectionIndex</code> will be used to traverse the class hierarchy while finding the method. <p/> Throws {@link org.jboss.as.server.deployment.DeploymentUnitProcessingException} if no such method is found. @param deploymentReflectionIndex The deployment reflection index @param clazz The class to search @param methodIdentifier The method identifier of the method being searched for @return @throws org.jboss.as.server.deployment.DeploymentUnitProcessingException If no such method is found
[ "Finds", "and", "returns", "a", "method", "corresponding", "to", "the", "passed", "<code", ">", "methodIdentifier<", "/", "code", ">", ".", "The", "passed", "<code", ">", "classReflectionIndex<", "/", "code", ">", "will", "be", "used", "to", "traverse", "the...
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/reflect/ClassReflectionIndexUtil.java#L97-L103
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/ODataLocal.java
ODataLocal.addRecord
public long addRecord(final ORecordId iRid, final byte[] iContent) throws IOException { if (iContent.length == 0) // AVOID UNUSEFUL CREATION OF EMPTY RECORD: IT WILL BE CREATED AT FIRST UPDATE return -1; final int recordSize = iContent.length + RECORD_FIX_SIZE; acquireExclusiveLock(); try { final long[] newFilePosition = getFreeSpace(recordSize); writeRecord(newFilePosition, iRid.clusterId, iRid.clusterPosition, iContent); return getAbsolutePosition(newFilePosition); } finally { releaseExclusiveLock(); } }
java
public long addRecord(final ORecordId iRid, final byte[] iContent) throws IOException { if (iContent.length == 0) // AVOID UNUSEFUL CREATION OF EMPTY RECORD: IT WILL BE CREATED AT FIRST UPDATE return -1; final int recordSize = iContent.length + RECORD_FIX_SIZE; acquireExclusiveLock(); try { final long[] newFilePosition = getFreeSpace(recordSize); writeRecord(newFilePosition, iRid.clusterId, iRid.clusterPosition, iContent); return getAbsolutePosition(newFilePosition); } finally { releaseExclusiveLock(); } }
[ "public", "long", "addRecord", "(", "final", "ORecordId", "iRid", ",", "final", "byte", "[", "]", "iContent", ")", "throws", "IOException", "{", "if", "(", "iContent", ".", "length", "==", "0", ")", "// AVOID UNUSEFUL CREATION OF EMPTY RECORD: IT WILL BE CREATED AT ...
Add the record content in file. @param iContent The content to write @return The record offset. @throws IOException
[ "Add", "the", "record", "content", "in", "file", "." ]
train
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/ODataLocal.java#L187-L205
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/ConfigUtils.java
ConfigUtils.hasNonEmptyPath
public static boolean hasNonEmptyPath(Config config, String key) { return config.hasPath(key) && StringUtils.isNotBlank(config.getString(key)); }
java
public static boolean hasNonEmptyPath(Config config, String key) { return config.hasPath(key) && StringUtils.isNotBlank(config.getString(key)); }
[ "public", "static", "boolean", "hasNonEmptyPath", "(", "Config", "config", ",", "String", "key", ")", "{", "return", "config", ".", "hasPath", "(", "key", ")", "&&", "StringUtils", ".", "isNotBlank", "(", "config", ".", "getString", "(", "key", ")", ")", ...
Check if the given <code>key</code> exists in <code>config</code> and it is not null or empty Uses {@link StringUtils#isNotBlank(CharSequence)} @param config which may have the key @param key to look for in the config @return True if key exits and not null or empty. False otherwise
[ "Check", "if", "the", "given", "<code", ">", "key<", "/", "code", ">", "exists", "in", "<code", ">", "config<", "/", "code", ">", "and", "it", "is", "not", "null", "or", "empty", "Uses", "{", "@link", "StringUtils#isNotBlank", "(", "CharSequence", ")", ...
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/ConfigUtils.java#L474-L476
rsocket/rsocket-java
rsocket-core/src/main/java/io/rsocket/util/DefaultPayload.java
DefaultPayload.create
public static Payload create(CharSequence data, @Nullable CharSequence metadata) { return create( StandardCharsets.UTF_8.encode(CharBuffer.wrap(data)), metadata == null ? null : StandardCharsets.UTF_8.encode(CharBuffer.wrap(metadata))); }
java
public static Payload create(CharSequence data, @Nullable CharSequence metadata) { return create( StandardCharsets.UTF_8.encode(CharBuffer.wrap(data)), metadata == null ? null : StandardCharsets.UTF_8.encode(CharBuffer.wrap(metadata))); }
[ "public", "static", "Payload", "create", "(", "CharSequence", "data", ",", "@", "Nullable", "CharSequence", "metadata", ")", "{", "return", "create", "(", "StandardCharsets", ".", "UTF_8", ".", "encode", "(", "CharBuffer", ".", "wrap", "(", "data", ")", ")",...
Static factory method for a text payload. Mainly looks better than "new DefaultPayload(data, metadata)" @param data the data of the payload. @param metadata the metadata for the payload. @return a payload.
[ "Static", "factory", "method", "for", "a", "text", "payload", ".", "Mainly", "looks", "better", "than", "new", "DefaultPayload", "(", "data", "metadata", ")" ]
train
https://github.com/rsocket/rsocket-java/blob/5101748fbd224ec86570351cebd24d079b63fbfc/rsocket-core/src/main/java/io/rsocket/util/DefaultPayload.java#L61-L65
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/preferences/ExtraLanguagePreferenceAccess.java
ExtraLanguagePreferenceAccess.getXtextKey
private static String getXtextKey(String preferenceContainerID, String preferenceName) { return GENERATOR_PREFERENCE_TAG + PreferenceConstants.SEPARATOR + preferenceContainerID + PreferenceConstants.SEPARATOR + preferenceName; }
java
private static String getXtextKey(String preferenceContainerID, String preferenceName) { return GENERATOR_PREFERENCE_TAG + PreferenceConstants.SEPARATOR + preferenceContainerID + PreferenceConstants.SEPARATOR + preferenceName; }
[ "private", "static", "String", "getXtextKey", "(", "String", "preferenceContainerID", ",", "String", "preferenceName", ")", "{", "return", "GENERATOR_PREFERENCE_TAG", "+", "PreferenceConstants", ".", "SEPARATOR", "+", "preferenceContainerID", "+", "PreferenceConstants", "...
Create a preference key according to the Xtext option block standards. @param preferenceContainerID the identifier of the generator's preference container. @param preferenceName the name of the preference. @return the key.
[ "Create", "a", "preference", "key", "according", "to", "the", "Xtext", "option", "block", "standards", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/preferences/ExtraLanguagePreferenceAccess.java#L100-L103
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/ContentSpecUtilities.java
ContentSpecUtilities.fixFailedContentSpec
public static String fixFailedContentSpec(final ContentSpecWrapper contentSpec, final String validText, final boolean includeChecksum) { return fixFailedContentSpec(contentSpec.getId(), contentSpec.getFailed(), validText, includeChecksum); }
java
public static String fixFailedContentSpec(final ContentSpecWrapper contentSpec, final String validText, final boolean includeChecksum) { return fixFailedContentSpec(contentSpec.getId(), contentSpec.getFailed(), validText, includeChecksum); }
[ "public", "static", "String", "fixFailedContentSpec", "(", "final", "ContentSpecWrapper", "contentSpec", ",", "final", "String", "validText", ",", "final", "boolean", "includeChecksum", ")", "{", "return", "fixFailedContentSpec", "(", "contentSpec", ".", "getId", "(",...
Fixes a failed Content Spec so that the ID and CHECKSUM are included. This is primarily an issue when creating new content specs and they are initially invalid. @param contentSpec The content spec to fix. @param validText The content specs latest valid text. @param includeChecksum If the checksum should be included in the output. @return The fixed failed content spec string.
[ "Fixes", "a", "failed", "Content", "Spec", "so", "that", "the", "ID", "and", "CHECKSUM", "are", "included", ".", "This", "is", "primarily", "an", "issue", "when", "creating", "new", "content", "specs", "and", "they", "are", "initially", "invalid", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/ContentSpecUtilities.java#L169-L171
aws/aws-sdk-java
aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/EndpointUser.java
EndpointUser.withUserAttributes
public EndpointUser withUserAttributes(java.util.Map<String, java.util.List<String>> userAttributes) { setUserAttributes(userAttributes); return this; }
java
public EndpointUser withUserAttributes(java.util.Map<String, java.util.List<String>> userAttributes) { setUserAttributes(userAttributes); return this; }
[ "public", "EndpointUser", "withUserAttributes", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "java", ".", "util", ".", "List", "<", "String", ">", ">", "userAttributes", ")", "{", "setUserAttributes", "(", "userAttributes", ")", ";", "return", ...
Custom attributes that describe the user by associating a name with an array of values. For example, an attribute named "interests" might have the following values: ["science", "politics", "travel"]. You can use these attributes as selection criteria when you create segments. The Amazon Pinpoint console can't display attribute names that include the following characters: hash/pound sign (#), colon (:), question mark (?), backslash (\), and forward slash (/). For this reason, you should avoid using these characters in the names of custom attributes. @param userAttributes Custom attributes that describe the user by associating a name with an array of values. For example, an attribute named "interests" might have the following values: ["science", "politics", "travel"]. You can use these attributes as selection criteria when you create segments. The Amazon Pinpoint console can't display attribute names that include the following characters: hash/pound sign (#), colon (:), question mark (?), backslash (\), and forward slash (/). For this reason, you should avoid using these characters in the names of custom attributes. @return Returns a reference to this object so that method calls can be chained together.
[ "Custom", "attributes", "that", "describe", "the", "user", "by", "associating", "a", "name", "with", "an", "array", "of", "values", ".", "For", "example", "an", "attribute", "named", "interests", "might", "have", "the", "following", "values", ":", "[", "scie...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/EndpointUser.java#L107-L110
wildfly/wildfly-core
host-controller/src/main/java/org/jboss/as/host/controller/mgmt/DomainHostExcludeRegistry.java
DomainHostExcludeRegistry.getVersionIgnoreData
VersionExcludeData getVersionIgnoreData(int major, int minor, int micro) { VersionExcludeData result = registry.get(new VersionKey(major, minor, micro)); if (result == null) { result = registry.get(new VersionKey(major, minor, null)); } return result; }
java
VersionExcludeData getVersionIgnoreData(int major, int minor, int micro) { VersionExcludeData result = registry.get(new VersionKey(major, minor, micro)); if (result == null) { result = registry.get(new VersionKey(major, minor, null)); } return result; }
[ "VersionExcludeData", "getVersionIgnoreData", "(", "int", "major", ",", "int", "minor", ",", "int", "micro", ")", "{", "VersionExcludeData", "result", "=", "registry", ".", "get", "(", "new", "VersionKey", "(", "major", ",", "minor", ",", "micro", ")", ")", ...
Gets the host-ignore data for a slave host running the given version. @param major the kernel management API major version @param minor the kernel management API minor version @param micro the kernel management API micro version @return the host-ignore data, or {@code null} if there is no matching registration
[ "Gets", "the", "host", "-", "ignore", "data", "for", "a", "slave", "host", "running", "the", "given", "version", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/mgmt/DomainHostExcludeRegistry.java#L144-L150
sniffy/sniffy
sniffy-core/src/main/java/io/sniffy/socket/SnifferSocketImplFactory.java
SnifferSocketImplFactory.uninstall
public static void uninstall() throws IOException { try { Field factoryField = Socket.class.getDeclaredField("factory"); factoryField.setAccessible(true); factoryField.set(null, previousSocketImplFactory); } catch (IllegalAccessException e) { throw new IOException("Failed to initialize SnifferSocketImplFactory", e); } catch (NoSuchFieldException e) { throw new IOException("Failed to initialize SnifferSocketImplFactory", e); } }
java
public static void uninstall() throws IOException { try { Field factoryField = Socket.class.getDeclaredField("factory"); factoryField.setAccessible(true); factoryField.set(null, previousSocketImplFactory); } catch (IllegalAccessException e) { throw new IOException("Failed to initialize SnifferSocketImplFactory", e); } catch (NoSuchFieldException e) { throw new IOException("Failed to initialize SnifferSocketImplFactory", e); } }
[ "public", "static", "void", "uninstall", "(", ")", "throws", "IOException", "{", "try", "{", "Field", "factoryField", "=", "Socket", ".", "class", ".", "getDeclaredField", "(", "\"factory\"", ")", ";", "factoryField", ".", "setAccessible", "(", "true", ")", ...
Restores previously saved {@link SocketImplFactory} and sets it as a default @see #install() @throws IOException if failed to install {@link SnifferSocketImplFactory} @since 3.1
[ "Restores", "previously", "saved", "{" ]
train
https://github.com/sniffy/sniffy/blob/7bdddb9593e6b6e9fe5c7c87519f864acbc3a5c0/sniffy-core/src/main/java/io/sniffy/socket/SnifferSocketImplFactory.java#L53-L63
googleapis/google-cloud-java
google-cloud-clients/google-cloud-container/src/main/java/com/google/cloud/container/v1/ClusterManagerClient.java
ClusterManagerClient.getOperation
public final Operation getOperation(String projectId, String zone, String operationId) { GetOperationRequest request = GetOperationRequest.newBuilder() .setProjectId(projectId) .setZone(zone) .setOperationId(operationId) .build(); return getOperation(request); }
java
public final Operation getOperation(String projectId, String zone, String operationId) { GetOperationRequest request = GetOperationRequest.newBuilder() .setProjectId(projectId) .setZone(zone) .setOperationId(operationId) .build(); return getOperation(request); }
[ "public", "final", "Operation", "getOperation", "(", "String", "projectId", ",", "String", "zone", ",", "String", "operationId", ")", "{", "GetOperationRequest", "request", "=", "GetOperationRequest", ".", "newBuilder", "(", ")", ".", "setProjectId", "(", "project...
Gets the specified operation. <p>Sample code: <pre><code> try (ClusterManagerClient clusterManagerClient = ClusterManagerClient.create()) { String projectId = ""; String zone = ""; String operationId = ""; Operation response = clusterManagerClient.getOperation(projectId, zone, operationId); } </code></pre> @param projectId Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). This field has been deprecated and replaced by the name field. @param zone Deprecated. The name of the Google Compute Engine [zone](/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field. @param operationId Deprecated. The server-assigned `name` of the operation. This field has been deprecated and replaced by the name field. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Gets", "the", "specified", "operation", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-container/src/main/java/com/google/cloud/container/v1/ClusterManagerClient.java#L1478-L1487
datoin/http-requests
src/main/java/org/datoin/net/http/Request.java
Request.setContent
public Request setContent(InputStream stream, ContentType contentType) { entity = new InputStreamEntity(stream, contentType); return this; }
java
public Request setContent(InputStream stream, ContentType contentType) { entity = new InputStreamEntity(stream, contentType); return this; }
[ "public", "Request", "setContent", "(", "InputStream", "stream", ",", "ContentType", "contentType", ")", "{", "entity", "=", "new", "InputStreamEntity", "(", "stream", ",", "contentType", ")", ";", "return", "this", ";", "}" ]
set request content from input stream with given content type @param stream : teh input stream to be used as http content @param contentType : type of content set in header @return modified Request object with http content entity set
[ "set", "request", "content", "from", "input", "stream", "with", "given", "content", "type" ]
train
https://github.com/datoin/http-requests/blob/660a4bc516c594f321019df94451fead4dea19b6/src/main/java/org/datoin/net/http/Request.java#L411-L414
spring-cloud/spring-cloud-stream-app-starters
processor/spring-cloud-starter-stream-processor-tasklaunchrequest-transform/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/transform/processor/TasklaunchrequestTransformProcessorConfiguration.java
TasklaunchrequestTransformProcessorConfiguration.addKeyValuePairAsProperty
private void addKeyValuePairAsProperty(String pair, Map<String, String> properties) { int firstEquals = pair.indexOf('='); if (firstEquals != -1) { properties.put(pair.substring(0, firstEquals).trim(), pair.substring(firstEquals + 1).trim()); } }
java
private void addKeyValuePairAsProperty(String pair, Map<String, String> properties) { int firstEquals = pair.indexOf('='); if (firstEquals != -1) { properties.put(pair.substring(0, firstEquals).trim(), pair.substring(firstEquals + 1).trim()); } }
[ "private", "void", "addKeyValuePairAsProperty", "(", "String", "pair", ",", "Map", "<", "String", ",", "String", ">", "properties", ")", "{", "int", "firstEquals", "=", "pair", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "firstEquals", "!=", "-",...
Adds a String of format key=value to the provided Map as a key/value pair. @param pair the String representation @param properties the Map to which the key/value pair should be added
[ "Adds", "a", "String", "of", "format", "key", "=", "value", "to", "the", "provided", "Map", "as", "a", "key", "/", "value", "pair", "." ]
train
https://github.com/spring-cloud/spring-cloud-stream-app-starters/blob/c82827a9b5a6eab78fe6a2d56a946b5f9fb0ead9/processor/spring-cloud-starter-stream-processor-tasklaunchrequest-transform/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/transform/processor/TasklaunchrequestTransformProcessorConfiguration.java#L121-L126
Alluxio/alluxio
core/server/master/src/main/java/alluxio/master/file/activesync/ActiveSyncManager.java
ActiveSyncManager.getSyncPathList
public List<SyncPointInfo> getSyncPathList() { List<SyncPointInfo> returnList = new ArrayList<>(); for (AlluxioURI uri: mSyncPathList) { SyncPointInfo.SyncStatus status; Future<?> syncStatus = mSyncPathStatus.get(uri); if (syncStatus == null) { status = SyncPointInfo.SyncStatus.NOT_INITIALLY_SYNCED; } else if (syncStatus.isDone()) { status = SyncPointInfo.SyncStatus.INITIALLY_SYNCED; } else { status = SyncPointInfo.SyncStatus.SYNCING; } returnList.add(new SyncPointInfo(uri, status)); } return returnList; }
java
public List<SyncPointInfo> getSyncPathList() { List<SyncPointInfo> returnList = new ArrayList<>(); for (AlluxioURI uri: mSyncPathList) { SyncPointInfo.SyncStatus status; Future<?> syncStatus = mSyncPathStatus.get(uri); if (syncStatus == null) { status = SyncPointInfo.SyncStatus.NOT_INITIALLY_SYNCED; } else if (syncStatus.isDone()) { status = SyncPointInfo.SyncStatus.INITIALLY_SYNCED; } else { status = SyncPointInfo.SyncStatus.SYNCING; } returnList.add(new SyncPointInfo(uri, status)); } return returnList; }
[ "public", "List", "<", "SyncPointInfo", ">", "getSyncPathList", "(", ")", "{", "List", "<", "SyncPointInfo", ">", "returnList", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "AlluxioURI", "uri", ":", "mSyncPathList", ")", "{", "SyncPointInfo", ...
Get the sync point list. @return a list of URIs (sync points)
[ "Get", "the", "sync", "point", "list", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/activesync/ActiveSyncManager.java#L338-L353
bullhorn/sdk-rest
src/main/java/com/bullhornsdk/data/api/StandardBullhornData.java
StandardBullhornData.handleDeleteEntity
protected <C extends CrudResponse, T extends DeleteEntity> C handleDeleteEntity(Class<T> type, Integer id) { Map<String, String> uriVariables = restUriVariablesFactory.getUriVariablesForEntityDelete( BullhornEntityInfo.getTypesRestEntityName(type), id); String url = restUrlFactory.assembleEntityDeleteUrl(); CrudResponse response = null; try { if (isSoftDeleteEntity(type)) { String jsonString = "{\"isDeleted\" : true}"; response = this.performPostRequest(url, jsonString, DeleteResponse.class, uriVariables); } if (isHardDeleteEntity(type)) { response = this.performCustomRequest(url, null, DeleteResponse.class, uriVariables, HttpMethod.DELETE, null); } } catch (HttpStatusCodeException error) { response = restErrorHandler.handleHttpFourAndFiveHundredErrors(new DeleteResponse(), error, id); } return (C) response; }
java
protected <C extends CrudResponse, T extends DeleteEntity> C handleDeleteEntity(Class<T> type, Integer id) { Map<String, String> uriVariables = restUriVariablesFactory.getUriVariablesForEntityDelete( BullhornEntityInfo.getTypesRestEntityName(type), id); String url = restUrlFactory.assembleEntityDeleteUrl(); CrudResponse response = null; try { if (isSoftDeleteEntity(type)) { String jsonString = "{\"isDeleted\" : true}"; response = this.performPostRequest(url, jsonString, DeleteResponse.class, uriVariables); } if (isHardDeleteEntity(type)) { response = this.performCustomRequest(url, null, DeleteResponse.class, uriVariables, HttpMethod.DELETE, null); } } catch (HttpStatusCodeException error) { response = restErrorHandler.handleHttpFourAndFiveHundredErrors(new DeleteResponse(), error, id); } return (C) response; }
[ "protected", "<", "C", "extends", "CrudResponse", ",", "T", "extends", "DeleteEntity", ">", "C", "handleDeleteEntity", "(", "Class", "<", "T", ">", "type", ",", "Integer", "id", ")", "{", "Map", "<", "String", ",", "String", ">", "uriVariables", "=", "re...
Makes the delete api call. The type of delete (soft or hard) depends on the DeleteEntity type of the Class<T> type passed in. @param type @param id @return
[ "Makes", "the", "delete", "api", "call", ".", "The", "type", "of", "delete", "(", "soft", "or", "hard", ")", "depends", "on", "the", "DeleteEntity", "type", "of", "the", "Class<T", ">", "type", "passed", "in", "." ]
train
https://github.com/bullhorn/sdk-rest/blob/0c75a141c768bb31510afc3a412c11bd101eca06/src/main/java/com/bullhornsdk/data/api/StandardBullhornData.java#L1192-L1215
liferay/com-liferay-commerce
commerce-product-type-virtual-order-service/src/main/java/com/liferay/commerce/product/type/virtual/order/service/persistence/impl/CommerceVirtualOrderItemPersistenceImpl.java
CommerceVirtualOrderItemPersistenceImpl.findAll
@Override public List<CommerceVirtualOrderItem> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
java
@Override public List<CommerceVirtualOrderItem> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
[ "@", "Override", "public", "List", "<", "CommerceVirtualOrderItem", ">", "findAll", "(", ")", "{", "return", "findAll", "(", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ";", "}" ]
Returns all the commerce virtual order items. @return the commerce virtual order items
[ "Returns", "all", "the", "commerce", "virtual", "order", "items", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-type-virtual-order-service/src/main/java/com/liferay/commerce/product/type/virtual/order/service/persistence/impl/CommerceVirtualOrderItemPersistenceImpl.java#L2353-L2356
treasure-data/td-client-java
src/main/java/com/treasuredata/client/TDHttpClient.java
TDHttpClient.withHeaders
public TDHttpClient withHeaders(Multimap<String, String> headers) { Multimap<String, String> mergedHeaders = ImmutableMultimap.<String, String>builder() .putAll(this.headers) .putAll(headers) .build(); return new TDHttpClient(config, httpClient, objectMapper, mergedHeaders); }
java
public TDHttpClient withHeaders(Multimap<String, String> headers) { Multimap<String, String> mergedHeaders = ImmutableMultimap.<String, String>builder() .putAll(this.headers) .putAll(headers) .build(); return new TDHttpClient(config, httpClient, objectMapper, mergedHeaders); }
[ "public", "TDHttpClient", "withHeaders", "(", "Multimap", "<", "String", ",", "String", ">", "headers", ")", "{", "Multimap", "<", "String", ",", "String", ">", "mergedHeaders", "=", "ImmutableMultimap", ".", "<", "String", ",", "String", ">", "builder", "("...
Get a {@link TDHttpClient} that uses the specified headers for each request. Reuses the same underlying http client so closing the returned instance will return this instance as well. @param headers @return
[ "Get", "a", "{", "@link", "TDHttpClient", "}", "that", "uses", "the", "specified", "headers", "for", "each", "request", ".", "Reuses", "the", "same", "underlying", "http", "client", "so", "closing", "the", "returned", "instance", "will", "return", "this", "i...
train
https://github.com/treasure-data/td-client-java/blob/2769cbcf0e787d457344422cfcdde467399bd684/src/main/java/com/treasuredata/client/TDHttpClient.java#L152-L159
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java
SerializedFormBuilder.buildPackageSerializedForm
public void buildPackageSerializedForm(XMLNode node, Content serializedSummariesTree) { Content packageSerializedTree = writer.getPackageSerializedHeader(); String foo = currentPackage.name(); ClassDoc[] classes = currentPackage.allClasses(false); if (classes == null || classes.length == 0) { return; } if (!serialInclude(currentPackage)) { return; } if (!serialClassFoundToDocument(classes)) { return; } buildChildren(node, packageSerializedTree); serializedSummariesTree.addContent(packageSerializedTree); }
java
public void buildPackageSerializedForm(XMLNode node, Content serializedSummariesTree) { Content packageSerializedTree = writer.getPackageSerializedHeader(); String foo = currentPackage.name(); ClassDoc[] classes = currentPackage.allClasses(false); if (classes == null || classes.length == 0) { return; } if (!serialInclude(currentPackage)) { return; } if (!serialClassFoundToDocument(classes)) { return; } buildChildren(node, packageSerializedTree); serializedSummariesTree.addContent(packageSerializedTree); }
[ "public", "void", "buildPackageSerializedForm", "(", "XMLNode", "node", ",", "Content", "serializedSummariesTree", ")", "{", "Content", "packageSerializedTree", "=", "writer", ".", "getPackageSerializedHeader", "(", ")", ";", "String", "foo", "=", "currentPackage", "....
Build the package serialized form for the current package being processed. @param node the XML element that specifies which components to document @param serializedSummariesTree content tree to which the documentation will be added
[ "Build", "the", "package", "serialized", "form", "for", "the", "current", "package", "being", "processed", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java#L180-L195
facebookarchive/hadoop-20
src/core/org/apache/hadoop/net/NetworkTopology.java
NetworkTopology.isOnSameRack
public boolean isOnSameRack( Node node1, Node node2) { if (node1 == null || node2 == null) { return false; } netlock.readLock().lock(); try { return node1.getParent()==node2.getParent(); } finally { netlock.readLock().unlock(); } }
java
public boolean isOnSameRack( Node node1, Node node2) { if (node1 == null || node2 == null) { return false; } netlock.readLock().lock(); try { return node1.getParent()==node2.getParent(); } finally { netlock.readLock().unlock(); } }
[ "public", "boolean", "isOnSameRack", "(", "Node", "node1", ",", "Node", "node2", ")", "{", "if", "(", "node1", "==", "null", "||", "node2", "==", "null", ")", "{", "return", "false", ";", "}", "netlock", ".", "readLock", "(", ")", ".", "lock", "(", ...
Check if two nodes are on the same rack @param node1 one node @param node2 another node @return true if node1 and node2 are pm the same rack; false otherwise @exception IllegalArgumentException when either node1 or node2 is null, or node1 or node2 do not belong to the cluster
[ "Check", "if", "two", "nodes", "are", "on", "the", "same", "rack" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/net/NetworkTopology.java#L551-L562
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapComposedElement.java
MapComposedElement.setPointAt
public final boolean setPointAt(int groupIndex, int indexInGroup, Point2D<?, ?> point, boolean canonize) { return setPointAt(groupIndex, indexInGroup, point.getX(), point.getY(), canonize); }
java
public final boolean setPointAt(int groupIndex, int indexInGroup, Point2D<?, ?> point, boolean canonize) { return setPointAt(groupIndex, indexInGroup, point.getX(), point.getY(), canonize); }
[ "public", "final", "boolean", "setPointAt", "(", "int", "groupIndex", ",", "int", "indexInGroup", ",", "Point2D", "<", "?", ",", "?", ">", "point", ",", "boolean", "canonize", ")", "{", "return", "setPointAt", "(", "groupIndex", ",", "indexInGroup", ",", "...
Set the specified point at the given index in the specified group. @param groupIndex is the index of the group @param indexInGroup is the index of the ponit in the group (0 for the first point of the group...). @param point is the new value. @param canonize indicates if the function {@link #canonize(int)} must be called. @return <code>true</code> if the point was set, <code>false</code> if the specified coordinates correspond to the already existing point. @throws IndexOutOfBoundsException in case of error.
[ "Set", "the", "specified", "point", "at", "the", "given", "index", "in", "the", "specified", "group", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapComposedElement.java#L1081-L1083
vatbub/common
updater/src/main/java/com/github/vatbub/common/updater/UpdateChecker.java
UpdateChecker.downloadAndInstallUpdate
public static boolean downloadAndInstallUpdate(UpdateInfo updateToInstall, UpdateProgressDialog gui, String... params) throws IllegalStateException, IOException { return downloadAndInstallUpdate(updateToInstall, gui, true, params); }
java
public static boolean downloadAndInstallUpdate(UpdateInfo updateToInstall, UpdateProgressDialog gui, String... params) throws IllegalStateException, IOException { return downloadAndInstallUpdate(updateToInstall, gui, true, params); }
[ "public", "static", "boolean", "downloadAndInstallUpdate", "(", "UpdateInfo", "updateToInstall", ",", "UpdateProgressDialog", "gui", ",", "String", "...", "params", ")", "throws", "IllegalStateException", ",", "IOException", "{", "return", "downloadAndInstallUpdate", "(",...
Downloads the specified update as a jar-file and launches it. The jar file will be saved at the same location as the currently executed file but will not replace it (unless it has the same filename but this will never happen). The old app file will be deleted once the updated one is launched. <b>Please note</b> that the file can't delete itself on some operating systems. Therefore, the deletion is done by the updated file. To actually delete the file, you need to call {@link #completeUpdate(String[])} in your applications main method. @param updateToInstall The {@link UpdateInfo}-object that contains the information about the update to download @param gui The reference to an {@link UpdateProgressDialog} that displays the current update status. @param params Additional commandline parameters to be submitted to the new application version. @return {@code true} if the download finished successfully, {@code false} if the download was cancelled using {@link #cancelDownloadAndLaunch()} @throws IllegalStateException if maven fails to download or copy the new artifact. @throws IOException If the updated artifact cannot be launched. @see #completeUpdate(String[])
[ "Downloads", "the", "specified", "update", "as", "a", "jar", "-", "file", "and", "launches", "it", ".", "The", "jar", "file", "will", "be", "saved", "at", "the", "same", "location", "as", "the", "currently", "executed", "file", "but", "will", "not", "rep...
train
https://github.com/vatbub/common/blob/8b9fd2ece0a23d520ce53b66c84cbd094e378443/updater/src/main/java/com/github/vatbub/common/updater/UpdateChecker.java#L423-L426
oasp/oasp4j
modules/rest/src/main/java/io/oasp/module/rest/service/impl/RestServiceExceptionFacade.java
RestServiceExceptionFacade.createResponse
protected Response createResponse(Status status, NlsRuntimeException error, String message, Map<String, List<String>> errorsMap) { return createResponse(status, error, message, error.getCode(), errorsMap); }
java
protected Response createResponse(Status status, NlsRuntimeException error, String message, Map<String, List<String>> errorsMap) { return createResponse(status, error, message, error.getCode(), errorsMap); }
[ "protected", "Response", "createResponse", "(", "Status", "status", ",", "NlsRuntimeException", "error", ",", "String", "message", ",", "Map", "<", "String", ",", "List", "<", "String", ">", ">", "errorsMap", ")", "{", "return", "createResponse", "(", "status"...
Create a response message as a JSON-String from the given parts. @param status is the HTTP {@link Status}. @param error is the catched or wrapped {@link NlsRuntimeException}. @param message is the JSON message attribute. @param errorsMap is a map with all validation errors @return the corresponding {@link Response}.
[ "Create", "a", "response", "message", "as", "a", "JSON", "-", "String", "from", "the", "given", "parts", "." ]
train
https://github.com/oasp/oasp4j/blob/03f90132699fad95e52ec8efa54aa391f8d3c7e4/modules/rest/src/main/java/io/oasp/module/rest/service/impl/RestServiceExceptionFacade.java#L426-L430
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java
GeometryUtilities.getTriangleWindingRule
public static int getTriangleWindingRule( Coordinate A, Coordinate B, Coordinate C ) { double[] rBA = {B.x - A.x, B.y - A.y, B.z - A.z}; double[] rCA = {C.x - A.x, C.y - A.y, C.z - A.z}; double[] crossProduct = {// /* */rBA[1] * rCA[2] - rBA[2] * rCA[1], // -1 * (rBA[0] * rCA[2] - rBA[2] * rCA[0]), // rBA[0] * rCA[1] - rBA[1] * rCA[0] // }; return crossProduct[2] > 0 ? 1 : -1; }
java
public static int getTriangleWindingRule( Coordinate A, Coordinate B, Coordinate C ) { double[] rBA = {B.x - A.x, B.y - A.y, B.z - A.z}; double[] rCA = {C.x - A.x, C.y - A.y, C.z - A.z}; double[] crossProduct = {// /* */rBA[1] * rCA[2] - rBA[2] * rCA[1], // -1 * (rBA[0] * rCA[2] - rBA[2] * rCA[0]), // rBA[0] * rCA[1] - rBA[1] * rCA[0] // }; return crossProduct[2] > 0 ? 1 : -1; }
[ "public", "static", "int", "getTriangleWindingRule", "(", "Coordinate", "A", ",", "Coordinate", "B", ",", "Coordinate", "C", ")", "{", "double", "[", "]", "rBA", "=", "{", "B", ".", "x", "-", "A", ".", "x", ",", "B", ".", "y", "-", "A", ".", "y",...
Get the winding rule of a triangle by their coordinates (given in digitized order). @param A coordinate 1. @param B coordinate 2. @param C coordinate 3. @return -1 if the digitalization is clock wise, else 1.
[ "Get", "the", "winding", "rule", "of", "a", "triangle", "by", "their", "coordinates", "(", "given", "in", "digitized", "order", ")", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java#L870-L881
cdk/cdk
legacy/src/main/java/org/openscience/cdk/geometry/GeometryTools.java
GeometryTools.getClosestBond
public static IBond getClosestBond(double xPosition, double yPosition, IAtomContainer atomCon) { Point2d bondCenter; IBond closestBond = null; double smallestMouseDistance = -1; double mouseDistance; Iterator<IBond> bonds = atomCon.bonds().iterator(); while (bonds.hasNext()) { IBond currentBond = (IBond) bonds.next(); bondCenter = get2DCenter(currentBond.atoms()); mouseDistance = Math.sqrt(Math.pow(bondCenter.x - xPosition, 2) + Math.pow(bondCenter.y - yPosition, 2)); if (mouseDistance < smallestMouseDistance || smallestMouseDistance == -1) { smallestMouseDistance = mouseDistance; closestBond = currentBond; } } return closestBond; }
java
public static IBond getClosestBond(double xPosition, double yPosition, IAtomContainer atomCon) { Point2d bondCenter; IBond closestBond = null; double smallestMouseDistance = -1; double mouseDistance; Iterator<IBond> bonds = atomCon.bonds().iterator(); while (bonds.hasNext()) { IBond currentBond = (IBond) bonds.next(); bondCenter = get2DCenter(currentBond.atoms()); mouseDistance = Math.sqrt(Math.pow(bondCenter.x - xPosition, 2) + Math.pow(bondCenter.y - yPosition, 2)); if (mouseDistance < smallestMouseDistance || smallestMouseDistance == -1) { smallestMouseDistance = mouseDistance; closestBond = currentBond; } } return closestBond; }
[ "public", "static", "IBond", "getClosestBond", "(", "double", "xPosition", ",", "double", "yPosition", ",", "IAtomContainer", "atomCon", ")", "{", "Point2d", "bondCenter", ";", "IBond", "closestBond", "=", "null", ";", "double", "smallestMouseDistance", "=", "-", ...
Returns the bond of the given molecule that is closest to the given coordinates. See comment for center(IAtomContainer atomCon, Dimension areaDim, HashMap renderingCoordinates) for details on coordinate sets @param xPosition The x coordinate @param yPosition The y coordinate @param atomCon The molecule that is searched for the closest bond @return The bond that is closest to the given coordinates
[ "Returns", "the", "bond", "of", "the", "given", "molecule", "that", "is", "closest", "to", "the", "given", "coordinates", ".", "See", "comment", "for", "center", "(", "IAtomContainer", "atomCon", "Dimension", "areaDim", "HashMap", "renderingCoordinates", ")", "f...
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/geometry/GeometryTools.java#L828-L845
grpc/grpc-java
core/src/main/java/io/grpc/util/RoundRobinLoadBalancer.java
RoundRobinLoadBalancer.updateBalancingState
@SuppressWarnings("ReferenceEquality") private void updateBalancingState() { List<Subchannel> activeList = filterNonFailingSubchannels(getSubchannels()); if (activeList.isEmpty()) { // No READY subchannels, determine aggregate state and error status boolean isConnecting = false; Status aggStatus = EMPTY_OK; for (Subchannel subchannel : getSubchannels()) { ConnectivityStateInfo stateInfo = getSubchannelStateInfoRef(subchannel).value; // This subchannel IDLE is not because of channel IDLE_TIMEOUT, // in which case LB is already shutdown. // RRLB will request connection immediately on subchannel IDLE. if (stateInfo.getState() == CONNECTING || stateInfo.getState() == IDLE) { isConnecting = true; } if (aggStatus == EMPTY_OK || !aggStatus.isOk()) { aggStatus = stateInfo.getStatus(); } } updateBalancingState(isConnecting ? CONNECTING : TRANSIENT_FAILURE, // If all subchannels are TRANSIENT_FAILURE, return the Status associated with // an arbitrary subchannel, otherwise return OK. new EmptyPicker(aggStatus)); } else { // initialize the Picker to a random start index to ensure that a high frequency of Picker // churn does not skew subchannel selection. int startIndex = random.nextInt(activeList.size()); updateBalancingState(READY, new ReadyPicker(activeList, startIndex, stickinessState)); } }
java
@SuppressWarnings("ReferenceEquality") private void updateBalancingState() { List<Subchannel> activeList = filterNonFailingSubchannels(getSubchannels()); if (activeList.isEmpty()) { // No READY subchannels, determine aggregate state and error status boolean isConnecting = false; Status aggStatus = EMPTY_OK; for (Subchannel subchannel : getSubchannels()) { ConnectivityStateInfo stateInfo = getSubchannelStateInfoRef(subchannel).value; // This subchannel IDLE is not because of channel IDLE_TIMEOUT, // in which case LB is already shutdown. // RRLB will request connection immediately on subchannel IDLE. if (stateInfo.getState() == CONNECTING || stateInfo.getState() == IDLE) { isConnecting = true; } if (aggStatus == EMPTY_OK || !aggStatus.isOk()) { aggStatus = stateInfo.getStatus(); } } updateBalancingState(isConnecting ? CONNECTING : TRANSIENT_FAILURE, // If all subchannels are TRANSIENT_FAILURE, return the Status associated with // an arbitrary subchannel, otherwise return OK. new EmptyPicker(aggStatus)); } else { // initialize the Picker to a random start index to ensure that a high frequency of Picker // churn does not skew subchannel selection. int startIndex = random.nextInt(activeList.size()); updateBalancingState(READY, new ReadyPicker(activeList, startIndex, stickinessState)); } }
[ "@", "SuppressWarnings", "(", "\"ReferenceEquality\"", ")", "private", "void", "updateBalancingState", "(", ")", "{", "List", "<", "Subchannel", ">", "activeList", "=", "filterNonFailingSubchannels", "(", "getSubchannels", "(", ")", ")", ";", "if", "(", "activeLis...
Updates picker with the list of active subchannels (state == READY).
[ "Updates", "picker", "with", "the", "list", "of", "active", "subchannels", "(", "state", "==", "READY", ")", "." ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/util/RoundRobinLoadBalancer.java#L201-L230
mgm-tp/jfunk
jfunk-common/src/main/java/com/mgmtp/jfunk/common/random/MathRandom.java
MathRandom.getDouble
public double getDouble(final double min, final double max) { return min(min, max) + getDouble(abs(max - min)); }
java
public double getDouble(final double min, final double max) { return min(min, max) + getDouble(abs(max - min)); }
[ "public", "double", "getDouble", "(", "final", "double", "min", ",", "final", "double", "max", ")", "{", "return", "min", "(", "min", ",", "max", ")", "+", "getDouble", "(", "abs", "(", "max", "-", "min", ")", ")", ";", "}" ]
Returns a random decimal number in the range of [min, max]. @param min minimum value for generated number @param max maximum value for generated number
[ "Returns", "a", "random", "decimal", "number", "in", "the", "range", "of", "[", "min", "max", "]", "." ]
train
https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-common/src/main/java/com/mgmtp/jfunk/common/random/MathRandom.java#L115-L117
xdcrafts/flower
flower-tools/src/main/java/com/github/xdcrafts/flower/tools/ClassApi.java
ClassApi.findMethod
public static Method findMethod(Class clazz, String methodName) { final List<Method> methods = getDeclaredMethodsRecursively(clazz).get(methodName); if (methods.isEmpty()) { throw new IllegalArgumentException(clazz.getName() + "::" + methodName + " not found"); } final List<Method> specificMethods; if (methods.size() > 1) { specificMethods = methods.stream().filter(m -> m.getReturnType() != Object.class).collect(Collectors.toList()); } else { specificMethods = methods; } if (specificMethods.size() != 1) { throw new IllegalArgumentException( clazz.getName() + "::" + methodName + " more then one method found, can not decide which one to use. " + methods ); } return specificMethods.get(0); }
java
public static Method findMethod(Class clazz, String methodName) { final List<Method> methods = getDeclaredMethodsRecursively(clazz).get(methodName); if (methods.isEmpty()) { throw new IllegalArgumentException(clazz.getName() + "::" + methodName + " not found"); } final List<Method> specificMethods; if (methods.size() > 1) { specificMethods = methods.stream().filter(m -> m.getReturnType() != Object.class).collect(Collectors.toList()); } else { specificMethods = methods; } if (specificMethods.size() != 1) { throw new IllegalArgumentException( clazz.getName() + "::" + methodName + " more then one method found, can not decide which one to use. " + methods ); } return specificMethods.get(0); }
[ "public", "static", "Method", "findMethod", "(", "Class", "clazz", ",", "String", "methodName", ")", "{", "final", "List", "<", "Method", ">", "methods", "=", "getDeclaredMethodsRecursively", "(", "clazz", ")", ".", "get", "(", "methodName", ")", ";", "if", ...
Finds method with name, throws exception if no method found or there are many of them.
[ "Finds", "method", "with", "name", "throws", "exception", "if", "no", "method", "found", "or", "there", "are", "many", "of", "them", "." ]
train
https://github.com/xdcrafts/flower/blob/96a8e49102fea434bd383a3c7852f0ee9545f999/flower-tools/src/main/java/com/github/xdcrafts/flower/tools/ClassApi.java#L135-L155
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/tracker/tld/TldAdjustRegion.java
TldAdjustRegion.process
public boolean process( FastQueue<AssociatedPair> pairs , Rectangle2D_F64 targetRectangle ) { // estimate how the rectangle has changed and update it if( !estimateMotion.process(pairs.toList()) ) return false; ScaleTranslate2D motion = estimateMotion.getModelParameters(); adjustRectangle(targetRectangle,motion); if( targetRectangle.p0.x < 0 || targetRectangle.p0.y < 0 ) return false; if( targetRectangle.p1.x >= imageWidth || targetRectangle.p1.y >= imageHeight ) return false; return true; }
java
public boolean process( FastQueue<AssociatedPair> pairs , Rectangle2D_F64 targetRectangle ) { // estimate how the rectangle has changed and update it if( !estimateMotion.process(pairs.toList()) ) return false; ScaleTranslate2D motion = estimateMotion.getModelParameters(); adjustRectangle(targetRectangle,motion); if( targetRectangle.p0.x < 0 || targetRectangle.p0.y < 0 ) return false; if( targetRectangle.p1.x >= imageWidth || targetRectangle.p1.y >= imageHeight ) return false; return true; }
[ "public", "boolean", "process", "(", "FastQueue", "<", "AssociatedPair", ">", "pairs", ",", "Rectangle2D_F64", "targetRectangle", ")", "{", "// estimate how the rectangle has changed and update it", "if", "(", "!", "estimateMotion", ".", "process", "(", "pairs", ".", ...
Adjusts target rectangle using track information @param pairs List of feature location in previous and current frame. @param targetRectangle (Input) current location of rectangle. (output) adjusted location @return true if successful
[ "Adjusts", "target", "rectangle", "using", "track", "information" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/tracker/tld/TldAdjustRegion.java#L72-L88
square/protoparser
src/main/java/com/squareup/protoparser/OptionElement.java
OptionElement.findByName
public static OptionElement findByName(List<OptionElement> options, String name) { checkNotNull(options, "options"); checkNotNull(name, "name"); OptionElement found = null; for (OptionElement option : options) { if (option.name().equals(name)) { if (found != null) { throw new IllegalStateException("Multiple options match name: " + name); } found = option; } } return found; }
java
public static OptionElement findByName(List<OptionElement> options, String name) { checkNotNull(options, "options"); checkNotNull(name, "name"); OptionElement found = null; for (OptionElement option : options) { if (option.name().equals(name)) { if (found != null) { throw new IllegalStateException("Multiple options match name: " + name); } found = option; } } return found; }
[ "public", "static", "OptionElement", "findByName", "(", "List", "<", "OptionElement", ">", "options", ",", "String", "name", ")", "{", "checkNotNull", "(", "options", ",", "\"options\"", ")", ";", "checkNotNull", "(", "name", ",", "\"name\"", ")", ";", "Opti...
Return the option with the specified name from the supplied list or null.
[ "Return", "the", "option", "with", "the", "specified", "name", "from", "the", "supplied", "list", "or", "null", "." ]
train
https://github.com/square/protoparser/blob/8be66bb8fe6658b04741df0358daabca501f2524/src/main/java/com/squareup/protoparser/OptionElement.java#L64-L78
tvesalainen/util
ham/src/main/java/org/vesalainen/ham/Station.java
Station.inMap
public boolean inMap(String name, Location location) { MapArea map = maps.get(name); if (map == null) { throw new IllegalArgumentException(name); } return map.isInside(location); }
java
public boolean inMap(String name, Location location) { MapArea map = maps.get(name); if (map == null) { throw new IllegalArgumentException(name); } return map.isInside(location); }
[ "public", "boolean", "inMap", "(", "String", "name", ",", "Location", "location", ")", "{", "MapArea", "map", "=", "maps", ".", "get", "(", "name", ")", ";", "if", "(", "map", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "na...
Returns true if location is inside named map. @param name @param location @return
[ "Returns", "true", "if", "location", "is", "inside", "named", "map", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/ham/src/main/java/org/vesalainen/ham/Station.java#L57-L65
aws/aws-sdk-java
aws-java-sdk-core/src/main/java/com/amazonaws/retry/ClockSkewAdjuster.java
ClockSkewAdjuster.getAdjustment
public ClockSkewAdjustment getAdjustment(AdjustmentRequest adjustmentRequest) { ValidationUtils.assertNotNull(adjustmentRequest, "adjustmentRequest"); ValidationUtils.assertNotNull(adjustmentRequest.exception, "adjustmentRequest.exception"); ValidationUtils.assertNotNull(adjustmentRequest.clientRequest, "adjustmentRequest.clientRequest"); ValidationUtils.assertNotNull(adjustmentRequest.serviceResponse, "adjustmentRequest.serviceResponse"); int timeSkewInSeconds = 0; boolean isAdjustmentRecommended = false; try { if (isAdjustmentRecommended(adjustmentRequest)) { Date serverDate = getServerDate(adjustmentRequest); if (serverDate != null) { timeSkewInSeconds = timeSkewInSeconds(getCurrentDate(adjustmentRequest), serverDate); isAdjustmentRecommended = true; } } } catch (RuntimeException e) { log.warn("Unable to correct for clock skew.", e); } return new ClockSkewAdjustment(isAdjustmentRecommended, timeSkewInSeconds); }
java
public ClockSkewAdjustment getAdjustment(AdjustmentRequest adjustmentRequest) { ValidationUtils.assertNotNull(adjustmentRequest, "adjustmentRequest"); ValidationUtils.assertNotNull(adjustmentRequest.exception, "adjustmentRequest.exception"); ValidationUtils.assertNotNull(adjustmentRequest.clientRequest, "adjustmentRequest.clientRequest"); ValidationUtils.assertNotNull(adjustmentRequest.serviceResponse, "adjustmentRequest.serviceResponse"); int timeSkewInSeconds = 0; boolean isAdjustmentRecommended = false; try { if (isAdjustmentRecommended(adjustmentRequest)) { Date serverDate = getServerDate(adjustmentRequest); if (serverDate != null) { timeSkewInSeconds = timeSkewInSeconds(getCurrentDate(adjustmentRequest), serverDate); isAdjustmentRecommended = true; } } } catch (RuntimeException e) { log.warn("Unable to correct for clock skew.", e); } return new ClockSkewAdjustment(isAdjustmentRecommended, timeSkewInSeconds); }
[ "public", "ClockSkewAdjustment", "getAdjustment", "(", "AdjustmentRequest", "adjustmentRequest", ")", "{", "ValidationUtils", ".", "assertNotNull", "(", "adjustmentRequest", ",", "\"adjustmentRequest\"", ")", ";", "ValidationUtils", ".", "assertNotNull", "(", "adjustmentReq...
Recommend a {@link ClockSkewAdjustment}, based on the provided {@link AdjustmentRequest}.
[ "Recommend", "a", "{" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/retry/ClockSkewAdjuster.java#L68-L91
alkacon/opencms-core
src-modules/org/opencms/workplace/administration/CmsAdminMenuGroup.java
CmsAdminMenuGroup.addMenuItem
public void addMenuItem(CmsAdminMenuItem item, float position) { m_container.addIdentifiableObject(item.getId(), item, position); }
java
public void addMenuItem(CmsAdminMenuItem item, float position) { m_container.addIdentifiableObject(item.getId(), item, position); }
[ "public", "void", "addMenuItem", "(", "CmsAdminMenuItem", "item", ",", "float", "position", ")", "{", "m_container", ".", "addIdentifiableObject", "(", "item", ".", "getId", "(", ")", ",", "item", ",", "position", ")", ";", "}" ]
Adds a menu item at the given position.<p> @param item the item @param position the position @see org.opencms.workplace.tools.CmsIdentifiableObjectContainer#addIdentifiableObject(String, Object, float)
[ "Adds", "a", "menu", "item", "at", "the", "given", "position", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/administration/CmsAdminMenuGroup.java#L87-L90
jcuda/jcusparse
JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java
JCusparse.cusparseShybsv_analysis
public static int cusparseShybsv_analysis( cusparseHandle handle, int transA, cusparseMatDescr descrA, cusparseHybMat hybA, cusparseSolveAnalysisInfo info) { return checkResult(cusparseShybsv_analysisNative(handle, transA, descrA, hybA, info)); }
java
public static int cusparseShybsv_analysis( cusparseHandle handle, int transA, cusparseMatDescr descrA, cusparseHybMat hybA, cusparseSolveAnalysisInfo info) { return checkResult(cusparseShybsv_analysisNative(handle, transA, descrA, hybA, info)); }
[ "public", "static", "int", "cusparseShybsv_analysis", "(", "cusparseHandle", "handle", ",", "int", "transA", ",", "cusparseMatDescr", "descrA", ",", "cusparseHybMat", "hybA", ",", "cusparseSolveAnalysisInfo", "info", ")", "{", "return", "checkResult", "(", "cusparseSh...
Description: Solution of triangular linear system op(A) * x = alpha * f, where A is a sparse matrix in HYB storage format, rhs f and solution x are dense vectors.
[ "Description", ":", "Solution", "of", "triangular", "linear", "system", "op", "(", "A", ")", "*", "x", "=", "alpha", "*", "f", "where", "A", "is", "a", "sparse", "matrix", "in", "HYB", "storage", "format", "rhs", "f", "and", "solution", "x", "are", "...
train
https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L3480-L3488
Azure/azure-sdk-for-java
network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/NetworkSecurityGroupsInner.java
NetworkSecurityGroupsInner.beginUpdateTagsAsync
public Observable<NetworkSecurityGroupInner> beginUpdateTagsAsync(String resourceGroupName, String networkSecurityGroupName, Map<String, String> tags) { return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, networkSecurityGroupName, tags).map(new Func1<ServiceResponse<NetworkSecurityGroupInner>, NetworkSecurityGroupInner>() { @Override public NetworkSecurityGroupInner call(ServiceResponse<NetworkSecurityGroupInner> response) { return response.body(); } }); }
java
public Observable<NetworkSecurityGroupInner> beginUpdateTagsAsync(String resourceGroupName, String networkSecurityGroupName, Map<String, String> tags) { return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, networkSecurityGroupName, tags).map(new Func1<ServiceResponse<NetworkSecurityGroupInner>, NetworkSecurityGroupInner>() { @Override public NetworkSecurityGroupInner call(ServiceResponse<NetworkSecurityGroupInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "NetworkSecurityGroupInner", ">", "beginUpdateTagsAsync", "(", "String", "resourceGroupName", ",", "String", "networkSecurityGroupName", ",", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "return", "beginUpdateTagsWithServiceRe...
Updates a network security group tags. @param resourceGroupName The name of the resource group. @param networkSecurityGroupName The name of the network security group. @param tags Resource tags. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the NetworkSecurityGroupInner object
[ "Updates", "a", "network", "security", "group", "tags", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/NetworkSecurityGroupsInner.java#L862-L869
QSFT/Doradus
doradus-common/src/main/java/com/dell/doradus/common/UNode.java
UNode.addValueNode
public UNode addValueNode(String name, String value, boolean bAttribute) { return addChildNode(UNode.createValueNode(name, value, bAttribute)); }
java
public UNode addValueNode(String name, String value, boolean bAttribute) { return addChildNode(UNode.createValueNode(name, value, bAttribute)); }
[ "public", "UNode", "addValueNode", "(", "String", "name", ",", "String", "value", ",", "boolean", "bAttribute", ")", "{", "return", "addChildNode", "(", "UNode", ".", "createValueNode", "(", "name", ",", "value", ",", "bAttribute", ")", ")", ";", "}" ]
Create a new VALUE node with the given name, value, and attribute flag and add it as a child of this node. This node must be a MAP or ARRAY. This is convenience method that calls {@link UNode#createValueNode(String, String, boolean)} and then {@link #addChildNode(UNode)}. @param name Name of new VALUE node. @param value Value of new VALUE node. @param bAttribute True to mark the new VALUE node as an attribute (for XML). @return New VALUE node.
[ "Create", "a", "new", "VALUE", "node", "with", "the", "given", "name", "value", "and", "attribute", "flag", "and", "add", "it", "as", "a", "child", "of", "this", "node", ".", "This", "node", "must", "be", "a", "MAP", "or", "ARRAY", ".", "This", "is",...
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-common/src/main/java/com/dell/doradus/common/UNode.java#L874-L876
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/replace/CmsReplaceContentWidget.java
CmsReplaceContentWidget.displayDialogInfo
public void displayDialogInfo(String msg, boolean warning) { StringBuffer buffer = new StringBuffer(64); if (!warning) { buffer.append("<p class=\""); buffer.append(I_CmsLayoutBundle.INSTANCE.uploadButton().dialogMessage()); buffer.append("\">"); buffer.append(msg); buffer.append("</p>"); } else { buffer.append(FontOpenCms.WARNING.getHtml(32, I_CmsConstantsBundle.INSTANCE.css().colorWarning())); buffer.append("<p class=\""); buffer.append(I_CmsLayoutBundle.INSTANCE.uploadButton().warningMessage()); buffer.append("\">"); buffer.append(msg); buffer.append("</p>"); } m_dialogInfo.setHTML(buffer.toString()); }
java
public void displayDialogInfo(String msg, boolean warning) { StringBuffer buffer = new StringBuffer(64); if (!warning) { buffer.append("<p class=\""); buffer.append(I_CmsLayoutBundle.INSTANCE.uploadButton().dialogMessage()); buffer.append("\">"); buffer.append(msg); buffer.append("</p>"); } else { buffer.append(FontOpenCms.WARNING.getHtml(32, I_CmsConstantsBundle.INSTANCE.css().colorWarning())); buffer.append("<p class=\""); buffer.append(I_CmsLayoutBundle.INSTANCE.uploadButton().warningMessage()); buffer.append("\">"); buffer.append(msg); buffer.append("</p>"); } m_dialogInfo.setHTML(buffer.toString()); }
[ "public", "void", "displayDialogInfo", "(", "String", "msg", ",", "boolean", "warning", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", "64", ")", ";", "if", "(", "!", "warning", ")", "{", "buffer", ".", "append", "(", "\"<p class=\\\"...
Sets the dialog info message.<p> @param msg the message to display @param warning signals whether the message should be a warning or nor
[ "Sets", "the", "dialog", "info", "message", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/replace/CmsReplaceContentWidget.java#L88-L106
kiegroup/droolsjbpm-integration
kie-server-parent/kie-server-common/src/main/java/org/kie/server/common/rest/variant/AcceptHeaders.java
AcceptHeaders.evaluateAcceptParameters
private static QualityValue evaluateAcceptParameters(Map<String, String> parameters) { Iterator<String> i = parameters.keySet().iterator(); while (i.hasNext()) { String name = i.next(); if ("q".equals(name)) { if (i.hasNext()) { logger.debug("Accept extensions not supported."); i.remove(); do { i.next(); i.remove(); } while (i.hasNext()); return QualityValue.NOT_ACCEPTABLE; } else { String value = parameters.get(name); i.remove(); return QualityValue.valueOf(value); } } } return QualityValue.DEFAULT; }
java
private static QualityValue evaluateAcceptParameters(Map<String, String> parameters) { Iterator<String> i = parameters.keySet().iterator(); while (i.hasNext()) { String name = i.next(); if ("q".equals(name)) { if (i.hasNext()) { logger.debug("Accept extensions not supported."); i.remove(); do { i.next(); i.remove(); } while (i.hasNext()); return QualityValue.NOT_ACCEPTABLE; } else { String value = parameters.get(name); i.remove(); return QualityValue.valueOf(value); } } } return QualityValue.DEFAULT; }
[ "private", "static", "QualityValue", "evaluateAcceptParameters", "(", "Map", "<", "String", ",", "String", ">", "parameters", ")", "{", "Iterator", "<", "String", ">", "i", "=", "parameters", ".", "keySet", "(", ")", ".", "iterator", "(", ")", ";", "while"...
Evaluates and removes the accept parameters. <pre> accept-params = ";" "q" "=" qvalue *( accept-extension ) accept-extension = ";" token [ "=" ( token | quoted-string ) ] </pre> @param parameters all parameters in order of appearance. @return the qvalue. @see "accept-params
[ "Evaluates", "and", "removes", "the", "accept", "parameters", ".", "<pre", ">", "accept", "-", "params", "=", ";", "q", "=", "qvalue", "*", "(", "accept", "-", "extension", ")", "accept", "-", "extension", "=", ";", "token", "[", "=", "(", "token", "...
train
https://github.com/kiegroup/droolsjbpm-integration/blob/6c26200ab03855dbb92b56ca0c6363cdec0eaf2c/kie-server-parent/kie-server-common/src/main/java/org/kie/server/common/rest/variant/AcceptHeaders.java#L293-L321
amzn/ion-java
src/com/amazon/ion/impl/IonUTF8.java
IonUTF8.packBytesAfter1
public final static int packBytesAfter1(int unicodeScalar, int utf8Len) { int packed_chars; switch (utf8Len) { default: throw new IllegalArgumentException("pack requires len > 1"); case 2: packed_chars = getByte2Of2(unicodeScalar); break; case 3: packed_chars = getByte2Of3(unicodeScalar); packed_chars |= getByte3Of3(unicodeScalar) << 8; break; case 4: packed_chars = getByte2Of4(unicodeScalar); packed_chars |= getByte3Of4(unicodeScalar) << 8; packed_chars |= getByte4Of4(unicodeScalar) << 16; break; } return packed_chars; }
java
public final static int packBytesAfter1(int unicodeScalar, int utf8Len) { int packed_chars; switch (utf8Len) { default: throw new IllegalArgumentException("pack requires len > 1"); case 2: packed_chars = getByte2Of2(unicodeScalar); break; case 3: packed_chars = getByte2Of3(unicodeScalar); packed_chars |= getByte3Of3(unicodeScalar) << 8; break; case 4: packed_chars = getByte2Of4(unicodeScalar); packed_chars |= getByte3Of4(unicodeScalar) << 8; packed_chars |= getByte4Of4(unicodeScalar) << 16; break; } return packed_chars; }
[ "public", "final", "static", "int", "packBytesAfter1", "(", "int", "unicodeScalar", ",", "int", "utf8Len", ")", "{", "int", "packed_chars", ";", "switch", "(", "utf8Len", ")", "{", "default", ":", "throw", "new", "IllegalArgumentException", "(", "\"pack requires...
converts a unicode code point to a 0-3 bytes of UTF8 encoded data and a length - note this doesn't pack a 1 byte character and it returns the start character. this is the unpacking routine while (_utf8_pretch_byte_count > 0 && offset < limit) { _utf8_pretch_byte_count--; buffer[offset++] = (byte)((_utf8_pretch_bytes >> (_utf8_pretch_byte_count*8)) & 0xff); }
[ "converts", "a", "unicode", "code", "point", "to", "a", "0", "-", "3", "bytes", "of", "UTF8", "encoded", "data", "and", "a", "length", "-", "note", "this", "doesn", "t", "pack", "a", "1", "byte", "character", "and", "it", "returns", "the", "start", "...
train
https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonUTF8.java#L250-L272
Stratio/deep-spark
deep-cassandra/src/main/java/com/stratio/deep/cassandra/cql/RangeUtils.java
RangeUtils.getSplits
public static List<DeepTokenRange> getSplits(CassandraDeepJobConfig config) { Map<String, Iterable<Comparable>> tokens = new HashMap<>(); IPartitioner p = getPartitioner(config); Pair<Session, String> sessionWithHost = CassandraClientProvider.getSession( config.getHost(), config, false); String queryLocal = "select tokens from system.local"; tokens.putAll(fetchTokens(queryLocal, sessionWithHost, p)); String queryPeers = "select peer, tokens from system.peers"; tokens.putAll(fetchTokens(queryPeers, sessionWithHost, p)); List<DeepTokenRange> merged = mergeTokenRanges(tokens, sessionWithHost.left, p); return splitRanges(merged, p, config.getBisectFactor()); }
java
public static List<DeepTokenRange> getSplits(CassandraDeepJobConfig config) { Map<String, Iterable<Comparable>> tokens = new HashMap<>(); IPartitioner p = getPartitioner(config); Pair<Session, String> sessionWithHost = CassandraClientProvider.getSession( config.getHost(), config, false); String queryLocal = "select tokens from system.local"; tokens.putAll(fetchTokens(queryLocal, sessionWithHost, p)); String queryPeers = "select peer, tokens from system.peers"; tokens.putAll(fetchTokens(queryPeers, sessionWithHost, p)); List<DeepTokenRange> merged = mergeTokenRanges(tokens, sessionWithHost.left, p); return splitRanges(merged, p, config.getBisectFactor()); }
[ "public", "static", "List", "<", "DeepTokenRange", ">", "getSplits", "(", "CassandraDeepJobConfig", "config", ")", "{", "Map", "<", "String", ",", "Iterable", "<", "Comparable", ">", ">", "tokens", "=", "new", "HashMap", "<>", "(", ")", ";", "IPartitioner", ...
Returns the token ranges that will be mapped to Spark partitions. @param config the Deep configuration object. @return the list of computed token ranges.
[ "Returns", "the", "token", "ranges", "that", "will", "be", "mapped", "to", "Spark", "partitions", "." ]
train
https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-cassandra/src/main/java/com/stratio/deep/cassandra/cql/RangeUtils.java#L159-L175
wcm-io/wcm-io-handler
link/src/main/java/io/wcm/handler/link/type/InternalCrossContextLinkType.java
InternalCrossContextLinkType.getSyntheticLinkResource
public static @NotNull Resource getSyntheticLinkResource(@NotNull ResourceResolver resourceResolver, @NotNull String pageRef) { Map<String, Object> map = new HashMap<>(); map.put(LinkNameConstants.PN_LINK_TYPE, ID); map.put(LinkNameConstants.PN_LINK_CROSSCONTEXT_CONTENT_REF, pageRef); return new SyntheticLinkResource(resourceResolver, map); }
java
public static @NotNull Resource getSyntheticLinkResource(@NotNull ResourceResolver resourceResolver, @NotNull String pageRef) { Map<String, Object> map = new HashMap<>(); map.put(LinkNameConstants.PN_LINK_TYPE, ID); map.put(LinkNameConstants.PN_LINK_CROSSCONTEXT_CONTENT_REF, pageRef); return new SyntheticLinkResource(resourceResolver, map); }
[ "public", "static", "@", "NotNull", "Resource", "getSyntheticLinkResource", "(", "@", "NotNull", "ResourceResolver", "resourceResolver", ",", "@", "NotNull", "String", "pageRef", ")", "{", "Map", "<", "String", ",", "Object", ">", "map", "=", "new", "HashMap", ...
Get synthetic link resource for this link type. @param resourceResolver Resource resolver @param pageRef Path to target page @return Synthetic link resource
[ "Get", "synthetic", "link", "resource", "for", "this", "link", "type", "." ]
train
https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/link/src/main/java/io/wcm/handler/link/type/InternalCrossContextLinkType.java#L116-L121
strator-dev/greenpepper
greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/domain/Execution.java
Execution.newInstance
public static Execution newInstance(Specification specification, SystemUnderTest systemUnderTest, XmlReport xmlReport) { if(xmlReport.getGlobalException() != null) { return error(specification, systemUnderTest, null, xmlReport.getGlobalException()); } Execution execution = new Execution(); execution.setExecutionDate(new Timestamp(System.currentTimeMillis())); execution.setSpecification(specification); execution.setSystemUnderTest(systemUnderTest); execution.setFailures( xmlReport.getFailure(0) ); execution.setErrors( xmlReport.getError(0) ); execution.setSuccess( xmlReport.getSuccess(0) ); execution.setIgnored( xmlReport.getIgnored(0) ); String results = xmlReport.getResults(0); if(results != null) { execution.setResults(results); } if (xmlReport.getSections(0) != null) { StringBuilder sections = new StringBuilder(); int index = 0; while (xmlReport.getSections(index) != null) { if (index > 0) sections.append(','); sections.append(xmlReport.getSections(index)); index++; } execution.setSections(sections.toString()); } return execution; }
java
public static Execution newInstance(Specification specification, SystemUnderTest systemUnderTest, XmlReport xmlReport) { if(xmlReport.getGlobalException() != null) { return error(specification, systemUnderTest, null, xmlReport.getGlobalException()); } Execution execution = new Execution(); execution.setExecutionDate(new Timestamp(System.currentTimeMillis())); execution.setSpecification(specification); execution.setSystemUnderTest(systemUnderTest); execution.setFailures( xmlReport.getFailure(0) ); execution.setErrors( xmlReport.getError(0) ); execution.setSuccess( xmlReport.getSuccess(0) ); execution.setIgnored( xmlReport.getIgnored(0) ); String results = xmlReport.getResults(0); if(results != null) { execution.setResults(results); } if (xmlReport.getSections(0) != null) { StringBuilder sections = new StringBuilder(); int index = 0; while (xmlReport.getSections(index) != null) { if (index > 0) sections.append(','); sections.append(xmlReport.getSections(index)); index++; } execution.setSections(sections.toString()); } return execution; }
[ "public", "static", "Execution", "newInstance", "(", "Specification", "specification", ",", "SystemUnderTest", "systemUnderTest", ",", "XmlReport", "xmlReport", ")", "{", "if", "(", "xmlReport", ".", "getGlobalException", "(", ")", "!=", "null", ")", "{", "return"...
<p>newInstance.</p> @param specification a {@link com.greenpepper.server.domain.Specification} object. @param systemUnderTest a {@link com.greenpepper.server.domain.SystemUnderTest} object. @param xmlReport a {@link com.greenpepper.report.XmlReport} object. @return a {@link com.greenpepper.server.domain.Execution} object.
[ "<p", ">", "newInstance", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/domain/Execution.java#L89-L127
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/formatting2/SARLFormatter.java
SARLFormatter._format
protected void _format(SarlAgent agent, IFormattableDocument document) { formatAnnotations(agent, document, XbaseFormatterPreferenceKeys.newLineAfterClassAnnotations); formatModifiers(agent, document); final ISemanticRegionsFinder regionFor = this.textRegionExtensions.regionFor(agent); document.append(regionFor.keyword(this.keywords.getAgentKeyword()), ONE_SPACE); document.surround(regionFor.keyword(this.keywords.getExtendsKeyword()), ONE_SPACE); document.format(agent.getExtends()); formatBody(agent, document); }
java
protected void _format(SarlAgent agent, IFormattableDocument document) { formatAnnotations(agent, document, XbaseFormatterPreferenceKeys.newLineAfterClassAnnotations); formatModifiers(agent, document); final ISemanticRegionsFinder regionFor = this.textRegionExtensions.regionFor(agent); document.append(regionFor.keyword(this.keywords.getAgentKeyword()), ONE_SPACE); document.surround(regionFor.keyword(this.keywords.getExtendsKeyword()), ONE_SPACE); document.format(agent.getExtends()); formatBody(agent, document); }
[ "protected", "void", "_format", "(", "SarlAgent", "agent", ",", "IFormattableDocument", "document", ")", "{", "formatAnnotations", "(", "agent", ",", "document", ",", "XbaseFormatterPreferenceKeys", ".", "newLineAfterClassAnnotations", ")", ";", "formatModifiers", "(", ...
Format the given SARL agent. @param agent the SARL component. @param document the document.
[ "Format", "the", "given", "SARL", "agent", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/formatting2/SARLFormatter.java#L232-L243