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
metafacture/metafacture-core
metafacture-commons/src/main/java/org/metafacture/commons/StringUtil.java
StringUtil.repeatChars
public static String repeatChars(final char ch, final int count) { return CharBuffer.allocate(count).toString().replace('\0', ch); }
java
public static String repeatChars(final char ch, final int count) { return CharBuffer.allocate(count).toString().replace('\0', ch); }
[ "public", "static", "String", "repeatChars", "(", "final", "char", "ch", ",", "final", "int", "count", ")", "{", "return", "CharBuffer", ".", "allocate", "(", "count", ")", ".", "toString", "(", ")", ".", "replace", "(", "'", "'", ",", "ch", ")", ";"...
Creates a string which contains a sequence of repeated characters. @param ch to repeat @param count number of repetitions @return a string with {@code count} consisting only of {@code ch}
[ "Creates", "a", "string", "which", "contains", "a", "sequence", "of", "repeated", "characters", "." ]
train
https://github.com/metafacture/metafacture-core/blob/cb43933ec8eb01a4ddce4019c14b2415cc441918/metafacture-commons/src/main/java/org/metafacture/commons/StringUtil.java#L155-L157
Red5/red5-server-common
src/main/java/org/red5/server/Server.java
Server.removeMapping
public boolean removeMapping(String hostName, String contextPath) { log.info("Remove mapping host: {} context: {}", hostName, contextPath); final String key = getKey(hostName, contextPath); log.debug("Remove mapping: {}", key); return (mapping.remove(key) != null); }
java
public boolean removeMapping(String hostName, String contextPath) { log.info("Remove mapping host: {} context: {}", hostName, contextPath); final String key = getKey(hostName, contextPath); log.debug("Remove mapping: {}", key); return (mapping.remove(key) != null); }
[ "public", "boolean", "removeMapping", "(", "String", "hostName", ",", "String", "contextPath", ")", "{", "log", ".", "info", "(", "\"Remove mapping host: {} context: {}\"", ",", "hostName", ",", "contextPath", ")", ";", "final", "String", "key", "=", "getKey", "...
Remove mapping with given key @param hostName Host name @param contextPath Context path @return true if mapping was removed, false if key doesn't exist
[ "Remove", "mapping", "with", "given", "key" ]
train
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/Server.java#L225-L230
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/distort/brown/AddBrownPtoN_F64.java
AddBrownPtoN_F64.setK
public AddBrownPtoN_F64 setK( /**/double fx, /**/double fy, /**/double skew, /**/double cx, /**/double cy) { // analytic solution to matrix inverse a11 = (double)(1.0/fx); a12 = (double)(-skew/(fx*fy)); a13 = (double)((skew*cy - cx*fy)/(fx*fy)); a22 = (double)(1.0/fy); a23 = (double)(-cy/fy); return this; }
java
public AddBrownPtoN_F64 setK( /**/double fx, /**/double fy, /**/double skew, /**/double cx, /**/double cy) { // analytic solution to matrix inverse a11 = (double)(1.0/fx); a12 = (double)(-skew/(fx*fy)); a13 = (double)((skew*cy - cx*fy)/(fx*fy)); a22 = (double)(1.0/fy); a23 = (double)(-cy/fy); return this; }
[ "public", "AddBrownPtoN_F64", "setK", "(", "/**/", "double", "fx", ",", "/**/", "double", "fy", ",", "/**/", "double", "skew", ",", "/**/", "double", "cx", ",", "/**/", "double", "cy", ")", "{", "// analytic solution to matrix inverse", "a11", "=", "(", "dou...
Specify camera calibration parameters @param fx Focal length x-axis in pixels @param fy Focal length y-axis in pixels @param skew skew in pixels @param cx camera center x-axis in pixels @param cy center center y-axis in pixels
[ "Specify", "camera", "calibration", "parameters" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/distort/brown/AddBrownPtoN_F64.java#L50-L60
mapfish/mapfish-print
core/src/main/java/org/mapfish/print/processor/http/MapUriProcessor.java
MapUriProcessor.setMapping
public void setMapping(final Map<String, String> mapping) { this.uriMapping.clear(); for (Map.Entry<String, String> entry: mapping.entrySet()) { Pattern pattern = Pattern.compile(entry.getKey()); this.uriMapping.put(pattern, entry.getValue()); } }
java
public void setMapping(final Map<String, String> mapping) { this.uriMapping.clear(); for (Map.Entry<String, String> entry: mapping.entrySet()) { Pattern pattern = Pattern.compile(entry.getKey()); this.uriMapping.put(pattern, entry.getValue()); } }
[ "public", "void", "setMapping", "(", "final", "Map", "<", "String", ",", "String", ">", "mapping", ")", "{", "this", ".", "uriMapping", ".", "clear", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "entry", ":", "...
Set the uri mappings. <p> The key is a regular expression that must match uri's string form. The value will be used for the replacement. @param mapping the uri mappings.
[ "Set", "the", "uri", "mappings", ".", "<p", ">", "The", "key", "is", "a", "regular", "expression", "that", "must", "match", "uri", "s", "string", "form", ".", "The", "value", "will", "be", "used", "for", "the", "replacement", "." ]
train
https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/processor/http/MapUriProcessor.java#L47-L53
casbin/jcasbin
src/main/java/org/casbin/jcasbin/main/CoreEnforcer.java
CoreEnforcer.newModel
public static Model newModel(String modelPath, String unused) { Model m = new Model(); if (!modelPath.equals("")) { m.loadModel(modelPath); } return m; }
java
public static Model newModel(String modelPath, String unused) { Model m = new Model(); if (!modelPath.equals("")) { m.loadModel(modelPath); } return m; }
[ "public", "static", "Model", "newModel", "(", "String", "modelPath", ",", "String", "unused", ")", "{", "Model", "m", "=", "new", "Model", "(", ")", ";", "if", "(", "!", "modelPath", ".", "equals", "(", "\"\"", ")", ")", "{", "m", ".", "loadModel", ...
newModel creates a model. @param modelPath the path of the model file. @param unused unused parameter, just for differentiating with newModel(String text). @return the model.
[ "newModel", "creates", "a", "model", "." ]
train
https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/main/CoreEnforcer.java#L98-L106
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/events/EventManager.java
EventManager.registerHandler
public synchronized void registerHandler(Object handler) { boolean validClass = false; if (handler==null) { throw new IllegalArgumentException("Null handler class"); } // Get the implemented interfaces. This gets only the // directly implemented interfaces Class<?> clazz = handler.getClass(); Class<?> interfaces[] = clazz.getInterfaces(); for (int i=0; i<interfaces.length; i++) { String iName = interfaces[i].getSimpleName(); // verify the interface is for an event interface if (iName.contains(EVENT_INTERFACE_SUFFIX)) { validClass = true; String eventCategory = iName.substring(0, iName.indexOf(EVENT_INTERFACE_SUFFIX)).toLowerCase(); // see if a handler has been registered for the interface type if (eventHandlers.get(eventCategory)==null) { eventHandlers.put(eventCategory, handler); } else { throw new ApiException("Handler already registered for event type " + iName); } } } if (!validClass) { throw new ApiException("Class is invalid, it does not implement any event interfaces: " + clazz.getName()); } }
java
public synchronized void registerHandler(Object handler) { boolean validClass = false; if (handler==null) { throw new IllegalArgumentException("Null handler class"); } // Get the implemented interfaces. This gets only the // directly implemented interfaces Class<?> clazz = handler.getClass(); Class<?> interfaces[] = clazz.getInterfaces(); for (int i=0; i<interfaces.length; i++) { String iName = interfaces[i].getSimpleName(); // verify the interface is for an event interface if (iName.contains(EVENT_INTERFACE_SUFFIX)) { validClass = true; String eventCategory = iName.substring(0, iName.indexOf(EVENT_INTERFACE_SUFFIX)).toLowerCase(); // see if a handler has been registered for the interface type if (eventHandlers.get(eventCategory)==null) { eventHandlers.put(eventCategory, handler); } else { throw new ApiException("Handler already registered for event type " + iName); } } } if (!validClass) { throw new ApiException("Class is invalid, it does not implement any event interfaces: " + clazz.getName()); } }
[ "public", "synchronized", "void", "registerHandler", "(", "Object", "handler", ")", "{", "boolean", "validClass", "=", "false", ";", "if", "(", "handler", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Null handler class\"", ")", ";"...
Register an event handler. The registration looks at the interfaces that the handler implements. An entry is created in the event handler map for each event interface that is implemented. Event interfaces are named in the form [Category]Event (e.g. ProductEvent) @param handler handler class
[ "Register", "an", "event", "handler", ".", "The", "registration", "looks", "at", "the", "interfaces", "that", "the", "handler", "implements", ".", "An", "entry", "is", "created", "in", "the", "event", "handler", "map", "for", "each", "event", "interface", "t...
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/events/EventManager.java#L53-L85
Netflix/eureka
eureka-core/src/main/java/com/netflix/eureka/cluster/ReplicationTaskProcessor.java
ReplicationTaskProcessor.logNetworkErrorSample
private void logNetworkErrorSample(ReplicationTask task, Throwable e) { long now = System.currentTimeMillis(); if (now - lastNetworkErrorTime > 10000) { lastNetworkErrorTime = now; StringBuilder sb = new StringBuilder(); sb.append("Network level connection to peer ").append(peerId); if (task != null) { sb.append(" for task ").append(task.getTaskName()); } sb.append("; retrying after delay"); logger.error(sb.toString(), e); } }
java
private void logNetworkErrorSample(ReplicationTask task, Throwable e) { long now = System.currentTimeMillis(); if (now - lastNetworkErrorTime > 10000) { lastNetworkErrorTime = now; StringBuilder sb = new StringBuilder(); sb.append("Network level connection to peer ").append(peerId); if (task != null) { sb.append(" for task ").append(task.getTaskName()); } sb.append("; retrying after delay"); logger.error(sb.toString(), e); } }
[ "private", "void", "logNetworkErrorSample", "(", "ReplicationTask", "task", ",", "Throwable", "e", ")", "{", "long", "now", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "if", "(", "now", "-", "lastNetworkErrorTime", ">", "10000", ")", "{", "lastNe...
We want to retry eagerly, but without flooding log file with tons of error entries. As tasks are executed by a pool of threads the error logging multiplies. For example: 20 threads * 100ms delay == 200 error entries / sec worst case Still we would like to see the exception samples, so we print samples at regular intervals.
[ "We", "want", "to", "retry", "eagerly", "but", "without", "flooding", "log", "file", "with", "tons", "of", "error", "entries", ".", "As", "tasks", "are", "executed", "by", "a", "pool", "of", "threads", "the", "error", "logging", "multiplies", ".", "For", ...
train
https://github.com/Netflix/eureka/blob/48446d956be09df6650a3c00b7ebd7e2d1e1544f/eureka-core/src/main/java/com/netflix/eureka/cluster/ReplicationTaskProcessor.java#L116-L128
snowflakedb/snowflake-jdbc
src/main/java/net/snowflake/client/loader/BufferStage.java
BufferStage.completeUploading
void completeUploading() throws IOException { LOGGER.debug("name: {}, currentSize: {}, Threshold: {}," + " fileCount: {}, fileBucketSize: {}", _file.getAbsolutePath(), _currentSize, this._csvFileSize, _fileCount, this._csvFileBucketSize); _outstream.flush(); _outstream.close(); //last file if (_currentSize > 0) { FileUploader fu = new FileUploader(_loader, _location, _file); fu.upload(); _uploaders.add(fu); } else { // delete empty file _file.delete(); } for (FileUploader fu : _uploaders) { // Finish all files being uploaded fu.join(); } // Delete the directory once we are done (for easier tracking // of what is going on) _directory.deleteOnExit(); if (this._rowCount == 0) { setState(State.EMPTY); } }
java
void completeUploading() throws IOException { LOGGER.debug("name: {}, currentSize: {}, Threshold: {}," + " fileCount: {}, fileBucketSize: {}", _file.getAbsolutePath(), _currentSize, this._csvFileSize, _fileCount, this._csvFileBucketSize); _outstream.flush(); _outstream.close(); //last file if (_currentSize > 0) { FileUploader fu = new FileUploader(_loader, _location, _file); fu.upload(); _uploaders.add(fu); } else { // delete empty file _file.delete(); } for (FileUploader fu : _uploaders) { // Finish all files being uploaded fu.join(); } // Delete the directory once we are done (for easier tracking // of what is going on) _directory.deleteOnExit(); if (this._rowCount == 0) { setState(State.EMPTY); } }
[ "void", "completeUploading", "(", ")", "throws", "IOException", "{", "LOGGER", ".", "debug", "(", "\"name: {}, currentSize: {}, Threshold: {},\"", "+", "\" fileCount: {}, fileBucketSize: {}\"", ",", "_file", ".", "getAbsolutePath", "(", ")", ",", "_currentSize", ",", "t...
Wait for all files to finish uploading and schedule stage for processing @throws IOException raises an exception if IO error occurs
[ "Wait", "for", "all", "files", "to", "finish", "uploading", "and", "schedule", "stage", "for", "processing" ]
train
https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/loader/BufferStage.java#L239-L276
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/RunsInner.java
RunsInner.beginUpdate
public RunInner beginUpdate(String resourceGroupName, String registryName, String runId, Boolean isArchiveEnabled) { return beginUpdateWithServiceResponseAsync(resourceGroupName, registryName, runId, isArchiveEnabled).toBlocking().single().body(); }
java
public RunInner beginUpdate(String resourceGroupName, String registryName, String runId, Boolean isArchiveEnabled) { return beginUpdateWithServiceResponseAsync(resourceGroupName, registryName, runId, isArchiveEnabled).toBlocking().single().body(); }
[ "public", "RunInner", "beginUpdate", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "String", "runId", ",", "Boolean", "isArchiveEnabled", ")", "{", "return", "beginUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "registryName", ...
Patch the run properties. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param runId The run ID. @param isArchiveEnabled The value that indicates whether archiving is enabled or not. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the RunInner object if successful.
[ "Patch", "the", "run", "properties", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/RunsInner.java#L691-L693
crnk-project/crnk-framework
crnk-core/src/main/java/io/crnk/core/boot/CrnkBoot.java
CrnkBoot.putServerInfo
public void putServerInfo(String key, String value) { serverInfo.put(key, value); moduleRegistry.setServerInfo(serverInfo); }
java
public void putServerInfo(String key, String value) { serverInfo.put(key, value); moduleRegistry.setServerInfo(serverInfo); }
[ "public", "void", "putServerInfo", "(", "String", "key", ",", "String", "value", ")", "{", "serverInfo", ".", "put", "(", "key", ",", "value", ")", ";", "moduleRegistry", ".", "setServerInfo", "(", "serverInfo", ")", ";", "}" ]
Returned in the jsonapi field with every response. See http://jsonapi.org/format/#document-top-level.
[ "Returned", "in", "the", "jsonapi", "field", "with", "every", "response", ".", "See", "http", ":", "//", "jsonapi", ".", "org", "/", "format", "/", "#document", "-", "top", "-", "level", "." ]
train
https://github.com/crnk-project/crnk-framework/blob/2fd3ef9a991788d46fd2e83b43c8ea37cbaf8681/crnk-core/src/main/java/io/crnk/core/boot/CrnkBoot.java#L132-L136
iipc/webarchive-commons
src/main/java/org/archive/util/FileUtils.java
FileUtils.maybeRelative
public static File maybeRelative(File context, String path) { File f = new File(path); if(f.isAbsolute()) { return f; } return new File(context, path); }
java
public static File maybeRelative(File context, String path) { File f = new File(path); if(f.isAbsolute()) { return f; } return new File(context, path); }
[ "public", "static", "File", "maybeRelative", "(", "File", "context", ",", "String", "path", ")", "{", "File", "f", "=", "new", "File", "(", "path", ")", ";", "if", "(", "f", ".", "isAbsolute", "(", ")", ")", "{", "return", "f", ";", "}", "return", ...
Turn path into a File, relative to context (which may be ignored if path is absolute). @param context File context if path is relative @param path String path to make into a File @return File created
[ "Turn", "path", "into", "a", "File", "relative", "to", "context", "(", "which", "may", "be", "ignored", "if", "path", "is", "absolute", ")", "." ]
train
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/util/FileUtils.java#L320-L326
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FacesImpl.java
FacesImpl.verifyFaceToFace
public VerifyResult verifyFaceToFace(UUID faceId1, UUID faceId2) { return verifyFaceToFaceWithServiceResponseAsync(faceId1, faceId2).toBlocking().single().body(); }
java
public VerifyResult verifyFaceToFace(UUID faceId1, UUID faceId2) { return verifyFaceToFaceWithServiceResponseAsync(faceId1, faceId2).toBlocking().single().body(); }
[ "public", "VerifyResult", "verifyFaceToFace", "(", "UUID", "faceId1", ",", "UUID", "faceId2", ")", "{", "return", "verifyFaceToFaceWithServiceResponseAsync", "(", "faceId1", ",", "faceId2", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", ...
Verify whether two faces belong to a same person or whether one face belongs to a person. @param faceId1 FaceId of the first face, comes from Face - Detect @param faceId2 FaceId of the second face, comes from Face - Detect @throws IllegalArgumentException thrown if parameters fail the validation @throws APIErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the VerifyResult object if successful.
[ "Verify", "whether", "two", "faces", "belong", "to", "a", "same", "person", "or", "whether", "one", "face", "belongs", "to", "a", "person", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FacesImpl.java#L569-L571
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/UserAuthenticationEvent.java
UserAuthenticationEvent.addNodeActiveParticipant
public void addNodeActiveParticipant(String userId, String altUserId, String userName, String networkId) { addActiveParticipant( userId, altUserId, userName, true, Collections.singletonList(new DICOMActiveParticipantRoleIdCodes.Application()), networkId); }
java
public void addNodeActiveParticipant(String userId, String altUserId, String userName, String networkId) { addActiveParticipant( userId, altUserId, userName, true, Collections.singletonList(new DICOMActiveParticipantRoleIdCodes.Application()), networkId); }
[ "public", "void", "addNodeActiveParticipant", "(", "String", "userId", ",", "String", "altUserId", ",", "String", "userName", ",", "String", "networkId", ")", "{", "addActiveParticipant", "(", "userId", ",", "altUserId", ",", "userName", ",", "true", ",", "Colle...
Adds an Active Participant representing the node that is performing the authentication @param userId The Active Participant's User ID @param altUserId The Active Participant's Alternate UserID @param userName The Active Participant's UserName @param networkId The Active Participant's Network Access Point ID
[ "Adds", "an", "Active", "Participant", "representing", "the", "node", "that", "is", "performing", "the", "authentication" ]
train
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/UserAuthenticationEvent.java#L91-L100
spring-projects/spring-social-facebook
spring-social-facebook/src/main/java/org/springframework/social/facebook/api/impl/FacebookTemplate.java
FacebookTemplate.fetchPreviousPagedConnections
public <T> PagedList<T> fetchPreviousPagedConnections(PagedList<T> page, Class<T> type) { if (null != page && null != page.getPreviousPage() && !"".equals(page.getPreviousPage().getFullUrl().trim())) { URIBuilder uriBuilder = URIBuilder.fromUri(page.getPreviousPage().getFullUrl()); JsonNode jsonNode = getRestTemplate().getForObject(uriBuilder.build(), JsonNode.class); return pagify(type, jsonNode); } return null; }
java
public <T> PagedList<T> fetchPreviousPagedConnections(PagedList<T> page, Class<T> type) { if (null != page && null != page.getPreviousPage() && !"".equals(page.getPreviousPage().getFullUrl().trim())) { URIBuilder uriBuilder = URIBuilder.fromUri(page.getPreviousPage().getFullUrl()); JsonNode jsonNode = getRestTemplate().getForObject(uriBuilder.build(), JsonNode.class); return pagify(type, jsonNode); } return null; }
[ "public", "<", "T", ">", "PagedList", "<", "T", ">", "fetchPreviousPagedConnections", "(", "PagedList", "<", "T", ">", "page", ",", "Class", "<", "T", ">", "type", ")", "{", "if", "(", "null", "!=", "page", "&&", "null", "!=", "page", ".", "getPrevio...
Fetchs the previous {@link org.springframework.social.facebook.api.PagedList PagedList} of the current one. @param page source {@link org.springframework.social.facebook.api.PagedList PagedList} to fetch the previous one. @param type type of the source {@link org.springframework.social.facebook.api.PagedList PagedList} and the previous one. @return the previous {@link org.springframework.social.facebook.api.PagedList PagedList} of the given one. @param <T> the type of the source It returns <code>null</code> if the previous {@link org.springframework.social.facebook.api.PagedList PagedList} doesn't exist.
[ "Fetchs", "the", "previous", "{" ]
train
https://github.com/spring-projects/spring-social-facebook/blob/ae2234d94367eaa3adbba251ec7790d5ba7ffa41/spring-social-facebook/src/main/java/org/springframework/social/facebook/api/impl/FacebookTemplate.java#L279-L286
apache/incubator-gobblin
gobblin-runtime/src/main/java/org/apache/gobblin/scheduler/JobScheduler.java
JobScheduler.unscheduleJob
public void unscheduleJob(String jobName) throws JobException { if (this.scheduledJobs.containsKey(jobName)) { try { this.scheduler.getScheduler().deleteJob(this.scheduledJobs.remove(jobName)); } catch (SchedulerException se) { LOG.error("Failed to unschedule and delete job " + jobName, se); throw new JobException("Failed to unschedule and delete job " + jobName, se); } } }
java
public void unscheduleJob(String jobName) throws JobException { if (this.scheduledJobs.containsKey(jobName)) { try { this.scheduler.getScheduler().deleteJob(this.scheduledJobs.remove(jobName)); } catch (SchedulerException se) { LOG.error("Failed to unschedule and delete job " + jobName, se); throw new JobException("Failed to unschedule and delete job " + jobName, se); } } }
[ "public", "void", "unscheduleJob", "(", "String", "jobName", ")", "throws", "JobException", "{", "if", "(", "this", ".", "scheduledJobs", ".", "containsKey", "(", "jobName", ")", ")", "{", "try", "{", "this", ".", "scheduler", ".", "getScheduler", "(", ")"...
Unschedule and delete a job. @param jobName Job name @throws JobException when there is anything wrong unschedule the job
[ "Unschedule", "and", "delete", "a", "job", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/scheduler/JobScheduler.java#L408-L418
gallandarakhneorg/afc
core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3d.java
AlignedBox3d.setZ
@Override public void setZ(double min, double max) { if (min <= max) { this.minzProperty.set(min); this.maxzProperty.set(max); } else { this.minzProperty.set(max); this.maxzProperty.set(min); } }
java
@Override public void setZ(double min, double max) { if (min <= max) { this.minzProperty.set(min); this.maxzProperty.set(max); } else { this.minzProperty.set(max); this.maxzProperty.set(min); } }
[ "@", "Override", "public", "void", "setZ", "(", "double", "min", ",", "double", "max", ")", "{", "if", "(", "min", "<=", "max", ")", "{", "this", ".", "minzProperty", ".", "set", "(", "min", ")", ";", "this", ".", "maxzProperty", ".", "set", "(", ...
Set the z bounds of the box. @param min the min value for the z axis. @param max the max value for the z axis.
[ "Set", "the", "z", "bounds", "of", "the", "box", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3d.java#L705-L714
ldapchai/ldapchai
src/main/java/com/novell/ldapchai/provider/AbstractWrapper.java
AbstractWrapper.factoryImpl
protected static ChaiProviderImplementor factoryImpl( final Class wrapperClass, final ChaiSetting enableSetting, final ChaiProviderImplementor chaiProvider ) throws Exception { //check to make sure watchdog ise enabled; final boolean isEnabled = Boolean.parseBoolean( chaiProvider.getChaiConfiguration().getSetting( enableSetting ) ); if ( !isEnabled ) { final String errorStr = "attempt to obtain " + wrapperClass.getName() + " wrapper when not enabled in chaiConfiguration"; LOGGER.warn( errorStr ); throw new IllegalStateException( errorStr ); } if ( Proxy.isProxyClass( chaiProvider.getClass() ) && wrapperClass.isInstance( chaiProvider ) ) { LOGGER.warn( "attempt to obtain " + wrapperClass.getName() + " wrapper for already wrapped ChaiProvider." ); return chaiProvider; } try { final Constructor constructor = wrapperClass.getConstructor( ChaiProviderImplementor.class.getClass() ); final InvocationHandler wrapper = ( InvocationHandler ) constructor.newInstance( chaiProvider ); final Object wrappedProvider = Proxy.newProxyInstance( chaiProvider.getClass().getClassLoader(), chaiProvider.getClass().getInterfaces(), wrapper ); return ( ChaiProviderImplementor ) wrappedProvider; } catch ( Exception e ) { LOGGER.fatal( "Chai internal error, no appropriate constructor for " + wrapperClass.getCanonicalName(), e ); } throw new Exception( "Chai internal error, unable to create wrapper for " + wrapperClass.getCanonicalName() ); }
java
protected static ChaiProviderImplementor factoryImpl( final Class wrapperClass, final ChaiSetting enableSetting, final ChaiProviderImplementor chaiProvider ) throws Exception { //check to make sure watchdog ise enabled; final boolean isEnabled = Boolean.parseBoolean( chaiProvider.getChaiConfiguration().getSetting( enableSetting ) ); if ( !isEnabled ) { final String errorStr = "attempt to obtain " + wrapperClass.getName() + " wrapper when not enabled in chaiConfiguration"; LOGGER.warn( errorStr ); throw new IllegalStateException( errorStr ); } if ( Proxy.isProxyClass( chaiProvider.getClass() ) && wrapperClass.isInstance( chaiProvider ) ) { LOGGER.warn( "attempt to obtain " + wrapperClass.getName() + " wrapper for already wrapped ChaiProvider." ); return chaiProvider; } try { final Constructor constructor = wrapperClass.getConstructor( ChaiProviderImplementor.class.getClass() ); final InvocationHandler wrapper = ( InvocationHandler ) constructor.newInstance( chaiProvider ); final Object wrappedProvider = Proxy.newProxyInstance( chaiProvider.getClass().getClassLoader(), chaiProvider.getClass().getInterfaces(), wrapper ); return ( ChaiProviderImplementor ) wrappedProvider; } catch ( Exception e ) { LOGGER.fatal( "Chai internal error, no appropriate constructor for " + wrapperClass.getCanonicalName(), e ); } throw new Exception( "Chai internal error, unable to create wrapper for " + wrapperClass.getCanonicalName() ); }
[ "protected", "static", "ChaiProviderImplementor", "factoryImpl", "(", "final", "Class", "wrapperClass", ",", "final", "ChaiSetting", "enableSetting", ",", "final", "ChaiProviderImplementor", "chaiProvider", ")", "throws", "Exception", "{", "//check to make sure watchdog ise e...
Wrap a pre-existing ChaiProvider with a WatchdogWrapper instance. @param chaiProvider a pre-existing {@code ChaiProvider} @param enableSetting setting to mark if watchdog is enabled @param wrapperClass chai provider wrapper @return a wrapped {@code ChaiProvider} instance.
[ "Wrap", "a", "pre", "-", "existing", "ChaiProvider", "with", "a", "WatchdogWrapper", "instance", "." ]
train
https://github.com/ldapchai/ldapchai/blob/a6d4b5dbfa4e270db0ce70892512cbe39e64b874/src/main/java/com/novell/ldapchai/provider/AbstractWrapper.java#L45-L80
radkovo/jStyleParser
src/main/java/cz/vutbr/web/css/CSSFactory.java
CSSFactory.parseString
public static final StyleSheet parseString(String css, URL base) throws IOException, CSSException { return parseString(css, base, getNetworkProcessor()); }
java
public static final StyleSheet parseString(String css, URL base) throws IOException, CSSException { return parseString(css, base, getNetworkProcessor()); }
[ "public", "static", "final", "StyleSheet", "parseString", "(", "String", "css", ",", "URL", "base", ")", "throws", "IOException", ",", "CSSException", "{", "return", "parseString", "(", "css", ",", "base", ",", "getNetworkProcessor", "(", ")", ")", ";", "}" ...
Parses text into a StyleSheet @param css Text with CSS declarations @param base The URL to be used as a base for loading external resources. Base URL may be {@code null} if there are no external resources in the CSS string referenced by relative URLs. @return Parsed StyleSheet @throws IOException When exception during read occurs @throws CSSException When exception during parse occurs
[ "Parses", "text", "into", "a", "StyleSheet" ]
train
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/css/CSSFactory.java#L519-L522
VoltDB/voltdb
third_party/java/src/org/apache/commons_voltpatches/cli/HelpFormatter.java
HelpFormatter.printHelp
public void printHelp(String cmdLineSyntax, String header, Options options, String footer) { printHelp(cmdLineSyntax, header, options, footer, false); }
java
public void printHelp(String cmdLineSyntax, String header, Options options, String footer) { printHelp(cmdLineSyntax, header, options, footer, false); }
[ "public", "void", "printHelp", "(", "String", "cmdLineSyntax", ",", "String", "header", ",", "Options", "options", ",", "String", "footer", ")", "{", "printHelp", "(", "cmdLineSyntax", ",", "header", ",", "options", ",", "footer", ",", "false", ")", ";", "...
Print the help for <code>options</code> with the specified command line syntax. This method prints help information to System.out. @param cmdLineSyntax the syntax for this application @param header the banner to display at the beginning of the help @param options the Options instance @param footer the banner to display at the end of the help
[ "Print", "the", "help", "for", "<code", ">", "options<", "/", "code", ">", "with", "the", "specified", "command", "line", "syntax", ".", "This", "method", "prints", "help", "information", "to", "System", ".", "out", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/commons_voltpatches/cli/HelpFormatter.java#L436-L439
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Solo.java
Solo.scrollListToLine
public void scrollListToLine(AbsListView absListView, int line){ if(config.commandLogging){ Log.d(config.commandLoggingTag, "scrollListToLine("+absListView+", "+line+")"); } scroller.scrollListToLine(absListView, line); }
java
public void scrollListToLine(AbsListView absListView, int line){ if(config.commandLogging){ Log.d(config.commandLoggingTag, "scrollListToLine("+absListView+", "+line+")"); } scroller.scrollListToLine(absListView, line); }
[ "public", "void", "scrollListToLine", "(", "AbsListView", "absListView", ",", "int", "line", ")", "{", "if", "(", "config", ".", "commandLogging", ")", "{", "Log", ".", "d", "(", "config", ".", "commandLoggingTag", ",", "\"scrollListToLine(\"", "+", "absListVi...
Scroll the specified AbsListView to the specified line. @param absListView the {@link AbsListView} to scroll @param line the line to scroll to
[ "Scroll", "the", "specified", "AbsListView", "to", "the", "specified", "line", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Solo.java#L2186-L2192
OpenLiberty/open-liberty
dev/com.ibm.ws.concurrent.mp.1.0/src/com/ibm/ws/concurrent/mp/ManagedCompletableFuture.java
ManagedCompletableFuture.runAsync
@Trivial // traced by caller public static CompletableFuture<Void> runAsync(Runnable action, Executor executor) { // Reject ManagedTask so that we have the flexibility to decide later how to handle ManagedTaskListener and execution properties if (action instanceof ManagedTask) throw new IllegalArgumentException(ManagedTask.class.getName()); FutureRefExecutor futureExecutor = supportsAsync(executor); ThreadContextDescriptor contextDescriptor; if (action instanceof ContextualSupplier) { ContextualRunnable r = (ContextualRunnable) action; contextDescriptor = r.getContextDescriptor(); action = r.getAction(); } else if (executor instanceof WSManagedExecutorService) { WSContextService contextSvc = ((WSManagedExecutorService) executor).getContextService(); contextDescriptor = contextSvc.captureThreadContext(XPROPS_SUSPEND_TRAN); } else { contextDescriptor = null; } if (JAVA8) { action = new ContextualRunnable(contextDescriptor, action); CompletableFuture<Void> completableFuture = CompletableFuture.runAsync(action, futureExecutor == null ? executor : futureExecutor); return new ManagedCompletableFuture<Void>(completableFuture, executor, futureExecutor); } else { ManagedCompletableFuture<Void> completableFuture = new ManagedCompletableFuture<Void>(executor, futureExecutor); action = new ContextualRunnable(contextDescriptor, action, completableFuture); (futureExecutor == null ? executor : futureExecutor).execute(action); return completableFuture; } }
java
@Trivial // traced by caller public static CompletableFuture<Void> runAsync(Runnable action, Executor executor) { // Reject ManagedTask so that we have the flexibility to decide later how to handle ManagedTaskListener and execution properties if (action instanceof ManagedTask) throw new IllegalArgumentException(ManagedTask.class.getName()); FutureRefExecutor futureExecutor = supportsAsync(executor); ThreadContextDescriptor contextDescriptor; if (action instanceof ContextualSupplier) { ContextualRunnable r = (ContextualRunnable) action; contextDescriptor = r.getContextDescriptor(); action = r.getAction(); } else if (executor instanceof WSManagedExecutorService) { WSContextService contextSvc = ((WSManagedExecutorService) executor).getContextService(); contextDescriptor = contextSvc.captureThreadContext(XPROPS_SUSPEND_TRAN); } else { contextDescriptor = null; } if (JAVA8) { action = new ContextualRunnable(contextDescriptor, action); CompletableFuture<Void> completableFuture = CompletableFuture.runAsync(action, futureExecutor == null ? executor : futureExecutor); return new ManagedCompletableFuture<Void>(completableFuture, executor, futureExecutor); } else { ManagedCompletableFuture<Void> completableFuture = new ManagedCompletableFuture<Void>(executor, futureExecutor); action = new ContextualRunnable(contextDescriptor, action, completableFuture); (futureExecutor == null ? executor : futureExecutor).execute(action); return completableFuture; } }
[ "@", "Trivial", "// traced by caller", "public", "static", "CompletableFuture", "<", "Void", ">", "runAsync", "(", "Runnable", "action", ",", "Executor", "executor", ")", "{", "// Reject ManagedTask so that we have the flexibility to decide later how to handle ManagedTaskListener...
Alternative to CompletableFuture.runAsync(action, executor) with an implementation that switches the default asynchronous execution facility to be the specified managed executor. @param action the action to run asynchronously. @param executor the executor, typically a managed executor, that becomes the default asynchronous execution facility for the completable future. @return completable future where the specified managed executor is the default asynchronous execution facility.
[ "Alternative", "to", "CompletableFuture", ".", "runAsync", "(", "action", "executor", ")", "with", "an", "implementation", "that", "switches", "the", "default", "asynchronous", "execution", "facility", "to", "be", "the", "specified", "managed", "executor", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent.mp.1.0/src/com/ibm/ws/concurrent/mp/ManagedCompletableFuture.java#L451-L481
mapfish/mapfish-print
core/src/main/java/org/mapfish/print/servlet/BaseMapServlet.java
BaseMapServlet.findReplacement
public static String findReplacement(final String variableName, final Date date) { if (variableName.equalsIgnoreCase("date")) { return cleanUpName(DateFormat.getDateInstance().format(date)); } else if (variableName.equalsIgnoreCase("datetime")) { return cleanUpName(DateFormat.getDateTimeInstance().format(date)); } else if (variableName.equalsIgnoreCase("time")) { return cleanUpName(DateFormat.getTimeInstance().format(date)); } else { try { return new SimpleDateFormat(variableName).format(date); } catch (Exception e) { LOGGER.error("Unable to format timestamp according to pattern: {}", variableName, e); return "${" + variableName + "}"; } } }
java
public static String findReplacement(final String variableName, final Date date) { if (variableName.equalsIgnoreCase("date")) { return cleanUpName(DateFormat.getDateInstance().format(date)); } else if (variableName.equalsIgnoreCase("datetime")) { return cleanUpName(DateFormat.getDateTimeInstance().format(date)); } else if (variableName.equalsIgnoreCase("time")) { return cleanUpName(DateFormat.getTimeInstance().format(date)); } else { try { return new SimpleDateFormat(variableName).format(date); } catch (Exception e) { LOGGER.error("Unable to format timestamp according to pattern: {}", variableName, e); return "${" + variableName + "}"; } } }
[ "public", "static", "String", "findReplacement", "(", "final", "String", "variableName", ",", "final", "Date", "date", ")", "{", "if", "(", "variableName", ".", "equalsIgnoreCase", "(", "\"date\"", ")", ")", "{", "return", "cleanUpName", "(", "DateFormat", "."...
Update a variable name with a date if the variable is detected as being a date. @param variableName the variable name. @param date the date to replace the value with if the variable is a date variable.
[ "Update", "a", "variable", "name", "with", "a", "date", "if", "the", "variable", "is", "detected", "as", "being", "a", "date", "." ]
train
https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/servlet/BaseMapServlet.java#L38-L53
aNNiMON/Lightweight-Stream-API
stream/src/main/java/com/annimon/stream/Collectors.java
Collectors.joining
@NotNull public static Collector<CharSequence, ?, String> joining( @NotNull CharSequence delimiter, @NotNull CharSequence prefix, @NotNull CharSequence suffix) { return joining(delimiter, prefix, suffix, prefix.toString() + suffix.toString()); }
java
@NotNull public static Collector<CharSequence, ?, String> joining( @NotNull CharSequence delimiter, @NotNull CharSequence prefix, @NotNull CharSequence suffix) { return joining(delimiter, prefix, suffix, prefix.toString() + suffix.toString()); }
[ "@", "NotNull", "public", "static", "Collector", "<", "CharSequence", ",", "?", ",", "String", ">", "joining", "(", "@", "NotNull", "CharSequence", "delimiter", ",", "@", "NotNull", "CharSequence", "prefix", ",", "@", "NotNull", "CharSequence", "suffix", ")", ...
Returns a {@code Collector} that concatenates input elements into new string. @param delimiter the delimiter between each element @param prefix the prefix of result @param suffix the suffix of result @return a {@code Collector}
[ "Returns", "a", "{", "@code", "Collector", "}", "that", "concatenates", "input", "elements", "into", "new", "string", "." ]
train
https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/Collectors.java#L398-L404
Baidu-AIP/java-sdk
src/main/java/com/baidu/aip/face/AipFace.java
AipFace.personVerify
public JSONObject personVerify(String image, String imageType, String idCardNumber, String name, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); request.addBody("image", image); request.addBody("image_type", imageType); request.addBody("id_card_number", idCardNumber); request.addBody("name", name); if (options != null) { request.addBody(options); } request.setUri(FaceConsts.PERSON_VERIFY); request.setBodyFormat(EBodyFormat.RAW_JSON); postOperation(request); return requestServer(request); }
java
public JSONObject personVerify(String image, String imageType, String idCardNumber, String name, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); request.addBody("image", image); request.addBody("image_type", imageType); request.addBody("id_card_number", idCardNumber); request.addBody("name", name); if (options != null) { request.addBody(options); } request.setUri(FaceConsts.PERSON_VERIFY); request.setBodyFormat(EBodyFormat.RAW_JSON); postOperation(request); return requestServer(request); }
[ "public", "JSONObject", "personVerify", "(", "String", "image", ",", "String", "imageType", ",", "String", "idCardNumber", ",", "String", "name", ",", "HashMap", "<", "String", ",", "String", ">", "options", ")", "{", "AipRequest", "request", "=", "new", "Ai...
身份验证接口 @param image - 图片信息(**总数据大小应小于10M**),图片上传方式根据image_type来判断 @param imageType - 图片类型 **BASE64**:图片的base64值,base64编码后的图片数据,需urlencode,编码后的图片大小不超过2M;**URL**:图片的 URL地址( 可能由于网络等原因导致下载图片时间过长)**;FACE_TOKEN**: 人脸图片的唯一标识,调用人脸检测接口时,会为每个人脸图片赋予一个唯一的FACE_TOKEN,同一张图片多次检测得到的FACE_TOKEN是同一个 @param idCardNumber - 身份证号(真实身份证号号码) @param name - utf8,姓名(真实姓名,和身份证号匹配) @param options - 可选参数对象,key: value都为string类型 options - options列表: quality_control 图片质量控制 **NONE**: 不进行控制 **LOW**:较低的质量要求 **NORMAL**: 一般的质量要求 **HIGH**: 较高的质量要求 **默认 NONE** liveness_control 活体检测控制 **NONE**: 不进行控制 **LOW**:较低的活体要求(高通过率 低攻击拒绝率) **NORMAL**: 一般的活体要求(平衡的攻击拒绝率, 通过率) **HIGH**: 较高的活体要求(高攻击拒绝率 低通过率) **默认NONE** @return JSONObject
[ "身份验证接口" ]
train
https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/face/AipFace.java#L392-L410
vkostyukov/la4j
src/main/java/org/la4j/matrix/RowMajorSparseMatrix.java
RowMajorSparseMatrix.from1DArray
public static RowMajorSparseMatrix from1DArray(int rows, int columns, double[] array) { return CRSMatrix.from1DArray(rows, columns, array); }
java
public static RowMajorSparseMatrix from1DArray(int rows, int columns, double[] array) { return CRSMatrix.from1DArray(rows, columns, array); }
[ "public", "static", "RowMajorSparseMatrix", "from1DArray", "(", "int", "rows", ",", "int", "columns", ",", "double", "[", "]", "array", ")", "{", "return", "CRSMatrix", ".", "from1DArray", "(", "rows", ",", "columns", ",", "array", ")", ";", "}" ]
Creates a new {@link RowMajorSparseMatrix} from the given 1D {@code array} with compressing (copying) the underlying array.
[ "Creates", "a", "new", "{" ]
train
https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/matrix/RowMajorSparseMatrix.java#L101-L103
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/DeployKeysApi.java
DeployKeysApi.enableDeployKey
public DeployKey enableDeployKey(Object projectIdOrPath, Integer keyId) throws GitLabApiException { if (keyId == null) { throw new RuntimeException("keyId cannot be null"); } Response response = post(Response.Status.CREATED, (Form)null, "projects", getProjectIdOrPath(projectIdOrPath), "deploy_keys", keyId, "enable"); return (response.readEntity(DeployKey.class)); }
java
public DeployKey enableDeployKey(Object projectIdOrPath, Integer keyId) throws GitLabApiException { if (keyId == null) { throw new RuntimeException("keyId cannot be null"); } Response response = post(Response.Status.CREATED, (Form)null, "projects", getProjectIdOrPath(projectIdOrPath), "deploy_keys", keyId, "enable"); return (response.readEntity(DeployKey.class)); }
[ "public", "DeployKey", "enableDeployKey", "(", "Object", "projectIdOrPath", ",", "Integer", "keyId", ")", "throws", "GitLabApiException", "{", "if", "(", "keyId", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"keyId cannot be null\"", ")", ";"...
Enables a deploy key for a project so this can be used. Returns the enabled key when successful. <pre><code>GitLab Endpoint: POST /projects/:id/deploy_keys/:key_id/enable</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param keyId the ID of the deploy key to enable @return an DeployKey instance with info on the enabled deploy key @throws GitLabApiException if any exception occurs
[ "Enables", "a", "deploy", "key", "for", "a", "project", "so", "this", "can", "be", "used", ".", "Returns", "the", "enabled", "key", "when", "successful", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/DeployKeysApi.java#L223-L232
alkacon/opencms-core
src/org/opencms/jsp/decorator/CmsHtmlDecorator.java
CmsHtmlDecorator.hasDelimiter
private boolean hasDelimiter(String word, String[] delimiters) { boolean delim = false; for (int i = 0; i < delimiters.length; i++) { if (word.indexOf(delimiters[i]) > -1) { delim = true; break; } } return delim; }
java
private boolean hasDelimiter(String word, String[] delimiters) { boolean delim = false; for (int i = 0; i < delimiters.length; i++) { if (word.indexOf(delimiters[i]) > -1) { delim = true; break; } } return delim; }
[ "private", "boolean", "hasDelimiter", "(", "String", "word", ",", "String", "[", "]", "delimiters", ")", "{", "boolean", "delim", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "delimiters", ".", "length", ";", "i", "++", ")", ...
Checks if a word contains a given delimiter.<p> @param word the word to test @param delimiters array of delimiter strings @return true if the word contains the delimiter, false otherwiese
[ "Checks", "if", "a", "word", "contains", "a", "given", "delimiter", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/decorator/CmsHtmlDecorator.java#L460-L470
unbescape/unbescape
src/main/java/org/unbescape/properties/PropertiesEscape.java
PropertiesEscape.escapePropertiesValueMinimal
public static void escapePropertiesValueMinimal(final Reader reader, final Writer writer) throws IOException { escapePropertiesValue(reader, writer, PropertiesValueEscapeLevel.LEVEL_1_BASIC_ESCAPE_SET); }
java
public static void escapePropertiesValueMinimal(final Reader reader, final Writer writer) throws IOException { escapePropertiesValue(reader, writer, PropertiesValueEscapeLevel.LEVEL_1_BASIC_ESCAPE_SET); }
[ "public", "static", "void", "escapePropertiesValueMinimal", "(", "final", "Reader", "reader", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "escapePropertiesValue", "(", "reader", ",", "writer", ",", "PropertiesValueEscapeLevel", ".", "LEVEL_1_B...
<p> Perform a Java Properties Value level 1 (only basic set) <strong>escape</strong> operation on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>. </p> <p> <em>Level 1</em> means this method will only escape the Java Properties basic escape set: </p> <ul> <li>The <em>Single Escape Characters</em>: <tt>&#92;t</tt> (<tt>U+0009</tt>), <tt>&#92;n</tt> (<tt>U+000A</tt>), <tt>&#92;f</tt> (<tt>U+000C</tt>), <tt>&#92;r</tt> (<tt>U+000D</tt>) and <tt>&#92;&#92;</tt> (<tt>U+005C</tt>). </li> <li> Two ranges of non-displayable, control characters (some of which are already part of the <em>single escape characters</em> list): <tt>U+0000</tt> to <tt>U+001F</tt> and <tt>U+007F</tt> to <tt>U+009F</tt>. </li> </ul> <p> This method calls {@link #escapePropertiesValue(Reader, Writer, PropertiesValueEscapeLevel)} with the following preconfigured values: </p> <ul> <li><tt>level</tt>: {@link PropertiesValueEscapeLevel#LEVEL_1_BASIC_ESCAPE_SET}</li> </ul> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.2
[ "<p", ">", "Perform", "a", "Java", "Properties", "Value", "level", "1", "(", "only", "basic", "set", ")", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "Reader<", "/", "tt", ">", "input", "writing", "results", "to",...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/properties/PropertiesEscape.java#L483-L486
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/utils/Utils.java
Utils.isAncestor
public static boolean isAncestor( File ancestorCandidate, File file ) { String path = ancestorCandidate.getAbsolutePath(); if( ! path.endsWith( "/" )) path += "/"; return file.getAbsolutePath().startsWith( path ); }
java
public static boolean isAncestor( File ancestorCandidate, File file ) { String path = ancestorCandidate.getAbsolutePath(); if( ! path.endsWith( "/" )) path += "/"; return file.getAbsolutePath().startsWith( path ); }
[ "public", "static", "boolean", "isAncestor", "(", "File", "ancestorCandidate", ",", "File", "file", ")", "{", "String", "path", "=", "ancestorCandidate", ".", "getAbsolutePath", "(", ")", ";", "if", "(", "!", "path", ".", "endsWith", "(", "\"/\"", ")", ")"...
Determines whether a directory contains a given file. @param ancestorCandidate the directory @param file the file @return true if the directory directly or indirectly contains the file
[ "Determines", "whether", "a", "directory", "contains", "a", "given", "file", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/utils/Utils.java#L1009-L1016
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/LogNormalDistribution.java
LogNormalDistribution.quantile
public static double quantile(double x, double mu, double sigma) { return FastMath.exp(mu + sigma * NormalDistribution.standardNormalQuantile(x)); }
java
public static double quantile(double x, double mu, double sigma) { return FastMath.exp(mu + sigma * NormalDistribution.standardNormalQuantile(x)); }
[ "public", "static", "double", "quantile", "(", "double", "x", ",", "double", "mu", ",", "double", "sigma", ")", "{", "return", "FastMath", ".", "exp", "(", "mu", "+", "sigma", "*", "NormalDistribution", ".", "standardNormalQuantile", "(", "x", ")", ")", ...
Inverse cumulative probability density function (probit) of a normal distribution. @param x value to evaluate probit function at @param mu Mean value @param sigma Standard deviation. @return The probit of the given normal distribution at x.
[ "Inverse", "cumulative", "probability", "density", "function", "(", "probit", ")", "of", "a", "normal", "distribution", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/LogNormalDistribution.java#L216-L218
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaReferenceUtilsImpl.java
JmsJcaReferenceUtilsImpl.getMapFromReference
public Map getMapFromReference(final Reference ref, final Map defaults) { if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.entry(this, TRACE, "getMapFromReference", new Object[] {ref,defaults}); } Map extractedProps = null; // Extract a Map of the properties from the Reference synchronized (ref) { Enumeration propsList = ref.getAll(); // This will be set up to contain a map representing all the // information that was previously stored in the Reference. final Map<String,String> encodedMap = new HashMap<String,String>(); // Look at each property in turn. while (propsList.hasMoreElements()) { // Get the coded version of the name. This will start with one // of the prefix values. The codedName must have been non-null. StringRefAddr refAddr = (StringRefAddr) propsList.nextElement(); String codedName = refAddr.getType(); String val = (String) refAddr.getContent(); // Store the coded information in the map. encodedMap.put(codedName, val); }//while // Decode the encoded map. extractedProps = getStringDecodedMap(encodedMap, defaults); }//sync if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(this, TRACE, "getMapFromReference", extractedProps); } return extractedProps; }
java
public Map getMapFromReference(final Reference ref, final Map defaults) { if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.entry(this, TRACE, "getMapFromReference", new Object[] {ref,defaults}); } Map extractedProps = null; // Extract a Map of the properties from the Reference synchronized (ref) { Enumeration propsList = ref.getAll(); // This will be set up to contain a map representing all the // information that was previously stored in the Reference. final Map<String,String> encodedMap = new HashMap<String,String>(); // Look at each property in turn. while (propsList.hasMoreElements()) { // Get the coded version of the name. This will start with one // of the prefix values. The codedName must have been non-null. StringRefAddr refAddr = (StringRefAddr) propsList.nextElement(); String codedName = refAddr.getType(); String val = (String) refAddr.getContent(); // Store the coded information in the map. encodedMap.put(codedName, val); }//while // Decode the encoded map. extractedProps = getStringDecodedMap(encodedMap, defaults); }//sync if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(this, TRACE, "getMapFromReference", extractedProps); } return extractedProps; }
[ "public", "Map", "getMapFromReference", "(", "final", "Reference", "ref", ",", "final", "Map", "defaults", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "TRACE", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", ...
Uses the reference passed in to extract a map of properties which have been stored in this Reference. @param ref the reference @param defaults the default set of properties to be used (those in the reference will override these) @return the map of properties
[ "Uses", "the", "reference", "passed", "in", "to", "extract", "a", "map", "of", "properties", "which", "have", "been", "stored", "in", "this", "Reference", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jmsra/impl/JmsJcaReferenceUtilsImpl.java#L386-L427
jbundle/jbundle
thin/base/util/util/src/main/java/org/jbundle/thin/base/util/message/RemoteMessageManager.java
RemoteMessageManager.getMessageQueue
public BaseMessageQueue getMessageQueue(String strQueueName, String strQueueType) { // Look up the message Queue! BaseMessageQueue messageQueue = (BaseMessageQueue)super.getMessageQueue(strQueueName, strQueueType); if (messageQueue != null) return messageQueue; return new RemoteMessageQueue(this, strQueueName, strQueueType); }
java
public BaseMessageQueue getMessageQueue(String strQueueName, String strQueueType) { // Look up the message Queue! BaseMessageQueue messageQueue = (BaseMessageQueue)super.getMessageQueue(strQueueName, strQueueType); if (messageQueue != null) return messageQueue; return new RemoteMessageQueue(this, strQueueName, strQueueType); }
[ "public", "BaseMessageQueue", "getMessageQueue", "(", "String", "strQueueName", ",", "String", "strQueueType", ")", "{", "// Look up the message Queue!", "BaseMessageQueue", "messageQueue", "=", "(", "BaseMessageQueue", ")", "super", ".", "getMessageQueue", "(", "strQueue...
Get this Message Queue (or create one if this name doesn't exist). Creates a RemoteMessageQueue if this queue doesn't exist. @param strQueueName The queue name to lookup. @param strQueueType The queue type if this queue needs to be created. @return The message queue.
[ "Get", "this", "Message", "Queue", "(", "or", "create", "one", "if", "this", "name", "doesn", "t", "exist", ")", ".", "Creates", "a", "RemoteMessageQueue", "if", "this", "queue", "doesn", "t", "exist", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/util/util/src/main/java/org/jbundle/thin/base/util/message/RemoteMessageManager.java#L61-L68
googleads/googleads-java-lib
examples/admanager_axis/src/main/java/admanager/axis/v201902/companyservice/GetAdvertisers.java
GetAdvertisers.runExample
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException { CompanyServiceInterface companyService = adManagerServices.get(session, CompanyServiceInterface.class); // Create a statement to select companies. StatementBuilder statementBuilder = new StatementBuilder() .where("type = :type") .orderBy("id ASC") .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT) .withBindVariableValue("type", CompanyType.ADVERTISER.toString()); // Retrieve a small amount of companies at a time, paging through // until all companies have been retrieved. int totalResultSetSize = 0; do { CompanyPage page = companyService.getCompaniesByStatement(statementBuilder.toStatement()); if (page.getResults() != null) { // Print out some information for each company. totalResultSetSize = page.getTotalResultSetSize(); int i = page.getStartIndex(); for (Company company : page.getResults()) { System.out.printf( "%d) Company with ID %d, name '%s', and type '%s' was found.%n", i++, company.getId(), company.getName(), company.getType()); } } statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (statementBuilder.getOffset() < totalResultSetSize); System.out.printf("Number of results found: %d%n", totalResultSetSize); }
java
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException { CompanyServiceInterface companyService = adManagerServices.get(session, CompanyServiceInterface.class); // Create a statement to select companies. StatementBuilder statementBuilder = new StatementBuilder() .where("type = :type") .orderBy("id ASC") .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT) .withBindVariableValue("type", CompanyType.ADVERTISER.toString()); // Retrieve a small amount of companies at a time, paging through // until all companies have been retrieved. int totalResultSetSize = 0; do { CompanyPage page = companyService.getCompaniesByStatement(statementBuilder.toStatement()); if (page.getResults() != null) { // Print out some information for each company. totalResultSetSize = page.getTotalResultSetSize(); int i = page.getStartIndex(); for (Company company : page.getResults()) { System.out.printf( "%d) Company with ID %d, name '%s', and type '%s' was found.%n", i++, company.getId(), company.getName(), company.getType()); } } statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (statementBuilder.getOffset() < totalResultSetSize); System.out.printf("Number of results found: %d%n", totalResultSetSize); }
[ "public", "static", "void", "runExample", "(", "AdManagerServices", "adManagerServices", ",", "AdManagerSession", "session", ")", "throws", "RemoteException", "{", "CompanyServiceInterface", "companyService", "=", "adManagerServices", ".", "get", "(", "session", ",", "C...
Runs the example. @param adManagerServices the services factory. @param session the session. @throws ApiException if the API request failed with one or more service errors. @throws RemoteException if the API request failed due to other errors.
[ "Runs", "the", "example", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201902/companyservice/GetAdvertisers.java#L52-L86
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/DatabaseImpl.java
DatabaseImpl.getAllRevisionsOfDocument
public DocumentRevisionTree getAllRevisionsOfDocument(final String docId) { try { return get(queue.submit(new GetAllRevisionsOfDocumentCallable(docId, this.attachmentsDir, this.attachmentStreamFactory))); } catch (ExecutionException e) { logger.log(Level.SEVERE, "Failed to get all revisions of document", e); } return null; }
java
public DocumentRevisionTree getAllRevisionsOfDocument(final String docId) { try { return get(queue.submit(new GetAllRevisionsOfDocumentCallable(docId, this.attachmentsDir, this.attachmentStreamFactory))); } catch (ExecutionException e) { logger.log(Level.SEVERE, "Failed to get all revisions of document", e); } return null; }
[ "public", "DocumentRevisionTree", "getAllRevisionsOfDocument", "(", "final", "String", "docId", ")", "{", "try", "{", "return", "get", "(", "queue", ".", "submit", "(", "new", "GetAllRevisionsOfDocumentCallable", "(", "docId", ",", "this", ".", "attachmentsDir", "...
<p>Returns {@code DocumentRevisionTree} of a document.</p> <p>The tree contains the complete revision history of the document, including branches for conflicts and deleted leaves.</p> @param docId ID of the document @return {@code DocumentRevisionTree} of the specified document
[ "<p", ">", "Returns", "{", "@code", "DocumentRevisionTree", "}", "of", "a", "document", ".", "<", "/", "p", ">" ]
train
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/DatabaseImpl.java#L273-L281
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/StratifiedSampling.java
StratifiedSampling.std
public static double std(TransposeDataCollection sampleDataCollection, AssociativeArray populationNh) { return Math.sqrt(variance(sampleDataCollection, populationNh)); }
java
public static double std(TransposeDataCollection sampleDataCollection, AssociativeArray populationNh) { return Math.sqrt(variance(sampleDataCollection, populationNh)); }
[ "public", "static", "double", "std", "(", "TransposeDataCollection", "sampleDataCollection", ",", "AssociativeArray", "populationNh", ")", "{", "return", "Math", ".", "sqrt", "(", "variance", "(", "sampleDataCollection", ",", "populationNh", ")", ")", ";", "}" ]
Calculate the standard deviation of the sample @param sampleDataCollection @param populationNh @return
[ "Calculate", "the", "standard", "deviation", "of", "the", "sample" ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/StratifiedSampling.java#L154-L156
FINRAOS/DataGenerator
dg-core/src/main/java/org/finra/datagenerator/engine/scxml/tags/SetAssignExtension.java
SetAssignExtension.pipelinePossibleStates
public List<Map<String, String>> pipelinePossibleStates(SetAssignTag action, List<Map<String, String>> possibleStateList) { if (action == null) { throw new NullActionException("Called with a null action, and possibleStateList = " + possibleStateList.toString()); } String variable = action.getName(); String set = action.getSet(); String[] domain; if (set == null) { throw new NullSetException("Called with a null set, action name=" + action.getName() + " and possibleStateList = " + possibleStateList.toString()); } if (StringUtils.splitByWholeSeparator(set, action.getSeparator()).length == 0) { domain = new String[]{""}; } else { domain = StringUtils.splitByWholeSeparator(set, action.getSeparator()); } //take the product List<Map<String, String>> productTemp = new LinkedList<>(); for (Map<String, String> p : possibleStateList) { for (String value : domain) { HashMap<String, String> n = new HashMap<>(p); n.put(variable, value); productTemp.add(n); } } return productTemp; }
java
public List<Map<String, String>> pipelinePossibleStates(SetAssignTag action, List<Map<String, String>> possibleStateList) { if (action == null) { throw new NullActionException("Called with a null action, and possibleStateList = " + possibleStateList.toString()); } String variable = action.getName(); String set = action.getSet(); String[] domain; if (set == null) { throw new NullSetException("Called with a null set, action name=" + action.getName() + " and possibleStateList = " + possibleStateList.toString()); } if (StringUtils.splitByWholeSeparator(set, action.getSeparator()).length == 0) { domain = new String[]{""}; } else { domain = StringUtils.splitByWholeSeparator(set, action.getSeparator()); } //take the product List<Map<String, String>> productTemp = new LinkedList<>(); for (Map<String, String> p : possibleStateList) { for (String value : domain) { HashMap<String, String> n = new HashMap<>(p); n.put(variable, value); productTemp.add(n); } } return productTemp; }
[ "public", "List", "<", "Map", "<", "String", ",", "String", ">", ">", "pipelinePossibleStates", "(", "SetAssignTag", "action", ",", "List", "<", "Map", "<", "String", ",", "String", ">", ">", "possibleStateList", ")", "{", "if", "(", "action", "==", "nul...
Performs variable assignments from a set of values @param action a SetAssignTag Action @param possibleStateList a current list of possible states produced so far from expanding a model state @return the cartesian product of every current possible state and the set of values specified by action
[ "Performs", "variable", "assignments", "from", "a", "set", "of", "values" ]
train
https://github.com/FINRAOS/DataGenerator/blob/1f69f949401cbed4db4f553c3eb8350832c4d45a/dg-core/src/main/java/org/finra/datagenerator/engine/scxml/tags/SetAssignExtension.java#L61-L95
VoltDB/voltdb
src/frontend/org/voltdb/plannodes/AggregatePlanNode.java
AggregatePlanNode.convertToSerialAggregatePlanNode
public static AggregatePlanNode convertToSerialAggregatePlanNode(HashAggregatePlanNode hashAggregateNode) { AggregatePlanNode serialAggr = new AggregatePlanNode(); return setAggregatePlanNode(hashAggregateNode, serialAggr); }
java
public static AggregatePlanNode convertToSerialAggregatePlanNode(HashAggregatePlanNode hashAggregateNode) { AggregatePlanNode serialAggr = new AggregatePlanNode(); return setAggregatePlanNode(hashAggregateNode, serialAggr); }
[ "public", "static", "AggregatePlanNode", "convertToSerialAggregatePlanNode", "(", "HashAggregatePlanNode", "hashAggregateNode", ")", "{", "AggregatePlanNode", "serialAggr", "=", "new", "AggregatePlanNode", "(", ")", ";", "return", "setAggregatePlanNode", "(", "hashAggregateNo...
Convert HashAggregate into a Serialized Aggregate @param hashAggregateNode HashAggregatePlanNode @return AggregatePlanNode
[ "Convert", "HashAggregate", "into", "a", "Serialized", "Aggregate" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/plannodes/AggregatePlanNode.java#L591-L594
JOML-CI/JOML
src/org/joml/Matrix4f.java
Matrix4f.setPerspective
public Matrix4f setPerspective(float fovy, float aspect, float zNear, float zFar) { return setPerspective(fovy, aspect, zNear, zFar, false); }
java
public Matrix4f setPerspective(float fovy, float aspect, float zNear, float zFar) { return setPerspective(fovy, aspect, zNear, zFar, false); }
[ "public", "Matrix4f", "setPerspective", "(", "float", "fovy", ",", "float", "aspect", ",", "float", "zNear", ",", "float", "zFar", ")", "{", "return", "setPerspective", "(", "fovy", ",", "aspect", ",", "zNear", ",", "zFar", ",", "false", ")", ";", "}" ]
Set this matrix to be a symmetric perspective projection frustum transformation for a right-handed coordinate system using OpenGL's NDC z range of <code>[-1..+1]</code>. <p> In order to apply the perspective projection transformation to an existing transformation, use {@link #perspective(float, float, float, float) perspective()}. @see #perspective(float, float, float, float) @param fovy the vertical field of view in radians (must be greater than zero and less than {@link Math#PI PI}) @param aspect the aspect ratio (i.e. width / height; must be greater than zero) @param zNear near clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity. In that case, <code>zFar</code> may not also be {@link Float#POSITIVE_INFINITY}. @param zFar far clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity. In that case, <code>zNear</code> may not also be {@link Float#POSITIVE_INFINITY}. @return this
[ "Set", "this", "matrix", "to", "be", "a", "symmetric", "perspective", "projection", "frustum", "transformation", "for", "a", "right", "-", "handed", "coordinate", "system", "using", "OpenGL", "s", "NDC", "z", "range", "of", "<code", ">", "[", "-", "1", ".....
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L9859-L9861
opsmatters/opsmatters-core
src/main/java/com/opsmatters/core/documents/FileColumn.java
FileColumn.convertDateTime
private String convertDateTime(long dt, String format) { if(format.length() == 0) format = Formats.DATETIME_FORMAT; return FormatUtilities.getFormattedDateTime(dt, format, false, 0L); }
java
private String convertDateTime(long dt, String format) { if(format.length() == 0) format = Formats.DATETIME_FORMAT; return FormatUtilities.getFormattedDateTime(dt, format, false, 0L); }
[ "private", "String", "convertDateTime", "(", "long", "dt", ",", "String", "format", ")", "{", "if", "(", "format", ".", "length", "(", ")", "==", "0", ")", "format", "=", "Formats", ".", "DATETIME_FORMAT", ";", "return", "FormatUtilities", ".", "getFormatt...
Converts the given milliseconds date value to the output date format. @param dt The date to be formatted @param format The format to use for the date @return The formatted date
[ "Converts", "the", "given", "milliseconds", "date", "value", "to", "the", "output", "date", "format", "." ]
train
https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/documents/FileColumn.java#L701-L706
JOML-CI/JOML
src/org/joml/Matrix4f.java
Matrix4f.setOrthoSymmetricLH
public Matrix4f setOrthoSymmetricLH(float width, float height, float zNear, float zFar) { return setOrthoSymmetricLH(width, height, zNear, zFar, false); }
java
public Matrix4f setOrthoSymmetricLH(float width, float height, float zNear, float zFar) { return setOrthoSymmetricLH(width, height, zNear, zFar, false); }
[ "public", "Matrix4f", "setOrthoSymmetricLH", "(", "float", "width", ",", "float", "height", ",", "float", "zNear", ",", "float", "zFar", ")", "{", "return", "setOrthoSymmetricLH", "(", "width", ",", "height", ",", "zNear", ",", "zFar", ",", "false", ")", "...
Set this matrix to be a symmetric orthographic projection transformation for a left-handed coordinate system using OpenGL's NDC z range of <code>[-1..+1]</code>. <p> This method is equivalent to calling {@link #setOrthoLH(float, float, float, float, float, float) setOrthoLH()} with <code>left=-width/2</code>, <code>right=+width/2</code>, <code>bottom=-height/2</code> and <code>top=+height/2</code>. <p> In order to apply the symmetric orthographic projection to an already existing transformation, use {@link #orthoSymmetricLH(float, float, float, float) orthoSymmetricLH()}. <p> Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a> @see #orthoSymmetricLH(float, float, float, float) @param width the distance between the right and left frustum edges @param height the distance between the top and bottom frustum edges @param zNear near clipping plane distance @param zFar far clipping plane distance @return this
[ "Set", "this", "matrix", "to", "be", "a", "symmetric", "orthographic", "projection", "transformation", "for", "a", "left", "-", "handed", "coordinate", "system", "using", "OpenGL", "s", "NDC", "z", "range", "of", "<code", ">", "[", "-", "1", "..", "+", "...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L7768-L7770
tomgibara/bits
src/main/java/com/tomgibara/bits/Bits.java
Bits.asStore
public static BitStore asStore(byte[] bytes) { if (bytes == null) throw new IllegalArgumentException("null bytes"); if (bytes.length * 8L > Integer.MAX_VALUE) throw new IllegalArgumentException("index overflow"); return new BytesBitStore(bytes, 0, bytes.length << 3, true); }
java
public static BitStore asStore(byte[] bytes) { if (bytes == null) throw new IllegalArgumentException("null bytes"); if (bytes.length * 8L > Integer.MAX_VALUE) throw new IllegalArgumentException("index overflow"); return new BytesBitStore(bytes, 0, bytes.length << 3, true); }
[ "public", "static", "BitStore", "asStore", "(", "byte", "[", "]", "bytes", ")", "{", "if", "(", "bytes", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"null bytes\"", ")", ";", "if", "(", "bytes", ".", "length", "*", "8L", ">", ...
Exposes the bits of a byte array as a {@link BitStore}. The returned bit store is a live view over the byte array; changes made to the array are reflected in bit store and vice versa. The bit store contains every bit in the array with the zeroth indexed bit of the store taking its value from the least significant bit of the byte at index zero. @param bytes the byte data @return a {@link BitStore} over the bytes. @see #asStore(byte[], int, int) @see BitVector#fromByteArray(byte[], int)
[ "Exposes", "the", "bits", "of", "a", "byte", "array", "as", "a", "{", "@link", "BitStore", "}", ".", "The", "returned", "bit", "store", "is", "a", "live", "view", "over", "the", "byte", "array", ";", "changes", "made", "to", "the", "array", "are", "r...
train
https://github.com/tomgibara/bits/blob/56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97/src/main/java/com/tomgibara/bits/Bits.java#L512-L516
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/AbstractModelUpdateHandler.java
AbstractModelUpdateHandler.updateModel
protected void updateModel(final ModelNode operation, final Resource resource) throws OperationFailedException { updateModel(operation, resource.getModel()); }
java
protected void updateModel(final ModelNode operation, final Resource resource) throws OperationFailedException { updateModel(operation, resource.getModel()); }
[ "protected", "void", "updateModel", "(", "final", "ModelNode", "operation", ",", "final", "Resource", "resource", ")", "throws", "OperationFailedException", "{", "updateModel", "(", "operation", ",", "resource", ".", "getModel", "(", ")", ")", ";", "}" ]
Update the given resource in the persistent configuration model based on the values in the given operation. @param operation the operation @param resource the resource that corresponds to the address of {@code operation} @throws OperationFailedException if {@code operation} is invalid or populating the model otherwise fails
[ "Update", "the", "given", "resource", "in", "the", "persistent", "configuration", "model", "based", "on", "the", "values", "in", "the", "given", "operation", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AbstractModelUpdateHandler.java#L64-L66
aws/aws-sdk-java
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/AmazonS3Client.java
AmazonS3Client.populateRequestWithCopyPartParameters
private static void populateRequestWithCopyPartParameters(Request<?> request, CopyPartRequest copyPartRequest) { String copySourceHeader = "/" + SdkHttpUtils.urlEncode(copyPartRequest.getSourceBucketName(), true) + "/" + SdkHttpUtils.urlEncode(copyPartRequest.getSourceKey(), true); if (copyPartRequest.getSourceVersionId() != null) { copySourceHeader += "?versionId=" + copyPartRequest.getSourceVersionId(); } request.addHeader("x-amz-copy-source", copySourceHeader); addDateHeader(request, Headers.COPY_SOURCE_IF_MODIFIED_SINCE, copyPartRequest.getModifiedSinceConstraint()); addDateHeader(request, Headers.COPY_SOURCE_IF_UNMODIFIED_SINCE, copyPartRequest.getUnmodifiedSinceConstraint()); addStringListHeader(request, Headers.COPY_SOURCE_IF_MATCH, copyPartRequest.getMatchingETagConstraints()); addStringListHeader(request, Headers.COPY_SOURCE_IF_NO_MATCH, copyPartRequest.getNonmatchingETagConstraints()); if ( copyPartRequest.getFirstByte() != null && copyPartRequest.getLastByte() != null ) { String range = "bytes=" + copyPartRequest.getFirstByte() + "-" + copyPartRequest.getLastByte(); request.addHeader(Headers.COPY_PART_RANGE, range); } // Populate the SSE-C parameters for the destination object populateSourceSSE_C(request, copyPartRequest.getSourceSSECustomerKey()); populateSSE_C(request, copyPartRequest.getDestinationSSECustomerKey()); }
java
private static void populateRequestWithCopyPartParameters(Request<?> request, CopyPartRequest copyPartRequest) { String copySourceHeader = "/" + SdkHttpUtils.urlEncode(copyPartRequest.getSourceBucketName(), true) + "/" + SdkHttpUtils.urlEncode(copyPartRequest.getSourceKey(), true); if (copyPartRequest.getSourceVersionId() != null) { copySourceHeader += "?versionId=" + copyPartRequest.getSourceVersionId(); } request.addHeader("x-amz-copy-source", copySourceHeader); addDateHeader(request, Headers.COPY_SOURCE_IF_MODIFIED_SINCE, copyPartRequest.getModifiedSinceConstraint()); addDateHeader(request, Headers.COPY_SOURCE_IF_UNMODIFIED_SINCE, copyPartRequest.getUnmodifiedSinceConstraint()); addStringListHeader(request, Headers.COPY_SOURCE_IF_MATCH, copyPartRequest.getMatchingETagConstraints()); addStringListHeader(request, Headers.COPY_SOURCE_IF_NO_MATCH, copyPartRequest.getNonmatchingETagConstraints()); if ( copyPartRequest.getFirstByte() != null && copyPartRequest.getLastByte() != null ) { String range = "bytes=" + copyPartRequest.getFirstByte() + "-" + copyPartRequest.getLastByte(); request.addHeader(Headers.COPY_PART_RANGE, range); } // Populate the SSE-C parameters for the destination object populateSourceSSE_C(request, copyPartRequest.getSourceSSECustomerKey()); populateSSE_C(request, copyPartRequest.getDestinationSSECustomerKey()); }
[ "private", "static", "void", "populateRequestWithCopyPartParameters", "(", "Request", "<", "?", ">", "request", ",", "CopyPartRequest", "copyPartRequest", ")", "{", "String", "copySourceHeader", "=", "\"/\"", "+", "SdkHttpUtils", ".", "urlEncode", "(", "copyPartReques...
<p> Populates the specified request with the numerous options available in <code>CopyObjectRequest</code>. </p> @param request The request to populate with headers to represent all the options expressed in the <code>CopyPartRequest</code> object. @param copyPartRequest The object containing all the options for copying an object in Amazon S3.
[ "<p", ">", "Populates", "the", "specified", "request", "with", "the", "numerous", "options", "available", "in", "<code", ">", "CopyObjectRequest<", "/", "code", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/AmazonS3Client.java#L4315-L4342
openbaton/openbaton-client
sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceDescriptorAgent.java
NetworkServiceDescriptorAgent.deleteVirtualNetworkFunctionDescriptors
@Help( help = "Delete the VirtualNetworkFunctionDescriptor of a NetworkServiceDescriptor with specific id" ) @Deprecated public void deleteVirtualNetworkFunctionDescriptors(final String idNSD, final String idVnf) throws SDKException { String url = idNSD + "/vnfdescriptors" + "/" + idVnf; requestDelete(url); }
java
@Help( help = "Delete the VirtualNetworkFunctionDescriptor of a NetworkServiceDescriptor with specific id" ) @Deprecated public void deleteVirtualNetworkFunctionDescriptors(final String idNSD, final String idVnf) throws SDKException { String url = idNSD + "/vnfdescriptors" + "/" + idVnf; requestDelete(url); }
[ "@", "Help", "(", "help", "=", "\"Delete the VirtualNetworkFunctionDescriptor of a NetworkServiceDescriptor with specific id\"", ")", "@", "Deprecated", "public", "void", "deleteVirtualNetworkFunctionDescriptors", "(", "final", "String", "idNSD", ",", "final", "String", "idVnf"...
Delete a specific VirtualNetworkFunctionDescriptor that is contained in a particular NetworkServiceDescriptor. @param idNSD the ID of the NetworkServiceDescriptor @param idVnf the id of the VirtualNetworkFunctionDescriptor @throws SDKException if the request fails
[ "Delete", "a", "specific", "VirtualNetworkFunctionDescriptor", "that", "is", "contained", "in", "a", "particular", "NetworkServiceDescriptor", "." ]
train
https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceDescriptorAgent.java#L146-L155
crawljax/crawljax
core/src/main/java/com/crawljax/forms/FormHandler.java
FormHandler.setInputElementValue
protected void setInputElementValue(Node element, FormInput input) { LOGGER.debug("INPUTFIELD: {} ({})", input.getIdentification(), input.getType()); if (element == null || input.getInputValues().isEmpty()) { return; } try { switch (input.getType()) { case TEXT: case TEXTAREA: case PASSWORD: handleText(input); break; case HIDDEN: handleHidden(input); break; case CHECKBOX: handleCheckBoxes(input); break; case RADIO: handleRadioSwitches(input); break; case SELECT: handleSelectBoxes(input); } } catch (ElementNotVisibleException e) { LOGGER.warn("Element not visible, input not completed."); } catch (BrowserConnectionException e) { throw e; } catch (RuntimeException e) { LOGGER.error("Could not input element values", e); } }
java
protected void setInputElementValue(Node element, FormInput input) { LOGGER.debug("INPUTFIELD: {} ({})", input.getIdentification(), input.getType()); if (element == null || input.getInputValues().isEmpty()) { return; } try { switch (input.getType()) { case TEXT: case TEXTAREA: case PASSWORD: handleText(input); break; case HIDDEN: handleHidden(input); break; case CHECKBOX: handleCheckBoxes(input); break; case RADIO: handleRadioSwitches(input); break; case SELECT: handleSelectBoxes(input); } } catch (ElementNotVisibleException e) { LOGGER.warn("Element not visible, input not completed."); } catch (BrowserConnectionException e) { throw e; } catch (RuntimeException e) { LOGGER.error("Could not input element values", e); } }
[ "protected", "void", "setInputElementValue", "(", "Node", "element", ",", "FormInput", "input", ")", "{", "LOGGER", ".", "debug", "(", "\"INPUTFIELD: {} ({})\"", ",", "input", ".", "getIdentification", "(", ")", ",", "input", ".", "getType", "(", ")", ")", "...
Fills in the element with the InputValues for input @param element the node element @param input the input data
[ "Fills", "in", "the", "element", "with", "the", "InputValues", "for", "input" ]
train
https://github.com/crawljax/crawljax/blob/d339f4f622ca902ccd35322065821e52a62ec543/core/src/main/java/com/crawljax/forms/FormHandler.java#L54-L88
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlImplementation.java
AptControlImplementation.initSuperClass
private AptControlImplementation initSuperClass() { if ( _implDecl == null || _implDecl.getSuperclass() == null ) return null; ClassDeclaration superDecl = _implDecl.getSuperclass().getDeclaration(); if (superDecl != null && superDecl.getAnnotation(org.apache.beehive.controls.api.bean.ControlImplementation.class) != null) { return new AptControlImplementation(superDecl, _ap); } return null; }
java
private AptControlImplementation initSuperClass() { if ( _implDecl == null || _implDecl.getSuperclass() == null ) return null; ClassDeclaration superDecl = _implDecl.getSuperclass().getDeclaration(); if (superDecl != null && superDecl.getAnnotation(org.apache.beehive.controls.api.bean.ControlImplementation.class) != null) { return new AptControlImplementation(superDecl, _ap); } return null; }
[ "private", "AptControlImplementation", "initSuperClass", "(", ")", "{", "if", "(", "_implDecl", "==", "null", "||", "_implDecl", ".", "getSuperclass", "(", ")", "==", "null", ")", "return", "null", ";", "ClassDeclaration", "superDecl", "=", "_implDecl", ".", "...
Initializes the super interface that this ControlImpl extends (or null if a base class)
[ "Initializes", "the", "super", "interface", "that", "this", "ControlImpl", "extends", "(", "or", "null", "if", "a", "base", "class", ")" ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlImplementation.java#L112-L125
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/taglib/jsf/AbstractHtmlImageTag.java
AbstractHtmlImageTag.prepareAttribute
protected void prepareAttribute(StringBuffer handlers, String name, boolean value) { handlers.append(" "); handlers.append(name); handlers.append("=\""); handlers.append(value); handlers.append("\""); }
java
protected void prepareAttribute(StringBuffer handlers, String name, boolean value) { handlers.append(" "); handlers.append(name); handlers.append("=\""); handlers.append(value); handlers.append("\""); }
[ "protected", "void", "prepareAttribute", "(", "StringBuffer", "handlers", ",", "String", "name", ",", "boolean", "value", ")", "{", "handlers", ".", "append", "(", "\" \"", ")", ";", "handlers", ".", "append", "(", "name", ")", ";", "handlers", ".", "appen...
Prepares an attribute if the value is not null, appending it to the the given StringBuffer. @param handlers The StringBuffer that output will be appended to. @param name the property name @param value the property value
[ "Prepares", "an", "attribute", "if", "the", "value", "is", "not", "null", "appending", "it", "to", "the", "the", "given", "StringBuffer", "." ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/taglib/jsf/AbstractHtmlImageTag.java#L159-L167
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/PythonDistributionAnalyzer.java
PythonDistributionAnalyzer.getMatchingFile
private static File getMatchingFile(File folder, FilenameFilter filter) { File result = null; final File[] matches = folder.listFiles(filter); if (null != matches && 1 == matches.length) { result = matches[0]; } return result; }
java
private static File getMatchingFile(File folder, FilenameFilter filter) { File result = null; final File[] matches = folder.listFiles(filter); if (null != matches && 1 == matches.length) { result = matches[0]; } return result; }
[ "private", "static", "File", "getMatchingFile", "(", "File", "folder", ",", "FilenameFilter", "filter", ")", "{", "File", "result", "=", "null", ";", "final", "File", "[", "]", "matches", "=", "folder", ".", "listFiles", "(", "filter", ")", ";", "if", "(...
Returns a list of files that match the given filter, this does not recursively scan the directory. @param folder the folder to filter @param filter the filter to apply to the files in the directory @return the list of Files in the directory that match the provided filter
[ "Returns", "a", "list", "of", "files", "that", "match", "the", "given", "filter", "this", "does", "not", "recursively", "scan", "the", "directory", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/PythonDistributionAnalyzer.java#L354-L361
Azure/azure-sdk-for-java
datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java
AccountsInner.listByResourceGroupAsync
public Observable<Page<DataLakeAnalyticsAccountInner>> listByResourceGroupAsync(final String resourceGroupName, final String filter, final Integer top, final Integer skip, final String expand, final String select, final String orderby, final Boolean count, final String search, final String format) { return listByResourceGroupWithServiceResponseAsync(resourceGroupName, filter, top, skip, expand, select, orderby, count, search, format) .map(new Func1<ServiceResponse<Page<DataLakeAnalyticsAccountInner>>, Page<DataLakeAnalyticsAccountInner>>() { @Override public Page<DataLakeAnalyticsAccountInner> call(ServiceResponse<Page<DataLakeAnalyticsAccountInner>> response) { return response.body(); } }); }
java
public Observable<Page<DataLakeAnalyticsAccountInner>> listByResourceGroupAsync(final String resourceGroupName, final String filter, final Integer top, final Integer skip, final String expand, final String select, final String orderby, final Boolean count, final String search, final String format) { return listByResourceGroupWithServiceResponseAsync(resourceGroupName, filter, top, skip, expand, select, orderby, count, search, format) .map(new Func1<ServiceResponse<Page<DataLakeAnalyticsAccountInner>>, Page<DataLakeAnalyticsAccountInner>>() { @Override public Page<DataLakeAnalyticsAccountInner> call(ServiceResponse<Page<DataLakeAnalyticsAccountInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "DataLakeAnalyticsAccountInner", ">", ">", "listByResourceGroupAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "filter", ",", "final", "Integer", "top", ",", "final", "Integer", "skip", ",", "f...
Gets the first page of Data Lake Analytics accounts, if any, within a specific resource group. This includes a link to the next page, if any. @param resourceGroupName The name of the Azure resource group that contains the Data Lake Analytics account. @param filter OData filter. Optional. @param top The number of items to return. Optional. @param skip The number of items to skip over before returning elements. Optional. @param expand OData expansion. Expand related resources in line with the retrieved resources, e.g. Categories/$expand=Products would expand Product data in line with each Category entry. Optional. @param select OData Select statement. Limits the properties on each entry to just those requested, e.g. Categories?$select=CategoryName,Description. Optional. @param orderby OrderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or "desc" depending on the order you'd like the values sorted, e.g. Categories?$orderby=CategoryName desc. Optional. @param count The Boolean value of true or false to request a count of the matching resources included with the resources in the response, e.g. Categories?$count=true. Optional. @param search A free form search. A free-text search expression to match for whether a particular entry should be included in the feed, e.g. Categories?$search=blue OR green. Optional. @param format The return format. Return the response in particular formatxii without access to request headers for standard content-type negotiation (e.g Orders?$format=json). Optional. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;DataLakeAnalyticsAccountInner&gt; object
[ "Gets", "the", "first", "page", "of", "Data", "Lake", "Analytics", "accounts", "if", "any", "within", "a", "specific", "resource", "group", ".", "This", "includes", "a", "link", "to", "the", "next", "page", "if", "any", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java#L1997-L2005
geomajas/geomajas-project-client-gwt2
common-gwt/command/src/main/java/org/geomajas/gwt/client/util/Log.java
Log.logDebug
public static void logDebug(String message, Throwable t) { logDebug(message + SEP + getMessage(t)); }
java
public static void logDebug(String message, Throwable t) { logDebug(message + SEP + getMessage(t)); }
[ "public", "static", "void", "logDebug", "(", "String", "message", ",", "Throwable", "t", ")", "{", "logDebug", "(", "message", "+", "SEP", "+", "getMessage", "(", "t", ")", ")", ";", "}" ]
Debug logging with cause. @param message message @param t cause
[ "Debug", "logging", "with", "cause", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/common-gwt/command/src/main/java/org/geomajas/gwt/client/util/Log.java#L99-L101
io7m/jaffirm
com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Postconditions.java
Postconditions.checkPostcondition
public static <T> T checkPostcondition( final T value, final boolean condition, final Function<T, String> describer) { return innerCheck(value, condition, describer); }
java
public static <T> T checkPostcondition( final T value, final boolean condition, final Function<T, String> describer) { return innerCheck(value, condition, describer); }
[ "public", "static", "<", "T", ">", "T", "checkPostcondition", "(", "final", "T", "value", ",", "final", "boolean", "condition", ",", "final", "Function", "<", "T", ",", "String", ">", "describer", ")", "{", "return", "innerCheck", "(", "value", ",", "con...
<p>Evaluate the given {@code predicate} using {@code value} as input.</p> <p>The function throws {@link PostconditionViolationException} if the predicate is false.</p> @param value The value @param condition The predicate @param describer A describer for the predicate @param <T> The type of values @return value @throws PostconditionViolationException If the predicate is false
[ "<p", ">", "Evaluate", "the", "given", "{", "@code", "predicate", "}", "using", "{", "@code", "value", "}", "as", "input", ".", "<", "/", "p", ">" ]
train
https://github.com/io7m/jaffirm/blob/c97d246242d381e48832838737418cfe4cb57b4d/com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Postconditions.java#L229-L235
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/linalg/primitives/CounterMap.java
CounterMap.setCount
public double setCount(F first, S second, double value) { Counter<S> counter = maps.get(first); if (counter == null) { counter = new Counter<S>(); maps.put(first, counter); } return counter.setCount(second, value); }
java
public double setCount(F first, S second, double value) { Counter<S> counter = maps.get(first); if (counter == null) { counter = new Counter<S>(); maps.put(first, counter); } return counter.setCount(second, value); }
[ "public", "double", "setCount", "(", "F", "first", ",", "S", "second", ",", "double", "value", ")", "{", "Counter", "<", "S", ">", "counter", "=", "maps", ".", "get", "(", "first", ")", ";", "if", "(", "counter", "==", "null", ")", "{", "counter", ...
This method allows you to set counter value for a given first/second pair @param first @param second @param value @return
[ "This", "method", "allows", "you", "to", "set", "counter", "value", "for", "a", "given", "first", "/", "second", "pair" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/linalg/primitives/CounterMap.java#L123-L131
inkstand-io/scribble
scribble-ldap/src/main/java/io/inkstand/scribble/rules/ldap/Directory.java
Directory.createDirectoryService
private DirectoryService createDirectoryService() { final DirectoryServiceFactory factory = new DefaultDirectoryServiceFactory(); try { factory.init("scribble"); return factory.getDirectoryService(); } catch (Exception e) { //NOSONAR throw new AssertionError("Unable to create directory service", e); } }
java
private DirectoryService createDirectoryService() { final DirectoryServiceFactory factory = new DefaultDirectoryServiceFactory(); try { factory.init("scribble"); return factory.getDirectoryService(); } catch (Exception e) { //NOSONAR throw new AssertionError("Unable to create directory service", e); } }
[ "private", "DirectoryService", "createDirectoryService", "(", ")", "{", "final", "DirectoryServiceFactory", "factory", "=", "new", "DefaultDirectoryServiceFactory", "(", ")", ";", "try", "{", "factory", ".", "init", "(", "\"scribble\"", ")", ";", "return", "factory"...
Creates a new DirectoryService instance for the test rule. Initialization of the service is done in the apply Statement phase by invoking the setupService method.
[ "Creates", "a", "new", "DirectoryService", "instance", "for", "the", "test", "rule", ".", "Initialization", "of", "the", "service", "is", "done", "in", "the", "apply", "Statement", "phase", "by", "invoking", "the", "setupService", "method", "." ]
train
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-ldap/src/main/java/io/inkstand/scribble/rules/ldap/Directory.java#L158-L168
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.cart_cartId_checkout_POST
public OvhOrder cart_cartId_checkout_POST(String cartId, Boolean autoPayWithPreferredPaymentMethod, Boolean waiveRetractationPeriod) throws IOException { String qPath = "/order/cart/{cartId}/checkout"; StringBuilder sb = path(qPath, cartId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "autoPayWithPreferredPaymentMethod", autoPayWithPreferredPaymentMethod); addBody(o, "waiveRetractationPeriod", waiveRetractationPeriod); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder cart_cartId_checkout_POST(String cartId, Boolean autoPayWithPreferredPaymentMethod, Boolean waiveRetractationPeriod) throws IOException { String qPath = "/order/cart/{cartId}/checkout"; StringBuilder sb = path(qPath, cartId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "autoPayWithPreferredPaymentMethod", autoPayWithPreferredPaymentMethod); addBody(o, "waiveRetractationPeriod", waiveRetractationPeriod); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "cart_cartId_checkout_POST", "(", "String", "cartId", ",", "Boolean", "autoPayWithPreferredPaymentMethod", ",", "Boolean", "waiveRetractationPeriod", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/cart/{cartId}/checkout\"", ";", "...
Validate your shopping and create order REST: POST /order/cart/{cartId}/checkout @param cartId [required] Cart identifier @param autoPayWithPreferredPaymentMethod [required] Indicates that order will be automatically paid with preferred payment method @param waiveRetractationPeriod [required] Indicates that order will be processed with waiving retractation period
[ "Validate", "your", "shopping", "and", "create", "order" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L9195-L9203
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/CategoryUrl.java
CategoryUrl.getChildCategoriesUrl
public static MozuUrl getChildCategoriesUrl(Integer categoryId, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/categories/{categoryId}/children?responseFields={responseFields}"); formatter.formatUrl("categoryId", categoryId); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl getChildCategoriesUrl(Integer categoryId, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/categories/{categoryId}/children?responseFields={responseFields}"); formatter.formatUrl("categoryId", categoryId); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "getChildCategoriesUrl", "(", "Integer", "categoryId", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/catalog/admin/categories/{categoryId}/children?responseFields={responseF...
Get Resource Url for GetChildCategories @param categoryId Unique identifier of the category to modify. @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. @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetChildCategories" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/CategoryUrl.java#L42-L48
google/Accessibility-Test-Framework-for-Android
src/main/java/com/googlecode/eyesfree/utils/AccessibilityNodeInfoUtils.java
AccessibilityNodeInfoUtils.isAutoScrollEdgeListItem
public static boolean isAutoScrollEdgeListItem( Context context, AccessibilityNodeInfoCompat node, int direction) { return isEdgeListItem(context, node, direction, FILTER_AUTO_SCROLL); }
java
public static boolean isAutoScrollEdgeListItem( Context context, AccessibilityNodeInfoCompat node, int direction) { return isEdgeListItem(context, node, direction, FILTER_AUTO_SCROLL); }
[ "public", "static", "boolean", "isAutoScrollEdgeListItem", "(", "Context", "context", ",", "AccessibilityNodeInfoCompat", "node", ",", "int", "direction", ")", "{", "return", "isEdgeListItem", "(", "context", ",", "node", ",", "direction", ",", "FILTER_AUTO_SCROLL", ...
Convenience method determining if the current item is at the edge of a list and suitable autoscroll. Calls {@code isEdgeListItem} with {@code FILTER_AUTO_SCROLL}. @param context The parent context. @param node The node to check. @param direction The direction in which to check, one of: <ul> <li>{@code -1} to check backward <li>{@code 0} to check both backward and forward <li>{@code 1} to check forward </ul> @return true if the current item is at the edge of a list.
[ "Convenience", "method", "determining", "if", "the", "current", "item", "is", "at", "the", "edge", "of", "a", "list", "and", "suitable", "autoscroll", ".", "Calls", "{", "@code", "isEdgeListItem", "}", "with", "{", "@code", "FILTER_AUTO_SCROLL", "}", "." ]
train
https://github.com/google/Accessibility-Test-Framework-for-Android/blob/a6117fe0059c82dd764fa628d3817d724570f69e/src/main/java/com/googlecode/eyesfree/utils/AccessibilityNodeInfoUtils.java#L610-L613
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/TransactionImpl.java
TransactionImpl.afterMaterialization
public void afterMaterialization(IndirectionHandler handler, Object materializedObject) { try { Identity oid = handler.getIdentity(); if (log.isDebugEnabled()) log.debug("deferred registration: " + oid); if(!isOpen()) { log.error("Proxy object materialization outside of a running tx, obj=" + oid); try{throw new Exception("Proxy object materialization outside of a running tx, obj=" + oid);}catch(Exception e) { e.printStackTrace(); } } ClassDescriptor cld = getBroker().getClassDescriptor(materializedObject.getClass()); RuntimeObject rt = new RuntimeObject(materializedObject, oid, cld, false, false); lockAndRegister(rt, Transaction.READ, isImplicitLocking(), getRegistrationList()); } catch (Throwable t) { log.error("Register materialized object with this tx failed", t); throw new LockNotGrantedException(t.getMessage()); } unregisterFromIndirectionHandler(handler); }
java
public void afterMaterialization(IndirectionHandler handler, Object materializedObject) { try { Identity oid = handler.getIdentity(); if (log.isDebugEnabled()) log.debug("deferred registration: " + oid); if(!isOpen()) { log.error("Proxy object materialization outside of a running tx, obj=" + oid); try{throw new Exception("Proxy object materialization outside of a running tx, obj=" + oid);}catch(Exception e) { e.printStackTrace(); } } ClassDescriptor cld = getBroker().getClassDescriptor(materializedObject.getClass()); RuntimeObject rt = new RuntimeObject(materializedObject, oid, cld, false, false); lockAndRegister(rt, Transaction.READ, isImplicitLocking(), getRegistrationList()); } catch (Throwable t) { log.error("Register materialized object with this tx failed", t); throw new LockNotGrantedException(t.getMessage()); } unregisterFromIndirectionHandler(handler); }
[ "public", "void", "afterMaterialization", "(", "IndirectionHandler", "handler", ",", "Object", "materializedObject", ")", "{", "try", "{", "Identity", "oid", "=", "handler", ".", "getIdentity", "(", ")", ";", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ...
this callback is invoked after an Object is materialized within an IndirectionHandler. this callback allows to defer registration of objects until it's really neccessary. @param handler the invoking handler @param materializedObject the materialized Object
[ "this", "callback", "is", "invoked", "after", "an", "Object", "is", "materialized", "within", "an", "IndirectionHandler", ".", "this", "callback", "allows", "to", "defer", "registration", "of", "objects", "until", "it", "s", "really", "neccessary", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/TransactionImpl.java#L1091-L1116
loldevs/riotapi
rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/LcdsGameInvitationService.java
LcdsGameInvitationService.createArrangedBotTeamLobby
@Deprecated public LobbyStatus createArrangedBotTeamLobby(long queueId, String difficulty) { return client.sendRpcAndWait(SERVICE, "createArrangedBotTeamLobby", queueId, difficulty); }
java
@Deprecated public LobbyStatus createArrangedBotTeamLobby(long queueId, String difficulty) { return client.sendRpcAndWait(SERVICE, "createArrangedBotTeamLobby", queueId, difficulty); }
[ "@", "Deprecated", "public", "LobbyStatus", "createArrangedBotTeamLobby", "(", "long", "queueId", ",", "String", "difficulty", ")", "{", "return", "client", ".", "sendRpcAndWait", "(", "SERVICE", ",", "\"createArrangedBotTeamLobby\"", ",", "queueId", ",", "difficulty"...
Create a premade team lobby for bot games @param queueId The target queue @param difficulty The difficulty of the bots @return The lobby status @deprecated Use {@link #createArrangedBotTeamLobby(long, net.boreeas.riotapi.constants.BotDifficulty)}
[ "Create", "a", "premade", "team", "lobby", "for", "bot", "games" ]
train
https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/LcdsGameInvitationService.java#L60-L63
VoltDB/voltdb
third_party/java/src/org/apache/zookeeper_voltpatches/server/ZKDatabase.java
ZKDatabase.statNode
public Stat statNode(String path, ServerCnxn serverCnxn) throws KeeperException.NoNodeException { return dataTree.statNode(path, serverCnxn); }
java
public Stat statNode(String path, ServerCnxn serverCnxn) throws KeeperException.NoNodeException { return dataTree.statNode(path, serverCnxn); }
[ "public", "Stat", "statNode", "(", "String", "path", ",", "ServerCnxn", "serverCnxn", ")", "throws", "KeeperException", ".", "NoNodeException", "{", "return", "dataTree", ".", "statNode", "(", "path", ",", "serverCnxn", ")", ";", "}" ]
stat the path @param path the path for which stat is to be done @param serverCnxn the servercnxn attached to this request @return the stat of this node @throws KeeperException.NoNodeException
[ "stat", "the", "path" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/zookeeper_voltpatches/server/ZKDatabase.java#L187-L189
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/jcr/AbstractJcrNode.java
AbstractJcrNode.createJcrProperty
private final AbstractJcrProperty createJcrProperty( Property property, Name primaryTypeName, Set<Name> mixinTypeNames ) throws ConstraintViolationException { NodeTypes nodeTypes = session.nodeTypes(); JcrPropertyDefinition defn = propertyDefinitionFor(property, primaryTypeName, mixinTypeNames, nodeTypes); int jcrPropertyType = defn.getRequiredType(); jcrPropertyType = determineBestPropertyTypeIfUndefined(jcrPropertyType, property); AbstractJcrProperty prop = null; if (defn.isMultiple()) { prop = new JcrMultiValueProperty(this, property.getName(), jcrPropertyType); } else { prop = new JcrSingleValueProperty(this, property.getName(), jcrPropertyType); } prop.setPropertyDefinitionId(defn.getId(), nodeTypes.getVersion()); return prop; }
java
private final AbstractJcrProperty createJcrProperty( Property property, Name primaryTypeName, Set<Name> mixinTypeNames ) throws ConstraintViolationException { NodeTypes nodeTypes = session.nodeTypes(); JcrPropertyDefinition defn = propertyDefinitionFor(property, primaryTypeName, mixinTypeNames, nodeTypes); int jcrPropertyType = defn.getRequiredType(); jcrPropertyType = determineBestPropertyTypeIfUndefined(jcrPropertyType, property); AbstractJcrProperty prop = null; if (defn.isMultiple()) { prop = new JcrMultiValueProperty(this, property.getName(), jcrPropertyType); } else { prop = new JcrSingleValueProperty(this, property.getName(), jcrPropertyType); } prop.setPropertyDefinitionId(defn.getId(), nodeTypes.getVersion()); return prop; }
[ "private", "final", "AbstractJcrProperty", "createJcrProperty", "(", "Property", "property", ",", "Name", "primaryTypeName", ",", "Set", "<", "Name", ">", "mixinTypeNames", ")", "throws", "ConstraintViolationException", "{", "NodeTypes", "nodeTypes", "=", "session", "...
Create a new JCR Property instance given the supplied information. Note that this does not alter the node in any way, since it does not store a reference to this property (the caller must do that if needed). @param property the cached node property; may not be null @param primaryTypeName the name of the node's primary type; may not be null @param mixinTypeNames the names of the node's mixin types; may be null or empty @return the JCR Property instance, or null if the property could not be represented with a valid property definition given the primary type and mixin types @throws ConstraintViolationException if the property has no valid property definition
[ "Create", "a", "new", "JCR", "Property", "instance", "given", "the", "supplied", "information", ".", "Note", "that", "this", "does", "not", "alter", "the", "node", "in", "any", "way", "since", "it", "does", "not", "store", "a", "reference", "to", "this", ...
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/AbstractJcrNode.java#L393-L408
NordicSemiconductor/Android-DFU-Library
dfu/src/main/java/no/nordicsemi/android/dfu/SecureDfuImpl.java
SecureDfuImpl.setPacketReceiptNotifications
private void setPacketReceiptNotifications(final int number) throws DfuException, DeviceDisconnectedException, UploadAbortedException, UnknownResponseException, RemoteDfuException { if (!mConnected) throw new DeviceDisconnectedException("Unable to read Checksum: device disconnected"); // Send the number of packets of firmware before receiving a receipt notification logi("Sending the number of packets before notifications (Op Code = 2, Value = " + number + ")"); setNumberOfPackets(OP_CODE_PACKET_RECEIPT_NOTIF_REQ, number); writeOpCode(mControlPointCharacteristic, OP_CODE_PACKET_RECEIPT_NOTIF_REQ); // Read response final byte[] response = readNotificationResponse(); final int status = getStatusCode(response, OP_CODE_PACKET_RECEIPT_NOTIF_REQ_KEY); if (status == SecureDfuError.EXTENDED_ERROR) throw new RemoteDfuExtendedErrorException("Sending the number of packets failed", response[3]); if (status != DFU_STATUS_SUCCESS) throw new RemoteDfuException("Sending the number of packets failed", status); }
java
private void setPacketReceiptNotifications(final int number) throws DfuException, DeviceDisconnectedException, UploadAbortedException, UnknownResponseException, RemoteDfuException { if (!mConnected) throw new DeviceDisconnectedException("Unable to read Checksum: device disconnected"); // Send the number of packets of firmware before receiving a receipt notification logi("Sending the number of packets before notifications (Op Code = 2, Value = " + number + ")"); setNumberOfPackets(OP_CODE_PACKET_RECEIPT_NOTIF_REQ, number); writeOpCode(mControlPointCharacteristic, OP_CODE_PACKET_RECEIPT_NOTIF_REQ); // Read response final byte[] response = readNotificationResponse(); final int status = getStatusCode(response, OP_CODE_PACKET_RECEIPT_NOTIF_REQ_KEY); if (status == SecureDfuError.EXTENDED_ERROR) throw new RemoteDfuExtendedErrorException("Sending the number of packets failed", response[3]); if (status != DFU_STATUS_SUCCESS) throw new RemoteDfuException("Sending the number of packets failed", status); }
[ "private", "void", "setPacketReceiptNotifications", "(", "final", "int", "number", ")", "throws", "DfuException", ",", "DeviceDisconnectedException", ",", "UploadAbortedException", ",", "UnknownResponseException", ",", "RemoteDfuException", "{", "if", "(", "!", "mConnecte...
Sets the number of packets that needs to be sent to receive the Packet Receipt Notification. Value 0 disables PRNs. By default this is disabled. The PRNs may be used to send both the Data and Command object, but this Secure DFU implementation can handle them only during Data transfer. <p> The intention of having PRNs is to make sure the outgoing BLE buffer is not getting overflown. The PRN will be sent after sending all packets from the queue. @param number number of packets required before receiving a Packet Receipt Notification. @throws DfuException @throws DeviceDisconnectedException @throws UploadAbortedException @throws UnknownResponseException @throws RemoteDfuException thrown when the returned status code is not equal to {@link #DFU_STATUS_SUCCESS}
[ "Sets", "the", "number", "of", "packets", "that", "needs", "to", "be", "sent", "to", "receive", "the", "Packet", "Receipt", "Notification", ".", "Value", "0", "disables", "PRNs", ".", "By", "default", "this", "is", "disabled", ".", "The", "PRNs", "may", ...
train
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/SecureDfuImpl.java#L759-L777
redkale/redkale
src/org/redkale/asm/ClassReader.java
ClassReader.createDebugLabel
private void createDebugLabel(int offset, Label[] labels) { if (labels[offset] == null) { readLabel(offset, labels).status |= Label.DEBUG; } }
java
private void createDebugLabel(int offset, Label[] labels) { if (labels[offset] == null) { readLabel(offset, labels).status |= Label.DEBUG; } }
[ "private", "void", "createDebugLabel", "(", "int", "offset", ",", "Label", "[", "]", "labels", ")", "{", "if", "(", "labels", "[", "offset", "]", "==", "null", ")", "{", "readLabel", "(", "offset", ",", "labels", ")", ".", "status", "|=", "Label", "....
Creates a label with the Label.DEBUG flag set, if there is no already existing label for the given offset (otherwise does nothing). The label is created with a call to {@link #readLabel}. @param offset a bytecode offset in a method. @param labels the already created labels, indexed by their offset.
[ "Creates", "a", "label", "with", "the", "Label", ".", "DEBUG", "flag", "set", "if", "there", "is", "no", "already", "existing", "label", "for", "the", "given", "offset", "(", "otherwise", "does", "nothing", ")", ".", "The", "label", "is", "created", "wit...
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/asm/ClassReader.java#L2417-L2421
coopernurse/barrister-java
src/main/java/com/bitmechanic/barrister/Contract.java
Contract.getFunction
public Function getFunction(String iface, String func) throws RpcException { Interface i = interfaces.get(iface); if (i == null) { String msg = "Interface '" + iface + "' not found"; throw RpcException.Error.METHOD_NOT_FOUND.exc(msg); } Function f = i.getFunction(func); if (f == null) { String msg = "Function '" + iface + "." + func + "' not found"; throw RpcException.Error.METHOD_NOT_FOUND.exc(msg); } return f; }
java
public Function getFunction(String iface, String func) throws RpcException { Interface i = interfaces.get(iface); if (i == null) { String msg = "Interface '" + iface + "' not found"; throw RpcException.Error.METHOD_NOT_FOUND.exc(msg); } Function f = i.getFunction(func); if (f == null) { String msg = "Function '" + iface + "." + func + "' not found"; throw RpcException.Error.METHOD_NOT_FOUND.exc(msg); } return f; }
[ "public", "Function", "getFunction", "(", "String", "iface", ",", "String", "func", ")", "throws", "RpcException", "{", "Interface", "i", "=", "interfaces", ".", "get", "(", "iface", ")", ";", "if", "(", "i", "==", "null", ")", "{", "String", "msg", "=...
Returns the Function associated with the given interface and function name. @param iface Interface name @param func Function name in the interface @return Function that matches iface and func on this Contract @throws RpcException If no Function matches
[ "Returns", "the", "Function", "associated", "with", "the", "given", "interface", "and", "function", "name", "." ]
train
https://github.com/coopernurse/barrister-java/blob/c2b639634c88a25002b66d1fb4a8f5fb51ade6a2/src/main/java/com/bitmechanic/barrister/Contract.java#L232-L246
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/amp/AMPManager.java
AMPManager.isConditionSupported
public static boolean isConditionSupported(XMPPConnection connection, String conditionName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { String featureName = AMPExtension.NAMESPACE + "?condition=" + conditionName; return isFeatureSupportedByServer(connection, featureName); }
java
public static boolean isConditionSupported(XMPPConnection connection, String conditionName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { String featureName = AMPExtension.NAMESPACE + "?condition=" + conditionName; return isFeatureSupportedByServer(connection, featureName); }
[ "public", "static", "boolean", "isConditionSupported", "(", "XMPPConnection", "connection", ",", "String", "conditionName", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", "{", "String", "featureNam...
Check if server supports specified condition. @param connection active xmpp connection @param conditionName name of condition to check @return true if this condition is supported. @throws XMPPErrorException @throws NoResponseException @throws NotConnectedException @throws InterruptedException @see AMPDeliverCondition @see AMPExpireAtCondition @see AMPMatchResourceCondition
[ "Check", "if", "server", "supports", "specified", "condition", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/AMPManager.java#L111-L114
jparsec/jparsec
jparsec/src/main/java/org/jparsec/Parser.java
Parser.sepBy1
public final Parser<List<T>> sepBy1(Parser<?> delim) { final Parser<T> afterFirst = delim.asDelimiter().next(this); return next((Function<T, Parser<List<T>>>) firstValue -> new RepeatAtLeastParser<T>( afterFirst, 0, ListFactory.arrayListFactoryWithFirstElement(firstValue))); }
java
public final Parser<List<T>> sepBy1(Parser<?> delim) { final Parser<T> afterFirst = delim.asDelimiter().next(this); return next((Function<T, Parser<List<T>>>) firstValue -> new RepeatAtLeastParser<T>( afterFirst, 0, ListFactory.arrayListFactoryWithFirstElement(firstValue))); }
[ "public", "final", "Parser", "<", "List", "<", "T", ">", ">", "sepBy1", "(", "Parser", "<", "?", ">", "delim", ")", "{", "final", "Parser", "<", "T", ">", "afterFirst", "=", "delim", ".", "asDelimiter", "(", ")", ".", "next", "(", "this", ")", ";...
A {@link Parser} that runs {@code this} 1 or more times separated by {@code delim}. <p>The return values are collected in a {@link List}.
[ "A", "{", "@link", "Parser", "}", "that", "runs", "{", "@code", "this", "}", "1", "or", "more", "times", "separated", "by", "{", "@code", "delim", "}", "." ]
train
https://github.com/jparsec/jparsec/blob/df1280259f5da9eb5ffc537437569dddba66cb94/jparsec/src/main/java/org/jparsec/Parser.java#L533-L538
facebookarchive/hadoop-20
src/contrib/corona/src/java/org/apache/hadoop/corona/Utilities.java
Utilities.getUnitResourceRequest
public static ResourceRequest getUnitResourceRequest(ResourceType type) { ResourceRequest req = unitResourceRequestMap.get(type); if (req == null) { req = new ResourceRequest(1, type); req.setSpecs(UNIT_COMPUTE_SPECS); // instead of using concurrent classes or locking - we clone and replace // the map with a new entry. this makes sense because this structure is // entirely read-only and will be populated quickly at bootstrap time HashMap<ResourceType, ResourceRequest> newMap = new HashMap<ResourceType, ResourceRequest>(); for (Map.Entry<ResourceType, ResourceRequest> entry : unitResourceRequestMap.entrySet()) { newMap.put(entry.getKey(), entry.getValue()); } newMap.put(type, req); unitResourceRequestMap = newMap; } return req; }
java
public static ResourceRequest getUnitResourceRequest(ResourceType type) { ResourceRequest req = unitResourceRequestMap.get(type); if (req == null) { req = new ResourceRequest(1, type); req.setSpecs(UNIT_COMPUTE_SPECS); // instead of using concurrent classes or locking - we clone and replace // the map with a new entry. this makes sense because this structure is // entirely read-only and will be populated quickly at bootstrap time HashMap<ResourceType, ResourceRequest> newMap = new HashMap<ResourceType, ResourceRequest>(); for (Map.Entry<ResourceType, ResourceRequest> entry : unitResourceRequestMap.entrySet()) { newMap.put(entry.getKey(), entry.getValue()); } newMap.put(type, req); unitResourceRequestMap = newMap; } return req; }
[ "public", "static", "ResourceRequest", "getUnitResourceRequest", "(", "ResourceType", "type", ")", "{", "ResourceRequest", "req", "=", "unitResourceRequestMap", ".", "get", "(", "type", ")", ";", "if", "(", "req", "==", "null", ")", "{", "req", "=", "new", "...
Get a {@link ResourceRequest} object for a given resource type Will cache the resource request after the first time it is created @param type the type to return the {@link ResourceRequest} for @return the {@link ResourceRequest} object for a given type
[ "Get", "a", "{", "@link", "ResourceRequest", "}", "object", "for", "a", "given", "resource", "type", "Will", "cache", "the", "resource", "request", "after", "the", "first", "time", "it", "is", "created" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/Utilities.java#L61-L81
relayrides/pushy
pushy/src/main/java/com/turo/pushy/apns/auth/ApnsSigningKey.java
ApnsSigningKey.loadFromPkcs8File
public static ApnsSigningKey loadFromPkcs8File(final File pkcs8File, final String teamId, final String keyId) throws IOException, NoSuchAlgorithmException, InvalidKeyException { try (final FileInputStream fileInputStream = new FileInputStream(pkcs8File)) { return ApnsSigningKey.loadFromInputStream(fileInputStream, teamId, keyId); } }
java
public static ApnsSigningKey loadFromPkcs8File(final File pkcs8File, final String teamId, final String keyId) throws IOException, NoSuchAlgorithmException, InvalidKeyException { try (final FileInputStream fileInputStream = new FileInputStream(pkcs8File)) { return ApnsSigningKey.loadFromInputStream(fileInputStream, teamId, keyId); } }
[ "public", "static", "ApnsSigningKey", "loadFromPkcs8File", "(", "final", "File", "pkcs8File", ",", "final", "String", "teamId", ",", "final", "String", "keyId", ")", "throws", "IOException", ",", "NoSuchAlgorithmException", ",", "InvalidKeyException", "{", "try", "(...
Loads a signing key from the given PKCS#8 file. @param pkcs8File the file from which to load the key @param teamId the ten-character, Apple-issued identifier for the team to which the key belongs @param keyId the ten-character, Apple-issued identitifier for the key itself @return an APNs signing key with the given key ID and associated with the given team @throws IOException if a key could not be loaded from the given file for any reason @throws NoSuchAlgorithmException if the JVM does not support elliptic curve keys @throws InvalidKeyException if the loaded key is invalid for any reason
[ "Loads", "a", "signing", "key", "from", "the", "given", "PKCS#8", "file", "." ]
train
https://github.com/relayrides/pushy/blob/1f6f9a0e07d785c815d74c2320a8d87c80231d36/pushy/src/main/java/com/turo/pushy/apns/auth/ApnsSigningKey.java#L105-L109
grails/gorm-hibernate5
grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/query/AbstractHibernateCriteriaBuilder.java
AbstractHibernateCriteriaBuilder.distinct
public org.grails.datastore.mapping.query.api.ProjectionList distinct(String propertyName, String alias) { final Projection proj = Projections.distinct(Projections.property(calculatePropertyName(propertyName))); addProjectionToList(proj,alias); return this; }
java
public org.grails.datastore.mapping.query.api.ProjectionList distinct(String propertyName, String alias) { final Projection proj = Projections.distinct(Projections.property(calculatePropertyName(propertyName))); addProjectionToList(proj,alias); return this; }
[ "public", "org", ".", "grails", ".", "datastore", ".", "mapping", ".", "query", ".", "api", ".", "ProjectionList", "distinct", "(", "String", "propertyName", ",", "String", "alias", ")", "{", "final", "Projection", "proj", "=", "Projections", ".", "distinct"...
A projection that selects a distince property name @param propertyName The property name @param alias The alias to use
[ "A", "projection", "that", "selects", "a", "distince", "property", "name" ]
train
https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/query/AbstractHibernateCriteriaBuilder.java#L204-L208
mozilla/rhino
src/org/mozilla/javascript/Context.java
Context.reportRuntimeError
public static EvaluatorException reportRuntimeError(String message, String sourceName, int lineno, String lineSource, int lineOffset) { Context cx = getCurrentContext(); if (cx != null) { return cx.getErrorReporter(). runtimeError(message, sourceName, lineno, lineSource, lineOffset); } throw new EvaluatorException(message, sourceName, lineno, lineSource, lineOffset); }
java
public static EvaluatorException reportRuntimeError(String message, String sourceName, int lineno, String lineSource, int lineOffset) { Context cx = getCurrentContext(); if (cx != null) { return cx.getErrorReporter(). runtimeError(message, sourceName, lineno, lineSource, lineOffset); } throw new EvaluatorException(message, sourceName, lineno, lineSource, lineOffset); }
[ "public", "static", "EvaluatorException", "reportRuntimeError", "(", "String", "message", ",", "String", "sourceName", ",", "int", "lineno", ",", "String", "lineSource", ",", "int", "lineOffset", ")", "{", "Context", "cx", "=", "getCurrentContext", "(", ")", ";"...
Report a runtime error using the error reporter for the current thread. @param message the error message to report @param sourceName a string describing the source, such as a filename @param lineno the starting line number @param lineSource the text of the line (may be null) @param lineOffset the offset into lineSource where problem was detected @return a runtime exception that will be thrown to terminate the execution of the script @see org.mozilla.javascript.ErrorReporter
[ "Report", "a", "runtime", "error", "using", "the", "error", "reporter", "for", "the", "current", "thread", "." ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Context.java#L997-L1010
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnclientlessaccesspolicy.java
vpnclientlessaccesspolicy.get
public static vpnclientlessaccesspolicy get(nitro_service service, String name) throws Exception{ vpnclientlessaccesspolicy obj = new vpnclientlessaccesspolicy(); obj.set_name(name); vpnclientlessaccesspolicy response = (vpnclientlessaccesspolicy) obj.get_resource(service); return response; }
java
public static vpnclientlessaccesspolicy get(nitro_service service, String name) throws Exception{ vpnclientlessaccesspolicy obj = new vpnclientlessaccesspolicy(); obj.set_name(name); vpnclientlessaccesspolicy response = (vpnclientlessaccesspolicy) obj.get_resource(service); return response; }
[ "public", "static", "vpnclientlessaccesspolicy", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "vpnclientlessaccesspolicy", "obj", "=", "new", "vpnclientlessaccesspolicy", "(", ")", ";", "obj", ".", "set_name", "(", ...
Use this API to fetch vpnclientlessaccesspolicy resource of given name .
[ "Use", "this", "API", "to", "fetch", "vpnclientlessaccesspolicy", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnclientlessaccesspolicy.java#L320-L325
jboss/jboss-jstl-api_spec
src/main/java/org/apache/taglibs/standard/util/XmlUtil.java
XmlUtil.runWithOurClassLoader
private static <T, E extends Exception> T runWithOurClassLoader(final Callable<T> action, Class<E> allowed) throws E { PrivilegedExceptionAction<T> actionWithClassloader = new PrivilegedExceptionAction<T>() { public T run() throws Exception { ClassLoader original = Thread.currentThread().getContextClassLoader(); ClassLoader ours = XmlUtil.class.getClassLoader(); // Don't override the TCCL if it is not needed. if (original == ours) { return action.call(); } else { try { Thread.currentThread().setContextClassLoader(ours); return action.call(); } finally { Thread.currentThread().setContextClassLoader(original); } } } }; try { return AccessController.doPrivileged(actionWithClassloader); } catch (PrivilegedActionException e) { Throwable cause = e.getCause(); if (allowed.isInstance(cause)) { throw allowed.cast(cause); } else { throw (Error) new AssertionError().initCause(cause); } } }
java
private static <T, E extends Exception> T runWithOurClassLoader(final Callable<T> action, Class<E> allowed) throws E { PrivilegedExceptionAction<T> actionWithClassloader = new PrivilegedExceptionAction<T>() { public T run() throws Exception { ClassLoader original = Thread.currentThread().getContextClassLoader(); ClassLoader ours = XmlUtil.class.getClassLoader(); // Don't override the TCCL if it is not needed. if (original == ours) { return action.call(); } else { try { Thread.currentThread().setContextClassLoader(ours); return action.call(); } finally { Thread.currentThread().setContextClassLoader(original); } } } }; try { return AccessController.doPrivileged(actionWithClassloader); } catch (PrivilegedActionException e) { Throwable cause = e.getCause(); if (allowed.isInstance(cause)) { throw allowed.cast(cause); } else { throw (Error) new AssertionError().initCause(cause); } } }
[ "private", "static", "<", "T", ",", "E", "extends", "Exception", ">", "T", "runWithOurClassLoader", "(", "final", "Callable", "<", "T", ">", "action", ",", "Class", "<", "E", ">", "allowed", ")", "throws", "E", "{", "PrivilegedExceptionAction", "<", "T", ...
Performs an action using this Class's ClassLoader as the Thread context ClassLoader. @param action the action to perform @param allowed an Exception that might be thrown by the action @param <T> the type of the result @param <E> the type of the allowed Exception @return the result of the action @throws E if the action threw the allowed Exception
[ "Performs", "an", "action", "using", "this", "Class", "s", "ClassLoader", "as", "the", "Thread", "context", "ClassLoader", "." ]
train
https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/util/XmlUtil.java#L384-L412
GeoLatte/geolatte-common
src/main/java/org/geolatte/common/dataformats/json/jackson/GeometryDeserializer.java
GeometryDeserializer.asMultiPolygon
private MultiPolygon asMultiPolygon(List<List<List<List>>> coords, CrsId crsId) throws IOException { if (coords == null || coords.isEmpty()) { throw new IOException("A multipolygon should have at least one polyon."); } Polygon[] polygons = new Polygon[coords.size()]; for (int i = 0; i < coords.size(); i++) { polygons[i] = asPolygon(coords.get(i), crsId); } return new MultiPolygon(polygons); }
java
private MultiPolygon asMultiPolygon(List<List<List<List>>> coords, CrsId crsId) throws IOException { if (coords == null || coords.isEmpty()) { throw new IOException("A multipolygon should have at least one polyon."); } Polygon[] polygons = new Polygon[coords.size()]; for (int i = 0; i < coords.size(); i++) { polygons[i] = asPolygon(coords.get(i), crsId); } return new MultiPolygon(polygons); }
[ "private", "MultiPolygon", "asMultiPolygon", "(", "List", "<", "List", "<", "List", "<", "List", ">", ">", ">", "coords", ",", "CrsId", "crsId", ")", "throws", "IOException", "{", "if", "(", "coords", "==", "null", "||", "coords", ".", "isEmpty", "(", ...
Parses the JSON as a MultiPolygon geometry @param coords the coordinates of a multipolygon which is just a list of coordinates of polygons. @param crsId @return an instance of multipolygon @throws IOException if the given json does not correspond to a multipolygon or can be parsed as such
[ "Parses", "the", "JSON", "as", "a", "MultiPolygon", "geometry" ]
train
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/jackson/GeometryDeserializer.java#L216-L225
wildfly/wildfly-core
logging/src/main/java/org/jboss/as/logging/LoggingSubsystemParser.java
LoggingSubsystemParser.readNameAttribute
static String readNameAttribute(final XMLExtendedStreamReader reader) throws XMLStreamException { return readStringAttributeElement(reader, Attribute.NAME.getLocalName()); }
java
static String readNameAttribute(final XMLExtendedStreamReader reader) throws XMLStreamException { return readStringAttributeElement(reader, Attribute.NAME.getLocalName()); }
[ "static", "String", "readNameAttribute", "(", "final", "XMLExtendedStreamReader", "reader", ")", "throws", "XMLStreamException", "{", "return", "readStringAttributeElement", "(", "reader", ",", "Attribute", ".", "NAME", ".", "getLocalName", "(", ")", ")", ";", "}" ]
Reads the single {@code name} attribute from an element. @param reader the reader to use @return the value of the {@code name} attribute @throws XMLStreamException if the {@code name} attribute is not present, there is more than one attribute on the element or there is content within the element.
[ "Reads", "the", "single", "{", "@code", "name", "}", "attribute", "from", "an", "element", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/logging/src/main/java/org/jboss/as/logging/LoggingSubsystemParser.java#L83-L85
cdk/cdk
base/core/src/main/java/org/openscience/cdk/ringsearch/RegularCyclicVertexSearch.java
RegularCyclicVertexSearch.indexOfFused
private int indexOfFused(int start, long cycle) { for (int i = start; i < cycles.size(); i++) { long intersect = cycles.get(i) & cycle; if (intersect != 0 && Long.bitCount(intersect) > 1) { return i; } } return -1; }
java
private int indexOfFused(int start, long cycle) { for (int i = start; i < cycles.size(); i++) { long intersect = cycles.get(i) & cycle; if (intersect != 0 && Long.bitCount(intersect) > 1) { return i; } } return -1; }
[ "private", "int", "indexOfFused", "(", "int", "start", ",", "long", "cycle", ")", "{", "for", "(", "int", "i", "=", "start", ";", "i", "<", "cycles", ".", "size", "(", ")", ";", "i", "++", ")", "{", "long", "intersect", "=", "cycles", ".", "get",...
Find the next index that the <i>cycle</i> intersects with by at least two vertices. If the intersect of a vertex set with another contains more then two vertices it cannot be edge disjoint. @param start start searching from here @param cycle test whether any current cycles are fused with this one @return the index of the first fused after 'start', -1 if none
[ "Find", "the", "next", "index", "that", "the", "<i", ">", "cycle<", "/", "i", ">", "intersects", "with", "by", "at", "least", "two", "vertices", ".", "If", "the", "intersect", "of", "a", "vertex", "set", "with", "another", "contains", "more", "then", "...
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/core/src/main/java/org/openscience/cdk/ringsearch/RegularCyclicVertexSearch.java#L220-L228
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_configtemplate.java
ns_configtemplate.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { ns_configtemplate_responses result = (ns_configtemplate_responses) service.get_payload_formatter().string_to_resource(ns_configtemplate_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ns_configtemplate_response_array); } ns_configtemplate[] result_ns_configtemplate = new ns_configtemplate[result.ns_configtemplate_response_array.length]; for(int i = 0; i < result.ns_configtemplate_response_array.length; i++) { result_ns_configtemplate[i] = result.ns_configtemplate_response_array[i].ns_configtemplate[0]; } return result_ns_configtemplate; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { ns_configtemplate_responses result = (ns_configtemplate_responses) service.get_payload_formatter().string_to_resource(ns_configtemplate_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ns_configtemplate_response_array); } ns_configtemplate[] result_ns_configtemplate = new ns_configtemplate[result.ns_configtemplate_response_array.length]; for(int i = 0; i < result.ns_configtemplate_response_array.length; i++) { result_ns_configtemplate[i] = result.ns_configtemplate_response_array[i].ns_configtemplate[0]; } return result_ns_configtemplate; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "ns_configtemplate_responses", "result", "=", "(", "ns_configtemplate_responses", ")", "service", ".", "get_pa...
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_configtemplate.java#L401-L418
graphhopper/graphhopper
api/src/main/java/com/graphhopper/util/AngleCalc.java
AngleCalc.calcAzimuth
public double calcAzimuth(double lat1, double lon1, double lat2, double lon2) { double orientation = Math.PI / 2 - calcOrientation(lat1, lon1, lat2, lon2); if (orientation < 0) orientation += 2 * Math.PI; return Math.toDegrees(Helper.round4(orientation)) % 360; }
java
public double calcAzimuth(double lat1, double lon1, double lat2, double lon2) { double orientation = Math.PI / 2 - calcOrientation(lat1, lon1, lat2, lon2); if (orientation < 0) orientation += 2 * Math.PI; return Math.toDegrees(Helper.round4(orientation)) % 360; }
[ "public", "double", "calcAzimuth", "(", "double", "lat1", ",", "double", "lon1", ",", "double", "lat2", ",", "double", "lon2", ")", "{", "double", "orientation", "=", "Math", ".", "PI", "/", "2", "-", "calcOrientation", "(", "lat1", ",", "lon1", ",", "...
Calculate the azimuth in degree for a line given by two coordinates. Direction in 'degree' where 0 is north, 90 is east, 180 is south and 270 is west.
[ "Calculate", "the", "azimuth", "in", "degree", "for", "a", "line", "given", "by", "two", "coordinates", ".", "Direction", "in", "degree", "where", "0", "is", "north", "90", "is", "east", "180", "is", "south", "and", "270", "is", "west", "." ]
train
https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/api/src/main/java/com/graphhopper/util/AngleCalc.java#L113-L119
Red5/red5-server-common
src/main/java/org/red5/server/stream/PlaylistSubscriberStream.java
PlaylistSubscriberStream.createEngine
PlayEngine createEngine(ISchedulingService schedulingService, IConsumerService consumerService, IProviderService providerService) { engine = new PlayEngine.Builder(this, schedulingService, consumerService, providerService).build(); // set the max pending video frames to the play engine engine.setMaxPendingVideoFrames(maxPendingVideoFrames); // set the max sequential pending video frames to the play engine engine.setMaxSequentialPendingVideoFrames(maxSequentialPendingVideoFrames); return engine; }
java
PlayEngine createEngine(ISchedulingService schedulingService, IConsumerService consumerService, IProviderService providerService) { engine = new PlayEngine.Builder(this, schedulingService, consumerService, providerService).build(); // set the max pending video frames to the play engine engine.setMaxPendingVideoFrames(maxPendingVideoFrames); // set the max sequential pending video frames to the play engine engine.setMaxSequentialPendingVideoFrames(maxSequentialPendingVideoFrames); return engine; }
[ "PlayEngine", "createEngine", "(", "ISchedulingService", "schedulingService", ",", "IConsumerService", "consumerService", ",", "IProviderService", "providerService", ")", "{", "engine", "=", "new", "PlayEngine", ".", "Builder", "(", "this", ",", "schedulingService", ","...
Creates a play engine based on current services (scheduling service, consumer service, and provider service). This method is useful during unit testing.
[ "Creates", "a", "play", "engine", "based", "on", "current", "services", "(", "scheduling", "service", "consumer", "service", "and", "provider", "service", ")", ".", "This", "method", "is", "useful", "during", "unit", "testing", "." ]
train
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlaylistSubscriberStream.java#L143-L150
Netflix/Hystrix
hystrix-core/src/main/java/com/netflix/hystrix/strategy/executionhook/HystrixCommandExecutionHook.java
HystrixCommandExecutionHook.onError
public <T> Exception onError(HystrixInvokable<T> commandInstance, FailureType failureType, Exception e) { return e; //by default, just pass through }
java
public <T> Exception onError(HystrixInvokable<T> commandInstance, FailureType failureType, Exception e) { return e; //by default, just pass through }
[ "public", "<", "T", ">", "Exception", "onError", "(", "HystrixInvokable", "<", "T", ">", "commandInstance", ",", "FailureType", "failureType", ",", "Exception", "e", ")", "{", "return", "e", ";", "//by default, just pass through", "}" ]
Invoked when {@link HystrixInvokable} fails with an Exception. @param commandInstance The executing HystrixInvokable instance. @param failureType {@link FailureType} enum representing which type of error @param e exception object @since 1.2
[ "Invoked", "when", "{", "@link", "HystrixInvokable", "}", "fails", "with", "an", "Exception", "." ]
train
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-core/src/main/java/com/netflix/hystrix/strategy/executionhook/HystrixCommandExecutionHook.java#L76-L78
infinispan/infinispan
commons/src/main/java/org/infinispan/commons/marshall/MarshallUtil.java
MarshallUtil.unmarshallMap
public static <K, V, T extends Map<K, V>> T unmarshallMap(ObjectInput in, MapBuilder<K, V, T> builder) throws IOException, ClassNotFoundException { final int size = unmarshallSize(in); if (size == NULL_VALUE) { return null; } final T map = Objects.requireNonNull(builder, "MapBuilder must be non-null").build(size); for (int i = 0; i < size; i++) //noinspection unchecked map.put((K) in.readObject(), (V) in.readObject()); return map; }
java
public static <K, V, T extends Map<K, V>> T unmarshallMap(ObjectInput in, MapBuilder<K, V, T> builder) throws IOException, ClassNotFoundException { final int size = unmarshallSize(in); if (size == NULL_VALUE) { return null; } final T map = Objects.requireNonNull(builder, "MapBuilder must be non-null").build(size); for (int i = 0; i < size; i++) //noinspection unchecked map.put((K) in.readObject(), (V) in.readObject()); return map; }
[ "public", "static", "<", "K", ",", "V", ",", "T", "extends", "Map", "<", "K", ",", "V", ">", ">", "T", "unmarshallMap", "(", "ObjectInput", "in", ",", "MapBuilder", "<", "K", ",", "V", ",", "T", ">", "builder", ")", "throws", "IOException", ",", ...
Unmarshall the {@link Map}. <p> If the marshalled map is {@code null}, then the {@link MapBuilder} is not invoked. @param in {@link ObjectInput} to read. @param builder {@link MapBuilder} to create the concrete {@link Map} implementation. @return The populated {@link Map} created by the {@link MapBuilder} or {@code null}. @throws IOException If any of the usual Input/Output related exceptions occur. @throws ClassNotFoundException If the class of a serialized object cannot be found. @see #marshallMap(Map, ObjectOutput)
[ "Unmarshall", "the", "{", "@link", "Map", "}", ".", "<p", ">", "If", "the", "marshalled", "map", "is", "{", "@code", "null", "}", "then", "the", "{", "@link", "MapBuilder", "}", "is", "not", "invoked", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/marshall/MarshallUtil.java#L79-L88
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-xml/src/main/java/org/xwiki/xml/html/filter/AbstractHTMLFilter.java
AbstractHTMLFilter.moveChildren
protected void moveChildren(Element parent, Element destination) { NodeList children = parent.getChildNodes(); while (children.getLength() > 0) { destination.appendChild(parent.removeChild(parent.getFirstChild())); } }
java
protected void moveChildren(Element parent, Element destination) { NodeList children = parent.getChildNodes(); while (children.getLength() > 0) { destination.appendChild(parent.removeChild(parent.getFirstChild())); } }
[ "protected", "void", "moveChildren", "(", "Element", "parent", ",", "Element", "destination", ")", "{", "NodeList", "children", "=", "parent", ".", "getChildNodes", "(", ")", ";", "while", "(", "children", ".", "getLength", "(", ")", ">", "0", ")", "{", ...
Moves all child elements of the parent into destination element. @param parent the parent {@link Element}. @param destination the destination {@link Element}.
[ "Moves", "all", "child", "elements", "of", "the", "parent", "into", "destination", "element", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-xml/src/main/java/org/xwiki/xml/html/filter/AbstractHTMLFilter.java#L147-L153
mozilla/rhino
src/org/mozilla/javascript/ScriptRuntime.java
ScriptRuntime.newObjectLiteral
@Deprecated public static Scriptable newObjectLiteral(Object[] propertyIds, Object[] propertyValues, Context cx, Scriptable scope) { // Passing null for getterSetters means no getters or setters return newObjectLiteral(propertyIds, propertyValues, null, cx, scope); }
java
@Deprecated public static Scriptable newObjectLiteral(Object[] propertyIds, Object[] propertyValues, Context cx, Scriptable scope) { // Passing null for getterSetters means no getters or setters return newObjectLiteral(propertyIds, propertyValues, null, cx, scope); }
[ "@", "Deprecated", "public", "static", "Scriptable", "newObjectLiteral", "(", "Object", "[", "]", "propertyIds", ",", "Object", "[", "]", "propertyValues", ",", "Context", "cx", ",", "Scriptable", "scope", ")", "{", "// Passing null for getterSetters means no getters ...
This method is here for backward compat with existing compiled code. It is called when an object literal is compiled. The next instance will be the version called from new code. <strong>This method only present for compatibility.</strong> @deprecated Use {@link #newObjectLiteral(Object[], Object[], int[], Context, Scriptable)} instead
[ "This", "method", "is", "here", "for", "backward", "compat", "with", "existing", "compiled", "code", ".", "It", "is", "called", "when", "an", "object", "literal", "is", "compiled", ".", "The", "next", "instance", "will", "be", "the", "version", "called", "...
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptRuntime.java#L4061-L4068
algolia/instantsearch-android
core/src/main/java/com/algolia/instantsearch/core/helpers/Highlighter.java
Highlighter.setDefault
@SuppressWarnings({"WeakerAccess", "unused"}) // For library users public static void setDefault(final String prefixTag, final String postfixTag) { defaultHighlighter = new Highlighter(prefixTag, postfixTag); }
java
@SuppressWarnings({"WeakerAccess", "unused"}) // For library users public static void setDefault(final String prefixTag, final String postfixTag) { defaultHighlighter = new Highlighter(prefixTag, postfixTag); }
[ "@", "SuppressWarnings", "(", "{", "\"WeakerAccess\"", ",", "\"unused\"", "}", ")", "// For library users", "public", "static", "void", "setDefault", "(", "final", "String", "prefixTag", ",", "final", "String", "postfixTag", ")", "{", "defaultHighlighter", "=", "n...
Sets the default highlighter to highlight anything between {@code prefixTag} and {@code postfixTag}. @param prefixTag the String that is inserted before a highlighted part of a result. @param postfixTag the String that is inserted after a highlighted part of a result.
[ "Sets", "the", "default", "highlighter", "to", "highlight", "anything", "between", "{", "@code", "prefixTag", "}", "and", "{", "@code", "postfixTag", "}", "." ]
train
https://github.com/algolia/instantsearch-android/blob/12092ec30140df9ffc2bf916339b433372034616/core/src/main/java/com/algolia/instantsearch/core/helpers/Highlighter.java#L97-L100
keenon/loglinear
src/main/java/com/github/keenon/loglinear/model/ConcatVectorNamespace.java
ConcatVectorNamespace.setDenseFeature
public void setDenseFeature(ConcatVector vector, String featureName, double[] value) { vector.setDenseComponent(ensureFeature(featureName), value); }
java
public void setDenseFeature(ConcatVector vector, String featureName, double[] value) { vector.setDenseComponent(ensureFeature(featureName), value); }
[ "public", "void", "setDenseFeature", "(", "ConcatVector", "vector", ",", "String", "featureName", ",", "double", "[", "]", "value", ")", "{", "vector", ".", "setDenseComponent", "(", "ensureFeature", "(", "featureName", ")", ",", "value", ")", ";", "}" ]
This adds a dense feature to a vector, setting the appropriate component of the given vector to the passed in value. @param vector the vector @param featureName the feature whose value to set @param value the value we want to set this vector to
[ "This", "adds", "a", "dense", "feature", "to", "a", "vector", "setting", "the", "appropriate", "component", "of", "the", "given", "vector", "to", "the", "passed", "in", "value", "." ]
train
https://github.com/keenon/loglinear/blob/fa0c370ab6782015412f676ef2ab11c97be58e29/src/main/java/com/github/keenon/loglinear/model/ConcatVectorNamespace.java#L134-L136
futuresimple/android-db-commons
library/src/main/java/com/getbase/android/db/cursors/FluentCursor.java
FluentCursor.toOnlyElement
public <T> T toOnlyElement(Function<? super Cursor, T> singleRowTransform) { try { switch (getCount()) { case 0: throw new NoSuchElementException(); case 1: moveToFirst(); return singleRowTransform.apply(this); default: throw new IllegalArgumentException("expected one element but was: " + getCount()); } } finally { close(); } }
java
public <T> T toOnlyElement(Function<? super Cursor, T> singleRowTransform) { try { switch (getCount()) { case 0: throw new NoSuchElementException(); case 1: moveToFirst(); return singleRowTransform.apply(this); default: throw new IllegalArgumentException("expected one element but was: " + getCount()); } } finally { close(); } }
[ "public", "<", "T", ">", "T", "toOnlyElement", "(", "Function", "<", "?", "super", "Cursor", ",", "T", ">", "singleRowTransform", ")", "{", "try", "{", "switch", "(", "getCount", "(", ")", ")", "{", "case", "0", ":", "throw", "new", "NoSuchElementExcep...
Returns the only row of this cursor transformed using the given function. WARNING: This method closes cursor. Do not use this from onLoadFinished() @param singleRowTransform Function to apply on the only row of this cursor @param <T> Type of returned element @return Transformed first row of the cursor. If the cursor is empty, NoSuchElementException is thrown. If the cursor contains more than one row, IllegalArgumentException is thrown.
[ "Returns", "the", "only", "row", "of", "this", "cursor", "transformed", "using", "the", "given", "function", ".", "WARNING", ":", "This", "method", "closes", "cursor", ".", "Do", "not", "use", "this", "from", "onLoadFinished", "()" ]
train
https://github.com/futuresimple/android-db-commons/blob/a3c37df806f61b1bfab6927ba3710cbb0fa9229a/library/src/main/java/com/getbase/android/db/cursors/FluentCursor.java#L129-L143
seedstack/seed
core/src/main/java/org/seedstack/seed/core/internal/el/ELBinder.java
ELBinder.bindELAnnotation
public ELBinder bindELAnnotation(Class<? extends Annotation> annotationClass, ExecutionPolicy policy) { ELInterceptor interceptor = new ELInterceptor(annotationClass, policy); binder.requestInjection(interceptor); binder.bindInterceptor(Matchers.any(), handlerMethodMatcher(annotationClass), interceptor); return this; }
java
public ELBinder bindELAnnotation(Class<? extends Annotation> annotationClass, ExecutionPolicy policy) { ELInterceptor interceptor = new ELInterceptor(annotationClass, policy); binder.requestInjection(interceptor); binder.bindInterceptor(Matchers.any(), handlerMethodMatcher(annotationClass), interceptor); return this; }
[ "public", "ELBinder", "bindELAnnotation", "(", "Class", "<", "?", "extends", "Annotation", ">", "annotationClass", ",", "ExecutionPolicy", "policy", ")", "{", "ELInterceptor", "interceptor", "=", "new", "ELInterceptor", "(", "annotationClass", ",", "policy", ")", ...
Bind an ELInterceptor to the given annotation with the given {@link ELBinder.ExecutionPolicy}. @param annotationClass EL annotation to intercept @param policy determine when the EL is evaluated @return ELBinder
[ "Bind", "an", "ELInterceptor", "to", "the", "given", "annotation", "with", "the", "given", "{", "@link", "ELBinder", ".", "ExecutionPolicy", "}", "." ]
train
https://github.com/seedstack/seed/blob/d9cf33bfb2fffcdbb0976f4726e943acda90e828/core/src/main/java/org/seedstack/seed/core/internal/el/ELBinder.java#L71-L76
deeplearning4j/deeplearning4j
datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/loader/ImageLoader.java
ImageLoader.toBgr
public INDArray toBgr(InputStream inputStream) { try { BufferedImage image = ImageIO.read(inputStream); return toBgr(image); } catch (IOException e) { throw new RuntimeException("Unable to load image", e); } }
java
public INDArray toBgr(InputStream inputStream) { try { BufferedImage image = ImageIO.read(inputStream); return toBgr(image); } catch (IOException e) { throw new RuntimeException("Unable to load image", e); } }
[ "public", "INDArray", "toBgr", "(", "InputStream", "inputStream", ")", "{", "try", "{", "BufferedImage", "image", "=", "ImageIO", ".", "read", "(", "inputStream", ")", ";", "return", "toBgr", "(", "image", ")", ";", "}", "catch", "(", "IOException", "e", ...
Convert an input stream to an bgr spectrum image @param inputStream the input stream to convert @return the input stream to convert
[ "Convert", "an", "input", "stream", "to", "an", "bgr", "spectrum", "image" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/loader/ImageLoader.java#L211-L218
Waikato/moa
moa/src/main/java/moa/gui/GUIDefaults.java
GUIDefaults.getObject
protected static Object getObject(String property, String defaultValue) { return getObject(property, defaultValue, Object.class); }
java
protected static Object getObject(String property, String defaultValue) { return getObject(property, defaultValue, Object.class); }
[ "protected", "static", "Object", "getObject", "(", "String", "property", ",", "String", "defaultValue", ")", "{", "return", "getObject", "(", "property", ",", "defaultValue", ",", "Object", ".", "class", ")", ";", "}" ]
Tries to instantiate the class stored for this property, optional options will be set as well. Returns null if unsuccessful. @param property the property to get the object for @param defaultValue the default object spec string @return if successful the fully configured object, null otherwise
[ "Tries", "to", "instantiate", "the", "class", "stored", "for", "this", "property", "optional", "options", "will", "be", "set", "as", "well", ".", "Returns", "null", "if", "unsuccessful", "." ]
train
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/GUIDefaults.java#L91-L93
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/DateTimeUtil.java
DateTimeUtil.setTime
public static void setTime(Datebox datebox, Timebox timebox, Date value) { value = value == null ? new Date() : value; datebox.setValue(DateUtil.stripTime(value)); timebox.setValue(value); }
java
public static void setTime(Datebox datebox, Timebox timebox, Date value) { value = value == null ? new Date() : value; datebox.setValue(DateUtil.stripTime(value)); timebox.setValue(value); }
[ "public", "static", "void", "setTime", "(", "Datebox", "datebox", ",", "Timebox", "timebox", ",", "Date", "value", ")", "{", "value", "=", "value", "==", "null", "?", "new", "Date", "(", ")", ":", "value", ";", "datebox", ".", "setValue", "(", "DateUti...
Sets the UI to reflect the specified time. @param datebox The date box. @param timebox The time box. @param value Time value to set.
[ "Sets", "the", "UI", "to", "reflect", "the", "specified", "time", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/DateTimeUtil.java#L68-L72
pac4j/pac4j
pac4j-saml/src/main/java/org/pac4j/saml/transport/Pac4jHTTPPostEncoder.java
Pac4jHTTPPostEncoder.marshallMessage
protected Element marshallMessage(XMLObject message) throws MessageEncodingException { log.debug("Marshalling message"); try { return XMLObjectSupport.marshall(message); } catch (MarshallingException e) { throw new MessageEncodingException("Error marshalling message", e); } }
java
protected Element marshallMessage(XMLObject message) throws MessageEncodingException { log.debug("Marshalling message"); try { return XMLObjectSupport.marshall(message); } catch (MarshallingException e) { throw new MessageEncodingException("Error marshalling message", e); } }
[ "protected", "Element", "marshallMessage", "(", "XMLObject", "message", ")", "throws", "MessageEncodingException", "{", "log", ".", "debug", "(", "\"Marshalling message\"", ")", ";", "try", "{", "return", "XMLObjectSupport", ".", "marshall", "(", "message", ")", "...
Helper method that marshalls the given message. @param message message the marshall and serialize @return marshalled message @throws MessageEncodingException thrown if the give message can not be marshalled into its DOM representation
[ "Helper", "method", "that", "marshalls", "the", "given", "message", "." ]
train
https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-saml/src/main/java/org/pac4j/saml/transport/Pac4jHTTPPostEncoder.java#L224-L232
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/TableFactory.java
TableFactory.createTable
public Table createTable(ProjectFile file, byte[] data, VarMeta varMeta, Var2Data varData) { Table table = new Table(); table.setID(MPPUtility.getInt(data, 0)); table.setResourceFlag(MPPUtility.getShort(data, 108) == 1); table.setName(MPPUtility.removeAmpersands(MPPUtility.getUnicodeString(data, 4))); byte[] columnData = null; Integer tableID = Integer.valueOf(table.getID()); if (m_tableColumnDataBaseline != null) { columnData = varData.getByteArray(varMeta.getOffset(tableID, m_tableColumnDataBaseline)); } if (columnData == null) { columnData = varData.getByteArray(varMeta.getOffset(tableID, m_tableColumnDataEnterprise)); if (columnData == null) { columnData = varData.getByteArray(varMeta.getOffset(tableID, m_tableColumnDataStandard)); } } processColumnData(file, table, columnData); //System.out.println(table); return (table); }
java
public Table createTable(ProjectFile file, byte[] data, VarMeta varMeta, Var2Data varData) { Table table = new Table(); table.setID(MPPUtility.getInt(data, 0)); table.setResourceFlag(MPPUtility.getShort(data, 108) == 1); table.setName(MPPUtility.removeAmpersands(MPPUtility.getUnicodeString(data, 4))); byte[] columnData = null; Integer tableID = Integer.valueOf(table.getID()); if (m_tableColumnDataBaseline != null) { columnData = varData.getByteArray(varMeta.getOffset(tableID, m_tableColumnDataBaseline)); } if (columnData == null) { columnData = varData.getByteArray(varMeta.getOffset(tableID, m_tableColumnDataEnterprise)); if (columnData == null) { columnData = varData.getByteArray(varMeta.getOffset(tableID, m_tableColumnDataStandard)); } } processColumnData(file, table, columnData); //System.out.println(table); return (table); }
[ "public", "Table", "createTable", "(", "ProjectFile", "file", ",", "byte", "[", "]", "data", ",", "VarMeta", "varMeta", ",", "Var2Data", "varData", ")", "{", "Table", "table", "=", "new", "Table", "(", ")", ";", "table", ".", "setID", "(", "MPPUtility", ...
Creates a new Table instance from data extracted from an MPP file. @param file parent project file @param data fixed data @param varMeta var meta @param varData var data @return Table instance
[ "Creates", "a", "new", "Table", "instance", "from", "data", "extracted", "from", "an", "MPP", "file", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/TableFactory.java#L61-L90
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.setUserAvatar
public User setUserAvatar(final Object userIdOrUsername, File avatarFile) throws GitLabApiException { Response response = putUpload(Response.Status.OK, "avatar", avatarFile, "users", getUserIdOrUsername(userIdOrUsername)); return (response.readEntity(User.class)); }
java
public User setUserAvatar(final Object userIdOrUsername, File avatarFile) throws GitLabApiException { Response response = putUpload(Response.Status.OK, "avatar", avatarFile, "users", getUserIdOrUsername(userIdOrUsername)); return (response.readEntity(User.class)); }
[ "public", "User", "setUserAvatar", "(", "final", "Object", "userIdOrUsername", ",", "File", "avatarFile", ")", "throws", "GitLabApiException", "{", "Response", "response", "=", "putUpload", "(", "Response", ".", "Status", ".", "OK", ",", "\"avatar\"", ",", "avat...
Uploads and sets the user's avatar for the specified user. <pre><code>PUT /users/:id</code></pre> @param userIdOrUsername the user in the form of an Integer(ID), String(username), or User instance @param avatarFile the File instance of the avatar file to upload @return the updated User instance @throws GitLabApiException if any exception occurs
[ "Uploads", "and", "sets", "the", "user", "s", "avatar", "for", "the", "specified", "user", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L1011-L1014
playn/playn
java-base/src/playn/java/JavaGraphics.java
JavaGraphics.aaFontContext
FontRenderContext aaFontContext() { if (aaFontContext == null) { // set up the dummy font contexts Graphics2D aaGfx = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB).createGraphics(); aaGfx.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); aaFontContext = aaGfx.getFontRenderContext(); } return aaFontContext; }
java
FontRenderContext aaFontContext() { if (aaFontContext == null) { // set up the dummy font contexts Graphics2D aaGfx = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB).createGraphics(); aaGfx.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); aaFontContext = aaGfx.getFontRenderContext(); } return aaFontContext; }
[ "FontRenderContext", "aaFontContext", "(", ")", "{", "if", "(", "aaFontContext", "==", "null", ")", "{", "// set up the dummy font contexts", "Graphics2D", "aaGfx", "=", "new", "BufferedImage", "(", "1", ",", "1", ",", "BufferedImage", ".", "TYPE_INT_ARGB", ")", ...
these are initialized lazily to avoid doing any AWT stuff during startup
[ "these", "are", "initialized", "lazily", "to", "avoid", "doing", "any", "AWT", "stuff", "during", "startup" ]
train
https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/java-base/src/playn/java/JavaGraphics.java#L47-L55
RallyTools/RallyRestToolkitForJava
src/main/java/com/rallydev/rest/client/HttpClient.java
HttpClient.doPut
public String doPut(String url, String body) throws IOException { HttpPut httpPut = new HttpPut(getWsapiUrl() + url); httpPut.setEntity(new StringEntity(body, "utf-8")); return doRequest(httpPut); }
java
public String doPut(String url, String body) throws IOException { HttpPut httpPut = new HttpPut(getWsapiUrl() + url); httpPut.setEntity(new StringEntity(body, "utf-8")); return doRequest(httpPut); }
[ "public", "String", "doPut", "(", "String", "url", ",", "String", "body", ")", "throws", "IOException", "{", "HttpPut", "httpPut", "=", "new", "HttpPut", "(", "getWsapiUrl", "(", ")", "+", "url", ")", ";", "httpPut", ".", "setEntity", "(", "new", "String...
Perform a put against the WSAPI @param url the request url @param body the body of the put @return the JSON encoded string response @throws IOException if a non-200 response code is returned or if some other problem occurs while executing the request
[ "Perform", "a", "put", "against", "the", "WSAPI" ]
train
https://github.com/RallyTools/RallyRestToolkitForJava/blob/542afa16ea44c9c64cebb0299500dcbbb50b6d7d/src/main/java/com/rallydev/rest/client/HttpClient.java#L192-L196
jOOQ/jOOL
jOOL-java-8/src/main/java/org/jooq/lambda/Agg.java
Agg.maxAll
public static <T, U> Collector<T, ?, Seq<U>> maxAll(Function<? super T, ? extends U> function, Comparator<? super U> comparator) { return collectingAndThen(maxAllBy(function, comparator), t -> t.map(function)); }
java
public static <T, U> Collector<T, ?, Seq<U>> maxAll(Function<? super T, ? extends U> function, Comparator<? super U> comparator) { return collectingAndThen(maxAllBy(function, comparator), t -> t.map(function)); }
[ "public", "static", "<", "T", ",", "U", ">", "Collector", "<", "T", ",", "?", ",", "Seq", "<", "U", ">", ">", "maxAll", "(", "Function", "<", "?", "super", "T", ",", "?", "extends", "U", ">", "function", ",", "Comparator", "<", "?", "super", "U...
Get a {@link Collector} that calculates the <code>MAX()</code> function, producing multiple results.
[ "Get", "a", "{" ]
train
https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Agg.java#L350-L352
chemouna/Decor
decorators/src/main/java/com/mounacheikhna/decorators/AutofitDecorator.java
AutofitDecorator.setTextSize
public void setTextSize(int unit, float size) { if (!mSizeToFit) { mTextView.setTextSize(unit, size); } Context context = mTextView.getContext(); Resources r = Resources.getSystem(); if (context != null) { r = context.getResources(); } setRawTextSize(TypedValue.applyDimension(unit, size, r.getDisplayMetrics())); }
java
public void setTextSize(int unit, float size) { if (!mSizeToFit) { mTextView.setTextSize(unit, size); } Context context = mTextView.getContext(); Resources r = Resources.getSystem(); if (context != null) { r = context.getResources(); } setRawTextSize(TypedValue.applyDimension(unit, size, r.getDisplayMetrics())); }
[ "public", "void", "setTextSize", "(", "int", "unit", ",", "float", "size", ")", "{", "if", "(", "!", "mSizeToFit", ")", "{", "mTextView", ".", "setTextSize", "(", "unit", ",", "size", ")", ";", "}", "Context", "context", "=", "mTextView", ".", "getCont...
probably it wont work (is there a way to have a delegate for mTextView to pass to this when setTextSize is called on it)
[ "probably", "it", "wont", "work", "(", "is", "there", "a", "way", "to", "have", "a", "delegate", "for", "mTextView", "to", "pass", "to", "this", "when", "setTextSize", "is", "called", "on", "it", ")" ]
train
https://github.com/chemouna/Decor/blob/82b1c1be3c7769e0b63c6eb16f0c01055fb3e4ca/decorators/src/main/java/com/mounacheikhna/decorators/AutofitDecorator.java#L238-L251
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/N1qlParams.java
N1qlParams.rawParam
@InterfaceStability.Uncommitted public N1qlParams rawParam(String name, Object value) { if (this.rawParams == null) { this.rawParams = new HashMap<String, Object>(); } if (!JsonValue.checkType(value)) { throw new IllegalArgumentException("Only JSON types are supported."); } rawParams.put(name, value); return this; }
java
@InterfaceStability.Uncommitted public N1qlParams rawParam(String name, Object value) { if (this.rawParams == null) { this.rawParams = new HashMap<String, Object>(); } if (!JsonValue.checkType(value)) { throw new IllegalArgumentException("Only JSON types are supported."); } rawParams.put(name, value); return this; }
[ "@", "InterfaceStability", ".", "Uncommitted", "public", "N1qlParams", "rawParam", "(", "String", "name", ",", "Object", "value", ")", "{", "if", "(", "this", ".", "rawParams", "==", "null", ")", "{", "this", ".", "rawParams", "=", "new", "HashMap", "<", ...
Allows to specify an arbitrary, raw N1QL param. Use with care and only provide options that are supported by the server and are not exposed as part of the overall stable API in the {@link N1qlParams} class. @param name the name of the property. @param value the value of the property, only JSON value types are supported. @return this {@link N1qlParams} for chaining.
[ "Allows", "to", "specify", "an", "arbitrary", "raw", "N1QL", "param", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/N1qlParams.java#L448-L460
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Dict.java
Dict.removeEqual
public <T extends Dict> void removeEqual(T dict, String... withoutNames) { HashSet<String> withoutSet = CollectionUtil.newHashSet(withoutNames); for (Map.Entry<String, Object> entry : dict.entrySet()) { if (withoutSet.contains(entry.getKey())) { continue; } final Object value = this.get(entry.getKey()); if (null != value && value.equals(entry.getValue())) { this.remove(entry.getKey()); } } }
java
public <T extends Dict> void removeEqual(T dict, String... withoutNames) { HashSet<String> withoutSet = CollectionUtil.newHashSet(withoutNames); for (Map.Entry<String, Object> entry : dict.entrySet()) { if (withoutSet.contains(entry.getKey())) { continue; } final Object value = this.get(entry.getKey()); if (null != value && value.equals(entry.getValue())) { this.remove(entry.getKey()); } } }
[ "public", "<", "T", "extends", "Dict", ">", "void", "removeEqual", "(", "T", "dict", ",", "String", "...", "withoutNames", ")", "{", "HashSet", "<", "String", ">", "withoutSet", "=", "CollectionUtil", ".", "newHashSet", "(", "withoutNames", ")", ";", "for"...
与给定实体对比并去除相同的部分<br> 此方法用于在更新操作时避免所有字段被更新,跳过不需要更新的字段 version from 2.0.0 @param <T> 字典对象类型 @param dict 字典对象 @param withoutNames 不需要去除的字段名
[ "与给定实体对比并去除相同的部分<br", ">", "此方法用于在更新操作时避免所有字段被更新,跳过不需要更新的字段", "version", "from", "2", ".", "0", ".", "0" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Dict.java#L195-L207
unbescape/unbescape
src/main/java/org/unbescape/html/HtmlEscape.java
HtmlEscape.escapeHtml5Xml
public static void escapeHtml5Xml(final Reader reader, final Writer writer) throws IOException { escapeHtml(reader, writer, HtmlEscapeType.HTML5_NAMED_REFERENCES_DEFAULT_TO_DECIMAL, HtmlEscapeLevel.LEVEL_1_ONLY_MARKUP_SIGNIFICANT); }
java
public static void escapeHtml5Xml(final Reader reader, final Writer writer) throws IOException { escapeHtml(reader, writer, HtmlEscapeType.HTML5_NAMED_REFERENCES_DEFAULT_TO_DECIMAL, HtmlEscapeLevel.LEVEL_1_ONLY_MARKUP_SIGNIFICANT); }
[ "public", "static", "void", "escapeHtml5Xml", "(", "final", "Reader", "reader", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "escapeHtml", "(", "reader", ",", "writer", ",", "HtmlEscapeType", ".", "HTML5_NAMED_REFERENCES_DEFAULT_TO_DECIMAL", ...
<p> Perform an HTML5 level 1 (XML-style) <strong>escape</strong> operation on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>. </p> <p> <em>Level 1</em> means this method will only escape the five markup-significant characters: <tt>&lt;</tt>, <tt>&gt;</tt>, <tt>&amp;</tt>, <tt>&quot;</tt> and <tt>&#39;</tt>. It is called <em>XML-style</em> in order to link it with JSP's <tt>escapeXml</tt> attribute in JSTL's <tt>&lt;c:out ... /&gt;</tt> tags. </p> <p> Note this method may <strong>not</strong> produce the same results as {@link #escapeHtml4Xml(Reader, Writer)} because it will escape the apostrophe as <tt>&amp;apos;</tt>, whereas in HTML 4 such NCR does not exist (the decimal numeric reference <tt>&amp;#39;</tt> is used instead). </p> <p> This method calls {@link #escapeHtml(Reader, Writer, HtmlEscapeType, HtmlEscapeLevel)} with the following preconfigured values: </p> <ul> <li><tt>type</tt>: {@link org.unbescape.html.HtmlEscapeType#HTML5_NAMED_REFERENCES_DEFAULT_TO_DECIMAL}</li> <li><tt>level</tt>: {@link org.unbescape.html.HtmlEscapeLevel#LEVEL_1_ONLY_MARKUP_SIGNIFICANT}</li> </ul> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.2
[ "<p", ">", "Perform", "an", "HTML5", "level", "1", "(", "XML", "-", "style", ")", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "Reader<", "/", "tt", ">", "input", "writing", "results", "to", "a", "<tt", ">", "W...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/html/HtmlEscape.java#L681-L685
alkacon/opencms-core
src/org/opencms/loader/CmsImageScaler.java
CmsImageScaler.calculateClosest
private int calculateClosest(float base, float[] others) { int result = -1; float bestMatch = Float.MAX_VALUE; for (int count = 0; count < others.length; count++) { float difference = Math.abs(base - others[count]); if (difference < bestMatch) { // new best match found bestMatch = difference; result = count; } if (bestMatch == 0f) { // it does not get better then this break; } } return result; }
java
private int calculateClosest(float base, float[] others) { int result = -1; float bestMatch = Float.MAX_VALUE; for (int count = 0; count < others.length; count++) { float difference = Math.abs(base - others[count]); if (difference < bestMatch) { // new best match found bestMatch = difference; result = count; } if (bestMatch == 0f) { // it does not get better then this break; } } return result; }
[ "private", "int", "calculateClosest", "(", "float", "base", ",", "float", "[", "]", "others", ")", "{", "int", "result", "=", "-", "1", ";", "float", "bestMatch", "=", "Float", ".", "MAX_VALUE", ";", "for", "(", "int", "count", "=", "0", ";", "count"...
Calculate the closest match of the given base float with the list of others.<p> @param base the base float to compare the other with @param others the list of floats to compate to the base @return the array index of the closest match
[ "Calculate", "the", "closest", "match", "of", "the", "given", "base", "float", "with", "the", "list", "of", "others", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/CmsImageScaler.java#L1602-L1619
forge/core
parser-java/impl/src/main/java/org/jboss/forge/addon/parser/java/ui/methods/JavaNewMethodCommandImpl.java
JavaNewMethodCommandImpl.inspectSuperClasses
private MethodSource<JavaClassSource> inspectSuperClasses(UIExecutionContext context, final String type, String name, String[] paramTypes) { Project project = getSelectedProject(context); JavaSource<?> clazz = sourceForName(project, type); if (clazz instanceof JavaClass) { JavaClassSource source = Roaster.parse(JavaClassSource.class, clazz.toString()); MethodSource<JavaClassSource> superClassMethod = source.getMethod(name, paramTypes); if (superClassMethod != null) { return superClassMethod; } if (!source.getSuperType().equals("java.lang.Object")) { return inspectSuperClasses(context, source.getSuperType(), name, paramTypes); } } return null; }
java
private MethodSource<JavaClassSource> inspectSuperClasses(UIExecutionContext context, final String type, String name, String[] paramTypes) { Project project = getSelectedProject(context); JavaSource<?> clazz = sourceForName(project, type); if (clazz instanceof JavaClass) { JavaClassSource source = Roaster.parse(JavaClassSource.class, clazz.toString()); MethodSource<JavaClassSource> superClassMethod = source.getMethod(name, paramTypes); if (superClassMethod != null) { return superClassMethod; } if (!source.getSuperType().equals("java.lang.Object")) { return inspectSuperClasses(context, source.getSuperType(), name, paramTypes); } } return null; }
[ "private", "MethodSource", "<", "JavaClassSource", ">", "inspectSuperClasses", "(", "UIExecutionContext", "context", ",", "final", "String", "type", ",", "String", "name", ",", "String", "[", "]", "paramTypes", ")", "{", "Project", "project", "=", "getSelectedProj...
/* Recursively scans the super class hierarchy to find already existing methods with similar signatures in super classes. If an existing method with similar signature is found in super classes returns MethodSource<JavaClassSource> object corresponding to that method. Otherwise null is returned.
[ "/", "*", "Recursively", "scans", "the", "super", "class", "hierarchy", "to", "find", "already", "existing", "methods", "with", "similar", "signatures", "in", "super", "classes", ".", "If", "an", "existing", "method", "with", "similar", "signature", "is", "fou...
train
https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/parser-java/impl/src/main/java/org/jboss/forge/addon/parser/java/ui/methods/JavaNewMethodCommandImpl.java#L206-L231