repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
188
func_name
stringlengths
7
127
whole_func_string
stringlengths
77
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
77
3.91k
func_code_tokens
listlengths
20
745
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
477
split_name
stringclasses
1 value
func_code_url
stringlengths
111
288
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/ExpGammaDistribution.java
ExpGammaDistribution.logcdf
public static double logcdf(double x, double k, double theta, double shift) { final double e = FastMath.exp((x - shift) * theta); return e < Double.POSITIVE_INFINITY ? GammaDistribution.logregularizedGammaP(k, e) : 0.; }
java
public static double logcdf(double x, double k, double theta, double shift) { final double e = FastMath.exp((x - shift) * theta); return e < Double.POSITIVE_INFINITY ? GammaDistribution.logregularizedGammaP(k, e) : 0.; }
[ "public", "static", "double", "logcdf", "(", "double", "x", ",", "double", "k", ",", "double", "theta", ",", "double", "shift", ")", "{", "final", "double", "e", "=", "FastMath", ".", "exp", "(", "(", "x", "-", "shift", ")", "*", "theta", ")", ";",...
The log CDF, static version. @param x Value @param k Shape k @param theta Theta = 1.0/Beta aka. "scaling" parameter @return cdf value
[ "The", "log", "CDF", "static", "version", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/ExpGammaDistribution.java#L190-L193
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java
CommonOps_DDRM.elementLog
public static void elementLog(DMatrixD1 A , DMatrixD1 C ) { if( A.numCols != C.numCols || A.numRows != C.numRows ) { throw new MatrixDimensionException("All matrices must be the same shape"); } int size = A.getNumElements(); for( int i = 0; i < size; i++ ) { C.data[i] = Math.log(A.data[i]); } }
java
public static void elementLog(DMatrixD1 A , DMatrixD1 C ) { if( A.numCols != C.numCols || A.numRows != C.numRows ) { throw new MatrixDimensionException("All matrices must be the same shape"); } int size = A.getNumElements(); for( int i = 0; i < size; i++ ) { C.data[i] = Math.log(A.data[i]); } }
[ "public", "static", "void", "elementLog", "(", "DMatrixD1", "A", ",", "DMatrixD1", "C", ")", "{", "if", "(", "A", ".", "numCols", "!=", "C", ".", "numCols", "||", "A", ".", "numRows", "!=", "C", ".", "numRows", ")", "{", "throw", "new", "MatrixDimens...
<p> Element-wise log operation <br> c<sub>ij</sub> = Math.log(a<sub>ij</sub>) <p> @param A input @param C output (modified)
[ "<p", ">", "Element", "-", "wise", "log", "operation", "<br", ">", "c<sub", ">", "ij<", "/", "sub", ">", "=", "Math", ".", "log", "(", "a<sub", ">", "ij<", "/", "sub", ">", ")", "<p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L1707-L1717
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getAchievementInfo
public void getAchievementInfo(int[] ids, Callback<List<Achievement>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getAchievementInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
java
public void getAchievementInfo(int[] ids, Callback<List<Achievement>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getAchievementInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
[ "public", "void", "getAchievementInfo", "(", "int", "[", "]", "ids", ",", "Callback", "<", "List", "<", "Achievement", ">", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", "ParamChecker", "(", ...
For more info on achievement API go <a href="https://wiki.guildwars2.com/wiki/API:2/achievements">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param ids list of achievement id(s) @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception invalid API key @throws NullPointerException if given {@link Callback} is empty @see Achievement achievement info
[ "For", "more", "info", "on", "achievement", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "achievements", ">", "here<", "/", "a", ">", "<br", "/", ">", "Give", "...
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L484-L487
apptik/JustJson
json-core/src/main/java/io/apptik/json/JsonObject.java
JsonObject.optInt
public Integer optInt(String name, Integer fallback) { return optInt(name, fallback, true); }
java
public Integer optInt(String name, Integer fallback) { return optInt(name, fallback, true); }
[ "public", "Integer", "optInt", "(", "String", "name", ",", "Integer", "fallback", ")", "{", "return", "optInt", "(", "name", ",", "fallback", ",", "true", ")", ";", "}" ]
Returns the value mapped by {@code name} if it exists and is an int or can be coerced to an int, or {@code fallback} otherwise.
[ "Returns", "the", "value", "mapped", "by", "{" ]
train
https://github.com/apptik/JustJson/blob/c90f0dd7f84df26da4749be8cd9b026fff499a79/json-core/src/main/java/io/apptik/json/JsonObject.java#L499-L501
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/BackupShortTermRetentionPoliciesInner.java
BackupShortTermRetentionPoliciesInner.createOrUpdateAsync
public Observable<BackupShortTermRetentionPolicyInner> createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).map(new Func1<ServiceResponse<BackupShortTermRetentionPolicyInner>, BackupShortTermRetentionPolicyInner>() { @Override public BackupShortTermRetentionPolicyInner call(ServiceResponse<BackupShortTermRetentionPolicyInner> response) { return response.body(); } }); }
java
public Observable<BackupShortTermRetentionPolicyInner> createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).map(new Func1<ServiceResponse<BackupShortTermRetentionPolicyInner>, BackupShortTermRetentionPolicyInner>() { @Override public BackupShortTermRetentionPolicyInner call(ServiceResponse<BackupShortTermRetentionPolicyInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "BackupShortTermRetentionPolicyInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "Integer", "retentionDays", ")", "{", "return", "createOrUpdateWithServiceRes...
Updates a database's short term retention policy. @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. @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Updates", "a", "database", "s", "short", "term", "retention", "policy", "." ]
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/BackupShortTermRetentionPoliciesInner.java#L307-L314
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/lang/ClassHelper.java
ClassHelper.areConvertibleClasses
public static boolean areConvertibleClasses (@Nonnull final Class <?> aSrcClass, @Nonnull final Class <?> aDstClass) { ValueEnforcer.notNull (aSrcClass, "SrcClass"); ValueEnforcer.notNull (aDstClass, "DstClass"); // Same class? if (aDstClass.equals (aSrcClass)) return true; // Default assignable if (aDstClass.isAssignableFrom (aSrcClass)) return true; // Special handling for "int.class" == "Integer.class" etc. if (aDstClass == getPrimitiveWrapperClass (aSrcClass)) return true; if (aDstClass == getPrimitiveClass (aSrcClass)) return true; // Not convertible return false; }
java
public static boolean areConvertibleClasses (@Nonnull final Class <?> aSrcClass, @Nonnull final Class <?> aDstClass) { ValueEnforcer.notNull (aSrcClass, "SrcClass"); ValueEnforcer.notNull (aDstClass, "DstClass"); // Same class? if (aDstClass.equals (aSrcClass)) return true; // Default assignable if (aDstClass.isAssignableFrom (aSrcClass)) return true; // Special handling for "int.class" == "Integer.class" etc. if (aDstClass == getPrimitiveWrapperClass (aSrcClass)) return true; if (aDstClass == getPrimitiveClass (aSrcClass)) return true; // Not convertible return false; }
[ "public", "static", "boolean", "areConvertibleClasses", "(", "@", "Nonnull", "final", "Class", "<", "?", ">", "aSrcClass", ",", "@", "Nonnull", "final", "Class", "<", "?", ">", "aDstClass", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aSrcClass", ",", ...
Check if the passed classes are convertible. Includes conversion checks between primitive types and primitive wrapper types. @param aSrcClass First class. May not be <code>null</code>. @param aDstClass Second class. May not be <code>null</code>. @return <code>true</code> if the classes are directly convertible.
[ "Check", "if", "the", "passed", "classes", "are", "convertible", ".", "Includes", "conversion", "checks", "between", "primitive", "types", "and", "primitive", "wrapper", "types", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/ClassHelper.java#L284-L305
deeplearning4j/deeplearning4j
datavec/datavec-spark/src/main/java/org/datavec/spark/storage/SparkStorageUtils.java
SparkStorageUtils.saveSequenceFile
public static void saveSequenceFile(String path, JavaRDD<List<Writable>> rdd, Integer maxOutputFiles) { path = FilenameUtils.normalize(path, true); if (maxOutputFiles != null) { rdd = rdd.coalesce(maxOutputFiles); } JavaPairRDD<List<Writable>, Long> dataIndexPairs = rdd.zipWithUniqueId(); //Note: Long values are unique + NOT contiguous; more efficient than zipWithIndex JavaPairRDD<LongWritable, RecordWritable> keyedByIndex = dataIndexPairs.mapToPair(new RecordSavePrepPairFunction()); keyedByIndex.saveAsNewAPIHadoopFile(path, LongWritable.class, RecordWritable.class, SequenceFileOutputFormat.class); }
java
public static void saveSequenceFile(String path, JavaRDD<List<Writable>> rdd, Integer maxOutputFiles) { path = FilenameUtils.normalize(path, true); if (maxOutputFiles != null) { rdd = rdd.coalesce(maxOutputFiles); } JavaPairRDD<List<Writable>, Long> dataIndexPairs = rdd.zipWithUniqueId(); //Note: Long values are unique + NOT contiguous; more efficient than zipWithIndex JavaPairRDD<LongWritable, RecordWritable> keyedByIndex = dataIndexPairs.mapToPair(new RecordSavePrepPairFunction()); keyedByIndex.saveAsNewAPIHadoopFile(path, LongWritable.class, RecordWritable.class, SequenceFileOutputFormat.class); }
[ "public", "static", "void", "saveSequenceFile", "(", "String", "path", ",", "JavaRDD", "<", "List", "<", "Writable", ">", ">", "rdd", ",", "Integer", "maxOutputFiles", ")", "{", "path", "=", "FilenameUtils", ".", "normalize", "(", "path", ",", "true", ")",...
Save a {@code JavaRDD<List<Writable>>} to a Hadoop {@link org.apache.hadoop.io.SequenceFile}. Each record is given a unique (but noncontiguous) {@link LongWritable} key, and values are stored as {@link RecordWritable} instances. <p> Use {@link #restoreSequenceFile(String, JavaSparkContext)} to restore values saved with this method. @param path Path to save the sequence file @param rdd RDD to save @param maxOutputFiles Nullable. If non-null: first coalesce the RDD to the specified size (number of partitions) to limit the maximum number of output sequence files @see #saveSequenceFileSequences(String, JavaRDD) @see #saveMapFile(String, JavaRDD)
[ "Save", "a", "{", "@code", "JavaRDD<List<Writable", ">>", "}", "to", "a", "Hadoop", "{", "@link", "org", ".", "apache", ".", "hadoop", ".", "io", ".", "SequenceFile", "}", ".", "Each", "record", "is", "given", "a", "unique", "(", "but", "noncontiguous", ...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/storage/SparkStorageUtils.java#L92-L103
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobTargetGroupsInner.java
JobTargetGroupsInner.createOrUpdate
public JobTargetGroupInner createOrUpdate(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, List<JobTarget> members) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName, members).toBlocking().single().body(); }
java
public JobTargetGroupInner createOrUpdate(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, List<JobTarget> members) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName, members).toBlocking().single().body(); }
[ "public", "JobTargetGroupInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "jobAgentName", ",", "String", "targetGroupName", ",", "List", "<", "JobTarget", ">", "members", ")", "{", "return", "createOrUpdateWithS...
Creates or updates a target group. @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 jobAgentName The name of the job agent. @param targetGroupName The name of the target group. @param members Members of the target group. @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 JobTargetGroupInner object if successful.
[ "Creates", "or", "updates", "a", "target", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobTargetGroupsInner.java#L331-L333
alkacon/opencms-core
src-gwt/org/opencms/ade/publish/client/CmsPublishSelectPanel.java
CmsPublishSelectPanel.setShowResources
public void setShowResources(boolean showResources, String tooManyResourcesMessage) { m_showResources = showResources; m_checkboxRelated.setEnabled(showResources); m_checkboxRelated.setChecked(showResources && m_publishDialog.getPublishOptions().isIncludeRelated()); m_checkboxSiblings.setEnabled(showResources); m_checkboxSiblings.setChecked(showResources && m_publishDialog.getPublishOptions().isIncludeSiblings()); m_groupPanelContainer.setVisible(showResources); m_tooManyResources.setVisible(!showResources); m_tooManyResources.setText(tooManyResourcesMessage); m_selectAll.setVisible(showResources); enableActions(true); if (!showResources) { m_checkboxProblems.setVisible(false); m_noResources.setVisible(false); m_scrollPanel.setVisible(false); } else { addMoreListItems(); showProblemCount(m_model.countProblems()); onChangePublishSelection(); } }
java
public void setShowResources(boolean showResources, String tooManyResourcesMessage) { m_showResources = showResources; m_checkboxRelated.setEnabled(showResources); m_checkboxRelated.setChecked(showResources && m_publishDialog.getPublishOptions().isIncludeRelated()); m_checkboxSiblings.setEnabled(showResources); m_checkboxSiblings.setChecked(showResources && m_publishDialog.getPublishOptions().isIncludeSiblings()); m_groupPanelContainer.setVisible(showResources); m_tooManyResources.setVisible(!showResources); m_tooManyResources.setText(tooManyResourcesMessage); m_selectAll.setVisible(showResources); enableActions(true); if (!showResources) { m_checkboxProblems.setVisible(false); m_noResources.setVisible(false); m_scrollPanel.setVisible(false); } else { addMoreListItems(); showProblemCount(m_model.countProblems()); onChangePublishSelection(); } }
[ "public", "void", "setShowResources", "(", "boolean", "showResources", ",", "String", "tooManyResourcesMessage", ")", "{", "m_showResources", "=", "showResources", ";", "m_checkboxRelated", ".", "setEnabled", "(", "showResources", ")", ";", "m_checkboxRelated", ".", "...
Sets the mode to either show resources, or only show a "too many resources" message.<p> In the latter case, the check boxes for the siblings/related resources will be deactivated.<p> @param showResources true if the resource list should be shown, false if only the given message should be shown @param tooManyResourcesMessage the message to show if there are too many resources to display
[ "Sets", "the", "mode", "to", "either", "show", "resources", "or", "only", "show", "a", "too", "many", "resources", "message", ".", "<p", ">", "In", "the", "latter", "case", "the", "check", "boxes", "for", "the", "siblings", "/", "related", "resources", "...
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/publish/client/CmsPublishSelectPanel.java#L674-L695
maxirosson/jdroid-android
jdroid-android-core/src/main/java/com/jdroid/android/usecase/AbstractUseCase.java
AbstractUseCase.notifyFailedUseCase
@RestrictTo(LIBRARY) public void notifyFailedUseCase(AbstractException exception, UseCaseListener listener) { try { LOGGER.debug("Notifying " + getClass().getSimpleName() + " finish failed to listener " + listener.getClass().getSimpleName()); listener.onFinishFailedUseCase(exception); } catch (Exception e) { AbstractException abstractException = wrapException(e); logHandledException(abstractException); } }
java
@RestrictTo(LIBRARY) public void notifyFailedUseCase(AbstractException exception, UseCaseListener listener) { try { LOGGER.debug("Notifying " + getClass().getSimpleName() + " finish failed to listener " + listener.getClass().getSimpleName()); listener.onFinishFailedUseCase(exception); } catch (Exception e) { AbstractException abstractException = wrapException(e); logHandledException(abstractException); } }
[ "@", "RestrictTo", "(", "LIBRARY", ")", "public", "void", "notifyFailedUseCase", "(", "AbstractException", "exception", ",", "UseCaseListener", "listener", ")", "{", "try", "{", "LOGGER", ".", "debug", "(", "\"Notifying \"", "+", "getClass", "(", ")", ".", "ge...
Notifies the listener that the use case has failed to execute. <br/> You can override this method for a custom notification when your listeners may be listening to multiple use cases at a time. @param listener The listener to notify.
[ "Notifies", "the", "listener", "that", "the", "use", "case", "has", "failed", "to", "execute", ".", "<br", "/", ">", "You", "can", "override", "this", "method", "for", "a", "custom", "notification", "when", "your", "listeners", "may", "be", "listening", "t...
train
https://github.com/maxirosson/jdroid-android/blob/1ba9cae56a16fa36bdb2c9c04379853f0300707f/jdroid-android-core/src/main/java/com/jdroid/android/usecase/AbstractUseCase.java#L226-L235
duracloud/duracloud
glacierstorageprovider/src/main/java/org/duracloud/glacierstorage/GlacierStorageProvider.java
GlacierStorageProvider.checkStorageState
private void checkStorageState(StorageException e) { if (e.getCause() instanceof AmazonS3Exception) { String errorCode = ((AmazonS3Exception) e.getCause()).getErrorCode(); if (INVALID_OBJECT_STATE.equals(errorCode)) { String message = "The storage state of this content item " + "does not allow for this action to be taken. To resolve " + "this issue: 1. Request that this content item be " + "retrieved from offline storage 2. Wait (retrieval may " + "take up to 5 hours) 3. Retry this request"; throw new StorageStateException(message, e); } } }
java
private void checkStorageState(StorageException e) { if (e.getCause() instanceof AmazonS3Exception) { String errorCode = ((AmazonS3Exception) e.getCause()).getErrorCode(); if (INVALID_OBJECT_STATE.equals(errorCode)) { String message = "The storage state of this content item " + "does not allow for this action to be taken. To resolve " + "this issue: 1. Request that this content item be " + "retrieved from offline storage 2. Wait (retrieval may " + "take up to 5 hours) 3. Retry this request"; throw new StorageStateException(message, e); } } }
[ "private", "void", "checkStorageState", "(", "StorageException", "e", ")", "{", "if", "(", "e", ".", "getCause", "(", ")", "instanceof", "AmazonS3Exception", ")", "{", "String", "errorCode", "=", "(", "(", "AmazonS3Exception", ")", "e", ".", "getCause", "(",...
Recognize and handle exceptions due to content which resides in Glacier but has not been retrieved for access.
[ "Recognize", "and", "handle", "exceptions", "due", "to", "content", "which", "resides", "in", "Glacier", "but", "has", "not", "been", "retrieved", "for", "access", "." ]
train
https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/glacierstorageprovider/src/main/java/org/duracloud/glacierstorage/GlacierStorageProvider.java#L116-L129
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/registry/GlobalTransformerRegistry.java
GlobalTransformerRegistry.registerTransformer
public void registerTransformer(final PathAddress address, int major, int minor, String operationName, OperationTransformer transformer) { registerTransformer(address.iterator(), ModelVersion.create(major, minor), operationName, new OperationTransformerRegistry.OperationTransformerEntry(transformer, false)); }
java
public void registerTransformer(final PathAddress address, int major, int minor, String operationName, OperationTransformer transformer) { registerTransformer(address.iterator(), ModelVersion.create(major, minor), operationName, new OperationTransformerRegistry.OperationTransformerEntry(transformer, false)); }
[ "public", "void", "registerTransformer", "(", "final", "PathAddress", "address", ",", "int", "major", ",", "int", "minor", ",", "String", "operationName", ",", "OperationTransformer", "transformer", ")", "{", "registerTransformer", "(", "address", ".", "iterator", ...
Register an operation transformer. @param address the operation handler address @param major the major version @param minor the minor version @param operationName the operation name @param transformer the operation transformer
[ "Register", "an", "operation", "transformer", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/registry/GlobalTransformerRegistry.java#L88-L90
phax/ph-schedule
ph-mini-quartz/src/main/java/com/helger/quartz/impl/triggers/DailyTimeIntervalTrigger.java
DailyTimeIntervalTrigger.setRepeatIntervalUnit
public void setRepeatIntervalUnit (final EIntervalUnit intervalUnit) { if (m_eRepeatIntervalUnit == null || !((m_eRepeatIntervalUnit.equals (EIntervalUnit.SECOND) || m_eRepeatIntervalUnit.equals (EIntervalUnit.MINUTE) || m_eRepeatIntervalUnit.equals (EIntervalUnit.HOUR)))) throw new IllegalArgumentException ("Invalid repeat IntervalUnit (must be SECOND, MINUTE or HOUR)."); m_eRepeatIntervalUnit = intervalUnit; }
java
public void setRepeatIntervalUnit (final EIntervalUnit intervalUnit) { if (m_eRepeatIntervalUnit == null || !((m_eRepeatIntervalUnit.equals (EIntervalUnit.SECOND) || m_eRepeatIntervalUnit.equals (EIntervalUnit.MINUTE) || m_eRepeatIntervalUnit.equals (EIntervalUnit.HOUR)))) throw new IllegalArgumentException ("Invalid repeat IntervalUnit (must be SECOND, MINUTE or HOUR)."); m_eRepeatIntervalUnit = intervalUnit; }
[ "public", "void", "setRepeatIntervalUnit", "(", "final", "EIntervalUnit", "intervalUnit", ")", "{", "if", "(", "m_eRepeatIntervalUnit", "==", "null", "||", "!", "(", "(", "m_eRepeatIntervalUnit", ".", "equals", "(", "EIntervalUnit", ".", "SECOND", ")", "||", "m_...
<p> Set the interval unit - the time unit on with the interval applies. </p> @param intervalUnit The repeat interval unit. The only intervals that are valid for this type of trigger are {@link EIntervalUnit#SECOND}, {@link EIntervalUnit#MINUTE}, and {@link EIntervalUnit#HOUR}.
[ "<p", ">", "Set", "the", "interval", "unit", "-", "the", "time", "unit", "on", "with", "the", "interval", "applies", ".", "<", "/", "p", ">" ]
train
https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/impl/triggers/DailyTimeIntervalTrigger.java#L413-L421
selenide/selenide
src/main/java/com/codeborne/selenide/proxy/SelenideProxyServer.java
SelenideProxyServer.addRequestFilter
public void addRequestFilter(String name, RequestFilter requestFilter) { if (isRequestFilterAdded(name)) { throw new IllegalArgumentException("Duplicate request filter: " + name); } proxy.addRequestFilter(requestFilter); requestFilters.put(name, requestFilter); }
java
public void addRequestFilter(String name, RequestFilter requestFilter) { if (isRequestFilterAdded(name)) { throw new IllegalArgumentException("Duplicate request filter: " + name); } proxy.addRequestFilter(requestFilter); requestFilters.put(name, requestFilter); }
[ "public", "void", "addRequestFilter", "(", "String", "name", ",", "RequestFilter", "requestFilter", ")", "{", "if", "(", "isRequestFilterAdded", "(", "name", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Duplicate request filter: \"", "+", "name...
Add a custom request filter which allows to track/modify all requests from browser to server @param name unique name of filter @param requestFilter the filter
[ "Add", "a", "custom", "request", "filter", "which", "allows", "to", "track", "/", "modify", "all", "requests", "from", "browser", "to", "server" ]
train
https://github.com/selenide/selenide/blob/b867baf171942cf07725d83a985237428569883f/src/main/java/com/codeborne/selenide/proxy/SelenideProxyServer.java#L78-L84
EvidentSolutions/dalesbred
dalesbred/src/main/java/org/dalesbred/Database.java
Database.findAll
public @NotNull <T> List<T> findAll(@NotNull Class<T> cl, @NotNull @SQL String sql, Object... args) { return findAll(cl, SqlQuery.query(sql, args)); }
java
public @NotNull <T> List<T> findAll(@NotNull Class<T> cl, @NotNull @SQL String sql, Object... args) { return findAll(cl, SqlQuery.query(sql, args)); }
[ "public", "@", "NotNull", "<", "T", ">", "List", "<", "T", ">", "findAll", "(", "@", "NotNull", "Class", "<", "T", ">", "cl", ",", "@", "NotNull", "@", "SQL", "String", "sql", ",", "Object", "...", "args", ")", "{", "return", "findAll", "(", "cl"...
Executes a query and converts the results to instances of given class using default mechanisms.
[ "Executes", "a", "query", "and", "converts", "the", "results", "to", "instances", "of", "given", "class", "using", "default", "mechanisms", "." ]
train
https://github.com/EvidentSolutions/dalesbred/blob/713f5b6e152d97e1672ca68b9ff9c7c6c288ceb1/dalesbred/src/main/java/org/dalesbred/Database.java#L322-L324
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/ControlBar.java
ControlBar.addControl
public Widget addControl(String name, int resId, Widget.OnTouchListener listener, int position) { Widget control = findChildByName(name); if (control == null) { control = createControlWidget(resId, name, null); } setupControl(name, control, listener, position); return control; }
java
public Widget addControl(String name, int resId, Widget.OnTouchListener listener, int position) { Widget control = findChildByName(name); if (control == null) { control = createControlWidget(resId, name, null); } setupControl(name, control, listener, position); return control; }
[ "public", "Widget", "addControl", "(", "String", "name", ",", "int", "resId", ",", "Widget", ".", "OnTouchListener", "listener", ",", "int", "position", ")", "{", "Widget", "control", "=", "findChildByName", "(", "name", ")", ";", "if", "(", "control", "==...
Add new control at the control bar with specified touch listener, resource and position. Size of control bar is updated based on new number of controls. @param name name of the control to remove @param resId the control face @param listener touch listener @param position control position in the bar
[ "Add", "new", "control", "at", "the", "control", "bar", "with", "specified", "touch", "listener", "resource", "and", "position", ".", "Size", "of", "control", "bar", "is", "updated", "based", "on", "new", "number", "of", "controls", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/ControlBar.java#L194-L201
BlueBrain/bluima
modules/bluima_typesystem/src/main/java/de/julielab/jules/types/RelationMention.java
RelationMention.setArguments
public void setArguments(int i, ArgumentMention v) { if (RelationMention_Type.featOkTst && ((RelationMention_Type)jcasType).casFeat_arguments == null) jcasType.jcas.throwFeatMissing("arguments", "de.julielab.jules.types.RelationMention"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((RelationMention_Type)jcasType).casFeatCode_arguments), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((RelationMention_Type)jcasType).casFeatCode_arguments), i, jcasType.ll_cas.ll_getFSRef(v));}
java
public void setArguments(int i, ArgumentMention v) { if (RelationMention_Type.featOkTst && ((RelationMention_Type)jcasType).casFeat_arguments == null) jcasType.jcas.throwFeatMissing("arguments", "de.julielab.jules.types.RelationMention"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((RelationMention_Type)jcasType).casFeatCode_arguments), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((RelationMention_Type)jcasType).casFeatCode_arguments), i, jcasType.ll_cas.ll_getFSRef(v));}
[ "public", "void", "setArguments", "(", "int", "i", ",", "ArgumentMention", "v", ")", "{", "if", "(", "RelationMention_Type", ".", "featOkTst", "&&", "(", "(", "RelationMention_Type", ")", "jcasType", ")", ".", "casFeat_arguments", "==", "null", ")", "jcasType"...
indexed setter for arguments - sets an indexed value - @generated @param i index in the array to set @param v value to set into the array
[ "indexed", "setter", "for", "arguments", "-", "sets", "an", "indexed", "value", "-" ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/de/julielab/jules/types/RelationMention.java#L160-L164
micronaut-projects/micronaut-core
runtime/src/main/java/io/micronaut/discovery/cloud/aws/AmazonComputeInstanceMetadataResolver.java
AmazonComputeInstanceMetadataResolver.readEc2MetadataUrl
private String readEc2MetadataUrl(URL url, int connectionTimeoutMs, int readTimeoutMs) throws IOException { if (url.getProtocol().equalsIgnoreCase("file")) { url = rewriteUrl(url); URLConnection urlConnection = url.openConnection(); urlConnection.connect(); try (BufferedReader in = new BufferedReader( new InputStreamReader(urlConnection.getInputStream()))) { return IOUtils.readText(in); } } else { URLConnection urlConnection = url.openConnection(); HttpURLConnection uc = (HttpURLConnection) urlConnection; uc.setConnectTimeout(connectionTimeoutMs); uc.setReadTimeout(readTimeoutMs); uc.setRequestMethod("GET"); uc.setDoOutput(true); int responseCode = uc.getResponseCode(); try (BufferedReader in = new BufferedReader( new InputStreamReader(uc.getInputStream()))) { return IOUtils.readText(in); } } }
java
private String readEc2MetadataUrl(URL url, int connectionTimeoutMs, int readTimeoutMs) throws IOException { if (url.getProtocol().equalsIgnoreCase("file")) { url = rewriteUrl(url); URLConnection urlConnection = url.openConnection(); urlConnection.connect(); try (BufferedReader in = new BufferedReader( new InputStreamReader(urlConnection.getInputStream()))) { return IOUtils.readText(in); } } else { URLConnection urlConnection = url.openConnection(); HttpURLConnection uc = (HttpURLConnection) urlConnection; uc.setConnectTimeout(connectionTimeoutMs); uc.setReadTimeout(readTimeoutMs); uc.setRequestMethod("GET"); uc.setDoOutput(true); int responseCode = uc.getResponseCode(); try (BufferedReader in = new BufferedReader( new InputStreamReader(uc.getInputStream()))) { return IOUtils.readText(in); } } }
[ "private", "String", "readEc2MetadataUrl", "(", "URL", "url", ",", "int", "connectionTimeoutMs", ",", "int", "readTimeoutMs", ")", "throws", "IOException", "{", "if", "(", "url", ".", "getProtocol", "(", ")", ".", "equalsIgnoreCase", "(", "\"file\"", ")", ")",...
Read EC2 metadata from the given URL. @param url URL to fetch AWS EC2 metadata information @param connectionTimeoutMs connection timeout in millis @param readTimeoutMs read timeout in millis @return AWS EC2 metadata information @throws IOException Signals that an I/O exception of some sort has occurred
[ "Read", "EC2", "metadata", "from", "the", "given", "URL", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/runtime/src/main/java/io/micronaut/discovery/cloud/aws/AmazonComputeInstanceMetadataResolver.java#L176-L200
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java
PhotosInterface.setSafetyLevel
public void setSafetyLevel(String photoId, String safetyLevel, Boolean hidden) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_SET_SAFETYLEVEL); parameters.put("photo_id", photoId); if (safetyLevel != null) { parameters.put("safety_level", safetyLevel); } if (hidden != null) { parameters.put("hidden", hidden.booleanValue() ? "1" : "0"); } Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
java
public void setSafetyLevel(String photoId, String safetyLevel, Boolean hidden) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_SET_SAFETYLEVEL); parameters.put("photo_id", photoId); if (safetyLevel != null) { parameters.put("safety_level", safetyLevel); } if (hidden != null) { parameters.put("hidden", hidden.booleanValue() ? "1" : "0"); } Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
[ "public", "void", "setSafetyLevel", "(", "String", "photoId", ",", "String", "safetyLevel", ",", "Boolean", "hidden", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "O...
Set the safety level (adultness) of a photo. <p> This method requires authentication with 'write' permission. @param photoId The photo ID @param safetyLevel The safety level of the photo or null @param hidden Hidden from public searches or not or null @see com.flickr4java.flickr.Flickr#SAFETYLEVEL_SAFE @see com.flickr4java.flickr.Flickr#SAFETYLEVEL_MODERATE @see com.flickr4java.flickr.Flickr#SAFETYLEVEL_RESTRICTED @throws FlickrException
[ "Set", "the", "safety", "level", "(", "adultness", ")", "of", "a", "photo", ".", "<p", ">" ]
train
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L1260-L1278
kaazing/gateway
util/src/main/java/org/kaazing/gateway/util/asn1/Asn1Utils.java
Asn1Utils.decodeGeneralizedTime
public static Date decodeGeneralizedTime(ByteBuffer buf) { // GeneralizedTime ::= [UNIVERSAL 24] IMPLICIT VisibleString DerId id = DerId.decode(buf); if (!id.matches(DerId.TagClass.UNIVERSAL, DerId.EncodingType.PRIMITIVE, ASN1_GENERALIZED_TIME_TAG_NUM)) { throw new IllegalArgumentException("Expected GeneralizedTime identifier, received " + id); } int len = DerUtils.decodeLength(buf); if (buf.remaining() < len) { throw new IllegalArgumentException("Insufficient content for GeneralizedTime"); } Date date; byte[] dst = new byte[len]; buf.get(dst); String iso8601DateString = new String(dst); Matcher matcher = GENERALIZED_TIME_PATTERN.matcher(iso8601DateString); if (matcher.matches()) { Calendar cal = Calendar.getInstance(); cal.clear(); // Process yyyyMMddHHmmss cal.set(Calendar.YEAR, Integer.parseInt(matcher.group(1))); cal.set(Calendar.MONTH, Integer.parseInt(matcher.group(2)) - 1); // Calendar.MONTH is zero based cal.set(Calendar.DAY_OF_MONTH, Integer.parseInt(matcher.group(3))); cal.set(Calendar.HOUR_OF_DAY, Integer.parseInt(matcher.group(4))); cal.set(Calendar.MINUTE, Integer.parseInt(matcher.group(5))); cal.set(Calendar.SECOND, Integer.parseInt(matcher.group(6))); // Process fractional seconds, if any String fracSecStr = matcher.group(7); if (fracSecStr != null) { cal.set(Calendar.MILLISECOND, (int) (Float.parseFloat(fracSecStr) * 1000)); } // Process time zone, if any String tzStr = matcher.group(8); if (tzStr != null) { cal.setTimeZone(TimeZone.getTimeZone("Z".equals(tzStr) ? "GMT" : "GMT" + tzStr)); } date = cal.getTime(); } else { throw new IllegalArgumentException("Malformed GeneralizedTime " + iso8601DateString); } return date; }
java
public static Date decodeGeneralizedTime(ByteBuffer buf) { // GeneralizedTime ::= [UNIVERSAL 24] IMPLICIT VisibleString DerId id = DerId.decode(buf); if (!id.matches(DerId.TagClass.UNIVERSAL, DerId.EncodingType.PRIMITIVE, ASN1_GENERALIZED_TIME_TAG_NUM)) { throw new IllegalArgumentException("Expected GeneralizedTime identifier, received " + id); } int len = DerUtils.decodeLength(buf); if (buf.remaining() < len) { throw new IllegalArgumentException("Insufficient content for GeneralizedTime"); } Date date; byte[] dst = new byte[len]; buf.get(dst); String iso8601DateString = new String(dst); Matcher matcher = GENERALIZED_TIME_PATTERN.matcher(iso8601DateString); if (matcher.matches()) { Calendar cal = Calendar.getInstance(); cal.clear(); // Process yyyyMMddHHmmss cal.set(Calendar.YEAR, Integer.parseInt(matcher.group(1))); cal.set(Calendar.MONTH, Integer.parseInt(matcher.group(2)) - 1); // Calendar.MONTH is zero based cal.set(Calendar.DAY_OF_MONTH, Integer.parseInt(matcher.group(3))); cal.set(Calendar.HOUR_OF_DAY, Integer.parseInt(matcher.group(4))); cal.set(Calendar.MINUTE, Integer.parseInt(matcher.group(5))); cal.set(Calendar.SECOND, Integer.parseInt(matcher.group(6))); // Process fractional seconds, if any String fracSecStr = matcher.group(7); if (fracSecStr != null) { cal.set(Calendar.MILLISECOND, (int) (Float.parseFloat(fracSecStr) * 1000)); } // Process time zone, if any String tzStr = matcher.group(8); if (tzStr != null) { cal.setTimeZone(TimeZone.getTimeZone("Z".equals(tzStr) ? "GMT" : "GMT" + tzStr)); } date = cal.getTime(); } else { throw new IllegalArgumentException("Malformed GeneralizedTime " + iso8601DateString); } return date; }
[ "public", "static", "Date", "decodeGeneralizedTime", "(", "ByteBuffer", "buf", ")", "{", "// GeneralizedTime ::= [UNIVERSAL 24] IMPLICIT VisibleString", "DerId", "id", "=", "DerId", ".", "decode", "(", "buf", ")", ";", "if", "(", "!", "id", ".", "matches", "(", ...
Decode an ASN.1 GeneralizedTime. @param buf the DER-encoded GeneralizedTime @return the data and time
[ "Decode", "an", "ASN", ".", "1", "GeneralizedTime", "." ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/util/src/main/java/org/kaazing/gateway/util/asn1/Asn1Utils.java#L96-L142
apache/incubator-gobblin
gobblin-config-management/gobblin-config-client/src/main/java/org/apache/gobblin/config/client/ConfigClient.java
ConfigClient.getImports
public Collection<URI> getImports(URI configKeyUri, boolean recursive) throws ConfigStoreFactoryDoesNotExistsException, ConfigStoreCreationException, VersionDoesNotExistException { return getImports(configKeyUri, recursive, Optional.<Config>absent()); }
java
public Collection<URI> getImports(URI configKeyUri, boolean recursive) throws ConfigStoreFactoryDoesNotExistsException, ConfigStoreCreationException, VersionDoesNotExistException { return getImports(configKeyUri, recursive, Optional.<Config>absent()); }
[ "public", "Collection", "<", "URI", ">", "getImports", "(", "URI", "configKeyUri", ",", "boolean", "recursive", ")", "throws", "ConfigStoreFactoryDoesNotExistsException", ",", "ConfigStoreCreationException", ",", "VersionDoesNotExistException", "{", "return", "getImports", ...
Get the import links of the input URI. @param configKeyUri - The URI for the configuration key. @param recursive - Specify whether to get direct import links or recursively import links @return the import links of the input URI. @throws ConfigStoreFactoryDoesNotExistsException: if missing scheme name or the scheme name is invalid @throws ConfigStoreCreationException: Specified {@link ConfigStoreFactory} can not create required {@link ConfigStore} @throws VersionDoesNotExistException: Required version does not exist anymore ( may get deleted by retention job )
[ "Get", "the", "import", "links", "of", "the", "input", "URI", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-config-management/gobblin-config-client/src/main/java/org/apache/gobblin/config/client/ConfigClient.java#L222-L225
acromusashi/acromusashi-stream
src/main/java/acromusashi/stream/config/PropertyConfigLoader.java
PropertyConfigLoader.loadProperty
private static void loadProperty(String filePath) { try (InputStream propertyStream = Thread.currentThread().getContextClassLoader().getResourceAsStream( filePath); Reader propertyReader = new InputStreamReader(propertyStream, DEFAULT_CHARSET);) { Properties properties = new Properties(); properties.load(propertyReader); propertiesMap.put(filePath, properties); } catch (Exception ex) { String errorPattern = "Property file load failed. Skip load. : PropertyFile={0}"; logger.warn(MessageFormat.format(errorPattern, filePath), ex); } }
java
private static void loadProperty(String filePath) { try (InputStream propertyStream = Thread.currentThread().getContextClassLoader().getResourceAsStream( filePath); Reader propertyReader = new InputStreamReader(propertyStream, DEFAULT_CHARSET);) { Properties properties = new Properties(); properties.load(propertyReader); propertiesMap.put(filePath, properties); } catch (Exception ex) { String errorPattern = "Property file load failed. Skip load. : PropertyFile={0}"; logger.warn(MessageFormat.format(errorPattern, filePath), ex); } }
[ "private", "static", "void", "loadProperty", "(", "String", "filePath", ")", "{", "try", "(", "InputStream", "propertyStream", "=", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(", ")", ".", "getResourceAsStream", "(", "filePath", ")"...
Load property file. @param filePath property file path in classpath
[ "Load", "property", "file", "." ]
train
https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/config/PropertyConfigLoader.java#L77-L92
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/Compound.java
Compound.field2in
public void field2in(Object o, String field, Object to) { field = field.trim(); if (field.indexOf(' ') > 0) { // maybe multiple field names given String[] fields = field.split("\\s+"); for (String f : fields) { field2in(o, f, to, f); } } else { field2in(o, field, to, field); } }
java
public void field2in(Object o, String field, Object to) { field = field.trim(); if (field.indexOf(' ') > 0) { // maybe multiple field names given String[] fields = field.split("\\s+"); for (String f : fields) { field2in(o, f, to, f); } } else { field2in(o, field, to, field); } }
[ "public", "void", "field2in", "(", "Object", "o", ",", "String", "field", ",", "Object", "to", ")", "{", "field", "=", "field", ".", "trim", "(", ")", ";", "if", "(", "field", ".", "indexOf", "(", "'", "'", ")", ">", "0", ")", "{", "// maybe mult...
Maps an object's field to a component's In field with the same name @param o the object @param field the field name @param to the component.
[ "Maps", "an", "object", "s", "field", "to", "a", "component", "s", "In", "field", "with", "the", "same", "name" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/Compound.java#L199-L209
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/impl/DefaultFacelet.java
DefaultFacelet.include
private void include(AbstractFaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException, ELException { ctx.pushPageContext(new PageContextImpl()); try { this.refresh(parent); DefaultFaceletContext ctxWrapper = new DefaultFaceletContext((DefaultFaceletContext)ctx, this, false); ctx.getFacesContext().getAttributes().put(FaceletContext.FACELET_CONTEXT_KEY, ctxWrapper); _root.apply(ctxWrapper, parent); ctx.getFacesContext().getAttributes().put(FaceletContext.FACELET_CONTEXT_KEY, ctx); this.markApplied(parent); } finally { ctx.popPageContext(); } }
java
private void include(AbstractFaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException, ELException { ctx.pushPageContext(new PageContextImpl()); try { this.refresh(parent); DefaultFaceletContext ctxWrapper = new DefaultFaceletContext((DefaultFaceletContext)ctx, this, false); ctx.getFacesContext().getAttributes().put(FaceletContext.FACELET_CONTEXT_KEY, ctxWrapper); _root.apply(ctxWrapper, parent); ctx.getFacesContext().getAttributes().put(FaceletContext.FACELET_CONTEXT_KEY, ctx); this.markApplied(parent); } finally { ctx.popPageContext(); } }
[ "private", "void", "include", "(", "AbstractFaceletContext", "ctx", ",", "UIComponent", "parent", ")", "throws", "IOException", ",", "FacesException", ",", "FaceletException", ",", "ELException", "{", "ctx", ".", "pushPageContext", "(", "new", "PageContextImpl", "("...
Given the passed FaceletContext, apply our child FaceletHandlers to the passed parent @see FaceletHandler#apply(FaceletContext, UIComponent) @param ctx the FaceletContext to use for applying our FaceletHandlers @param parent the parent component to apply changes to @throws IOException @throws FacesException @throws FaceletException @throws ELException
[ "Given", "the", "passed", "FaceletContext", "apply", "our", "child", "FaceletHandlers", "to", "the", "passed", "parent" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/impl/DefaultFacelet.java#L517-L534
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java
ULocale.createTagString
static String createTagString(String lang, String script, String region, String trailing) { return createTagString(lang, script, region, trailing, null); }
java
static String createTagString(String lang, String script, String region, String trailing) { return createTagString(lang, script, region, trailing, null); }
[ "static", "String", "createTagString", "(", "String", "lang", ",", "String", "script", ",", "String", "region", ",", "String", "trailing", ")", "{", "return", "createTagString", "(", "lang", ",", "script", ",", "region", ",", "trailing", ",", "null", ")", ...
Create a tag string from the supplied parameters. The lang, script and region parameters may be null references.If the lang parameter is an empty string, the default value for an unknown language is written to the output buffer. @param lang The language tag to use. @param script The script tag to use. @param region The region tag to use. @param trailing Any trailing data to append to the new tag. @return The new String.
[ "Create", "a", "tag", "string", "from", "the", "supplied", "parameters", ".", "The", "lang", "script", "and", "region", "parameters", "may", "be", "null", "references", ".", "If", "the", "lang", "parameter", "is", "an", "empty", "string", "the", "default", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java#L2766-L2768
apache/reef
lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/AllocatedEvaluatorImpl.java
AllocatedEvaluatorImpl.submitTask
public void submitTask(final String evaluatorConfiguration, final String taskConfiguration) { final Configuration contextConfiguration = ContextConfiguration.CONF .set(ContextConfiguration.IDENTIFIER, "RootContext_" + this.getId()) .build(); final String contextConfigurationString = this.configurationSerializer.toString(contextConfiguration); this.launchWithConfigurationString( evaluatorConfiguration, contextConfigurationString, Optional.<String>empty(), Optional.of(taskConfiguration)); }
java
public void submitTask(final String evaluatorConfiguration, final String taskConfiguration) { final Configuration contextConfiguration = ContextConfiguration.CONF .set(ContextConfiguration.IDENTIFIER, "RootContext_" + this.getId()) .build(); final String contextConfigurationString = this.configurationSerializer.toString(contextConfiguration); this.launchWithConfigurationString( evaluatorConfiguration, contextConfigurationString, Optional.<String>empty(), Optional.of(taskConfiguration)); }
[ "public", "void", "submitTask", "(", "final", "String", "evaluatorConfiguration", ",", "final", "String", "taskConfiguration", ")", "{", "final", "Configuration", "contextConfiguration", "=", "ContextConfiguration", ".", "CONF", ".", "set", "(", "ContextConfiguration", ...
Submit Task with configuration strings. This method should be called from bridge and the configuration strings are serialized at .Net side. @param evaluatorConfiguration @param taskConfiguration
[ "Submit", "Task", "with", "configuration", "strings", ".", "This", "method", "should", "be", "called", "from", "bridge", "and", "the", "configuration", "strings", "are", "serialized", "at", ".", "Net", "side", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/AllocatedEvaluatorImpl.java#L109-L116
alkacon/opencms-core
src/org/opencms/flex/CmsFlexCacheEntry.java
CmsFlexCacheEntry.setRedirect
public void setRedirect(String target, boolean permanent) { if (m_completed || (target == null)) { return; } m_redirectTarget = target; m_redirectPermanent = permanent; m_byteSize = 512 + CmsMemoryMonitor.getMemorySize(target); // If we have a redirect we don't need any other output or headers m_elements = null; m_headers = null; }
java
public void setRedirect(String target, boolean permanent) { if (m_completed || (target == null)) { return; } m_redirectTarget = target; m_redirectPermanent = permanent; m_byteSize = 512 + CmsMemoryMonitor.getMemorySize(target); // If we have a redirect we don't need any other output or headers m_elements = null; m_headers = null; }
[ "public", "void", "setRedirect", "(", "String", "target", ",", "boolean", "permanent", ")", "{", "if", "(", "m_completed", "||", "(", "target", "==", "null", ")", ")", "{", "return", ";", "}", "m_redirectTarget", "=", "target", ";", "m_redirectPermanent", ...
Set a redirect target for this cache entry.<p> <b>Important:</b> When a redirect target is set, all saved data is thrown away, and new data will not be saved in the cache entry. This is so since with a redirect nothing will be displayed in the browser anyway, so there is no point in saving the data.<p> @param target The redirect target (must be a valid URL). @param permanent true if this is a permanent redirect
[ "Set", "a", "redirect", "target", "for", "this", "cache", "entry", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/flex/CmsFlexCacheEntry.java#L532-L543
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/util/HashUtil.java
HashUtil.MurmurHash3_x86_32_direct
public static int MurmurHash3_x86_32_direct(MemoryAccessor mem, long base, int offset, int len) { return MurmurHash3_x86_32(mem.isBigEndian() ? NARROW_DIRECT_LOADER : WIDE_DIRECT_LOADER, mem, base + offset, len, DEFAULT_MURMUR_SEED); }
java
public static int MurmurHash3_x86_32_direct(MemoryAccessor mem, long base, int offset, int len) { return MurmurHash3_x86_32(mem.isBigEndian() ? NARROW_DIRECT_LOADER : WIDE_DIRECT_LOADER, mem, base + offset, len, DEFAULT_MURMUR_SEED); }
[ "public", "static", "int", "MurmurHash3_x86_32_direct", "(", "MemoryAccessor", "mem", ",", "long", "base", ",", "int", "offset", ",", "int", "len", ")", "{", "return", "MurmurHash3_x86_32", "(", "mem", ".", "isBigEndian", "(", ")", "?", "NARROW_DIRECT_LOADER", ...
Returns the {@code MurmurHash3_x86_32} hash of a memory block accessed by the provided {@link MemoryAccessor}. The {@code MemoryAccessor} will be used to access {@code int}-sized data at addresses {@code (base + offset)}, {@code (base + offset + 4)}, etc. The caller must ensure that the {@code MemoryAccessor} supports it, especially when {@code (base + offset)} is not guaranteed to be 4 byte-aligned.
[ "Returns", "the", "{" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/HashUtil.java#L82-L85
Axway/Grapes
server/src/main/java/org/axway/grapes/server/webapp/resources/LicenseResource.java
LicenseResource.getNames
@GET @Produces({MediaType.TEXT_HTML, MediaType.APPLICATION_JSON}) @Path(ServerAPI.GET_NAMES) public Response getNames(@Context final UriInfo uriInfo){ LOG.info("Got a get license names request."); final ListView view = new ListView("License names view", "license"); final FiltersHolder filters = new FiltersHolder(); filters.init(uriInfo.getQueryParameters()); final List<String> names = getLicenseHandler().getLicensesNames(filters); view.addAll(names); return Response.ok(view).build(); }
java
@GET @Produces({MediaType.TEXT_HTML, MediaType.APPLICATION_JSON}) @Path(ServerAPI.GET_NAMES) public Response getNames(@Context final UriInfo uriInfo){ LOG.info("Got a get license names request."); final ListView view = new ListView("License names view", "license"); final FiltersHolder filters = new FiltersHolder(); filters.init(uriInfo.getQueryParameters()); final List<String> names = getLicenseHandler().getLicensesNames(filters); view.addAll(names); return Response.ok(view).build(); }
[ "@", "GET", "@", "Produces", "(", "{", "MediaType", ".", "TEXT_HTML", ",", "MediaType", ".", "APPLICATION_JSON", "}", ")", "@", "Path", "(", "ServerAPI", ".", "GET_NAMES", ")", "public", "Response", "getNames", "(", "@", "Context", "final", "UriInfo", "uri...
Return the list of available license name. This method is call via GET <dm_url>/license/names @param uriInfo UriInfo @return Response A list of license name in HTML or JSON
[ "Return", "the", "list", "of", "available", "license", "name", ".", "This", "method", "is", "call", "via", "GET", "<dm_url", ">", "/", "license", "/", "names" ]
train
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/webapp/resources/LicenseResource.java#L88-L102
netplex/json-smart-v2
json-smart/src/main/java/net/minidev/json/JSONNavi.java
JSONNavi.set
public JSONNavi<T> set(String key, double value) { return set(key, Double.valueOf(value)); }
java
public JSONNavi<T> set(String key, double value) { return set(key, Double.valueOf(value)); }
[ "public", "JSONNavi", "<", "T", ">", "set", "(", "String", "key", ",", "double", "value", ")", "{", "return", "set", "(", "key", ",", "Double", ".", "valueOf", "(", "value", ")", ")", ";", "}" ]
write an value in the current object @param key key to access @param value new value @return this
[ "write", "an", "value", "in", "the", "current", "object" ]
train
https://github.com/netplex/json-smart-v2/blob/bfb3daef039e22a7bbff5f76bf14ea23330cd70e/json-smart/src/main/java/net/minidev/json/JSONNavi.java#L265-L267
looly/hutool
hutool-core/src/main/java/cn/hutool/core/text/StrBuilder.java
StrBuilder.getChars
public StrBuilder getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin) { if (srcBegin < 0) { srcBegin = 0; } if (srcEnd < 0) { srcEnd = 0; } else if (srcEnd > this.position) { srcEnd = this.position; } if (srcBegin > srcEnd) { throw new StringIndexOutOfBoundsException("srcBegin > srcEnd"); } System.arraycopy(value, srcBegin, dst, dstBegin, srcEnd - srcBegin); return this; }
java
public StrBuilder getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin) { if (srcBegin < 0) { srcBegin = 0; } if (srcEnd < 0) { srcEnd = 0; } else if (srcEnd > this.position) { srcEnd = this.position; } if (srcBegin > srcEnd) { throw new StringIndexOutOfBoundsException("srcBegin > srcEnd"); } System.arraycopy(value, srcBegin, dst, dstBegin, srcEnd - srcBegin); return this; }
[ "public", "StrBuilder", "getChars", "(", "int", "srcBegin", ",", "int", "srcEnd", ",", "char", "[", "]", "dst", ",", "int", "dstBegin", ")", "{", "if", "(", "srcBegin", "<", "0", ")", "{", "srcBegin", "=", "0", ";", "}", "if", "(", "srcEnd", "<", ...
将指定段的字符列表写出到目标字符数组中 @param srcBegin 起始位置(包括) @param srcEnd 结束位置(不包括) @param dst 目标数组 @param dstBegin 目标起始位置(包括) @return this
[ "将指定段的字符列表写出到目标字符数组中" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/StrBuilder.java#L301-L315
couchbase/couchbase-lite-java
src/main/java/com/couchbase/lite/MutableArray.java
MutableArray.insertString
@NonNull @Override public MutableArray insertString(int index, String value) { return insertValue(index, value); }
java
@NonNull @Override public MutableArray insertString(int index, String value) { return insertValue(index, value); }
[ "@", "NonNull", "@", "Override", "public", "MutableArray", "insertString", "(", "int", "index", ",", "String", "value", ")", "{", "return", "insertValue", "(", "index", ",", "value", ")", ";", "}" ]
Inserts a String object at the given index. @param index the index. This value must not exceed the bounds of the array. @param value the String object @return The self object
[ "Inserts", "a", "String", "object", "at", "the", "given", "index", "." ]
train
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/MutableArray.java#L423-L427
gallandarakhneorg/afc
core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d2/Transform2D.java
Transform2D.transform
public void transform(Tuple2D<?> tuple, Tuple2D<?> result) { assert tuple != null : AssertMessages.notNullParameter(0); assert result != null : AssertMessages.notNullParameter(1); result.set( this.m00 * tuple.getX() + this.m01 * tuple.getY() + this.m02, this.m10 * tuple.getX() + this.m11 * tuple.getY() + this.m12); }
java
public void transform(Tuple2D<?> tuple, Tuple2D<?> result) { assert tuple != null : AssertMessages.notNullParameter(0); assert result != null : AssertMessages.notNullParameter(1); result.set( this.m00 * tuple.getX() + this.m01 * tuple.getY() + this.m02, this.m10 * tuple.getX() + this.m11 * tuple.getY() + this.m12); }
[ "public", "void", "transform", "(", "Tuple2D", "<", "?", ">", "tuple", ",", "Tuple2D", "<", "?", ">", "result", ")", "{", "assert", "tuple", "!=", "null", ":", "AssertMessages", ".", "notNullParameter", "(", "0", ")", ";", "assert", "result", "!=", "nu...
Multiply this matrix by the tuple t and and place the result into the tuple "result". <p>This function is equivalent to: <pre> result = this * [ t.x ] [ t.y ] [ 1 ] </pre> @param tuple the tuple to be multiplied by this matrix @param result the tuple into which the product is placed
[ "Multiply", "this", "matrix", "by", "the", "tuple", "t", "and", "and", "place", "the", "result", "into", "the", "tuple", "result", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d2/Transform2D.java#L683-L689
mapsforge/mapsforge
mapsforge-map-android/src/main/java/org/mapsforge/map/android/util/AndroidUtil.java
AndroidUtil.createTileCache
public static TileCache createTileCache(Context c, String id, int tileSize, int width, int height, double overdraw) { return createTileCache(c, id, tileSize, width, height, overdraw, false); }
java
public static TileCache createTileCache(Context c, String id, int tileSize, int width, int height, double overdraw) { return createTileCache(c, id, tileSize, width, height, overdraw, false); }
[ "public", "static", "TileCache", "createTileCache", "(", "Context", "c", ",", "String", "id", ",", "int", "tileSize", ",", "int", "width", ",", "int", "height", ",", "double", "overdraw", ")", "{", "return", "createTileCache", "(", "c", ",", "id", ",", "...
Utility function to create a two-level tile cache with the right size, using the size of the map view. This is the compatibility version that by default creates a non-persistent cache. @param c the Android context @param id name for the storage directory @param tileSize tile size @param width the width of the map view @param height the height of the map view @param overdraw overdraw allowance @return a new cache created on the external storage
[ "Utility", "function", "to", "create", "a", "two", "-", "level", "tile", "cache", "with", "the", "right", "size", "using", "the", "size", "of", "the", "map", "view", ".", "This", "is", "the", "compatibility", "version", "that", "by", "default", "creates", ...
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-android/src/main/java/org/mapsforge/map/android/util/AndroidUtil.java#L222-L224
JOML-CI/JOML
src/org/joml/Matrix3f.java
Matrix3f.rotationTowards
public Matrix3f rotationTowards(Vector3fc dir, Vector3fc up) { return rotationTowards(dir.x(), dir.y(), dir.z(), up.x(), up.y(), up.z()); }
java
public Matrix3f rotationTowards(Vector3fc dir, Vector3fc up) { return rotationTowards(dir.x(), dir.y(), dir.z(), up.x(), up.y(), up.z()); }
[ "public", "Matrix3f", "rotationTowards", "(", "Vector3fc", "dir", ",", "Vector3fc", "up", ")", "{", "return", "rotationTowards", "(", "dir", ".", "x", "(", ")", ",", "dir", ".", "y", "(", ")", ",", "dir", ".", "z", "(", ")", ",", "up", ".", "x", ...
Set this matrix to a model transformation for a right-handed coordinate system, that aligns the local <code>-z</code> axis with <code>center - eye</code>. <p> In order to apply the rotation transformation to a previous existing transformation, use {@link #rotateTowards(float, float, float, float, float, float) rotateTowards}. <p> This method is equivalent to calling: <code>setLookAlong(new Vector3f(dir).negate(), up).invert()</code> @see #rotationTowards(Vector3fc, Vector3fc) @see #rotateTowards(float, float, float, float, float, float) @param dir the direction to orient the local -z axis towards @param up the up vector @return this
[ "Set", "this", "matrix", "to", "a", "model", "transformation", "for", "a", "right", "-", "handed", "coordinate", "system", "that", "aligns", "the", "local", "<code", ">", "-", "z<", "/", "code", ">", "axis", "with", "<code", ">", "center", "-", "eye<", ...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3f.java#L4025-L4027
kaichunlin/android-transition
core/src/main/java/com/kaichunlin/transition/MenuItemTransitionBuilder.java
MenuItemTransitionBuilder.invalidateOptionOnStopTransition
public MenuItemTransitionBuilder invalidateOptionOnStopTransition(@NonNull Activity activity, boolean invalidate) { mActivity = activity; mInvalidateOptionOnStopAnimation = invalidate; return self(); }
java
public MenuItemTransitionBuilder invalidateOptionOnStopTransition(@NonNull Activity activity, boolean invalidate) { mActivity = activity; mInvalidateOptionOnStopAnimation = invalidate; return self(); }
[ "public", "MenuItemTransitionBuilder", "invalidateOptionOnStopTransition", "(", "@", "NonNull", "Activity", "activity", ",", "boolean", "invalidate", ")", "{", "mActivity", "=", "activity", ";", "mInvalidateOptionOnStopAnimation", "=", "invalidate", ";", "return", "self",...
See {@link MenuItemTransition#setInvalidateOptionOnStopTransition(Activity, boolean)}}. @param activity Activity that should have its invalidateOptionsMenu() method called, or null if invalidate parameter is false @param invalidate @return
[ "See", "{", "@link", "MenuItemTransition#setInvalidateOptionOnStopTransition", "(", "Activity", "boolean", ")", "}}", "." ]
train
https://github.com/kaichunlin/android-transition/blob/7b53074206622f5cf5d82091d891a7ed8b9f06cd/core/src/main/java/com/kaichunlin/transition/MenuItemTransitionBuilder.java#L180-L184
mediathekview/MServer
src/main/java/mServer/crawler/sender/br/BrFilmDeserializer.java
BrFilmDeserializer.deserialize
@Override public Optional<DatenFilm> deserialize(final JsonElement aElement, final Type aType, final JsonDeserializationContext aContext) { try { final Optional<JsonObject> viewer = getViewer(aElement.getAsJsonObject()); if (viewer.isPresent()) { final Optional<JsonObject> detailClip = getDetailClip(viewer.get()); return buildFilm(detailClip, viewer.get()); } else { printMissingDetails(JSON_ELEMENT_VIEWER); } } catch (final UnsupportedOperationException unsupportedOperationException) { // This will happen when a element is JsonNull. LOG.error("BR: A needed JSON element is JsonNull.", unsupportedOperationException); FilmeSuchen.listeSenderLaufen.inc(crawler.getSendername(), RunSender.Count.FEHLER); } return Optional.empty(); }
java
@Override public Optional<DatenFilm> deserialize(final JsonElement aElement, final Type aType, final JsonDeserializationContext aContext) { try { final Optional<JsonObject> viewer = getViewer(aElement.getAsJsonObject()); if (viewer.isPresent()) { final Optional<JsonObject> detailClip = getDetailClip(viewer.get()); return buildFilm(detailClip, viewer.get()); } else { printMissingDetails(JSON_ELEMENT_VIEWER); } } catch (final UnsupportedOperationException unsupportedOperationException) { // This will happen when a element is JsonNull. LOG.error("BR: A needed JSON element is JsonNull.", unsupportedOperationException); FilmeSuchen.listeSenderLaufen.inc(crawler.getSendername(), RunSender.Count.FEHLER); } return Optional.empty(); }
[ "@", "Override", "public", "Optional", "<", "DatenFilm", ">", "deserialize", "(", "final", "JsonElement", "aElement", ",", "final", "Type", "aType", ",", "final", "JsonDeserializationContext", "aContext", ")", "{", "try", "{", "final", "Optional", "<", "JsonObje...
Resolves the Film details which and creates a Film of it.<br> The data has this structure: <code>data -> viewer -> clip -> videoFiles -> edges[] -> node -> id</code><br> <code>data -> viewer -> detailClip -> title</code><br> <code>data -> viewer -> detailClip -> kicker</code><br> <code>data -> viewer -> detailClip -> duration</code><br> <code>data -> viewer -> detailClip -> broadcasts -> edges[0] -> node -> start</code><br> Optional: <code>data -> viewer -> detailClip -> shortDescription</code><br> Optional: <code>data -> viewer -> detailClip -> description</code>
[ "Resolves", "the", "Film", "details", "which", "and", "creates", "a", "Film", "of", "it", ".", "<br", ">", "The", "data", "has", "this", "structure", ":", "<code", ">", "data", "-", ">", "viewer", "-", ">", "clip", "-", ">", "videoFiles", "-", ">", ...
train
https://github.com/mediathekview/MServer/blob/ba8d03e6a1a303db3807a1327f553f1decd30388/src/main/java/mServer/crawler/sender/br/BrFilmDeserializer.java#L89-L111
jiaqi/caff
src/main/java/org/cyclopsgroup/caff/util/ByteUtils.java
ByteUtils.writeLong
public static void writeLong(long value, byte[] dest, int offset) throws IllegalArgumentException { if (dest.length < offset + 8) { throw new IllegalArgumentException( "Destination byte array does not have enough space to write long from offset " + offset); } long t = value; for (int i = offset; i < offset + 8; i++) { dest[i] = (byte) (t & 0xff); t = t >> 8; } }
java
public static void writeLong(long value, byte[] dest, int offset) throws IllegalArgumentException { if (dest.length < offset + 8) { throw new IllegalArgumentException( "Destination byte array does not have enough space to write long from offset " + offset); } long t = value; for (int i = offset; i < offset + 8; i++) { dest[i] = (byte) (t & 0xff); t = t >> 8; } }
[ "public", "static", "void", "writeLong", "(", "long", "value", ",", "byte", "[", "]", "dest", ",", "int", "offset", ")", "throws", "IllegalArgumentException", "{", "if", "(", "dest", ".", "length", "<", "offset", "+", "8", ")", "{", "throw", "new", "Il...
Write long value to given byte array @param value Value to write, it can be any long value @param dest Destination byte array value is written to @param offset The starting point of where the value is written @throws IllegalArgumentException When input byte array doesn't have enough space to write a long
[ "Write", "long", "value", "to", "given", "byte", "array" ]
train
https://github.com/jiaqi/caff/blob/dba4b937a0afc844eb37ccf74dd04dd78f0c1314/src/main/java/org/cyclopsgroup/caff/util/ByteUtils.java#L20-L31
jmeetsma/Iglu-Util
src/main/java/org/ijsberg/iglu/util/collection/CollectionPart.java
CollectionPart.calculateCollectionPartDescriptions
private void calculateCollectionPartDescriptions() { collectionPartIds = new CollectionPartDescription[this.getNrofParts()]; int displayOffset = 0; int count = 0; for (count = 0; count < getNrofParts() - 1; count++) { displayOffset = count * maxPartSize; if (displayOffset != offset) { collectionPartIds[count] = new CollectionPartDescription(displayOffset, maxPartSize, false); } else { collectionPartIds[count] = new CollectionPartDescription(displayOffset, maxPartSize, true); currentCollectionPartIdIndex = count; } } displayOffset = count * maxPartSize; if (displayOffset != offset) { collectionPartIds[count] = new CollectionPartDescription(displayOffset, getLastPartSize(), false); } else { collectionPartIds[count] = new CollectionPartDescription(displayOffset, getLastPartSize(), true); currentCollectionPartIdIndex = count; } }
java
private void calculateCollectionPartDescriptions() { collectionPartIds = new CollectionPartDescription[this.getNrofParts()]; int displayOffset = 0; int count = 0; for (count = 0; count < getNrofParts() - 1; count++) { displayOffset = count * maxPartSize; if (displayOffset != offset) { collectionPartIds[count] = new CollectionPartDescription(displayOffset, maxPartSize, false); } else { collectionPartIds[count] = new CollectionPartDescription(displayOffset, maxPartSize, true); currentCollectionPartIdIndex = count; } } displayOffset = count * maxPartSize; if (displayOffset != offset) { collectionPartIds[count] = new CollectionPartDescription(displayOffset, getLastPartSize(), false); } else { collectionPartIds[count] = new CollectionPartDescription(displayOffset, getLastPartSize(), true); currentCollectionPartIdIndex = count; } }
[ "private", "void", "calculateCollectionPartDescriptions", "(", ")", "{", "collectionPartIds", "=", "new", "CollectionPartDescription", "[", "this", ".", "getNrofParts", "(", ")", "]", ";", "int", "displayOffset", "=", "0", ";", "int", "count", "=", "0", ";", "...
Calculates offsets and sizes of all collection parts the complete collection is divided in.
[ "Calculates", "offsets", "and", "sizes", "of", "all", "collection", "parts", "the", "complete", "collection", "is", "divided", "in", "." ]
train
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/collection/CollectionPart.java#L251-L274
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.createBranch
public void createBranch(GitlabProject project, String branchName, String ref) throws IOException { createBranch(project.getId(), branchName, ref); }
java
public void createBranch(GitlabProject project, String branchName, String ref) throws IOException { createBranch(project.getId(), branchName, ref); }
[ "public", "void", "createBranch", "(", "GitlabProject", "project", ",", "String", "branchName", ",", "String", "ref", ")", "throws", "IOException", "{", "createBranch", "(", "project", ".", "getId", "(", ")", ",", "branchName", ",", "ref", ")", ";", "}" ]
Create Branch. <a href="http://doc.gitlab.com/ce/api/branches.html#create-repository-branch"> Create Repository Branch Documentation </a> @param project The gitlab project @param branchName The name of the branch to create @param ref The branch name or commit SHA to create branch from @throws IOException on gitlab api call error
[ "Create", "Branch", ".", "<a", "href", "=", "http", ":", "//", "doc", ".", "gitlab", ".", "com", "/", "ce", "/", "api", "/", "branches", ".", "html#create", "-", "repository", "-", "branch", ">", "Create", "Repository", "Branch", "Documentation", "<", ...
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L2318-L2320
looly/hutool
hutool-core/src/main/java/cn/hutool/core/convert/Convert.java
Convert.toDate
public static Date toDate(Object value, Date defaultValue) { return convert(Date.class, value, defaultValue); }
java
public static Date toDate(Object value, Date defaultValue) { return convert(Date.class, value, defaultValue); }
[ "public", "static", "Date", "toDate", "(", "Object", "value", ",", "Date", "defaultValue", ")", "{", "return", "convert", "(", "Date", ".", "class", ",", "value", ",", "defaultValue", ")", ";", "}" ]
转换为Date<br> 如果给定的值为空,或者转换失败,返回默认值<br> 转换失败不会报错 @param value 被转换的值 @param defaultValue 转换错误时的默认值 @return 结果 @since 4.1.6
[ "转换为Date<br", ">", "如果给定的值为空,或者转换失败,返回默认值<br", ">", "转换失败不会报错" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/Convert.java#L447-L449
probedock/probedock-java
src/main/java/io/probedock/client/core/filters/FilterTargetData.java
FilterTargetData.mergeTickets
private static String mergeTickets(ProbeTest mAnnotation, ProbeTestClass cAnnotation) { List<String> tickets = new ArrayList<>(); if (mAnnotation != null) { tickets.addAll(Arrays.asList(mAnnotation.tickets())); } if (cAnnotation != null) { tickets.addAll(Arrays.asList(cAnnotation.tickets())); } return Arrays.toString(tickets.toArray(new String[tickets.size()])); }
java
private static String mergeTickets(ProbeTest mAnnotation, ProbeTestClass cAnnotation) { List<String> tickets = new ArrayList<>(); if (mAnnotation != null) { tickets.addAll(Arrays.asList(mAnnotation.tickets())); } if (cAnnotation != null) { tickets.addAll(Arrays.asList(cAnnotation.tickets())); } return Arrays.toString(tickets.toArray(new String[tickets.size()])); }
[ "private", "static", "String", "mergeTickets", "(", "ProbeTest", "mAnnotation", ",", "ProbeTestClass", "cAnnotation", ")", "{", "List", "<", "String", ">", "tickets", "=", "new", "ArrayList", "<>", "(", ")", ";", "if", "(", "mAnnotation", "!=", "null", ")", ...
Create a string containing all the tickets from method and class annotations @param mAnnotation Method annotation @param cAnnotation Class annotation @return The string of tickets
[ "Create", "a", "string", "containing", "all", "the", "tickets", "from", "method", "and", "class", "annotations" ]
train
https://github.com/probedock/probedock-java/blob/92ee6634ba4fe3fdffeb4e202f5372ef947a67c3/src/main/java/io/probedock/client/core/filters/FilterTargetData.java#L188-L200
centic9/commons-dost
src/main/java/org/dstadler/commons/exec/ExecutionHelper.java
ExecutionHelper.getCommandResult
public static InputStream getCommandResult( CommandLine cmdLine, File dir, int expectedExit, long timeout, InputStream input) throws IOException { DefaultExecutor executor = getDefaultExecutor(dir, expectedExit, timeout); try (ByteArrayOutputStream outStr = new ByteArrayOutputStream()) { executor.setStreamHandler(new PumpStreamHandler(outStr, outStr, input)); try { execute(cmdLine, dir, executor, null); return new ByteArrayInputStream(outStr.toByteArray()); } catch (IOException e) { log.warning("Had output before error: " + new String(outStr.toByteArray())); throw new IOException(e); } } }
java
public static InputStream getCommandResult( CommandLine cmdLine, File dir, int expectedExit, long timeout, InputStream input) throws IOException { DefaultExecutor executor = getDefaultExecutor(dir, expectedExit, timeout); try (ByteArrayOutputStream outStr = new ByteArrayOutputStream()) { executor.setStreamHandler(new PumpStreamHandler(outStr, outStr, input)); try { execute(cmdLine, dir, executor, null); return new ByteArrayInputStream(outStr.toByteArray()); } catch (IOException e) { log.warning("Had output before error: " + new String(outStr.toByteArray())); throw new IOException(e); } } }
[ "public", "static", "InputStream", "getCommandResult", "(", "CommandLine", "cmdLine", ",", "File", "dir", ",", "int", "expectedExit", ",", "long", "timeout", ",", "InputStream", "input", ")", "throws", "IOException", "{", "DefaultExecutor", "executor", "=", "getDe...
Run the given commandline in the given directory and provide the given input to the command. Also verify that the tool has the expected exit code and does finish in the timeout. Note: The resulting output is stored in memory, running a command which prints out a huge amount of data to stdout or stderr will cause memory problems. @param cmdLine The commandline object filled with the executable and command line arguments @param dir The working directory for the command @param expectedExit The expected exit value or -1 to not fail on any exit value @param timeout The timeout in milliseconds or ExecuteWatchdog.INFINITE_TIMEOUT @param input Input for the command-execution @return An InputStream which provides the output of the command. @throws IOException Execution of sub-process failed or the sub-process returned a exit value indicating a failure
[ "Run", "the", "given", "commandline", "in", "the", "given", "directory", "and", "provide", "the", "given", "input", "to", "the", "command", ".", "Also", "verify", "that", "the", "tool", "has", "the", "expected", "exit", "code", "and", "does", "finish", "in...
train
https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/exec/ExecutionHelper.java#L70-L86
grails/grails-core
grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java
GrailsASTUtils.applyMethodTarget
public static MethodCallExpression applyMethodTarget(final MethodCallExpression methodCallExpression, final ClassNode targetClassNode, final Class<?>... targetParameterClassTypes) { return applyMethodTarget(methodCallExpression, targetClassNode, convertTargetParameterTypes(targetParameterClassTypes)); }
java
public static MethodCallExpression applyMethodTarget(final MethodCallExpression methodCallExpression, final ClassNode targetClassNode, final Class<?>... targetParameterClassTypes) { return applyMethodTarget(methodCallExpression, targetClassNode, convertTargetParameterTypes(targetParameterClassTypes)); }
[ "public", "static", "MethodCallExpression", "applyMethodTarget", "(", "final", "MethodCallExpression", "methodCallExpression", ",", "final", "ClassNode", "targetClassNode", ",", "final", "Class", "<", "?", ">", "...", "targetParameterClassTypes", ")", "{", "return", "ap...
Set the method target of a MethodCallExpression to the first matching method with same number and type of arguments. @param methodCallExpression @param targetClassNode @param targetParameterClassTypes @return The method call expression
[ "Set", "the", "method", "target", "of", "a", "MethodCallExpression", "to", "the", "first", "matching", "method", "with", "same", "number", "and", "type", "of", "arguments", "." ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java#L1268-L1270
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java
NetworkWatchersInner.beginGetTroubleshootingResultAsync
public Observable<TroubleshootingResultInner> beginGetTroubleshootingResultAsync(String resourceGroupName, String networkWatcherName, String targetResourceId) { return beginGetTroubleshootingResultWithServiceResponseAsync(resourceGroupName, networkWatcherName, targetResourceId).map(new Func1<ServiceResponse<TroubleshootingResultInner>, TroubleshootingResultInner>() { @Override public TroubleshootingResultInner call(ServiceResponse<TroubleshootingResultInner> response) { return response.body(); } }); }
java
public Observable<TroubleshootingResultInner> beginGetTroubleshootingResultAsync(String resourceGroupName, String networkWatcherName, String targetResourceId) { return beginGetTroubleshootingResultWithServiceResponseAsync(resourceGroupName, networkWatcherName, targetResourceId).map(new Func1<ServiceResponse<TroubleshootingResultInner>, TroubleshootingResultInner>() { @Override public TroubleshootingResultInner call(ServiceResponse<TroubleshootingResultInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "TroubleshootingResultInner", ">", "beginGetTroubleshootingResultAsync", "(", "String", "resourceGroupName", ",", "String", "networkWatcherName", ",", "String", "targetResourceId", ")", "{", "return", "beginGetTroubleshootingResultWithServiceResponseA...
Get the last completed troubleshooting result on a specified resource. @param resourceGroupName The name of the resource group. @param networkWatcherName The name of the network watcher resource. @param targetResourceId The target resource ID to query the troubleshooting result. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the TroubleshootingResultInner object
[ "Get", "the", "last", "completed", "troubleshooting", "result", "on", "a", "specified", "resource", "." ]
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/NetworkWatchersInner.java#L1735-L1742
cdapio/tigon
tigon-api/src/main/java/co/cask/tigon/internal/io/SchemaHash.java
SchemaHash.updateHash
private MessageDigest updateHash(MessageDigest md5, Schema schema, Set<String> knownRecords) { // Don't use enum.ordinal() as ordering in enum could change switch (schema.getType()) { case NULL: md5.update((byte) 0); break; case BOOLEAN: md5.update((byte) 1); break; case INT: md5.update((byte) 2); break; case LONG: md5.update((byte) 3); break; case FLOAT: md5.update((byte) 4); break; case DOUBLE: md5.update((byte) 5); break; case BYTES: md5.update((byte) 6); break; case STRING: md5.update((byte) 7); break; case ENUM: md5.update((byte) 8); for (String value : schema.getEnumValues()) { md5.update(Charsets.UTF_8.encode(value)); } break; case ARRAY: md5.update((byte) 9); updateHash(md5, schema.getComponentSchema(), knownRecords); break; case MAP: md5.update((byte) 10); updateHash(md5, schema.getMapSchema().getKey(), knownRecords); updateHash(md5, schema.getMapSchema().getValue(), knownRecords); break; case RECORD: md5.update((byte) 11); boolean notKnown = knownRecords.add(schema.getRecordName()); for (Schema.Field field : schema.getFields()) { md5.update(Charsets.UTF_8.encode(field.getName())); if (notKnown) { updateHash(md5, field.getSchema(), knownRecords); } } break; case UNION: md5.update((byte) 12); for (Schema unionSchema : schema.getUnionSchemas()) { updateHash(md5, unionSchema, knownRecords); } break; } return md5; }
java
private MessageDigest updateHash(MessageDigest md5, Schema schema, Set<String> knownRecords) { // Don't use enum.ordinal() as ordering in enum could change switch (schema.getType()) { case NULL: md5.update((byte) 0); break; case BOOLEAN: md5.update((byte) 1); break; case INT: md5.update((byte) 2); break; case LONG: md5.update((byte) 3); break; case FLOAT: md5.update((byte) 4); break; case DOUBLE: md5.update((byte) 5); break; case BYTES: md5.update((byte) 6); break; case STRING: md5.update((byte) 7); break; case ENUM: md5.update((byte) 8); for (String value : schema.getEnumValues()) { md5.update(Charsets.UTF_8.encode(value)); } break; case ARRAY: md5.update((byte) 9); updateHash(md5, schema.getComponentSchema(), knownRecords); break; case MAP: md5.update((byte) 10); updateHash(md5, schema.getMapSchema().getKey(), knownRecords); updateHash(md5, schema.getMapSchema().getValue(), knownRecords); break; case RECORD: md5.update((byte) 11); boolean notKnown = knownRecords.add(schema.getRecordName()); for (Schema.Field field : schema.getFields()) { md5.update(Charsets.UTF_8.encode(field.getName())); if (notKnown) { updateHash(md5, field.getSchema(), knownRecords); } } break; case UNION: md5.update((byte) 12); for (Schema unionSchema : schema.getUnionSchemas()) { updateHash(md5, unionSchema, knownRecords); } break; } return md5; }
[ "private", "MessageDigest", "updateHash", "(", "MessageDigest", "md5", ",", "Schema", "schema", ",", "Set", "<", "String", ">", "knownRecords", ")", "{", "// Don't use enum.ordinal() as ordering in enum could change", "switch", "(", "schema", ".", "getType", "(", ")",...
Updates md5 based on the given schema. @param md5 {@link java.security.MessageDigest} to update. @param schema {@link Schema} for updating the md5. @param knownRecords bytes to use for updating the md5 for records that're seen before. @return The same {@link java.security.MessageDigest} in the parameter.
[ "Updates", "md5", "based", "on", "the", "given", "schema", "." ]
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-api/src/main/java/co/cask/tigon/internal/io/SchemaHash.java#L108-L168
jhy/jsoup
src/main/java/org/jsoup/helper/DataUtil.java
DataUtil.crossStreams
static void crossStreams(final InputStream in, final OutputStream out) throws IOException { final byte[] buffer = new byte[bufferSize]; int len; while ((len = in.read(buffer)) != -1) { out.write(buffer, 0, len); } }
java
static void crossStreams(final InputStream in, final OutputStream out) throws IOException { final byte[] buffer = new byte[bufferSize]; int len; while ((len = in.read(buffer)) != -1) { out.write(buffer, 0, len); } }
[ "static", "void", "crossStreams", "(", "final", "InputStream", "in", ",", "final", "OutputStream", "out", ")", "throws", "IOException", "{", "final", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "bufferSize", "]", ";", "int", "len", ";", "while", ...
Writes the input stream to the output stream. Doesn't close them. @param in input stream to read from @param out output stream to write to @throws IOException on IO error
[ "Writes", "the", "input", "stream", "to", "the", "output", "stream", ".", "Doesn", "t", "close", "them", "." ]
train
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/helper/DataUtil.java#L88-L94
sawano/java-commons
src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java
AbstractValidate.exclusiveBetween
public <T, V extends Comparable<T>> V exclusiveBetween(final T start, final T end, final V value, final String message, final Object... values) { if (value.compareTo(start) <= 0 || value.compareTo(end) >= 0) { fail(String.format(message, values)); } return value; }
java
public <T, V extends Comparable<T>> V exclusiveBetween(final T start, final T end, final V value, final String message, final Object... values) { if (value.compareTo(start) <= 0 || value.compareTo(end) >= 0) { fail(String.format(message, values)); } return value; }
[ "public", "<", "T", ",", "V", "extends", "Comparable", "<", "T", ">", ">", "V", "exclusiveBetween", "(", "final", "T", "start", ",", "final", "T", "end", ",", "final", "V", "value", ",", "final", "String", "message", ",", "final", "Object", "...", "v...
<p>Validate that the specified argument object fall between the two exclusive values specified; otherwise, throws an exception with the specified message.</p> <pre>Validate.exclusiveBetween(0, 2, 1, "Not in boundaries");</pre> @param <T> the type of the start and end values @param <V> the type of the object @param start the exclusive start value, not null @param end the exclusive end value, not null @param value the object to validate, not null @param message the {@link String#format(String, Object...)} exception message if invalid, not null @param values the optional values for the formatted exception message, null array not recommended @return the value @throws IllegalArgumentValidationException if the value falls outside the boundaries @see #exclusiveBetween(Object, Object, Comparable)
[ "<p", ">", "Validate", "that", "the", "specified", "argument", "object", "fall", "between", "the", "two", "exclusive", "values", "specified", ";", "otherwise", "throws", "an", "exception", "with", "the", "specified", "message", ".", "<", "/", "p", ">", "<pre...
train
https://github.com/sawano/java-commons/blob/6f219c9e8dec4401dbe528d17ae6ec1ef9c0d284/src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java#L1419-L1424
OpenLiberty/open-liberty
dev/com.ibm.ws.app.manager.springboot/src/com/ibm/ws/app/manager/springboot/container/config/ConfigElementList.java
ConfigElementList.getOrCreateById
public E getOrCreateById(String id, Class<E> type) throws IllegalAccessException, InstantiationException { E element = this.getById(id); if (element == null) { element = type.newInstance(); element.setId(id); this.add(element); } return element; }
java
public E getOrCreateById(String id, Class<E> type) throws IllegalAccessException, InstantiationException { E element = this.getById(id); if (element == null) { element = type.newInstance(); element.setId(id); this.add(element); } return element; }
[ "public", "E", "getOrCreateById", "(", "String", "id", ",", "Class", "<", "E", ">", "type", ")", "throws", "IllegalAccessException", ",", "InstantiationException", "{", "E", "element", "=", "this", ".", "getById", "(", "id", ")", ";", "if", "(", "element",...
Returns the first element in this list with a matching identifier, or adds a new element to the end of this list and sets the identifier @param id the identifier to search for @param type the type of the element to add when no existing element is found. The type MUST have a public no-argument constructor (but it probably does since JAXB requires it anyway) @return the first element in this list with a matching identifier. Never returns null. @throws InstantiationException if the public no-argument constructor of the element type is not visible @throws IllegalAccessException if the instance could not be created
[ "Returns", "the", "first", "element", "in", "this", "list", "with", "a", "matching", "identifier", "or", "adds", "a", "new", "element", "to", "the", "end", "of", "this", "list", "and", "sets", "the", "identifier" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.app.manager.springboot/src/com/ibm/ws/app/manager/springboot/container/config/ConfigElementList.java#L146-L154
googleapis/google-cloud-java
google-cloud-clients/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/WebSecurityScannerClient.java
WebSecurityScannerClient.createScanConfig
public final ScanConfig createScanConfig(String parent, ScanConfig scanConfig) { CreateScanConfigRequest request = CreateScanConfigRequest.newBuilder().setParent(parent).setScanConfig(scanConfig).build(); return createScanConfig(request); }
java
public final ScanConfig createScanConfig(String parent, ScanConfig scanConfig) { CreateScanConfigRequest request = CreateScanConfigRequest.newBuilder().setParent(parent).setScanConfig(scanConfig).build(); return createScanConfig(request); }
[ "public", "final", "ScanConfig", "createScanConfig", "(", "String", "parent", ",", "ScanConfig", "scanConfig", ")", "{", "CreateScanConfigRequest", "request", "=", "CreateScanConfigRequest", ".", "newBuilder", "(", ")", ".", "setParent", "(", "parent", ")", ".", "...
Creates a new ScanConfig. <p>Sample code: <pre><code> try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) { ProjectName parent = ProjectName.of("[PROJECT]"); ScanConfig scanConfig = ScanConfig.newBuilder().build(); ScanConfig response = webSecurityScannerClient.createScanConfig(parent.toString(), scanConfig); } </code></pre> @param parent Required. The parent resource name where the scan is created, which should be a project resource name in the format 'projects/{projectId}'. @param scanConfig Required. The ScanConfig to be created. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "a", "new", "ScanConfig", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/WebSecurityScannerClient.java#L210-L215
Hygieia/Hygieia
collectors/misc/score/src/main/java/com/capitalone/dashboard/widget/BuildWidgetScore.java
BuildWidgetScore.fetchBuildDurationWithinThresholdRatio
private Double fetchBuildDurationWithinThresholdRatio(Iterable<Build> builds, long thresholdInMillis) { int totalBuilds = 0, totalBelowThreshold = 0; for (Build build : builds) { if (!Constants.SUCCESS_STATUS.contains(build.getBuildStatus())) { continue; } totalBuilds++; if (build.getDuration() < thresholdInMillis) { totalBelowThreshold++; } } if (totalBuilds == 0) { return 0.0d; } return ((totalBelowThreshold * 100) / (double) totalBuilds); }
java
private Double fetchBuildDurationWithinThresholdRatio(Iterable<Build> builds, long thresholdInMillis) { int totalBuilds = 0, totalBelowThreshold = 0; for (Build build : builds) { if (!Constants.SUCCESS_STATUS.contains(build.getBuildStatus())) { continue; } totalBuilds++; if (build.getDuration() < thresholdInMillis) { totalBelowThreshold++; } } if (totalBuilds == 0) { return 0.0d; } return ((totalBelowThreshold * 100) / (double) totalBuilds); }
[ "private", "Double", "fetchBuildDurationWithinThresholdRatio", "(", "Iterable", "<", "Build", ">", "builds", ",", "long", "thresholdInMillis", ")", "{", "int", "totalBuilds", "=", "0", ",", "totalBelowThreshold", "=", "0", ";", "for", "(", "Build", "build", ":",...
Calculate builds that completed successfully within threshold time Only builds with status as Success, Unstable is included for calculation @param builds iterable builds @param thresholdInMillis threshold for build times in milliseconds @return percentage of builds within threshold
[ "Calculate", "builds", "that", "completed", "successfully", "within", "threshold", "time", "Only", "builds", "with", "status", "as", "Success", "Unstable", "is", "included", "for", "calculation" ]
train
https://github.com/Hygieia/Hygieia/blob/d8b67a590da2744acf59bcd99d9b34ef1bb84890/collectors/misc/score/src/main/java/com/capitalone/dashboard/widget/BuildWidgetScore.java#L220-L236
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/extension/properties/PropertiesManagerCore.java
PropertiesManagerCore.addValue
public int addValue(String property, String value) { int count = 0; for (String geoPackage : propertiesMap.keySet()) { if (addValue(geoPackage, property, value)) { count++; } } return count; }
java
public int addValue(String property, String value) { int count = 0; for (String geoPackage : propertiesMap.keySet()) { if (addValue(geoPackage, property, value)) { count++; } } return count; }
[ "public", "int", "addValue", "(", "String", "property", ",", "String", "value", ")", "{", "int", "count", "=", "0", ";", "for", "(", "String", "geoPackage", ":", "propertiesMap", ".", "keySet", "(", ")", ")", "{", "if", "(", "addValue", "(", "geoPackag...
Add a property value to all GeoPackages @param property property name @param value value @return number of GeoPackages added to
[ "Add", "a", "property", "value", "to", "all", "GeoPackages" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/properties/PropertiesManagerCore.java#L395-L403
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/otf/OtfHeaderDecoder.java
OtfHeaderDecoder.getBlockLength
public int getBlockLength(final DirectBuffer buffer, final int bufferOffset) { return Types.getInt(buffer, bufferOffset + blockLengthOffset, blockLengthType, blockLengthByteOrder); }
java
public int getBlockLength(final DirectBuffer buffer, final int bufferOffset) { return Types.getInt(buffer, bufferOffset + blockLengthOffset, blockLengthType, blockLengthByteOrder); }
[ "public", "int", "getBlockLength", "(", "final", "DirectBuffer", "buffer", ",", "final", "int", "bufferOffset", ")", "{", "return", "Types", ".", "getInt", "(", "buffer", ",", "bufferOffset", "+", "blockLengthOffset", ",", "blockLengthType", ",", "blockLengthByteO...
Get the block length of the root block in the message. @param buffer from which to read the value. @param bufferOffset in the buffer at which the message header begins. @return the length of the root block in the coming message.
[ "Get", "the", "block", "length", "of", "the", "root", "block", "in", "the", "message", "." ]
train
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/otf/OtfHeaderDecoder.java#L142-L145
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java
CoverageUtilities.createSubCoverageFromTemplate
public static GridCoverage2D createSubCoverageFromTemplate( GridCoverage2D template, Envelope2D subregion, Double value, WritableRaster[] writableRasterHolder ) { RegionMap regionMap = getRegionParamsFromGridCoverage(template); double xRes = regionMap.getXres(); double yRes = regionMap.getYres(); double west = subregion.getMinX(); double south = subregion.getMinY(); double east = subregion.getMaxX(); double north = subregion.getMaxY(); int cols = (int) ((east - west) / xRes); int rows = (int) ((north - south) / yRes); ComponentSampleModel sampleModel = new ComponentSampleModel(DataBuffer.TYPE_DOUBLE, cols, rows, 1, cols, new int[]{0}); WritableRaster writableRaster = RasterFactory.createWritableRaster(sampleModel, null); if (value != null) { // autobox only once double v = value; for( int y = 0; y < rows; y++ ) { for( int x = 0; x < cols; x++ ) { writableRaster.setSample(x, y, 0, v); } } } if (writableRasterHolder != null) writableRasterHolder[0] = writableRaster; Envelope2D writeEnvelope = new Envelope2D(template.getCoordinateReferenceSystem(), west, south, east - west, north - south); GridCoverageFactory factory = CoverageFactoryFinder.getGridCoverageFactory(null); GridCoverage2D coverage2D = factory.create("newraster", writableRaster, writeEnvelope); return coverage2D; }
java
public static GridCoverage2D createSubCoverageFromTemplate( GridCoverage2D template, Envelope2D subregion, Double value, WritableRaster[] writableRasterHolder ) { RegionMap regionMap = getRegionParamsFromGridCoverage(template); double xRes = regionMap.getXres(); double yRes = regionMap.getYres(); double west = subregion.getMinX(); double south = subregion.getMinY(); double east = subregion.getMaxX(); double north = subregion.getMaxY(); int cols = (int) ((east - west) / xRes); int rows = (int) ((north - south) / yRes); ComponentSampleModel sampleModel = new ComponentSampleModel(DataBuffer.TYPE_DOUBLE, cols, rows, 1, cols, new int[]{0}); WritableRaster writableRaster = RasterFactory.createWritableRaster(sampleModel, null); if (value != null) { // autobox only once double v = value; for( int y = 0; y < rows; y++ ) { for( int x = 0; x < cols; x++ ) { writableRaster.setSample(x, y, 0, v); } } } if (writableRasterHolder != null) writableRasterHolder[0] = writableRaster; Envelope2D writeEnvelope = new Envelope2D(template.getCoordinateReferenceSystem(), west, south, east - west, north - south); GridCoverageFactory factory = CoverageFactoryFinder.getGridCoverageFactory(null); GridCoverage2D coverage2D = factory.create("newraster", writableRaster, writeEnvelope); return coverage2D; }
[ "public", "static", "GridCoverage2D", "createSubCoverageFromTemplate", "(", "GridCoverage2D", "template", ",", "Envelope2D", "subregion", ",", "Double", "value", ",", "WritableRaster", "[", "]", "writableRasterHolder", ")", "{", "RegionMap", "regionMap", "=", "getRegion...
Create a subcoverage given a template coverage and an envelope. @param template the template coverage used for the resolution. @param subregion the envelope to extract to the new coverage. This should be snapped on the resolution of the coverage, in order to avoid shifts. @param value the value to set the new raster to, if not <code>null</code>. @param writableRasterHolder an array of length 1 to place the writable raster in, that was can be used to populate the coverage. If <code>null</code>, it is ignored. @return the new coverage.
[ "Create", "a", "subcoverage", "given", "a", "template", "coverage", "and", "an", "envelope", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java#L344-L376
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/ContainerKeyCache.java
ContainerKeyCache.includeUpdateBatch
List<Long> includeUpdateBatch(long segmentId, TableKeyBatch batch, long batchOffset) { SegmentKeyCache cache; int generation; synchronized (this.segmentCaches) { generation = this.currentCacheGeneration; cache = this.segmentCaches.computeIfAbsent(segmentId, s -> new SegmentKeyCache(s, this.cache)); } return cache.includeUpdateBatch(batch, batchOffset, generation); }
java
List<Long> includeUpdateBatch(long segmentId, TableKeyBatch batch, long batchOffset) { SegmentKeyCache cache; int generation; synchronized (this.segmentCaches) { generation = this.currentCacheGeneration; cache = this.segmentCaches.computeIfAbsent(segmentId, s -> new SegmentKeyCache(s, this.cache)); } return cache.includeUpdateBatch(batch, batchOffset, generation); }
[ "List", "<", "Long", ">", "includeUpdateBatch", "(", "long", "segmentId", ",", "TableKeyBatch", "batch", ",", "long", "batchOffset", ")", "{", "SegmentKeyCache", "cache", ";", "int", "generation", ";", "synchronized", "(", "this", ".", "segmentCaches", ")", "{...
Updates the tail cache for the given Table Segment with the contents of the given {@link TableKeyBatch}. Each {@link TableKeyBatch.Item} is updated only if no previous entry exists with its {@link TableKeyBatch.Item#getHash()} or if its {@link TableKeyBatch.Item#getOffset()} is greater than the existing entry's offset. This method should be used for processing new updates to the Index (as opposed from bulk-loading already indexed keys). @param segmentId Segment Id that the {@link TableKeyBatch} Items belong to. @param batch An {@link TableKeyBatch} containing items to accept into the Cache. @param batchOffset Offset in the Segment where the first item in the {@link TableKeyBatch} has been written to. @return A List of offsets for each item in the {@link TableKeyBatch} (in the same order) of where the latest value for that item's Key exists now.
[ "Updates", "the", "tail", "cache", "for", "the", "given", "Table", "Segment", "with", "the", "contents", "of", "the", "given", "{", "@link", "TableKeyBatch", "}", ".", "Each", "{", "@link", "TableKeyBatch", ".", "Item", "}", "is", "updated", "only", "if", ...
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/ContainerKeyCache.java#L129-L138
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.patchClosedListWithServiceResponseAsync
public Observable<ServiceResponse<OperationStatus>> patchClosedListWithServiceResponseAsync(UUID appId, String versionId, UUID clEntityId, PatchClosedListOptionalParameter patchClosedListOptionalParameter) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (appId == null) { throw new IllegalArgumentException("Parameter appId is required and cannot be null."); } if (versionId == null) { throw new IllegalArgumentException("Parameter versionId is required and cannot be null."); } if (clEntityId == null) { throw new IllegalArgumentException("Parameter clEntityId is required and cannot be null."); } final List<WordListObject> subLists = patchClosedListOptionalParameter != null ? patchClosedListOptionalParameter.subLists() : null; return patchClosedListWithServiceResponseAsync(appId, versionId, clEntityId, subLists); }
java
public Observable<ServiceResponse<OperationStatus>> patchClosedListWithServiceResponseAsync(UUID appId, String versionId, UUID clEntityId, PatchClosedListOptionalParameter patchClosedListOptionalParameter) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (appId == null) { throw new IllegalArgumentException("Parameter appId is required and cannot be null."); } if (versionId == null) { throw new IllegalArgumentException("Parameter versionId is required and cannot be null."); } if (clEntityId == null) { throw new IllegalArgumentException("Parameter clEntityId is required and cannot be null."); } final List<WordListObject> subLists = patchClosedListOptionalParameter != null ? patchClosedListOptionalParameter.subLists() : null; return patchClosedListWithServiceResponseAsync(appId, versionId, clEntityId, subLists); }
[ "public", "Observable", "<", "ServiceResponse", "<", "OperationStatus", ">", ">", "patchClosedListWithServiceResponseAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "clEntityId", ",", "PatchClosedListOptionalParameter", "patchClosedListOptionalParameter...
Adds a batch of sublists to an existing closedlist. @param appId The application ID. @param versionId The version ID. @param clEntityId The closed list model ID. @param patchClosedListOptionalParameter 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
[ "Adds", "a", "batch", "of", "sublists", "to", "an", "existing", "closedlist", "." ]
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#L4458-L4474
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/VoiceApi.java
VoiceApi.dndOff
public void dndOff() throws WorkspaceApiException { try { ApiSuccessResponse response = this.voiceApi.setDNDOff(null); throwIfNotOk("dndOff", response); } catch (ApiException e) { throw new WorkspaceApiException("dndOff failed.", e); } }
java
public void dndOff() throws WorkspaceApiException { try { ApiSuccessResponse response = this.voiceApi.setDNDOff(null); throwIfNotOk("dndOff", response); } catch (ApiException e) { throw new WorkspaceApiException("dndOff failed.", e); } }
[ "public", "void", "dndOff", "(", ")", "throws", "WorkspaceApiException", "{", "try", "{", "ApiSuccessResponse", "response", "=", "this", ".", "voiceApi", ".", "setDNDOff", "(", "null", ")", ";", "throwIfNotOk", "(", "\"dndOff\"", ",", "response", ")", ";", "...
Turn off Do Not Disturb for the current agent on the voice channel.
[ "Turn", "off", "Do", "Not", "Disturb", "for", "the", "current", "agent", "on", "the", "voice", "channel", "." ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L401-L408
Wikidata/Wikidata-Toolkit
wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/WbEditingAction.java
WbEditingAction.wbRemoveClaims
public JsonNode wbRemoveClaims(List<String> statementIds, boolean bot, long baserevid, String summary) throws IOException, MediaWikiApiErrorException { Validate.notNull(statementIds, "statementIds parameter cannot be null when deleting statements"); Validate.notEmpty(statementIds, "statement ids to delete must be non-empty when deleting statements"); Validate.isTrue(statementIds.size() <= 50, "At most 50 statements can be deleted at once"); Map<String, String> parameters = new HashMap<String, String>(); parameters.put("claim", String.join("|", statementIds)); return performAPIAction("wbremoveclaims", null, null, null, null, parameters, summary, baserevid, bot); }
java
public JsonNode wbRemoveClaims(List<String> statementIds, boolean bot, long baserevid, String summary) throws IOException, MediaWikiApiErrorException { Validate.notNull(statementIds, "statementIds parameter cannot be null when deleting statements"); Validate.notEmpty(statementIds, "statement ids to delete must be non-empty when deleting statements"); Validate.isTrue(statementIds.size() <= 50, "At most 50 statements can be deleted at once"); Map<String, String> parameters = new HashMap<String, String>(); parameters.put("claim", String.join("|", statementIds)); return performAPIAction("wbremoveclaims", null, null, null, null, parameters, summary, baserevid, bot); }
[ "public", "JsonNode", "wbRemoveClaims", "(", "List", "<", "String", ">", "statementIds", ",", "boolean", "bot", ",", "long", "baserevid", ",", "String", "summary", ")", "throws", "IOException", ",", "MediaWikiApiErrorException", "{", "Validate", ".", "notNull", ...
Executes the API action "wbremoveclaims" for the given parameters. @param statementIds the statement ids to delete @param bot if true, edits will be flagged as "bot edits" provided that the logged in user is in the bot group; for regular users, the flag will just be ignored @param baserevid the revision of the data that the edit refers to or 0 if this should not be submitted; when used, the site will ensure that no edit has happened since this revision to detect edit conflicts; it is recommended to use this whenever in all operations where the outcome depends on the state of the online data @param summary summary for the edit; will be prepended by an automatically generated comment; the length limit of the autocomment together with the summary is 260 characters: everything above that limit will be cut off @return the JSON response from the API @throws IOException if there was an IO problem. such as missing network connection @throws MediaWikiApiErrorException if the API returns an error @throws IOException @throws MediaWikiApiErrorException
[ "Executes", "the", "API", "action", "wbremoveclaims", "for", "the", "given", "parameters", "." ]
train
https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/WbEditingAction.java#L583-L597
avianey/facebook-api-android-maven
facebook/src/main/java/com/facebook/Request.java
Request.newMeRequest
public static Request newMeRequest(Session session, final GraphUserCallback callback) { Callback wrapper = new Callback() { @Override public void onCompleted(Response response) { if (callback != null) { callback.onCompleted(response.getGraphObjectAs(GraphUser.class), response); } } }; return new Request(session, ME, null, null, wrapper); }
java
public static Request newMeRequest(Session session, final GraphUserCallback callback) { Callback wrapper = new Callback() { @Override public void onCompleted(Response response) { if (callback != null) { callback.onCompleted(response.getGraphObjectAs(GraphUser.class), response); } } }; return new Request(session, ME, null, null, wrapper); }
[ "public", "static", "Request", "newMeRequest", "(", "Session", "session", ",", "final", "GraphUserCallback", "callback", ")", "{", "Callback", "wrapper", "=", "new", "Callback", "(", ")", "{", "@", "Override", "public", "void", "onCompleted", "(", "Response", ...
Creates a new Request configured to retrieve a user's own profile. @param session the Session to use, or null; if non-null, the session must be in an opened state @param callback a callback that will be called when the request is completed to handle success or error conditions @return a Request that is ready to execute
[ "Creates", "a", "new", "Request", "configured", "to", "retrieve", "a", "user", "s", "own", "profile", "." ]
train
https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/Request.java#L275-L285
kite-sdk/kite
kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/filesystem/SignalManager.java
SignalManager.getReadyTimestamp
public long getReadyTimestamp(Constraints viewConstraints) { String normalizedConstraints = getNormalizedConstraints(viewConstraints); Path signalPath = new Path(signalDirectory, normalizedConstraints); // check if the signal exists try { try { FileStatus signalStatus = rootFileSystem.getFileStatus(signalPath); return signalStatus.getModificationTime(); } catch (final FileNotFoundException ex) { // empty, will be thrown when the signal path doesn't exist } return -1; } catch (IOException e) { throw new DatasetIOException("Could not access signal path: " + signalPath, e); } }
java
public long getReadyTimestamp(Constraints viewConstraints) { String normalizedConstraints = getNormalizedConstraints(viewConstraints); Path signalPath = new Path(signalDirectory, normalizedConstraints); // check if the signal exists try { try { FileStatus signalStatus = rootFileSystem.getFileStatus(signalPath); return signalStatus.getModificationTime(); } catch (final FileNotFoundException ex) { // empty, will be thrown when the signal path doesn't exist } return -1; } catch (IOException e) { throw new DatasetIOException("Could not access signal path: " + signalPath, e); } }
[ "public", "long", "getReadyTimestamp", "(", "Constraints", "viewConstraints", ")", "{", "String", "normalizedConstraints", "=", "getNormalizedConstraints", "(", "viewConstraints", ")", ";", "Path", "signalPath", "=", "new", "Path", "(", "signalDirectory", ",", "normal...
Check the last time the specified constraints have been signaled as ready. @param viewConstraints The constraints to check for a signal. @return the timestamp of the last time the constraints were signaled as ready. if the constraints have never been signaled, -1 will be returned. @throws DatasetException if the signals could not be accessed.
[ "Check", "the", "last", "time", "the", "specified", "constraints", "have", "been", "signaled", "as", "ready", "." ]
train
https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/filesystem/SignalManager.java#L97-L113
OpenLiberty/open-liberty
dev/com.ibm.ws.management.j2ee/src/com/ibm/websphere/management/j2ee/J2EEManagementObjectNameFactory.java
J2EEManagementObjectNameFactory.createObjectName
private static ObjectName createObjectName(String type, String name, Hashtable<String, String> props) { props.put(KEY_TYPE, type); props.put(KEY_NAME, name); try { return new ObjectName(DOMAIN_NAME, props); } catch (MalformedObjectNameException e) { throw new IllegalArgumentException(e); } }
java
private static ObjectName createObjectName(String type, String name, Hashtable<String, String> props) { props.put(KEY_TYPE, type); props.put(KEY_NAME, name); try { return new ObjectName(DOMAIN_NAME, props); } catch (MalformedObjectNameException e) { throw new IllegalArgumentException(e); } }
[ "private", "static", "ObjectName", "createObjectName", "(", "String", "type", ",", "String", "name", ",", "Hashtable", "<", "String", ",", "String", ">", "props", ")", "{", "props", ".", "put", "(", "KEY_TYPE", ",", "type", ")", ";", "props", ".", "put",...
Common object name factory method. The properties table must be an {@link Hashtable} because the object name constructor {@link Object#ObjectName String, Hashtable)} takes a parameter of this type. @param type The type of the object name. See {@link #KEY_TYPE}. @param name The name of the object name. See {@link #KEY_NAME}. @param props Properties expressing the attribute values of the object name.
[ "Common", "object", "name", "factory", "method", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.management.j2ee/src/com/ibm/websphere/management/j2ee/J2EEManagementObjectNameFactory.java#L105-L114
landawn/AbacusUtil
src/com/landawn/abacus/dataSource/PoolablePreparedStatement.java
PoolablePreparedStatement.setBigDecimal
@Override public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException { internalStmt.setBigDecimal(parameterIndex, x); }
java
@Override public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException { internalStmt.setBigDecimal(parameterIndex, x); }
[ "@", "Override", "public", "void", "setBigDecimal", "(", "int", "parameterIndex", ",", "BigDecimal", "x", ")", "throws", "SQLException", "{", "internalStmt", ".", "setBigDecimal", "(", "parameterIndex", ",", "x", ")", ";", "}" ]
Method setBigDecimal. @param parameterIndex @param x @throws SQLException @see java.sql.PreparedStatement#setBigDecimal(int, BigDecimal)
[ "Method", "setBigDecimal", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/dataSource/PoolablePreparedStatement.java#L497-L500
JavaMoney/jsr354-ri-bp
src/main/java/org/javamoney/moneta/internal/loader/DefaultLoaderService.java
DefaultLoaderService.initialize
@Deprecated protected void initialize() { // Cancel any running tasks Timer oldTimer = timer; timer = new Timer(); if (oldTimer!=null) { oldTimer.cancel(); } // (re)initialize LoaderConfigurator configurator = new LoaderConfigurator(this); defaultLoaderServiceFacade = new DefaultLoaderServiceFacade(timer, listener, resources); configurator.load(); }
java
@Deprecated protected void initialize() { // Cancel any running tasks Timer oldTimer = timer; timer = new Timer(); if (oldTimer!=null) { oldTimer.cancel(); } // (re)initialize LoaderConfigurator configurator = new LoaderConfigurator(this); defaultLoaderServiceFacade = new DefaultLoaderServiceFacade(timer, listener, resources); configurator.load(); }
[ "@", "Deprecated", "protected", "void", "initialize", "(", ")", "{", "// Cancel any running tasks", "Timer", "oldTimer", "=", "timer", ";", "timer", "=", "new", "Timer", "(", ")", ";", "if", "(", "oldTimer", "!=", "null", ")", "{", "oldTimer", ".", "cancel...
This method reads initial loads from the javamoney.properties and installs the according timers.
[ "This", "method", "reads", "initial", "loads", "from", "the", "javamoney", ".", "properties", "and", "installs", "the", "according", "timers", "." ]
train
https://github.com/JavaMoney/jsr354-ri-bp/blob/9c147ef5623d8032a6dc4c0e5eefdfb41641a9a2/src/main/java/org/javamoney/moneta/internal/loader/DefaultLoaderService.java#L87-L99
geomajas/geomajas-project-client-gwt
common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java
HtmlBuilder.tableStyleHtmlContent
public static String tableStyleHtmlContent(String style, String... content) { return tagStyleHtmlContent(Html.Tag.TABLE, style, content); }
java
public static String tableStyleHtmlContent(String style, String... content) { return tagStyleHtmlContent(Html.Tag.TABLE, style, content); }
[ "public", "static", "String", "tableStyleHtmlContent", "(", "String", "style", ",", "String", "...", "content", ")", "{", "return", "tagStyleHtmlContent", "(", "Html", ".", "Tag", ".", "TABLE", ",", "style", ",", "content", ")", ";", "}" ]
Build a HTML Table with given CSS style for a string. Use this method if given content contains HTML snippets, prepared with {@link HtmlBuilder#htmlEncode(String)}. @param style style for table element @param content content string @return HTML table element as string
[ "Build", "a", "HTML", "Table", "with", "given", "CSS", "style", "for", "a", "string", ".", "Use", "this", "method", "if", "given", "content", "contains", "HTML", "snippets", "prepared", "with", "{", "@link", "HtmlBuilder#htmlEncode", "(", "String", ")", "}",...
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java#L54-L56
jOOQ/jOOL
jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java
Unchecked.longPredicate
public static LongPredicate longPredicate(CheckedLongPredicate function, Consumer<Throwable> handler) { return l -> { try { return function.test(l); } catch (Throwable e) { handler.accept(e); throw new IllegalStateException("Exception handler must throw a RuntimeException", e); } }; }
java
public static LongPredicate longPredicate(CheckedLongPredicate function, Consumer<Throwable> handler) { return l -> { try { return function.test(l); } catch (Throwable e) { handler.accept(e); throw new IllegalStateException("Exception handler must throw a RuntimeException", e); } }; }
[ "public", "static", "LongPredicate", "longPredicate", "(", "CheckedLongPredicate", "function", ",", "Consumer", "<", "Throwable", ">", "handler", ")", "{", "return", "l", "->", "{", "try", "{", "return", "function", ".", "test", "(", "l", ")", ";", "}", "c...
Wrap a {@link CheckedLongPredicate} in a {@link LongPredicate} with a custom handler for checked exceptions. <p> Example: <code><pre> LongStream.of(1L, 2L, 3L).filter(Unchecked.longPredicate( l -> { if (l &lt; 0L) throw new Exception("Only positive numbers allowed"); return true; }, e -> { throw new IllegalStateException(e); } )); </pre></code>
[ "Wrap", "a", "{", "@link", "CheckedLongPredicate", "}", "in", "a", "{", "@link", "LongPredicate", "}", "with", "a", "custom", "handler", "for", "checked", "exceptions", ".", "<p", ">", "Example", ":", "<code", ">", "<pre", ">", "LongStream", ".", "of", "...
train
https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java#L1599-L1610
aws/aws-sdk-java
aws-java-sdk-iotjobsdataplane/src/main/java/com/amazonaws/services/iotjobsdataplane/model/StartNextPendingJobExecutionRequest.java
StartNextPendingJobExecutionRequest.withStatusDetails
public StartNextPendingJobExecutionRequest withStatusDetails(java.util.Map<String, String> statusDetails) { setStatusDetails(statusDetails); return this; }
java
public StartNextPendingJobExecutionRequest withStatusDetails(java.util.Map<String, String> statusDetails) { setStatusDetails(statusDetails); return this; }
[ "public", "StartNextPendingJobExecutionRequest", "withStatusDetails", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "statusDetails", ")", "{", "setStatusDetails", "(", "statusDetails", ")", ";", "return", "this", ";", "}" ]
<p> A collection of name/value pairs that describe the status of the job execution. If not specified, the statusDetails are unchanged. </p> @param statusDetails A collection of name/value pairs that describe the status of the job execution. If not specified, the statusDetails are unchanged. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "collection", "of", "name", "/", "value", "pairs", "that", "describe", "the", "status", "of", "the", "job", "execution", ".", "If", "not", "specified", "the", "statusDetails", "are", "unchanged", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iotjobsdataplane/src/main/java/com/amazonaws/services/iotjobsdataplane/model/StartNextPendingJobExecutionRequest.java#L134-L137
lestard/advanced-bindings
src/main/java/eu/lestard/advanced_bindings/api/MathBindings.java
MathBindings.multiplyExact
public static IntegerBinding multiplyExact(final ObservableIntegerValue x, final ObservableIntegerValue y) { return createIntegerBinding(() -> Math.multiplyExact(x.get(), y.get()), x, y); }
java
public static IntegerBinding multiplyExact(final ObservableIntegerValue x, final ObservableIntegerValue y) { return createIntegerBinding(() -> Math.multiplyExact(x.get(), y.get()), x, y); }
[ "public", "static", "IntegerBinding", "multiplyExact", "(", "final", "ObservableIntegerValue", "x", ",", "final", "ObservableIntegerValue", "y", ")", "{", "return", "createIntegerBinding", "(", "(", ")", "->", "Math", ".", "multiplyExact", "(", "x", ".", "get", ...
Binding for {@link java.lang.Math#multiplyExact(int, int)} @param x the first value @param y the second value @return the result @throws ArithmeticException if the result overflows an int
[ "Binding", "for", "{", "@link", "java", ".", "lang", ".", "Math#multiplyExact", "(", "int", "int", ")", "}" ]
train
https://github.com/lestard/advanced-bindings/blob/054a5dde261c29f862b971765fa3da3704a13ab4/src/main/java/eu/lestard/advanced_bindings/api/MathBindings.java#L986-L988
knowm/Yank
src/main/java/org/knowm/yank/Yank.java
Yank.executeSQLKey
public static int executeSQLKey(String poolName, String sqlKey, Object[] params) throws SQLStatementNotFoundException, YankSQLException { String sql = YANK_POOL_MANAGER.getMergedSqlProperties().getProperty(sqlKey); if (sql == null || sql.equalsIgnoreCase("")) { throw new SQLStatementNotFoundException(); } else { return execute(poolName, sql, params); } }
java
public static int executeSQLKey(String poolName, String sqlKey, Object[] params) throws SQLStatementNotFoundException, YankSQLException { String sql = YANK_POOL_MANAGER.getMergedSqlProperties().getProperty(sqlKey); if (sql == null || sql.equalsIgnoreCase("")) { throw new SQLStatementNotFoundException(); } else { return execute(poolName, sql, params); } }
[ "public", "static", "int", "executeSQLKey", "(", "String", "poolName", ",", "String", "sqlKey", ",", "Object", "[", "]", "params", ")", "throws", "SQLStatementNotFoundException", ",", "YankSQLException", "{", "String", "sql", "=", "YANK_POOL_MANAGER", ".", "getMer...
Executes the given INSERT, UPDATE, DELETE, REPLACE or UPSERT SQL statement matching the sqlKey String in a properties file loaded via Yank.addSQLStatements(...). Returns the number of rows affected. @param poolName The name of the connection pool to query against @param sqlKey The SQL Key found in a properties file corresponding to the desired SQL statement value @param params The replacement parameters @return The number of rows affected @throws SQLStatementNotFoundException if an SQL statement could not be found for the given sqlKey String
[ "Executes", "the", "given", "INSERT", "UPDATE", "DELETE", "REPLACE", "or", "UPSERT", "SQL", "statement", "matching", "the", "sqlKey", "String", "in", "a", "properties", "file", "loaded", "via", "Yank", ".", "addSQLStatements", "(", "...", ")", ".", "Returns", ...
train
https://github.com/knowm/Yank/blob/b2071dcd94da99db6904355f9557456b8b292a6b/src/main/java/org/knowm/yank/Yank.java#L168-L177
cybazeitalia/emaze-dysfunctional
src/main/java/net/emaze/dysfunctional/Consumers.java
Consumers.pipe
public static <E> void pipe(E[] array, OutputIterator<E> outputIterator) { new ConsumeIntoOutputIterator<>(outputIterator).apply(new ArrayIterator<>(array)); }
java
public static <E> void pipe(E[] array, OutputIterator<E> outputIterator) { new ConsumeIntoOutputIterator<>(outputIterator).apply(new ArrayIterator<>(array)); }
[ "public", "static", "<", "E", ">", "void", "pipe", "(", "E", "[", "]", "array", ",", "OutputIterator", "<", "E", ">", "outputIterator", ")", "{", "new", "ConsumeIntoOutputIterator", "<>", "(", "outputIterator", ")", ".", "apply", "(", "new", "ArrayIterator...
Consumes the array into the output iterator. @param <E> the iterator element type @param array the array that will be consumed @param outputIterator the iterator that will be filled
[ "Consumes", "the", "array", "into", "the", "output", "iterator", "." ]
train
https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Consumers.java#L334-L336
kite-sdk/kite
kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/PartitionKey.java
PartitionKey.partitionKeyForEntity
public static <E> PartitionKey partitionKeyForEntity(PartitionStrategy strategy, E entity, EntityAccessor<E> accessor) { return partitionKeyForEntity(strategy, entity, accessor, null); }
java
public static <E> PartitionKey partitionKeyForEntity(PartitionStrategy strategy, E entity, EntityAccessor<E> accessor) { return partitionKeyForEntity(strategy, entity, accessor, null); }
[ "public", "static", "<", "E", ">", "PartitionKey", "partitionKeyForEntity", "(", "PartitionStrategy", "strategy", ",", "E", "entity", ",", "EntityAccessor", "<", "E", ">", "accessor", ")", "{", "return", "partitionKeyForEntity", "(", "strategy", ",", "entity", "...
<p> Construct a partition key for the given entity. </p> <p> This is a convenient way to find the partition that a given entity is written to, or to find a partition using objects from the entity domain. </p>
[ "<p", ">", "Construct", "a", "partition", "key", "for", "the", "given", "entity", ".", "<", "/", "p", ">", "<p", ">", "This", "is", "a", "convenient", "way", "to", "find", "the", "partition", "that", "a", "given", "entity", "is", "written", "to", "or...
train
https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/PartitionKey.java#L83-L86
jcuda/jcuda
JCudaJava/src/main/java/jcuda/runtime/JCuda.java
JCuda.cudaMemset2DAsync
public static int cudaMemset2DAsync(Pointer devPtr, long pitch, int value, long width, long height, cudaStream_t stream) { return checkResult(cudaMemset2DAsyncNative(devPtr, pitch, value, width, height, stream)); }
java
public static int cudaMemset2DAsync(Pointer devPtr, long pitch, int value, long width, long height, cudaStream_t stream) { return checkResult(cudaMemset2DAsyncNative(devPtr, pitch, value, width, height, stream)); }
[ "public", "static", "int", "cudaMemset2DAsync", "(", "Pointer", "devPtr", ",", "long", "pitch", ",", "int", "value", ",", "long", "width", ",", "long", "height", ",", "cudaStream_t", "stream", ")", "{", "return", "checkResult", "(", "cudaMemset2DAsyncNative", ...
Initializes or sets device memory to a value. <pre> cudaError_t cudaMemset2DAsync ( void* devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream = 0 ) </pre> <div> <p>Initializes or sets device memory to a value. Sets to the specified value <tt>value</tt> a matrix (<tt>height</tt> rows of <tt>width</tt> bytes each) pointed to by <tt>dstPtr</tt>. <tt>pitch</tt> is the width in bytes of the 2D array pointed to by <tt>dstPtr</tt>, including any padding added to the end of each row. This function performs fastest when the pitch is one that has been passed back by cudaMallocPitch(). </p> <p>cudaMemset2DAsync() is asynchronous with respect to the host, so the call may return before the memset is complete. The operation can optionally be associated to a stream by passing a non-zero <tt>stream</tt> argument. If <tt>stream</tt> is non-zero, the operation may overlap with operations in other streams. </p> <div> <span>Note:</span> <ul> <li> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </li> </ul> </div> </p> </div> @param devPtr Pointer to 2D device memory @param pitch Pitch in bytes of 2D device memory @param value Value to set for each byte of specified memory @param width Width of matrix set (columns in bytes) @param height Height of matrix set (rows) @param stream Stream identifier @return cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidDevicePointer @see JCuda#cudaMemset @see JCuda#cudaMemset2D @see JCuda#cudaMemset3D @see JCuda#cudaMemsetAsync @see JCuda#cudaMemset3DAsync
[ "Initializes", "or", "sets", "device", "memory", "to", "a", "value", "." ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/runtime/JCuda.java#L2981-L2984
alkacon/opencms-core
src/org/opencms/xml/types/CmsXmlVfsImageValue.java
CmsXmlVfsImageValue.getParameterValue
private String getParameterValue(CmsObject cms, Map<String, String[]> parameterMap, String key) { String result = null; String[] params = parameterMap.get(key); if ((params != null) && (params.length > 0)) { result = params[0]; } if (result == null) { return ""; } return result; }
java
private String getParameterValue(CmsObject cms, Map<String, String[]> parameterMap, String key) { String result = null; String[] params = parameterMap.get(key); if ((params != null) && (params.length > 0)) { result = params[0]; } if (result == null) { return ""; } return result; }
[ "private", "String", "getParameterValue", "(", "CmsObject", "cms", ",", "Map", "<", "String", ",", "String", "[", "]", ">", "parameterMap", ",", "String", "key", ")", "{", "String", "result", "=", "null", ";", "String", "[", "]", "params", "=", "paramete...
Returns the value of the given parameter name from a parameter map.<p> @param cms the current users context @param parameterMap the map containing the parameters @param key the parameter name @return the value of the parameter or an empty String
[ "Returns", "the", "value", "of", "the", "given", "parameter", "name", "from", "a", "parameter", "map", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/types/CmsXmlVfsImageValue.java#L346-L357
jhunters/jprotobuf
android/src/main/java/com/baidu/bjf/remoting/protobuf/utils/StringUtils.java
StringUtils.toLong
public static long toLong(String str, long defaultValue) { if (str == null) { return defaultValue; } try { return Long.parseLong(str); } catch (NumberFormatException nfe) { return defaultValue; } }
java
public static long toLong(String str, long defaultValue) { if (str == null) { return defaultValue; } try { return Long.parseLong(str); } catch (NumberFormatException nfe) { return defaultValue; } }
[ "public", "static", "long", "toLong", "(", "String", "str", ",", "long", "defaultValue", ")", "{", "if", "(", "str", "==", "null", ")", "{", "return", "defaultValue", ";", "}", "try", "{", "return", "Long", ".", "parseLong", "(", "str", ")", ";", "}"...
<p> Convert a <code>String</code> to an <code>long</code>, returning a default value if the conversion fails. </p> <p> If the string is <code>null</code>, the default value is returned. </p> <pre> NumberUtils.toLong(null, 1) = 1 NumberUtils.toLong("", 1) = 1 NumberUtils.toLong("1", 0) = 1 </pre> @param str the string to convert, may be null @param defaultValue the default value @return the long represented by the string, or the default if conversion fails @since 2.1
[ "<p", ">", "Convert", "a", "<code", ">", "String<", "/", "code", ">", "to", "an", "<code", ">", "long<", "/", "code", ">", "returning", "a", "default", "value", "if", "the", "conversion", "fails", ".", "<", "/", "p", ">" ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/android/src/main/java/com/baidu/bjf/remoting/protobuf/utils/StringUtils.java#L1529-L1538
redkale/redkale
src/org/redkale/net/http/HttpRequest.java
HttpRequest.getShortHeader
public short getShortHeader(int radix, String name, int defaultValue) { return header.getShortValue(radix, name, (short) defaultValue); }
java
public short getShortHeader(int radix, String name, int defaultValue) { return header.getShortValue(radix, name, (short) defaultValue); }
[ "public", "short", "getShortHeader", "(", "int", "radix", ",", "String", "name", ",", "int", "defaultValue", ")", "{", "return", "header", ".", "getShortValue", "(", "radix", ",", "name", ",", "(", "short", ")", "defaultValue", ")", ";", "}" ]
获取指定的header的short值, 没有返回默认short值 @param radix 进制数 @param name header名 @param defaultValue 默认short值 @return header值
[ "获取指定的header的short值", "没有返回默认short值" ]
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/net/http/HttpRequest.java#L1107-L1109
hawkular/hawkular-inventory
hawkular-inventory-impl-tinkerpop-parent/hawkular-inventory-impl-tinkerpop/src/main/java/org/hawkular/inventory/impl/tinkerpop/TinkerpopBackend.java
TinkerpopBackend.checkProperties
static void checkProperties(Map<String, Object> properties, String[] disallowedProperties) { if (properties == null || properties.isEmpty()) { return; } HashSet<String> disallowed = new HashSet<>(properties.keySet()); disallowed.retainAll(Arrays.asList(disallowedProperties)); if (!disallowed.isEmpty()) { throw new IllegalArgumentException("The following properties are reserved for this type of entity: " + Arrays.asList(disallowedProperties)); } }
java
static void checkProperties(Map<String, Object> properties, String[] disallowedProperties) { if (properties == null || properties.isEmpty()) { return; } HashSet<String> disallowed = new HashSet<>(properties.keySet()); disallowed.retainAll(Arrays.asList(disallowedProperties)); if (!disallowed.isEmpty()) { throw new IllegalArgumentException("The following properties are reserved for this type of entity: " + Arrays.asList(disallowedProperties)); } }
[ "static", "void", "checkProperties", "(", "Map", "<", "String", ",", "Object", ">", "properties", ",", "String", "[", "]", "disallowedProperties", ")", "{", "if", "(", "properties", "==", "null", "||", "properties", ".", "isEmpty", "(", ")", ")", "{", "r...
If the properties map contains a key from the disallowed properties, throw an exception. @param properties the properties to check @param disallowedProperties the list of property names that cannot appear in the provided map @throws IllegalArgumentException if the map contains one or more disallowed keys
[ "If", "the", "properties", "map", "contains", "a", "key", "from", "the", "disallowed", "properties", "throw", "an", "exception", "." ]
train
https://github.com/hawkular/hawkular-inventory/blob/f56dc10323dca21777feb5b609a9e9cc70ffaf62/hawkular-inventory-impl-tinkerpop-parent/hawkular-inventory-impl-tinkerpop/src/main/java/org/hawkular/inventory/impl/tinkerpop/TinkerpopBackend.java#L1268-L1280
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Solo.java
Solo.waitForView
public boolean waitForView(int id, int minimumNumberOfMatches, int timeout, boolean scroll){ if(config.commandLogging){ Log.d(config.commandLoggingTag, "waitForView("+id+", "+minimumNumberOfMatches+", "+timeout+", "+scroll+")"); } int index = minimumNumberOfMatches-1; if(index < 1) index = 0; return (waiter.waitForView(id, index, timeout, scroll) != null); }
java
public boolean waitForView(int id, int minimumNumberOfMatches, int timeout, boolean scroll){ if(config.commandLogging){ Log.d(config.commandLoggingTag, "waitForView("+id+", "+minimumNumberOfMatches+", "+timeout+", "+scroll+")"); } int index = minimumNumberOfMatches-1; if(index < 1) index = 0; return (waiter.waitForView(id, index, timeout, scroll) != null); }
[ "public", "boolean", "waitForView", "(", "int", "id", ",", "int", "minimumNumberOfMatches", ",", "int", "timeout", ",", "boolean", "scroll", ")", "{", "if", "(", "config", ".", "commandLogging", ")", "{", "Log", ".", "d", "(", "config", ".", "commandLoggin...
Waits for a View matching the specified resource id. @param id the R.id of the {@link View} to wait for @param minimumNumberOfMatches the minimum number of matches that are expected to be found. {@code 0} means any number of matches @param timeout the amount of time in milliseconds to wait @param scroll {@code true} if scrolling should be performed @return {@code true} if the {@link View} is displayed and {@code false} if it is not displayed before the timeout
[ "Waits", "for", "a", "View", "matching", "the", "specified", "resource", "id", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Solo.java#L486-L497
amilcar-sr/JustifiedTextView
library/src/main/java/com/codesgood/views/JustifiedTextView.java
JustifiedTextView.addWord
private void addWord(String word, boolean containsNewLine) { currentSentence.add(word); if (containsNewLine) { sentences.add(getSentenceFromListCheckingNewLines(currentSentence)); currentSentence.clear(); } }
java
private void addWord(String word, boolean containsNewLine) { currentSentence.add(word); if (containsNewLine) { sentences.add(getSentenceFromListCheckingNewLines(currentSentence)); currentSentence.clear(); } }
[ "private", "void", "addWord", "(", "String", "word", ",", "boolean", "containsNewLine", ")", "{", "currentSentence", ".", "add", "(", "word", ")", ";", "if", "(", "containsNewLine", ")", "{", "sentences", ".", "add", "(", "getSentenceFromListCheckingNewLines", ...
Adds a word into sentence and starts a new one if "new line" is part of the string. @param word Word to be added @param containsNewLine Specifies if the string contains a new line
[ "Adds", "a", "word", "into", "sentence", "and", "starts", "a", "new", "one", "if", "new", "line", "is", "part", "of", "the", "string", "." ]
train
https://github.com/amilcar-sr/JustifiedTextView/blob/8fd91b4cfb225f973096519eae8295c3d7e8d49f/library/src/main/java/com/codesgood/views/JustifiedTextView.java#L136-L142
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/ZipUtil.java
ZipUtil.entryEquals
public static boolean entryEquals(File f1, File f2, String path) { return entryEquals(f1, f2, path, path); }
java
public static boolean entryEquals(File f1, File f2, String path) { return entryEquals(f1, f2, path, path); }
[ "public", "static", "boolean", "entryEquals", "(", "File", "f1", ",", "File", "f2", ",", "String", "path", ")", "{", "return", "entryEquals", "(", "f1", ",", "f2", ",", "path", ",", "path", ")", ";", "}" ]
Compares same entry in two ZIP files (byte-by-byte). @param f1 first ZIP file. @param f2 second ZIP file. @param path name of the entry. @return <code>true</code> if the contents of the entry was same in both ZIP files.
[ "Compares", "same", "entry", "in", "two", "ZIP", "files", "(", "byte", "-", "by", "-", "byte", ")", "." ]
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L3214-L3216
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/jcr/security/acl/JcrAccessControlList.java
JcrAccessControlList.defaultAcl
public static JcrAccessControlList defaultAcl( AccessControlManagerImpl acm ) { JcrAccessControlList acl = new JcrAccessControlList("/"); try { acl.principals.put(SimplePrincipal.EVERYONE, new AccessControlEntryImpl(SimplePrincipal.EVERYONE, acm.privileges())); } catch (AccessControlException e) { // will never happen } return acl; }
java
public static JcrAccessControlList defaultAcl( AccessControlManagerImpl acm ) { JcrAccessControlList acl = new JcrAccessControlList("/"); try { acl.principals.put(SimplePrincipal.EVERYONE, new AccessControlEntryImpl(SimplePrincipal.EVERYONE, acm.privileges())); } catch (AccessControlException e) { // will never happen } return acl; }
[ "public", "static", "JcrAccessControlList", "defaultAcl", "(", "AccessControlManagerImpl", "acm", ")", "{", "JcrAccessControlList", "acl", "=", "new", "JcrAccessControlList", "(", "\"/\"", ")", ";", "try", "{", "acl", ".", "principals", ".", "put", "(", "SimplePri...
Creates default Access Control List. @param acm access control manager instance @return Access Control List with all permissions granted to everyone.
[ "Creates", "default", "Access", "Control", "List", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/security/acl/JcrAccessControlList.java#L60-L68
lucee/Lucee
core/src/main/java/lucee/runtime/converter/JSConverter.java
JSConverter._serializeList
private void _serializeList(String name, List list, StringBuilder sb, Set<Object> done) throws ConverterException { if (useShortcuts) sb.append("[];"); else sb.append("new Array();"); ListIterator it = list.listIterator(); int index = -1; while (it.hasNext()) { // if(index!=-1)sb.append(","); index = it.nextIndex(); sb.append(name + "[" + index + "]="); _serialize(name + "[" + index + "]", it.next(), sb, done); // sb.append(";"); } }
java
private void _serializeList(String name, List list, StringBuilder sb, Set<Object> done) throws ConverterException { if (useShortcuts) sb.append("[];"); else sb.append("new Array();"); ListIterator it = list.listIterator(); int index = -1; while (it.hasNext()) { // if(index!=-1)sb.append(","); index = it.nextIndex(); sb.append(name + "[" + index + "]="); _serialize(name + "[" + index + "]", it.next(), sb, done); // sb.append(";"); } }
[ "private", "void", "_serializeList", "(", "String", "name", ",", "List", "list", ",", "StringBuilder", "sb", ",", "Set", "<", "Object", ">", "done", ")", "throws", "ConverterException", "{", "if", "(", "useShortcuts", ")", "sb", ".", "append", "(", "\"[];\...
serialize a List (as Array) @param name @param list List to serialize @param sb @param done @return serialized list @throws ConverterException
[ "serialize", "a", "List", "(", "as", "Array", ")" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/converter/JSConverter.java#L192-L206
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookBuilder.java
DocBookBuilder.buildBook
public HashMap<String, byte[]> buildBook(final ContentSpec contentSpec, final String requester, final DocBookBuildingOptions buildingOptions, final Map<String, byte[]> overrideFiles) throws BuilderCreationException, BuildProcessingException { return buildBook(contentSpec, requester, buildingOptions, overrideFiles, null, false); }
java
public HashMap<String, byte[]> buildBook(final ContentSpec contentSpec, final String requester, final DocBookBuildingOptions buildingOptions, final Map<String, byte[]> overrideFiles) throws BuilderCreationException, BuildProcessingException { return buildBook(contentSpec, requester, buildingOptions, overrideFiles, null, false); }
[ "public", "HashMap", "<", "String", ",", "byte", "[", "]", ">", "buildBook", "(", "final", "ContentSpec", "contentSpec", ",", "final", "String", "requester", ",", "final", "DocBookBuildingOptions", "buildingOptions", ",", "final", "Map", "<", "String", ",", "b...
Builds a DocBook Formatted Book using a Content Specification to define the structure and contents of the book. @param contentSpec The content specification to build from. @param requester The user who requested the build. @param buildingOptions The options to be used when building. @param overrideFiles @return Returns a mapping of file names/locations to files. This HashMap can be used to build a ZIP archive. @throws BuilderCreationException Thrown if the builder is unable to start due to incorrect passed variables. @throws BuildProcessingException Any build issue that should not occur under normal circumstances. Ie a Template can't be converted to a DOM Document.
[ "Builds", "a", "DocBook", "Formatted", "Book", "using", "a", "Content", "Specification", "to", "define", "the", "structure", "and", "contents", "of", "the", "book", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookBuilder.java#L422-L426
hageldave/ImagingKit
ImagingKit_Core/src/main/java/hageldave/imagingkit/core/Pixel.java
Pixel.getGrey
public static final int getGrey(final int color, final int redWeight, final int greenWeight, final int blueWeight){ return (r(color)*redWeight + g(color)*greenWeight + b(color)*blueWeight)/(redWeight+blueWeight+greenWeight); }
java
public static final int getGrey(final int color, final int redWeight, final int greenWeight, final int blueWeight){ return (r(color)*redWeight + g(color)*greenWeight + b(color)*blueWeight)/(redWeight+blueWeight+greenWeight); }
[ "public", "static", "final", "int", "getGrey", "(", "final", "int", "color", ",", "final", "int", "redWeight", ",", "final", "int", "greenWeight", ",", "final", "int", "blueWeight", ")", "{", "return", "(", "r", "(", "color", ")", "*", "redWeight", "+", ...
Calculates a grey value from an RGB or ARGB value using specified weights for each R,G and B channel. <p> Weights are integer values so normalized weights need to be converted beforehand. E.g. normalized weights (0.33, 0.62, 0.05) would be have to be converted to integer weights (33, 62, 5). <p> When using weights with same signs, the value is within [0..255]. When weights have mixed signs the resulting value is unbounded. @param color RGB(24bit) or ARGB(32bit) value @param redWeight weight for red channel @param greenWeight weight for green channel @param blueWeight weight for blue channel @return weighted grey value (8bit) of RGB color value for non-negative weights. @throws ArithmeticException divide by zero if the weights sum up to 0. @see #getLuminance(int) @since 1.0
[ "Calculates", "a", "grey", "value", "from", "an", "RGB", "or", "ARGB", "value", "using", "specified", "weights", "for", "each", "R", "G", "and", "B", "channel", ".", "<p", ">", "Weights", "are", "integer", "values", "so", "normalized", "weights", "need", ...
train
https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/Pixel.java#L596-L598
kiswanij/jk-util
src/main/java/com/jk/util/config/JKConfig.java
JKConfig.getString
public String getString(String name, String defaultValue) { return config.getString(name, defaultValue); }
java
public String getString(String name, String defaultValue) { return config.getString(name, defaultValue); }
[ "public", "String", "getString", "(", "String", "name", ",", "String", "defaultValue", ")", "{", "return", "config", ".", "getString", "(", "name", ",", "defaultValue", ")", ";", "}" ]
Gets the string. @param name the name @param defaultValue the default value @return the string
[ "Gets", "the", "string", "." ]
train
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/config/JKConfig.java#L145-L147
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/BoardsApi.java
BoardsApi.getBoardList
public BoardList getBoardList(Object projectIdOrPath, Integer boardId, Integer listId) throws GitLabApiException { Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "boards", boardId, "lists", listId); return (response.readEntity(BoardList.class)); }
java
public BoardList getBoardList(Object projectIdOrPath, Integer boardId, Integer listId) throws GitLabApiException { Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "boards", boardId, "lists", listId); return (response.readEntity(BoardList.class)); }
[ "public", "BoardList", "getBoardList", "(", "Object", "projectIdOrPath", ",", "Integer", "boardId", ",", "Integer", "listId", ")", "throws", "GitLabApiException", "{", "Response", "response", "=", "get", "(", "Response", ".", "Status", ".", "OK", ",", "null", ...
Get a single issue board list. <pre><code>GitLab Endpoint: GET /projects/:id/boards/:board_id/lists/:list_id</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param boardId the ID of the board @param listId the ID of the board lists to get @return a BoardList instance for the specified board ID and list ID @throws GitLabApiException if any exception occurs
[ "Get", "a", "single", "issue", "board", "list", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/BoardsApi.java#L255-L259
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/FileOperations.java
FileOperations.deleteFileFromComputeNode
public void deleteFileFromComputeNode(String poolId, String nodeId, String fileName) throws BatchErrorException, IOException { deleteFileFromComputeNode(poolId, nodeId, fileName, null, null); }
java
public void deleteFileFromComputeNode(String poolId, String nodeId, String fileName) throws BatchErrorException, IOException { deleteFileFromComputeNode(poolId, nodeId, fileName, null, null); }
[ "public", "void", "deleteFileFromComputeNode", "(", "String", "poolId", ",", "String", "nodeId", ",", "String", "fileName", ")", "throws", "BatchErrorException", ",", "IOException", "{", "deleteFileFromComputeNode", "(", "poolId", ",", "nodeId", ",", "fileName", ","...
Deletes the specified file from the specified compute node. @param poolId The ID of the pool that contains the compute node. @param nodeId The ID of the compute node. @param fileName The name of the file to delete. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Deletes", "the", "specified", "file", "from", "the", "specified", "compute", "node", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/FileOperations.java#L217-L219
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPAttachmentFileEntryPersistenceImpl.java
CPAttachmentFileEntryPersistenceImpl.findByUUID_G
@Override public CPAttachmentFileEntry findByUUID_G(String uuid, long groupId) throws NoSuchCPAttachmentFileEntryException { CPAttachmentFileEntry cpAttachmentFileEntry = fetchByUUID_G(uuid, groupId); if (cpAttachmentFileEntry == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", groupId="); msg.append(groupId); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchCPAttachmentFileEntryException(msg.toString()); } return cpAttachmentFileEntry; }
java
@Override public CPAttachmentFileEntry findByUUID_G(String uuid, long groupId) throws NoSuchCPAttachmentFileEntryException { CPAttachmentFileEntry cpAttachmentFileEntry = fetchByUUID_G(uuid, groupId); if (cpAttachmentFileEntry == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", groupId="); msg.append(groupId); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchCPAttachmentFileEntryException(msg.toString()); } return cpAttachmentFileEntry; }
[ "@", "Override", "public", "CPAttachmentFileEntry", "findByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "NoSuchCPAttachmentFileEntryException", "{", "CPAttachmentFileEntry", "cpAttachmentFileEntry", "=", "fetchByUUID_G", "(", "uuid", ",", "groupI...
Returns the cp attachment file entry where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchCPAttachmentFileEntryException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching cp attachment file entry @throws NoSuchCPAttachmentFileEntryException if a matching cp attachment file entry could not be found
[ "Returns", "the", "cp", "attachment", "file", "entry", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchCPAttachmentFileEntryException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPAttachmentFileEntryPersistenceImpl.java#L673-L700
futuresimple/android-db-commons
library/src/main/java/com/getbase/android/db/cursors/FluentCursor.java
FluentCursor.toOnlyElement
public <T> T toOnlyElement(Function<? super Cursor, T> singleRowTransform, T defaultValue) { if (moveToFirst()) { return toOnlyElement(singleRowTransform); } else { close(); return defaultValue; } }
java
public <T> T toOnlyElement(Function<? super Cursor, T> singleRowTransform, T defaultValue) { if (moveToFirst()) { return toOnlyElement(singleRowTransform); } else { close(); return defaultValue; } }
[ "public", "<", "T", ">", "T", "toOnlyElement", "(", "Function", "<", "?", "super", "Cursor", ",", "T", ">", "singleRowTransform", ",", "T", "defaultValue", ")", "{", "if", "(", "moveToFirst", "(", ")", ")", "{", "return", "toOnlyElement", "(", "singleRow...
Returns the only row of this cursor transformed using the given function, or the supplied default value if cursor is empty. WARNING: This method closes cursor. Do not use this from onLoadFinished() @param singleRowTransform Function to apply on the only row of this cursor @param <T> Type of returned element @return Transformed first row of the cursor or the supplied default value if the cursor is empty. If the cursor contains more than one row, IllegalArgumentException is thrown.
[ "Returns", "the", "only", "row", "of", "this", "cursor", "transformed", "using", "the", "given", "function", "or", "the", "supplied", "default", "value", "if", "cursor", "is", "empty", ".", "WARNING", ":", "This", "method", "closes", "cursor", ".", "Do", "...
train
https://github.com/futuresimple/android-db-commons/blob/a3c37df806f61b1bfab6927ba3710cbb0fa9229a/library/src/main/java/com/getbase/android/db/cursors/FluentCursor.java#L156-L163
digitalheir/java-xml-to-json
src/main/java/org/leibnizcenter/xml/helpers/XmlNodeToJsonElement.java
XmlNodeToJsonElement.documentType
public static Object documentType(DocumentType dtd, String[][] entities, String[][] notations) { return new Object[]{ dtd.getNodeType(),// short dtd.getName(),// String entities,// NamedNodeMap notations,// NamedNodeMap dtd.getPublicId(),// String dtd.getSystemId(),// String dtd.getInternalSubset() //String }; }
java
public static Object documentType(DocumentType dtd, String[][] entities, String[][] notations) { return new Object[]{ dtd.getNodeType(),// short dtd.getName(),// String entities,// NamedNodeMap notations,// NamedNodeMap dtd.getPublicId(),// String dtd.getSystemId(),// String dtd.getInternalSubset() //String }; }
[ "public", "static", "Object", "documentType", "(", "DocumentType", "dtd", ",", "String", "[", "]", "[", "]", "entities", ",", "String", "[", "]", "[", "]", "notations", ")", "{", "return", "new", "Object", "[", "]", "{", "dtd", ".", "getNodeType", "(",...
Each Document has a doctype attribute whose value is either null or a DocumentType object. The DocumentType interface in the DOM Core provides an interface to the list of entities that are defined for the document, and little else because the effect of namespaces and the various XML schema efforts on DTD representation are not clearly understood as of this writing. <p> DOM Level 3 doesn't support editing DocumentType nodes. DocumentType nodes are read-only.
[ "Each", "Document", "has", "a", "doctype", "attribute", "whose", "value", "is", "either", "null", "or", "a", "DocumentType", "object", ".", "The", "DocumentType", "interface", "in", "the", "DOM", "Core", "provides", "an", "interface", "to", "the", "list", "o...
train
https://github.com/digitalheir/java-xml-to-json/blob/94b4cef671bea9b79fb6daa685cd5bf78c222179/src/main/java/org/leibnizcenter/xml/helpers/XmlNodeToJsonElement.java#L37-L47
alkacon/opencms-core
src-gwt/org/opencms/acacia/client/CmsAttributeHandler.java
CmsAttributeHandler.setWarningMessage
public void setWarningMessage(int valueIndex, String message, CmsTabbedPanel<?> tabbedPanel) { if (!m_attributeValueViews.isEmpty()) { FlowPanel parent = (FlowPanel)m_attributeValueViews.get(0).getParent(); CmsAttributeValueView valueView = (CmsAttributeValueView)parent.getWidget(valueIndex); valueView.setWarningMessage(message); if (tabbedPanel != null) { int tabIndex = tabbedPanel.getTabIndex(valueView.getElement()); if (tabIndex > -1) { Widget tab = tabbedPanel.getTabWidget(tabIndex); tab.setTitle("This tab has warnings."); tab.getParent().addStyleName(I_CmsLayoutBundle.INSTANCE.form().hasWarning()); } } } }
java
public void setWarningMessage(int valueIndex, String message, CmsTabbedPanel<?> tabbedPanel) { if (!m_attributeValueViews.isEmpty()) { FlowPanel parent = (FlowPanel)m_attributeValueViews.get(0).getParent(); CmsAttributeValueView valueView = (CmsAttributeValueView)parent.getWidget(valueIndex); valueView.setWarningMessage(message); if (tabbedPanel != null) { int tabIndex = tabbedPanel.getTabIndex(valueView.getElement()); if (tabIndex > -1) { Widget tab = tabbedPanel.getTabWidget(tabIndex); tab.setTitle("This tab has warnings."); tab.getParent().addStyleName(I_CmsLayoutBundle.INSTANCE.form().hasWarning()); } } } }
[ "public", "void", "setWarningMessage", "(", "int", "valueIndex", ",", "String", "message", ",", "CmsTabbedPanel", "<", "?", ">", "tabbedPanel", ")", "{", "if", "(", "!", "m_attributeValueViews", ".", "isEmpty", "(", ")", ")", "{", "FlowPanel", "parent", "=",...
Sets the warning message for the given value index.<p> @param valueIndex the value index @param message the warning message @param tabbedPanel the forms tabbed panel if available
[ "Sets", "the", "warning", "message", "for", "the", "given", "value", "index", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/CmsAttributeHandler.java#L1023-L1039
hawkular/hawkular-apm
client/instrumenter/src/main/java/org/hawkular/apm/instrumenter/RuleHelper.java
RuleHelper.removeAfter
public String removeAfter(String original, String marker) { int index = original.indexOf(marker); if (index != -1) { return original.substring(0, index); } return original; }
java
public String removeAfter(String original, String marker) { int index = original.indexOf(marker); if (index != -1) { return original.substring(0, index); } return original; }
[ "public", "String", "removeAfter", "(", "String", "original", ",", "String", "marker", ")", "{", "int", "index", "=", "original", ".", "indexOf", "(", "marker", ")", ";", "if", "(", "index", "!=", "-", "1", ")", "{", "return", "original", ".", "substri...
This method removes the end part of a string beginning at a specified marker. @param original The original string @param marker The marker identifying the point to remove from @return The modified string
[ "This", "method", "removes", "the", "end", "part", "of", "a", "string", "beginning", "at", "a", "specified", "marker", "." ]
train
https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/client/instrumenter/src/main/java/org/hawkular/apm/instrumenter/RuleHelper.java#L285-L291
maxirosson/jdroid-android
jdroid-android-core/src/main/java/com/jdroid/android/utils/TooltipHelper.java
TooltipHelper.setup
public static void setup(View view) { view.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { return showCheatSheet(view, view.getContentDescription()); } }); }
java
public static void setup(View view) { view.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { return showCheatSheet(view, view.getContentDescription()); } }); }
[ "public", "static", "void", "setup", "(", "View", "view", ")", "{", "view", ".", "setOnLongClickListener", "(", "new", "View", ".", "OnLongClickListener", "(", ")", "{", "@", "Override", "public", "boolean", "onLongClick", "(", "View", "view", ")", "{", "r...
Sets up a cheat sheet (tooltip) for the given view by setting its {@link android.view.View.OnLongClickListener}. When the view is long-pressed, a {@link Toast} with the view's {@link android.view.View#getContentDescription() content description} will be shown either above (default) or below the view (if there isn't room above it). @param view The view to add a cheat sheet for.
[ "Sets", "up", "a", "cheat", "sheet", "(", "tooltip", ")", "for", "the", "given", "view", "by", "setting", "its", "{", "@link", "android", ".", "view", ".", "View", ".", "OnLongClickListener", "}", ".", "When", "the", "view", "is", "long", "-", "pressed...
train
https://github.com/maxirosson/jdroid-android/blob/1ba9cae56a16fa36bdb2c9c04379853f0300707f/jdroid-android-core/src/main/java/com/jdroid/android/utils/TooltipHelper.java#L35-L43
cojen/Cojen
src/main/java/org/cojen/classfile/ClassFile.java
ClassFile.setVersion
public void setVersion(int major, int minor) { if (major > 65535 || minor > 65535) { throw new IllegalArgumentException("Version number element cannot exceed 65535"); } mVersion = (minor << 16) | (major & 0xffff); String target; switch (major) { default: target = null; break; case 45: target = minor == 3 ? "1.0" : null; break; case 46: target = minor == 0 ? "1.2" : null; break; case 47: target = minor == 0 ? "1.3" : null; break; case 48: target = minor == 0 ? "1.4" : null; break; case 49: target = minor == 0 ? "1.5" : null; break; case 50: target = minor == 0 ? "1.6" : null; break; case 51: target = minor == 0 ? "1.7" : null; break; } mTarget = target; }
java
public void setVersion(int major, int minor) { if (major > 65535 || minor > 65535) { throw new IllegalArgumentException("Version number element cannot exceed 65535"); } mVersion = (minor << 16) | (major & 0xffff); String target; switch (major) { default: target = null; break; case 45: target = minor == 3 ? "1.0" : null; break; case 46: target = minor == 0 ? "1.2" : null; break; case 47: target = minor == 0 ? "1.3" : null; break; case 48: target = minor == 0 ? "1.4" : null; break; case 49: target = minor == 0 ? "1.5" : null; break; case 50: target = minor == 0 ? "1.6" : null; break; case 51: target = minor == 0 ? "1.7" : null; break; } mTarget = target; }
[ "public", "void", "setVersion", "(", "int", "major", ",", "int", "minor", ")", "{", "if", "(", "major", ">", "65535", "||", "minor", ">", "65535", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Version number element cannot exceed 65535\"", ")", ...
Sets the version to use when writing the generated classfile, overriding the target.
[ "Sets", "the", "version", "to", "use", "when", "writing", "the", "generated", "classfile", "overriding", "the", "target", "." ]
train
https://github.com/cojen/Cojen/blob/ddee9a0fde83870b97e0ed04c58270aa665f3a62/src/main/java/org/cojen/classfile/ClassFile.java#L997-L1033
EdwardRaff/JSAT
JSAT/src/jsat/DataSet.java
DataSet.base_add
protected void base_add(DataPoint dp, double weight) { datapoints.addDataPoint(dp); setWeight(size()-1, weight); }
java
protected void base_add(DataPoint dp, double weight) { datapoints.addDataPoint(dp); setWeight(size()-1, weight); }
[ "protected", "void", "base_add", "(", "DataPoint", "dp", ",", "double", "weight", ")", "{", "datapoints", ".", "addDataPoint", "(", "dp", ")", ";", "setWeight", "(", "size", "(", ")", "-", "1", ",", "weight", ")", ";", "}" ]
Adds a new datapoint to this set.This method is protected, as not all datasets will be satisfied by adding just a data point. @param dp the datapoint to add @param weight weight of the point to add
[ "Adds", "a", "new", "datapoint", "to", "this", "set", ".", "This", "method", "is", "protected", "as", "not", "all", "datasets", "will", "be", "satisfied", "by", "adding", "just", "a", "data", "point", "." ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/DataSet.java#L269-L273
DV8FromTheWorld/JDA
src/main/java/net/dv8tion/jda/core/EmbedBuilder.java
EmbedBuilder.setFooter
public EmbedBuilder setFooter(String text, String iconUrl) { //We only check if the text is null because its presence is what determines if the // footer will appear in the embed. if (text == null) { this.footer = null; } else { Checks.check(text.length() <= MessageEmbed.TEXT_MAX_LENGTH, "Text cannot be longer than %d characters.", MessageEmbed.TEXT_MAX_LENGTH); urlCheck(iconUrl); this.footer = new MessageEmbed.Footer(text, iconUrl, null); } return this; }
java
public EmbedBuilder setFooter(String text, String iconUrl) { //We only check if the text is null because its presence is what determines if the // footer will appear in the embed. if (text == null) { this.footer = null; } else { Checks.check(text.length() <= MessageEmbed.TEXT_MAX_LENGTH, "Text cannot be longer than %d characters.", MessageEmbed.TEXT_MAX_LENGTH); urlCheck(iconUrl); this.footer = new MessageEmbed.Footer(text, iconUrl, null); } return this; }
[ "public", "EmbedBuilder", "setFooter", "(", "String", "text", ",", "String", "iconUrl", ")", "{", "//We only check if the text is null because its presence is what determines if the", "// footer will appear in the embed.", "if", "(", "text", "==", "null", ")", "{", "this", ...
Sets the Footer of the embed. <p><b><a href="http://i.imgur.com/jdf4sbi.png">Example</a></b> <p><b>Uploading images with Embeds</b> <br>When uploading an <u>image</u> (using {@link net.dv8tion.jda.core.entities.MessageChannel#sendFile(java.io.File, net.dv8tion.jda.core.entities.Message) MessageChannel.sendFile(...)}) you can reference said image using the specified filename as URI {@code attachment://filename.ext}. <p><u>Example</u> <pre><code> MessageChannel channel; // = reference of a MessageChannel MessageBuilder message = new MessageBuilder(); EmbedBuilder embed = new EmbedBuilder(); InputStream file = new URL("https://http.cat/500").openStream(); embed.setFooter("Cool footer!", "attachment://cat.png") // we specify this in sendFile as "cat.png" .setDescription("This is a cute cat :3"); message.setEmbed(embed.build()); channel.sendFile(file, "cat.png", message.build()).queue(); </code></pre> @param text the text of the footer of the embed. If this is not set, the footer will not appear in the embed. @param iconUrl the url of the icon for the footer @throws java.lang.IllegalArgumentException <ul> <li>If the length of {@code text} is longer than {@link net.dv8tion.jda.core.entities.MessageEmbed#TEXT_MAX_LENGTH}.</li> <li>If the length of {@code iconUrl} is longer than {@link net.dv8tion.jda.core.entities.MessageEmbed#URL_MAX_LENGTH}.</li> <li>If the provided {@code iconUrl} is not a properly formatted http or https url.</li> </ul> @return the builder after the footer has been set
[ "Sets", "the", "Footer", "of", "the", "embed", "." ]
train
https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/EmbedBuilder.java#L660-L675
haraldk/TwelveMonkeys
sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/HttpURLConnection.java
HttpURLConnection.writeRequestHeaders
private static void writeRequestHeaders(OutputStream pOut, URL pURL, String pMethod, Properties pProps, boolean pUsingProxy, PasswordAuthentication pAuth, String pAuthType) { PrintWriter out = new PrintWriter(pOut, true); // autoFlush if (!pUsingProxy) { out.println(pMethod + " " + (!StringUtil.isEmpty(pURL.getPath()) ? pURL.getPath() : "/") + ((pURL.getQuery() != null) ? "?" + pURL.getQuery() : "") + " HTTP/1.1"); // HTTP/1.1 // out.println("Connection: close"); // No persistent connections yet /* System.err.println(pMethod + " " + (!StringUtil.isEmpty(pURL.getPath()) ? pURL.getPath() : "/") + (pURL.getQuery() != null ? "?" + pURL.getQuery() : "") + " HTTP/1.1"); // HTTP/1.1 */ // Authority (Host: HTTP/1.1 field, but seems to work for HTTP/1.0) out.println("Host: " + pURL.getHost() + ((pURL.getPort() != -1) ? ":" + pURL.getPort() : "")); /* System.err.println("Host: " + pURL.getHost() + (pURL.getPort() != -1 ? ":" + pURL.getPort() : "")); */ } else { ////-- PROXY (absolute) VERSION out.println(pMethod + " " + pURL.getProtocol() + "://" + pURL.getHost() + ((pURL.getPort() != -1) ? ":" + pURL.getPort() : "") + pURL.getPath() + ((pURL.getQuery() != null) ? "?" + pURL.getQuery() : "") + " HTTP/1.1"); } // Check if we have authentication if (pAuth != null) { // If found, set Authorization header byte[] userPass = (pAuth.getUserName() + ":" + new String(pAuth.getPassword())).getBytes(); // "Authorization" ":" credentials out.println("Authorization: " + pAuthType + " " + BASE64.encode(userPass)); /* System.err.println("Authorization: " + pAuthType + " " + BASE64.encode(userPass)); */ } // Iterate over properties for (Map.Entry<Object, Object> property : pProps.entrySet()) { out.println(property.getKey() + ": " + property.getValue()); //System.err.println(property.getKey() + ": " + property.getValue()); } out.println(); // Empty line, marks end of request-header }
java
private static void writeRequestHeaders(OutputStream pOut, URL pURL, String pMethod, Properties pProps, boolean pUsingProxy, PasswordAuthentication pAuth, String pAuthType) { PrintWriter out = new PrintWriter(pOut, true); // autoFlush if (!pUsingProxy) { out.println(pMethod + " " + (!StringUtil.isEmpty(pURL.getPath()) ? pURL.getPath() : "/") + ((pURL.getQuery() != null) ? "?" + pURL.getQuery() : "") + " HTTP/1.1"); // HTTP/1.1 // out.println("Connection: close"); // No persistent connections yet /* System.err.println(pMethod + " " + (!StringUtil.isEmpty(pURL.getPath()) ? pURL.getPath() : "/") + (pURL.getQuery() != null ? "?" + pURL.getQuery() : "") + " HTTP/1.1"); // HTTP/1.1 */ // Authority (Host: HTTP/1.1 field, but seems to work for HTTP/1.0) out.println("Host: " + pURL.getHost() + ((pURL.getPort() != -1) ? ":" + pURL.getPort() : "")); /* System.err.println("Host: " + pURL.getHost() + (pURL.getPort() != -1 ? ":" + pURL.getPort() : "")); */ } else { ////-- PROXY (absolute) VERSION out.println(pMethod + " " + pURL.getProtocol() + "://" + pURL.getHost() + ((pURL.getPort() != -1) ? ":" + pURL.getPort() : "") + pURL.getPath() + ((pURL.getQuery() != null) ? "?" + pURL.getQuery() : "") + " HTTP/1.1"); } // Check if we have authentication if (pAuth != null) { // If found, set Authorization header byte[] userPass = (pAuth.getUserName() + ":" + new String(pAuth.getPassword())).getBytes(); // "Authorization" ":" credentials out.println("Authorization: " + pAuthType + " " + BASE64.encode(userPass)); /* System.err.println("Authorization: " + pAuthType + " " + BASE64.encode(userPass)); */ } // Iterate over properties for (Map.Entry<Object, Object> property : pProps.entrySet()) { out.println(property.getKey() + ": " + property.getValue()); //System.err.println(property.getKey() + ": " + property.getValue()); } out.println(); // Empty line, marks end of request-header }
[ "private", "static", "void", "writeRequestHeaders", "(", "OutputStream", "pOut", ",", "URL", "pURL", ",", "String", "pMethod", ",", "Properties", "pProps", ",", "boolean", "pUsingProxy", ",", "PasswordAuthentication", "pAuth", ",", "String", "pAuthType", ")", "{",...
Writes the HTTP request headers, for HTTP GET method. @see <A href="http://www.w3.org/Protocols/rfc2616/rfc2616.html">RFC 2616</A>
[ "Writes", "the", "HTTP", "request", "headers", "for", "HTTP", "GET", "method", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/HttpURLConnection.java#L681-L744
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CompoundTransliterator.java
CompoundTransliterator._smartAppend
private static void _smartAppend(StringBuilder buf, char c) { if (buf.length() != 0 && buf.charAt(buf.length() - 1) != c) { buf.append(c); } }
java
private static void _smartAppend(StringBuilder buf, char c) { if (buf.length() != 0 && buf.charAt(buf.length() - 1) != c) { buf.append(c); } }
[ "private", "static", "void", "_smartAppend", "(", "StringBuilder", "buf", ",", "char", "c", ")", "{", "if", "(", "buf", ".", "length", "(", ")", "!=", "0", "&&", "buf", ".", "charAt", "(", "buf", ".", "length", "(", ")", "-", "1", ")", "!=", "c",...
Append c to buf, unless buf is empty or buf already ends in c.
[ "Append", "c", "to", "buf", "unless", "buf", "is", "empty", "or", "buf", "already", "ends", "in", "c", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CompoundTransliterator.java#L250-L255
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/ch/Subtypes2.java
Subtypes2.getFirstCommonSuperclass
public ObjectType getFirstCommonSuperclass(ObjectType a, ObjectType b) throws ClassNotFoundException { // Easy case if (a.equals(b)) { return a; } ObjectType firstCommonSupertype = (ObjectType) checkFirstCommonSuperclassQueryCache(a, b); if (firstCommonSupertype == null) { firstCommonSupertype = computeFirstCommonSuperclassOfObjectTypes(a, b); firstCommonSuperclassQueryCache.put(a, b, firstCommonSupertype); } return firstCommonSupertype; }
java
public ObjectType getFirstCommonSuperclass(ObjectType a, ObjectType b) throws ClassNotFoundException { // Easy case if (a.equals(b)) { return a; } ObjectType firstCommonSupertype = (ObjectType) checkFirstCommonSuperclassQueryCache(a, b); if (firstCommonSupertype == null) { firstCommonSupertype = computeFirstCommonSuperclassOfObjectTypes(a, b); firstCommonSuperclassQueryCache.put(a, b, firstCommonSupertype); } return firstCommonSupertype; }
[ "public", "ObjectType", "getFirstCommonSuperclass", "(", "ObjectType", "a", ",", "ObjectType", "b", ")", "throws", "ClassNotFoundException", "{", "// Easy case", "if", "(", "a", ".", "equals", "(", "b", ")", ")", "{", "return", "a", ";", "}", "ObjectType", "...
Get the first common superclass of the given object types. Note that an interface type is never returned unless <code>a</code> and <code>b</code> are the same type. Otherwise, we try to return as accurate a type as possible. This method is used as the meet operator in TypeDataflowAnalysis, and is intended to follow (more or less) the JVM bytecode verifier semantics. <p> This method should be used in preference to the getFirstCommonSuperclass() method in {@link ReferenceType}. </p> @param a an ObjectType @param b another ObjectType @return the first common superclass of <code>a</code> and <code>b</code> @throws ClassNotFoundException
[ "Get", "the", "first", "common", "superclass", "of", "the", "given", "object", "types", ".", "Note", "that", "an", "interface", "type", "is", "never", "returned", "unless", "<code", ">", "a<", "/", "code", ">", "and", "<code", ">", "b<", "/", "code", "...
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/ch/Subtypes2.java#L702-L715
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/PersistentTimerTaskHandler.java
PersistentTimerTaskHandler.serializeObject
private static byte[] serializeObject(Object obj) { if (obj == null) { return null; } ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { ObjectOutputStream out = new ObjectOutputStream(baos); out.writeObject(obj); out.flush(); } catch (IOException ioex) { throw new EJBException("Timer info object failed to serialize.", ioex); } return baos.toByteArray(); }
java
private static byte[] serializeObject(Object obj) { if (obj == null) { return null; } ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { ObjectOutputStream out = new ObjectOutputStream(baos); out.writeObject(obj); out.flush(); } catch (IOException ioex) { throw new EJBException("Timer info object failed to serialize.", ioex); } return baos.toByteArray(); }
[ "private", "static", "byte", "[", "]", "serializeObject", "(", "Object", "obj", ")", "{", "if", "(", "obj", "==", "null", ")", "{", "return", "null", ";", "}", "ByteArrayOutputStream", "baos", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "try", "{...
Internal convenience method for serializing the user info object to a byte array.
[ "Internal", "convenience", "method", "for", "serializing", "the", "user", "info", "object", "to", "a", "byte", "array", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/PersistentTimerTaskHandler.java#L768-L784
woo-j/OkapiBarcode
src/main/java/uk/org/okapibarcode/backend/MaxiCode.java
MaxiCode.bestSurroundingSet
private int bestSurroundingSet(int index, int length, int... valid) { int option1 = set[index - 1]; if (index + 1 < length) { // we have two options to check int option2 = set[index + 1]; if (contains(valid, option1) && contains(valid, option2)) { return Math.min(option1, option2); } else if (contains(valid, option1)) { return option1; } else if (contains(valid, option2)) { return option2; } else { return valid[0]; } } else { // we only have one option to check if (contains(valid, option1)) { return option1; } else { return valid[0]; } } }
java
private int bestSurroundingSet(int index, int length, int... valid) { int option1 = set[index - 1]; if (index + 1 < length) { // we have two options to check int option2 = set[index + 1]; if (contains(valid, option1) && contains(valid, option2)) { return Math.min(option1, option2); } else if (contains(valid, option1)) { return option1; } else if (contains(valid, option2)) { return option2; } else { return valid[0]; } } else { // we only have one option to check if (contains(valid, option1)) { return option1; } else { return valid[0]; } } }
[ "private", "int", "bestSurroundingSet", "(", "int", "index", ",", "int", "length", ",", "int", "...", "valid", ")", "{", "int", "option1", "=", "set", "[", "index", "-", "1", "]", ";", "if", "(", "index", "+", "1", "<", "length", ")", "{", "// we h...
Guesses the best set to use at the specified index by looking at the surrounding sets. In general, characters in lower-numbered sets are more common, so we choose them if we can. If no good surrounding sets can be found, the default value returned is the first value from the valid set. @param index the current index @param length the maximum length to look at @param valid the valid sets for this index @return the best set to use at the specified index
[ "Guesses", "the", "best", "set", "to", "use", "at", "the", "specified", "index", "by", "looking", "at", "the", "surrounding", "sets", ".", "In", "general", "characters", "in", "lower", "-", "numbered", "sets", "are", "more", "common", "so", "we", "choose",...
train
https://github.com/woo-j/OkapiBarcode/blob/d1cb4f4ab64557cd3db64d9a473528a52ce58081/src/main/java/uk/org/okapibarcode/backend/MaxiCode.java#L828-L850
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/core/Parser.java
Parser.parseInsertKeyword
public static boolean parseInsertKeyword(final char[] query, int offset) { if (query.length < (offset + 7)) { return false; } return (query[offset] | 32) == 'i' && (query[offset + 1] | 32) == 'n' && (query[offset + 2] | 32) == 's' && (query[offset + 3] | 32) == 'e' && (query[offset + 4] | 32) == 'r' && (query[offset + 5] | 32) == 't'; }
java
public static boolean parseInsertKeyword(final char[] query, int offset) { if (query.length < (offset + 7)) { return false; } return (query[offset] | 32) == 'i' && (query[offset + 1] | 32) == 'n' && (query[offset + 2] | 32) == 's' && (query[offset + 3] | 32) == 'e' && (query[offset + 4] | 32) == 'r' && (query[offset + 5] | 32) == 't'; }
[ "public", "static", "boolean", "parseInsertKeyword", "(", "final", "char", "[", "]", "query", ",", "int", "offset", ")", "{", "if", "(", "query", ".", "length", "<", "(", "offset", "+", "7", ")", ")", "{", "return", "false", ";", "}", "return", "(", ...
Parse string to check presence of INSERT keyword regardless of case. @param query char[] of the query statement @param offset position of query to start checking @return boolean indicates presence of word
[ "Parse", "string", "to", "check", "presence", "of", "INSERT", "keyword", "regardless", "of", "case", "." ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/core/Parser.java#L582-L593