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
js-lib-com/dom
src/main/java/js/dom/w3c/DocumentBuilderImpl.java
DocumentBuilderImpl.getDocumentBuilder
private static javax.xml.parsers.DocumentBuilder getDocumentBuilder(Schema schema, boolean useNamespace) throws ParserConfigurationException { """ Get XML document builder. @param schema XML schema, @param useNamespace flag to use name space. @return XML document builder. @throws ParserConfigurationException if document builder factory feature set fail. """ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setIgnoringComments(true); dbf.setIgnoringElementContentWhitespace(true); dbf.setCoalescing(true); if (schema != null) { // because schema is used throws fatal error if XML document contains DOCTYPE declaration dbf.setFeature(FEAT_DOCTYPE_DECL, true); // excerpt from document builder factory api: // Note that "the validation" here means a validating parser as defined in the XML recommendation. In other words, // it essentially just controls the DTD validation. // To use modern schema languages such as W3C XML Schema or RELAX NG instead of DTD, you can configure your parser // to be a non-validating parser by leaving the setValidating(boolean) method false, then use the setSchema(Schema) // method to associate a schema to a parser. dbf.setValidating(false); // XML schema validation requires namespace support dbf.setFeature(FEAT_SCHEMA_VALIDATION, true); dbf.setNamespaceAware(true); dbf.setSchema(schema); } else { // disable parser XML schema support; it is enabled by default dbf.setFeature(FEAT_SCHEMA_VALIDATION, false); dbf.setValidating(false); dbf.setNamespaceAware(useNamespace); } javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder(); db.setEntityResolver(new EntityResolverImpl()); db.setErrorHandler(new ErrorHandlerImpl()); return db; }
java
private static javax.xml.parsers.DocumentBuilder getDocumentBuilder(Schema schema, boolean useNamespace) throws ParserConfigurationException { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setIgnoringComments(true); dbf.setIgnoringElementContentWhitespace(true); dbf.setCoalescing(true); if (schema != null) { // because schema is used throws fatal error if XML document contains DOCTYPE declaration dbf.setFeature(FEAT_DOCTYPE_DECL, true); // excerpt from document builder factory api: // Note that "the validation" here means a validating parser as defined in the XML recommendation. In other words, // it essentially just controls the DTD validation. // To use modern schema languages such as W3C XML Schema or RELAX NG instead of DTD, you can configure your parser // to be a non-validating parser by leaving the setValidating(boolean) method false, then use the setSchema(Schema) // method to associate a schema to a parser. dbf.setValidating(false); // XML schema validation requires namespace support dbf.setFeature(FEAT_SCHEMA_VALIDATION, true); dbf.setNamespaceAware(true); dbf.setSchema(schema); } else { // disable parser XML schema support; it is enabled by default dbf.setFeature(FEAT_SCHEMA_VALIDATION, false); dbf.setValidating(false); dbf.setNamespaceAware(useNamespace); } javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder(); db.setEntityResolver(new EntityResolverImpl()); db.setErrorHandler(new ErrorHandlerImpl()); return db; }
[ "private", "static", "javax", ".", "xml", ".", "parsers", ".", "DocumentBuilder", "getDocumentBuilder", "(", "Schema", "schema", ",", "boolean", "useNamespace", ")", "throws", "ParserConfigurationException", "{", "DocumentBuilderFactory", "dbf", "=", "DocumentBuilderFactory", ".", "newInstance", "(", ")", ";", "dbf", ".", "setIgnoringComments", "(", "true", ")", ";", "dbf", ".", "setIgnoringElementContentWhitespace", "(", "true", ")", ";", "dbf", ".", "setCoalescing", "(", "true", ")", ";", "if", "(", "schema", "!=", "null", ")", "{", "// because schema is used throws fatal error if XML document contains DOCTYPE declaration\r", "dbf", ".", "setFeature", "(", "FEAT_DOCTYPE_DECL", ",", "true", ")", ";", "// excerpt from document builder factory api:\r", "// Note that \"the validation\" here means a validating parser as defined in the XML recommendation. In other words,\r", "// it essentially just controls the DTD validation.\r", "// To use modern schema languages such as W3C XML Schema or RELAX NG instead of DTD, you can configure your parser\r", "// to be a non-validating parser by leaving the setValidating(boolean) method false, then use the setSchema(Schema)\r", "// method to associate a schema to a parser.\r", "dbf", ".", "setValidating", "(", "false", ")", ";", "// XML schema validation requires namespace support\r", "dbf", ".", "setFeature", "(", "FEAT_SCHEMA_VALIDATION", ",", "true", ")", ";", "dbf", ".", "setNamespaceAware", "(", "true", ")", ";", "dbf", ".", "setSchema", "(", "schema", ")", ";", "}", "else", "{", "// disable parser XML schema support; it is enabled by default\r", "dbf", ".", "setFeature", "(", "FEAT_SCHEMA_VALIDATION", ",", "false", ")", ";", "dbf", ".", "setValidating", "(", "false", ")", ";", "dbf", ".", "setNamespaceAware", "(", "useNamespace", ")", ";", "}", "javax", ".", "xml", ".", "parsers", ".", "DocumentBuilder", "db", "=", "dbf", ".", "newDocumentBuilder", "(", ")", ";", "db", ".", "setEntityResolver", "(", "new", "EntityResolverImpl", "(", ")", ")", ";", "db", ".", "setErrorHandler", "(", "new", "ErrorHandlerImpl", "(", ")", ")", ";", "return", "db", ";", "}" ]
Get XML document builder. @param schema XML schema, @param useNamespace flag to use name space. @return XML document builder. @throws ParserConfigurationException if document builder factory feature set fail.
[ "Get", "XML", "document", "builder", "." ]
train
https://github.com/js-lib-com/dom/blob/8c7cd7c802977f210674dec7c2a8f61e8de05b63/src/main/java/js/dom/w3c/DocumentBuilderImpl.java#L453-L486
FXMisc/Flowless
src/main/java/org/fxmisc/flowless/CellListManager.java
CellListManager.cropTo
public void cropTo(int fromItem, int toItem) { """ Updates the list of cells to display @param fromItem the index of the first item to display @param toItem the index of the last item to display """ fromItem = Math.max(fromItem, 0); toItem = Math.min(toItem, cells.size()); cells.forget(0, fromItem); cells.forget(toItem, cells.size()); }
java
public void cropTo(int fromItem, int toItem) { fromItem = Math.max(fromItem, 0); toItem = Math.min(toItem, cells.size()); cells.forget(0, fromItem); cells.forget(toItem, cells.size()); }
[ "public", "void", "cropTo", "(", "int", "fromItem", ",", "int", "toItem", ")", "{", "fromItem", "=", "Math", ".", "max", "(", "fromItem", ",", "0", ")", ";", "toItem", "=", "Math", ".", "min", "(", "toItem", ",", "cells", ".", "size", "(", ")", ")", ";", "cells", ".", "forget", "(", "0", ",", "fromItem", ")", ";", "cells", ".", "forget", "(", "toItem", ",", "cells", ".", "size", "(", ")", ")", ";", "}" ]
Updates the list of cells to display @param fromItem the index of the first item to display @param toItem the index of the last item to display
[ "Updates", "the", "list", "of", "cells", "to", "display" ]
train
https://github.com/FXMisc/Flowless/blob/dce2269ebafed8f79203d00085af41f06f3083bc/src/main/java/org/fxmisc/flowless/CellListManager.java#L82-L87
ksclarke/freelib-utils
src/main/java/info/freelibrary/util/FileUtils.java
FileUtils.toHashMap
public static Map<String, List<String>> toHashMap(final String aFilePath) throws FileNotFoundException { """ Returns a Map representation of the supplied directory's structure. The map contains the file name as the key and its path as the value. If a file with a name occurs more than once, multiple path values are returned for that file name key. The map that is returned is unmodifiable. @param aFilePath The directory of which you'd like a file listing @return An unmodifiable map representing the files in the file structure @throws FileNotFoundException If the directory for the supplied file path does not exist """ return toHashMap(aFilePath, null, (String[]) null); }
java
public static Map<String, List<String>> toHashMap(final String aFilePath) throws FileNotFoundException { return toHashMap(aFilePath, null, (String[]) null); }
[ "public", "static", "Map", "<", "String", ",", "List", "<", "String", ">", ">", "toHashMap", "(", "final", "String", "aFilePath", ")", "throws", "FileNotFoundException", "{", "return", "toHashMap", "(", "aFilePath", ",", "null", ",", "(", "String", "[", "]", ")", "null", ")", ";", "}" ]
Returns a Map representation of the supplied directory's structure. The map contains the file name as the key and its path as the value. If a file with a name occurs more than once, multiple path values are returned for that file name key. The map that is returned is unmodifiable. @param aFilePath The directory of which you'd like a file listing @return An unmodifiable map representing the files in the file structure @throws FileNotFoundException If the directory for the supplied file path does not exist
[ "Returns", "a", "Map", "representation", "of", "the", "supplied", "directory", "s", "structure", ".", "The", "map", "contains", "the", "file", "name", "as", "the", "key", "and", "its", "path", "as", "the", "value", ".", "If", "a", "file", "with", "a", "name", "occurs", "more", "than", "once", "multiple", "path", "values", "are", "returned", "for", "that", "file", "name", "key", ".", "The", "map", "that", "is", "returned", "is", "unmodifiable", "." ]
train
https://github.com/ksclarke/freelib-utils/blob/54e822ae4c11b3d74793fd82a1a535ffafffaf45/src/main/java/info/freelibrary/util/FileUtils.java#L183-L185
line/armeria
grpc-protocol/src/main/java/com/linecorp/armeria/common/grpc/protocol/ArmeriaMessageFramer.java
ArmeriaMessageFramer.writePayload
public ByteBufHttpData writePayload(ByteBuf message) { """ Writes out a payload message. @param message the message to be written out. Ownership is taken by {@link ArmeriaMessageFramer}. @return a {@link ByteBufHttpData} with the framed payload. Ownership is passed to caller. """ verifyNotClosed(); final boolean compressed = messageCompression && compressor != null; final int messageLength = message.readableBytes(); try { final ByteBuf buf; if (messageLength != 0 && compressed) { buf = writeCompressed(message); } else { buf = writeUncompressed(message); } return new ByteBufHttpData(buf, false); } catch (IOException | RuntimeException e) { // IOException will not be thrown, since sink#deliverFrame doesn't throw. throw new ArmeriaStatusException( StatusCodes.INTERNAL, "Failed to frame message", e); } }
java
public ByteBufHttpData writePayload(ByteBuf message) { verifyNotClosed(); final boolean compressed = messageCompression && compressor != null; final int messageLength = message.readableBytes(); try { final ByteBuf buf; if (messageLength != 0 && compressed) { buf = writeCompressed(message); } else { buf = writeUncompressed(message); } return new ByteBufHttpData(buf, false); } catch (IOException | RuntimeException e) { // IOException will not be thrown, since sink#deliverFrame doesn't throw. throw new ArmeriaStatusException( StatusCodes.INTERNAL, "Failed to frame message", e); } }
[ "public", "ByteBufHttpData", "writePayload", "(", "ByteBuf", "message", ")", "{", "verifyNotClosed", "(", ")", ";", "final", "boolean", "compressed", "=", "messageCompression", "&&", "compressor", "!=", "null", ";", "final", "int", "messageLength", "=", "message", ".", "readableBytes", "(", ")", ";", "try", "{", "final", "ByteBuf", "buf", ";", "if", "(", "messageLength", "!=", "0", "&&", "compressed", ")", "{", "buf", "=", "writeCompressed", "(", "message", ")", ";", "}", "else", "{", "buf", "=", "writeUncompressed", "(", "message", ")", ";", "}", "return", "new", "ByteBufHttpData", "(", "buf", ",", "false", ")", ";", "}", "catch", "(", "IOException", "|", "RuntimeException", "e", ")", "{", "// IOException will not be thrown, since sink#deliverFrame doesn't throw.", "throw", "new", "ArmeriaStatusException", "(", "StatusCodes", ".", "INTERNAL", ",", "\"Failed to frame message\"", ",", "e", ")", ";", "}", "}" ]
Writes out a payload message. @param message the message to be written out. Ownership is taken by {@link ArmeriaMessageFramer}. @return a {@link ByteBufHttpData} with the framed payload. Ownership is passed to caller.
[ "Writes", "out", "a", "payload", "message", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/grpc-protocol/src/main/java/com/linecorp/armeria/common/grpc/protocol/ArmeriaMessageFramer.java#L105-L124
aerogear/aerogear-unifiedpush-server
jaxrs/src/main/java/org/jboss/aerogear/unifiedpush/rest/registry/installations/InstallationRegistrationEndpoint.java
InstallationRegistrationEndpoint.crossOriginForInstallations
@OPTIONS public Response crossOriginForInstallations(@Context HttpHeaders headers) { """ Cross Origin for Installations @param headers "Origin" header @return "Access-Control-Allow-Origin" header for your response @responseheader Access-Control-Allow-Origin With host in your "Origin" header @responseheader Access-Control-Allow-Methods POST, DELETE @responseheader Access-Control-Allow-Headers accept, origin, content-type, authorization @responseheader Access-Control-Allow-Credentials true @responseheader Access-Control-Max-Age 604800 @statuscode 200 Successful response for your request """ return appendPreflightResponseHeaders(headers, Response.ok()).build(); }
java
@OPTIONS public Response crossOriginForInstallations(@Context HttpHeaders headers) { return appendPreflightResponseHeaders(headers, Response.ok()).build(); }
[ "@", "OPTIONS", "public", "Response", "crossOriginForInstallations", "(", "@", "Context", "HttpHeaders", "headers", ")", "{", "return", "appendPreflightResponseHeaders", "(", "headers", ",", "Response", ".", "ok", "(", ")", ")", ".", "build", "(", ")", ";", "}" ]
Cross Origin for Installations @param headers "Origin" header @return "Access-Control-Allow-Origin" header for your response @responseheader Access-Control-Allow-Origin With host in your "Origin" header @responseheader Access-Control-Allow-Methods POST, DELETE @responseheader Access-Control-Allow-Headers accept, origin, content-type, authorization @responseheader Access-Control-Allow-Credentials true @responseheader Access-Control-Max-Age 604800 @statuscode 200 Successful response for your request
[ "Cross", "Origin", "for", "Installations" ]
train
https://github.com/aerogear/aerogear-unifiedpush-server/blob/c7b798f085449117d84345d8c378b27165cad32b/jaxrs/src/main/java/org/jboss/aerogear/unifiedpush/rest/registry/installations/InstallationRegistrationEndpoint.java#L105-L109
hazelcast/hazelcast
hazelcast-client/src/main/java/com/hazelcast/client/cache/impl/NearCachedClientCacheProxy.java
NearCachedClientCacheProxy.tryPublishReserved
private Object tryPublishReserved(Object key, Object remoteValue, long reservationId, boolean deserialize) { """ Publishes value got from remote or deletes reserved record when remote value is {@code null}. @param key key to update in Near Cache @param remoteValue fetched value from server @param reservationId reservation ID for this key @param deserialize deserialize returned value @return last known value for the key """ assert remoteValue != NOT_CACHED; // caching null value is not supported for ICache Near Cache if (remoteValue == null) { // needed to delete reserved record invalidateNearCache(key); return null; } Object cachedValue = null; if (reservationId != NOT_RESERVED) { cachedValue = nearCache.tryPublishReserved(key, remoteValue, reservationId, deserialize); } return cachedValue == null ? remoteValue : cachedValue; }
java
private Object tryPublishReserved(Object key, Object remoteValue, long reservationId, boolean deserialize) { assert remoteValue != NOT_CACHED; // caching null value is not supported for ICache Near Cache if (remoteValue == null) { // needed to delete reserved record invalidateNearCache(key); return null; } Object cachedValue = null; if (reservationId != NOT_RESERVED) { cachedValue = nearCache.tryPublishReserved(key, remoteValue, reservationId, deserialize); } return cachedValue == null ? remoteValue : cachedValue; }
[ "private", "Object", "tryPublishReserved", "(", "Object", "key", ",", "Object", "remoteValue", ",", "long", "reservationId", ",", "boolean", "deserialize", ")", "{", "assert", "remoteValue", "!=", "NOT_CACHED", ";", "// caching null value is not supported for ICache Near Cache", "if", "(", "remoteValue", "==", "null", ")", "{", "// needed to delete reserved record", "invalidateNearCache", "(", "key", ")", ";", "return", "null", ";", "}", "Object", "cachedValue", "=", "null", ";", "if", "(", "reservationId", "!=", "NOT_RESERVED", ")", "{", "cachedValue", "=", "nearCache", ".", "tryPublishReserved", "(", "key", ",", "remoteValue", ",", "reservationId", ",", "deserialize", ")", ";", "}", "return", "cachedValue", "==", "null", "?", "remoteValue", ":", "cachedValue", ";", "}" ]
Publishes value got from remote or deletes reserved record when remote value is {@code null}. @param key key to update in Near Cache @param remoteValue fetched value from server @param reservationId reservation ID for this key @param deserialize deserialize returned value @return last known value for the key
[ "Publishes", "value", "got", "from", "remote", "or", "deletes", "reserved", "record", "when", "remote", "value", "is", "{", "@code", "null", "}", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast-client/src/main/java/com/hazelcast/client/cache/impl/NearCachedClientCacheProxy.java#L539-L554
kite-sdk/kite
kite-data/kite-data-hbase/src/main/java/org/kitesdk/data/hbase/tool/SchemaTool.java
SchemaTool.getSchemaStringsFromJar
private List<String> getSchemaStringsFromJar(String jarPath, String directoryPath) { """ Gets the list of HBase Common Avro schema strings from a directory in the Jar. It recursively searches the directory in the jar to find files that end in .avsc to locate thos strings. @param jarPath The path to the jar to search @param directoryPath The directory in the jar to find avro schema strings @return The list of schema strings. """ LOG.info("Getting schema strings in: " + directoryPath + ", from jar: " + jarPath); JarFile jar; try { jar = new JarFile(URLDecoder.decode(jarPath, "UTF-8")); } catch (UnsupportedEncodingException e) { throw new DatasetException(e); } catch (IOException e) { throw new DatasetException(e); } Enumeration<JarEntry> entries = jar.entries(); List<String> schemaStrings = new ArrayList<String>(); while (entries.hasMoreElements()) { JarEntry jarEntry = entries.nextElement(); if (jarEntry.getName().startsWith(directoryPath) && jarEntry.getName().endsWith(".avsc")) { LOG.info("Found schema: " + jarEntry.getName()); InputStream inputStream; try { inputStream = jar.getInputStream(jarEntry); } catch (IOException e) { throw new DatasetException(e); } String schemaString = AvroUtils.inputStreamToString(inputStream); schemaStrings.add(schemaString); } } return schemaStrings; }
java
private List<String> getSchemaStringsFromJar(String jarPath, String directoryPath) { LOG.info("Getting schema strings in: " + directoryPath + ", from jar: " + jarPath); JarFile jar; try { jar = new JarFile(URLDecoder.decode(jarPath, "UTF-8")); } catch (UnsupportedEncodingException e) { throw new DatasetException(e); } catch (IOException e) { throw new DatasetException(e); } Enumeration<JarEntry> entries = jar.entries(); List<String> schemaStrings = new ArrayList<String>(); while (entries.hasMoreElements()) { JarEntry jarEntry = entries.nextElement(); if (jarEntry.getName().startsWith(directoryPath) && jarEntry.getName().endsWith(".avsc")) { LOG.info("Found schema: " + jarEntry.getName()); InputStream inputStream; try { inputStream = jar.getInputStream(jarEntry); } catch (IOException e) { throw new DatasetException(e); } String schemaString = AvroUtils.inputStreamToString(inputStream); schemaStrings.add(schemaString); } } return schemaStrings; }
[ "private", "List", "<", "String", ">", "getSchemaStringsFromJar", "(", "String", "jarPath", ",", "String", "directoryPath", ")", "{", "LOG", ".", "info", "(", "\"Getting schema strings in: \"", "+", "directoryPath", "+", "\", from jar: \"", "+", "jarPath", ")", ";", "JarFile", "jar", ";", "try", "{", "jar", "=", "new", "JarFile", "(", "URLDecoder", ".", "decode", "(", "jarPath", ",", "\"UTF-8\"", ")", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "throw", "new", "DatasetException", "(", "e", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "DatasetException", "(", "e", ")", ";", "}", "Enumeration", "<", "JarEntry", ">", "entries", "=", "jar", ".", "entries", "(", ")", ";", "List", "<", "String", ">", "schemaStrings", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "while", "(", "entries", ".", "hasMoreElements", "(", ")", ")", "{", "JarEntry", "jarEntry", "=", "entries", ".", "nextElement", "(", ")", ";", "if", "(", "jarEntry", ".", "getName", "(", ")", ".", "startsWith", "(", "directoryPath", ")", "&&", "jarEntry", ".", "getName", "(", ")", ".", "endsWith", "(", "\".avsc\"", ")", ")", "{", "LOG", ".", "info", "(", "\"Found schema: \"", "+", "jarEntry", ".", "getName", "(", ")", ")", ";", "InputStream", "inputStream", ";", "try", "{", "inputStream", "=", "jar", ".", "getInputStream", "(", "jarEntry", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "DatasetException", "(", "e", ")", ";", "}", "String", "schemaString", "=", "AvroUtils", ".", "inputStreamToString", "(", "inputStream", ")", ";", "schemaStrings", ".", "add", "(", "schemaString", ")", ";", "}", "}", "return", "schemaStrings", ";", "}" ]
Gets the list of HBase Common Avro schema strings from a directory in the Jar. It recursively searches the directory in the jar to find files that end in .avsc to locate thos strings. @param jarPath The path to the jar to search @param directoryPath The directory in the jar to find avro schema strings @return The list of schema strings.
[ "Gets", "the", "list", "of", "HBase", "Common", "Avro", "schema", "strings", "from", "a", "directory", "in", "the", "Jar", ".", "It", "recursively", "searches", "the", "directory", "in", "the", "jar", "to", "find", "files", "that", "end", "in", ".", "avsc", "to", "locate", "thos", "strings", "." ]
train
https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-hbase/src/main/java/org/kitesdk/data/hbase/tool/SchemaTool.java#L497-L527
nmdp-bioinformatics/ngs
range/src/main/java/org/nmdp/ngs/range/Ranges.java
Ranges.isLessThan
public static <C extends Comparable> boolean isLessThan(final Range<C> range, final C value) { """ Return true if the specified range is strictly less than the specified value. @param <C> range endpoint type @param range range, must not be null @param value value, must not be null @return true if the specified range is strictly less than the specified value """ checkNotNull(range); checkNotNull(value); if (!range.hasUpperBound()) { return false; } if (range.upperBoundType() == BoundType.OPEN && range.upperEndpoint().equals(value)) { return true; } return range.upperEndpoint().compareTo(value) < 0; }
java
public static <C extends Comparable> boolean isLessThan(final Range<C> range, final C value) { checkNotNull(range); checkNotNull(value); if (!range.hasUpperBound()) { return false; } if (range.upperBoundType() == BoundType.OPEN && range.upperEndpoint().equals(value)) { return true; } return range.upperEndpoint().compareTo(value) < 0; }
[ "public", "static", "<", "C", "extends", "Comparable", ">", "boolean", "isLessThan", "(", "final", "Range", "<", "C", ">", "range", ",", "final", "C", "value", ")", "{", "checkNotNull", "(", "range", ")", ";", "checkNotNull", "(", "value", ")", ";", "if", "(", "!", "range", ".", "hasUpperBound", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "range", ".", "upperBoundType", "(", ")", "==", "BoundType", ".", "OPEN", "&&", "range", ".", "upperEndpoint", "(", ")", ".", "equals", "(", "value", ")", ")", "{", "return", "true", ";", "}", "return", "range", ".", "upperEndpoint", "(", ")", ".", "compareTo", "(", "value", ")", "<", "0", ";", "}" ]
Return true if the specified range is strictly less than the specified value. @param <C> range endpoint type @param range range, must not be null @param value value, must not be null @return true if the specified range is strictly less than the specified value
[ "Return", "true", "if", "the", "specified", "range", "is", "strictly", "less", "than", "the", "specified", "value", "." ]
train
https://github.com/nmdp-bioinformatics/ngs/blob/277627e4311313a80f5dc110b3185b0d7af32bd0/range/src/main/java/org/nmdp/ngs/range/Ranges.java#L110-L121
kiswanij/jk-util
src/main/java/com/jk/util/JKObjectUtil.java
JKObjectUtil.setPeopertyValue
public static void setPeopertyValue(final Object target, final String fieldName, Object value) { """ Sets the peoperty value. @param target the source @param fieldName the field name @param value the value """ JK.logger.trace("setPeopertyValue On class({}) on field ({}) with value ({})", target, fieldName, value); try { if (value != null) { Field field = getFieldByName(target.getClass(), fieldName); if (field.getType().isEnum()) { Class<? extends Enum> clas = (Class) field.getType(); value = Enum.valueOf(clas, value.toString()); JK.logger.debug("Field is enum, new value is ({}) for class ({})", value, value.getClass()); } } PropertyUtils.setNestedProperty(target, fieldName, value); } catch (Exception e) { throw new RuntimeException(e); } }
java
public static void setPeopertyValue(final Object target, final String fieldName, Object value) { JK.logger.trace("setPeopertyValue On class({}) on field ({}) with value ({})", target, fieldName, value); try { if (value != null) { Field field = getFieldByName(target.getClass(), fieldName); if (field.getType().isEnum()) { Class<? extends Enum> clas = (Class) field.getType(); value = Enum.valueOf(clas, value.toString()); JK.logger.debug("Field is enum, new value is ({}) for class ({})", value, value.getClass()); } } PropertyUtils.setNestedProperty(target, fieldName, value); } catch (Exception e) { throw new RuntimeException(e); } }
[ "public", "static", "void", "setPeopertyValue", "(", "final", "Object", "target", ",", "final", "String", "fieldName", ",", "Object", "value", ")", "{", "JK", ".", "logger", ".", "trace", "(", "\"setPeopertyValue On class({}) on field ({}) with value ({})\"", ",", "target", ",", "fieldName", ",", "value", ")", ";", "try", "{", "if", "(", "value", "!=", "null", ")", "{", "Field", "field", "=", "getFieldByName", "(", "target", ".", "getClass", "(", ")", ",", "fieldName", ")", ";", "if", "(", "field", ".", "getType", "(", ")", ".", "isEnum", "(", ")", ")", "{", "Class", "<", "?", "extends", "Enum", ">", "clas", "=", "(", "Class", ")", "field", ".", "getType", "(", ")", ";", "value", "=", "Enum", ".", "valueOf", "(", "clas", ",", "value", ".", "toString", "(", ")", ")", ";", "JK", ".", "logger", ".", "debug", "(", "\"Field is enum, new value is ({}) for class ({})\"", ",", "value", ",", "value", ".", "getClass", "(", ")", ")", ";", "}", "}", "PropertyUtils", ".", "setNestedProperty", "(", "target", ",", "fieldName", ",", "value", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
Sets the peoperty value. @param target the source @param fieldName the field name @param value the value
[ "Sets", "the", "peoperty", "value", "." ]
train
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKObjectUtil.java#L259-L275
wellner/jcarafe
jcarafe-core/src/main/java/cern/colt/GenericSorting.java
GenericSorting.mergeSort
public static void mergeSort(int fromIndex, int toIndex, IntComparator c, Swapper swapper) { """ Sorts the specified range of elements according to the order induced by the specified comparator. All elements in the range must be <i>mutually comparable</i> by the specified comparator (that is, <tt>c.compare(a, b)</tt> must not throw an exception for any indexes <tt>a</tt> and <tt>b</tt> in the range).<p> This sort is guaranteed to be <i>stable</i>: equal elements will not be reordered as a result of the sort.<p> The sorting algorithm is a modified mergesort (in which the merge is omitted if the highest element in the low sublist is less than the lowest element in the high sublist). This algorithm offers guaranteed n*log(n) performance, and can approach linear performance on nearly sorted lists. @param fromIndex the index of the first element (inclusive) to be sorted. @param toIndex the index of the last element (exclusive) to be sorted. @param c the comparator to determine the order of the generic data. @param swapper an object that knows how to swap the elements at any two indexes (a,b). @see IntComparator @see Swapper """ /* We retain the same method signature as quickSort. Given only a comparator and swapper we do not know how to copy and move elements from/to temporary arrays. Hence, in contrast to the JDK mergesorts this is an "in-place" mergesort, i.e. does not allocate any temporary arrays. A non-inplace mergesort would perhaps be faster in most cases, but would require non-intuitive delegate objects... */ int length = toIndex - fromIndex; // Insertion sort on smallest arrays if (length < SMALL) { for (int i = fromIndex; i < toIndex; i++) { for (int j = i; j > fromIndex && (c.compare(j - 1, j) > 0); j--) { swapper.swap(j, j - 1); } } return; } // Recursively sort halves int mid = (fromIndex + toIndex) / 2; mergeSort(fromIndex, mid, c, swapper); mergeSort(mid, toIndex, c, swapper); // If list is already sorted, nothing left to do. This is an // optimization that results in faster sorts for nearly ordered lists. if (c.compare(mid - 1, mid) <= 0) return; // Merge sorted halves inplace_merge(fromIndex, mid, toIndex, c, swapper); }
java
public static void mergeSort(int fromIndex, int toIndex, IntComparator c, Swapper swapper) { /* We retain the same method signature as quickSort. Given only a comparator and swapper we do not know how to copy and move elements from/to temporary arrays. Hence, in contrast to the JDK mergesorts this is an "in-place" mergesort, i.e. does not allocate any temporary arrays. A non-inplace mergesort would perhaps be faster in most cases, but would require non-intuitive delegate objects... */ int length = toIndex - fromIndex; // Insertion sort on smallest arrays if (length < SMALL) { for (int i = fromIndex; i < toIndex; i++) { for (int j = i; j > fromIndex && (c.compare(j - 1, j) > 0); j--) { swapper.swap(j, j - 1); } } return; } // Recursively sort halves int mid = (fromIndex + toIndex) / 2; mergeSort(fromIndex, mid, c, swapper); mergeSort(mid, toIndex, c, swapper); // If list is already sorted, nothing left to do. This is an // optimization that results in faster sorts for nearly ordered lists. if (c.compare(mid - 1, mid) <= 0) return; // Merge sorted halves inplace_merge(fromIndex, mid, toIndex, c, swapper); }
[ "public", "static", "void", "mergeSort", "(", "int", "fromIndex", ",", "int", "toIndex", ",", "IntComparator", "c", ",", "Swapper", "swapper", ")", "{", "/*\r\n\t\tWe retain the same method signature as quickSort.\r\n\t\tGiven only a comparator and swapper we do not know how to copy and move elements from/to temporary arrays.\r\n\t\tHence, in contrast to the JDK mergesorts this is an \"in-place\" mergesort, i.e. does not allocate any temporary arrays.\r\n\t\tA non-inplace mergesort would perhaps be faster in most cases, but would require non-intuitive delegate objects...\r\n\t*/", "int", "length", "=", "toIndex", "-", "fromIndex", ";", "// Insertion sort on smallest arrays\r", "if", "(", "length", "<", "SMALL", ")", "{", "for", "(", "int", "i", "=", "fromIndex", ";", "i", "<", "toIndex", ";", "i", "++", ")", "{", "for", "(", "int", "j", "=", "i", ";", "j", ">", "fromIndex", "&&", "(", "c", ".", "compare", "(", "j", "-", "1", ",", "j", ")", ">", "0", ")", ";", "j", "--", ")", "{", "swapper", ".", "swap", "(", "j", ",", "j", "-", "1", ")", ";", "}", "}", "return", ";", "}", "// Recursively sort halves\r", "int", "mid", "=", "(", "fromIndex", "+", "toIndex", ")", "/", "2", ";", "mergeSort", "(", "fromIndex", ",", "mid", ",", "c", ",", "swapper", ")", ";", "mergeSort", "(", "mid", ",", "toIndex", ",", "c", ",", "swapper", ")", ";", "// If list is already sorted, nothing left to do. This is an\r", "// optimization that results in faster sorts for nearly ordered lists.\r", "if", "(", "c", ".", "compare", "(", "mid", "-", "1", ",", "mid", ")", "<=", "0", ")", "return", ";", "// Merge sorted halves \r", "inplace_merge", "(", "fromIndex", ",", "mid", ",", "toIndex", ",", "c", ",", "swapper", ")", ";", "}" ]
Sorts the specified range of elements according to the order induced by the specified comparator. All elements in the range must be <i>mutually comparable</i> by the specified comparator (that is, <tt>c.compare(a, b)</tt> must not throw an exception for any indexes <tt>a</tt> and <tt>b</tt> in the range).<p> This sort is guaranteed to be <i>stable</i>: equal elements will not be reordered as a result of the sort.<p> The sorting algorithm is a modified mergesort (in which the merge is omitted if the highest element in the low sublist is less than the lowest element in the high sublist). This algorithm offers guaranteed n*log(n) performance, and can approach linear performance on nearly sorted lists. @param fromIndex the index of the first element (inclusive) to be sorted. @param toIndex the index of the last element (exclusive) to be sorted. @param c the comparator to determine the order of the generic data. @param swapper an object that knows how to swap the elements at any two indexes (a,b). @see IntComparator @see Swapper
[ "Sorts", "the", "specified", "range", "of", "elements", "according", "to", "the", "order", "induced", "by", "the", "specified", "comparator", ".", "All", "elements", "in", "the", "range", "must", "be", "<i", ">", "mutually", "comparable<", "/", "i", ">", "by", "the", "specified", "comparator", "(", "that", "is", "<tt", ">", "c", ".", "compare", "(", "a", "b", ")", "<", "/", "tt", ">", "must", "not", "throw", "an", "exception", "for", "any", "indexes", "<tt", ">", "a<", "/", "tt", ">", "and", "<tt", ">", "b<", "/", "tt", ">", "in", "the", "range", ")", ".", "<p", ">" ]
train
https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/cern/colt/GenericSorting.java#L270-L300
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/action/ActionUtil.java
ActionUtil.addAction
public static ActionListener addAction(BaseComponent component, IAction action) { """ Adds/removes an action listener to/from a component using the default click trigger event. @param component Component to be associated with the action. @param action Action to invoke when listener event is triggered. If null, dissociates the event listener from the component. @return The newly created action listener. """ return addAction(component, action, ClickEvent.TYPE); }
java
public static ActionListener addAction(BaseComponent component, IAction action) { return addAction(component, action, ClickEvent.TYPE); }
[ "public", "static", "ActionListener", "addAction", "(", "BaseComponent", "component", ",", "IAction", "action", ")", "{", "return", "addAction", "(", "component", ",", "action", ",", "ClickEvent", ".", "TYPE", ")", ";", "}" ]
Adds/removes an action listener to/from a component using the default click trigger event. @param component Component to be associated with the action. @param action Action to invoke when listener event is triggered. If null, dissociates the event listener from the component. @return The newly created action listener.
[ "Adds", "/", "removes", "an", "action", "listener", "to", "/", "from", "a", "component", "using", "the", "default", "click", "trigger", "event", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/action/ActionUtil.java#L84-L86
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/config/xml/SchemaRepositoryParser.java
SchemaRepositoryParser.registerJsonSchemaRepository
private void registerJsonSchemaRepository(Element element, ParserContext parserContext) { """ Registers a JsonSchemaRepository definition in the parser context @param element The element to be converted into a JsonSchemaRepository definition @param parserContext The parser context to add the definitions to """ BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(JsonSchemaRepository.class); addLocationsToBuilder(element, builder); parseSchemasElement(element, builder, parserContext); parserContext.getRegistry().registerBeanDefinition(element.getAttribute(ID), builder.getBeanDefinition()); }
java
private void registerJsonSchemaRepository(Element element, ParserContext parserContext) { BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(JsonSchemaRepository.class); addLocationsToBuilder(element, builder); parseSchemasElement(element, builder, parserContext); parserContext.getRegistry().registerBeanDefinition(element.getAttribute(ID), builder.getBeanDefinition()); }
[ "private", "void", "registerJsonSchemaRepository", "(", "Element", "element", ",", "ParserContext", "parserContext", ")", "{", "BeanDefinitionBuilder", "builder", "=", "BeanDefinitionBuilder", ".", "genericBeanDefinition", "(", "JsonSchemaRepository", ".", "class", ")", ";", "addLocationsToBuilder", "(", "element", ",", "builder", ")", ";", "parseSchemasElement", "(", "element", ",", "builder", ",", "parserContext", ")", ";", "parserContext", ".", "getRegistry", "(", ")", ".", "registerBeanDefinition", "(", "element", ".", "getAttribute", "(", "ID", ")", ",", "builder", ".", "getBeanDefinition", "(", ")", ")", ";", "}" ]
Registers a JsonSchemaRepository definition in the parser context @param element The element to be converted into a JsonSchemaRepository definition @param parserContext The parser context to add the definitions to
[ "Registers", "a", "JsonSchemaRepository", "definition", "in", "the", "parser", "context" ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/xml/SchemaRepositoryParser.java#L69-L74
amaembo/streamex
src/main/java/one/util/streamex/MoreCollectors.java
MoreCollectors.maxAll
public static <T> Collector<T, ?, List<T>> maxAll(Comparator<? super T> comparator) { """ Returns a {@code Collector} which finds all the elements which are equal to each other and bigger than any other element according to the specified {@link Comparator}. The found elements are collected to {@link List}. @param <T> the type of the input elements @param comparator a {@code Comparator} to compare the elements @return a {@code Collector} which finds all the maximal elements and collects them to the {@code List}. @see #maxAll(Comparator, Collector) @see #maxAll() """ return maxAll(comparator, Collectors.toList()); }
java
public static <T> Collector<T, ?, List<T>> maxAll(Comparator<? super T> comparator) { return maxAll(comparator, Collectors.toList()); }
[ "public", "static", "<", "T", ">", "Collector", "<", "T", ",", "?", ",", "List", "<", "T", ">", ">", "maxAll", "(", "Comparator", "<", "?", "super", "T", ">", "comparator", ")", "{", "return", "maxAll", "(", "comparator", ",", "Collectors", ".", "toList", "(", ")", ")", ";", "}" ]
Returns a {@code Collector} which finds all the elements which are equal to each other and bigger than any other element according to the specified {@link Comparator}. The found elements are collected to {@link List}. @param <T> the type of the input elements @param comparator a {@code Comparator} to compare the elements @return a {@code Collector} which finds all the maximal elements and collects them to the {@code List}. @see #maxAll(Comparator, Collector) @see #maxAll()
[ "Returns", "a", "{", "@code", "Collector", "}", "which", "finds", "all", "the", "elements", "which", "are", "equal", "to", "each", "other", "and", "bigger", "than", "any", "other", "element", "according", "to", "the", "specified", "{", "@link", "Comparator", "}", ".", "The", "found", "elements", "are", "collected", "to", "{", "@link", "List", "}", "." ]
train
https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/MoreCollectors.java#L381-L383
groovyfx-project/groovyfx
src/main/groovy/groovyx/javafx/beans/FXBindableASTTransformation.java
FXBindableASTTransformation.visit
@Override public void visit(ASTNode[] nodes, SourceUnit sourceUnit) { """ This ASTTransformation method is called when the compiler encounters our annotation. @param nodes An array of nodes. Index 0 is the annotation that triggered the call, index 1 is the annotated node. @param sourceUnit The SourceUnit describing the source code in which the annotation was placed. """ if (!(nodes[0] instanceof AnnotationNode) || !(nodes[1] instanceof AnnotatedNode)) { throw new IllegalArgumentException("Internal error: wrong types: " + nodes[0].getClass().getName() + " / " + nodes[1].getClass().getName()); } AnnotationNode node = (AnnotationNode) nodes[0]; AnnotatedNode parent = (AnnotatedNode) nodes[1]; ClassNode declaringClass = parent.getDeclaringClass(); if (parent instanceof FieldNode) { int modifiers = ((FieldNode) parent).getModifiers(); if ((modifiers & Modifier.FINAL) != 0) { String msg = "@griffon.transform.FXBindable cannot annotate a final property."; generateSyntaxErrorMessage(sourceUnit, node, msg); } addJavaFXProperty(sourceUnit, node, declaringClass, (FieldNode) parent); } else { addJavaFXPropertyToClass(sourceUnit, node, (ClassNode) parent); } }
java
@Override public void visit(ASTNode[] nodes, SourceUnit sourceUnit) { if (!(nodes[0] instanceof AnnotationNode) || !(nodes[1] instanceof AnnotatedNode)) { throw new IllegalArgumentException("Internal error: wrong types: " + nodes[0].getClass().getName() + " / " + nodes[1].getClass().getName()); } AnnotationNode node = (AnnotationNode) nodes[0]; AnnotatedNode parent = (AnnotatedNode) nodes[1]; ClassNode declaringClass = parent.getDeclaringClass(); if (parent instanceof FieldNode) { int modifiers = ((FieldNode) parent).getModifiers(); if ((modifiers & Modifier.FINAL) != 0) { String msg = "@griffon.transform.FXBindable cannot annotate a final property."; generateSyntaxErrorMessage(sourceUnit, node, msg); } addJavaFXProperty(sourceUnit, node, declaringClass, (FieldNode) parent); } else { addJavaFXPropertyToClass(sourceUnit, node, (ClassNode) parent); } }
[ "@", "Override", "public", "void", "visit", "(", "ASTNode", "[", "]", "nodes", ",", "SourceUnit", "sourceUnit", ")", "{", "if", "(", "!", "(", "nodes", "[", "0", "]", "instanceof", "AnnotationNode", ")", "||", "!", "(", "nodes", "[", "1", "]", "instanceof", "AnnotatedNode", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Internal error: wrong types: \"", "+", "nodes", "[", "0", "]", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\" / \"", "+", "nodes", "[", "1", "]", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "}", "AnnotationNode", "node", "=", "(", "AnnotationNode", ")", "nodes", "[", "0", "]", ";", "AnnotatedNode", "parent", "=", "(", "AnnotatedNode", ")", "nodes", "[", "1", "]", ";", "ClassNode", "declaringClass", "=", "parent", ".", "getDeclaringClass", "(", ")", ";", "if", "(", "parent", "instanceof", "FieldNode", ")", "{", "int", "modifiers", "=", "(", "(", "FieldNode", ")", "parent", ")", ".", "getModifiers", "(", ")", ";", "if", "(", "(", "modifiers", "&", "Modifier", ".", "FINAL", ")", "!=", "0", ")", "{", "String", "msg", "=", "\"@griffon.transform.FXBindable cannot annotate a final property.\"", ";", "generateSyntaxErrorMessage", "(", "sourceUnit", ",", "node", ",", "msg", ")", ";", "}", "addJavaFXProperty", "(", "sourceUnit", ",", "node", ",", "declaringClass", ",", "(", "FieldNode", ")", "parent", ")", ";", "}", "else", "{", "addJavaFXPropertyToClass", "(", "sourceUnit", ",", "node", ",", "(", "ClassNode", ")", "parent", ")", ";", "}", "}" ]
This ASTTransformation method is called when the compiler encounters our annotation. @param nodes An array of nodes. Index 0 is the annotation that triggered the call, index 1 is the annotated node. @param sourceUnit The SourceUnit describing the source code in which the annotation was placed.
[ "This", "ASTTransformation", "method", "is", "called", "when", "the", "compiler", "encounters", "our", "annotation", "." ]
train
https://github.com/groovyfx-project/groovyfx/blob/7067d76793601ce4de9c642d4c0c0e11db7907cb/src/main/groovy/groovyx/javafx/beans/FXBindableASTTransformation.java#L178-L199
apache/spark
launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java
CommandBuilderUtils.mergeEnvPathList
static void mergeEnvPathList(Map<String, String> userEnv, String envKey, String pathList) { """ Updates the user environment, appending the given pathList to the existing value of the given environment variable (or setting it if it hasn't yet been set). """ if (!isEmpty(pathList)) { String current = firstNonEmpty(userEnv.get(envKey), System.getenv(envKey)); userEnv.put(envKey, join(File.pathSeparator, current, pathList)); } }
java
static void mergeEnvPathList(Map<String, String> userEnv, String envKey, String pathList) { if (!isEmpty(pathList)) { String current = firstNonEmpty(userEnv.get(envKey), System.getenv(envKey)); userEnv.put(envKey, join(File.pathSeparator, current, pathList)); } }
[ "static", "void", "mergeEnvPathList", "(", "Map", "<", "String", ",", "String", ">", "userEnv", ",", "String", "envKey", ",", "String", "pathList", ")", "{", "if", "(", "!", "isEmpty", "(", "pathList", ")", ")", "{", "String", "current", "=", "firstNonEmpty", "(", "userEnv", ".", "get", "(", "envKey", ")", ",", "System", ".", "getenv", "(", "envKey", ")", ")", ";", "userEnv", ".", "put", "(", "envKey", ",", "join", "(", "File", ".", "pathSeparator", ",", "current", ",", "pathList", ")", ")", ";", "}", "}" ]
Updates the user environment, appending the given pathList to the existing value of the given environment variable (or setting it if it hasn't yet been set).
[ "Updates", "the", "user", "environment", "appending", "the", "given", "pathList", "to", "the", "existing", "value", "of", "the", "given", "environment", "variable", "(", "or", "setting", "it", "if", "it", "hasn", "t", "yet", "been", "set", ")", "." ]
train
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java#L114-L119
mlhartme/jasmin
src/main/java/net/oneandone/jasmin/model/Engine.java
Engine.request
public int request(String path, HttpServletResponse response, boolean gzip) throws IOException { """ Output is prepared in-memory before the response is written because a) that's the common case where output is cached. If output is to big for this, that whole caching doesn't work b) I send sent proper error pages c) I can return the number of bytes actually written @return bytes written or -1 if building the module content failed. """ Content content; byte[] bytes; try { content = doRequest(path); } catch (IOException e) { Servlet.LOG.error("request failed: " + e.getMessage(), e); response.setStatus(500); response.setContentType("text/html"); try (Writer writer = response.getWriter()) { writer.write("<html><body><h1>" + e.getMessage() + "</h1>"); writer.write("<details><br/>"); printException(e, writer); writer.write("</body></html>"); } return -1; } if (gzip) { // see http://cs193h.stevesouders.com and "High Performance Websites", by Steve Souders response.setHeader("Content-Encoding", "gzip"); bytes = content.bytes; } else { bytes = unzip(content.bytes); } response.addHeader("Vary", "Accept-Encoding"); response.setBufferSize(0); response.setContentType(content.mimeType); response.setCharacterEncoding(ENCODING); // TODO: inspect header - does this have an effect? if (content.lastModified != -1) { response.setDateHeader("Last-Modified", content.lastModified); } response.getOutputStream().write(bytes); return bytes.length; }
java
public int request(String path, HttpServletResponse response, boolean gzip) throws IOException { Content content; byte[] bytes; try { content = doRequest(path); } catch (IOException e) { Servlet.LOG.error("request failed: " + e.getMessage(), e); response.setStatus(500); response.setContentType("text/html"); try (Writer writer = response.getWriter()) { writer.write("<html><body><h1>" + e.getMessage() + "</h1>"); writer.write("<details><br/>"); printException(e, writer); writer.write("</body></html>"); } return -1; } if (gzip) { // see http://cs193h.stevesouders.com and "High Performance Websites", by Steve Souders response.setHeader("Content-Encoding", "gzip"); bytes = content.bytes; } else { bytes = unzip(content.bytes); } response.addHeader("Vary", "Accept-Encoding"); response.setBufferSize(0); response.setContentType(content.mimeType); response.setCharacterEncoding(ENCODING); // TODO: inspect header - does this have an effect? if (content.lastModified != -1) { response.setDateHeader("Last-Modified", content.lastModified); } response.getOutputStream().write(bytes); return bytes.length; }
[ "public", "int", "request", "(", "String", "path", ",", "HttpServletResponse", "response", ",", "boolean", "gzip", ")", "throws", "IOException", "{", "Content", "content", ";", "byte", "[", "]", "bytes", ";", "try", "{", "content", "=", "doRequest", "(", "path", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "Servlet", ".", "LOG", ".", "error", "(", "\"request failed: \"", "+", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "response", ".", "setStatus", "(", "500", ")", ";", "response", ".", "setContentType", "(", "\"text/html\"", ")", ";", "try", "(", "Writer", "writer", "=", "response", ".", "getWriter", "(", ")", ")", "{", "writer", ".", "write", "(", "\"<html><body><h1>\"", "+", "e", ".", "getMessage", "(", ")", "+", "\"</h1>\"", ")", ";", "writer", ".", "write", "(", "\"<details><br/>\"", ")", ";", "printException", "(", "e", ",", "writer", ")", ";", "writer", ".", "write", "(", "\"</body></html>\"", ")", ";", "}", "return", "-", "1", ";", "}", "if", "(", "gzip", ")", "{", "// see http://cs193h.stevesouders.com and \"High Performance Websites\", by Steve Souders", "response", ".", "setHeader", "(", "\"Content-Encoding\"", ",", "\"gzip\"", ")", ";", "bytes", "=", "content", ".", "bytes", ";", "}", "else", "{", "bytes", "=", "unzip", "(", "content", ".", "bytes", ")", ";", "}", "response", ".", "addHeader", "(", "\"Vary\"", ",", "\"Accept-Encoding\"", ")", ";", "response", ".", "setBufferSize", "(", "0", ")", ";", "response", ".", "setContentType", "(", "content", ".", "mimeType", ")", ";", "response", ".", "setCharacterEncoding", "(", "ENCODING", ")", ";", "// TODO: inspect header - does this have an effect?", "if", "(", "content", ".", "lastModified", "!=", "-", "1", ")", "{", "response", ".", "setDateHeader", "(", "\"Last-Modified\"", ",", "content", ".", "lastModified", ")", ";", "}", "response", ".", "getOutputStream", "(", ")", ".", "write", "(", "bytes", ")", ";", "return", "bytes", ".", "length", ";", "}" ]
Output is prepared in-memory before the response is written because a) that's the common case where output is cached. If output is to big for this, that whole caching doesn't work b) I send sent proper error pages c) I can return the number of bytes actually written @return bytes written or -1 if building the module content failed.
[ "Output", "is", "prepared", "in", "-", "memory", "before", "the", "response", "is", "written", "because", "a", ")", "that", "s", "the", "common", "case", "where", "output", "is", "cached", ".", "If", "output", "is", "to", "big", "for", "this", "that", "whole", "caching", "doesn", "t", "work", "b", ")", "I", "send", "sent", "proper", "error", "pages", "c", ")", "I", "can", "return", "the", "number", "of", "bytes", "actually", "written" ]
train
https://github.com/mlhartme/jasmin/blob/1c44339a2555ae7ffb7d40fd3a7d80d81c3fc39d/src/main/java/net/oneandone/jasmin/model/Engine.java#L88-L122
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/CertificateOperations.java
CertificateOperations.cancelDeleteCertificate
public void cancelDeleteCertificate(String thumbprintAlgorithm, String thumbprint) throws BatchErrorException, IOException { """ Cancels a failed deletion of the specified certificate. This operation can be performed only when the certificate is in the {@link com.microsoft.azure.batch.protocol.models.CertificateState#DELETE_FAILED Delete Failed} state, and restores the certificate to the {@link com.microsoft.azure.batch.protocol.models.CertificateState#ACTIVE Active} state. @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. @param thumbprint The thumbprint of the certificate that failed to delete. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. """ cancelDeleteCertificate(thumbprintAlgorithm, thumbprint, null); }
java
public void cancelDeleteCertificate(String thumbprintAlgorithm, String thumbprint) throws BatchErrorException, IOException { cancelDeleteCertificate(thumbprintAlgorithm, thumbprint, null); }
[ "public", "void", "cancelDeleteCertificate", "(", "String", "thumbprintAlgorithm", ",", "String", "thumbprint", ")", "throws", "BatchErrorException", ",", "IOException", "{", "cancelDeleteCertificate", "(", "thumbprintAlgorithm", ",", "thumbprint", ",", "null", ")", ";", "}" ]
Cancels a failed deletion of the specified certificate. This operation can be performed only when the certificate is in the {@link com.microsoft.azure.batch.protocol.models.CertificateState#DELETE_FAILED Delete Failed} state, and restores the certificate to the {@link com.microsoft.azure.batch.protocol.models.CertificateState#ACTIVE Active} state. @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. @param thumbprint The thumbprint of the certificate that failed to delete. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Cancels", "a", "failed", "deletion", "of", "the", "specified", "certificate", ".", "This", "operation", "can", "be", "performed", "only", "when", "the", "certificate", "is", "in", "the", "{", "@link", "com", ".", "microsoft", ".", "azure", ".", "batch", ".", "protocol", ".", "models", ".", "CertificateState#DELETE_FAILED", "Delete", "Failed", "}", "state", "and", "restores", "the", "certificate", "to", "the", "{", "@link", "com", ".", "microsoft", ".", "azure", ".", "batch", ".", "protocol", ".", "models", ".", "CertificateState#ACTIVE", "Active", "}", "state", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/CertificateOperations.java#L165-L167
comapi/comapi-sdk-android
COMAPI/foundation/src/main/java/com/comapi/internal/helpers/DateHelper.java
DateHelper.getUTC
public static String getUTC(long time) { """ Gets the UTC date and time in 'yyyy-MM-dd'T'HH:mm:ss.SSS'Z'' format. @return UTC date and time. """ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.ENGLISH); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); return sdf.format(time); }
java
public static String getUTC(long time) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.ENGLISH); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); return sdf.format(time); }
[ "public", "static", "String", "getUTC", "(", "long", "time", ")", "{", "SimpleDateFormat", "sdf", "=", "new", "SimpleDateFormat", "(", "\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\"", ",", "Locale", ".", "ENGLISH", ")", ";", "sdf", ".", "setTimeZone", "(", "TimeZone", ".", "getTimeZone", "(", "\"UTC\"", ")", ")", ";", "return", "sdf", ".", "format", "(", "time", ")", ";", "}" ]
Gets the UTC date and time in 'yyyy-MM-dd'T'HH:mm:ss.SSS'Z'' format. @return UTC date and time.
[ "Gets", "the", "UTC", "date", "and", "time", "in", "yyyy", "-", "MM", "-", "dd", "T", "HH", ":", "mm", ":", "ss", ".", "SSS", "Z", "format", "." ]
train
https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/helpers/DateHelper.java#L85-L89
phax/ph-pdf-layout
src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java
PDPageContentStreamExt.curveTo2
public void curveTo2 (final float x2, final float y2, final float x3, final float y3) throws IOException { """ Append a cubic Bézier curve to the current path. The curve extends from the current point to the point (x3, y3), using the current point and (x2, y2) as the Bézier control points. @param x2 x coordinate of the point 2 @param y2 y coordinate of the point 2 @param x3 x coordinate of the point 3 @param y3 y coordinate of the point 3 @throws IllegalStateException If the method was called within a text block. @throws IOException If the content stream could not be written. """ if (inTextMode) { throw new IllegalStateException ("Error: curveTo2 is not allowed within a text block."); } writeOperand (x2); writeOperand (y2); writeOperand (x3); writeOperand (y3); writeOperator ((byte) 'v'); }
java
public void curveTo2 (final float x2, final float y2, final float x3, final float y3) throws IOException { if (inTextMode) { throw new IllegalStateException ("Error: curveTo2 is not allowed within a text block."); } writeOperand (x2); writeOperand (y2); writeOperand (x3); writeOperand (y3); writeOperator ((byte) 'v'); }
[ "public", "void", "curveTo2", "(", "final", "float", "x2", ",", "final", "float", "y2", ",", "final", "float", "x3", ",", "final", "float", "y3", ")", "throws", "IOException", "{", "if", "(", "inTextMode", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Error: curveTo2 is not allowed within a text block.\"", ")", ";", "}", "writeOperand", "(", "x2", ")", ";", "writeOperand", "(", "y2", ")", ";", "writeOperand", "(", "x3", ")", ";", "writeOperand", "(", "y3", ")", ";", "writeOperator", "(", "(", "byte", ")", "'", "'", ")", ";", "}" ]
Append a cubic Bézier curve to the current path. The curve extends from the current point to the point (x3, y3), using the current point and (x2, y2) as the Bézier control points. @param x2 x coordinate of the point 2 @param y2 y coordinate of the point 2 @param x3 x coordinate of the point 3 @param y3 y coordinate of the point 3 @throws IllegalStateException If the method was called within a text block. @throws IOException If the content stream could not be written.
[ "Append", "a", "cubic", "Bézier", "curve", "to", "the", "current", "path", ".", "The", "curve", "extends", "from", "the", "current", "point", "to", "the", "point", "(", "x3", "y3", ")", "using", "the", "current", "point", "and", "(", "x2", "y2", ")", "as", "the", "Bézier", "control", "points", "." ]
train
https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L1166-L1177
bazaarvoice/emodb
table/src/main/java/com/bazaarvoice/emodb/table/db/astyanax/TableJson.java
TableJson.newMoveRestart
Delta newMoveRestart(Storage src, Storage dest) { """ Start a move to an existing mirror that may or may not have once been primary. """ // If the destination used to be the initial primary for the group, it's consistent and ready to promote // but lacking the MIRROR_CONSISTENT marker attribute which is the prereq for promotion. Add one. Delta consistentMarker = dest.isConsistent() ? Deltas.conditional(Conditions.isUndefined(), Deltas.literal(now())) : Deltas.noop(); return Deltas.mapBuilder() .update(STORAGE.key(), Deltas.mapBuilder() .update(src.getUuidString(), Deltas.mapBuilder() .put(Storage.MOVE_TO.key(), dest.getUuidString()) .build()) .update(dest.getUuidString(), Deltas.mapBuilder() // Clean slate: clear 'moveTo' plus all markers for promotion states and later. .update(StorageState.MIRROR_CONSISTENT.getMarkerAttribute().key(), consistentMarker) .remove(Storage.MOVE_TO.key()) .remove(Storage.PROMOTION_ID.key()) .remove(StorageState.PRIMARY.getMarkerAttribute().key()) .remove(StorageState.MIRROR_EXPIRING.getMarkerAttribute().key()) .remove(StorageState.MIRROR_EXPIRED.getMarkerAttribute().key()) .build()) .build()) .build(); }
java
Delta newMoveRestart(Storage src, Storage dest) { // If the destination used to be the initial primary for the group, it's consistent and ready to promote // but lacking the MIRROR_CONSISTENT marker attribute which is the prereq for promotion. Add one. Delta consistentMarker = dest.isConsistent() ? Deltas.conditional(Conditions.isUndefined(), Deltas.literal(now())) : Deltas.noop(); return Deltas.mapBuilder() .update(STORAGE.key(), Deltas.mapBuilder() .update(src.getUuidString(), Deltas.mapBuilder() .put(Storage.MOVE_TO.key(), dest.getUuidString()) .build()) .update(dest.getUuidString(), Deltas.mapBuilder() // Clean slate: clear 'moveTo' plus all markers for promotion states and later. .update(StorageState.MIRROR_CONSISTENT.getMarkerAttribute().key(), consistentMarker) .remove(Storage.MOVE_TO.key()) .remove(Storage.PROMOTION_ID.key()) .remove(StorageState.PRIMARY.getMarkerAttribute().key()) .remove(StorageState.MIRROR_EXPIRING.getMarkerAttribute().key()) .remove(StorageState.MIRROR_EXPIRED.getMarkerAttribute().key()) .build()) .build()) .build(); }
[ "Delta", "newMoveRestart", "(", "Storage", "src", ",", "Storage", "dest", ")", "{", "// If the destination used to be the initial primary for the group, it's consistent and ready to promote", "// but lacking the MIRROR_CONSISTENT marker attribute which is the prereq for promotion. Add one.", "Delta", "consistentMarker", "=", "dest", ".", "isConsistent", "(", ")", "?", "Deltas", ".", "conditional", "(", "Conditions", ".", "isUndefined", "(", ")", ",", "Deltas", ".", "literal", "(", "now", "(", ")", ")", ")", ":", "Deltas", ".", "noop", "(", ")", ";", "return", "Deltas", ".", "mapBuilder", "(", ")", ".", "update", "(", "STORAGE", ".", "key", "(", ")", ",", "Deltas", ".", "mapBuilder", "(", ")", ".", "update", "(", "src", ".", "getUuidString", "(", ")", ",", "Deltas", ".", "mapBuilder", "(", ")", ".", "put", "(", "Storage", ".", "MOVE_TO", ".", "key", "(", ")", ",", "dest", ".", "getUuidString", "(", ")", ")", ".", "build", "(", ")", ")", ".", "update", "(", "dest", ".", "getUuidString", "(", ")", ",", "Deltas", ".", "mapBuilder", "(", ")", "// Clean slate: clear 'moveTo' plus all markers for promotion states and later.", ".", "update", "(", "StorageState", ".", "MIRROR_CONSISTENT", ".", "getMarkerAttribute", "(", ")", ".", "key", "(", ")", ",", "consistentMarker", ")", ".", "remove", "(", "Storage", ".", "MOVE_TO", ".", "key", "(", ")", ")", ".", "remove", "(", "Storage", ".", "PROMOTION_ID", ".", "key", "(", ")", ")", ".", "remove", "(", "StorageState", ".", "PRIMARY", ".", "getMarkerAttribute", "(", ")", ".", "key", "(", ")", ")", ".", "remove", "(", "StorageState", ".", "MIRROR_EXPIRING", ".", "getMarkerAttribute", "(", ")", ".", "key", "(", ")", ")", ".", "remove", "(", "StorageState", ".", "MIRROR_EXPIRED", ".", "getMarkerAttribute", "(", ")", ".", "key", "(", ")", ")", ".", "build", "(", ")", ")", ".", "build", "(", ")", ")", ".", "build", "(", ")", ";", "}" ]
Start a move to an existing mirror that may or may not have once been primary.
[ "Start", "a", "move", "to", "an", "existing", "mirror", "that", "may", "or", "may", "not", "have", "once", "been", "primary", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/table/src/main/java/com/bazaarvoice/emodb/table/db/astyanax/TableJson.java#L268-L290
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/openal/WaveData.java
WaveData.convertAudioBytes
private static ByteBuffer convertAudioBytes(byte[] audio_bytes, boolean two_bytes_data) { """ Convert the audio bytes into the stream @param audio_bytes The audio byts @param two_bytes_data True if we using double byte data @return The byte bufer of data """ ByteBuffer dest = ByteBuffer.allocateDirect(audio_bytes.length); dest.order(ByteOrder.nativeOrder()); ByteBuffer src = ByteBuffer.wrap(audio_bytes); src.order(ByteOrder.LITTLE_ENDIAN); if (two_bytes_data) { ShortBuffer dest_short = dest.asShortBuffer(); ShortBuffer src_short = src.asShortBuffer(); while (src_short.hasRemaining()) dest_short.put(src_short.get()); } else { while (src.hasRemaining()) dest.put(src.get()); } dest.rewind(); return dest; }
java
private static ByteBuffer convertAudioBytes(byte[] audio_bytes, boolean two_bytes_data) { ByteBuffer dest = ByteBuffer.allocateDirect(audio_bytes.length); dest.order(ByteOrder.nativeOrder()); ByteBuffer src = ByteBuffer.wrap(audio_bytes); src.order(ByteOrder.LITTLE_ENDIAN); if (two_bytes_data) { ShortBuffer dest_short = dest.asShortBuffer(); ShortBuffer src_short = src.asShortBuffer(); while (src_short.hasRemaining()) dest_short.put(src_short.get()); } else { while (src.hasRemaining()) dest.put(src.get()); } dest.rewind(); return dest; }
[ "private", "static", "ByteBuffer", "convertAudioBytes", "(", "byte", "[", "]", "audio_bytes", ",", "boolean", "two_bytes_data", ")", "{", "ByteBuffer", "dest", "=", "ByteBuffer", ".", "allocateDirect", "(", "audio_bytes", ".", "length", ")", ";", "dest", ".", "order", "(", "ByteOrder", ".", "nativeOrder", "(", ")", ")", ";", "ByteBuffer", "src", "=", "ByteBuffer", ".", "wrap", "(", "audio_bytes", ")", ";", "src", ".", "order", "(", "ByteOrder", ".", "LITTLE_ENDIAN", ")", ";", "if", "(", "two_bytes_data", ")", "{", "ShortBuffer", "dest_short", "=", "dest", ".", "asShortBuffer", "(", ")", ";", "ShortBuffer", "src_short", "=", "src", ".", "asShortBuffer", "(", ")", ";", "while", "(", "src_short", ".", "hasRemaining", "(", ")", ")", "dest_short", ".", "put", "(", "src_short", ".", "get", "(", ")", ")", ";", "}", "else", "{", "while", "(", "src", ".", "hasRemaining", "(", ")", ")", "dest", ".", "put", "(", "src", ".", "get", "(", ")", ")", ";", "}", "dest", ".", "rewind", "(", ")", ";", "return", "dest", ";", "}" ]
Convert the audio bytes into the stream @param audio_bytes The audio byts @param two_bytes_data True if we using double byte data @return The byte bufer of data
[ "Convert", "the", "audio", "bytes", "into", "the", "stream" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/openal/WaveData.java#L248-L264
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/Zips.java
Zips.process
public void process() { """ Iterates through source Zip entries removing or changing them according to set parameters. """ if (src == null && dest == null) { throw new IllegalArgumentException("Source and destination shouldn't be null together"); } File destinationFile = null; try { destinationFile = getDestinationFile(); ZipOutputStream out = null; ZipEntryOrInfoAdapter zipEntryAdapter = null; if (destinationFile.isFile()) { out = ZipFileUtil.createZipOutputStream(new BufferedOutputStream(new FileOutputStream(destinationFile)), charset); zipEntryAdapter = new ZipEntryOrInfoAdapter(new CopyingCallback(transformers, out, preserveTimestamps), null); } else { // directory zipEntryAdapter = new ZipEntryOrInfoAdapter(new UnpackingCallback(transformers, destinationFile), null); } try { processAllEntries(zipEntryAdapter); } finally { IOUtils.closeQuietly(out); } handleInPlaceActions(destinationFile); } catch (IOException e) { ZipExceptionUtil.rethrow(e); } finally { if (isInPlace()) { // destinationZip is a temporary file FileUtils.deleteQuietly(destinationFile); } } }
java
public void process() { if (src == null && dest == null) { throw new IllegalArgumentException("Source and destination shouldn't be null together"); } File destinationFile = null; try { destinationFile = getDestinationFile(); ZipOutputStream out = null; ZipEntryOrInfoAdapter zipEntryAdapter = null; if (destinationFile.isFile()) { out = ZipFileUtil.createZipOutputStream(new BufferedOutputStream(new FileOutputStream(destinationFile)), charset); zipEntryAdapter = new ZipEntryOrInfoAdapter(new CopyingCallback(transformers, out, preserveTimestamps), null); } else { // directory zipEntryAdapter = new ZipEntryOrInfoAdapter(new UnpackingCallback(transformers, destinationFile), null); } try { processAllEntries(zipEntryAdapter); } finally { IOUtils.closeQuietly(out); } handleInPlaceActions(destinationFile); } catch (IOException e) { ZipExceptionUtil.rethrow(e); } finally { if (isInPlace()) { // destinationZip is a temporary file FileUtils.deleteQuietly(destinationFile); } } }
[ "public", "void", "process", "(", ")", "{", "if", "(", "src", "==", "null", "&&", "dest", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Source and destination shouldn't be null together\"", ")", ";", "}", "File", "destinationFile", "=", "null", ";", "try", "{", "destinationFile", "=", "getDestinationFile", "(", ")", ";", "ZipOutputStream", "out", "=", "null", ";", "ZipEntryOrInfoAdapter", "zipEntryAdapter", "=", "null", ";", "if", "(", "destinationFile", ".", "isFile", "(", ")", ")", "{", "out", "=", "ZipFileUtil", ".", "createZipOutputStream", "(", "new", "BufferedOutputStream", "(", "new", "FileOutputStream", "(", "destinationFile", ")", ")", ",", "charset", ")", ";", "zipEntryAdapter", "=", "new", "ZipEntryOrInfoAdapter", "(", "new", "CopyingCallback", "(", "transformers", ",", "out", ",", "preserveTimestamps", ")", ",", "null", ")", ";", "}", "else", "{", "// directory", "zipEntryAdapter", "=", "new", "ZipEntryOrInfoAdapter", "(", "new", "UnpackingCallback", "(", "transformers", ",", "destinationFile", ")", ",", "null", ")", ";", "}", "try", "{", "processAllEntries", "(", "zipEntryAdapter", ")", ";", "}", "finally", "{", "IOUtils", ".", "closeQuietly", "(", "out", ")", ";", "}", "handleInPlaceActions", "(", "destinationFile", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "ZipExceptionUtil", ".", "rethrow", "(", "e", ")", ";", "}", "finally", "{", "if", "(", "isInPlace", "(", ")", ")", "{", "// destinationZip is a temporary file", "FileUtils", ".", "deleteQuietly", "(", "destinationFile", ")", ";", "}", "}", "}" ]
Iterates through source Zip entries removing or changing them according to set parameters.
[ "Iterates", "through", "source", "Zip", "entries", "removing", "or", "changing", "them", "according", "to", "set", "parameters", "." ]
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/Zips.java#L345-L380
integration-technology/amazon-mws-orders
src/main/java/com/amazonservices/mws/client/MwsUtl.java
MwsUtl.urlEncode
protected static String urlEncode(String value, boolean path) { """ URL encode a value. @param value @param path true if is a path and '/' should not be encoded. @return The encoded string. """ try { value = URLEncoder.encode(value, DEFAULT_ENCODING); } catch (Exception e) { throw wrap(e); } value = replaceAll(value, plusPtn, "%20"); value = replaceAll(value, asteriskPtn, "%2A"); value = replaceAll(value, pct7EPtn, "~"); if (path) { value = replaceAll(value, pct2FPtn, "/"); } return value; }
java
protected static String urlEncode(String value, boolean path) { try { value = URLEncoder.encode(value, DEFAULT_ENCODING); } catch (Exception e) { throw wrap(e); } value = replaceAll(value, plusPtn, "%20"); value = replaceAll(value, asteriskPtn, "%2A"); value = replaceAll(value, pct7EPtn, "~"); if (path) { value = replaceAll(value, pct2FPtn, "/"); } return value; }
[ "protected", "static", "String", "urlEncode", "(", "String", "value", ",", "boolean", "path", ")", "{", "try", "{", "value", "=", "URLEncoder", ".", "encode", "(", "value", ",", "DEFAULT_ENCODING", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "wrap", "(", "e", ")", ";", "}", "value", "=", "replaceAll", "(", "value", ",", "plusPtn", ",", "\"%20\"", ")", ";", "value", "=", "replaceAll", "(", "value", ",", "asteriskPtn", ",", "\"%2A\"", ")", ";", "value", "=", "replaceAll", "(", "value", ",", "pct7EPtn", ",", "\"~\"", ")", ";", "if", "(", "path", ")", "{", "value", "=", "replaceAll", "(", "value", ",", "pct2FPtn", ",", "\"/\"", ")", ";", "}", "return", "value", ";", "}" ]
URL encode a value. @param value @param path true if is a path and '/' should not be encoded. @return The encoded string.
[ "URL", "encode", "a", "value", "." ]
train
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsUtl.java#L282-L295
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java
Log.initWriters
private static Map<WriterKind, PrintWriter> initWriters(Context context) { """ Initialize a map of writers based on values found in the context @param context the context in which to find writers to use @return a map of writers """ PrintWriter out = context.get(outKey); PrintWriter err = context.get(errKey); if (out == null && err == null) { out = new PrintWriter(System.out, true); err = new PrintWriter(System.err, true); return initWriters(out, err); } else if (out == null || err == null) { PrintWriter pw = (out != null) ? out : err; return initWriters(pw, pw); } else { return initWriters(out, err); } }
java
private static Map<WriterKind, PrintWriter> initWriters(Context context) { PrintWriter out = context.get(outKey); PrintWriter err = context.get(errKey); if (out == null && err == null) { out = new PrintWriter(System.out, true); err = new PrintWriter(System.err, true); return initWriters(out, err); } else if (out == null || err == null) { PrintWriter pw = (out != null) ? out : err; return initWriters(pw, pw); } else { return initWriters(out, err); } }
[ "private", "static", "Map", "<", "WriterKind", ",", "PrintWriter", ">", "initWriters", "(", "Context", "context", ")", "{", "PrintWriter", "out", "=", "context", ".", "get", "(", "outKey", ")", ";", "PrintWriter", "err", "=", "context", ".", "get", "(", "errKey", ")", ";", "if", "(", "out", "==", "null", "&&", "err", "==", "null", ")", "{", "out", "=", "new", "PrintWriter", "(", "System", ".", "out", ",", "true", ")", ";", "err", "=", "new", "PrintWriter", "(", "System", ".", "err", ",", "true", ")", ";", "return", "initWriters", "(", "out", ",", "err", ")", ";", "}", "else", "if", "(", "out", "==", "null", "||", "err", "==", "null", ")", "{", "PrintWriter", "pw", "=", "(", "out", "!=", "null", ")", "?", "out", ":", "err", ";", "return", "initWriters", "(", "pw", ",", "pw", ")", ";", "}", "else", "{", "return", "initWriters", "(", "out", ",", "err", ")", ";", "}", "}" ]
Initialize a map of writers based on values found in the context @param context the context in which to find writers to use @return a map of writers
[ "Initialize", "a", "map", "of", "writers", "based", "on", "values", "found", "in", "the", "context" ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java#L262-L275
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/data/WaveformDetailComponent.java
WaveformDetailComponent.drawCueList
private void drawCueList(Graphics g, Rectangle clipRect, CueList cueList, int axis, int maxHeight) { """ Draw the visible memory cue points or hot cues. @param g the graphics object in which we are being rendered @param clipRect the region that is being currently rendered @param cueList the cues to be drawn @param axis the base on which the waveform is being drawn @param maxHeight the highest waveform segment """ for (CueList.Entry entry : cueList.entries) { final int x = millisecondsToX(entry.cueTime); if ((x > clipRect.x - 4) && (x < clipRect.x + clipRect.width + 4)) { g.setColor(cueColor(entry)); for (int i = 0; i < 4; i++) { g.drawLine(x - 3 + i, axis - maxHeight - BEAT_MARKER_HEIGHT - CUE_MARKER_HEIGHT + i, x + 3 - i, axis - maxHeight - BEAT_MARKER_HEIGHT - CUE_MARKER_HEIGHT + i); } } } }
java
private void drawCueList(Graphics g, Rectangle clipRect, CueList cueList, int axis, int maxHeight) { for (CueList.Entry entry : cueList.entries) { final int x = millisecondsToX(entry.cueTime); if ((x > clipRect.x - 4) && (x < clipRect.x + clipRect.width + 4)) { g.setColor(cueColor(entry)); for (int i = 0; i < 4; i++) { g.drawLine(x - 3 + i, axis - maxHeight - BEAT_MARKER_HEIGHT - CUE_MARKER_HEIGHT + i, x + 3 - i, axis - maxHeight - BEAT_MARKER_HEIGHT - CUE_MARKER_HEIGHT + i); } } } }
[ "private", "void", "drawCueList", "(", "Graphics", "g", ",", "Rectangle", "clipRect", ",", "CueList", "cueList", ",", "int", "axis", ",", "int", "maxHeight", ")", "{", "for", "(", "CueList", ".", "Entry", "entry", ":", "cueList", ".", "entries", ")", "{", "final", "int", "x", "=", "millisecondsToX", "(", "entry", ".", "cueTime", ")", ";", "if", "(", "(", "x", ">", "clipRect", ".", "x", "-", "4", ")", "&&", "(", "x", "<", "clipRect", ".", "x", "+", "clipRect", ".", "width", "+", "4", ")", ")", "{", "g", ".", "setColor", "(", "cueColor", "(", "entry", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "4", ";", "i", "++", ")", "{", "g", ".", "drawLine", "(", "x", "-", "3", "+", "i", ",", "axis", "-", "maxHeight", "-", "BEAT_MARKER_HEIGHT", "-", "CUE_MARKER_HEIGHT", "+", "i", ",", "x", "+", "3", "-", "i", ",", "axis", "-", "maxHeight", "-", "BEAT_MARKER_HEIGHT", "-", "CUE_MARKER_HEIGHT", "+", "i", ")", ";", "}", "}", "}", "}" ]
Draw the visible memory cue points or hot cues. @param g the graphics object in which we are being rendered @param clipRect the region that is being currently rendered @param cueList the cues to be drawn @param axis the base on which the waveform is being drawn @param maxHeight the highest waveform segment
[ "Draw", "the", "visible", "memory", "cue", "points", "or", "hot", "cues", "." ]
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformDetailComponent.java#L798-L809
sstrickx/yahoofinance-api
src/main/java/yahoofinance/Stock.java
Stock.getHistory
public List<HistoricalQuote> getHistory(Calendar from, Calendar to, Interval interval) throws IOException { """ Requests the historical quotes for this stock with the following characteristics. <ul> <li> from: specified value <li> to: specified value <li> interval: specified value </ul> @param from start date of the historical data @param to end date of the historical data @param interval the interval of the historical data @return a list of historical quotes from this stock @throws java.io.IOException when there's a connection problem @see #getHistory() """ if(YahooFinance.HISTQUOTES2_ENABLED.equalsIgnoreCase("true")) { HistQuotes2Request hist = new HistQuotes2Request(this.symbol, from, to, interval); this.setHistory(hist.getResult()); } else { HistQuotesRequest hist = new HistQuotesRequest(this.symbol, from, to, interval); this.setHistory(hist.getResult()); } return this.history; }
java
public List<HistoricalQuote> getHistory(Calendar from, Calendar to, Interval interval) throws IOException { if(YahooFinance.HISTQUOTES2_ENABLED.equalsIgnoreCase("true")) { HistQuotes2Request hist = new HistQuotes2Request(this.symbol, from, to, interval); this.setHistory(hist.getResult()); } else { HistQuotesRequest hist = new HistQuotesRequest(this.symbol, from, to, interval); this.setHistory(hist.getResult()); } return this.history; }
[ "public", "List", "<", "HistoricalQuote", ">", "getHistory", "(", "Calendar", "from", ",", "Calendar", "to", ",", "Interval", "interval", ")", "throws", "IOException", "{", "if", "(", "YahooFinance", ".", "HISTQUOTES2_ENABLED", ".", "equalsIgnoreCase", "(", "\"true\"", ")", ")", "{", "HistQuotes2Request", "hist", "=", "new", "HistQuotes2Request", "(", "this", ".", "symbol", ",", "from", ",", "to", ",", "interval", ")", ";", "this", ".", "setHistory", "(", "hist", ".", "getResult", "(", ")", ")", ";", "}", "else", "{", "HistQuotesRequest", "hist", "=", "new", "HistQuotesRequest", "(", "this", ".", "symbol", ",", "from", ",", "to", ",", "interval", ")", ";", "this", ".", "setHistory", "(", "hist", ".", "getResult", "(", ")", ")", ";", "}", "return", "this", ".", "history", ";", "}" ]
Requests the historical quotes for this stock with the following characteristics. <ul> <li> from: specified value <li> to: specified value <li> interval: specified value </ul> @param from start date of the historical data @param to end date of the historical data @param interval the interval of the historical data @return a list of historical quotes from this stock @throws java.io.IOException when there's a connection problem @see #getHistory()
[ "Requests", "the", "historical", "quotes", "for", "this", "stock", "with", "the", "following", "characteristics", ".", "<ul", ">", "<li", ">", "from", ":", "specified", "value", "<li", ">", "to", ":", "specified", "value", "<li", ">", "interval", ":", "specified", "value", "<", "/", "ul", ">" ]
train
https://github.com/sstrickx/yahoofinance-api/blob/2766ba52fc5cccf9b4da5c06423d68059cf0a6e6/src/main/java/yahoofinance/Stock.java#L324-L333
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/runtime/util/JspFunctions.java
JspFunctions.buildQueryParamsMapForSortExpression
public static Map buildQueryParamsMapForSortExpression(DataGridURLBuilder urlBuilder, String sortExpression) { """ <p> Utility method used to build a query parameter map which includes the list of parameters needed to change the direction of a sort related to the given sort expression. This method uses a {@link DataGridURLBuilder} instance to call its {@link DataGridURLBuilder#buildSortQueryParamsMap(String)} method from JSP EL. </p> @param urlBuilder the data grid URL builder associated with a {@link org.apache.beehive.netui.databinding.datagrid.api.DataGridState} object that is used to build lists of query parameters @param sortExpression the sort expression whose direction to change @return a {@link Map} of key / value pairs for query parameters @netui:jspfunction name="buildQueryParamsMapForSortExpression" signature="java.util.Map buildQueryParamsMapForSortExpression(org.apache.beehive.netui.databinding.datagrid.api.DataGridURLBuilder,java.lang.String)" """ if(urlBuilder == null || sortExpression == null) return null; return urlBuilder.buildSortQueryParamsMap(sortExpression); }
java
public static Map buildQueryParamsMapForSortExpression(DataGridURLBuilder urlBuilder, String sortExpression) { if(urlBuilder == null || sortExpression == null) return null; return urlBuilder.buildSortQueryParamsMap(sortExpression); }
[ "public", "static", "Map", "buildQueryParamsMapForSortExpression", "(", "DataGridURLBuilder", "urlBuilder", ",", "String", "sortExpression", ")", "{", "if", "(", "urlBuilder", "==", "null", "||", "sortExpression", "==", "null", ")", "return", "null", ";", "return", "urlBuilder", ".", "buildSortQueryParamsMap", "(", "sortExpression", ")", ";", "}" ]
<p> Utility method used to build a query parameter map which includes the list of parameters needed to change the direction of a sort related to the given sort expression. This method uses a {@link DataGridURLBuilder} instance to call its {@link DataGridURLBuilder#buildSortQueryParamsMap(String)} method from JSP EL. </p> @param urlBuilder the data grid URL builder associated with a {@link org.apache.beehive.netui.databinding.datagrid.api.DataGridState} object that is used to build lists of query parameters @param sortExpression the sort expression whose direction to change @return a {@link Map} of key / value pairs for query parameters @netui:jspfunction name="buildQueryParamsMapForSortExpression" signature="java.util.Map buildQueryParamsMapForSortExpression(org.apache.beehive.netui.databinding.datagrid.api.DataGridURLBuilder,java.lang.String)"
[ "<p", ">", "Utility", "method", "used", "to", "build", "a", "query", "parameter", "map", "which", "includes", "the", "list", "of", "parameters", "needed", "to", "change", "the", "direction", "of", "a", "sort", "related", "to", "the", "given", "sort", "expression", ".", "This", "method", "uses", "a", "{" ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/runtime/util/JspFunctions.java#L99-L104
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-job/src/main/java/org/xwiki/job/internal/DefaultJobProgressStep.java
DefaultJobProgressStep.nextStep
public DefaultJobProgressStep nextStep(Message stepMessage, Object newStepSource) { """ Move to next child step. @param stepMessage the message associated to the step @param newStepSource who asked to create this new step @return the new step """ assertModifiable(); // Close current step and move to the end finishStep(); // Add new step return addStep(stepMessage, newStepSource); }
java
public DefaultJobProgressStep nextStep(Message stepMessage, Object newStepSource) { assertModifiable(); // Close current step and move to the end finishStep(); // Add new step return addStep(stepMessage, newStepSource); }
[ "public", "DefaultJobProgressStep", "nextStep", "(", "Message", "stepMessage", ",", "Object", "newStepSource", ")", "{", "assertModifiable", "(", ")", ";", "// Close current step and move to the end", "finishStep", "(", ")", ";", "// Add new step", "return", "addStep", "(", "stepMessage", ",", "newStepSource", ")", ";", "}" ]
Move to next child step. @param stepMessage the message associated to the step @param newStepSource who asked to create this new step @return the new step
[ "Move", "to", "next", "child", "step", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-job/src/main/java/org/xwiki/job/internal/DefaultJobProgressStep.java#L239-L248
nmdp-bioinformatics/ngs
sra/src/main/java/org/nmdp/ngs/sra/SraReader.java
SraReader.readAnalysis
public static Analysis readAnalysis(final Reader reader) throws IOException { """ Read an analysis from the specified reader. @param reader reader, must not be null @return an analysis read from the specified reader @throws IOException if an I/O error occurs """ checkNotNull(reader); try { JAXBContext context = JAXBContext.newInstance(Analysis.class); Unmarshaller unmarshaller = context.createUnmarshaller(); SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); URL commonSchemaURL = SraReader.class.getResource("/org/nmdp/ngs/sra/xsd/SRA.common.xsd"); URL analysisSchemaURL = SraReader.class.getResource("/org/nmdp/ngs/sra/xsd/SRA.analysis.xsd"); Schema schema = schemaFactory.newSchema(new StreamSource[] { new StreamSource(commonSchemaURL.toString()), new StreamSource(analysisSchemaURL.toString()) }); unmarshaller.setSchema(schema); return (Analysis) unmarshaller.unmarshal(reader); } catch (JAXBException | SAXException e) { throw new IOException("could not unmarshal Analysis", e); } }
java
public static Analysis readAnalysis(final Reader reader) throws IOException { checkNotNull(reader); try { JAXBContext context = JAXBContext.newInstance(Analysis.class); Unmarshaller unmarshaller = context.createUnmarshaller(); SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); URL commonSchemaURL = SraReader.class.getResource("/org/nmdp/ngs/sra/xsd/SRA.common.xsd"); URL analysisSchemaURL = SraReader.class.getResource("/org/nmdp/ngs/sra/xsd/SRA.analysis.xsd"); Schema schema = schemaFactory.newSchema(new StreamSource[] { new StreamSource(commonSchemaURL.toString()), new StreamSource(analysisSchemaURL.toString()) }); unmarshaller.setSchema(schema); return (Analysis) unmarshaller.unmarshal(reader); } catch (JAXBException | SAXException e) { throw new IOException("could not unmarshal Analysis", e); } }
[ "public", "static", "Analysis", "readAnalysis", "(", "final", "Reader", "reader", ")", "throws", "IOException", "{", "checkNotNull", "(", "reader", ")", ";", "try", "{", "JAXBContext", "context", "=", "JAXBContext", ".", "newInstance", "(", "Analysis", ".", "class", ")", ";", "Unmarshaller", "unmarshaller", "=", "context", ".", "createUnmarshaller", "(", ")", ";", "SchemaFactory", "schemaFactory", "=", "SchemaFactory", ".", "newInstance", "(", "XMLConstants", ".", "W3C_XML_SCHEMA_NS_URI", ")", ";", "URL", "commonSchemaURL", "=", "SraReader", ".", "class", ".", "getResource", "(", "\"/org/nmdp/ngs/sra/xsd/SRA.common.xsd\"", ")", ";", "URL", "analysisSchemaURL", "=", "SraReader", ".", "class", ".", "getResource", "(", "\"/org/nmdp/ngs/sra/xsd/SRA.analysis.xsd\"", ")", ";", "Schema", "schema", "=", "schemaFactory", ".", "newSchema", "(", "new", "StreamSource", "[", "]", "{", "new", "StreamSource", "(", "commonSchemaURL", ".", "toString", "(", ")", ")", ",", "new", "StreamSource", "(", "analysisSchemaURL", ".", "toString", "(", ")", ")", "}", ")", ";", "unmarshaller", ".", "setSchema", "(", "schema", ")", ";", "return", "(", "Analysis", ")", "unmarshaller", ".", "unmarshal", "(", "reader", ")", ";", "}", "catch", "(", "JAXBException", "|", "SAXException", "e", ")", "{", "throw", "new", "IOException", "(", "\"could not unmarshal Analysis\"", ",", "e", ")", ";", "}", "}" ]
Read an analysis from the specified reader. @param reader reader, must not be null @return an analysis read from the specified reader @throws IOException if an I/O error occurs
[ "Read", "an", "analysis", "from", "the", "specified", "reader", "." ]
train
https://github.com/nmdp-bioinformatics/ngs/blob/277627e4311313a80f5dc110b3185b0d7af32bd0/sra/src/main/java/org/nmdp/ngs/sra/SraReader.java#L73-L88
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.getAt
public static BitSet getAt(BitSet self, IntRange range) { """ Support retrieving a subset of a BitSet using a Range @param self a BitSet @param range a Range defining the desired subset @return a new BitSet that represents the requested subset @see java.util.BitSet @see groovy.lang.IntRange @since 1.5.0 """ RangeInfo info = subListBorders(self.length(), range); BitSet result = new BitSet(); int numberOfBits = info.to - info.from; int adjuster = 1; int offset = info.from; if (info.reverse) { adjuster = -1; offset = info.to - 1; } for (int i = 0; i < numberOfBits; i++) { result.set(i, self.get(offset + (adjuster * i))); } return result; }
java
public static BitSet getAt(BitSet self, IntRange range) { RangeInfo info = subListBorders(self.length(), range); BitSet result = new BitSet(); int numberOfBits = info.to - info.from; int adjuster = 1; int offset = info.from; if (info.reverse) { adjuster = -1; offset = info.to - 1; } for (int i = 0; i < numberOfBits; i++) { result.set(i, self.get(offset + (adjuster * i))); } return result; }
[ "public", "static", "BitSet", "getAt", "(", "BitSet", "self", ",", "IntRange", "range", ")", "{", "RangeInfo", "info", "=", "subListBorders", "(", "self", ".", "length", "(", ")", ",", "range", ")", ";", "BitSet", "result", "=", "new", "BitSet", "(", ")", ";", "int", "numberOfBits", "=", "info", ".", "to", "-", "info", ".", "from", ";", "int", "adjuster", "=", "1", ";", "int", "offset", "=", "info", ".", "from", ";", "if", "(", "info", ".", "reverse", ")", "{", "adjuster", "=", "-", "1", ";", "offset", "=", "info", ".", "to", "-", "1", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numberOfBits", ";", "i", "++", ")", "{", "result", ".", "set", "(", "i", ",", "self", ".", "get", "(", "offset", "+", "(", "adjuster", "*", "i", ")", ")", ")", ";", "}", "return", "result", ";", "}" ]
Support retrieving a subset of a BitSet using a Range @param self a BitSet @param range a Range defining the desired subset @return a new BitSet that represents the requested subset @see java.util.BitSet @see groovy.lang.IntRange @since 1.5.0
[ "Support", "retrieving", "a", "subset", "of", "a", "BitSet", "using", "a", "Range" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L14058-L14076
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/RelationalJMapper.java
RelationalJMapper.addClasses
private void addClasses(Class<?>[] classes, HashSet<Class<?>> result) { """ Adds to the result parameter all classes that aren't present in it @param classes classes to control @param result List to enrich """ if(isNull(classes) || classes.length==0) Error.globalClassesAbsent(configuredClass); for (Class<?> classe : classes) result.add(classe); }
java
private void addClasses(Class<?>[] classes, HashSet<Class<?>> result){ if(isNull(classes) || classes.length==0) Error.globalClassesAbsent(configuredClass); for (Class<?> classe : classes) result.add(classe); }
[ "private", "void", "addClasses", "(", "Class", "<", "?", ">", "[", "]", "classes", ",", "HashSet", "<", "Class", "<", "?", ">", ">", "result", ")", "{", "if", "(", "isNull", "(", "classes", ")", "||", "classes", ".", "length", "==", "0", ")", "Error", ".", "globalClassesAbsent", "(", "configuredClass", ")", ";", "for", "(", "Class", "<", "?", ">", "classe", ":", "classes", ")", "result", ".", "(", "classe", ")", ";", "}" ]
Adds to the result parameter all classes that aren't present in it @param classes classes to control @param result List to enrich
[ "Adds", "to", "the", "result", "parameter", "all", "classes", "that", "aren", "t", "present", "in", "it" ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/RelationalJMapper.java#L291-L297
Impetus/Kundera
src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/schemamanager/HBaseSchemaManager.java
HBaseSchemaManager.isNamespaceAvailable
private boolean isNamespaceAvailable(String databaseName) { """ Checks if is namespace available. @param databaseName the database name @return true, if is namespace available """ try { for (NamespaceDescriptor ns : admin.listNamespaceDescriptors()) { if (ns.getName().equals(databaseName)) { return true; } } return false; } catch (IOException ioex) { logger.error("Either table isn't in enabled state or some network problem, Caused by: ", ioex); throw new SchemaGenerationException(ioex, "Either table isn't in enabled state or some network problem."); } }
java
private boolean isNamespaceAvailable(String databaseName) { try { for (NamespaceDescriptor ns : admin.listNamespaceDescriptors()) { if (ns.getName().equals(databaseName)) { return true; } } return false; } catch (IOException ioex) { logger.error("Either table isn't in enabled state or some network problem, Caused by: ", ioex); throw new SchemaGenerationException(ioex, "Either table isn't in enabled state or some network problem."); } }
[ "private", "boolean", "isNamespaceAvailable", "(", "String", "databaseName", ")", "{", "try", "{", "for", "(", "NamespaceDescriptor", "ns", ":", "admin", ".", "listNamespaceDescriptors", "(", ")", ")", "{", "if", "(", "ns", ".", "getName", "(", ")", ".", "equals", "(", "databaseName", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}", "catch", "(", "IOException", "ioex", ")", "{", "logger", ".", "error", "(", "\"Either table isn't in enabled state or some network problem, Caused by: \"", ",", "ioex", ")", ";", "throw", "new", "SchemaGenerationException", "(", "ioex", ",", "\"Either table isn't in enabled state or some network problem.\"", ")", ";", "}", "}" ]
Checks if is namespace available. @param databaseName the database name @return true, if is namespace available
[ "Checks", "if", "is", "namespace", "available", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/schemamanager/HBaseSchemaManager.java#L428-L446
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/map/feature/Feature.java
Feature.setDateAttribute
public void setDateAttribute(String name, Date value) { """ Set attribute value of given type. @param name attribute name @param value attribute value """ Attribute attribute = getAttributes().get(name); if (!(attribute instanceof DateAttribute)) { throw new IllegalStateException("Cannot set date value on attribute with different type, " + attribute.getClass().getName() + " setting value " + value); } ((DateAttribute) attribute).setValue(value); }
java
public void setDateAttribute(String name, Date value) { Attribute attribute = getAttributes().get(name); if (!(attribute instanceof DateAttribute)) { throw new IllegalStateException("Cannot set date value on attribute with different type, " + attribute.getClass().getName() + " setting value " + value); } ((DateAttribute) attribute).setValue(value); }
[ "public", "void", "setDateAttribute", "(", "String", "name", ",", "Date", "value", ")", "{", "Attribute", "attribute", "=", "getAttributes", "(", ")", ".", "get", "(", "name", ")", ";", "if", "(", "!", "(", "attribute", "instanceof", "DateAttribute", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Cannot set date value on attribute with different type, \"", "+", "attribute", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\" setting value \"", "+", "value", ")", ";", "}", "(", "(", "DateAttribute", ")", "attribute", ")", ".", "setValue", "(", "value", ")", ";", "}" ]
Set attribute value of given type. @param name attribute name @param value attribute value
[ "Set", "attribute", "value", "of", "given", "type", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/feature/Feature.java#L245-L252
aalmiray/Json-lib
src/main/java/net/sf/json/JsonConfig.java
JsonConfig.registerJsonValueProcessor
public void registerJsonValueProcessor( Class beanClass, String key, JsonValueProcessor jsonValueProcessor ) { """ Registers a JsonValueProcessor.<br> [Java -&gt; JSON] @param beanClass the class to use as key @param key the property name to use as key @param jsonValueProcessor the processor to register """ if( beanClass != null && key != null && jsonValueProcessor != null ) { beanKeyMap.put( beanClass, key, jsonValueProcessor ); } }
java
public void registerJsonValueProcessor( Class beanClass, String key, JsonValueProcessor jsonValueProcessor ) { if( beanClass != null && key != null && jsonValueProcessor != null ) { beanKeyMap.put( beanClass, key, jsonValueProcessor ); } }
[ "public", "void", "registerJsonValueProcessor", "(", "Class", "beanClass", ",", "String", "key", ",", "JsonValueProcessor", "jsonValueProcessor", ")", "{", "if", "(", "beanClass", "!=", "null", "&&", "key", "!=", "null", "&&", "jsonValueProcessor", "!=", "null", ")", "{", "beanKeyMap", ".", "put", "(", "beanClass", ",", "key", ",", "jsonValueProcessor", ")", ";", "}", "}" ]
Registers a JsonValueProcessor.<br> [Java -&gt; JSON] @param beanClass the class to use as key @param key the property name to use as key @param jsonValueProcessor the processor to register
[ "Registers", "a", "JsonValueProcessor", ".", "<br", ">", "[", "Java", "-", "&gt", ";", "JSON", "]" ]
train
https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JsonConfig.java#L840-L844
cloudant/java-cloudant
cloudant-client/src/main/java/com/cloudant/client/internal/query/Helpers.java
Helpers.withKey
public static String withKey(String key, Selector selector) { """ <P> Returns the string form of the specified key mapping to a JSON object enclosing the selector. </P> <pre> {@code Selector selector = eq("year", 2017); System.out.println(selector.toString()); // Output: "year": {"$eq" : 2017} System.out.println(SelectorUtils.withKey("selector", selector)); // Output: "selector": {"year": {"$eq": 2017}} } </pre> @param key key to use for the selector (usually "selector" or "partial_filter_selector") @param selector the selector @return the string form of the selector enclosed in a JSON object, keyed by key """ return String.format("\"%s\": %s", key, enclose(selector)); }
java
public static String withKey(String key, Selector selector) { return String.format("\"%s\": %s", key, enclose(selector)); }
[ "public", "static", "String", "withKey", "(", "String", "key", ",", "Selector", "selector", ")", "{", "return", "String", ".", "format", "(", "\"\\\"%s\\\": %s\"", ",", "key", ",", "enclose", "(", "selector", ")", ")", ";", "}" ]
<P> Returns the string form of the specified key mapping to a JSON object enclosing the selector. </P> <pre> {@code Selector selector = eq("year", 2017); System.out.println(selector.toString()); // Output: "year": {"$eq" : 2017} System.out.println(SelectorUtils.withKey("selector", selector)); // Output: "selector": {"year": {"$eq": 2017}} } </pre> @param key key to use for the selector (usually "selector" or "partial_filter_selector") @param selector the selector @return the string form of the selector enclosed in a JSON object, keyed by key
[ "<P", ">", "Returns", "the", "string", "form", "of", "the", "specified", "key", "mapping", "to", "a", "JSON", "object", "enclosing", "the", "selector", ".", "<", "/", "P", ">", "<pre", ">", "{", "@code", "Selector", "selector", "=", "eq", "(", "year", "2017", ")", ";", "System", ".", "out", ".", "println", "(", "selector", ".", "toString", "()", ")", ";", "//", "Output", ":", "year", ":", "{", "$eq", ":", "2017", "}", "System", ".", "out", ".", "println", "(", "SelectorUtils", ".", "withKey", "(", "selector", "selector", "))", ";", "//", "Output", ":", "selector", ":", "{", "year", ":", "{", "$eq", ":", "2017", "}}", "}", "<", "/", "pre", ">" ]
train
https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/internal/query/Helpers.java#L144-L146
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/failover/thread/ConnectionValidator.java
ConnectionValidator.addListener
public void addListener(Listener listener, long listenerCheckMillis) { """ Add listener to validation list. @param listener listener @param listenerCheckMillis schedule time """ queue.add(listener); long newFrequency = Math.min(MINIMUM_CHECK_DELAY_MILLIS, listenerCheckMillis); //first listener if (currentScheduledFrequency.get() == -1) { if (currentScheduledFrequency.compareAndSet(-1, newFrequency)) { fixedSizedScheduler.schedule(checker, listenerCheckMillis, TimeUnit.MILLISECONDS); } } else { long frequency = currentScheduledFrequency.get(); if (frequency > newFrequency) { currentScheduledFrequency.compareAndSet(frequency, newFrequency); } } }
java
public void addListener(Listener listener, long listenerCheckMillis) { queue.add(listener); long newFrequency = Math.min(MINIMUM_CHECK_DELAY_MILLIS, listenerCheckMillis); //first listener if (currentScheduledFrequency.get() == -1) { if (currentScheduledFrequency.compareAndSet(-1, newFrequency)) { fixedSizedScheduler.schedule(checker, listenerCheckMillis, TimeUnit.MILLISECONDS); } } else { long frequency = currentScheduledFrequency.get(); if (frequency > newFrequency) { currentScheduledFrequency.compareAndSet(frequency, newFrequency); } } }
[ "public", "void", "addListener", "(", "Listener", "listener", ",", "long", "listenerCheckMillis", ")", "{", "queue", ".", "add", "(", "listener", ")", ";", "long", "newFrequency", "=", "Math", ".", "min", "(", "MINIMUM_CHECK_DELAY_MILLIS", ",", "listenerCheckMillis", ")", ";", "//first listener", "if", "(", "currentScheduledFrequency", ".", "get", "(", ")", "==", "-", "1", ")", "{", "if", "(", "currentScheduledFrequency", ".", "compareAndSet", "(", "-", "1", ",", "newFrequency", ")", ")", "{", "fixedSizedScheduler", ".", "schedule", "(", "checker", ",", "listenerCheckMillis", ",", "TimeUnit", ".", "MILLISECONDS", ")", ";", "}", "}", "else", "{", "long", "frequency", "=", "currentScheduledFrequency", ".", "get", "(", ")", ";", "if", "(", "frequency", ">", "newFrequency", ")", "{", "currentScheduledFrequency", ".", "compareAndSet", "(", "frequency", ",", "newFrequency", ")", ";", "}", "}", "}" ]
Add listener to validation list. @param listener listener @param listenerCheckMillis schedule time
[ "Add", "listener", "to", "validation", "list", "." ]
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/failover/thread/ConnectionValidator.java#L79-L96
aalmiray/Json-lib
src/main/java/net/sf/json/JsonConfig.java
JsonConfig.registerJsonValueProcessor
public void registerJsonValueProcessor( String key, JsonValueProcessor jsonValueProcessor ) { """ Registers a JsonValueProcessor.<br> [Java -&gt; JSON] @param key the property name to use as key @param jsonValueProcessor the processor to register """ if( key != null && jsonValueProcessor != null ) { keyMap.put( key, jsonValueProcessor ); } }
java
public void registerJsonValueProcessor( String key, JsonValueProcessor jsonValueProcessor ) { if( key != null && jsonValueProcessor != null ) { keyMap.put( key, jsonValueProcessor ); } }
[ "public", "void", "registerJsonValueProcessor", "(", "String", "key", ",", "JsonValueProcessor", "jsonValueProcessor", ")", "{", "if", "(", "key", "!=", "null", "&&", "jsonValueProcessor", "!=", "null", ")", "{", "keyMap", ".", "put", "(", "key", ",", "jsonValueProcessor", ")", ";", "}", "}" ]
Registers a JsonValueProcessor.<br> [Java -&gt; JSON] @param key the property name to use as key @param jsonValueProcessor the processor to register
[ "Registers", "a", "JsonValueProcessor", ".", "<br", ">", "[", "Java", "-", "&gt", ";", "JSON", "]" ]
train
https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JsonConfig.java#L853-L857
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/thread/MainThread.java
MainThread.runOnMainThreadDelayed
public boolean runOnMainThreadDelayed(Runnable r, long delayMillis) { """ Queues a Runnable to be run on the main thread after the time specified by {@code delayMillis} has elapsed. A pause in application execution may add an additional delay. @param r The Runnable to run on the main thread. @param delayMillis The delay, in milliseconds, until the Runnable is run. @return Returns {@code true} if the Runnable was successfully placed in the Looper's message queue. """ assert handler != null; if (!sanityCheck("runOnMainThreadDelayed " + r + " delayMillis = " + delayMillis)) { return false; } return handler.postDelayed(r, delayMillis); }
java
public boolean runOnMainThreadDelayed(Runnable r, long delayMillis) { assert handler != null; if (!sanityCheck("runOnMainThreadDelayed " + r + " delayMillis = " + delayMillis)) { return false; } return handler.postDelayed(r, delayMillis); }
[ "public", "boolean", "runOnMainThreadDelayed", "(", "Runnable", "r", ",", "long", "delayMillis", ")", "{", "assert", "handler", "!=", "null", ";", "if", "(", "!", "sanityCheck", "(", "\"runOnMainThreadDelayed \"", "+", "r", "+", "\" delayMillis = \"", "+", "delayMillis", ")", ")", "{", "return", "false", ";", "}", "return", "handler", ".", "postDelayed", "(", "r", ",", "delayMillis", ")", ";", "}" ]
Queues a Runnable to be run on the main thread after the time specified by {@code delayMillis} has elapsed. A pause in application execution may add an additional delay. @param r The Runnable to run on the main thread. @param delayMillis The delay, in milliseconds, until the Runnable is run. @return Returns {@code true} if the Runnable was successfully placed in the Looper's message queue.
[ "Queues", "a", "Runnable", "to", "be", "run", "on", "the", "main", "thread", "after", "the", "time", "specified", "by", "{", "@code", "delayMillis", "}", "has", "elapsed", ".", "A", "pause", "in", "application", "execution", "may", "add", "an", "additional", "delay", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/thread/MainThread.java#L167-L174
jcuda/jcurand
JCurandJava/src/main/java/jcuda/jcurand/JCurand.java
JCurand.curandGenerateUniform
public static int curandGenerateUniform(curandGenerator generator, Pointer outputPtr, long num) { """ <pre> Generate uniformly distributed floats. Use generator to generate num float results into the device memory at outputPtr. The device memory must have been previously allocated and be large enough to hold all the results. Launches are done with the stream set using ::curandSetStream(), or the null stream if no stream has been set. Results are 32-bit floating point values between 0.0f and 1.0f, excluding 0.0f and including 1.0f. @param generator - Generator to use @param outputPtr - Pointer to device memory to store CUDA-generated results, or Pointer to host memory to store CPU-generated results @param num - Number of floats to generate @return CURAND_STATUS_NOT_INITIALIZED if the generator was never created CURAND_STATUS_PREEXISTING_FAILURE if there was an existing error from a previous kernel launch CURAND_STATUS_LAUNCH_FAILURE if the kernel launch failed for any reason CURAND_STATUS_LENGTH_NOT_MULTIPLE if the number of output samples is not a multiple of the quasirandom dimension CURAND_STATUS_SUCCESS if the results were generated successfully </pre> """ return checkResult(curandGenerateUniformNative(generator, outputPtr, num)); }
java
public static int curandGenerateUniform(curandGenerator generator, Pointer outputPtr, long num) { return checkResult(curandGenerateUniformNative(generator, outputPtr, num)); }
[ "public", "static", "int", "curandGenerateUniform", "(", "curandGenerator", "generator", ",", "Pointer", "outputPtr", ",", "long", "num", ")", "{", "return", "checkResult", "(", "curandGenerateUniformNative", "(", "generator", ",", "outputPtr", ",", "num", ")", ")", ";", "}" ]
<pre> Generate uniformly distributed floats. Use generator to generate num float results into the device memory at outputPtr. The device memory must have been previously allocated and be large enough to hold all the results. Launches are done with the stream set using ::curandSetStream(), or the null stream if no stream has been set. Results are 32-bit floating point values between 0.0f and 1.0f, excluding 0.0f and including 1.0f. @param generator - Generator to use @param outputPtr - Pointer to device memory to store CUDA-generated results, or Pointer to host memory to store CPU-generated results @param num - Number of floats to generate @return CURAND_STATUS_NOT_INITIALIZED if the generator was never created CURAND_STATUS_PREEXISTING_FAILURE if there was an existing error from a previous kernel launch CURAND_STATUS_LAUNCH_FAILURE if the kernel launch failed for any reason CURAND_STATUS_LENGTH_NOT_MULTIPLE if the number of output samples is not a multiple of the quasirandom dimension CURAND_STATUS_SUCCESS if the results were generated successfully </pre>
[ "<pre", ">", "Generate", "uniformly", "distributed", "floats", "." ]
train
https://github.com/jcuda/jcurand/blob/0f463d2bb72cd93b3988f7ce148cdb6069ba4fd9/JCurandJava/src/main/java/jcuda/jcurand/JCurand.java#L594-L597
ozimov/cirneco
hamcrest/hamcrest-matchers/src/main/java/it/ozimov/cirneco/hamcrest/HamcrestMatchers.java
HamcrestMatchers.containsInOrder
public static <T> Matcher<Iterable<? extends T>> containsInOrder(final Iterable<T> items) { """ Creates a matcher for {@linkplain Iterable}s that matches when a single pass over the examined {@linkplain Iterable} yields a series of items, each logically equal to the corresponding item in the specified items. For a positive match, the examined iterable must be of the same length as the number of specified items. <p> <p>For example: <p> <pre> //Arrange Iterable<String> actual = Arrays.asList("foo", "bar"); Iterable<String> expected = Arrays.asList("foo", "bar"); //Assert assertThat(actual, containsInOrder(expected)); </pre> @param items the items that must equal the items provided by an examined {@linkplain Iterable} """ return IsIterableContainingInOrder.containsInOrder(items); }
java
public static <T> Matcher<Iterable<? extends T>> containsInOrder(final Iterable<T> items) { return IsIterableContainingInOrder.containsInOrder(items); }
[ "public", "static", "<", "T", ">", "Matcher", "<", "Iterable", "<", "?", "extends", "T", ">", ">", "containsInOrder", "(", "final", "Iterable", "<", "T", ">", "items", ")", "{", "return", "IsIterableContainingInOrder", ".", "containsInOrder", "(", "items", ")", ";", "}" ]
Creates a matcher for {@linkplain Iterable}s that matches when a single pass over the examined {@linkplain Iterable} yields a series of items, each logically equal to the corresponding item in the specified items. For a positive match, the examined iterable must be of the same length as the number of specified items. <p> <p>For example: <p> <pre> //Arrange Iterable<String> actual = Arrays.asList("foo", "bar"); Iterable<String> expected = Arrays.asList("foo", "bar"); //Assert assertThat(actual, containsInOrder(expected)); </pre> @param items the items that must equal the items provided by an examined {@linkplain Iterable}
[ "Creates", "a", "matcher", "for", "{", "@linkplain", "Iterable", "}", "s", "that", "matches", "when", "a", "single", "pass", "over", "the", "examined", "{", "@linkplain", "Iterable", "}", "yields", "a", "series", "of", "items", "each", "logically", "equal", "to", "the", "corresponding", "item", "in", "the", "specified", "items", ".", "For", "a", "positive", "match", "the", "examined", "iterable", "must", "be", "of", "the", "same", "length", "as", "the", "number", "of", "specified", "items", ".", "<p", ">", "<p", ">", "For", "example", ":", "<p", ">", "<pre", ">", "//", "Arrange", "Iterable<String", ">", "actual", "=", "Arrays", ".", "asList", "(", "foo", "bar", ")", ";", "Iterable<String", ">", "expected", "=", "Arrays", ".", "asList", "(", "foo", "bar", ")", ";" ]
train
https://github.com/ozimov/cirneco/blob/78ad782da0a2256634cfbebb2f97ed78c993b999/hamcrest/hamcrest-matchers/src/main/java/it/ozimov/cirneco/hamcrest/HamcrestMatchers.java#L537-L539
jbundle/jbundle
base/db/client/src/main/java/org/jbundle/base/db/client/ClientTable.java
ClientTable.fieldsToData
public void fieldsToData(Rec record) throws DBException { """ Move all the fields to the output buffer. In this implementation, create a new VectorBuffer and move the fielddata to it. @exception DBException File exception. """ try { int iFieldTypes = BaseBuffer.PHYSICAL_FIELDS; if (!((Record)record).isAllSelected()) iFieldTypes = BaseBuffer.DATA_FIELDS; //SELECTED_FIELDS; (Selected and physical) m_dataSource = new VectorBuffer(null, iFieldTypes); //x new StringBuff(); ((BaseBuffer)m_dataSource).fieldsToBuffer((FieldList)record); } catch (Exception ex) { throw DatabaseException.toDatabaseException(ex); } }
java
public void fieldsToData(Rec record) throws DBException { try { int iFieldTypes = BaseBuffer.PHYSICAL_FIELDS; if (!((Record)record).isAllSelected()) iFieldTypes = BaseBuffer.DATA_FIELDS; //SELECTED_FIELDS; (Selected and physical) m_dataSource = new VectorBuffer(null, iFieldTypes); //x new StringBuff(); ((BaseBuffer)m_dataSource).fieldsToBuffer((FieldList)record); } catch (Exception ex) { throw DatabaseException.toDatabaseException(ex); } }
[ "public", "void", "fieldsToData", "(", "Rec", "record", ")", "throws", "DBException", "{", "try", "{", "int", "iFieldTypes", "=", "BaseBuffer", ".", "PHYSICAL_FIELDS", ";", "if", "(", "!", "(", "(", "Record", ")", "record", ")", ".", "isAllSelected", "(", ")", ")", "iFieldTypes", "=", "BaseBuffer", ".", "DATA_FIELDS", ";", "//SELECTED_FIELDS; (Selected and physical)", "m_dataSource", "=", "new", "VectorBuffer", "(", "null", ",", "iFieldTypes", ")", ";", "//x new StringBuff();", "(", "(", "BaseBuffer", ")", "m_dataSource", ")", ".", "fieldsToBuffer", "(", "(", "FieldList", ")", "record", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "throw", "DatabaseException", ".", "toDatabaseException", "(", "ex", ")", ";", "}", "}" ]
Move all the fields to the output buffer. In this implementation, create a new VectorBuffer and move the fielddata to it. @exception DBException File exception.
[ "Move", "all", "the", "fields", "to", "the", "output", "buffer", ".", "In", "this", "implementation", "create", "a", "new", "VectorBuffer", "and", "move", "the", "fielddata", "to", "it", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/db/client/src/main/java/org/jbundle/base/db/client/ClientTable.java#L561-L572
RallyTools/RallyRestToolkitForJava
src/main/java/com/rallydev/rest/RallyRestApi.java
RallyRestApi.setProxy
public void setProxy(URI proxy, String userName, String password) { """ Set the authenticated proxy server to use. By default no proxy is configured. @param proxy The proxy server, e.g. {@code new URI("http://my.proxy.com:8000")} @param userName The username to be used for authentication. @param password The password to be used for authentication. """ client.setProxy(proxy, userName, password); }
java
public void setProxy(URI proxy, String userName, String password) { client.setProxy(proxy, userName, password); }
[ "public", "void", "setProxy", "(", "URI", "proxy", ",", "String", "userName", ",", "String", "password", ")", "{", "client", ".", "setProxy", "(", "proxy", ",", "userName", ",", "password", ")", ";", "}" ]
Set the authenticated proxy server to use. By default no proxy is configured. @param proxy The proxy server, e.g. {@code new URI("http://my.proxy.com:8000")} @param userName The username to be used for authentication. @param password The password to be used for authentication.
[ "Set", "the", "authenticated", "proxy", "server", "to", "use", ".", "By", "default", "no", "proxy", "is", "configured", "." ]
train
https://github.com/RallyTools/RallyRestToolkitForJava/blob/542afa16ea44c9c64cebb0299500dcbbb50b6d7d/src/main/java/com/rallydev/rest/RallyRestApi.java#L64-L66
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_RemoveRepeatedPoints.java
ST_RemoveRepeatedPoints.removeDuplicateCoordinates
public static MultiLineString removeDuplicateCoordinates(MultiLineString multiLineString, double tolerance) throws SQLException { """ Removes duplicated coordinates in a MultiLineString. @param multiLineString @param tolerance to delete the coordinates @return """ ArrayList<LineString> lines = new ArrayList<LineString>(); for (int i = 0; i < multiLineString.getNumGeometries(); i++) { LineString line = (LineString) multiLineString.getGeometryN(i); lines.add(removeDuplicateCoordinates(line, tolerance)); } return FACTORY.createMultiLineString(GeometryFactory.toLineStringArray(lines)); }
java
public static MultiLineString removeDuplicateCoordinates(MultiLineString multiLineString, double tolerance) throws SQLException { ArrayList<LineString> lines = new ArrayList<LineString>(); for (int i = 0; i < multiLineString.getNumGeometries(); i++) { LineString line = (LineString) multiLineString.getGeometryN(i); lines.add(removeDuplicateCoordinates(line, tolerance)); } return FACTORY.createMultiLineString(GeometryFactory.toLineStringArray(lines)); }
[ "public", "static", "MultiLineString", "removeDuplicateCoordinates", "(", "MultiLineString", "multiLineString", ",", "double", "tolerance", ")", "throws", "SQLException", "{", "ArrayList", "<", "LineString", ">", "lines", "=", "new", "ArrayList", "<", "LineString", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "multiLineString", ".", "getNumGeometries", "(", ")", ";", "i", "++", ")", "{", "LineString", "line", "=", "(", "LineString", ")", "multiLineString", ".", "getGeometryN", "(", "i", ")", ";", "lines", ".", "add", "(", "removeDuplicateCoordinates", "(", "line", ",", "tolerance", ")", ")", ";", "}", "return", "FACTORY", ".", "createMultiLineString", "(", "GeometryFactory", ".", "toLineStringArray", "(", "lines", ")", ")", ";", "}" ]
Removes duplicated coordinates in a MultiLineString. @param multiLineString @param tolerance to delete the coordinates @return
[ "Removes", "duplicated", "coordinates", "in", "a", "MultiLineString", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_RemoveRepeatedPoints.java#L140-L147
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/LinkedList.java
LinkedList.set
public E set(int index, E element) { """ Replaces the element at the specified position in this list with the specified element. @param index index of the element to replace @param element element to be stored at the specified position @return the element previously at the specified position @throws IndexOutOfBoundsException {@inheritDoc} """ checkElementIndex(index); Node<E> x = node(index); E oldVal = x.item; x.item = element; return oldVal; }
java
public E set(int index, E element) { checkElementIndex(index); Node<E> x = node(index); E oldVal = x.item; x.item = element; return oldVal; }
[ "public", "E", "set", "(", "int", "index", ",", "E", "element", ")", "{", "checkElementIndex", "(", "index", ")", ";", "Node", "<", "E", ">", "x", "=", "node", "(", "index", ")", ";", "E", "oldVal", "=", "x", ".", "item", ";", "x", ".", "item", "=", "element", ";", "return", "oldVal", ";", "}" ]
Replaces the element at the specified position in this list with the specified element. @param index index of the element to replace @param element element to be stored at the specified position @return the element previously at the specified position @throws IndexOutOfBoundsException {@inheritDoc}
[ "Replaces", "the", "element", "at", "the", "specified", "position", "in", "this", "list", "with", "the", "specified", "element", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/LinkedList.java#L491-L497
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/ReidSolomonCodes.java
ReidSolomonCodes.findErrorLocatorPolynomial
void findErrorLocatorPolynomial( int messageLength , GrowQueue_I32 errorLocations , GrowQueue_I8 errorLocator ) { """ Compute the error locator polynomial when given the error locations in the message. @param messageLength (Input) Length of the message @param errorLocations (Input) List of error locations in the byte @param errorLocator (Output) Error locator polynomial. Coefficients are large to small. """ tmp1.resize(2); tmp1.data[1] = 1; errorLocator.resize(1); errorLocator.data[0] = 1; for (int i = 0; i < errorLocations.size; i++) { // Convert from positions in the message to coefficient degrees int where = messageLength - errorLocations.get(i) - 1; // tmp1 = [2**w,1] tmp1.data[0] = (byte)math.power(2,where); // tmp1.data[1] = 1; tmp0.setTo(errorLocator); math.polyMult(tmp0,tmp1,errorLocator); } }
java
void findErrorLocatorPolynomial( int messageLength , GrowQueue_I32 errorLocations , GrowQueue_I8 errorLocator ) { tmp1.resize(2); tmp1.data[1] = 1; errorLocator.resize(1); errorLocator.data[0] = 1; for (int i = 0; i < errorLocations.size; i++) { // Convert from positions in the message to coefficient degrees int where = messageLength - errorLocations.get(i) - 1; // tmp1 = [2**w,1] tmp1.data[0] = (byte)math.power(2,where); // tmp1.data[1] = 1; tmp0.setTo(errorLocator); math.polyMult(tmp0,tmp1,errorLocator); } }
[ "void", "findErrorLocatorPolynomial", "(", "int", "messageLength", ",", "GrowQueue_I32", "errorLocations", ",", "GrowQueue_I8", "errorLocator", ")", "{", "tmp1", ".", "resize", "(", "2", ")", ";", "tmp1", ".", "data", "[", "1", "]", "=", "1", ";", "errorLocator", ".", "resize", "(", "1", ")", ";", "errorLocator", ".", "data", "[", "0", "]", "=", "1", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "errorLocations", ".", "size", ";", "i", "++", ")", "{", "// Convert from positions in the message to coefficient degrees", "int", "where", "=", "messageLength", "-", "errorLocations", ".", "get", "(", "i", ")", "-", "1", ";", "// tmp1 = [2**w,1]", "tmp1", ".", "data", "[", "0", "]", "=", "(", "byte", ")", "math", ".", "power", "(", "2", ",", "where", ")", ";", "//\t\t\ttmp1.data[1] = 1;", "tmp0", ".", "setTo", "(", "errorLocator", ")", ";", "math", ".", "polyMult", "(", "tmp0", ",", "tmp1", ",", "errorLocator", ")", ";", "}", "}" ]
Compute the error locator polynomial when given the error locations in the message. @param messageLength (Input) Length of the message @param errorLocations (Input) List of error locations in the byte @param errorLocator (Output) Error locator polynomial. Coefficients are large to small.
[ "Compute", "the", "error", "locator", "polynomial", "when", "given", "the", "error", "locations", "in", "the", "message", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/ReidSolomonCodes.java#L186-L202
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java
TrainingsImpl.deletePredictionAsync
public Observable<Void> deletePredictionAsync(UUID projectId, List<String> ids) { """ Delete a set of predicted images and their associated prediction results. @param projectId The project id @param ids The prediction ids. Limited to 64 @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful. """ return deletePredictionWithServiceResponseAsync(projectId, ids).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> deletePredictionAsync(UUID projectId, List<String> ids) { return deletePredictionWithServiceResponseAsync(projectId, ids).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "deletePredictionAsync", "(", "UUID", "projectId", ",", "List", "<", "String", ">", "ids", ")", "{", "return", "deletePredictionWithServiceResponseAsync", "(", "projectId", ",", "ids", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Void", ">", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "call", "(", "ServiceResponse", "<", "Void", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Delete a set of predicted images and their associated prediction results. @param projectId The project id @param ids The prediction ids. Limited to 64 @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Delete", "a", "set", "of", "predicted", "images", "and", "their", "associated", "prediction", "results", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L3111-L3118
finnyb/javampd
src/main/java/org/bff/javampd/monitor/MPDConnectionMonitor.java
MPDConnectionMonitor.fireConnectionChangeEvent
protected synchronized void fireConnectionChangeEvent(boolean isConnected) { """ Sends the appropriate {@link org.bff.javampd.server.ConnectionChangeEvent} to all registered {@link ConnectionChangeListener}s. @param isConnected the connection status """ ConnectionChangeEvent cce = new ConnectionChangeEvent(this, isConnected); for (ConnectionChangeListener ccl : connectionListeners) { ccl.connectionChangeEventReceived(cce); } }
java
protected synchronized void fireConnectionChangeEvent(boolean isConnected) { ConnectionChangeEvent cce = new ConnectionChangeEvent(this, isConnected); for (ConnectionChangeListener ccl : connectionListeners) { ccl.connectionChangeEventReceived(cce); } }
[ "protected", "synchronized", "void", "fireConnectionChangeEvent", "(", "boolean", "isConnected", ")", "{", "ConnectionChangeEvent", "cce", "=", "new", "ConnectionChangeEvent", "(", "this", ",", "isConnected", ")", ";", "for", "(", "ConnectionChangeListener", "ccl", ":", "connectionListeners", ")", "{", "ccl", ".", "connectionChangeEventReceived", "(", "cce", ")", ";", "}", "}" ]
Sends the appropriate {@link org.bff.javampd.server.ConnectionChangeEvent} to all registered {@link ConnectionChangeListener}s. @param isConnected the connection status
[ "Sends", "the", "appropriate", "{", "@link", "org", ".", "bff", ".", "javampd", ".", "server", ".", "ConnectionChangeEvent", "}", "to", "all", "registered", "{", "@link", "ConnectionChangeListener", "}", "s", "." ]
train
https://github.com/finnyb/javampd/blob/186736e85fc238b4208cc9ee23373f9249376b4c/src/main/java/org/bff/javampd/monitor/MPDConnectionMonitor.java#L48-L54
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/document/json/JsonObject.java
JsonObject.getAndDecryptString
public String getAndDecryptString(String name, String providerName) throws Exception { """ Retrieves the decrypted value from the field name and casts it to {@link String}. Note: Use of the Field Level Encryption functionality provided in the com.couchbase.client.encryption namespace provided by Couchbase is subject to the Couchbase Inc. Enterprise Subscription License Agreement at https://www.couchbase.com/ESLA-11132015. @param name the name of the field. @param providerName the crypto provider name for decryption. @return the result or null if it does not exist. """ return (String) getAndDecrypt(name, providerName); }
java
public String getAndDecryptString(String name, String providerName) throws Exception { return (String) getAndDecrypt(name, providerName); }
[ "public", "String", "getAndDecryptString", "(", "String", "name", ",", "String", "providerName", ")", "throws", "Exception", "{", "return", "(", "String", ")", "getAndDecrypt", "(", "name", ",", "providerName", ")", ";", "}" ]
Retrieves the decrypted value from the field name and casts it to {@link String}. Note: Use of the Field Level Encryption functionality provided in the com.couchbase.client.encryption namespace provided by Couchbase is subject to the Couchbase Inc. Enterprise Subscription License Agreement at https://www.couchbase.com/ESLA-11132015. @param name the name of the field. @param providerName the crypto provider name for decryption. @return the result or null if it does not exist.
[ "Retrieves", "the", "decrypted", "value", "from", "the", "field", "name", "and", "casts", "it", "to", "{", "@link", "String", "}", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/document/json/JsonObject.java#L380-L382
google/closure-compiler
src/com/google/javascript/jscomp/TypeValidator.java
TypeValidator.registerMismatch
private void registerMismatch(JSType found, JSType required, JSError error) { """ Registers a type mismatch into the universe of mismatches owned by this pass. """ TypeMismatch.registerMismatch( this.mismatches, this.implicitInterfaceUses, found, required, error); }
java
private void registerMismatch(JSType found, JSType required, JSError error) { TypeMismatch.registerMismatch( this.mismatches, this.implicitInterfaceUses, found, required, error); }
[ "private", "void", "registerMismatch", "(", "JSType", "found", ",", "JSType", "required", ",", "JSError", "error", ")", "{", "TypeMismatch", ".", "registerMismatch", "(", "this", ".", "mismatches", ",", "this", ".", "implicitInterfaceUses", ",", "found", ",", "required", ",", "error", ")", ";", "}" ]
Registers a type mismatch into the universe of mismatches owned by this pass.
[ "Registers", "a", "type", "mismatch", "into", "the", "universe", "of", "mismatches", "owned", "by", "this", "pass", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeValidator.java#L1052-L1055
alkacon/opencms-core
src/org/opencms/util/CmsRequestUtil.java
CmsRequestUtil.forwardRequest
public static void forwardRequest(String target, HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { """ Forwards the response to the given target, which may contain parameters appended like for example <code>?a=b&amp;c=d</code>.<p> Please note: If possible, use <code>{@link #forwardRequest(String, Map, HttpServletRequest, HttpServletResponse)}</code> where the parameters are passed as a map, since the parsing of the parameters may introduce issues with encoding and is in general much less effective.<p> The parsing of parameters will likely fail for "large values" (e.g. full blown web forms with &lt;textarea&gt; elements etc. Use this method only if you know that the target will just contain up to 3 parameters which are relatively short and have no encoding or line break issues.<p> @param target the target to forward to (may contain parameters like <code>?a=b&amp;c=d</code>) @param req the request to forward @param res the response to forward @throws IOException in case the forwarding fails @throws ServletException in case the forwarding fails """ // clear the current parameters CmsUriSplitter uri = new CmsUriSplitter(target); Map<String, String[]> params = createParameterMap(uri.getQuery()); forwardRequest(uri.getPrefix(), params, req, res); }
java
public static void forwardRequest(String target, HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { // clear the current parameters CmsUriSplitter uri = new CmsUriSplitter(target); Map<String, String[]> params = createParameterMap(uri.getQuery()); forwardRequest(uri.getPrefix(), params, req, res); }
[ "public", "static", "void", "forwardRequest", "(", "String", "target", ",", "HttpServletRequest", "req", ",", "HttpServletResponse", "res", ")", "throws", "IOException", ",", "ServletException", "{", "// clear the current parameters", "CmsUriSplitter", "uri", "=", "new", "CmsUriSplitter", "(", "target", ")", ";", "Map", "<", "String", ",", "String", "[", "]", ">", "params", "=", "createParameterMap", "(", "uri", ".", "getQuery", "(", ")", ")", ";", "forwardRequest", "(", "uri", ".", "getPrefix", "(", ")", ",", "params", ",", "req", ",", "res", ")", ";", "}" ]
Forwards the response to the given target, which may contain parameters appended like for example <code>?a=b&amp;c=d</code>.<p> Please note: If possible, use <code>{@link #forwardRequest(String, Map, HttpServletRequest, HttpServletResponse)}</code> where the parameters are passed as a map, since the parsing of the parameters may introduce issues with encoding and is in general much less effective.<p> The parsing of parameters will likely fail for "large values" (e.g. full blown web forms with &lt;textarea&gt; elements etc. Use this method only if you know that the target will just contain up to 3 parameters which are relatively short and have no encoding or line break issues.<p> @param target the target to forward to (may contain parameters like <code>?a=b&amp;c=d</code>) @param req the request to forward @param res the response to forward @throws IOException in case the forwarding fails @throws ServletException in case the forwarding fails
[ "Forwards", "the", "response", "to", "the", "given", "target", "which", "may", "contain", "parameters", "appended", "like", "for", "example", "<code", ">", "?a", "=", "b&amp", ";", "c", "=", "d<", "/", "code", ">", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsRequestUtil.java#L454-L461
ocelotds/ocelot
ocelot-processor/src/main/java/org/ocelotds/processors/visitors/AbstractDataServiceVisitor.java
AbstractDataServiceVisitor.browseAndWriteMethods
void browseAndWriteMethods(List<ExecutableElement> methodElements, String classname, Writer writer) throws IOException { """ browse valid methods and write equivalent js methods in writer @param methodElements @param classname @param writer @return @throws IOException """ Collection<String> methodProceeds = new ArrayList<>(); boolean first = true; for (ExecutableElement methodElement : methodElements) { if (isConsiderateMethod(methodProceeds, methodElement)) { if(!first) { writer.append(COMMA).append(CR); } visitMethodElement(classname, methodElement, writer); first = false; } } }
java
void browseAndWriteMethods(List<ExecutableElement> methodElements, String classname, Writer writer) throws IOException { Collection<String> methodProceeds = new ArrayList<>(); boolean first = true; for (ExecutableElement methodElement : methodElements) { if (isConsiderateMethod(methodProceeds, methodElement)) { if(!first) { writer.append(COMMA).append(CR); } visitMethodElement(classname, methodElement, writer); first = false; } } }
[ "void", "browseAndWriteMethods", "(", "List", "<", "ExecutableElement", ">", "methodElements", ",", "String", "classname", ",", "Writer", "writer", ")", "throws", "IOException", "{", "Collection", "<", "String", ">", "methodProceeds", "=", "new", "ArrayList", "<>", "(", ")", ";", "boolean", "first", "=", "true", ";", "for", "(", "ExecutableElement", "methodElement", ":", "methodElements", ")", "{", "if", "(", "isConsiderateMethod", "(", "methodProceeds", ",", "methodElement", ")", ")", "{", "if", "(", "!", "first", ")", "{", "writer", ".", "append", "(", "COMMA", ")", ".", "append", "(", "CR", ")", ";", "}", "visitMethodElement", "(", "classname", ",", "methodElement", ",", "writer", ")", ";", "first", "=", "false", ";", "}", "}", "}" ]
browse valid methods and write equivalent js methods in writer @param methodElements @param classname @param writer @return @throws IOException
[ "browse", "valid", "methods", "and", "write", "equivalent", "js", "methods", "in", "writer" ]
train
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-processor/src/main/java/org/ocelotds/processors/visitors/AbstractDataServiceVisitor.java#L133-L145
kohsuke/args4j
args4j/src/org/kohsuke/args4j/CmdLineParser.java
CmdLineParser.printUsage
public void printUsage(Writer out, ResourceBundle rb) { """ Prints the list of all the non-hidden options and their usages to the screen. <p> Short for {@code printUsage(out,rb,OptionHandlerFilter.PUBLIC)} """ printUsage(out, rb, OptionHandlerFilter.PUBLIC); }
java
public void printUsage(Writer out, ResourceBundle rb) { printUsage(out, rb, OptionHandlerFilter.PUBLIC); }
[ "public", "void", "printUsage", "(", "Writer", "out", ",", "ResourceBundle", "rb", ")", "{", "printUsage", "(", "out", ",", "rb", ",", "OptionHandlerFilter", ".", "PUBLIC", ")", ";", "}" ]
Prints the list of all the non-hidden options and their usages to the screen. <p> Short for {@code printUsage(out,rb,OptionHandlerFilter.PUBLIC)}
[ "Prints", "the", "list", "of", "all", "the", "non", "-", "hidden", "options", "and", "their", "usages", "to", "the", "screen", "." ]
train
https://github.com/kohsuke/args4j/blob/dc2e7e265caf15a1a146e3389c1f16a8781f06cf/args4j/src/org/kohsuke/args4j/CmdLineParser.java#L272-L274
jwtk/jjwt
api/src/main/java/io/jsonwebtoken/lang/Assert.java
Assert.hasLength
public static void hasLength(String text, String message) { """ Assert that the given String is not empty; that is, it must not be <code>null</code> and not the empty String. <pre class="code">Assert.hasLength(name, "Name must not be empty");</pre> @param text the String to check @param message the exception message to use if the assertion fails @see Strings#hasLength """ if (!Strings.hasLength(text)) { throw new IllegalArgumentException(message); } }
java
public static void hasLength(String text, String message) { if (!Strings.hasLength(text)) { throw new IllegalArgumentException(message); } }
[ "public", "static", "void", "hasLength", "(", "String", "text", ",", "String", "message", ")", "{", "if", "(", "!", "Strings", ".", "hasLength", "(", "text", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "message", ")", ";", "}", "}" ]
Assert that the given String is not empty; that is, it must not be <code>null</code> and not the empty String. <pre class="code">Assert.hasLength(name, "Name must not be empty");</pre> @param text the String to check @param message the exception message to use if the assertion fails @see Strings#hasLength
[ "Assert", "that", "the", "given", "String", "is", "not", "empty", ";", "that", "is", "it", "must", "not", "be", "<code", ">", "null<", "/", "code", ">", "and", "not", "the", "empty", "String", ".", "<pre", "class", "=", "code", ">", "Assert", ".", "hasLength", "(", "name", "Name", "must", "not", "be", "empty", ")", ";", "<", "/", "pre", ">" ]
train
https://github.com/jwtk/jjwt/blob/86b6096946752cffcfbc9b0a5503f1ea195cc140/api/src/main/java/io/jsonwebtoken/lang/Assert.java#L104-L108
Jasig/uPortal
uPortal-api/uPortal-api-internal/src/main/java/org/apereo/portal/portlets/groupadmin/GroupFormValidator.java
GroupFormValidator.validateEditDetails
public void validateEditDetails(GroupForm group, MessageContext context) { """ Validate the detail editing group view @param group @param context """ // ensure the group name is set if (StringUtils.isBlank(group.getName())) { context.addMessage( new MessageBuilder().error().source("name").code("please.enter.name").build()); } }
java
public void validateEditDetails(GroupForm group, MessageContext context) { // ensure the group name is set if (StringUtils.isBlank(group.getName())) { context.addMessage( new MessageBuilder().error().source("name").code("please.enter.name").build()); } }
[ "public", "void", "validateEditDetails", "(", "GroupForm", "group", ",", "MessageContext", "context", ")", "{", "// ensure the group name is set", "if", "(", "StringUtils", ".", "isBlank", "(", "group", ".", "getName", "(", ")", ")", ")", "{", "context", ".", "addMessage", "(", "new", "MessageBuilder", "(", ")", ".", "error", "(", ")", ".", "source", "(", "\"name\"", ")", ".", "code", "(", "\"please.enter.name\"", ")", ".", "build", "(", ")", ")", ";", "}", "}" ]
Validate the detail editing group view @param group @param context
[ "Validate", "the", "detail", "editing", "group", "view" ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-api/uPortal-api-internal/src/main/java/org/apereo/portal/portlets/groupadmin/GroupFormValidator.java#L30-L37
likethecolor/Alchemy-API
src/main/java/com/likethecolor/alchemy/api/parser/json/AbstractParser.java
AbstractParser.getString
protected String getString(final String key, final JSONObject jsonObject) { """ Check to make sure the JSONObject has the specified key and if so return the value as a string. If no key is found "" is returned. @param key name of the field to fetch from the json object @param jsonObject object from which to fetch the value @return string value corresponding to the key or null if key not found """ String value = null; if(hasKey(key, jsonObject)) { try { value = jsonObject.getString(key); } catch(JSONException e) { LOGGER.error("Could not get String from JSONObject for key: " + key, e); } } return value; }
java
protected String getString(final String key, final JSONObject jsonObject) { String value = null; if(hasKey(key, jsonObject)) { try { value = jsonObject.getString(key); } catch(JSONException e) { LOGGER.error("Could not get String from JSONObject for key: " + key, e); } } return value; }
[ "protected", "String", "getString", "(", "final", "String", "key", ",", "final", "JSONObject", "jsonObject", ")", "{", "String", "value", "=", "null", ";", "if", "(", "hasKey", "(", "key", ",", "jsonObject", ")", ")", "{", "try", "{", "value", "=", "jsonObject", ".", "getString", "(", "key", ")", ";", "}", "catch", "(", "JSONException", "e", ")", "{", "LOGGER", ".", "error", "(", "\"Could not get String from JSONObject for key: \"", "+", "key", ",", "e", ")", ";", "}", "}", "return", "value", ";", "}" ]
Check to make sure the JSONObject has the specified key and if so return the value as a string. If no key is found "" is returned. @param key name of the field to fetch from the json object @param jsonObject object from which to fetch the value @return string value corresponding to the key or null if key not found
[ "Check", "to", "make", "sure", "the", "JSONObject", "has", "the", "specified", "key", "and", "if", "so", "return", "the", "value", "as", "a", "string", ".", "If", "no", "key", "is", "found", "is", "returned", "." ]
train
https://github.com/likethecolor/Alchemy-API/blob/5208cfc92a878ceeaff052787af29da92d98db7e/src/main/java/com/likethecolor/alchemy/api/parser/json/AbstractParser.java#L208-L219
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/AbstractBaseParams.java
AbstractBaseParams.readDouble
protected double readDouble(final String doubleString, final double min, final double max) { """ Read a double string value. @param doubleString the double value @param min the minimum value allowed @param max the maximum value allowed @return the value parsed according to its range """ return Math.max(Math.min(Double.parseDouble(doubleString), max), min); }
java
protected double readDouble(final String doubleString, final double min, final double max) { return Math.max(Math.min(Double.parseDouble(doubleString), max), min); }
[ "protected", "double", "readDouble", "(", "final", "String", "doubleString", ",", "final", "double", "min", ",", "final", "double", "max", ")", "{", "return", "Math", ".", "max", "(", "Math", ".", "min", "(", "Double", ".", "parseDouble", "(", "doubleString", ")", ",", "max", ")", ",", "min", ")", ";", "}" ]
Read a double string value. @param doubleString the double value @param min the minimum value allowed @param max the maximum value allowed @return the value parsed according to its range
[ "Read", "a", "double", "string", "value", "." ]
train
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/AbstractBaseParams.java#L153-L155
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.document_id_PUT
public void document_id_PUT(String id, OvhDocument body) throws IOException { """ Alter this object properties REST: PUT /me/document/{id} @param body [required] New object properties @param id [required] Document id """ String qPath = "/me/document/{id}"; StringBuilder sb = path(qPath, id); exec(qPath, "PUT", sb.toString(), body); }
java
public void document_id_PUT(String id, OvhDocument body) throws IOException { String qPath = "/me/document/{id}"; StringBuilder sb = path(qPath, id); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "document_id_PUT", "(", "String", "id", ",", "OvhDocument", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/document/{id}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "id", ")", ";", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "body", ")", ";", "}" ]
Alter this object properties REST: PUT /me/document/{id} @param body [required] New object properties @param id [required] Document id
[ "Alter", "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#L2559-L2563
SimiaCryptus/utilities
java-util/src/main/java/com/simiacryptus/text/CompressionUtil.java
CompressionUtil.decodeBZ
public static String decodeBZ(byte[] data, String dictionary) { """ Decode bz string. @param data the data @param dictionary the dictionary @return the string """ try { byte[] dictBytes = dictionary.getBytes("UTF-8"); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); VCDiffDecoderBuilder.builder().buildSimple().decode(dictBytes, decodeBZRaw(data), buffer); return new String(buffer.toByteArray(), "UTF-8"); } catch (Exception e) { throw new RuntimeException(e); } }
java
public static String decodeBZ(byte[] data, String dictionary) { try { byte[] dictBytes = dictionary.getBytes("UTF-8"); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); VCDiffDecoderBuilder.builder().buildSimple().decode(dictBytes, decodeBZRaw(data), buffer); return new String(buffer.toByteArray(), "UTF-8"); } catch (Exception e) { throw new RuntimeException(e); } }
[ "public", "static", "String", "decodeBZ", "(", "byte", "[", "]", "data", ",", "String", "dictionary", ")", "{", "try", "{", "byte", "[", "]", "dictBytes", "=", "dictionary", ".", "getBytes", "(", "\"UTF-8\"", ")", ";", "ByteArrayOutputStream", "buffer", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "VCDiffDecoderBuilder", ".", "builder", "(", ")", ".", "buildSimple", "(", ")", ".", "decode", "(", "dictBytes", ",", "decodeBZRaw", "(", "data", ")", ",", "buffer", ")", ";", "return", "new", "String", "(", "buffer", ".", "toByteArray", "(", ")", ",", "\"UTF-8\"", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
Decode bz string. @param data the data @param dictionary the dictionary @return the string
[ "Decode", "bz", "string", "." ]
train
https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/text/CompressionUtil.java#L248-L257
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/File.java
File.createTempFile
public static File createTempFile(String prefix, String suffix, File directory) throws IOException { """ Creates an empty temporary file in the given directory using the given prefix and suffix as part of the file name. If {@code suffix} is null, {@code .tmp} is used. <p>Note that this method does <i>not</i> call {@link #deleteOnExit}, but see the documentation for that method before you call it manually. @param prefix the prefix to the temp file name. @param suffix the suffix to the temp file name. @param directory the location to which the temp file is to be written, or {@code null} for the default location for temporary files, which is taken from the "java.io.tmpdir" system property. It may be necessary to set this property to an existing, writable directory for this method to work properly. @return the temporary file. @throws IllegalArgumentException if the length of {@code prefix} is less than 3. @throws IOException if an error occurs when writing the file. """ // Force a prefix null check first if (prefix.length() < 3) { throw new IllegalArgumentException("prefix must be at least 3 characters"); } if (suffix == null) { suffix = ".tmp"; } File tmpDirFile = directory; if (tmpDirFile == null) { String tmpDir = System.getProperty("java.io.tmpdir", "."); tmpDirFile = new File(tmpDir); } File result; do { result = new File(tmpDirFile, prefix + tempFileRandom.nextInt() + suffix); } while (!result.createNewFile()); return result; }
java
public static File createTempFile(String prefix, String suffix, File directory) throws IOException { // Force a prefix null check first if (prefix.length() < 3) { throw new IllegalArgumentException("prefix must be at least 3 characters"); } if (suffix == null) { suffix = ".tmp"; } File tmpDirFile = directory; if (tmpDirFile == null) { String tmpDir = System.getProperty("java.io.tmpdir", "."); tmpDirFile = new File(tmpDir); } File result; do { result = new File(tmpDirFile, prefix + tempFileRandom.nextInt() + suffix); } while (!result.createNewFile()); return result; }
[ "public", "static", "File", "createTempFile", "(", "String", "prefix", ",", "String", "suffix", ",", "File", "directory", ")", "throws", "IOException", "{", "// Force a prefix null check first", "if", "(", "prefix", ".", "length", "(", ")", "<", "3", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"prefix must be at least 3 characters\"", ")", ";", "}", "if", "(", "suffix", "==", "null", ")", "{", "suffix", "=", "\".tmp\"", ";", "}", "File", "tmpDirFile", "=", "directory", ";", "if", "(", "tmpDirFile", "==", "null", ")", "{", "String", "tmpDir", "=", "System", ".", "getProperty", "(", "\"java.io.tmpdir\"", ",", "\".\"", ")", ";", "tmpDirFile", "=", "new", "File", "(", "tmpDir", ")", ";", "}", "File", "result", ";", "do", "{", "result", "=", "new", "File", "(", "tmpDirFile", ",", "prefix", "+", "tempFileRandom", ".", "nextInt", "(", ")", "+", "suffix", ")", ";", "}", "while", "(", "!", "result", ".", "createNewFile", "(", ")", ")", ";", "return", "result", ";", "}" ]
Creates an empty temporary file in the given directory using the given prefix and suffix as part of the file name. If {@code suffix} is null, {@code .tmp} is used. <p>Note that this method does <i>not</i> call {@link #deleteOnExit}, but see the documentation for that method before you call it manually. @param prefix the prefix to the temp file name. @param suffix the suffix to the temp file name. @param directory the location to which the temp file is to be written, or {@code null} for the default location for temporary files, which is taken from the "java.io.tmpdir" system property. It may be necessary to set this property to an existing, writable directory for this method to work properly. @return the temporary file. @throws IllegalArgumentException if the length of {@code prefix} is less than 3. @throws IOException if an error occurs when writing the file.
[ "Creates", "an", "empty", "temporary", "file", "in", "the", "given", "directory", "using", "the", "given", "prefix", "and", "suffix", "as", "part", "of", "the", "file", "name", ".", "If", "{", "@code", "suffix", "}", "is", "null", "{", "@code", ".", "tmp", "}", "is", "used", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/File.java#L1088-L1107
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/CmsListItemWidget.java
CmsListItemWidget.setIcon
public void setIcon(String iconClasses, String detailIconClasses) { """ Sets the icon for this item using the given CSS classes.<p> @param iconClasses the CSS classes @param detailIconClasses the detail type icon classes if available """ m_iconPanel.setVisible(true); HTML iconWidget = new HTML(); m_iconPanel.setWidget(iconWidget); iconWidget.setStyleName(iconClasses + " " + m_fixedIconClasses); // render the detail icon as an overlay above the main icon, if required if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(detailIconClasses)) { iconWidget.setHTML( "<span class=\"" + detailIconClasses + " " + I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().pageDetailType() + "\"></span>"); } }
java
public void setIcon(String iconClasses, String detailIconClasses) { m_iconPanel.setVisible(true); HTML iconWidget = new HTML(); m_iconPanel.setWidget(iconWidget); iconWidget.setStyleName(iconClasses + " " + m_fixedIconClasses); // render the detail icon as an overlay above the main icon, if required if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(detailIconClasses)) { iconWidget.setHTML( "<span class=\"" + detailIconClasses + " " + I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().pageDetailType() + "\"></span>"); } }
[ "public", "void", "setIcon", "(", "String", "iconClasses", ",", "String", "detailIconClasses", ")", "{", "m_iconPanel", ".", "setVisible", "(", "true", ")", ";", "HTML", "iconWidget", "=", "new", "HTML", "(", ")", ";", "m_iconPanel", ".", "setWidget", "(", "iconWidget", ")", ";", "iconWidget", ".", "setStyleName", "(", "iconClasses", "+", "\" \"", "+", "m_fixedIconClasses", ")", ";", "// render the detail icon as an overlay above the main icon, if required", "if", "(", "CmsStringUtil", ".", "isNotEmptyOrWhitespaceOnly", "(", "detailIconClasses", ")", ")", "{", "iconWidget", ".", "setHTML", "(", "\"<span class=\\\"\"", "+", "detailIconClasses", "+", "\" \"", "+", "I_CmsLayoutBundle", ".", "INSTANCE", ".", "listItemWidgetCss", "(", ")", ".", "pageDetailType", "(", ")", "+", "\"\\\"></span>\"", ")", ";", "}", "}" ]
Sets the icon for this item using the given CSS classes.<p> @param iconClasses the CSS classes @param detailIconClasses the detail type icon classes if available
[ "Sets", "the", "icon", "for", "this", "item", "using", "the", "given", "CSS", "classes", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsListItemWidget.java#L744-L759
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_bluecatvpx_image.java
xen_bluecatvpx_image.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { """ <pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre> """ xen_bluecatvpx_image_responses result = (xen_bluecatvpx_image_responses) service.get_payload_formatter().string_to_resource(xen_bluecatvpx_image_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.xen_bluecatvpx_image_response_array); } xen_bluecatvpx_image[] result_xen_bluecatvpx_image = new xen_bluecatvpx_image[result.xen_bluecatvpx_image_response_array.length]; for(int i = 0; i < result.xen_bluecatvpx_image_response_array.length; i++) { result_xen_bluecatvpx_image[i] = result.xen_bluecatvpx_image_response_array[i].xen_bluecatvpx_image[0]; } return result_xen_bluecatvpx_image; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { xen_bluecatvpx_image_responses result = (xen_bluecatvpx_image_responses) service.get_payload_formatter().string_to_resource(xen_bluecatvpx_image_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.xen_bluecatvpx_image_response_array); } xen_bluecatvpx_image[] result_xen_bluecatvpx_image = new xen_bluecatvpx_image[result.xen_bluecatvpx_image_response_array.length]; for(int i = 0; i < result.xen_bluecatvpx_image_response_array.length; i++) { result_xen_bluecatvpx_image[i] = result.xen_bluecatvpx_image_response_array[i].xen_bluecatvpx_image[0]; } return result_xen_bluecatvpx_image; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "xen_bluecatvpx_image_responses", "result", "=", "(", "xen_bluecatvpx_image_responses", ")", "service", ".", "get_payload_formatter", "(", ")", ".", "string_to_resource", "(", "xen_bluecatvpx_image_responses", ".", "class", ",", "response", ")", ";", "if", "(", "result", ".", "errorcode", "!=", "0", ")", "{", "if", "(", "result", ".", "errorcode", "==", "SESSION_NOT_EXISTS", ")", "service", ".", "clear_session", "(", ")", ";", "throw", "new", "nitro_exception", "(", "result", ".", "message", ",", "result", ".", "errorcode", ",", "(", "base_response", "[", "]", ")", "result", ".", "xen_bluecatvpx_image_response_array", ")", ";", "}", "xen_bluecatvpx_image", "[", "]", "result_xen_bluecatvpx_image", "=", "new", "xen_bluecatvpx_image", "[", "result", ".", "xen_bluecatvpx_image_response_array", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "result", ".", "xen_bluecatvpx_image_response_array", ".", "length", ";", "i", "++", ")", "{", "result_xen_bluecatvpx_image", "[", "i", "]", "=", "result", ".", "xen_bluecatvpx_image_response_array", "[", "i", "]", ".", "xen_bluecatvpx_image", "[", "0", "]", ";", "}", "return", "result_xen_bluecatvpx_image", ";", "}" ]
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_bluecatvpx_image.java#L264-L281
js-lib-com/commons
src/main/java/js/util/Strings.java
Strings.save
public static void save(CharSequence chars, File file) throws IOException { """ Create target file and copy characters into. Copy destination should be a file and this method throws access denied if attempt to write to a directory. This method creates target file if it does not already exist. If target file does exist it will be overwritten and old content lost. If given <code>chars</code> parameter is null or empty this method does nothing. <p> Note that this method takes care to create file parent directories. @param chars source characters sequence, @param file target file. @throws FileNotFoundException if <code>target</code> file does not exist and cannot be created. @throws IOException if copy operation fails, including if <code>target</code> is a directory. """ save(chars, new FileWriter(Files.mkdirs(file))); }
java
public static void save(CharSequence chars, File file) throws IOException { save(chars, new FileWriter(Files.mkdirs(file))); }
[ "public", "static", "void", "save", "(", "CharSequence", "chars", ",", "File", "file", ")", "throws", "IOException", "{", "save", "(", "chars", ",", "new", "FileWriter", "(", "Files", ".", "mkdirs", "(", "file", ")", ")", ")", ";", "}" ]
Create target file and copy characters into. Copy destination should be a file and this method throws access denied if attempt to write to a directory. This method creates target file if it does not already exist. If target file does exist it will be overwritten and old content lost. If given <code>chars</code> parameter is null or empty this method does nothing. <p> Note that this method takes care to create file parent directories. @param chars source characters sequence, @param file target file. @throws FileNotFoundException if <code>target</code> file does not exist and cannot be created. @throws IOException if copy operation fails, including if <code>target</code> is a directory.
[ "Create", "target", "file", "and", "copy", "characters", "into", ".", "Copy", "destination", "should", "be", "a", "file", "and", "this", "method", "throws", "access", "denied", "if", "attempt", "to", "write", "to", "a", "directory", ".", "This", "method", "creates", "target", "file", "if", "it", "does", "not", "already", "exist", ".", "If", "target", "file", "does", "exist", "it", "will", "be", "overwritten", "and", "old", "content", "lost", ".", "If", "given", "<code", ">", "chars<", "/", "code", ">", "parameter", "is", "null", "or", "empty", "this", "method", "does", "nothing", ".", "<p", ">", "Note", "that", "this", "method", "takes", "care", "to", "create", "file", "parent", "directories", "." ]
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Strings.java#L1496-L1499
stephanenicolas/robospice
robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/request/notifier/SpiceServiceListenerNotifier.java
SpiceServiceListenerNotifier.notifyObserversOfRequestProcessed
public void notifyObserversOfRequestProcessed(CachedSpiceRequest<?> request, Set<RequestListener<?>> requestListeners) { """ Notify interested observers of request completion. @param request the request that has completed. @param requestListeners the listeners to notify. """ RequestProcessingContext requestProcessingContext = new RequestProcessingContext(); requestProcessingContext.setExecutionThread(Thread.currentThread()); requestProcessingContext.setRequestListeners(requestListeners); post(new RequestProcessedNotifier(request, spiceServiceListenerList, requestProcessingContext)); }
java
public void notifyObserversOfRequestProcessed(CachedSpiceRequest<?> request, Set<RequestListener<?>> requestListeners) { RequestProcessingContext requestProcessingContext = new RequestProcessingContext(); requestProcessingContext.setExecutionThread(Thread.currentThread()); requestProcessingContext.setRequestListeners(requestListeners); post(new RequestProcessedNotifier(request, spiceServiceListenerList, requestProcessingContext)); }
[ "public", "void", "notifyObserversOfRequestProcessed", "(", "CachedSpiceRequest", "<", "?", ">", "request", ",", "Set", "<", "RequestListener", "<", "?", ">", ">", "requestListeners", ")", "{", "RequestProcessingContext", "requestProcessingContext", "=", "new", "RequestProcessingContext", "(", ")", ";", "requestProcessingContext", ".", "setExecutionThread", "(", "Thread", ".", "currentThread", "(", ")", ")", ";", "requestProcessingContext", ".", "setRequestListeners", "(", "requestListeners", ")", ";", "post", "(", "new", "RequestProcessedNotifier", "(", "request", ",", "spiceServiceListenerList", ",", "requestProcessingContext", ")", ")", ";", "}" ]
Notify interested observers of request completion. @param request the request that has completed. @param requestListeners the listeners to notify.
[ "Notify", "interested", "observers", "of", "request", "completion", "." ]
train
https://github.com/stephanenicolas/robospice/blob/8bffde88b3534a961a13cab72a8f07a755f0a0fe/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/request/notifier/SpiceServiceListenerNotifier.java#L134-L139
jnr/jnr-x86asm
src/main/java/jnr/x86asm/Asm.java
Asm.mmword_ptr_abs
public static final Mem mmword_ptr_abs(long target, long disp, SEGMENT segmentPrefix) { """ Create mmword (8 bytes) pointer operand ! ! @note This constructor is provided only for convenience for mmx programming. """ return _ptr_build_abs(target, disp, segmentPrefix, SIZE_QWORD); }
java
public static final Mem mmword_ptr_abs(long target, long disp, SEGMENT segmentPrefix) { return _ptr_build_abs(target, disp, segmentPrefix, SIZE_QWORD); }
[ "public", "static", "final", "Mem", "mmword_ptr_abs", "(", "long", "target", ",", "long", "disp", ",", "SEGMENT", "segmentPrefix", ")", "{", "return", "_ptr_build_abs", "(", "target", ",", "disp", ",", "segmentPrefix", ",", "SIZE_QWORD", ")", ";", "}" ]
Create mmword (8 bytes) pointer operand ! ! @note This constructor is provided only for convenience for mmx programming.
[ "Create", "mmword", "(", "8", "bytes", ")", "pointer", "operand", "!", "!" ]
train
https://github.com/jnr/jnr-x86asm/blob/fdcf68fb3dae49e607a49e33399e3dad1ada5536/src/main/java/jnr/x86asm/Asm.java#L433-L435
zaproxy/zaproxy
src/org/zaproxy/zap/utils/ClassLoaderUtil.java
ClassLoaderUtil.addURL
public static void addURL(URL u) throws IOException { """ Add URL to CLASSPATH @param u URL @throws IOException IOException """ if (!(ClassLoader.getSystemClassLoader() instanceof URLClassLoader)) { return; } URLClassLoader sysLoader = (URLClassLoader) ClassLoader.getSystemClassLoader(); URL[] urls = sysLoader.getURLs(); for (int i = 0; i < urls.length; i++) { if (StringUtils.equalsIgnoreCase(urls[i].toString(), u.toString())) { if (log.isDebugEnabled()) { log.debug("URL " + u + " is already in the CLASSPATH"); } return; } } Class<URLClassLoader> sysclass = URLClassLoader.class; try { Method method = sysclass.getDeclaredMethod("addURL", parameters); method.setAccessible(true); method.invoke(sysLoader, new Object[]{u}); } catch (Throwable t) { t.printStackTrace(); throw new IOException("Error, could not add URL to system classloader"); } }
java
public static void addURL(URL u) throws IOException { if (!(ClassLoader.getSystemClassLoader() instanceof URLClassLoader)) { return; } URLClassLoader sysLoader = (URLClassLoader) ClassLoader.getSystemClassLoader(); URL[] urls = sysLoader.getURLs(); for (int i = 0; i < urls.length; i++) { if (StringUtils.equalsIgnoreCase(urls[i].toString(), u.toString())) { if (log.isDebugEnabled()) { log.debug("URL " + u + " is already in the CLASSPATH"); } return; } } Class<URLClassLoader> sysclass = URLClassLoader.class; try { Method method = sysclass.getDeclaredMethod("addURL", parameters); method.setAccessible(true); method.invoke(sysLoader, new Object[]{u}); } catch (Throwable t) { t.printStackTrace(); throw new IOException("Error, could not add URL to system classloader"); } }
[ "public", "static", "void", "addURL", "(", "URL", "u", ")", "throws", "IOException", "{", "if", "(", "!", "(", "ClassLoader", ".", "getSystemClassLoader", "(", ")", "instanceof", "URLClassLoader", ")", ")", "{", "return", ";", "}", "URLClassLoader", "sysLoader", "=", "(", "URLClassLoader", ")", "ClassLoader", ".", "getSystemClassLoader", "(", ")", ";", "URL", "[", "]", "urls", "=", "sysLoader", ".", "getURLs", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "urls", ".", "length", ";", "i", "++", ")", "{", "if", "(", "StringUtils", ".", "equalsIgnoreCase", "(", "urls", "[", "i", "]", ".", "toString", "(", ")", ",", "u", ".", "toString", "(", ")", ")", ")", "{", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "log", ".", "debug", "(", "\"URL \"", "+", "u", "+", "\" is already in the CLASSPATH\"", ")", ";", "}", "return", ";", "}", "}", "Class", "<", "URLClassLoader", ">", "sysclass", "=", "URLClassLoader", ".", "class", ";", "try", "{", "Method", "method", "=", "sysclass", ".", "getDeclaredMethod", "(", "\"addURL\"", ",", "parameters", ")", ";", "method", ".", "setAccessible", "(", "true", ")", ";", "method", ".", "invoke", "(", "sysLoader", ",", "new", "Object", "[", "]", "{", "u", "}", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "t", ".", "printStackTrace", "(", ")", ";", "throw", "new", "IOException", "(", "\"Error, could not add URL to system classloader\"", ")", ";", "}", "}" ]
Add URL to CLASSPATH @param u URL @throws IOException IOException
[ "Add", "URL", "to", "CLASSPATH" ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/utils/ClassLoaderUtil.java#L51-L75
amaembo/streamex
src/main/java/one/util/streamex/LongStreamEx.java
LongStreamEx.chain
@Override public <U> U chain(Function<? super LongStreamEx, U> mapper) { """ does not add overhead as it appears in bytecode anyways as bridge method """ return mapper.apply(this); }
java
@Override public <U> U chain(Function<? super LongStreamEx, U> mapper) { return mapper.apply(this); }
[ "@", "Override", "public", "<", "U", ">", "U", "chain", "(", "Function", "<", "?", "super", "LongStreamEx", ",", "U", ">", "mapper", ")", "{", "return", "mapper", ".", "apply", "(", "this", ")", ";", "}" ]
does not add overhead as it appears in bytecode anyways as bridge method
[ "does", "not", "add", "overhead", "as", "it", "appears", "in", "bytecode", "anyways", "as", "bridge", "method" ]
train
https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/LongStreamEx.java#L1535-L1538
algolia/instantsearch-android
ui/src/main/java/com/algolia/instantsearch/ui/databinding/RenderingHelper.java
RenderingHelper.addHighlight
Integer addHighlight(@NonNull View view, @NonNull String attribute, @ColorInt int colorId) { """ Enables highlighting for this view/attribute pair. @param attribute the attribute to color. @param colorId a {@link ColorInt} to associate with this attribute. @return the previous color associated with this attribute or {@code null} if there was none. """ final Pair<Integer, String> pair = new Pair<>(view.getId(), attribute); highlightedAttributes.add(pair); return attributeColors.put(pair, colorId); }
java
Integer addHighlight(@NonNull View view, @NonNull String attribute, @ColorInt int colorId) { final Pair<Integer, String> pair = new Pair<>(view.getId(), attribute); highlightedAttributes.add(pair); return attributeColors.put(pair, colorId); }
[ "Integer", "addHighlight", "(", "@", "NonNull", "View", "view", ",", "@", "NonNull", "String", "attribute", ",", "@", "ColorInt", "int", "colorId", ")", "{", "final", "Pair", "<", "Integer", ",", "String", ">", "pair", "=", "new", "Pair", "<>", "(", "view", ".", "getId", "(", ")", ",", "attribute", ")", ";", "highlightedAttributes", ".", "add", "(", "pair", ")", ";", "return", "attributeColors", ".", "put", "(", "pair", ",", "colorId", ")", ";", "}" ]
Enables highlighting for this view/attribute pair. @param attribute the attribute to color. @param colorId a {@link ColorInt} to associate with this attribute. @return the previous color associated with this attribute or {@code null} if there was none.
[ "Enables", "highlighting", "for", "this", "view", "/", "attribute", "pair", "." ]
train
https://github.com/algolia/instantsearch-android/blob/12092ec30140df9ffc2bf916339b433372034616/ui/src/main/java/com/algolia/instantsearch/ui/databinding/RenderingHelper.java#L108-L112
UrielCh/ovh-java-sdk
ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java
ApiOvhXdsl.serviceName_modem_duplicatePortMappingConfig_POST
public void serviceName_modem_duplicatePortMappingConfig_POST(String serviceName, String accessName) throws IOException { """ Remove all the current port mapping rules and set the same config as the access given in parameters REST: POST /xdsl/{serviceName}/modem/duplicatePortMappingConfig @param accessName [required] The access name with the config you want to duplicate @param serviceName [required] The internal name of your XDSL offer @deprecated """ String qPath = "/xdsl/{serviceName}/modem/duplicatePortMappingConfig"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "accessName", accessName); exec(qPath, "POST", sb.toString(), o); }
java
public void serviceName_modem_duplicatePortMappingConfig_POST(String serviceName, String accessName) throws IOException { String qPath = "/xdsl/{serviceName}/modem/duplicatePortMappingConfig"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "accessName", accessName); exec(qPath, "POST", sb.toString(), o); }
[ "public", "void", "serviceName_modem_duplicatePortMappingConfig_POST", "(", "String", "serviceName", ",", "String", "accessName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/xdsl/{serviceName}/modem/duplicatePortMappingConfig\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"accessName\"", ",", "accessName", ")", ";", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "}" ]
Remove all the current port mapping rules and set the same config as the access given in parameters REST: POST /xdsl/{serviceName}/modem/duplicatePortMappingConfig @param accessName [required] The access name with the config you want to duplicate @param serviceName [required] The internal name of your XDSL offer @deprecated
[ "Remove", "all", "the", "current", "port", "mapping", "rules", "and", "set", "the", "same", "config", "as", "the", "access", "given", "in", "parameters" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L687-L693
zaproxy/zaproxy
src/org/zaproxy/zap/model/VulnerabilitiesLoader.java
VulnerabilitiesLoader.getListOfVulnerabilitiesFiles
List<String> getListOfVulnerabilitiesFiles() { """ Returns a {@code List} of resources files with {@code fileName} and {@code fileExtension} contained in the {@code directory}. @return the list of resources files contained in the {@code directory} @see LocaleUtils#createResourceFilesPattern(String, String) """ if (!Files.exists(directory)) { logger.debug("Skipping read of vulnerabilities, the directory does not exist: " + directory.toAbsolutePath()); return Collections.emptyList(); } final Pattern filePattern = LocaleUtils.createResourceFilesPattern(fileName, fileExtension); final List<String> fileNames = new ArrayList<>(); try { Files.walkFileTree(directory, Collections.<FileVisitOption> emptySet(), 1, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { String fileName = file.getFileName().toString(); if (filePattern.matcher(fileName).matches()) { fileNames.add(fileName); } return FileVisitResult.CONTINUE; } }); } catch (IOException e) { logger.error("An error occurred while walking directory: " + directory, e); } return fileNames; }
java
List<String> getListOfVulnerabilitiesFiles() { if (!Files.exists(directory)) { logger.debug("Skipping read of vulnerabilities, the directory does not exist: " + directory.toAbsolutePath()); return Collections.emptyList(); } final Pattern filePattern = LocaleUtils.createResourceFilesPattern(fileName, fileExtension); final List<String> fileNames = new ArrayList<>(); try { Files.walkFileTree(directory, Collections.<FileVisitOption> emptySet(), 1, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { String fileName = file.getFileName().toString(); if (filePattern.matcher(fileName).matches()) { fileNames.add(fileName); } return FileVisitResult.CONTINUE; } }); } catch (IOException e) { logger.error("An error occurred while walking directory: " + directory, e); } return fileNames; }
[ "List", "<", "String", ">", "getListOfVulnerabilitiesFiles", "(", ")", "{", "if", "(", "!", "Files", ".", "exists", "(", "directory", ")", ")", "{", "logger", ".", "debug", "(", "\"Skipping read of vulnerabilities, the directory does not exist: \"", "+", "directory", ".", "toAbsolutePath", "(", ")", ")", ";", "return", "Collections", ".", "emptyList", "(", ")", ";", "}", "final", "Pattern", "filePattern", "=", "LocaleUtils", ".", "createResourceFilesPattern", "(", "fileName", ",", "fileExtension", ")", ";", "final", "List", "<", "String", ">", "fileNames", "=", "new", "ArrayList", "<>", "(", ")", ";", "try", "{", "Files", ".", "walkFileTree", "(", "directory", ",", "Collections", ".", "<", "FileVisitOption", ">", "emptySet", "(", ")", ",", "1", ",", "new", "SimpleFileVisitor", "<", "Path", ">", "(", ")", "{", "@", "Override", "public", "FileVisitResult", "visitFile", "(", "Path", "file", ",", "BasicFileAttributes", "attrs", ")", "throws", "IOException", "{", "String", "fileName", "=", "file", ".", "getFileName", "(", ")", ".", "toString", "(", ")", ";", "if", "(", "filePattern", ".", "matcher", "(", "fileName", ")", ".", "matches", "(", ")", ")", "{", "fileNames", ".", "add", "(", "fileName", ")", ";", "}", "return", "FileVisitResult", ".", "CONTINUE", ";", "}", "}", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "logger", ".", "error", "(", "\"An error occurred while walking directory: \"", "+", "directory", ",", "e", ")", ";", "}", "return", "fileNames", ";", "}" ]
Returns a {@code List} of resources files with {@code fileName} and {@code fileExtension} contained in the {@code directory}. @return the list of resources files contained in the {@code directory} @see LocaleUtils#createResourceFilesPattern(String, String)
[ "Returns", "a", "{", "@code", "List", "}", "of", "resources", "files", "with", "{", "@code", "fileName", "}", "and", "{", "@code", "fileExtension", "}", "contained", "in", "the", "{", "@code", "directory", "}", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/model/VulnerabilitiesLoader.java#L157-L181
lucee/Lucee
core/src/main/java/lucee/runtime/ComponentImpl.java
ComponentImpl.get
public Object get(int access, String name) throws PageException { """ return element that has at least given access or null @param access @param name @return matching value @throws PageException """ return get(access, KeyImpl.init(name)); }
java
public Object get(int access, String name) throws PageException { return get(access, KeyImpl.init(name)); }
[ "public", "Object", "get", "(", "int", "access", ",", "String", "name", ")", "throws", "PageException", "{", "return", "get", "(", "access", ",", "KeyImpl", ".", "init", "(", "name", ")", ")", ";", "}" ]
return element that has at least given access or null @param access @param name @return matching value @throws PageException
[ "return", "element", "that", "has", "at", "least", "given", "access", "or", "null" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/ComponentImpl.java#L1839-L1841
josesamuel/remoter
remoter/src/main/java/remoter/compiler/builder/BindingManager.java
BindingManager.getClassBuilder
private ClassBuilder getClassBuilder(Element element) { """ Returns the {@link ClassBuilder} that generates the Builder for the Proxy and Stub classes """ ClassBuilder classBuilder = new ClassBuilder(messager, element); classBuilder.setBindingManager(this); return classBuilder; }
java
private ClassBuilder getClassBuilder(Element element) { ClassBuilder classBuilder = new ClassBuilder(messager, element); classBuilder.setBindingManager(this); return classBuilder; }
[ "private", "ClassBuilder", "getClassBuilder", "(", "Element", "element", ")", "{", "ClassBuilder", "classBuilder", "=", "new", "ClassBuilder", "(", "messager", ",", "element", ")", ";", "classBuilder", ".", "setBindingManager", "(", "this", ")", ";", "return", "classBuilder", ";", "}" ]
Returns the {@link ClassBuilder} that generates the Builder for the Proxy and Stub classes
[ "Returns", "the", "{" ]
train
https://github.com/josesamuel/remoter/blob/007401868c319740d40134ebc07c3406988f9a86/remoter/src/main/java/remoter/compiler/builder/BindingManager.java#L112-L116
apache/incubator-druid
core/src/main/java/org/apache/druid/concurrent/ConcurrentAwaitableCounter.java
ConcurrentAwaitableCounter.awaitFirstIncrement
public boolean awaitFirstIncrement(long timeout, TimeUnit unit) throws InterruptedException { """ The difference between this method and {@link #awaitCount(long, long, TimeUnit)} with argument 1 is that {@code awaitFirstIncrement()} returns boolean designating whether the count was await (while waiting for no longer than for the specified period of time), while {@code awaitCount()} throws {@link TimeoutException} if the count was not awaited. """ return sync.tryAcquireSharedNanos(0, unit.toNanos(timeout)); }
java
public boolean awaitFirstIncrement(long timeout, TimeUnit unit) throws InterruptedException { return sync.tryAcquireSharedNanos(0, unit.toNanos(timeout)); }
[ "public", "boolean", "awaitFirstIncrement", "(", "long", "timeout", ",", "TimeUnit", "unit", ")", "throws", "InterruptedException", "{", "return", "sync", ".", "tryAcquireSharedNanos", "(", "0", ",", "unit", ".", "toNanos", "(", "timeout", ")", ")", ";", "}" ]
The difference between this method and {@link #awaitCount(long, long, TimeUnit)} with argument 1 is that {@code awaitFirstIncrement()} returns boolean designating whether the count was await (while waiting for no longer than for the specified period of time), while {@code awaitCount()} throws {@link TimeoutException} if the count was not awaited.
[ "The", "difference", "between", "this", "method", "and", "{" ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/concurrent/ConcurrentAwaitableCounter.java#L162-L165
mkolisnyk/cucumber-reports
cucumber-runner/src/main/java/com/github/mkolisnyk/cucumber/assertions/LazyAssert.java
LazyAssert.assertArrayEquals
public static void assertArrayEquals(String message, double[] expecteds, double[] actuals, double delta) throws ArrayComparisonFailure { """ Asserts that two double arrays are equal. If they are not, an {@link LazyAssertionError} is thrown with the given message. @param message the identifying message for the {@link LazyAssertionError} (<code>null</code> okay) @param expecteds double array with expected values. @param actuals double array with actual values @param delta the maximum delta between <code>expecteds[i]</code> and <code>actuals[i]</code> for which both numbers are still considered equal. """ try { new InexactComparisonCriteria(delta).arrayEquals(message, expecteds, actuals); } catch (AssertionError e) { throw new LazyAssertionError(message, e); } }
java
public static void assertArrayEquals(String message, double[] expecteds, double[] actuals, double delta) throws ArrayComparisonFailure { try { new InexactComparisonCriteria(delta).arrayEquals(message, expecteds, actuals); } catch (AssertionError e) { throw new LazyAssertionError(message, e); } }
[ "public", "static", "void", "assertArrayEquals", "(", "String", "message", ",", "double", "[", "]", "expecteds", ",", "double", "[", "]", "actuals", ",", "double", "delta", ")", "throws", "ArrayComparisonFailure", "{", "try", "{", "new", "InexactComparisonCriteria", "(", "delta", ")", ".", "arrayEquals", "(", "message", ",", "expecteds", ",", "actuals", ")", ";", "}", "catch", "(", "AssertionError", "e", ")", "{", "throw", "new", "LazyAssertionError", "(", "message", ",", "e", ")", ";", "}", "}" ]
Asserts that two double arrays are equal. If they are not, an {@link LazyAssertionError} is thrown with the given message. @param message the identifying message for the {@link LazyAssertionError} (<code>null</code> okay) @param expecteds double array with expected values. @param actuals double array with actual values @param delta the maximum delta between <code>expecteds[i]</code> and <code>actuals[i]</code> for which both numbers are still considered equal.
[ "Asserts", "that", "two", "double", "arrays", "are", "equal", ".", "If", "they", "are", "not", "an", "{", "@link", "LazyAssertionError", "}", "is", "thrown", "with", "the", "given", "message", "." ]
train
https://github.com/mkolisnyk/cucumber-reports/blob/9c9a32f15f0bf1eb1d3d181a11bae9c5eec84a8e/cucumber-runner/src/main/java/com/github/mkolisnyk/cucumber/assertions/LazyAssert.java#L473-L480
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/V1InstanceGetter.java
V1InstanceGetter.retrospectives
public Collection<Retrospective> retrospectives( RetrospectiveFilter filter) { """ Get Retrospective filtered by the criteria specified in the passed in filter. @param filter Limit the items returned. If null, then all items returned. @return Collection of items as specified in the filter. """ return get(Retrospective.class, (filter != null) ? filter : new RetrospectiveFilter()); }
java
public Collection<Retrospective> retrospectives( RetrospectiveFilter filter) { return get(Retrospective.class, (filter != null) ? filter : new RetrospectiveFilter()); }
[ "public", "Collection", "<", "Retrospective", ">", "retrospectives", "(", "RetrospectiveFilter", "filter", ")", "{", "return", "get", "(", "Retrospective", ".", "class", ",", "(", "filter", "!=", "null", ")", "?", "filter", ":", "new", "RetrospectiveFilter", "(", ")", ")", ";", "}" ]
Get Retrospective filtered by the criteria specified in the passed in filter. @param filter Limit the items returned. If null, then all items returned. @return Collection of items as specified in the filter.
[ "Get", "Retrospective", "filtered", "by", "the", "criteria", "specified", "in", "the", "passed", "in", "filter", "." ]
train
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/V1InstanceGetter.java#L282-L285
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/view/ViewRetryHandler.java
ViewRetryHandler.shouldRetry
private static boolean shouldRetry(final int status, final String content) { """ Analyses status codes and checks if a retry needs to happen. Some status codes are ambiguous, so their contents are inspected further. @param status the status code. @param content the error body from the response. @return true if retry is needed, false otherwise. """ switch (status) { case 200: return false; case 404: return analyse404Response(content); case 500: return analyse500Response(content); case 300: case 301: case 302: case 303: case 307: case 401: case 408: case 409: case 412: case 416: case 417: case 501: case 502: case 503: case 504: return true; default: LOGGER.info("Received a View HTTP response code ({}) I did not expect, not retrying.", status); return false; } }
java
private static boolean shouldRetry(final int status, final String content) { switch (status) { case 200: return false; case 404: return analyse404Response(content); case 500: return analyse500Response(content); case 300: case 301: case 302: case 303: case 307: case 401: case 408: case 409: case 412: case 416: case 417: case 501: case 502: case 503: case 504: return true; default: LOGGER.info("Received a View HTTP response code ({}) I did not expect, not retrying.", status); return false; } }
[ "private", "static", "boolean", "shouldRetry", "(", "final", "int", "status", ",", "final", "String", "content", ")", "{", "switch", "(", "status", ")", "{", "case", "200", ":", "return", "false", ";", "case", "404", ":", "return", "analyse404Response", "(", "content", ")", ";", "case", "500", ":", "return", "analyse500Response", "(", "content", ")", ";", "case", "300", ":", "case", "301", ":", "case", "302", ":", "case", "303", ":", "case", "307", ":", "case", "401", ":", "case", "408", ":", "case", "409", ":", "case", "412", ":", "case", "416", ":", "case", "417", ":", "case", "501", ":", "case", "502", ":", "case", "503", ":", "case", "504", ":", "return", "true", ";", "default", ":", "LOGGER", ".", "info", "(", "\"Received a View HTTP response code ({}) I did not expect, not retrying.\"", ",", "status", ")", ";", "return", "false", ";", "}", "}" ]
Analyses status codes and checks if a retry needs to happen. Some status codes are ambiguous, so their contents are inspected further. @param status the status code. @param content the error body from the response. @return true if retry is needed, false otherwise.
[ "Analyses", "status", "codes", "and", "checks", "if", "a", "retry", "needs", "to", "happen", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/view/ViewRetryHandler.java#L118-L146
google/closure-compiler
src/com/google/javascript/jscomp/Tracer.java
Tracer.longToPaddedString
private static String longToPaddedString(long v, int digitsColumnWidth) { """ Converts 'v' to a string and pads it with up to 16 spaces for improved alignment. @param v The value to convert. @param digitsColumnWidth The desired with of the string. """ int digitWidth = numDigits(v); StringBuilder sb = new StringBuilder(); appendSpaces(sb, digitsColumnWidth - digitWidth); sb.append(v); return sb.toString(); }
java
private static String longToPaddedString(long v, int digitsColumnWidth) { int digitWidth = numDigits(v); StringBuilder sb = new StringBuilder(); appendSpaces(sb, digitsColumnWidth - digitWidth); sb.append(v); return sb.toString(); }
[ "private", "static", "String", "longToPaddedString", "(", "long", "v", ",", "int", "digitsColumnWidth", ")", "{", "int", "digitWidth", "=", "numDigits", "(", "v", ")", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "appendSpaces", "(", "sb", ",", "digitsColumnWidth", "-", "digitWidth", ")", ";", "sb", ".", "append", "(", "v", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Converts 'v' to a string and pads it with up to 16 spaces for improved alignment. @param v The value to convert. @param digitsColumnWidth The desired with of the string.
[ "Converts", "v", "to", "a", "string", "and", "pads", "it", "with", "up", "to", "16", "spaces", "for", "improved", "alignment", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Tracer.java#L295-L301
UrielCh/ovh-java-sdk
ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java
ApiOvhDomain.serviceName_glueRecord_host_DELETE
public net.minidev.ovh.api.domain.OvhTask serviceName_glueRecord_host_DELETE(String serviceName, String host) throws IOException { """ Delete the glue record REST: DELETE /domain/{serviceName}/glueRecord/{host} @param serviceName [required] The internal name of your domain @param host [required] Host of the glue record """ String qPath = "/domain/{serviceName}/glueRecord/{host}"; StringBuilder sb = path(qPath, serviceName, host); String resp = exec(qPath, "DELETE", sb.toString(), null); return convertTo(resp, net.minidev.ovh.api.domain.OvhTask.class); }
java
public net.minidev.ovh.api.domain.OvhTask serviceName_glueRecord_host_DELETE(String serviceName, String host) throws IOException { String qPath = "/domain/{serviceName}/glueRecord/{host}"; StringBuilder sb = path(qPath, serviceName, host); String resp = exec(qPath, "DELETE", sb.toString(), null); return convertTo(resp, net.minidev.ovh.api.domain.OvhTask.class); }
[ "public", "net", ".", "minidev", ".", "ovh", ".", "api", ".", "domain", ".", "OvhTask", "serviceName_glueRecord_host_DELETE", "(", "String", "serviceName", ",", "String", "host", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/domain/{serviceName}/glueRecord/{host}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "host", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"DELETE\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "net", ".", "minidev", ".", "ovh", ".", "api", ".", "domain", ".", "OvhTask", ".", "class", ")", ";", "}" ]
Delete the glue record REST: DELETE /domain/{serviceName}/glueRecord/{host} @param serviceName [required] The internal name of your domain @param host [required] Host of the glue record
[ "Delete", "the", "glue", "record" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L1212-L1217
zxing/zxing
core/src/main/java/com/google/zxing/qrcode/detector/Detector.java
Detector.sizeOfBlackWhiteBlackRunBothWays
private float sizeOfBlackWhiteBlackRunBothWays(int fromX, int fromY, int toX, int toY) { """ See {@link #sizeOfBlackWhiteBlackRun(int, int, int, int)}; computes the total width of a finder pattern by looking for a black-white-black run from the center in the direction of another point (another finder pattern center), and in the opposite direction too. """ float result = sizeOfBlackWhiteBlackRun(fromX, fromY, toX, toY); // Now count other way -- don't run off image though of course float scale = 1.0f; int otherToX = fromX - (toX - fromX); if (otherToX < 0) { scale = fromX / (float) (fromX - otherToX); otherToX = 0; } else if (otherToX >= image.getWidth()) { scale = (image.getWidth() - 1 - fromX) / (float) (otherToX - fromX); otherToX = image.getWidth() - 1; } int otherToY = (int) (fromY - (toY - fromY) * scale); scale = 1.0f; if (otherToY < 0) { scale = fromY / (float) (fromY - otherToY); otherToY = 0; } else if (otherToY >= image.getHeight()) { scale = (image.getHeight() - 1 - fromY) / (float) (otherToY - fromY); otherToY = image.getHeight() - 1; } otherToX = (int) (fromX + (otherToX - fromX) * scale); result += sizeOfBlackWhiteBlackRun(fromX, fromY, otherToX, otherToY); // Middle pixel is double-counted this way; subtract 1 return result - 1.0f; }
java
private float sizeOfBlackWhiteBlackRunBothWays(int fromX, int fromY, int toX, int toY) { float result = sizeOfBlackWhiteBlackRun(fromX, fromY, toX, toY); // Now count other way -- don't run off image though of course float scale = 1.0f; int otherToX = fromX - (toX - fromX); if (otherToX < 0) { scale = fromX / (float) (fromX - otherToX); otherToX = 0; } else if (otherToX >= image.getWidth()) { scale = (image.getWidth() - 1 - fromX) / (float) (otherToX - fromX); otherToX = image.getWidth() - 1; } int otherToY = (int) (fromY - (toY - fromY) * scale); scale = 1.0f; if (otherToY < 0) { scale = fromY / (float) (fromY - otherToY); otherToY = 0; } else if (otherToY >= image.getHeight()) { scale = (image.getHeight() - 1 - fromY) / (float) (otherToY - fromY); otherToY = image.getHeight() - 1; } otherToX = (int) (fromX + (otherToX - fromX) * scale); result += sizeOfBlackWhiteBlackRun(fromX, fromY, otherToX, otherToY); // Middle pixel is double-counted this way; subtract 1 return result - 1.0f; }
[ "private", "float", "sizeOfBlackWhiteBlackRunBothWays", "(", "int", "fromX", ",", "int", "fromY", ",", "int", "toX", ",", "int", "toY", ")", "{", "float", "result", "=", "sizeOfBlackWhiteBlackRun", "(", "fromX", ",", "fromY", ",", "toX", ",", "toY", ")", ";", "// Now count other way -- don't run off image though of course", "float", "scale", "=", "1.0f", ";", "int", "otherToX", "=", "fromX", "-", "(", "toX", "-", "fromX", ")", ";", "if", "(", "otherToX", "<", "0", ")", "{", "scale", "=", "fromX", "/", "(", "float", ")", "(", "fromX", "-", "otherToX", ")", ";", "otherToX", "=", "0", ";", "}", "else", "if", "(", "otherToX", ">=", "image", ".", "getWidth", "(", ")", ")", "{", "scale", "=", "(", "image", ".", "getWidth", "(", ")", "-", "1", "-", "fromX", ")", "/", "(", "float", ")", "(", "otherToX", "-", "fromX", ")", ";", "otherToX", "=", "image", ".", "getWidth", "(", ")", "-", "1", ";", "}", "int", "otherToY", "=", "(", "int", ")", "(", "fromY", "-", "(", "toY", "-", "fromY", ")", "*", "scale", ")", ";", "scale", "=", "1.0f", ";", "if", "(", "otherToY", "<", "0", ")", "{", "scale", "=", "fromY", "/", "(", "float", ")", "(", "fromY", "-", "otherToY", ")", ";", "otherToY", "=", "0", ";", "}", "else", "if", "(", "otherToY", ">=", "image", ".", "getHeight", "(", ")", ")", "{", "scale", "=", "(", "image", ".", "getHeight", "(", ")", "-", "1", "-", "fromY", ")", "/", "(", "float", ")", "(", "otherToY", "-", "fromY", ")", ";", "otherToY", "=", "image", ".", "getHeight", "(", ")", "-", "1", ";", "}", "otherToX", "=", "(", "int", ")", "(", "fromX", "+", "(", "otherToX", "-", "fromX", ")", "*", "scale", ")", ";", "result", "+=", "sizeOfBlackWhiteBlackRun", "(", "fromX", ",", "fromY", ",", "otherToX", ",", "otherToY", ")", ";", "// Middle pixel is double-counted this way; subtract 1", "return", "result", "-", "1.0f", ";", "}" ]
See {@link #sizeOfBlackWhiteBlackRun(int, int, int, int)}; computes the total width of a finder pattern by looking for a black-white-black run from the center in the direction of another point (another finder pattern center), and in the opposite direction too.
[ "See", "{" ]
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/qrcode/detector/Detector.java#L266-L296
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/ProjectApi.java
ProjectApi.updateMember
public Member updateMember(Object projectIdOrPath, Integer userId, Integer accessLevel, Date expiresAt) throws GitLabApiException { """ Updates a member of a project. <pre><code>PUT /projects/:projectId/members/:userId</code></pre> @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required @param userId the user ID of the member to update, required @param accessLevel the new access level for the member, required @param expiresAt the date the membership in the group will expire, optional @return the updated member @throws GitLabApiException if any exception occurs """ GitLabApiForm formData = new GitLabApiForm() .withParam("access_level", accessLevel, true) .withParam("expires_at", expiresAt, false); Response response = put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "members", userId); return (response.readEntity(Member.class)); }
java
public Member updateMember(Object projectIdOrPath, Integer userId, Integer accessLevel, Date expiresAt) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() .withParam("access_level", accessLevel, true) .withParam("expires_at", expiresAt, false); Response response = put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "members", userId); return (response.readEntity(Member.class)); }
[ "public", "Member", "updateMember", "(", "Object", "projectIdOrPath", ",", "Integer", "userId", ",", "Integer", "accessLevel", ",", "Date", "expiresAt", ")", "throws", "GitLabApiException", "{", "GitLabApiForm", "formData", "=", "new", "GitLabApiForm", "(", ")", ".", "withParam", "(", "\"access_level\"", ",", "accessLevel", ",", "true", ")", ".", "withParam", "(", "\"expires_at\"", ",", "expiresAt", ",", "false", ")", ";", "Response", "response", "=", "put", "(", "Response", ".", "Status", ".", "OK", ",", "formData", ".", "asMap", "(", ")", ",", "\"projects\"", ",", "getProjectIdOrPath", "(", "projectIdOrPath", ")", ",", "\"members\"", ",", "userId", ")", ";", "return", "(", "response", ".", "readEntity", "(", "Member", ".", "class", ")", ")", ";", "}" ]
Updates a member of a project. <pre><code>PUT /projects/:projectId/members/:userId</code></pre> @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required @param userId the user ID of the member to update, required @param accessLevel the new access level for the member, required @param expiresAt the date the membership in the group will expire, optional @return the updated member @throws GitLabApiException if any exception occurs
[ "Updates", "a", "member", "of", "a", "project", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/ProjectApi.java#L1381-L1387
betfair/cougar
cougar-framework/jetty-transport/src/main/java/com/betfair/cougar/transport/impl/protocol/http/AbstractHttpCommandProcessor.java
AbstractHttpCommandProcessor.handleResponseWritingIOException
protected CougarException handleResponseWritingIOException(Exception e, Class resultClass) { """ If an exception is received while writing a response to the client, it might be because the that client has closed their connection. If so, the problem should be ignored. """ String errorMessage = "Exception writing "+ resultClass.getCanonicalName() +" to http stream"; IOException ioe = getIOException(e); if (ioe == null) { CougarException ce; if (e instanceof CougarException) { ce = (CougarException)e; } else { ce = new CougarFrameworkException(errorMessage, e); } return ce; } //We arrive here when the output pipe is broken. Broken network connections are not //really exceptional and should not be reported by dumping the stack trace. //Instead a summary debug level log message with some relevant info incrementIoErrorsEncountered(); LOGGER.debug( "Failed to marshall object of class {} to the output channel. Exception ({}) message is: {}", resultClass.getCanonicalName(), e.getClass().getCanonicalName(), e.getMessage() ); return new CougarServiceException(ServerFaultCode.OutputChannelClosedCantWrite, errorMessage, e); }
java
protected CougarException handleResponseWritingIOException(Exception e, Class resultClass) { String errorMessage = "Exception writing "+ resultClass.getCanonicalName() +" to http stream"; IOException ioe = getIOException(e); if (ioe == null) { CougarException ce; if (e instanceof CougarException) { ce = (CougarException)e; } else { ce = new CougarFrameworkException(errorMessage, e); } return ce; } //We arrive here when the output pipe is broken. Broken network connections are not //really exceptional and should not be reported by dumping the stack trace. //Instead a summary debug level log message with some relevant info incrementIoErrorsEncountered(); LOGGER.debug( "Failed to marshall object of class {} to the output channel. Exception ({}) message is: {}", resultClass.getCanonicalName(), e.getClass().getCanonicalName(), e.getMessage() ); return new CougarServiceException(ServerFaultCode.OutputChannelClosedCantWrite, errorMessage, e); }
[ "protected", "CougarException", "handleResponseWritingIOException", "(", "Exception", "e", ",", "Class", "resultClass", ")", "{", "String", "errorMessage", "=", "\"Exception writing \"", "+", "resultClass", ".", "getCanonicalName", "(", ")", "+", "\" to http stream\"", ";", "IOException", "ioe", "=", "getIOException", "(", "e", ")", ";", "if", "(", "ioe", "==", "null", ")", "{", "CougarException", "ce", ";", "if", "(", "e", "instanceof", "CougarException", ")", "{", "ce", "=", "(", "CougarException", ")", "e", ";", "}", "else", "{", "ce", "=", "new", "CougarFrameworkException", "(", "errorMessage", ",", "e", ")", ";", "}", "return", "ce", ";", "}", "//We arrive here when the output pipe is broken. Broken network connections are not", "//really exceptional and should not be reported by dumping the stack trace.", "//Instead a summary debug level log message with some relevant info", "incrementIoErrorsEncountered", "(", ")", ";", "LOGGER", ".", "debug", "(", "\"Failed to marshall object of class {} to the output channel. Exception ({}) message is: {}\"", ",", "resultClass", ".", "getCanonicalName", "(", ")", ",", "e", ".", "getClass", "(", ")", ".", "getCanonicalName", "(", ")", ",", "e", ".", "getMessage", "(", ")", ")", ";", "return", "new", "CougarServiceException", "(", "ServerFaultCode", ".", "OutputChannelClosedCantWrite", ",", "errorMessage", ",", "e", ")", ";", "}" ]
If an exception is received while writing a response to the client, it might be because the that client has closed their connection. If so, the problem should be ignored.
[ "If", "an", "exception", "is", "received", "while", "writing", "a", "response", "to", "the", "client", "it", "might", "be", "because", "the", "that", "client", "has", "closed", "their", "connection", ".", "If", "so", "the", "problem", "should", "be", "ignored", "." ]
train
https://github.com/betfair/cougar/blob/08d1fe338fbd0e8572a9c2305bb5796402d5b1f5/cougar-framework/jetty-transport/src/main/java/com/betfair/cougar/transport/impl/protocol/http/AbstractHttpCommandProcessor.java#L280-L304
osglworks/java-tool
src/main/java/org/osgl/util/E.java
E.invalidRangeIfNot
public static void invalidRangeIfNot(boolean tester, String msg, Object... args) { """ Throws out an {@link InvalidRangeException} with error message specified when `tester` is `false`. @param tester when `false` then throw out the exception @param msg the error message format pattern. @param args the error message format arguments. """ if (!tester) { throw new InvalidRangeException(msg, args); } }
java
public static void invalidRangeIfNot(boolean tester, String msg, Object... args) { if (!tester) { throw new InvalidRangeException(msg, args); } }
[ "public", "static", "void", "invalidRangeIfNot", "(", "boolean", "tester", ",", "String", "msg", ",", "Object", "...", "args", ")", "{", "if", "(", "!", "tester", ")", "{", "throw", "new", "InvalidRangeException", "(", "msg", ",", "args", ")", ";", "}", "}" ]
Throws out an {@link InvalidRangeException} with error message specified when `tester` is `false`. @param tester when `false` then throw out the exception @param msg the error message format pattern. @param args the error message format arguments.
[ "Throws", "out", "an", "{", "@link", "InvalidRangeException", "}", "with", "error", "message", "specified", "when", "tester", "is", "false", "." ]
train
https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/util/E.java#L498-L502
alkacon/opencms-core
src/org/opencms/ui/login/CmsLoginController.java
CmsLoginController.displayError
private void displayError(String message, boolean showForgotPassword, boolean showTime) { """ Displays the given error message.<p> @param message the message @param showForgotPassword in case the forgot password link should be shown @param showTime show the time """ message = message.replace("\n", "<br />"); if (showForgotPassword) { message += "<br /><br /><a href=\"" + getResetPasswordLink() + "\">" + CmsVaadinUtils.getMessageText(Messages.GUI_FORGOT_PASSWORD_0) + "</a>"; } if (showTime) { SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); message += "<div style=\"position:absolute;right:6px;bottom:5px;\">" + CmsVaadinUtils.getMessageText(Messages.GUI_TIME_1, sdf.format(new Date())) + "</div>"; } m_ui.showLoginError(message); }
java
private void displayError(String message, boolean showForgotPassword, boolean showTime) { message = message.replace("\n", "<br />"); if (showForgotPassword) { message += "<br /><br /><a href=\"" + getResetPasswordLink() + "\">" + CmsVaadinUtils.getMessageText(Messages.GUI_FORGOT_PASSWORD_0) + "</a>"; } if (showTime) { SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); message += "<div style=\"position:absolute;right:6px;bottom:5px;\">" + CmsVaadinUtils.getMessageText(Messages.GUI_TIME_1, sdf.format(new Date())) + "</div>"; } m_ui.showLoginError(message); }
[ "private", "void", "displayError", "(", "String", "message", ",", "boolean", "showForgotPassword", ",", "boolean", "showTime", ")", "{", "message", "=", "message", ".", "replace", "(", "\"\\n\"", ",", "\"<br />\"", ")", ";", "if", "(", "showForgotPassword", ")", "{", "message", "+=", "\"<br /><br /><a href=\\\"\"", "+", "getResetPasswordLink", "(", ")", "+", "\"\\\">\"", "+", "CmsVaadinUtils", ".", "getMessageText", "(", "Messages", ".", "GUI_FORGOT_PASSWORD_0", ")", "+", "\"</a>\"", ";", "}", "if", "(", "showTime", ")", "{", "SimpleDateFormat", "sdf", "=", "new", "SimpleDateFormat", "(", "\"HH:mm:ss\"", ")", ";", "message", "+=", "\"<div style=\\\"position:absolute;right:6px;bottom:5px;\\\">\"", "+", "CmsVaadinUtils", ".", "getMessageText", "(", "Messages", ".", "GUI_TIME_1", ",", "sdf", ".", "format", "(", "new", "Date", "(", ")", ")", ")", "+", "\"</div>\"", ";", "}", "m_ui", ".", "showLoginError", "(", "message", ")", ";", "}" ]
Displays the given error message.<p> @param message the message @param showForgotPassword in case the forgot password link should be shown @param showTime show the time
[ "Displays", "the", "given", "error", "message", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/login/CmsLoginController.java#L732-L749
UrielCh/ovh-java-sdk
ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java
ApiOvhDomain.zone_zoneName_dynHost_login_login_DELETE
public void zone_zoneName_dynHost_login_login_DELETE(String zoneName, String login) throws IOException { """ Delete a DynHost login REST: DELETE /domain/zone/{zoneName}/dynHost/login/{login} @param zoneName [required] The internal name of your zone @param login [required] Login """ String qPath = "/domain/zone/{zoneName}/dynHost/login/{login}"; StringBuilder sb = path(qPath, zoneName, login); exec(qPath, "DELETE", sb.toString(), null); }
java
public void zone_zoneName_dynHost_login_login_DELETE(String zoneName, String login) throws IOException { String qPath = "/domain/zone/{zoneName}/dynHost/login/{login}"; StringBuilder sb = path(qPath, zoneName, login); exec(qPath, "DELETE", sb.toString(), null); }
[ "public", "void", "zone_zoneName_dynHost_login_login_DELETE", "(", "String", "zoneName", ",", "String", "login", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/domain/zone/{zoneName}/dynHost/login/{login}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "zoneName", ",", "login", ")", ";", "exec", "(", "qPath", ",", "\"DELETE\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "}" ]
Delete a DynHost login REST: DELETE /domain/zone/{zoneName}/dynHost/login/{login} @param zoneName [required] The internal name of your zone @param login [required] Login
[ "Delete", "a", "DynHost", "login" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L466-L470
SpartaTech/sparta-spring-web-utils
src/main/java/org/sparta/springwebutils/SpringContextUtils.java
SpringContextUtils.setProperties
private static void setProperties(GenericApplicationContext newContext, Properties properties) { """ Set properties into the context. @param newContext new context to add properties @param properties properties to add to the context """ PropertiesPropertySource pps = new PropertiesPropertySource("external-props", properties); newContext.getEnvironment().getPropertySources().addFirst(pps); }
java
private static void setProperties(GenericApplicationContext newContext, Properties properties) { PropertiesPropertySource pps = new PropertiesPropertySource("external-props", properties); newContext.getEnvironment().getPropertySources().addFirst(pps); }
[ "private", "static", "void", "setProperties", "(", "GenericApplicationContext", "newContext", ",", "Properties", "properties", ")", "{", "PropertiesPropertySource", "pps", "=", "new", "PropertiesPropertySource", "(", "\"external-props\"", ",", "properties", ")", ";", "newContext", ".", "getEnvironment", "(", ")", ".", "getPropertySources", "(", ")", ".", "addFirst", "(", "pps", ")", ";", "}" ]
Set properties into the context. @param newContext new context to add properties @param properties properties to add to the context
[ "Set", "properties", "into", "the", "context", "." ]
train
https://github.com/SpartaTech/sparta-spring-web-utils/blob/f5382474d46a6048d58707fc64e7936277e8b2ce/src/main/java/org/sparta/springwebutils/SpringContextUtils.java#L100-L103
jenetics/jenetics
jenetics/src/main/java/io/jenetics/engine/EvolutionResult.java
EvolutionResult.toUniquePopulation
public static <G extends Gene<?, G>, C extends Comparable<? super C>> UnaryOperator<EvolutionResult<G, C>> toUniquePopulation(final Factory<Genotype<G>> factory) { """ Return a mapping function, which removes duplicate individuals from the population and replaces it with newly created one by the given genotype {@code factory}. <pre>{@code final Problem<Double, DoubleGene, Integer> problem = ...; final Engine<DoubleGene, Integer> engine = Engine.builder(problem) .mapping(EvolutionResult.toUniquePopulation(problem.codec().encoding())) .build(); final Genotype<DoubleGene> best = engine.stream() .limit(100); .collect(EvolutionResult.toBestGenotype()); }</pre> @since 4.0 @see Engine.Builder#mapping(Function) @param factory the genotype factory which create new individuals @param <G> the gene type @param <C> the fitness function result type @return a mapping function, which removes duplicate individuals from the population @throws NullPointerException if the given genotype {@code factory} is {@code null} """ return toUniquePopulation(factory, 100); }
java
public static <G extends Gene<?, G>, C extends Comparable<? super C>> UnaryOperator<EvolutionResult<G, C>> toUniquePopulation(final Factory<Genotype<G>> factory) { return toUniquePopulation(factory, 100); }
[ "public", "static", "<", "G", "extends", "Gene", "<", "?", ",", "G", ">", ",", "C", "extends", "Comparable", "<", "?", "super", "C", ">", ">", "UnaryOperator", "<", "EvolutionResult", "<", "G", ",", "C", ">", ">", "toUniquePopulation", "(", "final", "Factory", "<", "Genotype", "<", "G", ">", ">", "factory", ")", "{", "return", "toUniquePopulation", "(", "factory", ",", "100", ")", ";", "}" ]
Return a mapping function, which removes duplicate individuals from the population and replaces it with newly created one by the given genotype {@code factory}. <pre>{@code final Problem<Double, DoubleGene, Integer> problem = ...; final Engine<DoubleGene, Integer> engine = Engine.builder(problem) .mapping(EvolutionResult.toUniquePopulation(problem.codec().encoding())) .build(); final Genotype<DoubleGene> best = engine.stream() .limit(100); .collect(EvolutionResult.toBestGenotype()); }</pre> @since 4.0 @see Engine.Builder#mapping(Function) @param factory the genotype factory which create new individuals @param <G> the gene type @param <C> the fitness function result type @return a mapping function, which removes duplicate individuals from the population @throws NullPointerException if the given genotype {@code factory} is {@code null}
[ "Return", "a", "mapping", "function", "which", "removes", "duplicate", "individuals", "from", "the", "population", "and", "replaces", "it", "with", "newly", "created", "one", "by", "the", "given", "genotype", "{", "@code", "factory", "}", "." ]
train
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/engine/EvolutionResult.java#L611-L615
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/RandomUtil.java
RandomUtil.randomDay
public static DateTime randomDay(int min, int max) { """ 以当天为基准,随机产生一个日期 @param min 偏移最小天,可以为负数表示过去的时间 @param max 偏移最大天,可以为负数表示过去的时间 @return 随机日期(随机天,其它时间不变) @since 4.0.8 """ return DateUtil.offsetDay(DateUtil.date(), randomInt(min, max)); }
java
public static DateTime randomDay(int min, int max) { return DateUtil.offsetDay(DateUtil.date(), randomInt(min, max)); }
[ "public", "static", "DateTime", "randomDay", "(", "int", "min", ",", "int", "max", ")", "{", "return", "DateUtil", ".", "offsetDay", "(", "DateUtil", ".", "date", "(", ")", ",", "randomInt", "(", "min", ",", "max", ")", ")", ";", "}" ]
以当天为基准,随机产生一个日期 @param min 偏移最小天,可以为负数表示过去的时间 @param max 偏移最大天,可以为负数表示过去的时间 @return 随机日期(随机天,其它时间不变) @since 4.0.8
[ "以当天为基准,随机产生一个日期" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/RandomUtil.java#L491-L493
leancloud/java-sdk-all
android-sdk/huawei-hmsagent/src/main/java/com/huawei/android/hms/agent/push/DeleteTokenApi.java
DeleteTokenApi.onConnect
@Override public void onConnect(final int rst, final HuaweiApiClient client) { """ HuaweiApiClient 连接结果回调 @param rst 结果码 @param client HuaweiApiClient 实例 """ //需要在子线程中执行删除TOKEN操作 ThreadUtil.INST.excute(new Runnable() { @Override public void run() { //调用删除TOKEN需要传入通过getToken接口获取到TOKEN,并且需要对TOKEN进行非空判断 if (!TextUtils.isEmpty(token)){ if (client == null || !ApiClientMgr.INST.isConnect(client)) { HMSAgentLog.e("client not connted"); onDeleteTokenResult(rst); } else { try { HuaweiPush.HuaweiPushApi.deleteToken(client, token); onDeleteTokenResult(HMSAgent.AgentResultCode.HMSAGENT_SUCCESS); } catch (Exception e) { HMSAgentLog.e("删除TOKEN失败:" + e.getMessage()); onDeleteTokenResult(HMSAgent.AgentResultCode.CALL_EXCEPTION); } } } else { HMSAgentLog.e("删除TOKEN失败: 要删除的token为空"); onDeleteTokenResult(HMSAgent.AgentResultCode.EMPTY_PARAM); } } }); }
java
@Override public void onConnect(final int rst, final HuaweiApiClient client) { //需要在子线程中执行删除TOKEN操作 ThreadUtil.INST.excute(new Runnable() { @Override public void run() { //调用删除TOKEN需要传入通过getToken接口获取到TOKEN,并且需要对TOKEN进行非空判断 if (!TextUtils.isEmpty(token)){ if (client == null || !ApiClientMgr.INST.isConnect(client)) { HMSAgentLog.e("client not connted"); onDeleteTokenResult(rst); } else { try { HuaweiPush.HuaweiPushApi.deleteToken(client, token); onDeleteTokenResult(HMSAgent.AgentResultCode.HMSAGENT_SUCCESS); } catch (Exception e) { HMSAgentLog.e("删除TOKEN失败:" + e.getMessage()); onDeleteTokenResult(HMSAgent.AgentResultCode.CALL_EXCEPTION); } } } else { HMSAgentLog.e("删除TOKEN失败: 要删除的token为空"); onDeleteTokenResult(HMSAgent.AgentResultCode.EMPTY_PARAM); } } }); }
[ "@", "Override", "public", "void", "onConnect", "(", "final", "int", "rst", ",", "final", "HuaweiApiClient", "client", ")", "{", "//需要在子线程中执行删除TOKEN操作\r", "ThreadUtil", ".", "INST", ".", "excute", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "//调用删除TOKEN需要传入通过getToken接口获取到TOKEN,并且需要对TOKEN进行非空判断\r", "if", "(", "!", "TextUtils", ".", "isEmpty", "(", "token", ")", ")", "{", "if", "(", "client", "==", "null", "||", "!", "ApiClientMgr", ".", "INST", ".", "isConnect", "(", "client", ")", ")", "{", "HMSAgentLog", ".", "e", "(", "\"client not connted\"", ")", ";", "onDeleteTokenResult", "(", "rst", ")", ";", "}", "else", "{", "try", "{", "HuaweiPush", ".", "HuaweiPushApi", ".", "deleteToken", "(", "client", ",", "token", ")", ";", "onDeleteTokenResult", "(", "HMSAgent", ".", "AgentResultCode", ".", "HMSAGENT_SUCCESS", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "HMSAgentLog", ".", "e", "(", "\"删除TOKEN失败:\" + e.get", "e", "s", "a", "ge());\r", "", "", "", "", "onDeleteTokenResult", "(", "HMSAgent", ".", "AgentResultCode", ".", "CALL_EXCEPTION", ")", ";", "}", "}", "}", "else", "{", "HMSAgentLog", ".", "e", "(", "\"删除TOKEN失败: 要删除的token为空\");\r", "", "", "onDeleteTokenResult", "(", "HMSAgent", ".", "AgentResultCode", ".", "EMPTY_PARAM", ")", ";", "}", "}", "}", ")", ";", "}" ]
HuaweiApiClient 连接结果回调 @param rst 结果码 @param client HuaweiApiClient 实例
[ "HuaweiApiClient", "连接结果回调" ]
train
https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/android-sdk/huawei-hmsagent/src/main/java/com/huawei/android/hms/agent/push/DeleteTokenApi.java#L39-L65
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/utils/StringToIntTable.java
StringToIntTable.put
public final void put(String key, int value) { """ Append a string onto the vector. @param key String to append @param value The int value of the string """ if ((m_firstFree + 1) >= m_mapSize) { m_mapSize += m_blocksize; String newMap[] = new String[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1); m_map = newMap; int newValues[] = new int[m_mapSize]; System.arraycopy(m_values, 0, newValues, 0, m_firstFree + 1); m_values = newValues; } m_map[m_firstFree] = key; m_values[m_firstFree] = value; m_firstFree++; }
java
public final void put(String key, int value) { if ((m_firstFree + 1) >= m_mapSize) { m_mapSize += m_blocksize; String newMap[] = new String[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1); m_map = newMap; int newValues[] = new int[m_mapSize]; System.arraycopy(m_values, 0, newValues, 0, m_firstFree + 1); m_values = newValues; } m_map[m_firstFree] = key; m_values[m_firstFree] = value; m_firstFree++; }
[ "public", "final", "void", "put", "(", "String", "key", ",", "int", "value", ")", "{", "if", "(", "(", "m_firstFree", "+", "1", ")", ">=", "m_mapSize", ")", "{", "m_mapSize", "+=", "m_blocksize", ";", "String", "newMap", "[", "]", "=", "new", "String", "[", "m_mapSize", "]", ";", "System", ".", "arraycopy", "(", "m_map", ",", "0", ",", "newMap", ",", "0", ",", "m_firstFree", "+", "1", ")", ";", "m_map", "=", "newMap", ";", "int", "newValues", "[", "]", "=", "new", "int", "[", "m_mapSize", "]", ";", "System", ".", "arraycopy", "(", "m_values", ",", "0", ",", "newValues", ",", "0", ",", "m_firstFree", "+", "1", ")", ";", "m_values", "=", "newValues", ";", "}", "m_map", "[", "m_firstFree", "]", "=", "key", ";", "m_values", "[", "m_firstFree", "]", "=", "value", ";", "m_firstFree", "++", ";", "}" ]
Append a string onto the vector. @param key String to append @param value The int value of the string
[ "Append", "a", "string", "onto", "the", "vector", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/utils/StringToIntTable.java#L100-L124
kiegroup/drools
drools-core/src/main/java/org/drools/core/reteoo/compiled/AbstractCompilerHandler.java
AbstractCompilerHandler.getVariableName
private String getVariableName(Class clazz, int nodeId) { """ Returns a variable name based on the simple name of the specified class appended with the specified nodeId. @param clazz class whose simple name is lowercased and user as the prefix of the variable name @param nodeId id of {@link org.kie.common.NetworkNode} @return variable name @see Class#getSimpleName() """ String type = clazz.getSimpleName(); return Character.toLowerCase(type.charAt(0)) + type.substring(1) + nodeId; }
java
private String getVariableName(Class clazz, int nodeId) { String type = clazz.getSimpleName(); return Character.toLowerCase(type.charAt(0)) + type.substring(1) + nodeId; }
[ "private", "String", "getVariableName", "(", "Class", "clazz", ",", "int", "nodeId", ")", "{", "String", "type", "=", "clazz", ".", "getSimpleName", "(", ")", ";", "return", "Character", ".", "toLowerCase", "(", "type", ".", "charAt", "(", "0", ")", ")", "+", "type", ".", "substring", "(", "1", ")", "+", "nodeId", ";", "}" ]
Returns a variable name based on the simple name of the specified class appended with the specified nodeId. @param clazz class whose simple name is lowercased and user as the prefix of the variable name @param nodeId id of {@link org.kie.common.NetworkNode} @return variable name @see Class#getSimpleName()
[ "Returns", "a", "variable", "name", "based", "on", "the", "simple", "name", "of", "the", "specified", "class", "appended", "with", "the", "specified", "nodeId", "." ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/reteoo/compiled/AbstractCompilerHandler.java#L76-L79
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WLabelRenderer.java
WLabelRenderer.doRender
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { """ Paints the given {@link WLabel}. @param component the WLabel to paint. @param renderContext the RenderContext to paint to. """ WLabel label = (WLabel) component; XmlStringBuilder xml = renderContext.getWriter(); xml.appendTagOpen("ui:label"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendOptionalAttribute("for", label.getLabelFor()); WComponent what = label.getForComponent(); String whatFor = null; if (what instanceof MultiInputComponent) { whatFor = "group"; } else if (what instanceof Labelable) { whatFor = "input"; } boolean isReadOnly = ((what instanceof Input) && ((Input) what).isReadOnly()) || (what instanceof WRadioButton && ((WRadioButton) what).isReadOnly()); boolean isMandatory = (what instanceof Input) && ((Input) what).isMandatory(); xml.appendOptionalAttribute("what", whatFor); xml.appendOptionalAttribute("readonly", isReadOnly, "true"); xml.appendOptionalAttribute("required", isMandatory, "true"); xml.appendOptionalAttribute("hiddencomponent", (what != null && what.isHidden()), "true"); xml.appendOptionalAttribute("hint", label.getHint()); xml.appendOptionalAttribute("accessKey", Util.upperCase(label.getAccessKeyAsString())); xml.appendOptionalAttribute("hidden", label.isHidden(), "true"); xml.appendOptionalAttribute("toolTip", label.getToolTip()); xml.appendOptionalAttribute("accessibleText", label.getAccessibleText()); xml.appendClose(); xml.append(label.getText(), label.isEncodeText()); paintChildren(label, renderContext); xml.appendEndTag("ui:label"); }
java
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WLabel label = (WLabel) component; XmlStringBuilder xml = renderContext.getWriter(); xml.appendTagOpen("ui:label"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendOptionalAttribute("for", label.getLabelFor()); WComponent what = label.getForComponent(); String whatFor = null; if (what instanceof MultiInputComponent) { whatFor = "group"; } else if (what instanceof Labelable) { whatFor = "input"; } boolean isReadOnly = ((what instanceof Input) && ((Input) what).isReadOnly()) || (what instanceof WRadioButton && ((WRadioButton) what).isReadOnly()); boolean isMandatory = (what instanceof Input) && ((Input) what).isMandatory(); xml.appendOptionalAttribute("what", whatFor); xml.appendOptionalAttribute("readonly", isReadOnly, "true"); xml.appendOptionalAttribute("required", isMandatory, "true"); xml.appendOptionalAttribute("hiddencomponent", (what != null && what.isHidden()), "true"); xml.appendOptionalAttribute("hint", label.getHint()); xml.appendOptionalAttribute("accessKey", Util.upperCase(label.getAccessKeyAsString())); xml.appendOptionalAttribute("hidden", label.isHidden(), "true"); xml.appendOptionalAttribute("toolTip", label.getToolTip()); xml.appendOptionalAttribute("accessibleText", label.getAccessibleText()); xml.appendClose(); xml.append(label.getText(), label.isEncodeText()); paintChildren(label, renderContext); xml.appendEndTag("ui:label"); }
[ "@", "Override", "public", "void", "doRender", "(", "final", "WComponent", "component", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "WLabel", "label", "=", "(", "WLabel", ")", "component", ";", "XmlStringBuilder", "xml", "=", "renderContext", ".", "getWriter", "(", ")", ";", "xml", ".", "appendTagOpen", "(", "\"ui:label\"", ")", ";", "xml", ".", "appendAttribute", "(", "\"id\"", ",", "component", ".", "getId", "(", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"class\"", ",", "component", ".", "getHtmlClass", "(", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"track\"", ",", "component", ".", "isTracking", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"for\"", ",", "label", ".", "getLabelFor", "(", ")", ")", ";", "WComponent", "what", "=", "label", ".", "getForComponent", "(", ")", ";", "String", "whatFor", "=", "null", ";", "if", "(", "what", "instanceof", "MultiInputComponent", ")", "{", "whatFor", "=", "\"group\"", ";", "}", "else", "if", "(", "what", "instanceof", "Labelable", ")", "{", "whatFor", "=", "\"input\"", ";", "}", "boolean", "isReadOnly", "=", "(", "(", "what", "instanceof", "Input", ")", "&&", "(", "(", "Input", ")", "what", ")", ".", "isReadOnly", "(", ")", ")", "||", "(", "what", "instanceof", "WRadioButton", "&&", "(", "(", "WRadioButton", ")", "what", ")", ".", "isReadOnly", "(", ")", ")", ";", "boolean", "isMandatory", "=", "(", "what", "instanceof", "Input", ")", "&&", "(", "(", "Input", ")", "what", ")", ".", "isMandatory", "(", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"what\"", ",", "whatFor", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"readonly\"", ",", "isReadOnly", ",", "\"true\"", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"required\"", ",", "isMandatory", ",", "\"true\"", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"hiddencomponent\"", ",", "(", "what", "!=", "null", "&&", "what", ".", "isHidden", "(", ")", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"hint\"", ",", "label", ".", "getHint", "(", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"accessKey\"", ",", "Util", ".", "upperCase", "(", "label", ".", "getAccessKeyAsString", "(", ")", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"hidden\"", ",", "label", ".", "isHidden", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"toolTip\"", ",", "label", ".", "getToolTip", "(", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"accessibleText\"", ",", "label", ".", "getAccessibleText", "(", ")", ")", ";", "xml", ".", "appendClose", "(", ")", ";", "xml", ".", "append", "(", "label", ".", "getText", "(", ")", ",", "label", ".", "isEncodeText", "(", ")", ")", ";", "paintChildren", "(", "label", ",", "renderContext", ")", ";", "xml", ".", "appendEndTag", "(", "\"ui:label\"", ")", ";", "}" ]
Paints the given {@link WLabel}. @param component the WLabel to paint. @param renderContext the RenderContext to paint to.
[ "Paints", "the", "given", "{", "@link", "WLabel", "}", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WLabelRenderer.java#L27-L67
alkacon/opencms-core
src/org/opencms/ade/configuration/CmsADEConfigData.java
CmsADEConfigData.getFormattersFromSchema
protected CmsFormatterConfiguration getFormattersFromSchema(CmsObject cms, CmsResource res) { """ Gets the formatters from the schema.<p> @param cms the current CMS context @param res the resource for which the formatters should be retrieved @return the formatters from the schema """ try { return OpenCms.getResourceManager().getResourceType(res.getTypeId()).getFormattersForResource(cms, res); } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); return CmsFormatterConfiguration.EMPTY_CONFIGURATION; } }
java
protected CmsFormatterConfiguration getFormattersFromSchema(CmsObject cms, CmsResource res) { try { return OpenCms.getResourceManager().getResourceType(res.getTypeId()).getFormattersForResource(cms, res); } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); return CmsFormatterConfiguration.EMPTY_CONFIGURATION; } }
[ "protected", "CmsFormatterConfiguration", "getFormattersFromSchema", "(", "CmsObject", "cms", ",", "CmsResource", "res", ")", "{", "try", "{", "return", "OpenCms", ".", "getResourceManager", "(", ")", ".", "getResourceType", "(", "res", ".", "getTypeId", "(", ")", ")", ".", "getFormattersForResource", "(", "cms", ",", "res", ")", ";", "}", "catch", "(", "CmsException", "e", ")", "{", "LOG", ".", "error", "(", "e", ".", "getLocalizedMessage", "(", ")", ",", "e", ")", ";", "return", "CmsFormatterConfiguration", ".", "EMPTY_CONFIGURATION", ";", "}", "}" ]
Gets the formatters from the schema.<p> @param cms the current CMS context @param res the resource for which the formatters should be retrieved @return the formatters from the schema
[ "Gets", "the", "formatters", "from", "the", "schema", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsADEConfigData.java#L1116-L1124
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/Mapper.java
Mapper.addMappedClass
public MappedClass addMappedClass(final Class c) { """ Creates a MappedClass and validates it. @param c the Class to map @return the MappedClass for the given Class """ MappedClass mappedClass = mappedClasses.get(c.getName()); if (mappedClass == null) { mappedClass = new MappedClass(c, this); return addMappedClass(mappedClass, true); } return mappedClass; }
java
public MappedClass addMappedClass(final Class c) { MappedClass mappedClass = mappedClasses.get(c.getName()); if (mappedClass == null) { mappedClass = new MappedClass(c, this); return addMappedClass(mappedClass, true); } return mappedClass; }
[ "public", "MappedClass", "addMappedClass", "(", "final", "Class", "c", ")", "{", "MappedClass", "mappedClass", "=", "mappedClasses", ".", "get", "(", "c", ".", "getName", "(", ")", ")", ";", "if", "(", "mappedClass", "==", "null", ")", "{", "mappedClass", "=", "new", "MappedClass", "(", "c", ",", "this", ")", ";", "return", "addMappedClass", "(", "mappedClass", ",", "true", ")", ";", "}", "return", "mappedClass", ";", "}" ]
Creates a MappedClass and validates it. @param c the Class to map @return the MappedClass for the given Class
[ "Creates", "a", "MappedClass", "and", "validates", "it", "." ]
train
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/Mapper.java#L168-L176
UrielCh/ovh-java-sdk
ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java
ApiOvhEmailexchange.organizationName_service_exchangeService_publicFolderQuota_GET
public OvhPublicFolderQuota organizationName_service_exchangeService_publicFolderQuota_GET(String organizationName, String exchangeService) throws IOException { """ Get public folder quota usage in total available space REST: GET /email/exchange/{organizationName}/service/{exchangeService}/publicFolderQuota @param organizationName [required] The internal name of your exchange organization @param exchangeService [required] The internal name of your exchange service """ String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/publicFolderQuota"; StringBuilder sb = path(qPath, organizationName, exchangeService); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPublicFolderQuota.class); }
java
public OvhPublicFolderQuota organizationName_service_exchangeService_publicFolderQuota_GET(String organizationName, String exchangeService) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/publicFolderQuota"; StringBuilder sb = path(qPath, organizationName, exchangeService); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPublicFolderQuota.class); }
[ "public", "OvhPublicFolderQuota", "organizationName_service_exchangeService_publicFolderQuota_GET", "(", "String", "organizationName", ",", "String", "exchangeService", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/exchange/{organizationName}/service/{exchangeService}/publicFolderQuota\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "organizationName", ",", "exchangeService", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhPublicFolderQuota", ".", "class", ")", ";", "}" ]
Get public folder quota usage in total available space REST: GET /email/exchange/{organizationName}/service/{exchangeService}/publicFolderQuota @param organizationName [required] The internal name of your exchange organization @param exchangeService [required] The internal name of your exchange service
[ "Get", "public", "folder", "quota", "usage", "in", "total", "available", "space" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L364-L369
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.faulttolerance/src/com/ibm/ws/microprofile/faulttolerance/impl/async/QueuedFuture.java
QueuedFuture.start
public void start(ExecutorService executorService, Callable<Future<R>> innerTask, ThreadContextDescriptor threadContext) { """ Submit this task for execution by the given executor service. @param executorService the executor service to use @param innerTask the task to run @param threadContext the thread context to apply when running the task """ synchronized (this) { this.innerTask = innerTask; this.threadContext = threadContext; //set up the future to hold the result this.resultFuture = new CompletableFuture<Future<R>>(); //submit the innerTask (wrapped by this) for execution this.taskFuture = executorService.submit(this); } }
java
public void start(ExecutorService executorService, Callable<Future<R>> innerTask, ThreadContextDescriptor threadContext) { synchronized (this) { this.innerTask = innerTask; this.threadContext = threadContext; //set up the future to hold the result this.resultFuture = new CompletableFuture<Future<R>>(); //submit the innerTask (wrapped by this) for execution this.taskFuture = executorService.submit(this); } }
[ "public", "void", "start", "(", "ExecutorService", "executorService", ",", "Callable", "<", "Future", "<", "R", ">", ">", "innerTask", ",", "ThreadContextDescriptor", "threadContext", ")", "{", "synchronized", "(", "this", ")", "{", "this", ".", "innerTask", "=", "innerTask", ";", "this", ".", "threadContext", "=", "threadContext", ";", "//set up the future to hold the result", "this", ".", "resultFuture", "=", "new", "CompletableFuture", "<", "Future", "<", "R", ">", ">", "(", ")", ";", "//submit the innerTask (wrapped by this) for execution", "this", ".", "taskFuture", "=", "executorService", ".", "submit", "(", "this", ")", ";", "}", "}" ]
Submit this task for execution by the given executor service. @param executorService the executor service to use @param innerTask the task to run @param threadContext the thread context to apply when running the task
[ "Submit", "this", "task", "for", "execution", "by", "the", "given", "executor", "service", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.faulttolerance/src/com/ibm/ws/microprofile/faulttolerance/impl/async/QueuedFuture.java#L265-L274
dialogflow/dialogflow-android-client
ailib/src/main/java/ai/api/android/AIService.java
AIService.getService
public static AIService getService(final Context context, final AIConfiguration config) { """ Use this method to get ready to work instance @param context @param config @return instance of AIService implementation """ if (config.getRecognitionEngine() == AIConfiguration.RecognitionEngine.Google) { return new GoogleRecognitionServiceImpl(context, config); } if (config.getRecognitionEngine() == AIConfiguration.RecognitionEngine.System) { return new GoogleRecognitionServiceImpl(context, config); } else if (config.getRecognitionEngine() == AIConfiguration.RecognitionEngine.Speaktoit) { return new SpeaktoitRecognitionServiceImpl(context, config); } else { throw new UnsupportedOperationException("This engine still not supported"); } }
java
public static AIService getService(final Context context, final AIConfiguration config) { if (config.getRecognitionEngine() == AIConfiguration.RecognitionEngine.Google) { return new GoogleRecognitionServiceImpl(context, config); } if (config.getRecognitionEngine() == AIConfiguration.RecognitionEngine.System) { return new GoogleRecognitionServiceImpl(context, config); } else if (config.getRecognitionEngine() == AIConfiguration.RecognitionEngine.Speaktoit) { return new SpeaktoitRecognitionServiceImpl(context, config); } else { throw new UnsupportedOperationException("This engine still not supported"); } }
[ "public", "static", "AIService", "getService", "(", "final", "Context", "context", ",", "final", "AIConfiguration", "config", ")", "{", "if", "(", "config", ".", "getRecognitionEngine", "(", ")", "==", "AIConfiguration", ".", "RecognitionEngine", ".", "Google", ")", "{", "return", "new", "GoogleRecognitionServiceImpl", "(", "context", ",", "config", ")", ";", "}", "if", "(", "config", ".", "getRecognitionEngine", "(", ")", "==", "AIConfiguration", ".", "RecognitionEngine", ".", "System", ")", "{", "return", "new", "GoogleRecognitionServiceImpl", "(", "context", ",", "config", ")", ";", "}", "else", "if", "(", "config", ".", "getRecognitionEngine", "(", ")", "==", "AIConfiguration", ".", "RecognitionEngine", ".", "Speaktoit", ")", "{", "return", "new", "SpeaktoitRecognitionServiceImpl", "(", "context", ",", "config", ")", ";", "}", "else", "{", "throw", "new", "UnsupportedOperationException", "(", "\"This engine still not supported\"", ")", ";", "}", "}" ]
Use this method to get ready to work instance @param context @param config @return instance of AIService implementation
[ "Use", "this", "method", "to", "get", "ready", "to", "work", "instance" ]
train
https://github.com/dialogflow/dialogflow-android-client/blob/331f3ae8f2e404e245cc6024fdf44ec99feba7ee/ailib/src/main/java/ai/api/android/AIService.java#L58-L70
JodaOrg/joda-time
src/main/java/org/joda/time/chrono/LimitChronology.java
LimitChronology.getInstance
public static LimitChronology getInstance(Chronology base, ReadableDateTime lowerLimit, ReadableDateTime upperLimit) { """ Wraps another chronology, with datetime limits. When withUTC or withZone is called, the returned LimitChronology instance has the same limits, except they are time zone adjusted. @param base base chronology to wrap @param lowerLimit inclusive lower limit, or null if none @param upperLimit exclusive upper limit, or null if none @throws IllegalArgumentException if chronology is null or limits are invalid """ if (base == null) { throw new IllegalArgumentException("Must supply a chronology"); } lowerLimit = lowerLimit == null ? null : lowerLimit.toDateTime(); upperLimit = upperLimit == null ? null : upperLimit.toDateTime(); if (lowerLimit != null && upperLimit != null && !lowerLimit.isBefore(upperLimit)) { throw new IllegalArgumentException ("The lower limit must be come before than the upper limit"); } return new LimitChronology(base, (DateTime)lowerLimit, (DateTime)upperLimit); }
java
public static LimitChronology getInstance(Chronology base, ReadableDateTime lowerLimit, ReadableDateTime upperLimit) { if (base == null) { throw new IllegalArgumentException("Must supply a chronology"); } lowerLimit = lowerLimit == null ? null : lowerLimit.toDateTime(); upperLimit = upperLimit == null ? null : upperLimit.toDateTime(); if (lowerLimit != null && upperLimit != null && !lowerLimit.isBefore(upperLimit)) { throw new IllegalArgumentException ("The lower limit must be come before than the upper limit"); } return new LimitChronology(base, (DateTime)lowerLimit, (DateTime)upperLimit); }
[ "public", "static", "LimitChronology", "getInstance", "(", "Chronology", "base", ",", "ReadableDateTime", "lowerLimit", ",", "ReadableDateTime", "upperLimit", ")", "{", "if", "(", "base", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Must supply a chronology\"", ")", ";", "}", "lowerLimit", "=", "lowerLimit", "==", "null", "?", "null", ":", "lowerLimit", ".", "toDateTime", "(", ")", ";", "upperLimit", "=", "upperLimit", "==", "null", "?", "null", ":", "upperLimit", ".", "toDateTime", "(", ")", ";", "if", "(", "lowerLimit", "!=", "null", "&&", "upperLimit", "!=", "null", "&&", "!", "lowerLimit", ".", "isBefore", "(", "upperLimit", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The lower limit must be come before than the upper limit\"", ")", ";", "}", "return", "new", "LimitChronology", "(", "base", ",", "(", "DateTime", ")", "lowerLimit", ",", "(", "DateTime", ")", "upperLimit", ")", ";", "}" ]
Wraps another chronology, with datetime limits. When withUTC or withZone is called, the returned LimitChronology instance has the same limits, except they are time zone adjusted. @param base base chronology to wrap @param lowerLimit inclusive lower limit, or null if none @param upperLimit exclusive upper limit, or null if none @throws IllegalArgumentException if chronology is null or limits are invalid
[ "Wraps", "another", "chronology", "with", "datetime", "limits", ".", "When", "withUTC", "or", "withZone", "is", "called", "the", "returned", "LimitChronology", "instance", "has", "the", "same", "limits", "except", "they", "are", "time", "zone", "adjusted", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/chrono/LimitChronology.java#L64-L80
PvdBerg1998/PNet
src/main/java/nl/pvdberg/pnet/event/PacketDistributer.java
PacketDistributer.addHandler
public synchronized void addHandler(final short packetID, final PacketHandler packetHandler) { """ Adds a new handler for this specific Packet ID @param packetID Packet ID to add handler for @param packetHandler Handler for given Packet ID @throws IllegalArgumentException when Packet ID already has a registered handler """ if (registry.containsKey(packetID)) throw new IllegalArgumentException("Handler for ID: " + packetID + " already exists"); registry.put(packetID, packetHandler); }
java
public synchronized void addHandler(final short packetID, final PacketHandler packetHandler) { if (registry.containsKey(packetID)) throw new IllegalArgumentException("Handler for ID: " + packetID + " already exists"); registry.put(packetID, packetHandler); }
[ "public", "synchronized", "void", "addHandler", "(", "final", "short", "packetID", ",", "final", "PacketHandler", "packetHandler", ")", "{", "if", "(", "registry", ".", "containsKey", "(", "packetID", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"Handler for ID: \"", "+", "packetID", "+", "\" already exists\"", ")", ";", "registry", ".", "put", "(", "packetID", ",", "packetHandler", ")", ";", "}" ]
Adds a new handler for this specific Packet ID @param packetID Packet ID to add handler for @param packetHandler Handler for given Packet ID @throws IllegalArgumentException when Packet ID already has a registered handler
[ "Adds", "a", "new", "handler", "for", "this", "specific", "Packet", "ID" ]
train
https://github.com/PvdBerg1998/PNet/blob/d3dfff2ceaf69c244e0593e3f7606f171ec718bb/src/main/java/nl/pvdberg/pnet/event/PacketDistributer.java#L70-L74
jbundle/jbundle
thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/TaskProxy.java
TaskProxy.createRemoteTask
public RemoteTask createRemoteTask(Map<String, Object> properties) throws RemoteException { """ Build a new remote session and initialize it. NOTE: This is convenience method to create a task below the current APPLICATION (not below this task) @param properties to create the new remote task @return The remote Task. """ // Note: This new task's parent is MY application! BaseTransport transport = this.createProxyTransport(CREATE_REMOTE_TASK); // Don't use my method yet, since I don't have the returned ID transport.addParam(PROPERTIES, properties); String strID = (String)transport.sendMessageAndGetReply(); return new TaskProxy((ApplicationProxy)m_parentProxy, strID); // Note the parent is MY PARENT not ME. (just like the remote hierarchy) }
java
public RemoteTask createRemoteTask(Map<String, Object> properties) throws RemoteException { // Note: This new task's parent is MY application! BaseTransport transport = this.createProxyTransport(CREATE_REMOTE_TASK); // Don't use my method yet, since I don't have the returned ID transport.addParam(PROPERTIES, properties); String strID = (String)transport.sendMessageAndGetReply(); return new TaskProxy((ApplicationProxy)m_parentProxy, strID); // Note the parent is MY PARENT not ME. (just like the remote hierarchy) }
[ "public", "RemoteTask", "createRemoteTask", "(", "Map", "<", "String", ",", "Object", ">", "properties", ")", "throws", "RemoteException", "{", "// Note: This new task's parent is MY application!", "BaseTransport", "transport", "=", "this", ".", "createProxyTransport", "(", "CREATE_REMOTE_TASK", ")", ";", "// Don't use my method yet, since I don't have the returned ID", "transport", ".", "addParam", "(", "PROPERTIES", ",", "properties", ")", ";", "String", "strID", "=", "(", "String", ")", "transport", ".", "sendMessageAndGetReply", "(", ")", ";", "return", "new", "TaskProxy", "(", "(", "ApplicationProxy", ")", "m_parentProxy", ",", "strID", ")", ";", "// Note the parent is MY PARENT not ME. (just like the remote hierarchy)", "}" ]
Build a new remote session and initialize it. NOTE: This is convenience method to create a task below the current APPLICATION (not below this task) @param properties to create the new remote task @return The remote Task.
[ "Build", "a", "new", "remote", "session", "and", "initialize", "it", ".", "NOTE", ":", "This", "is", "convenience", "method", "to", "create", "a", "task", "below", "the", "current", "APPLICATION", "(", "not", "below", "this", "task", ")" ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/TaskProxy.java#L117-L123
BioPAX/Paxtools
pattern/src/main/java/org/biopax/paxtools/pattern/Pattern.java
Pattern.checkLabels
private void checkLabels(boolean forGenerative, String... label) { """ Checks if all labels (other than the last if generative) exists. @param forGenerative whether the check is performed for a generative constraint @param label labels to check @throws IllegalArgumentException when a necessary label is not found """ for (int i = 0; i < (forGenerative ? label.length - 1 : label.length); i++) { if (!hasLabel(label[i])) throw new IllegalArgumentException( "Label neither found, nor generated: " + label[i]); } }
java
private void checkLabels(boolean forGenerative, String... label) { for (int i = 0; i < (forGenerative ? label.length - 1 : label.length); i++) { if (!hasLabel(label[i])) throw new IllegalArgumentException( "Label neither found, nor generated: " + label[i]); } }
[ "private", "void", "checkLabels", "(", "boolean", "forGenerative", ",", "String", "...", "label", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "(", "forGenerative", "?", "label", ".", "length", "-", "1", ":", "label", ".", "length", ")", ";", "i", "++", ")", "{", "if", "(", "!", "hasLabel", "(", "label", "[", "i", "]", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"Label neither found, nor generated: \"", "+", "label", "[", "i", "]", ")", ";", "}", "}" ]
Checks if all labels (other than the last if generative) exists. @param forGenerative whether the check is performed for a generative constraint @param label labels to check @throws IllegalArgumentException when a necessary label is not found
[ "Checks", "if", "all", "labels", "(", "other", "than", "the", "last", "if", "generative", ")", "exists", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/Pattern.java#L264-L271
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java
CommonOps_DDRM.concatColumnsMulti
public static DMatrixRMaj concatColumnsMulti(DMatrixRMaj ...m ) { """ <p>Concatinates all the matrices together along their columns. If the rows do not match the upper elements are set to zero.</p> A = [ m[0] , ... , m[n-1] ] @param m Set of matrices @return Resulting matrix """ int rows = 0; int cols = 0; for (int i = 0; i < m.length; i++) { rows = Math.max(rows,m[i].numRows); cols += m[i].numCols; } DMatrixRMaj R = new DMatrixRMaj(rows,cols); int col = 0; for (int i = 0; i < m.length; i++) { insert(m[i],R,0,col); col += m[i].numCols; } return R; }
java
public static DMatrixRMaj concatColumnsMulti(DMatrixRMaj ...m ) { int rows = 0; int cols = 0; for (int i = 0; i < m.length; i++) { rows = Math.max(rows,m[i].numRows); cols += m[i].numCols; } DMatrixRMaj R = new DMatrixRMaj(rows,cols); int col = 0; for (int i = 0; i < m.length; i++) { insert(m[i],R,0,col); col += m[i].numCols; } return R; }
[ "public", "static", "DMatrixRMaj", "concatColumnsMulti", "(", "DMatrixRMaj", "...", "m", ")", "{", "int", "rows", "=", "0", ";", "int", "cols", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "m", ".", "length", ";", "i", "++", ")", "{", "rows", "=", "Math", ".", "max", "(", "rows", ",", "m", "[", "i", "]", ".", "numRows", ")", ";", "cols", "+=", "m", "[", "i", "]", ".", "numCols", ";", "}", "DMatrixRMaj", "R", "=", "new", "DMatrixRMaj", "(", "rows", ",", "cols", ")", ";", "int", "col", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "m", ".", "length", ";", "i", "++", ")", "{", "insert", "(", "m", "[", "i", "]", ",", "R", ",", "0", ",", "col", ")", ";", "col", "+=", "m", "[", "i", "]", ".", "numCols", ";", "}", "return", "R", ";", "}" ]
<p>Concatinates all the matrices together along their columns. If the rows do not match the upper elements are set to zero.</p> A = [ m[0] , ... , m[n-1] ] @param m Set of matrices @return Resulting matrix
[ "<p", ">", "Concatinates", "all", "the", "matrices", "together", "along", "their", "columns", ".", "If", "the", "rows", "do", "not", "match", "the", "upper", "elements", "are", "set", "to", "zero", ".", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L2815-L2832