repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
mkobos/pca_transform
src/main/java/com/mkobos/pca_transform/covmatrixevd/EVDBased.java
EVDBased.calculateCovarianceMatrixOfCenteredData
public static Matrix calculateCovarianceMatrixOfCenteredData(Matrix data) { """ Calculate covariance matrix with an assumption that data matrix is centered i.e. for each column i: x_i' = x_i - E(x_i) """ Assume.assume(data.getRowDimension()>1, "Number of data samples is "+ data.getRowDimension()+", but it has to be >1 to compute "+ "covariances"); int dimsNo = data.getColumnDimension(); int samplesNo = data.getRowDimension(); Matrix m = new Matrix(dimsNo, dimsNo); for(int r = 0; r < dimsNo; r++) for(int c = r; c < dimsNo; c++){ double sum = 0; for(int i = 0; i < samplesNo; i++) sum += data.get(i, r)*data.get(i, c); m.set(r, c, sum/(samplesNo-1)); } for(int r = 0; r < dimsNo; r++) for(int c = 0; c < r; c++) m.set(r, c, m.get(c, r)); return m; } }
java
public static Matrix calculateCovarianceMatrixOfCenteredData(Matrix data){ Assume.assume(data.getRowDimension()>1, "Number of data samples is "+ data.getRowDimension()+", but it has to be >1 to compute "+ "covariances"); int dimsNo = data.getColumnDimension(); int samplesNo = data.getRowDimension(); Matrix m = new Matrix(dimsNo, dimsNo); for(int r = 0; r < dimsNo; r++) for(int c = r; c < dimsNo; c++){ double sum = 0; for(int i = 0; i < samplesNo; i++) sum += data.get(i, r)*data.get(i, c); m.set(r, c, sum/(samplesNo-1)); } for(int r = 0; r < dimsNo; r++) for(int c = 0; c < r; c++) m.set(r, c, m.get(c, r)); return m; } }
[ "public", "static", "Matrix", "calculateCovarianceMatrixOfCenteredData", "(", "Matrix", "data", ")", "{", "Assume", ".", "assume", "(", "data", ".", "getRowDimension", "(", ")", ">", "1", ",", "\"Number of data samples is \"", "+", "data", ".", "getRowDimension", "(", ")", "+", "\", but it has to be >1 to compute \"", "+", "\"covariances\"", ")", ";", "int", "dimsNo", "=", "data", ".", "getColumnDimension", "(", ")", ";", "int", "samplesNo", "=", "data", ".", "getRowDimension", "(", ")", ";", "Matrix", "m", "=", "new", "Matrix", "(", "dimsNo", ",", "dimsNo", ")", ";", "for", "(", "int", "r", "=", "0", ";", "r", "<", "dimsNo", ";", "r", "++", ")", "for", "(", "int", "c", "=", "r", ";", "c", "<", "dimsNo", ";", "c", "++", ")", "{", "double", "sum", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "samplesNo", ";", "i", "++", ")", "sum", "+=", "data", ".", "get", "(", "i", ",", "r", ")", "*", "data", ".", "get", "(", "i", ",", "c", ")", ";", "m", ".", "set", "(", "r", ",", "c", ",", "sum", "/", "(", "samplesNo", "-", "1", ")", ")", ";", "}", "for", "(", "int", "r", "=", "0", ";", "r", "<", "dimsNo", ";", "r", "++", ")", "for", "(", "int", "c", "=", "0", ";", "c", "<", "r", ";", "c", "++", ")", "m", ".", "set", "(", "r", ",", "c", ",", "m", ".", "get", "(", "c", ",", "r", ")", ")", ";", "return", "m", ";", "}", "}" ]
Calculate covariance matrix with an assumption that data matrix is centered i.e. for each column i: x_i' = x_i - E(x_i)
[ "Calculate", "covariance", "matrix", "with", "an", "assumption", "that", "data", "matrix", "is", "centered", "i", ".", "e", ".", "for", "each", "column", "i", ":", "x_i", "=", "x_i", "-", "E", "(", "x_i", ")" ]
train
https://github.com/mkobos/pca_transform/blob/0f73f443465eeae2d2131fc0da82a7cf7dc92bc2/src/main/java/com/mkobos/pca_transform/covmatrixevd/EVDBased.java#L24-L42
Netflix/zuul
zuul-core/src/main/java/com/netflix/zuul/context/SessionContext.java
SessionContext.set
public void set(String key, Object value) { """ puts the key, value into the map. a null value will remove the key from the map @param key @param value """ if (value != null) put(key, value); else remove(key); }
java
public void set(String key, Object value) { if (value != null) put(key, value); else remove(key); }
[ "public", "void", "set", "(", "String", "key", ",", "Object", "value", ")", "{", "if", "(", "value", "!=", "null", ")", "put", "(", "key", ",", "value", ")", ";", "else", "remove", "(", "key", ")", ";", "}" ]
puts the key, value into the map. a null value will remove the key from the map @param key @param value
[ "puts", "the", "key", "value", "into", "the", "map", ".", "a", "null", "value", "will", "remove", "the", "key", "from", "the", "map" ]
train
https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/context/SessionContext.java#L138-L141
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/basic/service.java
service.count_filtered
public static long count_filtered(nitro_service service, String filter) throws Exception { """ Use this API to count filtered the set of service resources. filter string should be in JSON format.eg: "port:80,servicetype:HTTP". """ service obj = new service(); options option = new options(); option.set_count(true); option.set_filter(filter); service[] response = (service[]) obj.getfiltered(service, option); if (response != null) { return response[0].__count; } return 0; }
java
public static long count_filtered(nitro_service service, String filter) throws Exception{ service obj = new service(); options option = new options(); option.set_count(true); option.set_filter(filter); service[] response = (service[]) obj.getfiltered(service, option); if (response != null) { return response[0].__count; } return 0; }
[ "public", "static", "long", "count_filtered", "(", "nitro_service", "service", ",", "String", "filter", ")", "throws", "Exception", "{", "service", "obj", "=", "new", "service", "(", ")", ";", "options", "option", "=", "new", "options", "(", ")", ";", "option", ".", "set_count", "(", "true", ")", ";", "option", ".", "set_filter", "(", "filter", ")", ";", "service", "[", "]", "response", "=", "(", "service", "[", "]", ")", "obj", ".", "getfiltered", "(", "service", ",", "option", ")", ";", "if", "(", "response", "!=", "null", ")", "{", "return", "response", "[", "0", "]", ".", "__count", ";", "}", "return", "0", ";", "}" ]
Use this API to count filtered the set of service resources. filter string should be in JSON format.eg: "port:80,servicetype:HTTP".
[ "Use", "this", "API", "to", "count", "filtered", "the", "set", "of", "service", "resources", ".", "filter", "string", "should", "be", "in", "JSON", "format", ".", "eg", ":", "port", ":", "80", "servicetype", ":", "HTTP", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/basic/service.java#L1857-L1867
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/StreamingLocatorsInner.java
StreamingLocatorsInner.getAsync
public Observable<StreamingLocatorInner> getAsync(String resourceGroupName, String accountName, String streamingLocatorName) { """ Get a Streaming Locator. Get the details of a Streaming Locator in the Media Services account. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param streamingLocatorName The Streaming Locator name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the StreamingLocatorInner object """ return getWithServiceResponseAsync(resourceGroupName, accountName, streamingLocatorName).map(new Func1<ServiceResponse<StreamingLocatorInner>, StreamingLocatorInner>() { @Override public StreamingLocatorInner call(ServiceResponse<StreamingLocatorInner> response) { return response.body(); } }); }
java
public Observable<StreamingLocatorInner> getAsync(String resourceGroupName, String accountName, String streamingLocatorName) { return getWithServiceResponseAsync(resourceGroupName, accountName, streamingLocatorName).map(new Func1<ServiceResponse<StreamingLocatorInner>, StreamingLocatorInner>() { @Override public StreamingLocatorInner call(ServiceResponse<StreamingLocatorInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "StreamingLocatorInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "streamingLocatorName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "streamingLocatorName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "StreamingLocatorInner", ">", ",", "StreamingLocatorInner", ">", "(", ")", "{", "@", "Override", "public", "StreamingLocatorInner", "call", "(", "ServiceResponse", "<", "StreamingLocatorInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Get a Streaming Locator. Get the details of a Streaming Locator in the Media Services account. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param streamingLocatorName The Streaming Locator name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the StreamingLocatorInner object
[ "Get", "a", "Streaming", "Locator", ".", "Get", "the", "details", "of", "a", "Streaming", "Locator", "in", "the", "Media", "Services", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/StreamingLocatorsInner.java#L403-L410
gallandarakhneorg/afc
advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/ifx/Vector3ifx.java
Vector3ifx.lengthSquaredProperty
public DoubleProperty lengthSquaredProperty() { """ Replies the property that represents the length of the vector. @return the length property """ if (this.lengthSquareProperty == null) { this.lengthSquareProperty = new ReadOnlyDoubleWrapper(this, MathFXAttributeNames.LENGTH_SQUARED); this.lengthSquareProperty.bind(Bindings.createDoubleBinding(() -> Vector3ifx.this.x.doubleValue() * Vector3ifx.this.x.doubleValue() + Vector3ifx.this.y.doubleValue() * Vector3ifx.this.y.doubleValue() + Vector3ifx.this.z.doubleValue() * Vector3ifx.this.z.doubleValue(), this.x, this.y, this.z)); } return this.lengthSquareProperty; }
java
public DoubleProperty lengthSquaredProperty() { if (this.lengthSquareProperty == null) { this.lengthSquareProperty = new ReadOnlyDoubleWrapper(this, MathFXAttributeNames.LENGTH_SQUARED); this.lengthSquareProperty.bind(Bindings.createDoubleBinding(() -> Vector3ifx.this.x.doubleValue() * Vector3ifx.this.x.doubleValue() + Vector3ifx.this.y.doubleValue() * Vector3ifx.this.y.doubleValue() + Vector3ifx.this.z.doubleValue() * Vector3ifx.this.z.doubleValue(), this.x, this.y, this.z)); } return this.lengthSquareProperty; }
[ "public", "DoubleProperty", "lengthSquaredProperty", "(", ")", "{", "if", "(", "this", ".", "lengthSquareProperty", "==", "null", ")", "{", "this", ".", "lengthSquareProperty", "=", "new", "ReadOnlyDoubleWrapper", "(", "this", ",", "MathFXAttributeNames", ".", "LENGTH_SQUARED", ")", ";", "this", ".", "lengthSquareProperty", ".", "bind", "(", "Bindings", ".", "createDoubleBinding", "(", "(", ")", "->", "Vector3ifx", ".", "this", ".", "x", ".", "doubleValue", "(", ")", "*", "Vector3ifx", ".", "this", ".", "x", ".", "doubleValue", "(", ")", "+", "Vector3ifx", ".", "this", ".", "y", ".", "doubleValue", "(", ")", "*", "Vector3ifx", ".", "this", ".", "y", ".", "doubleValue", "(", ")", "+", "Vector3ifx", ".", "this", ".", "z", ".", "doubleValue", "(", ")", "*", "Vector3ifx", ".", "this", ".", "z", ".", "doubleValue", "(", ")", ",", "this", ".", "x", ",", "this", ".", "y", ",", "this", ".", "z", ")", ")", ";", "}", "return", "this", ".", "lengthSquareProperty", ";", "}" ]
Replies the property that represents the length of the vector. @return the length property
[ "Replies", "the", "property", "that", "represents", "the", "length", "of", "the", "vector", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/ifx/Vector3ifx.java#L179-L188
dihedron/dihedron-commons
src/main/java/org/dihedron/core/reflection/Reflector.java
Reflector.setValueForKey
@SuppressWarnings( { """ If the object is a <code>Map</code> or a subclass, it sets the element corresponding to the given key. @param key the key corresponding to the element to be set. @param value the value to be set. @throws ReflectorException if the object is not <code>Map</code>. """ "unchecked", "rawtypes" }) public void setValueForKey(Object key, Object value) throws ReflectorException { if(object == null) { logger.error("object is null: did you specify it using the 'inspect()' method?"); throw new ReflectorException("object is null: did you specify it using the 'inspect()' method?"); } if(object instanceof Map) { ((Map)object).put(key, value); } else { throw new ReflectorException("object is not a map"); } }
java
@SuppressWarnings({ "unchecked", "rawtypes" }) public void setValueForKey(Object key, Object value) throws ReflectorException { if(object == null) { logger.error("object is null: did you specify it using the 'inspect()' method?"); throw new ReflectorException("object is null: did you specify it using the 'inspect()' method?"); } if(object instanceof Map) { ((Map)object).put(key, value); } else { throw new ReflectorException("object is not a map"); } }
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", ",", "\"rawtypes\"", "}", ")", "public", "void", "setValueForKey", "(", "Object", "key", ",", "Object", "value", ")", "throws", "ReflectorException", "{", "if", "(", "object", "==", "null", ")", "{", "logger", ".", "error", "(", "\"object is null: did you specify it using the 'inspect()' method?\"", ")", ";", "throw", "new", "ReflectorException", "(", "\"object is null: did you specify it using the 'inspect()' method?\"", ")", ";", "}", "if", "(", "object", "instanceof", "Map", ")", "{", "(", "(", "Map", ")", "object", ")", ".", "put", "(", "key", ",", "value", ")", ";", "}", "else", "{", "throw", "new", "ReflectorException", "(", "\"object is not a map\"", ")", ";", "}", "}" ]
If the object is a <code>Map</code> or a subclass, it sets the element corresponding to the given key. @param key the key corresponding to the element to be set. @param value the value to be set. @throws ReflectorException if the object is not <code>Map</code>.
[ "If", "the", "object", "is", "a", "<code", ">", "Map<", "/", "code", ">", "or", "a", "subclass", "it", "sets", "the", "element", "corresponding", "to", "the", "given", "key", "." ]
train
https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/core/reflection/Reflector.java#L353-L366
jcuda/jnvgraph
JNvgraphJava/src/main/java/jcuda/jnvgraph/JNvgraph.java
JNvgraph.nvgraphWidestPath
public static int nvgraphWidestPath( nvgraphHandle handle, nvgraphGraphDescr descrG, long weight_index, Pointer source_vert, long widest_path_index) { """ nvGRAPH WidestPath Find widest path potential from source_index to every other vertices. """ return checkResult(nvgraphWidestPathNative(handle, descrG, weight_index, source_vert, widest_path_index)); }
java
public static int nvgraphWidestPath( nvgraphHandle handle, nvgraphGraphDescr descrG, long weight_index, Pointer source_vert, long widest_path_index) { return checkResult(nvgraphWidestPathNative(handle, descrG, weight_index, source_vert, widest_path_index)); }
[ "public", "static", "int", "nvgraphWidestPath", "(", "nvgraphHandle", "handle", ",", "nvgraphGraphDescr", "descrG", ",", "long", "weight_index", ",", "Pointer", "source_vert", ",", "long", "widest_path_index", ")", "{", "return", "checkResult", "(", "nvgraphWidestPathNative", "(", "handle", ",", "descrG", ",", "weight_index", ",", "source_vert", ",", "widest_path_index", ")", ")", ";", "}" ]
nvGRAPH WidestPath Find widest path potential from source_index to every other vertices.
[ "nvGRAPH", "WidestPath", "Find", "widest", "path", "potential", "from", "source_index", "to", "every", "other", "vertices", "." ]
train
https://github.com/jcuda/jnvgraph/blob/2c6bd7c58edac181753bacf30af2cceeb1989a78/JNvgraphJava/src/main/java/jcuda/jnvgraph/JNvgraph.java#L625-L633
powermock/powermock
powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java
PowerMock.suppressMethod
@Deprecated public static synchronized void suppressMethod(Class<?> clazz, String methodName, String... additionalMethodNames) { """ Suppress multiple methods for a class. @param clazz The class whose methods will be suppressed. @param methodName The first method to be suppress in class {@code clazz}. @param additionalMethodNames Additional methods to suppress in class {@code clazz}. @deprecated Use {@link #suppress(Method[])} instead. """ SuppressCode.suppressMethod(clazz, methodName, additionalMethodNames); }
java
@Deprecated public static synchronized void suppressMethod(Class<?> clazz, String methodName, String... additionalMethodNames) { SuppressCode.suppressMethod(clazz, methodName, additionalMethodNames); }
[ "@", "Deprecated", "public", "static", "synchronized", "void", "suppressMethod", "(", "Class", "<", "?", ">", "clazz", ",", "String", "methodName", ",", "String", "...", "additionalMethodNames", ")", "{", "SuppressCode", ".", "suppressMethod", "(", "clazz", ",", "methodName", ",", "additionalMethodNames", ")", ";", "}" ]
Suppress multiple methods for a class. @param clazz The class whose methods will be suppressed. @param methodName The first method to be suppress in class {@code clazz}. @param additionalMethodNames Additional methods to suppress in class {@code clazz}. @deprecated Use {@link #suppress(Method[])} instead.
[ "Suppress", "multiple", "methods", "for", "a", "class", "." ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java#L1878-L1881
apache/incubator-atlas
addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
HiveMetaStoreBridge.createTableInstance
public Referenceable createTableInstance(Referenceable dbReference, Table hiveTable) throws AtlasHookException { """ Create a new table instance in Atlas @param dbReference reference to a created Hive database {@link Referenceable} to which this table belongs @param hiveTable reference to the Hive {@link Table} from which to map properties @return Newly created Hive reference @throws Exception """ return createOrUpdateTableInstance(dbReference, null, hiveTable); }
java
public Referenceable createTableInstance(Referenceable dbReference, Table hiveTable) throws AtlasHookException { return createOrUpdateTableInstance(dbReference, null, hiveTable); }
[ "public", "Referenceable", "createTableInstance", "(", "Referenceable", "dbReference", ",", "Table", "hiveTable", ")", "throws", "AtlasHookException", "{", "return", "createOrUpdateTableInstance", "(", "dbReference", ",", "null", ",", "hiveTable", ")", ";", "}" ]
Create a new table instance in Atlas @param dbReference reference to a created Hive database {@link Referenceable} to which this table belongs @param hiveTable reference to the Hive {@link Table} from which to map properties @return Newly created Hive reference @throws Exception
[ "Create", "a", "new", "table", "instance", "in", "Atlas" ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java#L422-L425
RestComm/sip-servlets
sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java
FacebookRestClient.marketplace_search
public T marketplace_search(CharSequence category, CharSequence subCategory, CharSequence query) throws FacebookException, IOException { """ Search for marketplace listings, optionally by category, subcategory, and/or query string. @param category the category of listings desired (optional except if subcategory is provided) @param subCategory the subcategory of listings desired (optional) @param query a query string (optional) @return a T of marketplace listings @see <a href="http://wiki.developers.facebook.com/index.php/Marketplace.search"> Developers Wiki: marketplace.search</a> """ ArrayList<Pair<String, CharSequence>> params = new ArrayList<Pair<String, CharSequence>>(FacebookMethod.MARKETPLACE_SEARCH.numParams()); if (null != category && !"".equals(category)) { params.add(new Pair<String, CharSequence>("category", category)); if (null != subCategory && !"".equals(subCategory)) { params.add(new Pair<String, CharSequence>("subcategory", subCategory)); } } if (null != query && !"".equals(query)) { params.add(new Pair<String, CharSequence>("query", category)); } return this.callMethod(FacebookMethod.MARKETPLACE_SEARCH, params); }
java
public T marketplace_search(CharSequence category, CharSequence subCategory, CharSequence query) throws FacebookException, IOException { ArrayList<Pair<String, CharSequence>> params = new ArrayList<Pair<String, CharSequence>>(FacebookMethod.MARKETPLACE_SEARCH.numParams()); if (null != category && !"".equals(category)) { params.add(new Pair<String, CharSequence>("category", category)); if (null != subCategory && !"".equals(subCategory)) { params.add(new Pair<String, CharSequence>("subcategory", subCategory)); } } if (null != query && !"".equals(query)) { params.add(new Pair<String, CharSequence>("query", category)); } return this.callMethod(FacebookMethod.MARKETPLACE_SEARCH, params); }
[ "public", "T", "marketplace_search", "(", "CharSequence", "category", ",", "CharSequence", "subCategory", ",", "CharSequence", "query", ")", "throws", "FacebookException", ",", "IOException", "{", "ArrayList", "<", "Pair", "<", "String", ",", "CharSequence", ">", ">", "params", "=", "new", "ArrayList", "<", "Pair", "<", "String", ",", "CharSequence", ">", ">", "(", "FacebookMethod", ".", "MARKETPLACE_SEARCH", ".", "numParams", "(", ")", ")", ";", "if", "(", "null", "!=", "category", "&&", "!", "\"\"", ".", "equals", "(", "category", ")", ")", "{", "params", ".", "add", "(", "new", "Pair", "<", "String", ",", "CharSequence", ">", "(", "\"category\"", ",", "category", ")", ")", ";", "if", "(", "null", "!=", "subCategory", "&&", "!", "\"\"", ".", "equals", "(", "subCategory", ")", ")", "{", "params", ".", "add", "(", "new", "Pair", "<", "String", ",", "CharSequence", ">", "(", "\"subcategory\"", ",", "subCategory", ")", ")", ";", "}", "}", "if", "(", "null", "!=", "query", "&&", "!", "\"\"", ".", "equals", "(", "query", ")", ")", "{", "params", ".", "add", "(", "new", "Pair", "<", "String", ",", "CharSequence", ">", "(", "\"query\"", ",", "category", ")", ")", ";", "}", "return", "this", ".", "callMethod", "(", "FacebookMethod", ".", "MARKETPLACE_SEARCH", ",", "params", ")", ";", "}" ]
Search for marketplace listings, optionally by category, subcategory, and/or query string. @param category the category of listings desired (optional except if subcategory is provided) @param subCategory the subcategory of listings desired (optional) @param query a query string (optional) @return a T of marketplace listings @see <a href="http://wiki.developers.facebook.com/index.php/Marketplace.search"> Developers Wiki: marketplace.search</a>
[ "Search", "for", "marketplace", "listings", "optionally", "by", "category", "subcategory", "and", "/", "or", "query", "string", "." ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L2049-L2065
lucee/Lucee
core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java
ResourceUtil.getMimeType
public static String getMimeType(Resource res, String defaultValue) { """ return the mime type of a file, dont check extension @param res @param defaultValue @return mime type of the file """ return IOUtil.getMimeType(res, defaultValue); }
java
public static String getMimeType(Resource res, String defaultValue) { return IOUtil.getMimeType(res, defaultValue); }
[ "public", "static", "String", "getMimeType", "(", "Resource", "res", ",", "String", "defaultValue", ")", "{", "return", "IOUtil", ".", "getMimeType", "(", "res", ",", "defaultValue", ")", ";", "}" ]
return the mime type of a file, dont check extension @param res @param defaultValue @return mime type of the file
[ "return", "the", "mime", "type", "of", "a", "file", "dont", "check", "extension" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java#L790-L792
craterdog/java-general-utilities
src/main/java/craterdog/utils/ByteUtils.java
ByteUtils.doubleToBytes
static public int doubleToBytes(double s, byte[] buffer, int index) { """ This function converts a double into its corresponding byte format and inserts it into the specified buffer at the specified index. @param s The double to be converted. @param buffer The byte array. @param index The index in the array to begin inserting bytes. @return The number of bytes inserted. """ long bits = Double.doubleToRawLongBits(s); int length = longToBytes(bits, buffer, index); return length; }
java
static public int doubleToBytes(double s, byte[] buffer, int index) { long bits = Double.doubleToRawLongBits(s); int length = longToBytes(bits, buffer, index); return length; }
[ "static", "public", "int", "doubleToBytes", "(", "double", "s", ",", "byte", "[", "]", "buffer", ",", "int", "index", ")", "{", "long", "bits", "=", "Double", ".", "doubleToRawLongBits", "(", "s", ")", ";", "int", "length", "=", "longToBytes", "(", "bits", ",", "buffer", ",", "index", ")", ";", "return", "length", ";", "}" ]
This function converts a double into its corresponding byte format and inserts it into the specified buffer at the specified index. @param s The double to be converted. @param buffer The byte array. @param index The index in the array to begin inserting bytes. @return The number of bytes inserted.
[ "This", "function", "converts", "a", "double", "into", "its", "corresponding", "byte", "format", "and", "inserts", "it", "into", "the", "specified", "buffer", "at", "the", "specified", "index", "." ]
train
https://github.com/craterdog/java-general-utilities/blob/a3ff45eaa00c2b8ed5c53efe9fe5166065fc1f57/src/main/java/craterdog/utils/ByteUtils.java#L429-L433
geomajas/geomajas-project-server
plugin/print/print/src/main/java/org/geomajas/plugin/printing/component/PdfContext.java
PdfContext.strokeRoundRectangle
public void strokeRoundRectangle(Rectangle rect, Color color, float linewidth, float r) { """ Draw a rounded rectangular boundary. @param rect rectangle @param color colour @param linewidth line width @param r radius for rounded corners """ template.saveState(); setStroke(color, linewidth, null); template.roundRectangle(origX + rect.getLeft(), origY + rect.getBottom(), rect.getWidth(), rect.getHeight(), r); template.stroke(); template.restoreState(); }
java
public void strokeRoundRectangle(Rectangle rect, Color color, float linewidth, float r) { template.saveState(); setStroke(color, linewidth, null); template.roundRectangle(origX + rect.getLeft(), origY + rect.getBottom(), rect.getWidth(), rect.getHeight(), r); template.stroke(); template.restoreState(); }
[ "public", "void", "strokeRoundRectangle", "(", "Rectangle", "rect", ",", "Color", "color", ",", "float", "linewidth", ",", "float", "r", ")", "{", "template", ".", "saveState", "(", ")", ";", "setStroke", "(", "color", ",", "linewidth", ",", "null", ")", ";", "template", ".", "roundRectangle", "(", "origX", "+", "rect", ".", "getLeft", "(", ")", ",", "origY", "+", "rect", ".", "getBottom", "(", ")", ",", "rect", ".", "getWidth", "(", ")", ",", "rect", ".", "getHeight", "(", ")", ",", "r", ")", ";", "template", ".", "stroke", "(", ")", ";", "template", ".", "restoreState", "(", ")", ";", "}" ]
Draw a rounded rectangular boundary. @param rect rectangle @param color colour @param linewidth line width @param r radius for rounded corners
[ "Draw", "a", "rounded", "rectangular", "boundary", "." ]
train
https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/plugin/print/print/src/main/java/org/geomajas/plugin/printing/component/PdfContext.java#L225-L231
soulwarelabs/jCommons-API
src/main/java/com/soulwarelabs/jcommons/data/Version.java
Version.setNumber
public Version setNumber(int index, int number, String label) { """ Sets a new version number. @param index available version number index. @param number version number (not negative). @param label version number label (optional). @return version descriptor. @throws IllegalArgumentException if either index or number are illegal. @since v1.1.0 """ validateNumber(number); if (isBeyondBounds(index)) { String message = String.format("illegal number index: %d", index); throw new IllegalArgumentException(message); } labels.set(--index, label); numbers.set(index, number); return this; }
java
public Version setNumber(int index, int number, String label) { validateNumber(number); if (isBeyondBounds(index)) { String message = String.format("illegal number index: %d", index); throw new IllegalArgumentException(message); } labels.set(--index, label); numbers.set(index, number); return this; }
[ "public", "Version", "setNumber", "(", "int", "index", ",", "int", "number", ",", "String", "label", ")", "{", "validateNumber", "(", "number", ")", ";", "if", "(", "isBeyondBounds", "(", "index", ")", ")", "{", "String", "message", "=", "String", ".", "format", "(", "\"illegal number index: %d\"", ",", "index", ")", ";", "throw", "new", "IllegalArgumentException", "(", "message", ")", ";", "}", "labels", ".", "set", "(", "--", "index", ",", "label", ")", ";", "numbers", ".", "set", "(", "index", ",", "number", ")", ";", "return", "this", ";", "}" ]
Sets a new version number. @param index available version number index. @param number version number (not negative). @param label version number label (optional). @return version descriptor. @throws IllegalArgumentException if either index or number are illegal. @since v1.1.0
[ "Sets", "a", "new", "version", "number", "." ]
train
https://github.com/soulwarelabs/jCommons-API/blob/57795ae28aea144e68502149506ec99dd67f0c67/src/main/java/com/soulwarelabs/jcommons/data/Version.java#L597-L606
ebourgeois/common-java
src/main/java/ca/jeb/common/infra/JReflectionUtils.java
JReflectionUtils.runMethod
public static Object runMethod(Object object, String method, Object... args) throws JException { """ Use reflection to run/execute the method represented by "method", on the object {@code object}, given the list of {@code args}. @param object - The object to execute the method against @param method - The method name @param args - All the arguments for this method @return Object - The value of executing this method, if any @throws JException """ try { final Method m = object.getClass().getMethod(method); return m.invoke(object, args); } catch (Exception e) { throw new JException(e); } }
java
public static Object runMethod(Object object, String method, Object... args) throws JException { try { final Method m = object.getClass().getMethod(method); return m.invoke(object, args); } catch (Exception e) { throw new JException(e); } }
[ "public", "static", "Object", "runMethod", "(", "Object", "object", ",", "String", "method", ",", "Object", "...", "args", ")", "throws", "JException", "{", "try", "{", "final", "Method", "m", "=", "object", ".", "getClass", "(", ")", ".", "getMethod", "(", "method", ")", ";", "return", "m", ".", "invoke", "(", "object", ",", "args", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "JException", "(", "e", ")", ";", "}", "}" ]
Use reflection to run/execute the method represented by "method", on the object {@code object}, given the list of {@code args}. @param object - The object to execute the method against @param method - The method name @param args - All the arguments for this method @return Object - The value of executing this method, if any @throws JException
[ "Use", "reflection", "to", "run", "/", "execute", "the", "method", "represented", "by", "method", "on", "the", "object", "{", "@code", "object", "}", "given", "the", "list", "of", "{", "@code", "args", "}", "." ]
train
https://github.com/ebourgeois/common-java/blob/8ba7e05b1228aad1ec2949b5707ac4b5e8889f92/src/main/java/ca/jeb/common/infra/JReflectionUtils.java#L128-L140
VoltDB/voltdb
src/catgen/in/javasrc/CatalogDiffEngine.java
CatalogDiffEngine.createViewDisallowedMessage
private String createViewDisallowedMessage(String viewName, String singleTableName) { """ Return an error message asserting that we cannot create a view with a given name. @param viewName The name of the view we are refusing to create. @param singleTableName The name of the source table if there is one source table. If there are multiple tables this should be null. This only affects the wording of the error message. @return """ boolean singleTable = (singleTableName != null); return String.format( "Unable to create %sview %s %sbecause the view definition uses operations that cannot always be applied if %s.", (singleTable ? "single table " : "multi-table "), viewName, (singleTable ? String.format("on table %s ", singleTableName) : ""), (singleTable ? "the table already contains data" : "none of the source tables are empty")); }
java
private String createViewDisallowedMessage(String viewName, String singleTableName) { boolean singleTable = (singleTableName != null); return String.format( "Unable to create %sview %s %sbecause the view definition uses operations that cannot always be applied if %s.", (singleTable ? "single table " : "multi-table "), viewName, (singleTable ? String.format("on table %s ", singleTableName) : ""), (singleTable ? "the table already contains data" : "none of the source tables are empty")); }
[ "private", "String", "createViewDisallowedMessage", "(", "String", "viewName", ",", "String", "singleTableName", ")", "{", "boolean", "singleTable", "=", "(", "singleTableName", "!=", "null", ")", ";", "return", "String", ".", "format", "(", "\"Unable to create %sview %s %sbecause the view definition uses operations that cannot always be applied if %s.\"", ",", "(", "singleTable", "?", "\"single table \"", ":", "\"multi-table \"", ")", ",", "viewName", ",", "(", "singleTable", "?", "String", ".", "format", "(", "\"on table %s \"", ",", "singleTableName", ")", ":", "\"\"", ")", ",", "(", "singleTable", "?", "\"the table already contains data\"", ":", "\"none of the source tables are empty\"", ")", ")", ";", "}" ]
Return an error message asserting that we cannot create a view with a given name. @param viewName The name of the view we are refusing to create. @param singleTableName The name of the source table if there is one source table. If there are multiple tables this should be null. This only affects the wording of the error message. @return
[ "Return", "an", "error", "message", "asserting", "that", "we", "cannot", "create", "a", "view", "with", "a", "given", "name", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/catgen/in/javasrc/CatalogDiffEngine.java#L809-L823
agmip/agmip-common-functions
src/main/java/org/agmip/functions/PTSaxton2006.java
PTSaxton2006.getSLLL
public static String getSLLL(String[] soilParas) { """ For calculating SLLL @param soilParas should include 1. Sand weight percentage by layer ([0,100]%), 2. Clay weight percentage by layer ([0,100]%), 3. Organic matter weight percentage by layer ([0,100]%), (= SLOC * 1.72) @return Soil water, lower limit, fraction """ if (soilParas != null && soilParas.length >= 3) { return divide(calcMoisture1500Kpa(soilParas[0], soilParas[1], soilParas[2]), "100", 3); } else { return null; } }
java
public static String getSLLL(String[] soilParas) { if (soilParas != null && soilParas.length >= 3) { return divide(calcMoisture1500Kpa(soilParas[0], soilParas[1], soilParas[2]), "100", 3); } else { return null; } }
[ "public", "static", "String", "getSLLL", "(", "String", "[", "]", "soilParas", ")", "{", "if", "(", "soilParas", "!=", "null", "&&", "soilParas", ".", "length", ">=", "3", ")", "{", "return", "divide", "(", "calcMoisture1500Kpa", "(", "soilParas", "[", "0", "]", ",", "soilParas", "[", "1", "]", ",", "soilParas", "[", "2", "]", ")", ",", "\"100\"", ",", "3", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
For calculating SLLL @param soilParas should include 1. Sand weight percentage by layer ([0,100]%), 2. Clay weight percentage by layer ([0,100]%), 3. Organic matter weight percentage by layer ([0,100]%), (= SLOC * 1.72) @return Soil water, lower limit, fraction
[ "For", "calculating", "SLLL" ]
train
https://github.com/agmip/agmip-common-functions/blob/4efa3042178841b026ca6fba9c96da02fbfb9a8e/src/main/java/org/agmip/functions/PTSaxton2006.java#L31-L37
apache/incubator-gobblin
gobblin-yarn/src/main/java/org/apache/gobblin/yarn/GobblinYarnLogSource.java
GobblinYarnLogSource.buildLogCopier
protected LogCopier buildLogCopier(Config config, ContainerId containerId, FileSystem destFs, Path appWorkDir) throws IOException { """ Build a {@link LogCopier} instance used to copy the logs out from this {@link GobblinYarnLogSource}. @param config the {@link Config} use to create the {@link LogCopier} @param containerId the {@link ContainerId} of the container the {@link LogCopier} runs in @param destFs the destination {@link FileSystem} @param appWorkDir the Gobblin Yarn application working directory on HDFS @return a {@link LogCopier} instance @throws IOException if it fails on any IO operation """ LogCopier.Builder builder = LogCopier.newBuilder() .useSrcFileSystem(FileSystem.getLocal(new Configuration())) .useDestFileSystem(destFs) .readFrom(getLocalLogDirs()) .writeTo(getHdfsLogDir(containerId, destFs, appWorkDir)) .acceptsLogFileExtensions(ImmutableSet.of(ApplicationConstants.STDOUT, ApplicationConstants.STDERR)) .useLogFileNamePrefix(containerId.toString()); if (config.hasPath(GobblinYarnConfigurationKeys.LOG_COPIER_MAX_FILE_SIZE)) { builder.useMaxBytesPerLogFile(config.getBytes(GobblinYarnConfigurationKeys.LOG_COPIER_MAX_FILE_SIZE)); } if (config.hasPath(GobblinYarnConfigurationKeys.LOG_COPIER_SCHEDULER)) { builder.useScheduler(config.getString(GobblinYarnConfigurationKeys.LOG_COPIER_SCHEDULER)); } return builder.build(); }
java
protected LogCopier buildLogCopier(Config config, ContainerId containerId, FileSystem destFs, Path appWorkDir) throws IOException { LogCopier.Builder builder = LogCopier.newBuilder() .useSrcFileSystem(FileSystem.getLocal(new Configuration())) .useDestFileSystem(destFs) .readFrom(getLocalLogDirs()) .writeTo(getHdfsLogDir(containerId, destFs, appWorkDir)) .acceptsLogFileExtensions(ImmutableSet.of(ApplicationConstants.STDOUT, ApplicationConstants.STDERR)) .useLogFileNamePrefix(containerId.toString()); if (config.hasPath(GobblinYarnConfigurationKeys.LOG_COPIER_MAX_FILE_SIZE)) { builder.useMaxBytesPerLogFile(config.getBytes(GobblinYarnConfigurationKeys.LOG_COPIER_MAX_FILE_SIZE)); } if (config.hasPath(GobblinYarnConfigurationKeys.LOG_COPIER_SCHEDULER)) { builder.useScheduler(config.getString(GobblinYarnConfigurationKeys.LOG_COPIER_SCHEDULER)); } return builder.build(); }
[ "protected", "LogCopier", "buildLogCopier", "(", "Config", "config", ",", "ContainerId", "containerId", ",", "FileSystem", "destFs", ",", "Path", "appWorkDir", ")", "throws", "IOException", "{", "LogCopier", ".", "Builder", "builder", "=", "LogCopier", ".", "newBuilder", "(", ")", ".", "useSrcFileSystem", "(", "FileSystem", ".", "getLocal", "(", "new", "Configuration", "(", ")", ")", ")", ".", "useDestFileSystem", "(", "destFs", ")", ".", "readFrom", "(", "getLocalLogDirs", "(", ")", ")", ".", "writeTo", "(", "getHdfsLogDir", "(", "containerId", ",", "destFs", ",", "appWorkDir", ")", ")", ".", "acceptsLogFileExtensions", "(", "ImmutableSet", ".", "of", "(", "ApplicationConstants", ".", "STDOUT", ",", "ApplicationConstants", ".", "STDERR", ")", ")", ".", "useLogFileNamePrefix", "(", "containerId", ".", "toString", "(", ")", ")", ";", "if", "(", "config", ".", "hasPath", "(", "GobblinYarnConfigurationKeys", ".", "LOG_COPIER_MAX_FILE_SIZE", ")", ")", "{", "builder", ".", "useMaxBytesPerLogFile", "(", "config", ".", "getBytes", "(", "GobblinYarnConfigurationKeys", ".", "LOG_COPIER_MAX_FILE_SIZE", ")", ")", ";", "}", "if", "(", "config", ".", "hasPath", "(", "GobblinYarnConfigurationKeys", ".", "LOG_COPIER_SCHEDULER", ")", ")", "{", "builder", ".", "useScheduler", "(", "config", ".", "getString", "(", "GobblinYarnConfigurationKeys", ".", "LOG_COPIER_SCHEDULER", ")", ")", ";", "}", "return", "builder", ".", "build", "(", ")", ";", "}" ]
Build a {@link LogCopier} instance used to copy the logs out from this {@link GobblinYarnLogSource}. @param config the {@link Config} use to create the {@link LogCopier} @param containerId the {@link ContainerId} of the container the {@link LogCopier} runs in @param destFs the destination {@link FileSystem} @param appWorkDir the Gobblin Yarn application working directory on HDFS @return a {@link LogCopier} instance @throws IOException if it fails on any IO operation
[ "Build", "a", "{", "@link", "LogCopier", "}", "instance", "used", "to", "copy", "the", "logs", "out", "from", "this", "{", "@link", "GobblinYarnLogSource", "}", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-yarn/src/main/java/org/apache/gobblin/yarn/GobblinYarnLogSource.java#L69-L85
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/randomprojection/RPUtils.java
RPUtils.getAllCandidates
public static INDArray getAllCandidates(INDArray x,List<RPTree> trees,String similarityFunction) { """ Get the search candidates as indices given the input and similarity function @param x the input data to search with @param trees the trees to search @param similarityFunction the function to use for similarity @return the list of indices as the search results """ List<Integer> candidates = getCandidates(x,trees,similarityFunction); Collections.sort(candidates); int prevIdx = -1; int idxCount = 0; List<Pair<Integer,Integer>> scores = new ArrayList<>(); for(int i = 0; i < candidates.size(); i++) { if(candidates.get(i) == prevIdx) { idxCount++; } else if(prevIdx != -1) { scores.add(Pair.of(idxCount,prevIdx)); idxCount = 1; } prevIdx = i; } scores.add(Pair.of(idxCount,prevIdx)); INDArray arr = Nd4j.create(scores.size()); for(int i = 0; i < scores.size(); i++) { arr.putScalar(i,scores.get(i).getSecond()); } return arr; }
java
public static INDArray getAllCandidates(INDArray x,List<RPTree> trees,String similarityFunction) { List<Integer> candidates = getCandidates(x,trees,similarityFunction); Collections.sort(candidates); int prevIdx = -1; int idxCount = 0; List<Pair<Integer,Integer>> scores = new ArrayList<>(); for(int i = 0; i < candidates.size(); i++) { if(candidates.get(i) == prevIdx) { idxCount++; } else if(prevIdx != -1) { scores.add(Pair.of(idxCount,prevIdx)); idxCount = 1; } prevIdx = i; } scores.add(Pair.of(idxCount,prevIdx)); INDArray arr = Nd4j.create(scores.size()); for(int i = 0; i < scores.size(); i++) { arr.putScalar(i,scores.get(i).getSecond()); } return arr; }
[ "public", "static", "INDArray", "getAllCandidates", "(", "INDArray", "x", ",", "List", "<", "RPTree", ">", "trees", ",", "String", "similarityFunction", ")", "{", "List", "<", "Integer", ">", "candidates", "=", "getCandidates", "(", "x", ",", "trees", ",", "similarityFunction", ")", ";", "Collections", ".", "sort", "(", "candidates", ")", ";", "int", "prevIdx", "=", "-", "1", ";", "int", "idxCount", "=", "0", ";", "List", "<", "Pair", "<", "Integer", ",", "Integer", ">", ">", "scores", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "candidates", ".", "size", "(", ")", ";", "i", "++", ")", "{", "if", "(", "candidates", ".", "get", "(", "i", ")", "==", "prevIdx", ")", "{", "idxCount", "++", ";", "}", "else", "if", "(", "prevIdx", "!=", "-", "1", ")", "{", "scores", ".", "add", "(", "Pair", ".", "of", "(", "idxCount", ",", "prevIdx", ")", ")", ";", "idxCount", "=", "1", ";", "}", "prevIdx", "=", "i", ";", "}", "scores", ".", "add", "(", "Pair", ".", "of", "(", "idxCount", ",", "prevIdx", ")", ")", ";", "INDArray", "arr", "=", "Nd4j", ".", "create", "(", "scores", ".", "size", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "scores", ".", "size", "(", ")", ";", "i", "++", ")", "{", "arr", ".", "putScalar", "(", "i", ",", "scores", ".", "get", "(", "i", ")", ".", "getSecond", "(", ")", ")", ";", "}", "return", "arr", ";", "}" ]
Get the search candidates as indices given the input and similarity function @param x the input data to search with @param trees the trees to search @param similarityFunction the function to use for similarity @return the list of indices as the search results
[ "Get", "the", "search", "candidates", "as", "indices", "given", "the", "input", "and", "similarity", "function" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/randomprojection/RPUtils.java#L231-L259
Javacord/Javacord
javacord-api/src/main/java/org/javacord/api/entity/message/MessageBuilder.java
MessageBuilder.addAttachmentAsSpoiler
public MessageBuilder addAttachmentAsSpoiler(InputStream stream, String fileName) { """ Adds an attachment to the message and marks it as spoiler. @param stream The stream of the file. @param fileName The name of the file. @return The current instance in order to chain call methods. """ delegate.addAttachment(stream, "SPOILER_" + fileName); return this; }
java
public MessageBuilder addAttachmentAsSpoiler(InputStream stream, String fileName) { delegate.addAttachment(stream, "SPOILER_" + fileName); return this; }
[ "public", "MessageBuilder", "addAttachmentAsSpoiler", "(", "InputStream", "stream", ",", "String", "fileName", ")", "{", "delegate", ".", "addAttachment", "(", "stream", ",", "\"SPOILER_\"", "+", "fileName", ")", ";", "return", "this", ";", "}" ]
Adds an attachment to the message and marks it as spoiler. @param stream The stream of the file. @param fileName The name of the file. @return The current instance in order to chain call methods.
[ "Adds", "an", "attachment", "to", "the", "message", "and", "marks", "it", "as", "spoiler", "." ]
train
https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-api/src/main/java/org/javacord/api/entity/message/MessageBuilder.java#L421-L424
rubenlagus/TelegramBots
telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java
BaseAbilityBot.getUserIdSendError
protected int getUserIdSendError(String username, MessageContext ctx) { """ Gets the user with the specified username. If user was not found, the bot will send a message on Telegram. @param username the username of the required user @param ctx the message context with the originating user @return the id of the user """ try { return getUser(username).getId(); } catch (IllegalStateException ex) { silent.send(getLocalizedMessage(USER_NOT_FOUND, ctx.user().getLanguageCode(), username), ctx.chatId()); throw propagate(ex); } }
java
protected int getUserIdSendError(String username, MessageContext ctx) { try { return getUser(username).getId(); } catch (IllegalStateException ex) { silent.send(getLocalizedMessage(USER_NOT_FOUND, ctx.user().getLanguageCode(), username), ctx.chatId()); throw propagate(ex); } }
[ "protected", "int", "getUserIdSendError", "(", "String", "username", ",", "MessageContext", "ctx", ")", "{", "try", "{", "return", "getUser", "(", "username", ")", ".", "getId", "(", ")", ";", "}", "catch", "(", "IllegalStateException", "ex", ")", "{", "silent", ".", "send", "(", "getLocalizedMessage", "(", "USER_NOT_FOUND", ",", "ctx", ".", "user", "(", ")", ".", "getLanguageCode", "(", ")", ",", "username", ")", ",", "ctx", ".", "chatId", "(", ")", ")", ";", "throw", "propagate", "(", "ex", ")", ";", "}", "}" ]
Gets the user with the specified username. If user was not found, the bot will send a message on Telegram. @param username the username of the required user @param ctx the message context with the originating user @return the id of the user
[ "Gets", "the", "user", "with", "the", "specified", "username", ".", "If", "user", "was", "not", "found", "the", "bot", "will", "send", "a", "message", "on", "Telegram", "." ]
train
https://github.com/rubenlagus/TelegramBots/blob/d62354915d7664597a40fd9858f16bce67ef1478/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java#L279-L286
adohe/etcd4j
src/main/java/com/xqbase/etcd4j/EtcdClient.java
EtcdClient.createDir
public void createDir(String key, int ttl, Boolean prevExist) throws EtcdClientException { """ Create directories with optional ttl and prevExist(update dir ttl) @param key the key @param ttl the ttl @param prevExist exists before @throws EtcdClientException """ Preconditions.checkNotNull(key); List<BasicNameValuePair> data = Lists.newArrayList(); data.add(new BasicNameValuePair("dir", String.valueOf(true))); if (ttl > 0) { data.add(new BasicNameValuePair("ttl", String.valueOf(ttl))); } if (prevExist != null) { data.add(new BasicNameValuePair("prevExist", String.valueOf(prevExist))); } put(key, data, null, new int[]{200, 201}); }
java
public void createDir(String key, int ttl, Boolean prevExist) throws EtcdClientException { Preconditions.checkNotNull(key); List<BasicNameValuePair> data = Lists.newArrayList(); data.add(new BasicNameValuePair("dir", String.valueOf(true))); if (ttl > 0) { data.add(new BasicNameValuePair("ttl", String.valueOf(ttl))); } if (prevExist != null) { data.add(new BasicNameValuePair("prevExist", String.valueOf(prevExist))); } put(key, data, null, new int[]{200, 201}); }
[ "public", "void", "createDir", "(", "String", "key", ",", "int", "ttl", ",", "Boolean", "prevExist", ")", "throws", "EtcdClientException", "{", "Preconditions", ".", "checkNotNull", "(", "key", ")", ";", "List", "<", "BasicNameValuePair", ">", "data", "=", "Lists", ".", "newArrayList", "(", ")", ";", "data", ".", "add", "(", "new", "BasicNameValuePair", "(", "\"dir\"", ",", "String", ".", "valueOf", "(", "true", ")", ")", ")", ";", "if", "(", "ttl", ">", "0", ")", "{", "data", ".", "add", "(", "new", "BasicNameValuePair", "(", "\"ttl\"", ",", "String", ".", "valueOf", "(", "ttl", ")", ")", ")", ";", "}", "if", "(", "prevExist", "!=", "null", ")", "{", "data", ".", "add", "(", "new", "BasicNameValuePair", "(", "\"prevExist\"", ",", "String", ".", "valueOf", "(", "prevExist", ")", ")", ")", ";", "}", "put", "(", "key", ",", "data", ",", "null", ",", "new", "int", "[", "]", "{", "200", ",", "201", "}", ")", ";", "}" ]
Create directories with optional ttl and prevExist(update dir ttl) @param key the key @param ttl the ttl @param prevExist exists before @throws EtcdClientException
[ "Create", "directories", "with", "optional", "ttl", "and", "prevExist", "(", "update", "dir", "ttl", ")" ]
train
https://github.com/adohe/etcd4j/blob/8d30ae9aa5da32d8e78287d61e69861c63538629/src/main/java/com/xqbase/etcd4j/EtcdClient.java#L185-L198
albfernandez/itext2
src/main/java/com/lowagie/text/rtf/RtfWriter2.java
RtfWriter2.setMargins
public boolean setMargins(float left, float right, float top, float bottom) { """ Sets the page margins @param left The left margin @param right The right margin @param top The top margin @param bottom The bottom margin @return <code>false</code> """ rtfDoc.getDocumentHeader().getPageSetting().setMarginLeft((int) (left * RtfElement.TWIPS_FACTOR)); rtfDoc.getDocumentHeader().getPageSetting().setMarginRight((int) (right * RtfElement.TWIPS_FACTOR)); rtfDoc.getDocumentHeader().getPageSetting().setMarginTop((int) (top * RtfElement.TWIPS_FACTOR)); rtfDoc.getDocumentHeader().getPageSetting().setMarginBottom((int) (bottom * RtfElement.TWIPS_FACTOR)); return true; }
java
public boolean setMargins(float left, float right, float top, float bottom) { rtfDoc.getDocumentHeader().getPageSetting().setMarginLeft((int) (left * RtfElement.TWIPS_FACTOR)); rtfDoc.getDocumentHeader().getPageSetting().setMarginRight((int) (right * RtfElement.TWIPS_FACTOR)); rtfDoc.getDocumentHeader().getPageSetting().setMarginTop((int) (top * RtfElement.TWIPS_FACTOR)); rtfDoc.getDocumentHeader().getPageSetting().setMarginBottom((int) (bottom * RtfElement.TWIPS_FACTOR)); return true; }
[ "public", "boolean", "setMargins", "(", "float", "left", ",", "float", "right", ",", "float", "top", ",", "float", "bottom", ")", "{", "rtfDoc", ".", "getDocumentHeader", "(", ")", ".", "getPageSetting", "(", ")", ".", "setMarginLeft", "(", "(", "int", ")", "(", "left", "*", "RtfElement", ".", "TWIPS_FACTOR", ")", ")", ";", "rtfDoc", ".", "getDocumentHeader", "(", ")", ".", "getPageSetting", "(", ")", ".", "setMarginRight", "(", "(", "int", ")", "(", "right", "*", "RtfElement", ".", "TWIPS_FACTOR", ")", ")", ";", "rtfDoc", ".", "getDocumentHeader", "(", ")", ".", "getPageSetting", "(", ")", ".", "setMarginTop", "(", "(", "int", ")", "(", "top", "*", "RtfElement", ".", "TWIPS_FACTOR", ")", ")", ";", "rtfDoc", ".", "getDocumentHeader", "(", ")", ".", "getPageSetting", "(", ")", ".", "setMarginBottom", "(", "(", "int", ")", "(", "bottom", "*", "RtfElement", ".", "TWIPS_FACTOR", ")", ")", ";", "return", "true", ";", "}" ]
Sets the page margins @param left The left margin @param right The right margin @param top The top margin @param bottom The bottom margin @return <code>false</code>
[ "Sets", "the", "page", "margins" ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/RtfWriter2.java#L217-L223
citrusframework/citrus
modules/citrus-mail/src/main/java/com/consol/citrus/mail/server/MailServer.java
MailServer.createMailMessage
protected MailMessage createMailMessage(Map<String, Object> messageHeaders, String body, String contentType) { """ Creates a new mail message model object from message headers. @param messageHeaders @param body @param contentType @return """ return MailMessage.request(messageHeaders) .marshaller(marshaller) .from(messageHeaders.get(CitrusMailMessageHeaders.MAIL_FROM).toString()) .to(messageHeaders.get(CitrusMailMessageHeaders.MAIL_TO).toString()) .cc(messageHeaders.get(CitrusMailMessageHeaders.MAIL_CC).toString()) .bcc(messageHeaders.get(CitrusMailMessageHeaders.MAIL_BCC).toString()) .subject(messageHeaders.get(CitrusMailMessageHeaders.MAIL_SUBJECT).toString()) .body(body, contentType); }
java
protected MailMessage createMailMessage(Map<String, Object> messageHeaders, String body, String contentType) { return MailMessage.request(messageHeaders) .marshaller(marshaller) .from(messageHeaders.get(CitrusMailMessageHeaders.MAIL_FROM).toString()) .to(messageHeaders.get(CitrusMailMessageHeaders.MAIL_TO).toString()) .cc(messageHeaders.get(CitrusMailMessageHeaders.MAIL_CC).toString()) .bcc(messageHeaders.get(CitrusMailMessageHeaders.MAIL_BCC).toString()) .subject(messageHeaders.get(CitrusMailMessageHeaders.MAIL_SUBJECT).toString()) .body(body, contentType); }
[ "protected", "MailMessage", "createMailMessage", "(", "Map", "<", "String", ",", "Object", ">", "messageHeaders", ",", "String", "body", ",", "String", "contentType", ")", "{", "return", "MailMessage", ".", "request", "(", "messageHeaders", ")", ".", "marshaller", "(", "marshaller", ")", ".", "from", "(", "messageHeaders", ".", "get", "(", "CitrusMailMessageHeaders", ".", "MAIL_FROM", ")", ".", "toString", "(", ")", ")", ".", "to", "(", "messageHeaders", ".", "get", "(", "CitrusMailMessageHeaders", ".", "MAIL_TO", ")", ".", "toString", "(", ")", ")", ".", "cc", "(", "messageHeaders", ".", "get", "(", "CitrusMailMessageHeaders", ".", "MAIL_CC", ")", ".", "toString", "(", ")", ")", ".", "bcc", "(", "messageHeaders", ".", "get", "(", "CitrusMailMessageHeaders", ".", "MAIL_BCC", ")", ".", "toString", "(", ")", ")", ".", "subject", "(", "messageHeaders", ".", "get", "(", "CitrusMailMessageHeaders", ".", "MAIL_SUBJECT", ")", ".", "toString", "(", ")", ")", ".", "body", "(", "body", ",", "contentType", ")", ";", "}" ]
Creates a new mail message model object from message headers. @param messageHeaders @param body @param contentType @return
[ "Creates", "a", "new", "mail", "message", "model", "object", "from", "message", "headers", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-mail/src/main/java/com/consol/citrus/mail/server/MailServer.java#L199-L208
BradleyWood/Software-Quality-Test-Framework
sqtf-core/src/main/java/org/sqtf/assertions/Assert.java
Assert.assertNotEqual
public static void assertNotEqual(Object a, Object b) { """ Asserts that the two objects are equal. If they are not the test will fail @param a The first object @param b The second object """ assertNotEqual(a, b, a + " should not equal to " + b); }
java
public static void assertNotEqual(Object a, Object b) { assertNotEqual(a, b, a + " should not equal to " + b); }
[ "public", "static", "void", "assertNotEqual", "(", "Object", "a", ",", "Object", "b", ")", "{", "assertNotEqual", "(", "a", ",", "b", ",", "a", "+", "\" should not equal to \"", "+", "b", ")", ";", "}" ]
Asserts that the two objects are equal. If they are not the test will fail @param a The first object @param b The second object
[ "Asserts", "that", "the", "two", "objects", "are", "equal", ".", "If", "they", "are", "not", "the", "test", "will", "fail" ]
train
https://github.com/BradleyWood/Software-Quality-Test-Framework/blob/010dea3bfc8e025a4304ab9ef4a213c1adcb1aa0/sqtf-core/src/main/java/org/sqtf/assertions/Assert.java#L178-L180
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/NodeReportsInner.java
NodeReportsInner.getAsync
public Observable<DscNodeReportInner> getAsync(String resourceGroupName, String automationAccountName, String nodeId, String reportId) { """ Retrieve the Dsc node report data by node id and report id. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param nodeId The Dsc node id. @param reportId The report id. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DscNodeReportInner object """ return getWithServiceResponseAsync(resourceGroupName, automationAccountName, nodeId, reportId).map(new Func1<ServiceResponse<DscNodeReportInner>, DscNodeReportInner>() { @Override public DscNodeReportInner call(ServiceResponse<DscNodeReportInner> response) { return response.body(); } }); }
java
public Observable<DscNodeReportInner> getAsync(String resourceGroupName, String automationAccountName, String nodeId, String reportId) { return getWithServiceResponseAsync(resourceGroupName, automationAccountName, nodeId, reportId).map(new Func1<ServiceResponse<DscNodeReportInner>, DscNodeReportInner>() { @Override public DscNodeReportInner call(ServiceResponse<DscNodeReportInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DscNodeReportInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "String", "nodeId", ",", "String", "reportId", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "automationAccountName", ",", "nodeId", ",", "reportId", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "DscNodeReportInner", ">", ",", "DscNodeReportInner", ">", "(", ")", "{", "@", "Override", "public", "DscNodeReportInner", "call", "(", "ServiceResponse", "<", "DscNodeReportInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Retrieve the Dsc node report data by node id and report id. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param nodeId The Dsc node id. @param reportId The report id. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DscNodeReportInner object
[ "Retrieve", "the", "Dsc", "node", "report", "data", "by", "node", "id", "and", "report", "id", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/NodeReportsInner.java#L376-L383
symphonyoss/messageml-utils
src/main/java/org/symphonyoss/symphony/messageml/elements/Element.java
Element.buildNode
private void buildNode(MessageMLParser context, org.w3c.dom.Node node) throws InvalidInputException, ProcessingException { """ Build a text node or a MessageML element based on the provided DOM node. """ switch (node.getNodeType()) { case org.w3c.dom.Node.TEXT_NODE: buildText((Text) node); break; case org.w3c.dom.Node.ELEMENT_NODE: buildElement(context, (org.w3c.dom.Element) node); break; default: throw new InvalidInputException("Invalid element \"" + node.getNodeName() + "\""); } }
java
private void buildNode(MessageMLParser context, org.w3c.dom.Node node) throws InvalidInputException, ProcessingException { switch (node.getNodeType()) { case org.w3c.dom.Node.TEXT_NODE: buildText((Text) node); break; case org.w3c.dom.Node.ELEMENT_NODE: buildElement(context, (org.w3c.dom.Element) node); break; default: throw new InvalidInputException("Invalid element \"" + node.getNodeName() + "\""); } }
[ "private", "void", "buildNode", "(", "MessageMLParser", "context", ",", "org", ".", "w3c", ".", "dom", ".", "Node", "node", ")", "throws", "InvalidInputException", ",", "ProcessingException", "{", "switch", "(", "node", ".", "getNodeType", "(", ")", ")", "{", "case", "org", ".", "w3c", ".", "dom", ".", "Node", ".", "TEXT_NODE", ":", "buildText", "(", "(", "Text", ")", "node", ")", ";", "break", ";", "case", "org", ".", "w3c", ".", "dom", ".", "Node", ".", "ELEMENT_NODE", ":", "buildElement", "(", "context", ",", "(", "org", ".", "w3c", ".", "dom", ".", "Element", ")", "node", ")", ";", "break", ";", "default", ":", "throw", "new", "InvalidInputException", "(", "\"Invalid element \\\"\"", "+", "node", ".", "getNodeName", "(", ")", "+", "\"\\\"\"", ")", ";", "}", "}" ]
Build a text node or a MessageML element based on the provided DOM node.
[ "Build", "a", "text", "node", "or", "a", "MessageML", "element", "based", "on", "the", "provided", "DOM", "node", "." ]
train
https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/elements/Element.java#L117-L131
onelogin/onelogin-java-sdk
src/main/java/com/onelogin/sdk/conn/Client.java
Client.enrollFactor
public OTPDevice enrollFactor(long userId, long factorId, String displayName, String number) throws OAuthSystemException, OAuthProblemException, URISyntaxException { """ Enroll a user with a given authentication factor. @param userId The id of the user. @param factorId The identifier of the factor to enroll the user with. @param displayName A name for the users device. @param number The phone number of the user in E.164 format. @return OTPDevice The MFA device @throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection @throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled @throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor @see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/multi-factor-authentication/enroll-factor">Enroll an Authentication Factor documentation</a> """ cleanError(); prepareToken(); URIBuilder url = new URIBuilder(settings.getURL(Constants.ENROLL_FACTOR_URL, userId)); OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient(); OAuthClient oAuthClient = new OAuthClient(httpClient); OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(url.toString()) .buildHeaderMessage(); Map<String, String> headers = getAuthorizedHeader(); bearerRequest.setHeaders(headers); HashMap<String, Object> params = new HashMap<String, Object>(); params.put("factor_id", factorId); params.put("display_name", displayName); params.put("number", number); String body = JSONUtils.buildJSON(params); bearerRequest.setBody(body); OTPDevice otpDevice = null; OneloginOAuthJSONResourceResponse oAuthResponse = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.POST, OneloginOAuthJSONResourceResponse.class); if (oAuthResponse.getResponseCode() == 200) { JSONObject data = oAuthResponse.getData(); otpDevice = new OTPDevice(data); } else { error = oAuthResponse.getError(); errorDescription = oAuthResponse.getErrorDescription(); } return otpDevice; }
java
public OTPDevice enrollFactor(long userId, long factorId, String displayName, String number) throws OAuthSystemException, OAuthProblemException, URISyntaxException { cleanError(); prepareToken(); URIBuilder url = new URIBuilder(settings.getURL(Constants.ENROLL_FACTOR_URL, userId)); OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient(); OAuthClient oAuthClient = new OAuthClient(httpClient); OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(url.toString()) .buildHeaderMessage(); Map<String, String> headers = getAuthorizedHeader(); bearerRequest.setHeaders(headers); HashMap<String, Object> params = new HashMap<String, Object>(); params.put("factor_id", factorId); params.put("display_name", displayName); params.put("number", number); String body = JSONUtils.buildJSON(params); bearerRequest.setBody(body); OTPDevice otpDevice = null; OneloginOAuthJSONResourceResponse oAuthResponse = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.POST, OneloginOAuthJSONResourceResponse.class); if (oAuthResponse.getResponseCode() == 200) { JSONObject data = oAuthResponse.getData(); otpDevice = new OTPDevice(data); } else { error = oAuthResponse.getError(); errorDescription = oAuthResponse.getErrorDescription(); } return otpDevice; }
[ "public", "OTPDevice", "enrollFactor", "(", "long", "userId", ",", "long", "factorId", ",", "String", "displayName", ",", "String", "number", ")", "throws", "OAuthSystemException", ",", "OAuthProblemException", ",", "URISyntaxException", "{", "cleanError", "(", ")", ";", "prepareToken", "(", ")", ";", "URIBuilder", "url", "=", "new", "URIBuilder", "(", "settings", ".", "getURL", "(", "Constants", ".", "ENROLL_FACTOR_URL", ",", "userId", ")", ")", ";", "OneloginURLConnectionClient", "httpClient", "=", "new", "OneloginURLConnectionClient", "(", ")", ";", "OAuthClient", "oAuthClient", "=", "new", "OAuthClient", "(", "httpClient", ")", ";", "OAuthClientRequest", "bearerRequest", "=", "new", "OAuthBearerClientRequest", "(", "url", ".", "toString", "(", ")", ")", ".", "buildHeaderMessage", "(", ")", ";", "Map", "<", "String", ",", "String", ">", "headers", "=", "getAuthorizedHeader", "(", ")", ";", "bearerRequest", ".", "setHeaders", "(", "headers", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "params", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "params", ".", "put", "(", "\"factor_id\"", ",", "factorId", ")", ";", "params", ".", "put", "(", "\"display_name\"", ",", "displayName", ")", ";", "params", ".", "put", "(", "\"number\"", ",", "number", ")", ";", "String", "body", "=", "JSONUtils", ".", "buildJSON", "(", "params", ")", ";", "bearerRequest", ".", "setBody", "(", "body", ")", ";", "OTPDevice", "otpDevice", "=", "null", ";", "OneloginOAuthJSONResourceResponse", "oAuthResponse", "=", "oAuthClient", ".", "resource", "(", "bearerRequest", ",", "OAuth", ".", "HttpMethod", ".", "POST", ",", "OneloginOAuthJSONResourceResponse", ".", "class", ")", ";", "if", "(", "oAuthResponse", ".", "getResponseCode", "(", ")", "==", "200", ")", "{", "JSONObject", "data", "=", "oAuthResponse", ".", "getData", "(", ")", ";", "otpDevice", "=", "new", "OTPDevice", "(", "data", ")", ";", "}", "else", "{", "error", "=", "oAuthResponse", ".", "getError", "(", ")", ";", "errorDescription", "=", "oAuthResponse", ".", "getErrorDescription", "(", ")", ";", "}", "return", "otpDevice", ";", "}" ]
Enroll a user with a given authentication factor. @param userId The id of the user. @param factorId The identifier of the factor to enroll the user with. @param displayName A name for the users device. @param number The phone number of the user in E.164 format. @return OTPDevice The MFA device @throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection @throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled @throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor @see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/multi-factor-authentication/enroll-factor">Enroll an Authentication Factor documentation</a>
[ "Enroll", "a", "user", "with", "a", "given", "authentication", "factor", "." ]
train
https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L2682-L2715
apereo/cas
support/cas-server-support-pac4j-authentication/src/main/java/org/apereo/cas/integration/pac4j/authentication/handler/support/AbstractPac4jAuthenticationHandler.java
AbstractPac4jAuthenticationHandler.createResult
protected AuthenticationHandlerExecutionResult createResult(final ClientCredential credentials, final UserProfile profile, final BaseClient client) throws GeneralSecurityException { """ Build the handler result. @param credentials the provided credentials @param profile the retrieved user profile @param client the client @return the built handler result @throws GeneralSecurityException On authentication failure. """ if (profile == null) { throw new FailedLoginException("Authentication did not produce a user profile for: " + credentials); } val id = determinePrincipalIdFrom(profile, client); if (StringUtils.isBlank(id)) { throw new FailedLoginException("No identifier found for this user profile: " + profile); } credentials.setUserProfile(profile); credentials.setTypedIdUsed(isTypedIdUsed); val attributes = CoreAuthenticationUtils.convertAttributeValuesToMultiValuedObjects(profile.getAttributes()); val principal = this.principalFactory.createPrincipal(id, attributes); LOGGER.debug("Constructed authenticated principal [{}] based on user profile [{}]", principal, profile); return finalizeAuthenticationHandlerResult(credentials, principal, profile, client); }
java
protected AuthenticationHandlerExecutionResult createResult(final ClientCredential credentials, final UserProfile profile, final BaseClient client) throws GeneralSecurityException { if (profile == null) { throw new FailedLoginException("Authentication did not produce a user profile for: " + credentials); } val id = determinePrincipalIdFrom(profile, client); if (StringUtils.isBlank(id)) { throw new FailedLoginException("No identifier found for this user profile: " + profile); } credentials.setUserProfile(profile); credentials.setTypedIdUsed(isTypedIdUsed); val attributes = CoreAuthenticationUtils.convertAttributeValuesToMultiValuedObjects(profile.getAttributes()); val principal = this.principalFactory.createPrincipal(id, attributes); LOGGER.debug("Constructed authenticated principal [{}] based on user profile [{}]", principal, profile); return finalizeAuthenticationHandlerResult(credentials, principal, profile, client); }
[ "protected", "AuthenticationHandlerExecutionResult", "createResult", "(", "final", "ClientCredential", "credentials", ",", "final", "UserProfile", "profile", ",", "final", "BaseClient", "client", ")", "throws", "GeneralSecurityException", "{", "if", "(", "profile", "==", "null", ")", "{", "throw", "new", "FailedLoginException", "(", "\"Authentication did not produce a user profile for: \"", "+", "credentials", ")", ";", "}", "val", "id", "=", "determinePrincipalIdFrom", "(", "profile", ",", "client", ")", ";", "if", "(", "StringUtils", ".", "isBlank", "(", "id", ")", ")", "{", "throw", "new", "FailedLoginException", "(", "\"No identifier found for this user profile: \"", "+", "profile", ")", ";", "}", "credentials", ".", "setUserProfile", "(", "profile", ")", ";", "credentials", ".", "setTypedIdUsed", "(", "isTypedIdUsed", ")", ";", "val", "attributes", "=", "CoreAuthenticationUtils", ".", "convertAttributeValuesToMultiValuedObjects", "(", "profile", ".", "getAttributes", "(", ")", ")", ";", "val", "principal", "=", "this", ".", "principalFactory", ".", "createPrincipal", "(", "id", ",", "attributes", ")", ";", "LOGGER", ".", "debug", "(", "\"Constructed authenticated principal [{}] based on user profile [{}]\"", ",", "principal", ",", "profile", ")", ";", "return", "finalizeAuthenticationHandlerResult", "(", "credentials", ",", "principal", ",", "profile", ",", "client", ")", ";", "}" ]
Build the handler result. @param credentials the provided credentials @param profile the retrieved user profile @param client the client @return the built handler result @throws GeneralSecurityException On authentication failure.
[ "Build", "the", "handler", "result", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-pac4j-authentication/src/main/java/org/apereo/cas/integration/pac4j/authentication/handler/support/AbstractPac4jAuthenticationHandler.java#L51-L67
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/deployment/DeploymentHandlerUtils.java
DeploymentHandlerUtils.addFlushHandler
public static void addFlushHandler(OperationContext context, ContentRepository contentRepository, OperationContext.ResultHandler handler) { """ Adds a new result handler that will flush (aka amend commit) the changes in the content repository. @param context @param contentRepository @param handler """ if (context.getAttachment(CONTENT_REPOSITORY_FLUSH) == null) { context.attach(CONTENT_REPOSITORY_FLUSH, true); context.completeStep(new OperationContext.ResultHandler() { @Override public void handleResult(OperationContext.ResultAction resultAction, OperationContext context, ModelNode operation) { handler.handleResult(resultAction, context, operation); contentRepository.flush(resultAction == OperationContext.ResultAction.KEEP); context.detach(CONTENT_REPOSITORY_FLUSH); } }); } else { context.completeStep(handler); } }
java
public static void addFlushHandler(OperationContext context, ContentRepository contentRepository, OperationContext.ResultHandler handler) { if (context.getAttachment(CONTENT_REPOSITORY_FLUSH) == null) { context.attach(CONTENT_REPOSITORY_FLUSH, true); context.completeStep(new OperationContext.ResultHandler() { @Override public void handleResult(OperationContext.ResultAction resultAction, OperationContext context, ModelNode operation) { handler.handleResult(resultAction, context, operation); contentRepository.flush(resultAction == OperationContext.ResultAction.KEEP); context.detach(CONTENT_REPOSITORY_FLUSH); } }); } else { context.completeStep(handler); } }
[ "public", "static", "void", "addFlushHandler", "(", "OperationContext", "context", ",", "ContentRepository", "contentRepository", ",", "OperationContext", ".", "ResultHandler", "handler", ")", "{", "if", "(", "context", ".", "getAttachment", "(", "CONTENT_REPOSITORY_FLUSH", ")", "==", "null", ")", "{", "context", ".", "attach", "(", "CONTENT_REPOSITORY_FLUSH", ",", "true", ")", ";", "context", ".", "completeStep", "(", "new", "OperationContext", ".", "ResultHandler", "(", ")", "{", "@", "Override", "public", "void", "handleResult", "(", "OperationContext", ".", "ResultAction", "resultAction", ",", "OperationContext", "context", ",", "ModelNode", "operation", ")", "{", "handler", ".", "handleResult", "(", "resultAction", ",", "context", ",", "operation", ")", ";", "contentRepository", ".", "flush", "(", "resultAction", "==", "OperationContext", ".", "ResultAction", ".", "KEEP", ")", ";", "context", ".", "detach", "(", "CONTENT_REPOSITORY_FLUSH", ")", ";", "}", "}", ")", ";", "}", "else", "{", "context", ".", "completeStep", "(", "handler", ")", ";", "}", "}" ]
Adds a new result handler that will flush (aka amend commit) the changes in the content repository. @param context @param contentRepository @param handler
[ "Adds", "a", "new", "result", "handler", "that", "will", "flush", "(", "aka", "amend", "commit", ")", "the", "changes", "in", "the", "content", "repository", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/DeploymentHandlerUtils.java#L159-L173
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/customer/CustomerAuthTicketUrl.java
CustomerAuthTicketUrl.refreshUserAuthTicketUrl
public static MozuUrl refreshUserAuthTicketUrl(String refreshToken, String responseFields) { """ Get Resource Url for RefreshUserAuthTicket @param refreshToken Alphanumeric string used for access tokens. This token refreshes access for accounts by generating a new developer or application account authentication ticket after an access token expires. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url """ UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/authtickets/refresh?refreshToken={refreshToken}&responseFields={responseFields}"); formatter.formatUrl("refreshToken", refreshToken); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl refreshUserAuthTicketUrl(String refreshToken, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/authtickets/refresh?refreshToken={refreshToken}&responseFields={responseFields}"); formatter.formatUrl("refreshToken", refreshToken); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "refreshUserAuthTicketUrl", "(", "String", "refreshToken", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/customer/authtickets/refresh?refreshToken={refreshToken}&responseFields={responseFields}\"", ")", ";", "formatter", ".", "formatUrl", "(", "\"refreshToken\"", ",", "refreshToken", ")", ";", "formatter", ".", "formatUrl", "(", "\"responseFields\"", ",", "responseFields", ")", ";", "return", "new", "MozuUrl", "(", "formatter", ".", "getResourceUrl", "(", ")", ",", "MozuUrl", ".", "UrlLocation", ".", "TENANT_POD", ")", ";", "}" ]
Get Resource Url for RefreshUserAuthTicket @param refreshToken Alphanumeric string used for access tokens. This token refreshes access for accounts by generating a new developer or application account authentication ticket after an access token expires. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "RefreshUserAuthTicket" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/customer/CustomerAuthTicketUrl.java#L46-L52
lemire/JavaFastPFOR
src/main/java/me/lemire/integercompression/Util.java
Util.maxbits
public static int maxbits(int[] i, int pos, int length) { """ Compute the maximum of the integer logarithms (ceil(log(x+1)) of a range of value @param i source array @param pos starting position @param length number of integers to consider @return integer logarithm """ int mask = 0; for (int k = pos; k < pos + length; ++k) mask |= i[k]; return bits(mask); }
java
public static int maxbits(int[] i, int pos, int length) { int mask = 0; for (int k = pos; k < pos + length; ++k) mask |= i[k]; return bits(mask); }
[ "public", "static", "int", "maxbits", "(", "int", "[", "]", "i", ",", "int", "pos", ",", "int", "length", ")", "{", "int", "mask", "=", "0", ";", "for", "(", "int", "k", "=", "pos", ";", "k", "<", "pos", "+", "length", ";", "++", "k", ")", "mask", "|=", "i", "[", "k", "]", ";", "return", "bits", "(", "mask", ")", ";", "}" ]
Compute the maximum of the integer logarithms (ceil(log(x+1)) of a range of value @param i source array @param pos starting position @param length number of integers to consider @return integer logarithm
[ "Compute", "the", "maximum", "of", "the", "integer", "logarithms", "(", "ceil", "(", "log", "(", "x", "+", "1", "))", "of", "a", "range", "of", "value" ]
train
https://github.com/lemire/JavaFastPFOR/blob/ffeea61ab2fdb3854da7b0a557f8d22d674477f4/src/main/java/me/lemire/integercompression/Util.java#L36-L41
codeprimate-software/cp-elements
src/main/java/org/cp/elements/util/MapUtils.java
MapUtils.count
@NullSafe public static <K, V> int count(Map<K, V> map) { """ Determines the number of entries (key-value pairs) in the {@link Map}. This method is null-safe and will return 0 if the {@link Map} is null or empty. @param <K> Class type of the key. @param <V> Class type of the value. @param map {@link Map} to evaluate. @return the size, or number of elements in the {@link Map}, returning 0 if the {@link Map} is null or empty. """ return (map != null ? map.size() : 0); }
java
@NullSafe public static <K, V> int count(Map<K, V> map) { return (map != null ? map.size() : 0); }
[ "@", "NullSafe", "public", "static", "<", "K", ",", "V", ">", "int", "count", "(", "Map", "<", "K", ",", "V", ">", "map", ")", "{", "return", "(", "map", "!=", "null", "?", "map", ".", "size", "(", ")", ":", "0", ")", ";", "}" ]
Determines the number of entries (key-value pairs) in the {@link Map}. This method is null-safe and will return 0 if the {@link Map} is null or empty. @param <K> Class type of the key. @param <V> Class type of the value. @param map {@link Map} to evaluate. @return the size, or number of elements in the {@link Map}, returning 0 if the {@link Map} is null or empty.
[ "Determines", "the", "number", "of", "entries", "(", "key", "-", "value", "pairs", ")", "in", "the", "{", "@link", "Map", "}", ".", "This", "method", "is", "null", "-", "safe", "and", "will", "return", "0", "if", "the", "{", "@link", "Map", "}", "is", "null", "or", "empty", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/MapUtils.java#L60-L63
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/map/impl/MapListenerAdaptors.java
MapListenerAdaptors.createListenerAdapter
private static ListenerAdapter createListenerAdapter(EntryEventType eventType, MapListener mapListener) { """ Creates a {@link ListenerAdapter} for a specific {@link com.hazelcast.core.EntryEventType}. @param eventType an {@link com.hazelcast.core.EntryEventType}. @param mapListener a {@link com.hazelcast.map.listener.MapListener} instance. @return {@link com.hazelcast.map.impl.ListenerAdapter} for a specific {@link com.hazelcast.core.EntryEventType} """ final ConstructorFunction<MapListener, ListenerAdapter> constructorFunction = CONSTRUCTORS.get(eventType); if (constructorFunction == null) { throw new IllegalArgumentException("First, define a ListenerAdapter for the event EntryEventType." + eventType); } return constructorFunction.createNew(mapListener); }
java
private static ListenerAdapter createListenerAdapter(EntryEventType eventType, MapListener mapListener) { final ConstructorFunction<MapListener, ListenerAdapter> constructorFunction = CONSTRUCTORS.get(eventType); if (constructorFunction == null) { throw new IllegalArgumentException("First, define a ListenerAdapter for the event EntryEventType." + eventType); } return constructorFunction.createNew(mapListener); }
[ "private", "static", "ListenerAdapter", "createListenerAdapter", "(", "EntryEventType", "eventType", ",", "MapListener", "mapListener", ")", "{", "final", "ConstructorFunction", "<", "MapListener", ",", "ListenerAdapter", ">", "constructorFunction", "=", "CONSTRUCTORS", ".", "get", "(", "eventType", ")", ";", "if", "(", "constructorFunction", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"First, define a ListenerAdapter for the event EntryEventType.\"", "+", "eventType", ")", ";", "}", "return", "constructorFunction", ".", "createNew", "(", "mapListener", ")", ";", "}" ]
Creates a {@link ListenerAdapter} for a specific {@link com.hazelcast.core.EntryEventType}. @param eventType an {@link com.hazelcast.core.EntryEventType}. @param mapListener a {@link com.hazelcast.map.listener.MapListener} instance. @return {@link com.hazelcast.map.impl.ListenerAdapter} for a specific {@link com.hazelcast.core.EntryEventType}
[ "Creates", "a", "{", "@link", "ListenerAdapter", "}", "for", "a", "specific", "{", "@link", "com", ".", "hazelcast", ".", "core", ".", "EntryEventType", "}", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/MapListenerAdaptors.java#L222-L228
UrielCh/ovh-java-sdk
ovh-java-sdk-cdndedicated/src/main/java/net/minidev/ovh/api/ApiOvhCdndedicated.java
ApiOvhCdndedicated.serviceName_domains_domain_backends_POST
public OvhBackend serviceName_domains_domain_backends_POST(String serviceName, String domain, String ip) throws IOException { """ Add a backend IP REST: POST /cdn/dedicated/{serviceName}/domains/{domain}/backends @param ip [required] IP to add to backends list @param serviceName [required] The internal name of your CDN offer @param domain [required] Domain of this object """ String qPath = "/cdn/dedicated/{serviceName}/domains/{domain}/backends"; StringBuilder sb = path(qPath, serviceName, domain); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "ip", ip); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhBackend.class); }
java
public OvhBackend serviceName_domains_domain_backends_POST(String serviceName, String domain, String ip) throws IOException { String qPath = "/cdn/dedicated/{serviceName}/domains/{domain}/backends"; StringBuilder sb = path(qPath, serviceName, domain); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "ip", ip); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhBackend.class); }
[ "public", "OvhBackend", "serviceName_domains_domain_backends_POST", "(", "String", "serviceName", ",", "String", "domain", ",", "String", "ip", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cdn/dedicated/{serviceName}/domains/{domain}/backends\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "domain", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"ip\"", ",", "ip", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhBackend", ".", "class", ")", ";", "}" ]
Add a backend IP REST: POST /cdn/dedicated/{serviceName}/domains/{domain}/backends @param ip [required] IP to add to backends list @param serviceName [required] The internal name of your CDN offer @param domain [required] Domain of this object
[ "Add", "a", "backend", "IP" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cdndedicated/src/main/java/net/minidev/ovh/api/ApiOvhCdndedicated.java#L127-L134
pippo-java/pippo
pippo-core/src/main/java/ro/pippo/core/PippoSettings.java
PippoSettings.overrideSetting
public void overrideSetting(String name, boolean value) { """ Override the setting at runtime with the specified value. This change does not persist. @param name @param value """ overrides.put(name, Boolean.toString(value)); }
java
public void overrideSetting(String name, boolean value) { overrides.put(name, Boolean.toString(value)); }
[ "public", "void", "overrideSetting", "(", "String", "name", ",", "boolean", "value", ")", "{", "overrides", ".", "put", "(", "name", ",", "Boolean", ".", "toString", "(", "value", ")", ")", ";", "}" ]
Override the setting at runtime with the specified value. This change does not persist. @param name @param value
[ "Override", "the", "setting", "at", "runtime", "with", "the", "specified", "value", ".", "This", "change", "does", "not", "persist", "." ]
train
https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L1012-L1014
js-lib-com/commons
src/main/java/js/lang/Config.java
Config.setProperty
public void setProperty(String name, String value) { """ Set configuration object string property. If property already exists overwrite old value. If <code>value</code> argument is null this setter does nothing. @param name property name, @param value property value, null ignored. @throws IllegalArgumentException if <code>name</code> argument is null or empty. @throws IllegalArgumentException if <code>value</code> argument is empty. """ Params.notNullOrEmpty(name, "Property name"); Params.notEmpty(value, "Property value"); if(value != null) { properties.setProperty(name, value); } }
java
public void setProperty(String name, String value) { Params.notNullOrEmpty(name, "Property name"); Params.notEmpty(value, "Property value"); if(value != null) { properties.setProperty(name, value); } }
[ "public", "void", "setProperty", "(", "String", "name", ",", "String", "value", ")", "{", "Params", ".", "notNullOrEmpty", "(", "name", ",", "\"Property name\"", ")", ";", "Params", ".", "notEmpty", "(", "value", ",", "\"Property value\"", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "properties", ".", "setProperty", "(", "name", ",", "value", ")", ";", "}", "}" ]
Set configuration object string property. If property already exists overwrite old value. If <code>value</code> argument is null this setter does nothing. @param name property name, @param value property value, null ignored. @throws IllegalArgumentException if <code>name</code> argument is null or empty. @throws IllegalArgumentException if <code>value</code> argument is empty.
[ "Set", "configuration", "object", "string", "property", ".", "If", "property", "already", "exists", "overwrite", "old", "value", ".", "If", "<code", ">", "value<", "/", "code", ">", "argument", "is", "null", "this", "setter", "does", "nothing", "." ]
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/lang/Config.java#L148-L155
jbundle/jbundle
base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XToolScreen.java
XToolScreen.printControl
public boolean printControl(PrintWriter out, int iPrintOptions) { """ Code to display a Menu. @exception DBException File exception. """ boolean bFieldsFound = super.printControl(out, iPrintOptions); if ((iPrintOptions & HtmlConstants.DETAIL_SCREEN) == HtmlConstants.DETAIL_SCREEN) this.printToolbarControl(true, out, iPrintOptions); return bFieldsFound; }
java
public boolean printControl(PrintWriter out, int iPrintOptions) { boolean bFieldsFound = super.printControl(out, iPrintOptions); if ((iPrintOptions & HtmlConstants.DETAIL_SCREEN) == HtmlConstants.DETAIL_SCREEN) this.printToolbarControl(true, out, iPrintOptions); return bFieldsFound; }
[ "public", "boolean", "printControl", "(", "PrintWriter", "out", ",", "int", "iPrintOptions", ")", "{", "boolean", "bFieldsFound", "=", "super", ".", "printControl", "(", "out", ",", "iPrintOptions", ")", ";", "if", "(", "(", "iPrintOptions", "&", "HtmlConstants", ".", "DETAIL_SCREEN", ")", "==", "HtmlConstants", ".", "DETAIL_SCREEN", ")", "this", ".", "printToolbarControl", "(", "true", ",", "out", ",", "iPrintOptions", ")", ";", "return", "bFieldsFound", ";", "}" ]
Code to display a Menu. @exception DBException File exception.
[ "Code", "to", "display", "a", "Menu", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XToolScreen.java#L70-L78
albfernandez/itext2
src/main/java/com/lowagie/text/Utilities.java
Utilities.isSurrogatePair
public static boolean isSurrogatePair(char[] text, int idx) { """ Checks if two subsequent characters in a character array are are the higher and the lower character in a surrogate pair (and therefore eligible for conversion to a UTF 32 character). @param text the character array with the high and low surrogate characters @param idx the index of the 'high' character in the pair @return true if the characters are surrogate pairs @since 2.1.2 """ if (idx < 0 || idx > text.length - 2) return false; return isSurrogateHigh(text[idx]) && isSurrogateLow(text[idx + 1]); }
java
public static boolean isSurrogatePair(char[] text, int idx) { if (idx < 0 || idx > text.length - 2) return false; return isSurrogateHigh(text[idx]) && isSurrogateLow(text[idx + 1]); }
[ "public", "static", "boolean", "isSurrogatePair", "(", "char", "[", "]", "text", ",", "int", "idx", ")", "{", "if", "(", "idx", "<", "0", "||", "idx", ">", "text", ".", "length", "-", "2", ")", "return", "false", ";", "return", "isSurrogateHigh", "(", "text", "[", "idx", "]", ")", "&&", "isSurrogateLow", "(", "text", "[", "idx", "+", "1", "]", ")", ";", "}" ]
Checks if two subsequent characters in a character array are are the higher and the lower character in a surrogate pair (and therefore eligible for conversion to a UTF 32 character). @param text the character array with the high and low surrogate characters @param idx the index of the 'high' character in the pair @return true if the characters are surrogate pairs @since 2.1.2
[ "Checks", "if", "two", "subsequent", "characters", "in", "a", "character", "array", "are", "are", "the", "higher", "and", "the", "lower", "character", "in", "a", "surrogate", "pair", "(", "and", "therefore", "eligible", "for", "conversion", "to", "a", "UTF", "32", "character", ")", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/Utilities.java#L290-L294
lazy-koala/java-toolkit
fast-toolkit/src/main/java/com/thankjava/toolkit/core/reflect/copier/ValueFactory.java
ValueFactory.createValueEnum
@SuppressWarnings( { """ 处理的数据是枚举类型 <p>Function: createValueEnum</p> <p>Description: </p> @author [email protected] @date 2015-1-27 下午4:58:57 @version 1.0 @param targetFieldType @param targetObject @param originValue @return """ "unchecked", "rawtypes" }) static Object createValueEnum(Field targetField,Class<?> targetFieldType,Object targetObject,Object originValue){ if(originValue == null){ return null; } Object enumNameObj = ReflectUtil.getFieldVal(originValue,"name");//获取枚举中的name属性 if(enumNameObj == null){ return null; } String enumName = (String)enumNameObj; return Enum.valueOf((Class<Enum>)targetFieldType,enumName);//得到目标枚举对象 }
java
@SuppressWarnings({ "unchecked", "rawtypes" }) static Object createValueEnum(Field targetField,Class<?> targetFieldType,Object targetObject,Object originValue){ if(originValue == null){ return null; } Object enumNameObj = ReflectUtil.getFieldVal(originValue,"name");//获取枚举中的name属性 if(enumNameObj == null){ return null; } String enumName = (String)enumNameObj; return Enum.valueOf((Class<Enum>)targetFieldType,enumName);//得到目标枚举对象 }
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", ",", "\"rawtypes\"", "}", ")", "static", "Object", "createValueEnum", "(", "Field", "targetField", ",", "Class", "<", "?", ">", "targetFieldType", ",", "Object", "targetObject", ",", "Object", "originValue", ")", "{", "if", "(", "originValue", "==", "null", ")", "{", "return", "null", ";", "}", "Object", "enumNameObj", "=", "ReflectUtil", ".", "getFieldVal", "(", "originValue", ",", "\"name\"", ")", ";", "//获取枚举中的name属性", "if", "(", "enumNameObj", "==", "null", ")", "{", "return", "null", ";", "}", "String", "enumName", "=", "(", "String", ")", "enumNameObj", ";", "return", "Enum", ".", "valueOf", "(", "(", "Class", "<", "Enum", ">", ")", "targetFieldType", ",", "enumName", ")", ";", "//得到目标枚举对象", "}" ]
处理的数据是枚举类型 <p>Function: createValueEnum</p> <p>Description: </p> @author [email protected] @date 2015-1-27 下午4:58:57 @version 1.0 @param targetFieldType @param targetObject @param originValue @return
[ "处理的数据是枚举类型", "<p", ">", "Function", ":", "createValueEnum<", "/", "p", ">", "<p", ">", "Description", ":", "<", "/", "p", ">" ]
train
https://github.com/lazy-koala/java-toolkit/blob/f46055fae0cc73049597a3708e515f5c6582d27a/fast-toolkit/src/main/java/com/thankjava/toolkit/core/reflect/copier/ValueFactory.java#L57-L68
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/IssuesApi.java
IssuesApi.getIssue
public Issue getIssue(Object projectIdOrPath, Integer issueIid) throws GitLabApiException { """ Get a single project issue. <pre><code>GitLab Endpoint: GET /projects/:id/issues/:issue_iid</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param issueIid the internal ID of a project's issue @return the specified Issue instance @throws GitLabApiException if any exception occurs """ Response response = get(Response.Status.OK, getDefaultPerPageParam(), "projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid); return (response.readEntity(Issue.class)); }
java
public Issue getIssue(Object projectIdOrPath, Integer issueIid) throws GitLabApiException { Response response = get(Response.Status.OK, getDefaultPerPageParam(), "projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid); return (response.readEntity(Issue.class)); }
[ "public", "Issue", "getIssue", "(", "Object", "projectIdOrPath", ",", "Integer", "issueIid", ")", "throws", "GitLabApiException", "{", "Response", "response", "=", "get", "(", "Response", ".", "Status", ".", "OK", ",", "getDefaultPerPageParam", "(", ")", ",", "\"projects\"", ",", "getProjectIdOrPath", "(", "projectIdOrPath", ")", ",", "\"issues\"", ",", "issueIid", ")", ";", "return", "(", "response", ".", "readEntity", "(", "Issue", ".", "class", ")", ")", ";", "}" ]
Get a single project issue. <pre><code>GitLab Endpoint: GET /projects/:id/issues/:issue_iid</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param issueIid the internal ID of a project's issue @return the specified Issue instance @throws GitLabApiException if any exception occurs
[ "Get", "a", "single", "project", "issue", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/IssuesApi.java#L293-L297
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-data/deeplearning4j-datavec-iterators/src/main/java/org/deeplearning4j/datasets/datavec/SequenceRecordReaderDataSetIterator.java
SequenceRecordReaderDataSetIterator.loadFromMetaData
public DataSet loadFromMetaData(List<RecordMetaData> list) throws IOException { """ Load a multiple sequence examples to a DataSet, using the provided RecordMetaData instances. @param list List of RecordMetaData instances to load from. Should have been produced by the record reader provided to the SequenceRecordReaderDataSetIterator constructor @return DataSet with the specified examples @throws IOException If an error occurs during loading of the data """ if (underlying == null) { SequenceRecord r = recordReader.loadSequenceFromMetaData(list.get(0)); initializeUnderlying(r); } //Two cases: single vs. multiple reader... List<RecordMetaData> l = new ArrayList<>(list.size()); if (singleSequenceReaderMode) { for (RecordMetaData m : list) { l.add(new RecordMetaDataComposableMap(Collections.singletonMap(READER_KEY, m))); } } else { for (RecordMetaData m : list) { RecordMetaDataComposable rmdc = (RecordMetaDataComposable) m; Map<String, RecordMetaData> map = new HashMap<>(2); map.put(READER_KEY, rmdc.getMeta()[0]); map.put(READER_KEY_LABEL, rmdc.getMeta()[1]); l.add(new RecordMetaDataComposableMap(map)); } } return mdsToDataSet(underlying.loadFromMetaData(l)); }
java
public DataSet loadFromMetaData(List<RecordMetaData> list) throws IOException { if (underlying == null) { SequenceRecord r = recordReader.loadSequenceFromMetaData(list.get(0)); initializeUnderlying(r); } //Two cases: single vs. multiple reader... List<RecordMetaData> l = new ArrayList<>(list.size()); if (singleSequenceReaderMode) { for (RecordMetaData m : list) { l.add(new RecordMetaDataComposableMap(Collections.singletonMap(READER_KEY, m))); } } else { for (RecordMetaData m : list) { RecordMetaDataComposable rmdc = (RecordMetaDataComposable) m; Map<String, RecordMetaData> map = new HashMap<>(2); map.put(READER_KEY, rmdc.getMeta()[0]); map.put(READER_KEY_LABEL, rmdc.getMeta()[1]); l.add(new RecordMetaDataComposableMap(map)); } } return mdsToDataSet(underlying.loadFromMetaData(l)); }
[ "public", "DataSet", "loadFromMetaData", "(", "List", "<", "RecordMetaData", ">", "list", ")", "throws", "IOException", "{", "if", "(", "underlying", "==", "null", ")", "{", "SequenceRecord", "r", "=", "recordReader", ".", "loadSequenceFromMetaData", "(", "list", ".", "get", "(", "0", ")", ")", ";", "initializeUnderlying", "(", "r", ")", ";", "}", "//Two cases: single vs. multiple reader...", "List", "<", "RecordMetaData", ">", "l", "=", "new", "ArrayList", "<>", "(", "list", ".", "size", "(", ")", ")", ";", "if", "(", "singleSequenceReaderMode", ")", "{", "for", "(", "RecordMetaData", "m", ":", "list", ")", "{", "l", ".", "add", "(", "new", "RecordMetaDataComposableMap", "(", "Collections", ".", "singletonMap", "(", "READER_KEY", ",", "m", ")", ")", ")", ";", "}", "}", "else", "{", "for", "(", "RecordMetaData", "m", ":", "list", ")", "{", "RecordMetaDataComposable", "rmdc", "=", "(", "RecordMetaDataComposable", ")", "m", ";", "Map", "<", "String", ",", "RecordMetaData", ">", "map", "=", "new", "HashMap", "<>", "(", "2", ")", ";", "map", ".", "put", "(", "READER_KEY", ",", "rmdc", ".", "getMeta", "(", ")", "[", "0", "]", ")", ";", "map", ".", "put", "(", "READER_KEY_LABEL", ",", "rmdc", ".", "getMeta", "(", ")", "[", "1", "]", ")", ";", "l", ".", "add", "(", "new", "RecordMetaDataComposableMap", "(", "map", ")", ")", ";", "}", "}", "return", "mdsToDataSet", "(", "underlying", ".", "loadFromMetaData", "(", "l", ")", ")", ";", "}" ]
Load a multiple sequence examples to a DataSet, using the provided RecordMetaData instances. @param list List of RecordMetaData instances to load from. Should have been produced by the record reader provided to the SequenceRecordReaderDataSetIterator constructor @return DataSet with the specified examples @throws IOException If an error occurs during loading of the data
[ "Load", "a", "multiple", "sequence", "examples", "to", "a", "DataSet", "using", "the", "provided", "RecordMetaData", "instances", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-data/deeplearning4j-datavec-iterators/src/main/java/org/deeplearning4j/datasets/datavec/SequenceRecordReaderDataSetIterator.java#L462-L485
lessthanoptimal/ejml
main/ejml-core/src/org/ejml/data/DMatrixSparseTriplet.java
DMatrixSparseTriplet.unsafe_set
@Override public void unsafe_set(int row, int col, double value) { """ Same as {@link #set(int, int, double)} but does not check to see if row and column are within bounds. @param row Matrix element's row index. @param col Matrix element's column index. @param value value of element. """ int index = nz_index(row,col); if( index < 0 ) addItem( row,col,value); else { nz_value.data[index] = value; } }
java
@Override public void unsafe_set(int row, int col, double value) { int index = nz_index(row,col); if( index < 0 ) addItem( row,col,value); else { nz_value.data[index] = value; } }
[ "@", "Override", "public", "void", "unsafe_set", "(", "int", "row", ",", "int", "col", ",", "double", "value", ")", "{", "int", "index", "=", "nz_index", "(", "row", ",", "col", ")", ";", "if", "(", "index", "<", "0", ")", "addItem", "(", "row", ",", "col", ",", "value", ")", ";", "else", "{", "nz_value", ".", "data", "[", "index", "]", "=", "value", ";", "}", "}" ]
Same as {@link #set(int, int, double)} but does not check to see if row and column are within bounds. @param row Matrix element's row index. @param col Matrix element's column index. @param value value of element.
[ "Same", "as", "{", "@link", "#set", "(", "int", "int", "double", ")", "}", "but", "does", "not", "check", "to", "see", "if", "row", "and", "column", "are", "within", "bounds", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/data/DMatrixSparseTriplet.java#L169-L177
landawn/AbacusUtil
src/com/landawn/abacus/util/ClassUtil.java
ClassUtil.setPropValue
public static void setPropValue(final Object entity, final Method propSetMethod, Object propValue) { """ Set the specified {@code propValue} to {@code entity} by the specified method {@code propSetMethod}. This method will try to convert {@code propValue} to appropriate type and set again if fails to set in the first time. The final value which is set to the property will be returned if property is set successfully finally. it could be the input {@code propValue} or converted property value, otherwise, exception will be threw if the property value is set unsuccessfully. @param entity MapEntity is not supported @param propSetMethod @param propValue """ try { propSetMethod.invoke(entity, propValue == null ? N.defaultValueOf(propSetMethod.getParameterTypes()[0]) : propValue); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { propValue = N.convert(propValue, ParserUtil.getEntityInfo(entity.getClass()).getPropInfo(propSetMethod.getName()).type); try { propSetMethod.invoke(entity, propValue); } catch (IllegalAccessException | InvocationTargetException e2) { throw N.toRuntimeException(e); } } }
java
public static void setPropValue(final Object entity, final Method propSetMethod, Object propValue) { try { propSetMethod.invoke(entity, propValue == null ? N.defaultValueOf(propSetMethod.getParameterTypes()[0]) : propValue); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { propValue = N.convert(propValue, ParserUtil.getEntityInfo(entity.getClass()).getPropInfo(propSetMethod.getName()).type); try { propSetMethod.invoke(entity, propValue); } catch (IllegalAccessException | InvocationTargetException e2) { throw N.toRuntimeException(e); } } }
[ "public", "static", "void", "setPropValue", "(", "final", "Object", "entity", ",", "final", "Method", "propSetMethod", ",", "Object", "propValue", ")", "{", "try", "{", "propSetMethod", ".", "invoke", "(", "entity", ",", "propValue", "==", "null", "?", "N", ".", "defaultValueOf", "(", "propSetMethod", ".", "getParameterTypes", "(", ")", "[", "0", "]", ")", ":", "propValue", ")", ";", "}", "catch", "(", "IllegalAccessException", "|", "IllegalArgumentException", "|", "InvocationTargetException", "e", ")", "{", "propValue", "=", "N", ".", "convert", "(", "propValue", ",", "ParserUtil", ".", "getEntityInfo", "(", "entity", ".", "getClass", "(", ")", ")", ".", "getPropInfo", "(", "propSetMethod", ".", "getName", "(", ")", ")", ".", "type", ")", ";", "try", "{", "propSetMethod", ".", "invoke", "(", "entity", ",", "propValue", ")", ";", "}", "catch", "(", "IllegalAccessException", "|", "InvocationTargetException", "e2", ")", "{", "throw", "N", ".", "toRuntimeException", "(", "e", ")", ";", "}", "}", "}" ]
Set the specified {@code propValue} to {@code entity} by the specified method {@code propSetMethod}. This method will try to convert {@code propValue} to appropriate type and set again if fails to set in the first time. The final value which is set to the property will be returned if property is set successfully finally. it could be the input {@code propValue} or converted property value, otherwise, exception will be threw if the property value is set unsuccessfully. @param entity MapEntity is not supported @param propSetMethod @param propValue
[ "Set", "the", "specified", "{", "@code", "propValue", "}", "to", "{", "@code", "entity", "}", "by", "the", "specified", "method", "{", "@code", "propSetMethod", "}", ".", "This", "method", "will", "try", "to", "convert", "{", "@code", "propValue", "}", "to", "appropriate", "type", "and", "set", "again", "if", "fails", "to", "set", "in", "the", "first", "time", ".", "The", "final", "value", "which", "is", "set", "to", "the", "property", "will", "be", "returned", "if", "property", "is", "set", "successfully", "finally", ".", "it", "could", "be", "the", "input", "{", "@code", "propValue", "}", "or", "converted", "property", "value", "otherwise", "exception", "will", "be", "threw", "if", "the", "property", "value", "is", "set", "unsuccessfully", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/ClassUtil.java#L1787-L1799
lucee/Lucee
core/src/main/java/lucee/runtime/op/Caster.java
Caster.toLongValue
public static long toLongValue(String str) throws PageException { """ cast a Object to a long value (primitive value type) @param str Object to cast @return casted long value @throws PageException """ BigInteger bi = null; try { bi = new BigInteger(str); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); } if (bi != null) { if (bi.bitLength() < 64) return bi.longValue(); throw new ApplicationException("number [" + str + "] cannot be casted to a long value, number is to long (" + (bi.bitLength() + 1) + " bit)"); } return (long) toDoubleValue(str); }
java
public static long toLongValue(String str) throws PageException { BigInteger bi = null; try { bi = new BigInteger(str); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); } if (bi != null) { if (bi.bitLength() < 64) return bi.longValue(); throw new ApplicationException("number [" + str + "] cannot be casted to a long value, number is to long (" + (bi.bitLength() + 1) + " bit)"); } return (long) toDoubleValue(str); }
[ "public", "static", "long", "toLongValue", "(", "String", "str", ")", "throws", "PageException", "{", "BigInteger", "bi", "=", "null", ";", "try", "{", "bi", "=", "new", "BigInteger", "(", "str", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "ExceptionUtil", ".", "rethrowIfNecessary", "(", "t", ")", ";", "}", "if", "(", "bi", "!=", "null", ")", "{", "if", "(", "bi", ".", "bitLength", "(", ")", "<", "64", ")", "return", "bi", ".", "longValue", "(", ")", ";", "throw", "new", "ApplicationException", "(", "\"number [\"", "+", "str", "+", "\"] cannot be casted to a long value, number is to long (\"", "+", "(", "bi", ".", "bitLength", "(", ")", "+", "1", ")", "+", "\" bit)\"", ")", ";", "}", "return", "(", "long", ")", "toDoubleValue", "(", "str", ")", ";", "}" ]
cast a Object to a long value (primitive value type) @param str Object to cast @return casted long value @throws PageException
[ "cast", "a", "Object", "to", "a", "long", "value", "(", "primitive", "value", "type", ")" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Caster.java#L1409-L1423
Falydoor/limesurvey-rc
src/main/java/com/github/falydoor/limesurveyrc/LimesurveyRC.java
LimesurveyRC.getSurveys
public Stream<LsSurvey> getSurveys() throws LimesurveyRCException { """ Gets all surveys. @return a stream of surveys @throws LimesurveyRCException the limesurvey rc exception """ JsonElement result = callRC(new LsApiBody("list_surveys", getParamsWithKey())); List<LsSurvey> surveys = gson.fromJson(result, new TypeToken<List<LsSurvey>>() { }.getType()); return surveys.stream(); }
java
public Stream<LsSurvey> getSurveys() throws LimesurveyRCException { JsonElement result = callRC(new LsApiBody("list_surveys", getParamsWithKey())); List<LsSurvey> surveys = gson.fromJson(result, new TypeToken<List<LsSurvey>>() { }.getType()); return surveys.stream(); }
[ "public", "Stream", "<", "LsSurvey", ">", "getSurveys", "(", ")", "throws", "LimesurveyRCException", "{", "JsonElement", "result", "=", "callRC", "(", "new", "LsApiBody", "(", "\"list_surveys\"", ",", "getParamsWithKey", "(", ")", ")", ")", ";", "List", "<", "LsSurvey", ">", "surveys", "=", "gson", ".", "fromJson", "(", "result", ",", "new", "TypeToken", "<", "List", "<", "LsSurvey", ">", ">", "(", ")", "{", "}", ".", "getType", "(", ")", ")", ";", "return", "surveys", ".", "stream", "(", ")", ";", "}" ]
Gets all surveys. @return a stream of surveys @throws LimesurveyRCException the limesurvey rc exception
[ "Gets", "all", "surveys", "." ]
train
https://github.com/Falydoor/limesurvey-rc/blob/b8d573389086395e46a0bdeeddeef4d1c2c0a488/src/main/java/com/github/falydoor/limesurveyrc/LimesurveyRC.java#L325-L331
line/armeria
core/src/main/java/com/linecorp/armeria/client/Endpoint.java
Endpoint.of
public static Endpoint of(String host, int port) { """ Creates a new host {@link Endpoint}. @throws IllegalArgumentException if {@code host} is not a valid host name or {@code port} is not a valid port number """ validatePort("port", port); return create(host, port); }
java
public static Endpoint of(String host, int port) { validatePort("port", port); return create(host, port); }
[ "public", "static", "Endpoint", "of", "(", "String", "host", ",", "int", "port", ")", "{", "validatePort", "(", "\"port\"", ",", "port", ")", ";", "return", "create", "(", "host", ",", "port", ")", ";", "}" ]
Creates a new host {@link Endpoint}. @throws IllegalArgumentException if {@code host} is not a valid host name or {@code port} is not a valid port number
[ "Creates", "a", "new", "host", "{", "@link", "Endpoint", "}", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/Endpoint.java#L91-L94
facebook/SoLoader
java/com/facebook/soloader/SysUtil.java
SysUtil.copyBytes
static int copyBytes(RandomAccessFile os, InputStream is, int byteLimit, byte[] buffer) throws IOException { """ Copy up to byteLimit bytes from the input stream to the output stream. @param os Destination stream @param is Input stream @param byteLimit Maximum number of bytes to copy @param buffer IO buffer to use @return Number of bytes actually copied """ // Yes, this method is exactly the same as the above, just with a different type for `os'. int bytesCopied = 0; int nrRead; while (bytesCopied < byteLimit && (nrRead = is.read( buffer, 0, Math.min(buffer.length, byteLimit - bytesCopied))) != -1) { os.write(buffer, 0, nrRead); bytesCopied += nrRead; } return bytesCopied; }
java
static int copyBytes(RandomAccessFile os, InputStream is, int byteLimit, byte[] buffer) throws IOException { // Yes, this method is exactly the same as the above, just with a different type for `os'. int bytesCopied = 0; int nrRead; while (bytesCopied < byteLimit && (nrRead = is.read( buffer, 0, Math.min(buffer.length, byteLimit - bytesCopied))) != -1) { os.write(buffer, 0, nrRead); bytesCopied += nrRead; } return bytesCopied; }
[ "static", "int", "copyBytes", "(", "RandomAccessFile", "os", ",", "InputStream", "is", ",", "int", "byteLimit", ",", "byte", "[", "]", "buffer", ")", "throws", "IOException", "{", "// Yes, this method is exactly the same as the above, just with a different type for `os'.", "int", "bytesCopied", "=", "0", ";", "int", "nrRead", ";", "while", "(", "bytesCopied", "<", "byteLimit", "&&", "(", "nrRead", "=", "is", ".", "read", "(", "buffer", ",", "0", ",", "Math", ".", "min", "(", "buffer", ".", "length", ",", "byteLimit", "-", "bytesCopied", ")", ")", ")", "!=", "-", "1", ")", "{", "os", ".", "write", "(", "buffer", ",", "0", ",", "nrRead", ")", ";", "bytesCopied", "+=", "nrRead", ";", "}", "return", "bytesCopied", ";", "}" ]
Copy up to byteLimit bytes from the input stream to the output stream. @param os Destination stream @param is Input stream @param byteLimit Maximum number of bytes to copy @param buffer IO buffer to use @return Number of bytes actually copied
[ "Copy", "up", "to", "byteLimit", "bytes", "from", "the", "input", "stream", "to", "the", "output", "stream", "." ]
train
https://github.com/facebook/SoLoader/blob/263af31d2960b2c0d0afe79d80197165a543be86/java/com/facebook/soloader/SysUtil.java#L162-L176
aws/aws-cloudtrail-processing-library
src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/serializer/RawLogDeliveryEventSerializer.java
RawLogDeliveryEventSerializer.getMetadata
@Override public CloudTrailEventMetadata getMetadata(int charStart, int charEnd) { """ Find the raw event in string format from logFileContent based on character start index and end index. """ // Use Jackson getTokenLocation API only return the , (Comma) position, we need to advance to first open curly brace. String rawEvent = logFile.substring(charStart, charEnd+1); int offset = rawEvent.indexOf("{"); rawEvent = rawEvent.substring(offset); CloudTrailEventMetadata metadata = new LogDeliveryInfo(ctLog, charStart + offset, charEnd, rawEvent); return metadata; }
java
@Override public CloudTrailEventMetadata getMetadata(int charStart, int charEnd) { // Use Jackson getTokenLocation API only return the , (Comma) position, we need to advance to first open curly brace. String rawEvent = logFile.substring(charStart, charEnd+1); int offset = rawEvent.indexOf("{"); rawEvent = rawEvent.substring(offset); CloudTrailEventMetadata metadata = new LogDeliveryInfo(ctLog, charStart + offset, charEnd, rawEvent); return metadata; }
[ "@", "Override", "public", "CloudTrailEventMetadata", "getMetadata", "(", "int", "charStart", ",", "int", "charEnd", ")", "{", "// Use Jackson getTokenLocation API only return the , (Comma) position, we need to advance to first open curly brace.", "String", "rawEvent", "=", "logFile", ".", "substring", "(", "charStart", ",", "charEnd", "+", "1", ")", ";", "int", "offset", "=", "rawEvent", ".", "indexOf", "(", "\"{\"", ")", ";", "rawEvent", "=", "rawEvent", ".", "substring", "(", "offset", ")", ";", "CloudTrailEventMetadata", "metadata", "=", "new", "LogDeliveryInfo", "(", "ctLog", ",", "charStart", "+", "offset", ",", "charEnd", ",", "rawEvent", ")", ";", "return", "metadata", ";", "}" ]
Find the raw event in string format from logFileContent based on character start index and end index.
[ "Find", "the", "raw", "event", "in", "string", "format", "from", "logFileContent", "based", "on", "character", "start", "index", "and", "end", "index", "." ]
train
https://github.com/aws/aws-cloudtrail-processing-library/blob/411315808d8d3dc6b45e4182212e3e04d82e3782/src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/serializer/RawLogDeliveryEventSerializer.java#L42-L50
overturetool/overture
core/typechecker/src/main/java/org/overture/typechecker/TypeComparator.java
TypeComparator.searchCompatible
private Result searchCompatible(PType to, PType from, boolean paramOnly) { """ Search the {@link #done} vector for an existing comparison of two types before either returning the previous result, or making a new comparison and adding that result to the vector. @param to @param from @return Yes or No. """ TypePair pair = new TypePair(to, from); int i = done.indexOf(pair); if (i >= 0) { return done.get(i).result; // May be "Maybe". } else { done.add(pair); } // The pair.result is "Maybe" until this call returns. pair.result = test(to, from, paramOnly); return pair.result; }
java
private Result searchCompatible(PType to, PType from, boolean paramOnly) { TypePair pair = new TypePair(to, from); int i = done.indexOf(pair); if (i >= 0) { return done.get(i).result; // May be "Maybe". } else { done.add(pair); } // The pair.result is "Maybe" until this call returns. pair.result = test(to, from, paramOnly); return pair.result; }
[ "private", "Result", "searchCompatible", "(", "PType", "to", ",", "PType", "from", ",", "boolean", "paramOnly", ")", "{", "TypePair", "pair", "=", "new", "TypePair", "(", "to", ",", "from", ")", ";", "int", "i", "=", "done", ".", "indexOf", "(", "pair", ")", ";", "if", "(", "i", ">=", "0", ")", "{", "return", "done", ".", "get", "(", "i", ")", ".", "result", ";", "// May be \"Maybe\".", "}", "else", "{", "done", ".", "add", "(", "pair", ")", ";", "}", "// The pair.result is \"Maybe\" until this call returns.", "pair", ".", "result", "=", "test", "(", "to", ",", "from", ",", "paramOnly", ")", ";", "return", "pair", ".", "result", ";", "}" ]
Search the {@link #done} vector for an existing comparison of two types before either returning the previous result, or making a new comparison and adding that result to the vector. @param to @param from @return Yes or No.
[ "Search", "the", "{", "@link", "#done", "}", "vector", "for", "an", "existing", "comparison", "of", "two", "types", "before", "either", "returning", "the", "previous", "result", "or", "making", "a", "new", "comparison", "and", "adding", "that", "result", "to", "the", "vector", "." ]
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/typechecker/src/main/java/org/overture/typechecker/TypeComparator.java#L200-L217
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/fieldprocessor/FieldProcessorRegistry.java
FieldProcessorRegistry.registerProcessor
public <A extends Annotation> void registerProcessor(final Class<A> annoClass, final FieldProcessor<A> processor) { """ アノテーションに対する{@link FieldProcessor}を登録する。 @param annoClass 登録対象のアノテーションのクラスタイプ。 @param processor フィールドプロセッサーのインスタンス。{@link FieldProcessor}を実装している必要がある。 @throws NullPointerException {@literal annoClass == null or processor == null.} """ ArgUtils.notNull(annoClass, "annoClass"); ArgUtils.notNull(processor, "processor"); pocessorMap.put(annoClass, processor); }
java
public <A extends Annotation> void registerProcessor(final Class<A> annoClass, final FieldProcessor<A> processor) { ArgUtils.notNull(annoClass, "annoClass"); ArgUtils.notNull(processor, "processor"); pocessorMap.put(annoClass, processor); }
[ "public", "<", "A", "extends", "Annotation", ">", "void", "registerProcessor", "(", "final", "Class", "<", "A", ">", "annoClass", ",", "final", "FieldProcessor", "<", "A", ">", "processor", ")", "{", "ArgUtils", ".", "notNull", "(", "annoClass", ",", "\"annoClass\"", ")", ";", "ArgUtils", ".", "notNull", "(", "processor", ",", "\"processor\"", ")", ";", "pocessorMap", ".", "put", "(", "annoClass", ",", "processor", ")", ";", "}" ]
アノテーションに対する{@link FieldProcessor}を登録する。 @param annoClass 登録対象のアノテーションのクラスタイプ。 @param processor フィールドプロセッサーのインスタンス。{@link FieldProcessor}を実装している必要がある。 @throws NullPointerException {@literal annoClass == null or processor == null.}
[ "アノテーションに対する", "{" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/fieldprocessor/FieldProcessorRegistry.java#L82-L88
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/buffer/ST_OffSetCurve.java
ST_OffSetCurve.computeOffsetCurve
public static Geometry computeOffsetCurve(Geometry geometry, double offset, BufferParameters bufferParameters) { """ Method to compute the offset line @param geometry @param offset @param bufferParameters @return """ ArrayList<LineString> lineStrings = new ArrayList<LineString>(); for (int i = 0; i < geometry.getNumGeometries(); i++) { Geometry subGeom = geometry.getGeometryN(i); if (subGeom.getDimension() == 1) { lineStringOffSetCurve(lineStrings, (LineString) subGeom, offset, bufferParameters); } else { geometryOffSetCurve(lineStrings, subGeom, offset, bufferParameters); } } if (!lineStrings.isEmpty()) { if (lineStrings.size() == 1) { return lineStrings.get(0); } else { return geometry.getFactory().createMultiLineString(lineStrings.toArray(new LineString[0])); } } return null; }
java
public static Geometry computeOffsetCurve(Geometry geometry, double offset, BufferParameters bufferParameters) { ArrayList<LineString> lineStrings = new ArrayList<LineString>(); for (int i = 0; i < geometry.getNumGeometries(); i++) { Geometry subGeom = geometry.getGeometryN(i); if (subGeom.getDimension() == 1) { lineStringOffSetCurve(lineStrings, (LineString) subGeom, offset, bufferParameters); } else { geometryOffSetCurve(lineStrings, subGeom, offset, bufferParameters); } } if (!lineStrings.isEmpty()) { if (lineStrings.size() == 1) { return lineStrings.get(0); } else { return geometry.getFactory().createMultiLineString(lineStrings.toArray(new LineString[0])); } } return null; }
[ "public", "static", "Geometry", "computeOffsetCurve", "(", "Geometry", "geometry", ",", "double", "offset", ",", "BufferParameters", "bufferParameters", ")", "{", "ArrayList", "<", "LineString", ">", "lineStrings", "=", "new", "ArrayList", "<", "LineString", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "geometry", ".", "getNumGeometries", "(", ")", ";", "i", "++", ")", "{", "Geometry", "subGeom", "=", "geometry", ".", "getGeometryN", "(", "i", ")", ";", "if", "(", "subGeom", ".", "getDimension", "(", ")", "==", "1", ")", "{", "lineStringOffSetCurve", "(", "lineStrings", ",", "(", "LineString", ")", "subGeom", ",", "offset", ",", "bufferParameters", ")", ";", "}", "else", "{", "geometryOffSetCurve", "(", "lineStrings", ",", "subGeom", ",", "offset", ",", "bufferParameters", ")", ";", "}", "}", "if", "(", "!", "lineStrings", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "lineStrings", ".", "size", "(", ")", "==", "1", ")", "{", "return", "lineStrings", ".", "get", "(", "0", ")", ";", "}", "else", "{", "return", "geometry", ".", "getFactory", "(", ")", ".", "createMultiLineString", "(", "lineStrings", ".", "toArray", "(", "new", "LineString", "[", "0", "]", ")", ")", ";", "}", "}", "return", "null", ";", "}" ]
Method to compute the offset line @param geometry @param offset @param bufferParameters @return
[ "Method", "to", "compute", "the", "offset", "line" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/buffer/ST_OffSetCurve.java#L121-L139
TouK/sputnik
src/main/java/pl/touk/sputnik/processor/sonar/SonarProcessor.java
SonarProcessor.filterResults
@VisibleForTesting ReviewResult filterResults(ReviewResult results, Review review) { """ Filters a ReviewResult to keep only the violations that are about a file which is modified by a given review. """ ReviewResult filteredResults = new ReviewResult(); Set<String> reviewFiles = new HashSet<>(); for (ReviewFile file : review.getFiles()) { reviewFiles.add(file.getReviewFilename()); } for (Violation violation : results.getViolations()) { if (reviewFiles.contains(violation.getFilenameOrJavaClassName())) { filteredResults.add(violation); } } return filteredResults; }
java
@VisibleForTesting ReviewResult filterResults(ReviewResult results, Review review) { ReviewResult filteredResults = new ReviewResult(); Set<String> reviewFiles = new HashSet<>(); for (ReviewFile file : review.getFiles()) { reviewFiles.add(file.getReviewFilename()); } for (Violation violation : results.getViolations()) { if (reviewFiles.contains(violation.getFilenameOrJavaClassName())) { filteredResults.add(violation); } } return filteredResults; }
[ "@", "VisibleForTesting", "ReviewResult", "filterResults", "(", "ReviewResult", "results", ",", "Review", "review", ")", "{", "ReviewResult", "filteredResults", "=", "new", "ReviewResult", "(", ")", ";", "Set", "<", "String", ">", "reviewFiles", "=", "new", "HashSet", "<>", "(", ")", ";", "for", "(", "ReviewFile", "file", ":", "review", ".", "getFiles", "(", ")", ")", "{", "reviewFiles", ".", "add", "(", "file", ".", "getReviewFilename", "(", ")", ")", ";", "}", "for", "(", "Violation", "violation", ":", "results", ".", "getViolations", "(", ")", ")", "{", "if", "(", "reviewFiles", ".", "contains", "(", "violation", ".", "getFilenameOrJavaClassName", "(", ")", ")", ")", "{", "filteredResults", ".", "add", "(", "violation", ")", ";", "}", "}", "return", "filteredResults", ";", "}" ]
Filters a ReviewResult to keep only the violations that are about a file which is modified by a given review.
[ "Filters", "a", "ReviewResult", "to", "keep", "only", "the", "violations", "that", "are", "about", "a", "file", "which", "is", "modified", "by", "a", "given", "review", "." ]
train
https://github.com/TouK/sputnik/blob/64569e603d8837e800e3b3797b604a6942a7b5c5/src/main/java/pl/touk/sputnik/processor/sonar/SonarProcessor.java#L62-L75
sshtools/j2ssh-maverick
j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpClient.java
SftpClient.mkdirs
public void mkdirs(String dir) throws SftpStatusException, SshException { """ <p> Create a directory or set of directories. This method will not fail even if the directories exist. It is advisable to test whether the directory exists before attempting an operation by using <a href="#stat(java.lang.String)">stat</a> to return the directories attributes. </p> @param dir the path of directories to create. """ StringTokenizer tokens = new StringTokenizer(dir, "/"); String path = dir.startsWith("/") ? "/" : ""; while (tokens.hasMoreElements()) { path += (String) tokens.nextElement(); try { stat(path); } catch (SftpStatusException ex) { try { mkdir(path); } catch (SftpStatusException ex2) { if (ex2.getStatus() == SftpStatusException.SSH_FX_PERMISSION_DENIED) throw ex2; } } path += "/"; } }
java
public void mkdirs(String dir) throws SftpStatusException, SshException { StringTokenizer tokens = new StringTokenizer(dir, "/"); String path = dir.startsWith("/") ? "/" : ""; while (tokens.hasMoreElements()) { path += (String) tokens.nextElement(); try { stat(path); } catch (SftpStatusException ex) { try { mkdir(path); } catch (SftpStatusException ex2) { if (ex2.getStatus() == SftpStatusException.SSH_FX_PERMISSION_DENIED) throw ex2; } } path += "/"; } }
[ "public", "void", "mkdirs", "(", "String", "dir", ")", "throws", "SftpStatusException", ",", "SshException", "{", "StringTokenizer", "tokens", "=", "new", "StringTokenizer", "(", "dir", ",", "\"/\"", ")", ";", "String", "path", "=", "dir", ".", "startsWith", "(", "\"/\"", ")", "?", "\"/\"", ":", "\"\"", ";", "while", "(", "tokens", ".", "hasMoreElements", "(", ")", ")", "{", "path", "+=", "(", "String", ")", "tokens", ".", "nextElement", "(", ")", ";", "try", "{", "stat", "(", "path", ")", ";", "}", "catch", "(", "SftpStatusException", "ex", ")", "{", "try", "{", "mkdir", "(", "path", ")", ";", "}", "catch", "(", "SftpStatusException", "ex2", ")", "{", "if", "(", "ex2", ".", "getStatus", "(", ")", "==", "SftpStatusException", ".", "SSH_FX_PERMISSION_DENIED", ")", "throw", "ex2", ";", "}", "}", "path", "+=", "\"/\"", ";", "}", "}" ]
<p> Create a directory or set of directories. This method will not fail even if the directories exist. It is advisable to test whether the directory exists before attempting an operation by using <a href="#stat(java.lang.String)">stat</a> to return the directories attributes. </p> @param dir the path of directories to create.
[ "<p", ">", "Create", "a", "directory", "or", "set", "of", "directories", ".", "This", "method", "will", "not", "fail", "even", "if", "the", "directories", "exist", ".", "It", "is", "advisable", "to", "test", "whether", "the", "directory", "exists", "before", "attempting", "an", "operation", "by", "using", "<a", "href", "=", "#stat", "(", "java", ".", "lang", ".", "String", ")", ">", "stat<", "/", "a", ">", "to", "return", "the", "directories", "attributes", ".", "<", "/", "p", ">" ]
train
https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpClient.java#L630-L650
samskivert/samskivert
src/main/java/com/samskivert/jdbc/JORARepository.java
JORARepository.updateFields
protected <T> int updateFields ( final Table<T> table, final T object, String[] fields) throws PersistenceException { """ Updates the specified fields in the supplied object (which must correspond to the supplied table). @return the number of rows modified by the update. """ final FieldMask mask = table.getFieldMask(); for (int ii = 0; ii < fields.length; ii++) { mask.setModified(fields[ii]); } return executeUpdate(new Operation<Integer>() { public Integer invoke (Connection conn, DatabaseLiaison liaison) throws SQLException, PersistenceException { return table.update(conn, object, mask); } }); }
java
protected <T> int updateFields ( final Table<T> table, final T object, String[] fields) throws PersistenceException { final FieldMask mask = table.getFieldMask(); for (int ii = 0; ii < fields.length; ii++) { mask.setModified(fields[ii]); } return executeUpdate(new Operation<Integer>() { public Integer invoke (Connection conn, DatabaseLiaison liaison) throws SQLException, PersistenceException { return table.update(conn, object, mask); } }); }
[ "protected", "<", "T", ">", "int", "updateFields", "(", "final", "Table", "<", "T", ">", "table", ",", "final", "T", "object", ",", "String", "[", "]", "fields", ")", "throws", "PersistenceException", "{", "final", "FieldMask", "mask", "=", "table", ".", "getFieldMask", "(", ")", ";", "for", "(", "int", "ii", "=", "0", ";", "ii", "<", "fields", ".", "length", ";", "ii", "++", ")", "{", "mask", ".", "setModified", "(", "fields", "[", "ii", "]", ")", ";", "}", "return", "executeUpdate", "(", "new", "Operation", "<", "Integer", ">", "(", ")", "{", "public", "Integer", "invoke", "(", "Connection", "conn", ",", "DatabaseLiaison", "liaison", ")", "throws", "SQLException", ",", "PersistenceException", "{", "return", "table", ".", "update", "(", "conn", ",", "object", ",", "mask", ")", ";", "}", "}", ")", ";", "}" ]
Updates the specified fields in the supplied object (which must correspond to the supplied table). @return the number of rows modified by the update.
[ "Updates", "the", "specified", "fields", "in", "the", "supplied", "object", "(", "which", "must", "correspond", "to", "the", "supplied", "table", ")", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/jdbc/JORARepository.java#L287-L302
alkacon/opencms-core
src/org/opencms/main/OpenCmsCore.java
OpenCmsCore.getInstance
protected static OpenCmsCore getInstance() { """ Returns the initialized OpenCms singleton instance.<p> @return the initialized OpenCms singleton instance """ if (m_errorCondition != null) { // OpenCms is not properly initialized throw new CmsInitException(m_errorCondition, false); } if (m_instance != null) { return m_instance; } synchronized (LOCK) { if (m_instance == null) { try { // create a new core object with runlevel 1 m_instance = new OpenCmsCore(); } catch (CmsInitException e) { // already initialized, this is all we need LOG.debug(e.getMessage(), e); } } } return m_instance; }
java
protected static OpenCmsCore getInstance() { if (m_errorCondition != null) { // OpenCms is not properly initialized throw new CmsInitException(m_errorCondition, false); } if (m_instance != null) { return m_instance; } synchronized (LOCK) { if (m_instance == null) { try { // create a new core object with runlevel 1 m_instance = new OpenCmsCore(); } catch (CmsInitException e) { // already initialized, this is all we need LOG.debug(e.getMessage(), e); } } } return m_instance; }
[ "protected", "static", "OpenCmsCore", "getInstance", "(", ")", "{", "if", "(", "m_errorCondition", "!=", "null", ")", "{", "// OpenCms is not properly initialized", "throw", "new", "CmsInitException", "(", "m_errorCondition", ",", "false", ")", ";", "}", "if", "(", "m_instance", "!=", "null", ")", "{", "return", "m_instance", ";", "}", "synchronized", "(", "LOCK", ")", "{", "if", "(", "m_instance", "==", "null", ")", "{", "try", "{", "// create a new core object with runlevel 1", "m_instance", "=", "new", "OpenCmsCore", "(", ")", ";", "}", "catch", "(", "CmsInitException", "e", ")", "{", "// already initialized, this is all we need", "LOG", ".", "debug", "(", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "}", "}", "return", "m_instance", ";", "}" ]
Returns the initialized OpenCms singleton instance.<p> @return the initialized OpenCms singleton instance
[ "Returns", "the", "initialized", "OpenCms", "singleton", "instance", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/OpenCmsCore.java#L355-L377
wcm-io/wcm-io-tooling
commons/crx-packmgr-helper/src/main/java/io/wcm/tooling/commons/packmgr/PackageManagerHelper.java
PackageManagerHelper.executeHttpCallWithRetry
private <T> T executeHttpCallWithRetry(HttpCall<T> call, int runCount) { """ Execute HTTP call with automatic retry as configured for the MOJO. @param call HTTP call @param runCount Number of runs this call was already executed """ try { return call.execute(); } catch (PackageManagerHttpActionException ex) { // retry again if configured so... if (runCount < props.getRetryCount()) { log.info("ERROR: " + ex.getMessage()); log.debug("HTTP call failed.", ex); log.info("---------------"); StringBuilder msg = new StringBuilder(); msg.append("HTTP call failed, try again (" + (runCount + 1) + "/" + props.getRetryCount() + ")"); if (props.getRetryDelaySec() > 0) { msg.append(" after " + props.getRetryDelaySec() + " second(s)"); } msg.append("..."); log.info(msg); if (props.getRetryDelaySec() > 0) { try { Thread.sleep(props.getRetryDelaySec() * DateUtils.MILLIS_PER_SECOND); } catch (InterruptedException ex1) { // ignore } } return executeHttpCallWithRetry(call, runCount + 1); } else { throw ex; } } }
java
private <T> T executeHttpCallWithRetry(HttpCall<T> call, int runCount) { try { return call.execute(); } catch (PackageManagerHttpActionException ex) { // retry again if configured so... if (runCount < props.getRetryCount()) { log.info("ERROR: " + ex.getMessage()); log.debug("HTTP call failed.", ex); log.info("---------------"); StringBuilder msg = new StringBuilder(); msg.append("HTTP call failed, try again (" + (runCount + 1) + "/" + props.getRetryCount() + ")"); if (props.getRetryDelaySec() > 0) { msg.append(" after " + props.getRetryDelaySec() + " second(s)"); } msg.append("..."); log.info(msg); if (props.getRetryDelaySec() > 0) { try { Thread.sleep(props.getRetryDelaySec() * DateUtils.MILLIS_PER_SECOND); } catch (InterruptedException ex1) { // ignore } } return executeHttpCallWithRetry(call, runCount + 1); } else { throw ex; } } }
[ "private", "<", "T", ">", "T", "executeHttpCallWithRetry", "(", "HttpCall", "<", "T", ">", "call", ",", "int", "runCount", ")", "{", "try", "{", "return", "call", ".", "execute", "(", ")", ";", "}", "catch", "(", "PackageManagerHttpActionException", "ex", ")", "{", "// retry again if configured so...", "if", "(", "runCount", "<", "props", ".", "getRetryCount", "(", ")", ")", "{", "log", ".", "info", "(", "\"ERROR: \"", "+", "ex", ".", "getMessage", "(", ")", ")", ";", "log", ".", "debug", "(", "\"HTTP call failed.\"", ",", "ex", ")", ";", "log", ".", "info", "(", "\"---------------\"", ")", ";", "StringBuilder", "msg", "=", "new", "StringBuilder", "(", ")", ";", "msg", ".", "append", "(", "\"HTTP call failed, try again (\"", "+", "(", "runCount", "+", "1", ")", "+", "\"/\"", "+", "props", ".", "getRetryCount", "(", ")", "+", "\")\"", ")", ";", "if", "(", "props", ".", "getRetryDelaySec", "(", ")", ">", "0", ")", "{", "msg", ".", "append", "(", "\" after \"", "+", "props", ".", "getRetryDelaySec", "(", ")", "+", "\" second(s)\"", ")", ";", "}", "msg", ".", "append", "(", "\"...\"", ")", ";", "log", ".", "info", "(", "msg", ")", ";", "if", "(", "props", ".", "getRetryDelaySec", "(", ")", ">", "0", ")", "{", "try", "{", "Thread", ".", "sleep", "(", "props", ".", "getRetryDelaySec", "(", ")", "*", "DateUtils", ".", "MILLIS_PER_SECOND", ")", ";", "}", "catch", "(", "InterruptedException", "ex1", ")", "{", "// ignore", "}", "}", "return", "executeHttpCallWithRetry", "(", "call", ",", "runCount", "+", "1", ")", ";", "}", "else", "{", "throw", "ex", ";", "}", "}", "}" ]
Execute HTTP call with automatic retry as configured for the MOJO. @param call HTTP call @param runCount Number of runs this call was already executed
[ "Execute", "HTTP", "call", "with", "automatic", "retry", "as", "configured", "for", "the", "MOJO", "." ]
train
https://github.com/wcm-io/wcm-io-tooling/blob/1abcd01dd3ad4cc248f03b431f929573d84fa9b4/commons/crx-packmgr-helper/src/main/java/io/wcm/tooling/commons/packmgr/PackageManagerHelper.java#L180-L212
telly/groundy
library/src/main/java/com/telly/groundy/DeviceStatus.java
DeviceStatus.keepWiFiOn
public static void keepWiFiOn(Context context, boolean on) { """ Register a WiFi lock to WiFi management in the device. @param context Context to use @param on if true the device WiFi radio will keep awake until false is called back. if true is passed several times only the first time after a false call will take effect, also if false is passed and previously the WiFi radio was not turned on (true call) does nothing. """ if (wifiLock == null) { WifiManager wm = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); if (wm != null) { wifiLock = wm.createWifiLock(WifiManager.WIFI_MODE_FULL, TAG); wifiLock.setReferenceCounted(true); } } if (wifiLock != null) { // May be null if wm is null if (on) { wifiLock.acquire(); L.d(TAG, "Adquired WiFi lock"); } else if (wifiLock.isHeld()) { wifiLock.release(); L.d(TAG, "Released WiFi lock"); } } }
java
public static void keepWiFiOn(Context context, boolean on) { if (wifiLock == null) { WifiManager wm = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); if (wm != null) { wifiLock = wm.createWifiLock(WifiManager.WIFI_MODE_FULL, TAG); wifiLock.setReferenceCounted(true); } } if (wifiLock != null) { // May be null if wm is null if (on) { wifiLock.acquire(); L.d(TAG, "Adquired WiFi lock"); } else if (wifiLock.isHeld()) { wifiLock.release(); L.d(TAG, "Released WiFi lock"); } } }
[ "public", "static", "void", "keepWiFiOn", "(", "Context", "context", ",", "boolean", "on", ")", "{", "if", "(", "wifiLock", "==", "null", ")", "{", "WifiManager", "wm", "=", "(", "WifiManager", ")", "context", ".", "getSystemService", "(", "Context", ".", "WIFI_SERVICE", ")", ";", "if", "(", "wm", "!=", "null", ")", "{", "wifiLock", "=", "wm", ".", "createWifiLock", "(", "WifiManager", ".", "WIFI_MODE_FULL", ",", "TAG", ")", ";", "wifiLock", ".", "setReferenceCounted", "(", "true", ")", ";", "}", "}", "if", "(", "wifiLock", "!=", "null", ")", "{", "// May be null if wm is null", "if", "(", "on", ")", "{", "wifiLock", ".", "acquire", "(", ")", ";", "L", ".", "d", "(", "TAG", ",", "\"Adquired WiFi lock\"", ")", ";", "}", "else", "if", "(", "wifiLock", ".", "isHeld", "(", ")", ")", "{", "wifiLock", ".", "release", "(", ")", ";", "L", ".", "d", "(", "TAG", ",", "\"Released WiFi lock\"", ")", ";", "}", "}", "}" ]
Register a WiFi lock to WiFi management in the device. @param context Context to use @param on if true the device WiFi radio will keep awake until false is called back. if true is passed several times only the first time after a false call will take effect, also if false is passed and previously the WiFi radio was not turned on (true call) does nothing.
[ "Register", "a", "WiFi", "lock", "to", "WiFi", "management", "in", "the", "device", "." ]
train
https://github.com/telly/groundy/blob/e90baf9901a8be20b348bd1575d5ad782560cec8/library/src/main/java/com/telly/groundy/DeviceStatus.java#L117-L134
openengsb/openengsb
components/edbi/jdbc/src/main/java/org/openengsb/core/edbi/jdbc/driver/h2/SchemaCreateCommand.java
SchemaCreateCommand.execute
public void execute() { """ Creates the necessary relations to save Index and IndexField instances. """ try { new JdbcTemplate(dataSource).execute(readResourceContent(SCHEMA_FILE)); // TODO: sql independence } catch (IOException e) { throw new RuntimeException("Could not create schema for EDBI Index", e); } }
java
public void execute() { try { new JdbcTemplate(dataSource).execute(readResourceContent(SCHEMA_FILE)); // TODO: sql independence } catch (IOException e) { throw new RuntimeException("Could not create schema for EDBI Index", e); } }
[ "public", "void", "execute", "(", ")", "{", "try", "{", "new", "JdbcTemplate", "(", "dataSource", ")", ".", "execute", "(", "readResourceContent", "(", "SCHEMA_FILE", ")", ")", ";", "// TODO: sql independence", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Could not create schema for EDBI Index\"", ",", "e", ")", ";", "}", "}" ]
Creates the necessary relations to save Index and IndexField instances.
[ "Creates", "the", "necessary", "relations", "to", "save", "Index", "and", "IndexField", "instances", "." ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/edbi/jdbc/src/main/java/org/openengsb/core/edbi/jdbc/driver/h2/SchemaCreateCommand.java#L44-L50
aws/aws-sdk-java
aws-java-sdk-greengrass/src/main/java/com/amazonaws/services/greengrass/model/CreateResourceDefinitionRequest.java
CreateResourceDefinitionRequest.withTags
public CreateResourceDefinitionRequest withTags(java.util.Map<String, String> tags) { """ Tag(s) to add to the new resource @param tags Tag(s) to add to the new resource @return Returns a reference to this object so that method calls can be chained together. """ setTags(tags); return this; }
java
public CreateResourceDefinitionRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "CreateResourceDefinitionRequest", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
Tag(s) to add to the new resource @param tags Tag(s) to add to the new resource @return Returns a reference to this object so that method calls can be chained together.
[ "Tag", "(", "s", ")", "to", "add", "to", "the", "new", "resource" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-greengrass/src/main/java/com/amazonaws/services/greengrass/model/CreateResourceDefinitionRequest.java#L168-L171
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/dimension/SizeLong.java
SizeLong.getBestMatchingSize
@Nonnull @CheckReturnValue public SizeLong getBestMatchingSize (@Nonnegative final long nMaxWidth, @Nonnegative final long nMaxHeight) { """ Return the scaled width and height relative to a maximum size. @param nMaxWidth Maximum width. Must be &gt; 0. @param nMaxHeight Maximum height. Must be &gt; 0. @return An array with 2 elements, where the first element is the width, and the second is the height. """ ValueEnforcer.isGT0 (nMaxWidth, "MaxWidth"); ValueEnforcer.isGT0 (nMaxHeight, "MaxHeight"); final double dRelWidth = MathHelper.getDividedDouble (m_nWidth, nMaxWidth); final double dRelHeight = MathHelper.getDividedDouble (m_nHeight, nMaxHeight); if (dRelWidth > dRelHeight) { if (m_nWidth > nMaxWidth) return new SizeLong (nMaxWidth, (long) (m_nHeight / dRelWidth)); } else { if (m_nHeight > nMaxHeight) return new SizeLong ((long) (m_nWidth / dRelHeight), nMaxHeight); } return this; }
java
@Nonnull @CheckReturnValue public SizeLong getBestMatchingSize (@Nonnegative final long nMaxWidth, @Nonnegative final long nMaxHeight) { ValueEnforcer.isGT0 (nMaxWidth, "MaxWidth"); ValueEnforcer.isGT0 (nMaxHeight, "MaxHeight"); final double dRelWidth = MathHelper.getDividedDouble (m_nWidth, nMaxWidth); final double dRelHeight = MathHelper.getDividedDouble (m_nHeight, nMaxHeight); if (dRelWidth > dRelHeight) { if (m_nWidth > nMaxWidth) return new SizeLong (nMaxWidth, (long) (m_nHeight / dRelWidth)); } else { if (m_nHeight > nMaxHeight) return new SizeLong ((long) (m_nWidth / dRelHeight), nMaxHeight); } return this; }
[ "@", "Nonnull", "@", "CheckReturnValue", "public", "SizeLong", "getBestMatchingSize", "(", "@", "Nonnegative", "final", "long", "nMaxWidth", ",", "@", "Nonnegative", "final", "long", "nMaxHeight", ")", "{", "ValueEnforcer", ".", "isGT0", "(", "nMaxWidth", ",", "\"MaxWidth\"", ")", ";", "ValueEnforcer", ".", "isGT0", "(", "nMaxHeight", ",", "\"MaxHeight\"", ")", ";", "final", "double", "dRelWidth", "=", "MathHelper", ".", "getDividedDouble", "(", "m_nWidth", ",", "nMaxWidth", ")", ";", "final", "double", "dRelHeight", "=", "MathHelper", ".", "getDividedDouble", "(", "m_nHeight", ",", "nMaxHeight", ")", ";", "if", "(", "dRelWidth", ">", "dRelHeight", ")", "{", "if", "(", "m_nWidth", ">", "nMaxWidth", ")", "return", "new", "SizeLong", "(", "nMaxWidth", ",", "(", "long", ")", "(", "m_nHeight", "/", "dRelWidth", ")", ")", ";", "}", "else", "{", "if", "(", "m_nHeight", ">", "nMaxHeight", ")", "return", "new", "SizeLong", "(", "(", "long", ")", "(", "m_nWidth", "/", "dRelHeight", ")", ",", "nMaxHeight", ")", ";", "}", "return", "this", ";", "}" ]
Return the scaled width and height relative to a maximum size. @param nMaxWidth Maximum width. Must be &gt; 0. @param nMaxHeight Maximum height. Must be &gt; 0. @return An array with 2 elements, where the first element is the width, and the second is the height.
[ "Return", "the", "scaled", "width", "and", "height", "relative", "to", "a", "maximum", "size", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/dimension/SizeLong.java#L80-L100
belaban/JGroups
src/org/jgroups/util/MessageBatch.java
MessageBatch.replaceIf
public int replaceIf(Predicate<Message> filter, Message replacement, boolean match_all) { """ Replaces all messages that match a given filter with a replacement message @param filter the filter. If null, no changes take place. Note that filter needs to be able to handle null msgs @param replacement the replacement message. Can be null, which essentially removes all messages matching filter @param match_all whether to replace the first or all matches @return the number of matched messages """ if(filter == null) return 0; int matched=0; for(int i=0; i < index; i++) { if(filter.test(messages[i])) { messages[i]=replacement; matched++; if(!match_all) break; } } return matched; }
java
public int replaceIf(Predicate<Message> filter, Message replacement, boolean match_all) { if(filter == null) return 0; int matched=0; for(int i=0; i < index; i++) { if(filter.test(messages[i])) { messages[i]=replacement; matched++; if(!match_all) break; } } return matched; }
[ "public", "int", "replaceIf", "(", "Predicate", "<", "Message", ">", "filter", ",", "Message", "replacement", ",", "boolean", "match_all", ")", "{", "if", "(", "filter", "==", "null", ")", "return", "0", ";", "int", "matched", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "index", ";", "i", "++", ")", "{", "if", "(", "filter", ".", "test", "(", "messages", "[", "i", "]", ")", ")", "{", "messages", "[", "i", "]", "=", "replacement", ";", "matched", "++", ";", "if", "(", "!", "match_all", ")", "break", ";", "}", "}", "return", "matched", ";", "}" ]
Replaces all messages that match a given filter with a replacement message @param filter the filter. If null, no changes take place. Note that filter needs to be able to handle null msgs @param replacement the replacement message. Can be null, which essentially removes all messages matching filter @param match_all whether to replace the first or all matches @return the number of matched messages
[ "Replaces", "all", "messages", "that", "match", "a", "given", "filter", "with", "a", "replacement", "message" ]
train
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/MessageBatch.java#L215-L228
alkacon/opencms-core
src/org/opencms/ui/components/CmsBasicDialog.java
CmsBasicDialog.createResourceListPanelDirectly
protected Panel createResourceListPanelDirectly(String caption, List<CmsResourceInfo> resourceInfo) { """ Creates a resource list panel.<p> @param caption the caption to use @param resourceInfo the resource-infos @return the panel """ Panel result = new Panel(caption); result.addStyleName("v-scrollable"); result.setSizeFull(); VerticalLayout resourcePanel = new VerticalLayout(); result.setContent(resourcePanel); resourcePanel.addStyleName(OpenCmsTheme.REDUCED_MARGIN); resourcePanel.addStyleName(OpenCmsTheme.REDUCED_SPACING); resourcePanel.setSpacing(true); resourcePanel.setMargin(true); for (CmsResourceInfo resource : resourceInfo) { resourcePanel.addComponent(resource); } return result; }
java
protected Panel createResourceListPanelDirectly(String caption, List<CmsResourceInfo> resourceInfo) { Panel result = new Panel(caption); result.addStyleName("v-scrollable"); result.setSizeFull(); VerticalLayout resourcePanel = new VerticalLayout(); result.setContent(resourcePanel); resourcePanel.addStyleName(OpenCmsTheme.REDUCED_MARGIN); resourcePanel.addStyleName(OpenCmsTheme.REDUCED_SPACING); resourcePanel.setSpacing(true); resourcePanel.setMargin(true); for (CmsResourceInfo resource : resourceInfo) { resourcePanel.addComponent(resource); } return result; }
[ "protected", "Panel", "createResourceListPanelDirectly", "(", "String", "caption", ",", "List", "<", "CmsResourceInfo", ">", "resourceInfo", ")", "{", "Panel", "result", "=", "new", "Panel", "(", "caption", ")", ";", "result", ".", "addStyleName", "(", "\"v-scrollable\"", ")", ";", "result", ".", "setSizeFull", "(", ")", ";", "VerticalLayout", "resourcePanel", "=", "new", "VerticalLayout", "(", ")", ";", "result", ".", "setContent", "(", "resourcePanel", ")", ";", "resourcePanel", ".", "addStyleName", "(", "OpenCmsTheme", ".", "REDUCED_MARGIN", ")", ";", "resourcePanel", ".", "addStyleName", "(", "OpenCmsTheme", ".", "REDUCED_SPACING", ")", ";", "resourcePanel", ".", "setSpacing", "(", "true", ")", ";", "resourcePanel", ".", "setMargin", "(", "true", ")", ";", "for", "(", "CmsResourceInfo", "resource", ":", "resourceInfo", ")", "{", "resourcePanel", ".", "addComponent", "(", "resource", ")", ";", "}", "return", "result", ";", "}" ]
Creates a resource list panel.<p> @param caption the caption to use @param resourceInfo the resource-infos @return the panel
[ "Creates", "a", "resource", "list", "panel", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/CmsBasicDialog.java#L543-L558
tianjing/tgtools.web.develop
src/main/java/tgtools/web/develop/service/AbstractCommonService.java
AbstractCommonService.listPage
@Override public GridMessage listPage(int pPageIndex, int pPageSize) { """ 获取分页的表格数据 @param pPageIndex 页码 从1开始 @param pPageSize 页大小 @return """ GridMessage data = new GridMessage(); data.setData(invokePage(pPageIndex, pPageSize)); data.setTotal(mDao.selectCount(null)); return data; }
java
@Override public GridMessage listPage(int pPageIndex, int pPageSize) { GridMessage data = new GridMessage(); data.setData(invokePage(pPageIndex, pPageSize)); data.setTotal(mDao.selectCount(null)); return data; }
[ "@", "Override", "public", "GridMessage", "listPage", "(", "int", "pPageIndex", ",", "int", "pPageSize", ")", "{", "GridMessage", "data", "=", "new", "GridMessage", "(", ")", ";", "data", ".", "setData", "(", "invokePage", "(", "pPageIndex", ",", "pPageSize", ")", ")", ";", "data", ".", "setTotal", "(", "mDao", ".", "selectCount", "(", "null", ")", ")", ";", "return", "data", ";", "}" ]
获取分页的表格数据 @param pPageIndex 页码 从1开始 @param pPageSize 页大小 @return
[ "获取分页的表格数据" ]
train
https://github.com/tianjing/tgtools.web.develop/blob/a18567f3ccf877249f2e33028d1e7c479900e4eb/src/main/java/tgtools/web/develop/service/AbstractCommonService.java#L69-L75
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/tuple/QuickSelectSketch.java
QuickSelectSketch.merge
@SuppressWarnings("unchecked") void merge(final long key, final S summary, final SummarySetOperations<S> summarySetOps) { """ not sufficient by itself without keeping track of theta of another sketch """ isEmpty_ = false; if (key < theta_) { final int index = findOrInsert(key); if (index < 0) { insertSummary(~index, (S)summary.copy()); } else { insertSummary(index, summarySetOps.union(summaries_[index], summary)); } rebuildIfNeeded(); } }
java
@SuppressWarnings("unchecked") void merge(final long key, final S summary, final SummarySetOperations<S> summarySetOps) { isEmpty_ = false; if (key < theta_) { final int index = findOrInsert(key); if (index < 0) { insertSummary(~index, (S)summary.copy()); } else { insertSummary(index, summarySetOps.union(summaries_[index], summary)); } rebuildIfNeeded(); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "void", "merge", "(", "final", "long", "key", ",", "final", "S", "summary", ",", "final", "SummarySetOperations", "<", "S", ">", "summarySetOps", ")", "{", "isEmpty_", "=", "false", ";", "if", "(", "key", "<", "theta_", ")", "{", "final", "int", "index", "=", "findOrInsert", "(", "key", ")", ";", "if", "(", "index", "<", "0", ")", "{", "insertSummary", "(", "~", "index", ",", "(", "S", ")", "summary", ".", "copy", "(", ")", ")", ";", "}", "else", "{", "insertSummary", "(", "index", ",", "summarySetOps", ".", "union", "(", "summaries_", "[", "index", "]", ",", "summary", ")", ")", ";", "}", "rebuildIfNeeded", "(", ")", ";", "}", "}" ]
not sufficient by itself without keeping track of theta of another sketch
[ "not", "sufficient", "by", "itself", "without", "keeping", "track", "of", "theta", "of", "another", "sketch" ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/tuple/QuickSelectSketch.java#L363-L375
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Normalizer.java
Normalizer.setOption
@Deprecated public void setOption(int option,boolean value) { """ Set options that affect this <tt>Normalizer</tt>'s operation. Options do not change the basic composition or decomposition operation that is being performed , but they control whether certain optional portions of the operation are done. Currently the only available option is: <ul> <li>{@link #UNICODE_3_2} - Use Normalization conforming to Unicode version 3.2. </ul> @param option the option whose value is to be set. @param value the new setting for the option. Use <tt>true</tt> to turn the option on and <tt>false</tt> to turn it off. @see #getOption @deprecated ICU 56 @hide original deprecated declaration """ if (value) { options |= option; } else { options &= (~option); } norm2 = mode.getNormalizer2(options); }
java
@Deprecated public void setOption(int option,boolean value) { if (value) { options |= option; } else { options &= (~option); } norm2 = mode.getNormalizer2(options); }
[ "@", "Deprecated", "public", "void", "setOption", "(", "int", "option", ",", "boolean", "value", ")", "{", "if", "(", "value", ")", "{", "options", "|=", "option", ";", "}", "else", "{", "options", "&=", "(", "~", "option", ")", ";", "}", "norm2", "=", "mode", ".", "getNormalizer2", "(", "options", ")", ";", "}" ]
Set options that affect this <tt>Normalizer</tt>'s operation. Options do not change the basic composition or decomposition operation that is being performed , but they control whether certain optional portions of the operation are done. Currently the only available option is: <ul> <li>{@link #UNICODE_3_2} - Use Normalization conforming to Unicode version 3.2. </ul> @param option the option whose value is to be set. @param value the new setting for the option. Use <tt>true</tt> to turn the option on and <tt>false</tt> to turn it off. @see #getOption @deprecated ICU 56 @hide original deprecated declaration
[ "Set", "options", "that", "affect", "this", "<tt", ">", "Normalizer<", "/", "tt", ">", "s", "operation", ".", "Options", "do", "not", "change", "the", "basic", "composition", "or", "decomposition", "operation", "that", "is", "being", "performed", "but", "they", "control", "whether", "certain", "optional", "portions", "of", "the", "operation", "are", "done", ".", "Currently", "the", "only", "available", "option", "is", ":" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Normalizer.java#L1799-L1807
ravendb/ravendb-jvm-client
src/main/java/net/ravendb/client/documents/subscriptions/DocumentSubscriptions.java
DocumentSubscriptions.createForRevisions
public <T> String createForRevisions(Class<T> clazz, SubscriptionCreationOptions options) { """ Creates a data subscription in a database. The subscription will expose all documents that match the specified subscription options for a given type. @param options Subscription options @param clazz Document class @param <T> Document class @return created subscription """ return createForRevisions(clazz, options, null); }
java
public <T> String createForRevisions(Class<T> clazz, SubscriptionCreationOptions options) { return createForRevisions(clazz, options, null); }
[ "public", "<", "T", ">", "String", "createForRevisions", "(", "Class", "<", "T", ">", "clazz", ",", "SubscriptionCreationOptions", "options", ")", "{", "return", "createForRevisions", "(", "clazz", ",", "options", ",", "null", ")", ";", "}" ]
Creates a data subscription in a database. The subscription will expose all documents that match the specified subscription options for a given type. @param options Subscription options @param clazz Document class @param <T> Document class @return created subscription
[ "Creates", "a", "data", "subscription", "in", "a", "database", ".", "The", "subscription", "will", "expose", "all", "documents", "that", "match", "the", "specified", "subscription", "options", "for", "a", "given", "type", "." ]
train
https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/subscriptions/DocumentSubscriptions.java#L108-L110
Coveros/selenified
src/main/java/com/coveros/selenified/element/check/azzert/AssertEquals.java
AssertEquals.cssValue
public void cssValue(String attribute, String expectedValue) { """ Asserts that the element has a css attribute with a value equal to the value provided. If the element isn't present, or the css doesn't contain the desired attribute, this will constitute a failure, same as a mismatch. This information will be logged and recorded, with a screenshot for traceability and added debugging support. @param attribute - the css attribute to be checked @param expectedValue the expected css value of the passed attribute of the element """ String cssValue = checkCssValue(attribute, expectedValue, 0, 0); String reason = NO_ELEMENT_FOUND; if (cssValue == null && expectedValue != null && getElement().is().present()) { reason = "CSS attribute not found"; } assertFalse(reason, cssValue == null && expectedValue != null); assertEquals("CSS Value Mismatch", expectedValue, cssValue); }
java
public void cssValue(String attribute, String expectedValue) { String cssValue = checkCssValue(attribute, expectedValue, 0, 0); String reason = NO_ELEMENT_FOUND; if (cssValue == null && expectedValue != null && getElement().is().present()) { reason = "CSS attribute not found"; } assertFalse(reason, cssValue == null && expectedValue != null); assertEquals("CSS Value Mismatch", expectedValue, cssValue); }
[ "public", "void", "cssValue", "(", "String", "attribute", ",", "String", "expectedValue", ")", "{", "String", "cssValue", "=", "checkCssValue", "(", "attribute", ",", "expectedValue", ",", "0", ",", "0", ")", ";", "String", "reason", "=", "NO_ELEMENT_FOUND", ";", "if", "(", "cssValue", "==", "null", "&&", "expectedValue", "!=", "null", "&&", "getElement", "(", ")", ".", "is", "(", ")", ".", "present", "(", ")", ")", "{", "reason", "=", "\"CSS attribute not found\"", ";", "}", "assertFalse", "(", "reason", ",", "cssValue", "==", "null", "&&", "expectedValue", "!=", "null", ")", ";", "assertEquals", "(", "\"CSS Value Mismatch\"", ",", "expectedValue", ",", "cssValue", ")", ";", "}" ]
Asserts that the element has a css attribute with a value equal to the value provided. If the element isn't present, or the css doesn't contain the desired attribute, this will constitute a failure, same as a mismatch. This information will be logged and recorded, with a screenshot for traceability and added debugging support. @param attribute - the css attribute to be checked @param expectedValue the expected css value of the passed attribute of the element
[ "Asserts", "that", "the", "element", "has", "a", "css", "attribute", "with", "a", "value", "equal", "to", "the", "value", "provided", ".", "If", "the", "element", "isn", "t", "present", "or", "the", "css", "doesn", "t", "contain", "the", "desired", "attribute", "this", "will", "constitute", "a", "failure", "same", "as", "a", "mismatch", ".", "This", "information", "will", "be", "logged", "and", "recorded", "with", "a", "screenshot", "for", "traceability", "and", "added", "debugging", "support", "." ]
train
https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/element/check/azzert/AssertEquals.java#L102-L110
ttddyy/datasource-proxy
src/main/java/net/ttddyy/dsproxy/support/ProxyDataSourceBuilder.java
ProxyDataSourceBuilder.logSlowQueryByJUL
public ProxyDataSourceBuilder logSlowQueryByJUL(long thresholdTime, TimeUnit timeUnit, Level logLevel, String loggerName) { """ Register {@link JULSlowQueryListener}. @param thresholdTime slow query threshold time @param timeUnit slow query threshold time unit @param logLevel log level for JUL @param loggerName JUL logger name @return builder @since 1.4.1 """ this.createJulSlowQueryListener = true; this.slowQueryThreshold = thresholdTime; this.slowQueryTimeUnit = timeUnit; this.julSlowQueryLogLevel = logLevel; this.julSlowQueryLoggerName = loggerName; return this; }
java
public ProxyDataSourceBuilder logSlowQueryByJUL(long thresholdTime, TimeUnit timeUnit, Level logLevel, String loggerName) { this.createJulSlowQueryListener = true; this.slowQueryThreshold = thresholdTime; this.slowQueryTimeUnit = timeUnit; this.julSlowQueryLogLevel = logLevel; this.julSlowQueryLoggerName = loggerName; return this; }
[ "public", "ProxyDataSourceBuilder", "logSlowQueryByJUL", "(", "long", "thresholdTime", ",", "TimeUnit", "timeUnit", ",", "Level", "logLevel", ",", "String", "loggerName", ")", "{", "this", ".", "createJulSlowQueryListener", "=", "true", ";", "this", ".", "slowQueryThreshold", "=", "thresholdTime", ";", "this", ".", "slowQueryTimeUnit", "=", "timeUnit", ";", "this", ".", "julSlowQueryLogLevel", "=", "logLevel", ";", "this", ".", "julSlowQueryLoggerName", "=", "loggerName", ";", "return", "this", ";", "}" ]
Register {@link JULSlowQueryListener}. @param thresholdTime slow query threshold time @param timeUnit slow query threshold time unit @param logLevel log level for JUL @param loggerName JUL logger name @return builder @since 1.4.1
[ "Register", "{", "@link", "JULSlowQueryListener", "}", "." ]
train
https://github.com/ttddyy/datasource-proxy/blob/62163ccf9a569a99aa3ad9f9151a32567447a62e/src/main/java/net/ttddyy/dsproxy/support/ProxyDataSourceBuilder.java#L479-L486
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/core/PGStream.java
PGStream.sendStream
public void sendStream(InputStream inStream, int remaining) throws IOException { """ Copy data from an input stream to the connection. @param inStream the stream to read data from @param remaining the number of bytes to copy @throws IOException if a data I/O error occurs """ int expectedLength = remaining; if (streamBuffer == null) { streamBuffer = new byte[8192]; } while (remaining > 0) { int count = (remaining > streamBuffer.length ? streamBuffer.length : remaining); int readCount; try { readCount = inStream.read(streamBuffer, 0, count); if (readCount < 0) { throw new EOFException( GT.tr("Premature end of input stream, expected {0} bytes, but only read {1}.", expectedLength, expectedLength - remaining)); } } catch (IOException ioe) { while (remaining > 0) { send(streamBuffer, count); remaining -= count; count = (remaining > streamBuffer.length ? streamBuffer.length : remaining); } throw new PGBindException(ioe); } send(streamBuffer, readCount); remaining -= readCount; } }
java
public void sendStream(InputStream inStream, int remaining) throws IOException { int expectedLength = remaining; if (streamBuffer == null) { streamBuffer = new byte[8192]; } while (remaining > 0) { int count = (remaining > streamBuffer.length ? streamBuffer.length : remaining); int readCount; try { readCount = inStream.read(streamBuffer, 0, count); if (readCount < 0) { throw new EOFException( GT.tr("Premature end of input stream, expected {0} bytes, but only read {1}.", expectedLength, expectedLength - remaining)); } } catch (IOException ioe) { while (remaining > 0) { send(streamBuffer, count); remaining -= count; count = (remaining > streamBuffer.length ? streamBuffer.length : remaining); } throw new PGBindException(ioe); } send(streamBuffer, readCount); remaining -= readCount; } }
[ "public", "void", "sendStream", "(", "InputStream", "inStream", ",", "int", "remaining", ")", "throws", "IOException", "{", "int", "expectedLength", "=", "remaining", ";", "if", "(", "streamBuffer", "==", "null", ")", "{", "streamBuffer", "=", "new", "byte", "[", "8192", "]", ";", "}", "while", "(", "remaining", ">", "0", ")", "{", "int", "count", "=", "(", "remaining", ">", "streamBuffer", ".", "length", "?", "streamBuffer", ".", "length", ":", "remaining", ")", ";", "int", "readCount", ";", "try", "{", "readCount", "=", "inStream", ".", "read", "(", "streamBuffer", ",", "0", ",", "count", ")", ";", "if", "(", "readCount", "<", "0", ")", "{", "throw", "new", "EOFException", "(", "GT", ".", "tr", "(", "\"Premature end of input stream, expected {0} bytes, but only read {1}.\"", ",", "expectedLength", ",", "expectedLength", "-", "remaining", ")", ")", ";", "}", "}", "catch", "(", "IOException", "ioe", ")", "{", "while", "(", "remaining", ">", "0", ")", "{", "send", "(", "streamBuffer", ",", "count", ")", ";", "remaining", "-=", "count", ";", "count", "=", "(", "remaining", ">", "streamBuffer", ".", "length", "?", "streamBuffer", ".", "length", ":", "remaining", ")", ";", "}", "throw", "new", "PGBindException", "(", "ioe", ")", ";", "}", "send", "(", "streamBuffer", ",", "readCount", ")", ";", "remaining", "-=", "readCount", ";", "}", "}" ]
Copy data from an input stream to the connection. @param inStream the stream to read data from @param remaining the number of bytes to copy @throws IOException if a data I/O error occurs
[ "Copy", "data", "from", "an", "input", "stream", "to", "the", "connection", "." ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/core/PGStream.java#L499-L528
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/ProtectedBranchesApi.java
ProtectedBranchesApi.unprotectBranch
public void unprotectBranch(Integer projectIdOrPath, String branchName) throws GitLabApiException { """ Unprotects the given protected branch or wildcard protected branch. <pre><code>GitLab Endpoint: DELETE /projects/:id/protected_branches/:name</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param branchName the name of the branch to un-protect @throws GitLabApiException if any exception occurs """ delete(Response.Status.NO_CONTENT, null, "projects", getProjectIdOrPath(projectIdOrPath), "protected_branches", urlEncode(branchName)); }
java
public void unprotectBranch(Integer projectIdOrPath, String branchName) throws GitLabApiException { delete(Response.Status.NO_CONTENT, null, "projects", getProjectIdOrPath(projectIdOrPath), "protected_branches", urlEncode(branchName)); }
[ "public", "void", "unprotectBranch", "(", "Integer", "projectIdOrPath", ",", "String", "branchName", ")", "throws", "GitLabApiException", "{", "delete", "(", "Response", ".", "Status", ".", "NO_CONTENT", ",", "null", ",", "\"projects\"", ",", "getProjectIdOrPath", "(", "projectIdOrPath", ")", ",", "\"protected_branches\"", ",", "urlEncode", "(", "branchName", ")", ")", ";", "}" ]
Unprotects the given protected branch or wildcard protected branch. <pre><code>GitLab Endpoint: DELETE /projects/:id/protected_branches/:name</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param branchName the name of the branch to un-protect @throws GitLabApiException if any exception occurs
[ "Unprotects", "the", "given", "protected", "branch", "or", "wildcard", "protected", "branch", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/ProtectedBranchesApi.java#L68-L70
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPInfinitesimalPlanePoseEstimation.java
PnPInfinitesimalPlanePoseEstimation.process
public boolean process( List<AssociatedPair> points ) { """ Estimates the transform from world coordinate system to camera given known points and observations. For each observation p1=World 3D location. z=0 is implicit. p2=Observed location of points in image in normalized image coordinates @param points List of world coordinates in 2D (p1) and normalized image coordinates (p2) @return true if successful or false if it fails to estimate """ if( points.size() < estimateHomography.getMinimumPoints()) throw new IllegalArgumentException("At least "+estimateHomography.getMinimumPoints()+" must be provided"); // center location of points in model zeroMeanWorldPoints(points); // make sure there are no accidental references to the original points points = pointsAdj.toList(); if( !estimateHomography.process(points,H) ) return false; // make sure H[2,2] == 1 CommonOps_DDRM.divide(H,H.get(2,2)); // Jacobian of pi(H[u_0 1]^T) at u_0 = 0 // pi is plane to image transform J.a11 = H.unsafe_get(0,0) - H.unsafe_get(2,0)*H.unsafe_get(0,2); J.a12 = H.unsafe_get(0,1) - H.unsafe_get(2,1)*H.unsafe_get(0,2); J.a21 = H.unsafe_get(1,0) - H.unsafe_get(2,0)*H.unsafe_get(1,2); J.a22 = H.unsafe_get(1,1) - H.unsafe_get(2,1)*H.unsafe_get(1,2); // v = (H[0,1],H[1,2]) = pi(H[u_0 1]^T) at u_0 = 0 // projection of u_0 into normalized coordinates v1 = H.unsafe_get(0,2); v2 = H.unsafe_get(1,2); // Solve for rotations IPPE(pose0.R,pose1.R); // Solve for translations estimateTranslation(pose0.R,points,pose0.T); estimateTranslation(pose1.R,points,pose1.T); // compute the reprojection error for each pose error0 = computeError(points,pose0); error1 = computeError(points,pose1); // Make sure the best pose is the first one if( error0 > error1 ) { double e = error0; error0 = error1; error1 = e; Se3_F64 s = pose0;pose0 = pose1; pose1 = s; } // Undo centering adjustment center3.set(-center.x,-center.y,0); GeometryMath_F64.addMult(pose0.T,pose0.R,center3,pose0.T); GeometryMath_F64.addMult(pose1.T,pose1.R,center3,pose1.T); return true; }
java
public boolean process( List<AssociatedPair> points ) { if( points.size() < estimateHomography.getMinimumPoints()) throw new IllegalArgumentException("At least "+estimateHomography.getMinimumPoints()+" must be provided"); // center location of points in model zeroMeanWorldPoints(points); // make sure there are no accidental references to the original points points = pointsAdj.toList(); if( !estimateHomography.process(points,H) ) return false; // make sure H[2,2] == 1 CommonOps_DDRM.divide(H,H.get(2,2)); // Jacobian of pi(H[u_0 1]^T) at u_0 = 0 // pi is plane to image transform J.a11 = H.unsafe_get(0,0) - H.unsafe_get(2,0)*H.unsafe_get(0,2); J.a12 = H.unsafe_get(0,1) - H.unsafe_get(2,1)*H.unsafe_get(0,2); J.a21 = H.unsafe_get(1,0) - H.unsafe_get(2,0)*H.unsafe_get(1,2); J.a22 = H.unsafe_get(1,1) - H.unsafe_get(2,1)*H.unsafe_get(1,2); // v = (H[0,1],H[1,2]) = pi(H[u_0 1]^T) at u_0 = 0 // projection of u_0 into normalized coordinates v1 = H.unsafe_get(0,2); v2 = H.unsafe_get(1,2); // Solve for rotations IPPE(pose0.R,pose1.R); // Solve for translations estimateTranslation(pose0.R,points,pose0.T); estimateTranslation(pose1.R,points,pose1.T); // compute the reprojection error for each pose error0 = computeError(points,pose0); error1 = computeError(points,pose1); // Make sure the best pose is the first one if( error0 > error1 ) { double e = error0; error0 = error1; error1 = e; Se3_F64 s = pose0;pose0 = pose1; pose1 = s; } // Undo centering adjustment center3.set(-center.x,-center.y,0); GeometryMath_F64.addMult(pose0.T,pose0.R,center3,pose0.T); GeometryMath_F64.addMult(pose1.T,pose1.R,center3,pose1.T); return true; }
[ "public", "boolean", "process", "(", "List", "<", "AssociatedPair", ">", "points", ")", "{", "if", "(", "points", ".", "size", "(", ")", "<", "estimateHomography", ".", "getMinimumPoints", "(", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"At least \"", "+", "estimateHomography", ".", "getMinimumPoints", "(", ")", "+", "\" must be provided\"", ")", ";", "// center location of points in model", "zeroMeanWorldPoints", "(", "points", ")", ";", "// make sure there are no accidental references to the original points", "points", "=", "pointsAdj", ".", "toList", "(", ")", ";", "if", "(", "!", "estimateHomography", ".", "process", "(", "points", ",", "H", ")", ")", "return", "false", ";", "// make sure H[2,2] == 1", "CommonOps_DDRM", ".", "divide", "(", "H", ",", "H", ".", "get", "(", "2", ",", "2", ")", ")", ";", "// Jacobian of pi(H[u_0 1]^T) at u_0 = 0", "// pi is plane to image transform", "J", ".", "a11", "=", "H", ".", "unsafe_get", "(", "0", ",", "0", ")", "-", "H", ".", "unsafe_get", "(", "2", ",", "0", ")", "*", "H", ".", "unsafe_get", "(", "0", ",", "2", ")", ";", "J", ".", "a12", "=", "H", ".", "unsafe_get", "(", "0", ",", "1", ")", "-", "H", ".", "unsafe_get", "(", "2", ",", "1", ")", "*", "H", ".", "unsafe_get", "(", "0", ",", "2", ")", ";", "J", ".", "a21", "=", "H", ".", "unsafe_get", "(", "1", ",", "0", ")", "-", "H", ".", "unsafe_get", "(", "2", ",", "0", ")", "*", "H", ".", "unsafe_get", "(", "1", ",", "2", ")", ";", "J", ".", "a22", "=", "H", ".", "unsafe_get", "(", "1", ",", "1", ")", "-", "H", ".", "unsafe_get", "(", "2", ",", "1", ")", "*", "H", ".", "unsafe_get", "(", "1", ",", "2", ")", ";", "// v = (H[0,1],H[1,2]) = pi(H[u_0 1]^T) at u_0 = 0", "// projection of u_0 into normalized coordinates", "v1", "=", "H", ".", "unsafe_get", "(", "0", ",", "2", ")", ";", "v2", "=", "H", ".", "unsafe_get", "(", "1", ",", "2", ")", ";", "// Solve for rotations", "IPPE", "(", "pose0", ".", "R", ",", "pose1", ".", "R", ")", ";", "// Solve for translations", "estimateTranslation", "(", "pose0", ".", "R", ",", "points", ",", "pose0", ".", "T", ")", ";", "estimateTranslation", "(", "pose1", ".", "R", ",", "points", ",", "pose1", ".", "T", ")", ";", "// compute the reprojection error for each pose", "error0", "=", "computeError", "(", "points", ",", "pose0", ")", ";", "error1", "=", "computeError", "(", "points", ",", "pose1", ")", ";", "// Make sure the best pose is the first one", "if", "(", "error0", ">", "error1", ")", "{", "double", "e", "=", "error0", ";", "error0", "=", "error1", ";", "error1", "=", "e", ";", "Se3_F64", "s", "=", "pose0", ";", "pose0", "=", "pose1", ";", "pose1", "=", "s", ";", "}", "// Undo centering adjustment", "center3", ".", "set", "(", "-", "center", ".", "x", ",", "-", "center", ".", "y", ",", "0", ")", ";", "GeometryMath_F64", ".", "addMult", "(", "pose0", ".", "T", ",", "pose0", ".", "R", ",", "center3", ",", "pose0", ".", "T", ")", ";", "GeometryMath_F64", ".", "addMult", "(", "pose1", ".", "T", ",", "pose1", ".", "R", ",", "center3", ",", "pose1", ".", "T", ")", ";", "return", "true", ";", "}" ]
Estimates the transform from world coordinate system to camera given known points and observations. For each observation p1=World 3D location. z=0 is implicit. p2=Observed location of points in image in normalized image coordinates @param points List of world coordinates in 2D (p1) and normalized image coordinates (p2) @return true if successful or false if it fails to estimate
[ "Estimates", "the", "transform", "from", "world", "coordinate", "system", "to", "camera", "given", "known", "points", "and", "observations", ".", "For", "each", "observation", "p1", "=", "World", "3D", "location", ".", "z", "=", "0", "is", "implicit", ".", "p2", "=", "Observed", "location", "of", "points", "in", "image", "in", "normalized", "image", "coordinates" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPInfinitesimalPlanePoseEstimation.java#L115-L166
Stratio/bdt
src/main/java/com/stratio/qa/specs/DatabaseSpec.java
DatabaseSpec.elasticSearchIndexContainsDocument
@Then("^The Elasticsearch index named '(.+?)' and mapping '(.+?)' contains a column named '(.+?)' with the value '(.+?)'$") public void elasticSearchIndexContainsDocument(String indexName, String mappingName, String columnName, String columnValue) throws Exception { """ Check that an elasticsearch index contains a specific document @param indexName @param columnName @param columnValue """ Assertions.assertThat((commonspec.getElasticSearchClient().searchSimpleFilterElasticsearchQuery( indexName, mappingName, columnName, columnValue, "equals" ).size()) > 0).isTrue().withFailMessage("The index does not contain that document"); }
java
@Then("^The Elasticsearch index named '(.+?)' and mapping '(.+?)' contains a column named '(.+?)' with the value '(.+?)'$") public void elasticSearchIndexContainsDocument(String indexName, String mappingName, String columnName, String columnValue) throws Exception { Assertions.assertThat((commonspec.getElasticSearchClient().searchSimpleFilterElasticsearchQuery( indexName, mappingName, columnName, columnValue, "equals" ).size()) > 0).isTrue().withFailMessage("The index does not contain that document"); }
[ "@", "Then", "(", "\"^The Elasticsearch index named '(.+?)' and mapping '(.+?)' contains a column named '(.+?)' with the value '(.+?)'$\"", ")", "public", "void", "elasticSearchIndexContainsDocument", "(", "String", "indexName", ",", "String", "mappingName", ",", "String", "columnName", ",", "String", "columnValue", ")", "throws", "Exception", "{", "Assertions", ".", "assertThat", "(", "(", "commonspec", ".", "getElasticSearchClient", "(", ")", ".", "searchSimpleFilterElasticsearchQuery", "(", "indexName", ",", "mappingName", ",", "columnName", ",", "columnValue", ",", "\"equals\"", ")", ".", "size", "(", ")", ")", ">", "0", ")", ".", "isTrue", "(", ")", ".", "withFailMessage", "(", "\"The index does not contain that document\"", ")", ";", "}" ]
Check that an elasticsearch index contains a specific document @param indexName @param columnName @param columnValue
[ "Check", "that", "an", "elasticsearch", "index", "contains", "a", "specific", "document" ]
train
https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/DatabaseSpec.java#L873-L882
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/jcr/query/QueryContext.java
QueryContext.with
public QueryContext with( Map<String, Object> variables ) { """ Obtain a copy of this context, except that the copy uses the supplied variables. @param variables the variables that should be used in the new context; may be null if there are no such variables @return the new context; never null """ return new QueryContext(context, repositoryCache, workspaceNames, overriddenNodeCachesByWorkspaceName, schemata, indexDefns, nodeTypes, bufferManager, hints, problems, variables); }
java
public QueryContext with( Map<String, Object> variables ) { return new QueryContext(context, repositoryCache, workspaceNames, overriddenNodeCachesByWorkspaceName, schemata, indexDefns, nodeTypes, bufferManager, hints, problems, variables); }
[ "public", "QueryContext", "with", "(", "Map", "<", "String", ",", "Object", ">", "variables", ")", "{", "return", "new", "QueryContext", "(", "context", ",", "repositoryCache", ",", "workspaceNames", ",", "overriddenNodeCachesByWorkspaceName", ",", "schemata", ",", "indexDefns", ",", "nodeTypes", ",", "bufferManager", ",", "hints", ",", "problems", ",", "variables", ")", ";", "}" ]
Obtain a copy of this context, except that the copy uses the supplied variables. @param variables the variables that should be used in the new context; may be null if there are no such variables @return the new context; never null
[ "Obtain", "a", "copy", "of", "this", "context", "except", "that", "the", "copy", "uses", "the", "supplied", "variables", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/QueryContext.java#L434-L437
alkacon/opencms-core
src/org/opencms/jsp/CmsJspTagLink.java
CmsJspTagLink.linkTagAction
public static String linkTagAction(String target, ServletRequest req, String baseUri, Locale locale) { """ Returns a link to a file in the OpenCms VFS that has been adjusted according to the web application path and the OpenCms static export rules.<p> <p>If the <code>baseUri</code> parameter is provided, this will be treated as the source of the link, if this is <code>null</code> then the current OpenCms user context URI will be used as source.</p> <p>If the <code>locale</code> parameter is provided, the locale in the request context will be switched to the provided locale. This influences only the behavior of the {@link org.opencms.staticexport.CmsLocalePrefixLinkSubstitutionHandler}.</p> Relative links are converted to absolute links, using the current element URI as base.<p> @param target the link that should be calculated, can be relative or absolute @param req the current request @param baseUri the base URI for the link source @param locale the locale for which the link should be created (see {@link org.opencms.staticexport.CmsLocalePrefixLinkSubstitutionHandler} @return the target link adjusted according to the web application path and the OpenCms static export rules @see #linkTagAction(String, ServletRequest) @since 8.0.3 """ return linkTagAction(target, req, baseUri, null, locale); }
java
public static String linkTagAction(String target, ServletRequest req, String baseUri, Locale locale) { return linkTagAction(target, req, baseUri, null, locale); }
[ "public", "static", "String", "linkTagAction", "(", "String", "target", ",", "ServletRequest", "req", ",", "String", "baseUri", ",", "Locale", "locale", ")", "{", "return", "linkTagAction", "(", "target", ",", "req", ",", "baseUri", ",", "null", ",", "locale", ")", ";", "}" ]
Returns a link to a file in the OpenCms VFS that has been adjusted according to the web application path and the OpenCms static export rules.<p> <p>If the <code>baseUri</code> parameter is provided, this will be treated as the source of the link, if this is <code>null</code> then the current OpenCms user context URI will be used as source.</p> <p>If the <code>locale</code> parameter is provided, the locale in the request context will be switched to the provided locale. This influences only the behavior of the {@link org.opencms.staticexport.CmsLocalePrefixLinkSubstitutionHandler}.</p> Relative links are converted to absolute links, using the current element URI as base.<p> @param target the link that should be calculated, can be relative or absolute @param req the current request @param baseUri the base URI for the link source @param locale the locale for which the link should be created (see {@link org.opencms.staticexport.CmsLocalePrefixLinkSubstitutionHandler} @return the target link adjusted according to the web application path and the OpenCms static export rules @see #linkTagAction(String, ServletRequest) @since 8.0.3
[ "Returns", "a", "link", "to", "a", "file", "in", "the", "OpenCms", "VFS", "that", "has", "been", "adjusted", "according", "to", "the", "web", "application", "path", "and", "the", "OpenCms", "static", "export", "rules", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagLink.java#L149-L152
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java
SqlQueryStatement.buildJoinTreeForColumn
private void buildJoinTreeForColumn(String aColName, boolean useOuterJoin, UserAlias aUserAlias, Map pathClasses) { """ build the Join-Information for name functions and the last segment are removed ie: avg(accounts.amount) -> accounts """ String pathName = SqlHelper.cleanPath(aColName); int sepPos = pathName.lastIndexOf("."); if (sepPos >= 0) { getTableAlias(pathName.substring(0, sepPos), useOuterJoin, aUserAlias, new String[]{pathName.substring(sepPos + 1)}, pathClasses); } }
java
private void buildJoinTreeForColumn(String aColName, boolean useOuterJoin, UserAlias aUserAlias, Map pathClasses) { String pathName = SqlHelper.cleanPath(aColName); int sepPos = pathName.lastIndexOf("."); if (sepPos >= 0) { getTableAlias(pathName.substring(0, sepPos), useOuterJoin, aUserAlias, new String[]{pathName.substring(sepPos + 1)}, pathClasses); } }
[ "private", "void", "buildJoinTreeForColumn", "(", "String", "aColName", ",", "boolean", "useOuterJoin", ",", "UserAlias", "aUserAlias", ",", "Map", "pathClasses", ")", "{", "String", "pathName", "=", "SqlHelper", ".", "cleanPath", "(", "aColName", ")", ";", "int", "sepPos", "=", "pathName", ".", "lastIndexOf", "(", "\".\"", ")", ";", "if", "(", "sepPos", ">=", "0", ")", "{", "getTableAlias", "(", "pathName", ".", "substring", "(", "0", ",", "sepPos", ")", ",", "useOuterJoin", ",", "aUserAlias", ",", "new", "String", "[", "]", "{", "pathName", ".", "substring", "(", "sepPos", "+", "1", ")", "}", ",", "pathClasses", ")", ";", "}", "}" ]
build the Join-Information for name functions and the last segment are removed ie: avg(accounts.amount) -> accounts
[ "build", "the", "Join", "-", "Information", "for", "name", "functions", "and", "the", "last", "segment", "are", "removed", "ie", ":", "avg", "(", "accounts", ".", "amount", ")", "-", ">", "accounts" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java#L1711-L1721
twitter/scrooge
scrooge-maven-plugin/src/main/java/com/twitter/AbstractMavenScroogeMojo.java
AbstractMavenScroogeMojo.extractThriftFile
private File extractThriftFile(String artifactId, String fileName, Set<File> thriftFiles) { """ Picks out a File from `thriftFiles` corresponding to a given artifact ID and file name. Returns null if `artifactId` and `fileName` do not map to a thrift file path. @parameter artifactId The artifact ID of which to look up the path @parameter fileName the name of the thrift file for which to extract a path @parameter thriftFiles The set of Thrift files in which to lookup the artifact ID. @return The path of the directory containing Thrift files for the given artifact ID. null if artifact ID not found. """ for (File thriftFile : thriftFiles) { boolean fileFound = false; if (fileName.equals(thriftFile.getName())) { for (String pathComponent : thriftFile.getPath().split(File.separator)) { if (pathComponent.equals(artifactId)) { fileFound = true; } } } if (fileFound) { return thriftFile; } } return null; }
java
private File extractThriftFile(String artifactId, String fileName, Set<File> thriftFiles) { for (File thriftFile : thriftFiles) { boolean fileFound = false; if (fileName.equals(thriftFile.getName())) { for (String pathComponent : thriftFile.getPath().split(File.separator)) { if (pathComponent.equals(artifactId)) { fileFound = true; } } } if (fileFound) { return thriftFile; } } return null; }
[ "private", "File", "extractThriftFile", "(", "String", "artifactId", ",", "String", "fileName", ",", "Set", "<", "File", ">", "thriftFiles", ")", "{", "for", "(", "File", "thriftFile", ":", "thriftFiles", ")", "{", "boolean", "fileFound", "=", "false", ";", "if", "(", "fileName", ".", "equals", "(", "thriftFile", ".", "getName", "(", ")", ")", ")", "{", "for", "(", "String", "pathComponent", ":", "thriftFile", ".", "getPath", "(", ")", ".", "split", "(", "File", ".", "separator", ")", ")", "{", "if", "(", "pathComponent", ".", "equals", "(", "artifactId", ")", ")", "{", "fileFound", "=", "true", ";", "}", "}", "}", "if", "(", "fileFound", ")", "{", "return", "thriftFile", ";", "}", "}", "return", "null", ";", "}" ]
Picks out a File from `thriftFiles` corresponding to a given artifact ID and file name. Returns null if `artifactId` and `fileName` do not map to a thrift file path. @parameter artifactId The artifact ID of which to look up the path @parameter fileName the name of the thrift file for which to extract a path @parameter thriftFiles The set of Thrift files in which to lookup the artifact ID. @return The path of the directory containing Thrift files for the given artifact ID. null if artifact ID not found.
[ "Picks", "out", "a", "File", "from", "thriftFiles", "corresponding", "to", "a", "given", "artifact", "ID", "and", "file", "name", ".", "Returns", "null", "if", "artifactId", "and", "fileName", "do", "not", "map", "to", "a", "thrift", "file", "path", "." ]
train
https://github.com/twitter/scrooge/blob/2aec9b19a610e12be9609cd97925d0b1284d48bc/scrooge-maven-plugin/src/main/java/com/twitter/AbstractMavenScroogeMojo.java#L228-L244
UrielCh/ovh-java-sdk
ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java
ApiOvhDbaaslogs.serviceName_cluster_clusterId_allowedNetwork_allowedNetworkId_DELETE
public OvhOperation serviceName_cluster_clusterId_allowedNetwork_allowedNetworkId_DELETE(String serviceName, String clusterId, String allowedNetworkId) throws IOException { """ Remove the specified IP from the list of allowed networks REST: DELETE /dbaas/logs/{serviceName}/cluster/{clusterId}/allowedNetwork/{allowedNetworkId} @param serviceName [required] Service name @param clusterId [required] Cluster ID @param allowedNetworkId [required] Allowed network UUID """ String qPath = "/dbaas/logs/{serviceName}/cluster/{clusterId}/allowedNetwork/{allowedNetworkId}"; StringBuilder sb = path(qPath, serviceName, clusterId, allowedNetworkId); String resp = exec(qPath, "DELETE", sb.toString(), null); return convertTo(resp, OvhOperation.class); }
java
public OvhOperation serviceName_cluster_clusterId_allowedNetwork_allowedNetworkId_DELETE(String serviceName, String clusterId, String allowedNetworkId) throws IOException { String qPath = "/dbaas/logs/{serviceName}/cluster/{clusterId}/allowedNetwork/{allowedNetworkId}"; StringBuilder sb = path(qPath, serviceName, clusterId, allowedNetworkId); String resp = exec(qPath, "DELETE", sb.toString(), null); return convertTo(resp, OvhOperation.class); }
[ "public", "OvhOperation", "serviceName_cluster_clusterId_allowedNetwork_allowedNetworkId_DELETE", "(", "String", "serviceName", ",", "String", "clusterId", ",", "String", "allowedNetworkId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dbaas/logs/{serviceName}/cluster/{clusterId}/allowedNetwork/{allowedNetworkId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "clusterId", ",", "allowedNetworkId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"DELETE\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhOperation", ".", "class", ")", ";", "}" ]
Remove the specified IP from the list of allowed networks REST: DELETE /dbaas/logs/{serviceName}/cluster/{clusterId}/allowedNetwork/{allowedNetworkId} @param serviceName [required] Service name @param clusterId [required] Cluster ID @param allowedNetworkId [required] Allowed network UUID
[ "Remove", "the", "specified", "IP", "from", "the", "list", "of", "allowed", "networks" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java#L176-L181
lessthanoptimal/ejml
main/ejml-core/src/org/ejml/ops/ComplexMath_F64.java
ComplexMath_F64.divide
public static void divide(Complex_F64 a, Complex_F64 b, Complex_F64 result) { """ <p> Division: result = a / b </p> @param a Complex number. Not modified. @param b Complex number. Not modified. @param result Storage for output """ double norm = b.getMagnitude2(); result.real = (a.real * b.real + a.imaginary*b.imaginary)/norm; result.imaginary = (a.imaginary*b.real - a.real*b.imaginary)/norm; }
java
public static void divide(Complex_F64 a, Complex_F64 b, Complex_F64 result) { double norm = b.getMagnitude2(); result.real = (a.real * b.real + a.imaginary*b.imaginary)/norm; result.imaginary = (a.imaginary*b.real - a.real*b.imaginary)/norm; }
[ "public", "static", "void", "divide", "(", "Complex_F64", "a", ",", "Complex_F64", "b", ",", "Complex_F64", "result", ")", "{", "double", "norm", "=", "b", ".", "getMagnitude2", "(", ")", ";", "result", ".", "real", "=", "(", "a", ".", "real", "*", "b", ".", "real", "+", "a", ".", "imaginary", "*", "b", ".", "imaginary", ")", "/", "norm", ";", "result", ".", "imaginary", "=", "(", "a", ".", "imaginary", "*", "b", ".", "real", "-", "a", ".", "real", "*", "b", ".", "imaginary", ")", "/", "norm", ";", "}" ]
<p> Division: result = a / b </p> @param a Complex number. Not modified. @param b Complex number. Not modified. @param result Storage for output
[ "<p", ">", "Division", ":", "result", "=", "a", "/", "b", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/ops/ComplexMath_F64.java#L94-L98
Frostman/dropbox4j
src/main/java/ru/frostman/dropbox/api/DropboxClient.java
DropboxClient.getMetadata
public Entry getMetadata(String path, int fileLimit) { """ Returns metadata information about specified resource with specified maximum child entries count. @param path to file or directory @param fileLimit max child elements count @return metadata of specified resource @see Entry """ return getMetadata(path, fileLimit, null, true); }
java
public Entry getMetadata(String path, int fileLimit) { return getMetadata(path, fileLimit, null, true); }
[ "public", "Entry", "getMetadata", "(", "String", "path", ",", "int", "fileLimit", ")", "{", "return", "getMetadata", "(", "path", ",", "fileLimit", ",", "null", ",", "true", ")", ";", "}" ]
Returns metadata information about specified resource with specified maximum child entries count. @param path to file or directory @param fileLimit max child elements count @return metadata of specified resource @see Entry
[ "Returns", "metadata", "information", "about", "specified", "resource", "with", "specified", "maximum", "child", "entries", "count", "." ]
train
https://github.com/Frostman/dropbox4j/blob/774c817e5bf294d0139ecb5ac81399be50ada5e0/src/main/java/ru/frostman/dropbox/api/DropboxClient.java#L117-L119
borball/weixin-sdk
weixin-mp/src/main/java/com/riversoft/weixin/mp/media/Materials.java
Materials.updateMpNews
public void updateMpNews(String mediaId, int index, MpArticle article) { """ 修改图文素材 @param mediaId 图文素材 media id @param index 要更新的文章在图文素材中的位置 @param article 文章 """ String url = WxEndpoint.get("url.material.mpnews.update"); Map<String, Object> request = new HashMap<>(); request.put("media_id", mediaId); request.put("index", index); request.put("articles", article); String json = JsonMapper.nonEmptyMapper().toJson(request); logger.info("update mpnews: {}", json); wxClient.post(url, json); }
java
public void updateMpNews(String mediaId, int index, MpArticle article) { String url = WxEndpoint.get("url.material.mpnews.update"); Map<String, Object> request = new HashMap<>(); request.put("media_id", mediaId); request.put("index", index); request.put("articles", article); String json = JsonMapper.nonEmptyMapper().toJson(request); logger.info("update mpnews: {}", json); wxClient.post(url, json); }
[ "public", "void", "updateMpNews", "(", "String", "mediaId", ",", "int", "index", ",", "MpArticle", "article", ")", "{", "String", "url", "=", "WxEndpoint", ".", "get", "(", "\"url.material.mpnews.update\"", ")", ";", "Map", "<", "String", ",", "Object", ">", "request", "=", "new", "HashMap", "<>", "(", ")", ";", "request", ".", "put", "(", "\"media_id\"", ",", "mediaId", ")", ";", "request", ".", "put", "(", "\"index\"", ",", "index", ")", ";", "request", ".", "put", "(", "\"articles\"", ",", "article", ")", ";", "String", "json", "=", "JsonMapper", ".", "nonEmptyMapper", "(", ")", ".", "toJson", "(", "request", ")", ";", "logger", ".", "info", "(", "\"update mpnews: {}\"", ",", "json", ")", ";", "wxClient", ".", "post", "(", "url", ",", "json", ")", ";", "}" ]
修改图文素材 @param mediaId 图文素材 media id @param index 要更新的文章在图文素材中的位置 @param article 文章
[ "修改图文素材" ]
train
https://github.com/borball/weixin-sdk/blob/32bf5e45cdd8d0d28074e83954e1ec62dcf25cb7/weixin-mp/src/main/java/com/riversoft/weixin/mp/media/Materials.java#L113-L124
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/AccountManager.java
AccountManager.createAccount
public void createAccount(Localpart username, String password, Map<String, String> attributes) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { """ Creates a new account using the specified username, password and account attributes. The attributes Map must contain only String name/value pairs and must also have values for all required attributes. @param username the username. @param password the password. @param attributes the account attributes. @throws XMPPErrorException if an error occurs creating the account. @throws NoResponseException if there was no response from the server. @throws NotConnectedException @throws InterruptedException @see #getAccountAttributes() """ if (!connection().isSecureConnection() && !allowSensitiveOperationOverInsecureConnection) { throw new IllegalStateException("Creating account over insecure connection"); } if (username == null) { throw new IllegalArgumentException("Username must not be null"); } if (StringUtils.isNullOrEmpty(password)) { throw new IllegalArgumentException("Password must not be null"); } attributes.put("username", username.toString()); attributes.put("password", password); Registration reg = new Registration(attributes); reg.setType(IQ.Type.set); reg.setTo(connection().getXMPPServiceDomain()); createStanzaCollectorAndSend(reg).nextResultOrThrow(); }
java
public void createAccount(Localpart username, String password, Map<String, String> attributes) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { if (!connection().isSecureConnection() && !allowSensitiveOperationOverInsecureConnection) { throw new IllegalStateException("Creating account over insecure connection"); } if (username == null) { throw new IllegalArgumentException("Username must not be null"); } if (StringUtils.isNullOrEmpty(password)) { throw new IllegalArgumentException("Password must not be null"); } attributes.put("username", username.toString()); attributes.put("password", password); Registration reg = new Registration(attributes); reg.setType(IQ.Type.set); reg.setTo(connection().getXMPPServiceDomain()); createStanzaCollectorAndSend(reg).nextResultOrThrow(); }
[ "public", "void", "createAccount", "(", "Localpart", "username", ",", "String", "password", ",", "Map", "<", "String", ",", "String", ">", "attributes", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", "{", "if", "(", "!", "connection", "(", ")", ".", "isSecureConnection", "(", ")", "&&", "!", "allowSensitiveOperationOverInsecureConnection", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Creating account over insecure connection\"", ")", ";", "}", "if", "(", "username", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Username must not be null\"", ")", ";", "}", "if", "(", "StringUtils", ".", "isNullOrEmpty", "(", "password", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Password must not be null\"", ")", ";", "}", "attributes", ".", "put", "(", "\"username\"", ",", "username", ".", "toString", "(", ")", ")", ";", "attributes", ".", "put", "(", "\"password\"", ",", "password", ")", ";", "Registration", "reg", "=", "new", "Registration", "(", "attributes", ")", ";", "reg", ".", "setType", "(", "IQ", ".", "Type", ".", "set", ")", ";", "reg", ".", "setTo", "(", "connection", "(", ")", ".", "getXMPPServiceDomain", "(", ")", ")", ";", "createStanzaCollectorAndSend", "(", "reg", ")", ".", "nextResultOrThrow", "(", ")", ";", "}" ]
Creates a new account using the specified username, password and account attributes. The attributes Map must contain only String name/value pairs and must also have values for all required attributes. @param username the username. @param password the password. @param attributes the account attributes. @throws XMPPErrorException if an error occurs creating the account. @throws NoResponseException if there was no response from the server. @throws NotConnectedException @throws InterruptedException @see #getAccountAttributes()
[ "Creates", "a", "new", "account", "using", "the", "specified", "username", "password", "and", "account", "attributes", ".", "The", "attributes", "Map", "must", "contain", "only", "String", "name", "/", "value", "pairs", "and", "must", "also", "have", "values", "for", "all", "required", "attributes", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/AccountManager.java#L271-L289
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java
ApiOvhDedicatedserver.serviceName_license_compliantWindows_GET
public ArrayList<OvhWindowsOsVersionEnum> serviceName_license_compliantWindows_GET(String serviceName) throws IOException { """ Get the windows license compliant with your server. REST: GET /dedicated/server/{serviceName}/license/compliantWindows @param serviceName [required] The internal name of your dedicated server """ String qPath = "/dedicated/server/{serviceName}/license/compliantWindows"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t7); }
java
public ArrayList<OvhWindowsOsVersionEnum> serviceName_license_compliantWindows_GET(String serviceName) throws IOException { String qPath = "/dedicated/server/{serviceName}/license/compliantWindows"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t7); }
[ "public", "ArrayList", "<", "OvhWindowsOsVersionEnum", ">", "serviceName_license_compliantWindows_GET", "(", "String", "serviceName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/server/{serviceName}/license/compliantWindows\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t7", ")", ";", "}" ]
Get the windows license compliant with your server. REST: GET /dedicated/server/{serviceName}/license/compliantWindows @param serviceName [required] The internal name of your dedicated server
[ "Get", "the", "windows", "license", "compliant", "with", "your", "server", "." ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L1207-L1212
cdk/cdk
descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/XLogPDescriptor.java
XLogPDescriptor.getPiSystemsCount
private int getPiSystemsCount(IAtomContainer ac, IAtom atom) { """ Gets the piSystemsCount attribute of the XLogPDescriptor object. @param ac Description of the Parameter @param atom Description of the Parameter @return The piSystemsCount value """ List neighbours = ac.getConnectedAtomsList(atom); int picounter = 0; List bonds = null; for (int i = 0; i < neighbours.size(); i++) { IAtom neighbour = (IAtom) neighbours.get(i); bonds = ac.getConnectedBondsList(neighbour); for (int j = 0; j < bonds.size(); j++) { IBond bond = (IBond) bonds.get(j); if (bond.getOrder() != IBond.Order.SINGLE && !bond.getOther(neighbour).equals(atom) && !neighbour.getSymbol().equals("P") && !neighbour.getSymbol().equals("S")) { picounter += 1; }/* * else if (bonds[j].getOther(neighbours[i])!=atom && * !neighbours[i].getSymbol().equals("P") && * !neighbours[i].getSymbol().equals("S") && * bonds[j].getOther * (neighbours[i]).getFlag(CDKConstants.ISAROMATIC)){ picounter * += 1; } */ } } return picounter; }
java
private int getPiSystemsCount(IAtomContainer ac, IAtom atom) { List neighbours = ac.getConnectedAtomsList(atom); int picounter = 0; List bonds = null; for (int i = 0; i < neighbours.size(); i++) { IAtom neighbour = (IAtom) neighbours.get(i); bonds = ac.getConnectedBondsList(neighbour); for (int j = 0; j < bonds.size(); j++) { IBond bond = (IBond) bonds.get(j); if (bond.getOrder() != IBond.Order.SINGLE && !bond.getOther(neighbour).equals(atom) && !neighbour.getSymbol().equals("P") && !neighbour.getSymbol().equals("S")) { picounter += 1; }/* * else if (bonds[j].getOther(neighbours[i])!=atom && * !neighbours[i].getSymbol().equals("P") && * !neighbours[i].getSymbol().equals("S") && * bonds[j].getOther * (neighbours[i]).getFlag(CDKConstants.ISAROMATIC)){ picounter * += 1; } */ } } return picounter; }
[ "private", "int", "getPiSystemsCount", "(", "IAtomContainer", "ac", ",", "IAtom", "atom", ")", "{", "List", "neighbours", "=", "ac", ".", "getConnectedAtomsList", "(", "atom", ")", ";", "int", "picounter", "=", "0", ";", "List", "bonds", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "neighbours", ".", "size", "(", ")", ";", "i", "++", ")", "{", "IAtom", "neighbour", "=", "(", "IAtom", ")", "neighbours", ".", "get", "(", "i", ")", ";", "bonds", "=", "ac", ".", "getConnectedBondsList", "(", "neighbour", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "bonds", ".", "size", "(", ")", ";", "j", "++", ")", "{", "IBond", "bond", "=", "(", "IBond", ")", "bonds", ".", "get", "(", "j", ")", ";", "if", "(", "bond", ".", "getOrder", "(", ")", "!=", "IBond", ".", "Order", ".", "SINGLE", "&&", "!", "bond", ".", "getOther", "(", "neighbour", ")", ".", "equals", "(", "atom", ")", "&&", "!", "neighbour", ".", "getSymbol", "(", ")", ".", "equals", "(", "\"P\"", ")", "&&", "!", "neighbour", ".", "getSymbol", "(", ")", ".", "equals", "(", "\"S\"", ")", ")", "{", "picounter", "+=", "1", ";", "}", "/*\n * else if (bonds[j].getOther(neighbours[i])!=atom &&\n * !neighbours[i].getSymbol().equals(\"P\") &&\n * !neighbours[i].getSymbol().equals(\"S\") &&\n * bonds[j].getOther\n * (neighbours[i]).getFlag(CDKConstants.ISAROMATIC)){ picounter\n * += 1; }\n */", "}", "}", "return", "picounter", ";", "}" ]
Gets the piSystemsCount attribute of the XLogPDescriptor object. @param ac Description of the Parameter @param atom Description of the Parameter @return The piSystemsCount value
[ "Gets", "the", "piSystemsCount", "attribute", "of", "the", "XLogPDescriptor", "object", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/XLogPDescriptor.java#L1255-L1278
qiujuer/Genius-Android
caprice/ui/src/main/java/net/qiujuer/genius/ui/Ui.java
Ui.isHaveAttribute
public static boolean isHaveAttribute(AttributeSet attrs, String attribute) { """ Check the AttributeSet values have a attribute String, on user set the attribute resource. Form android styles namespace @param attrs AttributeSet @param attribute The attribute to retrieve @return If have the attribute return True """ return attrs.getAttributeValue(Ui.androidStyleNameSpace, attribute) != null; }
java
public static boolean isHaveAttribute(AttributeSet attrs, String attribute) { return attrs.getAttributeValue(Ui.androidStyleNameSpace, attribute) != null; }
[ "public", "static", "boolean", "isHaveAttribute", "(", "AttributeSet", "attrs", ",", "String", "attribute", ")", "{", "return", "attrs", ".", "getAttributeValue", "(", "Ui", ".", "androidStyleNameSpace", ",", "attribute", ")", "!=", "null", ";", "}" ]
Check the AttributeSet values have a attribute String, on user set the attribute resource. Form android styles namespace @param attrs AttributeSet @param attribute The attribute to retrieve @return If have the attribute return True
[ "Check", "the", "AttributeSet", "values", "have", "a", "attribute", "String", "on", "user", "set", "the", "attribute", "resource", ".", "Form", "android", "styles", "namespace" ]
train
https://github.com/qiujuer/Genius-Android/blob/babefaf1321f5883a21cada582b6fa5104adc648/caprice/ui/src/main/java/net/qiujuer/genius/ui/Ui.java#L241-L243
kotcrab/vis-ui
ui/src/main/java/com/kotcrab/vis/ui/util/form/SimpleFormValidator.java
SimpleFormValidator.valueLesserThan
public FormInputValidator valueLesserThan (VisValidatableTextField field, String errorMsg, float value, boolean validIfEqualsValue) { """ Validates if entered text is lesser (or equal) than entered number <p> Can be used in combination with {@link #integerNumber(VisValidatableTextField, String)} to only allows integers. """ ValidatorWrapper wrapper = new ValidatorWrapper(errorMsg, new LesserThanValidator(value, validIfEqualsValue)); field.addValidator(wrapper); add(field); return wrapper; }
java
public FormInputValidator valueLesserThan (VisValidatableTextField field, String errorMsg, float value, boolean validIfEqualsValue) { ValidatorWrapper wrapper = new ValidatorWrapper(errorMsg, new LesserThanValidator(value, validIfEqualsValue)); field.addValidator(wrapper); add(field); return wrapper; }
[ "public", "FormInputValidator", "valueLesserThan", "(", "VisValidatableTextField", "field", ",", "String", "errorMsg", ",", "float", "value", ",", "boolean", "validIfEqualsValue", ")", "{", "ValidatorWrapper", "wrapper", "=", "new", "ValidatorWrapper", "(", "errorMsg", ",", "new", "LesserThanValidator", "(", "value", ",", "validIfEqualsValue", ")", ")", ";", "field", ".", "addValidator", "(", "wrapper", ")", ";", "add", "(", "field", ")", ";", "return", "wrapper", ";", "}" ]
Validates if entered text is lesser (or equal) than entered number <p> Can be used in combination with {@link #integerNumber(VisValidatableTextField, String)} to only allows integers.
[ "Validates", "if", "entered", "text", "is", "lesser", "(", "or", "equal", ")", "than", "entered", "number", "<p", ">", "Can", "be", "used", "in", "combination", "with", "{" ]
train
https://github.com/kotcrab/vis-ui/blob/3b68f82d94ae32bffa2a3399c63f432e0f4908e0/ui/src/main/java/com/kotcrab/vis/ui/util/form/SimpleFormValidator.java#L152-L157
exoplatform/jcr
exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/artifact/rest/RESTArtifactLoaderService.java
RESTArtifactLoaderService.getRootNodeList
@GET public Response getRootNodeList(final @Context UriInfo uriInfo, final @QueryParam("view") String view, final @QueryParam("gadget") String gadget) { """ Browsing of root node of Maven repository. @param uriInfo @param view @param gadget @return {@link Response}. """ return getResource("", uriInfo, view, gadget); }
java
@GET public Response getRootNodeList(final @Context UriInfo uriInfo, final @QueryParam("view") String view, final @QueryParam("gadget") String gadget) { return getResource("", uriInfo, view, gadget); }
[ "@", "GET", "public", "Response", "getRootNodeList", "(", "final", "@", "Context", "UriInfo", "uriInfo", ",", "final", "@", "QueryParam", "(", "\"view\"", ")", "String", "view", ",", "final", "@", "QueryParam", "(", "\"gadget\"", ")", "String", "gadget", ")", "{", "return", "getResource", "(", "\"\"", ",", "uriInfo", ",", "view", ",", "gadget", ")", ";", "}" ]
Browsing of root node of Maven repository. @param uriInfo @param view @param gadget @return {@link Response}.
[ "Browsing", "of", "root", "node", "of", "Maven", "repository", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/artifact/rest/RESTArtifactLoaderService.java#L254-L259
Azure/azure-sdk-for-java
labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentSettingsInner.java
EnvironmentSettingsInner.beginCreateOrUpdate
public EnvironmentSettingInner beginCreateOrUpdate(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, EnvironmentSettingInner environmentSetting) { """ Create or replace an existing Environment Setting. This operation can take a while to complete. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param labName The name of the lab. @param environmentSettingName The name of the environment Setting. @param environmentSetting Represents settings of an environment, from which environment instances would be created @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the EnvironmentSettingInner object if successful. """ return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting).toBlocking().single().body(); }
java
public EnvironmentSettingInner beginCreateOrUpdate(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, EnvironmentSettingInner environmentSetting) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting).toBlocking().single().body(); }
[ "public", "EnvironmentSettingInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "labAccountName", ",", "String", "labName", ",", "String", "environmentSettingName", ",", "EnvironmentSettingInner", "environmentSetting", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "labAccountName", ",", "labName", ",", "environmentSettingName", ",", "environmentSetting", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Create or replace an existing Environment Setting. This operation can take a while to complete. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param labName The name of the lab. @param environmentSettingName The name of the environment Setting. @param environmentSetting Represents settings of an environment, from which environment instances would be created @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the EnvironmentSettingInner object if successful.
[ "Create", "or", "replace", "an", "existing", "Environment", "Setting", ".", "This", "operation", "can", "take", "a", "while", "to", "complete", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentSettingsInner.java#L707-L709
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMessageImpl.java
JsMessageImpl.appendList
protected void appendList(StringBuilder buff, String name, List list) { """ Helper method to append a list (which doesn't have a standard toString as in the case of JsVaringListImpl) to a summary trace string. Also provides hex output for byte arrays. """ buff.append(','); buff.append(name); buff.append("=["); if (list != null) { // Take a copy of the array, to be very sure it doesn't change under us Object[] items = list.toArray(); for (int i = 0; i < items.length; i++) { if (i != 0) buff.append(','); if (items[i] instanceof byte[]) { // Print out the bytes in hex. buff.append(HexUtil.toString((byte[])items[i])); } else { // Just use the default toString buff.append(items[i]); } } } buff.append(']'); } }
java
protected void appendList(StringBuilder buff, String name, List list) { buff.append(','); buff.append(name); buff.append("=["); if (list != null) { // Take a copy of the array, to be very sure it doesn't change under us Object[] items = list.toArray(); for (int i = 0; i < items.length; i++) { if (i != 0) buff.append(','); if (items[i] instanceof byte[]) { // Print out the bytes in hex. buff.append(HexUtil.toString((byte[])items[i])); } else { // Just use the default toString buff.append(items[i]); } } } buff.append(']'); } }
[ "protected", "void", "appendList", "(", "StringBuilder", "buff", ",", "String", "name", ",", "List", "list", ")", "{", "buff", ".", "append", "(", "'", "'", ")", ";", "buff", ".", "append", "(", "name", ")", ";", "buff", ".", "append", "(", "\"=[\"", ")", ";", "if", "(", "list", "!=", "null", ")", "{", "// Take a copy of the array, to be very sure it doesn't change under us", "Object", "[", "]", "items", "=", "list", ".", "toArray", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "items", ".", "length", ";", "i", "++", ")", "{", "if", "(", "i", "!=", "0", ")", "buff", ".", "append", "(", "'", "'", ")", ";", "if", "(", "items", "[", "i", "]", "instanceof", "byte", "[", "]", ")", "{", "// Print out the bytes in hex.", "buff", ".", "append", "(", "HexUtil", ".", "toString", "(", "(", "byte", "[", "]", ")", "items", "[", "i", "]", ")", ")", ";", "}", "else", "{", "// Just use the default toString", "buff", ".", "append", "(", "items", "[", "i", "]", ")", ";", "}", "}", "}", "buff", ".", "append", "(", "'", "'", ")", ";", "}", "}", "" ]
Helper method to append a list (which doesn't have a standard toString as in the case of JsVaringListImpl) to a summary trace string. Also provides hex output for byte arrays.
[ "Helper", "method", "to", "append", "a", "list", "(", "which", "doesn", "t", "have", "a", "standard", "toString", "as", "in", "the", "case", "of", "JsVaringListImpl", ")", "to", "a", "summary", "trace", "string", ".", "Also", "provides", "hex", "output", "for", "byte", "arrays", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMessageImpl.java#L958-L979
TheHortonMachine/hortonmachine
gui/src/main/java/org/hortonmachine/gui/utils/GuiUtilities.java
GuiUtilities.setFolderBrowsingOnWidgets
public static void setFolderBrowsingOnWidgets( JTextField pathTextField, JButton browseButton ) { """ Adds to a textfield and button the necessary to browse for a folder. @param pathTextField @param browseButton """ browseButton.addActionListener(e -> { File lastFile = GuiUtilities.getLastFile(); File[] res = showOpenFolderDialog(browseButton, "Select folder", false, lastFile); if (res != null && res.length == 1) { String absolutePath = res[0].getAbsolutePath(); pathTextField.setText(absolutePath); setLastPath(absolutePath); } }); }
java
public static void setFolderBrowsingOnWidgets( JTextField pathTextField, JButton browseButton ) { browseButton.addActionListener(e -> { File lastFile = GuiUtilities.getLastFile(); File[] res = showOpenFolderDialog(browseButton, "Select folder", false, lastFile); if (res != null && res.length == 1) { String absolutePath = res[0].getAbsolutePath(); pathTextField.setText(absolutePath); setLastPath(absolutePath); } }); }
[ "public", "static", "void", "setFolderBrowsingOnWidgets", "(", "JTextField", "pathTextField", ",", "JButton", "browseButton", ")", "{", "browseButton", ".", "addActionListener", "(", "e", "->", "{", "File", "lastFile", "=", "GuiUtilities", ".", "getLastFile", "(", ")", ";", "File", "[", "]", "res", "=", "showOpenFolderDialog", "(", "browseButton", ",", "\"Select folder\"", ",", "false", ",", "lastFile", ")", ";", "if", "(", "res", "!=", "null", "&&", "res", ".", "length", "==", "1", ")", "{", "String", "absolutePath", "=", "res", "[", "0", "]", ".", "getAbsolutePath", "(", ")", ";", "pathTextField", ".", "setText", "(", "absolutePath", ")", ";", "setLastPath", "(", "absolutePath", ")", ";", "}", "}", ")", ";", "}" ]
Adds to a textfield and button the necessary to browse for a folder. @param pathTextField @param browseButton
[ "Adds", "to", "a", "textfield", "and", "button", "the", "necessary", "to", "browse", "for", "a", "folder", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gui/src/main/java/org/hortonmachine/gui/utils/GuiUtilities.java#L550-L560
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java
SourceLineAnnotation.fromVisitedInstruction
public static SourceLineAnnotation fromVisitedInstruction(ClassContext classContext, PreorderVisitor visitor, int pc) { """ Factory method for creating a source line annotation describing the source line number for the instruction being visited by given visitor. @param classContext the ClassContext @param visitor a BetterVisitor which is visiting the method @param pc the bytecode offset of the instruction in the method @return the SourceLineAnnotation, or null if we do not have line number information for the instruction """ return fromVisitedInstructionRange(classContext, visitor, pc, pc); }
java
public static SourceLineAnnotation fromVisitedInstruction(ClassContext classContext, PreorderVisitor visitor, int pc) { return fromVisitedInstructionRange(classContext, visitor, pc, pc); }
[ "public", "static", "SourceLineAnnotation", "fromVisitedInstruction", "(", "ClassContext", "classContext", ",", "PreorderVisitor", "visitor", ",", "int", "pc", ")", "{", "return", "fromVisitedInstructionRange", "(", "classContext", ",", "visitor", ",", "pc", ",", "pc", ")", ";", "}" ]
Factory method for creating a source line annotation describing the source line number for the instruction being visited by given visitor. @param classContext the ClassContext @param visitor a BetterVisitor which is visiting the method @param pc the bytecode offset of the instruction in the method @return the SourceLineAnnotation, or null if we do not have line number information for the instruction
[ "Factory", "method", "for", "creating", "a", "source", "line", "annotation", "describing", "the", "source", "line", "number", "for", "the", "instruction", "being", "visited", "by", "given", "visitor", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java#L384-L386
Azure/azure-sdk-for-java
labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentsInner.java
EnvironmentsInner.beginStartAsync
public Observable<Void> beginStartAsync(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, String environmentName) { """ Starts an environment by starting all resources inside the environment. This operation can take a while to complete. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param labName The name of the lab. @param environmentSettingName The name of the environment Setting. @param environmentName The name of the environment. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful. """ return beginStartWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> beginStartAsync(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, String environmentName) { return beginStartWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "beginStartAsync", "(", "String", "resourceGroupName", ",", "String", "labAccountName", ",", "String", "labName", ",", "String", "environmentSettingName", ",", "String", "environmentName", ")", "{", "return", "beginStartWithServiceResponseAsync", "(", "resourceGroupName", ",", "labAccountName", ",", "labName", ",", "environmentSettingName", ",", "environmentName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Void", ">", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "call", "(", "ServiceResponse", "<", "Void", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Starts an environment by starting all resources inside the environment. This operation can take a while to complete. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param labName The name of the lab. @param environmentSettingName The name of the environment Setting. @param environmentName The name of the environment. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Starts", "an", "environment", "by", "starting", "all", "resources", "inside", "the", "environment", ".", "This", "operation", "can", "take", "a", "while", "to", "complete", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentsInner.java#L1510-L1517
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java
ValueEnforcer.isBetweenInclusive
public static double isBetweenInclusive (final double dValue, final String sName, final double dLowerBoundInclusive, final double dUpperBoundInclusive) { """ Check if <code>nValue &ge; nLowerBoundInclusive &amp;&amp; nValue &le; nUpperBoundInclusive</code> @param dValue Value @param sName Name @param dLowerBoundInclusive Lower bound @param dUpperBoundInclusive Upper bound @return The value """ if (isEnabled ()) return isBetweenInclusive (dValue, () -> sName, dLowerBoundInclusive, dUpperBoundInclusive); return dValue; }
java
public static double isBetweenInclusive (final double dValue, final String sName, final double dLowerBoundInclusive, final double dUpperBoundInclusive) { if (isEnabled ()) return isBetweenInclusive (dValue, () -> sName, dLowerBoundInclusive, dUpperBoundInclusive); return dValue; }
[ "public", "static", "double", "isBetweenInclusive", "(", "final", "double", "dValue", ",", "final", "String", "sName", ",", "final", "double", "dLowerBoundInclusive", ",", "final", "double", "dUpperBoundInclusive", ")", "{", "if", "(", "isEnabled", "(", ")", ")", "return", "isBetweenInclusive", "(", "dValue", ",", "(", ")", "->", "sName", ",", "dLowerBoundInclusive", ",", "dUpperBoundInclusive", ")", ";", "return", "dValue", ";", "}" ]
Check if <code>nValue &ge; nLowerBoundInclusive &amp;&amp; nValue &le; nUpperBoundInclusive</code> @param dValue Value @param sName Name @param dLowerBoundInclusive Lower bound @param dUpperBoundInclusive Upper bound @return The value
[ "Check", "if", "<code", ">", "nValue", "&ge", ";", "nLowerBoundInclusive", "&amp", ";", "&amp", ";", "nValue", "&le", ";", "nUpperBoundInclusive<", "/", "code", ">" ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java#L2445-L2453
betfair/cougar
cougar-framework/socket-transport/src/main/java/com/betfair/cougar/transport/socket/PooledServerConnectedObjectManager.java
PooledServerConnectedObjectManager.terminateSubscriptions
private void terminateSubscriptions(IoSession session, String heapUri, Subscription.CloseReason reason) { """ Terminates all subscriptions to a given heap from a single session """ terminateSubscriptions(session, heapStates.get(heapUri), heapUri, reason); }
java
private void terminateSubscriptions(IoSession session, String heapUri, Subscription.CloseReason reason) { terminateSubscriptions(session, heapStates.get(heapUri), heapUri, reason); }
[ "private", "void", "terminateSubscriptions", "(", "IoSession", "session", ",", "String", "heapUri", ",", "Subscription", ".", "CloseReason", "reason", ")", "{", "terminateSubscriptions", "(", "session", ",", "heapStates", ".", "get", "(", "heapUri", ")", ",", "heapUri", ",", "reason", ")", ";", "}" ]
Terminates all subscriptions to a given heap from a single session
[ "Terminates", "all", "subscriptions", "to", "a", "given", "heap", "from", "a", "single", "session" ]
train
https://github.com/betfair/cougar/blob/08d1fe338fbd0e8572a9c2305bb5796402d5b1f5/cougar-framework/socket-transport/src/main/java/com/betfair/cougar/transport/socket/PooledServerConnectedObjectManager.java#L412-L414
aol/cyclops
cyclops/src/main/java/cyclops/companion/Functions.java
Functions.flatMapDoubles
public static Function<? super ReactiveSeq<Double>, ? extends ReactiveSeq<Double>> flatMapDoubles(DoubleFunction<? extends DoubleStream> b) { """ /* Fluent flatMap operation using primitive types e.g. <pre> {@code import static cyclops.ReactiveSeq.flatMapDoubles; ReactiveSeq.ofDoubles(1d,2d,3d) .to(flatMapDoubles(i->DoubleStream.of(i*2))); //[2d,4d,6d] } </pre> """ return a->a.doubles(i->i,s->s.flatMap(b)); }
java
public static Function<? super ReactiveSeq<Double>, ? extends ReactiveSeq<Double>> flatMapDoubles(DoubleFunction<? extends DoubleStream> b){ return a->a.doubles(i->i,s->s.flatMap(b)); }
[ "public", "static", "Function", "<", "?", "super", "ReactiveSeq", "<", "Double", ">", ",", "?", "extends", "ReactiveSeq", "<", "Double", ">", ">", "flatMapDoubles", "(", "DoubleFunction", "<", "?", "extends", "DoubleStream", ">", "b", ")", "{", "return", "a", "->", "a", ".", "doubles", "(", "i", "->", "i", ",", "s", "->", "s", ".", "flatMap", "(", "b", ")", ")", ";", "}" ]
/* Fluent flatMap operation using primitive types e.g. <pre> {@code import static cyclops.ReactiveSeq.flatMapDoubles; ReactiveSeq.ofDoubles(1d,2d,3d) .to(flatMapDoubles(i->DoubleStream.of(i*2))); //[2d,4d,6d] } </pre>
[ "/", "*", "Fluent", "flatMap", "operation", "using", "primitive", "types", "e", ".", "g", ".", "<pre", ">", "{", "@code", "import", "static", "cyclops", ".", "ReactiveSeq", ".", "flatMapDoubles", ";" ]
train
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Functions.java#L537-L540
eclipse/hawkbit
hawkbit-repository/hawkbit-repository-core/src/main/java/org/eclipse/hawkbit/repository/RolloutStatusCache.java
RolloutStatusCache.putRolloutGroupStatus
public void putRolloutGroupStatus(final Long groupId, final List<TotalTargetCountActionStatus> status) { """ Put {@link TotalTargetCountActionStatus} for multiple {@link RolloutGroup}s into cache. @param groupId the cache entries belong to @param status list to cache """ final Cache cache = cacheManager.getCache(CACHE_GR_NAME); putIntoCache(groupId, status, cache); }
java
public void putRolloutGroupStatus(final Long groupId, final List<TotalTargetCountActionStatus> status) { final Cache cache = cacheManager.getCache(CACHE_GR_NAME); putIntoCache(groupId, status, cache); }
[ "public", "void", "putRolloutGroupStatus", "(", "final", "Long", "groupId", ",", "final", "List", "<", "TotalTargetCountActionStatus", ">", "status", ")", "{", "final", "Cache", "cache", "=", "cacheManager", ".", "getCache", "(", "CACHE_GR_NAME", ")", ";", "putIntoCache", "(", "groupId", ",", "status", ",", "cache", ")", ";", "}" ]
Put {@link TotalTargetCountActionStatus} for multiple {@link RolloutGroup}s into cache. @param groupId the cache entries belong to @param status list to cache
[ "Put", "{", "@link", "TotalTargetCountActionStatus", "}", "for", "multiple", "{", "@link", "RolloutGroup", "}", "s", "into", "cache", "." ]
train
https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-core/src/main/java/org/eclipse/hawkbit/repository/RolloutStatusCache.java#L171-L174
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/media/MediaClient.java
MediaClient.getPipeline
public GetPipelineResponse getPipeline(GetPipelineRequest request) { """ Gets a pipeline with the specified pipeline name. @param request The request object containing all options for getting a pipelines. @return The information of your pipeline. """ checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getPipelineName(), "The parameter pipelineName should NOT be null or empty string."); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, PIPELINE, request.getPipelineName()); return invokeHttpClient(internalRequest, GetPipelineResponse.class); }
java
public GetPipelineResponse getPipeline(GetPipelineRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getPipelineName(), "The parameter pipelineName should NOT be null or empty string."); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, PIPELINE, request.getPipelineName()); return invokeHttpClient(internalRequest, GetPipelineResponse.class); }
[ "public", "GetPipelineResponse", "getPipeline", "(", "GetPipelineRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getPipelineName", "(", ")", ",", "\"The parameter pipelineName should NOT be null or empty string.\"", ")", ";", "InternalRequest", "internalRequest", "=", "createRequest", "(", "HttpMethodName", ".", "GET", ",", "request", ",", "PIPELINE", ",", "request", ".", "getPipelineName", "(", ")", ")", ";", "return", "invokeHttpClient", "(", "internalRequest", ",", "GetPipelineResponse", ".", "class", ")", ";", "}" ]
Gets a pipeline with the specified pipeline name. @param request The request object containing all options for getting a pipelines. @return The information of your pipeline.
[ "Gets", "a", "pipeline", "with", "the", "specified", "pipeline", "name", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/media/MediaClient.java#L632-L640
Alluxio/alluxio
core/common/src/main/java/alluxio/grpc/GrpcSerializationUtils.java
GrpcSerializationUtils.overrideMethods
public static ServerServiceDefinition overrideMethods( final ServerServiceDefinition service, final Map<MethodDescriptor, MethodDescriptor> marshallers) { """ Creates a service definition that uses custom marshallers. @param service the service to intercept @param marshallers a map that specifies which marshaller to use for each method @return the new service definition """ List<ServerMethodDefinition<?, ?>> newMethods = new ArrayList<ServerMethodDefinition<?, ?>>(); List<MethodDescriptor<?, ?>> newDescriptors = new ArrayList<MethodDescriptor<?, ?>>(); // intercepts the descriptors for (final ServerMethodDefinition<?, ?> definition : service.getMethods()) { ServerMethodDefinition<?, ?> newMethod = interceptMethod(definition, marshallers); newDescriptors.add(newMethod.getMethodDescriptor()); newMethods.add(newMethod); } // builds the new service descriptor final ServerServiceDefinition.Builder serviceBuilder = ServerServiceDefinition .builder(new ServiceDescriptor(service.getServiceDescriptor().getName(), newDescriptors)); // creates the new service definition for (ServerMethodDefinition<?, ?> definition : newMethods) { serviceBuilder.addMethod(definition); } return serviceBuilder.build(); }
java
public static ServerServiceDefinition overrideMethods( final ServerServiceDefinition service, final Map<MethodDescriptor, MethodDescriptor> marshallers) { List<ServerMethodDefinition<?, ?>> newMethods = new ArrayList<ServerMethodDefinition<?, ?>>(); List<MethodDescriptor<?, ?>> newDescriptors = new ArrayList<MethodDescriptor<?, ?>>(); // intercepts the descriptors for (final ServerMethodDefinition<?, ?> definition : service.getMethods()) { ServerMethodDefinition<?, ?> newMethod = interceptMethod(definition, marshallers); newDescriptors.add(newMethod.getMethodDescriptor()); newMethods.add(newMethod); } // builds the new service descriptor final ServerServiceDefinition.Builder serviceBuilder = ServerServiceDefinition .builder(new ServiceDescriptor(service.getServiceDescriptor().getName(), newDescriptors)); // creates the new service definition for (ServerMethodDefinition<?, ?> definition : newMethods) { serviceBuilder.addMethod(definition); } return serviceBuilder.build(); }
[ "public", "static", "ServerServiceDefinition", "overrideMethods", "(", "final", "ServerServiceDefinition", "service", ",", "final", "Map", "<", "MethodDescriptor", ",", "MethodDescriptor", ">", "marshallers", ")", "{", "List", "<", "ServerMethodDefinition", "<", "?", ",", "?", ">", ">", "newMethods", "=", "new", "ArrayList", "<", "ServerMethodDefinition", "<", "?", ",", "?", ">", ">", "(", ")", ";", "List", "<", "MethodDescriptor", "<", "?", ",", "?", ">", ">", "newDescriptors", "=", "new", "ArrayList", "<", "MethodDescriptor", "<", "?", ",", "?", ">", ">", "(", ")", ";", "// intercepts the descriptors", "for", "(", "final", "ServerMethodDefinition", "<", "?", ",", "?", ">", "definition", ":", "service", ".", "getMethods", "(", ")", ")", "{", "ServerMethodDefinition", "<", "?", ",", "?", ">", "newMethod", "=", "interceptMethod", "(", "definition", ",", "marshallers", ")", ";", "newDescriptors", ".", "add", "(", "newMethod", ".", "getMethodDescriptor", "(", ")", ")", ";", "newMethods", ".", "add", "(", "newMethod", ")", ";", "}", "// builds the new service descriptor", "final", "ServerServiceDefinition", ".", "Builder", "serviceBuilder", "=", "ServerServiceDefinition", ".", "builder", "(", "new", "ServiceDescriptor", "(", "service", ".", "getServiceDescriptor", "(", ")", ".", "getName", "(", ")", ",", "newDescriptors", ")", ")", ";", "// creates the new service definition", "for", "(", "ServerMethodDefinition", "<", "?", ",", "?", ">", "definition", ":", "newMethods", ")", "{", "serviceBuilder", ".", "addMethod", "(", "definition", ")", ";", "}", "return", "serviceBuilder", ".", "build", "(", ")", ";", "}" ]
Creates a service definition that uses custom marshallers. @param service the service to intercept @param marshallers a map that specifies which marshaller to use for each method @return the new service definition
[ "Creates", "a", "service", "definition", "that", "uses", "custom", "marshallers", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/grpc/GrpcSerializationUtils.java#L209-L228
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/Resources.java
Resources.getResource
@Pure public static URL getResource(ClassLoader classLoader, String path) { """ Replies the URL of a resource. <p>You may use Unix-like syntax to write the resource path, ie. you may use slashes to separate filenames. <p>If the {@code classLoader} parameter is <code>null</code>, the class loader replied by {@link ClassLoaderFinder} is used. If this last is <code>null</code>, the class loader of the Resources class is used. @param classLoader is the research scope. If <code>null</code>, the class loader replied by {@link ClassLoaderFinder} is used. @param path is the absolute path of the resource. @return the url of the resource or <code>null</code> if the resource was not found in class paths. """ return currentResourceInstance.getResource(classLoader, path); }
java
@Pure public static URL getResource(ClassLoader classLoader, String path) { return currentResourceInstance.getResource(classLoader, path); }
[ "@", "Pure", "public", "static", "URL", "getResource", "(", "ClassLoader", "classLoader", ",", "String", "path", ")", "{", "return", "currentResourceInstance", ".", "getResource", "(", "classLoader", ",", "path", ")", ";", "}" ]
Replies the URL of a resource. <p>You may use Unix-like syntax to write the resource path, ie. you may use slashes to separate filenames. <p>If the {@code classLoader} parameter is <code>null</code>, the class loader replied by {@link ClassLoaderFinder} is used. If this last is <code>null</code>, the class loader of the Resources class is used. @param classLoader is the research scope. If <code>null</code>, the class loader replied by {@link ClassLoaderFinder} is used. @param path is the absolute path of the resource. @return the url of the resource or <code>null</code> if the resource was not found in class paths.
[ "Replies", "the", "URL", "of", "a", "resource", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/Resources.java#L193-L196
jakenjarvis/Android-OrmLiteContentProvider
ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherPattern.java
MatcherPattern.setContentUri
public MatcherPattern setContentUri(String authority, String path) { """ Set the ContentUri. This is used when you are not using the DefaultContentUri annotation, or want to override the setting of the DefaultContentUri annotation. This method can not be called after MatcherController#hasPreinitialized(). @see com.tojc.ormlite.android.annotation.AdditionalAnnotation.DefaultContentUri @see com.tojc.ormlite.android.framework.MatcherController#hasPreinitialized() @param authority @param path @return Instance of the MatcherPattern class. """ return this.setContentUri(new ContentUriInfo(authority, path)); }
java
public MatcherPattern setContentUri(String authority, String path) { return this.setContentUri(new ContentUriInfo(authority, path)); }
[ "public", "MatcherPattern", "setContentUri", "(", "String", "authority", ",", "String", "path", ")", "{", "return", "this", ".", "setContentUri", "(", "new", "ContentUriInfo", "(", "authority", ",", "path", ")", ")", ";", "}" ]
Set the ContentUri. This is used when you are not using the DefaultContentUri annotation, or want to override the setting of the DefaultContentUri annotation. This method can not be called after MatcherController#hasPreinitialized(). @see com.tojc.ormlite.android.annotation.AdditionalAnnotation.DefaultContentUri @see com.tojc.ormlite.android.framework.MatcherController#hasPreinitialized() @param authority @param path @return Instance of the MatcherPattern class.
[ "Set", "the", "ContentUri", ".", "This", "is", "used", "when", "you", "are", "not", "using", "the", "DefaultContentUri", "annotation", "or", "want", "to", "override", "the", "setting", "of", "the", "DefaultContentUri", "annotation", ".", "This", "method", "can", "not", "be", "called", "after", "MatcherController#hasPreinitialized", "()", "." ]
train
https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherPattern.java#L156-L158