repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
lessthanoptimal/BoofCV
main/boofcv-calibration/src/main/java/boofcv/alg/geo/selfcalib/SelfCalibrationLinearRotationSingle.java
SelfCalibrationLinearRotationSingle.extractCalibration
private boolean extractCalibration(DMatrixRMaj x , CameraPinhole calibration) { double s = x.data[5]; double cx = calibration.cx = x.data[2]/s; double cy = calibration.cy = x.data[4]/s; double fy = calibration.fy = Math.sqrt(x.data[3]/s-cy*cy); double sk = calibration.skew = (x.data[1]/s-cx*cy)/fy; calibration.fx = Math.sqrt(x.data[0]/s - sk*sk - cx*cx); if( calibration.fx < 0 || calibration.fy < 0 ) return false; if(UtilEjml.isUncountable(fy) || UtilEjml.isUncountable(calibration.fx)) return false; if(UtilEjml.isUncountable(sk)) return false; return true; }
java
private boolean extractCalibration(DMatrixRMaj x , CameraPinhole calibration) { double s = x.data[5]; double cx = calibration.cx = x.data[2]/s; double cy = calibration.cy = x.data[4]/s; double fy = calibration.fy = Math.sqrt(x.data[3]/s-cy*cy); double sk = calibration.skew = (x.data[1]/s-cx*cy)/fy; calibration.fx = Math.sqrt(x.data[0]/s - sk*sk - cx*cx); if( calibration.fx < 0 || calibration.fy < 0 ) return false; if(UtilEjml.isUncountable(fy) || UtilEjml.isUncountable(calibration.fx)) return false; if(UtilEjml.isUncountable(sk)) return false; return true; }
[ "private", "boolean", "extractCalibration", "(", "DMatrixRMaj", "x", ",", "CameraPinhole", "calibration", ")", "{", "double", "s", "=", "x", ".", "data", "[", "5", "]", ";", "double", "cx", "=", "calibration", ".", "cx", "=", "x", ".", "data", "[", "2"...
Extracts camera parameters from the solution. Checks for errors
[ "Extracts", "camera", "parameters", "from", "the", "solution", ".", "Checks", "for", "errors" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-calibration/src/main/java/boofcv/alg/geo/selfcalib/SelfCalibrationLinearRotationSingle.java#L123-L139
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/AttachedDisk.java
AttachedDisk.of
public static AttachedDisk of(String deviceName, AttachedDiskConfiguration configuration) { return newBuilder(configuration).setDeviceName(deviceName).build(); }
java
public static AttachedDisk of(String deviceName, AttachedDiskConfiguration configuration) { return newBuilder(configuration).setDeviceName(deviceName).build(); }
[ "public", "static", "AttachedDisk", "of", "(", "String", "deviceName", ",", "AttachedDiskConfiguration", "configuration", ")", "{", "return", "newBuilder", "(", "configuration", ")", ".", "setDeviceName", "(", "deviceName", ")", ".", "build", "(", ")", ";", "}" ...
Returns an {@code AttachedDisk} object given the device name and its configuration.
[ "Returns", "an", "{" ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/AttachedDisk.java#L845-L847
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/layout/GridBagLayoutBuilder.java
GridBagLayoutBuilder.appendLabeledField
public GridBagLayoutBuilder appendLabeledField(String propertyName, final JComponent field, LabelOrientation labelOrientation, int colSpan, int rowSpan, boolean expandX, boolean expandY) { JLabel label = createLabel(propertyName); return appendLabeledField(label, field, labelOrientation, colSpan, rowSpan, expandX, expandY); }
java
public GridBagLayoutBuilder appendLabeledField(String propertyName, final JComponent field, LabelOrientation labelOrientation, int colSpan, int rowSpan, boolean expandX, boolean expandY) { JLabel label = createLabel(propertyName); return appendLabeledField(label, field, labelOrientation, colSpan, rowSpan, expandX, expandY); }
[ "public", "GridBagLayoutBuilder", "appendLabeledField", "(", "String", "propertyName", ",", "final", "JComponent", "field", ",", "LabelOrientation", "labelOrientation", ",", "int", "colSpan", ",", "int", "rowSpan", ",", "boolean", "expandX", ",", "boolean", "expandY",...
Appends a label and field to the end of the current line.<p /> The label will be to the left of the field, and be right-justified.<br /> The field will "grow" horizontally as space allows.<p /> @param propertyName the name of the property to create the controls for @param colSpan the number of columns the field should span @return "this" to make it easier to string together append calls
[ "Appends", "a", "label", "and", "field", "to", "the", "end", "of", "the", "current", "line", ".", "<p", "/", ">" ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/layout/GridBagLayoutBuilder.java#L302-L306
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/TableWriteItems.java
TableWriteItems.addHashOnlyPrimaryKeyToDelete
public TableWriteItems addHashOnlyPrimaryKeyToDelete( String hashKeyName, Object hashKeyValue) { this.addPrimaryKeyToDelete(new PrimaryKey(hashKeyName, hashKeyValue)); return this; }
java
public TableWriteItems addHashOnlyPrimaryKeyToDelete( String hashKeyName, Object hashKeyValue) { this.addPrimaryKeyToDelete(new PrimaryKey(hashKeyName, hashKeyValue)); return this; }
[ "public", "TableWriteItems", "addHashOnlyPrimaryKeyToDelete", "(", "String", "hashKeyName", ",", "Object", "hashKeyValue", ")", "{", "this", ".", "addPrimaryKeyToDelete", "(", "new", "PrimaryKey", "(", "hashKeyName", ",", "hashKeyValue", ")", ")", ";", "return", "th...
Adds a hash-only primary key to be deleted in a batch write operation. @param hashKeyName name of the hash key attribute name @param hashKeyValue name of the hash key value @return the current instance for method chaining purposes
[ "Adds", "a", "hash", "-", "only", "primary", "key", "to", "be", "deleted", "in", "a", "batch", "write", "operation", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/TableWriteItems.java#L156-L160
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java
LinkedWorkspaceStorageCacheImpl.removeChildNode
protected NodeData removeChildNode(final String parentIdentifier, final String childIdentifier) { final List<NodeData> childNodes = nodesCache.get(parentIdentifier); if (childNodes != null) { synchronized (childNodes) { // [PN] 17.01.07 for (Iterator<NodeData> i = childNodes.iterator(); i.hasNext();) { NodeData cn = i.next(); if (cn.getIdentifier().equals(childIdentifier)) { i.remove(); return cn; } } } } return null; }
java
protected NodeData removeChildNode(final String parentIdentifier, final String childIdentifier) { final List<NodeData> childNodes = nodesCache.get(parentIdentifier); if (childNodes != null) { synchronized (childNodes) { // [PN] 17.01.07 for (Iterator<NodeData> i = childNodes.iterator(); i.hasNext();) { NodeData cn = i.next(); if (cn.getIdentifier().equals(childIdentifier)) { i.remove(); return cn; } } } } return null; }
[ "protected", "NodeData", "removeChildNode", "(", "final", "String", "parentIdentifier", ",", "final", "String", "childIdentifier", ")", "{", "final", "List", "<", "NodeData", ">", "childNodes", "=", "nodesCache", ".", "get", "(", "parentIdentifier", ")", ";", "i...
Remove child node by id if parent child nodes are cached in CN. @param parentIdentifier - parebt if @param childIdentifier - node id @return removed node or null if node not cached or parent child nodes are not cached
[ "Remove", "child", "node", "by", "id", "if", "parent", "child", "nodes", "are", "cached", "in", "CN", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java#L2099-L2118
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/ZipUtil.java
ZipUtil.addEntry
public static void addEntry(File zip, String path, File file, File destZip) { addEntry(zip, new FileSource(path, file), destZip); }
java
public static void addEntry(File zip, String path, File file, File destZip) { addEntry(zip, new FileSource(path, file), destZip); }
[ "public", "static", "void", "addEntry", "(", "File", "zip", ",", "String", "path", ",", "File", "file", ",", "File", "destZip", ")", "{", "addEntry", "(", "zip", ",", "new", "FileSource", "(", "path", ",", "file", ")", ",", "destZip", ")", ";", "}" ]
Copies an existing ZIP file and appends it with one new entry. @param zip an existing ZIP file (only read). @param path new ZIP entry path. @param file new entry to be added. @param destZip new ZIP file created.
[ "Copies", "an", "existing", "ZIP", "file", "and", "appends", "it", "with", "one", "new", "entry", "." ]
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L2026-L2028
actorapp/actor-platform
actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageScaling.java
ImageScaling.scaleFill
public static void scaleFill(Bitmap src, Bitmap dest, int clearColor) { float ratio = Math.max(dest.getWidth() / (float) src.getWidth(), dest.getHeight() / (float) src.getHeight()); int newW = (int) (src.getWidth() * ratio); int newH = (int) (src.getHeight() * ratio); int paddingTop = (dest.getHeight() - (int) (src.getHeight() * ratio)) / 2; int paddingLeft = (dest.getWidth() - (int) (src.getWidth() * ratio)) / 2; scale(src, dest, clearColor, 0, 0, src.getWidth(), src.getHeight(), paddingLeft, paddingTop, newW + paddingLeft, newH + paddingTop); }
java
public static void scaleFill(Bitmap src, Bitmap dest, int clearColor) { float ratio = Math.max(dest.getWidth() / (float) src.getWidth(), dest.getHeight() / (float) src.getHeight()); int newW = (int) (src.getWidth() * ratio); int newH = (int) (src.getHeight() * ratio); int paddingTop = (dest.getHeight() - (int) (src.getHeight() * ratio)) / 2; int paddingLeft = (dest.getWidth() - (int) (src.getWidth() * ratio)) / 2; scale(src, dest, clearColor, 0, 0, src.getWidth(), src.getHeight(), paddingLeft, paddingTop, newW + paddingLeft, newH + paddingTop); }
[ "public", "static", "void", "scaleFill", "(", "Bitmap", "src", ",", "Bitmap", "dest", ",", "int", "clearColor", ")", "{", "float", "ratio", "=", "Math", ".", "max", "(", "dest", ".", "getWidth", "(", ")", "/", "(", "float", ")", "src", ".", "getWidth...
Scaling src bitmap to fill dest bitmap with centering. Method keep aspect ratio. @param src source bitmap @param dest destination bitmap @param clearColor color for clearing dest before drawing
[ "Scaling", "src", "bitmap", "to", "fill", "dest", "bitmap", "with", "centering", ".", "Method", "keep", "aspect", "ratio", "." ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageScaling.java#L46-L56
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/structures/TopicErrorDatabase.java
TopicErrorDatabase.addTocError
public void addTocError(final BaseTopicWrapper<?> topic, final ErrorType errorType, final String error) { addItem(topic, error, ErrorLevel.ERROR, errorType); }
java
public void addTocError(final BaseTopicWrapper<?> topic, final ErrorType errorType, final String error) { addItem(topic, error, ErrorLevel.ERROR, errorType); }
[ "public", "void", "addTocError", "(", "final", "BaseTopicWrapper", "<", "?", ">", "topic", ",", "final", "ErrorType", "errorType", ",", "final", "String", "error", ")", "{", "addItem", "(", "topic", ",", "error", ",", "ErrorLevel", ".", "ERROR", ",", "erro...
Add a error for a topic that was included in the TOC @param topic @param error
[ "Add", "a", "error", "for", "a", "topic", "that", "was", "included", "in", "the", "TOC" ]
train
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/structures/TopicErrorDatabase.java#L85-L87
OpenLiberty/open-liberty
dev/com.ibm.ws.repository.liberty/src/com/ibm/ws/repository/connections/liberty/MainRepository.java
MainRepository.checkHttpResponseCodeValid
private static void checkHttpResponseCodeValid(URLConnection connection) throws RepositoryHttpException, IOException { // if HTTP URL not File URL if (connection instanceof HttpURLConnection) { HttpURLConnection conn = (HttpURLConnection) connection; conn.setRequestMethod("GET"); int respCode = conn.getResponseCode(); if (respCode < 200 || respCode >= 300) { throw new RepositoryHttpException("HTTP connection returned error code " + respCode, respCode, null); } } }
java
private static void checkHttpResponseCodeValid(URLConnection connection) throws RepositoryHttpException, IOException { // if HTTP URL not File URL if (connection instanceof HttpURLConnection) { HttpURLConnection conn = (HttpURLConnection) connection; conn.setRequestMethod("GET"); int respCode = conn.getResponseCode(); if (respCode < 200 || respCode >= 300) { throw new RepositoryHttpException("HTTP connection returned error code " + respCode, respCode, null); } } }
[ "private", "static", "void", "checkHttpResponseCodeValid", "(", "URLConnection", "connection", ")", "throws", "RepositoryHttpException", ",", "IOException", "{", "// if HTTP URL not File URL", "if", "(", "connection", "instanceof", "HttpURLConnection", ")", "{", "HttpURLCon...
Checks for a valid response code and throws and exception with the response code if an error @param connection @throws RepositoryHttpException @throws IOException
[ "Checks", "for", "a", "valid", "response", "code", "and", "throws", "and", "exception", "with", "the", "response", "code", "if", "an", "error" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository.liberty/src/com/ibm/ws/repository/connections/liberty/MainRepository.java#L263-L273
pushbit/sprockets
src/main/java/net/sf/sprockets/sql/Statements.java
Statements.setInts
public static PreparedStatement setInts(int index, PreparedStatement stmt, int... params) throws SQLException { return set(index, stmt, params, null, null); }
java
public static PreparedStatement setInts(int index, PreparedStatement stmt, int... params) throws SQLException { return set(index, stmt, params, null, null); }
[ "public", "static", "PreparedStatement", "setInts", "(", "int", "index", ",", "PreparedStatement", "stmt", ",", "int", "...", "params", ")", "throws", "SQLException", "{", "return", "set", "(", "index", ",", "stmt", ",", "params", ",", "null", ",", "null", ...
Set the statement parameters, starting at the index, in the order of the params. @since 3.0.0
[ "Set", "the", "statement", "parameters", "starting", "at", "the", "index", "in", "the", "order", "of", "the", "params", "." ]
train
https://github.com/pushbit/sprockets/blob/5d967317cbb2374c69d33271d3c7b7311e1ea4ac/src/main/java/net/sf/sprockets/sql/Statements.java#L60-L63
UrielCh/ovh-java-sdk
ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java
ApiOvhIpLoadbalancing.serviceName_http_frontend_POST
public OvhFrontendHttp serviceName_http_frontend_POST(String serviceName, String[] allowedSource, String[] dedicatedIpfo, Long defaultFarmId, Long defaultSslId, Boolean disabled, String displayName, Boolean hsts, String[] httpHeader, String port, String redirectLocation, Boolean ssl, String zone) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/http/frontend"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "allowedSource", allowedSource); addBody(o, "dedicatedIpfo", dedicatedIpfo); addBody(o, "defaultFarmId", defaultFarmId); addBody(o, "defaultSslId", defaultSslId); addBody(o, "disabled", disabled); addBody(o, "displayName", displayName); addBody(o, "hsts", hsts); addBody(o, "httpHeader", httpHeader); addBody(o, "port", port); addBody(o, "redirectLocation", redirectLocation); addBody(o, "ssl", ssl); addBody(o, "zone", zone); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhFrontendHttp.class); }
java
public OvhFrontendHttp serviceName_http_frontend_POST(String serviceName, String[] allowedSource, String[] dedicatedIpfo, Long defaultFarmId, Long defaultSslId, Boolean disabled, String displayName, Boolean hsts, String[] httpHeader, String port, String redirectLocation, Boolean ssl, String zone) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/http/frontend"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "allowedSource", allowedSource); addBody(o, "dedicatedIpfo", dedicatedIpfo); addBody(o, "defaultFarmId", defaultFarmId); addBody(o, "defaultSslId", defaultSslId); addBody(o, "disabled", disabled); addBody(o, "displayName", displayName); addBody(o, "hsts", hsts); addBody(o, "httpHeader", httpHeader); addBody(o, "port", port); addBody(o, "redirectLocation", redirectLocation); addBody(o, "ssl", ssl); addBody(o, "zone", zone); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhFrontendHttp.class); }
[ "public", "OvhFrontendHttp", "serviceName_http_frontend_POST", "(", "String", "serviceName", ",", "String", "[", "]", "allowedSource", ",", "String", "[", "]", "dedicatedIpfo", ",", "Long", "defaultFarmId", ",", "Long", "defaultSslId", ",", "Boolean", "disabled", ",...
Add a new http frontend on your IP Load Balancing REST: POST /ipLoadbalancing/{serviceName}/http/frontend @param dedicatedIpfo [required] Only attach frontend on these ip. No restriction if null @param redirectLocation [required] HTTP redirection (Ex : http://www.ovh.com) @param port [required] Port(s) attached to your frontend. Supports single port (numerical value), range (2 dash-delimited increasing ports) and comma-separated list of 'single port' and/or 'range'. Each port must be in the [1;49151] range. @param disabled [required] Disable your frontend. Default: 'false' @param defaultFarmId [required] Default HTTP Farm of your frontend @param displayName [required] Human readable name for your frontend, this field is for you @param httpHeader [required] Add header to your frontend. Useful variables admitted : %ci <=> client_ip, %cp <=> client_port @param hsts [required] HTTP Strict Transport Security. Default: 'false' @param allowedSource [required] Restrict IP Load Balancing access to these ip block. No restriction if null @param defaultSslId [required] Default ssl served to your customer @param zone [required] Zone of your frontend. Use "all" for all owned zone. @param ssl [required] SSL deciphering. Default: 'false' @param serviceName [required] The internal name of your IP load balancing
[ "Add", "a", "new", "http", "frontend", "on", "your", "IP", "Load", "Balancing" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L296-L314
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringHelper.java
StringHelper.appendQuoted
public static void appendQuoted (@Nonnull final StringBuilder aTarget, @Nullable final String sSource) { if (sSource == null) aTarget.append ("null"); else aTarget.append ('\'').append (sSource).append ('\''); }
java
public static void appendQuoted (@Nonnull final StringBuilder aTarget, @Nullable final String sSource) { if (sSource == null) aTarget.append ("null"); else aTarget.append ('\'').append (sSource).append ('\''); }
[ "public", "static", "void", "appendQuoted", "(", "@", "Nonnull", "final", "StringBuilder", "aTarget", ",", "@", "Nullable", "final", "String", "sSource", ")", "{", "if", "(", "sSource", "==", "null", ")", "aTarget", ".", "append", "(", "\"null\"", ")", ";"...
Append the provided string quoted or unquoted if it is <code>null</code>. @param aTarget The target to write to. May not be <code>null</code>. @param sSource Source string. May be <code>null</code>. @see #getQuoted(String) @since 9.2.0
[ "Append", "the", "provided", "string", "quoted", "or", "unquoted", "if", "it", "is", "<code", ">", "null<", "/", "code", ">", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L2511-L2517
landawn/AbacusUtil
src/com/landawn/abacus/eventBus/EventBus.java
EventBus.removeStickyEvents
public boolean removeStickyEvents(final Class<?> eventType, final String eventId) { final List<Object> keyToRemove = new ArrayList<>(); synchronized (stickyEventMap) { for (Map.Entry<Object, String> entry : stickyEventMap.entrySet()) { if (N.equals(entry.getValue(), eventId) && eventType.isAssignableFrom(entry.getKey().getClass())) { keyToRemove.add(entry); } } if (N.notNullOrEmpty(keyToRemove)) { synchronized (stickyEventMap) { for (Object event : keyToRemove) { stickyEventMap.remove(event); } this.mapOfStickyEvent = null; } return true; } } return false; }
java
public boolean removeStickyEvents(final Class<?> eventType, final String eventId) { final List<Object> keyToRemove = new ArrayList<>(); synchronized (stickyEventMap) { for (Map.Entry<Object, String> entry : stickyEventMap.entrySet()) { if (N.equals(entry.getValue(), eventId) && eventType.isAssignableFrom(entry.getKey().getClass())) { keyToRemove.add(entry); } } if (N.notNullOrEmpty(keyToRemove)) { synchronized (stickyEventMap) { for (Object event : keyToRemove) { stickyEventMap.remove(event); } this.mapOfStickyEvent = null; } return true; } } return false; }
[ "public", "boolean", "removeStickyEvents", "(", "final", "Class", "<", "?", ">", "eventType", ",", "final", "String", "eventId", ")", "{", "final", "List", "<", "Object", ">", "keyToRemove", "=", "new", "ArrayList", "<>", "(", ")", ";", "synchronized", "("...
Remove the sticky events which can be assigned to specified <code>eventType</code> and posted with the specified <code>eventId</code>. @param eventType @param eventId @return true if one or one more than sticky events are removed, otherwise, <code>false</code>.
[ "Remove", "the", "sticky", "events", "which", "can", "be", "assigned", "to", "specified", "<code", ">", "eventType<", "/", "code", ">", "and", "posted", "with", "the", "specified", "<code", ">", "eventId<", "/", "code", ">", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/eventBus/EventBus.java#L561-L585
codelibs/fess
src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java
FessMessages.addSuccessJobStopped
public FessMessages addSuccessJobStopped(String property, String arg0) { assertPropertyNotNull(property); add(property, new UserMessage(SUCCESS_job_stopped, arg0)); return this; }
java
public FessMessages addSuccessJobStopped(String property, String arg0) { assertPropertyNotNull(property); add(property, new UserMessage(SUCCESS_job_stopped, arg0)); return this; }
[ "public", "FessMessages", "addSuccessJobStopped", "(", "String", "property", ",", "String", "arg0", ")", "{", "assertPropertyNotNull", "(", "property", ")", ";", "add", "(", "property", ",", "new", "UserMessage", "(", "SUCCESS_job_stopped", ",", "arg0", ")", ")"...
Add the created action message for the key 'success.job_stopped' with parameters. <pre> message: Stopped job {0}. </pre> @param property The property name for the message. (NotNull) @param arg0 The parameter arg0 for message. (NotNull) @return this. (NotNull)
[ "Add", "the", "created", "action", "message", "for", "the", "key", "success", ".", "job_stopped", "with", "parameters", ".", "<pre", ">", "message", ":", "Stopped", "job", "{", "0", "}", ".", "<", "/", "pre", ">" ]
train
https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L2420-L2424
osmdroid/osmdroid
osmdroid-android/src/main/java/org/osmdroid/views/Projection.java
Projection.toProjectedPixels
public PointL toProjectedPixels(final double latitude, final double longitude, final PointL reuse) { return toProjectedPixels(latitude, longitude, true, reuse); }
java
public PointL toProjectedPixels(final double latitude, final double longitude, final PointL reuse) { return toProjectedPixels(latitude, longitude, true, reuse); }
[ "public", "PointL", "toProjectedPixels", "(", "final", "double", "latitude", ",", "final", "double", "longitude", ",", "final", "PointL", "reuse", ")", "{", "return", "toProjectedPixels", "(", "latitude", ",", "longitude", ",", "true", ",", "reuse", ")", ";", ...
Performs only the first computationally heavy part of the projection. Call {@link #getLongPixelsFromProjected(PointL, double, boolean, PointL)} to get the final position. @param latitude the latitute of the point @param longitude the longitude of the point @param reuse just pass null if you do not have a PointL to be 'recycled'. @return intermediate value to be stored and passed to toMapPixelsTranslated.
[ "Performs", "only", "the", "first", "computationally", "heavy", "part", "of", "the", "projection", ".", "Call", "{", "@link", "#getLongPixelsFromProjected", "(", "PointL", "double", "boolean", "PointL", ")", "}", "to", "get", "the", "final", "position", "." ]
train
https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/views/Projection.java#L269-L271
powermock/powermock
powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java
PowerMock.createMock
public static synchronized <T> T createMock(Class<T> type, Method... methods) { return doMock(type, false, new DefaultMockStrategy(), null, methods); }
java
public static synchronized <T> T createMock(Class<T> type, Method... methods) { return doMock(type, false, new DefaultMockStrategy(), null, methods); }
[ "public", "static", "synchronized", "<", "T", ">", "T", "createMock", "(", "Class", "<", "T", ">", "type", ",", "Method", "...", "methods", ")", "{", "return", "doMock", "(", "type", ",", "false", ",", "new", "DefaultMockStrategy", "(", ")", ",", "null...
Creates a mock object that supports mocking of final and native methods. @param <T> the type of the mock object @param type the type of the mock object @param methods optionally what methods to mock @return the mock object.
[ "Creates", "a", "mock", "object", "that", "supports", "mocking", "of", "final", "and", "native", "methods", "." ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java#L83-L85
KyoriPowered/text
api/src/main/java/net/kyori/text/TextComponent.java
TextComponent.of
public static TextComponent of(final @NonNull String content, final @Nullable TextColor color, final @NonNull Set<TextDecoration> decorations) { return builder(content).color(color).decorations(decorations, true).build(); }
java
public static TextComponent of(final @NonNull String content, final @Nullable TextColor color, final @NonNull Set<TextDecoration> decorations) { return builder(content).color(color).decorations(decorations, true).build(); }
[ "public", "static", "TextComponent", "of", "(", "final", "@", "NonNull", "String", "content", ",", "final", "@", "Nullable", "TextColor", "color", ",", "final", "@", "NonNull", "Set", "<", "TextDecoration", ">", "decorations", ")", "{", "return", "builder", ...
Creates a text component with content, and optional color and decorations. @param content the plain text content @param color the color @param decorations the decorations @return the text component
[ "Creates", "a", "text", "component", "with", "content", "and", "optional", "color", "and", "decorations", "." ]
train
https://github.com/KyoriPowered/text/blob/4496c593bf89e8fb036dd6efe26f8ac60f7655c9/api/src/main/java/net/kyori/text/TextComponent.java#L177-L179
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/storage/StorageUtil.java
StorageUtil.withStream
public static ResourceMeta withStream(final HasInputStream stream, final Map<String, String> meta) { return new BaseStreamResource(meta,stream); }
java
public static ResourceMeta withStream(final HasInputStream stream, final Map<String, String> meta) { return new BaseStreamResource(meta,stream); }
[ "public", "static", "ResourceMeta", "withStream", "(", "final", "HasInputStream", "stream", ",", "final", "Map", "<", "String", ",", "String", ">", "meta", ")", "{", "return", "new", "BaseStreamResource", "(", "meta", ",", "stream", ")", ";", "}" ]
@return Construct a resource @param stream stream @param meta metadata
[ "@return", "Construct", "a", "resource" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/storage/StorageUtil.java#L100-L102
EdwardRaff/JSAT
JSAT/src/jsat/distributions/kernels/KernelPoints.java
KernelPoints.standardMove
private void standardMove(KernelPoint destination, KernelPoint source) { destination.InvK = source.InvK; destination.InvKExpanded = source.InvKExpanded; destination.K = source.K; destination.KExpanded = source.KExpanded; }
java
private void standardMove(KernelPoint destination, KernelPoint source) { destination.InvK = source.InvK; destination.InvKExpanded = source.InvKExpanded; destination.K = source.K; destination.KExpanded = source.KExpanded; }
[ "private", "void", "standardMove", "(", "KernelPoint", "destination", ",", "KernelPoint", "source", ")", "{", "destination", ".", "InvK", "=", "source", ".", "InvK", ";", "destination", ".", "InvKExpanded", "=", "source", ".", "InvKExpanded", ";", "destination",...
Updates the gram matrix storage of the destination to point at the exact same objects as the ones from the source. @param destination the destination object @param source the source object
[ "Updates", "the", "gram", "matrix", "storage", "of", "the", "destination", "to", "point", "at", "the", "exact", "same", "objects", "as", "the", "ones", "from", "the", "source", "." ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/kernels/KernelPoints.java#L601-L607
krummas/DrizzleJDBC
src/main/java/org/drizzle/jdbc/DrizzleResultSet.java
DrizzleResultSet.updateRowId
public void updateRowId(final String columnLabel, final java.sql.RowId x) throws SQLException { throw SQLExceptionMapper.getFeatureNotSupportedException("Updates are not supported"); }
java
public void updateRowId(final String columnLabel, final java.sql.RowId x) throws SQLException { throw SQLExceptionMapper.getFeatureNotSupportedException("Updates are not supported"); }
[ "public", "void", "updateRowId", "(", "final", "String", "columnLabel", ",", "final", "java", ".", "sql", ".", "RowId", "x", ")", "throws", "SQLException", "{", "throw", "SQLExceptionMapper", ".", "getFeatureNotSupportedException", "(", "\"Updates are not supported\""...
Updates the designated column with a <code>RowId</code> value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code> methods are called to update the database. @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column @param x the column value @throws java.sql.SQLException if the columnLabel is not valid; if a database access error occurs; the result set concurrency is <code>CONCUR_READ_ONLY</code> or this method is called on a closed result set @throws java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support this method @since 1.6
[ "Updates", "the", "designated", "column", "with", "a", "<code", ">", "RowId<", "/", "code", ">", "value", ".", "The", "updater", "methods", "are", "used", "to", "update", "column", "values", "in", "the", "current", "row", "or", "the", "insert", "row", "....
train
https://github.com/krummas/DrizzleJDBC/blob/716f31fd71f3cc289edf69844d8117deb86d98d6/src/main/java/org/drizzle/jdbc/DrizzleResultSet.java#L2457-L2460
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/websphere/servlet/filter/ChainerServlet.java
ChainerServlet.getRequiredInitParameter
String getRequiredInitParameter(String name) throws ServletException { String value = getInitParameter(name); if (value == null) { throw new ServletException(MessageFormat.format(nls.getString("Missing.required.initialization.parameter","Missing required initialization parameter: {0}"), new Object[]{name})); } return value; }
java
String getRequiredInitParameter(String name) throws ServletException { String value = getInitParameter(name); if (value == null) { throw new ServletException(MessageFormat.format(nls.getString("Missing.required.initialization.parameter","Missing required initialization parameter: {0}"), new Object[]{name})); } return value; }
[ "String", "getRequiredInitParameter", "(", "String", "name", ")", "throws", "ServletException", "{", "String", "value", "=", "getInitParameter", "(", "name", ")", ";", "if", "(", "value", "==", "null", ")", "{", "throw", "new", "ServletException", "(", "Messag...
Retrieve a required init parameter by name. @exception javax.servlet.ServletException thrown if the required parameter is not present.
[ "Retrieve", "a", "required", "init", "parameter", "by", "name", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/websphere/servlet/filter/ChainerServlet.java#L153-L160
neoremind/fluent-validator
fluent-validator/src/main/java/com/baidu/unbiz/fluentvalidator/ResultCollectors.java
ResultCollectors.newComplexResult
static <T extends ComplexResult> T newComplexResult(Supplier<T> supplier, ValidationResult result) { T ret = supplier.get(); if (result.isSuccess()) { ret.setIsSuccess(true); } else { ret.setIsSuccess(false); ret.setErrors(result.getErrors()); } ret.setTimeElapsed(result.getTimeElapsed()); return ret; }
java
static <T extends ComplexResult> T newComplexResult(Supplier<T> supplier, ValidationResult result) { T ret = supplier.get(); if (result.isSuccess()) { ret.setIsSuccess(true); } else { ret.setIsSuccess(false); ret.setErrors(result.getErrors()); } ret.setTimeElapsed(result.getTimeElapsed()); return ret; }
[ "static", "<", "T", "extends", "ComplexResult", ">", "T", "newComplexResult", "(", "Supplier", "<", "T", ">", "supplier", ",", "ValidationResult", "result", ")", "{", "T", "ret", "=", "supplier", ".", "get", "(", ")", ";", "if", "(", "result", ".", "is...
{@link #toComplex()}和{@link #toComplex2()}复用的结果生成函数 @param supplier 供给模板 @param result 内部用验证结果 @param <T> 结果的泛型 @return 结果
[ "{", "@link", "#toComplex", "()", "}", "和", "{", "@link", "#toComplex2", "()", "}", "复用的结果生成函数" ]
train
https://github.com/neoremind/fluent-validator/blob/b516970591aa9468b44ba63938b98ec341fd6ead/fluent-validator/src/main/java/com/baidu/unbiz/fluentvalidator/ResultCollectors.java#L81-L92
steveohara/j2mod
src/main/java/com/ghgande/j2mod/modbus/net/AbstractModbusListener.java
AbstractModbusListener.handleRequest
void handleRequest(AbstractModbusTransport transport, AbstractModbusListener listener) throws ModbusIOException { // Get the request from the transport. It will be processed // using an associated process image if (transport == null) { throw new ModbusIOException("No transport specified"); } ModbusRequest request = transport.readRequest(listener); if (request == null) { throw new ModbusIOException("Request for transport %s is invalid (null)", transport.getClass().getSimpleName()); } ModbusResponse response; // Test if Process image exists for this Unit ID ProcessImage spi = getProcessImage(request.getUnitID()); if (spi == null) { response = request.createExceptionResponse(Modbus.ILLEGAL_ADDRESS_EXCEPTION); response.setAuxiliaryType(ModbusResponse.AuxiliaryMessageTypes.UNIT_ID_MISSMATCH); } else { response = request.createResponse(this); } if (logger.isDebugEnabled()) { logger.debug("Request:{}", request.getHexMessage()); if (transport instanceof ModbusRTUTransport && response.getAuxiliaryType() == AuxiliaryMessageTypes.UNIT_ID_MISSMATCH) { logger.debug("Not sending response because it was not meant for us."); } else { logger.debug("Response:{}", response.getHexMessage()); } } // Write the response transport.writeResponse(response); }
java
void handleRequest(AbstractModbusTransport transport, AbstractModbusListener listener) throws ModbusIOException { // Get the request from the transport. It will be processed // using an associated process image if (transport == null) { throw new ModbusIOException("No transport specified"); } ModbusRequest request = transport.readRequest(listener); if (request == null) { throw new ModbusIOException("Request for transport %s is invalid (null)", transport.getClass().getSimpleName()); } ModbusResponse response; // Test if Process image exists for this Unit ID ProcessImage spi = getProcessImage(request.getUnitID()); if (spi == null) { response = request.createExceptionResponse(Modbus.ILLEGAL_ADDRESS_EXCEPTION); response.setAuxiliaryType(ModbusResponse.AuxiliaryMessageTypes.UNIT_ID_MISSMATCH); } else { response = request.createResponse(this); } if (logger.isDebugEnabled()) { logger.debug("Request:{}", request.getHexMessage()); if (transport instanceof ModbusRTUTransport && response.getAuxiliaryType() == AuxiliaryMessageTypes.UNIT_ID_MISSMATCH) { logger.debug("Not sending response because it was not meant for us."); } else { logger.debug("Response:{}", response.getHexMessage()); } } // Write the response transport.writeResponse(response); }
[ "void", "handleRequest", "(", "AbstractModbusTransport", "transport", ",", "AbstractModbusListener", "listener", ")", "throws", "ModbusIOException", "{", "// Get the request from the transport. It will be processed", "// using an associated process image", "if", "(", "transport", "...
Reads the request, checks it is valid and that the unit ID is ok and sends back a response @param transport Transport to read request from @param listener Listener that the request was received by @throws ModbusIOException If there is an issue with the transport or transmission
[ "Reads", "the", "request", "checks", "it", "is", "valid", "and", "that", "the", "unit", "ID", "is", "ok", "and", "sends", "back", "a", "response" ]
train
https://github.com/steveohara/j2mod/blob/67162c55d7c02564e50211a9df06b8314953b5f2/src/main/java/com/ghgande/j2mod/modbus/net/AbstractModbusListener.java#L153-L190
datasift/datasift-java
src/main/java/com/datasift/client/push/DataSiftPush.java
DataSiftPush.validate
public <T extends PushConnector> FutureData<PushValidation> validate(T connector) { FutureData<PushValidation> future = new FutureData<>(); URI uri = newParams().forURL(config.newAPIEndpointURI(VALIDATE)); POST request = config.http().POST(uri, new PageReader(newRequestCallback(future, new PushValidation(), config))) .form("output_type", connector.type().value()); for (Map.Entry<String, String> e : connector.parameters().verifyAndGet().entrySet()) { request.form(e.getKey(), e.getValue()); } performRequest(future, request); return future; }
java
public <T extends PushConnector> FutureData<PushValidation> validate(T connector) { FutureData<PushValidation> future = new FutureData<>(); URI uri = newParams().forURL(config.newAPIEndpointURI(VALIDATE)); POST request = config.http().POST(uri, new PageReader(newRequestCallback(future, new PushValidation(), config))) .form("output_type", connector.type().value()); for (Map.Entry<String, String> e : connector.parameters().verifyAndGet().entrySet()) { request.form(e.getKey(), e.getValue()); } performRequest(future, request); return future; }
[ "public", "<", "T", "extends", "PushConnector", ">", "FutureData", "<", "PushValidation", ">", "validate", "(", "T", "connector", ")", "{", "FutureData", "<", "PushValidation", ">", "future", "=", "new", "FutureData", "<>", "(", ")", ";", "URI", "uri", "="...
/* Check that the subscription details are correct @return the results of the validation
[ "/", "*", "Check", "that", "the", "subscription", "details", "are", "correct" ]
train
https://github.com/datasift/datasift-java/blob/09de124f2a1a507ff6181e59875c6f325290850e/src/main/java/com/datasift/client/push/DataSiftPush.java#L423-L433
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.readFile
public CmsFile readFile(String resourcename, CmsResourceFilter filter) throws CmsException { CmsResource resource = readResource(resourcename, filter); return readFile(resource); }
java
public CmsFile readFile(String resourcename, CmsResourceFilter filter) throws CmsException { CmsResource resource = readResource(resourcename, filter); return readFile(resource); }
[ "public", "CmsFile", "readFile", "(", "String", "resourcename", ",", "CmsResourceFilter", "filter", ")", "throws", "CmsException", "{", "CmsResource", "resource", "=", "readResource", "(", "resourcename", ",", "filter", ")", ";", "return", "readFile", "(", "resour...
Reads a file resource (including it's binary content) from the VFS, using the specified resource filter.<p> In case you do not need the file content, use <code>{@link #readResource(String, CmsResourceFilter)}</code> instead.<p> The specified filter controls what kind of resources should be "found" during the read operation. This will depend on the application. For example, using <code>{@link CmsResourceFilter#DEFAULT}</code> will only return currently "valid" resources, while using <code>{@link CmsResourceFilter#IGNORE_EXPIRATION}</code> will ignore the date release / date expired information of the resource.<p> @param resourcename the name of the resource to read (full current site relative path) @param filter the resource filter to use while reading @return the file resource that was read @throws CmsException if the file resource could not be read for any reason @see #readFile(String) @see #readFile(CmsResource) @see #readResource(String, CmsResourceFilter)
[ "Reads", "a", "file", "resource", "(", "including", "it", "s", "binary", "content", ")", "from", "the", "VFS", "using", "the", "specified", "resource", "filter", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L2560-L2564
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/flow/cdi/FlowScopeBeanHolder.java
FlowScopeBeanHolder.getContextualStorage
public ContextualStorage getContextualStorage(BeanManager beanManager, String flowClientWindowId) { ContextualStorage contextualStorage = storageMap.get(flowClientWindowId); if (contextualStorage == null) { synchronized (this) { contextualStorage = storageMap.get(flowClientWindowId); if (contextualStorage == null) { contextualStorage = new ContextualStorage(beanManager, true, true); storageMap.put(flowClientWindowId, contextualStorage); } } } return contextualStorage; }
java
public ContextualStorage getContextualStorage(BeanManager beanManager, String flowClientWindowId) { ContextualStorage contextualStorage = storageMap.get(flowClientWindowId); if (contextualStorage == null) { synchronized (this) { contextualStorage = storageMap.get(flowClientWindowId); if (contextualStorage == null) { contextualStorage = new ContextualStorage(beanManager, true, true); storageMap.put(flowClientWindowId, contextualStorage); } } } return contextualStorage; }
[ "public", "ContextualStorage", "getContextualStorage", "(", "BeanManager", "beanManager", ",", "String", "flowClientWindowId", ")", "{", "ContextualStorage", "contextualStorage", "=", "storageMap", ".", "get", "(", "flowClientWindowId", ")", ";", "if", "(", "contextualS...
This method will return the ContextualStorage or create a new one if no one is yet assigned to the current flowClientWindowId. @param beanManager we need the CDI {@link BeanManager} for serialisation. @param flowClientWindowId the flowClientWindowId for the current flow.
[ "This", "method", "will", "return", "the", "ContextualStorage", "or", "create", "a", "new", "one", "if", "no", "one", "is", "yet", "assigned", "to", "the", "current", "flowClientWindowId", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/flow/cdi/FlowScopeBeanHolder.java#L104-L121
JoeKerouac/utils
src/main/java/com/joe/utils/collection/CollectionUtil.java
CollectionUtil.clear
public static <K, V> void clear(Map<K, V> map) { if (map != null) { map.clear(); } }
java
public static <K, V> void clear(Map<K, V> map) { if (map != null) { map.clear(); } }
[ "public", "static", "<", "K", ",", "V", ">", "void", "clear", "(", "Map", "<", "K", ",", "V", ">", "map", ")", "{", "if", "(", "map", "!=", "null", ")", "{", "map", ".", "clear", "(", ")", ";", "}", "}" ]
清空map集合 @param map 要清空的集合(可以为null) @param <K> map中key的实际类型 @param <V> map中value的实际类型
[ "清空map集合" ]
train
https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/collection/CollectionUtil.java#L390-L394
landawn/AbacusUtil
src/com/landawn/abacus/util/DateUtil.java
DateUtil.truncatedCompareTo
public static int truncatedCompareTo(final java.util.Date date1, final java.util.Date date2, final int field) { return truncate(date1, field).compareTo(truncate(date2, field)); }
java
public static int truncatedCompareTo(final java.util.Date date1, final java.util.Date date2, final int field) { return truncate(date1, field).compareTo(truncate(date2, field)); }
[ "public", "static", "int", "truncatedCompareTo", "(", "final", "java", ".", "util", ".", "Date", "date1", ",", "final", "java", ".", "util", ".", "Date", "date2", ",", "final", "int", "field", ")", "{", "return", "truncate", "(", "date1", ",", "field", ...
Copied from Apache Commons Lang under Apache License v2. <br /> Determines how two dates compare up to no more than the specified most significant field. @param date1 the first date, not <code>null</code> @param date2 the second date, not <code>null</code> @param field the field from <code>Calendar</code> @return a negative integer, zero, or a positive integer as the first date is less than, equal to, or greater than the second. @throws IllegalArgumentException if any argument is <code>null</code> @see #truncate(Calendar, int) @see #truncatedCompareTo(Date, Date, int) @since 3.0
[ "Copied", "from", "Apache", "Commons", "Lang", "under", "Apache", "License", "v2", ".", "<br", "/", ">" ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/DateUtil.java#L1602-L1604
korpling/ANNIS
annis-service/src/main/java/annis/administration/AdministrationDao.java
AdministrationDao.importCorpus
@Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW, isolation = Isolation.READ_COMMITTED) public boolean importCorpus(String path, String aliasName, boolean overwrite, boolean waitForOtherTasks) { // check schema version first checkDatabaseSchemaVersion(); if (!lockRepositoryMetadataTable(waitForOtherTasks)) { log.error("Another import is currently running"); return false; } // explicitly unset any timeout getJdbcTemplate().update("SET statement_timeout TO 0"); ANNISFormatVersion annisFormatVersion = getANNISFormatVersion(path); if (annisFormatVersion == ANNISFormatVersion.V3_3) { return importVersion4(path, aliasName, overwrite, annisFormatVersion); } else if (annisFormatVersion == ANNISFormatVersion.V3_1 || annisFormatVersion == ANNISFormatVersion.V3_2) { return importVersion3(path, aliasName, overwrite, annisFormatVersion); } log.error("Unknown ANNIS import format version"); return false; }
java
@Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW, isolation = Isolation.READ_COMMITTED) public boolean importCorpus(String path, String aliasName, boolean overwrite, boolean waitForOtherTasks) { // check schema version first checkDatabaseSchemaVersion(); if (!lockRepositoryMetadataTable(waitForOtherTasks)) { log.error("Another import is currently running"); return false; } // explicitly unset any timeout getJdbcTemplate().update("SET statement_timeout TO 0"); ANNISFormatVersion annisFormatVersion = getANNISFormatVersion(path); if (annisFormatVersion == ANNISFormatVersion.V3_3) { return importVersion4(path, aliasName, overwrite, annisFormatVersion); } else if (annisFormatVersion == ANNISFormatVersion.V3_1 || annisFormatVersion == ANNISFormatVersion.V3_2) { return importVersion3(path, aliasName, overwrite, annisFormatVersion); } log.error("Unknown ANNIS import format version"); return false; }
[ "@", "Transactional", "(", "readOnly", "=", "false", ",", "propagation", "=", "Propagation", ".", "REQUIRES_NEW", ",", "isolation", "=", "Isolation", ".", "READ_COMMITTED", ")", "public", "boolean", "importCorpus", "(", "String", "path", ",", "String", "aliasNam...
Reads ANNIS files from several directories. @param path Specifies the path to the corpora, which should be imported. @param aliasName An alias name for this corpus. Can be null. @param overwrite If set to true conflicting top level corpora are deleted. @param waitForOtherTasks If true wait for other tasks to finish, if false abort. @return true if successful
[ "Reads", "ANNIS", "files", "from", "several", "directories", "." ]
train
https://github.com/korpling/ANNIS/blob/152a2e34832e015f73ac8ce8a7d4c32641641324/annis-service/src/main/java/annis/administration/AdministrationDao.java#L534-L568
square/okhttp
mockwebserver/src/main/java/okhttp3/mockwebserver/MockResponse.java
MockResponse.throttleBody
public MockResponse throttleBody(long bytesPerPeriod, long period, TimeUnit unit) { this.throttleBytesPerPeriod = bytesPerPeriod; this.throttlePeriodAmount = period; this.throttlePeriodUnit = unit; return this; }
java
public MockResponse throttleBody(long bytesPerPeriod, long period, TimeUnit unit) { this.throttleBytesPerPeriod = bytesPerPeriod; this.throttlePeriodAmount = period; this.throttlePeriodUnit = unit; return this; }
[ "public", "MockResponse", "throttleBody", "(", "long", "bytesPerPeriod", ",", "long", "period", ",", "TimeUnit", "unit", ")", "{", "this", ".", "throttleBytesPerPeriod", "=", "bytesPerPeriod", ";", "this", ".", "throttlePeriodAmount", "=", "period", ";", "this", ...
Throttles the request reader and response writer to sleep for the given period after each series of {@code bytesPerPeriod} bytes are transferred. Use this to simulate network behavior.
[ "Throttles", "the", "request", "reader", "and", "response", "writer", "to", "sleep", "for", "the", "given", "period", "after", "each", "series", "of", "{" ]
train
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/mockwebserver/src/main/java/okhttp3/mockwebserver/MockResponse.java#L256-L261
michael-rapp/AndroidUtil
library/src/main/java/de/mrapp/android/util/BitmapUtil.java
BitmapUtil.clipSquare
public static Bitmap clipSquare(@NonNull final Bitmap bitmap, final int size, final int borderWidth, @ColorInt final int borderColor) { Condition.INSTANCE.ensureAtLeast(borderWidth, 0, "The border width must be at least 0"); Bitmap clippedBitmap = clipSquare(bitmap, size); Bitmap result = Bitmap.createBitmap(clippedBitmap.getWidth(), clippedBitmap.getHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(result); float offset = borderWidth / 2.0f; Rect src = new Rect(0, 0, clippedBitmap.getWidth(), clippedBitmap.getHeight()); RectF dst = new RectF(offset, offset, result.getWidth() - offset, result.getHeight() - offset); canvas.drawBitmap(clippedBitmap, src, dst, null); if (borderWidth > 0 && Color.alpha(borderColor) != 0) { Paint paint = new Paint(); paint.setFilterBitmap(false); paint.setStyle(Paint.Style.STROKE); paint.setStrokeWidth(borderWidth); paint.setColor(borderColor); offset = borderWidth / 2.0f; RectF bounds = new RectF(offset, offset, result.getWidth() - offset, result.getWidth() - offset); canvas.drawRect(bounds, paint); } return result; }
java
public static Bitmap clipSquare(@NonNull final Bitmap bitmap, final int size, final int borderWidth, @ColorInt final int borderColor) { Condition.INSTANCE.ensureAtLeast(borderWidth, 0, "The border width must be at least 0"); Bitmap clippedBitmap = clipSquare(bitmap, size); Bitmap result = Bitmap.createBitmap(clippedBitmap.getWidth(), clippedBitmap.getHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(result); float offset = borderWidth / 2.0f; Rect src = new Rect(0, 0, clippedBitmap.getWidth(), clippedBitmap.getHeight()); RectF dst = new RectF(offset, offset, result.getWidth() - offset, result.getHeight() - offset); canvas.drawBitmap(clippedBitmap, src, dst, null); if (borderWidth > 0 && Color.alpha(borderColor) != 0) { Paint paint = new Paint(); paint.setFilterBitmap(false); paint.setStyle(Paint.Style.STROKE); paint.setStrokeWidth(borderWidth); paint.setColor(borderColor); offset = borderWidth / 2.0f; RectF bounds = new RectF(offset, offset, result.getWidth() - offset, result.getWidth() - offset); canvas.drawRect(bounds, paint); } return result; }
[ "public", "static", "Bitmap", "clipSquare", "(", "@", "NonNull", "final", "Bitmap", "bitmap", ",", "final", "int", "size", ",", "final", "int", "borderWidth", ",", "@", "ColorInt", "final", "int", "borderColor", ")", "{", "Condition", ".", "INSTANCE", ".", ...
Clips the long edge of a bitmap, if its width and height are not equal, in order to transform it into a square. Additionally, the bitmap is resized to a specific size and a border will be added. @param bitmap The bitmap, which should be clipped, as an instance of the class {@link Bitmap}. The bitmap may not be null @param size The size, the bitmap should be resized to, as an {@link Integer} value in pixels. The size must be at least 1 @param borderWidth The width of the border as an {@link Integer} value in pixels. The width must be at least 0 @param borderColor The color of the border as an {@link Integer} value @return The clipped bitmap as an instance of the class {@link Bitmap}
[ "Clips", "the", "long", "edge", "of", "a", "bitmap", "if", "its", "width", "and", "height", "are", "not", "equal", "in", "order", "to", "transform", "it", "into", "a", "square", ".", "Additionally", "the", "bitmap", "is", "resized", "to", "a", "specific"...
train
https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/BitmapUtil.java#L311-L337
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/JarURLConnection.java
JarURLConnection.parseSpecs
private void parseSpecs(URL url) throws MalformedURLException { String spec = url.getFile(); int separator = spec.indexOf("!/"); /* * REMIND: we don't handle nested JAR URLs */ if (separator == -1) { throw new MalformedURLException("no !/ found in url spec:" + spec); } jarFileURL = new URL(spec.substring(0, separator++)); entryName = null; /* if ! is the last letter of the innerURL, entryName is null */ if (++separator != spec.length()) { entryName = spec.substring(separator, spec.length()); entryName = ParseUtil.decode (entryName); } }
java
private void parseSpecs(URL url) throws MalformedURLException { String spec = url.getFile(); int separator = spec.indexOf("!/"); /* * REMIND: we don't handle nested JAR URLs */ if (separator == -1) { throw new MalformedURLException("no !/ found in url spec:" + spec); } jarFileURL = new URL(spec.substring(0, separator++)); entryName = null; /* if ! is the last letter of the innerURL, entryName is null */ if (++separator != spec.length()) { entryName = spec.substring(separator, spec.length()); entryName = ParseUtil.decode (entryName); } }
[ "private", "void", "parseSpecs", "(", "URL", "url", ")", "throws", "MalformedURLException", "{", "String", "spec", "=", "url", ".", "getFile", "(", ")", ";", "int", "separator", "=", "spec", ".", "indexOf", "(", "\"!/\"", ")", ";", "/*\n * REMIND: we...
/* get the specs for a given url out of the cache, and compute and cache them if they're not there.
[ "/", "*", "get", "the", "specs", "for", "a", "given", "url", "out", "of", "the", "cache", "and", "compute", "and", "cache", "them", "if", "they", "re", "not", "there", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/JarURLConnection.java#L164-L183
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDataSomeValuesFromImpl_CustomFieldSerializer.java
OWLDataSomeValuesFromImpl_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLDataSomeValuesFromImpl instance) throws SerializationException { deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLDataSomeValuesFromImpl instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLDataSomeValuesFromImpl", "instance", ")", "throws", "SerializationException", "{", "deserialize", "(", "streamReader", ",", "instance", ")", ";", "}" ]
Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful
[ "Deserializes", "the", "content", "of", "the", "object", "from", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamReader", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDataSomeValuesFromImpl_CustomFieldSerializer.java#L93-L96
alkacon/opencms-core
src-modules/org/opencms/workplace/explorer/CmsExplorer.java
CmsExplorer.getWorkplaceExplorerLink
public static String getWorkplaceExplorerLink(final CmsObject cms, final String explorerRootPath) { // split the root site: StringBuffer siteRoot = new StringBuffer(); StringBuffer path = new StringBuffer('/'); Scanner scanner = new Scanner(explorerRootPath); scanner.useDelimiter("/"); int count = 0; while (scanner.hasNext()) { if (count < 2) { siteRoot.append('/').append(scanner.next()); } else { if (count == 2) { path.append('/'); } path.append(scanner.next()); path.append('/'); } count++; } String targetSiteRoot = siteRoot.toString(); String targetVfsFolder = path.toString(); // build the link StringBuilder link2Source = new StringBuilder(); link2Source.append("/system/workplace/views/workplace.jsp?"); link2Source.append(CmsWorkplace.PARAM_WP_EXPLORER_RESOURCE); link2Source.append("="); link2Source.append(targetVfsFolder); link2Source.append("&"); link2Source.append(CmsFrameset.PARAM_WP_VIEW); link2Source.append("="); link2Source.append( OpenCms.getLinkManager().substituteLinkForUnknownTarget( cms, "/system/workplace/views/explorer/explorer_fs.jsp")); link2Source.append("&"); link2Source.append(CmsWorkplace.PARAM_WP_SITE); link2Source.append("="); link2Source.append(targetSiteRoot); String result = link2Source.toString(); result = OpenCms.getLinkManager().substituteLinkForUnknownTarget(cms, result); return result; }
java
public static String getWorkplaceExplorerLink(final CmsObject cms, final String explorerRootPath) { // split the root site: StringBuffer siteRoot = new StringBuffer(); StringBuffer path = new StringBuffer('/'); Scanner scanner = new Scanner(explorerRootPath); scanner.useDelimiter("/"); int count = 0; while (scanner.hasNext()) { if (count < 2) { siteRoot.append('/').append(scanner.next()); } else { if (count == 2) { path.append('/'); } path.append(scanner.next()); path.append('/'); } count++; } String targetSiteRoot = siteRoot.toString(); String targetVfsFolder = path.toString(); // build the link StringBuilder link2Source = new StringBuilder(); link2Source.append("/system/workplace/views/workplace.jsp?"); link2Source.append(CmsWorkplace.PARAM_WP_EXPLORER_RESOURCE); link2Source.append("="); link2Source.append(targetVfsFolder); link2Source.append("&"); link2Source.append(CmsFrameset.PARAM_WP_VIEW); link2Source.append("="); link2Source.append( OpenCms.getLinkManager().substituteLinkForUnknownTarget( cms, "/system/workplace/views/explorer/explorer_fs.jsp")); link2Source.append("&"); link2Source.append(CmsWorkplace.PARAM_WP_SITE); link2Source.append("="); link2Source.append(targetSiteRoot); String result = link2Source.toString(); result = OpenCms.getLinkManager().substituteLinkForUnknownTarget(cms, result); return result; }
[ "public", "static", "String", "getWorkplaceExplorerLink", "(", "final", "CmsObject", "cms", ",", "final", "String", "explorerRootPath", ")", "{", "// split the root site:", "StringBuffer", "siteRoot", "=", "new", "StringBuffer", "(", ")", ";", "StringBuffer", "path", ...
Creates a link for the OpenCms workplace that will reload the whole workplace, switch to the explorer view, the site of the given explorerRootPath and show the folder given in the explorerRootPath. <p> @param cms the cms object @param explorerRootPath a root relative folder link (has to end with '/'). @return a link for the OpenCms workplace that will reload the whole workplace, switch to the explorer view, the site of the given explorerRootPath and show the folder given in the explorerRootPath.
[ "Creates", "a", "link", "for", "the", "OpenCms", "workplace", "that", "will", "reload", "the", "whole", "workplace", "switch", "to", "the", "explorer", "view", "the", "site", "of", "the", "given", "explorerRootPath", "and", "show", "the", "folder", "given", ...
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/explorer/CmsExplorer.java#L154-L197
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalDate.java
LocalDate.plusYears
public LocalDate plusYears(long yearsToAdd) { if (yearsToAdd == 0) { return this; } int newYear = YEAR.checkValidIntValue(year + yearsToAdd); // safe overflow return resolvePreviousValid(newYear, month, day); }
java
public LocalDate plusYears(long yearsToAdd) { if (yearsToAdd == 0) { return this; } int newYear = YEAR.checkValidIntValue(year + yearsToAdd); // safe overflow return resolvePreviousValid(newYear, month, day); }
[ "public", "LocalDate", "plusYears", "(", "long", "yearsToAdd", ")", "{", "if", "(", "yearsToAdd", "==", "0", ")", "{", "return", "this", ";", "}", "int", "newYear", "=", "YEAR", ".", "checkValidIntValue", "(", "year", "+", "yearsToAdd", ")", ";", "// saf...
Returns a copy of this {@code LocalDate} with the specified number of years added. <p> This method adds the specified amount to the years field in three steps: <ol> <li>Add the input years to the year field</li> <li>Check if the resulting date would be invalid</li> <li>Adjust the day-of-month to the last valid day if necessary</li> </ol> <p> For example, 2008-02-29 (leap year) plus one year would result in the invalid date 2009-02-29 (standard year). Instead of returning an invalid result, the last valid day of the month, 2009-02-28, is selected instead. <p> This instance is immutable and unaffected by this method call. @param yearsToAdd the years to add, may be negative @return a {@code LocalDate} based on this date with the years added, not null @throws DateTimeException if the result exceeds the supported date range
[ "Returns", "a", "copy", "of", "this", "{", "@code", "LocalDate", "}", "with", "the", "specified", "number", "of", "years", "added", ".", "<p", ">", "This", "method", "adds", "the", "specified", "amount", "to", "the", "years", "field", "in", "three", "ste...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalDate.java#L1267-L1273
beanshell/beanshell
src/main/java/bsh/engine/BshScriptEngine.java
BshScriptEngine.invokeFunction
@Override public Object invokeFunction(String name, Object... args) throws ScriptException, NoSuchMethodException { return invokeMethod(getGlobal(), name, args); }
java
@Override public Object invokeFunction(String name, Object... args) throws ScriptException, NoSuchMethodException { return invokeMethod(getGlobal(), name, args); }
[ "@", "Override", "public", "Object", "invokeFunction", "(", "String", "name", ",", "Object", "...", "args", ")", "throws", "ScriptException", ",", "NoSuchMethodException", "{", "return", "invokeMethod", "(", "getGlobal", "(", ")", ",", "name", ",", "args", ")"...
Same as invoke(Object, String, Object...) with {@code null} as the first argument. Used to call top-level procedures defined in scripts. @param args Arguments to pass to the procedure @return The value returned by the procedure @throws javax.script.ScriptException if an error occurrs during invocation of the method. @throws NoSuchMethodException if method with given name or matching argument types cannot be found. @throws NullPointerException if method name is null.
[ "Same", "as", "invoke", "(", "Object", "String", "Object", "...", ")", "with", "{", "@code", "null", "}", "as", "the", "first", "argument", ".", "Used", "to", "call", "top", "-", "level", "procedures", "defined", "in", "scripts", "." ]
train
https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/engine/BshScriptEngine.java#L302-L305
j256/ormlite-core
src/main/java/com/j256/ormlite/table/TableUtils.java
TableUtils.clearTable
public static <T> int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig) throws SQLException { return clearTable(connectionSource, tableConfig.getTableName()); }
java
public static <T> int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig) throws SQLException { return clearTable(connectionSource, tableConfig.getTableName()); }
[ "public", "static", "<", "T", ">", "int", "clearTable", "(", "ConnectionSource", "connectionSource", ",", "DatabaseTableConfig", "<", "T", ">", "tableConfig", ")", "throws", "SQLException", "{", "return", "clearTable", "(", "connectionSource", ",", "tableConfig", ...
Clear all data out of the table. For certain database types and with large sized tables, which may take a long time. In some configurations, it may be faster to drop and re-create the table. <p> <b>WARNING:</b> This is [obviously] very destructive and is unrecoverable. </p>
[ "Clear", "all", "data", "out", "of", "the", "table", ".", "For", "certain", "database", "types", "and", "with", "large", "sized", "tables", "which", "may", "take", "a", "long", "time", ".", "In", "some", "configurations", "it", "may", "be", "faster", "to...
train
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/table/TableUtils.java#L249-L252
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/CentralAnalyzer.java
CentralAnalyzer.prepareFileTypeAnalyzer
@Override public void prepareFileTypeAnalyzer(Engine engine) throws InitializationException { LOGGER.debug("Initializing Central analyzer"); LOGGER.debug("Central analyzer enabled: {}", isEnabled()); if (isEnabled()) { try { searcher = new CentralSearch(getSettings()); } catch (MalformedURLException ex) { setEnabled(false); throw new InitializationException("The configured URL to Maven Central is malformed", ex); } } }
java
@Override public void prepareFileTypeAnalyzer(Engine engine) throws InitializationException { LOGGER.debug("Initializing Central analyzer"); LOGGER.debug("Central analyzer enabled: {}", isEnabled()); if (isEnabled()) { try { searcher = new CentralSearch(getSettings()); } catch (MalformedURLException ex) { setEnabled(false); throw new InitializationException("The configured URL to Maven Central is malformed", ex); } } }
[ "@", "Override", "public", "void", "prepareFileTypeAnalyzer", "(", "Engine", "engine", ")", "throws", "InitializationException", "{", "LOGGER", ".", "debug", "(", "\"Initializing Central analyzer\"", ")", ";", "LOGGER", ".", "debug", "(", "\"Central analyzer enabled: {}...
Initializes the analyzer once before any analysis is performed. @param engine a reference to the dependency-check engine @throws InitializationException if there's an error during initialization
[ "Initializes", "the", "analyzer", "once", "before", "any", "analysis", "is", "performed", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/CentralAnalyzer.java#L161-L173
querydsl/querydsl
querydsl-collections/src/main/java/com/querydsl/collections/AbstractCollQuery.java
AbstractCollQuery.from
public <A> Q from(Path<A> entity, Iterable<? extends A> col) { iterables.put(entity, col); getMetadata().addJoin(JoinType.DEFAULT, entity); return queryMixin.getSelf(); }
java
public <A> Q from(Path<A> entity, Iterable<? extends A> col) { iterables.put(entity, col); getMetadata().addJoin(JoinType.DEFAULT, entity); return queryMixin.getSelf(); }
[ "public", "<", "A", ">", "Q", "from", "(", "Path", "<", "A", ">", "entity", ",", "Iterable", "<", "?", "extends", "A", ">", "col", ")", "{", "iterables", ".", "put", "(", "entity", ",", "col", ")", ";", "getMetadata", "(", ")", ".", "addJoin", ...
Add a query source @param <A> type of expression @param entity Path for the source @param col content of the source @return current object
[ "Add", "a", "query", "source" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-collections/src/main/java/com/querydsl/collections/AbstractCollQuery.java#L76-L80
netty/netty
common/src/main/java/io/netty/util/internal/ThreadLocalRandom.java
ThreadLocalRandom.nextInt
public int nextInt(int least, int bound) { if (least >= bound) { throw new IllegalArgumentException(); } return nextInt(bound - least) + least; }
java
public int nextInt(int least, int bound) { if (least >= bound) { throw new IllegalArgumentException(); } return nextInt(bound - least) + least; }
[ "public", "int", "nextInt", "(", "int", "least", ",", "int", "bound", ")", "{", "if", "(", "least", ">=", "bound", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "return", "nextInt", "(", "bound", "-", "least", ")", "+", "l...
Returns a pseudorandom, uniformly distributed value between the given least value (inclusive) and bound (exclusive). @param least the least value returned @param bound the upper bound (exclusive) @throws IllegalArgumentException if least greater than or equal to bound @return the next value
[ "Returns", "a", "pseudorandom", "uniformly", "distributed", "value", "between", "the", "given", "least", "value", "(", "inclusive", ")", "and", "bound", "(", "exclusive", ")", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/ThreadLocalRandom.java#L296-L301
looly/hutool
hutool-core/src/main/java/cn/hutool/core/bean/copier/BeanCopier.java
BeanCopier.create
public static <T> BeanCopier<T> create(Object source, T dest, CopyOptions copyOptions) { return create(source, dest, dest.getClass(), copyOptions); }
java
public static <T> BeanCopier<T> create(Object source, T dest, CopyOptions copyOptions) { return create(source, dest, dest.getClass(), copyOptions); }
[ "public", "static", "<", "T", ">", "BeanCopier", "<", "T", ">", "create", "(", "Object", "source", ",", "T", "dest", ",", "CopyOptions", "copyOptions", ")", "{", "return", "create", "(", "source", ",", "dest", ",", "dest", ".", "getClass", "(", ")", ...
创建BeanCopier @param <T> 目标Bean类型 @param source 来源对象,可以是Bean或者Map @param dest 目标Bean对象 @param copyOptions 拷贝属性选项 @return BeanCopier
[ "创建BeanCopier" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/copier/BeanCopier.java#L54-L56
pedrovgs/Nox
nox/src/main/java/com/github/pedrovgs/nox/NoxView.java
NoxView.drawNoxItemDrawable
private void drawNoxItemDrawable(Canvas canvas, int left, int top, Drawable drawable) { if (drawable != null) { int itemSize = (int) noxConfig.getNoxItemSize(); drawable.setBounds(left, top, left + itemSize, top + itemSize); drawable.draw(canvas); } }
java
private void drawNoxItemDrawable(Canvas canvas, int left, int top, Drawable drawable) { if (drawable != null) { int itemSize = (int) noxConfig.getNoxItemSize(); drawable.setBounds(left, top, left + itemSize, top + itemSize); drawable.draw(canvas); } }
[ "private", "void", "drawNoxItemDrawable", "(", "Canvas", "canvas", ",", "int", "left", ",", "int", "top", ",", "Drawable", "drawable", ")", "{", "if", "(", "drawable", "!=", "null", ")", "{", "int", "itemSize", "=", "(", "int", ")", "noxConfig", ".", "...
Draws a NoxItem drawable during the onDraw method given a canvas object and all the information needed to draw the Drawable passed as parameter.
[ "Draws", "a", "NoxItem", "drawable", "during", "the", "onDraw", "method", "given", "a", "canvas", "object", "and", "all", "the", "information", "needed", "to", "draw", "the", "Drawable", "passed", "as", "parameter", "." ]
train
https://github.com/pedrovgs/Nox/blob/b4dfe37895e1b7bf2084d60139931dd4fb12f3f4/nox/src/main/java/com/github/pedrovgs/nox/NoxView.java#L353-L359
iipc/webarchive-commons
src/main/java/org/archive/format/http/HttpHeaders.java
HttpHeaders.set
public void set(String name, String value) { HttpHeader header = get(name); if(header == null) { add(name,value); } else { header.setValue(value); } }
java
public void set(String name, String value) { HttpHeader header = get(name); if(header == null) { add(name,value); } else { header.setValue(value); } }
[ "public", "void", "set", "(", "String", "name", ",", "String", "value", ")", "{", "HttpHeader", "header", "=", "get", "(", "name", ")", ";", "if", "(", "header", "==", "null", ")", "{", "add", "(", "name", ",", "value", ")", ";", "}", "else", "{"...
Add a new Header with the given name/value, or replace an existing value if a Header already exists with name @param name @param value
[ "Add", "a", "new", "Header", "with", "the", "given", "name", "/", "value", "or", "replace", "an", "existing", "value", "if", "a", "Header", "already", "exists", "with", "name" ]
train
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/format/http/HttpHeaders.java#L120-L127
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/task/DataSinkTask.java
DataSinkTask.initInputReaders
@SuppressWarnings("unchecked") private void initInputReaders() throws Exception { MutableReader<?> inputReader; int numGates = 0; // ---------------- create the input readers --------------------- // in case where a logical input unions multiple physical inputs, create a union reader final int groupSize = this.config.getGroupSize(0); numGates += groupSize; if (groupSize == 1) { // non-union case inputReader = new MutableRecordReader<DeserializationDelegate<IT>>(this); } else if (groupSize > 1){ // union case MutableRecordReader<IOReadableWritable>[] readers = new MutableRecordReader[groupSize]; for (int j = 0; j < groupSize; ++j) { readers[j] = new MutableRecordReader<IOReadableWritable>(this); } inputReader = new MutableUnionRecordReader<IOReadableWritable>(readers); } else { throw new Exception("Illegal input group size in task configuration: " + groupSize); } this.inputTypeSerializerFactory = this.config.getInputSerializer(0, this.userCodeClassLoader); if (this.inputTypeSerializerFactory.getDataType() == Record.class) { // record specific deserialization MutableReader<Record> reader = (MutableReader<Record>) inputReader; this.reader = (MutableObjectIterator<IT>)new RecordReaderIterator(reader); } else { // generic data type serialization MutableReader<DeserializationDelegate<?>> reader = (MutableReader<DeserializationDelegate<?>>) inputReader; @SuppressWarnings({ "rawtypes" }) final MutableObjectIterator<?> iter = new ReaderIterator(reader, this.inputTypeSerializerFactory.getSerializer()); this.reader = (MutableObjectIterator<IT>)iter; } // final sanity check if (numGates != this.config.getNumInputs()) { throw new Exception("Illegal configuration: Number of input gates and group sizes are not consistent."); } }
java
@SuppressWarnings("unchecked") private void initInputReaders() throws Exception { MutableReader<?> inputReader; int numGates = 0; // ---------------- create the input readers --------------------- // in case where a logical input unions multiple physical inputs, create a union reader final int groupSize = this.config.getGroupSize(0); numGates += groupSize; if (groupSize == 1) { // non-union case inputReader = new MutableRecordReader<DeserializationDelegate<IT>>(this); } else if (groupSize > 1){ // union case MutableRecordReader<IOReadableWritable>[] readers = new MutableRecordReader[groupSize]; for (int j = 0; j < groupSize; ++j) { readers[j] = new MutableRecordReader<IOReadableWritable>(this); } inputReader = new MutableUnionRecordReader<IOReadableWritable>(readers); } else { throw new Exception("Illegal input group size in task configuration: " + groupSize); } this.inputTypeSerializerFactory = this.config.getInputSerializer(0, this.userCodeClassLoader); if (this.inputTypeSerializerFactory.getDataType() == Record.class) { // record specific deserialization MutableReader<Record> reader = (MutableReader<Record>) inputReader; this.reader = (MutableObjectIterator<IT>)new RecordReaderIterator(reader); } else { // generic data type serialization MutableReader<DeserializationDelegate<?>> reader = (MutableReader<DeserializationDelegate<?>>) inputReader; @SuppressWarnings({ "rawtypes" }) final MutableObjectIterator<?> iter = new ReaderIterator(reader, this.inputTypeSerializerFactory.getSerializer()); this.reader = (MutableObjectIterator<IT>)iter; } // final sanity check if (numGates != this.config.getNumInputs()) { throw new Exception("Illegal configuration: Number of input gates and group sizes are not consistent."); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "void", "initInputReaders", "(", ")", "throws", "Exception", "{", "MutableReader", "<", "?", ">", "inputReader", ";", "int", "numGates", "=", "0", ";", "// ---------------- create the input readers ------...
Initializes the input readers of the DataSinkTask. @throws RuntimeException Thrown in case of invalid task input configuration.
[ "Initializes", "the", "input", "readers", "of", "the", "DataSinkTask", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/task/DataSinkTask.java#L310-L353
tempodb/tempodb-java
src/main/java/com/tempodb/Client.java
Client.readSingleValue
public Cursor<SingleValue> readSingleValue(Filter filter, DateTime timestamp) { return readSingleValue(filter, timestamp, DateTimeZone.getDefault(), Direction.EXACT); }
java
public Cursor<SingleValue> readSingleValue(Filter filter, DateTime timestamp) { return readSingleValue(filter, timestamp, DateTimeZone.getDefault(), Direction.EXACT); }
[ "public", "Cursor", "<", "SingleValue", ">", "readSingleValue", "(", "Filter", "filter", ",", "DateTime", "timestamp", ")", "{", "return", "readSingleValue", "(", "filter", ",", "timestamp", ",", "DateTimeZone", ".", "getDefault", "(", ")", ",", "Direction", "...
Returns a cursor of single value for a set of series <p>The returned values (datapoints) can be null if there are no datapoints in the series or in the specified direction. The system default timezone is used. The direction is set to EXACT. @param filter The filter of series to read from @param timestamp The timestamp to read a value at @return A cursor over the values at the specified timestamp @see Cursor @see SingleValue @since 1.1.0
[ "Returns", "a", "cursor", "of", "single", "value", "for", "a", "set", "of", "series", "<p", ">", "The", "returned", "values", "(", "datapoints", ")", "can", "be", "null", "if", "there", "are", "no", "datapoints", "in", "the", "series", "or", "in", "the...
train
https://github.com/tempodb/tempodb-java/blob/5733f204fe4c8dda48916ba1f67cf44f5a3f9c69/src/main/java/com/tempodb/Client.java#L490-L492
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/Workitem.java
Workitem.createEffort
public Effort createEffort(double value, Member member) { return createEffort(value, member, DateTime.now()); }
java
public Effort createEffort(double value, Member member) { return createEffort(value, member, DateTime.now()); }
[ "public", "Effort", "createEffort", "(", "double", "value", ",", "Member", "member", ")", "{", "return", "createEffort", "(", "value", ",", "member", ",", "DateTime", ".", "now", "(", ")", ")", ";", "}" ]
Log an effort record against this workitem with the current day and time and given member and value. @param member The subject of the Effort. @param value if the Effort. @return created Effort record. @throws IllegalStateException if Effort tracking is not enabled.
[ "Log", "an", "effort", "record", "against", "this", "workitem", "with", "the", "current", "day", "and", "time", "and", "given", "member", "and", "value", "." ]
train
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/Workitem.java#L156-L158
owetterau/neo4j-websockets
client/src/main/java/de/oliverwetterau/neo4j/websockets/client/web/WebSocketHandler.java
WebSocketHandler.handleTransportError
@Override public void handleTransportError(final WebSocketSession webSocketSession, final Throwable exception) throws Exception { if (exception != null) { logger.error("[handleTransportError]", exception); } }
java
@Override public void handleTransportError(final WebSocketSession webSocketSession, final Throwable exception) throws Exception { if (exception != null) { logger.error("[handleTransportError]", exception); } }
[ "@", "Override", "public", "void", "handleTransportError", "(", "final", "WebSocketSession", "webSocketSession", ",", "final", "Throwable", "exception", ")", "throws", "Exception", "{", "if", "(", "exception", "!=", "null", ")", "{", "logger", ".", "error", "(",...
Handles websocket transport errors @param webSocketSession websocket session where the error appeared @param exception exception that occured @throws Exception transport error exception
[ "Handles", "websocket", "transport", "errors" ]
train
https://github.com/owetterau/neo4j-websockets/blob/ca3481066819d01169873aeb145ab3bf5c736afe/client/src/main/java/de/oliverwetterau/neo4j/websockets/client/web/WebSocketHandler.java#L187-L192
mpetazzoni/ttorrent
ttorrent-tracker/src/main/java/com/turn/ttorrent/tracker/TrackerRequestProcessor.java
TrackerRequestProcessor.parseQuery
private HTTPAnnounceRequestMessage parseQuery(final String uri, final String hostAddress) throws IOException, MessageValidationException { Map<String, BEValue> params = new HashMap<String, BEValue>(); try { // String uri = request.getAddress().toString(); for (String pair : uri.split("[?]")[1].split("&")) { String[] keyval = pair.split("[=]", 2); if (keyval.length == 1) { this.recordParam(params, keyval[0], null); } else { this.recordParam(params, keyval[0], keyval[1]); } } } catch (ArrayIndexOutOfBoundsException e) { params.clear(); } // Make sure we have the peer IP, fallbacking on the request's source // address if the peer didn't provide it. if (params.get("ip") == null) { params.put("ip", new BEValue( hostAddress, Constants.BYTE_ENCODING)); } return HTTPAnnounceRequestMessage.parse(new BEValue(params)); }
java
private HTTPAnnounceRequestMessage parseQuery(final String uri, final String hostAddress) throws IOException, MessageValidationException { Map<String, BEValue> params = new HashMap<String, BEValue>(); try { // String uri = request.getAddress().toString(); for (String pair : uri.split("[?]")[1].split("&")) { String[] keyval = pair.split("[=]", 2); if (keyval.length == 1) { this.recordParam(params, keyval[0], null); } else { this.recordParam(params, keyval[0], keyval[1]); } } } catch (ArrayIndexOutOfBoundsException e) { params.clear(); } // Make sure we have the peer IP, fallbacking on the request's source // address if the peer didn't provide it. if (params.get("ip") == null) { params.put("ip", new BEValue( hostAddress, Constants.BYTE_ENCODING)); } return HTTPAnnounceRequestMessage.parse(new BEValue(params)); }
[ "private", "HTTPAnnounceRequestMessage", "parseQuery", "(", "final", "String", "uri", ",", "final", "String", "hostAddress", ")", "throws", "IOException", ",", "MessageValidationException", "{", "Map", "<", "String", ",", "BEValue", ">", "params", "=", "new", "Has...
Parse the query parameters using our defined BYTE_ENCODING. <p> <p> Because we're expecting byte-encoded strings as query parameters, we can't rely on SimpleHTTP's QueryParser which uses the wrong encoding for the job and returns us unparsable byte data. We thus have to implement our own little parsing method that uses BYTE_ENCODING to decode parameters from the URI. </p> <p> <p> <b>Note:</b> array parameters are not supported. If a key is present multiple times in the URI, the latest value prevails. We don't really need to implement this functionality as this never happens in the Tracker HTTP protocol. </p> @param uri @param hostAddress @return The {@link AnnounceRequestMessage} representing the client's announce request.
[ "Parse", "the", "query", "parameters", "using", "our", "defined", "BYTE_ENCODING", ".", "<p", ">", "<p", ">", "Because", "we", "re", "expecting", "byte", "-", "encoded", "strings", "as", "query", "parameters", "we", "can", "t", "rely", "on", "SimpleHTTP", ...
train
https://github.com/mpetazzoni/ttorrent/blob/ecd0e6caf853b63393c4ab63cfd8f20114f73f70/ttorrent-tracker/src/main/java/com/turn/ttorrent/tracker/TrackerRequestProcessor.java#L237-L264
westnordost/osmapi
src/main/java/de/westnordost/osmapi/map/MapDataHistoryDao.java
MapDataHistoryDao.getWayHistory
public void getWayHistory(long id, Handler<Way> handler) { MapDataHandler mapDataHandler = new WrapperOsmElementHandler<>(Way.class, handler); boolean authenticate = osm.getOAuth() != null; osm.makeRequest(WAY + "/" + id + "/" + HISTORY, authenticate, new MapDataParser(mapDataHandler, factory)); }
java
public void getWayHistory(long id, Handler<Way> handler) { MapDataHandler mapDataHandler = new WrapperOsmElementHandler<>(Way.class, handler); boolean authenticate = osm.getOAuth() != null; osm.makeRequest(WAY + "/" + id + "/" + HISTORY, authenticate, new MapDataParser(mapDataHandler, factory)); }
[ "public", "void", "getWayHistory", "(", "long", "id", ",", "Handler", "<", "Way", ">", "handler", ")", "{", "MapDataHandler", "mapDataHandler", "=", "new", "WrapperOsmElementHandler", "<>", "(", "Way", ".", "class", ",", "handler", ")", ";", "boolean", "auth...
Feeds all versions of the given way to the handler. The elements are sorted by version, the oldest version is the first, the newest version is the last element.<br> If not logged in, the Changeset for each returned element will be null @throws OsmNotFoundException if the node has not been found.
[ "Feeds", "all", "versions", "of", "the", "given", "way", "to", "the", "handler", ".", "The", "elements", "are", "sorted", "by", "version", "the", "oldest", "version", "is", "the", "first", "the", "newest", "version", "is", "the", "last", "element", ".", ...
train
https://github.com/westnordost/osmapi/blob/dda6978fd12e117d0cf17812bc22037f61e22c4b/src/main/java/de/westnordost/osmapi/map/MapDataHistoryDao.java#L60-L66
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/sax/ExcelSaxUtil.java
ExcelSaxUtil.getNumberValue
private static Number getNumberValue(String value, String numFmtString) { if(StrUtil.isBlank(value)) { return null; } double numValue = Double.parseDouble(value); // 普通数字 if (null != numFmtString && numFmtString.indexOf(StrUtil.C_DOT) < 0) { final long longPart = (long) numValue; if (longPart == numValue) { // 对于无小数部分的数字类型,转为Long return longPart; } } return numValue; }
java
private static Number getNumberValue(String value, String numFmtString) { if(StrUtil.isBlank(value)) { return null; } double numValue = Double.parseDouble(value); // 普通数字 if (null != numFmtString && numFmtString.indexOf(StrUtil.C_DOT) < 0) { final long longPart = (long) numValue; if (longPart == numValue) { // 对于无小数部分的数字类型,转为Long return longPart; } } return numValue; }
[ "private", "static", "Number", "getNumberValue", "(", "String", "value", ",", "String", "numFmtString", ")", "{", "if", "(", "StrUtil", ".", "isBlank", "(", "value", ")", ")", "{", "return", "null", ";", "}", "double", "numValue", "=", "Double", ".", "pa...
获取数字类型值 @param value 值 @param numFmtString 格式 @return 数字,可以是Double、Long @since 4.1.0
[ "获取数字类型值" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/sax/ExcelSaxUtil.java#L140-L154
landawn/AbacusUtil
src/com/landawn/abacus/util/SQLExecutor.java
SQLExecutor.streamAll
@SafeVarargs public final <T> Stream<T> streamAll(final List<String> sqls, final StatementSetter statementSetter, final JdbcUtil.BiRecordGetter<T, RuntimeException> recordGetter, final JdbcSettings jdbcSettings, final Object... parameters) { if (sqls.size() == 1) { return streamAll(sqls.get(0), statementSetter, recordGetter, jdbcSettings, parameters); } final boolean isQueryInParallel = jdbcSettings != null && jdbcSettings.isQueryInParallel(); return Stream.of(sqls).__(new Function<Stream<String>, Stream<String>>() { @Override public Stream<String> apply(Stream<String> s) { return isQueryInParallel ? s.parallel(sqls.size()) : s; } }).flatMap(new Function<String, Stream<T>>() { @Override public Stream<T> apply(String sql) { return streamAll(sql, statementSetter, recordGetter, jdbcSettings, parameters); } }); }
java
@SafeVarargs public final <T> Stream<T> streamAll(final List<String> sqls, final StatementSetter statementSetter, final JdbcUtil.BiRecordGetter<T, RuntimeException> recordGetter, final JdbcSettings jdbcSettings, final Object... parameters) { if (sqls.size() == 1) { return streamAll(sqls.get(0), statementSetter, recordGetter, jdbcSettings, parameters); } final boolean isQueryInParallel = jdbcSettings != null && jdbcSettings.isQueryInParallel(); return Stream.of(sqls).__(new Function<Stream<String>, Stream<String>>() { @Override public Stream<String> apply(Stream<String> s) { return isQueryInParallel ? s.parallel(sqls.size()) : s; } }).flatMap(new Function<String, Stream<T>>() { @Override public Stream<T> apply(String sql) { return streamAll(sql, statementSetter, recordGetter, jdbcSettings, parameters); } }); }
[ "@", "SafeVarargs", "public", "final", "<", "T", ">", "Stream", "<", "T", ">", "streamAll", "(", "final", "List", "<", "String", ">", "sqls", ",", "final", "StatementSetter", "statementSetter", ",", "final", "JdbcUtil", ".", "BiRecordGetter", "<", "T", ","...
Remember to close the returned <code>Stream</code> list to close the underlying <code>ResultSet</code> list. {@code stream} operation won't be part of transaction or use the connection created by {@code Transaction} even it's in transaction block/range. @param sqls @param statementSetter @param recordGetter @param jdbcSettings @param parameters @return
[ "Remember", "to", "close", "the", "returned", "<code", ">", "Stream<", "/", "code", ">", "list", "to", "close", "the", "underlying", "<code", ">", "ResultSet<", "/", "code", ">", "list", ".", "{", "@code", "stream", "}", "operation", "won", "t", "be", ...
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/SQLExecutor.java#L2984-L3004
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/cache/cachepolicylabel.java
cachepolicylabel.get
public static cachepolicylabel get(nitro_service service, String labelname) throws Exception{ cachepolicylabel obj = new cachepolicylabel(); obj.set_labelname(labelname); cachepolicylabel response = (cachepolicylabel) obj.get_resource(service); return response; }
java
public static cachepolicylabel get(nitro_service service, String labelname) throws Exception{ cachepolicylabel obj = new cachepolicylabel(); obj.set_labelname(labelname); cachepolicylabel response = (cachepolicylabel) obj.get_resource(service); return response; }
[ "public", "static", "cachepolicylabel", "get", "(", "nitro_service", "service", ",", "String", "labelname", ")", "throws", "Exception", "{", "cachepolicylabel", "obj", "=", "new", "cachepolicylabel", "(", ")", ";", "obj", ".", "set_labelname", "(", "labelname", ...
Use this API to fetch cachepolicylabel resource of given name .
[ "Use", "this", "API", "to", "fetch", "cachepolicylabel", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/cache/cachepolicylabel.java#L325-L330
Alluxio/alluxio
core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournalFile.java
UfsJournalFile.encodeLogFileLocation
static URI encodeLogFileLocation(UfsJournal journal, long start, long end) { String filename = String.format("0x%x-0x%x", start, end); URI location = URIUtils.appendPathOrDie(journal.getLogDir(), filename); return location; }
java
static URI encodeLogFileLocation(UfsJournal journal, long start, long end) { String filename = String.format("0x%x-0x%x", start, end); URI location = URIUtils.appendPathOrDie(journal.getLogDir(), filename); return location; }
[ "static", "URI", "encodeLogFileLocation", "(", "UfsJournal", "journal", ",", "long", "start", ",", "long", "end", ")", "{", "String", "filename", "=", "String", ".", "format", "(", "\"0x%x-0x%x\"", ",", "start", ",", "end", ")", ";", "URI", "location", "="...
Encodes a log location under the log directory. @param journal the UFS journal instance @param start the start sequence number (inclusive) @param end the end sequence number (exclusive) @return the location
[ "Encodes", "a", "log", "location", "under", "the", "log", "directory", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournalFile.java#L127-L131
OpenLiberty/open-liberty
dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolutionException.java
RepositoryResolutionException.getMaximumVersionForMissingProduct
public String getMaximumVersionForMissingProduct(String productId, String version, String edition) { Collection<LibertyVersionRange> filteredRanges = filterVersionRanges(productId, edition); Collection<LibertyVersion> maximumVersions = new HashSet<LibertyVersion>(); for (LibertyVersionRange range : filteredRanges) { LibertyVersion maxVersion = range.getMaxVersion(); if (maxVersion == null) { // unbounded return null; } maximumVersions.add(maxVersion); } Collection<LibertyVersion> filteredVersions = filterVersions(maximumVersions, version); LibertyVersion maximumVersion = null; for (LibertyVersion potentialNewMaxVersion : filteredVersions) { if (maximumVersion == null || potentialNewMaxVersion.compareTo(maximumVersion) > 0) { maximumVersion = potentialNewMaxVersion; } } return maximumVersion == null ? null : maximumVersion.toString(); }
java
public String getMaximumVersionForMissingProduct(String productId, String version, String edition) { Collection<LibertyVersionRange> filteredRanges = filterVersionRanges(productId, edition); Collection<LibertyVersion> maximumVersions = new HashSet<LibertyVersion>(); for (LibertyVersionRange range : filteredRanges) { LibertyVersion maxVersion = range.getMaxVersion(); if (maxVersion == null) { // unbounded return null; } maximumVersions.add(maxVersion); } Collection<LibertyVersion> filteredVersions = filterVersions(maximumVersions, version); LibertyVersion maximumVersion = null; for (LibertyVersion potentialNewMaxVersion : filteredVersions) { if (maximumVersion == null || potentialNewMaxVersion.compareTo(maximumVersion) > 0) { maximumVersion = potentialNewMaxVersion; } } return maximumVersion == null ? null : maximumVersion.toString(); }
[ "public", "String", "getMaximumVersionForMissingProduct", "(", "String", "productId", ",", "String", "version", ",", "String", "edition", ")", "{", "Collection", "<", "LibertyVersionRange", ">", "filteredRanges", "=", "filterVersionRanges", "(", "productId", ",", "edi...
<p>This will iterate through the products that couldn't be found as supplied by {@link #getMissingProducts()} and look for the maximum version that was searched for. It will limit it to products that match the supplied <code>productId</code>. Note that if the maximum version on a {@link ProductRequirementInformation} is not in the form digit.digit.digit.digit then it will be ignored. Also, if the maximum version is unbounded then this method will return <code>null</code>, this means that {@link #getMinimumVersionForMissingProduct(String)} may return a non-null value at the same time as this method returning <code>null</code>. It is possible for a strange quirk in that if the repository had the following versions in it:</p> <ul><li>8.5.5.2</li> <li>8.5.5.4+</li></ul> <p>The {@link #getMinimumVersionForMissingProduct(String)} would return "8.5.5.2" and this method would return <code>null</code> implying a range from 8.5.5.2 to infinity even though 8.5.5.3 is not supported, therefore {@link #getMissingProducts()} should be relied on for the most accurate information although in reality this situation would indicate a fairly odd repository setup.</p> @param productId The product ID to find the maximum missing version for or <code>null</code> to match to all products @param version The version to find the maximum missing version for by matching the first three parts so if you supply "8.5.5.2" and this item applies to version "8.5.5.3" and "9.0.0.1" then "8.5.5.3" will be returned. Supply <code>null</code> to match all versions @param edition The edition to find the maximum missing version for or <code>null</code> to match to all products @return The maximum missing version or <code>null</code> if there were no relevant matches or the maximum version is unbounded
[ "<p", ">", "This", "will", "iterate", "through", "the", "products", "that", "couldn", "t", "be", "found", "as", "supplied", "by", "{", "@link", "#getMissingProducts", "()", "}", "and", "look", "for", "the", "maximum", "version", "that", "was", "searched", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolutionException.java#L181-L200
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/ArrayIterate.java
ArrayIterate.indexOf
public static <T> int indexOf(T[] objectArray, T elem) { return InternalArrayIterate.indexOf(objectArray, objectArray.length, elem); }
java
public static <T> int indexOf(T[] objectArray, T elem) { return InternalArrayIterate.indexOf(objectArray, objectArray.length, elem); }
[ "public", "static", "<", "T", ">", "int", "indexOf", "(", "T", "[", "]", "objectArray", ",", "T", "elem", ")", "{", "return", "InternalArrayIterate", ".", "indexOf", "(", "objectArray", ",", "objectArray", ".", "length", ",", "elem", ")", ";", "}" ]
Searches for the first occurrence of the given argument, testing for equality using the <tt>equals</tt> method.
[ "Searches", "for", "the", "first", "occurrence", "of", "the", "given", "argument", "testing", "for", "equality", "using", "the", "<tt", ">", "equals<", "/", "tt", ">", "method", "." ]
train
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/ArrayIterate.java#L1094-L1097
devcon5io/common
classutils/src/main/java/io/devcon5/classutils/JarScanner.java
JarScanner.toUri
private static URI toUri(final URL u) { try { return u.toURI(); } catch (URISyntaxException e) { throw new IllegalArgumentException("Could not convert URL "+u+" to uri",e); } }
java
private static URI toUri(final URL u) { try { return u.toURI(); } catch (URISyntaxException e) { throw new IllegalArgumentException("Could not convert URL "+u+" to uri",e); } }
[ "private", "static", "URI", "toUri", "(", "final", "URL", "u", ")", "{", "try", "{", "return", "u", ".", "toURI", "(", ")", ";", "}", "catch", "(", "URISyntaxException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Could not convert U...
Converts a url to uri without throwing a checked exception. In case an URI syntax exception occurs, an IllegalArgumentException is thrown. @param u the url to be converted @return the converted uri
[ "Converts", "a", "url", "to", "uri", "without", "throwing", "a", "checked", "exception", ".", "In", "case", "an", "URI", "syntax", "exception", "occurs", "an", "IllegalArgumentException", "is", "thrown", "." ]
train
https://github.com/devcon5io/common/blob/363688e0dc904d559682bf796bd6c836b4e0efc7/classutils/src/main/java/io/devcon5/classutils/JarScanner.java#L124-L131
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/preferences/ExtraLanguagePreferenceAccess.java
ExtraLanguagePreferenceAccess.getBoolean
public boolean getBoolean(String preferenceContainerID, IProject project, String preferenceName) { assert preferenceName != null; final IProject prj = ifSpecificConfiguration(preferenceContainerID, project); final IPreferenceStore store = getPreferenceStore(prj); return getBoolean(store, preferenceContainerID, preferenceName); }
java
public boolean getBoolean(String preferenceContainerID, IProject project, String preferenceName) { assert preferenceName != null; final IProject prj = ifSpecificConfiguration(preferenceContainerID, project); final IPreferenceStore store = getPreferenceStore(prj); return getBoolean(store, preferenceContainerID, preferenceName); }
[ "public", "boolean", "getBoolean", "(", "String", "preferenceContainerID", ",", "IProject", "project", ",", "String", "preferenceName", ")", "{", "assert", "preferenceName", "!=", "null", ";", "final", "IProject", "prj", "=", "ifSpecificConfiguration", "(", "prefere...
Replies the preference value. <p>This function takes care of the specific options that are associated to the given project. If the given project is {@code null} or has no specific options, according to {@link #ifSpecificConfiguration(String, IProject)}, then the global preferences are used. @param preferenceContainerID the identifier of the generator's preference container. @param project the context. If {@code null}, the global context is assumed. @param preferenceName the name of the preference. @return the value. @since 0.8
[ "Replies", "the", "preference", "value", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/preferences/ExtraLanguagePreferenceAccess.java#L167-L172
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/tree/GISTreeSetUtil.java
GISTreeSetUtil.computeCutPoint
private static <P extends GISPrimitive, N extends AbstractGISTreeSetNode<P, N>> Point2d computeCutPoint(IcosepQuadTreeZone region, N parent) { final double w = parent.nodeWidth / 4.; final double h = parent.nodeHeight / 4.; final double x; final double y; switch (region) { case SOUTH_WEST: x = parent.verticalSplit - w; y = parent.horizontalSplit - h; break; case SOUTH_EAST: x = parent.verticalSplit + w; y = parent.horizontalSplit - h; break; case NORTH_WEST: x = parent.verticalSplit - w; y = parent.horizontalSplit + h; break; case NORTH_EAST: x = parent.verticalSplit + w; y = parent.horizontalSplit + h; break; case ICOSEP: default: return null; } return new Point2d(x, y); }
java
private static <P extends GISPrimitive, N extends AbstractGISTreeSetNode<P, N>> Point2d computeCutPoint(IcosepQuadTreeZone region, N parent) { final double w = parent.nodeWidth / 4.; final double h = parent.nodeHeight / 4.; final double x; final double y; switch (region) { case SOUTH_WEST: x = parent.verticalSplit - w; y = parent.horizontalSplit - h; break; case SOUTH_EAST: x = parent.verticalSplit + w; y = parent.horizontalSplit - h; break; case NORTH_WEST: x = parent.verticalSplit - w; y = parent.horizontalSplit + h; break; case NORTH_EAST: x = parent.verticalSplit + w; y = parent.horizontalSplit + h; break; case ICOSEP: default: return null; } return new Point2d(x, y); }
[ "private", "static", "<", "P", "extends", "GISPrimitive", ",", "N", "extends", "AbstractGISTreeSetNode", "<", "P", ",", "N", ">", ">", "Point2d", "computeCutPoint", "(", "IcosepQuadTreeZone", "region", ",", "N", "parent", ")", "{", "final", "double", "w", "=...
Computes the cut planes' position of the given region. @param region is the id of the region for which the cut plane position must be computed @param parent is the parent node. @return the cut planes' position of the region, or <code>null</code> if the cut planes' position could not be computed (because the region is the icosep region for instance).
[ "Computes", "the", "cut", "planes", "position", "of", "the", "given", "region", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/tree/GISTreeSetUtil.java#L512-L540
redkale/redkale
src/org/redkale/source/EntityInfo.java
EntityInfo.formatSQLValue
protected CharSequence formatSQLValue(String col, Attribute<T, Serializable> attr, final ColumnValue cv) { if (cv == null) return null; Object val = cv.getValue(); CryptHandler handler = attr.attach(); if (handler != null) val = handler.encrypt(val); switch (cv.getExpress()) { case INC: return new StringBuilder().append(col).append(" + ").append(val); case MUL: return new StringBuilder().append(col).append(" * ").append(val); case AND: return new StringBuilder().append(col).append(" & ").append(val); case ORR: return new StringBuilder().append(col).append(" | ").append(val); case MOV: return formatToString(val); } return formatToString(val); }
java
protected CharSequence formatSQLValue(String col, Attribute<T, Serializable> attr, final ColumnValue cv) { if (cv == null) return null; Object val = cv.getValue(); CryptHandler handler = attr.attach(); if (handler != null) val = handler.encrypt(val); switch (cv.getExpress()) { case INC: return new StringBuilder().append(col).append(" + ").append(val); case MUL: return new StringBuilder().append(col).append(" * ").append(val); case AND: return new StringBuilder().append(col).append(" & ").append(val); case ORR: return new StringBuilder().append(col).append(" | ").append(val); case MOV: return formatToString(val); } return formatToString(val); }
[ "protected", "CharSequence", "formatSQLValue", "(", "String", "col", ",", "Attribute", "<", "T", ",", "Serializable", ">", "attr", ",", "final", "ColumnValue", "cv", ")", "{", "if", "(", "cv", "==", "null", ")", "return", "null", ";", "Object", "val", "=...
拼接UPDATE给字段赋值的SQL片段 @param col 表字段名 @param attr Attribute @param cv ColumnValue @return CharSequence
[ "拼接UPDATE给字段赋值的SQL片段" ]
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/source/EntityInfo.java#L956-L974
lucmoreau/ProvToolbox
prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java
ProvFactory.newEntry
public Entry newEntry(Key key, QualifiedName entity) { Entry res = of.createEntry(); res.setKey(key); res.setEntity(entity); return res; }
java
public Entry newEntry(Key key, QualifiedName entity) { Entry res = of.createEntry(); res.setKey(key); res.setEntity(entity); return res; }
[ "public", "Entry", "newEntry", "(", "Key", "key", ",", "QualifiedName", "entity", ")", "{", "Entry", "res", "=", "of", ".", "createEntry", "(", ")", ";", "res", ".", "setKey", "(", "key", ")", ";", "res", ".", "setEntity", "(", "entity", ")", ";", ...
Factory method for Key-entity entries. Key-entity entries are used to identify the members of a dictionary. @param key indexing the entity in the dictionary @param entity a {@link QualifiedName} denoting an entity @return an instance of {@link Entry}
[ "Factory", "method", "for", "Key", "-", "entity", "entries", ".", "Key", "-", "entity", "entries", "are", "used", "to", "identify", "the", "members", "of", "a", "dictionary", "." ]
train
https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java#L661-L666
milaboratory/milib
src/main/java/com/milaboratory/core/sequence/SequencesUtils.java
SequencesUtils.wildcardsToRandomBasic
public static <S extends Sequence<S>> S wildcardsToRandomBasic(S sequence, long seed) { Alphabet<S> alphabet = sequence.getAlphabet(); SequenceBuilder<S> sequenceBuilder = alphabet.createBuilder().ensureCapacity(sequence.size()); for (int i = 0; i < sequence.size(); ++i) { byte code = sequence.codeAt(i); if (alphabet.isWildcard(code)) { seed = HashFunctions.JenkinWang64shift(seed + i); sequenceBuilder.append(alphabet.codeToWildcard(code).getUniformlyDistributedBasicCode(seed)); } else sequenceBuilder.append(code); } return sequenceBuilder.createAndDestroy(); }
java
public static <S extends Sequence<S>> S wildcardsToRandomBasic(S sequence, long seed) { Alphabet<S> alphabet = sequence.getAlphabet(); SequenceBuilder<S> sequenceBuilder = alphabet.createBuilder().ensureCapacity(sequence.size()); for (int i = 0; i < sequence.size(); ++i) { byte code = sequence.codeAt(i); if (alphabet.isWildcard(code)) { seed = HashFunctions.JenkinWang64shift(seed + i); sequenceBuilder.append(alphabet.codeToWildcard(code).getUniformlyDistributedBasicCode(seed)); } else sequenceBuilder.append(code); } return sequenceBuilder.createAndDestroy(); }
[ "public", "static", "<", "S", "extends", "Sequence", "<", "S", ">", ">", "S", "wildcardsToRandomBasic", "(", "S", "sequence", ",", "long", "seed", ")", "{", "Alphabet", "<", "S", ">", "alphabet", "=", "sequence", ".", "getAlphabet", "(", ")", ";", "Seq...
Converts sequence with wildcards to a sequence without wildcards by converting wildcard letters to uniformly distributed letters from the set of letters allowed by the wildcard. (see {@link Wildcard#getUniformlyDistributedBasicCode(long)}. <p>Returns same result for the same combination of sequence and seed.</p> @param sequence sequence to convert @param seed seed for random generator @param <S> type of sequence @return sequence with wildcards replaced by uniformly distributed random basic letters
[ "Converts", "sequence", "with", "wildcards", "to", "a", "sequence", "without", "wildcards", "by", "converting", "wildcard", "letters", "to", "uniformly", "distributed", "letters", "from", "the", "set", "of", "letters", "allowed", "by", "the", "wildcard", ".", "(...
train
https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/core/sequence/SequencesUtils.java#L125-L137
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_health_monitor_voltage.java
xen_health_monitor_voltage.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { xen_health_monitor_voltage_responses result = (xen_health_monitor_voltage_responses) service.get_payload_formatter().string_to_resource(xen_health_monitor_voltage_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.xen_health_monitor_voltage_response_array); } xen_health_monitor_voltage[] result_xen_health_monitor_voltage = new xen_health_monitor_voltage[result.xen_health_monitor_voltage_response_array.length]; for(int i = 0; i < result.xen_health_monitor_voltage_response_array.length; i++) { result_xen_health_monitor_voltage[i] = result.xen_health_monitor_voltage_response_array[i].xen_health_monitor_voltage[0]; } return result_xen_health_monitor_voltage; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { xen_health_monitor_voltage_responses result = (xen_health_monitor_voltage_responses) service.get_payload_formatter().string_to_resource(xen_health_monitor_voltage_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.xen_health_monitor_voltage_response_array); } xen_health_monitor_voltage[] result_xen_health_monitor_voltage = new xen_health_monitor_voltage[result.xen_health_monitor_voltage_response_array.length]; for(int i = 0; i < result.xen_health_monitor_voltage_response_array.length; i++) { result_xen_health_monitor_voltage[i] = result.xen_health_monitor_voltage_response_array[i].xen_health_monitor_voltage[0]; } return result_xen_health_monitor_voltage; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "xen_health_monitor_voltage_responses", "result", "=", "(", "xen_health_monitor_voltage_responses", ")", "service"...
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_health_monitor_voltage.java#L173-L190
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFile.java
BoxApiFile.getAddToCollectionRequest
public BoxRequestsFile.AddFileToCollection getAddToCollectionRequest(String fileId, String collectionId) { BoxRequestsFile.AddFileToCollection request = new BoxRequestsFile.AddFileToCollection(fileId, collectionId, getFileInfoUrl(fileId), mSession); return request; }
java
public BoxRequestsFile.AddFileToCollection getAddToCollectionRequest(String fileId, String collectionId) { BoxRequestsFile.AddFileToCollection request = new BoxRequestsFile.AddFileToCollection(fileId, collectionId, getFileInfoUrl(fileId), mSession); return request; }
[ "public", "BoxRequestsFile", ".", "AddFileToCollection", "getAddToCollectionRequest", "(", "String", "fileId", ",", "String", "collectionId", ")", "{", "BoxRequestsFile", ".", "AddFileToCollection", "request", "=", "new", "BoxRequestsFile", ".", "AddFileToCollection", "("...
Gets a request that adds a file to a collection @param fileId id of file to add to collection @param collectionId id of collection to add the file to @return request to add a file to a collection
[ "Gets", "a", "request", "that", "adds", "a", "file", "to", "a", "collection" ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFile.java#L545-L548
LGoodDatePicker/LGoodDatePicker
Project/src/main/java/com/privatejgoodies/common/base/Preconditions.java
Preconditions.checkArgument
public static void checkArgument( boolean expression, String messageFormat, Object... messageArgs) { if (!expression) { throw new IllegalArgumentException(format(messageFormat, messageArgs)); } }
java
public static void checkArgument( boolean expression, String messageFormat, Object... messageArgs) { if (!expression) { throw new IllegalArgumentException(format(messageFormat, messageArgs)); } }
[ "public", "static", "void", "checkArgument", "(", "boolean", "expression", ",", "String", "messageFormat", ",", "Object", "...", "messageArgs", ")", "{", "if", "(", "!", "expression", ")", "{", "throw", "new", "IllegalArgumentException", "(", "format", "(", "m...
Checks the truth of the given expression and throws a customized {@link IllegalArgumentException} if it is false. Intended for doing parameter validation in methods and constructors, e.g.: <blockquote><pre> public void foo(int count) { Preconditions.checkArgument(count > 0, "count must be positive: %s.", count); } </pre></blockquote> @param expression the precondition to check involving one ore more parameters to the calling method or constructor @param messageFormat a {@link Formatter format} string for the detail message to be used in the event that an exception is thrown. @param messageArgs the arguments referenced by the format specifiers in the {@code messageFormat} @throws IllegalArgumentException if {@code expression} is false
[ "Checks", "the", "truth", "of", "the", "given", "expression", "and", "throws", "a", "customized", "{", "@link", "IllegalArgumentException", "}", "if", "it", "is", "false", ".", "Intended", "for", "doing", "parameter", "validation", "in", "methods", "and", "con...
train
https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/privatejgoodies/common/base/Preconditions.java#L85-L90
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/query/QueryImpl.java
QueryImpl.findUsingLucene
private List<Object> findUsingLucene(EntityMetadata m, Client client, Object[] primaryKeys) { String idField = m.getIdAttribute().getName(); String equals = "="; MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel( m.getPersistenceUnit()); EntityType entityType = metaModel.entity(m.getEntityClazz()); String columnName = ((AbstractAttribute) entityType.getAttribute(idField)).getJPAColumnName(); List<Object> result = new ArrayList<Object>(); Queue queue = getKunderaQuery().getFilterClauseQueue(); KunderaQuery kunderaQuery = getKunderaQuery(); for (Object primaryKey : primaryKeys) { FilterClause filterClause = kunderaQuery.new FilterClause(columnName, equals, primaryKey, idField); kunderaQuery.setFilter(kunderaQuery.getEntityAlias() + "." + columnName + " = " + primaryKey); queue.clear(); queue.add(filterClause); List<Object> object = findUsingLucene(m, client); if (object != null && !object.isEmpty()) result.add(object.get(0)); } return result; }
java
private List<Object> findUsingLucene(EntityMetadata m, Client client, Object[] primaryKeys) { String idField = m.getIdAttribute().getName(); String equals = "="; MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel( m.getPersistenceUnit()); EntityType entityType = metaModel.entity(m.getEntityClazz()); String columnName = ((AbstractAttribute) entityType.getAttribute(idField)).getJPAColumnName(); List<Object> result = new ArrayList<Object>(); Queue queue = getKunderaQuery().getFilterClauseQueue(); KunderaQuery kunderaQuery = getKunderaQuery(); for (Object primaryKey : primaryKeys) { FilterClause filterClause = kunderaQuery.new FilterClause(columnName, equals, primaryKey, idField); kunderaQuery.setFilter(kunderaQuery.getEntityAlias() + "." + columnName + " = " + primaryKey); queue.clear(); queue.add(filterClause); List<Object> object = findUsingLucene(m, client); if (object != null && !object.isEmpty()) result.add(object.get(0)); } return result; }
[ "private", "List", "<", "Object", ">", "findUsingLucene", "(", "EntityMetadata", "m", ",", "Client", "client", ",", "Object", "[", "]", "primaryKeys", ")", "{", "String", "idField", "=", "m", ".", "getIdAttribute", "(", ")", ".", "getName", "(", ")", ";"...
find data using lucene. @param m the m @param client the client @param primaryKeys the primary keys @return the list
[ "find", "data", "using", "lucene", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/query/QueryImpl.java#L375-L399
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/util/ReflectUtil.java
ReflectUtil.getSetter
public static Method getSetter(String fieldName, Class<?> clazz, Class<?> fieldType) { String setterName = buildSetterName(fieldName); try { // Using getMathods(), getMathod(...) expects exact parameter type // matching and ignores inheritance-tree. Method[] methods = clazz.getMethods(); for(Method method : methods) { if(method.getName().equals(setterName)) { Class<?>[] paramTypes = method.getParameterTypes(); if(paramTypes != null && paramTypes.length == 1 && paramTypes[0].isAssignableFrom(fieldType)) { return method; } } } return null; } catch (SecurityException e) { throw LOG.unableToAccessMethod(setterName, clazz.getName()); } }
java
public static Method getSetter(String fieldName, Class<?> clazz, Class<?> fieldType) { String setterName = buildSetterName(fieldName); try { // Using getMathods(), getMathod(...) expects exact parameter type // matching and ignores inheritance-tree. Method[] methods = clazz.getMethods(); for(Method method : methods) { if(method.getName().equals(setterName)) { Class<?>[] paramTypes = method.getParameterTypes(); if(paramTypes != null && paramTypes.length == 1 && paramTypes[0].isAssignableFrom(fieldType)) { return method; } } } return null; } catch (SecurityException e) { throw LOG.unableToAccessMethod(setterName, clazz.getName()); } }
[ "public", "static", "Method", "getSetter", "(", "String", "fieldName", ",", "Class", "<", "?", ">", "clazz", ",", "Class", "<", "?", ">", "fieldType", ")", "{", "String", "setterName", "=", "buildSetterName", "(", "fieldName", ")", ";", "try", "{", "// U...
Returns the setter-method for the given field name or null if no setter exists.
[ "Returns", "the", "setter", "-", "method", "for", "the", "given", "field", "name", "or", "null", "if", "no", "setter", "exists", "." ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/util/ReflectUtil.java#L254-L273
elki-project/elki
elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/datasource/bundle/MultipleObjectsBundle.java
MultipleObjectsBundle.makeSimple
public static <V> MultipleObjectsBundle makeSimple(SimpleTypeInformation<? super V> type, List<? extends V> data) { MultipleObjectsBundle bundle = new MultipleObjectsBundle(); bundle.appendColumn(type, data); return bundle; }
java
public static <V> MultipleObjectsBundle makeSimple(SimpleTypeInformation<? super V> type, List<? extends V> data) { MultipleObjectsBundle bundle = new MultipleObjectsBundle(); bundle.appendColumn(type, data); return bundle; }
[ "public", "static", "<", "V", ">", "MultipleObjectsBundle", "makeSimple", "(", "SimpleTypeInformation", "<", "?", "super", "V", ">", "type", ",", "List", "<", "?", "extends", "V", ">", "data", ")", "{", "MultipleObjectsBundle", "bundle", "=", "new", "Multipl...
Helper to add a single column to the bundle. @param <V> Object type @param type Type information @param data Data to add
[ "Helper", "to", "add", "a", "single", "column", "to", "the", "bundle", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/datasource/bundle/MultipleObjectsBundle.java#L174-L178
mapsforge/mapsforge
mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java
MercatorProjection.latitudeToPixelYWithScaleFactor
public static double latitudeToPixelYWithScaleFactor(double latitude, double scaleFactor, int tileSize) { double sinLatitude = Math.sin(latitude * (Math.PI / 180)); long mapSize = getMapSizeWithScaleFactor(scaleFactor, tileSize); // FIXME improve this formula so that it works correctly without the clipping double pixelY = (0.5 - Math.log((1 + sinLatitude) / (1 - sinLatitude)) / (4 * Math.PI)) * mapSize; return Math.min(Math.max(0, pixelY), mapSize); }
java
public static double latitudeToPixelYWithScaleFactor(double latitude, double scaleFactor, int tileSize) { double sinLatitude = Math.sin(latitude * (Math.PI / 180)); long mapSize = getMapSizeWithScaleFactor(scaleFactor, tileSize); // FIXME improve this formula so that it works correctly without the clipping double pixelY = (0.5 - Math.log((1 + sinLatitude) / (1 - sinLatitude)) / (4 * Math.PI)) * mapSize; return Math.min(Math.max(0, pixelY), mapSize); }
[ "public", "static", "double", "latitudeToPixelYWithScaleFactor", "(", "double", "latitude", ",", "double", "scaleFactor", ",", "int", "tileSize", ")", "{", "double", "sinLatitude", "=", "Math", ".", "sin", "(", "latitude", "*", "(", "Math", ".", "PI", "/", "...
Converts a latitude coordinate (in degrees) to a pixel Y coordinate at a certain scale. @param latitude the latitude coordinate that should be converted. @param scaleFactor the scale factor at which the coordinate should be converted. @return the pixel Y coordinate of the latitude value.
[ "Converts", "a", "latitude", "coordinate", "(", "in", "degrees", ")", "to", "a", "pixel", "Y", "coordinate", "at", "a", "certain", "scale", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java#L186-L192
apache/incubator-heron
heron/schedulers/src/java/org/apache/heron/scheduler/yarn/HeronMasterDriver.java
HeronMasterDriver.scheduleHeronWorkers
void scheduleHeronWorkers(Set<ContainerPlan> containers) throws ContainerAllocationException { for (ContainerPlan containerPlan : containers) { int id = containerPlan.getId(); if (containerPlans.containsKey(containerPlan.getId())) { throw new ContainerAllocationException("Received duplicate allocation request for " + id); } Resource reqResource = containerPlan.getRequiredResource(); containerPlans.put(id, containerPlan); requestContainerForWorker(id, new HeronWorker(id, reqResource)); } }
java
void scheduleHeronWorkers(Set<ContainerPlan> containers) throws ContainerAllocationException { for (ContainerPlan containerPlan : containers) { int id = containerPlan.getId(); if (containerPlans.containsKey(containerPlan.getId())) { throw new ContainerAllocationException("Received duplicate allocation request for " + id); } Resource reqResource = containerPlan.getRequiredResource(); containerPlans.put(id, containerPlan); requestContainerForWorker(id, new HeronWorker(id, reqResource)); } }
[ "void", "scheduleHeronWorkers", "(", "Set", "<", "ContainerPlan", ">", "containers", ")", "throws", "ContainerAllocationException", "{", "for", "(", "ContainerPlan", "containerPlan", ":", "containers", ")", "{", "int", "id", "=", "containerPlan", ".", "getId", "("...
Container allocation is asynchronous. Requests all containers in the input set serially to ensure allocated resources match the required resources.
[ "Container", "allocation", "is", "asynchronous", ".", "Requests", "all", "containers", "in", "the", "input", "set", "serially", "to", "ensure", "allocated", "resources", "match", "the", "required", "resources", "." ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/schedulers/src/java/org/apache/heron/scheduler/yarn/HeronMasterDriver.java#L199-L209
wcm-io/wcm-io-handler
url/src/main/java/io/wcm/handler/url/suffix/SuffixBuilder.java
SuffixBuilder.putAll
public @NotNull SuffixBuilder putAll(@NotNull Map<String, Object> map) { for (Map.Entry<String, Object> entry : map.entrySet()) { put(entry.getKey(), entry.getValue()); } return this; }
java
public @NotNull SuffixBuilder putAll(@NotNull Map<String, Object> map) { for (Map.Entry<String, Object> entry : map.entrySet()) { put(entry.getKey(), entry.getValue()); } return this; }
[ "public", "@", "NotNull", "SuffixBuilder", "putAll", "(", "@", "NotNull", "Map", "<", "String", ",", "Object", ">", "map", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "Object", ">", "entry", ":", "map", ".", "entrySet", "(", ")", ...
Puts a map of key-value pairs into the suffix. @param map map of key-value pairs @return this
[ "Puts", "a", "map", "of", "key", "-", "value", "pairs", "into", "the", "suffix", "." ]
train
https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/url/src/main/java/io/wcm/handler/url/suffix/SuffixBuilder.java#L215-L220
hdbeukel/james-core
src/main/java/org/jamesframework/core/search/algo/vns/VariableNeighbourhoodSearch.java
VariableNeighbourhoodSearch.searchStep
@Override protected void searchStep() { // cyclically reset s to zero if no more shaking neighbourhoods are available if(s >= getNeighbourhoods().size()){ s = 0; } // create copy of current solution to shake and modify by applying local search procedure SolutionType shakedSolution = Solution.checkedCopy(getCurrentSolution()); // 1) SHAKING // get random move from current shaking neighbourhood Move<? super SolutionType> shakeMove = getNeighbourhoods().get(s).getRandomMove(shakedSolution, getRandom()); // shake (only if a move was obtained) Evaluation shakedEval = getCurrentSolutionEvaluation(); Validation shakedVal = getCurrentSolutionValidation(); if(shakeMove != null){ shakedEval = evaluate(shakeMove); shakedVal = validate(shakeMove); shakeMove.apply(shakedSolution); } // 2) LOCAL SEARCH // create instance of local search algorithm LocalSearch<SolutionType> localSearch = localSearchFactory.create(getProblem()); // set initial solution to be modified localSearch.setCurrentSolution(shakedSolution, shakedEval, shakedVal); // interrupt local search algorithm when main VNS search wants to terminate localSearch.addStopCriterion(_search -> getStatus() == SearchStatus.TERMINATING); // run local search localSearch.start(); // dispose local search when completed localSearch.dispose(); // 3) ACCEPTANCE SolutionType lsBestSolution = localSearch.getBestSolution(); Evaluation lsBestSolutionEvaluation = localSearch.getBestSolutionEvaluation(); Validation lsBestSolutionValidation = localSearch.getBestSolutionValidation(); // check improvement if(lsBestSolution != null && lsBestSolutionValidation.passed() // should always be true but it doesn't hurt to check && computeDelta(lsBestSolutionEvaluation, getCurrentSolutionEvaluation()) > 0){ // improvement: increase number of accepted moves incNumAcceptedMoves(1); // update current and best solution updateCurrentAndBestSolution(lsBestSolution, lsBestSolutionEvaluation, lsBestSolutionValidation); // reset shaking neighbourhood s = 0; } else { // no improvement: stick with current solution, adopt next shaking neighbourhood incNumRejectedMoves(1); s++; } }
java
@Override protected void searchStep() { // cyclically reset s to zero if no more shaking neighbourhoods are available if(s >= getNeighbourhoods().size()){ s = 0; } // create copy of current solution to shake and modify by applying local search procedure SolutionType shakedSolution = Solution.checkedCopy(getCurrentSolution()); // 1) SHAKING // get random move from current shaking neighbourhood Move<? super SolutionType> shakeMove = getNeighbourhoods().get(s).getRandomMove(shakedSolution, getRandom()); // shake (only if a move was obtained) Evaluation shakedEval = getCurrentSolutionEvaluation(); Validation shakedVal = getCurrentSolutionValidation(); if(shakeMove != null){ shakedEval = evaluate(shakeMove); shakedVal = validate(shakeMove); shakeMove.apply(shakedSolution); } // 2) LOCAL SEARCH // create instance of local search algorithm LocalSearch<SolutionType> localSearch = localSearchFactory.create(getProblem()); // set initial solution to be modified localSearch.setCurrentSolution(shakedSolution, shakedEval, shakedVal); // interrupt local search algorithm when main VNS search wants to terminate localSearch.addStopCriterion(_search -> getStatus() == SearchStatus.TERMINATING); // run local search localSearch.start(); // dispose local search when completed localSearch.dispose(); // 3) ACCEPTANCE SolutionType lsBestSolution = localSearch.getBestSolution(); Evaluation lsBestSolutionEvaluation = localSearch.getBestSolutionEvaluation(); Validation lsBestSolutionValidation = localSearch.getBestSolutionValidation(); // check improvement if(lsBestSolution != null && lsBestSolutionValidation.passed() // should always be true but it doesn't hurt to check && computeDelta(lsBestSolutionEvaluation, getCurrentSolutionEvaluation()) > 0){ // improvement: increase number of accepted moves incNumAcceptedMoves(1); // update current and best solution updateCurrentAndBestSolution(lsBestSolution, lsBestSolutionEvaluation, lsBestSolutionValidation); // reset shaking neighbourhood s = 0; } else { // no improvement: stick with current solution, adopt next shaking neighbourhood incNumRejectedMoves(1); s++; } }
[ "@", "Override", "protected", "void", "searchStep", "(", ")", "{", "// cyclically reset s to zero if no more shaking neighbourhoods are available", "if", "(", "s", ">=", "getNeighbourhoods", "(", ")", ".", "size", "(", ")", ")", "{", "s", "=", "0", ";", "}", "//...
Performs a step of VNS. One step consists of: <ol> <li>Shaking using the current shaking neighbourhood</li> <li>Modification using a new instance of the local search algorithm</li> <li> Acceptance of modified solution if it is a global improvement. In such case, the search continues with the first shaking neighbourhood; else, the next shaking neighbourhood will be used (cyclically). </li> </ol> @throws JamesRuntimeException if depending on malfunctioning components (problem, neighbourhood, ...)
[ "Performs", "a", "step", "of", "VNS", ".", "One", "step", "consists", "of", ":", "<ol", ">", "<li", ">", "Shaking", "using", "the", "current", "shaking", "neighbourhood<", "/", "li", ">", "<li", ">", "Modification", "using", "a", "new", "instance", "of",...
train
https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/search/algo/vns/VariableNeighbourhoodSearch.java#L209-L267
jenkinsci/jenkins
core/src/main/java/hudson/model/Items.java
Items.verifyItemDoesNotAlreadyExist
static void verifyItemDoesNotAlreadyExist(@Nonnull ItemGroup<?> parent, @Nonnull String newName, @CheckForNull Item variant) throws IllegalArgumentException, Failure { Item existing; try (ACLContext ctxt = ACL.as(ACL.SYSTEM)) { existing = parent.getItem(newName); } if (existing != null && existing != variant) { if (existing.hasPermission(Item.DISCOVER)) { String prefix = parent.getFullName(); throw new IllegalArgumentException((prefix.isEmpty() ? "" : prefix + "/") + newName + " already exists"); } else { // Cannot hide its existence, so at least be as vague as possible. throw new Failure(""); } } }
java
static void verifyItemDoesNotAlreadyExist(@Nonnull ItemGroup<?> parent, @Nonnull String newName, @CheckForNull Item variant) throws IllegalArgumentException, Failure { Item existing; try (ACLContext ctxt = ACL.as(ACL.SYSTEM)) { existing = parent.getItem(newName); } if (existing != null && existing != variant) { if (existing.hasPermission(Item.DISCOVER)) { String prefix = parent.getFullName(); throw new IllegalArgumentException((prefix.isEmpty() ? "" : prefix + "/") + newName + " already exists"); } else { // Cannot hide its existence, so at least be as vague as possible. throw new Failure(""); } } }
[ "static", "void", "verifyItemDoesNotAlreadyExist", "(", "@", "Nonnull", "ItemGroup", "<", "?", ">", "parent", ",", "@", "Nonnull", "String", "newName", ",", "@", "CheckForNull", "Item", "variant", ")", "throws", "IllegalArgumentException", ",", "Failure", "{", "...
Securely check for the existence of an item before trying to create one with the same name. @param parent the folder where we are about to create/rename/move an item @param newName the proposed new name @param variant if not null, an existing item which we accept could be there @throws IllegalArgumentException if there is already something there, which you were supposed to know about @throws Failure if there is already something there but you should not be told details
[ "Securely", "check", "for", "the", "existence", "of", "an", "item", "before", "trying", "to", "create", "one", "with", "the", "same", "name", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/Items.java#L633-L647
snowflakedb/snowflake-jdbc
src/main/java/net/snowflake/client/core/EventHandler.java
EventHandler.pushEvent
private synchronized void pushEvent(Event event, boolean flushBuffer) { eventBuffer.add(event); if (flushBuffer || eventBuffer.size() >= maxEntries) { this.flushEventBuffer(); } }
java
private synchronized void pushEvent(Event event, boolean flushBuffer) { eventBuffer.add(event); if (flushBuffer || eventBuffer.size() >= maxEntries) { this.flushEventBuffer(); } }
[ "private", "synchronized", "void", "pushEvent", "(", "Event", "event", ",", "boolean", "flushBuffer", ")", "{", "eventBuffer", ".", "add", "(", "event", ")", ";", "if", "(", "flushBuffer", "||", "eventBuffer", ".", "size", "(", ")", ">=", "maxEntries", ")"...
/* Pushes an event onto the event buffer and flushes if specified or if the buffer has reached maximum capacity.
[ "/", "*", "Pushes", "an", "event", "onto", "the", "event", "buffer", "and", "flushes", "if", "specified", "or", "if", "the", "buffer", "has", "reached", "maximum", "capacity", "." ]
train
https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/EventHandler.java#L234-L242
maxmind/geoip-api-java
src/main/java/com/maxmind/geoip/LookupService.java
LookupService.getCountryV6
public synchronized Country getCountryV6(InetAddress addr) { if (file == null && (dboptions & GEOIP_MEMORY_CACHE) == 0) { throw new IllegalStateException("Database has been closed."); } int ret = seekCountryV6(addr) - COUNTRY_BEGIN; if (ret == 0) { return UNKNOWN_COUNTRY; } else { return new Country(countryCode[ret], countryName[ret]); } }
java
public synchronized Country getCountryV6(InetAddress addr) { if (file == null && (dboptions & GEOIP_MEMORY_CACHE) == 0) { throw new IllegalStateException("Database has been closed."); } int ret = seekCountryV6(addr) - COUNTRY_BEGIN; if (ret == 0) { return UNKNOWN_COUNTRY; } else { return new Country(countryCode[ret], countryName[ret]); } }
[ "public", "synchronized", "Country", "getCountryV6", "(", "InetAddress", "addr", ")", "{", "if", "(", "file", "==", "null", "&&", "(", "dboptions", "&", "GEOIP_MEMORY_CACHE", ")", "==", "0", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Database h...
Returns the country the IP address is in. @param addr the IP address as Inet6Address. @return the country the IP address is from.
[ "Returns", "the", "country", "the", "IP", "address", "is", "in", "." ]
train
https://github.com/maxmind/geoip-api-java/blob/baae36617ba6c5004370642716bc6e526774ba87/src/main/java/com/maxmind/geoip/LookupService.java#L472-L482
phax/ph-oton
ph-oton-html/src/main/java/com/helger/html/hc/HCHelper.java
HCHelper.iterateChildren
public static void iterateChildren (@Nonnull final IHCNode aNode, @Nonnull final IHCIteratorCallback aCallback) { ValueEnforcer.notNull (aNode, "node"); ValueEnforcer.notNull (aCallback, "callback"); _recursiveIterateTreeBreakable (aNode, aCallback); }
java
public static void iterateChildren (@Nonnull final IHCNode aNode, @Nonnull final IHCIteratorCallback aCallback) { ValueEnforcer.notNull (aNode, "node"); ValueEnforcer.notNull (aCallback, "callback"); _recursiveIterateTreeBreakable (aNode, aCallback); }
[ "public", "static", "void", "iterateChildren", "(", "@", "Nonnull", "final", "IHCNode", "aNode", ",", "@", "Nonnull", "final", "IHCIteratorCallback", "aCallback", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aNode", ",", "\"node\"", ")", ";", "ValueEnforcer"...
Recursively iterate all child nodes of the passed node. @param aNode The node who's children should be iterated. @param aCallback The callback to be invoked on every child
[ "Recursively", "iterate", "all", "child", "nodes", "of", "the", "passed", "node", "." ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/hc/HCHelper.java#L138-L144
ist-dresden/composum
sling/core/commons/src/main/java/com/composum/sling/clientlibs/servlet/ClientlibServlet.java
ClientlibServlet.appendHashSuffix
public static String appendHashSuffix(String url, String hash) { if (null == hash) return url; Matcher matcher = FILENAME_PATTERN.matcher(url); String fname = ""; if (matcher.find()) fname = matcher.group(0); return url + "/" + hash + "/" + fname; }
java
public static String appendHashSuffix(String url, String hash) { if (null == hash) return url; Matcher matcher = FILENAME_PATTERN.matcher(url); String fname = ""; if (matcher.find()) fname = matcher.group(0); return url + "/" + hash + "/" + fname; }
[ "public", "static", "String", "appendHashSuffix", "(", "String", "url", ",", "String", "hash", ")", "{", "if", "(", "null", "==", "hash", ")", "return", "url", ";", "Matcher", "matcher", "=", "FILENAME_PATTERN", ".", "matcher", "(", "url", ")", ";", "Str...
Appends a suffix containing the hash code, if given. The file name is repeated to satisfy browsers with the correct type and file name, though it is not used by the servlet. @param url an url to which we append the suffix @param hash optional, the hash code @return the url with suffix /{hash}/{filename} appended, where {filename} is the last part of a / separated url.
[ "Appends", "a", "suffix", "containing", "the", "hash", "code", "if", "given", ".", "The", "file", "name", "is", "repeated", "to", "satisfy", "browsers", "with", "the", "correct", "type", "and", "file", "name", "though", "it", "is", "not", "used", "by", "...
train
https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/clientlibs/servlet/ClientlibServlet.java#L86-L92
apache/groovy
subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java
DateTimeExtensions.plus
public static DayOfWeek plus(final DayOfWeek self, int days) { int daysPerWeek = DayOfWeek.values().length; int val = ((self.getValue() + days - 1) % daysPerWeek) + 1; return DayOfWeek.of(val > 0 ? val : daysPerWeek + val); }
java
public static DayOfWeek plus(final DayOfWeek self, int days) { int daysPerWeek = DayOfWeek.values().length; int val = ((self.getValue() + days - 1) % daysPerWeek) + 1; return DayOfWeek.of(val > 0 ? val : daysPerWeek + val); }
[ "public", "static", "DayOfWeek", "plus", "(", "final", "DayOfWeek", "self", ",", "int", "days", ")", "{", "int", "daysPerWeek", "=", "DayOfWeek", ".", "values", "(", ")", ".", "length", ";", "int", "val", "=", "(", "(", "self", ".", "getValue", "(", ...
Returns the {@link java.time.DayOfWeek} that is {@code days} many days after this day of the week. @param self a DayOfWeek @param days the number of days to move forward @return the DayOfWeek @since 2.5.0
[ "Returns", "the", "{", "@link", "java", ".", "time", ".", "DayOfWeek", "}", "that", "is", "{", "@code", "days", "}", "many", "days", "after", "this", "day", "of", "the", "week", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java#L1980-L1984
lukas-krecan/json2xml
src/main/java/net/javacrumbs/json2xml/JsonXmlHelper.java
JsonXmlHelper.convertElement
private static void convertElement(JsonGenerator generator, Element element, boolean isArrayItem, ElementNameConverter converter) throws IOException { TYPE type = toTYPE(element.getAttribute("type")); String name = element.getTagName(); if (!isArrayItem) { generator.writeFieldName(converter.convertName(name)); } switch (type) { case OBJECT: generator.writeStartObject(); convertChildren(generator, element, false, converter); generator.writeEndObject(); break; case ARRAY: generator.writeStartArray(); convertChildren(generator, element, true, converter); generator.writeEndArray(); break; case STRING: generator.writeString(element.getTextContent()); break; case INT: case FLOAT: generator.writeNumber(new BigDecimal(element.getTextContent())); break; case BOOLEAN: generator.writeBoolean(Boolean.parseBoolean(element.getTextContent())); break; case NULL: generator.writeNull(); break; } }
java
private static void convertElement(JsonGenerator generator, Element element, boolean isArrayItem, ElementNameConverter converter) throws IOException { TYPE type = toTYPE(element.getAttribute("type")); String name = element.getTagName(); if (!isArrayItem) { generator.writeFieldName(converter.convertName(name)); } switch (type) { case OBJECT: generator.writeStartObject(); convertChildren(generator, element, false, converter); generator.writeEndObject(); break; case ARRAY: generator.writeStartArray(); convertChildren(generator, element, true, converter); generator.writeEndArray(); break; case STRING: generator.writeString(element.getTextContent()); break; case INT: case FLOAT: generator.writeNumber(new BigDecimal(element.getTextContent())); break; case BOOLEAN: generator.writeBoolean(Boolean.parseBoolean(element.getTextContent())); break; case NULL: generator.writeNull(); break; } }
[ "private", "static", "void", "convertElement", "(", "JsonGenerator", "generator", ",", "Element", "element", ",", "boolean", "isArrayItem", ",", "ElementNameConverter", "converter", ")", "throws", "IOException", "{", "TYPE", "type", "=", "toTYPE", "(", "element", ...
Convert a DOM element to Json, with special handling for arrays since arrays don't exist in XML. @param generator @param element @param isArrayItem @throws IOException
[ "Convert", "a", "DOM", "element", "to", "Json", "with", "special", "handling", "for", "arrays", "since", "arrays", "don", "t", "exist", "in", "XML", "." ]
train
https://github.com/lukas-krecan/json2xml/blob/8fba4f942ebed5d6f7ad851390c634fff8559cac/src/main/java/net/javacrumbs/json2xml/JsonXmlHelper.java#L130-L163
dnsjava/dnsjava
org/xbill/DNS/Cache.java
Cache.lookupRecords
public SetResponse lookupRecords(Name name, int type, int minCred) { return lookup(name, type, minCred); }
java
public SetResponse lookupRecords(Name name, int type, int minCred) { return lookup(name, type, minCred); }
[ "public", "SetResponse", "lookupRecords", "(", "Name", "name", ",", "int", "type", ",", "int", "minCred", ")", "{", "return", "lookup", "(", "name", ",", "type", ",", "minCred", ")", ";", "}" ]
Looks up Records in the Cache. This follows CNAMEs and handles negatively cached data. @param name The name to look up @param type The type to look up @param minCred The minimum acceptable credibility @return A SetResponse object @see SetResponse @see Credibility
[ "Looks", "up", "Records", "in", "the", "Cache", ".", "This", "follows", "CNAMEs", "and", "handles", "negatively", "cached", "data", "." ]
train
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Cache.java#L511-L514
OpenLiberty/open-liberty
dev/com.ibm.ws.session.cache/src/com/ibm/ws/session/store/cache/TypeConversion.java
TypeConversion.bytesToShort
public static short bytesToShort(byte[] bytes, int offset) { short result = 0x0; for (int i = offset; i < offset + 2; ++i) { result = (short) ((result) << 8); result |= (bytes[i] & 0x00FF); } return result; }
java
public static short bytesToShort(byte[] bytes, int offset) { short result = 0x0; for (int i = offset; i < offset + 2; ++i) { result = (short) ((result) << 8); result |= (bytes[i] & 0x00FF); } return result; }
[ "public", "static", "short", "bytesToShort", "(", "byte", "[", "]", "bytes", ",", "int", "offset", ")", "{", "short", "result", "=", "0x0", ";", "for", "(", "int", "i", "=", "offset", ";", "i", "<", "offset", "+", "2", ";", "++", "i", ")", "{", ...
A utility method to convert the short from the byte array to a short. @param bytes The byte array containing the short. @param offset The index at which the short is located. @return The short value.
[ "A", "utility", "method", "to", "convert", "the", "short", "from", "the", "byte", "array", "to", "a", "short", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session.cache/src/com/ibm/ws/session/store/cache/TypeConversion.java#L47-L54
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/utility/PRJUtil.java
PRJUtil.getValidSRID
public static int getValidSRID(Connection connection, File prjFile) throws SQLException, IOException { int srid = getSRID(prjFile); if(!isSRIDValid(srid, connection)){ srid = 0; } return srid; }
java
public static int getValidSRID(Connection connection, File prjFile) throws SQLException, IOException { int srid = getSRID(prjFile); if(!isSRIDValid(srid, connection)){ srid = 0; } return srid; }
[ "public", "static", "int", "getValidSRID", "(", "Connection", "connection", ",", "File", "prjFile", ")", "throws", "SQLException", ",", "IOException", "{", "int", "srid", "=", "getSRID", "(", "prjFile", ")", ";", "if", "(", "!", "isSRIDValid", "(", "srid", ...
Get a valid SRID value from a prj file. If the the prj file - is null, - doesn't contain a valid srid code, - is empty * then a default srid equals to 0 is added. @param connection @param prjFile @return @throws SQLException @throws IOException
[ "Get", "a", "valid", "SRID", "value", "from", "a", "prj", "file", ".", "If", "the", "the", "prj", "file", "-", "is", "null", "-", "doesn", "t", "contain", "a", "valid", "srid", "code", "-", "is", "empty", "*", "then", "a", "default", "srid", "equal...
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/utility/PRJUtil.java#L95-L101
dashorst/wicket-stuff-markup-validator
jing/src/main/java/com/thaiopensource/validate/nvdl/FilteredAttributes.java
FilteredAttributes.getValue
public String getValue(String uri, String localName) { return attributes.getValue(getRealIndex(uri, localName)); }
java
public String getValue(String uri, String localName) { return attributes.getValue(getRealIndex(uri, localName)); }
[ "public", "String", "getValue", "(", "String", "uri", ",", "String", "localName", ")", "{", "return", "attributes", ".", "getValue", "(", "getRealIndex", "(", "uri", ",", "localName", ")", ")", ";", "}" ]
Get the value of the attribute. @param uri The attribute uri. @param localName The attribute local name.
[ "Get", "the", "value", "of", "the", "attribute", "." ]
train
https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/validate/nvdl/FilteredAttributes.java#L167-L169
apache/flink
flink-core/src/main/java/org/apache/flink/configuration/Configuration.java
Configuration.setFloat
@PublicEvolving public void setFloat(ConfigOption<Float> key, float value) { setValueInternal(key.key(), value); }
java
@PublicEvolving public void setFloat(ConfigOption<Float> key, float value) { setValueInternal(key.key(), value); }
[ "@", "PublicEvolving", "public", "void", "setFloat", "(", "ConfigOption", "<", "Float", ">", "key", ",", "float", "value", ")", "{", "setValueInternal", "(", "key", ".", "key", "(", ")", ",", "value", ")", ";", "}" ]
Adds the given value to the configuration object. The main key of the config option will be used to map the value. @param key the option specifying the key to be added @param value the value of the key/value pair to be added
[ "Adds", "the", "given", "value", "to", "the", "configuration", "object", ".", "The", "main", "key", "of", "the", "config", "option", "will", "be", "used", "to", "map", "the", "value", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L486-L489
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.availableDefaultSipDomains_GET
public ArrayList<OvhDefaultSipDomains> availableDefaultSipDomains_GET(OvhSipDomainProductTypeEnum type) throws IOException { String qPath = "/telephony/availableDefaultSipDomains"; StringBuilder sb = path(qPath); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
java
public ArrayList<OvhDefaultSipDomains> availableDefaultSipDomains_GET(OvhSipDomainProductTypeEnum type) throws IOException { String qPath = "/telephony/availableDefaultSipDomains"; StringBuilder sb = path(qPath); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "OvhDefaultSipDomains", ">", "availableDefaultSipDomains_GET", "(", "OvhSipDomainProductTypeEnum", "type", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/availableDefaultSipDomains\"", ";", "StringBuilder", "sb", "=", "p...
Get all available SIP domains by country REST: GET /telephony/availableDefaultSipDomains @param type [required] Product type
[ "Get", "all", "available", "SIP", "domains", "by", "country" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L207-L213
rolfl/MicroBench
src/main/java/net/tuis/ubench/UBench.java
UBench.addLongTask
public UBench addLongTask(String name, LongSupplier task, LongPredicate check) { return putTask(name, () -> { long start = System.nanoTime(); long result = task.getAsLong(); long time = System.nanoTime() - start; if (check != null && !check.test(result)) { throw new UBenchRuntimeException(String.format("Task %s failed Result: %d", name, result)); } return time; }); }
java
public UBench addLongTask(String name, LongSupplier task, LongPredicate check) { return putTask(name, () -> { long start = System.nanoTime(); long result = task.getAsLong(); long time = System.nanoTime() - start; if (check != null && !check.test(result)) { throw new UBenchRuntimeException(String.format("Task %s failed Result: %d", name, result)); } return time; }); }
[ "public", "UBench", "addLongTask", "(", "String", "name", ",", "LongSupplier", "task", ",", "LongPredicate", "check", ")", "{", "return", "putTask", "(", "name", ",", "(", ")", "->", "{", "long", "start", "=", "System", ".", "nanoTime", "(", ")", ";", ...
Include a long-specialized named task (and validator) in to the benchmark. @param name The name of the task. Only one task with any one name is allowed. @param task The task to perform @param check The check of the results from the task. @return The same object, for chaining calls.
[ "Include", "a", "long", "-", "specialized", "named", "task", "(", "and", "validator", ")", "in", "to", "the", "benchmark", "." ]
train
https://github.com/rolfl/MicroBench/blob/f2bfa92dacd7ea0d6b8eae4d4fe2975139d317ce/src/main/java/net/tuis/ubench/UBench.java#L209-L219
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
ToStringStyle.appendDetail
protected void appendDetail(final StringBuffer buffer, final String fieldName, final Object value) { buffer.append(value); }
java
protected void appendDetail(final StringBuffer buffer, final String fieldName, final Object value) { buffer.append(value); }
[ "protected", "void", "appendDetail", "(", "final", "StringBuffer", "buffer", ",", "final", "String", "fieldName", ",", "final", "Object", "value", ")", "{", "buffer", ".", "append", "(", "value", ")", ";", "}" ]
<p>Append to the <code>toString</code> an <code>Object</code> value, printing the full detail of the <code>Object</code>.</p> @param buffer the <code>StringBuffer</code> to populate @param fieldName the field name, typically not used as already appended @param value the value to add to the <code>toString</code>, not <code>null</code>
[ "<p", ">", "Append", "to", "the", "<code", ">", "toString<", "/", "code", ">", "an", "<code", ">", "Object<", "/", "code", ">", "value", "printing", "the", "full", "detail", "of", "the", "<code", ">", "Object<", "/", "code", ">", ".", "<", "/", "p"...
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java#L625-L627
yan74/afplib
org.afplib/src/main/java/org/afplib/base/util/BaseValidator.java
BaseValidator.validateModcaString32_MinLength
public boolean validateModcaString32_MinLength(String modcaString32, DiagnosticChain diagnostics, Map<Object, Object> context) { int length = modcaString32.length(); boolean result = length >= 32; if (!result && diagnostics != null) reportMinLengthViolation(BasePackage.Literals.MODCA_STRING32, modcaString32, length, 32, diagnostics, context); return result; }
java
public boolean validateModcaString32_MinLength(String modcaString32, DiagnosticChain diagnostics, Map<Object, Object> context) { int length = modcaString32.length(); boolean result = length >= 32; if (!result && diagnostics != null) reportMinLengthViolation(BasePackage.Literals.MODCA_STRING32, modcaString32, length, 32, diagnostics, context); return result; }
[ "public", "boolean", "validateModcaString32_MinLength", "(", "String", "modcaString32", ",", "DiagnosticChain", "diagnostics", ",", "Map", "<", "Object", ",", "Object", ">", "context", ")", "{", "int", "length", "=", "modcaString32", ".", "length", "(", ")", ";"...
Validates the MinLength constraint of '<em>Modca String32</em>'. <!-- begin-user-doc --> <!-- end-user-doc --> @generated
[ "Validates", "the", "MinLength", "constraint", "of", "<em", ">", "Modca", "String32<", "/", "em", ">", ".", "<!", "--", "begin", "-", "user", "-", "doc", "--", ">", "<!", "--", "end", "-", "user", "-", "doc", "--", ">" ]
train
https://github.com/yan74/afplib/blob/9ff0513f9448bdf8c0b0e31dc4910c094c48fb2f/org.afplib/src/main/java/org/afplib/base/util/BaseValidator.java#L264-L270
graknlabs/grakn
server/src/server/session/TransactionOLTP.java
TransactionOLTP.putSchemaConcept
private <T extends SchemaConcept> T putSchemaConcept(Label label, Schema.BaseType baseType, boolean isImplicit, Function<VertexElement, T> newConceptFactory) { //Get the type if it already exists otherwise build a new one SchemaConceptImpl schemaConcept = getSchemaConcept(convertToId(label)); if (schemaConcept == null) { if (!isImplicit && label.getValue().startsWith(Schema.ImplicitType.RESERVED.getValue())) { throw TransactionException.invalidLabelStart(label); } VertexElement vertexElement = addTypeVertex(getNextId(), label, baseType); //Mark it as implicit here so we don't have to pass it down the constructors if (isImplicit) { vertexElement.property(Schema.VertexProperty.IS_IMPLICIT, true); } // if the schema concept is not in janus, create it here schemaConcept = SchemaConceptImpl.from(newConceptFactory.apply(vertexElement)); } else if (!baseType.equals(schemaConcept.baseType())) { throw labelTaken(schemaConcept); } //noinspection unchecked return (T) schemaConcept; }
java
private <T extends SchemaConcept> T putSchemaConcept(Label label, Schema.BaseType baseType, boolean isImplicit, Function<VertexElement, T> newConceptFactory) { //Get the type if it already exists otherwise build a new one SchemaConceptImpl schemaConcept = getSchemaConcept(convertToId(label)); if (schemaConcept == null) { if (!isImplicit && label.getValue().startsWith(Schema.ImplicitType.RESERVED.getValue())) { throw TransactionException.invalidLabelStart(label); } VertexElement vertexElement = addTypeVertex(getNextId(), label, baseType); //Mark it as implicit here so we don't have to pass it down the constructors if (isImplicit) { vertexElement.property(Schema.VertexProperty.IS_IMPLICIT, true); } // if the schema concept is not in janus, create it here schemaConcept = SchemaConceptImpl.from(newConceptFactory.apply(vertexElement)); } else if (!baseType.equals(schemaConcept.baseType())) { throw labelTaken(schemaConcept); } //noinspection unchecked return (T) schemaConcept; }
[ "private", "<", "T", "extends", "SchemaConcept", ">", "T", "putSchemaConcept", "(", "Label", "label", ",", "Schema", ".", "BaseType", "baseType", ",", "boolean", "isImplicit", ",", "Function", "<", "VertexElement", ",", "T", ">", "newConceptFactory", ")", "{",...
This is a helper method which will either find or create a SchemaConcept. When a new SchemaConcept is created it is added for validation through it's own creation method for example RoleImpl#create(VertexElement, Role). <p> When an existing SchemaConcept is found it is build via it's get method such as RoleImpl#get(VertexElement) and skips validation. <p> Once the SchemaConcept is found or created a few checks for uniqueness and correct Schema.BaseType are performed. @param label The Label of the SchemaConcept to find or create @param baseType The Schema.BaseType of the SchemaConcept to find or create @param isImplicit a flag indicating if the label we are creating is for an implicit grakn.core.concept.type.Type or not @param newConceptFactory the factory to be using when creating a new SchemaConcept @param <T> The type of SchemaConcept to return @return a new or existing SchemaConcept
[ "This", "is", "a", "helper", "method", "which", "will", "either", "find", "or", "create", "a", "SchemaConcept", ".", "When", "a", "new", "SchemaConcept", "is", "created", "it", "is", "added", "for", "validation", "through", "it", "s", "own", "creation", "m...
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/session/TransactionOLTP.java#L516-L539
dita-ot/dita-ot
src/main/java/org/dita/dost/module/ImageMetadataModule.java
ImageMetadataModule.execute
@Override public AbstractPipelineOutput execute(final AbstractPipelineInput input) throws DITAOTException { if (logger == null) { throw new IllegalStateException("Logger not set"); } final Collection<FileInfo> images = job.getFileInfo(f -> ATTR_FORMAT_VALUE_IMAGE.equals(f.format) || ATTR_FORMAT_VALUE_HTML.equals(f.format)); if (!images.isEmpty()) { final File outputDir = new File(input.getAttribute(ANT_INVOKER_EXT_PARAM_OUTPUTDIR)); final ImageMetadataFilter writer = new ImageMetadataFilter(outputDir, job); writer.setLogger(logger); writer.setJob(job); final Predicate<FileInfo> filter = fileInfoFilter != null ? fileInfoFilter : f -> !f.isResourceOnly && ATTR_FORMAT_VALUE_DITA.equals(f.format); for (final FileInfo f : job.getFileInfo(filter)) { writer.write(new File(job.tempDir, f.file.getPath()).getAbsoluteFile()); } storeImageFormat(writer.getImages(), outputDir); try { job.write(); } catch (IOException e) { throw new DITAOTException("Failed to serialize job configuration: " + e.getMessage(), e); } } return null; }
java
@Override public AbstractPipelineOutput execute(final AbstractPipelineInput input) throws DITAOTException { if (logger == null) { throw new IllegalStateException("Logger not set"); } final Collection<FileInfo> images = job.getFileInfo(f -> ATTR_FORMAT_VALUE_IMAGE.equals(f.format) || ATTR_FORMAT_VALUE_HTML.equals(f.format)); if (!images.isEmpty()) { final File outputDir = new File(input.getAttribute(ANT_INVOKER_EXT_PARAM_OUTPUTDIR)); final ImageMetadataFilter writer = new ImageMetadataFilter(outputDir, job); writer.setLogger(logger); writer.setJob(job); final Predicate<FileInfo> filter = fileInfoFilter != null ? fileInfoFilter : f -> !f.isResourceOnly && ATTR_FORMAT_VALUE_DITA.equals(f.format); for (final FileInfo f : job.getFileInfo(filter)) { writer.write(new File(job.tempDir, f.file.getPath()).getAbsoluteFile()); } storeImageFormat(writer.getImages(), outputDir); try { job.write(); } catch (IOException e) { throw new DITAOTException("Failed to serialize job configuration: " + e.getMessage(), e); } } return null; }
[ "@", "Override", "public", "AbstractPipelineOutput", "execute", "(", "final", "AbstractPipelineInput", "input", ")", "throws", "DITAOTException", "{", "if", "(", "logger", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Logger not set\"", ")...
Entry point of image metadata ModuleElem. @param input Input parameters and resources. @return null @throws DITAOTException exception
[ "Entry", "point", "of", "image", "metadata", "ModuleElem", "." ]
train
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/ImageMetadataModule.java#L43-L72
jglobus/JGlobus
gridftp/src/main/java/org/globus/ftp/FTPClient.java
FTPClient.asynchGet
public TransferState asynchGet(String remoteFileName, DataSink sink, MarkerListener mListener) throws IOException, ClientException, ServerException { checkTransferParamsGet(); localServer.store(sink); controlChannel.write(new Command("RETR", remoteFileName)); return transferStart(localServer.getControlChannel(), mListener); }
java
public TransferState asynchGet(String remoteFileName, DataSink sink, MarkerListener mListener) throws IOException, ClientException, ServerException { checkTransferParamsGet(); localServer.store(sink); controlChannel.write(new Command("RETR", remoteFileName)); return transferStart(localServer.getControlChannel(), mListener); }
[ "public", "TransferState", "asynchGet", "(", "String", "remoteFileName", ",", "DataSink", "sink", ",", "MarkerListener", "mListener", ")", "throws", "IOException", ",", "ClientException", ",", "ServerException", "{", "checkTransferParamsGet", "(", ")", ";", "localServ...
Retrieves the file from the remote server. @param remoteFileName remote file name @param sink sink to which the data will be written @param mListener restart marker listener (currently not used)
[ "Retrieves", "the", "file", "from", "the", "remote", "server", "." ]
train
https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gridftp/src/main/java/org/globus/ftp/FTPClient.java#L1262-L1272
alibaba/jstorm
jstorm-core/src/main/java/backtype/storm/topology/TopologyBuilder.java
TopologyBuilder.setBolt
public <T extends State> BoltDeclarer setBolt(String id, IStatefulBolt<T> bolt, Number parallelism_hint) throws IllegalArgumentException { hasStatefulBolt = true; return setBolt(id, new StatefulBoltExecutor<T>(bolt), parallelism_hint); }
java
public <T extends State> BoltDeclarer setBolt(String id, IStatefulBolt<T> bolt, Number parallelism_hint) throws IllegalArgumentException { hasStatefulBolt = true; return setBolt(id, new StatefulBoltExecutor<T>(bolt), parallelism_hint); }
[ "public", "<", "T", "extends", "State", ">", "BoltDeclarer", "setBolt", "(", "String", "id", ",", "IStatefulBolt", "<", "T", ">", "bolt", ",", "Number", "parallelism_hint", ")", "throws", "IllegalArgumentException", "{", "hasStatefulBolt", "=", "true", ";", "r...
Define a new bolt in this topology. This defines a stateful bolt, that requires its state (of computation) to be saved. When this bolt is initialized, the {@link IStatefulBolt#initState(State)} method is invoked after {@link IStatefulBolt#prepare(Map, TopologyContext, OutputCollector)} but before {@link IStatefulBolt#execute(Tuple)} with its previously saved state. <p> The framework provides at-least once guarantee for the state updates. Bolts (both stateful and non-stateful) in a stateful topology are expected to anchor the tuples while emitting and ack the input tuples once its processed. </p> @param id the id of this component. This id is referenced by other components that want to consume this bolt's outputs. @param bolt the stateful bolt @param parallelism_hint the number of tasks that should be assigned to execute this bolt. Each task will run on a thread in a process somwehere around the cluster. @return use the returned object to declare the inputs to this component @throws IllegalArgumentException if {@code parallelism_hint} is not positive
[ "Define", "a", "new", "bolt", "in", "this", "topology", ".", "This", "defines", "a", "stateful", "bolt", "that", "requires", "its", "state", "(", "of", "computation", ")", "to", "be", "saved", ".", "When", "this", "bolt", "is", "initialized", "the", "{" ...
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/backtype/storm/topology/TopologyBuilder.java#L278-L281
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/PathAndPackageVerifier.java
PathAndPackageVerifier.checkPathAndPackage
private boolean checkPathAndPackage(Path dir, JCTree pkgName) { Iterator<String> pathIter = new ParentIterator(dir); Iterator<String> pkgIter = new EnclosingPkgIterator(pkgName); while (pathIter.hasNext() && pkgIter.hasNext()) { if (!pathIter.next().equals(pkgIter.next())) return false; } return !pkgIter.hasNext(); /*&& !pathIter.hasNext() See JDK-8059598 */ }
java
private boolean checkPathAndPackage(Path dir, JCTree pkgName) { Iterator<String> pathIter = new ParentIterator(dir); Iterator<String> pkgIter = new EnclosingPkgIterator(pkgName); while (pathIter.hasNext() && pkgIter.hasNext()) { if (!pathIter.next().equals(pkgIter.next())) return false; } return !pkgIter.hasNext(); /*&& !pathIter.hasNext() See JDK-8059598 */ }
[ "private", "boolean", "checkPathAndPackage", "(", "Path", "dir", ",", "JCTree", "pkgName", ")", "{", "Iterator", "<", "String", ">", "pathIter", "=", "new", "ParentIterator", "(", "dir", ")", ";", "Iterator", "<", "String", ">", "pkgIter", "=", "new", "Enc...
/* Returns true if dir matches pkgName. Examples: (a/b/c, a.b.c) gives true (i/j/k, i.x.k) gives false Currently (x/a/b/c, a.b.c) also gives true. See JDK-8059598.
[ "/", "*", "Returns", "true", "if", "dir", "matches", "pkgName", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/PathAndPackageVerifier.java#L96-L104
dain/leveldb
leveldb/src/main/java/org/iq80/leveldb/util/Slice.java
Slice.getBytes
public void getBytes(int index, Slice dst, int dstIndex, int length) { getBytes(index, dst.data, dstIndex, length); }
java
public void getBytes(int index, Slice dst, int dstIndex, int length) { getBytes(index, dst.data, dstIndex, length); }
[ "public", "void", "getBytes", "(", "int", "index", ",", "Slice", "dst", ",", "int", "dstIndex", ",", "int", "length", ")", "{", "getBytes", "(", "index", ",", "dst", ".", "data", ",", "dstIndex", ",", "length", ")", ";", "}" ]
Transfers this buffer's data to the specified destination starting at the specified absolute {@code index}. @param dstIndex the first index of the destination @param length the number of bytes to transfer @throws IndexOutOfBoundsException if the specified {@code index} is less than {@code 0}, if the specified {@code dstIndex} is less than {@code 0}, if {@code index + length} is greater than {@code this.capacity}, or if {@code dstIndex + length} is greater than {@code dst.capacity}
[ "Transfers", "this", "buffer", "s", "data", "to", "the", "specified", "destination", "starting", "at", "the", "specified", "absolute", "{", "@code", "index", "}", "." ]
train
https://github.com/dain/leveldb/blob/7994065b48eada2ef29e7fefd172c2ad1e0110eb/leveldb/src/main/java/org/iq80/leveldb/util/Slice.java#L189-L192
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/Project.java
Project.getTotalDetailEstimate
public Double getTotalDetailEstimate(WorkitemFilter filter, boolean includeChildProjects) { filter = (filter != null) ? filter : new WorkitemFilter(); return getRollup("Workitems", "DetailEstimate", filter, includeChildProjects); }
java
public Double getTotalDetailEstimate(WorkitemFilter filter, boolean includeChildProjects) { filter = (filter != null) ? filter : new WorkitemFilter(); return getRollup("Workitems", "DetailEstimate", filter, includeChildProjects); }
[ "public", "Double", "getTotalDetailEstimate", "(", "WorkitemFilter", "filter", ",", "boolean", "includeChildProjects", ")", "{", "filter", "=", "(", "filter", "!=", "null", ")", "?", "filter", ":", "new", "WorkitemFilter", "(", ")", ";", "return", "getRollup", ...
Count the total detail estimate for all workitems in this project optionally filtered. @param filter Criteria to filter workitems on. @param includeChildProjects If true, include open sub projects, otherwise only include this project. @return total detail estimate for all workitems in this project optionally filtered.
[ "Count", "the", "total", "detail", "estimate", "for", "all", "workitems", "in", "this", "project", "optionally", "filtered", "." ]
train
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/Project.java#L1101-L1106
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/EnvelopesApi.java
EnvelopesApi.listTabs
public Tabs listTabs(String accountId, String envelopeId, String recipientId) throws ApiException { return listTabs(accountId, envelopeId, recipientId, null); }
java
public Tabs listTabs(String accountId, String envelopeId, String recipientId) throws ApiException { return listTabs(accountId, envelopeId, recipientId, null); }
[ "public", "Tabs", "listTabs", "(", "String", "accountId", ",", "String", "envelopeId", ",", "String", "recipientId", ")", "throws", "ApiException", "{", "return", "listTabs", "(", "accountId", ",", "envelopeId", ",", "recipientId", ",", "null", ")", ";", "}" ]
Gets the tabs information for a signer or sign-in-person recipient in an envelope. Retrieves information about the tabs associated with a recipient in a draft envelope. @param accountId The external account number (int) or account ID Guid. (required) @param envelopeId The envelopeId Guid of the envelope being accessed. (required) @param recipientId The ID of the recipient being accessed. (required) @return Tabs
[ "Gets", "the", "tabs", "information", "for", "a", "signer", "or", "sign", "-", "in", "-", "person", "recipient", "in", "an", "envelope", ".", "Retrieves", "information", "about", "the", "tabs", "associated", "with", "a", "recipient", "in", "a", "draft", "e...
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/EnvelopesApi.java#L4255-L4257
aws/aws-sdk-java
aws-java-sdk-core/src/main/java/com/amazonaws/util/TimingInfo.java
TimingInfo.newTimingInfoFullSupport
public static TimingInfo newTimingInfoFullSupport(long startTimeNano, long endTimeNano) { return new TimingInfoFullSupport(null, startTimeNano, Long.valueOf(endTimeNano)); }
java
public static TimingInfo newTimingInfoFullSupport(long startTimeNano, long endTimeNano) { return new TimingInfoFullSupport(null, startTimeNano, Long.valueOf(endTimeNano)); }
[ "public", "static", "TimingInfo", "newTimingInfoFullSupport", "(", "long", "startTimeNano", ",", "long", "endTimeNano", ")", "{", "return", "new", "TimingInfoFullSupport", "(", "null", ",", "startTimeNano", ",", "Long", ".", "valueOf", "(", "endTimeNano", ")", ")"...
Returns a {@link TimingInfoFullSupport} based on the given start and end time in nanosecond, ignoring the wall clock time. @param startTimeNano start time in nanosecond @param endTimeNano end time in nanosecond
[ "Returns", "a", "{", "@link", "TimingInfoFullSupport", "}", "based", "on", "the", "given", "start", "and", "end", "time", "in", "nanosecond", "ignoring", "the", "wall", "clock", "time", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/util/TimingInfo.java#L116-L118
looly/hutool
hutool-core/src/main/java/cn/hutool/core/convert/Convert.java
Convert.toEnum
public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value) { return toEnum(clazz, value, null); }
java
public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value) { return toEnum(clazz, value, null); }
[ "public", "static", "<", "E", "extends", "Enum", "<", "E", ">", ">", "E", "toEnum", "(", "Class", "<", "E", ">", "clazz", ",", "Object", "value", ")", "{", "return", "toEnum", "(", "clazz", ",", "value", ",", "null", ")", ";", "}" ]
转换为Enum对象<br> 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> @param <E> 枚举类型 @param clazz Enum的Class @param value 值 @return Enum
[ "转换为Enum对象<br", ">", "如果给定的值为空,或者转换失败,返回默认值<code", ">", "null<", "/", "code", ">", "<br", ">" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/Convert.java#L487-L489
groovy/groovy-core
src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java
StringGroovyMethods.replaceFirst
public static String replaceFirst(final CharSequence self, final Pattern pattern, final @ClosureParams(value=FromString.class, options={"List<String>","String[]"}) Closure closure) { final String s = self.toString(); final Matcher matcher = pattern.matcher(s); if (matcher.find()) { final StringBuffer sb = new StringBuffer(s.length() + 16); String replacement = getReplacement(matcher, closure); matcher.appendReplacement(sb, Matcher.quoteReplacement(replacement)); matcher.appendTail(sb); return sb.toString(); } else { return s; } }
java
public static String replaceFirst(final CharSequence self, final Pattern pattern, final @ClosureParams(value=FromString.class, options={"List<String>","String[]"}) Closure closure) { final String s = self.toString(); final Matcher matcher = pattern.matcher(s); if (matcher.find()) { final StringBuffer sb = new StringBuffer(s.length() + 16); String replacement = getReplacement(matcher, closure); matcher.appendReplacement(sb, Matcher.quoteReplacement(replacement)); matcher.appendTail(sb); return sb.toString(); } else { return s; } }
[ "public", "static", "String", "replaceFirst", "(", "final", "CharSequence", "self", ",", "final", "Pattern", "pattern", ",", "final", "@", "ClosureParams", "(", "value", "=", "FromString", ".", "class", ",", "options", "=", "{", "\"List<String>\"", ",", "\"Str...
Replaces the first occurrence of a captured group by the result of a closure call on that text. <p> For example (with some replaceAll variants thrown in for comparison purposes), <pre> assert "hellO world" == "hello world".replaceFirst(~"(o)") { it[0].toUpperCase() } // first match assert "hellO wOrld" == "hello world".replaceAll(~"(o)") { it[0].toUpperCase() } // all matches assert '1-FISH, two fish' == "one fish, two fish".replaceFirst(~/([a-z]{3})\s([a-z]{4})/) { [one:1, two:2][it[1]] + '-' + it[2].toUpperCase() } assert '1-FISH, 2-FISH' == "one fish, two fish".replaceAll(~/([a-z]{3})\s([a-z]{4})/) { [one:1, two:2][it[1]] + '-' + it[2].toUpperCase() } </pre> @param self a CharSequence @param pattern the capturing regex Pattern @param closure the closure to apply on the first captured group @return a CharSequence with replaced content @since 1.8.2
[ "Replaces", "the", "first", "occurrence", "of", "a", "captured", "group", "by", "the", "result", "of", "a", "closure", "call", "on", "that", "text", ".", "<p", ">", "For", "example", "(", "with", "some", "replaceAll", "variants", "thrown", "in", "for", "...
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L2701-L2713
foundation-runtime/common
commons/src/main/java/com/cisco/oss/foundation/application/exception/ExceptionUtil.java
ExceptionUtil.getLowestException
public static Exception getLowestException(final Exception exception, final String exceptionPrefix) { if (exception == null) { return null; } Throwable nestedException = (Throwable) exception; Exception lastLowException = null; while (nestedException != null) { if (nestedException.getClass().toString().startsWith("class " + exceptionPrefix)) { lastLowException = (Exception) nestedException; } nestedException = getInnerException(nestedException); } return lastLowException; }
java
public static Exception getLowestException(final Exception exception, final String exceptionPrefix) { if (exception == null) { return null; } Throwable nestedException = (Throwable) exception; Exception lastLowException = null; while (nestedException != null) { if (nestedException.getClass().toString().startsWith("class " + exceptionPrefix)) { lastLowException = (Exception) nestedException; } nestedException = getInnerException(nestedException); } return lastLowException; }
[ "public", "static", "Exception", "getLowestException", "(", "final", "Exception", "exception", ",", "final", "String", "exceptionPrefix", ")", "{", "if", "(", "exception", "==", "null", ")", "{", "return", "null", ";", "}", "Throwable", "nestedException", "=", ...
Get the most inner exception that is exception from "exceptionPrefix" type. If the exception does not include inner exception of type "exceptionPrefix", returns null. @param exception @param exceptionPrefix @return
[ "Get", "the", "most", "inner", "exception", "that", "is", "exception", "from", "exceptionPrefix", "type", ".", "If", "the", "exception", "does", "not", "include", "inner", "exception", "of", "type", "exceptionPrefix", "returns", "null", "." ]
train
https://github.com/foundation-runtime/common/blob/8d243111f68dc620bdea0659f9fff75fe05f0447/commons/src/main/java/com/cisco/oss/foundation/application/exception/ExceptionUtil.java#L92-L109
apache/incubator-druid
processing/src/main/java/org/apache/druid/segment/data/GenericIndexed.java
GenericIndexed.checkIndex
private void checkIndex(int index) { if (index < 0) { throw new IAE("Index[%s] < 0", index); } if (index >= size) { throw new IAE("Index[%d] >= size[%d]", index, size); } }
java
private void checkIndex(int index) { if (index < 0) { throw new IAE("Index[%s] < 0", index); } if (index >= size) { throw new IAE("Index[%d] >= size[%d]", index, size); } }
[ "private", "void", "checkIndex", "(", "int", "index", ")", "{", "if", "(", "index", "<", "0", ")", "{", "throw", "new", "IAE", "(", "\"Index[%s] < 0\"", ",", "index", ")", ";", "}", "if", "(", "index", ">=", "size", ")", "{", "throw", "new", "IAE",...
Checks if {@code index} a valid `element index` in GenericIndexed. Similar to Preconditions.checkElementIndex() except this method throws {@link IAE} with custom error message. <p> Used here to get existing behavior(same error message and exception) of V1 GenericIndexed. @param index index identifying an element of an GenericIndexed.
[ "Checks", "if", "{", "@code", "index", "}", "a", "valid", "element", "index", "in", "GenericIndexed", ".", "Similar", "to", "Preconditions", ".", "checkElementIndex", "()", "except", "this", "method", "throws", "{", "@link", "IAE", "}", "with", "custom", "er...
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/segment/data/GenericIndexed.java#L265-L273