repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
amzn/ion-java
src/com/amazon/ion/impl/bin/IonRawBinaryWriter.java
IonRawBinaryWriter.writeTypedBytes
private void writeTypedBytes(final int type, final byte[] data, final int offset, final int length) { int totalLength = 1 + length; if (length < 14) { buffer.writeUInt8(type | length); } else { // need to specify length explicitly buffer.writeUInt8(type | 0xE); final int sizeLength = buffer.writeVarUInt(length); totalLength += sizeLength; } updateLength(totalLength); buffer.writeBytes(data, offset, length); }
java
private void writeTypedBytes(final int type, final byte[] data, final int offset, final int length) { int totalLength = 1 + length; if (length < 14) { buffer.writeUInt8(type | length); } else { // need to specify length explicitly buffer.writeUInt8(type | 0xE); final int sizeLength = buffer.writeVarUInt(length); totalLength += sizeLength; } updateLength(totalLength); buffer.writeBytes(data, offset, length); }
[ "private", "void", "writeTypedBytes", "(", "final", "int", "type", ",", "final", "byte", "[", "]", "data", ",", "final", "int", "offset", ",", "final", "int", "length", ")", "{", "int", "totalLength", "=", "1", "+", "length", ";", "if", "(", "length", ...
Write a raw byte array as some type. Note that this does not do {@link #prepareValue()}.
[ "Write", "a", "raw", "byte", "array", "as", "some", "type", ".", "Note", "that", "this", "does", "not", "do", "{" ]
train
https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/bin/IonRawBinaryWriter.java#L1021-L1037
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/LoadingWorkObject.java
LoadingWorkObject.addTypeBindError
public void addTypeBindError(final TypeBindException bindException, final CellPosition address, final String fieldName, final String label) { this.errors.createFieldConversionError(fieldName, bindException.getBindClass(), bindException.getTargetValue()) .variables(bindException.getMessageVars()) .variables("validatedValue", bindException.getTargetValue()) .address(address) .label(label) .buildAndAddError(); }
java
public void addTypeBindError(final TypeBindException bindException, final CellPosition address, final String fieldName, final String label) { this.errors.createFieldConversionError(fieldName, bindException.getBindClass(), bindException.getTargetValue()) .variables(bindException.getMessageVars()) .variables("validatedValue", bindException.getTargetValue()) .address(address) .label(label) .buildAndAddError(); }
[ "public", "void", "addTypeBindError", "(", "final", "TypeBindException", "bindException", ",", "final", "CellPosition", "address", ",", "final", "String", "fieldName", ",", "final", "String", "label", ")", "{", "this", ".", "errors", ".", "createFieldConversionError...
型変換エラーを追加します。 @param bindException 型変換エラー @param address マッピング元となったセルのアドレス @param fieldName マッピング先のフィールド名 @param label ラベル。省略する場合は、nullを指定します。
[ "型変換エラーを追加します。" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/LoadingWorkObject.java#L68-L77
aws/aws-sdk-java
aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/ListDevEndpointsRequest.java
ListDevEndpointsRequest.withTags
public ListDevEndpointsRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
java
public ListDevEndpointsRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "ListDevEndpointsRequest", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
<p> Specifies to return only these tagged resources. </p> @param tags Specifies to return only these tagged resources. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Specifies", "to", "return", "only", "these", "tagged", "resources", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/ListDevEndpointsRequest.java#L162-L165
aNNiMON/Lightweight-Stream-API
stream/src/main/java/com/annimon/stream/Collectors.java
Collectors.toMap
@NotNull public static <T, K, V, M extends Map<K, V>> Collector<T, ?, M> toMap( @NotNull final Function<? super T, ? extends K> keyMapper, @NotNull final Function<? super T, ? extends V> valueMapper, @NotNull final Supplier<M> mapFactory) { return new CollectorsImpl<T, M, M>( mapFactory, new BiConsumer<M, T>() { @Override public void accept(M map, T t) { final K key = keyMapper.apply(t); final V value = Objects.requireNonNull(valueMapper.apply(t)); // To avoid calling map.get to determine duplicate keys // we check the result of map.put final V oldValue = map.put(key, value); if (oldValue != null) { // If there is duplicate key, rollback previous put operation map.put(key, oldValue); throw duplicateKeyException(key, oldValue, value); } } } ); }
java
@NotNull public static <T, K, V, M extends Map<K, V>> Collector<T, ?, M> toMap( @NotNull final Function<? super T, ? extends K> keyMapper, @NotNull final Function<? super T, ? extends V> valueMapper, @NotNull final Supplier<M> mapFactory) { return new CollectorsImpl<T, M, M>( mapFactory, new BiConsumer<M, T>() { @Override public void accept(M map, T t) { final K key = keyMapper.apply(t); final V value = Objects.requireNonNull(valueMapper.apply(t)); // To avoid calling map.get to determine duplicate keys // we check the result of map.put final V oldValue = map.put(key, value); if (oldValue != null) { // If there is duplicate key, rollback previous put operation map.put(key, oldValue); throw duplicateKeyException(key, oldValue, value); } } } ); }
[ "@", "NotNull", "public", "static", "<", "T", ",", "K", ",", "V", ",", "M", "extends", "Map", "<", "K", ",", "V", ">", ">", "Collector", "<", "T", ",", "?", ",", "M", ">", "toMap", "(", "@", "NotNull", "final", "Function", "<", "?", "super", ...
Returns a {@code Collector} that fills new {@code Map} with input elements. If the mapped keys contain duplicates, an {@code IllegalStateException} is thrown. Use {@link #toMap(Function, Function, BinaryOperator, Supplier)} to handle merging of the values. @param <T> the type of the input elements @param <K> the result type of key mapping function @param <V> the result type of value mapping function @param <M> the type of the resulting {@code Map} @param keyMapper a mapping function to produce keys @param valueMapper a mapping function to produce values @param mapFactory a supplier function that provides new {@code Map} @return a {@code Collector} @see #toMap(Function, Function, BinaryOperator, Supplier)
[ "Returns", "a", "{", "@code", "Collector", "}", "that", "fills", "new", "{", "@code", "Map", "}", "with", "input", "elements", "." ]
train
https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/Collectors.java#L224-L250
dbracewell/mango
src/main/java/com/davidbracewell/DynamicEnum.java
DynamicEnum.valueOf
public static <T extends EnumValue> T valueOf(@NonNull Class<T> enumClass, @NonNull String name) { String key = toKey(enumClass, name); T toReturn = Cast.as(GLOBAL_REPOSITORY.get(key)); if (toReturn == null) { throw new IllegalArgumentException("No enum constant " + key); } return toReturn; }
java
public static <T extends EnumValue> T valueOf(@NonNull Class<T> enumClass, @NonNull String name) { String key = toKey(enumClass, name); T toReturn = Cast.as(GLOBAL_REPOSITORY.get(key)); if (toReturn == null) { throw new IllegalArgumentException("No enum constant " + key); } return toReturn; }
[ "public", "static", "<", "T", "extends", "EnumValue", ">", "T", "valueOf", "(", "@", "NonNull", "Class", "<", "T", ">", "enumClass", ",", "@", "NonNull", "String", "name", ")", "{", "String", "key", "=", "toKey", "(", "enumClass", ",", "name", ")", "...
<p>Returns the constant of the given {@link EnumValue} class with the specified name.The normalized version of the specified name will be matched allowing for case and space variations.</p> @param <T> Specific type of EnumValue being looked up @param enumClass Class information for the EnumValue that we will check. @param name the name of the specified value @return The constant of enumClass with the specified name @throws IllegalArgumentException if the specified name is not a member of enumClass. @throws NullPointerException if either the enumClass or name are null
[ "<p", ">", "Returns", "the", "constant", "of", "the", "given", "{", "@link", "EnumValue", "}", "class", "with", "the", "specified", "name", ".", "The", "normalized", "version", "of", "the", "specified", "name", "will", "be", "matched", "allowing", "for", "...
train
https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/DynamicEnum.java#L97-L104
gallandarakhneorg/afc
advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java
DBaseFileReader.readBooleanRecordValue
@SuppressWarnings("checkstyle:magicnumber") private static int readBooleanRecordValue(DBaseFileField field, int nrecord, int nfield, byte[] rawData, int rawOffset, OutputParameter<Boolean> value) throws IOException { final int byteCode = rawData[rawOffset] & 0xFF; if (TRUE_CHARS.indexOf(byteCode) != -1) { value.set(true); return 1; } if (FALSE_CHARS.indexOf(byteCode) != -1) { value.set(false); return 1; } throw new InvalidRawDataFormatException(nrecord, nfield, Integer.toString(byteCode)); }
java
@SuppressWarnings("checkstyle:magicnumber") private static int readBooleanRecordValue(DBaseFileField field, int nrecord, int nfield, byte[] rawData, int rawOffset, OutputParameter<Boolean> value) throws IOException { final int byteCode = rawData[rawOffset] & 0xFF; if (TRUE_CHARS.indexOf(byteCode) != -1) { value.set(true); return 1; } if (FALSE_CHARS.indexOf(byteCode) != -1) { value.set(false); return 1; } throw new InvalidRawDataFormatException(nrecord, nfield, Integer.toString(byteCode)); }
[ "@", "SuppressWarnings", "(", "\"checkstyle:magicnumber\"", ")", "private", "static", "int", "readBooleanRecordValue", "(", "DBaseFileField", "field", ",", "int", "nrecord", ",", "int", "nfield", ",", "byte", "[", "]", "rawData", ",", "int", "rawOffset", ",", "O...
Read a BOOLEAN record value. @param field is the current parsed field. @param nrecord is the number of the record @param nfield is the number of the field @param rawData raw data @param rawOffset is the index at which the data could be obtained @param value will be set with the value extracted from the dBASE file @return the count of consumed bytes @throws IOException in case of error.
[ "Read", "a", "BOOLEAN", "record", "value", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java#L1148-L1164
SonarSource/sonarqube
server/sonar-db-dao/src/main/java/org/sonar/db/ce/CeQueueDao.java
CeQueueDao.resetToPendingForWorker
public int resetToPendingForWorker(DbSession session, String workerUuid) { return mapper(session).resetToPendingForWorker(workerUuid, system2.now()); }
java
public int resetToPendingForWorker(DbSession session, String workerUuid) { return mapper(session).resetToPendingForWorker(workerUuid, system2.now()); }
[ "public", "int", "resetToPendingForWorker", "(", "DbSession", "session", ",", "String", "workerUuid", ")", "{", "return", "mapper", "(", "session", ")", ".", "resetToPendingForWorker", "(", "workerUuid", ",", "system2", ".", "now", "(", ")", ")", ";", "}" ]
Update all tasks for the specified worker uuid which are not PENDING to: STATUS='PENDING', STARTED_AT=NULL, UPDATED_AT={now}.
[ "Update", "all", "tasks", "for", "the", "specified", "worker", "uuid", "which", "are", "not", "PENDING", "to", ":", "STATUS", "=", "PENDING", "STARTED_AT", "=", "NULL", "UPDATED_AT", "=", "{", "now", "}", "." ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/ce/CeQueueDao.java#L133-L135
alkacon/opencms-core
src/org/opencms/importexport/A_CmsImport.java
A_CmsImport.importAccessControlEntries
protected void importAccessControlEntries(CmsResource resource, List<CmsAccessControlEntry> aceList) { if (aceList.size() == 0) { // no ACE in the list return; } try { m_cms.importAccessControlEntries(resource, aceList); } catch (CmsException exc) { m_report.println( Messages.get().container(Messages.RPT_IMPORT_ACL_DATA_FAILED_0), I_CmsReport.FORMAT_WARNING); } }
java
protected void importAccessControlEntries(CmsResource resource, List<CmsAccessControlEntry> aceList) { if (aceList.size() == 0) { // no ACE in the list return; } try { m_cms.importAccessControlEntries(resource, aceList); } catch (CmsException exc) { m_report.println( Messages.get().container(Messages.RPT_IMPORT_ACL_DATA_FAILED_0), I_CmsReport.FORMAT_WARNING); } }
[ "protected", "void", "importAccessControlEntries", "(", "CmsResource", "resource", ",", "List", "<", "CmsAccessControlEntry", ">", "aceList", ")", "{", "if", "(", "aceList", ".", "size", "(", ")", "==", "0", ")", "{", "// no ACE in the list", "return", ";", "}...
Writes already imported access control entries for a given resource.<p> @param resource the resource assigned to the access control entries @param aceList the access control entries to create
[ "Writes", "already", "imported", "access", "control", "entries", "for", "a", "given", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/importexport/A_CmsImport.java#L647-L660
BlueBrain/bluima
modules/bluima_pdf/src/main/java/ch/epfl/bbp/uima/pdf/grobid/diff_match_patch.java
diff_match_patch.patch_make
public LinkedList<Patch> patch_make(String text1, String text2) { if (text1 == null || text2 == null) { throw new IllegalArgumentException("Null inputs. (patch_make)"); } // No diffs provided, compute our own. LinkedList<Diff> diffs = diff_main(text1, text2, true); if (diffs.size() > 2) { diff_cleanupSemantic(diffs); diff_cleanupEfficiency(diffs); } return patch_make(text1, diffs); }
java
public LinkedList<Patch> patch_make(String text1, String text2) { if (text1 == null || text2 == null) { throw new IllegalArgumentException("Null inputs. (patch_make)"); } // No diffs provided, compute our own. LinkedList<Diff> diffs = diff_main(text1, text2, true); if (diffs.size() > 2) { diff_cleanupSemantic(diffs); diff_cleanupEfficiency(diffs); } return patch_make(text1, diffs); }
[ "public", "LinkedList", "<", "Patch", ">", "patch_make", "(", "String", "text1", ",", "String", "text2", ")", "{", "if", "(", "text1", "==", "null", "||", "text2", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Null inputs. (patc...
Compute a list of patches to turn text1 into text2. A set of diffs will be computed. @param text1 Old text. @param text2 New text. @return LinkedList of Patch objects.
[ "Compute", "a", "list", "of", "patches", "to", "turn", "text1", "into", "text2", ".", "A", "set", "of", "diffs", "will", "be", "computed", "." ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_pdf/src/main/java/ch/epfl/bbp/uima/pdf/grobid/diff_match_patch.java#L1932-L1943
wisdom-framework/wisdom-jdbc
wisdom-openjpa-enhancer-plugin/src/main/java/org/wisdom/openjpa/enhancer/OpenJPAEnhancerMojo.java
OpenJPAEnhancerMojo.fileCreated
@Override public boolean fileCreated(File file) throws WatchingException { try { List<File> entities = findEntityClassFiles(); enhance(entities); return true; } catch (MojoExecutionException e) { throw new WatchingException("OpenJPA Enhancer", "Error while enhancing JPA entities", file, e); } }
java
@Override public boolean fileCreated(File file) throws WatchingException { try { List<File> entities = findEntityClassFiles(); enhance(entities); return true; } catch (MojoExecutionException e) { throw new WatchingException("OpenJPA Enhancer", "Error while enhancing JPA entities", file, e); } }
[ "@", "Override", "public", "boolean", "fileCreated", "(", "File", "file", ")", "throws", "WatchingException", "{", "try", "{", "List", "<", "File", ">", "entities", "=", "findEntityClassFiles", "(", ")", ";", "enhance", "(", "entities", ")", ";", "return", ...
Notifies the watcher that a new file is created. @param file is the file. @return {@literal false} if the pipeline processing must be interrupted for this event. Most watchers should return {@literal true} to let other watchers be notified. @throws org.wisdom.maven.WatchingException if the watcher failed to process the given file.
[ "Notifies", "the", "watcher", "that", "a", "new", "file", "is", "created", "." ]
train
https://github.com/wisdom-framework/wisdom-jdbc/blob/931f5acf0b2bcb0a8f3b683d60d326caafd09a72/wisdom-openjpa-enhancer-plugin/src/main/java/org/wisdom/openjpa/enhancer/OpenJPAEnhancerMojo.java#L259-L268
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/release/ReleaseAction.java
ReleaseAction.doApi
@SuppressWarnings({"UnusedDeclaration"}) protected void doApi(StaplerRequest req, StaplerResponse resp) throws IOException, ServletException { try { log.log(Level.INFO, "Initiating Artifactory Release Staging using API"); // Enforce release permissions project.checkPermission(ArtifactoryPlugin.RELEASE); // In case a staging user plugin is configured, the init() method invoke it: init(); // Read the values provided by the staging user plugin and assign them to data members in this class. // Those values can be overriden by URL arguments sent with the API: readStagingPluginValues(); // Read values from the request and override the staging plugin values: overrideStagingPluginParams(req); // Schedule the release build: Queue.WaitingItem item = Jenkins.getInstance().getQueue().schedule( project, 0, new Action[]{this, new CauseAction(new Cause.UserIdCause())} ); if (item == null) { log.log(Level.SEVERE, "Failed to schedule a release build following a Release API invocation"); resp.setStatus(StaplerResponse.SC_INTERNAL_SERVER_ERROR); } else { String url = req.getContextPath() + '/' + item.getUrl(); JSONObject json = new JSONObject(); json.element("queueItem", item.getId()); json.element("releaseVersion", getReleaseVersion()); json.element("nextVersion", getNextVersion()); json.element("releaseBranch", getReleaseBranch()); // Must use getOutputStream as sendRedirect uses getOutputStream (and closes it) resp.getOutputStream().print(json.toString()); resp.sendRedirect(201, url); } } catch (Exception e) { log.log(Level.SEVERE, "Artifactory Release Staging API invocation failed: " + e.getMessage(), e); resp.setStatus(StaplerResponse.SC_INTERNAL_SERVER_ERROR); ErrorResponse errorResponse = new ErrorResponse(StaplerResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage()); ObjectMapper mapper = new ObjectMapper(); mapper.enable(SerializationFeature.INDENT_OUTPUT); resp.getWriter().write(mapper.writeValueAsString(errorResponse)); } }
java
@SuppressWarnings({"UnusedDeclaration"}) protected void doApi(StaplerRequest req, StaplerResponse resp) throws IOException, ServletException { try { log.log(Level.INFO, "Initiating Artifactory Release Staging using API"); // Enforce release permissions project.checkPermission(ArtifactoryPlugin.RELEASE); // In case a staging user plugin is configured, the init() method invoke it: init(); // Read the values provided by the staging user plugin and assign them to data members in this class. // Those values can be overriden by URL arguments sent with the API: readStagingPluginValues(); // Read values from the request and override the staging plugin values: overrideStagingPluginParams(req); // Schedule the release build: Queue.WaitingItem item = Jenkins.getInstance().getQueue().schedule( project, 0, new Action[]{this, new CauseAction(new Cause.UserIdCause())} ); if (item == null) { log.log(Level.SEVERE, "Failed to schedule a release build following a Release API invocation"); resp.setStatus(StaplerResponse.SC_INTERNAL_SERVER_ERROR); } else { String url = req.getContextPath() + '/' + item.getUrl(); JSONObject json = new JSONObject(); json.element("queueItem", item.getId()); json.element("releaseVersion", getReleaseVersion()); json.element("nextVersion", getNextVersion()); json.element("releaseBranch", getReleaseBranch()); // Must use getOutputStream as sendRedirect uses getOutputStream (and closes it) resp.getOutputStream().print(json.toString()); resp.sendRedirect(201, url); } } catch (Exception e) { log.log(Level.SEVERE, "Artifactory Release Staging API invocation failed: " + e.getMessage(), e); resp.setStatus(StaplerResponse.SC_INTERNAL_SERVER_ERROR); ErrorResponse errorResponse = new ErrorResponse(StaplerResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage()); ObjectMapper mapper = new ObjectMapper(); mapper.enable(SerializationFeature.INDENT_OUTPUT); resp.getWriter().write(mapper.writeValueAsString(errorResponse)); } }
[ "@", "SuppressWarnings", "(", "{", "\"UnusedDeclaration\"", "}", ")", "protected", "void", "doApi", "(", "StaplerRequest", "req", ",", "StaplerResponse", "resp", ")", "throws", "IOException", ",", "ServletException", "{", "try", "{", "log", ".", "log", "(", "L...
This method is used to initiate a release staging process using the Artifactory Release Staging API.
[ "This", "method", "is", "used", "to", "initiate", "a", "release", "staging", "process", "using", "the", "Artifactory", "Release", "Staging", "API", "." ]
train
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/release/ReleaseAction.java#L273-L313
QSFT/Doradus
doradus-client/src/main/java/com/dell/doradus/client/Client.java
Client.openApplication
public static ApplicationSession openApplication(String appName, String host, int port, SSLTransportParameters sslParams, Credentials credentials) { Utils.require(!Utils.isEmpty(appName), "appName"); Utils.require(!Utils.isEmpty(host), "host"); try (Client client = new Client(host, port, sslParams)) { client.setCredentials(credentials); ApplicationDefinition appDef = client.getAppDef(appName); Utils.require(appDef != null, "Unknown application: %s", appName); RESTClient restClient = new RESTClient(client.m_restClient); return openApplication(appDef, restClient); } }
java
public static ApplicationSession openApplication(String appName, String host, int port, SSLTransportParameters sslParams, Credentials credentials) { Utils.require(!Utils.isEmpty(appName), "appName"); Utils.require(!Utils.isEmpty(host), "host"); try (Client client = new Client(host, port, sslParams)) { client.setCredentials(credentials); ApplicationDefinition appDef = client.getAppDef(appName); Utils.require(appDef != null, "Unknown application: %s", appName); RESTClient restClient = new RESTClient(client.m_restClient); return openApplication(appDef, restClient); } }
[ "public", "static", "ApplicationSession", "openApplication", "(", "String", "appName", ",", "String", "host", ",", "int", "port", ",", "SSLTransportParameters", "sslParams", ",", "Credentials", "credentials", ")", "{", "Utils", ".", "require", "(", "!", "Utils", ...
Create an {@link ApplicationSession} for the given application name on the Doradus server, creating a new connection the given REST API host, port, and TLS/SSL parameters. This static method allows an application session to be created without creating a Client object and then calling {@link #openApplication(String)}. If the given sslParams is null, an unsecured (HTTP) connectio is opened. Otherwise, a TLS/SSL connection is created using the given credentials. An exception is thrown if the given application is unknown or cannot be accessed or if a connection cannot be established. If successful, the session object will be specific to the type of application opened, and it will have its own REST session to the Doradus server. @param appName Name of an application to open. @param host REST API host name or IP address. @param port REST API port number. @param sslParams {@link SSLTransportParameters} object containing TLS/SSL parameters to use, or null to open an HTTP connection. @param credentials {@link Credentials} to use for all requests with the new application session. Can be null to use an unauthenticated session. @return {@link ApplicationSession} through which the application can be accessed. @see com.dell.doradus.client.OLAPSession @see com.dell.doradus.client.SpiderSession
[ "Create", "an", "{", "@link", "ApplicationSession", "}", "for", "the", "given", "application", "name", "on", "the", "Doradus", "server", "creating", "a", "new", "connection", "the", "given", "REST", "API", "host", "port", "and", "TLS", "/", "SSL", "parameter...
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-client/src/main/java/com/dell/doradus/client/Client.java#L223-L236
codecentric/zucchini
zucchini-web/src/main/java/de/codecentric/zucchini/web/results/AbstractWebResult.java
AbstractWebResult.injectVariables
@SuppressWarnings("WeakerAccess") protected final void injectVariables(Map<String, String> variables, By element) { if (element instanceof VariablesAware) { ((VariablesAware) element).setVariables(variables); } }
java
@SuppressWarnings("WeakerAccess") protected final void injectVariables(Map<String, String> variables, By element) { if (element instanceof VariablesAware) { ((VariablesAware) element).setVariables(variables); } }
[ "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "protected", "final", "void", "injectVariables", "(", "Map", "<", "String", ",", "String", ">", "variables", ",", "By", "element", ")", "{", "if", "(", "element", "instanceof", "VariablesAware", ")", "{", ...
This method can be used to inject variables into {@link org.openqa.selenium.By} instances that implement {@link de.codecentric.zucchini.bdd.dsl.VariablesAware}. If the element does not implement {@link de.codecentric.zucchini.bdd.dsl.VariablesAware}, then no injection will occur. @param variables The variables that will be injected. @param element The element.
[ "This", "method", "can", "be", "used", "to", "inject", "variables", "into", "{", "@link", "org", ".", "openqa", ".", "selenium", ".", "By", "}", "instances", "that", "implement", "{", "@link", "de", ".", "codecentric", ".", "zucchini", ".", "bdd", ".", ...
train
https://github.com/codecentric/zucchini/blob/61541cd8ce666ef21ad943486a7c0eb53310ed5a/zucchini-web/src/main/java/de/codecentric/zucchini/web/results/AbstractWebResult.java#L60-L65
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/symmetric/RC4.java
RC4.decrypt
public String decrypt(byte[] message, Charset charset) throws CryptoException { return StrUtil.str(crypt(message), charset); }
java
public String decrypt(byte[] message, Charset charset) throws CryptoException { return StrUtil.str(crypt(message), charset); }
[ "public", "String", "decrypt", "(", "byte", "[", "]", "message", ",", "Charset", "charset", ")", "throws", "CryptoException", "{", "return", "StrUtil", ".", "str", "(", "crypt", "(", "message", ")", ",", "charset", ")", ";", "}" ]
解密 @param message 消息 @param charset 编码 @return 明文 @throws CryptoException key长度小于5或者大于255抛出此异常
[ "解密" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/symmetric/RC4.java#L72-L74
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/linear/StochasticMultinomialLogisticRegression.java
StochasticMultinomialLogisticRegression.setAlpha
public void setAlpha(double alpha) { if(alpha < 0 || Double.isNaN(alpha) || Double.isInfinite(alpha)) throw new IllegalArgumentException("Extra parameter must be non negative, not " + alpha); this.alpha = alpha; }
java
public void setAlpha(double alpha) { if(alpha < 0 || Double.isNaN(alpha) || Double.isInfinite(alpha)) throw new IllegalArgumentException("Extra parameter must be non negative, not " + alpha); this.alpha = alpha; }
[ "public", "void", "setAlpha", "(", "double", "alpha", ")", "{", "if", "(", "alpha", "<", "0", "||", "Double", ".", "isNaN", "(", "alpha", ")", "||", "Double", ".", "isInfinite", "(", "alpha", ")", ")", "throw", "new", "IllegalArgumentException", "(", "...
Sets the extra parameter alpha. This is used for some priors that take an extra parameter. This is {@link Prior#CAUCHY} and {@link Prior#ELASTIC}. If these two priors are not in use, the value is ignored. @param alpha the extra parameter value to use. Must be positive
[ "Sets", "the", "extra", "parameter", "alpha", ".", "This", "is", "used", "for", "some", "priors", "that", "take", "an", "extra", "parameter", ".", "This", "is", "{", "@link", "Prior#CAUCHY", "}", "and", "{", "@link", "Prior#ELASTIC", "}", ".", "If", "the...
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/StochasticMultinomialLogisticRegression.java#L315-L320
Chorus-bdd/Chorus
interpreter/chorus-interpreter/src/main/java/org/chorusbdd/chorus/interpreter/startup/InterpreterBuilder.java
InterpreterBuilder.buildAndConfigure
public ChorusInterpreter buildAndConfigure(ConfigProperties config, SubsystemManager subsystemManager) { ChorusInterpreter chorusInterpreter = new ChorusInterpreter(listenerSupport); chorusInterpreter.setHandlerClassBasePackages(config.getValues(ChorusConfigProperty.HANDLER_PACKAGES)); chorusInterpreter.setScenarioTimeoutMillis(Integer.valueOf(config.getValue(ChorusConfigProperty.SCENARIO_TIMEOUT)) * 1000); chorusInterpreter.setDryRun(config.isTrue(ChorusConfigProperty.DRY_RUN)); chorusInterpreter.setSubsystemManager(subsystemManager); StepCatalogue stepCatalogue = createStepCatalogue(config); chorusInterpreter.setStepCatalogue(stepCatalogue); return chorusInterpreter; }
java
public ChorusInterpreter buildAndConfigure(ConfigProperties config, SubsystemManager subsystemManager) { ChorusInterpreter chorusInterpreter = new ChorusInterpreter(listenerSupport); chorusInterpreter.setHandlerClassBasePackages(config.getValues(ChorusConfigProperty.HANDLER_PACKAGES)); chorusInterpreter.setScenarioTimeoutMillis(Integer.valueOf(config.getValue(ChorusConfigProperty.SCENARIO_TIMEOUT)) * 1000); chorusInterpreter.setDryRun(config.isTrue(ChorusConfigProperty.DRY_RUN)); chorusInterpreter.setSubsystemManager(subsystemManager); StepCatalogue stepCatalogue = createStepCatalogue(config); chorusInterpreter.setStepCatalogue(stepCatalogue); return chorusInterpreter; }
[ "public", "ChorusInterpreter", "buildAndConfigure", "(", "ConfigProperties", "config", ",", "SubsystemManager", "subsystemManager", ")", "{", "ChorusInterpreter", "chorusInterpreter", "=", "new", "ChorusInterpreter", "(", "listenerSupport", ")", ";", "chorusInterpreter", "....
Run the interpreter, collating results into the executionToken
[ "Run", "the", "interpreter", "collating", "results", "into", "the", "executionToken" ]
train
https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-interpreter/src/main/java/org/chorusbdd/chorus/interpreter/startup/InterpreterBuilder.java#L56-L66
seancfoley/IPAddress
IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSection.java
IPAddressSection.isPrefixSubnet
protected static boolean isPrefixSubnet(IPAddressSegment sectionSegments[], Integer networkPrefixLength, IPAddressNetwork<?, ?, ?, ?, ?> network, boolean fullRangeOnly) { int segmentCount = sectionSegments.length; if(segmentCount == 0) { return false; } IPAddressSegment seg = sectionSegments[0]; return ParsedAddressGrouping.isPrefixSubnet( (segmentIndex) -> sectionSegments[segmentIndex].getSegmentValue(), (segmentIndex) -> sectionSegments[segmentIndex].getUpperSegmentValue(), segmentCount, seg.getByteCount(), seg.getBitCount(), seg.getMaxSegmentValue(), networkPrefixLength, network.getPrefixConfiguration(), fullRangeOnly); }
java
protected static boolean isPrefixSubnet(IPAddressSegment sectionSegments[], Integer networkPrefixLength, IPAddressNetwork<?, ?, ?, ?, ?> network, boolean fullRangeOnly) { int segmentCount = sectionSegments.length; if(segmentCount == 0) { return false; } IPAddressSegment seg = sectionSegments[0]; return ParsedAddressGrouping.isPrefixSubnet( (segmentIndex) -> sectionSegments[segmentIndex].getSegmentValue(), (segmentIndex) -> sectionSegments[segmentIndex].getUpperSegmentValue(), segmentCount, seg.getByteCount(), seg.getBitCount(), seg.getMaxSegmentValue(), networkPrefixLength, network.getPrefixConfiguration(), fullRangeOnly); }
[ "protected", "static", "boolean", "isPrefixSubnet", "(", "IPAddressSegment", "sectionSegments", "[", "]", ",", "Integer", "networkPrefixLength", ",", "IPAddressNetwork", "<", "?", ",", "?", ",", "?", ",", "?", ",", "?", ">", "network", ",", "boolean", "fullRan...
/* Starting from the first host bit according to the prefix, if the section is a sequence of zeros in both low and high values, followed by a sequence where low values are zero and high values are 1, then the section is a subnet prefix. Note that this includes sections where hosts are all zeros, or sections where hosts are full range of values, so the sequence of zeros can be empty and the sequence of where low values are zero and high values are 1 can be empty as well. However, if they are both empty, then this returns false, there must be at least one bit in the sequence.
[ "/", "*", "Starting", "from", "the", "first", "host", "bit", "according", "to", "the", "prefix", "if", "the", "section", "is", "a", "sequence", "of", "zeros", "in", "both", "low", "and", "high", "values", "followed", "by", "a", "sequence", "where", "low"...
train
https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSection.java#L239-L255
depsypher/pngtastic
src/main/java/com/googlecode/pngtastic/core/processing/Base64.java
Base64.encodeToFile
public static void encodeToFile(byte[] dataToEncode, String filename) throws IOException { if (dataToEncode == null) { throw new NullPointerException("Data to encode was null."); } Base64.OutputStream bos = null; try { bos = new Base64.OutputStream(new java.io.FileOutputStream(filename), Base64.ENCODE); bos.write(dataToEncode); } catch (IOException e) { throw e; // Catch and throw to execute finally{} block } finally { try { if (bos != null) { bos.close(); } } catch (Exception e) { } } }
java
public static void encodeToFile(byte[] dataToEncode, String filename) throws IOException { if (dataToEncode == null) { throw new NullPointerException("Data to encode was null."); } Base64.OutputStream bos = null; try { bos = new Base64.OutputStream(new java.io.FileOutputStream(filename), Base64.ENCODE); bos.write(dataToEncode); } catch (IOException e) { throw e; // Catch and throw to execute finally{} block } finally { try { if (bos != null) { bos.close(); } } catch (Exception e) { } } }
[ "public", "static", "void", "encodeToFile", "(", "byte", "[", "]", "dataToEncode", ",", "String", "filename", ")", "throws", "IOException", "{", "if", "(", "dataToEncode", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"Data to encode was...
Convenience method for encoding data to a file. <p>As of v 2.3, if there is a error, the method will throw an java.io.IOException. <b>This is new to v2.3!</b> In earlier versions, it just returned false, but in retrospect that's a pretty poor way to handle it.</p> @param dataToEncode byte array of data to encode in base64 form @param filename Filename for saving encoded data @throws IOException if there is an error @throws NullPointerException if dataToEncode is null @since 2.1
[ "Convenience", "method", "for", "encoding", "data", "to", "a", "file", "." ]
train
https://github.com/depsypher/pngtastic/blob/13fd2a63dd8b2febd7041273889a1bba4f2a6a07/src/main/java/com/googlecode/pngtastic/core/processing/Base64.java#L1288-L1307
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photosets/PhotosetsInterface.java
PhotosetsInterface.editMeta
public void editMeta(String photosetId, String title, String description) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_EDIT_META); parameters.put("photoset_id", photosetId); parameters.put("title", title); if (description != null) { parameters.put("description", description); } Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
java
public void editMeta(String photosetId, String title, String description) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_EDIT_META); parameters.put("photoset_id", photosetId); parameters.put("title", title); if (description != null) { parameters.put("description", description); } Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
[ "public", "void", "editMeta", "(", "String", "photosetId", ",", "String", "title", ",", "String", "description", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object...
Modify the meta-data for a photoset. @param photosetId The photoset ID @param title A new title @param description A new description (can be null) @throws FlickrException
[ "Modify", "the", "meta", "-", "data", "for", "a", "photoset", "." ]
train
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photosets/PhotosetsInterface.java#L162-L176
Azure/azure-sdk-for-java
resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java
ResourcesInner.beginCreateOrUpdate
public GenericResourceInner beginCreateOrUpdate(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters).toBlocking().single().body(); }
java
public GenericResourceInner beginCreateOrUpdate(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters).toBlocking().single().body(); }
[ "public", "GenericResourceInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "resourceProviderNamespace", ",", "String", "parentResourcePath", ",", "String", "resourceType", ",", "String", "resourceName", ",", "String", "apiVersion", ",", "G...
Creates a resource. @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. @param resourceProviderNamespace The namespace of the resource provider. @param parentResourcePath The parent resource identity. @param resourceType The resource type of the resource to create. @param resourceName The name of the resource to create. @param apiVersion The API version to use for the operation. @param parameters Parameters for creating or updating the resource. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the GenericResourceInner object if successful.
[ "Creates", "a", "resource", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java#L1396-L1398
aws/aws-sdk-java
aws-java-sdk-sns/src/main/java/com/amazonaws/services/sns/model/Endpoint.java
Endpoint.withAttributes
public Endpoint withAttributes(java.util.Map<String, String> attributes) { setAttributes(attributes); return this; }
java
public Endpoint withAttributes(java.util.Map<String, String> attributes) { setAttributes(attributes); return this; }
[ "public", "Endpoint", "withAttributes", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "attributes", ")", "{", "setAttributes", "(", "attributes", ")", ";", "return", "this", ";", "}" ]
<p> Attributes for endpoint. </p> @param attributes Attributes for endpoint. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Attributes", "for", "endpoint", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-sns/src/main/java/com/amazonaws/services/sns/model/Endpoint.java#L119-L122
amplexus/java-flac-encoder
src/main/java/net/sourceforge/javaflacencoder/MetadataBlockStreamInfo.java
MetadataBlockStreamInfo.getStreamInfo
public static EncodedElement getStreamInfo(StreamConfiguration sc, int minFrameSize, int maxFrameSize, long samplesInStream, byte[] md5Hash) { int bytes = getByteSize(); EncodedElement ele = new EncodedElement(bytes, 0); int encodedBitsPerSample = sc.getBitsPerSample()-1; ele.addInt(sc.getMinBlockSize(), 16); ele.addInt(sc.getMaxBlockSize(), 16); ele.addInt(minFrameSize, 24); ele.addInt(maxFrameSize, 24); ele.addInt(sc.getSampleRate(), 20); ele.addInt(sc.getChannelCount()-1, 3); ele.addInt(encodedBitsPerSample, 5); ele.addLong(samplesInStream, 36); for(int i = 0; i < 16; i++) { ele.addInt(md5Hash[i], 8); } return ele; }
java
public static EncodedElement getStreamInfo(StreamConfiguration sc, int minFrameSize, int maxFrameSize, long samplesInStream, byte[] md5Hash) { int bytes = getByteSize(); EncodedElement ele = new EncodedElement(bytes, 0); int encodedBitsPerSample = sc.getBitsPerSample()-1; ele.addInt(sc.getMinBlockSize(), 16); ele.addInt(sc.getMaxBlockSize(), 16); ele.addInt(minFrameSize, 24); ele.addInt(maxFrameSize, 24); ele.addInt(sc.getSampleRate(), 20); ele.addInt(sc.getChannelCount()-1, 3); ele.addInt(encodedBitsPerSample, 5); ele.addLong(samplesInStream, 36); for(int i = 0; i < 16; i++) { ele.addInt(md5Hash[i], 8); } return ele; }
[ "public", "static", "EncodedElement", "getStreamInfo", "(", "StreamConfiguration", "sc", ",", "int", "minFrameSize", ",", "int", "maxFrameSize", ",", "long", "samplesInStream", ",", "byte", "[", "]", "md5Hash", ")", "{", "int", "bytes", "=", "getByteSize", "(", ...
Create a FLAC StreamInfo metadata block with the given parameters. Because of the data stored in a StreamInfo block, this should generally be created only after all encoding is done. @param sc StreamConfiguration used in this FLAC stream. @param minFrameSize Size of smallest frame in FLAC stream. @param maxFrameSize Size of largest frame in FLAC stream. @param samplesInStream Total number of inter-channel audio samples in FLAC stream. @param md5Hash MD5 hash of the raw audio samples. @return EncodedElement containing created StreamInfo block.
[ "Create", "a", "FLAC", "StreamInfo", "metadata", "block", "with", "the", "given", "parameters", ".", "Because", "of", "the", "data", "stored", "in", "a", "StreamInfo", "block", "this", "should", "generally", "be", "created", "only", "after", "all", "encoding",...
train
https://github.com/amplexus/java-flac-encoder/blob/3d536b877dee2a3fd4ab2e0d9569e292cae93bc9/src/main/java/net/sourceforge/javaflacencoder/MetadataBlockStreamInfo.java#L65-L82
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java
CalendarCodeGenerator.addWrapper
private void addWrapper(MethodSpec.Builder method, String pattern) { method.addComment("$S", pattern); for (Node node : WRAPPER_PARSER.parseWrapper(pattern)) { if (node instanceof Text) { method.addStatement("b.append($S)", ((Text)node).text()); } else if (node instanceof Field) { Field field = (Field)node; switch (field.ch()) { case '0': method.beginControlFlow("if (timeType != null)"); method.addStatement("formatTime(timeType, d, b)"); method.nextControlFlow("else"); method.addStatement("formatSkeleton(timeSkel, d, b)"); method.endControlFlow(); break; case '1': method.beginControlFlow("if (dateType != null)"); method.addStatement("formatDate(dateType, d, b)"); method.nextControlFlow("else"); method.addStatement("formatSkeleton(dateSkel, d, b)"); method.endControlFlow(); break; } } } }
java
private void addWrapper(MethodSpec.Builder method, String pattern) { method.addComment("$S", pattern); for (Node node : WRAPPER_PARSER.parseWrapper(pattern)) { if (node instanceof Text) { method.addStatement("b.append($S)", ((Text)node).text()); } else if (node instanceof Field) { Field field = (Field)node; switch (field.ch()) { case '0': method.beginControlFlow("if (timeType != null)"); method.addStatement("formatTime(timeType, d, b)"); method.nextControlFlow("else"); method.addStatement("formatSkeleton(timeSkel, d, b)"); method.endControlFlow(); break; case '1': method.beginControlFlow("if (dateType != null)"); method.addStatement("formatDate(dateType, d, b)"); method.nextControlFlow("else"); method.addStatement("formatSkeleton(dateSkel, d, b)"); method.endControlFlow(); break; } } } }
[ "private", "void", "addWrapper", "(", "MethodSpec", ".", "Builder", "method", ",", "String", "pattern", ")", "{", "method", ".", "addComment", "(", "\"$S\"", ",", "pattern", ")", ";", "for", "(", "Node", "node", ":", "WRAPPER_PARSER", ".", "parseWrapper", ...
Formats a date-time combination into a wrapper format, e.g. "{1} at {0}"
[ "Formats", "a", "date", "-", "time", "combination", "into", "a", "wrapper", "format", "e", ".", "g", ".", "{", "1", "}", "at", "{", "0", "}" ]
train
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java#L345-L372
apereo/cas
support/cas-server-support-x509-core/src/main/java/org/apereo/cas/adaptors/x509/authentication/principal/X509CommonNameEDIPIPrincipalResolver.java
X509CommonNameEDIPIPrincipalResolver.isTokenCommonName
private static boolean isTokenCommonName(final String inToken) { val st = new StringTokenizer(inToken, "="); return st.nextToken().equals(COMMON_NAME_VAR); }
java
private static boolean isTokenCommonName(final String inToken) { val st = new StringTokenizer(inToken, "="); return st.nextToken().equals(COMMON_NAME_VAR); }
[ "private", "static", "boolean", "isTokenCommonName", "(", "final", "String", "inToken", ")", "{", "val", "st", "=", "new", "StringTokenizer", "(", "inToken", ",", "\"=\"", ")", ";", "return", "st", ".", "nextToken", "(", ")", ".", "equals", "(", "COMMON_NA...
This method determines whether or not the input token is the Common Name (CN). @param inToken The input token to be tested @return Returns boolean value indicating whether or not the token string is the Common Name (CN) number
[ "This", "method", "determines", "whether", "or", "not", "the", "input", "token", "is", "the", "Common", "Name", "(", "CN", ")", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-x509-core/src/main/java/org/apereo/cas/adaptors/x509/authentication/principal/X509CommonNameEDIPIPrincipalResolver.java#L104-L107
mercadopago/dx-java
src/main/java/com/mercadopago/core/MPBase.java
MPBase.fillResource
private static <T extends MPBase> T fillResource(T sourceResource, T destinationResource) throws MPException { Field[] declaredFields = destinationResource.getClass().getDeclaredFields(); for (Field field : declaredFields) { try { Field originField = sourceResource.getClass().getDeclaredField(field.getName()); field.setAccessible(true); originField.setAccessible(true); field.set(destinationResource, originField.get(sourceResource)); } catch (Exception ex) { throw new MPException(ex); } } return destinationResource; }
java
private static <T extends MPBase> T fillResource(T sourceResource, T destinationResource) throws MPException { Field[] declaredFields = destinationResource.getClass().getDeclaredFields(); for (Field field : declaredFields) { try { Field originField = sourceResource.getClass().getDeclaredField(field.getName()); field.setAccessible(true); originField.setAccessible(true); field.set(destinationResource, originField.get(sourceResource)); } catch (Exception ex) { throw new MPException(ex); } } return destinationResource; }
[ "private", "static", "<", "T", "extends", "MPBase", ">", "T", "fillResource", "(", "T", "sourceResource", ",", "T", "destinationResource", ")", "throws", "MPException", "{", "Field", "[", "]", "declaredFields", "=", "destinationResource", ".", "getClass", "(", ...
Copies the atributes from an obj to a destination obj @param sourceResource source resource obj @param destinationResource destination resource obj @param <T> @return @throws MPException
[ "Copies", "the", "atributes", "from", "an", "obj", "to", "a", "destination", "obj" ]
train
https://github.com/mercadopago/dx-java/blob/9df65a6bfb4db0c1fddd7699a5b109643961b03f/src/main/java/com/mercadopago/core/MPBase.java#L393-L407
nmorel/gwt-jackson
gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/client/deser/array/AbstractArrayJsonDeserializer.java
AbstractArrayJsonDeserializer.doDeserializeNonArray
protected T doDeserializeNonArray( JsonReader reader, JsonDeserializationContext ctx, JsonDeserializerParameters params ) { if ( ctx.isAcceptSingleValueAsArray() ) { return doDeserializeSingleArray( reader, ctx, params ); } else { throw ctx.traceError( "Cannot deserialize an array out of " + reader.peek() + " token", reader ); } }
java
protected T doDeserializeNonArray( JsonReader reader, JsonDeserializationContext ctx, JsonDeserializerParameters params ) { if ( ctx.isAcceptSingleValueAsArray() ) { return doDeserializeSingleArray( reader, ctx, params ); } else { throw ctx.traceError( "Cannot deserialize an array out of " + reader.peek() + " token", reader ); } }
[ "protected", "T", "doDeserializeNonArray", "(", "JsonReader", "reader", ",", "JsonDeserializationContext", "ctx", ",", "JsonDeserializerParameters", "params", ")", "{", "if", "(", "ctx", ".", "isAcceptSingleValueAsArray", "(", ")", ")", "{", "return", "doDeserializeSi...
<p>doDeserializeNonArray</p> @param reader a {@link com.github.nmorel.gwtjackson.client.stream.JsonReader} object. @param ctx a {@link com.github.nmorel.gwtjackson.client.JsonDeserializationContext} object. @param params a {@link com.github.nmorel.gwtjackson.client.JsonDeserializerParameters} object. @return a T object.
[ "<p", ">", "doDeserializeNonArray<", "/", "p", ">" ]
train
https://github.com/nmorel/gwt-jackson/blob/3fdc4350a27a9b64fc437d5fe516bf9191b74824/gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/client/deser/array/AbstractArrayJsonDeserializer.java#L65-L71
jeremiehuchet/acrachilisync
acrachilisync-core/src/main/java/fr/dudie/acrachilisync/utils/ChiliprojectUtils.java
ChiliprojectUtils.isSynchronized
public static boolean isSynchronized(final AcraReport pReport, final Issue pIssue) throws IssueParseException { final IssueDescriptionReader reader = new IssueDescriptionReader(pIssue); return CollectionUtils.exists(reader.getOccurrences(), new ReportPredicate(pReport)); }
java
public static boolean isSynchronized(final AcraReport pReport, final Issue pIssue) throws IssueParseException { final IssueDescriptionReader reader = new IssueDescriptionReader(pIssue); return CollectionUtils.exists(reader.getOccurrences(), new ReportPredicate(pReport)); }
[ "public", "static", "boolean", "isSynchronized", "(", "final", "AcraReport", "pReport", ",", "final", "Issue", "pIssue", ")", "throws", "IssueParseException", "{", "final", "IssueDescriptionReader", "reader", "=", "new", "IssueDescriptionReader", "(", "pIssue", ")", ...
Gets wheter or not the given report has already been synchronized with the given issue. @param pReport an ACRA report @param pIssue a Chiliproject issue @return true if the given report has already been synchronized with the given issue @throws IssueParseException the Date of one of the synchronized issue is unreadable
[ "Gets", "wheter", "or", "not", "the", "given", "report", "has", "already", "been", "synchronized", "with", "the", "given", "issue", "." ]
train
https://github.com/jeremiehuchet/acrachilisync/blob/4eadb0218623e77e0d92b5a08515eea2db51e988/acrachilisync-core/src/main/java/fr/dudie/acrachilisync/utils/ChiliprojectUtils.java#L55-L60
voldemort/voldemort
src/java/voldemort/utils/UpdateClusterUtils.java
UpdateClusterUtils.addPartitionToNode
public static Node addPartitionToNode(final Node node, Integer donatedPartition) { return UpdateClusterUtils.addPartitionsToNode(node, Sets.newHashSet(donatedPartition)); }
java
public static Node addPartitionToNode(final Node node, Integer donatedPartition) { return UpdateClusterUtils.addPartitionsToNode(node, Sets.newHashSet(donatedPartition)); }
[ "public", "static", "Node", "addPartitionToNode", "(", "final", "Node", "node", ",", "Integer", "donatedPartition", ")", "{", "return", "UpdateClusterUtils", ".", "addPartitionsToNode", "(", "node", ",", "Sets", ".", "newHashSet", "(", "donatedPartition", ")", ")"...
Add a partition to the node provided @param node The node to which we'll add the partition @param donatedPartition The partition to add @return The new node with the new partition
[ "Add", "a", "partition", "to", "the", "node", "provided" ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/UpdateClusterUtils.java#L67-L69
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/util/StreamUtil.java
StreamUtil.cloneContent
public static InputStream cloneContent(InputStream source, int readbackSize, ByteArrayOutputStream target) throws IOException { if (source == null) { return null; } // if the source supports mark/reset then we read and then reset up to the read-back size if (source.markSupported()) { readbackSize = Math.max(TEN_KB, readbackSize); // at least 10 KB (minimal waste, handles those -1 ContentLength cases) source.mark(readbackSize); copyContentIntoOutputStream(source, target, readbackSize, false); source.reset(); return source; } else { copyContentIntoOutputStream(source, target, ONE_MB, true); byte[] fullContentBytes = target.toByteArray(); // if we can't reset the source we need to create a replacement stream so others can read the content return new ByteArrayInputStream(fullContentBytes); } }
java
public static InputStream cloneContent(InputStream source, int readbackSize, ByteArrayOutputStream target) throws IOException { if (source == null) { return null; } // if the source supports mark/reset then we read and then reset up to the read-back size if (source.markSupported()) { readbackSize = Math.max(TEN_KB, readbackSize); // at least 10 KB (minimal waste, handles those -1 ContentLength cases) source.mark(readbackSize); copyContentIntoOutputStream(source, target, readbackSize, false); source.reset(); return source; } else { copyContentIntoOutputStream(source, target, ONE_MB, true); byte[] fullContentBytes = target.toByteArray(); // if we can't reset the source we need to create a replacement stream so others can read the content return new ByteArrayInputStream(fullContentBytes); } }
[ "public", "static", "InputStream", "cloneContent", "(", "InputStream", "source", ",", "int", "readbackSize", ",", "ByteArrayOutputStream", "target", ")", "throws", "IOException", "{", "if", "(", "source", "==", "null", ")", "{", "return", "null", ";", "}", "//...
used when you want to clone a InputStream's content and still have it appear "rewound" to the stream beginning @param source the stream around the contents we want to clone @param readbackSize the farthest we should read a resetable stream before giving up @param target an output stream into which we place a copy of the content read from source @return the source if it was resetable; a new stream rewound around the source data otherwise @throws IOException if any issues occur with the reading of bytes from the source stream
[ "used", "when", "you", "want", "to", "clone", "a", "InputStream", "s", "content", "and", "still", "have", "it", "appear", "rewound", "to", "the", "stream", "beginning" ]
train
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/util/StreamUtil.java#L99-L116
radkovo/jStyleParser
src/main/java/cz/vutbr/web/domassign/Variator.java
Variator.tryOneTermVariant
public boolean tryOneTermVariant(int variant, Declaration d, Map<String, CSSProperty> properties, Map<String, Term<?>> values) { // only one term is allowed if (d.size() != 1) return false; // try inherit variant if (checkInherit(variant, d.get(0), properties)) return true; this.terms = new ArrayList<Term<?>>(); this.terms.add(d.get(0)); return variant(variant, new IntegerRef(0), properties, values); }
java
public boolean tryOneTermVariant(int variant, Declaration d, Map<String, CSSProperty> properties, Map<String, Term<?>> values) { // only one term is allowed if (d.size() != 1) return false; // try inherit variant if (checkInherit(variant, d.get(0), properties)) return true; this.terms = new ArrayList<Term<?>>(); this.terms.add(d.get(0)); return variant(variant, new IntegerRef(0), properties, values); }
[ "public", "boolean", "tryOneTermVariant", "(", "int", "variant", ",", "Declaration", "d", ",", "Map", "<", "String", ",", "CSSProperty", ">", "properties", ",", "Map", "<", "String", ",", "Term", "<", "?", ">", ">", "values", ")", "{", "// only one term is...
Uses variator functionality to test selected variant on term @param variant Which variant will be tested @param d The declaration on which variant will be tested @param properties Properties map where to store property type @param values Values map where to store property value @return <code>true</code> in case of success, <code>false</code> otherwise
[ "Uses", "variator", "functionality", "to", "test", "selected", "variant", "on", "term" ]
train
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/Variator.java#L264-L279
Azure/azure-sdk-for-java
sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansInner.java
DatabaseVulnerabilityAssessmentScansInner.listByDatabaseWithServiceResponseAsync
public Observable<ServiceResponse<Page<VulnerabilityAssessmentScanRecordInner>>> listByDatabaseWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String databaseName) { return listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName) .concatMap(new Func1<ServiceResponse<Page<VulnerabilityAssessmentScanRecordInner>>, Observable<ServiceResponse<Page<VulnerabilityAssessmentScanRecordInner>>>>() { @Override public Observable<ServiceResponse<Page<VulnerabilityAssessmentScanRecordInner>>> call(ServiceResponse<Page<VulnerabilityAssessmentScanRecordInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listByDatabaseNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<VulnerabilityAssessmentScanRecordInner>>> listByDatabaseWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String databaseName) { return listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName) .concatMap(new Func1<ServiceResponse<Page<VulnerabilityAssessmentScanRecordInner>>, Observable<ServiceResponse<Page<VulnerabilityAssessmentScanRecordInner>>>>() { @Override public Observable<ServiceResponse<Page<VulnerabilityAssessmentScanRecordInner>>> call(ServiceResponse<Page<VulnerabilityAssessmentScanRecordInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listByDatabaseNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "VulnerabilityAssessmentScanRecordInner", ">", ">", ">", "listByDatabaseWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "serverName", ",", "final", "String", ...
Lists the vulnerability assessment scans of a database. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;VulnerabilityAssessmentScanRecordInner&gt; object
[ "Lists", "the", "vulnerability", "assessment", "scans", "of", "a", "database", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansInner.java#L158-L170
bramp/ffmpeg-cli-wrapper
src/main/java/net/bramp/ffmpeg/builder/FFmpegOutputBuilder.java
FFmpegOutputBuilder.buildOptions
@CheckReturnValue @Override public EncodingOptions buildOptions() { // TODO When/if modelmapper supports @ConstructorProperties, we map this // object, instead of doing new XXX(...) // https://github.com/jhalterman/modelmapper/issues/44 return new EncodingOptions( new MainEncodingOptions(format, startOffset, duration), new AudioEncodingOptions( audio_enabled, audio_codec, audio_channels, audio_sample_rate, audio_sample_format, audio_bit_rate, audio_quality), new VideoEncodingOptions( video_enabled, video_codec, video_frame_rate, video_width, video_height, video_bit_rate, video_frames, video_filter, video_preset)); }
java
@CheckReturnValue @Override public EncodingOptions buildOptions() { // TODO When/if modelmapper supports @ConstructorProperties, we map this // object, instead of doing new XXX(...) // https://github.com/jhalterman/modelmapper/issues/44 return new EncodingOptions( new MainEncodingOptions(format, startOffset, duration), new AudioEncodingOptions( audio_enabled, audio_codec, audio_channels, audio_sample_rate, audio_sample_format, audio_bit_rate, audio_quality), new VideoEncodingOptions( video_enabled, video_codec, video_frame_rate, video_width, video_height, video_bit_rate, video_frames, video_filter, video_preset)); }
[ "@", "CheckReturnValue", "@", "Override", "public", "EncodingOptions", "buildOptions", "(", ")", "{", "// TODO When/if modelmapper supports @ConstructorProperties, we map this", "// object, instead of doing new XXX(...)", "// https://github.com/jhalterman/modelmapper/issues/44", "return", ...
Returns a representation of this Builder that can be safely serialised. <p>NOTE: This method is horribly out of date, and its use should be rethought. @return A new EncodingOptions capturing this Builder's state
[ "Returns", "a", "representation", "of", "this", "Builder", "that", "can", "be", "safely", "serialised", "." ]
train
https://github.com/bramp/ffmpeg-cli-wrapper/blob/3819b155edf9132acc75bb6af66dcef1b98c64b2/src/main/java/net/bramp/ffmpeg/builder/FFmpegOutputBuilder.java#L186-L212
facebook/fresco
fbcore/src/main/java/com/facebook/common/statfs/StatFsHelper.java
StatFsHelper.updateStatsHelper
private @Nullable StatFs updateStatsHelper(@Nullable StatFs statfs, @Nullable File dir) { if(dir == null || !dir.exists()) { // The path does not exist, do not track stats for it. return null; } try { if (statfs == null) { // Create a new StatFs object for this path. statfs = createStatFs(dir.getAbsolutePath()); } else { // Call restat and keep the existing StatFs object. statfs.restat(dir.getAbsolutePath()); } } catch (IllegalArgumentException ex) { // Invalidate the StatFs object for this directory. The native StatFs implementation throws // IllegalArgumentException in the case that the statfs() system call fails and it invalidates // its internal data structures so subsequent calls against the StatFs object will fail or // throw (so we should make no more calls on the object). The most likely reason for this call // to fail is because the provided path no longer exists. The next call to updateStats() will // a new statfs object if the path exists. This will handle the case that a path is unmounted // and later remounted (but it has to have been mounted when this object was initialized). statfs = null; } catch (Throwable ex) { // Any other exception types are not expected and should be propagated as runtime errors. throw Throwables.propagate(ex); } return statfs; }
java
private @Nullable StatFs updateStatsHelper(@Nullable StatFs statfs, @Nullable File dir) { if(dir == null || !dir.exists()) { // The path does not exist, do not track stats for it. return null; } try { if (statfs == null) { // Create a new StatFs object for this path. statfs = createStatFs(dir.getAbsolutePath()); } else { // Call restat and keep the existing StatFs object. statfs.restat(dir.getAbsolutePath()); } } catch (IllegalArgumentException ex) { // Invalidate the StatFs object for this directory. The native StatFs implementation throws // IllegalArgumentException in the case that the statfs() system call fails and it invalidates // its internal data structures so subsequent calls against the StatFs object will fail or // throw (so we should make no more calls on the object). The most likely reason for this call // to fail is because the provided path no longer exists. The next call to updateStats() will // a new statfs object if the path exists. This will handle the case that a path is unmounted // and later remounted (but it has to have been mounted when this object was initialized). statfs = null; } catch (Throwable ex) { // Any other exception types are not expected and should be propagated as runtime errors. throw Throwables.propagate(ex); } return statfs; }
[ "private", "@", "Nullable", "StatFs", "updateStatsHelper", "(", "@", "Nullable", "StatFs", "statfs", ",", "@", "Nullable", "File", "dir", ")", "{", "if", "(", "dir", "==", "null", "||", "!", "dir", ".", "exists", "(", ")", ")", "{", "// The path does not...
Update stats for a single directory and return the StatFs object for that directory. If the directory does not exist or the StatFs restat() or constructor fails (throws), a null StatFs object is returned.
[ "Update", "stats", "for", "a", "single", "directory", "and", "return", "the", "StatFs", "object", "for", "that", "directory", ".", "If", "the", "directory", "does", "not", "exist", "or", "the", "StatFs", "restat", "()", "or", "constructor", "fails", "(", "...
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/fbcore/src/main/java/com/facebook/common/statfs/StatFsHelper.java#L259-L288
OpenLiberty/open-liberty
dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLUtils.java
SSLUtils.flipBuffersToMark
public static void flipBuffersToMark(WsByteBuffer buffers[], int mark, int markBufferIndex) { WsByteBuffer buffer = null; // Verify the input buffer array is not null. if (buffers != null) { // Loop through all the buffers in the array. for (int i = 0; i < buffers.length; i++) { // Extract each buffer. buffer = buffers[i]; // Verify the buffer is non null. if (buffer != null) { if (i == markBufferIndex && mark != 0) { // Found the "marked" buffer. if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "mark is " + mark); } buffer.limit(buffer.position()); buffer.position(mark); } else { // Not the "marked" buffer, so flip it. buffer.flip(); } } } } }
java
public static void flipBuffersToMark(WsByteBuffer buffers[], int mark, int markBufferIndex) { WsByteBuffer buffer = null; // Verify the input buffer array is not null. if (buffers != null) { // Loop through all the buffers in the array. for (int i = 0; i < buffers.length; i++) { // Extract each buffer. buffer = buffers[i]; // Verify the buffer is non null. if (buffer != null) { if (i == markBufferIndex && mark != 0) { // Found the "marked" buffer. if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "mark is " + mark); } buffer.limit(buffer.position()); buffer.position(mark); } else { // Not the "marked" buffer, so flip it. buffer.flip(); } } } } }
[ "public", "static", "void", "flipBuffersToMark", "(", "WsByteBuffer", "buffers", "[", "]", ",", "int", "mark", ",", "int", "markBufferIndex", ")", "{", "WsByteBuffer", "buffer", "=", "null", ";", "// Verify the input buffer array is not null.", "if", "(", "buffers",...
Sort of like Buffer.flip(). The limit is set to the postion, but the position is set differently. If the index of the buffer is markIndex and the mark is not zero, then the position will of that buffer will be set to mark. All other buffers will be flipped. @param buffers buffers on which flip to mark @param mark the mark to be set on the indexed buffer in the array @param markBufferIndex the index into the array where the mark should be placed
[ "Sort", "of", "like", "Buffer", ".", "flip", "()", ".", "The", "limit", "is", "set", "to", "the", "postion", "but", "the", "position", "is", "set", "differently", ".", "If", "the", "index", "of", "the", "buffer", "is", "markIndex", "and", "the", "mark"...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLUtils.java#L322-L346
apache/flink
flink-core/src/main/java/org/apache/flink/util/StringUtils.java
StringUtils.getRandomString
public static String getRandomString(Random rnd, int minLength, int maxLength) { int len = rnd.nextInt(maxLength - minLength + 1) + minLength; char[] data = new char[len]; for (int i = 0; i < data.length; i++) { data[i] = (char) (rnd.nextInt(0x7fff) + 1); } return new String(data); }
java
public static String getRandomString(Random rnd, int minLength, int maxLength) { int len = rnd.nextInt(maxLength - minLength + 1) + minLength; char[] data = new char[len]; for (int i = 0; i < data.length; i++) { data[i] = (char) (rnd.nextInt(0x7fff) + 1); } return new String(data); }
[ "public", "static", "String", "getRandomString", "(", "Random", "rnd", ",", "int", "minLength", ",", "int", "maxLength", ")", "{", "int", "len", "=", "rnd", ".", "nextInt", "(", "maxLength", "-", "minLength", "+", "1", ")", "+", "minLength", ";", "char",...
Creates a random string with a length within the given interval. The string contains only characters that can be represented as a single code point. @param rnd The random used to create the strings. @param minLength The minimum string length. @param maxLength The maximum string length (inclusive). @return A random String.
[ "Creates", "a", "random", "string", "with", "a", "length", "within", "the", "given", "interval", ".", "The", "string", "contains", "only", "characters", "that", "can", "be", "represented", "as", "a", "single", "code", "point", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/StringUtils.java#L219-L227
Coveros/selenified
src/main/java/com/coveros/selenified/element/Element.java
Element.isNotPresentDisplayedEnabled
private boolean isNotPresentDisplayedEnabled(String action, String expected, String extra) { // wait for element to be present if (isNotPresent(action, expected, extra)) { return true; } // wait for element to be displayed if (isNotDisplayed(action, expected, extra)) { return true; } // wait for element to be enabled return isNotEnabled(action, expected, extra); }
java
private boolean isNotPresentDisplayedEnabled(String action, String expected, String extra) { // wait for element to be present if (isNotPresent(action, expected, extra)) { return true; } // wait for element to be displayed if (isNotDisplayed(action, expected, extra)) { return true; } // wait for element to be enabled return isNotEnabled(action, expected, extra); }
[ "private", "boolean", "isNotPresentDisplayedEnabled", "(", "String", "action", ",", "String", "expected", ",", "String", "extra", ")", "{", "// wait for element to be present", "if", "(", "isNotPresent", "(", "action", ",", "expected", ",", "extra", ")", ")", "{",...
Determines if something is present, displayed, and enabled. This returns true if all three are true, otherwise, it returns false @param action - what action is occurring @param expected - what is the expected result @param extra - what actually is occurring @return Boolean: is the element present, displayed, and enabled?
[ "Determines", "if", "something", "is", "present", "displayed", "and", "enabled", ".", "This", "returns", "true", "if", "all", "three", "are", "true", "otherwise", "it", "returns", "false" ]
train
https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/element/Element.java#L694-L705
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/cache/impl/AbstractCacheRecordStore.java
AbstractCacheRecordStore.createCacheEvictionChecker
protected EvictionChecker createCacheEvictionChecker(int size, MaxSizePolicy maxSizePolicy) { if (maxSizePolicy == null) { throw new IllegalArgumentException("Max-Size policy cannot be null"); } if (maxSizePolicy == MaxSizePolicy.ENTRY_COUNT) { return new EntryCountCacheEvictionChecker(size, records, partitionCount); } return null; }
java
protected EvictionChecker createCacheEvictionChecker(int size, MaxSizePolicy maxSizePolicy) { if (maxSizePolicy == null) { throw new IllegalArgumentException("Max-Size policy cannot be null"); } if (maxSizePolicy == MaxSizePolicy.ENTRY_COUNT) { return new EntryCountCacheEvictionChecker(size, records, partitionCount); } return null; }
[ "protected", "EvictionChecker", "createCacheEvictionChecker", "(", "int", "size", ",", "MaxSizePolicy", "maxSizePolicy", ")", "{", "if", "(", "maxSizePolicy", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Max-Size policy cannot be null\"", ...
Creates an instance for checking if the maximum cache size has been reached. Supports only the {@link MaxSizePolicy#ENTRY_COUNT} policy. Returns null if other {@code maxSizePolicy} is used. @param size the maximum number of entries @param maxSizePolicy the way in which the size is interpreted, only the {@link MaxSizePolicy#ENTRY_COUNT} policy is supported. @return the instance which will check if the maximum number of entries has been reached or null if the {@code maxSizePolicy} is not {@link MaxSizePolicy#ENTRY_COUNT} @throws IllegalArgumentException if the {@code maxSizePolicy} is null
[ "Creates", "an", "instance", "for", "checking", "if", "the", "maximum", "cache", "size", "has", "been", "reached", ".", "Supports", "only", "the", "{", "@link", "MaxSizePolicy#ENTRY_COUNT", "}", "policy", ".", "Returns", "null", "if", "other", "{", "@code", ...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cache/impl/AbstractCacheRecordStore.java#L326-L334
infinispan/infinispan
core/src/main/java/org/infinispan/interceptors/BaseAsyncInterceptor.java
BaseAsyncInterceptor.delayedValue
public static Object delayedValue(CompletionStage<Void> stage, Object syncValue) { if (stage != null) { CompletableFuture<?> future = stage.toCompletableFuture(); if (!future.isDone()) { return asyncValue(stage.thenApply(v -> syncValue)); } if (future.isCompletedExceptionally()) { return asyncValue(stage); } } return syncValue; }
java
public static Object delayedValue(CompletionStage<Void> stage, Object syncValue) { if (stage != null) { CompletableFuture<?> future = stage.toCompletableFuture(); if (!future.isDone()) { return asyncValue(stage.thenApply(v -> syncValue)); } if (future.isCompletedExceptionally()) { return asyncValue(stage); } } return syncValue; }
[ "public", "static", "Object", "delayedValue", "(", "CompletionStage", "<", "Void", ">", "stage", ",", "Object", "syncValue", ")", "{", "if", "(", "stage", "!=", "null", ")", "{", "CompletableFuture", "<", "?", ">", "future", "=", "stage", ".", "toCompletab...
Returns an InvocationStage if the provided CompletionStage is null, not completed or completed via exception. If these are not true the sync value is returned directly. @param stage wait for completion of this if not null @param syncValue sync value to return if stage is complete or as stage value @return invocation stage or sync value
[ "Returns", "an", "InvocationStage", "if", "the", "provided", "CompletionStage", "is", "null", "not", "completed", "or", "completed", "via", "exception", ".", "If", "these", "are", "not", "true", "the", "sync", "value", "is", "returned", "directly", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/interceptors/BaseAsyncInterceptor.java#L299-L310
apache/incubator-gobblin
gobblin-modules/gobblin-compliance/src/main/java/org/apache/gobblin/compliance/purger/HivePurgerQueryTemplate.java
HivePurgerQueryTemplate.getWhereClauseForPartition
public static String getWhereClauseForPartition(Map<String, String> spec, String prefix) { StringBuilder sb = new StringBuilder(); for (Map.Entry<String, String> entry : spec.entrySet()) { if (!sb.toString().isEmpty()) { sb.append(" AND "); } sb.append(prefix + entry.getKey()); sb.append("="); sb.append(PartitionUtils.getQuotedString(entry.getValue())); } return sb.toString(); }
java
public static String getWhereClauseForPartition(Map<String, String> spec, String prefix) { StringBuilder sb = new StringBuilder(); for (Map.Entry<String, String> entry : spec.entrySet()) { if (!sb.toString().isEmpty()) { sb.append(" AND "); } sb.append(prefix + entry.getKey()); sb.append("="); sb.append(PartitionUtils.getQuotedString(entry.getValue())); } return sb.toString(); }
[ "public", "static", "String", "getWhereClauseForPartition", "(", "Map", "<", "String", ",", "String", ">", "spec", ",", "String", "prefix", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", ...
This method builds the where clause for the insertion query. If prefix is a, then it builds a.datepartition='2016-01-01-00' AND a.size='12345' from [datepartition : '2016-01-01-00', size : '12345']
[ "This", "method", "builds", "the", "where", "clause", "for", "the", "insertion", "query", ".", "If", "prefix", "is", "a", "then", "it", "builds", "a", ".", "datepartition", "=", "2016", "-", "01", "-", "01", "-", "00", "AND", "a", ".", "size", "=", ...
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-compliance/src/main/java/org/apache/gobblin/compliance/purger/HivePurgerQueryTemplate.java#L191-L202
wso2/transport-http
components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/Util.java
Util.createInboundRespCarbonMsg
public static HttpCarbonMessage createInboundRespCarbonMsg(ChannelHandlerContext ctx, HttpResponse httpResponseHeaders, HttpCarbonMessage outboundRequestMsg) { HttpCarbonMessage inboundResponseMsg = new HttpCarbonResponse(httpResponseHeaders, new DefaultListener(ctx)); inboundResponseMsg.setProperty(Constants.POOLED_BYTE_BUFFER_FACTORY, new PooledDataStreamerFactory(ctx.alloc())); inboundResponseMsg.setProperty(Constants.DIRECTION, Constants.DIRECTION_RESPONSE); inboundResponseMsg.setProperty(Constants.HTTP_STATUS_CODE, httpResponseHeaders.status().code()); //copy required properties for service chaining from incoming carbon message to the response carbon message //copy shared worker pool inboundResponseMsg.setProperty(Constants.EXECUTOR_WORKER_POOL, outboundRequestMsg .getProperty(Constants.EXECUTOR_WORKER_POOL)); return inboundResponseMsg; }
java
public static HttpCarbonMessage createInboundRespCarbonMsg(ChannelHandlerContext ctx, HttpResponse httpResponseHeaders, HttpCarbonMessage outboundRequestMsg) { HttpCarbonMessage inboundResponseMsg = new HttpCarbonResponse(httpResponseHeaders, new DefaultListener(ctx)); inboundResponseMsg.setProperty(Constants.POOLED_BYTE_BUFFER_FACTORY, new PooledDataStreamerFactory(ctx.alloc())); inboundResponseMsg.setProperty(Constants.DIRECTION, Constants.DIRECTION_RESPONSE); inboundResponseMsg.setProperty(Constants.HTTP_STATUS_CODE, httpResponseHeaders.status().code()); //copy required properties for service chaining from incoming carbon message to the response carbon message //copy shared worker pool inboundResponseMsg.setProperty(Constants.EXECUTOR_WORKER_POOL, outboundRequestMsg .getProperty(Constants.EXECUTOR_WORKER_POOL)); return inboundResponseMsg; }
[ "public", "static", "HttpCarbonMessage", "createInboundRespCarbonMsg", "(", "ChannelHandlerContext", "ctx", ",", "HttpResponse", "httpResponseHeaders", ",", "HttpCarbonMessage", "outboundRequestMsg", ")", "{", "HttpCarbonMessage", "inboundResponseMsg", "=", "new", "HttpCarbonRe...
Create a HttpCarbonMessage using the netty inbound response message. @param ctx of the inbound response message @param httpResponseHeaders of the inbound response message @param outboundRequestMsg is the correlated outbound request message @return HttpCarbon message
[ "Create", "a", "HttpCarbonMessage", "using", "the", "netty", "inbound", "response", "message", "." ]
train
https://github.com/wso2/transport-http/blob/c51aa715b473db6c1b82a7d7b22f6e65f74df4c9/components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/Util.java#L746-L762
pressgang-ccms/PressGangCCMSContentSpecProcessor
src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java
ContentSpecParser.processEitherSpec
protected ParserResults processEitherSpec(final ParserData parserData, final boolean processProcesses) { try { final Pair<String, String> keyValuePair = ProcessorUtilities.getAndValidateKeyValuePair(parserData.getLines().peek()); final String key = keyValuePair.getFirst(); if (key.equalsIgnoreCase(CommonConstants.CS_CHECKSUM_TITLE) || key.equalsIgnoreCase(CommonConstants.CS_ID_TITLE)) { return processEditedSpec(parserData, processProcesses); } else { return processNewSpec(parserData, processProcesses); } } catch (InvalidKeyValueException e) { log.error(ProcessorConstants.ERROR_INCORRECT_FILE_FORMAT_MSG, e); return new ParserResults(false, null); } }
java
protected ParserResults processEitherSpec(final ParserData parserData, final boolean processProcesses) { try { final Pair<String, String> keyValuePair = ProcessorUtilities.getAndValidateKeyValuePair(parserData.getLines().peek()); final String key = keyValuePair.getFirst(); if (key.equalsIgnoreCase(CommonConstants.CS_CHECKSUM_TITLE) || key.equalsIgnoreCase(CommonConstants.CS_ID_TITLE)) { return processEditedSpec(parserData, processProcesses); } else { return processNewSpec(parserData, processProcesses); } } catch (InvalidKeyValueException e) { log.error(ProcessorConstants.ERROR_INCORRECT_FILE_FORMAT_MSG, e); return new ParserResults(false, null); } }
[ "protected", "ParserResults", "processEitherSpec", "(", "final", "ParserData", "parserData", ",", "final", "boolean", "processProcesses", ")", "{", "try", "{", "final", "Pair", "<", "String", ",", "String", ">", "keyValuePair", "=", "ProcessorUtilities", ".", "get...
Process Content Specification that is either NEW or EDITED. That is that it should start with a CHECKSUM and ID or a Title. @param parserData @param processProcesses If processes should be processed to populate the relationships. @return True if the content spec was processed successfully otherwise false.
[ "Process", "Content", "Specification", "that", "is", "either", "NEW", "or", "EDITED", ".", "That", "is", "that", "it", "should", "start", "with", "a", "CHECKSUM", "and", "ID", "or", "a", "Title", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java#L352-L366
Domo42/saga-lib
saga-lib/src/main/java/com/codebullets/sagalib/processing/SagaTypeCacheLoader.java
SagaTypeCacheLoader.containsItem
private SagaType containsItem(final Iterable<SagaType> source, final Class itemToSearch) { SagaType containedItem = null; for (SagaType sagaType : source) { if (sagaType.getSagaClass().equals(itemToSearch)) { containedItem = sagaType; break; } } return containedItem; }
java
private SagaType containsItem(final Iterable<SagaType> source, final Class itemToSearch) { SagaType containedItem = null; for (SagaType sagaType : source) { if (sagaType.getSagaClass().equals(itemToSearch)) { containedItem = sagaType; break; } } return containedItem; }
[ "private", "SagaType", "containsItem", "(", "final", "Iterable", "<", "SagaType", ">", "source", ",", "final", "Class", "itemToSearch", ")", "{", "SagaType", "containedItem", "=", "null", ";", "for", "(", "SagaType", "sagaType", ":", "source", ")", "{", "if"...
Checks whether the source list contains a saga type matching the input class.
[ "Checks", "whether", "the", "source", "list", "contains", "a", "saga", "type", "matching", "the", "input", "class", "." ]
train
https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/processing/SagaTypeCacheLoader.java#L120-L131
VoltDB/voltdb
src/frontend/org/voltdb/rejoin/TaskLogImpl.java
TaskLogImpl.bufferCatchup
private void bufferCatchup(int messageSize) throws IOException { // If the current buffer has too many tasks logged, queue it and // create a new one. if (m_tail != null && m_tail.size() > 0 && messageSize > m_bufferHeadroom) { // compile the invocation buffer m_tail.compile(); final RejoinTaskBuffer boundTail = m_tail; final Runnable r = new Runnable() { @Override public void run() { try { m_buffers.offer(boundTail.getContainer()); if (m_reader.sizeInBytes() > m_overflowLimit * 1024 * 1024) { // we can never catch up, should break rejoin. VoltDB.crashLocalVoltDB("On-disk task log is full. Please reduce " + "workload and try live rejoin again, or use blocking rejoin."); } } catch (Throwable t) { VoltDB.crashLocalVoltDB("Error in task log buffering transactions", true, t); } } }; m_es.execute(r); // Reset m_tail = null; m_tasksPendingInCurrentTail = 0; } // create a new buffer if (m_tail == null) { m_tail = new RejoinTaskBuffer(m_partitionId, messageSize); m_bufferHeadroom = RejoinTaskBuffer.DEFAULT_BUFFER_SIZE; } }
java
private void bufferCatchup(int messageSize) throws IOException { // If the current buffer has too many tasks logged, queue it and // create a new one. if (m_tail != null && m_tail.size() > 0 && messageSize > m_bufferHeadroom) { // compile the invocation buffer m_tail.compile(); final RejoinTaskBuffer boundTail = m_tail; final Runnable r = new Runnable() { @Override public void run() { try { m_buffers.offer(boundTail.getContainer()); if (m_reader.sizeInBytes() > m_overflowLimit * 1024 * 1024) { // we can never catch up, should break rejoin. VoltDB.crashLocalVoltDB("On-disk task log is full. Please reduce " + "workload and try live rejoin again, or use blocking rejoin."); } } catch (Throwable t) { VoltDB.crashLocalVoltDB("Error in task log buffering transactions", true, t); } } }; m_es.execute(r); // Reset m_tail = null; m_tasksPendingInCurrentTail = 0; } // create a new buffer if (m_tail == null) { m_tail = new RejoinTaskBuffer(m_partitionId, messageSize); m_bufferHeadroom = RejoinTaskBuffer.DEFAULT_BUFFER_SIZE; } }
[ "private", "void", "bufferCatchup", "(", "int", "messageSize", ")", "throws", "IOException", "{", "// If the current buffer has too many tasks logged, queue it and", "// create a new one.", "if", "(", "m_tail", "!=", "null", "&&", "m_tail", ".", "size", "(", ")", ">", ...
The buffers are bound by the number of tasks in them. Once the current buffer has enough tasks, it will be queued and a new buffer will be created. @throws IOException
[ "The", "buffers", "are", "bound", "by", "the", "number", "of", "tasks", "in", "them", ".", "Once", "the", "current", "buffer", "has", "enough", "tasks", "it", "will", "be", "queued", "and", "a", "new", "buffer", "will", "be", "created", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/rejoin/TaskLogImpl.java#L94-L130
luuuis/jcalendar
src/main/java/com/toedter/calendar/JDateChooser.java
JDateChooser.setSelectableDateRange
public void setSelectableDateRange(Date min, Date max) { jcalendar.setSelectableDateRange(min, max); dateEditor.setSelectableDateRange(jcalendar.getMinSelectableDate(), jcalendar.getMaxSelectableDate()); }
java
public void setSelectableDateRange(Date min, Date max) { jcalendar.setSelectableDateRange(min, max); dateEditor.setSelectableDateRange(jcalendar.getMinSelectableDate(), jcalendar.getMaxSelectableDate()); }
[ "public", "void", "setSelectableDateRange", "(", "Date", "min", ",", "Date", "max", ")", "{", "jcalendar", ".", "setSelectableDateRange", "(", "min", ",", "max", ")", ";", "dateEditor", ".", "setSelectableDateRange", "(", "jcalendar", ".", "getMinSelectableDate", ...
Sets a valid date range for selectable dates. If max is before min, the default range with no limitation is set. @param min the minimum selectable date or null (then the minimum date is set to 01\01\0001) @param max the maximum selectable date or null (then the maximum date is set to 01\01\9999)
[ "Sets", "a", "valid", "date", "range", "for", "selectable", "dates", ".", "If", "max", "is", "before", "min", "the", "default", "range", "with", "no", "limitation", "is", "set", "." ]
train
https://github.com/luuuis/jcalendar/blob/442e5bc319d92dee93400e6180ca74a5b6bd7775/src/main/java/com/toedter/calendar/JDateChooser.java#L512-L516
greenmail-mail-test/greenmail
greenmail-core/src/main/java/com/icegreen/greenmail/imap/commands/IdRange.java
IdRange.containsUid
public static boolean containsUid(IdRange[] idRanges, long uid) { if (null != idRanges && idRanges.length > 0) { for (IdRange range : idRanges) { if (range.includes(uid)) { return true; } } } return false; }
java
public static boolean containsUid(IdRange[] idRanges, long uid) { if (null != idRanges && idRanges.length > 0) { for (IdRange range : idRanges) { if (range.includes(uid)) { return true; } } } return false; }
[ "public", "static", "boolean", "containsUid", "(", "IdRange", "[", "]", "idRanges", ",", "long", "uid", ")", "{", "if", "(", "null", "!=", "idRanges", "&&", "idRanges", ".", "length", ">", "0", ")", "{", "for", "(", "IdRange", "range", ":", "idRanges",...
Checks if ranges contain the uid @param idRanges the id ranges @param uid the uid @return true, if ranges contain given uid
[ "Checks", "if", "ranges", "contain", "the", "uid" ]
train
https://github.com/greenmail-mail-test/greenmail/blob/6d19a62233d1ef6fedbbd1f6fdde2d28e713834a/greenmail-core/src/main/java/com/icegreen/greenmail/imap/commands/IdRange.java#L149-L158
jcuda/jcusparse
JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java
JCusparse.cusparseSbsrxmv
public static int cusparseSbsrxmv( cusparseHandle handle, int dirA, int transA, int sizeOfMask, int mb, int nb, int nnzb, Pointer alpha, cusparseMatDescr descrA, Pointer bsrSortedValA, Pointer bsrSortedMaskPtrA, Pointer bsrSortedRowPtrA, Pointer bsrSortedEndPtrA, Pointer bsrSortedColIndA, int blockDim, Pointer x, Pointer beta, Pointer y) { return checkResult(cusparseSbsrxmvNative(handle, dirA, transA, sizeOfMask, mb, nb, nnzb, alpha, descrA, bsrSortedValA, bsrSortedMaskPtrA, bsrSortedRowPtrA, bsrSortedEndPtrA, bsrSortedColIndA, blockDim, x, beta, y)); }
java
public static int cusparseSbsrxmv( cusparseHandle handle, int dirA, int transA, int sizeOfMask, int mb, int nb, int nnzb, Pointer alpha, cusparseMatDescr descrA, Pointer bsrSortedValA, Pointer bsrSortedMaskPtrA, Pointer bsrSortedRowPtrA, Pointer bsrSortedEndPtrA, Pointer bsrSortedColIndA, int blockDim, Pointer x, Pointer beta, Pointer y) { return checkResult(cusparseSbsrxmvNative(handle, dirA, transA, sizeOfMask, mb, nb, nnzb, alpha, descrA, bsrSortedValA, bsrSortedMaskPtrA, bsrSortedRowPtrA, bsrSortedEndPtrA, bsrSortedColIndA, blockDim, x, beta, y)); }
[ "public", "static", "int", "cusparseSbsrxmv", "(", "cusparseHandle", "handle", ",", "int", "dirA", ",", "int", "transA", ",", "int", "sizeOfMask", ",", "int", "mb", ",", "int", "nb", ",", "int", "nnzb", ",", "Pointer", "alpha", ",", "cusparseMatDescr", "de...
Description: Matrix-vector multiplication y = alpha * op(A) * x + beta * y, where A is a sparse matrix in extended BSR storage format, x and y are dense vectors.
[ "Description", ":", "Matrix", "-", "vector", "multiplication", "y", "=", "alpha", "*", "op", "(", "A", ")", "*", "x", "+", "beta", "*", "y", "where", "A", "is", "a", "sparse", "matrix", "in", "extended", "BSR", "storage", "format", "x", "and", "y", ...
train
https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L1968-L1989
hltcoe/annotated-nyt
src/main/java/com/nytlabs/corpus/NYTCorpusDocumentParser.java
NYTCorpusDocumentParser.parseNYTCorpusDocumentFromFile
public NYTCorpusDocument parseNYTCorpusDocumentFromFile(InputStream is, boolean validating) { Document document = null; if (validating) { document = loadValidating(is); } else { document = loadNonValidating(is); } return parseNYTCorpusDocumentFromDOMDocument(is, document); }
java
public NYTCorpusDocument parseNYTCorpusDocumentFromFile(InputStream is, boolean validating) { Document document = null; if (validating) { document = loadValidating(is); } else { document = loadNonValidating(is); } return parseNYTCorpusDocumentFromDOMDocument(is, document); }
[ "public", "NYTCorpusDocument", "parseNYTCorpusDocumentFromFile", "(", "InputStream", "is", ",", "boolean", "validating", ")", "{", "Document", "document", "=", "null", ";", "if", "(", "validating", ")", "{", "document", "=", "loadValidating", "(", "is", ")", ";"...
Parse an New York Times Document from an {@link InputStream}. @param is The {@link InputStream} from which to parse the document. @param validating True if the file is to be validated against the nitf DTD and false if it is not. It is recommended that validation be disabled, as all documents in the corpus have previously been validated against the NITF DTD. @return The parsed document, or null if an error occurs.
[ "Parse", "an", "New", "York", "Times", "Document", "from", "an", "{", "@link", "InputStream", "}", "." ]
train
https://github.com/hltcoe/annotated-nyt/blob/0a4daa97705591cefea9de61614770ae2665a48e/src/main/java/com/nytlabs/corpus/NYTCorpusDocumentParser.java#L329-L338
cwilper/ttff
src/main/java/com/github/cwilper/ttff/Sources.java
Sources.drain
public static <T> long drain(Source<T> source, Sink<T> sink) throws IOException { long count = 0L; try { while (source.hasNext()) { count++; sink.put(source.next()); } return count; } finally { source.close(); } }
java
public static <T> long drain(Source<T> source, Sink<T> sink) throws IOException { long count = 0L; try { while (source.hasNext()) { count++; sink.put(source.next()); } return count; } finally { source.close(); } }
[ "public", "static", "<", "T", ">", "long", "drain", "(", "Source", "<", "T", ">", "source", ",", "Sink", "<", "T", ">", "sink", ")", "throws", "IOException", "{", "long", "count", "=", "0L", ";", "try", "{", "while", "(", "source", ".", "hasNext", ...
Exhausts the given source, sending each item to the given sink. <p> The source will be automatically closed regardless of success. @param source the source to exhaust. @param sink the sink to send each item to. @param <T> the type. @return the number of items encountered. @throws IOException if an I/O problem occurs.
[ "Exhausts", "the", "given", "source", "sending", "each", "item", "to", "the", "given", "sink", ".", "<p", ">", "The", "source", "will", "be", "automatically", "closed", "regardless", "of", "success", "." ]
train
https://github.com/cwilper/ttff/blob/b351883764546078128d69c2ff0a8431dd45796b/src/main/java/com/github/cwilper/ttff/Sources.java#L266-L278
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.updateCompositeEntityRoleAsync
public Observable<OperationStatus> updateCompositeEntityRoleAsync(UUID appId, String versionId, UUID cEntityId, UUID roleId, UpdateCompositeEntityRoleOptionalParameter updateCompositeEntityRoleOptionalParameter) { return updateCompositeEntityRoleWithServiceResponseAsync(appId, versionId, cEntityId, roleId, updateCompositeEntityRoleOptionalParameter).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
java
public Observable<OperationStatus> updateCompositeEntityRoleAsync(UUID appId, String versionId, UUID cEntityId, UUID roleId, UpdateCompositeEntityRoleOptionalParameter updateCompositeEntityRoleOptionalParameter) { return updateCompositeEntityRoleWithServiceResponseAsync(appId, versionId, cEntityId, roleId, updateCompositeEntityRoleOptionalParameter).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatus", ">", "updateCompositeEntityRoleAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "cEntityId", ",", "UUID", "roleId", ",", "UpdateCompositeEntityRoleOptionalParameter", "updateCompositeEntityRoleOptionalParam...
Update an entity role for a given entity. @param appId The application ID. @param versionId The version ID. @param cEntityId The composite entity extractor ID. @param roleId The entity role ID. @param updateCompositeEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object
[ "Update", "an", "entity", "role", "for", "a", "given", "entity", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L12485-L12492
korpling/ANNIS
annis-visualizers/src/main/java/annis/visualizers/iframe/dependency/VakyarthaDependencyTree.java
VakyarthaDependencyTree.getText
private String getText(SNode node, VisualizerInput input) { SDocumentGraph sDocumentGraph = input.getSResult().getDocumentGraph(); List<DataSourceSequence> sequences = sDocumentGraph. getOverlappedDataSourceSequence(node, SALT_TYPE.STEXT_OVERLAPPING_RELATION); if (sequences != null && sequences.size() > 0) { return ((STextualDS) sequences.get(0).getDataSource()).getText(). substring(sequences.get(0).getStart().intValue(), sequences.get(0).getEnd().intValue()); } return ""; }
java
private String getText(SNode node, VisualizerInput input) { SDocumentGraph sDocumentGraph = input.getSResult().getDocumentGraph(); List<DataSourceSequence> sequences = sDocumentGraph. getOverlappedDataSourceSequence(node, SALT_TYPE.STEXT_OVERLAPPING_RELATION); if (sequences != null && sequences.size() > 0) { return ((STextualDS) sequences.get(0).getDataSource()).getText(). substring(sequences.get(0).getStart().intValue(), sequences.get(0).getEnd().intValue()); } return ""; }
[ "private", "String", "getText", "(", "SNode", "node", ",", "VisualizerInput", "input", ")", "{", "SDocumentGraph", "sDocumentGraph", "=", "input", ".", "getSResult", "(", ")", ".", "getDocumentGraph", "(", ")", ";", "List", "<", "DataSourceSequence", ">", "seq...
Get the text which is overlapped by the SNode. @return Empty string, if there are no token overlapped by the node.
[ "Get", "the", "text", "which", "is", "overlapped", "by", "the", "SNode", "." ]
train
https://github.com/korpling/ANNIS/blob/152a2e34832e015f73ac8ce8a7d4c32641641324/annis-visualizers/src/main/java/annis/visualizers/iframe/dependency/VakyarthaDependencyTree.java#L388-L402
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/servlet/ServletUtil.java
ServletUtil.getRequestParameterValue
public static String getRequestParameterValue(final HttpServletRequest request, final String key) { String[] values = getRequestParameterValues(request, key); return values == null || values.length == 0 ? null : values[0]; }
java
public static String getRequestParameterValue(final HttpServletRequest request, final String key) { String[] values = getRequestParameterValues(request, key); return values == null || values.length == 0 ? null : values[0]; }
[ "public", "static", "String", "getRequestParameterValue", "(", "final", "HttpServletRequest", "request", ",", "final", "String", "key", ")", "{", "String", "[", "]", "values", "=", "getRequestParameterValues", "(", "request", ",", "key", ")", ";", "return", "val...
Get a value for a request parameter allowing for multi part form fields. @param request the request being processed @param key the parameter key to return @return the parameter value
[ "Get", "a", "value", "for", "a", "request", "parameter", "allowing", "for", "multi", "part", "form", "fields", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/servlet/ServletUtil.java#L545-L548
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamIterationHead.java
StreamIterationHead.createBrokerIdString
public static String createBrokerIdString(JobID jid, String iterationID, int subtaskIndex) { return jid + "-" + iterationID + "-" + subtaskIndex; }
java
public static String createBrokerIdString(JobID jid, String iterationID, int subtaskIndex) { return jid + "-" + iterationID + "-" + subtaskIndex; }
[ "public", "static", "String", "createBrokerIdString", "(", "JobID", "jid", ",", "String", "iterationID", ",", "int", "subtaskIndex", ")", "{", "return", "jid", "+", "\"-\"", "+", "iterationID", "+", "\"-\"", "+", "subtaskIndex", ";", "}" ]
Creates the identification string with which head and tail task find the shared blocking queue for the back channel. The identification string is unique per parallel head/tail pair per iteration per job. @param jid The job ID. @param iterationID The id of the iteration in the job. @param subtaskIndex The parallel subtask number @return The identification string.
[ "Creates", "the", "identification", "string", "with", "which", "head", "and", "tail", "task", "find", "the", "shared", "blocking", "queue", "for", "the", "back", "channel", ".", "The", "identification", "string", "is", "unique", "per", "parallel", "head", "/",...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamIterationHead.java#L142-L144
igniterealtime/Smack
smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java
OmemoStore.isAvailableDeviceId
boolean isAvailableDeviceId(OmemoDevice userDevice, int id) { LOGGER.log(Level.INFO, "Check if id " + id + " is available..."); // Lookup local cached device list BareJid ownJid = userDevice.getJid(); OmemoCachedDeviceList cachedDeviceList; cachedDeviceList = loadCachedDeviceList(userDevice, ownJid); if (cachedDeviceList == null) { cachedDeviceList = new OmemoCachedDeviceList(); } // Does the list already contain that id? return !cachedDeviceList.contains(id); }
java
boolean isAvailableDeviceId(OmemoDevice userDevice, int id) { LOGGER.log(Level.INFO, "Check if id " + id + " is available..."); // Lookup local cached device list BareJid ownJid = userDevice.getJid(); OmemoCachedDeviceList cachedDeviceList; cachedDeviceList = loadCachedDeviceList(userDevice, ownJid); if (cachedDeviceList == null) { cachedDeviceList = new OmemoCachedDeviceList(); } // Does the list already contain that id? return !cachedDeviceList.contains(id); }
[ "boolean", "isAvailableDeviceId", "(", "OmemoDevice", "userDevice", ",", "int", "id", ")", "{", "LOGGER", ".", "log", "(", "Level", ".", "INFO", ",", "\"Check if id \"", "+", "id", "+", "\" is available...\"", ")", ";", "// Lookup local cached device list", "BareJ...
Check, if our freshly generated deviceId is available (unique) in our deviceList. @param userDevice our current device. @param id deviceId to check for. @return true if list did not contain our id, else false
[ "Check", "if", "our", "freshly", "generated", "deviceId", "is", "available", "(", "unique", ")", "in", "our", "deviceList", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java#L81-L95
FasterXML/woodstox
src/main/java/com/ctc/wstx/util/PrefixedName.java
PrefixedName.isXmlReservedAttr
public boolean isXmlReservedAttr(boolean nsAware, String localName) { if (nsAware) { if ("xml" == mPrefix) { return mLocalName == localName; } } else { if (mLocalName.length() == (4 + localName.length())) { return (mLocalName.startsWith("xml:") && mLocalName.endsWith(localName)); } } return false; }
java
public boolean isXmlReservedAttr(boolean nsAware, String localName) { if (nsAware) { if ("xml" == mPrefix) { return mLocalName == localName; } } else { if (mLocalName.length() == (4 + localName.length())) { return (mLocalName.startsWith("xml:") && mLocalName.endsWith(localName)); } } return false; }
[ "public", "boolean", "isXmlReservedAttr", "(", "boolean", "nsAware", ",", "String", "localName", ")", "{", "if", "(", "nsAware", ")", "{", "if", "(", "\"xml\"", "==", "mPrefix", ")", "{", "return", "mLocalName", "==", "localName", ";", "}", "}", "else", ...
Method used to check for xml reserved attribute names, like "xml:space" and "xml:id". <p> Note: it is assumed that the passed-in localName is also interned.
[ "Method", "used", "to", "check", "for", "xml", "reserved", "attribute", "names", "like", "xml", ":", "space", "and", "xml", ":", "id", ".", "<p", ">", "Note", ":", "it", "is", "assumed", "that", "the", "passed", "-", "in", "localName", "is", "also", ...
train
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/PrefixedName.java#L100-L113
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/util/TempByteHolder.java
TempByteHolder.writeTo
public void writeTo(java.io.OutputStream os, int start_offset, int length) throws IOException { int towrite = min(length, _write_pos-start_offset); int writeoff = start_offset; if (towrite > 0) { while (towrite >= _window_size) { moveWindow(writeoff); os.write(_memory_buffer,0,_window_size); towrite -= _window_size; writeoff += _window_size; } if (towrite > 0) { moveWindow(writeoff); os.write(_memory_buffer,0,towrite); } } }
java
public void writeTo(java.io.OutputStream os, int start_offset, int length) throws IOException { int towrite = min(length, _write_pos-start_offset); int writeoff = start_offset; if (towrite > 0) { while (towrite >= _window_size) { moveWindow(writeoff); os.write(_memory_buffer,0,_window_size); towrite -= _window_size; writeoff += _window_size; } if (towrite > 0) { moveWindow(writeoff); os.write(_memory_buffer,0,towrite); } } }
[ "public", "void", "writeTo", "(", "java", ".", "io", ".", "OutputStream", "os", ",", "int", "start_offset", ",", "int", "length", ")", "throws", "IOException", "{", "int", "towrite", "=", "min", "(", "length", ",", "_write_pos", "-", "start_offset", ")", ...
Writes efficiently part of the content to output stream. @param os OutputStream to write to @param start_offset Offset of data fragment to be written @param length Length of data fragment to be written @throws IOException
[ "Writes", "efficiently", "part", "of", "the", "content", "to", "output", "stream", "." ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/util/TempByteHolder.java#L286-L301
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/dbserver/Client.java
Client.buildRMST
public NumberField buildRMST(Message.MenuIdentifier targetMenu, CdjStatus.TrackSourceSlot slot) { return buildRMST(posingAsPlayer, targetMenu, slot, CdjStatus.TrackType.REKORDBOX); }
java
public NumberField buildRMST(Message.MenuIdentifier targetMenu, CdjStatus.TrackSourceSlot slot) { return buildRMST(posingAsPlayer, targetMenu, slot, CdjStatus.TrackType.REKORDBOX); }
[ "public", "NumberField", "buildRMST", "(", "Message", ".", "MenuIdentifier", "targetMenu", ",", "CdjStatus", ".", "TrackSourceSlot", "slot", ")", "{", "return", "buildRMST", "(", "posingAsPlayer", ",", "targetMenu", ",", "slot", ",", "CdjStatus", ".", "TrackType",...
<p>Build the <em>R:M:S:T</em> parameter that begins many queries.</p> <p>Many request messages take, as their first argument, a 4-byte value where each byte has a special meaning. The first byte is the player number of the requesting player. The second identifies the menu into which the response is being loaded, as described by {@link Message.MenuIdentifier}. The third specifies the media slot from which information is desired, as described by {@link CdjStatus.TrackSourceSlot}, and the fourth byte identifies the type of track about which information is being requested; in most requests this has the value 1, which corresponds to rekordbox tracks, and this version of the function assumes that.</p> @param targetMenu the destination for the response to this query @param slot the media library of interest for this query @return the first argument to send with the query in order to obtain the desired information
[ "<p", ">", "Build", "the", "<em", ">", "R", ":", "M", ":", "S", ":", "T<", "/", "em", ">", "parameter", "that", "begins", "many", "queries", ".", "<", "/", "p", ">" ]
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/dbserver/Client.java#L308-L310
elki-project/elki
elki/src/main/java/de/lmu/ifi/dbs/elki/application/greedyensemble/ComputeKNNOutlierScores.java
ComputeKNNOutlierScores.runForEachK
private void runForEachK(String prefix, int mink, int maxk, IntFunction<OutlierResult> runner, BiConsumer<String, OutlierResult> out) { if(isDisabled(prefix)) { LOG.verbose("Skipping (disabled): " + prefix); return; // Disabled } LOG.verbose("Running " + prefix); final int digits = (int) FastMath.ceil(FastMath.log10(krange.getMax() + 1)); final String format = "%s-%0" + digits + "d"; krange.forEach(k -> { if(k >= mink && k <= maxk) { Duration time = LOG.newDuration(this.getClass().getCanonicalName() + "." + prefix + ".k" + k + ".runtime").begin(); OutlierResult result = runner.apply(k); LOG.statistics(time.end()); if(result != null) { out.accept(String.format(Locale.ROOT, format, prefix, k), result); result.getHierarchy().removeSubtree(result); } } }); }
java
private void runForEachK(String prefix, int mink, int maxk, IntFunction<OutlierResult> runner, BiConsumer<String, OutlierResult> out) { if(isDisabled(prefix)) { LOG.verbose("Skipping (disabled): " + prefix); return; // Disabled } LOG.verbose("Running " + prefix); final int digits = (int) FastMath.ceil(FastMath.log10(krange.getMax() + 1)); final String format = "%s-%0" + digits + "d"; krange.forEach(k -> { if(k >= mink && k <= maxk) { Duration time = LOG.newDuration(this.getClass().getCanonicalName() + "." + prefix + ".k" + k + ".runtime").begin(); OutlierResult result = runner.apply(k); LOG.statistics(time.end()); if(result != null) { out.accept(String.format(Locale.ROOT, format, prefix, k), result); result.getHierarchy().removeSubtree(result); } } }); }
[ "private", "void", "runForEachK", "(", "String", "prefix", ",", "int", "mink", ",", "int", "maxk", ",", "IntFunction", "<", "OutlierResult", ">", "runner", ",", "BiConsumer", "<", "String", ",", "OutlierResult", ">", "out", ")", "{", "if", "(", "isDisabled...
Iterate over the k range. @param prefix Prefix string @param mink Minimum value of k for this method @param maxk Maximum value of k for this method @param runner Runner to run @param out Output function
[ "Iterate", "over", "the", "k", "range", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/application/greedyensemble/ComputeKNNOutlierScores.java#L359-L378
TestFX/Monocle
src/main/java/com/sun/glass/ui/monocle/MonocleView.java
MonocleView.notifyMenu
@Override protected void notifyMenu(int x, int y, int xAbs, int yAbs, boolean isKeyboardTrigger) { super.notifyMenu(x, y, xAbs, yAbs, isKeyboardTrigger); }
java
@Override protected void notifyMenu(int x, int y, int xAbs, int yAbs, boolean isKeyboardTrigger) { super.notifyMenu(x, y, xAbs, yAbs, isKeyboardTrigger); }
[ "@", "Override", "protected", "void", "notifyMenu", "(", "int", "x", ",", "int", "y", ",", "int", "xAbs", ",", "int", "yAbs", ",", "boolean", "isKeyboardTrigger", ")", "{", "super", ".", "notifyMenu", "(", "x", ",", "y", ",", "xAbs", ",", "yAbs", ","...
Menu event - i.e context menu hint (usually mouse right click)
[ "Menu", "event", "-", "i", ".", "e", "context", "menu", "hint", "(", "usually", "mouse", "right", "click", ")" ]
train
https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/MonocleView.java#L174-L177
apache/flink
flink-core/src/main/java/org/apache/flink/types/parser/FieldParser.java
FieldParser.nextStringEndPos
protected final int nextStringEndPos(byte[] bytes, int startPos, int limit, byte[] delimiter) { int endPos = startPos; final int delimLimit = limit - delimiter.length + 1; while (endPos < limit) { if (endPos < delimLimit && delimiterNext(bytes, endPos, delimiter)) { break; } endPos++; } if (endPos == startPos) { setErrorState(ParseErrorState.EMPTY_COLUMN); return -1; } return endPos; }
java
protected final int nextStringEndPos(byte[] bytes, int startPos, int limit, byte[] delimiter) { int endPos = startPos; final int delimLimit = limit - delimiter.length + 1; while (endPos < limit) { if (endPos < delimLimit && delimiterNext(bytes, endPos, delimiter)) { break; } endPos++; } if (endPos == startPos) { setErrorState(ParseErrorState.EMPTY_COLUMN); return -1; } return endPos; }
[ "protected", "final", "int", "nextStringEndPos", "(", "byte", "[", "]", "bytes", ",", "int", "startPos", ",", "int", "limit", ",", "byte", "[", "]", "delimiter", ")", "{", "int", "endPos", "=", "startPos", ";", "final", "int", "delimLimit", "=", "limit",...
Returns the end position of a string. Sets the error state if the column is empty. @return the end position of the string or -1 if an error occurred
[ "Returns", "the", "end", "position", "of", "a", "string", ".", "Sets", "the", "error", "state", "if", "the", "column", "is", "empty", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/types/parser/FieldParser.java#L206-L223
wildfly/wildfly-core
launcher/src/main/java/org/wildfly/core/launcher/CliCommandBuilder.java
CliCommandBuilder.setController
public CliCommandBuilder setController(final String protocol, final String hostname, final int port) { setController(formatAddress(protocol, hostname, port)); return this; }
java
public CliCommandBuilder setController(final String protocol, final String hostname, final int port) { setController(formatAddress(protocol, hostname, port)); return this; }
[ "public", "CliCommandBuilder", "setController", "(", "final", "String", "protocol", ",", "final", "String", "hostname", ",", "final", "int", "port", ")", "{", "setController", "(", "formatAddress", "(", "protocol", ",", "hostname", ",", "port", ")", ")", ";", ...
Sets the protocol, hostname and port to connect to. @param protocol the protocol to use @param hostname the host name @param port the port @return the builder
[ "Sets", "the", "protocol", "hostname", "and", "port", "to", "connect", "to", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/launcher/src/main/java/org/wildfly/core/launcher/CliCommandBuilder.java#L213-L216
dmfs/xmlobjects
src/org/dmfs/xmlobjects/serializer/XmlObjectSerializer.java
XmlObjectSerializer.setOutput
public XmlObjectSerializer setOutput(SerializerContext serializerContext, Writer out) throws SerializerException, IOException { try { serializerContext.serializer.setOutput(out); } catch (IllegalArgumentException e) { throw new SerializerException("can't configure serializer", e); } catch (IllegalStateException e) { throw new SerializerException("can't configure serializer", e); } return this; }
java
public XmlObjectSerializer setOutput(SerializerContext serializerContext, Writer out) throws SerializerException, IOException { try { serializerContext.serializer.setOutput(out); } catch (IllegalArgumentException e) { throw new SerializerException("can't configure serializer", e); } catch (IllegalStateException e) { throw new SerializerException("can't configure serializer", e); } return this; }
[ "public", "XmlObjectSerializer", "setOutput", "(", "SerializerContext", "serializerContext", ",", "Writer", "out", ")", "throws", "SerializerException", ",", "IOException", "{", "try", "{", "serializerContext", ".", "serializer", ".", "setOutput", "(", "out", ")", "...
Set the output of the serializer. @param serializerContext A {@link SerializerContext}. @param out The {@link Writer} to write to. @return @throws SerializerException @throws IOException
[ "Set", "the", "output", "of", "the", "serializer", "." ]
train
https://github.com/dmfs/xmlobjects/blob/b68ddd0ce994d804fc2ec6da1096bf0d883b37f9/src/org/dmfs/xmlobjects/serializer/XmlObjectSerializer.java#L190-L205
landawn/AbacusUtil
src/com/landawn/abacus/util/DateUtil.java
DateUtil.addMinutes
public static <T extends java.util.Date> T addMinutes(final T date, final int amount) { return roll(date, amount, CalendarUnit.MINUTE); }
java
public static <T extends java.util.Date> T addMinutes(final T date, final int amount) { return roll(date, amount, CalendarUnit.MINUTE); }
[ "public", "static", "<", "T", "extends", "java", ".", "util", ".", "Date", ">", "T", "addMinutes", "(", "final", "T", "date", ",", "final", "int", "amount", ")", "{", "return", "roll", "(", "date", ",", "amount", ",", "CalendarUnit", ".", "MINUTE", "...
Adds a number of minutes to a date returning a new object. The original {@code Date} is unchanged. @param date the date, not null @param amount the amount to add, may be negative @return the new {@code Date} with the amount added @throws IllegalArgumentException if the date is null
[ "Adds", "a", "number", "of", "minutes", "to", "a", "date", "returning", "a", "new", "object", ".", "The", "original", "{", "@code", "Date", "}", "is", "unchanged", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/DateUtil.java#L1021-L1023
google/error-prone
core/src/main/java/com/google/errorprone/refaster/RefasterScanner.java
RefasterScanner.visitDoWhileLoop
@Override public Void visitDoWhileLoop(DoWhileLoopTree node, Context context) { scan(node.getStatement(), context); scan(SKIP_PARENS.visit(node.getCondition(), null), context); return null; }
java
@Override public Void visitDoWhileLoop(DoWhileLoopTree node, Context context) { scan(node.getStatement(), context); scan(SKIP_PARENS.visit(node.getCondition(), null), context); return null; }
[ "@", "Override", "public", "Void", "visitDoWhileLoop", "(", "DoWhileLoopTree", "node", ",", "Context", "context", ")", "{", "scan", "(", "node", ".", "getStatement", "(", ")", ",", "context", ")", ";", "scan", "(", "SKIP_PARENS", ".", "visit", "(", "node",...
/* Matching on the parentheses surrounding the condition of an if, while, or do-while is nonsensical, as those parentheses are obligatory and should never be changed.
[ "/", "*", "Matching", "on", "the", "parentheses", "surrounding", "the", "condition", "of", "an", "if", "while", "or", "do", "-", "while", "is", "nonsensical", "as", "those", "parentheses", "are", "obligatory", "and", "should", "never", "be", "changed", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/refaster/RefasterScanner.java#L142-L147
albfernandez/itext2
src/main/java/com/lowagie/text/rtf/parser/RtfParser.java
RtfParser.importRtfDocumentIntoElement
public void importRtfDocumentIntoElement(Element elem, InputStream readerIn, RtfDocument rtfDoc) throws IOException { if(readerIn == null || rtfDoc == null || elem == null) return; this.init(TYPE_IMPORT_INTO_ELEMENT, rtfDoc, readerIn, this.document, elem); this.setCurrentDestination(RtfDestinationMgr.DESTINATION_NULL); this.groupLevel = 0; try { this.tokenise(); } catch (RuntimeException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
java
public void importRtfDocumentIntoElement(Element elem, InputStream readerIn, RtfDocument rtfDoc) throws IOException { if(readerIn == null || rtfDoc == null || elem == null) return; this.init(TYPE_IMPORT_INTO_ELEMENT, rtfDoc, readerIn, this.document, elem); this.setCurrentDestination(RtfDestinationMgr.DESTINATION_NULL); this.groupLevel = 0; try { this.tokenise(); } catch (RuntimeException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
[ "public", "void", "importRtfDocumentIntoElement", "(", "Element", "elem", ",", "InputStream", "readerIn", ",", "RtfDocument", "rtfDoc", ")", "throws", "IOException", "{", "if", "(", "readerIn", "==", "null", "||", "rtfDoc", "==", "null", "||", "elem", "==", "n...
Imports a complete RTF document into an Element, i.e. Chapter, section, Table Cell, etc. @param elem The Element the document is to be imported into. @param readerIn The Reader to read the RTF document from. @param rtfDoc The RtfDocument to add the imported document to. @throws IOException On I/O errors. @since 2.1.4
[ "Imports", "a", "complete", "RTF", "document", "into", "an", "Element", "i", ".", "e", ".", "Chapter", "section", "Table", "Cell", "etc", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/parser/RtfParser.java#L509-L524
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVREventManager.java
GVREventManager.sendEvent
public boolean sendEvent(Object target, Class<? extends IEvents> eventsClass, String eventName, Object... params) { return sendEventWithMask(SEND_MASK_ALL, target, eventsClass, eventName, params); }
java
public boolean sendEvent(Object target, Class<? extends IEvents> eventsClass, String eventName, Object... params) { return sendEventWithMask(SEND_MASK_ALL, target, eventsClass, eventName, params); }
[ "public", "boolean", "sendEvent", "(", "Object", "target", ",", "Class", "<", "?", "extends", "IEvents", ">", "eventsClass", ",", "String", "eventName", ",", "Object", "...", "params", ")", "{", "return", "sendEventWithMask", "(", "SEND_MASK_ALL", ",", "target...
Delivers an event to a handler object. An event is sent in the following way: <p> <ol> <li> If the {@code target} defines the interface of the class object {@code eventsClass}, the event is delivered to it first, by invoking the corresponding method in the {@code target}. </li> <li> If the {@code target} implements interface {@link IEventReceiver}, the event is delivered to listeners added to the {@link GVREventReceiver} object. See {@link GVREventReceiver} for more information. </li> <li> If the target is bound with scripts, the event is delivered to the scripts. A script can be attached to the target using {@link org.gearvrf.script.GVRScriptManager#attachScriptFile(IScriptable, GVRScriptFile)}.</li> </ol> @param target The object which handles the event. @param eventsClass The interface class object representing an event group, such as {@link IScriptEvents}.class. @param eventName The name of the event, such as "onInit". @param params Parameters of the event. It should match the parameter list of the corresponding method in the interface, specified by {@code event class} @return {@code true} if the event is handled successfully, {@code false} if not handled or any error occurred.
[ "Delivers", "an", "event", "to", "a", "handler", "object", ".", "An", "event", "is", "sent", "in", "the", "following", "way", ":", "<p", ">" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVREventManager.java#L106-L109
alkacon/opencms-core
src/org/opencms/ui/apps/git/CmsGitCheckin.java
CmsGitCheckin.runCommitScript
private int runCommitScript() { if (m_checkout && !m_fetchAndResetBeforeImport) { m_logStream.println("Skipping script...."); return 0; } try { m_logStream.flush(); String commandParam; if (m_resetRemoteHead) { commandParam = resetRemoteHeadScriptCommand(); } else if (m_resetHead) { commandParam = resetHeadScriptCommand(); } else if (m_checkout) { commandParam = checkoutScriptCommand(); } else { commandParam = checkinScriptCommand(); } String[] cmd = {"bash", "-c", commandParam}; m_logStream.println("Calling the script as follows:"); m_logStream.println(); m_logStream.println(cmd[0] + " " + cmd[1] + " " + cmd[2]); ProcessBuilder builder = new ProcessBuilder(cmd); m_logStream.close(); m_logStream = null; Redirect redirect = Redirect.appendTo(new File(DEFAULT_LOGFILE_PATH)); builder.redirectOutput(redirect); builder.redirectError(redirect); Process scriptProcess = builder.start(); int exitCode = scriptProcess.waitFor(); scriptProcess.getOutputStream().close(); m_logStream = new PrintStream(new FileOutputStream(DEFAULT_LOGFILE_PATH, true)); return exitCode; } catch (InterruptedException | IOException e) { e.printStackTrace(m_logStream); return -1; } }
java
private int runCommitScript() { if (m_checkout && !m_fetchAndResetBeforeImport) { m_logStream.println("Skipping script...."); return 0; } try { m_logStream.flush(); String commandParam; if (m_resetRemoteHead) { commandParam = resetRemoteHeadScriptCommand(); } else if (m_resetHead) { commandParam = resetHeadScriptCommand(); } else if (m_checkout) { commandParam = checkoutScriptCommand(); } else { commandParam = checkinScriptCommand(); } String[] cmd = {"bash", "-c", commandParam}; m_logStream.println("Calling the script as follows:"); m_logStream.println(); m_logStream.println(cmd[0] + " " + cmd[1] + " " + cmd[2]); ProcessBuilder builder = new ProcessBuilder(cmd); m_logStream.close(); m_logStream = null; Redirect redirect = Redirect.appendTo(new File(DEFAULT_LOGFILE_PATH)); builder.redirectOutput(redirect); builder.redirectError(redirect); Process scriptProcess = builder.start(); int exitCode = scriptProcess.waitFor(); scriptProcess.getOutputStream().close(); m_logStream = new PrintStream(new FileOutputStream(DEFAULT_LOGFILE_PATH, true)); return exitCode; } catch (InterruptedException | IOException e) { e.printStackTrace(m_logStream); return -1; } }
[ "private", "int", "runCommitScript", "(", ")", "{", "if", "(", "m_checkout", "&&", "!", "m_fetchAndResetBeforeImport", ")", "{", "m_logStream", ".", "println", "(", "\"Skipping script....\"", ")", ";", "return", "0", ";", "}", "try", "{", "m_logStream", ".", ...
Runs the shell script for committing and optionally pushing the changes in the module. @return exit code of the script.
[ "Runs", "the", "shell", "script", "for", "committing", "and", "optionally", "pushing", "the", "changes", "in", "the", "module", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/git/CmsGitCheckin.java#L902-L940
erlang/otp
lib/jinterface/java_src/com/ericsson/otp/erlang/OtpOutputStream.java
OtpOutputStream.writeLE
public void writeLE(final long n, final int b) { long v = n; for (int i = 0; i < b; i++) { write((byte) (v & 0xff)); v >>= 8; } }
java
public void writeLE(final long n, final int b) { long v = n; for (int i = 0; i < b; i++) { write((byte) (v & 0xff)); v >>= 8; } }
[ "public", "void", "writeLE", "(", "final", "long", "n", ",", "final", "int", "b", ")", "{", "long", "v", "=", "n", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "b", ";", "i", "++", ")", "{", "write", "(", "(", "byte", ")", "(", "...
Write any number of bytes in little endian format. @param n the value to use. @param b the number of bytes to write from the little end.
[ "Write", "any", "number", "of", "bytes", "in", "little", "endian", "format", "." ]
train
https://github.com/erlang/otp/blob/ac6084fd83240355f72e94adbf303e57832d1fab/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpOutputStream.java#L314-L320
alkacon/opencms-core
src/org/opencms/workplace/CmsWorkplace.java
CmsWorkplace.sendForward
public void sendForward(String location, Map<String, String[]> params) throws IOException, ServletException { setForwarded(true); // params must be arrays of String, ensure this is the case Map<String, String[]> parameters = CmsRequestUtil.createParameterMap(params); CmsRequestUtil.forwardRequest( getJsp().link(location), parameters, getJsp().getRequest(), getJsp().getResponse()); }
java
public void sendForward(String location, Map<String, String[]> params) throws IOException, ServletException { setForwarded(true); // params must be arrays of String, ensure this is the case Map<String, String[]> parameters = CmsRequestUtil.createParameterMap(params); CmsRequestUtil.forwardRequest( getJsp().link(location), parameters, getJsp().getRequest(), getJsp().getResponse()); }
[ "public", "void", "sendForward", "(", "String", "location", ",", "Map", "<", "String", ",", "String", "[", "]", ">", "params", ")", "throws", "IOException", ",", "ServletException", "{", "setForwarded", "(", "true", ")", ";", "// params must be arrays of String,...
Forwards to the specified location in the OpenCms VFS.<p> @param location the location the response is redirected to @param params the map of parameters to use for the forwarded request @throws IOException in case the forward fails @throws ServletException in case the forward fails
[ "Forwards", "to", "the", "specified", "location", "in", "the", "OpenCms", "VFS", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplace.java#L2135-L2145
Azure/azure-sdk-for-java
labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentSettingsInner.java
EnvironmentSettingsInner.updateAsync
public Observable<EnvironmentSettingInner> updateAsync(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, EnvironmentSettingFragment environmentSetting) { return updateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting).map(new Func1<ServiceResponse<EnvironmentSettingInner>, EnvironmentSettingInner>() { @Override public EnvironmentSettingInner call(ServiceResponse<EnvironmentSettingInner> response) { return response.body(); } }); }
java
public Observable<EnvironmentSettingInner> updateAsync(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, EnvironmentSettingFragment environmentSetting) { return updateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting).map(new Func1<ServiceResponse<EnvironmentSettingInner>, EnvironmentSettingInner>() { @Override public EnvironmentSettingInner call(ServiceResponse<EnvironmentSettingInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "EnvironmentSettingInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "labAccountName", ",", "String", "labName", ",", "String", "environmentSettingName", ",", "EnvironmentSettingFragment", "environmentSetting", ")", ...
Modify properties of environment setting. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param labName The name of the lab. @param environmentSettingName The name of the environment Setting. @param environmentSetting Represents settings of an environment, from which environment instances would be created @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the EnvironmentSettingInner object
[ "Modify", "properties", "of", "environment", "setting", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentSettingsInner.java#L1029-L1036
aws/aws-sdk-java
aws-java-sdk-amplify/src/main/java/com/amazonaws/services/amplify/model/App.java
App.withEnvironmentVariables
public App withEnvironmentVariables(java.util.Map<String, String> environmentVariables) { setEnvironmentVariables(environmentVariables); return this; }
java
public App withEnvironmentVariables(java.util.Map<String, String> environmentVariables) { setEnvironmentVariables(environmentVariables); return this; }
[ "public", "App", "withEnvironmentVariables", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "environmentVariables", ")", "{", "setEnvironmentVariables", "(", "environmentVariables", ")", ";", "return", "this", ";", "}" ]
<p> Environment Variables for the Amplify App. </p> @param environmentVariables Environment Variables for the Amplify App. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Environment", "Variables", "for", "the", "Amplify", "App", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-amplify/src/main/java/com/amazonaws/services/amplify/model/App.java#L614-L617
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.flip
public static void flip(Image image, File outFile) throws IORuntimeException { write(flip(image), outFile); }
java
public static void flip(Image image, File outFile) throws IORuntimeException { write(flip(image), outFile); }
[ "public", "static", "void", "flip", "(", "Image", "image", ",", "File", "outFile", ")", "throws", "IORuntimeException", "{", "write", "(", "flip", "(", "image", ")", ",", "outFile", ")", ";", "}" ]
水平翻转图像 @param image 图像 @param outFile 输出文件 @throws IORuntimeException IO异常 @since 3.2.2
[ "水平翻转图像" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1082-L1084
elki-project/elki
elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/strategies/split/MSTSplit.java
MSTSplit.omitEdge
private static void omitEdge(int[] edges, int[] idx, int[] sizes, int omit) { for(int i = 0; i < idx.length; i++) { idx[i] = i; } Arrays.fill(sizes, 1); for(int i = 0, j = 0, e = edges.length - 1; j < e; i++, j += 2) { if(i == omit) { continue; } int ea = edges[j + 1], eb = edges[j]; if(eb < ea) { // Swap int tmp = eb; eb = ea; ea = tmp; } final int pa = follow(ea, idx), pb = follow(eb, idx); assert (pa != pb) : "Must be disjoint - MST inconsistent."; sizes[idx[pa]] += sizes[idx[pb]]; idx[pb] = idx[pa]; } }
java
private static void omitEdge(int[] edges, int[] idx, int[] sizes, int omit) { for(int i = 0; i < idx.length; i++) { idx[i] = i; } Arrays.fill(sizes, 1); for(int i = 0, j = 0, e = edges.length - 1; j < e; i++, j += 2) { if(i == omit) { continue; } int ea = edges[j + 1], eb = edges[j]; if(eb < ea) { // Swap int tmp = eb; eb = ea; ea = tmp; } final int pa = follow(ea, idx), pb = follow(eb, idx); assert (pa != pb) : "Must be disjoint - MST inconsistent."; sizes[idx[pa]] += sizes[idx[pb]]; idx[pb] = idx[pa]; } }
[ "private", "static", "void", "omitEdge", "(", "int", "[", "]", "edges", ",", "int", "[", "]", "idx", ",", "int", "[", "]", "sizes", ",", "int", "omit", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "idx", ".", "length", ";", "i",...
Partition the data by omitting one edge. @param edges Edges list @param idx Partition index storage @param sizes Partition sizes @param omit Edge number to omit
[ "Partition", "the", "data", "by", "omitting", "one", "edge", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/strategies/split/MSTSplit.java#L196-L216
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/Validate.java
Validate.validIndex
public static <T extends CharSequence> T validIndex(final T chars, final int index) { return validIndex(chars, index, DEFAULT_VALID_INDEX_CHAR_SEQUENCE_EX_MESSAGE, Integer.valueOf(index)); }
java
public static <T extends CharSequence> T validIndex(final T chars, final int index) { return validIndex(chars, index, DEFAULT_VALID_INDEX_CHAR_SEQUENCE_EX_MESSAGE, Integer.valueOf(index)); }
[ "public", "static", "<", "T", "extends", "CharSequence", ">", "T", "validIndex", "(", "final", "T", "chars", ",", "final", "int", "index", ")", "{", "return", "validIndex", "(", "chars", ",", "index", ",", "DEFAULT_VALID_INDEX_CHAR_SEQUENCE_EX_MESSAGE", ",", "...
<p>Validates that the index is within the bounds of the argument character sequence; otherwise throwing an exception.</p> <pre>Validate.validIndex(myStr, 2);</pre> <p>If the character sequence is {@code null}, then the message of the exception is &quot;The validated object is null&quot;.</p> <p>If the index is invalid, then the message of the exception is &quot;The validated character sequence index is invalid: &quot; followed by the index.</p> @param <T> the character sequence type @param chars the character sequence to check, validated not null by this method @param index the index to check @return the validated character sequence (never {@code null} for method chaining) @throws NullPointerException if the character sequence is {@code null} @throws IndexOutOfBoundsException if the index is invalid @see #validIndex(CharSequence, int, String, Object...) @since 3.0
[ "<p", ">", "Validates", "that", "the", "index", "is", "within", "the", "bounds", "of", "the", "argument", "character", "sequence", ";", "otherwise", "throwing", "an", "exception", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/Validate.java#L785-L787
tvesalainen/util
util/src/main/java/org/vesalainen/util/Recycler.java
Recycler.get
public static final <T extends Recyclable> T get(Class<T> cls) { return get(cls, null); }
java
public static final <T extends Recyclable> T get(Class<T> cls) { return get(cls, null); }
[ "public", "static", "final", "<", "T", "extends", "Recyclable", ">", "T", "get", "(", "Class", "<", "T", ">", "cls", ")", "{", "return", "get", "(", "cls", ",", "null", ")", ";", "}" ]
Returns new or recycled uninitialized object. @param <T> @param cls @return
[ "Returns", "new", "or", "recycled", "uninitialized", "object", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/Recycler.java#L59-L62
hankcs/HanLP
src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java
Matrix.getMatrix
public Matrix getMatrix(int i0, int i1, int j0, int j1) { Matrix X = new Matrix(i1 - i0 + 1, j1 - j0 + 1); double[][] B = X.getArray(); try { for (int i = i0; i <= i1; i++) { for (int j = j0; j <= j1; j++) { B[i - i0][j - j0] = A[i][j]; } } } catch (ArrayIndexOutOfBoundsException e) { throw new ArrayIndexOutOfBoundsException("Submatrix indices"); } return X; }
java
public Matrix getMatrix(int i0, int i1, int j0, int j1) { Matrix X = new Matrix(i1 - i0 + 1, j1 - j0 + 1); double[][] B = X.getArray(); try { for (int i = i0; i <= i1; i++) { for (int j = j0; j <= j1; j++) { B[i - i0][j - j0] = A[i][j]; } } } catch (ArrayIndexOutOfBoundsException e) { throw new ArrayIndexOutOfBoundsException("Submatrix indices"); } return X; }
[ "public", "Matrix", "getMatrix", "(", "int", "i0", ",", "int", "i1", ",", "int", "j0", ",", "int", "j1", ")", "{", "Matrix", "X", "=", "new", "Matrix", "(", "i1", "-", "i0", "+", "1", ",", "j1", "-", "j0", "+", "1", ")", ";", "double", "[", ...
Get a submatrix. @param i0 Initial row index @param i1 Final row index @param j0 Initial column index @param j1 Final column index @return A(i0:i1, j0:j1) @throws ArrayIndexOutOfBoundsException Submatrix indices
[ "Get", "a", "submatrix", "." ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java#L362-L381
florent37/DaVinci
davinci/src/main/java/com/github/florent37/davinci/DaVinci.java
DaVinci.returnBitmapInto
private static void returnBitmapInto(final Bitmap bitmap, final String path, final Object into) { new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { if (into != null && path != null && bitmap != null) { if (into instanceof ImageView) { Log.d(TAG, "return bitmap " + path + " into ImageView"); ((ImageView) into).setImageBitmap(bitmap); } else if (into instanceof Callback) { Log.d(TAG, "return bitmap " + path + " into Callback"); ((Callback) into).onBitmapLoaded(path, bitmap); } } } }); }
java
private static void returnBitmapInto(final Bitmap bitmap, final String path, final Object into) { new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { if (into != null && path != null && bitmap != null) { if (into instanceof ImageView) { Log.d(TAG, "return bitmap " + path + " into ImageView"); ((ImageView) into).setImageBitmap(bitmap); } else if (into instanceof Callback) { Log.d(TAG, "return bitmap " + path + " into Callback"); ((Callback) into).onBitmapLoaded(path, bitmap); } } } }); }
[ "private", "static", "void", "returnBitmapInto", "(", "final", "Bitmap", "bitmap", ",", "final", "String", "path", ",", "final", "Object", "into", ")", "{", "new", "Handler", "(", "Looper", ".", "getMainLooper", "(", ")", ")", ".", "post", "(", "new", "R...
When the bitmap has been downloaded, load it into the [into] object @param bitmap the downloaded bitmap @param path the image source path (path or url) @param into the destination object
[ "When", "the", "bitmap", "has", "been", "downloaded", "load", "it", "into", "the", "[", "into", "]", "object" ]
train
https://github.com/florent37/DaVinci/blob/9c6ce4aa2df8e2288cd6ee8b57d9091b1b770a7a/davinci/src/main/java/com/github/florent37/davinci/DaVinci.java#L326-L341
BlueBrain/bluima
modules/bluima_typesystem/src/main/java/de/julielab/jules/types/Token.java
Token.setPosTag
public void setPosTag(int i, POSTag v) { if (Token_Type.featOkTst && ((Token_Type)jcasType).casFeat_posTag == null) jcasType.jcas.throwFeatMissing("posTag", "de.julielab.jules.types.Token"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Token_Type)jcasType).casFeatCode_posTag), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Token_Type)jcasType).casFeatCode_posTag), i, jcasType.ll_cas.ll_getFSRef(v));}
java
public void setPosTag(int i, POSTag v) { if (Token_Type.featOkTst && ((Token_Type)jcasType).casFeat_posTag == null) jcasType.jcas.throwFeatMissing("posTag", "de.julielab.jules.types.Token"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Token_Type)jcasType).casFeatCode_posTag), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Token_Type)jcasType).casFeatCode_posTag), i, jcasType.ll_cas.ll_getFSRef(v));}
[ "public", "void", "setPosTag", "(", "int", "i", ",", "POSTag", "v", ")", "{", "if", "(", "Token_Type", ".", "featOkTst", "&&", "(", "(", "Token_Type", ")", "jcasType", ")", ".", "casFeat_posTag", "==", "null", ")", "jcasType", ".", "jcas", ".", "throwF...
indexed setter for posTag - sets an indexed value - List contains part-of-speech tags of different part-of-speech tagsets (see also POSTag and subtypes), O @generated @param i index in the array to set @param v value to set into the array
[ "indexed", "setter", "for", "posTag", "-", "sets", "an", "indexed", "value", "-", "List", "contains", "part", "-", "of", "-", "speech", "tags", "of", "different", "part", "-", "of", "-", "speech", "tagsets", "(", "see", "also", "POSTag", "and", "subtypes...
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/de/julielab/jules/types/Token.java#L138-L142
landawn/AbacusUtil
src/com/landawn/abacus/util/StringUtil.java
StringUtil.toUpperCase
public static String toUpperCase(final String str, final Locale locale) { if (N.isNullOrEmpty(str)) { return str; } return str.toUpperCase(locale); }
java
public static String toUpperCase(final String str, final Locale locale) { if (N.isNullOrEmpty(str)) { return str; } return str.toUpperCase(locale); }
[ "public", "static", "String", "toUpperCase", "(", "final", "String", "str", ",", "final", "Locale", "locale", ")", "{", "if", "(", "N", ".", "isNullOrEmpty", "(", "str", ")", ")", "{", "return", "str", ";", "}", "return", "str", ".", "toUpperCase", "("...
<p> Converts a String to upper case as per {@link String#toUpperCase(Locale)} . </p> <p> A {@code null} input String returns {@code null}. </p> <pre> N.toUpperCase(null, Locale.ENGLISH) = null N.toUpperCase("", Locale.ENGLISH) = "" N.toUpperCase("aBc", Locale.ENGLISH) = "ABC" </pre> @param str the String to upper case, may be null @param locale the locale that defines the case transformation rules, must not be null @return the upper cased String, {@code null} if null String input @since 2.5
[ "<p", ">", "Converts", "a", "String", "to", "upper", "case", "as", "per", "{", "@link", "String#toUpperCase", "(", "Locale", ")", "}", ".", "<", "/", "p", ">" ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/StringUtil.java#L632-L638
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/TagsApi.java
TagsApi.createTag
public Tag createTag(Object projectIdOrPath, String tagName, String ref) throws GitLabApiException { return (createTag(projectIdOrPath, tagName, ref, null, (String)null)); }
java
public Tag createTag(Object projectIdOrPath, String tagName, String ref) throws GitLabApiException { return (createTag(projectIdOrPath, tagName, ref, null, (String)null)); }
[ "public", "Tag", "createTag", "(", "Object", "projectIdOrPath", ",", "String", "tagName", ",", "String", "ref", ")", "throws", "GitLabApiException", "{", "return", "(", "createTag", "(", "projectIdOrPath", ",", "tagName", ",", "ref", ",", "null", ",", "(", "...
Creates a tag on a particular ref of the given project. <pre><code>GitLab Endpoint: POST /projects/:id/repository/tags</code></pre> @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path @param tagName The name of the tag Must be unique for the project @param ref the git ref to place the tag on @return a Tag instance containing info on the newly created tag @throws GitLabApiException if any exception occurs
[ "Creates", "a", "tag", "on", "a", "particular", "ref", "of", "the", "given", "project", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/TagsApi.java#L130-L132
OpenLiberty/open-liberty
dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/internal/jaas/modules/ServerCommonLoginModule.java
ServerCommonLoginModule.getSecurityName
protected String getSecurityName(String loginName, String urAuthenticatedId) throws EntryNotFoundException, RegistryException { UserRegistry ur = getUserRegistry(); if (ur != null && ur.getType() != "CUSTOM") { // Preserve the existing behavior for CUSTOM user registries String securityName = ur.getUserSecurityName(urAuthenticatedId); if (securityName != null) { return securityName; } } // If a loginName was provided, use it. if (loginName != null) { return loginName; } if (ur != null) { return ur.getUserSecurityName(urAuthenticatedId); } else { throw new NullPointerException("No user registry"); } }
java
protected String getSecurityName(String loginName, String urAuthenticatedId) throws EntryNotFoundException, RegistryException { UserRegistry ur = getUserRegistry(); if (ur != null && ur.getType() != "CUSTOM") { // Preserve the existing behavior for CUSTOM user registries String securityName = ur.getUserSecurityName(urAuthenticatedId); if (securityName != null) { return securityName; } } // If a loginName was provided, use it. if (loginName != null) { return loginName; } if (ur != null) { return ur.getUserSecurityName(urAuthenticatedId); } else { throw new NullPointerException("No user registry"); } }
[ "protected", "String", "getSecurityName", "(", "String", "loginName", ",", "String", "urAuthenticatedId", ")", "throws", "EntryNotFoundException", ",", "RegistryException", "{", "UserRegistry", "ur", "=", "getUserRegistry", "(", ")", ";", "if", "(", "ur", "!=", "n...
Common method called by all login modules that use the UserRegistry (UsernameAndPasswordLoginModule, CertificateLoginModule, HashtableLoginModule and TokenLoginModule). Determines the securityName to use for the login. @param loginName The username passed to the login @param urAuthenticatedId The id returned by UserRegistry checkPassword or mapCertificate. @return The securityName to use for the WSPrincipal. @throws EntryNotFoundException @throws RegistryException
[ "Common", "method", "called", "by", "all", "login", "modules", "that", "use", "the", "UserRegistry", "(", "UsernameAndPasswordLoginModule", "CertificateLoginModule", "HashtableLoginModule", "and", "TokenLoginModule", ")", ".", "Determines", "the", "securityName", "to", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/internal/jaas/modules/ServerCommonLoginModule.java#L109-L129
baratine/baratine
web/src/main/java/com/caucho/v5/web/builder/IncludeWebClass.java
IncludeWebClass.buildWebService
private static ServiceWeb buildWebService(WebBuilder builder, Function<RequestWeb,Object> beanFactory, Method method) { Parameter []params = method.getParameters(); WebParam []webParam = new WebParam[params.length]; for (int i = 0; i < params.length; i++) { webParam[i] = buildParam(builder, params[i]); } return new WebServiceMethod(beanFactory, method, webParam); }
java
private static ServiceWeb buildWebService(WebBuilder builder, Function<RequestWeb,Object> beanFactory, Method method) { Parameter []params = method.getParameters(); WebParam []webParam = new WebParam[params.length]; for (int i = 0; i < params.length; i++) { webParam[i] = buildParam(builder, params[i]); } return new WebServiceMethod(beanFactory, method, webParam); }
[ "private", "static", "ServiceWeb", "buildWebService", "(", "WebBuilder", "builder", ",", "Function", "<", "RequestWeb", ",", "Object", ">", "beanFactory", ",", "Method", "method", ")", "{", "Parameter", "[", "]", "params", "=", "method", ".", "getParameters", ...
Builds a HTTP service from a method. <pre><code> &#64;Get void myMethod(&64;Query("id") id, Result&lt;String&gt; result); </code></pre> Method parameters are filled from the request. @param builder called to create the service @param beanFactory factory for the bean instance @param method method for the service
[ "Builds", "a", "HTTP", "service", "from", "a", "method", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/web/builder/IncludeWebClass.java#L402-L416
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/OracleHelper.java
OracleHelper.psSetString
@Override public void psSetString(PreparedStatement pstmtImpl, int i, String x) throws SQLException { int length = (x == null ? 0 : x.getBytes().length); if (tc.isDebugEnabled()) { Tr.debug(this, tc, "string length: " + length); } if (length > 4000) { if (tc.isDebugEnabled()) Tr.debug(this, tc, "Oracle setString length > 4000 bytes workaround."); /* * length in setCharacterStream is number of character in * stream */ pstmtImpl.setCharacterStream(i, new StringReader(x), x.length()); } else { pstmtImpl.setString(i, x); } }
java
@Override public void psSetString(PreparedStatement pstmtImpl, int i, String x) throws SQLException { int length = (x == null ? 0 : x.getBytes().length); if (tc.isDebugEnabled()) { Tr.debug(this, tc, "string length: " + length); } if (length > 4000) { if (tc.isDebugEnabled()) Tr.debug(this, tc, "Oracle setString length > 4000 bytes workaround."); /* * length in setCharacterStream is number of character in * stream */ pstmtImpl.setCharacterStream(i, new StringReader(x), x.length()); } else { pstmtImpl.setString(i, x); } }
[ "@", "Override", "public", "void", "psSetString", "(", "PreparedStatement", "pstmtImpl", ",", "int", "i", ",", "String", "x", ")", "throws", "SQLException", "{", "int", "length", "=", "(", "x", "==", "null", "?", "0", ":", "x", ".", "getBytes", "(", ")...
- allow for special handling of Oracle prepared statement setString
[ "-", "allow", "for", "special", "handling", "of", "Oracle", "prepared", "statement", "setString" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/OracleHelper.java#L741-L760
OpenLiberty/open-liberty
dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/Director.java
Director.fireInstallProgressEvent
public void fireInstallProgressEvent(int progress, InstallAsset installAsset) throws InstallException { if (installAsset.isServerPackage()) fireProgressEvent(InstallProgressEvent.DEPLOY, progress, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_DEPLOYING", installAsset.toString()), true); else if (installAsset.isFeature()) { ESAAsset esaa = ((ESAAsset) installAsset); if (esaa.isPublic()) { String resourceName = (esaa.getShortName() == null) ? esaa.getDisplayName() : esaa.getShortName(); fireProgressEvent(InstallProgressEvent.INSTALL, progress, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_INSTALLING", resourceName), true); } else if (!firePublicAssetOnly) { fireProgressEvent(InstallProgressEvent.INSTALL, progress, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_INSTALLING_DEPENDENCY"), true); } } else { fireProgressEvent(InstallProgressEvent.INSTALL, progress, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_INSTALLING", installAsset.toString()), true); } }
java
public void fireInstallProgressEvent(int progress, InstallAsset installAsset) throws InstallException { if (installAsset.isServerPackage()) fireProgressEvent(InstallProgressEvent.DEPLOY, progress, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_DEPLOYING", installAsset.toString()), true); else if (installAsset.isFeature()) { ESAAsset esaa = ((ESAAsset) installAsset); if (esaa.isPublic()) { String resourceName = (esaa.getShortName() == null) ? esaa.getDisplayName() : esaa.getShortName(); fireProgressEvent(InstallProgressEvent.INSTALL, progress, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_INSTALLING", resourceName), true); } else if (!firePublicAssetOnly) { fireProgressEvent(InstallProgressEvent.INSTALL, progress, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_INSTALLING_DEPENDENCY"), true); } } else { fireProgressEvent(InstallProgressEvent.INSTALL, progress, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_INSTALLING", installAsset.toString()), true); } }
[ "public", "void", "fireInstallProgressEvent", "(", "int", "progress", ",", "InstallAsset", "installAsset", ")", "throws", "InstallException", "{", "if", "(", "installAsset", ".", "isServerPackage", "(", ")", ")", "fireProgressEvent", "(", "InstallProgressEvent", ".", ...
Fires an install progress event to be displayed @param progress the progress integer @param installAsset the install asset necessitating the progress event @throws InstallException
[ "Fires", "an", "install", "progress", "event", "to", "be", "displayed" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/Director.java#L198-L212
JadiraOrg/jadira
bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java
BasicBinder.convertTo
public <S, T> T convertTo(Class<T> output, Object object, Class<? extends Annotation> qualifier) { if (object == null) { return null; } @SuppressWarnings("unchecked") Converter<S, T> conv = (Converter<S, T>) determineConverter(object.getClass(), output, qualifier == null ? DefaultBinding.class : qualifier); if (conv == null) { @SuppressWarnings("unchecked") Class<S> inputClass = (Class<S>)object.getClass(); throw new NoConverterFoundException(new ConverterKey<S,T>(inputClass, output, qualifier == null ? DefaultBinding.class : qualifier)); } @SuppressWarnings("unchecked") S myObject = (S)object; return conv.convert(myObject); }
java
public <S, T> T convertTo(Class<T> output, Object object, Class<? extends Annotation> qualifier) { if (object == null) { return null; } @SuppressWarnings("unchecked") Converter<S, T> conv = (Converter<S, T>) determineConverter(object.getClass(), output, qualifier == null ? DefaultBinding.class : qualifier); if (conv == null) { @SuppressWarnings("unchecked") Class<S> inputClass = (Class<S>)object.getClass(); throw new NoConverterFoundException(new ConverterKey<S,T>(inputClass, output, qualifier == null ? DefaultBinding.class : qualifier)); } @SuppressWarnings("unchecked") S myObject = (S)object; return conv.convert(myObject); }
[ "public", "<", "S", ",", "T", ">", "T", "convertTo", "(", "Class", "<", "T", ">", "output", ",", "Object", "object", ",", "Class", "<", "?", "extends", "Annotation", ">", "qualifier", ")", "{", "if", "(", "object", "==", "null", ")", "{", "return",...
Convert an object to the given target class This method infers the source type for the conversion from the runtime type of object. @param output The target class to convert the object to @param object The object to be converted @param qualifier The qualifier for which the binding must be registered
[ "Convert", "an", "object", "to", "the", "given", "target", "class", "This", "method", "infers", "the", "source", "type", "for", "the", "conversion", "from", "the", "runtime", "type", "of", "object", "." ]
train
https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java#L741-L759
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/protocols/channels/StoredPaymentChannelClientStates.java
StoredPaymentChannelClientStates.getChannel
@Nullable public StoredClientChannel getChannel(Sha256Hash id, Sha256Hash contractHash) { lock.lock(); try { Set<StoredClientChannel> setChannels = mapChannels.get(id); for (StoredClientChannel channel : setChannels) { if (channel.contract.getTxId().equals(contractHash)) return channel; } return null; } finally { lock.unlock(); } }
java
@Nullable public StoredClientChannel getChannel(Sha256Hash id, Sha256Hash contractHash) { lock.lock(); try { Set<StoredClientChannel> setChannels = mapChannels.get(id); for (StoredClientChannel channel : setChannels) { if (channel.contract.getTxId().equals(contractHash)) return channel; } return null; } finally { lock.unlock(); } }
[ "@", "Nullable", "public", "StoredClientChannel", "getChannel", "(", "Sha256Hash", "id", ",", "Sha256Hash", "contractHash", ")", "{", "lock", ".", "lock", "(", ")", ";", "try", "{", "Set", "<", "StoredClientChannel", ">", "setChannels", "=", "mapChannels", "."...
Finds a channel with the given id and contract hash and returns it, or returns null.
[ "Finds", "a", "channel", "with", "the", "given", "id", "and", "contract", "hash", "and", "returns", "it", "or", "returns", "null", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/channels/StoredPaymentChannelClientStates.java#L169-L182
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/i18n/dao/GeneratedDi18nDaoImpl.java
GeneratedDi18nDaoImpl.queryByKey
public Iterable<Di18n> queryByKey(java.lang.String key) { return queryByField(null, Di18nMapper.Field.KEY.getFieldName(), key); }
java
public Iterable<Di18n> queryByKey(java.lang.String key) { return queryByField(null, Di18nMapper.Field.KEY.getFieldName(), key); }
[ "public", "Iterable", "<", "Di18n", ">", "queryByKey", "(", "java", ".", "lang", ".", "String", "key", ")", "{", "return", "queryByField", "(", "null", ",", "Di18nMapper", ".", "Field", ".", "KEY", ".", "getFieldName", "(", ")", ",", "key", ")", ";", ...
query-by method for field key @param key the specified attribute @return an Iterable of Di18ns for the specified key
[ "query", "-", "by", "method", "for", "field", "key" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/i18n/dao/GeneratedDi18nDaoImpl.java#L70-L72
opencb/biodata
biodata-tools/src/main/java/org/opencb/biodata/tools/variant/metadata/VariantMetadataManager.java
VariantMetadataManager.removeIndividual
public void removeIndividual(String individualId, String studyId) { // Sanity check if (StringUtils.isEmpty(individualId)) { logger.error("Individual ID {} is null or empty.", individualId); return; } VariantStudyMetadata variantStudyMetadata = getVariantStudyMetadata(studyId); if (variantStudyMetadata == null) { logger.error("Study not found. Check your study ID: '{}'", studyId); return; } if (variantStudyMetadata.getIndividuals() != null) { for (int i = 0; i < variantStudyMetadata.getIndividuals().size(); i++) { if (individualId.equals(variantStudyMetadata.getIndividuals().get(i).getId())) { variantStudyMetadata.getIndividuals().remove(i); return; } } } }
java
public void removeIndividual(String individualId, String studyId) { // Sanity check if (StringUtils.isEmpty(individualId)) { logger.error("Individual ID {} is null or empty.", individualId); return; } VariantStudyMetadata variantStudyMetadata = getVariantStudyMetadata(studyId); if (variantStudyMetadata == null) { logger.error("Study not found. Check your study ID: '{}'", studyId); return; } if (variantStudyMetadata.getIndividuals() != null) { for (int i = 0; i < variantStudyMetadata.getIndividuals().size(); i++) { if (individualId.equals(variantStudyMetadata.getIndividuals().get(i).getId())) { variantStudyMetadata.getIndividuals().remove(i); return; } } } }
[ "public", "void", "removeIndividual", "(", "String", "individualId", ",", "String", "studyId", ")", "{", "// Sanity check", "if", "(", "StringUtils", ".", "isEmpty", "(", "individualId", ")", ")", "{", "logger", ".", "error", "(", "\"Individual ID {} is null or em...
Remove an individual (from individual ID) of a given variant study metadata (from study ID). @param individualId Individual ID @param studyId Study ID
[ "Remove", "an", "individual", "(", "from", "individual", "ID", ")", "of", "a", "given", "variant", "study", "metadata", "(", "from", "study", "ID", ")", "." ]
train
https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/variant/metadata/VariantMetadataManager.java#L372-L392
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UTF16.java
UTF16.valueOf
public static String valueOf(String source, int offset16) { switch (bounds(source, offset16)) { case LEAD_SURROGATE_BOUNDARY: return source.substring(offset16, offset16 + 2); case TRAIL_SURROGATE_BOUNDARY: return source.substring(offset16 - 1, offset16 + 1); default: return source.substring(offset16, offset16 + 1); } }
java
public static String valueOf(String source, int offset16) { switch (bounds(source, offset16)) { case LEAD_SURROGATE_BOUNDARY: return source.substring(offset16, offset16 + 2); case TRAIL_SURROGATE_BOUNDARY: return source.substring(offset16 - 1, offset16 + 1); default: return source.substring(offset16, offset16 + 1); } }
[ "public", "static", "String", "valueOf", "(", "String", "source", ",", "int", "offset16", ")", "{", "switch", "(", "bounds", "(", "source", ",", "offset16", ")", ")", "{", "case", "LEAD_SURROGATE_BOUNDARY", ":", "return", "source", ".", "substring", "(", "...
Convenience method corresponding to String.valueOf(codepoint at offset16). Returns a one or two char string containing the UTF-32 value in UTF16 format. If offset16 indexes a surrogate character, the whole supplementary codepoint will be returned. If a validity check is required, use {@link android.icu.lang.UCharacter#isLegal(int)} on the codepoint at offset16 before calling. The result returned will be a newly created String obtained by calling source.substring(..) with the appropriate indexes. @param source The input string. @param offset16 The UTF16 index to the codepoint in source @return string value of char32 in UTF16 format
[ "Convenience", "method", "corresponding", "to", "String", ".", "valueOf", "(", "codepoint", "at", "offset16", ")", ".", "Returns", "a", "one", "or", "two", "char", "string", "containing", "the", "UTF", "-", "32", "value", "in", "UTF16", "format", ".", "If"...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UTF16.java#L660-L669
Azure/azure-sdk-for-java
datamigration/resource-manager/v2018_07_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2018_07_15_preview/implementation/FilesInner.java
FilesInner.updateAsync
public Observable<ProjectFileInner> updateAsync(String groupName, String serviceName, String projectName, String fileName, ProjectFileInner parameters) { return updateWithServiceResponseAsync(groupName, serviceName, projectName, fileName, parameters).map(new Func1<ServiceResponse<ProjectFileInner>, ProjectFileInner>() { @Override public ProjectFileInner call(ServiceResponse<ProjectFileInner> response) { return response.body(); } }); }
java
public Observable<ProjectFileInner> updateAsync(String groupName, String serviceName, String projectName, String fileName, ProjectFileInner parameters) { return updateWithServiceResponseAsync(groupName, serviceName, projectName, fileName, parameters).map(new Func1<ServiceResponse<ProjectFileInner>, ProjectFileInner>() { @Override public ProjectFileInner call(ServiceResponse<ProjectFileInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ProjectFileInner", ">", "updateAsync", "(", "String", "groupName", ",", "String", "serviceName", ",", "String", "projectName", ",", "String", "fileName", ",", "ProjectFileInner", "parameters", ")", "{", "return", "updateWithServiceRespons...
Update a file. This method updates an existing file. @param groupName Name of the resource group @param serviceName Name of the service @param projectName Name of the project @param fileName Name of the File @param parameters Information about the file @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ProjectFileInner object
[ "Update", "a", "file", ".", "This", "method", "updates", "an", "existing", "file", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datamigration/resource-manager/v2018_07_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2018_07_15_preview/implementation/FilesInner.java#L604-L611
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java
CPInstancePersistenceImpl.findAll
@Override public List<CPInstance> findAll(int start, int end) { return findAll(start, end, null); }
java
@Override public List<CPInstance> findAll(int start, int end) { return findAll(start, end, null); }
[ "@", "Override", "public", "List", "<", "CPInstance", ">", "findAll", "(", "int", "start", ",", "int", "end", ")", "{", "return", "findAll", "(", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the cp instances. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPInstanceModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param start the lower bound of the range of cp instances @param end the upper bound of the range of cp instances (not inclusive) @return the range of cp instances
[ "Returns", "a", "range", "of", "all", "the", "cp", "instances", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java#L7911-L7914
Azure/azure-sdk-for-java
eventgrid/resource-manager/v2018_05_01_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_05_01_preview/implementation/EventSubscriptionsInner.java
EventSubscriptionsInner.listRegionalByResourceGroup
public List<EventSubscriptionInner> listRegionalByResourceGroup(String resourceGroupName, String location) { return listRegionalByResourceGroupWithServiceResponseAsync(resourceGroupName, location).toBlocking().single().body(); }
java
public List<EventSubscriptionInner> listRegionalByResourceGroup(String resourceGroupName, String location) { return listRegionalByResourceGroupWithServiceResponseAsync(resourceGroupName, location).toBlocking().single().body(); }
[ "public", "List", "<", "EventSubscriptionInner", ">", "listRegionalByResourceGroup", "(", "String", "resourceGroupName", ",", "String", "location", ")", "{", "return", "listRegionalByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "location", ")", "."...
List all regional event subscriptions under an Azure subscription and resource group. List all event subscriptions from the given location under a specific Azure subscription and resource group. @param resourceGroupName The name of the resource group within the user's subscription. @param location Name of the location @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;EventSubscriptionInner&gt; object if successful.
[ "List", "all", "regional", "event", "subscriptions", "under", "an", "Azure", "subscription", "and", "resource", "group", ".", "List", "all", "event", "subscriptions", "from", "the", "given", "location", "under", "a", "specific", "Azure", "subscription", "and", "...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2018_05_01_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_05_01_preview/implementation/EventSubscriptionsInner.java#L1272-L1274
alkacon/opencms-core
src-modules/org/opencms/workplace/commons/CmsPreferences.java
CmsPreferences.buildSelectEditorButtonStyle
public String buildSelectEditorButtonStyle(String htmlAttributes) { int selectedIndex = Integer.parseInt(getParamTabEdButtonStyle()); return buildSelectButtonStyle(htmlAttributes, selectedIndex); }
java
public String buildSelectEditorButtonStyle(String htmlAttributes) { int selectedIndex = Integer.parseInt(getParamTabEdButtonStyle()); return buildSelectButtonStyle(htmlAttributes, selectedIndex); }
[ "public", "String", "buildSelectEditorButtonStyle", "(", "String", "htmlAttributes", ")", "{", "int", "selectedIndex", "=", "Integer", ".", "parseInt", "(", "getParamTabEdButtonStyle", "(", ")", ")", ";", "return", "buildSelectButtonStyle", "(", "htmlAttributes", ",",...
Builds the html for the editor button style select box.<p> @param htmlAttributes optional html attributes for the &lgt;select&gt; tag @return the html for the editor button style select box
[ "Builds", "the", "html", "for", "the", "editor", "button", "style", "select", "box", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsPreferences.java#L657-L661
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/io/GeoPackageIOUtils.java
GeoPackageIOUtils.copyStream
public static void copyStream(InputStream copyFrom, File copyTo) throws IOException { copyStream(copyFrom, copyTo, null); }
java
public static void copyStream(InputStream copyFrom, File copyTo) throws IOException { copyStream(copyFrom, copyTo, null); }
[ "public", "static", "void", "copyStream", "(", "InputStream", "copyFrom", ",", "File", "copyTo", ")", "throws", "IOException", "{", "copyStream", "(", "copyFrom", ",", "copyTo", ",", "null", ")", ";", "}" ]
Copy an input stream to a file location @param copyFrom from file @param copyTo to file @throws IOException upon failure
[ "Copy", "an", "input", "stream", "to", "a", "file", "location" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/io/GeoPackageIOUtils.java#L121-L124
wellner/jcarafe
jcarafe-core/src/main/java/org/mitre/jcarafe/jarafe/JarafeMEDecoder.java
JarafeMEDecoder.classifyValuedInstanceDistribution
public List<StringDoublePair> classifyValuedInstanceDistribution(List<StringDoublePair> features) { List<scala.Tuple2<String,Double>> nfs = new ArrayList<scala.Tuple2<String,Double>>(); for (StringDoublePair el : features) { nfs.add(new scala.Tuple2<String,Double>(el.getString(), el.getDouble())); } List<scala.Tuple2<String,Double>> r = maxEnt.decodeValuedInstanceAsDistribution(nfs); List<StringDoublePair> res = new ArrayList<StringDoublePair>(); for (scala.Tuple2<String,Double> el : r) { res.add(new StringDoublePair(el._1, el._2)); } return res; }
java
public List<StringDoublePair> classifyValuedInstanceDistribution(List<StringDoublePair> features) { List<scala.Tuple2<String,Double>> nfs = new ArrayList<scala.Tuple2<String,Double>>(); for (StringDoublePair el : features) { nfs.add(new scala.Tuple2<String,Double>(el.getString(), el.getDouble())); } List<scala.Tuple2<String,Double>> r = maxEnt.decodeValuedInstanceAsDistribution(nfs); List<StringDoublePair> res = new ArrayList<StringDoublePair>(); for (scala.Tuple2<String,Double> el : r) { res.add(new StringDoublePair(el._1, el._2)); } return res; }
[ "public", "List", "<", "StringDoublePair", ">", "classifyValuedInstanceDistribution", "(", "List", "<", "StringDoublePair", ">", "features", ")", "{", "List", "<", "scala", ".", "Tuple2", "<", "String", ",", "Double", ">", ">", "nfs", "=", "new", "ArrayList", ...
/* @param features - A list of string-double pairs representing the valued features for a classification instance @return string-double pair list - A list of pairs that include each label and a posterior probability mass
[ "/", "*" ]
train
https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/org/mitre/jcarafe/jarafe/JarafeMEDecoder.java#L63-L74
hal/core
processors/src/main/java/org/jboss/hal/processors/AbstractHalProcessor.java
AbstractHalProcessor.writeResource
protected void writeResource(final String packageName, final String resourceName, final StringBuffer content) { try { FileObject mf = filer.createResource(StandardLocation.SOURCE_OUTPUT, packageName, resourceName); Writer w = mf.openWriter(); BufferedWriter bw = new BufferedWriter(w); bw.append(content); bw.close(); w.close(); } catch (IOException e) { throw new GenerationException(String.format("Error writing content for %s.%s: %s", packageName, resourceName, e.getMessage())); } }
java
protected void writeResource(final String packageName, final String resourceName, final StringBuffer content) { try { FileObject mf = filer.createResource(StandardLocation.SOURCE_OUTPUT, packageName, resourceName); Writer w = mf.openWriter(); BufferedWriter bw = new BufferedWriter(w); bw.append(content); bw.close(); w.close(); } catch (IOException e) { throw new GenerationException(String.format("Error writing content for %s.%s: %s", packageName, resourceName, e.getMessage())); } }
[ "protected", "void", "writeResource", "(", "final", "String", "packageName", ",", "final", "String", "resourceName", ",", "final", "StringBuffer", "content", ")", "{", "try", "{", "FileObject", "mf", "=", "filer", ".", "createResource", "(", "StandardLocation", ...
Writes the specified resource and wraps any {@code IOException} as {@link GenerationException}. @param packageName the package name @param resourceName the resource name @param content the content @throws GenerationException if an {@code IOException occurs}
[ "Writes", "the", "specified", "resource", "and", "wraps", "any", "{", "@code", "IOException", "}", "as", "{", "@link", "GenerationException", "}", "." ]
train
https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/processors/src/main/java/org/jboss/hal/processors/AbstractHalProcessor.java#L271-L283
Steveice10/OpenNBT
src/main/java/com/github/steveice10/opennbt/NBTIO.java
NBTIO.readTag
public static Tag readTag(InputStream in, boolean littleEndian) throws IOException { return readTag((DataInput) (littleEndian ? new LittleEndianDataInputStream(in) : new DataInputStream(in))); }
java
public static Tag readTag(InputStream in, boolean littleEndian) throws IOException { return readTag((DataInput) (littleEndian ? new LittleEndianDataInputStream(in) : new DataInputStream(in))); }
[ "public", "static", "Tag", "readTag", "(", "InputStream", "in", ",", "boolean", "littleEndian", ")", "throws", "IOException", "{", "return", "readTag", "(", "(", "DataInput", ")", "(", "littleEndian", "?", "new", "LittleEndianDataInputStream", "(", "in", ")", ...
Reads an NBT tag. @param in Input stream to read from. @param littleEndian Whether to read little endian NBT. @return The read tag, or null if the tag is an end tag. @throws java.io.IOException If an I/O error occurs.
[ "Reads", "an", "NBT", "tag", "." ]
train
https://github.com/Steveice10/OpenNBT/blob/9bf4adb2afd206a21bc4309c85d642494d1fb536/src/main/java/com/github/steveice10/opennbt/NBTIO.java#L167-L169
csc19601128/Phynixx
phynixx/phynixx-logger/src/main/java/org/csc/phynixx/loggersystem/logrecord/PhynixxXADataRecorder.java
PhynixxXADataRecorder.recoverDataRecorder
static PhynixxXADataRecorder recoverDataRecorder(XADataLogger xaDataLogger, IXADataRecorderLifecycleListener dataRecorderLifycycleListner) { try { PhynixxXADataRecorder dataRecorder = new PhynixxXADataRecorder(-1, xaDataLogger, dataRecorderLifycycleListner); dataRecorder.recover(); return dataRecorder; } catch (Exception e) { throw new DelegatedRuntimeException(e); } }
java
static PhynixxXADataRecorder recoverDataRecorder(XADataLogger xaDataLogger, IXADataRecorderLifecycleListener dataRecorderLifycycleListner) { try { PhynixxXADataRecorder dataRecorder = new PhynixxXADataRecorder(-1, xaDataLogger, dataRecorderLifycycleListner); dataRecorder.recover(); return dataRecorder; } catch (Exception e) { throw new DelegatedRuntimeException(e); } }
[ "static", "PhynixxXADataRecorder", "recoverDataRecorder", "(", "XADataLogger", "xaDataLogger", ",", "IXADataRecorderLifecycleListener", "dataRecorderLifycycleListner", ")", "{", "try", "{", "PhynixxXADataRecorder", "dataRecorder", "=", "new", "PhynixxXADataRecorder", "(", "-", ...
opens an Recorder for read. If no recorder with the given ID exists recorder with no data is returned @param xaDataLogger Strategy to persist the records @return @throws IOException @throws InterruptedException
[ "opens", "an", "Recorder", "for", "read", ".", "If", "no", "recorder", "with", "the", "given", "ID", "exists", "recorder", "with", "no", "data", "is", "returned" ]
train
https://github.com/csc19601128/Phynixx/blob/a26c03bc229a8882c647799834115bec6bdc0ac8/phynixx/phynixx-logger/src/main/java/org/csc/phynixx/loggersystem/logrecord/PhynixxXADataRecorder.java#L73-L82
classgraph/classgraph
src/main/java/io/github/classgraph/ClassInfo.java
ClassInfo.getClassesWithFieldOrMethodAnnotation
private ClassInfoList getClassesWithFieldOrMethodAnnotation(final RelType relType) { final boolean isField = relType == RelType.CLASSES_WITH_FIELD_ANNOTATION; if (!(isField ? scanResult.scanSpec.enableFieldInfo : scanResult.scanSpec.enableMethodInfo) || !scanResult.scanSpec.enableAnnotationInfo) { throw new IllegalArgumentException("Please call ClassGraph#enable" + (isField ? "Field" : "Method") + "Info() and " + "#enableAnnotationInfo() before #scan()"); } final ReachableAndDirectlyRelatedClasses classesWithDirectlyAnnotatedFieldsOrMethods = this .filterClassInfo(relType, /* strictWhitelist = */ !isExternalClass); final ReachableAndDirectlyRelatedClasses annotationsWithThisMetaAnnotation = this.filterClassInfo( RelType.CLASSES_WITH_ANNOTATION, /* strictWhitelist = */ !isExternalClass, ClassType.ANNOTATION); if (annotationsWithThisMetaAnnotation.reachableClasses.isEmpty()) { // This annotation does not meta-annotate another annotation that annotates a method return new ClassInfoList(classesWithDirectlyAnnotatedFieldsOrMethods, /* sortByName = */ true); } else { // Take the union of all classes with fields or methods directly annotated by this annotation, // and classes with fields or methods meta-annotated by this annotation final Set<ClassInfo> allClassesWithAnnotatedOrMetaAnnotatedFieldsOrMethods = new LinkedHashSet<>( classesWithDirectlyAnnotatedFieldsOrMethods.reachableClasses); for (final ClassInfo metaAnnotatedAnnotation : annotationsWithThisMetaAnnotation.reachableClasses) { allClassesWithAnnotatedOrMetaAnnotatedFieldsOrMethods .addAll(metaAnnotatedAnnotation.filterClassInfo(relType, /* strictWhitelist = */ !metaAnnotatedAnnotation.isExternalClass).reachableClasses); } return new ClassInfoList(allClassesWithAnnotatedOrMetaAnnotatedFieldsOrMethods, classesWithDirectlyAnnotatedFieldsOrMethods.directlyRelatedClasses, /* sortByName = */ true); } }
java
private ClassInfoList getClassesWithFieldOrMethodAnnotation(final RelType relType) { final boolean isField = relType == RelType.CLASSES_WITH_FIELD_ANNOTATION; if (!(isField ? scanResult.scanSpec.enableFieldInfo : scanResult.scanSpec.enableMethodInfo) || !scanResult.scanSpec.enableAnnotationInfo) { throw new IllegalArgumentException("Please call ClassGraph#enable" + (isField ? "Field" : "Method") + "Info() and " + "#enableAnnotationInfo() before #scan()"); } final ReachableAndDirectlyRelatedClasses classesWithDirectlyAnnotatedFieldsOrMethods = this .filterClassInfo(relType, /* strictWhitelist = */ !isExternalClass); final ReachableAndDirectlyRelatedClasses annotationsWithThisMetaAnnotation = this.filterClassInfo( RelType.CLASSES_WITH_ANNOTATION, /* strictWhitelist = */ !isExternalClass, ClassType.ANNOTATION); if (annotationsWithThisMetaAnnotation.reachableClasses.isEmpty()) { // This annotation does not meta-annotate another annotation that annotates a method return new ClassInfoList(classesWithDirectlyAnnotatedFieldsOrMethods, /* sortByName = */ true); } else { // Take the union of all classes with fields or methods directly annotated by this annotation, // and classes with fields or methods meta-annotated by this annotation final Set<ClassInfo> allClassesWithAnnotatedOrMetaAnnotatedFieldsOrMethods = new LinkedHashSet<>( classesWithDirectlyAnnotatedFieldsOrMethods.reachableClasses); for (final ClassInfo metaAnnotatedAnnotation : annotationsWithThisMetaAnnotation.reachableClasses) { allClassesWithAnnotatedOrMetaAnnotatedFieldsOrMethods .addAll(metaAnnotatedAnnotation.filterClassInfo(relType, /* strictWhitelist = */ !metaAnnotatedAnnotation.isExternalClass).reachableClasses); } return new ClassInfoList(allClassesWithAnnotatedOrMetaAnnotatedFieldsOrMethods, classesWithDirectlyAnnotatedFieldsOrMethods.directlyRelatedClasses, /* sortByName = */ true); } }
[ "private", "ClassInfoList", "getClassesWithFieldOrMethodAnnotation", "(", "final", "RelType", "relType", ")", "{", "final", "boolean", "isField", "=", "relType", "==", "RelType", ".", "CLASSES_WITH_FIELD_ANNOTATION", ";", "if", "(", "!", "(", "isField", "?", "scanRe...
Get the classes that have this class as a field, method or method parameter annotation. @param relType One of {@link RelType#CLASSES_WITH_FIELD_ANNOTATION}, {@link RelType#CLASSES_WITH_METHOD_ANNOTATION} or {@link RelType#CLASSES_WITH_METHOD_PARAMETER_ANNOTATION}. @return A list of classes that have a declared method with this annotation or meta-annotation, or the empty list if none.
[ "Get", "the", "classes", "that", "have", "this", "class", "as", "a", "field", "method", "or", "method", "parameter", "annotation", "." ]
train
https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/io/github/classgraph/ClassInfo.java#L1571-L1598
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkGatewayConnectionsInner.java
VirtualNetworkGatewayConnectionsInner.beginResetSharedKey
public ConnectionResetSharedKeyInner beginResetSharedKey(String resourceGroupName, String virtualNetworkGatewayConnectionName, int keyLength) { return beginResetSharedKeyWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, keyLength).toBlocking().single().body(); }
java
public ConnectionResetSharedKeyInner beginResetSharedKey(String resourceGroupName, String virtualNetworkGatewayConnectionName, int keyLength) { return beginResetSharedKeyWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, keyLength).toBlocking().single().body(); }
[ "public", "ConnectionResetSharedKeyInner", "beginResetSharedKey", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkGatewayConnectionName", ",", "int", "keyLength", ")", "{", "return", "beginResetSharedKeyWithServiceResponseAsync", "(", "resourceGroupName", ",", ...
The VirtualNetworkGatewayConnectionResetSharedKey operation resets the virtual network gateway connection shared key for passed virtual network gateway connection in the specified resource group through Network resource provider. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayConnectionName The virtual network gateway connection reset shared key Name. @param keyLength The virtual network connection reset shared key length, should between 1 and 128. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ConnectionResetSharedKeyInner object if successful.
[ "The", "VirtualNetworkGatewayConnectionResetSharedKey", "operation", "resets", "the", "virtual", "network", "gateway", "connection", "shared", "key", "for", "passed", "virtual", "network", "gateway", "connection", "in", "the", "specified", "resource", "group", "through", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkGatewayConnectionsInner.java#L1296-L1298
Alluxio/alluxio
core/common/src/main/java/alluxio/concurrent/jsr/CompletableFuture.java
CompletableFuture.encodeThrowable
static Object encodeThrowable(Throwable x, Object r) { if (!(x instanceof CompletionException)) x = new CompletionException(x); else if (r instanceof AltResult && x == ((AltResult) r).ex) return r; return new AltResult(x); }
java
static Object encodeThrowable(Throwable x, Object r) { if (!(x instanceof CompletionException)) x = new CompletionException(x); else if (r instanceof AltResult && x == ((AltResult) r).ex) return r; return new AltResult(x); }
[ "static", "Object", "encodeThrowable", "(", "Throwable", "x", ",", "Object", "r", ")", "{", "if", "(", "!", "(", "x", "instanceof", "CompletionException", ")", ")", "x", "=", "new", "CompletionException", "(", "x", ")", ";", "else", "if", "(", "r", "in...
Returns the encoding of the given (non-null) exception as a wrapped CompletionException unless it is one already. May return the given Object r (which must have been the result of a source future) if it is equivalent, i.e. if this is a simple relay of an existing CompletionException.
[ "Returns", "the", "encoding", "of", "the", "given", "(", "non", "-", "null", ")", "exception", "as", "a", "wrapped", "CompletionException", "unless", "it", "is", "one", "already", ".", "May", "return", "the", "given", "Object", "r", "(", "which", "must", ...
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/concurrent/jsr/CompletableFuture.java#L261-L267