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
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
ahome-it/lienzo-core
src/main/java/com/ait/lienzo/client/core/shape/GroupOf.java
GroupOf.setScale
@Override public C setScale(final double x, final double y) { """ Sets this gruop's scale, starting at the given x and y @param x @param y @return Group this Group """ getAttributes().setScale(x, y); return cast(); }
java
@Override public C setScale(final double x, final double y) { getAttributes().setScale(x, y); return cast(); }
[ "@", "Override", "public", "C", "setScale", "(", "final", "double", "x", ",", "final", "double", "y", ")", "{", "getAttributes", "(", ")", ".", "setScale", "(", "x", ",", "y", ")", ";", "return", "cast", "(", ")", ";", "}" ]
Sets this gruop's scale, starting at the given x and y @param x @param y @return Group this Group
[ "Sets", "this", "gruop", "s", "scale", "starting", "at", "the", "given", "x", "and", "y" ]
train
https://github.com/ahome-it/lienzo-core/blob/8e03723700dec366f77064d12fb8676d8cd6be99/src/main/java/com/ait/lienzo/client/core/shape/GroupOf.java#L401-L407
sebastiangraf/treetank
interfacemodules/jax-rx/src/main/java/org/treetank/service/jaxrx/util/RESTResponseHelper.java
RESTResponseHelper.createCollectionElementDBs
private static List<Element> createCollectionElementDBs(final IStorage pDatabase, final Document document, final IBackendFactory pStorageFac, final IRevisioning pRevision) throws WebApplicationException, TTException { """ This method creates the XML element containing a collection. This collection contains the available resources which are children of the database. @param pDatabase path where the data must be stored @param document The XML {@link Document} instance. @return A list of XML {@link Element} as the collection. @throws TTException @throws WebApplicationException """ final List<Element> collectionsEls = new ArrayList<Element>(); for (final String res : pDatabase.listResources()) { final Element elRes = document.createElement("resource"); // Getting the name elRes.setAttribute("name", res); // get last revision from given db name final DatabaseRepresentation dbWorker = new DatabaseRepresentation(pDatabase, pStorageFac, pRevision); final String lastRevision = Long.toString(dbWorker.getLastRevision(res.toString())); elRes.setAttribute("lastRevision", lastRevision); collectionsEls.add(elRes); } return collectionsEls; }
java
private static List<Element> createCollectionElementDBs(final IStorage pDatabase, final Document document, final IBackendFactory pStorageFac, final IRevisioning pRevision) throws WebApplicationException, TTException { final List<Element> collectionsEls = new ArrayList<Element>(); for (final String res : pDatabase.listResources()) { final Element elRes = document.createElement("resource"); // Getting the name elRes.setAttribute("name", res); // get last revision from given db name final DatabaseRepresentation dbWorker = new DatabaseRepresentation(pDatabase, pStorageFac, pRevision); final String lastRevision = Long.toString(dbWorker.getLastRevision(res.toString())); elRes.setAttribute("lastRevision", lastRevision); collectionsEls.add(elRes); } return collectionsEls; }
[ "private", "static", "List", "<", "Element", ">", "createCollectionElementDBs", "(", "final", "IStorage", "pDatabase", ",", "final", "Document", "document", ",", "final", "IBackendFactory", "pStorageFac", ",", "final", "IRevisioning", "pRevision", ")", "throws", "WebApplicationException", ",", "TTException", "{", "final", "List", "<", "Element", ">", "collectionsEls", "=", "new", "ArrayList", "<", "Element", ">", "(", ")", ";", "for", "(", "final", "String", "res", ":", "pDatabase", ".", "listResources", "(", ")", ")", "{", "final", "Element", "elRes", "=", "document", ".", "createElement", "(", "\"resource\"", ")", ";", "// Getting the name", "elRes", ".", "setAttribute", "(", "\"name\"", ",", "res", ")", ";", "// get last revision from given db name", "final", "DatabaseRepresentation", "dbWorker", "=", "new", "DatabaseRepresentation", "(", "pDatabase", ",", "pStorageFac", ",", "pRevision", ")", ";", "final", "String", "lastRevision", "=", "Long", ".", "toString", "(", "dbWorker", ".", "getLastRevision", "(", "res", ".", "toString", "(", ")", ")", ")", ";", "elRes", ".", "setAttribute", "(", "\"lastRevision\"", ",", "lastRevision", ")", ";", "collectionsEls", ".", "add", "(", "elRes", ")", ";", "}", "return", "collectionsEls", ";", "}" ]
This method creates the XML element containing a collection. This collection contains the available resources which are children of the database. @param pDatabase path where the data must be stored @param document The XML {@link Document} instance. @return A list of XML {@link Element} as the collection. @throws TTException @throws WebApplicationException
[ "This", "method", "creates", "the", "XML", "element", "containing", "a", "collection", ".", "This", "collection", "contains", "the", "available", "resources", "which", "are", "children", "of", "the", "database", "." ]
train
https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/jax-rx/src/main/java/org/treetank/service/jaxrx/util/RESTResponseHelper.java#L112-L131
kaazing/gateway
transport/http/src/main/java/org/kaazing/gateway/transport/http/HttpUtils.java
HttpUtils.getCanonicalURI
public static URI getCanonicalURI(String uriString, boolean canonicalizePath) { """ Create a canonical URI from a given URI. A canonical URI is a URI with:<ul> <li>the host part of the authority lower-case since URI semantics dictate that hostnames are case insensitive <li>(optionally, NOT appropriate for Origin headers) the path part set to "/" if there was no path in the input URI (this conforms to the WebSocket and HTTP protocol specifications and avoids us having to do special handling for path throughout the server code). </ul> @param uriString the URI to canonicalize, in string form @param canonicalizePath if true, append trailing '/' when missing @return a URI with the host part of the authority lower-case and (optionally) trailing / added, or null if the uri is null @throws IllegalArgumentException if the uriString is not valid syntax """ if ((uriString != null) && !"".equals(uriString)) { return getCanonicalURI(URI.create(uriString), canonicalizePath); } return null; }
java
public static URI getCanonicalURI(String uriString, boolean canonicalizePath) { if ((uriString != null) && !"".equals(uriString)) { return getCanonicalURI(URI.create(uriString), canonicalizePath); } return null; }
[ "public", "static", "URI", "getCanonicalURI", "(", "String", "uriString", ",", "boolean", "canonicalizePath", ")", "{", "if", "(", "(", "uriString", "!=", "null", ")", "&&", "!", "\"\"", ".", "equals", "(", "uriString", ")", ")", "{", "return", "getCanonicalURI", "(", "URI", ".", "create", "(", "uriString", ")", ",", "canonicalizePath", ")", ";", "}", "return", "null", ";", "}" ]
Create a canonical URI from a given URI. A canonical URI is a URI with:<ul> <li>the host part of the authority lower-case since URI semantics dictate that hostnames are case insensitive <li>(optionally, NOT appropriate for Origin headers) the path part set to "/" if there was no path in the input URI (this conforms to the WebSocket and HTTP protocol specifications and avoids us having to do special handling for path throughout the server code). </ul> @param uriString the URI to canonicalize, in string form @param canonicalizePath if true, append trailing '/' when missing @return a URI with the host part of the authority lower-case and (optionally) trailing / added, or null if the uri is null @throws IllegalArgumentException if the uriString is not valid syntax
[ "Create", "a", "canonical", "URI", "from", "a", "given", "URI", ".", "A", "canonical", "URI", "is", "a", "URI", "with", ":", "<ul", ">", "<li", ">", "the", "host", "part", "of", "the", "authority", "lower", "-", "case", "since", "URI", "semantics", "dictate", "that", "hostnames", "are", "case", "insensitive", "<li", ">", "(", "optionally", "NOT", "appropriate", "for", "Origin", "headers", ")", "the", "path", "part", "set", "to", "/", "if", "there", "was", "no", "path", "in", "the", "input", "URI", "(", "this", "conforms", "to", "the", "WebSocket", "and", "HTTP", "protocol", "specifications", "and", "avoids", "us", "having", "to", "do", "special", "handling", "for", "path", "throughout", "the", "server", "code", ")", ".", "<", "/", "ul", ">" ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/http/src/main/java/org/kaazing/gateway/transport/http/HttpUtils.java#L503-L508
JM-Lab/utils-java8
src/main/java/kr/jm/utils/helper/JMLambda.java
JMLambda.functionIfTrue
public static <T, R> Optional<R> functionIfTrue(boolean bool, T target, Function<T, R> function) { """ Function if true optional. @param <T> the type parameter @param <R> the type parameter @param bool the bool @param target the target @param function the function @return the optional """ return supplierIfTrue(bool, () -> function.apply(target)); }
java
public static <T, R> Optional<R> functionIfTrue(boolean bool, T target, Function<T, R> function) { return supplierIfTrue(bool, () -> function.apply(target)); }
[ "public", "static", "<", "T", ",", "R", ">", "Optional", "<", "R", ">", "functionIfTrue", "(", "boolean", "bool", ",", "T", "target", ",", "Function", "<", "T", ",", "R", ">", "function", ")", "{", "return", "supplierIfTrue", "(", "bool", ",", "(", ")", "->", "function", ".", "apply", "(", "target", ")", ")", ";", "}" ]
Function if true optional. @param <T> the type parameter @param <R> the type parameter @param bool the bool @param target the target @param function the function @return the optional
[ "Function", "if", "true", "optional", "." ]
train
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/helper/JMLambda.java#L269-L272
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/reflect/ReflectionUtils.java
ReflectionUtils.getValue
@SuppressWarnings("unchecked") public static <T> T getValue(Class<?> type, String fieldName, Class<T> fieldType) { """ Gets the value of the field with the specified name on the given class type cast to the desired field type. This method assumes the field is a static (class) member field. @param <T> the desired return type in which the field's value will be cast; should be compatible with the field's declared type. @param type the Class type on which the field is declared and defined. @param fieldName a String indicating the name of the field from which to get the value. @param fieldType the declared type of the class field. @return the value of the specified field on the given class type cast to the desired type. @throws IllegalArgumentException if the given class type does not declare a static member field with the specified name. @throws FieldAccessException if the value for the specified field could not be retrieved. @see #getField(Class, String) @see #getValue(Object, java.lang.reflect.Field, Class) """ try { return getValue(null, getField(type, fieldName), fieldType); } catch (FieldNotFoundException e) { throw new IllegalArgumentException(String.format("Field with name (%1$s) does not exist on class type (%2$s)!", fieldName, type.getName()), e); } }
java
@SuppressWarnings("unchecked") public static <T> T getValue(Class<?> type, String fieldName, Class<T> fieldType) { try { return getValue(null, getField(type, fieldName), fieldType); } catch (FieldNotFoundException e) { throw new IllegalArgumentException(String.format("Field with name (%1$s) does not exist on class type (%2$s)!", fieldName, type.getName()), e); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "T", "getValue", "(", "Class", "<", "?", ">", "type", ",", "String", "fieldName", ",", "Class", "<", "T", ">", "fieldType", ")", "{", "try", "{", "return", "getValue", "(", "null", ",", "getField", "(", "type", ",", "fieldName", ")", ",", "fieldType", ")", ";", "}", "catch", "(", "FieldNotFoundException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "\"Field with name (%1$s) does not exist on class type (%2$s)!\"", ",", "fieldName", ",", "type", ".", "getName", "(", ")", ")", ",", "e", ")", ";", "}", "}" ]
Gets the value of the field with the specified name on the given class type cast to the desired field type. This method assumes the field is a static (class) member field. @param <T> the desired return type in which the field's value will be cast; should be compatible with the field's declared type. @param type the Class type on which the field is declared and defined. @param fieldName a String indicating the name of the field from which to get the value. @param fieldType the declared type of the class field. @return the value of the specified field on the given class type cast to the desired type. @throws IllegalArgumentException if the given class type does not declare a static member field with the specified name. @throws FieldAccessException if the value for the specified field could not be retrieved. @see #getField(Class, String) @see #getValue(Object, java.lang.reflect.Field, Class)
[ "Gets", "the", "value", "of", "the", "field", "with", "the", "specified", "name", "on", "the", "given", "class", "type", "cast", "to", "the", "desired", "field", "type", ".", "This", "method", "assumes", "the", "field", "is", "a", "static", "(", "class", ")", "member", "field", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/reflect/ReflectionUtils.java#L100-L109
GeoLatte/geolatte-common
src/main/java/org/geolatte/common/dataformats/json/to/GeoJsonToAssembler.java
GeoJsonToAssembler.createPointSequence
private PointSequence createPointSequence(double[][] coordinates, CrsId crsId) { """ Helpermethod that creates a geolatte pointsequence starting from an array containing coordinate arrays @param coordinates an array containing coordinate arrays @return a geolatte pointsequence or null if the coordinatesequence was null """ if (coordinates == null) { return null; } else if (coordinates.length == 0) { return PointCollectionFactory.createEmpty(); } DimensionalFlag df = coordinates[0].length == 4 ? DimensionalFlag.d3DM : coordinates[0].length == 3 ? DimensionalFlag.d3D : DimensionalFlag.d2D; PointSequenceBuilder psb = PointSequenceBuilders.variableSized(df, crsId); for (double[] point : coordinates) { psb.add(point); } return psb.toPointSequence(); }
java
private PointSequence createPointSequence(double[][] coordinates, CrsId crsId) { if (coordinates == null) { return null; } else if (coordinates.length == 0) { return PointCollectionFactory.createEmpty(); } DimensionalFlag df = coordinates[0].length == 4 ? DimensionalFlag.d3DM : coordinates[0].length == 3 ? DimensionalFlag.d3D : DimensionalFlag.d2D; PointSequenceBuilder psb = PointSequenceBuilders.variableSized(df, crsId); for (double[] point : coordinates) { psb.add(point); } return psb.toPointSequence(); }
[ "private", "PointSequence", "createPointSequence", "(", "double", "[", "]", "[", "]", "coordinates", ",", "CrsId", "crsId", ")", "{", "if", "(", "coordinates", "==", "null", ")", "{", "return", "null", ";", "}", "else", "if", "(", "coordinates", ".", "length", "==", "0", ")", "{", "return", "PointCollectionFactory", ".", "createEmpty", "(", ")", ";", "}", "DimensionalFlag", "df", "=", "coordinates", "[", "0", "]", ".", "length", "==", "4", "?", "DimensionalFlag", ".", "d3DM", ":", "coordinates", "[", "0", "]", ".", "length", "==", "3", "?", "DimensionalFlag", ".", "d3D", ":", "DimensionalFlag", ".", "d2D", ";", "PointSequenceBuilder", "psb", "=", "PointSequenceBuilders", ".", "variableSized", "(", "df", ",", "crsId", ")", ";", "for", "(", "double", "[", "]", "point", ":", "coordinates", ")", "{", "psb", ".", "add", "(", "point", ")", ";", "}", "return", "psb", ".", "toPointSequence", "(", ")", ";", "}" ]
Helpermethod that creates a geolatte pointsequence starting from an array containing coordinate arrays @param coordinates an array containing coordinate arrays @return a geolatte pointsequence or null if the coordinatesequence was null
[ "Helpermethod", "that", "creates", "a", "geolatte", "pointsequence", "starting", "from", "an", "array", "containing", "coordinate", "arrays" ]
train
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/to/GeoJsonToAssembler.java#L460-L473
shrinkwrap/descriptors
metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/Metadata.java
Metadata.addGroupElement
public void addGroupElement(final String groupName, final MetadataElement groupElement) { """ Adds a new element to the specific group element class. If no group element class is found, then a new group element class. will be created. @param groupName the group class name of @param groupElement the new element to be added. """ for (MetadataItem item : groupList) { if (item.getName().equals(groupName) && item.getNamespace().equals(getCurrentNamespace())) { item.getElements().add(groupElement); return; } } final MetadataItem newItem = new MetadataItem(groupName); newItem.getElements().add(groupElement); newItem.setNamespace(getCurrentNamespace()); newItem.setSchemaName(getCurrentSchmema()); newItem.setPackageApi(getCurrentPackageApi()); newItem.setPackageImpl(getCurrentPackageImpl()); groupList.add(newItem); }
java
public void addGroupElement(final String groupName, final MetadataElement groupElement) { for (MetadataItem item : groupList) { if (item.getName().equals(groupName) && item.getNamespace().equals(getCurrentNamespace())) { item.getElements().add(groupElement); return; } } final MetadataItem newItem = new MetadataItem(groupName); newItem.getElements().add(groupElement); newItem.setNamespace(getCurrentNamespace()); newItem.setSchemaName(getCurrentSchmema()); newItem.setPackageApi(getCurrentPackageApi()); newItem.setPackageImpl(getCurrentPackageImpl()); groupList.add(newItem); }
[ "public", "void", "addGroupElement", "(", "final", "String", "groupName", ",", "final", "MetadataElement", "groupElement", ")", "{", "for", "(", "MetadataItem", "item", ":", "groupList", ")", "{", "if", "(", "item", ".", "getName", "(", ")", ".", "equals", "(", "groupName", ")", "&&", "item", ".", "getNamespace", "(", ")", ".", "equals", "(", "getCurrentNamespace", "(", ")", ")", ")", "{", "item", ".", "getElements", "(", ")", ".", "add", "(", "groupElement", ")", ";", "return", ";", "}", "}", "final", "MetadataItem", "newItem", "=", "new", "MetadataItem", "(", "groupName", ")", ";", "newItem", ".", "getElements", "(", ")", ".", "add", "(", "groupElement", ")", ";", "newItem", ".", "setNamespace", "(", "getCurrentNamespace", "(", ")", ")", ";", "newItem", ".", "setSchemaName", "(", "getCurrentSchmema", "(", ")", ")", ";", "newItem", ".", "setPackageApi", "(", "getCurrentPackageApi", "(", ")", ")", ";", "newItem", ".", "setPackageImpl", "(", "getCurrentPackageImpl", "(", ")", ")", ";", "groupList", ".", "add", "(", "newItem", ")", ";", "}" ]
Adds a new element to the specific group element class. If no group element class is found, then a new group element class. will be created. @param groupName the group class name of @param groupElement the new element to be added.
[ "Adds", "a", "new", "element", "to", "the", "specific", "group", "element", "class", ".", "If", "no", "group", "element", "class", "is", "found", "then", "a", "new", "group", "element", "class", ".", "will", "be", "created", "." ]
train
https://github.com/shrinkwrap/descriptors/blob/023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba/metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/Metadata.java#L143-L158
JodaOrg/joda-beans
src/main/java/org/joda/beans/ser/JodaBeanSer.java
JodaBeanSer.withIndent
public JodaBeanSer withIndent(String indent) { """ Returns a copy of this serializer with the specified pretty print indent. @param indent the indent, not null @return a copy of this object with the indent changed, not null """ JodaBeanUtils.notNull(indent, "indent"); return new JodaBeanSer(indent, newLine, converter, iteratorFactory, shortTypes, deserializers, includeDerived); }
java
public JodaBeanSer withIndent(String indent) { JodaBeanUtils.notNull(indent, "indent"); return new JodaBeanSer(indent, newLine, converter, iteratorFactory, shortTypes, deserializers, includeDerived); }
[ "public", "JodaBeanSer", "withIndent", "(", "String", "indent", ")", "{", "JodaBeanUtils", ".", "notNull", "(", "indent", ",", "\"indent\"", ")", ";", "return", "new", "JodaBeanSer", "(", "indent", ",", "newLine", ",", "converter", ",", "iteratorFactory", ",", "shortTypes", ",", "deserializers", ",", "includeDerived", ")", ";", "}" ]
Returns a copy of this serializer with the specified pretty print indent. @param indent the indent, not null @return a copy of this object with the indent changed, not null
[ "Returns", "a", "copy", "of", "this", "serializer", "with", "the", "specified", "pretty", "print", "indent", "." ]
train
https://github.com/JodaOrg/joda-beans/blob/f07dbe42947150b23a173f35984c6ab33c5529bf/src/main/java/org/joda/beans/ser/JodaBeanSer.java#L117-L120
artikcloud/artikcloud-java
src/main/java/cloud/artik/api/DeviceTypesApi.java
DeviceTypesApi.getDeviceTypes
public DeviceTypesEnvelope getDeviceTypes(String name, Integer offset, Integer count, String tags) throws ApiException { """ Get Device Types Retrieves Device Types @param name Device Type name (required) @param offset Offset for pagination. (optional) @param count Desired count of items in the result set (optional) @param tags Elements tagged with the list of tags. (comma separated) (optional) @return DeviceTypesEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body """ ApiResponse<DeviceTypesEnvelope> resp = getDeviceTypesWithHttpInfo(name, offset, count, tags); return resp.getData(); }
java
public DeviceTypesEnvelope getDeviceTypes(String name, Integer offset, Integer count, String tags) throws ApiException { ApiResponse<DeviceTypesEnvelope> resp = getDeviceTypesWithHttpInfo(name, offset, count, tags); return resp.getData(); }
[ "public", "DeviceTypesEnvelope", "getDeviceTypes", "(", "String", "name", ",", "Integer", "offset", ",", "Integer", "count", ",", "String", "tags", ")", "throws", "ApiException", "{", "ApiResponse", "<", "DeviceTypesEnvelope", ">", "resp", "=", "getDeviceTypesWithHttpInfo", "(", "name", ",", "offset", ",", "count", ",", "tags", ")", ";", "return", "resp", ".", "getData", "(", ")", ";", "}" ]
Get Device Types Retrieves Device Types @param name Device Type name (required) @param offset Offset for pagination. (optional) @param count Desired count of items in the result set (optional) @param tags Elements tagged with the list of tags. (comma separated) (optional) @return DeviceTypesEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Get", "Device", "Types", "Retrieves", "Device", "Types" ]
train
https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/DeviceTypesApi.java#L375-L378
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.regenerateStorageAccountKeyAsync
public Observable<StorageBundle> regenerateStorageAccountKeyAsync(String vaultBaseUrl, String storageAccountName, String keyName) { """ Regenerates the specified key value for the given storage account. This operation requires the storage/regeneratekey permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param storageAccountName The name of the storage account. @param keyName The storage account key name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the StorageBundle object """ return regenerateStorageAccountKeyWithServiceResponseAsync(vaultBaseUrl, storageAccountName, keyName).map(new Func1<ServiceResponse<StorageBundle>, StorageBundle>() { @Override public StorageBundle call(ServiceResponse<StorageBundle> response) { return response.body(); } }); }
java
public Observable<StorageBundle> regenerateStorageAccountKeyAsync(String vaultBaseUrl, String storageAccountName, String keyName) { return regenerateStorageAccountKeyWithServiceResponseAsync(vaultBaseUrl, storageAccountName, keyName).map(new Func1<ServiceResponse<StorageBundle>, StorageBundle>() { @Override public StorageBundle call(ServiceResponse<StorageBundle> response) { return response.body(); } }); }
[ "public", "Observable", "<", "StorageBundle", ">", "regenerateStorageAccountKeyAsync", "(", "String", "vaultBaseUrl", ",", "String", "storageAccountName", ",", "String", "keyName", ")", "{", "return", "regenerateStorageAccountKeyWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "storageAccountName", ",", "keyName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "StorageBundle", ">", ",", "StorageBundle", ">", "(", ")", "{", "@", "Override", "public", "StorageBundle", "call", "(", "ServiceResponse", "<", "StorageBundle", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Regenerates the specified key value for the given storage account. This operation requires the storage/regeneratekey permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param storageAccountName The name of the storage account. @param keyName The storage account key name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the StorageBundle object
[ "Regenerates", "the", "specified", "key", "value", "for", "the", "given", "storage", "account", ".", "This", "operation", "requires", "the", "storage", "/", "regeneratekey", "permission", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L10321-L10328
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/AutomaticTimerBean.java
AutomaticTimerBean.getBeanId
public BeanId getBeanId() { """ Gets the partially formed BeanId for this bean. The resulting BeanId will not have a home reference. @return the partially formed BeanId """ if (ivBeanId == null) { ivBeanId = new BeanId(ivBMD.j2eeName, null, false); } return ivBeanId; }
java
public BeanId getBeanId() { if (ivBeanId == null) { ivBeanId = new BeanId(ivBMD.j2eeName, null, false); } return ivBeanId; }
[ "public", "BeanId", "getBeanId", "(", ")", "{", "if", "(", "ivBeanId", "==", "null", ")", "{", "ivBeanId", "=", "new", "BeanId", "(", "ivBMD", ".", "j2eeName", ",", "null", ",", "false", ")", ";", "}", "return", "ivBeanId", ";", "}" ]
Gets the partially formed BeanId for this bean. The resulting BeanId will not have a home reference. @return the partially formed BeanId
[ "Gets", "the", "partially", "formed", "BeanId", "for", "this", "bean", ".", "The", "resulting", "BeanId", "will", "not", "have", "a", "home", "reference", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/AutomaticTimerBean.java#L127-L132
optimatika/ojAlgo-finance
src/main/java/org/ojalgo/finance/data/fetcher/YahooSession.java
YahooSession.buildChallengeRequest
static ResourceLocator.Request buildChallengeRequest(ResourceLocator.Session session, String symbol) { """ A request that requires consent and will set the "B" cookie, but not the crumb """ // The "options" part causes the cookie to be set. // Other path endings may also work, // but there has to be something after the symbol return session.request().host(FINANCE_YAHOO_COM).path("/quote/" + symbol + "/options"); }
java
static ResourceLocator.Request buildChallengeRequest(ResourceLocator.Session session, String symbol) { // The "options" part causes the cookie to be set. // Other path endings may also work, // but there has to be something after the symbol return session.request().host(FINANCE_YAHOO_COM).path("/quote/" + symbol + "/options"); }
[ "static", "ResourceLocator", ".", "Request", "buildChallengeRequest", "(", "ResourceLocator", ".", "Session", "session", ",", "String", "symbol", ")", "{", "// The \"options\" part causes the cookie to be set.", "// Other path endings may also work,", "// but there has to be something after the symbol", "return", "session", ".", "request", "(", ")", ".", "host", "(", "FINANCE_YAHOO_COM", ")", ".", "path", "(", "\"/quote/\"", "+", "symbol", "+", "\"/options\"", ")", ";", "}" ]
A request that requires consent and will set the "B" cookie, but not the crumb
[ "A", "request", "that", "requires", "consent", "and", "will", "set", "the", "B", "cookie", "but", "not", "the", "crumb" ]
train
https://github.com/optimatika/ojAlgo-finance/blob/c8d3f7e1894d4263b7334bca3f4c060e466f8b15/src/main/java/org/ojalgo/finance/data/fetcher/YahooSession.java#L139-L144
elki-project/elki
elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/ParseUtil.java
ParseUtil.matchInf
private static boolean matchInf(byte[] str, byte firstchar, int start, int end) { """ Match "inf", "infinity" in a number of different capitalizations. @param str String to match @param firstchar First character @param start Interval begin @param end Interval end @return {@code true} when infinity was recognized. """ final int len = end - start; // The wonders of unicode. The infinity symbol \u221E is three bytes: if(len == 3 && firstchar == -0x1E && str[start + 1] == -0x78 && str[start + 2] == -0x62) { return true; } if((len != 3 && len != INFINITY_LENGTH) // || (firstchar != 'I' && firstchar != 'i')) { return false; } for(int i = 1, j = INFINITY_LENGTH + 1; i < INFINITY_LENGTH; i++, j++) { final byte c = str[start + i]; if(c != INFINITY_PATTERN[i] && c != INFINITY_PATTERN[j]) { return false; } if(i == 2 && len == 3) { return true; } } return true; }
java
private static boolean matchInf(byte[] str, byte firstchar, int start, int end) { final int len = end - start; // The wonders of unicode. The infinity symbol \u221E is three bytes: if(len == 3 && firstchar == -0x1E && str[start + 1] == -0x78 && str[start + 2] == -0x62) { return true; } if((len != 3 && len != INFINITY_LENGTH) // || (firstchar != 'I' && firstchar != 'i')) { return false; } for(int i = 1, j = INFINITY_LENGTH + 1; i < INFINITY_LENGTH; i++, j++) { final byte c = str[start + i]; if(c != INFINITY_PATTERN[i] && c != INFINITY_PATTERN[j]) { return false; } if(i == 2 && len == 3) { return true; } } return true; }
[ "private", "static", "boolean", "matchInf", "(", "byte", "[", "]", "str", ",", "byte", "firstchar", ",", "int", "start", ",", "int", "end", ")", "{", "final", "int", "len", "=", "end", "-", "start", ";", "// The wonders of unicode. The infinity symbol \\u221E is three bytes:", "if", "(", "len", "==", "3", "&&", "firstchar", "==", "-", "0x1E", "&&", "str", "[", "start", "+", "1", "]", "==", "-", "0x78", "&&", "str", "[", "start", "+", "2", "]", "==", "-", "0x62", ")", "{", "return", "true", ";", "}", "if", "(", "(", "len", "!=", "3", "&&", "len", "!=", "INFINITY_LENGTH", ")", "//", "||", "(", "firstchar", "!=", "'", "'", "&&", "firstchar", "!=", "'", "'", ")", ")", "{", "return", "false", ";", "}", "for", "(", "int", "i", "=", "1", ",", "j", "=", "INFINITY_LENGTH", "+", "1", ";", "i", "<", "INFINITY_LENGTH", ";", "i", "++", ",", "j", "++", ")", "{", "final", "byte", "c", "=", "str", "[", "start", "+", "i", "]", ";", "if", "(", "c", "!=", "INFINITY_PATTERN", "[", "i", "]", "&&", "c", "!=", "INFINITY_PATTERN", "[", "j", "]", ")", "{", "return", "false", ";", "}", "if", "(", "i", "==", "2", "&&", "len", "==", "3", ")", "{", "return", "true", ";", "}", "}", "return", "true", ";", "}" ]
Match "inf", "infinity" in a number of different capitalizations. @param str String to match @param firstchar First character @param start Interval begin @param end Interval end @return {@code true} when infinity was recognized.
[ "Match", "inf", "infinity", "in", "a", "number", "of", "different", "capitalizations", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/ParseUtil.java#L481-L501
Azure/azure-sdk-for-java
edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java
DevicesInner.beginScanForUpdatesAsync
public Observable<Void> beginScanForUpdatesAsync(String deviceName, String resourceGroupName) { """ Scans for updates on a data box edge/gateway device. @param deviceName The device name. @param resourceGroupName The resource group name. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful. """ return beginScanForUpdatesWithServiceResponseAsync(deviceName, resourceGroupName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> beginScanForUpdatesAsync(String deviceName, String resourceGroupName) { return beginScanForUpdatesWithServiceResponseAsync(deviceName, resourceGroupName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "beginScanForUpdatesAsync", "(", "String", "deviceName", ",", "String", "resourceGroupName", ")", "{", "return", "beginScanForUpdatesWithServiceResponseAsync", "(", "deviceName", ",", "resourceGroupName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Void", ">", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "call", "(", "ServiceResponse", "<", "Void", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Scans for updates on a data box edge/gateway device. @param deviceName The device name. @param resourceGroupName The resource group name. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Scans", "for", "updates", "on", "a", "data", "box", "edge", "/", "gateway", "device", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java#L1775-L1782
dlemmermann/CalendarFX
CalendarFXRecurrence/src/main/java/com/google/ical/iter/Generators.java
Generators.byYearGenerator
static Generator byYearGenerator(int[] years, final DateValue dtStart) { """ constructs a generator that yields the specified years in increasing order. """ final int[] uyears = Util.uniquify(years); // index into years return new Generator() { int i; { while (i < uyears.length && dtStart.year() > uyears[i]) { ++i; } } @Override boolean generate(DTBuilder builder) { if (i >= uyears.length) { return false; } builder.year = uyears[i++]; return true; } @Override public String toString() { return "byYearGenerator"; } }; }
java
static Generator byYearGenerator(int[] years, final DateValue dtStart) { final int[] uyears = Util.uniquify(years); // index into years return new Generator() { int i; { while (i < uyears.length && dtStart.year() > uyears[i]) { ++i; } } @Override boolean generate(DTBuilder builder) { if (i >= uyears.length) { return false; } builder.year = uyears[i++]; return true; } @Override public String toString() { return "byYearGenerator"; } }; }
[ "static", "Generator", "byYearGenerator", "(", "int", "[", "]", "years", ",", "final", "DateValue", "dtStart", ")", "{", "final", "int", "[", "]", "uyears", "=", "Util", ".", "uniquify", "(", "years", ")", ";", "// index into years", "return", "new", "Generator", "(", ")", "{", "int", "i", ";", "{", "while", "(", "i", "<", "uyears", ".", "length", "&&", "dtStart", ".", "year", "(", ")", ">", "uyears", "[", "i", "]", ")", "{", "++", "i", ";", "}", "}", "@", "Override", "boolean", "generate", "(", "DTBuilder", "builder", ")", "{", "if", "(", "i", ">=", "uyears", ".", "length", ")", "{", "return", "false", ";", "}", "builder", ".", "year", "=", "uyears", "[", "i", "++", "]", ";", "return", "true", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "\"byYearGenerator\"", ";", "}", "}", ";", "}" ]
constructs a generator that yields the specified years in increasing order.
[ "constructs", "a", "generator", "that", "yields", "the", "specified", "years", "in", "increasing", "order", "." ]
train
https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXRecurrence/src/main/java/com/google/ical/iter/Generators.java#L376-L403
geomajas/geomajas-project-client-gwt2
common-gwt/command/src/main/java/org/geomajas/gwt/client/util/StyleUtil.java
StyleUtil.createRule
public static RuleInfo createRule(LayerType type, FeatureStyleInfo featureStyle) { """ Create a non-filtered rule from a feature style. @param type the layer type @param featureStyle the style @return the rule """ SymbolizerTypeInfo symbolizer = createSymbolizer(type, featureStyle); RuleInfo rule = createRule(featureStyle.getName(), featureStyle.getName(), symbolizer); return rule; }
java
public static RuleInfo createRule(LayerType type, FeatureStyleInfo featureStyle) { SymbolizerTypeInfo symbolizer = createSymbolizer(type, featureStyle); RuleInfo rule = createRule(featureStyle.getName(), featureStyle.getName(), symbolizer); return rule; }
[ "public", "static", "RuleInfo", "createRule", "(", "LayerType", "type", ",", "FeatureStyleInfo", "featureStyle", ")", "{", "SymbolizerTypeInfo", "symbolizer", "=", "createSymbolizer", "(", "type", ",", "featureStyle", ")", ";", "RuleInfo", "rule", "=", "createRule", "(", "featureStyle", ".", "getName", "(", ")", ",", "featureStyle", ".", "getName", "(", ")", ",", "symbolizer", ")", ";", "return", "rule", ";", "}" ]
Create a non-filtered rule from a feature style. @param type the layer type @param featureStyle the style @return the rule
[ "Create", "a", "non", "-", "filtered", "rule", "from", "a", "feature", "style", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/common-gwt/command/src/main/java/org/geomajas/gwt/client/util/StyleUtil.java#L75-L79
pierre/serialization
hadoop/src/main/java/com/ning/metrics/serialization/hadoop/pig/ThriftStorage.java
ThriftStorage.prepareToRead
@Override public void prepareToRead(RecordReader reader, PigSplit split) throws IOException { """ Initializes LoadFunc for reading data. This will be called during execution before any calls to getNext. The RecordReader needs to be passed here because it has been instantiated for a particular InputSplit. @param reader {@link org.apache.hadoop.mapreduce.RecordReader} to be used by this instance of the LoadFunc @param split The input {@link org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigSplit} to process @throws java.io.IOException if there is an exception during initialization """ this.reader = reader; this.split = split; setIOSerializations(split.getConf()); }
java
@Override public void prepareToRead(RecordReader reader, PigSplit split) throws IOException { this.reader = reader; this.split = split; setIOSerializations(split.getConf()); }
[ "@", "Override", "public", "void", "prepareToRead", "(", "RecordReader", "reader", ",", "PigSplit", "split", ")", "throws", "IOException", "{", "this", ".", "reader", "=", "reader", ";", "this", ".", "split", "=", "split", ";", "setIOSerializations", "(", "split", ".", "getConf", "(", ")", ")", ";", "}" ]
Initializes LoadFunc for reading data. This will be called during execution before any calls to getNext. The RecordReader needs to be passed here because it has been instantiated for a particular InputSplit. @param reader {@link org.apache.hadoop.mapreduce.RecordReader} to be used by this instance of the LoadFunc @param split The input {@link org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigSplit} to process @throws java.io.IOException if there is an exception during initialization
[ "Initializes", "LoadFunc", "for", "reading", "data", ".", "This", "will", "be", "called", "during", "execution", "before", "any", "calls", "to", "getNext", ".", "The", "RecordReader", "needs", "to", "be", "passed", "here", "because", "it", "has", "been", "instantiated", "for", "a", "particular", "InputSplit", "." ]
train
https://github.com/pierre/serialization/blob/b15b7c749ba78bfe94dce8fc22f31b30b2e6830b/hadoop/src/main/java/com/ning/metrics/serialization/hadoop/pig/ThriftStorage.java#L133-L139
apache/incubator-gobblin
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/EventMetadataUtils.java
EventMetadataUtils.getTaskFailureExceptions
public static String getTaskFailureExceptions(List<TaskState> taskStates) { """ Get failure messages @return The concatenated failure messages from all the task states """ StringBuffer sb = new StringBuffer(); // Add task failure messages in a group followed by task failure exceptions appendTaskStateValues(taskStates, sb, TASK_FAILURE_MESSAGE_KEY); appendTaskStateValues(taskStates, sb, ConfigurationKeys.TASK_FAILURE_EXCEPTION_KEY); return sb.toString(); }
java
public static String getTaskFailureExceptions(List<TaskState> taskStates) { StringBuffer sb = new StringBuffer(); // Add task failure messages in a group followed by task failure exceptions appendTaskStateValues(taskStates, sb, TASK_FAILURE_MESSAGE_KEY); appendTaskStateValues(taskStates, sb, ConfigurationKeys.TASK_FAILURE_EXCEPTION_KEY); return sb.toString(); }
[ "public", "static", "String", "getTaskFailureExceptions", "(", "List", "<", "TaskState", ">", "taskStates", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "// Add task failure messages in a group followed by task failure exceptions", "appendTaskStateValues", "(", "taskStates", ",", "sb", ",", "TASK_FAILURE_MESSAGE_KEY", ")", ";", "appendTaskStateValues", "(", "taskStates", ",", "sb", ",", "ConfigurationKeys", ".", "TASK_FAILURE_EXCEPTION_KEY", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Get failure messages @return The concatenated failure messages from all the task states
[ "Get", "failure", "messages" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/EventMetadataUtils.java#L49-L57
gallandarakhneorg/afc
advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/ifx/Segment3ifx.java
Segment3ifx.z1Property
@Pure public IntegerProperty z1Property() { """ Replies the property that is the z coordinate of the first segment point. @return the z1 property. """ if (this.p1.z == null) { this.p1.z = new SimpleIntegerProperty(this, MathFXAttributeNames.Z1); } return this.p1.z; }
java
@Pure public IntegerProperty z1Property() { if (this.p1.z == null) { this.p1.z = new SimpleIntegerProperty(this, MathFXAttributeNames.Z1); } return this.p1.z; }
[ "@", "Pure", "public", "IntegerProperty", "z1Property", "(", ")", "{", "if", "(", "this", ".", "p1", ".", "z", "==", "null", ")", "{", "this", ".", "p1", ".", "z", "=", "new", "SimpleIntegerProperty", "(", "this", ",", "MathFXAttributeNames", ".", "Z1", ")", ";", "}", "return", "this", ".", "p1", ".", "z", ";", "}" ]
Replies the property that is the z coordinate of the first segment point. @return the z1 property.
[ "Replies", "the", "property", "that", "is", "the", "z", "coordinate", "of", "the", "first", "segment", "point", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/ifx/Segment3ifx.java#L240-L246
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_fax_serviceName_settings_PUT
public void billingAccount_fax_serviceName_settings_PUT(String billingAccount, String serviceName, OvhFaxProperties body) throws IOException { """ Alter this object properties REST: PUT /telephony/{billingAccount}/fax/{serviceName}/settings @param body [required] New object properties @param billingAccount [required] The name of your billingAccount @param serviceName [required] """ String qPath = "/telephony/{billingAccount}/fax/{serviceName}/settings"; StringBuilder sb = path(qPath, billingAccount, serviceName); exec(qPath, "PUT", sb.toString(), body); }
java
public void billingAccount_fax_serviceName_settings_PUT(String billingAccount, String serviceName, OvhFaxProperties body) throws IOException { String qPath = "/telephony/{billingAccount}/fax/{serviceName}/settings"; StringBuilder sb = path(qPath, billingAccount, serviceName); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "billingAccount_fax_serviceName_settings_PUT", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "OvhFaxProperties", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/fax/{serviceName}/settings\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "billingAccount", ",", "serviceName", ")", ";", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "body", ")", ";", "}" ]
Alter this object properties REST: PUT /telephony/{billingAccount}/fax/{serviceName}/settings @param body [required] New object properties @param billingAccount [required] The name of your billingAccount @param serviceName [required]
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L4416-L4420
jbundle/jbundle
app/program/screen/src/main/java/org/jbundle/app/program/screen/ClassInfoGridScreen.java
ClassInfoGridScreen.doCommand
public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions) { """ Process the command. <br />Step 1 - Process the command if possible and return true if processed. <br />Step 2 - If I can't process, pass to all children (with me as the source). <br />Step 3 - If children didn't process, pass to parent (with me as the source). <br />Note: Never pass to a parent or child that matches the source (to avoid an endless loop). @param strCommand The command to process. @param sourceSField The source screen field (to avoid echos). @param iCommandOptions If this command creates a new screen, create in a new window? @return true if success. """ if ((MenuConstants.FORM.equalsIgnoreCase(strCommand)) || (MenuConstants.FORMLINK.equalsIgnoreCase(strCommand))) if (this.getMainRecord().getEditMode() == DBConstants.EDIT_ADD) if (!this.getMainRecord().getField(ClassInfo.CLASS_PROJECT_ID).isNull()) { strCommand = Utility.addURLParam(null, DBParams.COMMAND, strCommand); strCommand = Utility.addURLParam(strCommand, DBParams.RECORD, ClassInfo.class.getName()); strCommand = Utility.addURLParam(strCommand, DBParams.HEADER_OBJECT_ID, this.getMainRecord().getField(ClassInfo.CLASS_PROJECT_ID).toString()); } return super.doCommand(strCommand, sourceSField, iCommandOptions); }
java
public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions) { if ((MenuConstants.FORM.equalsIgnoreCase(strCommand)) || (MenuConstants.FORMLINK.equalsIgnoreCase(strCommand))) if (this.getMainRecord().getEditMode() == DBConstants.EDIT_ADD) if (!this.getMainRecord().getField(ClassInfo.CLASS_PROJECT_ID).isNull()) { strCommand = Utility.addURLParam(null, DBParams.COMMAND, strCommand); strCommand = Utility.addURLParam(strCommand, DBParams.RECORD, ClassInfo.class.getName()); strCommand = Utility.addURLParam(strCommand, DBParams.HEADER_OBJECT_ID, this.getMainRecord().getField(ClassInfo.CLASS_PROJECT_ID).toString()); } return super.doCommand(strCommand, sourceSField, iCommandOptions); }
[ "public", "boolean", "doCommand", "(", "String", "strCommand", ",", "ScreenField", "sourceSField", ",", "int", "iCommandOptions", ")", "{", "if", "(", "(", "MenuConstants", ".", "FORM", ".", "equalsIgnoreCase", "(", "strCommand", ")", ")", "||", "(", "MenuConstants", ".", "FORMLINK", ".", "equalsIgnoreCase", "(", "strCommand", ")", ")", ")", "if", "(", "this", ".", "getMainRecord", "(", ")", ".", "getEditMode", "(", ")", "==", "DBConstants", ".", "EDIT_ADD", ")", "if", "(", "!", "this", ".", "getMainRecord", "(", ")", ".", "getField", "(", "ClassInfo", ".", "CLASS_PROJECT_ID", ")", ".", "isNull", "(", ")", ")", "{", "strCommand", "=", "Utility", ".", "addURLParam", "(", "null", ",", "DBParams", ".", "COMMAND", ",", "strCommand", ")", ";", "strCommand", "=", "Utility", ".", "addURLParam", "(", "strCommand", ",", "DBParams", ".", "RECORD", ",", "ClassInfo", ".", "class", ".", "getName", "(", ")", ")", ";", "strCommand", "=", "Utility", ".", "addURLParam", "(", "strCommand", ",", "DBParams", ".", "HEADER_OBJECT_ID", ",", "this", ".", "getMainRecord", "(", ")", ".", "getField", "(", "ClassInfo", ".", "CLASS_PROJECT_ID", ")", ".", "toString", "(", ")", ")", ";", "}", "return", "super", ".", "doCommand", "(", "strCommand", ",", "sourceSField", ",", "iCommandOptions", ")", ";", "}" ]
Process the command. <br />Step 1 - Process the command if possible and return true if processed. <br />Step 2 - If I can't process, pass to all children (with me as the source). <br />Step 3 - If children didn't process, pass to parent (with me as the source). <br />Note: Never pass to a parent or child that matches the source (to avoid an endless loop). @param strCommand The command to process. @param sourceSField The source screen field (to avoid echos). @param iCommandOptions If this command creates a new screen, create in a new window? @return true if success.
[ "Process", "the", "command", ".", "<br", "/", ">", "Step", "1", "-", "Process", "the", "command", "if", "possible", "and", "return", "true", "if", "processed", ".", "<br", "/", ">", "Step", "2", "-", "If", "I", "can", "t", "process", "pass", "to", "all", "children", "(", "with", "me", "as", "the", "source", ")", ".", "<br", "/", ">", "Step", "3", "-", "If", "children", "didn", "t", "process", "pass", "to", "parent", "(", "with", "me", "as", "the", "source", ")", ".", "<br", "/", ">", "Note", ":", "Never", "pass", "to", "a", "parent", "or", "child", "that", "matches", "the", "source", "(", "to", "avoid", "an", "endless", "loop", ")", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/screen/src/main/java/org/jbundle/app/program/screen/ClassInfoGridScreen.java#L169-L180
BioPAX/Paxtools
pattern/src/main/java/org/biopax/paxtools/pattern/miner/ExtendedSIFWriter.java
ExtendedSIFWriter.writeParticipants
public static boolean writeParticipants(Set<SIFInteraction> inters, OutputStream out) { """ Writes down the interaction participants' (nodes) details to the given output stream. Closes the stream at the end. @param inters binary interactions @param out stream to write @return true if any output produced successfully """ if (!inters.isEmpty()) { try { OutputStreamWriter writer = new OutputStreamWriter(out); writeSourceAndTargetDetails(inters, writer); writer.close(); return true; } catch (IOException e) { e.printStackTrace(); } } return false; }
java
public static boolean writeParticipants(Set<SIFInteraction> inters, OutputStream out) { if (!inters.isEmpty()) { try { OutputStreamWriter writer = new OutputStreamWriter(out); writeSourceAndTargetDetails(inters, writer); writer.close(); return true; } catch (IOException e) { e.printStackTrace(); } } return false; }
[ "public", "static", "boolean", "writeParticipants", "(", "Set", "<", "SIFInteraction", ">", "inters", ",", "OutputStream", "out", ")", "{", "if", "(", "!", "inters", ".", "isEmpty", "(", ")", ")", "{", "try", "{", "OutputStreamWriter", "writer", "=", "new", "OutputStreamWriter", "(", "out", ")", ";", "writeSourceAndTargetDetails", "(", "inters", ",", "writer", ")", ";", "writer", ".", "close", "(", ")", ";", "return", "true", ";", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "return", "false", ";", "}" ]
Writes down the interaction participants' (nodes) details to the given output stream. Closes the stream at the end. @param inters binary interactions @param out stream to write @return true if any output produced successfully
[ "Writes", "down", "the", "interaction", "participants", "(", "nodes", ")", "details", "to", "the", "given", "output", "stream", ".", "Closes", "the", "stream", "at", "the", "end", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/ExtendedSIFWriter.java#L119-L136
dkmfbk/knowledgestore
ks-server/src/main/java/eu/fbk/knowledgestore/triplestore/SelectQuery.java
SelectQuery.from
public static SelectQuery from(final String string) throws ParseException { """ Returns a <tt>SelectQuery</tt> for the specified SPARQL SELECT query string. @param string the query string, in SPARQL and without relative URIs @return the corresponding <tt>SelectQuery</tt> @throws ParseException in case the string does not denote a valid SPARQL SELECT query """ Preconditions.checkNotNull(string); SelectQuery query = CACHE.getIfPresent(string); if (query == null) { final ParsedTupleQuery parsedQuery; try { parsedQuery = QueryParserUtil.parseTupleQuery(QueryLanguage.SPARQL, string, null); } catch (final IllegalArgumentException ex) { throw new ParseException(string, "SPARQL query not in SELECT form", ex); } catch (final MalformedQueryException ex) { throw new ParseException(string, "Invalid SPARQL query: " + ex.getMessage(), ex); } query = new SelectQuery(string, parsedQuery.getTupleExpr(), parsedQuery.getDataset()); CACHE.put(string, query); } return query; }
java
public static SelectQuery from(final String string) throws ParseException { Preconditions.checkNotNull(string); SelectQuery query = CACHE.getIfPresent(string); if (query == null) { final ParsedTupleQuery parsedQuery; try { parsedQuery = QueryParserUtil.parseTupleQuery(QueryLanguage.SPARQL, string, null); } catch (final IllegalArgumentException ex) { throw new ParseException(string, "SPARQL query not in SELECT form", ex); } catch (final MalformedQueryException ex) { throw new ParseException(string, "Invalid SPARQL query: " + ex.getMessage(), ex); } query = new SelectQuery(string, parsedQuery.getTupleExpr(), parsedQuery.getDataset()); CACHE.put(string, query); } return query; }
[ "public", "static", "SelectQuery", "from", "(", "final", "String", "string", ")", "throws", "ParseException", "{", "Preconditions", ".", "checkNotNull", "(", "string", ")", ";", "SelectQuery", "query", "=", "CACHE", ".", "getIfPresent", "(", "string", ")", ";", "if", "(", "query", "==", "null", ")", "{", "final", "ParsedTupleQuery", "parsedQuery", ";", "try", "{", "parsedQuery", "=", "QueryParserUtil", ".", "parseTupleQuery", "(", "QueryLanguage", ".", "SPARQL", ",", "string", ",", "null", ")", ";", "}", "catch", "(", "final", "IllegalArgumentException", "ex", ")", "{", "throw", "new", "ParseException", "(", "string", ",", "\"SPARQL query not in SELECT form\"", ",", "ex", ")", ";", "}", "catch", "(", "final", "MalformedQueryException", "ex", ")", "{", "throw", "new", "ParseException", "(", "string", ",", "\"Invalid SPARQL query: \"", "+", "ex", ".", "getMessage", "(", ")", ",", "ex", ")", ";", "}", "query", "=", "new", "SelectQuery", "(", "string", ",", "parsedQuery", ".", "getTupleExpr", "(", ")", ",", "parsedQuery", ".", "getDataset", "(", ")", ")", ";", "CACHE", ".", "put", "(", "string", ",", "query", ")", ";", "}", "return", "query", ";", "}" ]
Returns a <tt>SelectQuery</tt> for the specified SPARQL SELECT query string. @param string the query string, in SPARQL and without relative URIs @return the corresponding <tt>SelectQuery</tt> @throws ParseException in case the string does not denote a valid SPARQL SELECT query
[ "Returns", "a", "<tt", ">", "SelectQuery<", "/", "tt", ">", "for", "the", "specified", "SPARQL", "SELECT", "query", "string", "." ]
train
https://github.com/dkmfbk/knowledgestore/blob/a548101b1dd67fcf72a1ec6f838ea7539bdbbe7a/ks-server/src/main/java/eu/fbk/knowledgestore/triplestore/SelectQuery.java#L85-L103
tweea/matrixjavalib-main-common
src/main/java/net/matrix/lang/Reflections.java
Reflections.getAccessibleMethod
public static Method getAccessibleMethod(final Object target, final String name, final Class<?>... parameterTypes) { """ 循环向上转型,获取对象的 DeclaredMethod,并强制设置为可访问。 如向上转型到 Object 仍无法找到,返回 null。 匹配函数名 + 参数类型。 用于方法需要被多次调用的情况。先使用本函数先取得 Method,然后调用 Method.invoke(Object obj, Object... args) @param target 目标对象 @param name 方法名 @param parameterTypes 参数类型 @return 方法 """ for (Class<?> searchType = target.getClass(); searchType != Object.class; searchType = searchType.getSuperclass()) { try { Method method = searchType.getDeclaredMethod(name, parameterTypes); makeAccessible(method); return method; } catch (NoSuchMethodException e) { // Method不在当前类定义,继续向上转型 LOG.trace("", e); } } return null; }
java
public static Method getAccessibleMethod(final Object target, final String name, final Class<?>... parameterTypes) { for (Class<?> searchType = target.getClass(); searchType != Object.class; searchType = searchType.getSuperclass()) { try { Method method = searchType.getDeclaredMethod(name, parameterTypes); makeAccessible(method); return method; } catch (NoSuchMethodException e) { // Method不在当前类定义,继续向上转型 LOG.trace("", e); } } return null; }
[ "public", "static", "Method", "getAccessibleMethod", "(", "final", "Object", "target", ",", "final", "String", "name", ",", "final", "Class", "<", "?", ">", "...", "parameterTypes", ")", "{", "for", "(", "Class", "<", "?", ">", "searchType", "=", "target", ".", "getClass", "(", ")", ";", "searchType", "!=", "Object", ".", "class", ";", "searchType", "=", "searchType", ".", "getSuperclass", "(", ")", ")", "{", "try", "{", "Method", "method", "=", "searchType", ".", "getDeclaredMethod", "(", "name", ",", "parameterTypes", ")", ";", "makeAccessible", "(", "method", ")", ";", "return", "method", ";", "}", "catch", "(", "NoSuchMethodException", "e", ")", "{", "// Method不在当前类定义,继续向上转型\r", "LOG", ".", "trace", "(", "\"\"", ",", "e", ")", ";", "}", "}", "return", "null", ";", "}" ]
循环向上转型,获取对象的 DeclaredMethod,并强制设置为可访问。 如向上转型到 Object 仍无法找到,返回 null。 匹配函数名 + 参数类型。 用于方法需要被多次调用的情况。先使用本函数先取得 Method,然后调用 Method.invoke(Object obj, Object... args) @param target 目标对象 @param name 方法名 @param parameterTypes 参数类型 @return 方法
[ "循环向上转型,获取对象的", "DeclaredMethod,并强制设置为可访问。", "如向上转型到", "Object", "仍无法找到,返回", "null。", "匹配函数名", "+", "参数类型。", "用于方法需要被多次调用的情况。先使用本函数先取得", "Method,然后调用", "Method", ".", "invoke", "(", "Object", "obj", "Object", "...", "args", ")" ]
train
https://github.com/tweea/matrixjavalib-main-common/blob/ac8f98322a422e3ef76c3e12d47b98268cec7006/src/main/java/net/matrix/lang/Reflections.java#L224-L236
unbescape/unbescape
src/main/java/org/unbescape/properties/PropertiesEscape.java
PropertiesEscape.escapePropertiesValue
public static void escapePropertiesValue(final String text, final Writer writer, final PropertiesValueEscapeLevel level) throws IOException { """ <p> Perform a (configurable) Java Properties Value <strong>escape</strong> operation on a <tt>String</tt> input, writing results to a <tt>Writer</tt>. </p> <p> This method will perform an escape operation according to the specified {@link org.unbescape.properties.PropertiesValueEscapeLevel} argument value. </p> <p> All other <tt>String</tt>/<tt>Writer</tt>-based <tt>escapePropertiesValue*(...)</tt> methods call this one with preconfigured <tt>level</tt> values. </p> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>String</tt> to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @param level the escape level to be applied, see {@link org.unbescape.properties.PropertiesValueEscapeLevel}. @throws IOException if an input/output exception occurs @since 1.1.2 """ if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } if (level == null) { throw new IllegalArgumentException("The 'level' argument cannot be null"); } PropertiesValueEscapeUtil.escape(new InternalStringReader(text), writer, level); }
java
public static void escapePropertiesValue(final String text, final Writer writer, final PropertiesValueEscapeLevel level) throws IOException { if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } if (level == null) { throw new IllegalArgumentException("The 'level' argument cannot be null"); } PropertiesValueEscapeUtil.escape(new InternalStringReader(text), writer, level); }
[ "public", "static", "void", "escapePropertiesValue", "(", "final", "String", "text", ",", "final", "Writer", "writer", ",", "final", "PropertiesValueEscapeLevel", "level", ")", "throws", "IOException", "{", "if", "(", "writer", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Argument 'writer' cannot be null\"", ")", ";", "}", "if", "(", "level", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The 'level' argument cannot be null\"", ")", ";", "}", "PropertiesValueEscapeUtil", ".", "escape", "(", "new", "InternalStringReader", "(", "text", ")", ",", "writer", ",", "level", ")", ";", "}" ]
<p> Perform a (configurable) Java Properties Value <strong>escape</strong> operation on a <tt>String</tt> input, writing results to a <tt>Writer</tt>. </p> <p> This method will perform an escape operation according to the specified {@link org.unbescape.properties.PropertiesValueEscapeLevel} argument value. </p> <p> All other <tt>String</tt>/<tt>Writer</tt>-based <tt>escapePropertiesValue*(...)</tt> methods call this one with preconfigured <tt>level</tt> values. </p> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>String</tt> to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @param level the escape level to be applied, see {@link org.unbescape.properties.PropertiesValueEscapeLevel}. @throws IOException if an input/output exception occurs @since 1.1.2
[ "<p", ">", "Perform", "a", "(", "configurable", ")", "Java", "Properties", "Value", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "String<", "/", "tt", ">", "input", "writing", "results", "to", "a", "<tt", ">", "Writer<", "/", "tt", ">", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "will", "perform", "an", "escape", "operation", "according", "to", "the", "specified", "{", "@link", "org", ".", "unbescape", ".", "properties", ".", "PropertiesValueEscapeLevel", "}", "argument", "value", ".", "<", "/", "p", ">", "<p", ">", "All", "other", "<tt", ">", "String<", "/", "tt", ">", "/", "<tt", ">", "Writer<", "/", "tt", ">", "-", "based", "<tt", ">", "escapePropertiesValue", "*", "(", "...", ")", "<", "/", "tt", ">", "methods", "call", "this", "one", "with", "preconfigured", "<tt", ">", "level<", "/", "tt", ">", "values", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "is", "<strong", ">", "thread", "-", "safe<", "/", "strong", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/properties/PropertiesEscape.java#L424-L437
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/impl/matcher/PatternUtils.java
PatternUtils.error
static IllegalArgumentException error(String message, String str, int pos) { """ Create an IllegalArgumentException with a message including context based on the position. """ return new IllegalArgumentException(message + "\n" + context(str, pos)); }
java
static IllegalArgumentException error(String message, String str, int pos) { return new IllegalArgumentException(message + "\n" + context(str, pos)); }
[ "static", "IllegalArgumentException", "error", "(", "String", "message", ",", "String", "str", ",", "int", "pos", ")", "{", "return", "new", "IllegalArgumentException", "(", "message", "+", "\"\\n\"", "+", "context", "(", "str", ",", "pos", ")", ")", ";", "}" ]
Create an IllegalArgumentException with a message including context based on the position.
[ "Create", "an", "IllegalArgumentException", "with", "a", "message", "including", "context", "based", "on", "the", "position", "." ]
train
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/matcher/PatternUtils.java#L65-L67
google/error-prone
check_api/src/main/java/com/google/errorprone/dataflow/nullnesspropagation/NullnessAnalysis.java
NullnessAnalysis.getNullness
public Nullness getNullness(TreePath exprPath, Context context) { """ Returns the {@link Nullness} of the leaf of {@code exprPath}. <p>If the leaf required the compiler to generate autoboxing or autounboxing calls, {@code getNullness} returns the {@code Nullness} <i>after</i> the boxing/unboxing. This implies that, in those cases, it will always return {@code NONNULL}. """ try { nullnessPropagation.setContext(context).setCompilationUnit(exprPath.getCompilationUnit()); return DataFlow.expressionDataflow(exprPath, context, nullnessPropagation); } finally { nullnessPropagation.setContext(null).setCompilationUnit(null); } }
java
public Nullness getNullness(TreePath exprPath, Context context) { try { nullnessPropagation.setContext(context).setCompilationUnit(exprPath.getCompilationUnit()); return DataFlow.expressionDataflow(exprPath, context, nullnessPropagation); } finally { nullnessPropagation.setContext(null).setCompilationUnit(null); } }
[ "public", "Nullness", "getNullness", "(", "TreePath", "exprPath", ",", "Context", "context", ")", "{", "try", "{", "nullnessPropagation", ".", "setContext", "(", "context", ")", ".", "setCompilationUnit", "(", "exprPath", ".", "getCompilationUnit", "(", ")", ")", ";", "return", "DataFlow", ".", "expressionDataflow", "(", "exprPath", ",", "context", ",", "nullnessPropagation", ")", ";", "}", "finally", "{", "nullnessPropagation", ".", "setContext", "(", "null", ")", ".", "setCompilationUnit", "(", "null", ")", ";", "}", "}" ]
Returns the {@link Nullness} of the leaf of {@code exprPath}. <p>If the leaf required the compiler to generate autoboxing or autounboxing calls, {@code getNullness} returns the {@code Nullness} <i>after</i> the boxing/unboxing. This implies that, in those cases, it will always return {@code NONNULL}.
[ "Returns", "the", "{", "@link", "Nullness", "}", "of", "the", "leaf", "of", "{", "@code", "exprPath", "}", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/dataflow/nullnesspropagation/NullnessAnalysis.java#L56-L63
arnaudroger/SimpleFlatMapper
sfm-jdbc/src/main/java/org/simpleflatmapper/jdbc/DiscriminatorJdbcBuilder.java
DiscriminatorJdbcBuilder.when
public DiscriminatorJdbcSubBuilder when(Predicate<String> predicate, Type type) { """ Add a discriminator matching predicate with its associated type. @param predicate the predicate @param type the type @return the current builder """ final DiscriminatorJdbcSubBuilder subBuilder = new DiscriminatorJdbcSubBuilder(predicate, type); builders.add(subBuilder); return subBuilder; }
java
public DiscriminatorJdbcSubBuilder when(Predicate<String> predicate, Type type) { final DiscriminatorJdbcSubBuilder subBuilder = new DiscriminatorJdbcSubBuilder(predicate, type); builders.add(subBuilder); return subBuilder; }
[ "public", "DiscriminatorJdbcSubBuilder", "when", "(", "Predicate", "<", "String", ">", "predicate", ",", "Type", "type", ")", "{", "final", "DiscriminatorJdbcSubBuilder", "subBuilder", "=", "new", "DiscriminatorJdbcSubBuilder", "(", "predicate", ",", "type", ")", ";", "builders", ".", "add", "(", "subBuilder", ")", ";", "return", "subBuilder", ";", "}" ]
Add a discriminator matching predicate with its associated type. @param predicate the predicate @param type the type @return the current builder
[ "Add", "a", "discriminator", "matching", "predicate", "with", "its", "associated", "type", "." ]
train
https://github.com/arnaudroger/SimpleFlatMapper/blob/93435438c18f26c87963d5e0f3ebf0f264dcd8c2/sfm-jdbc/src/main/java/org/simpleflatmapper/jdbc/DiscriminatorJdbcBuilder.java#L55-L59
apiman/apiman
manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/audit/AuditUtils.java
AuditUtils.valueChanged
public static boolean valueChanged(Boolean before, Boolean after) { """ Returns true only if the value changed. @param before the value before change @param after the value after change @return true if value changed, else false """ if ((before == null && after == null) || after == null) { return false; } if (before == null) { return true; } return !before.equals(after); }
java
public static boolean valueChanged(Boolean before, Boolean after) { if ((before == null && after == null) || after == null) { return false; } if (before == null) { return true; } return !before.equals(after); }
[ "public", "static", "boolean", "valueChanged", "(", "Boolean", "before", ",", "Boolean", "after", ")", "{", "if", "(", "(", "before", "==", "null", "&&", "after", "==", "null", ")", "||", "after", "==", "null", ")", "{", "return", "false", ";", "}", "if", "(", "before", "==", "null", ")", "{", "return", "true", ";", "}", "return", "!", "before", ".", "equals", "(", "after", ")", ";", "}" ]
Returns true only if the value changed. @param before the value before change @param after the value after change @return true if value changed, else false
[ "Returns", "true", "only", "if", "the", "value", "changed", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/audit/AuditUtils.java#L85-L95
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.bill_billId_GET
public OvhBill bill_billId_GET(String billId) throws IOException { """ Get this object properties REST: GET /me/bill/{billId} @param billId [required] """ String qPath = "/me/bill/{billId}"; StringBuilder sb = path(qPath, billId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhBill.class); }
java
public OvhBill bill_billId_GET(String billId) throws IOException { String qPath = "/me/bill/{billId}"; StringBuilder sb = path(qPath, billId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhBill.class); }
[ "public", "OvhBill", "bill_billId_GET", "(", "String", "billId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/bill/{billId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "billId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhBill", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /me/bill/{billId} @param billId [required]
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L2920-L2925
aNNiMON/Lightweight-Stream-API
stream/src/main/java/com/annimon/stream/IntStream.java
IntStream.takeWhile
@NotNull public IntStream takeWhile(@NotNull final IntPredicate predicate) { """ Takes elements while the predicate returns {@code true}. <p>This is an intermediate operation. <p>Example: <pre> predicate: (a) -&gt; a &lt; 3 stream: [1, 2, 3, 4, 1, 2, 3, 4] result: [1, 2] </pre> @param predicate the predicate used to take elements @return the new {@code IntStream} """ return new IntStream(params, new IntTakeWhile(iterator, predicate)); }
java
@NotNull public IntStream takeWhile(@NotNull final IntPredicate predicate) { return new IntStream(params, new IntTakeWhile(iterator, predicate)); }
[ "@", "NotNull", "public", "IntStream", "takeWhile", "(", "@", "NotNull", "final", "IntPredicate", "predicate", ")", "{", "return", "new", "IntStream", "(", "params", ",", "new", "IntTakeWhile", "(", "iterator", ",", "predicate", ")", ")", ";", "}" ]
Takes elements while the predicate returns {@code true}. <p>This is an intermediate operation. <p>Example: <pre> predicate: (a) -&gt; a &lt; 3 stream: [1, 2, 3, 4, 1, 2, 3, 4] result: [1, 2] </pre> @param predicate the predicate used to take elements @return the new {@code IntStream}
[ "Takes", "elements", "while", "the", "predicate", "returns", "{", "@code", "true", "}", "." ]
train
https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/IntStream.java#L755-L758
fcrepo3/fcrepo
fcrepo-security/fcrepo-security-pdp/src/main/java/org/fcrepo/server/security/xacml/pdp/finder/policy/PolicyReader.java
PolicyReader.readPolicy
public synchronized Document readPolicy(InputStream input) throws ParsingException { """ Tries to read an XACML policy or policy set from the given stream. @param input the stream containing the policy to read @return a (potentially schema-validated) policy loaded from the given file @throws ParsingException if an error occurs while reading or parsing the policy """ try { return builder.parse(input); } catch (IOException ioe) { throw new ParsingException("Failed to read the stream", ioe); } catch (SAXException saxe) { throw new ParsingException("Failed to parse the stream", saxe); } }
java
public synchronized Document readPolicy(InputStream input) throws ParsingException { try { return builder.parse(input); } catch (IOException ioe) { throw new ParsingException("Failed to read the stream", ioe); } catch (SAXException saxe) { throw new ParsingException("Failed to parse the stream", saxe); } }
[ "public", "synchronized", "Document", "readPolicy", "(", "InputStream", "input", ")", "throws", "ParsingException", "{", "try", "{", "return", "builder", ".", "parse", "(", "input", ")", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "throw", "new", "ParsingException", "(", "\"Failed to read the stream\"", ",", "ioe", ")", ";", "}", "catch", "(", "SAXException", "saxe", ")", "{", "throw", "new", "ParsingException", "(", "\"Failed to parse the stream\"", ",", "saxe", ")", ";", "}", "}" ]
Tries to read an XACML policy or policy set from the given stream. @param input the stream containing the policy to read @return a (potentially schema-validated) policy loaded from the given file @throws ParsingException if an error occurs while reading or parsing the policy
[ "Tries", "to", "read", "an", "XACML", "policy", "or", "policy", "set", "from", "the", "given", "stream", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-security/fcrepo-security-pdp/src/main/java/org/fcrepo/server/security/xacml/pdp/finder/policy/PolicyReader.java#L171-L180
rzwitserloot/lombok
src/utils/lombok/javac/TreeMirrorMaker.java
TreeMirrorMaker.visitLabeledStatement
@Override public JCTree visitLabeledStatement(LabeledStatementTree node, Void p) { """ This and visitVariable is rather hacky but we're working around evident bugs or at least inconsistencies in javac. """ return node.getStatement().accept(this, p); }
java
@Override public JCTree visitLabeledStatement(LabeledStatementTree node, Void p) { return node.getStatement().accept(this, p); }
[ "@", "Override", "public", "JCTree", "visitLabeledStatement", "(", "LabeledStatementTree", "node", ",", "Void", "p", ")", "{", "return", "node", ".", "getStatement", "(", ")", ".", "accept", "(", "this", ",", "p", ")", ";", "}" ]
This and visitVariable is rather hacky but we're working around evident bugs or at least inconsistencies in javac.
[ "This", "and", "visitVariable", "is", "rather", "hacky", "but", "we", "re", "working", "around", "evident", "bugs", "or", "at", "least", "inconsistencies", "in", "javac", "." ]
train
https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/utils/lombok/javac/TreeMirrorMaker.java#L120-L122
SimiaCryptus/utilities
java-util/src/main/java/com/simiacryptus/text/TextGenerator.java
TextGenerator.generateDictionary
public String generateDictionary(int length, int context, final String seed, int lookahead, boolean destructive) { """ Generate dictionary string. @param length the length @param context the context @param seed the seed @param lookahead the lookahead @param destructive the destructive @return the string """ return generateDictionary(length, context, seed, lookahead, destructive, false); }
java
public String generateDictionary(int length, int context, final String seed, int lookahead, boolean destructive) { return generateDictionary(length, context, seed, lookahead, destructive, false); }
[ "public", "String", "generateDictionary", "(", "int", "length", ",", "int", "context", ",", "final", "String", "seed", ",", "int", "lookahead", ",", "boolean", "destructive", ")", "{", "return", "generateDictionary", "(", "length", ",", "context", ",", "seed", ",", "lookahead", ",", "destructive", ",", "false", ")", ";", "}" ]
Generate dictionary string. @param length the length @param context the context @param seed the seed @param lookahead the lookahead @param destructive the destructive @return the string
[ "Generate", "dictionary", "string", "." ]
train
https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/text/TextGenerator.java#L92-L94
jpelzer/pelzer-util
src/main/java/com/pelzer/util/PropertyManager.java
PropertyManager.setOverride
private void setOverride(final String key, final String value) { """ Replaces whatever was in the allProperties object, and clears the cache. """ final boolean doSecurely = key.startsWith("_"); final String fullKey = defaultEnvironment + "." + key; if (value != null) { final String oldValue = _getProperty("", key, null); if (value.equals(oldValue)) { // Same value, not really an override. if (doSecurely) { logger.warning("*** IGNORED *** Ignoring redundant override " + fullKey + "=***PROTECTED***"); } else { logger.warning("*** IGNORED *** Ignoring redundant override " + fullKey + "='" + value + "'"); } } else { logger.warning("*** OVERRIDE *** Setting override " + fullKey); if (doSecurely) { logger.warning(" New value=***PROTECTED***"); logger.warning(" Old value='" + oldValue + "'"); } else { logger.warning(" New value='" + value + "'"); logger.warning(" Old value='" + oldValue + "'"); } allProperties.setProperty(fullKey, value); } } }
java
private void setOverride(final String key, final String value) { final boolean doSecurely = key.startsWith("_"); final String fullKey = defaultEnvironment + "." + key; if (value != null) { final String oldValue = _getProperty("", key, null); if (value.equals(oldValue)) { // Same value, not really an override. if (doSecurely) { logger.warning("*** IGNORED *** Ignoring redundant override " + fullKey + "=***PROTECTED***"); } else { logger.warning("*** IGNORED *** Ignoring redundant override " + fullKey + "='" + value + "'"); } } else { logger.warning("*** OVERRIDE *** Setting override " + fullKey); if (doSecurely) { logger.warning(" New value=***PROTECTED***"); logger.warning(" Old value='" + oldValue + "'"); } else { logger.warning(" New value='" + value + "'"); logger.warning(" Old value='" + oldValue + "'"); } allProperties.setProperty(fullKey, value); } } }
[ "private", "void", "setOverride", "(", "final", "String", "key", ",", "final", "String", "value", ")", "{", "final", "boolean", "doSecurely", "=", "key", ".", "startsWith", "(", "\"_\"", ")", ";", "final", "String", "fullKey", "=", "defaultEnvironment", "+", "\".\"", "+", "key", ";", "if", "(", "value", "!=", "null", ")", "{", "final", "String", "oldValue", "=", "_getProperty", "(", "\"\"", ",", "key", ",", "null", ")", ";", "if", "(", "value", ".", "equals", "(", "oldValue", ")", ")", "{", "// Same value, not really an override.\r", "if", "(", "doSecurely", ")", "{", "logger", ".", "warning", "(", "\"*** IGNORED *** Ignoring redundant override \"", "+", "fullKey", "+", "\"=***PROTECTED***\"", ")", ";", "}", "else", "{", "logger", ".", "warning", "(", "\"*** IGNORED *** Ignoring redundant override \"", "+", "fullKey", "+", "\"='\"", "+", "value", "+", "\"'\"", ")", ";", "}", "}", "else", "{", "logger", ".", "warning", "(", "\"*** OVERRIDE *** Setting override \"", "+", "fullKey", ")", ";", "if", "(", "doSecurely", ")", "{", "logger", ".", "warning", "(", "\" New value=***PROTECTED***\"", ")", ";", "logger", ".", "warning", "(", "\" Old value='\"", "+", "oldValue", "+", "\"'\"", ")", ";", "}", "else", "{", "logger", ".", "warning", "(", "\" New value='\"", "+", "value", "+", "\"'\"", ")", ";", "logger", ".", "warning", "(", "\" Old value='\"", "+", "oldValue", "+", "\"'\"", ")", ";", "}", "allProperties", ".", "setProperty", "(", "fullKey", ",", "value", ")", ";", "}", "}", "}" ]
Replaces whatever was in the allProperties object, and clears the cache.
[ "Replaces", "whatever", "was", "in", "the", "allProperties", "object", "and", "clears", "the", "cache", "." ]
train
https://github.com/jpelzer/pelzer-util/blob/ec14f2573fd977d1442dba5d1507a264f5ea9aa6/src/main/java/com/pelzer/util/PropertyManager.java#L576-L600
Stratio/bdt
src/main/java/com/stratio/qa/specs/DatabaseSpec.java
DatabaseSpec.sendQueryOfType
@When("^I execute a query over fields '(.+?)' with schema '(.+?)' of type '(json|string)' with magic_column '(.+?)' from table: '(.+?)' using keyspace: '(.+?)' with:$") public void sendQueryOfType(String fields, String schema, String type, String magic_column, String table, String keyspace, DataTable modifications) { """ Execute a query with schema over a cluster @param fields columns on which the query is executed. Example: "latitude,longitude" or "*" or "count(*)" @param schema the file of configuration (.conf) with the options of mappin. If schema is the word "empty", method will not add a where clause. @param type type of the changes in schema (string or json) @param table table for create the index @param magic_column magic column where index will be saved. If you don't need index, you can add the word "empty" @param keyspace keyspace used @param modifications all data in "where" clause. Where schema is "empty", query has not a where clause. So it is necessary to provide an empty table. Example: ||. """ try { commonspec.setResultsType("cassandra"); commonspec.getCassandraClient().useKeyspace(keyspace); commonspec.getLogger().debug("Starting a query of type " + commonspec.getResultsType()); String query = ""; if (schema.equals("empty") && magic_column.equals("empty")) { query = "SELECT " + fields + " FROM " + table + ";"; } else if (!schema.equals("empty") && magic_column.equals("empty")) { String retrievedData = commonspec.retrieveData(schema, type); String modifiedData = commonspec.modifyData(retrievedData, type, modifications).toString(); query = "SELECT " + fields + " FROM " + table + " WHERE " + modifiedData + ";"; } else { String retrievedData = commonspec.retrieveData(schema, type); String modifiedData = commonspec.modifyData(retrievedData, type, modifications).toString(); query = "SELECT " + fields + " FROM " + table + " WHERE " + magic_column + " = '" + modifiedData + "';"; } commonspec.getLogger().debug("query: {}", query); com.datastax.driver.core.ResultSet results = commonspec.getCassandraClient().executeQuery(query); commonspec.setCassandraResults(results); } catch (Exception e) { commonspec.getLogger().debug("Exception captured"); commonspec.getLogger().debug(e.toString()); commonspec.getExceptions().add(e); } }
java
@When("^I execute a query over fields '(.+?)' with schema '(.+?)' of type '(json|string)' with magic_column '(.+?)' from table: '(.+?)' using keyspace: '(.+?)' with:$") public void sendQueryOfType(String fields, String schema, String type, String magic_column, String table, String keyspace, DataTable modifications) { try { commonspec.setResultsType("cassandra"); commonspec.getCassandraClient().useKeyspace(keyspace); commonspec.getLogger().debug("Starting a query of type " + commonspec.getResultsType()); String query = ""; if (schema.equals("empty") && magic_column.equals("empty")) { query = "SELECT " + fields + " FROM " + table + ";"; } else if (!schema.equals("empty") && magic_column.equals("empty")) { String retrievedData = commonspec.retrieveData(schema, type); String modifiedData = commonspec.modifyData(retrievedData, type, modifications).toString(); query = "SELECT " + fields + " FROM " + table + " WHERE " + modifiedData + ";"; } else { String retrievedData = commonspec.retrieveData(schema, type); String modifiedData = commonspec.modifyData(retrievedData, type, modifications).toString(); query = "SELECT " + fields + " FROM " + table + " WHERE " + magic_column + " = '" + modifiedData + "';"; } commonspec.getLogger().debug("query: {}", query); com.datastax.driver.core.ResultSet results = commonspec.getCassandraClient().executeQuery(query); commonspec.setCassandraResults(results); } catch (Exception e) { commonspec.getLogger().debug("Exception captured"); commonspec.getLogger().debug(e.toString()); commonspec.getExceptions().add(e); } }
[ "@", "When", "(", "\"^I execute a query over fields '(.+?)' with schema '(.+?)' of type '(json|string)' with magic_column '(.+?)' from table: '(.+?)' using keyspace: '(.+?)' with:$\"", ")", "public", "void", "sendQueryOfType", "(", "String", "fields", ",", "String", "schema", ",", "String", "type", ",", "String", "magic_column", ",", "String", "table", ",", "String", "keyspace", ",", "DataTable", "modifications", ")", "{", "try", "{", "commonspec", ".", "setResultsType", "(", "\"cassandra\"", ")", ";", "commonspec", ".", "getCassandraClient", "(", ")", ".", "useKeyspace", "(", "keyspace", ")", ";", "commonspec", ".", "getLogger", "(", ")", ".", "debug", "(", "\"Starting a query of type \"", "+", "commonspec", ".", "getResultsType", "(", ")", ")", ";", "String", "query", "=", "\"\"", ";", "if", "(", "schema", ".", "equals", "(", "\"empty\"", ")", "&&", "magic_column", ".", "equals", "(", "\"empty\"", ")", ")", "{", "query", "=", "\"SELECT \"", "+", "fields", "+", "\" FROM \"", "+", "table", "+", "\";\"", ";", "}", "else", "if", "(", "!", "schema", ".", "equals", "(", "\"empty\"", ")", "&&", "magic_column", ".", "equals", "(", "\"empty\"", ")", ")", "{", "String", "retrievedData", "=", "commonspec", ".", "retrieveData", "(", "schema", ",", "type", ")", ";", "String", "modifiedData", "=", "commonspec", ".", "modifyData", "(", "retrievedData", ",", "type", ",", "modifications", ")", ".", "toString", "(", ")", ";", "query", "=", "\"SELECT \"", "+", "fields", "+", "\" FROM \"", "+", "table", "+", "\" WHERE \"", "+", "modifiedData", "+", "\";\"", ";", "}", "else", "{", "String", "retrievedData", "=", "commonspec", ".", "retrieveData", "(", "schema", ",", "type", ")", ";", "String", "modifiedData", "=", "commonspec", ".", "modifyData", "(", "retrievedData", ",", "type", ",", "modifications", ")", ".", "toString", "(", ")", ";", "query", "=", "\"SELECT \"", "+", "fields", "+", "\" FROM \"", "+", "table", "+", "\" WHERE \"", "+", "magic_column", "+", "\" = '\"", "+", "modifiedData", "+", "\"';\"", ";", "}", "commonspec", ".", "getLogger", "(", ")", ".", "debug", "(", "\"query: {}\"", ",", "query", ")", ";", "com", ".", "datastax", ".", "driver", ".", "core", ".", "ResultSet", "results", "=", "commonspec", ".", "getCassandraClient", "(", ")", ".", "executeQuery", "(", "query", ")", ";", "commonspec", ".", "setCassandraResults", "(", "results", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "commonspec", ".", "getLogger", "(", ")", ".", "debug", "(", "\"Exception captured\"", ")", ";", "commonspec", ".", "getLogger", "(", ")", ".", "debug", "(", "e", ".", "toString", "(", ")", ")", ";", "commonspec", ".", "getExceptions", "(", ")", ".", "add", "(", "e", ")", ";", "}", "}" ]
Execute a query with schema over a cluster @param fields columns on which the query is executed. Example: "latitude,longitude" or "*" or "count(*)" @param schema the file of configuration (.conf) with the options of mappin. If schema is the word "empty", method will not add a where clause. @param type type of the changes in schema (string or json) @param table table for create the index @param magic_column magic column where index will be saved. If you don't need index, you can add the word "empty" @param keyspace keyspace used @param modifications all data in "where" clause. Where schema is "empty", query has not a where clause. So it is necessary to provide an empty table. Example: ||.
[ "Execute", "a", "query", "with", "schema", "over", "a", "cluster" ]
train
https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/DatabaseSpec.java#L389-L424
adorsys/hbci4java-adorsys
src/main/java/org/kapott/hbci/protocol/MultipleSyntaxElements.java
MultipleSyntaxElements.containsOnly
private boolean containsOnly(String s, char c) { """ Prueft, ob der Text s nur aus dem Zeichen c besteht. @param s der Text. @param c das Zeichen. @return true, wenn der Text nur dieses Zeichen enthaelt. """ for (char c2 : s.toCharArray()) { if (c != c2) return false; } return true; }
java
private boolean containsOnly(String s, char c) { for (char c2 : s.toCharArray()) { if (c != c2) return false; } return true; }
[ "private", "boolean", "containsOnly", "(", "String", "s", ",", "char", "c", ")", "{", "for", "(", "char", "c2", ":", "s", ".", "toCharArray", "(", ")", ")", "{", "if", "(", "c", "!=", "c2", ")", "return", "false", ";", "}", "return", "true", ";", "}" ]
Prueft, ob der Text s nur aus dem Zeichen c besteht. @param s der Text. @param c das Zeichen. @return true, wenn der Text nur dieses Zeichen enthaelt.
[ "Prueft", "ob", "der", "Text", "s", "nur", "aus", "dem", "Zeichen", "c", "besteht", "." ]
train
https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/protocol/MultipleSyntaxElements.java#L533-L540
mojohaus/xml-maven-plugin
src/main/java/org/codehaus/mojo/xml/format/IndentCheckSaxHandler.java
IndentCheckSaxHandler.flushCharacters
private void flushCharacters() { """ Sets {@link lastIndent} based on {@link #charBuffer} and resets {@link #charBuffer}. """ int indentLength = 0; int len = charBuffer.length(); /* * Count characters from end of ignorable whitespace to first end of line we hit */ for ( int i = len - 1; i >= 0; i-- ) { char ch = charBuffer.charAt( i ); switch ( ch ) { case '\n': case '\r': lastIndent = new Indent( charLineNumber, indentLength ); charBuffer.setLength( 0 ); return; case ' ': case '\t': indentLength++; break; default: /* * No end of line foundIndent in the trailing whitespace. Leave the foundIndent from previous * ignorable whitespace unchanged */ charBuffer.setLength( 0 ); return; } } }
java
private void flushCharacters() { int indentLength = 0; int len = charBuffer.length(); /* * Count characters from end of ignorable whitespace to first end of line we hit */ for ( int i = len - 1; i >= 0; i-- ) { char ch = charBuffer.charAt( i ); switch ( ch ) { case '\n': case '\r': lastIndent = new Indent( charLineNumber, indentLength ); charBuffer.setLength( 0 ); return; case ' ': case '\t': indentLength++; break; default: /* * No end of line foundIndent in the trailing whitespace. Leave the foundIndent from previous * ignorable whitespace unchanged */ charBuffer.setLength( 0 ); return; } } }
[ "private", "void", "flushCharacters", "(", ")", "{", "int", "indentLength", "=", "0", ";", "int", "len", "=", "charBuffer", ".", "length", "(", ")", ";", "/*\n * Count characters from end of ignorable whitespace to first end of line we hit\n */", "for", "(", "int", "i", "=", "len", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "char", "ch", "=", "charBuffer", ".", "charAt", "(", "i", ")", ";", "switch", "(", "ch", ")", "{", "case", "'", "'", ":", "case", "'", "'", ":", "lastIndent", "=", "new", "Indent", "(", "charLineNumber", ",", "indentLength", ")", ";", "charBuffer", ".", "setLength", "(", "0", ")", ";", "return", ";", "case", "'", "'", ":", "case", "'", "'", ":", "indentLength", "++", ";", "break", ";", "default", ":", "/*\n * No end of line foundIndent in the trailing whitespace. Leave the foundIndent from previous\n * ignorable whitespace unchanged\n */", "charBuffer", ".", "setLength", "(", "0", ")", ";", "return", ";", "}", "}", "}" ]
Sets {@link lastIndent} based on {@link #charBuffer} and resets {@link #charBuffer}.
[ "Sets", "{" ]
train
https://github.com/mojohaus/xml-maven-plugin/blob/161edde37bbfe7a472369a9675c44d91ec24561d/src/main/java/org/codehaus/mojo/xml/format/IndentCheckSaxHandler.java#L175-L205
palatable/lambda
src/main/java/com/jnape/palatable/lambda/adt/Either.java
Either.trying
public static <T extends Throwable> Either<T, Unit> trying(CheckedRunnable<T> runnable) { """ Attempt to execute the {@link CheckedRunnable}, returning {@link Unit} in a right value. If the runnable throws exception, wrap it in a left value and return it. @param runnable the runnable @param <T> the left parameter type (the most contravariant exception that runnable might throw) @return {@link Unit} as a right value, or a left value of the thrown exception """ return trying(runnable, id()); }
java
public static <T extends Throwable> Either<T, Unit> trying(CheckedRunnable<T> runnable) { return trying(runnable, id()); }
[ "public", "static", "<", "T", "extends", "Throwable", ">", "Either", "<", "T", ",", "Unit", ">", "trying", "(", "CheckedRunnable", "<", "T", ">", "runnable", ")", "{", "return", "trying", "(", "runnable", ",", "id", "(", ")", ")", ";", "}" ]
Attempt to execute the {@link CheckedRunnable}, returning {@link Unit} in a right value. If the runnable throws exception, wrap it in a left value and return it. @param runnable the runnable @param <T> the left parameter type (the most contravariant exception that runnable might throw) @return {@link Unit} as a right value, or a left value of the thrown exception
[ "Attempt", "to", "execute", "the", "{", "@link", "CheckedRunnable", "}", "returning", "{", "@link", "Unit", "}", "in", "a", "right", "value", ".", "If", "the", "runnable", "throws", "exception", "wrap", "it", "in", "a", "left", "value", "and", "return", "it", "." ]
train
https://github.com/palatable/lambda/blob/b643ba836c5916d1d8193822e5efb4e7b40c489a/src/main/java/com/jnape/palatable/lambda/adt/Either.java#L373-L375
fuinorg/units4j
src/main/java/org/fuin/units4j/AssertUsage.java
AssertUsage.assertMethodsNotUsed
public static final void assertMethodsNotUsed(final File classesDir, final FileFilter filter, final MCAMethod... methodsToFind) { """ Asserts that a set of methods is not used. @param classesDir Directory with the ".class" files to check - Cannot be <code>null</code> and must be a valid directory. @param filter File filter or NULL (process all '*.class' files). @param methodsToFind List of methods to find. """ Utils4J.checkNotNull("methodsToFind", methodsToFind); assertMethodsNotUsed(classesDir, filter, Arrays.asList(methodsToFind)); }
java
public static final void assertMethodsNotUsed(final File classesDir, final FileFilter filter, final MCAMethod... methodsToFind) { Utils4J.checkNotNull("methodsToFind", methodsToFind); assertMethodsNotUsed(classesDir, filter, Arrays.asList(methodsToFind)); }
[ "public", "static", "final", "void", "assertMethodsNotUsed", "(", "final", "File", "classesDir", ",", "final", "FileFilter", "filter", ",", "final", "MCAMethod", "...", "methodsToFind", ")", "{", "Utils4J", ".", "checkNotNull", "(", "\"methodsToFind\"", ",", "methodsToFind", ")", ";", "assertMethodsNotUsed", "(", "classesDir", ",", "filter", ",", "Arrays", ".", "asList", "(", "methodsToFind", ")", ")", ";", "}" ]
Asserts that a set of methods is not used. @param classesDir Directory with the ".class" files to check - Cannot be <code>null</code> and must be a valid directory. @param filter File filter or NULL (process all '*.class' files). @param methodsToFind List of methods to find.
[ "Asserts", "that", "a", "set", "of", "methods", "is", "not", "used", "." ]
train
https://github.com/fuinorg/units4j/blob/29383e30b0f9c246b309e734df9cc63dc5d5499e/src/main/java/org/fuin/units4j/AssertUsage.java#L53-L58
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_trunk_serviceName_externalDisplayedNumber_POST
public OvhTrunkExternalDisplayedNumber billingAccount_trunk_serviceName_externalDisplayedNumber_POST(String billingAccount, String serviceName, Boolean autoValidation, String number) throws IOException { """ External displayed number creation for a given trunk REST: POST /telephony/{billingAccount}/trunk/{serviceName}/externalDisplayedNumber @param number [required] External displayed number to create, in international format @param autoValidation [required] External displayed number auto-validation. Only available for partner. Must be owner of the number. @param billingAccount [required] The name of your billingAccount @param serviceName [required] Name of the service """ String qPath = "/telephony/{billingAccount}/trunk/{serviceName}/externalDisplayedNumber"; StringBuilder sb = path(qPath, billingAccount, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "autoValidation", autoValidation); addBody(o, "number", number); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTrunkExternalDisplayedNumber.class); }
java
public OvhTrunkExternalDisplayedNumber billingAccount_trunk_serviceName_externalDisplayedNumber_POST(String billingAccount, String serviceName, Boolean autoValidation, String number) throws IOException { String qPath = "/telephony/{billingAccount}/trunk/{serviceName}/externalDisplayedNumber"; StringBuilder sb = path(qPath, billingAccount, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "autoValidation", autoValidation); addBody(o, "number", number); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTrunkExternalDisplayedNumber.class); }
[ "public", "OvhTrunkExternalDisplayedNumber", "billingAccount_trunk_serviceName_externalDisplayedNumber_POST", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Boolean", "autoValidation", ",", "String", "number", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/trunk/{serviceName}/externalDisplayedNumber\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "billingAccount", ",", "serviceName", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"autoValidation\"", ",", "autoValidation", ")", ";", "addBody", "(", "o", ",", "\"number\"", ",", "number", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhTrunkExternalDisplayedNumber", ".", "class", ")", ";", "}" ]
External displayed number creation for a given trunk REST: POST /telephony/{billingAccount}/trunk/{serviceName}/externalDisplayedNumber @param number [required] External displayed number to create, in international format @param autoValidation [required] External displayed number auto-validation. Only available for partner. Must be owner of the number. @param billingAccount [required] The name of your billingAccount @param serviceName [required] Name of the service
[ "External", "displayed", "number", "creation", "for", "a", "given", "trunk" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L8117-L8125
banq/jdonframework
src/main/java/com/jdon/util/StringUtil.java
StringUtil.encodePassword
public static String encodePassword(String password, String algorithm) { """ Encode a string using algorithm specified in web.xml and return the resulting encrypted password. If exception, the plain credentials string is returned @param password Password or other credentials to use in authenticating this username @param algorithm Algorithm used to do the digest @return encypted password based on the algorithm. """ byte[] unencodedPassword = password.getBytes(); MessageDigest md = null; try { // first create an instance, given the provider md = MessageDigest.getInstance(algorithm); } catch (Exception e) { System.err.print("Exception: " + e); return password; } md.reset(); // call the update method one or more times // (useful when you don't know the size of your data, eg. stream) md.update(unencodedPassword); // now calculate the hash byte[] encodedPassword = md.digest(); StringBuilder buf = new StringBuilder(); for (int i = 0; i < encodedPassword.length; i++) { if (((int) encodedPassword[i] & 0xff) < 0x10) { buf.append("0"); } buf.append(Long.toString((int) encodedPassword[i] & 0xff, 16)); } return buf.toString(); }
java
public static String encodePassword(String password, String algorithm) { byte[] unencodedPassword = password.getBytes(); MessageDigest md = null; try { // first create an instance, given the provider md = MessageDigest.getInstance(algorithm); } catch (Exception e) { System.err.print("Exception: " + e); return password; } md.reset(); // call the update method one or more times // (useful when you don't know the size of your data, eg. stream) md.update(unencodedPassword); // now calculate the hash byte[] encodedPassword = md.digest(); StringBuilder buf = new StringBuilder(); for (int i = 0; i < encodedPassword.length; i++) { if (((int) encodedPassword[i] & 0xff) < 0x10) { buf.append("0"); } buf.append(Long.toString((int) encodedPassword[i] & 0xff, 16)); } return buf.toString(); }
[ "public", "static", "String", "encodePassword", "(", "String", "password", ",", "String", "algorithm", ")", "{", "byte", "[", "]", "unencodedPassword", "=", "password", ".", "getBytes", "(", ")", ";", "MessageDigest", "md", "=", "null", ";", "try", "{", "// first create an instance, given the provider\r", "md", "=", "MessageDigest", ".", "getInstance", "(", "algorithm", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "err", ".", "print", "(", "\"Exception: \"", "+", "e", ")", ";", "return", "password", ";", "}", "md", ".", "reset", "(", ")", ";", "// call the update method one or more times\r", "// (useful when you don't know the size of your data, eg. stream)\r", "md", ".", "update", "(", "unencodedPassword", ")", ";", "// now calculate the hash\r", "byte", "[", "]", "encodedPassword", "=", "md", ".", "digest", "(", ")", ";", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "encodedPassword", ".", "length", ";", "i", "++", ")", "{", "if", "(", "(", "(", "int", ")", "encodedPassword", "[", "i", "]", "&", "0xff", ")", "<", "0x10", ")", "{", "buf", ".", "append", "(", "\"0\"", ")", ";", "}", "buf", ".", "append", "(", "Long", ".", "toString", "(", "(", "int", ")", "encodedPassword", "[", "i", "]", "&", "0xff", ",", "16", ")", ")", ";", "}", "return", "buf", ".", "toString", "(", ")", ";", "}" ]
Encode a string using algorithm specified in web.xml and return the resulting encrypted password. If exception, the plain credentials string is returned @param password Password or other credentials to use in authenticating this username @param algorithm Algorithm used to do the digest @return encypted password based on the algorithm.
[ "Encode", "a", "string", "using", "algorithm", "specified", "in", "web", ".", "xml", "and", "return", "the", "resulting", "encrypted", "password", ".", "If", "exception", "the", "plain", "credentials", "string", "is", "returned" ]
train
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/StringUtil.java#L496-L530
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/DoubleField.java
DoubleField.moveSQLToField
public void moveSQLToField(ResultSet resultset, int iColumn) throws SQLException { """ Move the physical binary data to this SQL parameter row. @param resultset The resultset to get the SQL data from. @param iColumn the column in the resultset that has my data. @exception SQLException From SQL calls. """ double dResult = resultset.getDouble(iColumn); if (resultset.wasNull()) this.setString(Constants.BLANK, false, DBConstants.READ_MOVE); // Null value else { if ((!this.isNullable()) && (dResult == Double.NaN)) this.setString(Constants.BLANK, false, DBConstants.READ_MOVE); // Null value else this.setValue(dResult, false, DBConstants.READ_MOVE); } }
java
public void moveSQLToField(ResultSet resultset, int iColumn) throws SQLException { double dResult = resultset.getDouble(iColumn); if (resultset.wasNull()) this.setString(Constants.BLANK, false, DBConstants.READ_MOVE); // Null value else { if ((!this.isNullable()) && (dResult == Double.NaN)) this.setString(Constants.BLANK, false, DBConstants.READ_MOVE); // Null value else this.setValue(dResult, false, DBConstants.READ_MOVE); } }
[ "public", "void", "moveSQLToField", "(", "ResultSet", "resultset", ",", "int", "iColumn", ")", "throws", "SQLException", "{", "double", "dResult", "=", "resultset", ".", "getDouble", "(", "iColumn", ")", ";", "if", "(", "resultset", ".", "wasNull", "(", ")", ")", "this", ".", "setString", "(", "Constants", ".", "BLANK", ",", "false", ",", "DBConstants", ".", "READ_MOVE", ")", ";", "// Null value", "else", "{", "if", "(", "(", "!", "this", ".", "isNullable", "(", ")", ")", "&&", "(", "dResult", "==", "Double", ".", "NaN", ")", ")", "this", ".", "setString", "(", "Constants", ".", "BLANK", ",", "false", ",", "DBConstants", ".", "READ_MOVE", ")", ";", "// Null value", "else", "this", ".", "setValue", "(", "dResult", ",", "false", ",", "DBConstants", ".", "READ_MOVE", ")", ";", "}", "}" ]
Move the physical binary data to this SQL parameter row. @param resultset The resultset to get the SQL data from. @param iColumn the column in the resultset that has my data. @exception SQLException From SQL calls.
[ "Move", "the", "physical", "binary", "data", "to", "this", "SQL", "parameter", "row", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/DoubleField.java#L161-L173
haifengl/smile
math/src/main/java/smile/stat/distribution/DiscreteDistribution.java
DiscreteDistribution.quantile
protected double quantile(double p, int xmin, int xmax) { """ Invertion of cdf by bisection numeric root finding of "cdf(x) = p" for discrete distribution.* Returns integer n such that P(<n) &le; p &le; P(<n+1). """ while (xmax - xmin > 1) { int xmed = (xmax + xmin) / 2; if (cdf(xmed) > p) { xmax = xmed; } else { xmin = xmed; } } if (cdf(xmin) >= p) return xmin; else return xmax; }
java
protected double quantile(double p, int xmin, int xmax) { while (xmax - xmin > 1) { int xmed = (xmax + xmin) / 2; if (cdf(xmed) > p) { xmax = xmed; } else { xmin = xmed; } } if (cdf(xmin) >= p) return xmin; else return xmax; }
[ "protected", "double", "quantile", "(", "double", "p", ",", "int", "xmin", ",", "int", "xmax", ")", "{", "while", "(", "xmax", "-", "xmin", ">", "1", ")", "{", "int", "xmed", "=", "(", "xmax", "+", "xmin", ")", "/", "2", ";", "if", "(", "cdf", "(", "xmed", ")", ">", "p", ")", "{", "xmax", "=", "xmed", ";", "}", "else", "{", "xmin", "=", "xmed", ";", "}", "}", "if", "(", "cdf", "(", "xmin", ")", ">=", "p", ")", "return", "xmin", ";", "else", "return", "xmax", ";", "}" ]
Invertion of cdf by bisection numeric root finding of "cdf(x) = p" for discrete distribution.* Returns integer n such that P(<n) &le; p &le; P(<n+1).
[ "Invertion", "of", "cdf", "by", "bisection", "numeric", "root", "finding", "of", "cdf", "(", "x", ")", "=", "p", "for", "discrete", "distribution", ".", "*", "Returns", "integer", "n", "such", "that", "P", "(", "<n", ")", "&le", ";", "p", "&le", ";", "P", "(", "<n", "+", "1", ")", "." ]
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/stat/distribution/DiscreteDistribution.java#L79-L93
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/MariaDbConnection.java
MariaDbConnection.newConnection
public static MariaDbConnection newConnection(UrlParser urlParser, GlobalStateInfo globalInfo) throws SQLException { """ Create new connection Object. @param urlParser parser @param globalInfo global info @return connection object @throws SQLException if any connection error occur """ if (urlParser.getOptions().pool) { return Pools.retrievePool(urlParser).getConnection(); } Protocol protocol = Utils.retrieveProxy(urlParser, globalInfo); return new MariaDbConnection(protocol); }
java
public static MariaDbConnection newConnection(UrlParser urlParser, GlobalStateInfo globalInfo) throws SQLException { if (urlParser.getOptions().pool) { return Pools.retrievePool(urlParser).getConnection(); } Protocol protocol = Utils.retrieveProxy(urlParser, globalInfo); return new MariaDbConnection(protocol); }
[ "public", "static", "MariaDbConnection", "newConnection", "(", "UrlParser", "urlParser", ",", "GlobalStateInfo", "globalInfo", ")", "throws", "SQLException", "{", "if", "(", "urlParser", ".", "getOptions", "(", ")", ".", "pool", ")", "{", "return", "Pools", ".", "retrievePool", "(", "urlParser", ")", ".", "getConnection", "(", ")", ";", "}", "Protocol", "protocol", "=", "Utils", ".", "retrieveProxy", "(", "urlParser", ",", "globalInfo", ")", ";", "return", "new", "MariaDbConnection", "(", "protocol", ")", ";", "}" ]
Create new connection Object. @param urlParser parser @param globalInfo global info @return connection object @throws SQLException if any connection error occur
[ "Create", "new", "connection", "Object", "." ]
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbConnection.java#L168-L176
UrielCh/ovh-java-sdk
ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java
ApiOvhEmaildomain.domain_account_accountName_filter_name_DELETE
public ArrayList<OvhTaskFilter> domain_account_accountName_filter_name_DELETE(String domain, String accountName, String name) throws IOException { """ Delete an existing filter REST: DELETE /email/domain/{domain}/account/{accountName}/filter/{name} @param domain [required] Name of your domain name @param accountName [required] Name of account @param name [required] Filter name """ String qPath = "/email/domain/{domain}/account/{accountName}/filter/{name}"; StringBuilder sb = path(qPath, domain, accountName, name); String resp = exec(qPath, "DELETE", sb.toString(), null); return convertTo(resp, t2); }
java
public ArrayList<OvhTaskFilter> domain_account_accountName_filter_name_DELETE(String domain, String accountName, String name) throws IOException { String qPath = "/email/domain/{domain}/account/{accountName}/filter/{name}"; StringBuilder sb = path(qPath, domain, accountName, name); String resp = exec(qPath, "DELETE", sb.toString(), null); return convertTo(resp, t2); }
[ "public", "ArrayList", "<", "OvhTaskFilter", ">", "domain_account_accountName_filter_name_DELETE", "(", "String", "domain", ",", "String", "accountName", ",", "String", "name", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/domain/{domain}/account/{accountName}/filter/{name}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "domain", ",", "accountName", ",", "name", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"DELETE\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t2", ")", ";", "}" ]
Delete an existing filter REST: DELETE /email/domain/{domain}/account/{accountName}/filter/{name} @param domain [required] Name of your domain name @param accountName [required] Name of account @param name [required] Filter name
[ "Delete", "an", "existing", "filter" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L769-L774
otto-de/edison-hal
src/main/java/de/otto/edison/hal/traverson/Traverson.java
Traverson.followLink
public Traverson followLink(final String rel, final Predicate<Link> predicate, final Map<String, Object> vars) { """ Follow the first {@link Link} of the current resource, selected by its link-relation type. The {@link LinkPredicates predicate} is used to select the matching link, if multiple links are available for the specified link-relation type. <p> Templated links are expanded to URIs using the specified template variables. </p> <p> Other than {@link #follow(String, Predicate, Map)}, this method will ignore possibly embedded resources with the same link-relation type. Only if the link is missing, the embedded resource is used. </p> @param rel the link-relation type of the followed link @param predicate the predicate used to select the link to follow. @param vars uri-template variables used to build links. @return this @since 2.0.0 """ checkState(); hops.add(new Hop(rel, predicate, vars, true)); return this; }
java
public Traverson followLink(final String rel, final Predicate<Link> predicate, final Map<String, Object> vars) { checkState(); hops.add(new Hop(rel, predicate, vars, true)); return this; }
[ "public", "Traverson", "followLink", "(", "final", "String", "rel", ",", "final", "Predicate", "<", "Link", ">", "predicate", ",", "final", "Map", "<", "String", ",", "Object", ">", "vars", ")", "{", "checkState", "(", ")", ";", "hops", ".", "add", "(", "new", "Hop", "(", "rel", ",", "predicate", ",", "vars", ",", "true", ")", ")", ";", "return", "this", ";", "}" ]
Follow the first {@link Link} of the current resource, selected by its link-relation type. The {@link LinkPredicates predicate} is used to select the matching link, if multiple links are available for the specified link-relation type. <p> Templated links are expanded to URIs using the specified template variables. </p> <p> Other than {@link #follow(String, Predicate, Map)}, this method will ignore possibly embedded resources with the same link-relation type. Only if the link is missing, the embedded resource is used. </p> @param rel the link-relation type of the followed link @param predicate the predicate used to select the link to follow. @param vars uri-template variables used to build links. @return this @since 2.0.0
[ "Follow", "the", "first", "{", "@link", "Link", "}", "of", "the", "current", "resource", "selected", "by", "its", "link", "-", "relation", "type", ".", "The", "{", "@link", "LinkPredicates", "predicate", "}", "is", "used", "to", "select", "the", "matching", "link", "if", "multiple", "links", "are", "available", "for", "the", "specified", "link", "-", "relation", "type", ".", "<p", ">", "Templated", "links", "are", "expanded", "to", "URIs", "using", "the", "specified", "template", "variables", ".", "<", "/", "p", ">", "<p", ">", "Other", "than", "{", "@link", "#follow", "(", "String", "Predicate", "Map", ")", "}", "this", "method", "will", "ignore", "possibly", "embedded", "resources", "with", "the", "same", "link", "-", "relation", "type", ".", "Only", "if", "the", "link", "is", "missing", "the", "embedded", "resource", "is", "used", ".", "<", "/", "p", ">" ]
train
https://github.com/otto-de/edison-hal/blob/1582d2b49d1f0d9103e03bf742f18afa9d166992/src/main/java/de/otto/edison/hal/traverson/Traverson.java#L581-L587
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/api/Table.java
Table.addRow
public void addRow(int rowIndex, Table sourceTable) { """ Adds a single row to this table from sourceTable, copying every column in sourceTable @param rowIndex The row in sourceTable to add to this table @param sourceTable A table with the same column structure as this table """ for (int i = 0; i < columnCount(); i++) { column(i).appendObj(sourceTable.column(i).get(rowIndex)); } }
java
public void addRow(int rowIndex, Table sourceTable) { for (int i = 0; i < columnCount(); i++) { column(i).appendObj(sourceTable.column(i).get(rowIndex)); } }
[ "public", "void", "addRow", "(", "int", "rowIndex", ",", "Table", "sourceTable", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "columnCount", "(", ")", ";", "i", "++", ")", "{", "column", "(", "i", ")", ".", "appendObj", "(", "sourceTable", ".", "column", "(", "i", ")", ".", "get", "(", "rowIndex", ")", ")", ";", "}", "}" ]
Adds a single row to this table from sourceTable, copying every column in sourceTable @param rowIndex The row in sourceTable to add to this table @param sourceTable A table with the same column structure as this table
[ "Adds", "a", "single", "row", "to", "this", "table", "from", "sourceTable", "copying", "every", "column", "in", "sourceTable" ]
train
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/api/Table.java#L642-L646
infinispan/infinispan
commons/src/main/java/org/infinispan/commons/marshall/MarshallableTypeHints.java
MarshallableTypeHints.getBufferSizePredictor
public BufferSizePredictor getBufferSizePredictor(Class<?> type) { """ Get the serialized form size predictor for a particular type. @param type Marshallable type for which serialized form size will be predicted @return an instance of {@link BufferSizePredictor} """ MarshallingType marshallingType = typeHints.get(type); if (marshallingType == null) { // Initialise with isMarshallable to null, meaning it's unknown marshallingType = new MarshallingType(null, new AdaptiveBufferSizePredictor()); MarshallingType prev = typeHints.putIfAbsent(type, marshallingType); if (prev != null) { marshallingType = prev; } else { if (trace) { log.tracef("Cache a buffer size predictor for '%s' assuming " + "its serializability is unknown", type.getName()); } } } return marshallingType.sizePredictor; }
java
public BufferSizePredictor getBufferSizePredictor(Class<?> type) { MarshallingType marshallingType = typeHints.get(type); if (marshallingType == null) { // Initialise with isMarshallable to null, meaning it's unknown marshallingType = new MarshallingType(null, new AdaptiveBufferSizePredictor()); MarshallingType prev = typeHints.putIfAbsent(type, marshallingType); if (prev != null) { marshallingType = prev; } else { if (trace) { log.tracef("Cache a buffer size predictor for '%s' assuming " + "its serializability is unknown", type.getName()); } } } return marshallingType.sizePredictor; }
[ "public", "BufferSizePredictor", "getBufferSizePredictor", "(", "Class", "<", "?", ">", "type", ")", "{", "MarshallingType", "marshallingType", "=", "typeHints", ".", "get", "(", "type", ")", ";", "if", "(", "marshallingType", "==", "null", ")", "{", "// Initialise with isMarshallable to null, meaning it's unknown", "marshallingType", "=", "new", "MarshallingType", "(", "null", ",", "new", "AdaptiveBufferSizePredictor", "(", ")", ")", ";", "MarshallingType", "prev", "=", "typeHints", ".", "putIfAbsent", "(", "type", ",", "marshallingType", ")", ";", "if", "(", "prev", "!=", "null", ")", "{", "marshallingType", "=", "prev", ";", "}", "else", "{", "if", "(", "trace", ")", "{", "log", ".", "tracef", "(", "\"Cache a buffer size predictor for '%s' assuming \"", "+", "\"its serializability is unknown\"", ",", "type", ".", "getName", "(", ")", ")", ";", "}", "}", "}", "return", "marshallingType", ".", "sizePredictor", ";", "}" ]
Get the serialized form size predictor for a particular type. @param type Marshallable type for which serialized form size will be predicted @return an instance of {@link BufferSizePredictor}
[ "Get", "the", "serialized", "form", "size", "predictor", "for", "a", "particular", "type", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/marshall/MarshallableTypeHints.java#L36-L52
intuit/QuickBooks-V3-Java-SDK
ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/PrepareRequestInterceptor.java
PrepareRequestInterceptor.setupAcceptEncoding
private void setupAcceptEncoding(Map<String, String> requestHeaders) { """ Setup accept encoding header from configuration @param requestHeaders """ // validates whether to add headers for accept-encoding for compression String acceptCompressionFormat = Config.getProperty(Config.COMPRESSION_RESPONSE_FORMAT); if (StringUtils.hasText(acceptCompressionFormat)) { requestHeaders.put(RequestElements.HEADER_PARAM_ACCEPT_ENCODING, acceptCompressionFormat); } }
java
private void setupAcceptEncoding(Map<String, String> requestHeaders) { // validates whether to add headers for accept-encoding for compression String acceptCompressionFormat = Config.getProperty(Config.COMPRESSION_RESPONSE_FORMAT); if (StringUtils.hasText(acceptCompressionFormat)) { requestHeaders.put(RequestElements.HEADER_PARAM_ACCEPT_ENCODING, acceptCompressionFormat); } }
[ "private", "void", "setupAcceptEncoding", "(", "Map", "<", "String", ",", "String", ">", "requestHeaders", ")", "{", "// validates whether to add headers for accept-encoding for compression", "String", "acceptCompressionFormat", "=", "Config", ".", "getProperty", "(", "Config", ".", "COMPRESSION_RESPONSE_FORMAT", ")", ";", "if", "(", "StringUtils", ".", "hasText", "(", "acceptCompressionFormat", ")", ")", "{", "requestHeaders", ".", "put", "(", "RequestElements", ".", "HEADER_PARAM_ACCEPT_ENCODING", ",", "acceptCompressionFormat", ")", ";", "}", "}" ]
Setup accept encoding header from configuration @param requestHeaders
[ "Setup", "accept", "encoding", "header", "from", "configuration" ]
train
https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/PrepareRequestInterceptor.java#L160-L166
netplex/json-smart-v2
json-smart/src/main/java/net/minidev/json/JSONObject.java
JSONObject.writeJSON
public static void writeJSON(Map<String, ? extends Object> map, Appendable out, JSONStyle compression) throws IOException { """ Encode a map into JSON text and write it to out. If this map is also a JSONAware or JSONStreamAware, JSONAware or JSONStreamAware specific behaviours will be ignored at this top level. @see JSONValue#writeJSONString(Object, Appendable) """ if (map == null) { out.append("null"); return; } JsonWriter.JSONMapWriter.writeJSONString(map, out, compression); }
java
public static void writeJSON(Map<String, ? extends Object> map, Appendable out, JSONStyle compression) throws IOException { if (map == null) { out.append("null"); return; } JsonWriter.JSONMapWriter.writeJSONString(map, out, compression); }
[ "public", "static", "void", "writeJSON", "(", "Map", "<", "String", ",", "?", "extends", "Object", ">", "map", ",", "Appendable", "out", ",", "JSONStyle", "compression", ")", "throws", "IOException", "{", "if", "(", "map", "==", "null", ")", "{", "out", ".", "append", "(", "\"null\"", ")", ";", "return", ";", "}", "JsonWriter", ".", "JSONMapWriter", ".", "writeJSONString", "(", "map", ",", "out", ",", "compression", ")", ";", "}" ]
Encode a map into JSON text and write it to out. If this map is also a JSONAware or JSONStreamAware, JSONAware or JSONStreamAware specific behaviours will be ignored at this top level. @see JSONValue#writeJSONString(Object, Appendable)
[ "Encode", "a", "map", "into", "JSON", "text", "and", "write", "it", "to", "out", ".", "If", "this", "map", "is", "also", "a", "JSONAware", "or", "JSONStreamAware", "JSONAware", "or", "JSONStreamAware", "specific", "behaviours", "will", "be", "ignored", "at", "this", "top", "level", "." ]
train
https://github.com/netplex/json-smart-v2/blob/bfb3daef039e22a7bbff5f76bf14ea23330cd70e/json-smart/src/main/java/net/minidev/json/JSONObject.java#L180-L187
unbescape/unbescape
src/main/java/org/unbescape/xml/XmlEscape.java
XmlEscape.unescapeXml
public static void unescapeXml(final Reader reader, final Writer writer) throws IOException { """ <p> Perform an XML <strong>unescape</strong> operation on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>. </p> <p> No additional configuration arguments are required. Unescape operations will always perform <em>complete</em> XML 1.0/1.1 unescape of CERs, decimal and hexadecimal references. </p> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be unescaped. @param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.2 """ if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } // The chosen symbols (1.0 or 1.1) don't really matter, as both contain the same CERs XmlEscapeUtil.unescape(reader, writer, XmlEscapeSymbols.XML11_SYMBOLS); }
java
public static void unescapeXml(final Reader reader, final Writer writer) throws IOException { if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } // The chosen symbols (1.0 or 1.1) don't really matter, as both contain the same CERs XmlEscapeUtil.unescape(reader, writer, XmlEscapeSymbols.XML11_SYMBOLS); }
[ "public", "static", "void", "unescapeXml", "(", "final", "Reader", "reader", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "if", "(", "writer", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Argument 'writer' cannot be null\"", ")", ";", "}", "// The chosen symbols (1.0 or 1.1) don't really matter, as both contain the same CERs", "XmlEscapeUtil", ".", "unescape", "(", "reader", ",", "writer", ",", "XmlEscapeSymbols", ".", "XML11_SYMBOLS", ")", ";", "}" ]
<p> Perform an XML <strong>unescape</strong> operation on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>. </p> <p> No additional configuration arguments are required. Unescape operations will always perform <em>complete</em> XML 1.0/1.1 unescape of CERs, decimal and hexadecimal references. </p> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be unescaped. @param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.2
[ "<p", ">", "Perform", "an", "XML", "<strong", ">", "unescape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "Reader<", "/", "tt", ">", "input", "writing", "results", "to", "a", "<tt", ">", "Writer<", "/", "tt", ">", ".", "<", "/", "p", ">", "<p", ">", "No", "additional", "configuration", "arguments", "are", "required", ".", "Unescape", "operations", "will", "always", "perform", "<em", ">", "complete<", "/", "em", ">", "XML", "1", ".", "0", "/", "1", ".", "1", "unescape", "of", "CERs", "decimal", "and", "hexadecimal", "references", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "is", "<strong", ">", "thread", "-", "safe<", "/", "strong", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/xml/XmlEscape.java#L2390-L2400
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UScript.java
UScript.getScriptExtensions
public static final int getScriptExtensions(int c, BitSet set) { """ Sets code point c's Script_Extensions as script code integers into the output BitSet. <ul> <li>If c does have Script_Extensions, then the return value is the negative number of Script_Extensions codes (= -set.cardinality()); in this case, the Script property value (normally Common or Inherited) is not included in the set. <li>If c does not have Script_Extensions, then the one Script code is put into the set and also returned. <li>If c is not a valid code point, then the one {@link #UNKNOWN} code is put into the set and also returned. </ul> In other words, if the return value is non-negative, it is c's single Script code and the set contains exactly this Script code. If the return value is -n, then the set contains c's n&gt;=2 Script_Extensions script codes. <p>Some characters are commonly used in multiple scripts. For more information, see UAX #24: http://www.unicode.org/reports/tr24/. @param c code point @param set set of script code integers; will be cleared, then bits are set corresponding to c's Script_Extensions @return negative number of script codes in c's Script_Extensions, or the non-negative single Script value """ set.clear(); int scriptX=UCharacterProperty.INSTANCE.getAdditional(c, 0)&UCharacterProperty.SCRIPT_X_MASK; if(scriptX<UCharacterProperty.SCRIPT_X_WITH_COMMON) { set.set(scriptX); return scriptX; } char[] scriptExtensions=UCharacterProperty.INSTANCE.m_scriptExtensions_; int scx=scriptX&UCharacterProperty.SCRIPT_MASK_; // index into scriptExtensions if(scriptX>=UCharacterProperty.SCRIPT_X_WITH_OTHER) { scx=scriptExtensions[scx+1]; } int length=0; int sx; do { sx=scriptExtensions[scx++]; set.set(sx&0x7fff); ++length; } while(sx<0x8000); // length==set.cardinality() return -length; }
java
public static final int getScriptExtensions(int c, BitSet set) { set.clear(); int scriptX=UCharacterProperty.INSTANCE.getAdditional(c, 0)&UCharacterProperty.SCRIPT_X_MASK; if(scriptX<UCharacterProperty.SCRIPT_X_WITH_COMMON) { set.set(scriptX); return scriptX; } char[] scriptExtensions=UCharacterProperty.INSTANCE.m_scriptExtensions_; int scx=scriptX&UCharacterProperty.SCRIPT_MASK_; // index into scriptExtensions if(scriptX>=UCharacterProperty.SCRIPT_X_WITH_OTHER) { scx=scriptExtensions[scx+1]; } int length=0; int sx; do { sx=scriptExtensions[scx++]; set.set(sx&0x7fff); ++length; } while(sx<0x8000); // length==set.cardinality() return -length; }
[ "public", "static", "final", "int", "getScriptExtensions", "(", "int", "c", ",", "BitSet", "set", ")", "{", "set", ".", "clear", "(", ")", ";", "int", "scriptX", "=", "UCharacterProperty", ".", "INSTANCE", ".", "getAdditional", "(", "c", ",", "0", ")", "&", "UCharacterProperty", ".", "SCRIPT_X_MASK", ";", "if", "(", "scriptX", "<", "UCharacterProperty", ".", "SCRIPT_X_WITH_COMMON", ")", "{", "set", ".", "set", "(", "scriptX", ")", ";", "return", "scriptX", ";", "}", "char", "[", "]", "scriptExtensions", "=", "UCharacterProperty", ".", "INSTANCE", ".", "m_scriptExtensions_", ";", "int", "scx", "=", "scriptX", "&", "UCharacterProperty", ".", "SCRIPT_MASK_", ";", "// index into scriptExtensions", "if", "(", "scriptX", ">=", "UCharacterProperty", ".", "SCRIPT_X_WITH_OTHER", ")", "{", "scx", "=", "scriptExtensions", "[", "scx", "+", "1", "]", ";", "}", "int", "length", "=", "0", ";", "int", "sx", ";", "do", "{", "sx", "=", "scriptExtensions", "[", "scx", "++", "]", ";", "set", ".", "set", "(", "sx", "&", "0x7fff", ")", ";", "++", "length", ";", "}", "while", "(", "sx", "<", "0x8000", ")", ";", "// length==set.cardinality()", "return", "-", "length", ";", "}" ]
Sets code point c's Script_Extensions as script code integers into the output BitSet. <ul> <li>If c does have Script_Extensions, then the return value is the negative number of Script_Extensions codes (= -set.cardinality()); in this case, the Script property value (normally Common or Inherited) is not included in the set. <li>If c does not have Script_Extensions, then the one Script code is put into the set and also returned. <li>If c is not a valid code point, then the one {@link #UNKNOWN} code is put into the set and also returned. </ul> In other words, if the return value is non-negative, it is c's single Script code and the set contains exactly this Script code. If the return value is -n, then the set contains c's n&gt;=2 Script_Extensions script codes. <p>Some characters are commonly used in multiple scripts. For more information, see UAX #24: http://www.unicode.org/reports/tr24/. @param c code point @param set set of script code integers; will be cleared, then bits are set corresponding to c's Script_Extensions @return negative number of script codes in c's Script_Extensions, or the non-negative single Script value
[ "Sets", "code", "point", "c", "s", "Script_Extensions", "as", "script", "code", "integers", "into", "the", "output", "BitSet", ".", "<ul", ">", "<li", ">", "If", "c", "does", "have", "Script_Extensions", "then", "the", "return", "value", "is", "the", "negative", "number", "of", "Script_Extensions", "codes", "(", "=", "-", "set", ".", "cardinality", "()", ")", ";", "in", "this", "case", "the", "Script", "property", "value", "(", "normally", "Common", "or", "Inherited", ")", "is", "not", "included", "in", "the", "set", ".", "<li", ">", "If", "c", "does", "not", "have", "Script_Extensions", "then", "the", "one", "Script", "code", "is", "put", "into", "the", "set", "and", "also", "returned", ".", "<li", ">", "If", "c", "is", "not", "a", "valid", "code", "point", "then", "the", "one", "{", "@link", "#UNKNOWN", "}", "code", "is", "put", "into", "the", "set", "and", "also", "returned", ".", "<", "/", "ul", ">", "In", "other", "words", "if", "the", "return", "value", "is", "non", "-", "negative", "it", "is", "c", "s", "single", "Script", "code", "and", "the", "set", "contains", "exactly", "this", "Script", "code", ".", "If", "the", "return", "value", "is", "-", "n", "then", "the", "set", "contains", "c", "s", "n&gt", ";", "=", "2", "Script_Extensions", "script", "codes", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UScript.java#L1019-L1041
bazaarvoice/emodb
event/src/main/java/com/bazaarvoice/emodb/event/db/astyanax/AstyanaxEventReaderDAO.java
AstyanaxEventReaderDAO.markUnread
@Override public void markUnread(String channel, Collection<EventId> events) { """ When all events from a slab have been read via {@link #readNewer(String, EventSink)} _closedSlabCursors caches that the slab is empty for 10 seconds. When a slab is marked as unread update the cursor, if present, such that it is rewound far enough to read the unread event again. """ // For each slab keep track of the earliest index for each unread event. ConcurrentMap<ChannelSlab, Integer> channelSlabs = Maps.newConcurrentMap(); for (EventId event : events) { AstyanaxEventId astyanaxEvent = (AstyanaxEventId) event; checkArgument(channel.equals(astyanaxEvent.getChannel())); channelSlabs.merge(new ChannelSlab(channel, astyanaxEvent.getSlabId()), astyanaxEvent.getEventIdx(), Ints::min); } for (Map.Entry<ChannelSlab, Integer> entry : channelSlabs.entrySet()) { ChannelSlab channelSlab = entry.getKey(); int eventIdx = entry.getValue(); // Get the closed slab cursor, if any SlabCursor cursor = _closedSlabCursors.getIfPresent(channelSlab); // If the cursor exists and is beyond the lowest unread index, rewind it if (cursor != null && (cursor.get() == SlabCursor.END || cursor.get() > eventIdx)) { // Synchronize on the cursor before updating it to avoid concurrent updates with a read //noinspection SynchronizationOnLocalVariableOrMethodParameter synchronized (cursor) { if (cursor.get() == SlabCursor.END || cursor.get() > eventIdx) { cursor.set(eventIdx); } } } } }
java
@Override public void markUnread(String channel, Collection<EventId> events) { // For each slab keep track of the earliest index for each unread event. ConcurrentMap<ChannelSlab, Integer> channelSlabs = Maps.newConcurrentMap(); for (EventId event : events) { AstyanaxEventId astyanaxEvent = (AstyanaxEventId) event; checkArgument(channel.equals(astyanaxEvent.getChannel())); channelSlabs.merge(new ChannelSlab(channel, astyanaxEvent.getSlabId()), astyanaxEvent.getEventIdx(), Ints::min); } for (Map.Entry<ChannelSlab, Integer> entry : channelSlabs.entrySet()) { ChannelSlab channelSlab = entry.getKey(); int eventIdx = entry.getValue(); // Get the closed slab cursor, if any SlabCursor cursor = _closedSlabCursors.getIfPresent(channelSlab); // If the cursor exists and is beyond the lowest unread index, rewind it if (cursor != null && (cursor.get() == SlabCursor.END || cursor.get() > eventIdx)) { // Synchronize on the cursor before updating it to avoid concurrent updates with a read //noinspection SynchronizationOnLocalVariableOrMethodParameter synchronized (cursor) { if (cursor.get() == SlabCursor.END || cursor.get() > eventIdx) { cursor.set(eventIdx); } } } } }
[ "@", "Override", "public", "void", "markUnread", "(", "String", "channel", ",", "Collection", "<", "EventId", ">", "events", ")", "{", "// For each slab keep track of the earliest index for each unread event.", "ConcurrentMap", "<", "ChannelSlab", ",", "Integer", ">", "channelSlabs", "=", "Maps", ".", "newConcurrentMap", "(", ")", ";", "for", "(", "EventId", "event", ":", "events", ")", "{", "AstyanaxEventId", "astyanaxEvent", "=", "(", "AstyanaxEventId", ")", "event", ";", "checkArgument", "(", "channel", ".", "equals", "(", "astyanaxEvent", ".", "getChannel", "(", ")", ")", ")", ";", "channelSlabs", ".", "merge", "(", "new", "ChannelSlab", "(", "channel", ",", "astyanaxEvent", ".", "getSlabId", "(", ")", ")", ",", "astyanaxEvent", ".", "getEventIdx", "(", ")", ",", "Ints", "::", "min", ")", ";", "}", "for", "(", "Map", ".", "Entry", "<", "ChannelSlab", ",", "Integer", ">", "entry", ":", "channelSlabs", ".", "entrySet", "(", ")", ")", "{", "ChannelSlab", "channelSlab", "=", "entry", ".", "getKey", "(", ")", ";", "int", "eventIdx", "=", "entry", ".", "getValue", "(", ")", ";", "// Get the closed slab cursor, if any", "SlabCursor", "cursor", "=", "_closedSlabCursors", ".", "getIfPresent", "(", "channelSlab", ")", ";", "// If the cursor exists and is beyond the lowest unread index, rewind it", "if", "(", "cursor", "!=", "null", "&&", "(", "cursor", ".", "get", "(", ")", "==", "SlabCursor", ".", "END", "||", "cursor", ".", "get", "(", ")", ">", "eventIdx", ")", ")", "{", "// Synchronize on the cursor before updating it to avoid concurrent updates with a read", "//noinspection SynchronizationOnLocalVariableOrMethodParameter", "synchronized", "(", "cursor", ")", "{", "if", "(", "cursor", ".", "get", "(", ")", "==", "SlabCursor", ".", "END", "||", "cursor", ".", "get", "(", ")", ">", "eventIdx", ")", "{", "cursor", ".", "set", "(", "eventIdx", ")", ";", "}", "}", "}", "}", "}" ]
When all events from a slab have been read via {@link #readNewer(String, EventSink)} _closedSlabCursors caches that the slab is empty for 10 seconds. When a slab is marked as unread update the cursor, if present, such that it is rewound far enough to read the unread event again.
[ "When", "all", "events", "from", "a", "slab", "have", "been", "read", "via", "{" ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/event/src/main/java/com/bazaarvoice/emodb/event/db/astyanax/AstyanaxEventReaderDAO.java#L523-L549
avianey/facebook-api-android-maven
facebook/src/main/java/com/facebook/AppEventsLogger.java
AppEventsLogger.newLogger
public static AppEventsLogger newLogger(Context context, String applicationId, Session session) { """ Build an AppEventsLogger instance to log events through. @param context Used to access the attributionId for non-authenticated users. @param applicationId Explicitly specified Facebook applicationId to log events against. If null, the default app ID specified in the package metadata will be used. @param session Explicitly specified Session to log events against. If null, the activeSession will be used if it's open, otherwise the logging will happen against the specified app ID. @return AppEventsLogger instance to invoke log* methods on. """ return new AppEventsLogger(context, applicationId, session); }
java
public static AppEventsLogger newLogger(Context context, String applicationId, Session session) { return new AppEventsLogger(context, applicationId, session); }
[ "public", "static", "AppEventsLogger", "newLogger", "(", "Context", "context", ",", "String", "applicationId", ",", "Session", "session", ")", "{", "return", "new", "AppEventsLogger", "(", "context", ",", "applicationId", ",", "session", ")", ";", "}" ]
Build an AppEventsLogger instance to log events through. @param context Used to access the attributionId for non-authenticated users. @param applicationId Explicitly specified Facebook applicationId to log events against. If null, the default app ID specified in the package metadata will be used. @param session Explicitly specified Session to log events against. If null, the activeSession will be used if it's open, otherwise the logging will happen against the specified app ID. @return AppEventsLogger instance to invoke log* methods on.
[ "Build", "an", "AppEventsLogger", "instance", "to", "log", "events", "through", "." ]
train
https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/AppEventsLogger.java#L371-L373
vkostyukov/la4j
src/main/java/org/la4j/Matrix.java
Matrix.foldRow
public double foldRow(int i, VectorAccumulator accumulator) { """ Folds all elements of specified row in this matrix with given {@code accumulator}. @param i the row index @param accumulator the vector accumulator @return the accumulated value """ eachInRow(i, Vectors.asAccumulatorProcedure(accumulator)); return accumulator.accumulate(); }
java
public double foldRow(int i, VectorAccumulator accumulator) { eachInRow(i, Vectors.asAccumulatorProcedure(accumulator)); return accumulator.accumulate(); }
[ "public", "double", "foldRow", "(", "int", "i", ",", "VectorAccumulator", "accumulator", ")", "{", "eachInRow", "(", "i", ",", "Vectors", ".", "asAccumulatorProcedure", "(", "accumulator", ")", ")", ";", "return", "accumulator", ".", "accumulate", "(", ")", ";", "}" ]
Folds all elements of specified row in this matrix with given {@code accumulator}. @param i the row index @param accumulator the vector accumulator @return the accumulated value
[ "Folds", "all", "elements", "of", "specified", "row", "in", "this", "matrix", "with", "given", "{", "@code", "accumulator", "}", "." ]
train
https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrix.java#L1616-L1619
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/internal/utility/Convert.java
Convert.twoBytesToInt
public static int twoBytesToInt(byte[] bytes, ByteOrder order) { """ Convert an array of two unsigned bytes with the given byte order to one signed int. @param bytes The bytes to be parsed @param order The byte order to be used @return An int representing the bytes in the given order """ if (order == ByteOrder.BIG_ENDIAN) { return bytesToInt(bytes[0], bytes[1]); } else if (order == ByteOrder.LITTLE_ENDIAN) { return bytesToInt(bytes[1], bytes[0]); } else { throw new IllegalArgumentException("ByteOrder must be BIG_ENDIAN or LITTLE_ENDIAN"); } }
java
public static int twoBytesToInt(byte[] bytes, ByteOrder order) { if (order == ByteOrder.BIG_ENDIAN) { return bytesToInt(bytes[0], bytes[1]); } else if (order == ByteOrder.LITTLE_ENDIAN) { return bytesToInt(bytes[1], bytes[0]); } else { throw new IllegalArgumentException("ByteOrder must be BIG_ENDIAN or LITTLE_ENDIAN"); } }
[ "public", "static", "int", "twoBytesToInt", "(", "byte", "[", "]", "bytes", ",", "ByteOrder", "order", ")", "{", "if", "(", "order", "==", "ByteOrder", ".", "BIG_ENDIAN", ")", "{", "return", "bytesToInt", "(", "bytes", "[", "0", "]", ",", "bytes", "[", "1", "]", ")", ";", "}", "else", "if", "(", "order", "==", "ByteOrder", ".", "LITTLE_ENDIAN", ")", "{", "return", "bytesToInt", "(", "bytes", "[", "1", "]", ",", "bytes", "[", "0", "]", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "\"ByteOrder must be BIG_ENDIAN or LITTLE_ENDIAN\"", ")", ";", "}", "}" ]
Convert an array of two unsigned bytes with the given byte order to one signed int. @param bytes The bytes to be parsed @param order The byte order to be used @return An int representing the bytes in the given order
[ "Convert", "an", "array", "of", "two", "unsigned", "bytes", "with", "the", "given", "byte", "order", "to", "one", "signed", "int", "." ]
train
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/internal/utility/Convert.java#L61-L73
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java
GlobalizationPreferences.setDateFormat
public GlobalizationPreferences setDateFormat(int dateStyle, int timeStyle, DateFormat format) { """ Set an explicit date format. Overrides the locale priority list for a particular combination of dateStyle and timeStyle. DF_NONE should be used if for the style, where only the date or time format individually is being set. @param dateStyle DF_FULL, DF_LONG, DF_MEDIUM, DF_SHORT or DF_NONE @param timeStyle DF_FULL, DF_LONG, DF_MEDIUM, DF_SHORT or DF_NONE @param format The date format @return this, for chaining @hide draft / provisional / internal are hidden on Android """ if (isFrozen()) { throw new UnsupportedOperationException("Attempt to modify immutable object"); } if (dateFormats == null) { dateFormats = new DateFormat[DF_LIMIT][DF_LIMIT]; } dateFormats[dateStyle][timeStyle] = (DateFormat) format.clone(); // for safety return this; }
java
public GlobalizationPreferences setDateFormat(int dateStyle, int timeStyle, DateFormat format) { if (isFrozen()) { throw new UnsupportedOperationException("Attempt to modify immutable object"); } if (dateFormats == null) { dateFormats = new DateFormat[DF_LIMIT][DF_LIMIT]; } dateFormats[dateStyle][timeStyle] = (DateFormat) format.clone(); // for safety return this; }
[ "public", "GlobalizationPreferences", "setDateFormat", "(", "int", "dateStyle", ",", "int", "timeStyle", ",", "DateFormat", "format", ")", "{", "if", "(", "isFrozen", "(", ")", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"Attempt to modify immutable object\"", ")", ";", "}", "if", "(", "dateFormats", "==", "null", ")", "{", "dateFormats", "=", "new", "DateFormat", "[", "DF_LIMIT", "]", "[", "DF_LIMIT", "]", ";", "}", "dateFormats", "[", "dateStyle", "]", "[", "timeStyle", "]", "=", "(", "DateFormat", ")", "format", ".", "clone", "(", ")", ";", "// for safety", "return", "this", ";", "}" ]
Set an explicit date format. Overrides the locale priority list for a particular combination of dateStyle and timeStyle. DF_NONE should be used if for the style, where only the date or time format individually is being set. @param dateStyle DF_FULL, DF_LONG, DF_MEDIUM, DF_SHORT or DF_NONE @param timeStyle DF_FULL, DF_LONG, DF_MEDIUM, DF_SHORT or DF_NONE @param format The date format @return this, for chaining @hide draft / provisional / internal are hidden on Android
[ "Set", "an", "explicit", "date", "format", ".", "Overrides", "the", "locale", "priority", "list", "for", "a", "particular", "combination", "of", "dateStyle", "and", "timeStyle", ".", "DF_NONE", "should", "be", "used", "if", "for", "the", "style", "where", "only", "the", "date", "or", "time", "format", "individually", "is", "being", "set", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java#L639-L648
JadiraOrg/jadira
bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java
BasicBinder.registerConverter
public final <S, T> void registerConverter(ConverterKey<S,T> key, Converter<S, T> converter) { """ Register a Converter with the given input and output classes. Instances of the input class can be converted into instances of the output class @param key Converter Key to use @param converter The Converter to be registered """ if (key.getInputClass() == null) { throw new IllegalArgumentException("Input Class must not be null"); } if (key.getOutputClass() == null) { throw new IllegalArgumentException("Output Class must not be null"); } if (converter == null) { throw new IllegalArgumentException("Converter must not be null"); } if (key.getQualifierAnnotation() == null) { throw new IllegalArgumentException("Qualifier must not be null"); } Converter<?,?> old = registeredConverters.putIfAbsent(key, converter); if (old != null && (!isSameConverter(old, converter))) { throw new IllegalStateException("Converter already registered for key: " + key); } }
java
public final <S, T> void registerConverter(ConverterKey<S,T> key, Converter<S, T> converter) { if (key.getInputClass() == null) { throw new IllegalArgumentException("Input Class must not be null"); } if (key.getOutputClass() == null) { throw new IllegalArgumentException("Output Class must not be null"); } if (converter == null) { throw new IllegalArgumentException("Converter must not be null"); } if (key.getQualifierAnnotation() == null) { throw new IllegalArgumentException("Qualifier must not be null"); } Converter<?,?> old = registeredConverters.putIfAbsent(key, converter); if (old != null && (!isSameConverter(old, converter))) { throw new IllegalStateException("Converter already registered for key: " + key); } }
[ "public", "final", "<", "S", ",", "T", ">", "void", "registerConverter", "(", "ConverterKey", "<", "S", ",", "T", ">", "key", ",", "Converter", "<", "S", ",", "T", ">", "converter", ")", "{", "if", "(", "key", ".", "getInputClass", "(", ")", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Input Class must not be null\"", ")", ";", "}", "if", "(", "key", ".", "getOutputClass", "(", ")", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Output Class must not be null\"", ")", ";", "}", "if", "(", "converter", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Converter must not be null\"", ")", ";", "}", "if", "(", "key", ".", "getQualifierAnnotation", "(", ")", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Qualifier must not be null\"", ")", ";", "}", "Converter", "<", "?", ",", "?", ">", "old", "=", "registeredConverters", ".", "putIfAbsent", "(", "key", ",", "converter", ")", ";", "if", "(", "old", "!=", "null", "&&", "(", "!", "isSameConverter", "(", "old", ",", "converter", ")", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Converter already registered for key: \"", "+", "key", ")", ";", "}", "}" ]
Register a Converter with the given input and output classes. Instances of the input class can be converted into instances of the output class @param key Converter Key to use @param converter The Converter to be registered
[ "Register", "a", "Converter", "with", "the", "given", "input", "and", "output", "classes", ".", "Instances", "of", "the", "input", "class", "can", "be", "converted", "into", "instances", "of", "the", "output", "class" ]
train
https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java#L677-L697
JadiraOrg/jadira
cloning/src/main/java/org/jadira/reflection/access/unsafe/UnsafeOperations.java
UnsafeOperations.putInt
public final void putInt(Object parent, long offset, int value) { """ Puts the value at the given offset of the supplied parent object @param parent The Object's parent @param offset The offset @param value int to be put """ THE_UNSAFE.putInt(parent, offset, value); }
java
public final void putInt(Object parent, long offset, int value) { THE_UNSAFE.putInt(parent, offset, value); }
[ "public", "final", "void", "putInt", "(", "Object", "parent", ",", "long", "offset", ",", "int", "value", ")", "{", "THE_UNSAFE", ".", "putInt", "(", "parent", ",", "offset", ",", "value", ")", ";", "}" ]
Puts the value at the given offset of the supplied parent object @param parent The Object's parent @param offset The offset @param value int to be put
[ "Puts", "the", "value", "at", "the", "given", "offset", "of", "the", "supplied", "parent", "object" ]
train
https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/cloning/src/main/java/org/jadira/reflection/access/unsafe/UnsafeOperations.java#L983-L985
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/VoiceApi.java
VoiceApi.initiateTransfer
public void initiateTransfer( String connId, String destination, String location, String outboundCallerId, KeyValueCollection userData, KeyValueCollection reasons, KeyValueCollection extensions ) throws WorkspaceApiException { """ Initiate a two-step transfer by placing the first call on hold and dialing the destination number (step 1). After initiating the transfer, you can use `completeTransfer()` to complete the transfer (step 2). @param connId The connection ID of the call to be transferred. This call will be placed on hold. @param destination The number where the call will be transferred. @param location Name of the remote location in the form of <SwitchName> or <T-ServerApplicationName>@<SwitchName>. This value is used by Workspace to set the location attribute for the corresponding T-Server requests. (optional) @param outboundCallerId The caller ID information to display on the destination party's phone. The value should be set as CPNDigits. For more information about caller ID, see the SIP Server Deployment Guide. (optional) @param userData Key/value data to include with the call. (optional) @param reasons Information on causes for, and results of, actions taken by the user of the current DN. For details about reasons, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Reasons). (optional) @param extensions Media device/hardware reason codes and similar information. For details about extensions, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Extensions). (optional) """ try { VoicecallsidinitiatetransferData data = new VoicecallsidinitiatetransferData(); data.setDestination(destination); data.setLocation(location); data.setOutboundCallerId(outboundCallerId); data.setUserData(Util.toKVList(userData)); data.setReasons(Util.toKVList(reasons)); data.setExtensions(Util.toKVList(extensions)); InitiateTransferData initData = new InitiateTransferData(); initData.data(data); ApiSuccessResponse response = this.voiceApi.initiateTransfer(connId, initData); throwIfNotOk("initiateTransfer", response); } catch (ApiException e) { throw new WorkspaceApiException("initiateTransfer failed.", e); } }
java
public void initiateTransfer( String connId, String destination, String location, String outboundCallerId, KeyValueCollection userData, KeyValueCollection reasons, KeyValueCollection extensions ) throws WorkspaceApiException { try { VoicecallsidinitiatetransferData data = new VoicecallsidinitiatetransferData(); data.setDestination(destination); data.setLocation(location); data.setOutboundCallerId(outboundCallerId); data.setUserData(Util.toKVList(userData)); data.setReasons(Util.toKVList(reasons)); data.setExtensions(Util.toKVList(extensions)); InitiateTransferData initData = new InitiateTransferData(); initData.data(data); ApiSuccessResponse response = this.voiceApi.initiateTransfer(connId, initData); throwIfNotOk("initiateTransfer", response); } catch (ApiException e) { throw new WorkspaceApiException("initiateTransfer failed.", e); } }
[ "public", "void", "initiateTransfer", "(", "String", "connId", ",", "String", "destination", ",", "String", "location", ",", "String", "outboundCallerId", ",", "KeyValueCollection", "userData", ",", "KeyValueCollection", "reasons", ",", "KeyValueCollection", "extensions", ")", "throws", "WorkspaceApiException", "{", "try", "{", "VoicecallsidinitiatetransferData", "data", "=", "new", "VoicecallsidinitiatetransferData", "(", ")", ";", "data", ".", "setDestination", "(", "destination", ")", ";", "data", ".", "setLocation", "(", "location", ")", ";", "data", ".", "setOutboundCallerId", "(", "outboundCallerId", ")", ";", "data", ".", "setUserData", "(", "Util", ".", "toKVList", "(", "userData", ")", ")", ";", "data", ".", "setReasons", "(", "Util", ".", "toKVList", "(", "reasons", ")", ")", ";", "data", ".", "setExtensions", "(", "Util", ".", "toKVList", "(", "extensions", ")", ")", ";", "InitiateTransferData", "initData", "=", "new", "InitiateTransferData", "(", ")", ";", "initData", ".", "data", "(", "data", ")", ";", "ApiSuccessResponse", "response", "=", "this", ".", "voiceApi", ".", "initiateTransfer", "(", "connId", ",", "initData", ")", ";", "throwIfNotOk", "(", "\"initiateTransfer\"", ",", "response", ")", ";", "}", "catch", "(", "ApiException", "e", ")", "{", "throw", "new", "WorkspaceApiException", "(", "\"initiateTransfer failed.\"", ",", "e", ")", ";", "}", "}" ]
Initiate a two-step transfer by placing the first call on hold and dialing the destination number (step 1). After initiating the transfer, you can use `completeTransfer()` to complete the transfer (step 2). @param connId The connection ID of the call to be transferred. This call will be placed on hold. @param destination The number where the call will be transferred. @param location Name of the remote location in the form of <SwitchName> or <T-ServerApplicationName>@<SwitchName>. This value is used by Workspace to set the location attribute for the corresponding T-Server requests. (optional) @param outboundCallerId The caller ID information to display on the destination party's phone. The value should be set as CPNDigits. For more information about caller ID, see the SIP Server Deployment Guide. (optional) @param userData Key/value data to include with the call. (optional) @param reasons Information on causes for, and results of, actions taken by the user of the current DN. For details about reasons, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Reasons). (optional) @param extensions Media device/hardware reason codes and similar information. For details about extensions, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Extensions). (optional)
[ "Initiate", "a", "two", "-", "step", "transfer", "by", "placing", "the", "first", "call", "on", "hold", "and", "dialing", "the", "destination", "number", "(", "step", "1", ")", ".", "After", "initiating", "the", "transfer", "you", "can", "use", "completeTransfer", "()", "to", "complete", "the", "transfer", "(", "step", "2", ")", "." ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L798-L823
softindex/datakernel
core-bytebuf/src/main/java/io/datakernel/bytebuf/ByteBufPool.java
ByteBufPool.ensureWriteRemaining
@NotNull public static ByteBuf ensureWriteRemaining(@NotNull ByteBuf buf, int minSize, int newWriteRemaining) { """ Checks if current ByteBuf can accommodate the needed amount of writable bytes. <p> Returns this ByteBuf, if it contains enough writable bytes. <p> Otherwise creates a new ByteBuf which contains data from the original ByteBuf and fits the parameters. Then recycles the original ByteBuf. @param buf the ByteBuf to check @param minSize the minimal size of the ByteBuf @param newWriteRemaining amount of needed writable bytes @return a ByteBuf which fits the parameters """ if (newWriteRemaining == 0) return buf; if (buf.writeRemaining() < newWriteRemaining || buf instanceof ByteBufSlice) { ByteBuf newBuf = allocate(max(minSize, newWriteRemaining + buf.readRemaining())); newBuf.put(buf); buf.recycle(); return newBuf; } return buf; }
java
@NotNull public static ByteBuf ensureWriteRemaining(@NotNull ByteBuf buf, int minSize, int newWriteRemaining) { if (newWriteRemaining == 0) return buf; if (buf.writeRemaining() < newWriteRemaining || buf instanceof ByteBufSlice) { ByteBuf newBuf = allocate(max(minSize, newWriteRemaining + buf.readRemaining())); newBuf.put(buf); buf.recycle(); return newBuf; } return buf; }
[ "@", "NotNull", "public", "static", "ByteBuf", "ensureWriteRemaining", "(", "@", "NotNull", "ByteBuf", "buf", ",", "int", "minSize", ",", "int", "newWriteRemaining", ")", "{", "if", "(", "newWriteRemaining", "==", "0", ")", "return", "buf", ";", "if", "(", "buf", ".", "writeRemaining", "(", ")", "<", "newWriteRemaining", "||", "buf", "instanceof", "ByteBufSlice", ")", "{", "ByteBuf", "newBuf", "=", "allocate", "(", "max", "(", "minSize", ",", "newWriteRemaining", "+", "buf", ".", "readRemaining", "(", ")", ")", ")", ";", "newBuf", ".", "put", "(", "buf", ")", ";", "buf", ".", "recycle", "(", ")", ";", "return", "newBuf", ";", "}", "return", "buf", ";", "}" ]
Checks if current ByteBuf can accommodate the needed amount of writable bytes. <p> Returns this ByteBuf, if it contains enough writable bytes. <p> Otherwise creates a new ByteBuf which contains data from the original ByteBuf and fits the parameters. Then recycles the original ByteBuf. @param buf the ByteBuf to check @param minSize the minimal size of the ByteBuf @param newWriteRemaining amount of needed writable bytes @return a ByteBuf which fits the parameters
[ "Checks", "if", "current", "ByteBuf", "can", "accommodate", "the", "needed", "amount", "of", "writable", "bytes", ".", "<p", ">", "Returns", "this", "ByteBuf", "if", "it", "contains", "enough", "writable", "bytes", ".", "<p", ">", "Otherwise", "creates", "a", "new", "ByteBuf", "which", "contains", "data", "from", "the", "original", "ByteBuf", "and", "fits", "the", "parameters", ".", "Then", "recycles", "the", "original", "ByteBuf", "." ]
train
https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/core-bytebuf/src/main/java/io/datakernel/bytebuf/ByteBufPool.java#L258-L268
ehcache/ehcache3
core/src/main/java/org/ehcache/core/spi/service/ServiceUtils.java
ServiceUtils.findAmongst
public static <T> Collection<T> findAmongst(Class<T> clazz, Collection<?> instances) { """ Find instances of {@code clazz} among the {@code instances}. @param clazz searched class @param instances instances looked at @param <T> type of the searched instances @return the list of compatible instances """ return findStreamAmongst(clazz, instances) .collect(Collectors.toList()); }
java
public static <T> Collection<T> findAmongst(Class<T> clazz, Collection<?> instances) { return findStreamAmongst(clazz, instances) .collect(Collectors.toList()); }
[ "public", "static", "<", "T", ">", "Collection", "<", "T", ">", "findAmongst", "(", "Class", "<", "T", ">", "clazz", ",", "Collection", "<", "?", ">", "instances", ")", "{", "return", "findStreamAmongst", "(", "clazz", ",", "instances", ")", ".", "collect", "(", "Collectors", ".", "toList", "(", ")", ")", ";", "}" ]
Find instances of {@code clazz} among the {@code instances}. @param clazz searched class @param instances instances looked at @param <T> type of the searched instances @return the list of compatible instances
[ "Find", "instances", "of", "{", "@code", "clazz", "}", "among", "the", "{", "@code", "instances", "}", "." ]
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/core/src/main/java/org/ehcache/core/spi/service/ServiceUtils.java#L49-L52
EdwardRaff/JSAT
JSAT/src/jsat/linear/Matrix.java
Matrix.eye
public static DenseMatrix eye(int k) { """ Creates a new dense identity matrix with <i>k</i> rows and columns. @param k the number of rows / columns @return a new dense identity matrix <i>I<sub>k</sub></i> """ DenseMatrix eye = new DenseMatrix(k, k); for(int i = 0; i < k; i++ ) eye.set(i, i, 1); return eye; }
java
public static DenseMatrix eye(int k) { DenseMatrix eye = new DenseMatrix(k, k); for(int i = 0; i < k; i++ ) eye.set(i, i, 1); return eye; }
[ "public", "static", "DenseMatrix", "eye", "(", "int", "k", ")", "{", "DenseMatrix", "eye", "=", "new", "DenseMatrix", "(", "k", ",", "k", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "k", ";", "i", "++", ")", "eye", ".", "set", "(", "i", ",", "i", ",", "1", ")", ";", "return", "eye", ";", "}" ]
Creates a new dense identity matrix with <i>k</i> rows and columns. @param k the number of rows / columns @return a new dense identity matrix <i>I<sub>k</sub></i>
[ "Creates", "a", "new", "dense", "identity", "matrix", "with", "<i", ">", "k<", "/", "i", ">", "rows", "and", "columns", "." ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/Matrix.java#L981-L987
chocotan/datepicker4j
src/main/java/io/loli/datepicker/DatePanel.java
DatePanel.getDayIndex
private int getDayIndex(int year, int month, int day) { """ Get DAY_OF_WEEK of a day @param year the year @param month the month @param day the day @return DAY_OF_WEEK of this day """ Calendar cal = Calendar.getInstance(); cal.set(year, month, day); return cal.get(Calendar.DAY_OF_WEEK); }
java
private int getDayIndex(int year, int month, int day) { Calendar cal = Calendar.getInstance(); cal.set(year, month, day); return cal.get(Calendar.DAY_OF_WEEK); }
[ "private", "int", "getDayIndex", "(", "int", "year", ",", "int", "month", ",", "int", "day", ")", "{", "Calendar", "cal", "=", "Calendar", ".", "getInstance", "(", ")", ";", "cal", ".", "set", "(", "year", ",", "month", ",", "day", ")", ";", "return", "cal", ".", "get", "(", "Calendar", ".", "DAY_OF_WEEK", ")", ";", "}" ]
Get DAY_OF_WEEK of a day @param year the year @param month the month @param day the day @return DAY_OF_WEEK of this day
[ "Get", "DAY_OF_WEEK", "of", "a", "day" ]
train
https://github.com/chocotan/datepicker4j/blob/d65d7a6b29f9efe77aeec2024dc31a38a7852676/src/main/java/io/loli/datepicker/DatePanel.java#L253-L257
line/armeria
core/src/main/java/com/linecorp/armeria/server/healthcheck/ManagedHttpHealthCheckService.java
ManagedHttpHealthCheckService.updateHealthStatus
private CompletionStage<AggregatedHttpMessage> updateHealthStatus( ServiceRequestContext ctx, HttpRequest req) { """ Updates health status using the specified {@link HttpRequest}. """ return mode(ctx, req).thenApply(mode -> { if (!mode.isPresent()) { return BAD_REQUEST_RES; } final boolean isHealthy = mode.get(); serverHealth.setHealthy(isHealthy); return isHealthy ? TURN_ON_RES : TURN_OFF_RES; }); }
java
private CompletionStage<AggregatedHttpMessage> updateHealthStatus( ServiceRequestContext ctx, HttpRequest req) { return mode(ctx, req).thenApply(mode -> { if (!mode.isPresent()) { return BAD_REQUEST_RES; } final boolean isHealthy = mode.get(); serverHealth.setHealthy(isHealthy); return isHealthy ? TURN_ON_RES : TURN_OFF_RES; }); }
[ "private", "CompletionStage", "<", "AggregatedHttpMessage", ">", "updateHealthStatus", "(", "ServiceRequestContext", "ctx", ",", "HttpRequest", "req", ")", "{", "return", "mode", "(", "ctx", ",", "req", ")", ".", "thenApply", "(", "mode", "->", "{", "if", "(", "!", "mode", ".", "isPresent", "(", ")", ")", "{", "return", "BAD_REQUEST_RES", ";", "}", "final", "boolean", "isHealthy", "=", "mode", ".", "get", "(", ")", ";", "serverHealth", ".", "setHealthy", "(", "isHealthy", ")", ";", "return", "isHealthy", "?", "TURN_ON_RES", ":", "TURN_OFF_RES", ";", "}", ")", ";", "}" ]
Updates health status using the specified {@link HttpRequest}.
[ "Updates", "health", "status", "using", "the", "specified", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/healthcheck/ManagedHttpHealthCheckService.java#L69-L82
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/UIContextImpl.java
UIContextImpl.setModel
@Override public void setModel(final WebComponent component, final WebModel model) { """ Stores the extrinsic state information for the given component. @param component the component to set the model for. @param model the model to set. """ map.put(component, model); }
java
@Override public void setModel(final WebComponent component, final WebModel model) { map.put(component, model); }
[ "@", "Override", "public", "void", "setModel", "(", "final", "WebComponent", "component", ",", "final", "WebModel", "model", ")", "{", "map", ".", "put", "(", "component", ",", "model", ")", ";", "}" ]
Stores the extrinsic state information for the given component. @param component the component to set the model for. @param model the model to set.
[ "Stores", "the", "extrinsic", "state", "information", "for", "the", "given", "component", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/UIContextImpl.java#L123-L126
s1ck/gdl
src/main/java/org/s1ck/gdl/GDLLoader.java
GDLLoader.getVertexCache
Map<String, Vertex> getVertexCache(boolean includeUserDefined, boolean includeAutoGenerated) { """ Returns a cache containing a mapping from variables to vertices. @param includeUserDefined include user-defined variables @param includeAutoGenerated include auto-generated variables @return immutable vertex cache """ return getCache(userVertexCache, autoVertexCache, includeUserDefined, includeAutoGenerated); }
java
Map<String, Vertex> getVertexCache(boolean includeUserDefined, boolean includeAutoGenerated) { return getCache(userVertexCache, autoVertexCache, includeUserDefined, includeAutoGenerated); }
[ "Map", "<", "String", ",", "Vertex", ">", "getVertexCache", "(", "boolean", "includeUserDefined", ",", "boolean", "includeAutoGenerated", ")", "{", "return", "getCache", "(", "userVertexCache", ",", "autoVertexCache", ",", "includeUserDefined", ",", "includeAutoGenerated", ")", ";", "}" ]
Returns a cache containing a mapping from variables to vertices. @param includeUserDefined include user-defined variables @param includeAutoGenerated include auto-generated variables @return immutable vertex cache
[ "Returns", "a", "cache", "containing", "a", "mapping", "from", "variables", "to", "vertices", "." ]
train
https://github.com/s1ck/gdl/blob/c89b0f83526661823ad3392f338dbf7dc3e3f834/src/main/java/org/s1ck/gdl/GDLLoader.java#L238-L240
knowitall/common-java
src/main/java/edu/washington/cs/knowitall/commonlib/FileUtils.java
FileUtils.pipe
public static void pipe(Reader reader, Writer writer, int buffersize) throws IOException { """ * Writes all lines read from the reader. @param reader the source reader @param writer the destination writer @param buffersize size of the buffer to use @throws IOException """ char[] buffer = new char[buffersize]; while (reader.read(buffer) != -1) { writer.write(buffer); } }
java
public static void pipe(Reader reader, Writer writer, int buffersize) throws IOException { char[] buffer = new char[buffersize]; while (reader.read(buffer) != -1) { writer.write(buffer); } }
[ "public", "static", "void", "pipe", "(", "Reader", "reader", ",", "Writer", "writer", ",", "int", "buffersize", ")", "throws", "IOException", "{", "char", "[", "]", "buffer", "=", "new", "char", "[", "buffersize", "]", ";", "while", "(", "reader", ".", "read", "(", "buffer", ")", "!=", "-", "1", ")", "{", "writer", ".", "write", "(", "buffer", ")", ";", "}", "}" ]
* Writes all lines read from the reader. @param reader the source reader @param writer the destination writer @param buffersize size of the buffer to use @throws IOException
[ "*", "Writes", "all", "lines", "read", "from", "the", "reader", "." ]
train
https://github.com/knowitall/common-java/blob/6c3e7b2f13da5afb1306e87a6c322c55b65fddfc/src/main/java/edu/washington/cs/knowitall/commonlib/FileUtils.java#L42-L47
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/BooleanIndexing.java
BooleanIndexing.lastIndex
public static INDArray lastIndex(INDArray array, Condition condition, int... dimension) { """ This method returns first index matching given condition along given dimensions PLEASE NOTE: This method will return -1 values for missing conditions @param array @param condition @param dimension @return """ if (!(condition instanceof BaseCondition)) throw new UnsupportedOperationException("Only static Conditions are supported"); return Nd4j.getExecutioner().exec(new LastIndex(array, condition, dimension)); }
java
public static INDArray lastIndex(INDArray array, Condition condition, int... dimension) { if (!(condition instanceof BaseCondition)) throw new UnsupportedOperationException("Only static Conditions are supported"); return Nd4j.getExecutioner().exec(new LastIndex(array, condition, dimension)); }
[ "public", "static", "INDArray", "lastIndex", "(", "INDArray", "array", ",", "Condition", "condition", ",", "int", "...", "dimension", ")", "{", "if", "(", "!", "(", "condition", "instanceof", "BaseCondition", ")", ")", "throw", "new", "UnsupportedOperationException", "(", "\"Only static Conditions are supported\"", ")", ";", "return", "Nd4j", ".", "getExecutioner", "(", ")", ".", "exec", "(", "new", "LastIndex", "(", "array", ",", "condition", ",", "dimension", ")", ")", ";", "}" ]
This method returns first index matching given condition along given dimensions PLEASE NOTE: This method will return -1 values for missing conditions @param array @param condition @param dimension @return
[ "This", "method", "returns", "first", "index", "matching", "given", "condition", "along", "given", "dimensions" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/BooleanIndexing.java#L334-L339
m-m-m/util
version/src/main/java/net/sf/mmm/util/version/base/AbstractVersionIdentifier.java
AbstractVersionIdentifier.compareToTimestamp
private int compareToTimestamp(int currentResult, VersionIdentifier otherVersion) { """ This method performs the part of {@link #compareTo(VersionIdentifier)} for the {@link #getTimestamp() timestamp}. @param currentResult is the current result so far. @param otherVersion is the {@link VersionIdentifier} to compare to. @return the result of comparison. """ return compareToLinear(currentResult, getTimestamp(), otherVersion.getTimestamp(), otherVersion); }
java
private int compareToTimestamp(int currentResult, VersionIdentifier otherVersion) { return compareToLinear(currentResult, getTimestamp(), otherVersion.getTimestamp(), otherVersion); }
[ "private", "int", "compareToTimestamp", "(", "int", "currentResult", ",", "VersionIdentifier", "otherVersion", ")", "{", "return", "compareToLinear", "(", "currentResult", ",", "getTimestamp", "(", ")", ",", "otherVersion", ".", "getTimestamp", "(", ")", ",", "otherVersion", ")", ";", "}" ]
This method performs the part of {@link #compareTo(VersionIdentifier)} for the {@link #getTimestamp() timestamp}. @param currentResult is the current result so far. @param otherVersion is the {@link VersionIdentifier} to compare to. @return the result of comparison.
[ "This", "method", "performs", "the", "part", "of", "{", "@link", "#compareTo", "(", "VersionIdentifier", ")", "}", "for", "the", "{", "@link", "#getTimestamp", "()", "timestamp", "}", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/version/src/main/java/net/sf/mmm/util/version/base/AbstractVersionIdentifier.java#L207-L210
RestComm/sipunit
src/main/java/org/cafesip/sipunit/SipCall.java
SipCall.respondToCancel
public boolean respondToCancel(SipTransaction siptrans, int statusCode, String reasonPhrase, int expires) { """ This method sends a basic response to a previously received CANCEL request. The response is constructed based on the parameters passed in. Call this method after waitForCancel() returns non-null. Call this method multiple times to send multiple responses to the received CANCEL. @param siptrans This is the object that was returned by method waitForCancel(). It identifies a specific CANCEL transaction. @param statusCode The status code of the response to send (may use SipResponse constants). @param reasonPhrase If not null, the reason phrase to send. @param expires If not -1, an expiration time is added to the response. This parameter indicates the duration the message is valid, in seconds. @return true if the response was successfully sent, false otherwise. """ return respondToCancel(siptrans, statusCode, reasonPhrase, expires, null, null, null); }
java
public boolean respondToCancel(SipTransaction siptrans, int statusCode, String reasonPhrase, int expires) { return respondToCancel(siptrans, statusCode, reasonPhrase, expires, null, null, null); }
[ "public", "boolean", "respondToCancel", "(", "SipTransaction", "siptrans", ",", "int", "statusCode", ",", "String", "reasonPhrase", ",", "int", "expires", ")", "{", "return", "respondToCancel", "(", "siptrans", ",", "statusCode", ",", "reasonPhrase", ",", "expires", ",", "null", ",", "null", ",", "null", ")", ";", "}" ]
This method sends a basic response to a previously received CANCEL request. The response is constructed based on the parameters passed in. Call this method after waitForCancel() returns non-null. Call this method multiple times to send multiple responses to the received CANCEL. @param siptrans This is the object that was returned by method waitForCancel(). It identifies a specific CANCEL transaction. @param statusCode The status code of the response to send (may use SipResponse constants). @param reasonPhrase If not null, the reason phrase to send. @param expires If not -1, an expiration time is added to the response. This parameter indicates the duration the message is valid, in seconds. @return true if the response was successfully sent, false otherwise.
[ "This", "method", "sends", "a", "basic", "response", "to", "a", "previously", "received", "CANCEL", "request", ".", "The", "response", "is", "constructed", "based", "on", "the", "parameters", "passed", "in", ".", "Call", "this", "method", "after", "waitForCancel", "()", "returns", "non", "-", "null", ".", "Call", "this", "method", "multiple", "times", "to", "send", "multiple", "responses", "to", "the", "received", "CANCEL", "." ]
train
https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/SipCall.java#L3255-L3258
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.service.location/src/com/ibm/ws/kernel/service/location/internal/FileLocator.java
FileLocator.matchFileInFilePath
public static File matchFileInFilePath(String regex, Collection<File> pathList) { """ Look for given file in any of the specified directories, return the first one found. @param name The name of the file to find @param pathList The list of directories to check @return The File object if the file is found; null if the pathList is null or empty, or file is not found. @throws SecurityException If a security manager exists and its <code>{@link java.lang.SecurityManager#checkRead(java.lang.String)}</code> method denies read access to the file. """ if (regex == null || pathList == null || pathList.size() == 0) return null; for (File dirPath : pathList) { File result = matchFile(dirPath, regex); if (result != null) return result; } return null; }
java
public static File matchFileInFilePath(String regex, Collection<File> pathList) { if (regex == null || pathList == null || pathList.size() == 0) return null; for (File dirPath : pathList) { File result = matchFile(dirPath, regex); if (result != null) return result; } return null; }
[ "public", "static", "File", "matchFileInFilePath", "(", "String", "regex", ",", "Collection", "<", "File", ">", "pathList", ")", "{", "if", "(", "regex", "==", "null", "||", "pathList", "==", "null", "||", "pathList", ".", "size", "(", ")", "==", "0", ")", "return", "null", ";", "for", "(", "File", "dirPath", ":", "pathList", ")", "{", "File", "result", "=", "matchFile", "(", "dirPath", ",", "regex", ")", ";", "if", "(", "result", "!=", "null", ")", "return", "result", ";", "}", "return", "null", ";", "}" ]
Look for given file in any of the specified directories, return the first one found. @param name The name of the file to find @param pathList The list of directories to check @return The File object if the file is found; null if the pathList is null or empty, or file is not found. @throws SecurityException If a security manager exists and its <code>{@link java.lang.SecurityManager#checkRead(java.lang.String)}</code> method denies read access to the file.
[ "Look", "for", "given", "file", "in", "any", "of", "the", "specified", "directories", "return", "the", "first", "one", "found", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service.location/src/com/ibm/ws/kernel/service/location/internal/FileLocator.java#L178-L189
gallandarakhneorg/afc
advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/ifx/Segment3ifx.java
Segment3ifx.y1Property
@Pure public IntegerProperty y1Property() { """ Replies the property that is the y coordinate of the first segment point. @return the y1 property. """ if (this.p1.y == null) { this.p1.y = new SimpleIntegerProperty(this, MathFXAttributeNames.Y1); } return this.p1.y; }
java
@Pure public IntegerProperty y1Property() { if (this.p1.y == null) { this.p1.y = new SimpleIntegerProperty(this, MathFXAttributeNames.Y1); } return this.p1.y; }
[ "@", "Pure", "public", "IntegerProperty", "y1Property", "(", ")", "{", "if", "(", "this", ".", "p1", ".", "y", "==", "null", ")", "{", "this", ".", "p1", ".", "y", "=", "new", "SimpleIntegerProperty", "(", "this", ",", "MathFXAttributeNames", ".", "Y1", ")", ";", "}", "return", "this", ".", "p1", ".", "y", ";", "}" ]
Replies the property that is the y coordinate of the first segment point. @return the y1 property.
[ "Replies", "the", "property", "that", "is", "the", "y", "coordinate", "of", "the", "first", "segment", "point", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/ifx/Segment3ifx.java#L222-L228
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.groupedUntil
public final static <T> Stream<Seq<T>> groupedUntil(final Stream<T> stream, final Predicate<? super T> predicate) { """ Group a Stream until the supplied predicate holds @see ReactiveSeq#groupedUntil(Predicate) @param stream Stream to group @param predicate Predicate to determine grouping @return Stream grouped into Lists determined by predicate """ return groupedWhile(stream, predicate.negate()); }
java
public final static <T> Stream<Seq<T>> groupedUntil(final Stream<T> stream, final Predicate<? super T> predicate) { return groupedWhile(stream, predicate.negate()); }
[ "public", "final", "static", "<", "T", ">", "Stream", "<", "Seq", "<", "T", ">", ">", "groupedUntil", "(", "final", "Stream", "<", "T", ">", "stream", ",", "final", "Predicate", "<", "?", "super", "T", ">", "predicate", ")", "{", "return", "groupedWhile", "(", "stream", ",", "predicate", ".", "negate", "(", ")", ")", ";", "}" ]
Group a Stream until the supplied predicate holds @see ReactiveSeq#groupedUntil(Predicate) @param stream Stream to group @param predicate Predicate to determine grouping @return Stream grouped into Lists determined by predicate
[ "Group", "a", "Stream", "until", "the", "supplied", "predicate", "holds" ]
train
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L2651-L2653
azkaban/azkaban
azkaban-hadoop-security-plugin/src/main/java/azkaban/security/HadoopSecurityManager_H_2_0.java
HadoopSecurityManager_H_2_0.assignPermissions
private void assignPermissions(final String user, final File tokenFile, final Logger logger) throws IOException { """ Uses execute-as-user binary to reassign file permissions to be readable only by that user. Step 1. Set file permissions to 460. Readable to self and readable / writable azkaban group Step 2. Set user as owner of file. @param user user to be proxied @param tokenFile file to be written @param logger logger to use """ final List<String> changePermissionsCommand = Arrays.asList( CHMOD, TOKEN_FILE_PERMISSIONS, tokenFile.getAbsolutePath() ); int result = this.executeAsUser .execute(System.getProperty("user.name"), changePermissionsCommand); if (result != 0) { throw new IOException("Unable to modify permissions. User: " + user); } final List<String> changeOwnershipCommand = Arrays.asList( CHOWN, user + ":" + GROUP_NAME, tokenFile.getAbsolutePath() ); result = this.executeAsUser.execute("root", changeOwnershipCommand); if (result != 0) { throw new IOException("Unable to set ownership. User: " + user); } }
java
private void assignPermissions(final String user, final File tokenFile, final Logger logger) throws IOException { final List<String> changePermissionsCommand = Arrays.asList( CHMOD, TOKEN_FILE_PERMISSIONS, tokenFile.getAbsolutePath() ); int result = this.executeAsUser .execute(System.getProperty("user.name"), changePermissionsCommand); if (result != 0) { throw new IOException("Unable to modify permissions. User: " + user); } final List<String> changeOwnershipCommand = Arrays.asList( CHOWN, user + ":" + GROUP_NAME, tokenFile.getAbsolutePath() ); result = this.executeAsUser.execute("root", changeOwnershipCommand); if (result != 0) { throw new IOException("Unable to set ownership. User: " + user); } }
[ "private", "void", "assignPermissions", "(", "final", "String", "user", ",", "final", "File", "tokenFile", ",", "final", "Logger", "logger", ")", "throws", "IOException", "{", "final", "List", "<", "String", ">", "changePermissionsCommand", "=", "Arrays", ".", "asList", "(", "CHMOD", ",", "TOKEN_FILE_PERMISSIONS", ",", "tokenFile", ".", "getAbsolutePath", "(", ")", ")", ";", "int", "result", "=", "this", ".", "executeAsUser", ".", "execute", "(", "System", ".", "getProperty", "(", "\"user.name\"", ")", ",", "changePermissionsCommand", ")", ";", "if", "(", "result", "!=", "0", ")", "{", "throw", "new", "IOException", "(", "\"Unable to modify permissions. User: \"", "+", "user", ")", ";", "}", "final", "List", "<", "String", ">", "changeOwnershipCommand", "=", "Arrays", ".", "asList", "(", "CHOWN", ",", "user", "+", "\":\"", "+", "GROUP_NAME", ",", "tokenFile", ".", "getAbsolutePath", "(", ")", ")", ";", "result", "=", "this", ".", "executeAsUser", ".", "execute", "(", "\"root\"", ",", "changeOwnershipCommand", ")", ";", "if", "(", "result", "!=", "0", ")", "{", "throw", "new", "IOException", "(", "\"Unable to set ownership. User: \"", "+", "user", ")", ";", "}", "}" ]
Uses execute-as-user binary to reassign file permissions to be readable only by that user. Step 1. Set file permissions to 460. Readable to self and readable / writable azkaban group Step 2. Set user as owner of file. @param user user to be proxied @param tokenFile file to be written @param logger logger to use
[ "Uses", "execute", "-", "as", "-", "user", "binary", "to", "reassign", "file", "permissions", "to", "be", "readable", "only", "by", "that", "user", "." ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-hadoop-security-plugin/src/main/java/azkaban/security/HadoopSecurityManager_H_2_0.java#L741-L759
voldemort/voldemort
src/java/voldemort/rest/coordinator/DynamicTimeoutStoreClient.java
DynamicTimeoutStoreClient.putVersionedWithCustomTimeout
public Version putVersionedWithCustomTimeout(CompositeVoldemortRequest<K, V> requestWrapper) throws ObsoleteVersionException { """ Performs a Versioned put operation with the specified composite request object @param requestWrapper Composite request object containing the key and the versioned object @return Version of the value for the successful put @throws ObsoleteVersionException """ validateTimeout(requestWrapper.getRoutingTimeoutInMs()); for(int attempts = 0; attempts < this.metadataRefreshAttempts; attempts++) { try { String keyHexString = ""; long startTimeInMs = System.currentTimeMillis(); if(logger.isDebugEnabled()) { ByteArray key = (ByteArray) requestWrapper.getKey(); keyHexString = RestUtils.getKeyHexString(key); debugLogStart("PUT_VERSION", requestWrapper.getRequestOriginTimeInMs(), startTimeInMs, keyHexString); } store.put(requestWrapper); if(logger.isDebugEnabled()) { debugLogEnd("PUT_VERSION", requestWrapper.getRequestOriginTimeInMs(), startTimeInMs, System.currentTimeMillis(), keyHexString, 0); } return requestWrapper.getValue().getVersion(); } catch(InvalidMetadataException e) { logger.info("Received invalid metadata exception during put [ " + e.getMessage() + " ] on store '" + storeName + "'. Rebootstrapping"); bootStrap(); } } throw new VoldemortException(this.metadataRefreshAttempts + " metadata refresh attempts failed."); }
java
public Version putVersionedWithCustomTimeout(CompositeVoldemortRequest<K, V> requestWrapper) throws ObsoleteVersionException { validateTimeout(requestWrapper.getRoutingTimeoutInMs()); for(int attempts = 0; attempts < this.metadataRefreshAttempts; attempts++) { try { String keyHexString = ""; long startTimeInMs = System.currentTimeMillis(); if(logger.isDebugEnabled()) { ByteArray key = (ByteArray) requestWrapper.getKey(); keyHexString = RestUtils.getKeyHexString(key); debugLogStart("PUT_VERSION", requestWrapper.getRequestOriginTimeInMs(), startTimeInMs, keyHexString); } store.put(requestWrapper); if(logger.isDebugEnabled()) { debugLogEnd("PUT_VERSION", requestWrapper.getRequestOriginTimeInMs(), startTimeInMs, System.currentTimeMillis(), keyHexString, 0); } return requestWrapper.getValue().getVersion(); } catch(InvalidMetadataException e) { logger.info("Received invalid metadata exception during put [ " + e.getMessage() + " ] on store '" + storeName + "'. Rebootstrapping"); bootStrap(); } } throw new VoldemortException(this.metadataRefreshAttempts + " metadata refresh attempts failed."); }
[ "public", "Version", "putVersionedWithCustomTimeout", "(", "CompositeVoldemortRequest", "<", "K", ",", "V", ">", "requestWrapper", ")", "throws", "ObsoleteVersionException", "{", "validateTimeout", "(", "requestWrapper", ".", "getRoutingTimeoutInMs", "(", ")", ")", ";", "for", "(", "int", "attempts", "=", "0", ";", "attempts", "<", "this", ".", "metadataRefreshAttempts", ";", "attempts", "++", ")", "{", "try", "{", "String", "keyHexString", "=", "\"\"", ";", "long", "startTimeInMs", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "ByteArray", "key", "=", "(", "ByteArray", ")", "requestWrapper", ".", "getKey", "(", ")", ";", "keyHexString", "=", "RestUtils", ".", "getKeyHexString", "(", "key", ")", ";", "debugLogStart", "(", "\"PUT_VERSION\"", ",", "requestWrapper", ".", "getRequestOriginTimeInMs", "(", ")", ",", "startTimeInMs", ",", "keyHexString", ")", ";", "}", "store", ".", "put", "(", "requestWrapper", ")", ";", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "debugLogEnd", "(", "\"PUT_VERSION\"", ",", "requestWrapper", ".", "getRequestOriginTimeInMs", "(", ")", ",", "startTimeInMs", ",", "System", ".", "currentTimeMillis", "(", ")", ",", "keyHexString", ",", "0", ")", ";", "}", "return", "requestWrapper", ".", "getValue", "(", ")", ".", "getVersion", "(", ")", ";", "}", "catch", "(", "InvalidMetadataException", "e", ")", "{", "logger", ".", "info", "(", "\"Received invalid metadata exception during put [ \"", "+", "e", ".", "getMessage", "(", ")", "+", "\" ] on store '\"", "+", "storeName", "+", "\"'. Rebootstrapping\"", ")", ";", "bootStrap", "(", ")", ";", "}", "}", "throw", "new", "VoldemortException", "(", "this", ".", "metadataRefreshAttempts", "+", "\" metadata refresh attempts failed.\"", ")", ";", "}" ]
Performs a Versioned put operation with the specified composite request object @param requestWrapper Composite request object containing the key and the versioned object @return Version of the value for the successful put @throws ObsoleteVersionException
[ "Performs", "a", "Versioned", "put", "operation", "with", "the", "specified", "composite", "request", "object" ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/rest/coordinator/DynamicTimeoutStoreClient.java#L198-L231
wildfly/wildfly-core
host-controller/src/main/java/org/jboss/as/host/controller/RemoteDomainConnectionService.java
RemoteDomainConnectionService.logConnectionException
static void logConnectionException(URI uri, DiscoveryOption discoveryOption, boolean moreOptions, Exception e) { """ Handles logging tasks related to a failure to connect to a remote HC. @param uri the URI at which the connection attempt was made. Can be {@code null} indicating a failure to discover the HC @param discoveryOption the {@code DiscoveryOption} used to determine {@code uri} @param moreOptions {@code true} if there are more untried discovery options @param e the exception """ if (uri == null) { HostControllerLogger.ROOT_LOGGER.failedDiscoveringMaster(discoveryOption, e); } else { HostControllerLogger.ROOT_LOGGER.cannotConnect(uri, e); } if (!moreOptions) { // All discovery options have been exhausted HostControllerLogger.ROOT_LOGGER.noDiscoveryOptionsLeft(); } }
java
static void logConnectionException(URI uri, DiscoveryOption discoveryOption, boolean moreOptions, Exception e) { if (uri == null) { HostControllerLogger.ROOT_LOGGER.failedDiscoveringMaster(discoveryOption, e); } else { HostControllerLogger.ROOT_LOGGER.cannotConnect(uri, e); } if (!moreOptions) { // All discovery options have been exhausted HostControllerLogger.ROOT_LOGGER.noDiscoveryOptionsLeft(); } }
[ "static", "void", "logConnectionException", "(", "URI", "uri", ",", "DiscoveryOption", "discoveryOption", ",", "boolean", "moreOptions", ",", "Exception", "e", ")", "{", "if", "(", "uri", "==", "null", ")", "{", "HostControllerLogger", ".", "ROOT_LOGGER", ".", "failedDiscoveringMaster", "(", "discoveryOption", ",", "e", ")", ";", "}", "else", "{", "HostControllerLogger", ".", "ROOT_LOGGER", ".", "cannotConnect", "(", "uri", ",", "e", ")", ";", "}", "if", "(", "!", "moreOptions", ")", "{", "// All discovery options have been exhausted", "HostControllerLogger", ".", "ROOT_LOGGER", ".", "noDiscoveryOptionsLeft", "(", ")", ";", "}", "}" ]
Handles logging tasks related to a failure to connect to a remote HC. @param uri the URI at which the connection attempt was made. Can be {@code null} indicating a failure to discover the HC @param discoveryOption the {@code DiscoveryOption} used to determine {@code uri} @param moreOptions {@code true} if there are more untried discovery options @param e the exception
[ "Handles", "logging", "tasks", "related", "to", "a", "failure", "to", "connect", "to", "a", "remote", "HC", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/RemoteDomainConnectionService.java#L690-L700
sporniket/core
sporniket-core-ui/src/main/java/com/sporniket/libre/ui/swing/ComponentFactory.java
ComponentFactory.createFluidFlowPanel
public static FluidFlowPanelModel createFluidFlowPanel(int horizontalGap, int verticalGap) { """ Create a scrollable panel. @param horizontalGap the horizontal gap. @param verticalGap the vertical gap. @return a scrollable panel. @since 15.02.00 """ FlowLayout _flowLayout = new FlowLayout(FlowLayout.LEFT, horizontalGap, verticalGap); return FluidFlowPanelModel.createFluidFlowPanel(_flowLayout); }
java
public static FluidFlowPanelModel createFluidFlowPanel(int horizontalGap, int verticalGap) { FlowLayout _flowLayout = new FlowLayout(FlowLayout.LEFT, horizontalGap, verticalGap); return FluidFlowPanelModel.createFluidFlowPanel(_flowLayout); }
[ "public", "static", "FluidFlowPanelModel", "createFluidFlowPanel", "(", "int", "horizontalGap", ",", "int", "verticalGap", ")", "{", "FlowLayout", "_flowLayout", "=", "new", "FlowLayout", "(", "FlowLayout", ".", "LEFT", ",", "horizontalGap", ",", "verticalGap", ")", ";", "return", "FluidFlowPanelModel", ".", "createFluidFlowPanel", "(", "_flowLayout", ")", ";", "}" ]
Create a scrollable panel. @param horizontalGap the horizontal gap. @param verticalGap the vertical gap. @return a scrollable panel. @since 15.02.00
[ "Create", "a", "scrollable", "panel", "." ]
train
https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-ui/src/main/java/com/sporniket/libre/ui/swing/ComponentFactory.java#L62-L66
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/ErrorHandling.java
ErrorHandling.registerTagError
public void registerTagError(AbstractPageError error, JspTag tag) throws JspException { """ This method will add an error to the errors begin tracked by the tag. After the first time this method is called, <code>hasErrors</code> will return true. @param error The <code>EvalErrorInfo</code> describing the error. """ assert (error != null); // add the error to the list of errors if (_errors == null) _errors = new ArrayList(); _errors.add(error); IErrorReporter er = getErrorReporter(tag); if (er == null) { error.errorNo = -1; return; } // add the error to the ErrorReporter tag er.addError(error); assert (error.errorNo > 0); }
java
public void registerTagError(AbstractPageError error, JspTag tag) throws JspException { assert (error != null); // add the error to the list of errors if (_errors == null) _errors = new ArrayList(); _errors.add(error); IErrorReporter er = getErrorReporter(tag); if (er == null) { error.errorNo = -1; return; } // add the error to the ErrorReporter tag er.addError(error); assert (error.errorNo > 0); }
[ "public", "void", "registerTagError", "(", "AbstractPageError", "error", ",", "JspTag", "tag", ")", "throws", "JspException", "{", "assert", "(", "error", "!=", "null", ")", ";", "// add the error to the list of errors", "if", "(", "_errors", "==", "null", ")", "_errors", "=", "new", "ArrayList", "(", ")", ";", "_errors", ".", "add", "(", "error", ")", ";", "IErrorReporter", "er", "=", "getErrorReporter", "(", "tag", ")", ";", "if", "(", "er", "==", "null", ")", "{", "error", ".", "errorNo", "=", "-", "1", ";", "return", ";", "}", "// add the error to the ErrorReporter tag", "er", ".", "addError", "(", "error", ")", ";", "assert", "(", "error", ".", "errorNo", ">", "0", ")", ";", "}" ]
This method will add an error to the errors begin tracked by the tag. After the first time this method is called, <code>hasErrors</code> will return true. @param error The <code>EvalErrorInfo</code> describing the error.
[ "This", "method", "will", "add", "an", "error", "to", "the", "errors", "begin", "tracked", "by", "the", "tag", ".", "After", "the", "first", "time", "this", "method", "is", "called", "<code", ">", "hasErrors<", "/", "code", ">", "will", "return", "true", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/ErrorHandling.java#L105-L125
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java
ClassUseWriter.generate
public static void generate(ConfigurationImpl configuration, ClassTree classtree) throws DocFileIOException { """ Write out class use pages. @param configuration the configuration for this doclet @param classtree the class tree hierarchy @throws DocFileIOException if there is an error while generating the documentation """ ClassUseMapper mapper = new ClassUseMapper(configuration, classtree); for (TypeElement aClass : configuration.getIncludedTypeElements()) { // If -nodeprecated option is set and the containing package is marked // as deprecated, do not generate the class-use page. We will still generate // the class-use page if the class is marked as deprecated but the containing // package is not since it could still be linked from that package-use page. if (!(configuration.nodeprecated && configuration.utils.isDeprecated(configuration.utils.containingPackage(aClass)))) ClassUseWriter.generate(configuration, mapper, aClass); } for (PackageElement pkg : configuration.packages) { // If -nodeprecated option is set and the package is marked // as deprecated, do not generate the package-use page. if (!(configuration.nodeprecated && configuration.utils.isDeprecated(pkg))) PackageUseWriter.generate(configuration, mapper, pkg); } }
java
public static void generate(ConfigurationImpl configuration, ClassTree classtree) throws DocFileIOException { ClassUseMapper mapper = new ClassUseMapper(configuration, classtree); for (TypeElement aClass : configuration.getIncludedTypeElements()) { // If -nodeprecated option is set and the containing package is marked // as deprecated, do not generate the class-use page. We will still generate // the class-use page if the class is marked as deprecated but the containing // package is not since it could still be linked from that package-use page. if (!(configuration.nodeprecated && configuration.utils.isDeprecated(configuration.utils.containingPackage(aClass)))) ClassUseWriter.generate(configuration, mapper, aClass); } for (PackageElement pkg : configuration.packages) { // If -nodeprecated option is set and the package is marked // as deprecated, do not generate the package-use page. if (!(configuration.nodeprecated && configuration.utils.isDeprecated(pkg))) PackageUseWriter.generate(configuration, mapper, pkg); } }
[ "public", "static", "void", "generate", "(", "ConfigurationImpl", "configuration", ",", "ClassTree", "classtree", ")", "throws", "DocFileIOException", "{", "ClassUseMapper", "mapper", "=", "new", "ClassUseMapper", "(", "configuration", ",", "classtree", ")", ";", "for", "(", "TypeElement", "aClass", ":", "configuration", ".", "getIncludedTypeElements", "(", ")", ")", "{", "// If -nodeprecated option is set and the containing package is marked", "// as deprecated, do not generate the class-use page. We will still generate", "// the class-use page if the class is marked as deprecated but the containing", "// package is not since it could still be linked from that package-use page.", "if", "(", "!", "(", "configuration", ".", "nodeprecated", "&&", "configuration", ".", "utils", ".", "isDeprecated", "(", "configuration", ".", "utils", ".", "containingPackage", "(", "aClass", ")", ")", ")", ")", "ClassUseWriter", ".", "generate", "(", "configuration", ",", "mapper", ",", "aClass", ")", ";", "}", "for", "(", "PackageElement", "pkg", ":", "configuration", ".", "packages", ")", "{", "// If -nodeprecated option is set and the package is marked", "// as deprecated, do not generate the package-use page.", "if", "(", "!", "(", "configuration", ".", "nodeprecated", "&&", "configuration", ".", "utils", ".", "isDeprecated", "(", "pkg", ")", ")", ")", "PackageUseWriter", ".", "generate", "(", "configuration", ",", "mapper", ",", "pkg", ")", ";", "}", "}" ]
Write out class use pages. @param configuration the configuration for this doclet @param classtree the class tree hierarchy @throws DocFileIOException if there is an error while generating the documentation
[ "Write", "out", "class", "use", "pages", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java#L180-L197
aws/aws-sdk-java
aws-java-sdk-iot1clickprojects/src/main/java/com/amazonaws/services/iot1clickprojects/model/DeviceTemplate.java
DeviceTemplate.withCallbackOverrides
public DeviceTemplate withCallbackOverrides(java.util.Map<String, String> callbackOverrides) { """ <p> An optional Lambda function to invoke instead of the default Lambda function provided by the placement template. </p> @param callbackOverrides An optional Lambda function to invoke instead of the default Lambda function provided by the placement template. @return Returns a reference to this object so that method calls can be chained together. """ setCallbackOverrides(callbackOverrides); return this; }
java
public DeviceTemplate withCallbackOverrides(java.util.Map<String, String> callbackOverrides) { setCallbackOverrides(callbackOverrides); return this; }
[ "public", "DeviceTemplate", "withCallbackOverrides", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "callbackOverrides", ")", "{", "setCallbackOverrides", "(", "callbackOverrides", ")", ";", "return", "this", ";", "}" ]
<p> An optional Lambda function to invoke instead of the default Lambda function provided by the placement template. </p> @param callbackOverrides An optional Lambda function to invoke instead of the default Lambda function provided by the placement template. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "An", "optional", "Lambda", "function", "to", "invoke", "instead", "of", "the", "default", "Lambda", "function", "provided", "by", "the", "placement", "template", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iot1clickprojects/src/main/java/com/amazonaws/services/iot1clickprojects/model/DeviceTemplate.java#L122-L125
cojen/Cojen
src/main/java/org/cojen/classfile/ClassFile.java
ClassFile.addInnerClass
public ClassFile addInnerClass(String fullInnerClassName, String innerClassName) { """ Add an inner class to this class. By default, inner classes are private static. @param fullInnerClassName Optional full inner class name. @param innerClassName Optional short inner class name. """ return addInnerClass(fullInnerClassName, innerClassName, (String)null); }
java
public ClassFile addInnerClass(String fullInnerClassName, String innerClassName) { return addInnerClass(fullInnerClassName, innerClassName, (String)null); }
[ "public", "ClassFile", "addInnerClass", "(", "String", "fullInnerClassName", ",", "String", "innerClassName", ")", "{", "return", "addInnerClass", "(", "fullInnerClassName", ",", "innerClassName", ",", "(", "String", ")", "null", ")", ";", "}" ]
Add an inner class to this class. By default, inner classes are private static. @param fullInnerClassName Optional full inner class name. @param innerClassName Optional short inner class name.
[ "Add", "an", "inner", "class", "to", "this", "class", ".", "By", "default", "inner", "classes", "are", "private", "static", "." ]
train
https://github.com/cojen/Cojen/blob/ddee9a0fde83870b97e0ed04c58270aa665f3a62/src/main/java/org/cojen/classfile/ClassFile.java#L837-L839
tvesalainen/util
util/src/main/java/org/vesalainen/math/matrix/Matrix.java
Matrix.set
public void set(int i, int j, Matrix<T> B) { """ Assign matrix A items starting at i,j @param i @param j @param B """ int m = B.rows(); int n = B.columns(); for (int ii = 0; ii < m; ii++) { for (int jj = 0; jj < n; jj++) { set(i+ii, j+jj, B.get(ii, jj)); } } }
java
public void set(int i, int j, Matrix<T> B) { int m = B.rows(); int n = B.columns(); for (int ii = 0; ii < m; ii++) { for (int jj = 0; jj < n; jj++) { set(i+ii, j+jj, B.get(ii, jj)); } } }
[ "public", "void", "set", "(", "int", "i", ",", "int", "j", ",", "Matrix", "<", "T", ">", "B", ")", "{", "int", "m", "=", "B", ".", "rows", "(", ")", ";", "int", "n", "=", "B", ".", "columns", "(", ")", ";", "for", "(", "int", "ii", "=", "0", ";", "ii", "<", "m", ";", "ii", "++", ")", "{", "for", "(", "int", "jj", "=", "0", ";", "jj", "<", "n", ";", "jj", "++", ")", "{", "set", "(", "i", "+", "ii", ",", "j", "+", "jj", ",", "B", ".", "get", "(", "ii", ",", "jj", ")", ")", ";", "}", "}", "}" ]
Assign matrix A items starting at i,j @param i @param j @param B
[ "Assign", "matrix", "A", "items", "starting", "at", "i", "j" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/matrix/Matrix.java#L74-L85
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/FieldBuilder.java
FieldBuilder.buildTagInfo
public void buildTagInfo(XMLNode node, Content fieldDocTree) { """ Build the tag information. @param node the XML element that specifies which components to document @param fieldDocTree the content tree to which the documentation will be added """ writer.addTags((FieldDoc) fields.get(currentFieldIndex), fieldDocTree); }
java
public void buildTagInfo(XMLNode node, Content fieldDocTree) { writer.addTags((FieldDoc) fields.get(currentFieldIndex), fieldDocTree); }
[ "public", "void", "buildTagInfo", "(", "XMLNode", "node", ",", "Content", "fieldDocTree", ")", "{", "writer", ".", "addTags", "(", "(", "FieldDoc", ")", "fields", ".", "get", "(", "currentFieldIndex", ")", ",", "fieldDocTree", ")", ";", "}" ]
Build the tag information. @param node the XML element that specifies which components to document @param fieldDocTree the content tree to which the documentation will be added
[ "Build", "the", "tag", "information", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/FieldBuilder.java#L216-L218
RuedigerMoeller/kontraktor
examples/REST/src/main/java/examples/rest/RESTActor.java
RESTActor.putUser
@ContentType("application/json") public IPromise putUser(String name, @FromQuery("age") int age, JsonObject body, Map<String,Deque<String>> queryparms) { """ curl -i -X PUT --data "{ \"name\": \"satoshi\", \"nkey\": 13345 }" 'http://localhost:8080/api/user/nakamoto/?x=simple&something=pokpokpok&x=13&age=111' """ Log.Info(this,"name:"+name+" age:"+age); queryparms.forEach( (k,v) -> { Log.Info(this,""+k+"=>"); v.forEach( s -> { Log.Info(this," "+s); }); }); return resolve(body); }
java
@ContentType("application/json") public IPromise putUser(String name, @FromQuery("age") int age, JsonObject body, Map<String,Deque<String>> queryparms) { Log.Info(this,"name:"+name+" age:"+age); queryparms.forEach( (k,v) -> { Log.Info(this,""+k+"=>"); v.forEach( s -> { Log.Info(this," "+s); }); }); return resolve(body); }
[ "@", "ContentType", "(", "\"application/json\"", ")", "public", "IPromise", "putUser", "(", "String", "name", ",", "@", "FromQuery", "(", "\"age\"", ")", "int", "age", ",", "JsonObject", "body", ",", "Map", "<", "String", ",", "Deque", "<", "String", ">", ">", "queryparms", ")", "{", "Log", ".", "Info", "(", "this", ",", "\"name:\"", "+", "name", "+", "\" age:\"", "+", "age", ")", ";", "queryparms", ".", "forEach", "(", "(", "k", ",", "v", ")", "->", "{", "Log", ".", "Info", "(", "this", ",", "\"\"", "+", "k", "+", "\"=>\"", ")", ";", "v", ".", "forEach", "(", "s", "->", "{", "Log", ".", "Info", "(", "this", ",", "\" \"", "+", "s", ")", ";", "}", ")", ";", "}", ")", ";", "return", "resolve", "(", "body", ")", ";", "}" ]
curl -i -X PUT --data "{ \"name\": \"satoshi\", \"nkey\": 13345 }" 'http://localhost:8080/api/user/nakamoto/?x=simple&something=pokpokpok&x=13&age=111'
[ "curl", "-", "i", "-", "X", "PUT", "--", "data", "{", "\\", "name", "\\", ":", "\\", "satoshi", "\\", "\\", "nkey", "\\", ":", "13345", "}", "http", ":", "//", "localhost", ":", "8080", "/", "api", "/", "user", "/", "nakamoto", "/", "?x", "=", "simple&something", "=", "pokpokpok&x", "=", "13&age", "=", "111" ]
train
https://github.com/RuedigerMoeller/kontraktor/blob/d5f3817f9476f3786187b8ef00400b7a4f25a404/examples/REST/src/main/java/examples/rest/RESTActor.java#L47-L57
sporniket/core
sporniket-core-ml/src/main/java/com/sporniket/libre/lang/sgml/SgmlUtils.java
SgmlUtils.generateAttribute
public static String generateAttribute(String attributeName, String value) { """ Generate an attribute of the specified name and value. @param attributeName name of the attribute. @param value value of the attribute. @return the SGML code for an attribute. """ Object[] _args = { attributeName, SGML_VALUE_ENCODER.apply(value) }; return MESSAGE_FORMAT__ATTRIBUT.format(_args); }
java
public static String generateAttribute(String attributeName, String value) { Object[] _args = { attributeName, SGML_VALUE_ENCODER.apply(value) }; return MESSAGE_FORMAT__ATTRIBUT.format(_args); }
[ "public", "static", "String", "generateAttribute", "(", "String", "attributeName", ",", "String", "value", ")", "{", "Object", "[", "]", "_args", "=", "{", "attributeName", ",", "SGML_VALUE_ENCODER", ".", "apply", "(", "value", ")", "}", ";", "return", "MESSAGE_FORMAT__ATTRIBUT", ".", "format", "(", "_args", ")", ";", "}" ]
Generate an attribute of the specified name and value. @param attributeName name of the attribute. @param value value of the attribute. @return the SGML code for an attribute.
[ "Generate", "an", "attribute", "of", "the", "specified", "name", "and", "value", "." ]
train
https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-ml/src/main/java/com/sporniket/libre/lang/sgml/SgmlUtils.java#L77-L84
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.getTag
public GitlabTag getTag(GitlabProject project, String tagName) throws IOException { """ Get a single repository tag in a specific project @param project (required) The ID or URL-encoded path of the project @param tagName (required) The name of the tag @return the found git tag object @throws IOException on gitlab api call error """ String tailUrl = GitlabProject.URL + "/" + project.getId() + GitlabTag.URL + "/" + tagName; return retrieve().to(tailUrl, GitlabTag.class); }
java
public GitlabTag getTag(GitlabProject project, String tagName) throws IOException { String tailUrl = GitlabProject.URL + "/" + project.getId() + GitlabTag.URL + "/" + tagName; return retrieve().to(tailUrl, GitlabTag.class); }
[ "public", "GitlabTag", "getTag", "(", "GitlabProject", "project", ",", "String", "tagName", ")", "throws", "IOException", "{", "String", "tailUrl", "=", "GitlabProject", ".", "URL", "+", "\"/\"", "+", "project", ".", "getId", "(", ")", "+", "GitlabTag", ".", "URL", "+", "\"/\"", "+", "tagName", ";", "return", "retrieve", "(", ")", ".", "to", "(", "tailUrl", ",", "GitlabTag", ".", "class", ")", ";", "}" ]
Get a single repository tag in a specific project @param project (required) The ID or URL-encoded path of the project @param tagName (required) The name of the tag @return the found git tag object @throws IOException on gitlab api call error
[ "Get", "a", "single", "repository", "tag", "in", "a", "specific", "project" ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L3373-L3376
OpenLiberty/open-liberty
dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseStoreService.java
DatabaseStoreService.modified
protected void modified(ComponentContext context, Map<String, Object> properties) { """ Called by Declarative Services to modify service config properties @param context for this component instance """ if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "modified", "context=" + context); LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "modified", "properties=" + properties); } configurationProperties = properties; }
java
protected void modified(ComponentContext context, Map<String, Object> properties) { if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "modified", "context=" + context); LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "modified", "properties=" + properties); } configurationProperties = properties; }
[ "protected", "void", "modified", "(", "ComponentContext", "context", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "LoggingUtil", ".", "SESSION_LOGGER_WAS", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "{", "LoggingUtil", ".", "SESSION_LOGGER_WAS", ".", "logp", "(", "Level", ".", "FINE", ",", "methodClassName", ",", "\"modified\"", ",", "\"context=\"", "+", "context", ")", ";", "LoggingUtil", ".", "SESSION_LOGGER_WAS", ".", "logp", "(", "Level", ".", "FINE", ",", "methodClassName", ",", "\"modified\"", ",", "\"properties=\"", "+", "properties", ")", ";", "}", "configurationProperties", "=", "properties", ";", "}" ]
Called by Declarative Services to modify service config properties @param context for this component instance
[ "Called", "by", "Declarative", "Services", "to", "modify", "service", "config", "properties" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseStoreService.java#L191-L197
jhg023/SimpleNet
src/main/java/simplenet/Server.java
Server.writeToAllExcept
public final void writeToAllExcept(Packet packet, Collection<? extends Client> clients) { """ Queues a {@link Packet} to all connected {@link Client}s except the one(s) specified. <br><br> No {@link Client} will receive this {@link Packet} until {@link Client#flush()} is called for that respective {@link Client}. @param clients A {@link Collection} of {@link Client}s to exclude from receiving the {@link Packet}. """ writeHelper(packet::write, clients); }
java
public final void writeToAllExcept(Packet packet, Collection<? extends Client> clients) { writeHelper(packet::write, clients); }
[ "public", "final", "void", "writeToAllExcept", "(", "Packet", "packet", ",", "Collection", "<", "?", "extends", "Client", ">", "clients", ")", "{", "writeHelper", "(", "packet", "::", "write", ",", "clients", ")", ";", "}" ]
Queues a {@link Packet} to all connected {@link Client}s except the one(s) specified. <br><br> No {@link Client} will receive this {@link Packet} until {@link Client#flush()} is called for that respective {@link Client}. @param clients A {@link Collection} of {@link Client}s to exclude from receiving the {@link Packet}.
[ "Queues", "a", "{", "@link", "Packet", "}", "to", "all", "connected", "{", "@link", "Client", "}", "s", "except", "the", "one", "(", "s", ")", "specified", ".", "<br", ">", "<br", ">", "No", "{", "@link", "Client", "}", "will", "receive", "this", "{", "@link", "Packet", "}", "until", "{", "@link", "Client#flush", "()", "}", "is", "called", "for", "that", "respective", "{", "@link", "Client", "}", "." ]
train
https://github.com/jhg023/SimpleNet/blob/a5b55cbfe1768c6a28874f12adac3c748f2b509a/src/main/java/simplenet/Server.java#L252-L254
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Instance.java
Instance.setMachineType
public Operation setMachineType(MachineTypeId machineType, OperationOption... options) { """ Sets the machine type for this instance. The instance must be in {@link InstanceInfo.Status#TERMINATED} state to be able to set its machine type. @return a zone operation if the set request was issued correctly, {@code null} if the instance was not found @throws ComputeException upon failure """ return compute.setMachineType(getInstanceId(), machineType, options); }
java
public Operation setMachineType(MachineTypeId machineType, OperationOption... options) { return compute.setMachineType(getInstanceId(), machineType, options); }
[ "public", "Operation", "setMachineType", "(", "MachineTypeId", "machineType", ",", "OperationOption", "...", "options", ")", "{", "return", "compute", ".", "setMachineType", "(", "getInstanceId", "(", ")", ",", "machineType", ",", "options", ")", ";", "}" ]
Sets the machine type for this instance. The instance must be in {@link InstanceInfo.Status#TERMINATED} state to be able to set its machine type. @return a zone operation if the set request was issued correctly, {@code null} if the instance was not found @throws ComputeException upon failure
[ "Sets", "the", "machine", "type", "for", "this", "instance", ".", "The", "instance", "must", "be", "in", "{", "@link", "InstanceInfo", ".", "Status#TERMINATED", "}", "state", "to", "be", "able", "to", "set", "its", "machine", "type", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Instance.java#L348-L350
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/DirectoryHelper.java
DirectoryHelper.compressDirectory
public static void compressDirectory(File rootPath, File dstZipPath) throws IOException { """ Compress data. In case when <code>rootPath</code> is a directory this method compress all files and folders inside the directory into single one. IOException will be thrown if directory is empty. If the <code>rootPath</code> is the file the only this file will be compressed. @param rootPath the root path, can be the directory or the file @param dstZipPath the path to the destination compressed file @throws IOException if any exception occurred """ ZipOutputStream zip = new ZipOutputStream(new FileOutputStream(dstZipPath)); try { if (rootPath.isDirectory()) { String[] files = rootPath.list(); if (files == null || files.length == 0) { // In java 7 no ZipException is thrown in case of an empty directory // so to remain compatible we need to throw it explicitly throw new ZipException("ZIP file must have at least one entry"); } for (int i = 0; i < files.length; i++) { compressDirectory("", new File(rootPath, files[i]), zip); } } else { compressDirectory("", rootPath, zip); } } finally { if (zip != null) { zip.flush(); zip.close(); } } }
java
public static void compressDirectory(File rootPath, File dstZipPath) throws IOException { ZipOutputStream zip = new ZipOutputStream(new FileOutputStream(dstZipPath)); try { if (rootPath.isDirectory()) { String[] files = rootPath.list(); if (files == null || files.length == 0) { // In java 7 no ZipException is thrown in case of an empty directory // so to remain compatible we need to throw it explicitly throw new ZipException("ZIP file must have at least one entry"); } for (int i = 0; i < files.length; i++) { compressDirectory("", new File(rootPath, files[i]), zip); } } else { compressDirectory("", rootPath, zip); } } finally { if (zip != null) { zip.flush(); zip.close(); } } }
[ "public", "static", "void", "compressDirectory", "(", "File", "rootPath", ",", "File", "dstZipPath", ")", "throws", "IOException", "{", "ZipOutputStream", "zip", "=", "new", "ZipOutputStream", "(", "new", "FileOutputStream", "(", "dstZipPath", ")", ")", ";", "try", "{", "if", "(", "rootPath", ".", "isDirectory", "(", ")", ")", "{", "String", "[", "]", "files", "=", "rootPath", ".", "list", "(", ")", ";", "if", "(", "files", "==", "null", "||", "files", ".", "length", "==", "0", ")", "{", "// In java 7 no ZipException is thrown in case of an empty directory\r", "// so to remain compatible we need to throw it explicitly\r", "throw", "new", "ZipException", "(", "\"ZIP file must have at least one entry\"", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "files", ".", "length", ";", "i", "++", ")", "{", "compressDirectory", "(", "\"\"", ",", "new", "File", "(", "rootPath", ",", "files", "[", "i", "]", ")", ",", "zip", ")", ";", "}", "}", "else", "{", "compressDirectory", "(", "\"\"", ",", "rootPath", ",", "zip", ")", ";", "}", "}", "finally", "{", "if", "(", "zip", "!=", "null", ")", "{", "zip", ".", "flush", "(", ")", ";", "zip", ".", "close", "(", ")", ";", "}", "}", "}" ]
Compress data. In case when <code>rootPath</code> is a directory this method compress all files and folders inside the directory into single one. IOException will be thrown if directory is empty. If the <code>rootPath</code> is the file the only this file will be compressed. @param rootPath the root path, can be the directory or the file @param dstZipPath the path to the destination compressed file @throws IOException if any exception occurred
[ "Compress", "data", ".", "In", "case", "when", "<code", ">", "rootPath<", "/", "code", ">", "is", "a", "directory", "this", "method", "compress", "all", "files", "and", "folders", "inside", "the", "directory", "into", "single", "one", ".", "IOException", "will", "be", "thrown", "if", "directory", "is", "empty", ".", "If", "the", "<code", ">", "rootPath<", "/", "code", ">", "is", "the", "file", "the", "only", "this", "file", "will", "be", "compressed", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/DirectoryHelper.java#L183-L215
apache/groovy
src/main/java/org/codehaus/groovy/classgen/asm/BytecodeHelper.java
BytecodeHelper.getTypeDescription
private static String getTypeDescription(ClassNode c, boolean end) { """ array types are special: eg.: String[]: classname: [Ljava/lang/String; int[]: [I @return the ASM type description """ ClassNode d = c; if (ClassHelper.isPrimitiveType(d.redirect())) { d = d.redirect(); } String desc = TypeUtil.getDescriptionByType(d); if (!end && desc.endsWith(";")) { desc = desc.substring(0, desc.length() - 1); } return desc; }
java
private static String getTypeDescription(ClassNode c, boolean end) { ClassNode d = c; if (ClassHelper.isPrimitiveType(d.redirect())) { d = d.redirect(); } String desc = TypeUtil.getDescriptionByType(d); if (!end && desc.endsWith(";")) { desc = desc.substring(0, desc.length() - 1); } return desc; }
[ "private", "static", "String", "getTypeDescription", "(", "ClassNode", "c", ",", "boolean", "end", ")", "{", "ClassNode", "d", "=", "c", ";", "if", "(", "ClassHelper", ".", "isPrimitiveType", "(", "d", ".", "redirect", "(", ")", ")", ")", "{", "d", "=", "d", ".", "redirect", "(", ")", ";", "}", "String", "desc", "=", "TypeUtil", ".", "getDescriptionByType", "(", "d", ")", ";", "if", "(", "!", "end", "&&", "desc", ".", "endsWith", "(", "\";\"", ")", ")", "{", "desc", "=", "desc", ".", "substring", "(", "0", ",", "desc", ".", "length", "(", ")", "-", "1", ")", ";", "}", "return", "desc", ";", "}" ]
array types are special: eg.: String[]: classname: [Ljava/lang/String; int[]: [I @return the ASM type description
[ "array", "types", "are", "special", ":", "eg", ".", ":", "String", "[]", ":", "classname", ":", "[", "Ljava", "/", "lang", "/", "String", ";", "int", "[]", ":", "[", "I" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/classgen/asm/BytecodeHelper.java#L163-L176
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.writePropertyObjects
public void writePropertyObjects(String resourcename, List<CmsProperty> properties) throws CmsException { """ Writes a list of properties for a specified resource.<p> Code calling this method has to ensure that the no properties <code>a, b</code> are contained in the specified list so that <code>a.equals(b)</code>, otherwise an exception is thrown.<p> @param resourcename the name of resource with complete path @param properties the list of properties to write @throws CmsException if something goes wrong """ CmsResource resource = readResource(resourcename, CmsResourceFilter.IGNORE_EXPIRATION); getResourceType(resource).writePropertyObjects(this, m_securityManager, resource, properties); }
java
public void writePropertyObjects(String resourcename, List<CmsProperty> properties) throws CmsException { CmsResource resource = readResource(resourcename, CmsResourceFilter.IGNORE_EXPIRATION); getResourceType(resource).writePropertyObjects(this, m_securityManager, resource, properties); }
[ "public", "void", "writePropertyObjects", "(", "String", "resourcename", ",", "List", "<", "CmsProperty", ">", "properties", ")", "throws", "CmsException", "{", "CmsResource", "resource", "=", "readResource", "(", "resourcename", ",", "CmsResourceFilter", ".", "IGNORE_EXPIRATION", ")", ";", "getResourceType", "(", "resource", ")", ".", "writePropertyObjects", "(", "this", ",", "m_securityManager", ",", "resource", ",", "properties", ")", ";", "}" ]
Writes a list of properties for a specified resource.<p> Code calling this method has to ensure that the no properties <code>a, b</code> are contained in the specified list so that <code>a.equals(b)</code>, otherwise an exception is thrown.<p> @param resourcename the name of resource with complete path @param properties the list of properties to write @throws CmsException if something goes wrong
[ "Writes", "a", "list", "of", "properties", "for", "a", "specified", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L4103-L4107
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/resources/BaseFileResourceModelSource.java
BaseFileResourceModelSource.writeData
@Override public long writeData(final InputStream data) throws IOException, ResourceModelSourceException { """ Writes the data to a temp file, and attempts to parser it, then if successful it will call {@link #writeFileData(InputStream)} to invoke the sub class @param data data @return number of bytes written @throws IOException if an IO error occurs @throws ResourceModelSourceException if an error occurs parsing the data. """ if (!isDataWritable()) { throw new IllegalArgumentException("Cannot write to file, it is not configured to be writeable"); } ResourceFormatParser resourceFormat = getResourceFormatParser(); //validate data File temp = Files.createTempFile("temp", "." + resourceFormat.getPreferredFileExtension()).toFile(); temp.deleteOnExit(); try { try (FileOutputStream fos = new FileOutputStream(temp)) { Streams.copyStream(data, fos); } final ResourceFormatParser parser = getResourceFormatParser(); try { final INodeSet set = parser.parseDocument(temp); } catch (ResourceFormatParserException e) { throw new ResourceModelSourceException(e); } try (FileInputStream tempStream = new FileInputStream(temp)) { return writeFileData(tempStream); } } finally { temp.delete(); } }
java
@Override public long writeData(final InputStream data) throws IOException, ResourceModelSourceException { if (!isDataWritable()) { throw new IllegalArgumentException("Cannot write to file, it is not configured to be writeable"); } ResourceFormatParser resourceFormat = getResourceFormatParser(); //validate data File temp = Files.createTempFile("temp", "." + resourceFormat.getPreferredFileExtension()).toFile(); temp.deleteOnExit(); try { try (FileOutputStream fos = new FileOutputStream(temp)) { Streams.copyStream(data, fos); } final ResourceFormatParser parser = getResourceFormatParser(); try { final INodeSet set = parser.parseDocument(temp); } catch (ResourceFormatParserException e) { throw new ResourceModelSourceException(e); } try (FileInputStream tempStream = new FileInputStream(temp)) { return writeFileData(tempStream); } } finally { temp.delete(); } }
[ "@", "Override", "public", "long", "writeData", "(", "final", "InputStream", "data", ")", "throws", "IOException", ",", "ResourceModelSourceException", "{", "if", "(", "!", "isDataWritable", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Cannot write to file, it is not configured to be writeable\"", ")", ";", "}", "ResourceFormatParser", "resourceFormat", "=", "getResourceFormatParser", "(", ")", ";", "//validate data", "File", "temp", "=", "Files", ".", "createTempFile", "(", "\"temp\"", ",", "\".\"", "+", "resourceFormat", ".", "getPreferredFileExtension", "(", ")", ")", ".", "toFile", "(", ")", ";", "temp", ".", "deleteOnExit", "(", ")", ";", "try", "{", "try", "(", "FileOutputStream", "fos", "=", "new", "FileOutputStream", "(", "temp", ")", ")", "{", "Streams", ".", "copyStream", "(", "data", ",", "fos", ")", ";", "}", "final", "ResourceFormatParser", "parser", "=", "getResourceFormatParser", "(", ")", ";", "try", "{", "final", "INodeSet", "set", "=", "parser", ".", "parseDocument", "(", "temp", ")", ";", "}", "catch", "(", "ResourceFormatParserException", "e", ")", "{", "throw", "new", "ResourceModelSourceException", "(", "e", ")", ";", "}", "try", "(", "FileInputStream", "tempStream", "=", "new", "FileInputStream", "(", "temp", ")", ")", "{", "return", "writeFileData", "(", "tempStream", ")", ";", "}", "}", "finally", "{", "temp", ".", "delete", "(", ")", ";", "}", "}" ]
Writes the data to a temp file, and attempts to parser it, then if successful it will call {@link #writeFileData(InputStream)} to invoke the sub class @param data data @return number of bytes written @throws IOException if an IO error occurs @throws ResourceModelSourceException if an error occurs parsing the data.
[ "Writes", "the", "data", "to", "a", "temp", "file", "and", "attempts", "to", "parser", "it", "then", "if", "successful", "it", "will", "call", "{", "@link", "#writeFileData", "(", "InputStream", ")", "}", "to", "invoke", "the", "sub", "class" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/resources/BaseFileResourceModelSource.java#L136-L164
vdmeer/skb-java-base
src/main/java/de/vandermeer/skb/base/shell/Ci_ScRun.java
Ci_ScRun.getContent
protected String getContent(String fileName, MessageMgr mm) { """ Returns the content of a string read from a file. @param fileName name of file to read from @param mm the message manager to use for reporting errors, warnings, and infos @return null if no content could be found (error), content in string otherwise """ StringFileLoader sfl = new StringFileLoader(fileName); if(sfl.getLoadErrors().hasErrors()){ mm.report(sfl.getLoadErrors()); return null; } String content = sfl.load(); if(sfl.getLoadErrors().hasErrors()){ mm.report(sfl.getLoadErrors()); return null; } if(content==null){ mm.report(MessageMgr.createErrorMessage("run: unexpected problem with run script, content was null")); return null; } return content; }
java
protected String getContent(String fileName, MessageMgr mm){ StringFileLoader sfl = new StringFileLoader(fileName); if(sfl.getLoadErrors().hasErrors()){ mm.report(sfl.getLoadErrors()); return null; } String content = sfl.load(); if(sfl.getLoadErrors().hasErrors()){ mm.report(sfl.getLoadErrors()); return null; } if(content==null){ mm.report(MessageMgr.createErrorMessage("run: unexpected problem with run script, content was null")); return null; } return content; }
[ "protected", "String", "getContent", "(", "String", "fileName", ",", "MessageMgr", "mm", ")", "{", "StringFileLoader", "sfl", "=", "new", "StringFileLoader", "(", "fileName", ")", ";", "if", "(", "sfl", ".", "getLoadErrors", "(", ")", ".", "hasErrors", "(", ")", ")", "{", "mm", ".", "report", "(", "sfl", ".", "getLoadErrors", "(", ")", ")", ";", "return", "null", ";", "}", "String", "content", "=", "sfl", ".", "load", "(", ")", ";", "if", "(", "sfl", ".", "getLoadErrors", "(", ")", ".", "hasErrors", "(", ")", ")", "{", "mm", ".", "report", "(", "sfl", ".", "getLoadErrors", "(", ")", ")", ";", "return", "null", ";", "}", "if", "(", "content", "==", "null", ")", "{", "mm", ".", "report", "(", "MessageMgr", ".", "createErrorMessage", "(", "\"run: unexpected problem with run script, content was null\"", ")", ")", ";", "return", "null", ";", "}", "return", "content", ";", "}" ]
Returns the content of a string read from a file. @param fileName name of file to read from @param mm the message manager to use for reporting errors, warnings, and infos @return null if no content could be found (error), content in string otherwise
[ "Returns", "the", "content", "of", "a", "string", "read", "from", "a", "file", "." ]
train
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/shell/Ci_ScRun.java#L233-L250
DDTH/ddth-queue
ddth-queue-core/src/main/java/com/github/ddth/queue/impl/InmemQueue.java
InmemQueue.putToQueue
protected void putToQueue(IQueueMessage<ID, DATA> msg) throws QueueException.QueueIsFull { """ Puts a message to the queue buffer. @param msg @throws QueueException.QueueIsFull if the ring buffer is full """ if (!queue.offer(msg)) { throw new QueueException.QueueIsFull(getBoundary()); } }
java
protected void putToQueue(IQueueMessage<ID, DATA> msg) throws QueueException.QueueIsFull { if (!queue.offer(msg)) { throw new QueueException.QueueIsFull(getBoundary()); } }
[ "protected", "void", "putToQueue", "(", "IQueueMessage", "<", "ID", ",", "DATA", ">", "msg", ")", "throws", "QueueException", ".", "QueueIsFull", "{", "if", "(", "!", "queue", ".", "offer", "(", "msg", ")", ")", "{", "throw", "new", "QueueException", ".", "QueueIsFull", "(", "getBoundary", "(", ")", ")", ";", "}", "}" ]
Puts a message to the queue buffer. @param msg @throws QueueException.QueueIsFull if the ring buffer is full
[ "Puts", "a", "message", "to", "the", "queue", "buffer", "." ]
train
https://github.com/DDTH/ddth-queue/blob/b20776850d23111d3d71fc8ed6023c590bc3621f/ddth-queue-core/src/main/java/com/github/ddth/queue/impl/InmemQueue.java#L123-L127
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/VMCommandLine.java
VMCommandLine.launchVM
@Inline(value = "VMCommandLine.launchVMWithClassPath(($1), System.getProperty(\"java.class.path\"), ($2))", imported = { """ Run a new VM with the class path of the current VM. @param classToLaunch is the class to launch. @param additionalParams is the list of additional parameters @return the process that is running the new virtual machine, neither <code>null</code> @throws IOException when a IO error occurs. @since 6.2 """VMCommandLine.class}, statementExpression = true) public static Process launchVM(String classToLaunch, String... additionalParams) throws IOException { return launchVMWithClassPath( classToLaunch, System.getProperty("java.class.path"), //$NON-NLS-1$ additionalParams); }
java
@Inline(value = "VMCommandLine.launchVMWithClassPath(($1), System.getProperty(\"java.class.path\"), ($2))", imported = {VMCommandLine.class}, statementExpression = true) public static Process launchVM(String classToLaunch, String... additionalParams) throws IOException { return launchVMWithClassPath( classToLaunch, System.getProperty("java.class.path"), //$NON-NLS-1$ additionalParams); }
[ "@", "Inline", "(", "value", "=", "\"VMCommandLine.launchVMWithClassPath(($1), System.getProperty(\\\"java.class.path\\\"), ($2))\"", ",", "imported", "=", "{", "VMCommandLine", ".", "class", "}", ",", "statementExpression", "=", "true", ")", "public", "static", "Process", "launchVM", "(", "String", "classToLaunch", ",", "String", "...", "additionalParams", ")", "throws", "IOException", "{", "return", "launchVMWithClassPath", "(", "classToLaunch", ",", "System", ".", "getProperty", "(", "\"java.class.path\"", ")", ",", "//$NON-NLS-1$", "additionalParams", ")", ";", "}" ]
Run a new VM with the class path of the current VM. @param classToLaunch is the class to launch. @param additionalParams is the list of additional parameters @return the process that is running the new virtual machine, neither <code>null</code> @throws IOException when a IO error occurs. @since 6.2
[ "Run", "a", "new", "VM", "with", "the", "class", "path", "of", "the", "current", "VM", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/VMCommandLine.java#L294-L301
lagom/lagom
service/javadsl/api/src/main/java/com/lightbend/lagom/javadsl/api/Descriptor.java
Descriptor.replaceAllMessageSerializers
public Descriptor replaceAllMessageSerializers(PMap<Type, MessageSerializer<?, ?>> messageSerializers) { """ Replace all the message serializers registered with this descriptor with the the given message serializers. @param messageSerializers The message serializers to replace the existing ones with. @return A copy of this descriptor with the new message serializers. """ return new Descriptor(name, calls, pathParamSerializers, messageSerializers, serializerFactory, exceptionSerializer, autoAcl, acls, headerFilter, locatableService, circuitBreaker, topicCalls); }
java
public Descriptor replaceAllMessageSerializers(PMap<Type, MessageSerializer<?, ?>> messageSerializers) { return new Descriptor(name, calls, pathParamSerializers, messageSerializers, serializerFactory, exceptionSerializer, autoAcl, acls, headerFilter, locatableService, circuitBreaker, topicCalls); }
[ "public", "Descriptor", "replaceAllMessageSerializers", "(", "PMap", "<", "Type", ",", "MessageSerializer", "<", "?", ",", "?", ">", ">", "messageSerializers", ")", "{", "return", "new", "Descriptor", "(", "name", ",", "calls", ",", "pathParamSerializers", ",", "messageSerializers", ",", "serializerFactory", ",", "exceptionSerializer", ",", "autoAcl", ",", "acls", ",", "headerFilter", ",", "locatableService", ",", "circuitBreaker", ",", "topicCalls", ")", ";", "}" ]
Replace all the message serializers registered with this descriptor with the the given message serializers. @param messageSerializers The message serializers to replace the existing ones with. @return A copy of this descriptor with the new message serializers.
[ "Replace", "all", "the", "message", "serializers", "registered", "with", "this", "descriptor", "with", "the", "the", "given", "message", "serializers", "." ]
train
https://github.com/lagom/lagom/blob/3763055a9d1aace793a5d970f4e688aea61b1a5a/service/javadsl/api/src/main/java/com/lightbend/lagom/javadsl/api/Descriptor.java#L740-L742
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/atomic/AtomicLongFieldUpdater.java
AtomicLongFieldUpdater.getAndAdd
public long getAndAdd(T obj, long delta) { """ Atomically adds the given value to the current value of the field of the given object managed by this updater. @param obj An object whose field to get and set @param delta the value to add @return the previous value """ long prev, next; do { prev = get(obj); next = prev + delta; } while (!compareAndSet(obj, prev, next)); return prev; }
java
public long getAndAdd(T obj, long delta) { long prev, next; do { prev = get(obj); next = prev + delta; } while (!compareAndSet(obj, prev, next)); return prev; }
[ "public", "long", "getAndAdd", "(", "T", "obj", ",", "long", "delta", ")", "{", "long", "prev", ",", "next", ";", "do", "{", "prev", "=", "get", "(", "obj", ")", ";", "next", "=", "prev", "+", "delta", ";", "}", "while", "(", "!", "compareAndSet", "(", "obj", ",", "prev", ",", "next", ")", ")", ";", "return", "prev", ";", "}" ]
Atomically adds the given value to the current value of the field of the given object managed by this updater. @param obj An object whose field to get and set @param delta the value to add @return the previous value
[ "Atomically", "adds", "the", "given", "value", "to", "the", "current", "value", "of", "the", "field", "of", "the", "given", "object", "managed", "by", "this", "updater", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/atomic/AtomicLongFieldUpdater.java#L216-L223