repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
haraldk/TwelveMonkeys
sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/DebugUtil.java
DebugUtil.printTimeDifference
public static void printTimeDifference(final TimeDifference pTimeDifference, final PrintStream pPrintStream) { printTimeDifference(pTimeDifference.getStartCalendar(), pTimeDifference.getEndCalendar(), pPrintStream); }
java
public static void printTimeDifference(final TimeDifference pTimeDifference, final PrintStream pPrintStream) { printTimeDifference(pTimeDifference.getStartCalendar(), pTimeDifference.getEndCalendar(), pPrintStream); }
[ "public", "static", "void", "printTimeDifference", "(", "final", "TimeDifference", "pTimeDifference", ",", "final", "PrintStream", "pPrintStream", ")", "{", "printTimeDifference", "(", "pTimeDifference", ".", "getStartCalendar", "(", ")", ",", "pTimeDifference", ".", ...
Prints out a {@code com.iml.oslo.eito.util.DebugUtil.TimeDifference} object. <p> @param pTimeDifference the {@code com.twelvemonkeys.util.DebugUtil.TimeDifference} to investigate. @param pPrintStream the {@code java.io.PrintStream} for flushing the results.
[ "Prints", "out", "a", "{" ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/DebugUtil.java#L1090-L1092
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java
PlanNode.findAllAtOrBelow
public List<PlanNode> findAllAtOrBelow( Set<Type> typesToFind ) { return findAllAtOrBelow(Traversal.PRE_ORDER, typesToFind); }
java
public List<PlanNode> findAllAtOrBelow( Set<Type> typesToFind ) { return findAllAtOrBelow(Traversal.PRE_ORDER, typesToFind); }
[ "public", "List", "<", "PlanNode", ">", "findAllAtOrBelow", "(", "Set", "<", "Type", ">", "typesToFind", ")", "{", "return", "findAllAtOrBelow", "(", "Traversal", ".", "PRE_ORDER", ",", "typesToFind", ")", ";", "}" ]
Find all of the nodes with one of the specified types that are at or below this node. @param typesToFind the types of node to find; may not be null @return the collection of nodes that are at or below this node that all have one of the supplied types; never null but possibly empty
[ "Find", "all", "of", "the", "nodes", "with", "one", "of", "the", "specified", "types", "that", "are", "at", "or", "below", "this", "node", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java#L1373-L1375
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java
TrainingsImpl.createImagesFromDataWithServiceResponseAsync
public Observable<ServiceResponse<ImageCreateSummary>> createImagesFromDataWithServiceResponseAsync(UUID projectId, byte[] imageData, CreateImagesFromDataOptionalParameter createImagesFromDataOptionalParameter) { if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (imageData == null) { throw new IllegalArgumentException("Parameter imageData is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } final List<String> tagIds = createImagesFromDataOptionalParameter != null ? createImagesFromDataOptionalParameter.tagIds() : null; return createImagesFromDataWithServiceResponseAsync(projectId, imageData, tagIds); }
java
public Observable<ServiceResponse<ImageCreateSummary>> createImagesFromDataWithServiceResponseAsync(UUID projectId, byte[] imageData, CreateImagesFromDataOptionalParameter createImagesFromDataOptionalParameter) { if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (imageData == null) { throw new IllegalArgumentException("Parameter imageData is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } final List<String> tagIds = createImagesFromDataOptionalParameter != null ? createImagesFromDataOptionalParameter.tagIds() : null; return createImagesFromDataWithServiceResponseAsync(projectId, imageData, tagIds); }
[ "public", "Observable", "<", "ServiceResponse", "<", "ImageCreateSummary", ">", ">", "createImagesFromDataWithServiceResponseAsync", "(", "UUID", "projectId", ",", "byte", "[", "]", "imageData", ",", "CreateImagesFromDataOptionalParameter", "createImagesFromDataOptionalParamete...
Add the provided images to the set of training images. This API accepts body content as multipart/form-data and application/octet-stream. When using multipart multiple image files can be sent at once, with a maximum of 64 files. @param projectId The project id @param imageData the InputStream value @param createImagesFromDataOptionalParameter 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 ImageCreateSummary object
[ "Add", "the", "provided", "images", "to", "the", "set", "of", "training", "images", ".", "This", "API", "accepts", "body", "content", "as", "multipart", "/", "form", "-", "data", "and", "application", "/", "octet", "-", "stream", ".", "When", "using", "m...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L4154-L4167
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java
Http2ConnectionHandler.exceptionCaught
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { if (getEmbeddedHttp2Exception(cause) != null) { // Some exception in the causality chain is an Http2Exception - handle it. onError(ctx, false, cause); } else { super.exceptionCaught(ctx, cause); } }
java
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { if (getEmbeddedHttp2Exception(cause) != null) { // Some exception in the causality chain is an Http2Exception - handle it. onError(ctx, false, cause); } else { super.exceptionCaught(ctx, cause); } }
[ "@", "Override", "public", "void", "exceptionCaught", "(", "ChannelHandlerContext", "ctx", ",", "Throwable", "cause", ")", "throws", "Exception", "{", "if", "(", "getEmbeddedHttp2Exception", "(", "cause", ")", "!=", "null", ")", "{", "// Some exception in the causal...
Handles {@link Http2Exception} objects that were thrown from other handlers. Ignores all other exceptions.
[ "Handles", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java#L553-L561
alkacon/opencms-core
src-gwt/org/opencms/ade/publish/client/CmsPublishDialog.java
CmsPublishDialog.showPublishDialog
public static void showPublishDialog( CmsPublishData result, CloseHandler<PopupPanel> handler, Runnable refreshAction, I_CmsContentEditorHandler editorHandler) { CmsPublishDialog publishDialog = new CmsPublishDialog(result, refreshAction, editorHandler); if (handler != null) { publishDialog.addCloseHandler(handler); } publishDialog.centerHorizontally(50); // replace current notification widget by overlay publishDialog.catchNotifications(); }
java
public static void showPublishDialog( CmsPublishData result, CloseHandler<PopupPanel> handler, Runnable refreshAction, I_CmsContentEditorHandler editorHandler) { CmsPublishDialog publishDialog = new CmsPublishDialog(result, refreshAction, editorHandler); if (handler != null) { publishDialog.addCloseHandler(handler); } publishDialog.centerHorizontally(50); // replace current notification widget by overlay publishDialog.catchNotifications(); }
[ "public", "static", "void", "showPublishDialog", "(", "CmsPublishData", "result", ",", "CloseHandler", "<", "PopupPanel", ">", "handler", ",", "Runnable", "refreshAction", ",", "I_CmsContentEditorHandler", "editorHandler", ")", "{", "CmsPublishDialog", "publishDialog", ...
Shows the publish dialog.<p> @param result the publish data @param handler the dialog close handler (may be null) @param refreshAction the action to execute on a context menu triggered refresh @param editorHandler the content editor handler (may be null)
[ "Shows", "the", "publish", "dialog", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/publish/client/CmsPublishDialog.java#L291-L304
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/Project.java
Project.addWorkingDir
public boolean addWorkingDir(String dirName) { if (dirName == null) { throw new NullPointerException(); } return addToListInternal(currentWorkingDirectoryList, new File(dirName)); }
java
public boolean addWorkingDir(String dirName) { if (dirName == null) { throw new NullPointerException(); } return addToListInternal(currentWorkingDirectoryList, new File(dirName)); }
[ "public", "boolean", "addWorkingDir", "(", "String", "dirName", ")", "{", "if", "(", "dirName", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";", "}", "return", "addToListInternal", "(", "currentWorkingDirectoryList", ",", "new", "...
Add a working directory to the project. @param dirName the directory to add @return true if the working directory was added, or false if the working directory was already present
[ "Add", "a", "working", "directory", "to", "the", "project", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/Project.java#L292-L297
Falydoor/limesurvey-rc
src/main/java/com/github/falydoor/limesurveyrc/LimesurveyRC.java
LimesurveyRC.getGroups
public Stream<LsQuestionGroup> getGroups(int surveyId) throws LimesurveyRCException { JsonElement result = callRC(new LsApiBody("list_groups", getParamsWithKey(surveyId))); List<LsQuestionGroup> questionGroups = gson.fromJson(result, new TypeToken<List<LsQuestionGroup>>() { }.getType()); return questionGroups.stream().sorted(Comparator.comparing(LsQuestionGroup::getOrder)); }
java
public Stream<LsQuestionGroup> getGroups(int surveyId) throws LimesurveyRCException { JsonElement result = callRC(new LsApiBody("list_groups", getParamsWithKey(surveyId))); List<LsQuestionGroup> questionGroups = gson.fromJson(result, new TypeToken<List<LsQuestionGroup>>() { }.getType()); return questionGroups.stream().sorted(Comparator.comparing(LsQuestionGroup::getOrder)); }
[ "public", "Stream", "<", "LsQuestionGroup", ">", "getGroups", "(", "int", "surveyId", ")", "throws", "LimesurveyRCException", "{", "JsonElement", "result", "=", "callRC", "(", "new", "LsApiBody", "(", "\"list_groups\"", ",", "getParamsWithKey", "(", "surveyId", ")...
Gets groups from a survey. The groups are ordered using the "group_order" field. @param surveyId the survey id you want to get the groups @return a stream of groups in an ordered order @throws LimesurveyRCException the limesurvey rc exception
[ "Gets", "groups", "from", "a", "survey", ".", "The", "groups", "are", "ordered", "using", "the", "group_order", "field", "." ]
train
https://github.com/Falydoor/limesurvey-rc/blob/b8d573389086395e46a0bdeeddeef4d1c2c0a488/src/main/java/com/github/falydoor/limesurveyrc/LimesurveyRC.java#L255-L261
neoremind/fluent-validator
fluent-validator/src/main/java/com/baidu/unbiz/fluentvalidator/AnnotationValidatorCache.java
AnnotationValidatorCache.addByClass
private static void addByClass(Registry registry, Class<?> clazz) { try { if (CLASS_2_ANNOTATION_VALIDATOR_MAP.contains(clazz)) { return; } List<AnnotationValidator> annotationValidators = getAllAnnotationValidators(registry, clazz); if (CollectionUtil.isEmpty(annotationValidators)) { LOGGER.debug(String.format("Annotation-based validation enabled for %s, and to-do validators are empty", clazz.getSimpleName())); } else { CLASS_2_ANNOTATION_VALIDATOR_MAP.putIfAbsent(clazz, annotationValidators); LOGGER.debug( String.format("Annotation-based validation added for %s, and to-do validators are %s", clazz .getSimpleName(), annotationValidators)); } } catch (Exception e) { LOGGER.error("Failed to add annotation validators " + e.getMessage(), e); } }
java
private static void addByClass(Registry registry, Class<?> clazz) { try { if (CLASS_2_ANNOTATION_VALIDATOR_MAP.contains(clazz)) { return; } List<AnnotationValidator> annotationValidators = getAllAnnotationValidators(registry, clazz); if (CollectionUtil.isEmpty(annotationValidators)) { LOGGER.debug(String.format("Annotation-based validation enabled for %s, and to-do validators are empty", clazz.getSimpleName())); } else { CLASS_2_ANNOTATION_VALIDATOR_MAP.putIfAbsent(clazz, annotationValidators); LOGGER.debug( String.format("Annotation-based validation added for %s, and to-do validators are %s", clazz .getSimpleName(), annotationValidators)); } } catch (Exception e) { LOGGER.error("Failed to add annotation validators " + e.getMessage(), e); } }
[ "private", "static", "void", "addByClass", "(", "Registry", "registry", ",", "Class", "<", "?", ">", "clazz", ")", "{", "try", "{", "if", "(", "CLASS_2_ANNOTATION_VALIDATOR_MAP", ".", "contains", "(", "clazz", ")", ")", "{", "return", ";", "}", "List", "...
为某个类添加所有待验证属性的<code>AnnotationValidator</code>到<code>CLASS_2_ANNOTATION_VALIDATOR_MAP</code>中 <p/> 流程如下: <ul> <li>1. 如果<code>CLASS_2_ANNOTATION_VALIDATOR_MAP</code>已缓存了类对应的验证器,则直接退出</li> <li>2. 寻找类中所有装饰有{@link FluentValidate}注解的属性,遍历之。</li> <li>3. 取出{@link FluentValidate}注解中的值,包含所有验证器的类定义。</li> <li>4. 遍历所有的验证器类定义,如果验证器类不是实现了<code>Validator</code>接口跳过。</li> <li>5. <code>VALIDATOR_MAP</code>中如果已经存在了改验证器类对应的实例,则跳过,如果没有就尝试从<code>Registry</code >中查询实例对象,一般情况下当前线程classLoader下只有一个实例,当使用Spring等IoC容器的时候会出现多个,则取第一个,放入 <code>validatorsMap</code>中。 </li> <li>6. 组装<code>AnnotationValidator</code>,放到<code>CLASS_2_ANNOTATION_VALIDATOR_MAP</code>缓存住。</li> </ul> @param registry 验证器对象寻找注册器 @param clazz 待验证类定义
[ "为某个类添加所有待验证属性的<code", ">", "AnnotationValidator<", "/", "code", ">", "到<code", ">", "CLASS_2_ANNOTATION_VALIDATOR_MAP<", "/", "code", ">", "中", "<p", "/", ">", "流程如下:", "<ul", ">", "<li", ">", "1", ".", "如果<code", ">", "CLASS_2_ANNOTATION_VALIDATOR_MAP<", "/", ...
train
https://github.com/neoremind/fluent-validator/blob/b516970591aa9468b44ba63938b98ec341fd6ead/fluent-validator/src/main/java/com/baidu/unbiz/fluentvalidator/AnnotationValidatorCache.java#L75-L94
santhosh-tekuri/jlibs
core/src/main/java/jlibs/core/lang/StringUtil.java
StringUtil.getTokens
public static String[] getTokens(String str, String delim, boolean trim){ StringTokenizer stok = new StringTokenizer(str, delim); String tokens[] = new String[stok.countTokens()]; for(int i=0; i<tokens.length; i++){ tokens[i] = stok.nextToken(); if(trim) tokens[i] = tokens[i].trim(); } return tokens; }
java
public static String[] getTokens(String str, String delim, boolean trim){ StringTokenizer stok = new StringTokenizer(str, delim); String tokens[] = new String[stok.countTokens()]; for(int i=0; i<tokens.length; i++){ tokens[i] = stok.nextToken(); if(trim) tokens[i] = tokens[i].trim(); } return tokens; }
[ "public", "static", "String", "[", "]", "getTokens", "(", "String", "str", ",", "String", "delim", ",", "boolean", "trim", ")", "{", "StringTokenizer", "stok", "=", "new", "StringTokenizer", "(", "str", ",", "delim", ")", ";", "String", "tokens", "[", "]...
Splits given string into tokens with delimiters specified. It uses StringTokenizer for tokenizing. @param str string to be tokenized @param delim delimiters used for tokenizing @param trim trim the tokens @return non-null token array
[ "Splits", "given", "string", "into", "tokens", "with", "delimiters", "specified", ".", "It", "uses", "StringTokenizer", "for", "tokenizing", "." ]
train
https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/core/src/main/java/jlibs/core/lang/StringUtil.java#L79-L88
aws/aws-cloudtrail-processing-library
src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/manager/S3Manager.java
S3Manager.getObject
public S3Object getObject(String bucketName, String objectKey) { try { return s3Client.getObject(bucketName, objectKey); } catch (AmazonServiceException e) { logger.error("Failed to get object " + objectKey + " from s3 bucket " + bucketName); throw e; } }
java
public S3Object getObject(String bucketName, String objectKey) { try { return s3Client.getObject(bucketName, objectKey); } catch (AmazonServiceException e) { logger.error("Failed to get object " + objectKey + " from s3 bucket " + bucketName); throw e; } }
[ "public", "S3Object", "getObject", "(", "String", "bucketName", ",", "String", "objectKey", ")", "{", "try", "{", "return", "s3Client", ".", "getObject", "(", "bucketName", ",", "objectKey", ")", ";", "}", "catch", "(", "AmazonServiceException", "e", ")", "{...
Download an S3 object. @param bucketName The S3 bucket name from which to download the object. @param objectKey The S3 key name of the object to download. @return The downloaded <a href="http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/s3/model/S3Object.html">S3Object</a>.
[ "Download", "an", "S3", "object", "." ]
train
https://github.com/aws/aws-cloudtrail-processing-library/blob/411315808d8d3dc6b45e4182212e3e04d82e3782/src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/manager/S3Manager.java#L110-L117
vnesek/nmote-iim4j
src/main/java/com/nmote/iim4j/IIMFile.java
IIMFile.validate
public Set<ConstraintViolation> validate(DataSetInfo info) { Set<ConstraintViolation> errors = new LinkedHashSet<ConstraintViolation>(); try { if (info.isMandatory() && get(info.getDataSetNumber()) == null) { errors.add(new ConstraintViolation(info, ConstraintViolation.MANDATORY_MISSING)); } if (!info.isRepeatable() && getAll(info.getDataSetNumber()).size() > 1) { errors.add(new ConstraintViolation(info, ConstraintViolation.REPEATABLE_REPEATED)); } } catch (SerializationException e) { errors.add(new ConstraintViolation(info, ConstraintViolation.INVALID_VALUE)); } return errors; }
java
public Set<ConstraintViolation> validate(DataSetInfo info) { Set<ConstraintViolation> errors = new LinkedHashSet<ConstraintViolation>(); try { if (info.isMandatory() && get(info.getDataSetNumber()) == null) { errors.add(new ConstraintViolation(info, ConstraintViolation.MANDATORY_MISSING)); } if (!info.isRepeatable() && getAll(info.getDataSetNumber()).size() > 1) { errors.add(new ConstraintViolation(info, ConstraintViolation.REPEATABLE_REPEATED)); } } catch (SerializationException e) { errors.add(new ConstraintViolation(info, ConstraintViolation.INVALID_VALUE)); } return errors; }
[ "public", "Set", "<", "ConstraintViolation", ">", "validate", "(", "DataSetInfo", "info", ")", "{", "Set", "<", "ConstraintViolation", ">", "errors", "=", "new", "LinkedHashSet", "<", "ConstraintViolation", ">", "(", ")", ";", "try", "{", "if", "(", "info", ...
Checks if data set is mandatory but missing or non repeatable but having multiple values in this IIM instance. @param info IIM data set to check @return list of constraint violations, empty set if data set is valid
[ "Checks", "if", "data", "set", "is", "mandatory", "but", "missing", "or", "non", "repeatable", "but", "having", "multiple", "values", "in", "this", "IIM", "instance", "." ]
train
https://github.com/vnesek/nmote-iim4j/blob/ec55b02fc644cd722e93051ac0bdb96b00cb42a8/src/main/java/com/nmote/iim4j/IIMFile.java#L500-L513
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/cluster/ClusterInstance.java
ClusterInstance.createSlice
synchronized AllocatedSlice createSlice(final InstanceType reqType, final JobID jobID) { // check whether we can accommodate the instance if (remainingCapacity.getNumberOfComputeUnits() >= reqType.getNumberOfComputeUnits() && remainingCapacity.getNumberOfCores() >= reqType.getNumberOfCores() && remainingCapacity.getMemorySize() >= reqType.getMemorySize() && remainingCapacity.getDiskCapacity() >= reqType.getDiskCapacity()) { // reduce available capacity by what has been requested remainingCapacity = InstanceTypeFactory.construct(remainingCapacity.getIdentifier(), remainingCapacity .getNumberOfComputeUnits() - reqType.getNumberOfComputeUnits(), remainingCapacity.getNumberOfCores() - reqType.getNumberOfCores(), remainingCapacity.getMemorySize() - reqType.getMemorySize(), remainingCapacity.getDiskCapacity() - reqType.getDiskCapacity(), remainingCapacity.getPricePerHour()); final long allocationTime = System.currentTimeMillis(); final AllocatedSlice slice = new AllocatedSlice(this, reqType, jobID, allocationTime); this.allocatedSlices.put(slice.getAllocationID(), slice); return slice; } // we cannot accommodate the instance return null; }
java
synchronized AllocatedSlice createSlice(final InstanceType reqType, final JobID jobID) { // check whether we can accommodate the instance if (remainingCapacity.getNumberOfComputeUnits() >= reqType.getNumberOfComputeUnits() && remainingCapacity.getNumberOfCores() >= reqType.getNumberOfCores() && remainingCapacity.getMemorySize() >= reqType.getMemorySize() && remainingCapacity.getDiskCapacity() >= reqType.getDiskCapacity()) { // reduce available capacity by what has been requested remainingCapacity = InstanceTypeFactory.construct(remainingCapacity.getIdentifier(), remainingCapacity .getNumberOfComputeUnits() - reqType.getNumberOfComputeUnits(), remainingCapacity.getNumberOfCores() - reqType.getNumberOfCores(), remainingCapacity.getMemorySize() - reqType.getMemorySize(), remainingCapacity.getDiskCapacity() - reqType.getDiskCapacity(), remainingCapacity.getPricePerHour()); final long allocationTime = System.currentTimeMillis(); final AllocatedSlice slice = new AllocatedSlice(this, reqType, jobID, allocationTime); this.allocatedSlices.put(slice.getAllocationID(), slice); return slice; } // we cannot accommodate the instance return null; }
[ "synchronized", "AllocatedSlice", "createSlice", "(", "final", "InstanceType", "reqType", ",", "final", "JobID", "jobID", ")", "{", "// check whether we can accommodate the instance", "if", "(", "remainingCapacity", ".", "getNumberOfComputeUnits", "(", ")", ">=", "reqType...
Tries to create a new slice on this instance. @param reqType the type describing the hardware characteristics of the slice @param jobID the ID of the job the new slice belongs to @return a new {@AllocatedSlice} object if a slice with the given hardware characteristics could still be accommodated on this instance or <code>null</code> if the instance's remaining resources were insufficient to host the desired slice
[ "Tries", "to", "create", "a", "new", "slice", "on", "this", "instance", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/cluster/ClusterInstance.java#L113-L137
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java
DataStream.writeAsCsv
@PublicEvolving public DataStreamSink<T> writeAsCsv(String path, WriteMode writeMode) { return writeAsCsv(path, writeMode, CsvOutputFormat.DEFAULT_LINE_DELIMITER, CsvOutputFormat.DEFAULT_FIELD_DELIMITER); }
java
@PublicEvolving public DataStreamSink<T> writeAsCsv(String path, WriteMode writeMode) { return writeAsCsv(path, writeMode, CsvOutputFormat.DEFAULT_LINE_DELIMITER, CsvOutputFormat.DEFAULT_FIELD_DELIMITER); }
[ "@", "PublicEvolving", "public", "DataStreamSink", "<", "T", ">", "writeAsCsv", "(", "String", "path", ",", "WriteMode", "writeMode", ")", "{", "return", "writeAsCsv", "(", "path", ",", "writeMode", ",", "CsvOutputFormat", ".", "DEFAULT_LINE_DELIMITER", ",", "Cs...
Writes a DataStream to the file specified by the path parameter. <p>For every field of an element of the DataStream the result of {@link Object#toString()} is written. This method can only be used on data streams of tuples. @param path the path pointing to the location the text file is written to @param writeMode Controls the behavior for existing files. Options are NO_OVERWRITE and OVERWRITE. @return the closed DataStream
[ "Writes", "a", "DataStream", "to", "the", "file", "specified", "by", "the", "path", "parameter", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java#L1080-L1083
graphhopper/graphhopper
core/src/main/java/com/graphhopper/routing/Path.java
Path.calcPoints
public PointList calcPoints() { final PointList points = new PointList(edgeIds.size() + 1, nodeAccess.is3D()); if (edgeIds.isEmpty()) { if (isFound()) { points.add(graph.getNodeAccess(), endNode); } return points; } int tmpNode = getFromNode(); points.add(nodeAccess, tmpNode); forEveryEdge(new EdgeVisitor() { @Override public void next(EdgeIteratorState eb, int index, int prevEdgeId) { PointList pl = eb.fetchWayGeometry(2); for (int j = 0; j < pl.getSize(); j++) { points.add(pl, j); } } @Override public void finish() { } }); return points; }
java
public PointList calcPoints() { final PointList points = new PointList(edgeIds.size() + 1, nodeAccess.is3D()); if (edgeIds.isEmpty()) { if (isFound()) { points.add(graph.getNodeAccess(), endNode); } return points; } int tmpNode = getFromNode(); points.add(nodeAccess, tmpNode); forEveryEdge(new EdgeVisitor() { @Override public void next(EdgeIteratorState eb, int index, int prevEdgeId) { PointList pl = eb.fetchWayGeometry(2); for (int j = 0; j < pl.getSize(); j++) { points.add(pl, j); } } @Override public void finish() { } }); return points; }
[ "public", "PointList", "calcPoints", "(", ")", "{", "final", "PointList", "points", "=", "new", "PointList", "(", "edgeIds", ".", "size", "(", ")", "+", "1", ",", "nodeAccess", ".", "is3D", "(", ")", ")", ";", "if", "(", "edgeIds", ".", "isEmpty", "(...
This method calculated a list of points for this path <p> @return this path its geometry
[ "This", "method", "calculated", "a", "list", "of", "points", "for", "this", "path", "<p", ">" ]
train
https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/routing/Path.java#L331-L357
HanSolo/SteelSeries-Swing
src/main/java/eu/hansolo/steelseries/gauges/AbstractGauge.java
AbstractGauge.create_LED_Image
protected final BufferedImage create_LED_Image(final int SIZE, final int STATE, final LedColor LED_COLOR) { return LED_FACTORY.create_LED_Image(SIZE, STATE, LED_COLOR, model.getCustomLedColor()); }
java
protected final BufferedImage create_LED_Image(final int SIZE, final int STATE, final LedColor LED_COLOR) { return LED_FACTORY.create_LED_Image(SIZE, STATE, LED_COLOR, model.getCustomLedColor()); }
[ "protected", "final", "BufferedImage", "create_LED_Image", "(", "final", "int", "SIZE", ",", "final", "int", "STATE", ",", "final", "LedColor", "LED_COLOR", ")", "{", "return", "LED_FACTORY", ".", "create_LED_Image", "(", "SIZE", ",", "STATE", ",", "LED_COLOR", ...
Returns an image of a led with the given size, state and color. If the LED_COLOR parameter equals CUSTOM the userLedColor will be used to calculate the custom led colors @param SIZE @param STATE @param LED_COLOR @return the led image
[ "Returns", "an", "image", "of", "a", "led", "with", "the", "given", "size", "state", "and", "color", ".", "If", "the", "LED_COLOR", "parameter", "equals", "CUSTOM", "the", "userLedColor", "will", "be", "used", "to", "calculate", "the", "custom", "led", "co...
train
https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/gauges/AbstractGauge.java#L2609-L2611
rzwitserloot/lombok
src/core/lombok/javac/HandlerLibrary.java
HandlerLibrary.javacWarning
public void javacWarning(String message, Throwable t) { messager.printMessage(Diagnostic.Kind.WARNING, message + (t == null ? "" : (": " + t))); }
java
public void javacWarning(String message, Throwable t) { messager.printMessage(Diagnostic.Kind.WARNING, message + (t == null ? "" : (": " + t))); }
[ "public", "void", "javacWarning", "(", "String", "message", ",", "Throwable", "t", ")", "{", "messager", ".", "printMessage", "(", "Diagnostic", ".", "Kind", ".", "WARNING", ",", "message", "+", "(", "t", "==", "null", "?", "\"\"", ":", "(", "\": \"", ...
Generates a warning in the Messager that was used to initialize this HandlerLibrary.
[ "Generates", "a", "warning", "in", "the", "Messager", "that", "was", "used", "to", "initialize", "this", "HandlerLibrary", "." ]
train
https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/HandlerLibrary.java#L208-L210
litsec/eidas-opensaml
opensaml3/src/main/java/se/litsec/eidas/opensaml/ext/attributes/AttributeUtils.java
AttributeUtils.createAttributeValueObject
public static <T extends XMLObject> T createAttributeValueObject(Class<T> clazz) { try { QName schemaType = (QName) clazz.getDeclaredField("TYPE_NAME").get(null); return createAttributeValueObject(schemaType, clazz); } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException | SecurityException e) { throw new RuntimeException(e); } }
java
public static <T extends XMLObject> T createAttributeValueObject(Class<T> clazz) { try { QName schemaType = (QName) clazz.getDeclaredField("TYPE_NAME").get(null); return createAttributeValueObject(schemaType, clazz); } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException | SecurityException e) { throw new RuntimeException(e); } }
[ "public", "static", "<", "T", "extends", "XMLObject", ">", "T", "createAttributeValueObject", "(", "Class", "<", "T", ">", "clazz", ")", "{", "try", "{", "QName", "schemaType", "=", "(", "QName", ")", "clazz", ".", "getDeclaredField", "(", "\"TYPE_NAME\"", ...
Creates an {@code AttributeValue} object of the given class. The type of the attribute value will be the field that is declared as {@code TYPE_NAME} of the given class. <p> After the object has been constructed, its setter methods should be called to setup the value object before adding it to the attribute itself. </p> @param <T> the type @param clazz the type of attribute value @return the attribute value @see #createAttributeValueObject(QName, Class)
[ "Creates", "an", "{", "@code", "AttributeValue", "}", "object", "of", "the", "given", "class", ".", "The", "type", "of", "the", "attribute", "value", "will", "be", "the", "field", "that", "is", "declared", "as", "{", "@code", "TYPE_NAME", "}", "of", "the...
train
https://github.com/litsec/eidas-opensaml/blob/522ba6dba433a9524cb8a02464cc3b087b47a2b7/opensaml3/src/main/java/se/litsec/eidas/opensaml/ext/attributes/AttributeUtils.java#L90-L98
morimekta/utils
console-util/src/main/java/net/morimekta/console/args/ArgumentParser.java
ArgumentParser.printUsage
public void printUsage(OutputStream out, boolean showHidden) { printUsage(new PrintWriter(new OutputStreamWriter(out, UTF_8)), showHidden); }
java
public void printUsage(OutputStream out, boolean showHidden) { printUsage(new PrintWriter(new OutputStreamWriter(out, UTF_8)), showHidden); }
[ "public", "void", "printUsage", "(", "OutputStream", "out", ",", "boolean", "showHidden", ")", "{", "printUsage", "(", "new", "PrintWriter", "(", "new", "OutputStreamWriter", "(", "out", ",", "UTF_8", ")", ")", ",", "showHidden", ")", ";", "}" ]
Print the option usage list. Essentially printed as a list of options with the description indented where it overflows the available line width. @param out The output stream. @param showHidden Whether to show hidden options.
[ "Print", "the", "option", "usage", "list", ".", "Essentially", "printed", "as", "a", "list", "of", "options", "with", "the", "description", "indented", "where", "it", "overflows", "the", "available", "line", "width", "." ]
train
https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/console-util/src/main/java/net/morimekta/console/args/ArgumentParser.java#L400-L402
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/WorkQueueManager.java
WorkQueueManager.processWork
protected VirtualConnection processWork(TCPBaseRequestContext req, int options) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "processWork"); } TCPConnLink conn = req.getTCPConnLink(); VirtualConnection vc = null; if (options != 1) { // initialize the action to false, set to true if we do the allocate if (req.isRequestTypeRead()) { ((TCPReadRequestContextImpl) req).setJITAllocateAction(false); } } if (attemptIO(req, false)) { vc = conn.getVirtualConnection(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "processWork"); } return vc; }
java
protected VirtualConnection processWork(TCPBaseRequestContext req, int options) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "processWork"); } TCPConnLink conn = req.getTCPConnLink(); VirtualConnection vc = null; if (options != 1) { // initialize the action to false, set to true if we do the allocate if (req.isRequestTypeRead()) { ((TCPReadRequestContextImpl) req).setJITAllocateAction(false); } } if (attemptIO(req, false)) { vc = conn.getVirtualConnection(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "processWork"); } return vc; }
[ "protected", "VirtualConnection", "processWork", "(", "TCPBaseRequestContext", "req", ",", "int", "options", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry",...
Processes the request. If the request is already associated with a work queue - send it there. Otherwise round robin requests amongst our set of queues. @param req @param options @return VirtualConnections
[ "Processes", "the", "request", ".", "If", "the", "request", "is", "already", "associated", "with", "a", "work", "queue", "-", "send", "it", "there", ".", "Otherwise", "round", "robin", "requests", "amongst", "our", "set", "of", "queues", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/WorkQueueManager.java#L288-L311
Mozu/mozu-java
mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/catalog/storefront/ProductUrl.java
ProductUrl.getProductUrl
public static MozuUrl getProductUrl(Boolean acceptVariantProductCode, Boolean allowInactive, String productCode, String purchaseLocation, Integer quantity, String responseFields, Boolean skipInventoryCheck, Boolean supressOutOfStock404, String variationProductCode, String variationProductCodeFilter) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/storefront/products/{productCode}?variationProductCode={variationProductCode}&allowInactive={allowInactive}&skipInventoryCheck={skipInventoryCheck}&supressOutOfStock404={supressOutOfStock404}&quantity={quantity}&acceptVariantProductCode={acceptVariantProductCode}&purchaseLocation={purchaseLocation}&variationProductCodeFilter={variationProductCodeFilter}&responseFields={responseFields}"); formatter.formatUrl("acceptVariantProductCode", acceptVariantProductCode); formatter.formatUrl("allowInactive", allowInactive); formatter.formatUrl("productCode", productCode); formatter.formatUrl("purchaseLocation", purchaseLocation); formatter.formatUrl("quantity", quantity); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("skipInventoryCheck", skipInventoryCheck); formatter.formatUrl("supressOutOfStock404", supressOutOfStock404); formatter.formatUrl("variationProductCode", variationProductCode); formatter.formatUrl("variationProductCodeFilter", variationProductCodeFilter); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl getProductUrl(Boolean acceptVariantProductCode, Boolean allowInactive, String productCode, String purchaseLocation, Integer quantity, String responseFields, Boolean skipInventoryCheck, Boolean supressOutOfStock404, String variationProductCode, String variationProductCodeFilter) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/storefront/products/{productCode}?variationProductCode={variationProductCode}&allowInactive={allowInactive}&skipInventoryCheck={skipInventoryCheck}&supressOutOfStock404={supressOutOfStock404}&quantity={quantity}&acceptVariantProductCode={acceptVariantProductCode}&purchaseLocation={purchaseLocation}&variationProductCodeFilter={variationProductCodeFilter}&responseFields={responseFields}"); formatter.formatUrl("acceptVariantProductCode", acceptVariantProductCode); formatter.formatUrl("allowInactive", allowInactive); formatter.formatUrl("productCode", productCode); formatter.formatUrl("purchaseLocation", purchaseLocation); formatter.formatUrl("quantity", quantity); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("skipInventoryCheck", skipInventoryCheck); formatter.formatUrl("supressOutOfStock404", supressOutOfStock404); formatter.formatUrl("variationProductCode", variationProductCode); formatter.formatUrl("variationProductCodeFilter", variationProductCodeFilter); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "getProductUrl", "(", "Boolean", "acceptVariantProductCode", ",", "Boolean", "allowInactive", ",", "String", "productCode", ",", "String", "purchaseLocation", ",", "Integer", "quantity", ",", "String", "responseFields", ",", "Boolean", "...
Get Resource Url for GetProduct @param acceptVariantProductCode Specifies whether to accept a product variant's code as the .When you set this parameter to , you can pass in a product variant's code in the GetProduct call to retrieve the product variant details that are associated with the base product. @param allowInactive If true, allow inactive categories to be retrieved in the category list response. If false, the categories retrieved will not include ones marked inactive. @param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product. @param purchaseLocation The location where the order item(s) was purchased. @param quantity The number of cart items in the shopper's active cart. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @param skipInventoryCheck If true, skip the process to validate inventory when creating this product reservation. @param supressOutOfStock404 Specifies whether to supress the 404 error when the product is out of stock. @param variationProductCode Merchant-created code associated with a specific product variation. Variation product codes maintain an association with the base product code. @param variationProductCodeFilter @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetProduct" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/catalog/storefront/ProductUrl.java#L72-L86
powermock/powermock
powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java
PowerMock.createNiceMock
public static <T> T createNiceMock(Class<T> type, ConstructorArgs constructorArgs, Method... methods) { return doMock(type, false, new NiceMockStrategy(), constructorArgs, methods); }
java
public static <T> T createNiceMock(Class<T> type, ConstructorArgs constructorArgs, Method... methods) { return doMock(type, false, new NiceMockStrategy(), constructorArgs, methods); }
[ "public", "static", "<", "T", ">", "T", "createNiceMock", "(", "Class", "<", "T", ">", "type", ",", "ConstructorArgs", "constructorArgs", ",", "Method", "...", "methods", ")", "{", "return", "doMock", "(", "type", ",", "false", ",", "new", "NiceMockStrateg...
Creates a nice mock object that supports mocking of final and native methods and invokes a specific constructor. @param <T> the type of the mock object @param type the type of the mock object @param constructorArgs The constructor arguments that will be used to invoke a special constructor. @param methods optionally what methods to mock @return the mock object.
[ "Creates", "a", "nice", "mock", "object", "that", "supports", "mocking", "of", "final", "and", "native", "methods", "and", "invokes", "a", "specific", "constructor", "." ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java#L205-L207
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/api/Table.java
Table.replaceColumn
public Table replaceColumn(final String columnName, final Column<?> newColumn) { int colIndex = columnIndex(columnName); return replaceColumn(colIndex, newColumn); }
java
public Table replaceColumn(final String columnName, final Column<?> newColumn) { int colIndex = columnIndex(columnName); return replaceColumn(colIndex, newColumn); }
[ "public", "Table", "replaceColumn", "(", "final", "String", "columnName", ",", "final", "Column", "<", "?", ">", "newColumn", ")", "{", "int", "colIndex", "=", "columnIndex", "(", "columnName", ")", ";", "return", "replaceColumn", "(", "colIndex", ",", "newC...
Replaces an existing column (by name) in this table with the given new column @param columnName String name of the column to be replaced @param newColumn Column to be added
[ "Replaces", "an", "existing", "column", "(", "by", "name", ")", "in", "this", "table", "with", "the", "given", "new", "column" ]
train
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/api/Table.java#L268-L271
spring-projects/spring-loaded
springloaded/src/main/java/org/springsource/loaded/FieldReaderWriter.java
FieldReaderWriter.findInstanceStateManager
private ISMgr findInstanceStateManager(Object instance) { Class<?> clazz = typeDescriptor.getReloadableType().getClazz(); try { Field fieldAccessorField = clazz.getField(Constants.fInstanceFieldsName); if (fieldAccessorField == null) { throw new IllegalStateException("Cant find field accessor for type " + clazz.getName()); } ISMgr stateManager = (ISMgr) fieldAccessorField.get(instance); if (stateManager == null) { // Looks to not have been initialized yet, this can happen if a non standard ctor was used. // We could push this step into the generated ctors... ISMgr instanceStateManager = new ISMgr(instance, typeDescriptor.getReloadableType()); fieldAccessorField.set(instance, instanceStateManager); stateManager = (ISMgr) fieldAccessorField.get(instance); // For some reason it didn't stick! if (stateManager == null) { throw new IllegalStateException("The class '" + clazz.getName() + "' has a null instance state manager object, instance is " + instance); } } return stateManager; } catch (Exception e) { throw new IllegalStateException("Unexpectedly unable to find instance state manager on class " + clazz.getName(), e); } }
java
private ISMgr findInstanceStateManager(Object instance) { Class<?> clazz = typeDescriptor.getReloadableType().getClazz(); try { Field fieldAccessorField = clazz.getField(Constants.fInstanceFieldsName); if (fieldAccessorField == null) { throw new IllegalStateException("Cant find field accessor for type " + clazz.getName()); } ISMgr stateManager = (ISMgr) fieldAccessorField.get(instance); if (stateManager == null) { // Looks to not have been initialized yet, this can happen if a non standard ctor was used. // We could push this step into the generated ctors... ISMgr instanceStateManager = new ISMgr(instance, typeDescriptor.getReloadableType()); fieldAccessorField.set(instance, instanceStateManager); stateManager = (ISMgr) fieldAccessorField.get(instance); // For some reason it didn't stick! if (stateManager == null) { throw new IllegalStateException("The class '" + clazz.getName() + "' has a null instance state manager object, instance is " + instance); } } return stateManager; } catch (Exception e) { throw new IllegalStateException("Unexpectedly unable to find instance state manager on class " + clazz.getName(), e); } }
[ "private", "ISMgr", "findInstanceStateManager", "(", "Object", "instance", ")", "{", "Class", "<", "?", ">", "clazz", "=", "typeDescriptor", ".", "getReloadableType", "(", ")", ".", "getClazz", "(", ")", ";", "try", "{", "Field", "fieldAccessorField", "=", "...
Discover the instance state manager for the specific object instance. Will fail by exception rather than returning null. @param instance the object instance on which to look @return the discovered state manager
[ "Discover", "the", "instance", "state", "manager", "for", "the", "specific", "object", "instance", ".", "Will", "fail", "by", "exception", "rather", "than", "returning", "null", "." ]
train
https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/FieldReaderWriter.java#L383-L409
dlemmermann/PreferencesFX
preferencesfx/src/main/java/com/dlsc/preferencesfx/model/Category.java
Category.of
public static Category of(String description, Node itemIcon, Group... groups) { return new Category(description, itemIcon, groups); }
java
public static Category of(String description, Node itemIcon, Group... groups) { return new Category(description, itemIcon, groups); }
[ "public", "static", "Category", "of", "(", "String", "description", ",", "Node", "itemIcon", ",", "Group", "...", "groups", ")", "{", "return", "new", "Category", "(", "description", ",", "itemIcon", ",", "groups", ")", ";", "}" ]
Creates a new category from groups. @param description Category name, for display in {@link CategoryView} @param itemIcon Icon to be shown next to the category name @param groups {@link Group} with {@link Setting} to be shown in the {@link CategoryView} @return initialized Category object
[ "Creates", "a", "new", "category", "from", "groups", "." ]
train
https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/model/Category.java#L116-L118
dropbox/dropbox-sdk-java
examples/web-file-browser/src/main/java/com/dropbox/core/examples/web_file_browser/Main.java
Main.doHome
public void doHome(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if (!common.checkGet(request, response)) return; // If nobody's logged in, send the browser to "/". User user = common.getLoggedInUser(request); if (user == null) { response.sendRedirect("/"); return; } FormProtection fp = FormProtection.start(response); response.setContentType("text/html"); response.setCharacterEncoding("utf-8"); PrintWriter out = new PrintWriter(new OutputStreamWriter(response.getOutputStream(), "UTF-8")); out.println("<html>"); out.println("<head><title>Home - Web File Browser</title></head>"); out.println("<body>"); fp.insertAntiRedressHtml(out); // Show user info. out.println("<h2>User: " + escapeHtml4(user.username) + "</h2>"); if (user.dropboxAccessToken != null) { // Show information about linked Dropbox account. Display the "Unlink" form. out.println("<p>Linked to your Dropbox account (" + escapeHtml4(user.dropboxAccessToken) + "), "); out.println("<form action='/dropbox-unlink' method='POST'>"); fp.insertAntiCsrfFormField(out); out.println("<input type='submit' value='Unlink Dropbox account' />"); out.println("</form>"); out.println("</p>"); out.println("<p><a href='/browse'>Browse your Dropbox files</a></p>"); } else { // They haven't linked their Dropbox account. Display the "Link" form. out.println("<p><form action='/dropbox-auth-start' method='POST'>"); fp.insertAntiCsrfFormField(out); out.println("<input type='submit' value='Link to your Dropbox account' />"); out.println("</form></p>"); } // Log out form. out.println("<p><form action='/logout' method='POST'>"); fp.insertAntiCsrfFormField(out); out.println("<input type='submit' value='Logout' />"); out.println("</form></p>"); out.println("</body>"); out.println("</html>"); out.flush(); }
java
public void doHome(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if (!common.checkGet(request, response)) return; // If nobody's logged in, send the browser to "/". User user = common.getLoggedInUser(request); if (user == null) { response.sendRedirect("/"); return; } FormProtection fp = FormProtection.start(response); response.setContentType("text/html"); response.setCharacterEncoding("utf-8"); PrintWriter out = new PrintWriter(new OutputStreamWriter(response.getOutputStream(), "UTF-8")); out.println("<html>"); out.println("<head><title>Home - Web File Browser</title></head>"); out.println("<body>"); fp.insertAntiRedressHtml(out); // Show user info. out.println("<h2>User: " + escapeHtml4(user.username) + "</h2>"); if (user.dropboxAccessToken != null) { // Show information about linked Dropbox account. Display the "Unlink" form. out.println("<p>Linked to your Dropbox account (" + escapeHtml4(user.dropboxAccessToken) + "), "); out.println("<form action='/dropbox-unlink' method='POST'>"); fp.insertAntiCsrfFormField(out); out.println("<input type='submit' value='Unlink Dropbox account' />"); out.println("</form>"); out.println("</p>"); out.println("<p><a href='/browse'>Browse your Dropbox files</a></p>"); } else { // They haven't linked their Dropbox account. Display the "Link" form. out.println("<p><form action='/dropbox-auth-start' method='POST'>"); fp.insertAntiCsrfFormField(out); out.println("<input type='submit' value='Link to your Dropbox account' />"); out.println("</form></p>"); } // Log out form. out.println("<p><form action='/logout' method='POST'>"); fp.insertAntiCsrfFormField(out); out.println("<input type='submit' value='Logout' />"); out.println("</form></p>"); out.println("</body>"); out.println("</html>"); out.flush(); }
[ "public", "void", "doHome", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "IOException", ",", "ServletException", "{", "if", "(", "!", "common", ".", "checkGet", "(", "request", ",", "response", ")", ")", "return", ...
account to their Dropbox account. If nobody is logged in, redirect to "/".
[ "account", "to", "their", "Dropbox", "account", ".", "If", "nobody", "is", "logged", "in", "redirect", "to", "/", "." ]
train
https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/examples/web-file-browser/src/main/java/com/dropbox/core/examples/web_file_browser/Main.java#L187-L236
VoltDB/voltdb
src/frontend/org/voltdb/sysprocs/LoadSinglepartitionTable.java
LoadSinglepartitionTable.partitionValueFromInvocation
public static Object partitionValueFromInvocation(Table catTable, VoltTable table) throws Exception { if (catTable.getIsreplicated()) { throw new Exception("Target table for LoadSinglepartitionTable is replicated."); } // check the number of columns int colCount = catTable.getColumns().size(); if (table.getColumnCount() != colCount) { throw new Exception("Input table has the wrong number of columns for bulk insert."); } // note there's no type checking // get the partitioning info from the catalog Column pCol = catTable.getPartitioncolumn(); int pIndex = pCol.getIndex(); // make sure the table has one row and move to it table.resetRowPosition(); boolean hasRow = table.advanceRow(); if (!hasRow) { // table has no rows, so it can partition any which way return 0; } // get the value from the first row of the table at the partition key Object pvalue = table.get(pIndex, table.getColumnType(pIndex)); return pvalue; }
java
public static Object partitionValueFromInvocation(Table catTable, VoltTable table) throws Exception { if (catTable.getIsreplicated()) { throw new Exception("Target table for LoadSinglepartitionTable is replicated."); } // check the number of columns int colCount = catTable.getColumns().size(); if (table.getColumnCount() != colCount) { throw new Exception("Input table has the wrong number of columns for bulk insert."); } // note there's no type checking // get the partitioning info from the catalog Column pCol = catTable.getPartitioncolumn(); int pIndex = pCol.getIndex(); // make sure the table has one row and move to it table.resetRowPosition(); boolean hasRow = table.advanceRow(); if (!hasRow) { // table has no rows, so it can partition any which way return 0; } // get the value from the first row of the table at the partition key Object pvalue = table.get(pIndex, table.getColumnType(pIndex)); return pvalue; }
[ "public", "static", "Object", "partitionValueFromInvocation", "(", "Table", "catTable", ",", "VoltTable", "table", ")", "throws", "Exception", "{", "if", "(", "catTable", ".", "getIsreplicated", "(", ")", ")", "{", "throw", "new", "Exception", "(", "\"Target tab...
Note: I (JHH) can't figure out what uses this code. It may be dead. Called by the client interface to partition this invocation based on parameters. @param tables The set of active tables in the catalog. @param spi The stored procedure invocation object @return An object suitable for hashing to a partition with The Hashinator @throws Exception thown on error with a descriptive message
[ "Note", ":", "I", "(", "JHH", ")", "can", "t", "figure", "out", "what", "uses", "this", "code", ".", "It", "may", "be", "dead", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/sysprocs/LoadSinglepartitionTable.java#L238-L266
svenkubiak/mangooio
mangooio-core/src/main/java/io/mangoo/core/Config.java
Config.getString
public String getString(String key, String defaultValue) { return this.props.getValueOrDefault(key, defaultValue); }
java
public String getString(String key, String defaultValue) { return this.props.getValueOrDefault(key, defaultValue); }
[ "public", "String", "getString", "(", "String", "key", ",", "String", "defaultValue", ")", "{", "return", "this", ".", "props", ".", "getValueOrDefault", "(", "key", ",", "defaultValue", ")", ";", "}" ]
Retrieves a configuration value with the given key @param key The key of the configuration value (e.g. application.name) @param defaultValue The default value to return of no key is found @return The configured value as String or the passed defautlValue if the key is not configured
[ "Retrieves", "a", "configuration", "value", "with", "the", "given", "key" ]
train
https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/core/Config.java#L164-L166
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/MapExtensions.java
MapExtensions.operator_minus
@Pure public static <K, V> Map<K, V> operator_minus(Map<K, V> left, final Map<? extends K, ? extends V> right) { return Maps.filterEntries(left, new Predicate<Entry<K, V>>() { @Override public boolean apply(Entry<K, V> input) { final V value = right.get(input.getKey()); if (value == null) { return input.getValue() == null && right.containsKey(input.getKey()); } return !Objects.equal(input.getValue(), value); } }); }
java
@Pure public static <K, V> Map<K, V> operator_minus(Map<K, V> left, final Map<? extends K, ? extends V> right) { return Maps.filterEntries(left, new Predicate<Entry<K, V>>() { @Override public boolean apply(Entry<K, V> input) { final V value = right.get(input.getKey()); if (value == null) { return input.getValue() == null && right.containsKey(input.getKey()); } return !Objects.equal(input.getValue(), value); } }); }
[ "@", "Pure", "public", "static", "<", "K", ",", "V", ">", "Map", "<", "K", ",", "V", ">", "operator_minus", "(", "Map", "<", "K", ",", "V", ">", "left", ",", "final", "Map", "<", "?", "extends", "K", ",", "?", "extends", "V", ">", "right", ")...
Replies the elements of the left map without the pairs in the right map. If the pair's values differ from the value within the map, the map entry is not removed. <p> The difference is an immutable snapshot of the state of the maps at the time this method is called. It will never change, even if the maps change at a later time. </p> <p> Since this method uses {@code HashMap} instances internally, the keys of the supplied maps must be well-behaved with respect to {@link Object#equals} and {@link Object#hashCode}. </p> @param <K> type of the map keys. @param <V> type of the map values. @param left the map to update. @param right the pairs to remove. @return the map with the content of the left map except the pairs of the right map. @since 2.15
[ "Replies", "the", "elements", "of", "the", "left", "map", "without", "the", "pairs", "in", "the", "right", "map", ".", "If", "the", "pair", "s", "values", "differ", "from", "the", "value", "within", "the", "map", "the", "map", "entry", "is", "not", "re...
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/MapExtensions.java#L334-L346
BorderTech/wcomponents
wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/menu/MenuFlyoutExample.java
MenuFlyoutExample.addMenuItem
private void addMenuItem(final WComponent parent, final String text, final WText selectedMenuText) { WMenuItem menuItem = new WMenuItem(text, new ExampleMenuAction(selectedMenuText)); menuItem.setActionObject(text); if (parent instanceof WSubMenu) { ((WSubMenu) parent).add(menuItem); } else { ((WMenuItemGroup) parent).add(menuItem); } }
java
private void addMenuItem(final WComponent parent, final String text, final WText selectedMenuText) { WMenuItem menuItem = new WMenuItem(text, new ExampleMenuAction(selectedMenuText)); menuItem.setActionObject(text); if (parent instanceof WSubMenu) { ((WSubMenu) parent).add(menuItem); } else { ((WMenuItemGroup) parent).add(menuItem); } }
[ "private", "void", "addMenuItem", "(", "final", "WComponent", "parent", ",", "final", "String", "text", ",", "final", "WText", "selectedMenuText", ")", "{", "WMenuItem", "menuItem", "=", "new", "WMenuItem", "(", "text", ",", "new", "ExampleMenuAction", "(", "s...
Adds an example menu item with the given text and an example action to the a parent component. @param parent the component to add the menu item to. @param text the text to display on the menu item. @param selectedMenuText the WText to display the selected menu item.
[ "Adds", "an", "example", "menu", "item", "with", "the", "given", "text", "and", "an", "example", "action", "to", "the", "a", "parent", "component", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/menu/MenuFlyoutExample.java#L138-L147
Nexmo/nexmo-java
src/main/java/com/nexmo/client/voice/VoiceClient.java
VoiceClient.modifyCall
public ModifyCallResponse modifyCall(String uuid, ModifyCallAction action) throws IOException, NexmoClientException { return this.modifyCall(new CallModifier(uuid, action)); }
java
public ModifyCallResponse modifyCall(String uuid, ModifyCallAction action) throws IOException, NexmoClientException { return this.modifyCall(new CallModifier(uuid, action)); }
[ "public", "ModifyCallResponse", "modifyCall", "(", "String", "uuid", ",", "ModifyCallAction", "action", ")", "throws", "IOException", ",", "NexmoClientException", "{", "return", "this", ".", "modifyCall", "(", "new", "CallModifier", "(", "uuid", ",", "action", ")"...
Modify an ongoing call. <p> This method modifies an ongoing call, identified by "uuid". Modifications to the call can be one of: <ul> <li>Terminate the call (hangup) <li>Mute a call leg (mute) <li>Unmute a call leg (unmute) <li>Earmuff a call leg (earmuff) <li>Unearmuff a call leg (unearmuff) </ul> @param uuid The UUID of the call, obtained from the object returned by {@link #createCall(Call)}. This value can be obtained with {@link CallEvent#getUuid()} @param action One of: "hangup", "mute", "unmute", "earmuff", "unearmuff" @return A ModifyCallResponse object, representing the response from the Nexmo Voice API. @throws IOException if a network error occurred contacting the Nexmo Voice API. @throws NexmoClientException if there was a problem with the Nexmo request or response objects.
[ "Modify", "an", "ongoing", "call", ".", "<p", ">", "This", "method", "modifies", "an", "ongoing", "call", "identified", "by", "uuid", ".", "Modifications", "to", "the", "call", "can", "be", "one", "of", ":", "<ul", ">", "<li", ">", "Terminate", "the", ...
train
https://github.com/Nexmo/nexmo-java/blob/7427eff6d6baa5a5bd9197fa096bcf2564191cf5/src/main/java/com/nexmo/client/voice/VoiceClient.java#L155-L157
groovy/groovy-core
src/main/org/codehaus/groovy/transform/ImmutableASTTransformation.java
ImmutableASTTransformation.checkImmutable
@SuppressWarnings("Unchecked") public static Object checkImmutable(String className, String fieldName, Object field) { if (field == null || field instanceof Enum || inImmutableList(field.getClass().getName())) return field; if (field instanceof Collection) return DefaultGroovyMethods.asImmutable((Collection) field); if (field.getClass().getAnnotation(MY_CLASS) != null) return field; final String typeName = field.getClass().getName(); throw new RuntimeException(createErrorMessage(className, fieldName, typeName, "constructing")); }
java
@SuppressWarnings("Unchecked") public static Object checkImmutable(String className, String fieldName, Object field) { if (field == null || field instanceof Enum || inImmutableList(field.getClass().getName())) return field; if (field instanceof Collection) return DefaultGroovyMethods.asImmutable((Collection) field); if (field.getClass().getAnnotation(MY_CLASS) != null) return field; final String typeName = field.getClass().getName(); throw new RuntimeException(createErrorMessage(className, fieldName, typeName, "constructing")); }
[ "@", "SuppressWarnings", "(", "\"Unchecked\"", ")", "public", "static", "Object", "checkImmutable", "(", "String", "className", ",", "String", "fieldName", ",", "Object", "field", ")", "{", "if", "(", "field", "==", "null", "||", "field", "instanceof", "Enum",...
This method exists to be binary compatible with 1.7 - 1.8.6 compiled code.
[ "This", "method", "exists", "to", "be", "binary", "compatible", "with", "1", ".", "7", "-", "1", ".", "8", ".", "6", "compiled", "code", "." ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/transform/ImmutableASTTransformation.java#L725-L732
graphql-java/graphql-java
src/main/java/graphql/language/NodeTraverser.java
NodeTraverser.depthFirst
public Object depthFirst(NodeVisitor nodeVisitor, Node root) { return depthFirst(nodeVisitor, Collections.singleton(root)); }
java
public Object depthFirst(NodeVisitor nodeVisitor, Node root) { return depthFirst(nodeVisitor, Collections.singleton(root)); }
[ "public", "Object", "depthFirst", "(", "NodeVisitor", "nodeVisitor", ",", "Node", "root", ")", "{", "return", "depthFirst", "(", "nodeVisitor", ",", "Collections", ".", "singleton", "(", "root", ")", ")", ";", "}" ]
depthFirst traversal with a enter/leave phase. @param nodeVisitor the visitor of the nodes @param root the root node @return the accumulation result of this traversal
[ "depthFirst", "traversal", "with", "a", "enter", "/", "leave", "phase", "." ]
train
https://github.com/graphql-java/graphql-java/blob/9214b6044317849388bd88a14b54fc1c18c9f29f/src/main/java/graphql/language/NodeTraverser.java#L52-L54
lucee/Lucee
core/src/main/java/lucee/runtime/jsr223/AbstractScriptEngine.java
AbstractScriptEngine.put
public void put(String key, Object value) { Bindings nn = getBindings(ScriptContext.ENGINE_SCOPE); if (nn != null) { nn.put(key, value); } }
java
public void put(String key, Object value) { Bindings nn = getBindings(ScriptContext.ENGINE_SCOPE); if (nn != null) { nn.put(key, value); } }
[ "public", "void", "put", "(", "String", "key", ",", "Object", "value", ")", "{", "Bindings", "nn", "=", "getBindings", "(", "ScriptContext", ".", "ENGINE_SCOPE", ")", ";", "if", "(", "nn", "!=", "null", ")", "{", "nn", ".", "put", "(", "key", ",", ...
Sets the specified value with the specified key in the <code>ENGINE_SCOPE</code> <code>Bindings</code> of the protected <code>context</code> field. @param key The specified key. @param value The specified value. @throws NullPointerException if key is null. @throws IllegalArgumentException if key is empty.
[ "Sets", "the", "specified", "value", "with", "the", "specified", "key", "in", "the", "<code", ">", "ENGINE_SCOPE<", "/", "code", ">", "<code", ">", "Bindings<", "/", "code", ">", "of", "the", "protected", "<code", ">", "context<", "/", "code", ">", "fiel...
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/jsr223/AbstractScriptEngine.java#L139-L146
lucee/Lucee
core/src/main/java/lucee/runtime/converter/WDDXConverter.java
WDDXConverter._serializeArray
private String _serializeArray(Array array, Set<Object> done) throws ConverterException { return _serializeList(array.toList(), done); }
java
private String _serializeArray(Array array, Set<Object> done) throws ConverterException { return _serializeList(array.toList(), done); }
[ "private", "String", "_serializeArray", "(", "Array", "array", ",", "Set", "<", "Object", ">", "done", ")", "throws", "ConverterException", "{", "return", "_serializeList", "(", "array", ".", "toList", "(", ")", ",", "done", ")", ";", "}" ]
serialize a Array @param array Array to serialize @param done @return serialized array @throws ConverterException
[ "serialize", "a", "Array" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/converter/WDDXConverter.java#L177-L179
apereo/cas
support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/util/OAuth20Utils.java
OAuth20Utils.isAuthorizedResponseTypeForService
public static boolean isAuthorizedResponseTypeForService(final J2EContext context, final OAuthRegisteredService registeredService) { val responseType = context.getRequestParameter(OAuth20Constants.RESPONSE_TYPE); if (registeredService.getSupportedResponseTypes() != null && !registeredService.getSupportedResponseTypes().isEmpty()) { LOGGER.debug("Checking response type [{}] against supported response types [{}]", responseType, registeredService.getSupportedResponseTypes()); return registeredService.getSupportedResponseTypes().stream().anyMatch(s -> s.equalsIgnoreCase(responseType)); } LOGGER.warn("Registered service [{}] does not define any authorized/supported response types. " + "It is STRONGLY recommended that you authorize and assign response types to the service definition. " + "While just a warning for now, this behavior will be enforced by CAS in future versions.", registeredService.getName()); return true; }
java
public static boolean isAuthorizedResponseTypeForService(final J2EContext context, final OAuthRegisteredService registeredService) { val responseType = context.getRequestParameter(OAuth20Constants.RESPONSE_TYPE); if (registeredService.getSupportedResponseTypes() != null && !registeredService.getSupportedResponseTypes().isEmpty()) { LOGGER.debug("Checking response type [{}] against supported response types [{}]", responseType, registeredService.getSupportedResponseTypes()); return registeredService.getSupportedResponseTypes().stream().anyMatch(s -> s.equalsIgnoreCase(responseType)); } LOGGER.warn("Registered service [{}] does not define any authorized/supported response types. " + "It is STRONGLY recommended that you authorize and assign response types to the service definition. " + "While just a warning for now, this behavior will be enforced by CAS in future versions.", registeredService.getName()); return true; }
[ "public", "static", "boolean", "isAuthorizedResponseTypeForService", "(", "final", "J2EContext", "context", ",", "final", "OAuthRegisteredService", "registeredService", ")", "{", "val", "responseType", "=", "context", ".", "getRequestParameter", "(", "OAuth20Constants", "...
Is authorized response type for service? @param context the context @param registeredService the registered service @return the boolean
[ "Is", "authorized", "response", "type", "for", "service?" ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/util/OAuth20Utils.java#L272-L283
mbeiter/util
db/src/main/java/org/beiter/michael/db/DataSourceFactory.java
DataSourceFactory.getDataSource
public static DataSource getDataSource(final String jndiName) throws FactoryException { Validate.notBlank(jndiName, "The validated character sequence 'jndiName' is null or empty"); // no need for defensive copies of Strings try { // the initial context is created from the provided JNDI settings final Context context = new InitialContext(); // retrieve a data source object, close the context as it is no longer needed, and return the data source final Object namedObject = context.lookup(jndiName); if (DataSource.class.isInstance(namedObject)) { final DataSource dataSource = (DataSource) context.lookup(jndiName); context.close(); return dataSource; } else { final String error = "The JNDI name '" + jndiName + "' does not reference a SQL DataSource." + " This is a configuration issue."; LOG.warn(error); throw new FactoryException(error); } } catch (NamingException e) { final String error = "Error retrieving JDBC date source from JNDI: " + jndiName; LOG.warn(error); throw new FactoryException(error, e); } }
java
public static DataSource getDataSource(final String jndiName) throws FactoryException { Validate.notBlank(jndiName, "The validated character sequence 'jndiName' is null or empty"); // no need for defensive copies of Strings try { // the initial context is created from the provided JNDI settings final Context context = new InitialContext(); // retrieve a data source object, close the context as it is no longer needed, and return the data source final Object namedObject = context.lookup(jndiName); if (DataSource.class.isInstance(namedObject)) { final DataSource dataSource = (DataSource) context.lookup(jndiName); context.close(); return dataSource; } else { final String error = "The JNDI name '" + jndiName + "' does not reference a SQL DataSource." + " This is a configuration issue."; LOG.warn(error); throw new FactoryException(error); } } catch (NamingException e) { final String error = "Error retrieving JDBC date source from JNDI: " + jndiName; LOG.warn(error); throw new FactoryException(error, e); } }
[ "public", "static", "DataSource", "getDataSource", "(", "final", "String", "jndiName", ")", "throws", "FactoryException", "{", "Validate", ".", "notBlank", "(", "jndiName", ",", "\"The validated character sequence 'jndiName' is null or empty\"", ")", ";", "// no need for de...
Return a DataSource instance for a JNDI managed JDBC data source. @param jndiName The JNDI connection name @return a JDBC data source @throws FactoryException When no date source can be retrieved from JNDI @throws NullPointerException When {@code jndiName} is null @throws IllegalArgumentException When {@code jndiName} is empty
[ "Return", "a", "DataSource", "instance", "for", "a", "JNDI", "managed", "JDBC", "data", "source", "." ]
train
https://github.com/mbeiter/util/blob/490fcebecb936e00c2f2ce2096b679b2fd10865e/db/src/main/java/org/beiter/michael/db/DataSourceFactory.java#L89-L118
JDBDT/jdbdt
src/main/java/org/jdbdt/DBSetup.java
DBSetup.deleteAll
static int deleteAll(CallInfo callInfo, Table table, String where, Object... args) { final DB db = table.getDB(); return db.access(callInfo, () -> { table.setDirtyStatus(true); String sql = DELETE_FROM_ + table.getName() + WHERE_ + where; db.logSetup(callInfo, sql); try (WrappedStatement ws = db.compile(sql)) { PreparedStatement deleteStmt = ws.getStatement(); if (args != null && args.length > 0) { for (int i=0; i < args.length; i++) { deleteStmt.setObject(i + 1, args[i]); } } return deleteStmt.executeUpdate(); } }); }
java
static int deleteAll(CallInfo callInfo, Table table, String where, Object... args) { final DB db = table.getDB(); return db.access(callInfo, () -> { table.setDirtyStatus(true); String sql = DELETE_FROM_ + table.getName() + WHERE_ + where; db.logSetup(callInfo, sql); try (WrappedStatement ws = db.compile(sql)) { PreparedStatement deleteStmt = ws.getStatement(); if (args != null && args.length > 0) { for (int i=0; i < args.length; i++) { deleteStmt.setObject(i + 1, args[i]); } } return deleteStmt.executeUpdate(); } }); }
[ "static", "int", "deleteAll", "(", "CallInfo", "callInfo", ",", "Table", "table", ",", "String", "where", ",", "Object", "...", "args", ")", "{", "final", "DB", "db", "=", "table", ".", "getDB", "(", ")", ";", "return", "db", ".", "access", "(", "cal...
Delete all data based on a WHERE clause. @param callInfo Call info. @param table Table. @param where <code>WHERE</code> clause. @param args Optional arguments for <code>WHERE</code> clause. @return The number of deleted rows.
[ "Delete", "all", "data", "based", "on", "a", "WHERE", "clause", "." ]
train
https://github.com/JDBDT/jdbdt/blob/7e32845ad41dfbc5d6fd0fd561e3613697186df4/src/main/java/org/jdbdt/DBSetup.java#L342-L361
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/CopyLastHandler.java
CopyLastHandler.moveSourceToDest
public int moveSourceToDest(boolean bDisplayOption, int iMoveMode) { String string = this.getSourceField().getString(); // Get this string int i = string.lastIndexOf(' '); if (i != -1) string = string.substring(i+1); return m_fldDest.setData(string, bDisplayOption, iMoveMode); }
java
public int moveSourceToDest(boolean bDisplayOption, int iMoveMode) { String string = this.getSourceField().getString(); // Get this string int i = string.lastIndexOf(' '); if (i != -1) string = string.substring(i+1); return m_fldDest.setData(string, bDisplayOption, iMoveMode); }
[ "public", "int", "moveSourceToDest", "(", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "String", "string", "=", "this", ".", "getSourceField", "(", ")", ".", "getString", "(", ")", ";", "// Get this string", "int", "i", "=", "string", ".",...
Do the physical move operation. @param bDisplayOption If true, display the change. @param iMoveMode The type of move being done (init/read/screen). @return The error code (or NORMAL_RETURN if okay).
[ "Do", "the", "physical", "move", "operation", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/CopyLastHandler.java#L80-L87
seancfoley/IPAddress
IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSection.java
IPAddressSection.isNetworkSection
protected boolean isNetworkSection(int networkPrefixLength, boolean withPrefixLength) { int segmentCount = getSegmentCount(); if(segmentCount == 0) { return true; } int bitsPerSegment = getBitsPerSegment(); int prefixedSegmentIndex = getNetworkSegmentIndex(networkPrefixLength, getBytesPerSegment(), bitsPerSegment); if(prefixedSegmentIndex + 1 < segmentCount) { return false; //not the right number of segments } //the segment count matches, now compare the prefixed segment int segPrefLength = getPrefixedSegmentPrefixLength(bitsPerSegment, networkPrefixLength, prefixedSegmentIndex); return !getSegment(segmentCount - 1).isNetworkChangedByPrefix(segPrefLength, withPrefixLength); }
java
protected boolean isNetworkSection(int networkPrefixLength, boolean withPrefixLength) { int segmentCount = getSegmentCount(); if(segmentCount == 0) { return true; } int bitsPerSegment = getBitsPerSegment(); int prefixedSegmentIndex = getNetworkSegmentIndex(networkPrefixLength, getBytesPerSegment(), bitsPerSegment); if(prefixedSegmentIndex + 1 < segmentCount) { return false; //not the right number of segments } //the segment count matches, now compare the prefixed segment int segPrefLength = getPrefixedSegmentPrefixLength(bitsPerSegment, networkPrefixLength, prefixedSegmentIndex); return !getSegment(segmentCount - 1).isNetworkChangedByPrefix(segPrefLength, withPrefixLength); }
[ "protected", "boolean", "isNetworkSection", "(", "int", "networkPrefixLength", ",", "boolean", "withPrefixLength", ")", "{", "int", "segmentCount", "=", "getSegmentCount", "(", ")", ";", "if", "(", "segmentCount", "==", "0", ")", "{", "return", "true", ";", "}...
this method is basically checking whether we can return "this" for getNetworkSection
[ "this", "method", "is", "basically", "checking", "whether", "we", "can", "return", "this", "for", "getNetworkSection" ]
train
https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSection.java#L258-L271
baratine/baratine
framework/src/main/java/com/caucho/v5/json/ser/JsonSerializerBase.java
JsonSerializerBase.writeTop
@Override public void writeTop(JsonWriterImpl out, T value) { out.writeStartArray(); write(out, value); out.writeEndArray(); }
java
@Override public void writeTop(JsonWriterImpl out, T value) { out.writeStartArray(); write(out, value); out.writeEndArray(); }
[ "@", "Override", "public", "void", "writeTop", "(", "JsonWriterImpl", "out", ",", "T", "value", ")", "{", "out", ".", "writeStartArray", "(", ")", ";", "write", "(", "out", ",", "value", ")", ";", "out", ".", "writeEndArray", "(", ")", ";", "}" ]
/* @Override public void write(JsonWriter out, String fieldName, T value) { throw new UnsupportedOperationException(getClass().getName()); }
[ "/", "*" ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/json/ser/JsonSerializerBase.java#L42-L48
craterdog/java-security-framework
java-certificate-management-providers/src/main/java/craterdog/security/RsaCertificateManager.java
RsaCertificateManager.createSigningRequest
public PKCS10CertificationRequest createSigningRequest(PrivateKey privateKey, PublicKey publicKey, String subjectString) { try { logger.entry(); logger.debug("Creating the CSR..."); X500Principal subject = new X500Principal(subjectString); ContentSigner signer = new JcaContentSignerBuilder(ASYMMETRIC_SIGNATURE_ALGORITHM).build(privateKey); PKCS10CertificationRequest result = new JcaPKCS10CertificationRequestBuilder(subject, publicKey) .setLeaveOffEmptyAttributes(true).build(signer); logger.exit(); return result; } catch (OperatorCreationException e) { RuntimeException exception = new RuntimeException("An unexpected exception occurred while attempting to generate a new certificate signing request.", e); logger.error(exception.toString()); throw exception; } }
java
public PKCS10CertificationRequest createSigningRequest(PrivateKey privateKey, PublicKey publicKey, String subjectString) { try { logger.entry(); logger.debug("Creating the CSR..."); X500Principal subject = new X500Principal(subjectString); ContentSigner signer = new JcaContentSignerBuilder(ASYMMETRIC_SIGNATURE_ALGORITHM).build(privateKey); PKCS10CertificationRequest result = new JcaPKCS10CertificationRequestBuilder(subject, publicKey) .setLeaveOffEmptyAttributes(true).build(signer); logger.exit(); return result; } catch (OperatorCreationException e) { RuntimeException exception = new RuntimeException("An unexpected exception occurred while attempting to generate a new certificate signing request.", e); logger.error(exception.toString()); throw exception; } }
[ "public", "PKCS10CertificationRequest", "createSigningRequest", "(", "PrivateKey", "privateKey", ",", "PublicKey", "publicKey", ",", "String", "subjectString", ")", "{", "try", "{", "logger", ".", "entry", "(", ")", ";", "logger", ".", "debug", "(", "\"Creating th...
This method creates a new certificate signing request (CSR) using the specified key pair and subject string. This is a convenience method that really should be part of the <code>CertificateManagement</code> interface except that it depends on a Bouncy Castle class in the signature. The java security framework does not have a similar class so it has been left out of the interface. @param privateKey The private key to be used to sign the request. @param publicKey The corresponding public key that is to be wrapped in the new certificate. @param subjectString The subject string to be included in the generated certificate. @return The newly created CSR.
[ "This", "method", "creates", "a", "new", "certificate", "signing", "request", "(", "CSR", ")", "using", "the", "specified", "key", "pair", "and", "subject", "string", ".", "This", "is", "a", "convenience", "method", "that", "really", "should", "be", "part", ...
train
https://github.com/craterdog/java-security-framework/blob/a5634c19812d473b608bc11060f5cbb4b4b0b5da/java-certificate-management-providers/src/main/java/craterdog/security/RsaCertificateManager.java#L113-L132
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CATProxyConsumer.java
CATProxyConsumer.sendEntireMessage
private int sendEntireMessage(SIBusMessage sibMessage, List<DataSlice> messageSlices) throws MessageCopyFailedException, IncorrectMessageTypeException, MessageEncodeFailedException, UnsupportedEncodingException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "sendEntireMessage", new Object[]{sibMessage, messageSlices}); int msgLen = 0; try { CommsServerByteBuffer buffer = poolManager.allocate(); ConversationState convState = (ConversationState) getConversation().getAttachment(); buffer.putShort(convState.getConnectionObjectId()); buffer.putShort(mainConsumer.getClientSessionId()); buffer.putShort(mainConsumer.getMessageBatchNumber()); // BIT16 Message batch // Put the entire message into the buffer in whatever way is suitable if (messageSlices == null) { msgLen = buffer.putMessage((JsMessage) sibMessage, convState.getCommsConnection(), getConversation()); } else { msgLen = buffer.putMessgeWithoutEncode(messageSlices); } short jfapPriority = JFapChannelConstants.getJFAPPriority(sibMessage.getPriority()); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Sending with JFAP priority of " + jfapPriority); getConversation().send(buffer, JFapChannelConstants.SEG_PROXY_MESSAGE, 0, // No request number jfapPriority, false, ThrottlingPolicy.BLOCK_THREAD, INVALIDATE_CONNECTION_ON_ERROR); messagesSent++; } catch (SIException e1) { FFDCFilter.processException(e1, CLASS_NAME + ".sendEntireMessage", CommsConstants.CATPROXYCONSUMER_SEND_MSG_01, this); SibTr.error(tc, "COMMUNICATION_ERROR_SICO2014", e1); msgLen = 0; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "sendEntireMessage", msgLen); return msgLen; }
java
private int sendEntireMessage(SIBusMessage sibMessage, List<DataSlice> messageSlices) throws MessageCopyFailedException, IncorrectMessageTypeException, MessageEncodeFailedException, UnsupportedEncodingException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "sendEntireMessage", new Object[]{sibMessage, messageSlices}); int msgLen = 0; try { CommsServerByteBuffer buffer = poolManager.allocate(); ConversationState convState = (ConversationState) getConversation().getAttachment(); buffer.putShort(convState.getConnectionObjectId()); buffer.putShort(mainConsumer.getClientSessionId()); buffer.putShort(mainConsumer.getMessageBatchNumber()); // BIT16 Message batch // Put the entire message into the buffer in whatever way is suitable if (messageSlices == null) { msgLen = buffer.putMessage((JsMessage) sibMessage, convState.getCommsConnection(), getConversation()); } else { msgLen = buffer.putMessgeWithoutEncode(messageSlices); } short jfapPriority = JFapChannelConstants.getJFAPPriority(sibMessage.getPriority()); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Sending with JFAP priority of " + jfapPriority); getConversation().send(buffer, JFapChannelConstants.SEG_PROXY_MESSAGE, 0, // No request number jfapPriority, false, ThrottlingPolicy.BLOCK_THREAD, INVALIDATE_CONNECTION_ON_ERROR); messagesSent++; } catch (SIException e1) { FFDCFilter.processException(e1, CLASS_NAME + ".sendEntireMessage", CommsConstants.CATPROXYCONSUMER_SEND_MSG_01, this); SibTr.error(tc, "COMMUNICATION_ERROR_SICO2014", e1); msgLen = 0; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "sendEntireMessage", msgLen); return msgLen; }
[ "private", "int", "sendEntireMessage", "(", "SIBusMessage", "sibMessage", ",", "List", "<", "DataSlice", ">", "messageSlices", ")", "throws", "MessageCopyFailedException", ",", "IncorrectMessageTypeException", ",", "MessageEncodeFailedException", ",", "UnsupportedEncodingExce...
Send the entire message in one big buffer. If the messageSlices parameter is not null then the message has already been encoded and does not need to be done again. This may be in the case where the message was destined to be sent in chunks but is so small that it does not seem worth it. @param sibMessage The entire message to send. @param messageSlices The already encoded message slices. @return Returns the length of the message sent to the client. @throws MessageCopyFailedException @throws IncorrectMessageTypeException @throws MessageEncodeFailedException @throws UnsupportedEncodingException
[ "Send", "the", "entire", "message", "in", "one", "big", "buffer", ".", "If", "the", "messageSlices", "parameter", "is", "not", "null", "then", "the", "message", "has", "already", "been", "encoded", "and", "does", "not", "need", "to", "be", "done", "again",...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CATProxyConsumer.java#L804-L861
code4everything/util
src/main/java/com/zhazhapan/util/Checker.java
Checker.isNotIn
public static <T> boolean isNotIn(T t, List<T> ts) { return isNotIn(t, ts.toArray()); }
java
public static <T> boolean isNotIn(T t, List<T> ts) { return isNotIn(t, ts.toArray()); }
[ "public", "static", "<", "T", ">", "boolean", "isNotIn", "(", "T", "t", ",", "List", "<", "T", ">", "ts", ")", "{", "return", "isNotIn", "(", "t", ",", "ts", ".", "toArray", "(", ")", ")", ";", "}" ]
检查对象是否不存在某个集合 @param t 对象 @param ts 集合 @param <T> 类型 @return {@link Boolean} @since 1.0.9
[ "检查对象是否不存在某个集合" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/Checker.java#L693-L695
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpTrailersImpl.java
HttpTrailersImpl.setDeferredTrailer
public void setDeferredTrailer(HeaderKeys hdr, HttpTrailerGenerator htg) { if (tc.isDebugEnabled()) { Tr.debug(tc, "setDeferredTrailer(HeaderKeys): " + hdr); } if (null == hdr) { throw new IllegalArgumentException("Null header name"); } if (null == htg) { throw new IllegalArgumentException("Null value generator"); } this.knownTGs.put(hdr, htg); }
java
public void setDeferredTrailer(HeaderKeys hdr, HttpTrailerGenerator htg) { if (tc.isDebugEnabled()) { Tr.debug(tc, "setDeferredTrailer(HeaderKeys): " + hdr); } if (null == hdr) { throw new IllegalArgumentException("Null header name"); } if (null == htg) { throw new IllegalArgumentException("Null value generator"); } this.knownTGs.put(hdr, htg); }
[ "public", "void", "setDeferredTrailer", "(", "HeaderKeys", "hdr", ",", "HttpTrailerGenerator", "htg", ")", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"setDeferredTrailer(HeaderKeys): \"", "+", "hdr", ...
Set a trailer based upon a not-yet established value. When the deferred trailer is set, it is the users responsibility to synchronize the deferred trailer list with the Trailer header field up front. For instance if one sets the deferred trailer HDR_CONTENT_LANGUAGE, then the trailer header in the head of the HTTP request/response should contain "Trailer:Content-Language" @param hdr the header to use. @param htg the object which will generate the value for this trailer dynamically. An <code>HttpTrailerGenerator</code> is called immediately after the 0-size chunk is sent, but before closing or recycling the connection. @throws IllegalArgumentException if any parameter is NULL or if the header represented is unsupported.
[ "Set", "a", "trailer", "based", "upon", "a", "not", "-", "yet", "established", "value", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpTrailersImpl.java#L129-L141
qspin/qtaste
kernel/src/main/java/com/qspin/qtaste/ui/jedit/TextUtilities.java
TextUtilities.tabsToSpaces
public static String tabsToSpaces(String in, int tabSize) { StringBuilder buf = new StringBuilder(); int width = 0; for (int i = 0; i < in.length(); i++) { switch (in.charAt(i)) { case '\t': int count = tabSize - (width % tabSize); width += count; while (--count >= 0) { buf.append(' '); } break; case '\n': width = 0; buf.append(in.charAt(i)); break; default: width++; buf.append(in.charAt(i)); break; } } return buf.toString(); }
java
public static String tabsToSpaces(String in, int tabSize) { StringBuilder buf = new StringBuilder(); int width = 0; for (int i = 0; i < in.length(); i++) { switch (in.charAt(i)) { case '\t': int count = tabSize - (width % tabSize); width += count; while (--count >= 0) { buf.append(' '); } break; case '\n': width = 0; buf.append(in.charAt(i)); break; default: width++; buf.append(in.charAt(i)); break; } } return buf.toString(); }
[ "public", "static", "String", "tabsToSpaces", "(", "String", "in", ",", "int", "tabSize", ")", "{", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", ")", ";", "int", "width", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", ...
Converts tabs to consecutive spaces in the specified string. @param in The string @param tabSize The tab size
[ "Converts", "tabs", "to", "consecutive", "spaces", "in", "the", "specified", "string", "." ]
train
https://github.com/qspin/qtaste/blob/ba45d4d86eb29b92f157c6e98536dee2002ddfdc/kernel/src/main/java/com/qspin/qtaste/ui/jedit/TextUtilities.java#L239-L262
marklogic/java-client-api
marklogic-client-api/src/main/java/com/marklogic/client/query/StructuredQueryBuilder.java
StructuredQueryBuilder.geoElementPair
public GeospatialIndex geoElementPair(Element parent, Element lat, Element lon) { return new GeoElementPairImpl(parent, lat, lon); }
java
public GeospatialIndex geoElementPair(Element parent, Element lat, Element lon) { return new GeoElementPairImpl(parent, lat, lon); }
[ "public", "GeospatialIndex", "geoElementPair", "(", "Element", "parent", ",", "Element", "lat", ",", "Element", "lon", ")", "{", "return", "new", "GeoElementPairImpl", "(", "parent", ",", "lat", ",", "lon", ")", ";", "}" ]
Identifies a parent element with child latitude and longitude elements to match with a geospatial query. @param parent the parent of the element with the coordinates @param lat the element with the latitude coordinate @param lon the element with the longitude coordinate @return the specification for the index on the geospatial coordinates
[ "Identifies", "a", "parent", "element", "with", "child", "latitude", "and", "longitude", "elements", "to", "match", "with", "a", "geospatial", "query", "." ]
train
https://github.com/marklogic/java-client-api/blob/acf60229a928abd4a8cc4b21b641d56957467da7/marklogic-client-api/src/main/java/com/marklogic/client/query/StructuredQueryBuilder.java#L890-L892
alkacon/opencms-core
src/org/opencms/xml/content/CmsXmlContentFactory.java
CmsXmlContentFactory.createDocument
public static CmsXmlContent createDocument(CmsObject cms, Locale locale, CmsResourceTypeXmlContent resourceType) throws CmsXmlException { String schema = resourceType.getSchema(); CmsXmlContentDefinition contentDefinition = CmsXmlContentDefinition.unmarshal(cms, schema); CmsXmlContent xmlContent = CmsXmlContentFactory.createDocument( cms, locale, OpenCms.getSystemInfo().getDefaultEncoding(), contentDefinition); return xmlContent; }
java
public static CmsXmlContent createDocument(CmsObject cms, Locale locale, CmsResourceTypeXmlContent resourceType) throws CmsXmlException { String schema = resourceType.getSchema(); CmsXmlContentDefinition contentDefinition = CmsXmlContentDefinition.unmarshal(cms, schema); CmsXmlContent xmlContent = CmsXmlContentFactory.createDocument( cms, locale, OpenCms.getSystemInfo().getDefaultEncoding(), contentDefinition); return xmlContent; }
[ "public", "static", "CmsXmlContent", "createDocument", "(", "CmsObject", "cms", ",", "Locale", "locale", ",", "CmsResourceTypeXmlContent", "resourceType", ")", "throws", "CmsXmlException", "{", "String", "schema", "=", "resourceType", ".", "getSchema", "(", ")", ";"...
Creates a new XML content based on a resource type.<p> @param cms the current OpenCms context @param locale the locale to generate the default content for @param resourceType the resource type for which the document should be created @return the created XML content @throws CmsXmlException if something goes wrong
[ "Creates", "a", "new", "XML", "content", "based", "on", "a", "resource", "type", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsXmlContentFactory.java#L79-L90
Azure/azure-sdk-for-java
network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/VirtualHubsInner.java
VirtualHubsInner.createOrUpdateAsync
public Observable<VirtualHubInner> createOrUpdateAsync(String resourceGroupName, String virtualHubName, VirtualHubInner virtualHubParameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualHubName, virtualHubParameters).map(new Func1<ServiceResponse<VirtualHubInner>, VirtualHubInner>() { @Override public VirtualHubInner call(ServiceResponse<VirtualHubInner> response) { return response.body(); } }); }
java
public Observable<VirtualHubInner> createOrUpdateAsync(String resourceGroupName, String virtualHubName, VirtualHubInner virtualHubParameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualHubName, virtualHubParameters).map(new Func1<ServiceResponse<VirtualHubInner>, VirtualHubInner>() { @Override public VirtualHubInner call(ServiceResponse<VirtualHubInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualHubInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "virtualHubName", ",", "VirtualHubInner", "virtualHubParameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupNa...
Creates a VirtualHub resource if it doesn't exist else updates the existing VirtualHub. @param resourceGroupName The resource group name of the VirtualHub. @param virtualHubName The name of the VirtualHub. @param virtualHubParameters Parameters supplied to create or update VirtualHub. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Creates", "a", "VirtualHub", "resource", "if", "it", "doesn", "t", "exist", "else", "updates", "the", "existing", "VirtualHub", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/VirtualHubsInner.java#L238-L245
Impetus/Kundera
src/kundera-spark/spark-core/src/main/java/com/impetus/spark/client/SparkClient.java
SparkClient.getDataFrame
public DataFrame getDataFrame(String query, EntityMetadata m, KunderaQuery kunderaQuery) { PersistenceUnitMetadata puMetadata = kunderaMetadata.getApplicationMetadata().getPersistenceUnitMetadata( persistenceUnit); String clientName = puMetadata.getProperty(DATA_CLIENT).toLowerCase(); SparkDataClient dataClient = SparkDataClientFactory.getDataClient(clientName); if (registeredTables.get(m.getTableName()) == null || !registeredTables.get(m.getTableName())) { dataClient.registerTable(m, this); registeredTables.put(m.getTableName(), true); } // at this level temp table or table should be ready DataFrame dataFrame = sqlContext.sql(query); return dataFrame; }
java
public DataFrame getDataFrame(String query, EntityMetadata m, KunderaQuery kunderaQuery) { PersistenceUnitMetadata puMetadata = kunderaMetadata.getApplicationMetadata().getPersistenceUnitMetadata( persistenceUnit); String clientName = puMetadata.getProperty(DATA_CLIENT).toLowerCase(); SparkDataClient dataClient = SparkDataClientFactory.getDataClient(clientName); if (registeredTables.get(m.getTableName()) == null || !registeredTables.get(m.getTableName())) { dataClient.registerTable(m, this); registeredTables.put(m.getTableName(), true); } // at this level temp table or table should be ready DataFrame dataFrame = sqlContext.sql(query); return dataFrame; }
[ "public", "DataFrame", "getDataFrame", "(", "String", "query", ",", "EntityMetadata", "m", ",", "KunderaQuery", "kunderaQuery", ")", "{", "PersistenceUnitMetadata", "puMetadata", "=", "kunderaMetadata", ".", "getApplicationMetadata", "(", ")", ".", "getPersistenceUnitMe...
Gets the data frame. @param query the query @param m the m @param kunderaQuery the kundera query @return the data frame
[ "Gets", "the", "data", "frame", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-spark/spark-core/src/main/java/com/impetus/spark/client/SparkClient.java#L333-L349
recruit-mp/android-RMP-Appirater
library/src/main/java/jp/co/recruit_mp/android/rmp_appirater/RmpAppirater.java
RmpAppirater.appLaunched
public static void appLaunched(Context context, Options options) { appLaunched(context, null, options, null); }
java
public static void appLaunched(Context context, Options options) { appLaunched(context, null, options, null); }
[ "public", "static", "void", "appLaunched", "(", "Context", "context", ",", "Options", "options", ")", "{", "appLaunched", "(", "context", ",", "null", ",", "options", ",", "null", ")", ";", "}" ]
Tells RMP-Appirater that the app has launched. <p/> Show rating dialog if user isn't rating yet and don't select "Not show again". @param context Context @param options RMP-Appirater options.
[ "Tells", "RMP", "-", "Appirater", "that", "the", "app", "has", "launched", ".", "<p", "/", ">", "Show", "rating", "dialog", "if", "user", "isn", "t", "rating", "yet", "and", "don", "t", "select", "Not", "show", "again", "." ]
train
https://github.com/recruit-mp/android-RMP-Appirater/blob/14fcdf110dfb97120303f39aab1de9393e84b90a/library/src/main/java/jp/co/recruit_mp/android/rmp_appirater/RmpAppirater.java#L83-L85
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/Assert.java
Assert.notEmpty
public static void notEmpty(String value, String message, Object... arguments) { notEmpty(value, new IllegalArgumentException(format(message, arguments))); }
java
public static void notEmpty(String value, String message, Object... arguments) { notEmpty(value, new IllegalArgumentException(format(message, arguments))); }
[ "public", "static", "void", "notEmpty", "(", "String", "value", ",", "String", "message", ",", "Object", "...", "arguments", ")", "{", "notEmpty", "(", "value", ",", "new", "IllegalArgumentException", "(", "format", "(", "message", ",", "arguments", ")", ")"...
Asserts that the given {@link String} is not empty. The assertion holds if and only if the {@link String String} is not the {@link String#isEmpty() empty String}. @param value {@link String} to evaluate. @param message {@link String} containing the message used in the {@link IllegalArgumentException} thrown if the assertion fails. @param arguments array of {@link Object arguments} used as placeholder values when formatting the {@link String message}. @throws java.lang.IllegalArgumentException if the {@link String} is empty. @see #notEmpty(String, RuntimeException) @see java.lang.String
[ "Asserts", "that", "the", "given", "{", "@link", "String", "}", "is", "not", "empty", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/Assert.java#L881-L883
atomix/atomix
core/src/main/java/io/atomix/core/tree/impl/DefaultDocumentTreeNode.java
DefaultDocumentTreeNode.addChild
public Versioned<V> addChild(String name, V newValue, long newVersion) { DefaultDocumentTreeNode<V> child = (DefaultDocumentTreeNode<V>) children.get(name); if (child != null) { return child.value(); } children.put(name, new DefaultDocumentTreeNode<>( new DocumentPath(name, path()), newValue, newVersion, ordering, this)); return null; }
java
public Versioned<V> addChild(String name, V newValue, long newVersion) { DefaultDocumentTreeNode<V> child = (DefaultDocumentTreeNode<V>) children.get(name); if (child != null) { return child.value(); } children.put(name, new DefaultDocumentTreeNode<>( new DocumentPath(name, path()), newValue, newVersion, ordering, this)); return null; }
[ "public", "Versioned", "<", "V", ">", "addChild", "(", "String", "name", ",", "V", "newValue", ",", "long", "newVersion", ")", "{", "DefaultDocumentTreeNode", "<", "V", ">", "child", "=", "(", "DefaultDocumentTreeNode", "<", "V", ">", ")", "children", ".",...
Adds a new child only if one does not exist with the name. @param name relative path name of the child node @param newValue new value to set @param newVersion new version to set @return previous value; can be {@code null} if no child currently exists with that relative path name. a non null return value indicates child already exists and no modification occurred.
[ "Adds", "a", "new", "child", "only", "if", "one", "does", "not", "exist", "with", "the", "name", "." ]
train
https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/core/src/main/java/io/atomix/core/tree/impl/DefaultDocumentTreeNode.java#L98-L106
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/serializer/NormalizerSerializer.java
NormalizerSerializer.parseHeader
private Header parseHeader(InputStream stream) throws IOException, ClassNotFoundException { DataInputStream dis = new DataInputStream(stream); // Check if the stream starts with the expected header String header = dis.readUTF(); if (!header.equals(HEADER)) { throw new IllegalArgumentException( "Could not restore normalizer: invalid header. If this normalizer was saved with a opType-specific " + "strategy like StandardizeSerializerStrategy, use that class to restore it as well."); } // The next byte is an integer indicating the version int version = dis.readInt(); // Right now, we only support version 1 if (version != 1) { throw new IllegalArgumentException("Could not restore normalizer: invalid version (" + version + ")"); } // The next value is a string indicating the normalizer opType NormalizerType type = NormalizerType.valueOf(dis.readUTF()); if (type.equals(NormalizerType.CUSTOM)) { // For custom serializers, the next value is a string with the class opName String strategyClassName = dis.readUTF(); //noinspection unchecked return new Header(type, (Class<? extends NormalizerSerializerStrategy>) Class.forName(strategyClassName)); } else { return new Header(type, null); } }
java
private Header parseHeader(InputStream stream) throws IOException, ClassNotFoundException { DataInputStream dis = new DataInputStream(stream); // Check if the stream starts with the expected header String header = dis.readUTF(); if (!header.equals(HEADER)) { throw new IllegalArgumentException( "Could not restore normalizer: invalid header. If this normalizer was saved with a opType-specific " + "strategy like StandardizeSerializerStrategy, use that class to restore it as well."); } // The next byte is an integer indicating the version int version = dis.readInt(); // Right now, we only support version 1 if (version != 1) { throw new IllegalArgumentException("Could not restore normalizer: invalid version (" + version + ")"); } // The next value is a string indicating the normalizer opType NormalizerType type = NormalizerType.valueOf(dis.readUTF()); if (type.equals(NormalizerType.CUSTOM)) { // For custom serializers, the next value is a string with the class opName String strategyClassName = dis.readUTF(); //noinspection unchecked return new Header(type, (Class<? extends NormalizerSerializerStrategy>) Class.forName(strategyClassName)); } else { return new Header(type, null); } }
[ "private", "Header", "parseHeader", "(", "InputStream", "stream", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "DataInputStream", "dis", "=", "new", "DataInputStream", "(", "stream", ")", ";", "// Check if the stream starts with the expected header", ...
Parse the data header @param stream the input stream @return the parsed header with information about the contents @throws IOException @throws IllegalArgumentException if the data format is invalid
[ "Parse", "the", "data", "header" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/serializer/NormalizerSerializer.java#L218-L245
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/gui/TextField.java
TextField.doUndo
protected void doUndo(int oldCursorPos, String oldText) { if (oldText != null) { setText(oldText); setCursorPos(oldCursorPos); } }
java
protected void doUndo(int oldCursorPos, String oldText) { if (oldText != null) { setText(oldText); setCursorPos(oldCursorPos); } }
[ "protected", "void", "doUndo", "(", "int", "oldCursorPos", ",", "String", "oldText", ")", "{", "if", "(", "oldText", "!=", "null", ")", "{", "setText", "(", "oldText", ")", ";", "setCursorPos", "(", "oldCursorPos", ")", ";", "}", "}" ]
Do the undo of the paste, overrideable for custom behaviour @param oldCursorPos before the paste @param oldText The text before the last paste
[ "Do", "the", "undo", "of", "the", "paste", "overrideable", "for", "custom", "behaviour" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/gui/TextField.java#L360-L365
gallandarakhneorg/afc
core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractTriangle3F.java
AbstractTriangle3F.getPointOnGround
public Point3f getPointOnGround(double x, double y, CoordinateSystem3D system) { assert(system!=null); int idx = system.getHeightCoordinateIndex(); assert(idx==1 || idx==2); FunctionalPoint3D p1 = this.getP1(); assert(p1!=null); Vector3f v = (Vector3f) this.getNormal(); assert(v!=null); if (idx==1 && v.getY()==0.) return new Point3f(x, p1.getY(), y); if (idx==2 && v.getZ()==0.) return new Point3f(x, y, p1.getZ()); double d = -(v.getX() * p1.getX() + v.getY() * p1.getY() + v.getZ() * p1.getZ()); if (idx==2) return new Point3f(x, y, -(v.getX() * x + v.getY() * y + d) / v.getZ()); return new Point3f(x, -(v.getX() * x + v.getZ() * y + d) / v.getY(), y); }
java
public Point3f getPointOnGround(double x, double y, CoordinateSystem3D system) { assert(system!=null); int idx = system.getHeightCoordinateIndex(); assert(idx==1 || idx==2); FunctionalPoint3D p1 = this.getP1(); assert(p1!=null); Vector3f v = (Vector3f) this.getNormal(); assert(v!=null); if (idx==1 && v.getY()==0.) return new Point3f(x, p1.getY(), y); if (idx==2 && v.getZ()==0.) return new Point3f(x, y, p1.getZ()); double d = -(v.getX() * p1.getX() + v.getY() * p1.getY() + v.getZ() * p1.getZ()); if (idx==2) return new Point3f(x, y, -(v.getX() * x + v.getY() * y + d) / v.getZ()); return new Point3f(x, -(v.getX() * x + v.getZ() * y + d) / v.getY(), y); }
[ "public", "Point3f", "getPointOnGround", "(", "double", "x", ",", "double", "y", ",", "CoordinateSystem3D", "system", ")", "{", "assert", "(", "system", "!=", "null", ")", ";", "int", "idx", "=", "system", ".", "getHeightCoordinateIndex", "(", ")", ";", "a...
Replies the projection on the triangle that is representing a ground. <p> Assuming that the triangle is representing a face of a terrain/ground, this function compute the position on the ground just below the given position. The input of this function is the coordinate of a point on the horizontal plane. @param x is the x-coordinate on point to project on the horizontal plane. @param y is the y-coordinate of point to project on the horizontal plane. @param system is the coordinate system to use for determining the up coordinate. @return the position on the ground.
[ "Replies", "the", "projection", "on", "the", "triangle", "that", "is", "representing", "a", "ground", ".", "<p", ">", "Assuming", "that", "the", "triangle", "is", "representing", "a", "face", "of", "a", "terrain", "/", "ground", "this", "function", "compute"...
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractTriangle3F.java#L2218-L2238
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/nephele/services/iomanager/BlockChannelReader.java
BlockChannelReader.readBlock
public void readBlock(MemorySegment segment) throws IOException { // check the error state of this channel checkErroneous(); // write the current buffer and get the next one // the statements have to be in this order to avoid incrementing the counter // after the channel has been closed this.requestsNotReturned.incrementAndGet(); if (this.closed || this.requestQueue.isClosed()) { // if we found ourselves closed after the counter increment, // decrement the counter again and do not forward the request this.requestsNotReturned.decrementAndGet(); throw new IOException("The reader has been closed."); } this.requestQueue.add(new SegmentReadRequest(this, segment)); }
java
public void readBlock(MemorySegment segment) throws IOException { // check the error state of this channel checkErroneous(); // write the current buffer and get the next one // the statements have to be in this order to avoid incrementing the counter // after the channel has been closed this.requestsNotReturned.incrementAndGet(); if (this.closed || this.requestQueue.isClosed()) { // if we found ourselves closed after the counter increment, // decrement the counter again and do not forward the request this.requestsNotReturned.decrementAndGet(); throw new IOException("The reader has been closed."); } this.requestQueue.add(new SegmentReadRequest(this, segment)); }
[ "public", "void", "readBlock", "(", "MemorySegment", "segment", ")", "throws", "IOException", "{", "// check the error state of this channel", "checkErroneous", "(", ")", ";", "// write the current buffer and get the next one", "// the statements have to be in this order to avoid inc...
Issues a read request, which will asynchronously fill the given segment with the next block in the underlying file channel. Once the read request is fulfilled, the segment will be added to this reader's return queue. @param segment The segment to read the block into. @throws IOException Thrown, when the reader encounters an I/O error. Due to the asynchronous nature of the reader, the exception thrown here may have been caused by an earlier read request.
[ "Issues", "a", "read", "request", "which", "will", "asynchronously", "fill", "the", "given", "segment", "with", "the", "next", "block", "in", "the", "underlying", "file", "channel", ".", "Once", "the", "read", "request", "is", "fulfilled", "the", "segment", ...
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/services/iomanager/BlockChannelReader.java#L66-L82
jenkinsci/jenkins
core/src/main/java/jenkins/model/Jenkins.java
Jenkins.doLoginEntry
public void doLoginEntry( StaplerRequest req, StaplerResponse rsp ) throws IOException { if(req.getUserPrincipal()==null) { rsp.sendRedirect2("noPrincipal"); return; } // TODO fire something in SecurityListener? String from = req.getParameter("from"); if(from!=null && from.startsWith("/") && !from.equals("/loginError")) { rsp.sendRedirect2(from); // I'm bit uncomfortable letting users redirected to other sites, make sure the URL falls into this domain return; } String url = AbstractProcessingFilter.obtainFullRequestUrl(req); if(url!=null) { // if the login redirect is initiated by Acegi // this should send the user back to where s/he was from. rsp.sendRedirect2(url); return; } rsp.sendRedirect2("."); }
java
public void doLoginEntry( StaplerRequest req, StaplerResponse rsp ) throws IOException { if(req.getUserPrincipal()==null) { rsp.sendRedirect2("noPrincipal"); return; } // TODO fire something in SecurityListener? String from = req.getParameter("from"); if(from!=null && from.startsWith("/") && !from.equals("/loginError")) { rsp.sendRedirect2(from); // I'm bit uncomfortable letting users redirected to other sites, make sure the URL falls into this domain return; } String url = AbstractProcessingFilter.obtainFullRequestUrl(req); if(url!=null) { // if the login redirect is initiated by Acegi // this should send the user back to where s/he was from. rsp.sendRedirect2(url); return; } rsp.sendRedirect2("."); }
[ "public", "void", "doLoginEntry", "(", "StaplerRequest", "req", ",", "StaplerResponse", "rsp", ")", "throws", "IOException", "{", "if", "(", "req", ".", "getUserPrincipal", "(", ")", "==", "null", ")", "{", "rsp", ".", "sendRedirect2", "(", "\"noPrincipal\"", ...
Called once the user logs in. Just forward to the top page. Used only by {@link LegacySecurityRealm}.
[ "Called", "once", "the", "user", "logs", "in", ".", "Just", "forward", "to", "the", "top", "page", ".", "Used", "only", "by", "{" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/model/Jenkins.java#L3998-L4021
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ChunkedIntArray.java
ChunkedIntArray.readSlot
void readSlot(int position, int[] buffer) { /* try { System.arraycopy(fastArray, position*slotsize, buffer, 0, slotsize); } catch(ArrayIndexOutOfBoundsException aioobe) */ { // System.out.println("Using slow read (2): "+position); position *= slotsize; int chunkpos = position >> lowbits; int slotpos = (position & lowmask); // Grow if needed if (chunkpos > chunks.size() - 1) chunks.addElement(new int[chunkalloc]); int[] chunk = chunks.elementAt(chunkpos); System.arraycopy(chunk,slotpos,buffer,0,slotsize); } }
java
void readSlot(int position, int[] buffer) { /* try { System.arraycopy(fastArray, position*slotsize, buffer, 0, slotsize); } catch(ArrayIndexOutOfBoundsException aioobe) */ { // System.out.println("Using slow read (2): "+position); position *= slotsize; int chunkpos = position >> lowbits; int slotpos = (position & lowmask); // Grow if needed if (chunkpos > chunks.size() - 1) chunks.addElement(new int[chunkalloc]); int[] chunk = chunks.elementAt(chunkpos); System.arraycopy(chunk,slotpos,buffer,0,slotsize); } }
[ "void", "readSlot", "(", "int", "position", ",", "int", "[", "]", "buffer", ")", "{", "/*\n try\n {\n System.arraycopy(fastArray, position*slotsize, buffer, 0, slotsize);\n }\n catch(ArrayIndexOutOfBoundsException aioobe)\n */", "{", "// System.out.println(\"Using slo...
Retrieve the contents of a record into a user-supplied buffer array. Used to reduce addressing overhead when code will access several columns of the record. @param position int Record number @param buffer int[] Integer array provided by user, must be large enough to hold a complete record.
[ "Retrieve", "the", "contents", "of", "a", "record", "into", "a", "user", "-", "supplied", "buffer", "array", ".", "Used", "to", "reduce", "addressing", "overhead", "when", "code", "will", "access", "several", "columns", "of", "the", "record", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ChunkedIntArray.java#L245-L266
sculptor/sculptor
sculptor-generator/sculptor-generator-core/src/main/java/org/sculptor/generator/util/PropertiesBase.java
PropertiesBase.getProperties
Properties getProperties(String prefix, boolean removePrefix) { Properties result = new Properties(); for (String key : getPropertyNames()) { if (key.startsWith(prefix)) { result.put((removePrefix) ? key.substring(prefix.length()) : key, getProperty(key)); } } return result; }
java
Properties getProperties(String prefix, boolean removePrefix) { Properties result = new Properties(); for (String key : getPropertyNames()) { if (key.startsWith(prefix)) { result.put((removePrefix) ? key.substring(prefix.length()) : key, getProperty(key)); } } return result; }
[ "Properties", "getProperties", "(", "String", "prefix", ",", "boolean", "removePrefix", ")", "{", "Properties", "result", "=", "new", "Properties", "(", ")", ";", "for", "(", "String", "key", ":", "getPropertyNames", "(", ")", ")", "{", "if", "(", "key", ...
Gets all properties with a key starting with prefix. @param prefix @param removePrefix remove prefix in the resulting properties or not @return properties starting with prefix
[ "Gets", "all", "properties", "with", "a", "key", "starting", "with", "prefix", "." ]
train
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-generator/sculptor-generator-core/src/main/java/org/sculptor/generator/util/PropertiesBase.java#L285-L293
jpush/jmessage-api-java-client
src/main/java/cn/jmessage/api/reportv2/ReportClient.java
ReportClient.v2GetUserMessagesByCursor
public MessageListResult v2GetUserMessagesByCursor(String username, String cursor) throws APIConnectionException, APIRequestException { StringUtils.checkUsername(username); if (null != cursor) { String requestUrl = mBaseReportPath + mV2UserPath + "/" + username + "/messages?cursor=" + cursor; ResponseWrapper response = _httpClient.sendGet(requestUrl); return MessageListResult.fromResponse(response, MessageListResult.class); } else { throw new IllegalArgumentException("the cursor parameter should not be null"); } }
java
public MessageListResult v2GetUserMessagesByCursor(String username, String cursor) throws APIConnectionException, APIRequestException { StringUtils.checkUsername(username); if (null != cursor) { String requestUrl = mBaseReportPath + mV2UserPath + "/" + username + "/messages?cursor=" + cursor; ResponseWrapper response = _httpClient.sendGet(requestUrl); return MessageListResult.fromResponse(response, MessageListResult.class); } else { throw new IllegalArgumentException("the cursor parameter should not be null"); } }
[ "public", "MessageListResult", "v2GetUserMessagesByCursor", "(", "String", "username", ",", "String", "cursor", ")", "throws", "APIConnectionException", ",", "APIRequestException", "{", "StringUtils", ".", "checkUsername", "(", "username", ")", ";", "if", "(", "null",...
Get user's message list with cursor, the cursor will effective in 120 seconds. And will return same count of messages as first request. @param username Necessary parameter. @param cursor First request will return cursor @return MessageListResult @throws APIConnectionException connect exception @throws APIRequestException request exception
[ "Get", "user", "s", "message", "list", "with", "cursor", "the", "cursor", "will", "effective", "in", "120", "seconds", ".", "And", "will", "return", "same", "count", "of", "messages", "as", "first", "request", "." ]
train
https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/reportv2/ReportClient.java#L186-L196
wellner/jcarafe
jcarafe-core/src/main/java/cern/colt/map/AbstractIntDoubleMap.java
AbstractIntDoubleMap.assign
public void assign(AbstractIntDoubleMap other) { clear(); other.forEachPair( new IntDoubleProcedure() { public boolean apply(int key, double value) { put(key,value); return true; } } ); }
java
public void assign(AbstractIntDoubleMap other) { clear(); other.forEachPair( new IntDoubleProcedure() { public boolean apply(int key, double value) { put(key,value); return true; } } ); }
[ "public", "void", "assign", "(", "AbstractIntDoubleMap", "other", ")", "{", "clear", "(", ")", ";", "other", ".", "forEachPair", "(", "new", "IntDoubleProcedure", "(", ")", "{", "public", "boolean", "apply", "(", "int", "key", ",", "double", "value", ")", ...
Clears the receiver, then adds all (key,value) pairs of <tt>other</tt>values to it. @param other the other map to be copied into the receiver.
[ "Clears", "the", "receiver", "then", "adds", "all", "(", "key", "value", ")", "pairs", "of", "<tt", ">", "other<", "/", "tt", ">", "values", "to", "it", "." ]
train
https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/cern/colt/map/AbstractIntDoubleMap.java#L54-L64
knowm/XChart
xchart/src/main/java/org/knowm/xchart/XYChart.java
XYChart.addSeries
public XYSeries addSeries(String seriesName, int[] xData, int[] yData) { return addSeries(seriesName, xData, yData, null); }
java
public XYSeries addSeries(String seriesName, int[] xData, int[] yData) { return addSeries(seriesName, xData, yData, null); }
[ "public", "XYSeries", "addSeries", "(", "String", "seriesName", ",", "int", "[", "]", "xData", ",", "int", "[", "]", "yData", ")", "{", "return", "addSeries", "(", "seriesName", ",", "xData", ",", "yData", ",", "null", ")", ";", "}" ]
Add a series for a X-Y type chart using using int arrays @param seriesName @param xData the X-Axis data @param yData the Y-Axis data @return A Series object that you can set properties on
[ "Add", "a", "series", "for", "a", "X", "-", "Y", "type", "chart", "using", "using", "int", "arrays" ]
train
https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/XYChart.java#L165-L168
ow2-chameleon/fuchsia
importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java
ZWaveController.requestBatteryLevel
public void requestBatteryLevel(int nodeId, int endpoint) { ZWaveNode node = this.getNode(nodeId); SerialMessage serialMessage = null; ZWaveBatteryCommandClass zwaveBatteryCommandClass = (ZWaveBatteryCommandClass)node.resolveCommandClass(ZWaveCommandClass.CommandClass.BATTERY, endpoint); if (zwaveBatteryCommandClass == null) { logger.error("No Command Class BATTERY found on node {}, instance/endpoint {} to request value.", nodeId, endpoint); return; } serialMessage = node.encapsulate(zwaveBatteryCommandClass.getValueMessage(), zwaveBatteryCommandClass, endpoint); if (serialMessage != null) this.sendData(serialMessage); }
java
public void requestBatteryLevel(int nodeId, int endpoint) { ZWaveNode node = this.getNode(nodeId); SerialMessage serialMessage = null; ZWaveBatteryCommandClass zwaveBatteryCommandClass = (ZWaveBatteryCommandClass)node.resolveCommandClass(ZWaveCommandClass.CommandClass.BATTERY, endpoint); if (zwaveBatteryCommandClass == null) { logger.error("No Command Class BATTERY found on node {}, instance/endpoint {} to request value.", nodeId, endpoint); return; } serialMessage = node.encapsulate(zwaveBatteryCommandClass.getValueMessage(), zwaveBatteryCommandClass, endpoint); if (serialMessage != null) this.sendData(serialMessage); }
[ "public", "void", "requestBatteryLevel", "(", "int", "nodeId", ",", "int", "endpoint", ")", "{", "ZWaveNode", "node", "=", "this", ".", "getNode", "(", "nodeId", ")", ";", "SerialMessage", "serialMessage", "=", "null", ";", "ZWaveBatteryCommandClass", "zwaveBatt...
Request the battery level from the node / endpoint; @param nodeId the node id to request the battery level for. @param endpoint the endpoint to request the battery level for.
[ "Request", "the", "battery", "level", "from", "the", "node", "/", "endpoint", ";" ]
train
https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java#L881-L896
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java
MemberSummaryBuilder.buildConstructorsSummary
public void buildConstructorsSummary(XMLNode node, Content memberSummaryTree) { MemberSummaryWriter writer = memberSummaryWriters[VisibleMemberMap.CONSTRUCTORS]; VisibleMemberMap visibleMemberMap = visibleMemberMaps[VisibleMemberMap.CONSTRUCTORS]; addSummary(writer, visibleMemberMap, false, memberSummaryTree); }
java
public void buildConstructorsSummary(XMLNode node, Content memberSummaryTree) { MemberSummaryWriter writer = memberSummaryWriters[VisibleMemberMap.CONSTRUCTORS]; VisibleMemberMap visibleMemberMap = visibleMemberMaps[VisibleMemberMap.CONSTRUCTORS]; addSummary(writer, visibleMemberMap, false, memberSummaryTree); }
[ "public", "void", "buildConstructorsSummary", "(", "XMLNode", "node", ",", "Content", "memberSummaryTree", ")", "{", "MemberSummaryWriter", "writer", "=", "memberSummaryWriters", "[", "VisibleMemberMap", ".", "CONSTRUCTORS", "]", ";", "VisibleMemberMap", "visibleMemberMap...
Build the constructor summary. @param node the XML element that specifies which components to document @param memberSummaryTree the content tree to which the documentation will be added
[ "Build", "the", "constructor", "summary", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java#L317-L323
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/SwingBindingFactory.java
SwingBindingFactory.createBoundList
public Binding createBoundList(String selectionFormProperty, ValueModel selectableItemsHolder, String renderedProperty) { return createBoundList(selectionFormProperty, selectableItemsHolder, renderedProperty, null); }
java
public Binding createBoundList(String selectionFormProperty, ValueModel selectableItemsHolder, String renderedProperty) { return createBoundList(selectionFormProperty, selectableItemsHolder, renderedProperty, null); }
[ "public", "Binding", "createBoundList", "(", "String", "selectionFormProperty", ",", "ValueModel", "selectableItemsHolder", ",", "String", "renderedProperty", ")", "{", "return", "createBoundList", "(", "selectionFormProperty", ",", "selectableItemsHolder", ",", "renderedPr...
Binds the values specified in the collection contained within <code>selectableItemsHolder</code> to a {@link JList}, with any user selection being placed in the form property referred to by <code>selectionFormProperty</code>. Each item in the list will be rendered by looking up a property on the item by the name contained in <code>renderedProperty</code>, retrieving the value of the property, and rendering that value in the UI. Note that the selection in the bound list will track any changes to the <code>selectionFormProperty</code>. This is especially useful to preselect items in the list - if <code>selectionFormProperty</code> is not empty when the list is bound, then its content will be used for the initial selection. This method uses default behavior to determine the selection mode of the resulting <code>JList</code>: if <code>selectionFormProperty</code> refers to a {@link java.util.Collection} type property, then {@link javax.swing.ListSelectionModel#MULTIPLE_INTERVAL_SELECTION} will be used, otherwise {@link javax.swing.ListSelectionModel#SINGLE_SELECTION} will be used. @param selectionFormProperty form property to hold user's selection. This property must either be compatible with the item objects contained in <code>selectableItemsHolder</code> (in which case only single selection makes sense), or must be a <code>Collection</code> type, which allows for multiple selection. @param selectableItemsHolder <code>ValueModel</code> containing the items with which to populate the list. @param renderedProperty the property to be queried for each item in the list, the result of which will be used to render that item in the UI @return
[ "Binds", "the", "values", "specified", "in", "the", "collection", "contained", "within", "<code", ">", "selectableItemsHolder<", "/", "code", ">", "to", "a", "{", "@link", "JList", "}", "with", "any", "user", "selection", "being", "placed", "in", "the", "for...
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/SwingBindingFactory.java#L224-L227
Alluxio/alluxio
core/server/common/src/main/java/alluxio/master/PrimarySelectorClient.java
PrimarySelectorClient.getNewCuratorClient
private CuratorFramework getNewCuratorClient() { CuratorFramework client = CuratorFrameworkFactory.newClient(mZookeeperAddress, (int) ServerConfiguration.getMs(PropertyKey.ZOOKEEPER_SESSION_TIMEOUT), (int) ServerConfiguration.getMs(PropertyKey.ZOOKEEPER_CONNECTION_TIMEOUT), new ExponentialBackoffRetry(Constants.SECOND_MS, 3)); client.start(); // Sometimes, if the master crashes and restarts too quickly (faster than the zookeeper // timeout), zookeeper thinks the new client is still an old one. In order to ensure a clean // state, explicitly close the "old" client and recreate a new one. client.close(); client = CuratorFrameworkFactory.newClient(mZookeeperAddress, (int) ServerConfiguration.getMs(PropertyKey.ZOOKEEPER_SESSION_TIMEOUT), (int) ServerConfiguration.getMs(PropertyKey.ZOOKEEPER_CONNECTION_TIMEOUT), new ExponentialBackoffRetry(Constants.SECOND_MS, 3)); client.start(); return client; }
java
private CuratorFramework getNewCuratorClient() { CuratorFramework client = CuratorFrameworkFactory.newClient(mZookeeperAddress, (int) ServerConfiguration.getMs(PropertyKey.ZOOKEEPER_SESSION_TIMEOUT), (int) ServerConfiguration.getMs(PropertyKey.ZOOKEEPER_CONNECTION_TIMEOUT), new ExponentialBackoffRetry(Constants.SECOND_MS, 3)); client.start(); // Sometimes, if the master crashes and restarts too quickly (faster than the zookeeper // timeout), zookeeper thinks the new client is still an old one. In order to ensure a clean // state, explicitly close the "old" client and recreate a new one. client.close(); client = CuratorFrameworkFactory.newClient(mZookeeperAddress, (int) ServerConfiguration.getMs(PropertyKey.ZOOKEEPER_SESSION_TIMEOUT), (int) ServerConfiguration.getMs(PropertyKey.ZOOKEEPER_CONNECTION_TIMEOUT), new ExponentialBackoffRetry(Constants.SECOND_MS, 3)); client.start(); return client; }
[ "private", "CuratorFramework", "getNewCuratorClient", "(", ")", "{", "CuratorFramework", "client", "=", "CuratorFrameworkFactory", ".", "newClient", "(", "mZookeeperAddress", ",", "(", "int", ")", "ServerConfiguration", ".", "getMs", "(", "PropertyKey", ".", "ZOOKEEPE...
Returns a new client for the zookeeper connection. The client is already started before returning. @return a new {@link CuratorFramework} client to use for leader selection
[ "Returns", "a", "new", "client", "for", "the", "zookeeper", "connection", ".", "The", "client", "is", "already", "started", "before", "returning", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/master/PrimarySelectorClient.java#L176-L193
Coveros/selenified
src/main/java/com/coveros/selenified/Selenified.java
Selenified.setAuthor
protected static void setAuthor(Selenified clazz, ITestContext context, String author) { context.setAttribute(clazz.getClass().getName() + "Author", author); }
java
protected static void setAuthor(Selenified clazz, ITestContext context, String author) { context.setAttribute(clazz.getClass().getName() + "Author", author); }
[ "protected", "static", "void", "setAuthor", "(", "Selenified", "clazz", ",", "ITestContext", "context", ",", "String", "author", ")", "{", "context", ".", "setAttribute", "(", "clazz", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\"Author\"", ...
Sets the author of the current test suite being executed. @param clazz - the test suite class, used for making threadsafe storage of application, allowing suites to have independent applications under test, run at the same time @param context - the TestNG context associated with the test suite, used for storing app url information @param author - the author of the test suite
[ "Sets", "the", "author", "of", "the", "current", "test", "suite", "being", "executed", "." ]
train
https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/Selenified.java#L164-L166
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRTransform.java
GVRTransform.setRotation
public GVRTransform setRotation(float w, float x, float y, float z) { NativeTransform.setRotation(getNative(), w, x, y, z); return this; }
java
public GVRTransform setRotation(float w, float x, float y, float z) { NativeTransform.setRotation(getNative(), w, x, y, z); return this; }
[ "public", "GVRTransform", "setRotation", "(", "float", "w", ",", "float", "x", ",", "float", "y", ",", "float", "z", ")", "{", "NativeTransform", ".", "setRotation", "(", "getNative", "(", ")", ",", "w", ",", "x", ",", "y", ",", "z", ")", ";", "ret...
Set rotation, as a quaternion. Sets the transform's current rotation in quaternion terms. Overrides any previous rotations using {@link #rotate(float, float, float, float) rotate()}, {@link #rotateByAxis(float, float, float, float) rotateByAxis()} , or {@link #rotateByAxisWithPivot(float, float, float, float, float, float, float) rotateByAxisWithPivot()} . @param w 'W' component of the quaternion. @param x 'X' component of the quaternion. @param y 'Y' component of the quaternion. @param z 'Z' component of the quaternion.
[ "Set", "rotation", "as", "a", "quaternion", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRTransform.java#L221-L224
autermann/yaml
src/main/java/com/github/autermann/yaml/Yaml.java
Yaml.dumpAll
public void dumpAll(Iterator<? extends YamlNode> data, Writer output) { getDelegate().dumpAll(data, output); }
java
public void dumpAll(Iterator<? extends YamlNode> data, Writer output) { getDelegate().dumpAll(data, output); }
[ "public", "void", "dumpAll", "(", "Iterator", "<", "?", "extends", "YamlNode", ">", "data", ",", "Writer", "output", ")", "{", "getDelegate", "(", ")", ".", "dumpAll", "(", "data", ",", "output", ")", ";", "}" ]
Dumps {@code data} into a {@code Writer}. @param data the data @param output the writer @see org.yaml.snakeyaml.Yaml#dumpAll(Iterator, Writer)
[ "Dumps", "{", "@code", "data", "}", "into", "a", "{", "@code", "Writer", "}", "." ]
train
https://github.com/autermann/yaml/blob/5f8ab03e4fec3a2abe72c03561cdaa3a3936634d/src/main/java/com/github/autermann/yaml/Yaml.java#L148-L150
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/features/FeatureUtilities.java
FeatureUtilities.envelopeToPolygon
public static Polygon envelopeToPolygon( Envelope2D envelope ) { double w = envelope.getMinX(); double e = envelope.getMaxX(); double s = envelope.getMinY(); double n = envelope.getMaxY(); Coordinate[] coords = new Coordinate[5]; coords[0] = new Coordinate(w, n); coords[1] = new Coordinate(e, n); coords[2] = new Coordinate(e, s); coords[3] = new Coordinate(w, s); coords[4] = new Coordinate(w, n); GeometryFactory gf = GeometryUtilities.gf(); LinearRing linearRing = gf.createLinearRing(coords); Polygon polygon = gf.createPolygon(linearRing, null); return polygon; }
java
public static Polygon envelopeToPolygon( Envelope2D envelope ) { double w = envelope.getMinX(); double e = envelope.getMaxX(); double s = envelope.getMinY(); double n = envelope.getMaxY(); Coordinate[] coords = new Coordinate[5]; coords[0] = new Coordinate(w, n); coords[1] = new Coordinate(e, n); coords[2] = new Coordinate(e, s); coords[3] = new Coordinate(w, s); coords[4] = new Coordinate(w, n); GeometryFactory gf = GeometryUtilities.gf(); LinearRing linearRing = gf.createLinearRing(coords); Polygon polygon = gf.createPolygon(linearRing, null); return polygon; }
[ "public", "static", "Polygon", "envelopeToPolygon", "(", "Envelope2D", "envelope", ")", "{", "double", "w", "=", "envelope", ".", "getMinX", "(", ")", ";", "double", "e", "=", "envelope", ".", "getMaxX", "(", ")", ";", "double", "s", "=", "envelope", "."...
Create a {@link Polygon} from an {@link Envelope}. @param envelope the envelope to convert. @return the created polygon.
[ "Create", "a", "{", "@link", "Polygon", "}", "from", "an", "{", "@link", "Envelope", "}", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/features/FeatureUtilities.java#L634-L651
rometools/rome
rome/src/main/java/com/rometools/rome/io/impl/RSS090Parser.java
RSS090Parser.parseItem
protected Item parseItem(final Element rssRoot, final Element eItem, final Locale locale) { final Item item = new Item(); final Element title = eItem.getChild("title", getRSSNamespace()); if (title != null) { item.setTitle(title.getText()); } final Element link = eItem.getChild("link", getRSSNamespace()); if (link != null) { item.setLink(link.getText()); item.setUri(link.getText()); } item.setModules(parseItemModules(eItem, locale)); final List<Element> foreignMarkup = extractForeignMarkup(eItem, item, getRSSNamespace()); // content:encoded elements are treated special, without a module, they have to be removed // from the foreign markup to avoid duplication in case of read/write. Note that this fix // will break if a content module is used final Iterator<Element> iterator = foreignMarkup.iterator(); while (iterator.hasNext()) { final Element element = iterator.next(); final Namespace eNamespace = element.getNamespace(); final String eName = element.getName(); if (getContentNamespace().equals(eNamespace) && eName.equals("encoded")) { iterator.remove(); } } if (!foreignMarkup.isEmpty()) { item.setForeignMarkup(foreignMarkup); } return item; }
java
protected Item parseItem(final Element rssRoot, final Element eItem, final Locale locale) { final Item item = new Item(); final Element title = eItem.getChild("title", getRSSNamespace()); if (title != null) { item.setTitle(title.getText()); } final Element link = eItem.getChild("link", getRSSNamespace()); if (link != null) { item.setLink(link.getText()); item.setUri(link.getText()); } item.setModules(parseItemModules(eItem, locale)); final List<Element> foreignMarkup = extractForeignMarkup(eItem, item, getRSSNamespace()); // content:encoded elements are treated special, without a module, they have to be removed // from the foreign markup to avoid duplication in case of read/write. Note that this fix // will break if a content module is used final Iterator<Element> iterator = foreignMarkup.iterator(); while (iterator.hasNext()) { final Element element = iterator.next(); final Namespace eNamespace = element.getNamespace(); final String eName = element.getName(); if (getContentNamespace().equals(eNamespace) && eName.equals("encoded")) { iterator.remove(); } } if (!foreignMarkup.isEmpty()) { item.setForeignMarkup(foreignMarkup); } return item; }
[ "protected", "Item", "parseItem", "(", "final", "Element", "rssRoot", ",", "final", "Element", "eItem", ",", "final", "Locale", "locale", ")", "{", "final", "Item", "item", "=", "new", "Item", "(", ")", ";", "final", "Element", "title", "=", "eItem", "."...
Parses an item element of an RSS document looking for item information. <p/> It reads title and link out of the 'item' element. <p/> @param rssRoot the root element of the RSS document in case it's needed for context. @param eItem the item element to parse. @return the parsed RSSItem bean.
[ "Parses", "an", "item", "element", "of", "an", "RSS", "document", "looking", "for", "item", "information", ".", "<p", "/", ">", "It", "reads", "title", "and", "link", "out", "of", "the", "item", "element", ".", "<p", "/", ">" ]
train
https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome/src/main/java/com/rometools/rome/io/impl/RSS090Parser.java#L293-L329
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java
AnycastOutputHandler.deleteAndUnlockPersistentStream
private void deleteAndUnlockPersistentStream(StreamInfo sinfo, ArrayList valueTicks) throws MessageStoreException, SIRollbackException, SIConnectionLostException, SIIncorrectCallException, SIResourceException, SIErrorException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "deleteAndUnlockPersistentStream", new Object[]{sinfo, valueTicks}); // create a transaction, and delete all AOValue ticks, unlock the persistent locks, // and then remove sinfo.itemStream, and sinfo.item LocalTransaction tran = getLocalTransaction(); cleanupTicks(sinfo, tran, valueTicks); Transaction msTran = mp.resolveAndEnlistMsgStoreTransaction(tran); sinfo.itemStream.lockItemIfAvailable(controlItemLockID); // will always be available sinfo.itemStream.remove(msTran, controlItemLockID); if (sinfo.item != null) { sinfo.item.lockItemIfAvailable(controlItemLockID); // will always be available sinfo.item.remove(msTran, controlItemLockID); } tran.commit(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "deleteAndUnlockPersistentStream"); }
java
private void deleteAndUnlockPersistentStream(StreamInfo sinfo, ArrayList valueTicks) throws MessageStoreException, SIRollbackException, SIConnectionLostException, SIIncorrectCallException, SIResourceException, SIErrorException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "deleteAndUnlockPersistentStream", new Object[]{sinfo, valueTicks}); // create a transaction, and delete all AOValue ticks, unlock the persistent locks, // and then remove sinfo.itemStream, and sinfo.item LocalTransaction tran = getLocalTransaction(); cleanupTicks(sinfo, tran, valueTicks); Transaction msTran = mp.resolveAndEnlistMsgStoreTransaction(tran); sinfo.itemStream.lockItemIfAvailable(controlItemLockID); // will always be available sinfo.itemStream.remove(msTran, controlItemLockID); if (sinfo.item != null) { sinfo.item.lockItemIfAvailable(controlItemLockID); // will always be available sinfo.item.remove(msTran, controlItemLockID); } tran.commit(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "deleteAndUnlockPersistentStream"); }
[ "private", "void", "deleteAndUnlockPersistentStream", "(", "StreamInfo", "sinfo", ",", "ArrayList", "valueTicks", ")", "throws", "MessageStoreException", ",", "SIRollbackException", ",", "SIConnectionLostException", ",", "SIIncorrectCallException", ",", "SIResourceException", ...
remove the persistent ticks and the itemstream and started-flush item
[ "remove", "the", "persistent", "ticks", "and", "the", "itemstream", "and", "started", "-", "flush", "item" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java#L3207-L3230
hsiafan/requests
src/main/java/net/dongliu/requests/RawResponse.java
RawResponse.readToText
public String readToText() { Charset charset = getCharset(); try (InputStream in = body(); Reader reader = new InputStreamReader(in, charset)) { return Readers.readAll(reader); } catch (IOException e) { throw new RequestsException(e); } finally { close(); } }
java
public String readToText() { Charset charset = getCharset(); try (InputStream in = body(); Reader reader = new InputStreamReader(in, charset)) { return Readers.readAll(reader); } catch (IOException e) { throw new RequestsException(e); } finally { close(); } }
[ "public", "String", "readToText", "(", ")", "{", "Charset", "charset", "=", "getCharset", "(", ")", ";", "try", "(", "InputStream", "in", "=", "body", "(", ")", ";", "Reader", "reader", "=", "new", "InputStreamReader", "(", "in", ",", "charset", ")", "...
Read response body to string. return empty string if response has no body
[ "Read", "response", "body", "to", "string", ".", "return", "empty", "string", "if", "response", "has", "no", "body" ]
train
https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/RawResponse.java#L115-L125
jbundle/jbundle
app/program/screen/src/main/java/org/jbundle/app/program/resource/screen/ResourceGridScreen.java
ResourceGridScreen.doCommand
public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions) { if (strCommand.equalsIgnoreCase(MenuConstants.FORMDETAIL)) return (this.onForm(null, ScreenConstants.DETAIL_MODE, true, iCommandOptions, null) != null); else return super.doCommand(strCommand, sourceSField, iCommandOptions); }
java
public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions) { if (strCommand.equalsIgnoreCase(MenuConstants.FORMDETAIL)) return (this.onForm(null, ScreenConstants.DETAIL_MODE, true, iCommandOptions, null) != null); else return super.doCommand(strCommand, sourceSField, iCommandOptions); }
[ "public", "boolean", "doCommand", "(", "String", "strCommand", ",", "ScreenField", "sourceSField", ",", "int", "iCommandOptions", ")", "{", "if", "(", "strCommand", ".", "equalsIgnoreCase", "(", "MenuConstants", ".", "FORMDETAIL", ")", ")", "return", "(", "this"...
Process the command. <br />Step 1 - Process the command if possible and return true if processed. <br />Step 2 - If I can't process, pass to all children (with me as the source). <br />Step 3 - If children didn't process, pass to parent (with me as the source). <br />Note: Never pass to a parent or child that matches the source (to avoid an endless loop). @param strCommand The command to process. @param sourceSField The source screen field (to avoid echos). @param iCommandOptions If this command creates a new screen, create in a new window? @return true if success.
[ "Process", "the", "command", ".", "<br", "/", ">", "Step", "1", "-", "Process", "the", "command", "if", "possible", "and", "return", "true", "if", "processed", ".", "<br", "/", ">", "Step", "2", "-", "If", "I", "can", "t", "process", "pass", "to", ...
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/screen/src/main/java/org/jbundle/app/program/resource/screen/ResourceGridScreen.java#L165-L171
UrielCh/ovh-java-sdk
ovh-java-sdk-connectivity/src/main/java/net/minidev/ovh/api/ApiOvhConnectivity.java
ApiOvhConnectivity.eligibility_search_buildingsByLine_POST
public OvhAsyncTaskArray<OvhBuilding> eligibility_search_buildingsByLine_POST(String lineNumber, OvhLineStatusEnum status) throws IOException { String qPath = "/connectivity/eligibility/search/buildingsByLine"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "lineNumber", lineNumber); addBody(o, "status", status); String resp = execN(qPath, "POST", sb.toString(), o); return convertTo(resp, t1); }
java
public OvhAsyncTaskArray<OvhBuilding> eligibility_search_buildingsByLine_POST(String lineNumber, OvhLineStatusEnum status) throws IOException { String qPath = "/connectivity/eligibility/search/buildingsByLine"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "lineNumber", lineNumber); addBody(o, "status", status); String resp = execN(qPath, "POST", sb.toString(), o); return convertTo(resp, t1); }
[ "public", "OvhAsyncTaskArray", "<", "OvhBuilding", ">", "eligibility_search_buildingsByLine_POST", "(", "String", "lineNumber", ",", "OvhLineStatusEnum", "status", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/connectivity/eligibility/search/buildingsByLine\"",...
Get building references from a given line number REST: POST /connectivity/eligibility/search/buildingsByLine @param lineNumber [required] Line number @param status [required] Status of the line number
[ "Get", "building", "references", "from", "a", "given", "line", "number" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-connectivity/src/main/java/net/minidev/ovh/api/ApiOvhConnectivity.java#L139-L147
ykrasik/jaci
jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/output/CliPrinter.java
CliPrinter.printCommand
public void printCommand(CliCommand command) { final PrintContext context = new PrintContext(); // Print command name : description printIdentifiable(context, command); // Print each param name : description printIdentifiables(context, command.getParams()); }
java
public void printCommand(CliCommand command) { final PrintContext context = new PrintContext(); // Print command name : description printIdentifiable(context, command); // Print each param name : description printIdentifiables(context, command.getParams()); }
[ "public", "void", "printCommand", "(", "CliCommand", "command", ")", "{", "final", "PrintContext", "context", "=", "new", "PrintContext", "(", ")", ";", "// Print command name : description", "printIdentifiable", "(", "context", ",", "command", ")", ";", "// Print e...
Print a command (it's name, description and parameters). @param command Command to describe.
[ "Print", "a", "command", "(", "it", "s", "name", "description", "and", "parameters", ")", "." ]
train
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/output/CliPrinter.java#L132-L140
pmwmedia/tinylog
benchmarks/src/main/java/org/tinylog/benchmarks/api/WritingBenchmark.java
WritingBenchmark.byteBufferFileChannel
@Benchmark @BenchmarkMode(Mode.AverageTime) public void byteBufferFileChannel(final Configuration configuration) throws IOException { ByteBuffer buffer = ByteBuffer.allocate(BUFFER_CAPACITY); try (RandomAccessFile file = new RandomAccessFile(configuration.file, "rw")) { try (FileChannel channel = file.getChannel()) { for (long i = 0; i < LINES; ++i) { if (buffer.remaining() < DATA.length) { buffer.flip(); channel.write(buffer); buffer.clear(); } if (buffer.remaining() < DATA.length) { file.write(DATA); } else { buffer.put(DATA); } } if (buffer.position() > 0) { buffer.flip(); channel.write(buffer); } } } }
java
@Benchmark @BenchmarkMode(Mode.AverageTime) public void byteBufferFileChannel(final Configuration configuration) throws IOException { ByteBuffer buffer = ByteBuffer.allocate(BUFFER_CAPACITY); try (RandomAccessFile file = new RandomAccessFile(configuration.file, "rw")) { try (FileChannel channel = file.getChannel()) { for (long i = 0; i < LINES; ++i) { if (buffer.remaining() < DATA.length) { buffer.flip(); channel.write(buffer); buffer.clear(); } if (buffer.remaining() < DATA.length) { file.write(DATA); } else { buffer.put(DATA); } } if (buffer.position() > 0) { buffer.flip(); channel.write(buffer); } } } }
[ "@", "Benchmark", "@", "BenchmarkMode", "(", "Mode", ".", "AverageTime", ")", "public", "void", "byteBufferFileChannel", "(", "final", "Configuration", "configuration", ")", "throws", "IOException", "{", "ByteBuffer", "buffer", "=", "ByteBuffer", ".", "allocate", ...
Benchmarks writing via {@link FileChannel} with using a {@link ByteBuffer} for buffering. @param configuration Configuration with target file @throws IOException Failed to write to target file
[ "Benchmarks", "writing", "via", "{", "@link", "FileChannel", "}", "with", "using", "a", "{", "@link", "ByteBuffer", "}", "for", "buffering", "." ]
train
https://github.com/pmwmedia/tinylog/blob/d03d4ef84a1310155037e08ca8822a91697d1086/benchmarks/src/main/java/org/tinylog/benchmarks/api/WritingBenchmark.java#L217-L244
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/debug/cli/Shell.java
Shell.addAuxHandler
public void addAuxHandler(Object handler, String prefix) { if (handler == null) { throw new NullPointerException(); } auxHandlers.put(prefix, handler); allHandlers.add(handler); addDeclaredMethods(handler, prefix); inputConverter.addDeclaredConverters(handler); outputConverter.addDeclaredConverters(handler); if (handler instanceof ShellDependent) { ((ShellDependent)handler).cliSetShell(this); } }
java
public void addAuxHandler(Object handler, String prefix) { if (handler == null) { throw new NullPointerException(); } auxHandlers.put(prefix, handler); allHandlers.add(handler); addDeclaredMethods(handler, prefix); inputConverter.addDeclaredConverters(handler); outputConverter.addDeclaredConverters(handler); if (handler instanceof ShellDependent) { ((ShellDependent)handler).cliSetShell(this); } }
[ "public", "void", "addAuxHandler", "(", "Object", "handler", ",", "String", "prefix", ")", "{", "if", "(", "handler", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";", "}", "auxHandlers", ".", "put", "(", "prefix", ",", "hand...
This method is very similar to addMainHandler, except ShellFactory will pass all handlers registered with this method to all this shell's subshells. @see org.gearvrf.debug.cli.Shell#addMainHandler(java.lang.Object, java.lang.String) @param handler Object which should be registered as handler. @param prefix Prefix that should be prepended to all handler's command names.
[ "This", "method", "is", "very", "similar", "to", "addMainHandler", "except", "ShellFactory", "will", "pass", "all", "handlers", "registered", "with", "this", "method", "to", "all", "this", "shell", "s", "subshells", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/debug/cli/Shell.java#L164-L178
Atmosphere/wasync
wasync/src/main/java/org/atmosphere/wasync/util/TypeResolver.java
TypeResolver.buildTypeVariableMap
static void buildTypeVariableMap(final Type[] types, final Map<TypeVariable<?>, Type> map) { for (Type type : types) { if (type instanceof ParameterizedType) { ParameterizedType parameterizedType = (ParameterizedType) type; buildTypeVariableMap(parameterizedType, map); Type rawType = parameterizedType.getRawType(); if (rawType instanceof Class) buildTypeVariableMap(((Class<?>) rawType).getGenericInterfaces(), map); } else if (type instanceof Class) { buildTypeVariableMap(((Class<?>) type).getGenericInterfaces(), map); } } }
java
static void buildTypeVariableMap(final Type[] types, final Map<TypeVariable<?>, Type> map) { for (Type type : types) { if (type instanceof ParameterizedType) { ParameterizedType parameterizedType = (ParameterizedType) type; buildTypeVariableMap(parameterizedType, map); Type rawType = parameterizedType.getRawType(); if (rawType instanceof Class) buildTypeVariableMap(((Class<?>) rawType).getGenericInterfaces(), map); } else if (type instanceof Class) { buildTypeVariableMap(((Class<?>) type).getGenericInterfaces(), map); } } }
[ "static", "void", "buildTypeVariableMap", "(", "final", "Type", "[", "]", "types", ",", "final", "Map", "<", "TypeVariable", "<", "?", ">", ",", "Type", ">", "map", ")", "{", "for", "(", "Type", "type", ":", "types", ")", "{", "if", "(", "type", "i...
Populates the {@code map} with with variable/argument pairs for the given {@code types}.
[ "Populates", "the", "{" ]
train
https://github.com/Atmosphere/wasync/blob/0146828b2f5138d4cbb4872fcbfe7d6e1887ac14/wasync/src/main/java/org/atmosphere/wasync/util/TypeResolver.java#L255-L267
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/BarcodePDF417.java
BarcodePDF417.createAwtImage
public java.awt.Image createAwtImage(Color foreground, Color background) { int f = foreground.getRGB(); int g = background.getRGB(); Canvas canvas = new Canvas(); paintCode(); int h = (int)yHeight; int pix[] = new int[bitColumns * codeRows * h]; int stride = (bitColumns + 7) / 8; int ptr = 0; for (int k = 0; k < codeRows; ++k) { int p = k * stride; for (int j = 0; j < bitColumns; ++j) { int b = outBits[p + (j / 8)] & 0xff; b <<= j % 8; pix[ptr++] = (b & 0x80) == 0 ? g : f; } for (int j = 1; j < h; ++j) { System.arraycopy(pix, ptr - bitColumns, pix, ptr + bitColumns * (j - 1), bitColumns); } ptr += bitColumns * (h - 1); } java.awt.Image img = canvas.createImage(new MemoryImageSource(bitColumns, codeRows * h, pix, 0, bitColumns)); return img; }
java
public java.awt.Image createAwtImage(Color foreground, Color background) { int f = foreground.getRGB(); int g = background.getRGB(); Canvas canvas = new Canvas(); paintCode(); int h = (int)yHeight; int pix[] = new int[bitColumns * codeRows * h]; int stride = (bitColumns + 7) / 8; int ptr = 0; for (int k = 0; k < codeRows; ++k) { int p = k * stride; for (int j = 0; j < bitColumns; ++j) { int b = outBits[p + (j / 8)] & 0xff; b <<= j % 8; pix[ptr++] = (b & 0x80) == 0 ? g : f; } for (int j = 1; j < h; ++j) { System.arraycopy(pix, ptr - bitColumns, pix, ptr + bitColumns * (j - 1), bitColumns); } ptr += bitColumns * (h - 1); } java.awt.Image img = canvas.createImage(new MemoryImageSource(bitColumns, codeRows * h, pix, 0, bitColumns)); return img; }
[ "public", "java", ".", "awt", ".", "Image", "createAwtImage", "(", "Color", "foreground", ",", "Color", "background", ")", "{", "int", "f", "=", "foreground", ".", "getRGB", "(", ")", ";", "int", "g", "=", "background", ".", "getRGB", "(", ")", ";", ...
Creates a <CODE>java.awt.Image</CODE>. @param foreground the color of the bars @param background the color of the background @return the image
[ "Creates", "a", "<CODE", ">", "java", ".", "awt", ".", "Image<", "/", "CODE", ">", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/BarcodePDF417.java#L901-L926
gallandarakhneorg/afc
core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java
XMLUtil.setAttributeEnum
public static <T extends Enum<T>> boolean setAttributeEnum(Node document, Class<T> type, T value, String... path) { assert document != null : AssertMessages.notNullParameter(0); return setAttributeEnum(document, type, true, value, path); }
java
public static <T extends Enum<T>> boolean setAttributeEnum(Node document, Class<T> type, T value, String... path) { assert document != null : AssertMessages.notNullParameter(0); return setAttributeEnum(document, type, true, value, path); }
[ "public", "static", "<", "T", "extends", "Enum", "<", "T", ">", ">", "boolean", "setAttributeEnum", "(", "Node", "document", ",", "Class", "<", "T", ">", "type", ",", "T", "value", ",", "String", "...", "path", ")", "{", "assert", "document", "!=", "...
Write an enumeration value. @param <T> is the type of the enumeration. @param document is the XML document to explore. @param type is the type of the enumeration. @param value is the value to put in the document. @param path is the list of and ended by the attribute's name. @return <code>true</code> if written, <code>false</code> if not written.
[ "Write", "an", "enumeration", "value", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L2202-L2205
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/CommitsApi.java
CommitsApi.getCommits
public Pager<Commit> getCommits(Object projectIdOrPath, String ref, Date since, Date until, int itemsPerPage) throws GitLabApiException { return getCommits(projectIdOrPath, ref, since, until, null, itemsPerPage); }
java
public Pager<Commit> getCommits(Object projectIdOrPath, String ref, Date since, Date until, int itemsPerPage) throws GitLabApiException { return getCommits(projectIdOrPath, ref, since, until, null, itemsPerPage); }
[ "public", "Pager", "<", "Commit", ">", "getCommits", "(", "Object", "projectIdOrPath", ",", "String", "ref", ",", "Date", "since", ",", "Date", "until", ",", "int", "itemsPerPage", ")", "throws", "GitLabApiException", "{", "return", "getCommits", "(", "project...
Get a Pager of repository commits in a project. <pre><code>GitLab Endpoint: GET /projects/:id/repository/commits</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param ref the name of a repository branch or tag or if not given the default branch @param since only commits after or on this date will be returned @param until only commits before or on this date will be returned @param itemsPerPage the number of Commit instances that will be fetched per page @return a Pager containing the commits for the specified project ID @throws GitLabApiException GitLabApiException if any exception occurs during execution
[ "Get", "a", "Pager", "of", "repository", "commits", "in", "a", "project", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/CommitsApi.java#L227-L229
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-backend-impls/nd4j-native/src/main/java/org/nd4j/linalg/cpu/nativecpu/blas/SparseCpuLevel1.java
SparseCpuLevel1.sroti
@Override protected void sroti(long N, INDArray X, DataBuffer indexes, INDArray Y, double c, double s) { cblas_sroti((int) N, (FloatPointer) X.data().addressPointer(), (IntPointer) indexes.addressPointer().capacity(X.columns()), (FloatPointer) Y.data().addressPointer(), (float) c, (float) s); }
java
@Override protected void sroti(long N, INDArray X, DataBuffer indexes, INDArray Y, double c, double s) { cblas_sroti((int) N, (FloatPointer) X.data().addressPointer(), (IntPointer) indexes.addressPointer().capacity(X.columns()), (FloatPointer) Y.data().addressPointer(), (float) c, (float) s); }
[ "@", "Override", "protected", "void", "sroti", "(", "long", "N", ",", "INDArray", "X", ",", "DataBuffer", "indexes", ",", "INDArray", "Y", ",", "double", "c", ",", "double", "s", ")", "{", "cblas_sroti", "(", "(", "int", ")", "N", ",", "(", "FloatPoi...
Applies Givens rotation to sparse vectors one of which is in compressed form. @param N The number of elements in vectors X and Y @param X a float sparse vector @param indexes The indexes of the sparse vector @param Y a float full-storage vector @param c a scalar @param s a scalar
[ "Applies", "Givens", "rotation", "to", "sparse", "vectors", "one", "of", "which", "is", "in", "compressed", "form", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-native/src/main/java/org/nd4j/linalg/cpu/nativecpu/blas/SparseCpuLevel1.java#L248-L252
julianhyde/sqlline
src/main/java/sqlline/Rows.java
Rows.getTablePrimaryKeys
private Set<String> getTablePrimaryKeys( String catalog, String schema, String table) { TableKey tableKey = new TableKey(catalog, schema, table); Set<String> primaryKeys = tablePrimaryKeysCache.get(tableKey); if (primaryKeys == null) { primaryKeys = loadAndCachePrimaryKeysForTable(tableKey); } return primaryKeys; }
java
private Set<String> getTablePrimaryKeys( String catalog, String schema, String table) { TableKey tableKey = new TableKey(catalog, schema, table); Set<String> primaryKeys = tablePrimaryKeysCache.get(tableKey); if (primaryKeys == null) { primaryKeys = loadAndCachePrimaryKeysForTable(tableKey); } return primaryKeys; }
[ "private", "Set", "<", "String", ">", "getTablePrimaryKeys", "(", "String", "catalog", ",", "String", "schema", ",", "String", "table", ")", "{", "TableKey", "tableKey", "=", "new", "TableKey", "(", "catalog", ",", "schema", ",", "table", ")", ";", "Set", ...
Gets a set of primary key column names given a table key (i.e. catalog, schema and table name). The returned set may be cached as a result of previous requests for the same table key. <p>The result cannot be considered authoritative as since it depends on whether the JDBC driver property implements {@link java.sql.ResultSetMetaData#getTableName} and many drivers/databases do not. @param catalog The catalog for the table. May be null. @param schema The schema for the table. May be null. @param table The name of table. May not be null. @return A set of primary key column names. May be empty but will never be null.
[ "Gets", "a", "set", "of", "primary", "key", "column", "names", "given", "a", "table", "key", "(", "i", ".", "e", ".", "catalog", "schema", "and", "table", "name", ")", ".", "The", "returned", "set", "may", "be", "cached", "as", "a", "result", "of", ...
train
https://github.com/julianhyde/sqlline/blob/7577f3ebaca0897a9ff01d1553d4576487e1d2c3/src/main/java/sqlline/Rows.java#L383-L391
HsiangLeekwok/hlklib
hlklib/src/main/java/com/hlk/hlklib/etc/Utility.java
Utility.isItMobilePhone
public static boolean isItMobilePhone(String phone, boolean rigidRules) { String temp = filterNumbers(phone); Pattern p = Pattern.compile(rigidRules ? PHONE_REGEX : PHONE_REGEX); Matcher m = p.matcher(temp); return m.matches(); }
java
public static boolean isItMobilePhone(String phone, boolean rigidRules) { String temp = filterNumbers(phone); Pattern p = Pattern.compile(rigidRules ? PHONE_REGEX : PHONE_REGEX); Matcher m = p.matcher(temp); return m.matches(); }
[ "public", "static", "boolean", "isItMobilePhone", "(", "String", "phone", ",", "boolean", "rigidRules", ")", "{", "String", "temp", "=", "filterNumbers", "(", "phone", ")", ";", "Pattern", "p", "=", "Pattern", ".", "compile", "(", "rigidRules", "?", "PHONE_R...
正则检测字符串是否为手机号码 @param phone 手机号码 @param rigidRules 是否用严格的规则进行号码验证
[ "正则检测字符串是否为手机号码" ]
train
https://github.com/HsiangLeekwok/hlklib/blob/b122f6dcab7cec60c8e5455e0c31613d08bec6ad/hlklib/src/main/java/com/hlk/hlklib/etc/Utility.java#L153-L158
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/lib/db/DBConfiguration.java
DBConfiguration.configureDB
public static void configureDB(JobConf job, String driverClass, String dbUrl) { configureDB(job, driverClass, dbUrl, null, null); }
java
public static void configureDB(JobConf job, String driverClass, String dbUrl) { configureDB(job, driverClass, dbUrl, null, null); }
[ "public", "static", "void", "configureDB", "(", "JobConf", "job", ",", "String", "driverClass", ",", "String", "dbUrl", ")", "{", "configureDB", "(", "job", ",", "driverClass", ",", "dbUrl", ",", "null", ",", "null", ")", ";", "}" ]
Sets the DB access related fields in the JobConf. @param job the job @param driverClass JDBC Driver class name @param dbUrl JDBC DB access URL.
[ "Sets", "the", "DB", "access", "related", "fields", "in", "the", "JobConf", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/lib/db/DBConfiguration.java#L108-L110
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/flow/cdi/FlowScopedContextImpl.java
FlowScopedContextImpl.getContextualStorage
protected ContextualStorage getContextualStorage(boolean createIfNotExist, String clientWindowFlowId) { //FacesContext facesContext = FacesContext.getCurrentInstance(); //String clientWindowFlowId = getCurrentClientWindowFlowId(facesContext); if (clientWindowFlowId == null) { throw new ContextNotActiveException("FlowScopedContextImpl: no current active flow"); } if (createIfNotExist) { return getFlowScopeBeanHolder().getContextualStorage(beanManager, clientWindowFlowId); } else { return getFlowScopeBeanHolder().getContextualStorageNoCreate(beanManager, clientWindowFlowId); } }
java
protected ContextualStorage getContextualStorage(boolean createIfNotExist, String clientWindowFlowId) { //FacesContext facesContext = FacesContext.getCurrentInstance(); //String clientWindowFlowId = getCurrentClientWindowFlowId(facesContext); if (clientWindowFlowId == null) { throw new ContextNotActiveException("FlowScopedContextImpl: no current active flow"); } if (createIfNotExist) { return getFlowScopeBeanHolder().getContextualStorage(beanManager, clientWindowFlowId); } else { return getFlowScopeBeanHolder().getContextualStorageNoCreate(beanManager, clientWindowFlowId); } }
[ "protected", "ContextualStorage", "getContextualStorage", "(", "boolean", "createIfNotExist", ",", "String", "clientWindowFlowId", ")", "{", "//FacesContext facesContext = FacesContext.getCurrentInstance();", "//String clientWindowFlowId = getCurrentClientWindowFlowId(facesContext);", "if"...
An implementation has to return the underlying storage which contains the items held in the Context. @param createIfNotExist whether a ContextualStorage shall get created if it doesn't yet exist. @return the underlying storage
[ "An", "implementation", "has", "to", "return", "the", "underlying", "storage", "which", "contains", "the", "items", "held", "in", "the", "Context", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/flow/cdi/FlowScopedContextImpl.java#L125-L142
buschmais/jqa-javaee6-plugin
src/main/java/com/buschmais/jqassistant/plugin/javaee6/impl/scanner/XmlDescriptorHelper.java
XmlDescriptorHelper.createIcon
public static IconDescriptor createIcon(IconType iconType, Store store) { IconDescriptor iconDescriptor = store.create(IconDescriptor.class); iconDescriptor.setLang(iconType.getLang()); PathType largeIcon = iconType.getLargeIcon(); if (largeIcon != null) { iconDescriptor.setLargeIcon(largeIcon.getValue()); } PathType smallIcon = iconType.getSmallIcon(); if (smallIcon != null) { iconDescriptor.setSmallIcon(smallIcon.getValue()); } return iconDescriptor; }
java
public static IconDescriptor createIcon(IconType iconType, Store store) { IconDescriptor iconDescriptor = store.create(IconDescriptor.class); iconDescriptor.setLang(iconType.getLang()); PathType largeIcon = iconType.getLargeIcon(); if (largeIcon != null) { iconDescriptor.setLargeIcon(largeIcon.getValue()); } PathType smallIcon = iconType.getSmallIcon(); if (smallIcon != null) { iconDescriptor.setSmallIcon(smallIcon.getValue()); } return iconDescriptor; }
[ "public", "static", "IconDescriptor", "createIcon", "(", "IconType", "iconType", ",", "Store", "store", ")", "{", "IconDescriptor", "iconDescriptor", "=", "store", ".", "create", "(", "IconDescriptor", ".", "class", ")", ";", "iconDescriptor", ".", "setLang", "(...
Create an icon descriptor. @param iconType The XML icon type. @param store The store @return The icon descriptor.
[ "Create", "an", "icon", "descriptor", "." ]
train
https://github.com/buschmais/jqa-javaee6-plugin/blob/f5776604d9255206807e5aca90b8767bde494e14/src/main/java/com/buschmais/jqassistant/plugin/javaee6/impl/scanner/XmlDescriptorHelper.java#L38-L50
h2oai/h2o-3
h2o-core/src/main/java/hex/ModelMetricsRegression.java
ModelMetricsRegression.make
static public ModelMetricsRegression make(Vec predicted, Vec actual, DistributionFamily family) { if (predicted == null || actual == null) throw new IllegalArgumentException("Missing actual or predicted targets for regression metrics!"); if (!predicted.isNumeric()) throw new IllegalArgumentException("Predicted values must be numeric for regression metrics."); if (!actual.isNumeric()) throw new IllegalArgumentException("Actual values must be numeric for regression metrics."); if (family == DistributionFamily.quantile || family == DistributionFamily.tweedie || family == DistributionFamily.huber) throw new IllegalArgumentException("Unsupported distribution family, requires additional parameters which cannot be specified right now."); Frame predsActual = new Frame(predicted); predsActual.add("actual", actual); MetricBuilderRegression mb = new RegressionMetrics(family).doAll(predsActual)._mb; ModelMetricsRegression mm = (ModelMetricsRegression)mb.makeModelMetrics(null, predsActual, null, null); mm._description = "Computed on user-given predictions and targets, distribution: " + (family ==null? DistributionFamily.gaussian.toString(): family.toString()) + "."; return mm; }
java
static public ModelMetricsRegression make(Vec predicted, Vec actual, DistributionFamily family) { if (predicted == null || actual == null) throw new IllegalArgumentException("Missing actual or predicted targets for regression metrics!"); if (!predicted.isNumeric()) throw new IllegalArgumentException("Predicted values must be numeric for regression metrics."); if (!actual.isNumeric()) throw new IllegalArgumentException("Actual values must be numeric for regression metrics."); if (family == DistributionFamily.quantile || family == DistributionFamily.tweedie || family == DistributionFamily.huber) throw new IllegalArgumentException("Unsupported distribution family, requires additional parameters which cannot be specified right now."); Frame predsActual = new Frame(predicted); predsActual.add("actual", actual); MetricBuilderRegression mb = new RegressionMetrics(family).doAll(predsActual)._mb; ModelMetricsRegression mm = (ModelMetricsRegression)mb.makeModelMetrics(null, predsActual, null, null); mm._description = "Computed on user-given predictions and targets, distribution: " + (family ==null? DistributionFamily.gaussian.toString(): family.toString()) + "."; return mm; }
[ "static", "public", "ModelMetricsRegression", "make", "(", "Vec", "predicted", ",", "Vec", "actual", ",", "DistributionFamily", "family", ")", "{", "if", "(", "predicted", "==", "null", "||", "actual", "==", "null", ")", "throw", "new", "IllegalArgumentException...
Build a Regression ModelMetrics object from predicted and actual targets @param predicted A Vec containing predicted values @param actual A Vec containing the actual target values @return ModelMetrics object
[ "Build", "a", "Regression", "ModelMetrics", "object", "from", "predicted", "and", "actual", "targets" ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/hex/ModelMetricsRegression.java#L56-L71
eurekaclinical/protempa
protempa-framework/src/main/java/org/protempa/SliceConsequence.java
SliceConsequence.evaluate
@Override public void evaluate(KnowledgeHelper arg0, WorkingMemory arg1) { @SuppressWarnings("unchecked") List<TemporalProposition> pl = (List<TemporalProposition>) arg0 .get(arg0.getDeclaration("result")); Comparator<TemporalProposition> comp; if (this.reverse) { comp = ProtempaUtil.REVERSE_TEMP_PROP_COMP; } else { comp = ProtempaUtil.TEMP_PROP_COMP; } Collections.sort(pl, comp); this.copier.grab(arg0); if (this.merged) { mergedInterval(arg0, pl); } else { for (ListIterator<TemporalProposition> itr = pl .listIterator(this.minIndex); itr.hasNext() && itr.nextIndex() < this.maxIndex;) { TemporalProposition o = itr.next(); o.accept(this.copier); } } this.copier.release(); }
java
@Override public void evaluate(KnowledgeHelper arg0, WorkingMemory arg1) { @SuppressWarnings("unchecked") List<TemporalProposition> pl = (List<TemporalProposition>) arg0 .get(arg0.getDeclaration("result")); Comparator<TemporalProposition> comp; if (this.reverse) { comp = ProtempaUtil.REVERSE_TEMP_PROP_COMP; } else { comp = ProtempaUtil.TEMP_PROP_COMP; } Collections.sort(pl, comp); this.copier.grab(arg0); if (this.merged) { mergedInterval(arg0, pl); } else { for (ListIterator<TemporalProposition> itr = pl .listIterator(this.minIndex); itr.hasNext() && itr.nextIndex() < this.maxIndex;) { TemporalProposition o = itr.next(); o.accept(this.copier); } } this.copier.release(); }
[ "@", "Override", "public", "void", "evaluate", "(", "KnowledgeHelper", "arg0", ",", "WorkingMemory", "arg1", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "List", "<", "TemporalProposition", ">", "pl", "=", "(", "List", "<", "TemporalProposition"...
Called when there exist the minimum necessary number of intervals with the specified proposition id in order to compute the temporal slice corresponding to this rule. @param arg0 a {@link KnowledgeHelper} @param arg1 a {@link WorkingMemory} @see JBossRuleCreator
[ "Called", "when", "there", "exist", "the", "minimum", "necessary", "number", "of", "intervals", "with", "the", "specified", "proposition", "id", "in", "order", "to", "compute", "the", "temporal", "slice", "corresponding", "to", "this", "rule", "." ]
train
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/SliceConsequence.java#L123-L147
foundation-runtime/service-directory
2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/config/ServiceDirectoryConfig.java
ServiceDirectoryConfig.getDouble
public double getDouble(String name, double defaultVal){ if(this.configuration.containsKey(name)){ return this.configuration.getDouble(name); } else { return defaultVal; } }
java
public double getDouble(String name, double defaultVal){ if(this.configuration.containsKey(name)){ return this.configuration.getDouble(name); } else { return defaultVal; } }
[ "public", "double", "getDouble", "(", "String", "name", ",", "double", "defaultVal", ")", "{", "if", "(", "this", ".", "configuration", ".", "containsKey", "(", "name", ")", ")", "{", "return", "this", ".", "configuration", ".", "getDouble", "(", "name", ...
Get the property object as double, or return defaultVal if property is not defined. @param name property name. @param defaultVal default property value. @return property value as double, return defaultVal if property is undefined.
[ "Get", "the", "property", "object", "as", "double", "or", "return", "defaultVal", "if", "property", "is", "not", "defined", "." ]
train
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/config/ServiceDirectoryConfig.java#L147-L153
onepf/OpenIAB
library/src/main/java/org/onepf/oms/appstore/nokiaUtils/NokiaStoreHelper.java
NokiaStoreHelper.processPurchaseSuccess
private void processPurchaseSuccess(final String purchaseData) { Logger.i("NokiaStoreHelper.processPurchaseSuccess"); Logger.d("purchaseData = ", purchaseData); Purchase purchase; try { final JSONObject obj = new JSONObject(purchaseData); final String sku = SkuManager.getInstance().getSku(OpenIabHelper.NAME_NOKIA, obj.getString("productId")); Logger.d("sku = ", sku); purchase = new Purchase(OpenIabHelper.NAME_NOKIA); purchase.setItemType(IabHelper.ITEM_TYPE_INAPP); purchase.setOrderId(obj.getString("orderId")); purchase.setPackageName(obj.getString("packageName")); purchase.setSku(sku); purchase.setToken(obj.getString("purchaseToken")); purchase.setDeveloperPayload(obj.getString("developerPayload")); } catch (JSONException e) { Logger.e(e, "JSONException: ", e); final IabResult result = new NokiaResult(IabHelper.IABHELPER_BAD_RESPONSE, "Failed to parse purchase data."); if (mPurchaseListener != null) { mPurchaseListener.onIabPurchaseFinished(result, null); } return; } if (mPurchaseListener != null) { mPurchaseListener.onIabPurchaseFinished(new NokiaResult(RESULT_OK, "Success"), purchase); } }
java
private void processPurchaseSuccess(final String purchaseData) { Logger.i("NokiaStoreHelper.processPurchaseSuccess"); Logger.d("purchaseData = ", purchaseData); Purchase purchase; try { final JSONObject obj = new JSONObject(purchaseData); final String sku = SkuManager.getInstance().getSku(OpenIabHelper.NAME_NOKIA, obj.getString("productId")); Logger.d("sku = ", sku); purchase = new Purchase(OpenIabHelper.NAME_NOKIA); purchase.setItemType(IabHelper.ITEM_TYPE_INAPP); purchase.setOrderId(obj.getString("orderId")); purchase.setPackageName(obj.getString("packageName")); purchase.setSku(sku); purchase.setToken(obj.getString("purchaseToken")); purchase.setDeveloperPayload(obj.getString("developerPayload")); } catch (JSONException e) { Logger.e(e, "JSONException: ", e); final IabResult result = new NokiaResult(IabHelper.IABHELPER_BAD_RESPONSE, "Failed to parse purchase data."); if (mPurchaseListener != null) { mPurchaseListener.onIabPurchaseFinished(result, null); } return; } if (mPurchaseListener != null) { mPurchaseListener.onIabPurchaseFinished(new NokiaResult(RESULT_OK, "Success"), purchase); } }
[ "private", "void", "processPurchaseSuccess", "(", "final", "String", "purchaseData", ")", "{", "Logger", ".", "i", "(", "\"NokiaStoreHelper.processPurchaseSuccess\"", ")", ";", "Logger", ".", "d", "(", "\"purchaseData = \"", ",", "purchaseData", ")", ";", "Purchase"...
Called if purchase has been successful @param purchaseData Response code for IabResult
[ "Called", "if", "purchase", "has", "been", "successful" ]
train
https://github.com/onepf/OpenIAB/blob/90552d53c5303b322940d96a0c4b7cb797d78760/library/src/main/java/org/onepf/oms/appstore/nokiaUtils/NokiaStoreHelper.java#L344-L380
ModeShape/modeshape
web/modeshape-webdav/src/main/java/org/modeshape/webdav/fromcatalina/RequestUtil.java
RequestUtil.URLDecode
public static String URLDecode( String str, String enc ) { if (str == null) { return (null); } // use the specified encoding to extract bytes out of the // given string so that the encoding is not lost. If an // encoding is not specified, let it use platform default byte[] bytes = null; try { if (enc == null) { bytes = str.getBytes(); } else { bytes = str.getBytes(enc); } } catch (UnsupportedEncodingException uee) { } return URLDecode(bytes, enc); }
java
public static String URLDecode( String str, String enc ) { if (str == null) { return (null); } // use the specified encoding to extract bytes out of the // given string so that the encoding is not lost. If an // encoding is not specified, let it use platform default byte[] bytes = null; try { if (enc == null) { bytes = str.getBytes(); } else { bytes = str.getBytes(enc); } } catch (UnsupportedEncodingException uee) { } return URLDecode(bytes, enc); }
[ "public", "static", "String", "URLDecode", "(", "String", "str", ",", "String", "enc", ")", "{", "if", "(", "str", "==", "null", ")", "{", "return", "(", "null", ")", ";", "}", "// use the specified encoding to extract bytes out of the", "// given string so that t...
Decode and return the specified URL-encoded String. @param str The url-encoded string @param enc The encoding to use; if null, the default encoding is used @return the decoded URL @throws IllegalArgumentException if a '%' character is not followed by a valid 2-digit hexadecimal number
[ "Decode", "and", "return", "the", "specified", "URL", "-", "encoded", "String", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/web/modeshape-webdav/src/main/java/org/modeshape/webdav/fromcatalina/RequestUtil.java#L320-L342
voldemort/voldemort
src/java/voldemort/utils/JmxUtils.java
JmxUtils.registerMbean
public static void registerMbean(Object mbean, ObjectName name) { registerMbean(ManagementFactory.getPlatformMBeanServer(), JmxUtils.createModelMBean(mbean), name); }
java
public static void registerMbean(Object mbean, ObjectName name) { registerMbean(ManagementFactory.getPlatformMBeanServer(), JmxUtils.createModelMBean(mbean), name); }
[ "public", "static", "void", "registerMbean", "(", "Object", "mbean", ",", "ObjectName", "name", ")", "{", "registerMbean", "(", "ManagementFactory", ".", "getPlatformMBeanServer", "(", ")", ",", "JmxUtils", ".", "createModelMBean", "(", "mbean", ")", ",", "name"...
Register the given mbean with the platform mbean server @param mbean The mbean to register @param name The name to register under
[ "Register", "the", "given", "mbean", "with", "the", "platform", "mbean", "server" ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/JmxUtils.java#L284-L288
albfernandez/itext2
src/main/java/com/lowagie/text/html/simpleparser/FactoryProperties.java
FactoryProperties.getHyphenation
public static HyphenationEvent getHyphenation(String s) { if (s == null || s.length() == 0) { return null; } String lang = s; String country = null; int leftMin = 2; int rightMin = 2; int pos = s.indexOf('_'); if (pos == -1) { return new HyphenationAuto(lang, country, leftMin, rightMin); } lang = s.substring(0, pos); country = s.substring(pos + 1); pos = country.indexOf(','); if (pos == -1) { return new HyphenationAuto(lang, country, leftMin, rightMin); } s = country.substring(pos + 1); country = country.substring(0, pos); pos = s.indexOf(','); if (pos == -1) { leftMin = Integer.parseInt(s); } else { leftMin = Integer.parseInt(s.substring(0, pos)); rightMin = Integer.parseInt(s.substring(pos + 1)); } return new HyphenationAuto(lang, country, leftMin, rightMin); }
java
public static HyphenationEvent getHyphenation(String s) { if (s == null || s.length() == 0) { return null; } String lang = s; String country = null; int leftMin = 2; int rightMin = 2; int pos = s.indexOf('_'); if (pos == -1) { return new HyphenationAuto(lang, country, leftMin, rightMin); } lang = s.substring(0, pos); country = s.substring(pos + 1); pos = country.indexOf(','); if (pos == -1) { return new HyphenationAuto(lang, country, leftMin, rightMin); } s = country.substring(pos + 1); country = country.substring(0, pos); pos = s.indexOf(','); if (pos == -1) { leftMin = Integer.parseInt(s); } else { leftMin = Integer.parseInt(s.substring(0, pos)); rightMin = Integer.parseInt(s.substring(pos + 1)); } return new HyphenationAuto(lang, country, leftMin, rightMin); }
[ "public", "static", "HyphenationEvent", "getHyphenation", "(", "String", "s", ")", "{", "if", "(", "s", "==", "null", "||", "s", ".", "length", "(", ")", "==", "0", ")", "{", "return", "null", ";", "}", "String", "lang", "=", "s", ";", "String", "c...
Gets a HyphenationEvent based on a String. For instance "en_UK,3,2" returns new HyphenationAuto("en", "UK", 3, 2); @param s a String, for instance "en_UK,2,2" @return a HyphenationEvent @since 2.1.2
[ "Gets", "a", "HyphenationEvent", "based", "on", "a", "String", ".", "For", "instance", "en_UK", "3", "2", "returns", "new", "HyphenationAuto", "(", "en", "UK", "3", "2", ")", ";" ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/html/simpleparser/FactoryProperties.java#L227-L256
netty/netty
resolver-dns/src/main/java/io/netty/resolver/dns/DnsNameResolver.java
DnsNameResolver.resolveAll
public final Future<List<DnsRecord>> resolveAll(DnsQuestion question, Iterable<DnsRecord> additionals) { return resolveAll(question, additionals, executor().<List<DnsRecord>>newPromise()); }
java
public final Future<List<DnsRecord>> resolveAll(DnsQuestion question, Iterable<DnsRecord> additionals) { return resolveAll(question, additionals, executor().<List<DnsRecord>>newPromise()); }
[ "public", "final", "Future", "<", "List", "<", "DnsRecord", ">", ">", "resolveAll", "(", "DnsQuestion", "question", ",", "Iterable", "<", "DnsRecord", ">", "additionals", ")", "{", "return", "resolveAll", "(", "question", ",", "additionals", ",", "executor", ...
Resolves the {@link DnsRecord}s that are matched by the specified {@link DnsQuestion}. Unlike {@link #query(DnsQuestion)}, this method handles redirection, CNAMEs and multiple name servers. If the specified {@link DnsQuestion} is {@code A} or {@code AAAA}, this method looks up the configured {@link HostsFileEntries} before sending a query to the name servers. If a match is found in the {@link HostsFileEntries}, a synthetic {@code A} or {@code AAAA} record will be returned. @param question the question @param additionals additional records ({@code OPT}) @return the list of the {@link DnsRecord}s as the result of the resolution
[ "Resolves", "the", "{", "@link", "DnsRecord", "}", "s", "that", "are", "matched", "by", "the", "specified", "{", "@link", "DnsQuestion", "}", ".", "Unlike", "{", "@link", "#query", "(", "DnsQuestion", ")", "}", "this", "method", "handles", "redirection", "...
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/resolver-dns/src/main/java/io/netty/resolver/dns/DnsNameResolver.java#L727-L729
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLSubPropertyChainAxiomImpl_CustomFieldSerializer.java
OWLSubPropertyChainAxiomImpl_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLSubPropertyChainAxiomImpl instance) throws SerializationException { deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLSubPropertyChainAxiomImpl instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLSubPropertyChainAxiomImpl", "instance", ")", "throws", "SerializationException", "{", "deserialize", "(", "streamReader", ",", "instance", ")", ";", "}" ]
Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful
[ "Deserializes", "the", "content", "of", "the", "object", "from", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamReader", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLSubPropertyChainAxiomImpl_CustomFieldSerializer.java#L102-L105
groupon/monsoon
expr/src/main/java/com/groupon/lex/metrics/timeseries/expression/MinExpression.java
MinExpression.impl_
private static Number impl_(Number x, Number y) { return (x.doubleValue() > y.doubleValue() ? y : x); }
java
private static Number impl_(Number x, Number y) { return (x.doubleValue() > y.doubleValue() ? y : x); }
[ "private", "static", "Number", "impl_", "(", "Number", "x", ",", "Number", "y", ")", "{", "return", "(", "x", ".", "doubleValue", "(", ")", ">", "y", ".", "doubleValue", "(", ")", "?", "y", ":", "x", ")", ";", "}" ]
/* Calculate the sum of two numbers, preserving integral type if possible.
[ "/", "*", "Calculate", "the", "sum", "of", "two", "numbers", "preserving", "integral", "type", "if", "possible", "." ]
train
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/expr/src/main/java/com/groupon/lex/metrics/timeseries/expression/MinExpression.java#L25-L27
cdk/cdk
base/core/src/main/java/org/openscience/cdk/config/AtomTypeFactory.java
AtomTypeFactory.getInstance
public static AtomTypeFactory getInstance(InputStream ins, String format, IChemObjectBuilder builder) { return new AtomTypeFactory(ins, format, builder); }
java
public static AtomTypeFactory getInstance(InputStream ins, String format, IChemObjectBuilder builder) { return new AtomTypeFactory(ins, format, builder); }
[ "public", "static", "AtomTypeFactory", "getInstance", "(", "InputStream", "ins", ",", "String", "format", ",", "IChemObjectBuilder", "builder", ")", "{", "return", "new", "AtomTypeFactory", "(", "ins", ",", "format", ",", "builder", ")", ";", "}" ]
Method to create a default AtomTypeFactory, using the given InputStream. An AtomType of this kind is not cached. @see #getInstance(String, IChemObjectBuilder) @param ins InputStream containing the data @param format String representing the possible formats ('xml' and 'txt') @param builder IChemObjectBuilder used to make IChemObject instances @return The AtomTypeFactory for the given data file
[ "Method", "to", "create", "a", "default", "AtomTypeFactory", "using", "the", "given", "InputStream", ".", "An", "AtomType", "of", "this", "kind", "is", "not", "cached", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/core/src/main/java/org/openscience/cdk/config/AtomTypeFactory.java#L129-L131
FedericoPecora/meta-csp-framework
src/main/java/org/metacsp/multi/spatioTemporal/paths/TrajectoryEnvelope.java
TrajectoryEnvelope.getGroundEnvelopes
public TreeSet<TrajectoryEnvelope> getGroundEnvelopes() { TreeSet<TrajectoryEnvelope> ret = new TreeSet<TrajectoryEnvelope>(new Comparator<TrajectoryEnvelope>() { @Override public int compare(TrajectoryEnvelope o1, TrajectoryEnvelope o2) { Bounds o1b = new Bounds(o1.getTemporalVariable().getEST(),o1.getTemporalVariable().getEET()); Bounds o2b = new Bounds(o2.getTemporalVariable().getEST(),o2.getTemporalVariable().getEET()); if (o2b.min-o1b.min > 0) return -1; else if (o2b.min-o1b.min == 0) return 0; return 1; } }); if (this.getSubEnvelopes() != null) { for (TrajectoryEnvelope te : this.getSubEnvelopes()) { ret.addAll(te.getGroundEnvelopes()); } } else ret.add(this); return ret; }
java
public TreeSet<TrajectoryEnvelope> getGroundEnvelopes() { TreeSet<TrajectoryEnvelope> ret = new TreeSet<TrajectoryEnvelope>(new Comparator<TrajectoryEnvelope>() { @Override public int compare(TrajectoryEnvelope o1, TrajectoryEnvelope o2) { Bounds o1b = new Bounds(o1.getTemporalVariable().getEST(),o1.getTemporalVariable().getEET()); Bounds o2b = new Bounds(o2.getTemporalVariable().getEST(),o2.getTemporalVariable().getEET()); if (o2b.min-o1b.min > 0) return -1; else if (o2b.min-o1b.min == 0) return 0; return 1; } }); if (this.getSubEnvelopes() != null) { for (TrajectoryEnvelope te : this.getSubEnvelopes()) { ret.addAll(te.getGroundEnvelopes()); } } else ret.add(this); return ret; }
[ "public", "TreeSet", "<", "TrajectoryEnvelope", ">", "getGroundEnvelopes", "(", ")", "{", "TreeSet", "<", "TrajectoryEnvelope", ">", "ret", "=", "new", "TreeSet", "<", "TrajectoryEnvelope", ">", "(", "new", "Comparator", "<", "TrajectoryEnvelope", ">", "(", ")",...
Get the ground {@link TrajectoryEnvelope}s of this {@link TrajectoryEnvelope}, ordered by increasing start time. @return The ground {@link TrajectoryEnvelope}s of this {@link TrajectoryEnvelope}.
[ "Get", "the", "ground", "{" ]
train
https://github.com/FedericoPecora/meta-csp-framework/blob/42aaef2e2b76d0f738427f0dd9653c4f62b40517/src/main/java/org/metacsp/multi/spatioTemporal/paths/TrajectoryEnvelope.java#L263-L281