repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
gallandarakhneorg/afc
core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java
XMLUtil.getAttributeUUID
@Pure public static UUID getAttributeUUID(Node document, String... path) { assert document != null : AssertMessages.notNullParameter(0); return getAttributeUUIDWithDefault(document, true, null, path); }
java
@Pure public static UUID getAttributeUUID(Node document, String... path) { assert document != null : AssertMessages.notNullParameter(0); return getAttributeUUIDWithDefault(document, true, null, path); }
[ "@", "Pure", "public", "static", "UUID", "getAttributeUUID", "(", "Node", "document", ",", "String", "...", "path", ")", "{", "assert", "document", "!=", "null", ":", "AssertMessages", ".", "notNullParameter", "(", "0", ")", ";", "return", "getAttributeUUIDWit...
Replies the UUID that corresponds to the specified attribute's path. <p>The path is an ordered list of tag's names and ended by the name of the attribute. Be careful about the fact that the names are case sensitives. @param document is the XML document to explore. @param path is the list of and ended by the attribute's name. @return the UUID in the specified attribute or <code>null</code> if it was node found in the document
[ "Replies", "the", "UUID", "that", "corresponds", "to", "the", "specified", "attribute", "s", "path", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L1056-L1060
apache/groovy
subprojects/groovy-yaml/src/main/java/groovy/yaml/YamlBuilder.java
YamlBuilder.call
public Object call(Iterable coll, Closure c) { return jsonBuilder.call(coll, c); }
java
public Object call(Iterable coll, Closure c) { return jsonBuilder.call(coll, c); }
[ "public", "Object", "call", "(", "Iterable", "coll", ",", "Closure", "c", ")", "{", "return", "jsonBuilder", ".", "call", "(", "coll", ",", "c", ")", ";", "}" ]
A collection and closure passed to a YAML builder will create a root YAML array applying the closure to each object in the collection <p> Example: <pre><code class="groovyTestCase"> class Author { String name } def authors = [new Author (name: "Guillaume"), new Author (name: "Jochen"), new Author (name: "Paul")] def yaml = new groovy.yaml.YamlBuilder() yaml authors, { Author author {@code ->} name author.name } assert yaml.toString() == '''--- - name: "Guillaume" - name: "Jochen" - name: "Paul" ''' </code></pre> @param coll a collection @param c a closure used to convert the objects of coll @return a list of values
[ "A", "collection", "and", "closure", "passed", "to", "a", "YAML", "builder", "will", "create", "a", "root", "YAML", "array", "applying", "the", "closure", "to", "each", "object", "in", "the", "collection", "<p", ">", "Example", ":", "<pre", ">", "<code", ...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-yaml/src/main/java/groovy/yaml/YamlBuilder.java#L143-L145
ops4j/org.ops4j.pax.web
pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/util/TypeUtil.java
TypeUtil.valueOf
public static Object valueOf(String type, String value) { return valueOf(fromName(type), value); }
java
public static Object valueOf(String type, String value) { return valueOf(fromName(type), value); }
[ "public", "static", "Object", "valueOf", "(", "String", "type", ",", "String", "value", ")", "{", "return", "valueOf", "(", "fromName", "(", "type", ")", ",", "value", ")", ";", "}" ]
Convert String value to instance. @param type classname or type (eg int) @param value The value as a string. @return The value as an Object.
[ "Convert", "String", "value", "to", "instance", "." ]
train
https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/util/TypeUtil.java#L265-L267
apache/incubator-gobblin
gobblin-core/src/main/java/org/apache/gobblin/converter/csv/CsvToJsonConverter.java
CsvToJsonConverter.convertSchema
@Override public JsonArray convertSchema(String inputSchema, WorkUnitState workUnit) throws SchemaConversionException { JsonParser jsonParser = new JsonParser(); JsonElement jsonSchema = jsonParser.parse(inputSchema); return jsonSchema.getAsJsonArray(); }
java
@Override public JsonArray convertSchema(String inputSchema, WorkUnitState workUnit) throws SchemaConversionException { JsonParser jsonParser = new JsonParser(); JsonElement jsonSchema = jsonParser.parse(inputSchema); return jsonSchema.getAsJsonArray(); }
[ "@", "Override", "public", "JsonArray", "convertSchema", "(", "String", "inputSchema", ",", "WorkUnitState", "workUnit", ")", "throws", "SchemaConversionException", "{", "JsonParser", "jsonParser", "=", "new", "JsonParser", "(", ")", ";", "JsonElement", "jsonSchema", ...
Take in an input schema of type string, the schema must be in JSON format @return a JsonArray representation of the schema
[ "Take", "in", "an", "input", "schema", "of", "type", "string", "the", "schema", "must", "be", "in", "JSON", "format" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/converter/csv/CsvToJsonConverter.java#L47-L52
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/base/base_resource.java
base_resource.perform_operation
public base_resource[] perform_operation(nitro_service service) throws Exception { if (!service.isLogin() && !get_object_type().equals("login")) service.login(); return post_request(service, null); }
java
public base_resource[] perform_operation(nitro_service service) throws Exception { if (!service.isLogin() && !get_object_type().equals("login")) service.login(); return post_request(service, null); }
[ "public", "base_resource", "[", "]", "perform_operation", "(", "nitro_service", "service", ")", "throws", "Exception", "{", "if", "(", "!", "service", ".", "isLogin", "(", ")", "&&", "!", "get_object_type", "(", ")", ".", "equals", "(", "\"login\"", ")", "...
Use this method to perform a any post operation ...etc operation on MPS resource. @param service nitro_service object. @return status of the operation performed. @throws Exception API exception is thrown.
[ "Use", "this", "method", "to", "perform", "a", "any", "post", "operation", "...", "etc", "operation", "on", "MPS", "resource", "." ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/base/base_resource.java#L164-L169
seam/faces
impl/src/main/java/org/jboss/seam/faces/security/SecurityPhaseListener.java
SecurityPhaseListener.redirectToAccessDeniedView
private void redirectToAccessDeniedView(FacesContext context, UIViewRoot viewRoot) { // If a user has already done a redirect and rendered the response (possibly in an observer) we cannot do this output final PhaseId currentPhase = context.getCurrentPhaseId(); if (!context.getResponseComplete() && !PhaseId.RENDER_RESPONSE.equals(currentPhase)) { AccessDeniedView accessDeniedView = viewConfigStore.getAnnotationData(viewRoot.getViewId(), AccessDeniedView.class); if (accessDeniedView == null || accessDeniedView.value() == null || accessDeniedView.value().isEmpty()) { log.warn("No AccessDeniedView is configured, returning 401 response (access denied). Please configure an AccessDeniedView in the ViewConfig."); context.getExternalContext().setResponseStatus(401); context.responseComplete(); return; } String accessDeniedViewId = accessDeniedView.value(); log.debugf("Redirecting to configured AccessDenied %s", accessDeniedViewId); NavigationHandler navHandler = context.getApplication().getNavigationHandler(); navHandler.handleNavigation(context, "", accessDeniedViewId); context.renderResponse(); } }
java
private void redirectToAccessDeniedView(FacesContext context, UIViewRoot viewRoot) { // If a user has already done a redirect and rendered the response (possibly in an observer) we cannot do this output final PhaseId currentPhase = context.getCurrentPhaseId(); if (!context.getResponseComplete() && !PhaseId.RENDER_RESPONSE.equals(currentPhase)) { AccessDeniedView accessDeniedView = viewConfigStore.getAnnotationData(viewRoot.getViewId(), AccessDeniedView.class); if (accessDeniedView == null || accessDeniedView.value() == null || accessDeniedView.value().isEmpty()) { log.warn("No AccessDeniedView is configured, returning 401 response (access denied). Please configure an AccessDeniedView in the ViewConfig."); context.getExternalContext().setResponseStatus(401); context.responseComplete(); return; } String accessDeniedViewId = accessDeniedView.value(); log.debugf("Redirecting to configured AccessDenied %s", accessDeniedViewId); NavigationHandler navHandler = context.getApplication().getNavigationHandler(); navHandler.handleNavigation(context, "", accessDeniedViewId); context.renderResponse(); } }
[ "private", "void", "redirectToAccessDeniedView", "(", "FacesContext", "context", ",", "UIViewRoot", "viewRoot", ")", "{", "// If a user has already done a redirect and rendered the response (possibly in an observer) we cannot do this output", "final", "PhaseId", "currentPhase", "=", ...
Perform the navigation to the @AccessDeniedView. If not @AccessDeniedView is defined, return a 401 response @param context @param viewRoot
[ "Perform", "the", "navigation", "to", "the", "@AccessDeniedView", ".", "If", "not", "@AccessDeniedView", "is", "defined", "return", "a", "401", "response" ]
train
https://github.com/seam/faces/blob/2fdedbc7070318c2c58bfffb8a26f1ea1d0ee1e3/impl/src/main/java/org/jboss/seam/faces/security/SecurityPhaseListener.java#L330-L347
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.adjustLinks
public void adjustLinks(String sourceFolder, String targetFolder) throws CmsException { String rootSourceFolder = addSiteRoot(sourceFolder); String rootTargetFolder = addSiteRoot(targetFolder); String siteRoot = getRequestContext().getSiteRoot(); getRequestContext().setSiteRoot(""); try { CmsLinkRewriter linkRewriter = new CmsLinkRewriter(this, rootSourceFolder, rootTargetFolder); linkRewriter.rewriteLinks(); } finally { getRequestContext().setSiteRoot(siteRoot); } }
java
public void adjustLinks(String sourceFolder, String targetFolder) throws CmsException { String rootSourceFolder = addSiteRoot(sourceFolder); String rootTargetFolder = addSiteRoot(targetFolder); String siteRoot = getRequestContext().getSiteRoot(); getRequestContext().setSiteRoot(""); try { CmsLinkRewriter linkRewriter = new CmsLinkRewriter(this, rootSourceFolder, rootTargetFolder); linkRewriter.rewriteLinks(); } finally { getRequestContext().setSiteRoot(siteRoot); } }
[ "public", "void", "adjustLinks", "(", "String", "sourceFolder", ",", "String", "targetFolder", ")", "throws", "CmsException", "{", "String", "rootSourceFolder", "=", "addSiteRoot", "(", "sourceFolder", ")", ";", "String", "rootTargetFolder", "=", "addSiteRoot", "(",...
Adjusts all links in the target folder that point to the source folder so that they are kept "relative" in the target folder where possible. If a link is found from the target folder to the source folder, then the target folder is checked if a target of the same name is found also "relative" inside the target Folder, and if so, the link is changed to that "relative" target. This is mainly used to keep relative links inside a copied folder structure intact. Example: Image we have folder /folderA/ that contains files /folderA/x1 and /folderA/y1. x1 has a link to y1 and y1 to x1. Now someone copies /folderA/ to /folderB/. So we end up with /folderB/x2 and /folderB/y2. Because of the link mechanism in OpenCms, x2 will have a link to y1 and y2 to x1. By using this method, the links from x2 to y1 will be replaced by a link x2 to y2, and y2 to x1 with y2 to x2. Link replacement works for links in XML files as well as relation only type links. @param sourceFolder the source folder @param targetFolder the target folder @throws CmsException if something goes wrong
[ "Adjusts", "all", "links", "in", "the", "target", "folder", "that", "point", "to", "the", "source", "folder", "so", "that", "they", "are", "kept", "relative", "in", "the", "target", "folder", "where", "possible", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L253-L265
voldemort/voldemort
src/java/voldemort/rest/coordinator/DynamicTimeoutStoreClient.java
DynamicTimeoutStoreClient.putWithCustomTimeout
public Version putWithCustomTimeout(CompositeVoldemortRequest<K, V> requestWrapper) { validateTimeout(requestWrapper.getRoutingTimeoutInMs()); List<Versioned<V>> versionedValues; long startTime = System.currentTimeMillis(); String keyHexString = ""; if(logger.isDebugEnabled()) { ByteArray key = (ByteArray) requestWrapper.getKey(); keyHexString = RestUtils.getKeyHexString(key); logger.debug("PUT requested for key: " + keyHexString + " , for store: " + this.storeName + " at time(in ms): " + startTime + " . Nested GET and PUT VERSION requests to follow ---"); } // We use the full timeout for doing the Get. In this, we're being // optimistic that the subsequent put might be faster such that all the // steps might finish within the allotted time requestWrapper.setResolveConflicts(true); versionedValues = getWithCustomTimeout(requestWrapper); Versioned<V> versioned = getItemOrThrow(requestWrapper.getKey(), null, versionedValues); long endTime = System.currentTimeMillis(); if(versioned == null) versioned = Versioned.value(requestWrapper.getRawValue(), new VectorClock()); else versioned.setObject(requestWrapper.getRawValue()); // This should not happen unless there's a bug in the // getWithCustomTimeout long timeLeft = requestWrapper.getRoutingTimeoutInMs() - (endTime - startTime); if(timeLeft <= 0) { throw new StoreTimeoutException("PUT request timed out"); } CompositeVersionedPutVoldemortRequest<K, V> putVersionedRequestObject = new CompositeVersionedPutVoldemortRequest<K, V>(requestWrapper.getKey(), versioned, timeLeft); putVersionedRequestObject.setRequestOriginTimeInMs(requestWrapper.getRequestOriginTimeInMs()); Version result = putVersionedWithCustomTimeout(putVersionedRequestObject); long endTimeInMs = System.currentTimeMillis(); if(logger.isDebugEnabled()) { logger.debug("PUT response received for key: " + keyHexString + " , for store: " + this.storeName + " at time(in ms): " + endTimeInMs); } return result; }
java
public Version putWithCustomTimeout(CompositeVoldemortRequest<K, V> requestWrapper) { validateTimeout(requestWrapper.getRoutingTimeoutInMs()); List<Versioned<V>> versionedValues; long startTime = System.currentTimeMillis(); String keyHexString = ""; if(logger.isDebugEnabled()) { ByteArray key = (ByteArray) requestWrapper.getKey(); keyHexString = RestUtils.getKeyHexString(key); logger.debug("PUT requested for key: " + keyHexString + " , for store: " + this.storeName + " at time(in ms): " + startTime + " . Nested GET and PUT VERSION requests to follow ---"); } // We use the full timeout for doing the Get. In this, we're being // optimistic that the subsequent put might be faster such that all the // steps might finish within the allotted time requestWrapper.setResolveConflicts(true); versionedValues = getWithCustomTimeout(requestWrapper); Versioned<V> versioned = getItemOrThrow(requestWrapper.getKey(), null, versionedValues); long endTime = System.currentTimeMillis(); if(versioned == null) versioned = Versioned.value(requestWrapper.getRawValue(), new VectorClock()); else versioned.setObject(requestWrapper.getRawValue()); // This should not happen unless there's a bug in the // getWithCustomTimeout long timeLeft = requestWrapper.getRoutingTimeoutInMs() - (endTime - startTime); if(timeLeft <= 0) { throw new StoreTimeoutException("PUT request timed out"); } CompositeVersionedPutVoldemortRequest<K, V> putVersionedRequestObject = new CompositeVersionedPutVoldemortRequest<K, V>(requestWrapper.getKey(), versioned, timeLeft); putVersionedRequestObject.setRequestOriginTimeInMs(requestWrapper.getRequestOriginTimeInMs()); Version result = putVersionedWithCustomTimeout(putVersionedRequestObject); long endTimeInMs = System.currentTimeMillis(); if(logger.isDebugEnabled()) { logger.debug("PUT response received for key: " + keyHexString + " , for store: " + this.storeName + " at time(in ms): " + endTimeInMs); } return result; }
[ "public", "Version", "putWithCustomTimeout", "(", "CompositeVoldemortRequest", "<", "K", ",", "V", ">", "requestWrapper", ")", "{", "validateTimeout", "(", "requestWrapper", ".", "getRoutingTimeoutInMs", "(", ")", ")", ";", "List", "<", "Versioned", "<", "V", ">...
Performs a put operation with the specified composite request object @param requestWrapper A composite request object containing the key and value @return Version of the value for the successful put
[ "Performs", "a", "put", "operation", "with", "the", "specified", "composite", "request", "object" ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/rest/coordinator/DynamicTimeoutStoreClient.java#L144-L187
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfSignatureAppearance.java
PdfSignatureAppearance.setVisibleSignature
public void setVisibleSignature(Rectangle pageRect, int page, String fieldName) { if (fieldName != null) { if (fieldName.indexOf('.') >= 0) throw new IllegalArgumentException("Field names cannot contain a dot."); AcroFields af = writer.getAcroFields(); AcroFields.Item item = af.getFieldItem(fieldName); if (item != null) throw new IllegalArgumentException("The field " + fieldName + " already exists."); this.fieldName = fieldName; } if (page < 1 || page > writer.reader.getNumberOfPages()) throw new IllegalArgumentException("Invalid page number: " + page); this.pageRect = new Rectangle(pageRect); this.pageRect.normalize(); rect = new Rectangle(this.pageRect.getWidth(), this.pageRect.getHeight()); this.page = page; newField = true; }
java
public void setVisibleSignature(Rectangle pageRect, int page, String fieldName) { if (fieldName != null) { if (fieldName.indexOf('.') >= 0) throw new IllegalArgumentException("Field names cannot contain a dot."); AcroFields af = writer.getAcroFields(); AcroFields.Item item = af.getFieldItem(fieldName); if (item != null) throw new IllegalArgumentException("The field " + fieldName + " already exists."); this.fieldName = fieldName; } if (page < 1 || page > writer.reader.getNumberOfPages()) throw new IllegalArgumentException("Invalid page number: " + page); this.pageRect = new Rectangle(pageRect); this.pageRect.normalize(); rect = new Rectangle(this.pageRect.getWidth(), this.pageRect.getHeight()); this.page = page; newField = true; }
[ "public", "void", "setVisibleSignature", "(", "Rectangle", "pageRect", ",", "int", "page", ",", "String", "fieldName", ")", "{", "if", "(", "fieldName", "!=", "null", ")", "{", "if", "(", "fieldName", ".", "indexOf", "(", "'", "'", ")", ">=", "0", ")",...
Sets the signature to be visible. It creates a new visible signature field. @param pageRect the position and dimension of the field in the page @param page the page to place the field. The fist page is 1 @param fieldName the field name or <CODE>null</CODE> to generate automatically a new field name
[ "Sets", "the", "signature", "to", "be", "visible", ".", "It", "creates", "a", "new", "visible", "signature", "field", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfSignatureAppearance.java#L267-L284
HanSolo/SteelSeries-Swing
src/main/java/eu/hansolo/steelseries/gauges/AbstractLinear.java
AbstractLinear.create_FRAME_Image
protected BufferedImage create_FRAME_Image(final int WIDTH, final int HEIGHT, final BufferedImage IMAGE) { return FRAME_FACTORY.createLinearFrame(WIDTH, HEIGHT, getFrameDesign(), getCustomFrameDesign(), getFrameBaseColor(), isFrameBaseColorEnabled(), getFrameEffect(), IMAGE); }
java
protected BufferedImage create_FRAME_Image(final int WIDTH, final int HEIGHT, final BufferedImage IMAGE) { return FRAME_FACTORY.createLinearFrame(WIDTH, HEIGHT, getFrameDesign(), getCustomFrameDesign(), getFrameBaseColor(), isFrameBaseColorEnabled(), getFrameEffect(), IMAGE); }
[ "protected", "BufferedImage", "create_FRAME_Image", "(", "final", "int", "WIDTH", ",", "final", "int", "HEIGHT", ",", "final", "BufferedImage", "IMAGE", ")", "{", "return", "FRAME_FACTORY", ".", "createLinearFrame", "(", "WIDTH", ",", "HEIGHT", ",", "getFrameDesig...
Returns the frame image with the currently active framedesign with the given with and height. @param WIDTH @param HEIGHT @param IMAGE @return buffered image containing the frame in the active frame design
[ "Returns", "the", "frame", "image", "with", "the", "currently", "active", "framedesign", "with", "the", "given", "with", "and", "height", "." ]
train
https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/gauges/AbstractLinear.java#L894-L896
datastax/java-driver
query-builder/src/main/java/com/datastax/oss/driver/api/querybuilder/SchemaBuilder.java
SchemaBuilder.dropIndex
@NonNull public static Drop dropIndex(@Nullable CqlIdentifier keyspace, @NonNull CqlIdentifier indexName) { return new DefaultDrop(keyspace, indexName, "INDEX"); }
java
@NonNull public static Drop dropIndex(@Nullable CqlIdentifier keyspace, @NonNull CqlIdentifier indexName) { return new DefaultDrop(keyspace, indexName, "INDEX"); }
[ "@", "NonNull", "public", "static", "Drop", "dropIndex", "(", "@", "Nullable", "CqlIdentifier", "keyspace", ",", "@", "NonNull", "CqlIdentifier", "indexName", ")", "{", "return", "new", "DefaultDrop", "(", "keyspace", ",", "indexName", ",", "\"INDEX\"", ")", "...
Starts a DROP INDEX query for the given index for the given keyspace name.
[ "Starts", "a", "DROP", "INDEX", "query", "for", "the", "given", "index", "for", "the", "given", "keyspace", "name", "." ]
train
https://github.com/datastax/java-driver/blob/612a63f2525618e2020e86c9ad75ab37adba6132/query-builder/src/main/java/com/datastax/oss/driver/api/querybuilder/SchemaBuilder.java#L454-L457
padrig64/ValidationFramework
validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/anchor/Anchor.java
Anchor.getAnchorPoint
public Point getAnchorPoint(int width, int height) { return new Point((int) (relativeX * width + offsetX), (int) (relativeY * height + offsetY)); }
java
public Point getAnchorPoint(int width, int height) { return new Point((int) (relativeX * width + offsetX), (int) (relativeY * height + offsetY)); }
[ "public", "Point", "getAnchorPoint", "(", "int", "width", ",", "int", "height", ")", "{", "return", "new", "Point", "(", "(", "int", ")", "(", "relativeX", "*", "width", "+", "offsetX", ")", ",", "(", "int", ")", "(", "relativeY", "*", "height", "+",...
Retrieves a point on an object of the specified size. @param width Width of the object to get the anchor point for. @param height Height of the object to get the anchor point for. @return Anchor point. @see #getAnchorPoint(Dimension)
[ "Retrieves", "a", "point", "on", "an", "object", "of", "the", "specified", "size", "." ]
train
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/anchor/Anchor.java#L203-L205
TheCoder4eu/BootsFaces-OSP
src/main/java/net/bootsfaces/component/tree/model/TreeModelUtils.java
TreeModelUtils.printNodeData
public static void printNodeData(Node rootNode, String tab) { tab = tab == null ? "" : tab + " "; for (Node n : rootNode.getChilds()) { printNodeData(n, tab); } }
java
public static void printNodeData(Node rootNode, String tab) { tab = tab == null ? "" : tab + " "; for (Node n : rootNode.getChilds()) { printNodeData(n, tab); } }
[ "public", "static", "void", "printNodeData", "(", "Node", "rootNode", ",", "String", "tab", ")", "{", "tab", "=", "tab", "==", "null", "?", "\"\"", ":", "tab", "+", "\" \"", ";", "for", "(", "Node", "n", ":", "rootNode", ".", "getChilds", "(", ")", ...
Debug method to print tree node structure @param rootNode @param tab
[ "Debug", "method", "to", "print", "tree", "node", "structure" ]
train
https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/tree/model/TreeModelUtils.java#L40-L47
yangjm/winlet
utils/src/main/java/com/aggrepoint/utils/CollectionUtils.java
CollectionUtils.toHashtable
public static <T, K> Hashtable<K, T> toHashtable(Collection<T> entities, Function<T, K> keyMapper) { return toMap(entities, keyMapper, Hashtable<K, T>::new); }
java
public static <T, K> Hashtable<K, T> toHashtable(Collection<T> entities, Function<T, K> keyMapper) { return toMap(entities, keyMapper, Hashtable<K, T>::new); }
[ "public", "static", "<", "T", ",", "K", ">", "Hashtable", "<", "K", ",", "T", ">", "toHashtable", "(", "Collection", "<", "T", ">", "entities", ",", "Function", "<", "T", ",", "K", ">", "keyMapper", ")", "{", "return", "toMap", "(", "entities", ","...
Convert a collection to Hashtable. The key is decided by keyMapper, value is the object in collection @param entities @param keyMapper @return
[ "Convert", "a", "collection", "to", "Hashtable", ".", "The", "key", "is", "decided", "by", "keyMapper", "value", "is", "the", "object", "in", "collection" ]
train
https://github.com/yangjm/winlet/blob/2126236f56858e283fa6ad69fe9279ee30f47b67/utils/src/main/java/com/aggrepoint/utils/CollectionUtils.java#L126-L129
defei/codelogger-utils
src/main/java/org/codelogger/utils/DateUtils.java
DateUtils.getDateFromString
public static Date getDateFromString(final String dateString, final String pattern) { try { SimpleDateFormat df = buildDateFormat(pattern); return df.parse(dateString); } catch (ParseException e) { throw new DateException(String.format("Could not parse %s with pattern %s.", dateString, pattern), e); } }
java
public static Date getDateFromString(final String dateString, final String pattern) { try { SimpleDateFormat df = buildDateFormat(pattern); return df.parse(dateString); } catch (ParseException e) { throw new DateException(String.format("Could not parse %s with pattern %s.", dateString, pattern), e); } }
[ "public", "static", "Date", "getDateFromString", "(", "final", "String", "dateString", ",", "final", "String", "pattern", ")", "{", "try", "{", "SimpleDateFormat", "df", "=", "buildDateFormat", "(", "pattern", ")", ";", "return", "df", ".", "parse", "(", "da...
Get data from data string using the given pattern and the default date format symbols for the default locale. @param dateString date string to be handled. @param pattern pattern to be formated. @return a new Date object by given date string and pattern. @throws DateException
[ "Get", "data", "from", "data", "string", "using", "the", "given", "pattern", "and", "the", "default", "date", "format", "symbols", "for", "the", "default", "locale", "." ]
train
https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/DateUtils.java#L93-L102
aws/aws-sdk-java
aws-java-sdk-resourcegroups/src/main/java/com/amazonaws/services/resourcegroups/model/TagRequest.java
TagRequest.withTags
public TagRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
java
public TagRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "TagRequest", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
<p> The tags to add to the specified resource. A tag is a string-to-string map of key-value pairs. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters. </p> @param tags The tags to add to the specified resource. A tag is a string-to-string map of key-value pairs. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "tags", "to", "add", "to", "the", "specified", "resource", ".", "A", "tag", "is", "a", "string", "-", "to", "-", "string", "map", "of", "key", "-", "value", "pairs", ".", "Tag", "keys", "can", "have", "a", "maximum", "character", ...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-resourcegroups/src/main/java/com/amazonaws/services/resourcegroups/model/TagRequest.java#L126-L129
blinkfox/zealot
src/main/java/com/blinkfox/zealot/core/ZealotKhala.java
ZealotKhala.andBetween
public ZealotKhala andBetween(String field, Object startValue, Object endValue) { return this.doBetween(ZealotConst.AND_PREFIX, field, startValue, endValue, true); }
java
public ZealotKhala andBetween(String field, Object startValue, Object endValue) { return this.doBetween(ZealotConst.AND_PREFIX, field, startValue, endValue, true); }
[ "public", "ZealotKhala", "andBetween", "(", "String", "field", ",", "Object", "startValue", ",", "Object", "endValue", ")", "{", "return", "this", ".", "doBetween", "(", "ZealotConst", ".", "AND_PREFIX", ",", "field", ",", "startValue", ",", "endValue", ",", ...
生成带" AND "前缀的between区间查询的SQL片段(当某一个值为null时,会是大于等于或小于等于的情形). @param field 数据库字段 @param startValue 开始值 @param endValue 结束值 @return ZealotKhala实例
[ "生成带", "AND", "前缀的between区间查询的SQL片段", "(", "当某一个值为null时,会是大于等于或小于等于的情形", ")", "." ]
train
https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/ZealotKhala.java#L1218-L1220
Alluxio/alluxio
core/server/worker/src/main/java/alluxio/worker/file/FileDataManager.java
FileDataManager.needPersistence
public boolean needPersistence(long fileId) { if (isFilePersisting(fileId) || isFilePersisted(fileId)) { return false; } try { String ufsFingerprint = ufsFingerprint(fileId); if (ufsFingerprint != null) { // mark as persisted addPersistedFile(fileId, ufsFingerprint); return false; } } catch (Exception e) { LOG.warn("Failed to check if file {} exists in under storage system: {}", fileId, e.getMessage()); LOG.debug("Exception: ", e); } return true; }
java
public boolean needPersistence(long fileId) { if (isFilePersisting(fileId) || isFilePersisted(fileId)) { return false; } try { String ufsFingerprint = ufsFingerprint(fileId); if (ufsFingerprint != null) { // mark as persisted addPersistedFile(fileId, ufsFingerprint); return false; } } catch (Exception e) { LOG.warn("Failed to check if file {} exists in under storage system: {}", fileId, e.getMessage()); LOG.debug("Exception: ", e); } return true; }
[ "public", "boolean", "needPersistence", "(", "long", "fileId", ")", "{", "if", "(", "isFilePersisting", "(", "fileId", ")", "||", "isFilePersisted", "(", "fileId", ")", ")", "{", "return", "false", ";", "}", "try", "{", "String", "ufsFingerprint", "=", "uf...
Checks if the given file needs persistence. @param fileId the file id @return false if the file is being persisted, or is already persisted; otherwise true
[ "Checks", "if", "the", "given", "file", "needs", "persistence", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/worker/file/FileDataManager.java#L144-L162
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/utils/HttpRequestUtils.java
HttpRequestUtils.getShortRequestDump
public static String getShortRequestDump(String fromMethod, HttpServletRequest request) { return (getShortRequestDump(fromMethod, false, request)); }
java
public static String getShortRequestDump(String fromMethod, HttpServletRequest request) { return (getShortRequestDump(fromMethod, false, request)); }
[ "public", "static", "String", "getShortRequestDump", "(", "String", "fromMethod", ",", "HttpServletRequest", "request", ")", "{", "return", "(", "getShortRequestDump", "(", "fromMethod", ",", "false", ",", "request", ")", ")", ";", "}" ]
Build a String containing a very short multi-line dump of an HTTP request. @param fromMethod the method that this method was called from @param request the HTTP request build the request dump from @return a String containing a very short multi-line dump of the HTTP request
[ "Build", "a", "String", "containing", "a", "very", "short", "multi", "-", "line", "dump", "of", "an", "HTTP", "request", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/utils/HttpRequestUtils.java#L20-L22
zxing/zxing
core/src/main/java/com/google/zxing/datamatrix/encoder/HighLevelEncoder.java
HighLevelEncoder.encodeHighLevel
public static String encodeHighLevel(String msg) { return encodeHighLevel(msg, SymbolShapeHint.FORCE_NONE, null, null); }
java
public static String encodeHighLevel(String msg) { return encodeHighLevel(msg, SymbolShapeHint.FORCE_NONE, null, null); }
[ "public", "static", "String", "encodeHighLevel", "(", "String", "msg", ")", "{", "return", "encodeHighLevel", "(", "msg", ",", "SymbolShapeHint", ".", "FORCE_NONE", ",", "null", ",", "null", ")", ";", "}" ]
Performs message encoding of a DataMatrix message using the algorithm described in annex P of ISO/IEC 16022:2000(E). @param msg the message @return the encoded message (the char values range from 0 to 255)
[ "Performs", "message", "encoding", "of", "a", "DataMatrix", "message", "using", "the", "algorithm", "described", "in", "annex", "P", "of", "ISO", "/", "IEC", "16022", ":", "2000", "(", "E", ")", "." ]
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/datamatrix/encoder/HighLevelEncoder.java#L141-L143
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/Where.java
Where.ge
public Where<T, ID> ge(String columnName, Object value) throws SQLException { addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value, SimpleComparison.GREATER_THAN_EQUAL_TO_OPERATION)); return this; }
java
public Where<T, ID> ge(String columnName, Object value) throws SQLException { addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value, SimpleComparison.GREATER_THAN_EQUAL_TO_OPERATION)); return this; }
[ "public", "Where", "<", "T", ",", "ID", ">", "ge", "(", "String", "columnName", ",", "Object", "value", ")", "throws", "SQLException", "{", "addClause", "(", "new", "SimpleComparison", "(", "columnName", ",", "findColumnFieldType", "(", "columnName", ")", ",...
Add a '&gt;=' clause so the column must be greater-than or equals-to the value.
[ "Add", "a", "&gt", ";", "=", "clause", "so", "the", "column", "must", "be", "greater", "-", "than", "or", "equals", "-", "to", "the", "value", "." ]
train
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L200-L204
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasesInner.java
ServerDnsAliasesInner.createOrUpdate
public ServerDnsAliasInner createOrUpdate(String resourceGroupName, String serverName, String dnsAliasName) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).toBlocking().last().body(); }
java
public ServerDnsAliasInner createOrUpdate(String resourceGroupName, String serverName, String dnsAliasName) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).toBlocking().last().body(); }
[ "public", "ServerDnsAliasInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "dnsAliasName", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "dnsAliasName",...
Creates a server dns alias. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server that the alias is pointing to. @param dnsAliasName The name of the server DNS alias. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ServerDnsAliasInner object if successful.
[ "Creates", "a", "server", "dns", "alias", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasesInner.java#L207-L209
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/InternalResourceMap.java
InternalResourceMap.computeHash
public static String computeHash(final InternalResource resource) { final int bufferSize = 1024; try (InputStream stream = resource.getStream()) { if (stream == null) { return null; } // Compute CRC-32 checksum // TODO: Is a 1 in 2^32 chance of a cache bust fail good enough? // Checksum checksumEngine = new Adler32(); Checksum checksumEngine = new CRC32(); byte[] buf = new byte[bufferSize]; for (int read = stream.read(buf); read != -1; read = stream.read(buf)) { checksumEngine.update(buf, 0, read); } return Long.toHexString(checksumEngine.getValue()); } catch (Exception e) { throw new SystemException("Error calculating resource hash", e); } }
java
public static String computeHash(final InternalResource resource) { final int bufferSize = 1024; try (InputStream stream = resource.getStream()) { if (stream == null) { return null; } // Compute CRC-32 checksum // TODO: Is a 1 in 2^32 chance of a cache bust fail good enough? // Checksum checksumEngine = new Adler32(); Checksum checksumEngine = new CRC32(); byte[] buf = new byte[bufferSize]; for (int read = stream.read(buf); read != -1; read = stream.read(buf)) { checksumEngine.update(buf, 0, read); } return Long.toHexString(checksumEngine.getValue()); } catch (Exception e) { throw new SystemException("Error calculating resource hash", e); } }
[ "public", "static", "String", "computeHash", "(", "final", "InternalResource", "resource", ")", "{", "final", "int", "bufferSize", "=", "1024", ";", "try", "(", "InputStream", "stream", "=", "resource", ".", "getStream", "(", ")", ")", "{", "if", "(", "str...
Computes a simple hash of the resource contents. @param resource the resource to hash. @return a hash of the resource contents.
[ "Computes", "a", "simple", "hash", "of", "the", "resource", "contents", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/InternalResourceMap.java#L83-L105
apache/reef
lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/DriverRuntimeStartHandler.java
DriverRuntimeStartHandler.onNext
@Override public synchronized void onNext(final RuntimeStart runtimeStart) { LOG.log(Level.FINEST, "RuntimeStart: {0}", runtimeStart); // Register for heartbeats and error messages from the Evaluators. this.remoteManager.registerHandler( EvaluatorRuntimeProtocol.EvaluatorHeartbeatProto.class, this.evaluatorHeartbeatHandler); this.remoteManager.registerHandler( ReefServiceProtos.RuntimeErrorProto.class, this.evaluatorResourceManagerErrorHandler); this.resourceManagerStatus.setRunning(); this.driverStatusManager.onRunning(); // Forward start event to the runtime-specific handler (e.g. YARN, Local, etc.) this.resourceManagerStartHandler.onNext(runtimeStart); LOG.log(Level.FINEST, "DriverRuntimeStartHandler complete."); }
java
@Override public synchronized void onNext(final RuntimeStart runtimeStart) { LOG.log(Level.FINEST, "RuntimeStart: {0}", runtimeStart); // Register for heartbeats and error messages from the Evaluators. this.remoteManager.registerHandler( EvaluatorRuntimeProtocol.EvaluatorHeartbeatProto.class, this.evaluatorHeartbeatHandler); this.remoteManager.registerHandler( ReefServiceProtos.RuntimeErrorProto.class, this.evaluatorResourceManagerErrorHandler); this.resourceManagerStatus.setRunning(); this.driverStatusManager.onRunning(); // Forward start event to the runtime-specific handler (e.g. YARN, Local, etc.) this.resourceManagerStartHandler.onNext(runtimeStart); LOG.log(Level.FINEST, "DriverRuntimeStartHandler complete."); }
[ "@", "Override", "public", "synchronized", "void", "onNext", "(", "final", "RuntimeStart", "runtimeStart", ")", "{", "LOG", ".", "log", "(", "Level", ".", "FINEST", ",", "\"RuntimeStart: {0}\"", ",", "runtimeStart", ")", ";", "// Register for heartbeats and error me...
This method is called on start of the REEF Driver runtime event loop. It contains startup logic for REEF Driver that is independent from a runtime framework (e.g. Mesos, YARN, Local, etc). Platform-specific logic is then handled in ResourceManagerStartHandler. @param runtimeStart An event that signals start of the Driver runtime. Contains a timestamp and can be pretty printed.
[ "This", "method", "is", "called", "on", "start", "of", "the", "REEF", "Driver", "runtime", "event", "loop", ".", "It", "contains", "startup", "logic", "for", "REEF", "Driver", "that", "is", "independent", "from", "a", "runtime", "framework", "(", "e", ".",...
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/DriverRuntimeStartHandler.java#L88-L109
UrielCh/ovh-java-sdk
ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java
ApiOvhXdsl.serviceName_monitoringNotifications_GET
public ArrayList<Long> serviceName_monitoringNotifications_GET(String serviceName) throws IOException { String qPath = "/xdsl/{serviceName}/monitoringNotifications"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t15); }
java
public ArrayList<Long> serviceName_monitoringNotifications_GET(String serviceName) throws IOException { String qPath = "/xdsl/{serviceName}/monitoringNotifications"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t15); }
[ "public", "ArrayList", "<", "Long", ">", "serviceName_monitoringNotifications_GET", "(", "String", "serviceName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/xdsl/{serviceName}/monitoringNotifications\"", ";", "StringBuilder", "sb", "=", "path", "(", ...
List the notifications for this access REST: GET /xdsl/{serviceName}/monitoringNotifications @param serviceName [required] The internal name of your XDSL offer
[ "List", "the", "notifications", "for", "this", "access" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L1425-L1430
apereo/cas
core/cas-server-core-services-authentication/src/main/java/org/apereo/cas/authentication/principal/DefaultResponse.java
DefaultResponse.getRedirectResponse
public static Response getRedirectResponse(final String url, final Map<String, String> parameters) { val builder = new StringBuilder(parameters.size() * RESPONSE_INITIAL_CAPACITY); val sanitizedUrl = sanitizeUrl(url); LOGGER.debug("Sanitized URL for redirect response is [{}]", sanitizedUrl); val fragmentSplit = Splitter.on("#").splitToList(sanitizedUrl); builder.append(fragmentSplit.get(0)); val params = parameters.entrySet() .stream() .filter(entry -> entry.getValue() != null) .map(entry -> { try { return String.join("=", entry.getKey(), EncodingUtils.urlEncode(entry.getValue())); } catch (final Exception e) { return String.join("=", entry.getKey(), entry.getValue()); } }) .collect(Collectors.joining("&")); if (!(params == null || params.isEmpty())) { builder.append(url.contains("?") ? "&" : "?"); builder.append(params); } if (fragmentSplit.size() > 1) { builder.append('#'); builder.append(fragmentSplit.get(1)); } val urlRedirect = builder.toString(); LOGGER.debug("Final redirect response is [{}]", urlRedirect); return new DefaultResponse(ResponseType.REDIRECT, urlRedirect, parameters); }
java
public static Response getRedirectResponse(final String url, final Map<String, String> parameters) { val builder = new StringBuilder(parameters.size() * RESPONSE_INITIAL_CAPACITY); val sanitizedUrl = sanitizeUrl(url); LOGGER.debug("Sanitized URL for redirect response is [{}]", sanitizedUrl); val fragmentSplit = Splitter.on("#").splitToList(sanitizedUrl); builder.append(fragmentSplit.get(0)); val params = parameters.entrySet() .stream() .filter(entry -> entry.getValue() != null) .map(entry -> { try { return String.join("=", entry.getKey(), EncodingUtils.urlEncode(entry.getValue())); } catch (final Exception e) { return String.join("=", entry.getKey(), entry.getValue()); } }) .collect(Collectors.joining("&")); if (!(params == null || params.isEmpty())) { builder.append(url.contains("?") ? "&" : "?"); builder.append(params); } if (fragmentSplit.size() > 1) { builder.append('#'); builder.append(fragmentSplit.get(1)); } val urlRedirect = builder.toString(); LOGGER.debug("Final redirect response is [{}]", urlRedirect); return new DefaultResponse(ResponseType.REDIRECT, urlRedirect, parameters); }
[ "public", "static", "Response", "getRedirectResponse", "(", "final", "String", "url", ",", "final", "Map", "<", "String", ",", "String", ">", "parameters", ")", "{", "val", "builder", "=", "new", "StringBuilder", "(", "parameters", ".", "size", "(", ")", "...
Gets the redirect response. @param url the url @param parameters the parameters @return the redirect response
[ "Gets", "the", "redirect", "response", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-services-authentication/src/main/java/org/apereo/cas/authentication/principal/DefaultResponse.java#L71-L99
auth0/Auth0.Android
auth0/src/main/java/com/auth0/android/provider/PermissionHandler.java
PermissionHandler.isPermissionGranted
public boolean isPermissionGranted(@NonNull Activity activity, @NonNull String permission) { Log.v(TAG, String.format("Checking if %s permission is granted.", permission)); int result = ContextCompat.checkSelfPermission(activity, permission); return result == PermissionChecker.PERMISSION_GRANTED; }
java
public boolean isPermissionGranted(@NonNull Activity activity, @NonNull String permission) { Log.v(TAG, String.format("Checking if %s permission is granted.", permission)); int result = ContextCompat.checkSelfPermission(activity, permission); return result == PermissionChecker.PERMISSION_GRANTED; }
[ "public", "boolean", "isPermissionGranted", "(", "@", "NonNull", "Activity", "activity", ",", "@", "NonNull", "String", "permission", ")", "{", "Log", ".", "v", "(", "TAG", ",", "String", ".", "format", "(", "\"Checking if %s permission is granted.\"", ",", "per...
Checks if the given Android Manifest Permission has been granted by the user to this application before. @param activity the caller activity @param permission to check availability for @return true if the Android Manifest Permission is currently granted, false otherwise.
[ "Checks", "if", "the", "given", "Android", "Manifest", "Permission", "has", "been", "granted", "by", "the", "user", "to", "this", "application", "before", "." ]
train
https://github.com/auth0/Auth0.Android/blob/ee37b7f94d989c1fbab2cb1378c87fdcaf7a8156/auth0/src/main/java/com/auth0/android/provider/PermissionHandler.java#L54-L58
RestComm/media-core
client/mgcp/driver/src/main/java/org/restcomm/media/client/mgcp/handlers/TransactionHandler.java
TransactionHandler.receiveResponse
public void receiveResponse(byte[] data,SplitDetails[] msg,Integer txID,ReturnCode returnCode) { cancelReTransmissionTimer(); cancelLongtranTimer(); JainMgcpResponseEvent event = null; try { event = decodeResponse(data,msg,txID,returnCode); } catch (Exception e) { logger.error("Could not decode message: ", e); } event.setTransactionHandle(remoteTID); if (this.isProvisional(event.getReturnCode())) resetLongtranTimer(); stack.provider.processMgcpResponseEvent(event, commandEvent); if (!this.isProvisional(event.getReturnCode())) this.release(); }
java
public void receiveResponse(byte[] data,SplitDetails[] msg,Integer txID,ReturnCode returnCode) { cancelReTransmissionTimer(); cancelLongtranTimer(); JainMgcpResponseEvent event = null; try { event = decodeResponse(data,msg,txID,returnCode); } catch (Exception e) { logger.error("Could not decode message: ", e); } event.setTransactionHandle(remoteTID); if (this.isProvisional(event.getReturnCode())) resetLongtranTimer(); stack.provider.processMgcpResponseEvent(event, commandEvent); if (!this.isProvisional(event.getReturnCode())) this.release(); }
[ "public", "void", "receiveResponse", "(", "byte", "[", "]", "data", ",", "SplitDetails", "[", "]", "msg", ",", "Integer", "txID", ",", "ReturnCode", "returnCode", ")", "{", "cancelReTransmissionTimer", "(", ")", ";", "cancelLongtranTimer", "(", ")", ";", "Ja...
Used by stack for relaying received MGCP response messages to the application. @param message receive MGCP response message.
[ "Used", "by", "stack", "for", "relaying", "received", "MGCP", "response", "messages", "to", "the", "application", "." ]
train
https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/client/mgcp/driver/src/main/java/org/restcomm/media/client/mgcp/handlers/TransactionHandler.java#L636-L659
googleapis/google-http-java-client
google-http-client/src/main/java/com/google/api/client/util/ClassInfo.java
ClassInfo.of
public static ClassInfo of(Class<?> underlyingClass, boolean ignoreCase) { if (underlyingClass == null) { return null; } final Map<Class<?>, ClassInfo> cache = ignoreCase ? CACHE_IGNORE_CASE : CACHE; ClassInfo classInfo; synchronized (cache) { classInfo = cache.get(underlyingClass); if (classInfo == null) { classInfo = new ClassInfo(underlyingClass, ignoreCase); cache.put(underlyingClass, classInfo); } } return classInfo; }
java
public static ClassInfo of(Class<?> underlyingClass, boolean ignoreCase) { if (underlyingClass == null) { return null; } final Map<Class<?>, ClassInfo> cache = ignoreCase ? CACHE_IGNORE_CASE : CACHE; ClassInfo classInfo; synchronized (cache) { classInfo = cache.get(underlyingClass); if (classInfo == null) { classInfo = new ClassInfo(underlyingClass, ignoreCase); cache.put(underlyingClass, classInfo); } } return classInfo; }
[ "public", "static", "ClassInfo", "of", "(", "Class", "<", "?", ">", "underlyingClass", ",", "boolean", "ignoreCase", ")", "{", "if", "(", "underlyingClass", "==", "null", ")", "{", "return", "null", ";", "}", "final", "Map", "<", "Class", "<", "?", ">"...
Returns the class information for the given underlying class. @param underlyingClass underlying class or {@code null} for {@code null} result @param ignoreCase whether field names are case sensitive @return class information or {@code null} for {@code null} input @since 1.10
[ "Returns", "the", "class", "information", "for", "the", "given", "underlying", "class", "." ]
train
https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/util/ClassInfo.java#L80-L94
jbossws/jbossws-common
src/main/java/org/jboss/ws/common/DOMUtils.java
DOMUtils.createElement
public static Element createElement(String localPart, String prefix, String uri) { Document doc = getOwnerDocument(); if (prefix == null || prefix.length() == 0) { if (ROOT_LOGGER.isTraceEnabled()) ROOT_LOGGER.trace("createElement {" + uri + "}" + localPart); return doc.createElementNS(uri, localPart); } else { if (ROOT_LOGGER.isTraceEnabled()) ROOT_LOGGER.trace("createElement {" + uri + "}" + prefix + ":" + localPart); return doc.createElementNS(uri, prefix + ":" + localPart); } }
java
public static Element createElement(String localPart, String prefix, String uri) { Document doc = getOwnerDocument(); if (prefix == null || prefix.length() == 0) { if (ROOT_LOGGER.isTraceEnabled()) ROOT_LOGGER.trace("createElement {" + uri + "}" + localPart); return doc.createElementNS(uri, localPart); } else { if (ROOT_LOGGER.isTraceEnabled()) ROOT_LOGGER.trace("createElement {" + uri + "}" + prefix + ":" + localPart); return doc.createElementNS(uri, prefix + ":" + localPart); } }
[ "public", "static", "Element", "createElement", "(", "String", "localPart", ",", "String", "prefix", ",", "String", "uri", ")", "{", "Document", "doc", "=", "getOwnerDocument", "(", ")", ";", "if", "(", "prefix", "==", "null", "||", "prefix", ".", "length"...
Create an Element for a given name, prefix and uri. This uses the document builder associated with the current thread.
[ "Create", "an", "Element", "for", "a", "given", "name", "prefix", "and", "uri", ".", "This", "uses", "the", "document", "builder", "associated", "with", "the", "current", "thread", "." ]
train
https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/DOMUtils.java#L305-L318
svenkubiak/mangooio
mangooio-core/src/main/java/io/mangoo/routing/bindings/Session.java
Session.put
public void put(String key, String value) { if (INVALID_CHRACTERTS.contains(key) || INVALID_CHRACTERTS.contains(value)) { LOG.error("Session key or value can not contain the following characters: spaces, |, & or :"); } else { this.changed = true; this.values.put(key, value); } }
java
public void put(String key, String value) { if (INVALID_CHRACTERTS.contains(key) || INVALID_CHRACTERTS.contains(value)) { LOG.error("Session key or value can not contain the following characters: spaces, |, & or :"); } else { this.changed = true; this.values.put(key, value); } }
[ "public", "void", "put", "(", "String", "key", ",", "String", "value", ")", "{", "if", "(", "INVALID_CHRACTERTS", ".", "contains", "(", "key", ")", "||", "INVALID_CHRACTERTS", ".", "contains", "(", "value", ")", ")", "{", "LOG", ".", "error", "(", "\"S...
Adds a value to the session, overwriting an existing value @param key The key to store the value @param value The value to store
[ "Adds", "a", "value", "to", "the", "session", "overwriting", "an", "existing", "value" ]
train
https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Session.java#L99-L106
camunda/camunda-commons
utils/src/main/java/org/camunda/commons/utils/IoUtil.java
IoUtil.getClasspathFile
public static File getClasspathFile(String filename) { if(filename == null) { throw LOG.nullParameter("filename"); } return getClasspathFile(filename, null); }
java
public static File getClasspathFile(String filename) { if(filename == null) { throw LOG.nullParameter("filename"); } return getClasspathFile(filename, null); }
[ "public", "static", "File", "getClasspathFile", "(", "String", "filename", ")", "{", "if", "(", "filename", "==", "null", ")", "{", "throw", "LOG", ".", "nullParameter", "(", "\"filename\"", ")", ";", "}", "return", "getClasspathFile", "(", "filename", ",", ...
Returns the {@link File} for a filename. @param filename the filename to load @return the file object
[ "Returns", "the", "{", "@link", "File", "}", "for", "a", "filename", "." ]
train
https://github.com/camunda/camunda-commons/blob/bd3195db47c92c25717288fe9e6735f8e882f247/utils/src/main/java/org/camunda/commons/utils/IoUtil.java#L186-L192
Samsung/GearVRf
GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptBundle.java
GVRScriptBundle.loadFromFile
public static GVRScriptBundle loadFromFile(GVRContext gvrContext, String filePath, GVRResourceVolume volume) throws IOException { GVRAndroidResource fileRes = volume.openResource(filePath); String fileText = TextFile.readTextFile(fileRes.getStream()); fileRes.closeStream(); GVRScriptBundle bundle = new GVRScriptBundle(); Gson gson = new Gson(); try { bundle.gvrContext = gvrContext; bundle.file = gson.fromJson(fileText, GVRScriptBundleFile.class); bundle.volume = volume; return bundle; } catch (Exception e) { throw new IOException("Cannot load the script bundle", e); } }
java
public static GVRScriptBundle loadFromFile(GVRContext gvrContext, String filePath, GVRResourceVolume volume) throws IOException { GVRAndroidResource fileRes = volume.openResource(filePath); String fileText = TextFile.readTextFile(fileRes.getStream()); fileRes.closeStream(); GVRScriptBundle bundle = new GVRScriptBundle(); Gson gson = new Gson(); try { bundle.gvrContext = gvrContext; bundle.file = gson.fromJson(fileText, GVRScriptBundleFile.class); bundle.volume = volume; return bundle; } catch (Exception e) { throw new IOException("Cannot load the script bundle", e); } }
[ "public", "static", "GVRScriptBundle", "loadFromFile", "(", "GVRContext", "gvrContext", ",", "String", "filePath", ",", "GVRResourceVolume", "volume", ")", "throws", "IOException", "{", "GVRAndroidResource", "fileRes", "=", "volume", ".", "openResource", "(", "filePat...
Loads a {@link GVRScriptBundle} from a file. @param gvrContext The GVRContext to use for loading. @param filePath The file name of the script bundle in JSON format. @param volume The {@link GVRResourceVolume} from which to load script bundle. @return The {@link GVRScriptBundle} object with contents from the JSON file. @throws IOException if the bundle cannot be loaded.
[ "Loads", "a", "{", "@link", "GVRScriptBundle", "}", "from", "a", "file", ".", "@param", "gvrContext", "The", "GVRContext", "to", "use", "for", "loading", ".", "@param", "filePath", "The", "file", "name", "of", "the", "script", "bundle", "in", "JSON", "form...
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptBundle.java#L67-L83
ow2-chameleon/fuchsia
importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveBasicCommandClass.java
ZWaveBasicCommandClass.processBasicReport
protected void processBasicReport(SerialMessage serialMessage, int offset, int endpoint) { int value = serialMessage.getMessagePayloadByte(offset + 1); logger.debug(String.format("Basic report from nodeId = %d, value = 0x%02X", this.getNode().getNodeId(), value)); Object eventValue; if (value == 0) { eventValue = "OFF"; } else if (value < 99) { eventValue = value; } else { eventValue = "ON"; } ZWaveEvent zEvent = new ZWaveEvent(ZWaveEventType.BASIC_EVENT, this.getNode().getNodeId(), endpoint, eventValue); this.getController().notifyEventListeners(zEvent); }
java
protected void processBasicReport(SerialMessage serialMessage, int offset, int endpoint) { int value = serialMessage.getMessagePayloadByte(offset + 1); logger.debug(String.format("Basic report from nodeId = %d, value = 0x%02X", this.getNode().getNodeId(), value)); Object eventValue; if (value == 0) { eventValue = "OFF"; } else if (value < 99) { eventValue = value; } else { eventValue = "ON"; } ZWaveEvent zEvent = new ZWaveEvent(ZWaveEventType.BASIC_EVENT, this.getNode().getNodeId(), endpoint, eventValue); this.getController().notifyEventListeners(zEvent); }
[ "protected", "void", "processBasicReport", "(", "SerialMessage", "serialMessage", ",", "int", "offset", ",", "int", "endpoint", ")", "{", "int", "value", "=", "serialMessage", ".", "getMessagePayloadByte", "(", "offset", "+", "1", ")", ";", "logger", ".", "deb...
Processes a BASIC_REPORT / BASIC_SET message. @param serialMessage the incoming message to process. @param offset the offset position from which to start message processing. @param endpoint the endpoint or instance number this message is meant for.
[ "Processes", "a", "BASIC_REPORT", "/", "BASIC_SET", "message", "." ]
train
https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveBasicCommandClass.java#L135-L148
nextreports/nextreports-engine
src/ro/nextreports/integration/DemoUtil.java
DemoUtil.copyImages
public static void copyImages(Report report, String from, String to) { try { List<String> images = ReportUtil.getStaticImages(report); File destination = new File(to); for (String image : images) { File f = new File(from + File.separator + image); if (f.exists()) { FileUtil.copyToDir(f, destination); } } } catch (IOException ex) { ex.printStackTrace(); } }
java
public static void copyImages(Report report, String from, String to) { try { List<String> images = ReportUtil.getStaticImages(report); File destination = new File(to); for (String image : images) { File f = new File(from + File.separator + image); if (f.exists()) { FileUtil.copyToDir(f, destination); } } } catch (IOException ex) { ex.printStackTrace(); } }
[ "public", "static", "void", "copyImages", "(", "Report", "report", ",", "String", "from", ",", "String", "to", ")", "{", "try", "{", "List", "<", "String", ">", "images", "=", "ReportUtil", ".", "getStaticImages", "(", "report", ")", ";", "File", "destin...
this must any folder taht is in the project classpath : PDF, EXCEL, RTF
[ "this", "must", "any", "folder", "taht", "is", "in", "the", "project", "classpath", ":", "PDF", "EXCEL", "RTF" ]
train
https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/integration/DemoUtil.java#L103-L116
alkacon/opencms-core
src/org/opencms/staticexport/CmsStaticExportManager.java
CmsStaticExportManager.isSecureLink
public boolean isSecureLink(CmsObject cms, String vfsName, String siteRoot, boolean fromSecure) { if (siteRoot == null) { return isSecureLink(cms, vfsName, fromSecure); } // the site root of the cms object has to be changed so that the property can be read String storedSiteRoot = cms.getRequestContext().getSiteRoot(); try { cms.getRequestContext().setSiteRoot(siteRoot); return isSecureLink(cms, vfsName, fromSecure); } finally { cms.getRequestContext().setSiteRoot(storedSiteRoot); } }
java
public boolean isSecureLink(CmsObject cms, String vfsName, String siteRoot, boolean fromSecure) { if (siteRoot == null) { return isSecureLink(cms, vfsName, fromSecure); } // the site root of the cms object has to be changed so that the property can be read String storedSiteRoot = cms.getRequestContext().getSiteRoot(); try { cms.getRequestContext().setSiteRoot(siteRoot); return isSecureLink(cms, vfsName, fromSecure); } finally { cms.getRequestContext().setSiteRoot(storedSiteRoot); } }
[ "public", "boolean", "isSecureLink", "(", "CmsObject", "cms", ",", "String", "vfsName", ",", "String", "siteRoot", ",", "boolean", "fromSecure", ")", "{", "if", "(", "siteRoot", "==", "null", ")", "{", "return", "isSecureLink", "(", "cms", ",", "vfsName", ...
Returns <code>true</code> if the given VFS resource should be transported through a secure channel.<p> The secure mode is only checked in the "Online" project. If the given OpenCms context is currently not in the "Online" project, <code>false</code> is returned.<p> The given resource is read from the site root of the provided OpenCms context.<p> @param cms the current users OpenCms context @param vfsName the VFS resource name to check @param siteRoot the site root where the the VFS resource should be read @param fromSecure <code>true</code> if the link source is delivered secure @return <code>true</code> if the given VFS resource should be transported through a secure channel @see CmsStaticExportManager#isSecureLink(CmsObject, String, String)
[ "Returns", "<code", ">", "true<", "/", "code", ">", "if", "the", "given", "VFS", "resource", "should", "be", "transported", "through", "a", "secure", "channel", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/staticexport/CmsStaticExportManager.java#L2026-L2040
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/LiveEventsInner.java
LiveEventsInner.updateAsync
public Observable<LiveEventInner> updateAsync(String resourceGroupName, String accountName, String liveEventName, LiveEventInner parameters) { return updateWithServiceResponseAsync(resourceGroupName, accountName, liveEventName, parameters).map(new Func1<ServiceResponse<LiveEventInner>, LiveEventInner>() { @Override public LiveEventInner call(ServiceResponse<LiveEventInner> response) { return response.body(); } }); }
java
public Observable<LiveEventInner> updateAsync(String resourceGroupName, String accountName, String liveEventName, LiveEventInner parameters) { return updateWithServiceResponseAsync(resourceGroupName, accountName, liveEventName, parameters).map(new Func1<ServiceResponse<LiveEventInner>, LiveEventInner>() { @Override public LiveEventInner call(ServiceResponse<LiveEventInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "LiveEventInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "liveEventName", ",", "LiveEventInner", "parameters", ")", "{", "return", "updateWithServiceResponseAsync", "(", "resource...
Updates a existing Live Event. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param liveEventName The name of the Live Event. @param parameters Live Event properties needed for creation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Updates", "a", "existing", "Live", "Event", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/LiveEventsInner.java#L785-L792
Talend/tesb-rt-se
locator/src/main/java/org/talend/esb/servicelocator/cxf/internal/CXFEndpointProvider.java
CXFEndpointProvider.serializeEPR
private void serializeEPR(EndpointReferenceType wsAddr, Node parent) throws ServiceLocatorException { try { JAXBElement<EndpointReferenceType> ep = WSA_OBJECT_FACTORY.createEndpointReference(wsAddr); createMarshaller().marshal(ep, parent); } catch (JAXBException e) { if (LOG.isLoggable(Level.SEVERE)) { LOG.log(Level.SEVERE, "Failed to serialize endpoint data", e); } throw new ServiceLocatorException("Failed to serialize endpoint data", e); } }
java
private void serializeEPR(EndpointReferenceType wsAddr, Node parent) throws ServiceLocatorException { try { JAXBElement<EndpointReferenceType> ep = WSA_OBJECT_FACTORY.createEndpointReference(wsAddr); createMarshaller().marshal(ep, parent); } catch (JAXBException e) { if (LOG.isLoggable(Level.SEVERE)) { LOG.log(Level.SEVERE, "Failed to serialize endpoint data", e); } throw new ServiceLocatorException("Failed to serialize endpoint data", e); } }
[ "private", "void", "serializeEPR", "(", "EndpointReferenceType", "wsAddr", ",", "Node", "parent", ")", "throws", "ServiceLocatorException", "{", "try", "{", "JAXBElement", "<", "EndpointReferenceType", ">", "ep", "=", "WSA_OBJECT_FACTORY", ".", "createEndpointReference"...
Inserts a marshalled endpoint reference to a given DOM tree rooted by parent. @param wsAddr @param parent @throws ServiceLocatorException
[ "Inserts", "a", "marshalled", "endpoint", "reference", "to", "a", "given", "DOM", "tree", "rooted", "by", "parent", "." ]
train
https://github.com/Talend/tesb-rt-se/blob/0a151a6d91ffff65ac4b5ee0c5b2c882ac28d886/locator/src/main/java/org/talend/esb/servicelocator/cxf/internal/CXFEndpointProvider.java#L205-L217
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/HeaderHandler.java
HeaderHandler.extractString
private String extractString(char[] data, int start, int end) { // skip leading whitespace and quotes while (start < end && (' ' == data[start] || '\t' == data[start] || '"' == data[start])) { start++; } // ignore trailing whitespace and quotes while (end >= start && (' ' == data[end] || '\t' == data[end] || '"' == data[end])) { end--; } // check for nothing but whitespace if (end < start) { return null; } int len = end - start + 1; String rc = Normalizer.normalize(new String(data, start, len), Normalizer.NORMALIZE_LOWER); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "extractString: [" + rc + "]"); } return rc; }
java
private String extractString(char[] data, int start, int end) { // skip leading whitespace and quotes while (start < end && (' ' == data[start] || '\t' == data[start] || '"' == data[start])) { start++; } // ignore trailing whitespace and quotes while (end >= start && (' ' == data[end] || '\t' == data[end] || '"' == data[end])) { end--; } // check for nothing but whitespace if (end < start) { return null; } int len = end - start + 1; String rc = Normalizer.normalize(new String(data, start, len), Normalizer.NORMALIZE_LOWER); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "extractString: [" + rc + "]"); } return rc; }
[ "private", "String", "extractString", "(", "char", "[", "]", "data", ",", "int", "start", ",", "int", "end", ")", "{", "// skip leading whitespace and quotes", "while", "(", "start", "<", "end", "&&", "(", "'", "'", "==", "data", "[", "start", "]", "||",...
Extract a string from the input array based on the start and end markers. This will strip off any leading and trailing white space or quotes. @param data @param start @param end @return String (lowercase converted)
[ "Extract", "a", "string", "from", "the", "input", "array", "based", "on", "the", "start", "and", "end", "markers", ".", "This", "will", "strip", "off", "any", "leading", "and", "trailing", "white", "space", "or", "quotes", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/HeaderHandler.java#L197-L218
sebastiangraf/treetank
interfacemodules/xml/src/main/java/org/treetank/service/xml/diff/AbsDiff.java
AbsDiff.checkUpdate
boolean checkUpdate(final INodeReadTrx paramNewRtx, final INodeReadTrx paramOldRtx) throws TTIOException { assert paramNewRtx != null; assert paramOldRtx != null; boolean updated = false; final long newKey = paramNewRtx.getNode().getDataKey(); boolean movedNewRtx = paramNewRtx.moveTo(((ITreeStructData)paramNewRtx.getNode()).getRightSiblingKey()); final long oldKey = paramOldRtx.getNode().getDataKey(); boolean movedOldRtx = paramOldRtx.moveTo(((ITreeStructData)paramOldRtx.getNode()).getRightSiblingKey()); if (movedNewRtx && movedOldRtx && checkNodes(paramNewRtx, paramOldRtx)) { updated = true; } else if (!movedNewRtx && !movedOldRtx) { movedNewRtx = paramNewRtx.moveTo(paramNewRtx.getNode().getParentKey()); movedOldRtx = paramOldRtx.moveTo(paramOldRtx.getNode().getParentKey()); if (movedNewRtx && movedOldRtx && checkNodes(paramNewRtx, paramOldRtx)) { updated = true; } } paramNewRtx.moveTo(newKey); paramOldRtx.moveTo(oldKey); if (!updated) { updated = paramNewRtx.getNode().getDataKey() == paramOldRtx.getNode().getDataKey(); } return updated; }
java
boolean checkUpdate(final INodeReadTrx paramNewRtx, final INodeReadTrx paramOldRtx) throws TTIOException { assert paramNewRtx != null; assert paramOldRtx != null; boolean updated = false; final long newKey = paramNewRtx.getNode().getDataKey(); boolean movedNewRtx = paramNewRtx.moveTo(((ITreeStructData)paramNewRtx.getNode()).getRightSiblingKey()); final long oldKey = paramOldRtx.getNode().getDataKey(); boolean movedOldRtx = paramOldRtx.moveTo(((ITreeStructData)paramOldRtx.getNode()).getRightSiblingKey()); if (movedNewRtx && movedOldRtx && checkNodes(paramNewRtx, paramOldRtx)) { updated = true; } else if (!movedNewRtx && !movedOldRtx) { movedNewRtx = paramNewRtx.moveTo(paramNewRtx.getNode().getParentKey()); movedOldRtx = paramOldRtx.moveTo(paramOldRtx.getNode().getParentKey()); if (movedNewRtx && movedOldRtx && checkNodes(paramNewRtx, paramOldRtx)) { updated = true; } } paramNewRtx.moveTo(newKey); paramOldRtx.moveTo(oldKey); if (!updated) { updated = paramNewRtx.getNode().getDataKey() == paramOldRtx.getNode().getDataKey(); } return updated; }
[ "boolean", "checkUpdate", "(", "final", "INodeReadTrx", "paramNewRtx", ",", "final", "INodeReadTrx", "paramOldRtx", ")", "throws", "TTIOException", "{", "assert", "paramNewRtx", "!=", "null", ";", "assert", "paramOldRtx", "!=", "null", ";", "boolean", "updated", "...
Check for an update of a node. @param paramNewRtx first {@link IReadTransaction} instance @param paramOldRtx second {@link IReadTransaction} instance @return kind of diff @throws TTIOException
[ "Check", "for", "an", "update", "of", "a", "node", "." ]
train
https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/diff/AbsDiff.java#L466-L490
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/url/URLHelper.java
URLHelper.getURLString
@Nullable public static String getURLString (@Nullable final String sPath, @Nullable final List <? extends URLParameter> aQueryParams, @Nullable final String sAnchor, @Nullable final Charset aParameterCharset) { final IEncoder <String, String> aQueryParameterEncoder = aParameterCharset == null ? null : new URLParameterEncoder (aParameterCharset); return getURLString (sPath, getQueryParametersAsString (aQueryParams, aQueryParameterEncoder), sAnchor); }
java
@Nullable public static String getURLString (@Nullable final String sPath, @Nullable final List <? extends URLParameter> aQueryParams, @Nullable final String sAnchor, @Nullable final Charset aParameterCharset) { final IEncoder <String, String> aQueryParameterEncoder = aParameterCharset == null ? null : new URLParameterEncoder (aParameterCharset); return getURLString (sPath, getQueryParametersAsString (aQueryParams, aQueryParameterEncoder), sAnchor); }
[ "@", "Nullable", "public", "static", "String", "getURLString", "(", "@", "Nullable", "final", "String", "sPath", ",", "@", "Nullable", "final", "List", "<", "?", "extends", "URLParameter", ">", "aQueryParams", ",", "@", "Nullable", "final", "String", "sAnchor"...
Get the final representation of the URL using the specified elements. @param sPath The main path. May be <code>null</code>. @param aQueryParams The list of parameters to be appended. May be <code>null</code>. @param sAnchor An optional anchor to be added. May be <code>null</code>. @param aParameterCharset If not <code>null</code> the parameters are encoded using this charset. @return May be <code>null</code> if all parameters are <code>null</code>.
[ "Get", "the", "final", "representation", "of", "the", "URL", "using", "the", "specified", "elements", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/url/URLHelper.java#L730-L739
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/util/plugin/PluginContext.java
PluginContext.addPlugin
public void addPlugin(Plugin plugin) { if (!mPluginMap.containsKey(plugin.getName())) { mPluginMap.put(plugin.getName(), plugin); PluginEvent event = new PluginEvent(this, plugin); firePluginAddedEvent(event); } }
java
public void addPlugin(Plugin plugin) { if (!mPluginMap.containsKey(plugin.getName())) { mPluginMap.put(plugin.getName(), plugin); PluginEvent event = new PluginEvent(this, plugin); firePluginAddedEvent(event); } }
[ "public", "void", "addPlugin", "(", "Plugin", "plugin", ")", "{", "if", "(", "!", "mPluginMap", ".", "containsKey", "(", "plugin", ".", "getName", "(", ")", ")", ")", "{", "mPluginMap", ".", "put", "(", "plugin", ".", "getName", "(", ")", ",", "plugi...
Adds a Plugin to the PluginContext. Plugins that want to make themselves available to other Plugins should add themselves to the PluginContext through this method. All PluginListeners will be notified of the new addition. @param plugin the Plugin to be added.
[ "Adds", "a", "Plugin", "to", "the", "PluginContext", ".", "Plugins", "that", "want", "to", "make", "themselves", "available", "to", "other", "Plugins", "should", "add", "themselves", "to", "the", "PluginContext", "through", "this", "method", ".", "All", "Plugi...
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/util/plugin/PluginContext.java#L86-L92
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/seo/CmsAliasList.java
CmsAliasList.validateAliases
public void validateAliases( final CmsUUID uuid, final Map<String, String> aliasPaths, final AsyncCallback<Map<String, String>> callback) { CmsRpcAction<Map<String, String>> action = new CmsRpcAction<Map<String, String>>() { /** * @see org.opencms.gwt.client.rpc.CmsRpcAction#execute() */ @Override public void execute() { start(200, true); CmsCoreProvider.getVfsService().validateAliases(uuid, aliasPaths, this); } /** * @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object) */ @Override protected void onResponse(Map<String, String> result) { stop(false); callback.onSuccess(result); } }; action.execute(); }
java
public void validateAliases( final CmsUUID uuid, final Map<String, String> aliasPaths, final AsyncCallback<Map<String, String>> callback) { CmsRpcAction<Map<String, String>> action = new CmsRpcAction<Map<String, String>>() { /** * @see org.opencms.gwt.client.rpc.CmsRpcAction#execute() */ @Override public void execute() { start(200, true); CmsCoreProvider.getVfsService().validateAliases(uuid, aliasPaths, this); } /** * @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object) */ @Override protected void onResponse(Map<String, String> result) { stop(false); callback.onSuccess(result); } }; action.execute(); }
[ "public", "void", "validateAliases", "(", "final", "CmsUUID", "uuid", ",", "final", "Map", "<", "String", ",", "String", ">", "aliasPaths", ",", "final", "AsyncCallback", "<", "Map", "<", "String", ",", "String", ">", ">", "callback", ")", "{", "CmsRpcActi...
Validates aliases. @param uuid The structure id for which the aliases should be valid @param aliasPaths a map from id strings to alias paths @param callback the callback which should be called with the validation results
[ "Validates", "aliases", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/seo/CmsAliasList.java#L423-L452
rwl/CSparseJ
src/main/java/edu/emory/mathcs/csparsej/tdcomplex/DZcs_happly.java
DZcs_happly.cs_happly
public static boolean cs_happly(DZcs V, int i, double beta, DZcsa x) { int p, Vp[], Vi[] ; DZcsa Vx = new DZcsa() ; double[] tau = cs_czero() ; if (!CS_CSC (V) || x == null) return (false) ; /* check inputs */ Vp = V.p ; Vi = V.i ; Vx.x = V.x ; for (p = Vp [i] ; p < Vp [i+1] ; p++) /* tau = v'*x */ { tau = cs_cplus(tau, cs_cmult(cs_conj(Vx.get(p)), x.get(Vi [p]))) ; } tau = cs_cmult(tau, beta) ; /* tau = beta*(v'*x) */ for (p = Vp [i] ; p < Vp [i+1] ; p++) /* x = x - v*tau */ { x.set(Vi [p], cs_cminus(x.get(Vi [p]), cs_cmult(Vx.get(p), tau))) ; } return (true) ; }
java
public static boolean cs_happly(DZcs V, int i, double beta, DZcsa x) { int p, Vp[], Vi[] ; DZcsa Vx = new DZcsa() ; double[] tau = cs_czero() ; if (!CS_CSC (V) || x == null) return (false) ; /* check inputs */ Vp = V.p ; Vi = V.i ; Vx.x = V.x ; for (p = Vp [i] ; p < Vp [i+1] ; p++) /* tau = v'*x */ { tau = cs_cplus(tau, cs_cmult(cs_conj(Vx.get(p)), x.get(Vi [p]))) ; } tau = cs_cmult(tau, beta) ; /* tau = beta*(v'*x) */ for (p = Vp [i] ; p < Vp [i+1] ; p++) /* x = x - v*tau */ { x.set(Vi [p], cs_cminus(x.get(Vi [p]), cs_cmult(Vx.get(p), tau))) ; } return (true) ; }
[ "public", "static", "boolean", "cs_happly", "(", "DZcs", "V", ",", "int", "i", ",", "double", "beta", ",", "DZcsa", "x", ")", "{", "int", "p", ",", "Vp", "[", "]", ",", "Vi", "[", "]", ";", "DZcsa", "Vx", "=", "new", "DZcsa", "(", ")", ";", "...
Applies a Householder reflection to a dense vector, x = (I - beta*v*v')*x. @param V column-compressed matrix of Householder vectors @param i v = V(:,i), the ith column of V @param beta scalar beta @param x vector x of size m @return true if successful, false on error
[ "Applies", "a", "Householder", "reflection", "to", "a", "dense", "vector", "x", "=", "(", "I", "-", "beta", "*", "v", "*", "v", ")", "*", "x", "." ]
train
https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tdcomplex/DZcs_happly.java#L60-L77
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/ScrollPanePainter.java
ScrollPanePainter.paintBorderFocused
private void paintBorderFocused(Graphics2D g, int width, int height) { Shape s; s = shapeGenerator.createRoundRectangle(0, 0, width - 1, height - 1, CornerSize.OUTER_FOCUS); g.setPaint(getFocusPaint(s, FocusType.OUTER_FOCUS, false)); g.draw(s); s = shapeGenerator.createRoundRectangle(1, 1, width - 3, height - 3, CornerSize.INNER_FOCUS); g.setPaint(getFocusPaint(s, FocusType.INNER_FOCUS, false)); g.draw(s); s = shapeGenerator.createRoundRectangle(2, 2, width - 5, height - 5, CornerSize.BORDER); g.setPaint(borderColor); g.draw(s); }
java
private void paintBorderFocused(Graphics2D g, int width, int height) { Shape s; s = shapeGenerator.createRoundRectangle(0, 0, width - 1, height - 1, CornerSize.OUTER_FOCUS); g.setPaint(getFocusPaint(s, FocusType.OUTER_FOCUS, false)); g.draw(s); s = shapeGenerator.createRoundRectangle(1, 1, width - 3, height - 3, CornerSize.INNER_FOCUS); g.setPaint(getFocusPaint(s, FocusType.INNER_FOCUS, false)); g.draw(s); s = shapeGenerator.createRoundRectangle(2, 2, width - 5, height - 5, CornerSize.BORDER); g.setPaint(borderColor); g.draw(s); }
[ "private", "void", "paintBorderFocused", "(", "Graphics2D", "g", ",", "int", "width", ",", "int", "height", ")", "{", "Shape", "s", ";", "s", "=", "shapeGenerator", ".", "createRoundRectangle", "(", "0", ",", "0", ",", "width", "-", "1", ",", "height", ...
DOCUMENT ME! @param g DOCUMENT ME! @param width DOCUMENT ME! @param height DOCUMENT ME!
[ "DOCUMENT", "ME!" ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/ScrollPanePainter.java#L129-L144
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/config/Config.java
Config.setCardinalityEstimatorConfigs
public Config setCardinalityEstimatorConfigs(Map<String, CardinalityEstimatorConfig> cardinalityEstimatorConfigs) { this.cardinalityEstimatorConfigs.clear(); this.cardinalityEstimatorConfigs.putAll(cardinalityEstimatorConfigs); for (Entry<String, CardinalityEstimatorConfig> entry : cardinalityEstimatorConfigs.entrySet()) { entry.getValue().setName(entry.getKey()); } return this; }
java
public Config setCardinalityEstimatorConfigs(Map<String, CardinalityEstimatorConfig> cardinalityEstimatorConfigs) { this.cardinalityEstimatorConfigs.clear(); this.cardinalityEstimatorConfigs.putAll(cardinalityEstimatorConfigs); for (Entry<String, CardinalityEstimatorConfig> entry : cardinalityEstimatorConfigs.entrySet()) { entry.getValue().setName(entry.getKey()); } return this; }
[ "public", "Config", "setCardinalityEstimatorConfigs", "(", "Map", "<", "String", ",", "CardinalityEstimatorConfig", ">", "cardinalityEstimatorConfigs", ")", "{", "this", ".", "cardinalityEstimatorConfigs", ".", "clear", "(", ")", ";", "this", ".", "cardinalityEstimatorC...
Sets the map of cardinality estimator configurations, mapped by config name. The config name may be a pattern with which the configuration will be obtained in the future. @param cardinalityEstimatorConfigs the cardinality estimator configuration map to set @return this config instance
[ "Sets", "the", "map", "of", "cardinality", "estimator", "configurations", "mapped", "by", "config", "name", ".", "The", "config", "name", "may", "be", "a", "pattern", "with", "which", "the", "configuration", "will", "be", "obtained", "in", "the", "future", "...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L2239-L2246
steveash/jopenfst
src/main/java/com/github/steveash/jopenfst/io/Convert.java
Convert.importFst
public static MutableFst importFst(String basename, Semiring semiring) { Optional<MutableSymbolTable> maybeInputs = importSymbols(basename + INPUT_SYMS); Optional<MutableSymbolTable> maybeOutputs = importSymbols(basename + OUTPUT_SYMS); Optional<MutableSymbolTable> maybeStates = importSymbols(basename + STATES_SYMS); CharSource cs = asCharSource(Resources.getResource(basename + FST_TXT), Charsets.UTF_8); return convertFrom(cs, maybeInputs, maybeOutputs, maybeStates, semiring); }
java
public static MutableFst importFst(String basename, Semiring semiring) { Optional<MutableSymbolTable> maybeInputs = importSymbols(basename + INPUT_SYMS); Optional<MutableSymbolTable> maybeOutputs = importSymbols(basename + OUTPUT_SYMS); Optional<MutableSymbolTable> maybeStates = importSymbols(basename + STATES_SYMS); CharSource cs = asCharSource(Resources.getResource(basename + FST_TXT), Charsets.UTF_8); return convertFrom(cs, maybeInputs, maybeOutputs, maybeStates, semiring); }
[ "public", "static", "MutableFst", "importFst", "(", "String", "basename", ",", "Semiring", "semiring", ")", "{", "Optional", "<", "MutableSymbolTable", ">", "maybeInputs", "=", "importSymbols", "(", "basename", "+", "INPUT_SYMS", ")", ";", "Optional", "<", "Muta...
Imports an openfst text format. You pass in the base path that can be loaded off of the classpath For example if you had classpath location data with files data/mymodel.fst.txt, data/mymodel.input.syms, and data/mymodel.output.syms then you would pass "data/mymodel" to this method @param basename the files' base name @param semiring the fst's semiring
[ "Imports", "an", "openfst", "text", "format", ".", "You", "pass", "in", "the", "base", "path", "that", "can", "be", "loaded", "off", "of", "the", "classpath", "For", "example", "if", "you", "had", "classpath", "location", "data", "with", "files", "data", ...
train
https://github.com/steveash/jopenfst/blob/4c675203015c1cfad2072556cb532b6edc73261d/src/main/java/com/github/steveash/jopenfst/io/Convert.java#L317-L325
mgm-tp/jfunk
jfunk-core/src/main/java/com/mgmtp/jfunk/core/scripting/ModuleArchiver.java
ModuleArchiver.startArchiving
void startArchiving() { if (isArchivingDisabled()) { return; } String archiveName = configuration.get(JFunkConstants.ARCHIVE_FILE); if (StringUtils.isBlank(archiveName)) { archiveName = String.format(DIR_PATTERN, moduleMetaData.getModuleName(), Thread.currentThread().getName(), FORMAT.format(moduleMetaData.getStartDate())); } moduleArchiveDir = new File(archiveDir, archiveName); if (moduleArchiveDir.exists()) { log.warn("Archive directory already exists: {}", moduleArchiveDir); } else { moduleArchiveDir.mkdirs(); } addModuleAppender(); log.info("Started archiving: (module={}, moduleArchiveDir={})", moduleMetaData.getModuleName(), moduleArchiveDir); }
java
void startArchiving() { if (isArchivingDisabled()) { return; } String archiveName = configuration.get(JFunkConstants.ARCHIVE_FILE); if (StringUtils.isBlank(archiveName)) { archiveName = String.format(DIR_PATTERN, moduleMetaData.getModuleName(), Thread.currentThread().getName(), FORMAT.format(moduleMetaData.getStartDate())); } moduleArchiveDir = new File(archiveDir, archiveName); if (moduleArchiveDir.exists()) { log.warn("Archive directory already exists: {}", moduleArchiveDir); } else { moduleArchiveDir.mkdirs(); } addModuleAppender(); log.info("Started archiving: (module={}, moduleArchiveDir={})", moduleMetaData.getModuleName(), moduleArchiveDir); }
[ "void", "startArchiving", "(", ")", "{", "if", "(", "isArchivingDisabled", "(", ")", ")", "{", "return", ";", "}", "String", "archiveName", "=", "configuration", ".", "get", "(", "JFunkConstants", ".", "ARCHIVE_FILE", ")", ";", "if", "(", "StringUtils", "....
Starts archiving of the specified module, if archiving is enabled.
[ "Starts", "archiving", "of", "the", "specified", "module", "if", "archiving", "is", "enabled", "." ]
train
https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-core/src/main/java/com/mgmtp/jfunk/core/scripting/ModuleArchiver.java#L122-L142
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4PreparedStatement.java
JDBC4PreparedStatement.setRef
@Override public void setRef(int parameterIndex, Ref x) throws SQLException { checkParameterBounds(parameterIndex); throw SQLError.noSupport(); }
java
@Override public void setRef(int parameterIndex, Ref x) throws SQLException { checkParameterBounds(parameterIndex); throw SQLError.noSupport(); }
[ "@", "Override", "public", "void", "setRef", "(", "int", "parameterIndex", ",", "Ref", "x", ")", "throws", "SQLException", "{", "checkParameterBounds", "(", "parameterIndex", ")", ";", "throw", "SQLError", ".", "noSupport", "(", ")", ";", "}" ]
Sets the designated parameter to the given REF(<structured-type>) value.
[ "Sets", "the", "designated", "parameter", "to", "the", "given", "REF", "(", "<structured", "-", "type", ">", ")", "value", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4PreparedStatement.java#L518-L523
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/microdom/AbstractMicroNode.java
AbstractMicroNode.onInsertAtIndex
@OverrideOnDemand protected void onInsertAtIndex (@Nonnegative final int nIndex, @Nonnull final AbstractMicroNode aChildNode) { throw new MicroException ("Cannot insert children in class " + getClass ().getName ()); }
java
@OverrideOnDemand protected void onInsertAtIndex (@Nonnegative final int nIndex, @Nonnull final AbstractMicroNode aChildNode) { throw new MicroException ("Cannot insert children in class " + getClass ().getName ()); }
[ "@", "OverrideOnDemand", "protected", "void", "onInsertAtIndex", "(", "@", "Nonnegative", "final", "int", "nIndex", ",", "@", "Nonnull", "final", "AbstractMicroNode", "aChildNode", ")", "{", "throw", "new", "MicroException", "(", "\"Cannot insert children in class \"", ...
Callback that is invoked once a child is to be inserted at the specified index. @param nIndex The index where the node should be inserted. @param aChildNode The new child node to be inserted.
[ "Callback", "that", "is", "invoked", "once", "a", "child", "is", "to", "be", "inserted", "at", "the", "specified", "index", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/microdom/AbstractMicroNode.java#L104-L108
DiUS/pact-jvm
pact-jvm-consumer-junit/src/main/java/au/com/dius/pact/consumer/BaseProviderRule.java
BaseProviderRule.getPacts
protected Map<String, RequestResponsePact> getPacts(String fragment) { if (pacts == null) { pacts = new HashMap<>(); for (Method m: target.getClass().getMethods()) { if (JUnitTestSupport.conformsToSignature(m) && methodMatchesFragment(m, fragment)) { Pact pactAnnotation = m.getAnnotation(Pact.class); if (StringUtils.isEmpty(pactAnnotation.provider()) || provider.equals(pactAnnotation.provider())) { PactDslWithProvider dslBuilder = ConsumerPactBuilder.consumer(pactAnnotation.consumer()) .hasPactWith(provider); updateAnyDefaultValues(dslBuilder); try { RequestResponsePact pact = (RequestResponsePact) m.invoke(target, dslBuilder); pacts.put(provider, pact); } catch (Exception e) { throw new RuntimeException("Failed to invoke pact method", e); } } } } } return pacts; }
java
protected Map<String, RequestResponsePact> getPacts(String fragment) { if (pacts == null) { pacts = new HashMap<>(); for (Method m: target.getClass().getMethods()) { if (JUnitTestSupport.conformsToSignature(m) && methodMatchesFragment(m, fragment)) { Pact pactAnnotation = m.getAnnotation(Pact.class); if (StringUtils.isEmpty(pactAnnotation.provider()) || provider.equals(pactAnnotation.provider())) { PactDslWithProvider dslBuilder = ConsumerPactBuilder.consumer(pactAnnotation.consumer()) .hasPactWith(provider); updateAnyDefaultValues(dslBuilder); try { RequestResponsePact pact = (RequestResponsePact) m.invoke(target, dslBuilder); pacts.put(provider, pact); } catch (Exception e) { throw new RuntimeException("Failed to invoke pact method", e); } } } } } return pacts; }
[ "protected", "Map", "<", "String", ",", "RequestResponsePact", ">", "getPacts", "(", "String", "fragment", ")", "{", "if", "(", "pacts", "==", "null", ")", "{", "pacts", "=", "new", "HashMap", "<>", "(", ")", ";", "for", "(", "Method", "m", ":", "tar...
scan all methods for @Pact annotation and execute them, if not already initialized @param fragment
[ "scan", "all", "methods", "for" ]
train
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer-junit/src/main/java/au/com/dius/pact/consumer/BaseProviderRule.java#L177-L198
headius/invokebinder
src/main/java/com/headius/invokebinder/SmartBinder.java
SmartBinder.invokeStatic
public SmartHandle invokeStatic(Lookup lookup, Class<?> target, String name) throws NoSuchMethodException, IllegalAccessException { return new SmartHandle(start, binder.invokeStatic(lookup, target, name)); }
java
public SmartHandle invokeStatic(Lookup lookup, Class<?> target, String name) throws NoSuchMethodException, IllegalAccessException { return new SmartHandle(start, binder.invokeStatic(lookup, target, name)); }
[ "public", "SmartHandle", "invokeStatic", "(", "Lookup", "lookup", ",", "Class", "<", "?", ">", "target", ",", "String", "name", ")", "throws", "NoSuchMethodException", ",", "IllegalAccessException", "{", "return", "new", "SmartHandle", "(", "start", ",", "binder...
Terminate this binder by looking up the named static method on the given target type. Perform the actual method lookup using the given Lookup object. @param lookup the Lookup to use for handle lookups @param target the type on which to find the static method @param name the name of the target static method @return a SmartHandle with this binder's starting signature, bound to the target method @throws NoSuchMethodException if the named method with current signature's types does not exist @throws IllegalAccessException if the named method is not accessible to the given Lookup
[ "Terminate", "this", "binder", "by", "looking", "up", "the", "named", "static", "method", "on", "the", "given", "target", "type", ".", "Perform", "the", "actual", "method", "lookup", "using", "the", "given", "Lookup", "object", "." ]
train
https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/SmartBinder.java#L1018-L1020
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/tiles/user/TileDaoUtils.java
TileDaoUtils.getZoomLevel
public static Long getZoomLevel(double[] widths, double[] heights, List<TileMatrix> tileMatrices, double width, double height) { return getZoomLevel(widths, heights, tileMatrices, width, height, true); }
java
public static Long getZoomLevel(double[] widths, double[] heights, List<TileMatrix> tileMatrices, double width, double height) { return getZoomLevel(widths, heights, tileMatrices, width, height, true); }
[ "public", "static", "Long", "getZoomLevel", "(", "double", "[", "]", "widths", ",", "double", "[", "]", "heights", ",", "List", "<", "TileMatrix", ">", "tileMatrices", ",", "double", "width", ",", "double", "height", ")", "{", "return", "getZoomLevel", "("...
Get the zoom level for the provided width and height in the default units @param widths sorted widths @param heights sorted heights @param tileMatrices tile matrices @param width in default units @param height in default units @return tile matrix zoom level @since 1.2.1
[ "Get", "the", "zoom", "level", "for", "the", "provided", "width", "and", "height", "in", "the", "default", "units" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/tiles/user/TileDaoUtils.java#L80-L83
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java
IoUtil.readLines
public static void readLines(InputStream in, Charset charset, LineHandler lineHandler) throws IORuntimeException { readLines(getReader(in, charset), lineHandler); }
java
public static void readLines(InputStream in, Charset charset, LineHandler lineHandler) throws IORuntimeException { readLines(getReader(in, charset), lineHandler); }
[ "public", "static", "void", "readLines", "(", "InputStream", "in", ",", "Charset", "charset", ",", "LineHandler", "lineHandler", ")", "throws", "IORuntimeException", "{", "readLines", "(", "getReader", "(", "in", ",", "charset", ")", ",", "lineHandler", ")", "...
按行读取数据,针对每行的数据做处理 @param in {@link InputStream} @param charset {@link Charset}编码 @param lineHandler 行处理接口,实现handle方法用于编辑一行的数据后入到指定地方 @throws IORuntimeException IO异常 @since 3.0.9
[ "按行读取数据,针对每行的数据做处理" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L702-L704
lessthanoptimal/BoofCV
main/boofcv-sfm/src/main/java/boofcv/alg/depth/VisualDepthOps.java
VisualDepthOps.depthTo3D
public static void depthTo3D(CameraPinholeBrown param , GrayU16 depth , FastQueue<Point3D_F64> cloud ) { cloud.reset(); Point2Transform2_F64 p2n = LensDistortionFactory.narrow(param).undistort_F64(true,false); Point2D_F64 n = new Point2D_F64(); for( int y = 0; y < depth.height; y++ ) { int index = depth.startIndex + y*depth.stride; for( int x = 0; x < depth.width; x++ ) { int mm = depth.data[index++] & 0xFFFF; // skip pixels with no depth information if( mm == 0 ) continue; // this could all be precomputed to speed it up p2n.compute(x,y,n); Point3D_F64 p = cloud.grow(); p.z = mm; p.x = n.x*p.z; p.y = n.y*p.z; } } }
java
public static void depthTo3D(CameraPinholeBrown param , GrayU16 depth , FastQueue<Point3D_F64> cloud ) { cloud.reset(); Point2Transform2_F64 p2n = LensDistortionFactory.narrow(param).undistort_F64(true,false); Point2D_F64 n = new Point2D_F64(); for( int y = 0; y < depth.height; y++ ) { int index = depth.startIndex + y*depth.stride; for( int x = 0; x < depth.width; x++ ) { int mm = depth.data[index++] & 0xFFFF; // skip pixels with no depth information if( mm == 0 ) continue; // this could all be precomputed to speed it up p2n.compute(x,y,n); Point3D_F64 p = cloud.grow(); p.z = mm; p.x = n.x*p.z; p.y = n.y*p.z; } } }
[ "public", "static", "void", "depthTo3D", "(", "CameraPinholeBrown", "param", ",", "GrayU16", "depth", ",", "FastQueue", "<", "Point3D_F64", ">", "cloud", ")", "{", "cloud", ".", "reset", "(", ")", ";", "Point2Transform2_F64", "p2n", "=", "LensDistortionFactory",...
Creates a point cloud from a depth image. @param param Intrinsic camera parameters for depth image @param depth depth image. each value is in millimeters. @param cloud Output point cloud
[ "Creates", "a", "point", "cloud", "from", "a", "depth", "image", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/depth/VisualDepthOps.java#L45-L70
vdmeer/skb-java-base
src/main/java/de/vandermeer/skb/base/shell/Ci_ScRun.java
Ci_ScRun.interpretInfo
protected int interpretInfo(LineParser lp, MessageMgr mm){ String fileName = this.getFileName(lp); String content = this.getContent(fileName, mm); if(content==null){ return 1; } String[] lines = StringUtils.split(content, "\n"); String info = null; for(String s : lines){ if(s.startsWith("//**")){ info = StringUtils.substringAfter(s, "//**"); break; } } if(info!=null){ mm.report(MessageMgr.createInfoMessage("script {} - info: {}", new Object[]{fileName, info})); // Skb_Console.conInfo("{}: script {} - info: {}", new Object[]{shell.getPromptName(), fileName, info}); } return 0; }
java
protected int interpretInfo(LineParser lp, MessageMgr mm){ String fileName = this.getFileName(lp); String content = this.getContent(fileName, mm); if(content==null){ return 1; } String[] lines = StringUtils.split(content, "\n"); String info = null; for(String s : lines){ if(s.startsWith("//**")){ info = StringUtils.substringAfter(s, "//**"); break; } } if(info!=null){ mm.report(MessageMgr.createInfoMessage("script {} - info: {}", new Object[]{fileName, info})); // Skb_Console.conInfo("{}: script {} - info: {}", new Object[]{shell.getPromptName(), fileName, info}); } return 0; }
[ "protected", "int", "interpretInfo", "(", "LineParser", "lp", ",", "MessageMgr", "mm", ")", "{", "String", "fileName", "=", "this", ".", "getFileName", "(", "lp", ")", ";", "String", "content", "=", "this", ".", "getContent", "(", "fileName", ",", "mm", ...
Interprets the actual info command @param lp line parser @param mm the message manager to use for reporting errors, warnings, and infos @return 0 for success, non-zero otherwise
[ "Interprets", "the", "actual", "info", "command" ]
train
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/shell/Ci_ScRun.java#L134-L154
ysc/word
src/main/java/org/apdplat/word/recognition/RecognitionTool.java
RecognitionTool.isFraction
public static boolean isFraction(final String text, final int start, final int len){ if(len < 3){ return false; } int index = -1; for(int i=start; i<start+len; i++){ char c = text.charAt(i); if(c=='.' || c=='/' || c=='/' || c=='.' || c=='·'){ index = i; break; } } if(index == -1 || index == start || index == start+len-1){ return false; } int beforeLen = index-start; return isNumber(text, start, beforeLen) && isNumber(text, index+1, len-(beforeLen+1)); }
java
public static boolean isFraction(final String text, final int start, final int len){ if(len < 3){ return false; } int index = -1; for(int i=start; i<start+len; i++){ char c = text.charAt(i); if(c=='.' || c=='/' || c=='/' || c=='.' || c=='·'){ index = i; break; } } if(index == -1 || index == start || index == start+len-1){ return false; } int beforeLen = index-start; return isNumber(text, start, beforeLen) && isNumber(text, index+1, len-(beforeLen+1)); }
[ "public", "static", "boolean", "isFraction", "(", "final", "String", "text", ",", "final", "int", "start", ",", "final", "int", "len", ")", "{", "if", "(", "len", "<", "3", ")", "{", "return", "false", ";", "}", "int", "index", "=", "-", "1", ";", ...
小数和分数识别 @param text 识别文本 @param start 待识别文本开始索引 @param len 识别长度 @return 是否识别
[ "小数和分数识别" ]
train
https://github.com/ysc/word/blob/5e45607f4e97207f55d1e3bc561abda6b34f7c54/src/main/java/org/apdplat/word/recognition/RecognitionTool.java#L75-L92
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java
ObjectEnvelopeTable.cascadeInsertFor
private void cascadeInsertFor(ObjectEnvelope mod, List alreadyPrepared) { // avoid endless recursion, so use List for registration if(alreadyPrepared.contains(mod.getIdentity())) return; alreadyPrepared.add(mod.getIdentity()); ClassDescriptor cld = getTransaction().getBroker().getClassDescriptor(mod.getObject().getClass()); List refs = cld.getObjectReferenceDescriptors(true); cascadeInsertSingleReferences(mod, refs, alreadyPrepared); List colls = cld.getCollectionDescriptors(true); cascadeInsertCollectionReferences(mod, colls, alreadyPrepared); }
java
private void cascadeInsertFor(ObjectEnvelope mod, List alreadyPrepared) { // avoid endless recursion, so use List for registration if(alreadyPrepared.contains(mod.getIdentity())) return; alreadyPrepared.add(mod.getIdentity()); ClassDescriptor cld = getTransaction().getBroker().getClassDescriptor(mod.getObject().getClass()); List refs = cld.getObjectReferenceDescriptors(true); cascadeInsertSingleReferences(mod, refs, alreadyPrepared); List colls = cld.getCollectionDescriptors(true); cascadeInsertCollectionReferences(mod, colls, alreadyPrepared); }
[ "private", "void", "cascadeInsertFor", "(", "ObjectEnvelope", "mod", ",", "List", "alreadyPrepared", ")", "{", "// avoid endless recursion, so use List for registration\r", "if", "(", "alreadyPrepared", ".", "contains", "(", "mod", ".", "getIdentity", "(", ")", ")", "...
Walk through the object graph of the specified insert object. Was used for recursive object graph walk.
[ "Walk", "through", "the", "object", "graph", "of", "the", "specified", "insert", "object", ".", "Was", "used", "for", "recursive", "object", "graph", "walk", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java#L545-L558
jamesagnew/hapi-fhir
hapi-fhir-base/src/main/java/ca/uhn/fhir/util/OperationOutcomeUtil.java
OperationOutcomeUtil.addIssue
public static void addIssue(FhirContext theCtx, IBaseOperationOutcome theOperationOutcome, String theSeverity, String theDetails, String theLocation, String theCode) { IBase issue = createIssue(theCtx, theOperationOutcome); populateDetails(theCtx, issue, theSeverity, theDetails, theLocation, theCode); }
java
public static void addIssue(FhirContext theCtx, IBaseOperationOutcome theOperationOutcome, String theSeverity, String theDetails, String theLocation, String theCode) { IBase issue = createIssue(theCtx, theOperationOutcome); populateDetails(theCtx, issue, theSeverity, theDetails, theLocation, theCode); }
[ "public", "static", "void", "addIssue", "(", "FhirContext", "theCtx", ",", "IBaseOperationOutcome", "theOperationOutcome", ",", "String", "theSeverity", ",", "String", "theDetails", ",", "String", "theLocation", ",", "String", "theCode", ")", "{", "IBase", "issue", ...
Add an issue to an OperationOutcome @param theCtx The fhir context @param theOperationOutcome The OO resource to add to @param theSeverity The severity (fatal | error | warning | information) @param theDetails The details string @param theCode
[ "Add", "an", "issue", "to", "an", "OperationOutcome" ]
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/OperationOutcomeUtil.java#L57-L60
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/classify/CrossValidator.java
CrossValidator.computeAverage
public double computeAverage (Function<Triple<GeneralDataset<L, F>,GeneralDataset<L, F>,SavedState>,Double> function) { double sum = 0; Iterator<Triple<GeneralDataset<L, F>,GeneralDataset<L, F>,SavedState>> foldIt = iterator(); while (foldIt.hasNext()) { sum += function.apply(foldIt.next()); } return sum / kfold; }
java
public double computeAverage (Function<Triple<GeneralDataset<L, F>,GeneralDataset<L, F>,SavedState>,Double> function) { double sum = 0; Iterator<Triple<GeneralDataset<L, F>,GeneralDataset<L, F>,SavedState>> foldIt = iterator(); while (foldIt.hasNext()) { sum += function.apply(foldIt.next()); } return sum / kfold; }
[ "public", "double", "computeAverage", "(", "Function", "<", "Triple", "<", "GeneralDataset", "<", "L", ",", "F", ">", ",", "GeneralDataset", "<", "L", ",", "F", ">", ",", "SavedState", ">", ",", "Double", ">", "function", ")", "{", "double", "sum", "="...
This computes the average over all folds of the function we're trying to optimize. The input triple contains, in order, the train set, the test set, and the saved state. You don't have to use the saved state if you don't want to.
[ "This", "computes", "the", "average", "over", "all", "folds", "of", "the", "function", "we", "re", "trying", "to", "optimize", ".", "The", "input", "triple", "contains", "in", "order", "the", "train", "set", "the", "test", "set", "and", "the", "saved", "...
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/CrossValidator.java#L48-L56
santhosh-tekuri/jlibs
core/src/main/java/jlibs/core/lang/BeanUtil.java
BeanUtil.setProperty
public static void setProperty(Object bean, String property, Object value) throws InvocationTargetException{ try{ getSetterMethod(bean.getClass(), property).invoke(bean, value); }catch(IllegalAccessException ex){ throw new ImpossibleException(ex); // because setter method is public } }
java
public static void setProperty(Object bean, String property, Object value) throws InvocationTargetException{ try{ getSetterMethod(bean.getClass(), property).invoke(bean, value); }catch(IllegalAccessException ex){ throw new ImpossibleException(ex); // because setter method is public } }
[ "public", "static", "void", "setProperty", "(", "Object", "bean", ",", "String", "property", ",", "Object", "value", ")", "throws", "InvocationTargetException", "{", "try", "{", "getSetterMethod", "(", "bean", ".", "getClass", "(", ")", ",", "property", ")", ...
Sets the value of the specified <code>property</code> in given <code>bean</code> @param bean bean object @param property property name whose value needs to be set @param value value to be set @throws InvocationTargetException if method invocation fails @throws NullPointerException if <code>property</code> is not found in <code>bean</code> or it is readonly property
[ "Sets", "the", "value", "of", "the", "specified", "<code", ">", "property<", "/", "code", ">", "in", "given", "<code", ">", "bean<", "/", "code", ">" ]
train
https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/core/src/main/java/jlibs/core/lang/BeanUtil.java#L224-L230
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/ObjectUtil.java
ObjectUtil.equalsAny
public static boolean equalsAny(final Object o1, final Object... o2s) { if (o2s != null) { for (final Object o2 : o2s) { if (o1 == null) { if (o2 == null) { return true; } continue; } // o1 != null if (o1.equals(o2)) { return true; } } } else { return o1 == null; } return false; }
java
public static boolean equalsAny(final Object o1, final Object... o2s) { if (o2s != null) { for (final Object o2 : o2s) { if (o1 == null) { if (o2 == null) { return true; } continue; } // o1 != null if (o1.equals(o2)) { return true; } } } else { return o1 == null; } return false; }
[ "public", "static", "boolean", "equalsAny", "(", "final", "Object", "o1", ",", "final", "Object", "...", "o2s", ")", "{", "if", "(", "o2s", "!=", "null", ")", "{", "for", "(", "final", "Object", "o2", ":", "o2s", ")", "{", "if", "(", "o1", "==", ...
Return true if o1 equals (according to {@link Object#equals(Object)} any of the given objects. Also returns true if o1 is null and any of the given objects is null as well!
[ "Return", "true", "if", "o1", "equals", "(", "according", "to", "{" ]
train
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/ObjectUtil.java#L80-L98
apereo/cas
support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/response/BaseSamlProfileSamlResponseBuilder.java
BaseSamlProfileSamlResponseBuilder.encodeFinalResponse
protected T encodeFinalResponse(final HttpServletRequest request, final HttpServletResponse response, final SamlRegisteredService service, final SamlRegisteredServiceServiceProviderMetadataFacade adaptor, final T finalResponse, final String binding, final RequestAbstractType authnRequest, final Object assertion, final MessageContext messageContext) { val scratch = messageContext.getSubcontext(ScratchContext.class, true); val encodeResponse = (Boolean) scratch.getMap().getOrDefault(SamlProtocolConstants.PARAMETER_ENCODE_RESPONSE, Boolean.TRUE); if (encodeResponse) { val relayState = request != null ? request.getParameter(SamlProtocolConstants.PARAMETER_SAML_RELAY_STATE) : StringUtils.EMPTY; LOGGER.trace("RelayState is [{}]", relayState); return encode(service, finalResponse, response, request, adaptor, relayState, binding, authnRequest, assertion); } return finalResponse; }
java
protected T encodeFinalResponse(final HttpServletRequest request, final HttpServletResponse response, final SamlRegisteredService service, final SamlRegisteredServiceServiceProviderMetadataFacade adaptor, final T finalResponse, final String binding, final RequestAbstractType authnRequest, final Object assertion, final MessageContext messageContext) { val scratch = messageContext.getSubcontext(ScratchContext.class, true); val encodeResponse = (Boolean) scratch.getMap().getOrDefault(SamlProtocolConstants.PARAMETER_ENCODE_RESPONSE, Boolean.TRUE); if (encodeResponse) { val relayState = request != null ? request.getParameter(SamlProtocolConstants.PARAMETER_SAML_RELAY_STATE) : StringUtils.EMPTY; LOGGER.trace("RelayState is [{}]", relayState); return encode(service, finalResponse, response, request, adaptor, relayState, binding, authnRequest, assertion); } return finalResponse; }
[ "protected", "T", "encodeFinalResponse", "(", "final", "HttpServletRequest", "request", ",", "final", "HttpServletResponse", "response", ",", "final", "SamlRegisteredService", "service", ",", "final", "SamlRegisteredServiceServiceProviderMetadataFacade", "adaptor", ",", "fina...
Encode final response. @param request the request @param response the response @param service the service @param adaptor the adaptor @param finalResponse the final response @param binding the binding @param authnRequest the authn request @param assertion the assertion @param messageContext the message context @return the response
[ "Encode", "final", "response", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/response/BaseSamlProfileSamlResponseBuilder.java#L81-L100
orbisgis/h2gis
postgis-jts/src/main/java/org/h2gis/postgis_jts/JtsBinaryParser.java
JtsBinaryParser.parsePolygon
private Polygon parsePolygon(ValueGetter data, boolean haveZ, boolean haveM, int srid) { int holecount = data.getInt() - 1; LinearRing[] rings = new LinearRing[holecount]; LinearRing shell = this.parseLinearRing(data, haveZ, haveM); shell.setSRID(srid); for(int i = 0; i < holecount; ++i) { rings[i] = this.parseLinearRing(data, haveZ, haveM); rings[i].setSRID(srid); } return JtsGeometry.geofac.createPolygon(shell, rings); }
java
private Polygon parsePolygon(ValueGetter data, boolean haveZ, boolean haveM, int srid) { int holecount = data.getInt() - 1; LinearRing[] rings = new LinearRing[holecount]; LinearRing shell = this.parseLinearRing(data, haveZ, haveM); shell.setSRID(srid); for(int i = 0; i < holecount; ++i) { rings[i] = this.parseLinearRing(data, haveZ, haveM); rings[i].setSRID(srid); } return JtsGeometry.geofac.createPolygon(shell, rings); }
[ "private", "Polygon", "parsePolygon", "(", "ValueGetter", "data", ",", "boolean", "haveZ", ",", "boolean", "haveM", ",", "int", "srid", ")", "{", "int", "holecount", "=", "data", ".", "getInt", "(", ")", "-", "1", ";", "LinearRing", "[", "]", "rings", ...
Parse the given {@link org.postgis.binary.ValueGetter} into a JTS {@link org.locationtech.jts.geom.Polygon}. @param data {@link org.postgis.binary.ValueGetter} to parse. @param haveZ True if the {@link org.locationtech.jts.geom.Polygon} has a Z component. @param haveM True if the {@link org.locationtech.jts.geom.Polygon} has a M component. @return The parsed {@link org.locationtech.jts.geom.Polygon}.
[ "Parse", "the", "given", "{", "@link", "org", ".", "postgis", ".", "binary", ".", "ValueGetter", "}", "into", "a", "JTS", "{", "@link", "org", ".", "locationtech", ".", "jts", ".", "geom", ".", "Polygon", "}", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/postgis-jts/src/main/java/org/h2gis/postgis_jts/JtsBinaryParser.java#L282-L294
legsem/legstar.avro
legstar.avro.cob2avro.hadoop/src/main/java/com/legstar/avro/cob2avro/hadoop/mapreduce/Cob2AvroJob.java
Cob2AvroJob.setInputKeyCobolContext
public static void setInputKeyCobolContext(Job job, Class<? extends CobolContext> cobolContext) { job.getConfiguration().setClass(CONF_INPUT_KEY_COBOL_CONTEXT, cobolContext, CobolContext.class); }
java
public static void setInputKeyCobolContext(Job job, Class<? extends CobolContext> cobolContext) { job.getConfiguration().setClass(CONF_INPUT_KEY_COBOL_CONTEXT, cobolContext, CobolContext.class); }
[ "public", "static", "void", "setInputKeyCobolContext", "(", "Job", "job", ",", "Class", "<", "?", "extends", "CobolContext", ">", "cobolContext", ")", "{", "job", ".", "getConfiguration", "(", ")", ".", "setClass", "(", "CONF_INPUT_KEY_COBOL_CONTEXT", ",", "cobo...
Sets the job input key mainframe COBOL parameters (including code page). @param job The job to configure. @param cobolContext The input key mainframe COBOL parameters.
[ "Sets", "the", "job", "input", "key", "mainframe", "COBOL", "parameters", "(", "including", "code", "page", ")", "." ]
train
https://github.com/legsem/legstar.avro/blob/bad5e0bf41700951eee1ad6a5d6d0c47b3da8f0b/legstar.avro.cob2avro.hadoop/src/main/java/com/legstar/avro/cob2avro/hadoop/mapreduce/Cob2AvroJob.java#L40-L42
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslpolicylabel_binding.java
sslpolicylabel_binding.get
public static sslpolicylabel_binding get(nitro_service service, String labelname) throws Exception{ sslpolicylabel_binding obj = new sslpolicylabel_binding(); obj.set_labelname(labelname); sslpolicylabel_binding response = (sslpolicylabel_binding) obj.get_resource(service); return response; }
java
public static sslpolicylabel_binding get(nitro_service service, String labelname) throws Exception{ sslpolicylabel_binding obj = new sslpolicylabel_binding(); obj.set_labelname(labelname); sslpolicylabel_binding response = (sslpolicylabel_binding) obj.get_resource(service); return response; }
[ "public", "static", "sslpolicylabel_binding", "get", "(", "nitro_service", "service", ",", "String", "labelname", ")", "throws", "Exception", "{", "sslpolicylabel_binding", "obj", "=", "new", "sslpolicylabel_binding", "(", ")", ";", "obj", ".", "set_labelname", "(",...
Use this API to fetch sslpolicylabel_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "sslpolicylabel_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslpolicylabel_binding.java#L103-L108
michael-rapp/AndroidUtil
library/src/main/java/de/mrapp/android/util/ThemeUtil.java
ThemeUtil.getColorStateList
public static ColorStateList getColorStateList(@NonNull final Context context, @AttrRes final int resourceId) { return getColorStateList(context, -1, resourceId); }
java
public static ColorStateList getColorStateList(@NonNull final Context context, @AttrRes final int resourceId) { return getColorStateList(context, -1, resourceId); }
[ "public", "static", "ColorStateList", "getColorStateList", "(", "@", "NonNull", "final", "Context", "context", ",", "@", "AttrRes", "final", "int", "resourceId", ")", "{", "return", "getColorStateList", "(", "context", ",", "-", "1", ",", "resourceId", ")", ";...
Obtains the color state list, which corresponds to a specific resource id, from a context's theme. If the given resource id is invalid, a {@link NotFoundException} will be thrown. @param context The context, which should be used, as an instance of the class {@link Context}. The context may not be null @param resourceId The resource id of the attribute, which should be obtained, as an {@link Integer} value. The resource id must corresponds to a valid theme attribute @return The color state list, which has been obtained, as an instance of the class {@link ColorStateList}
[ "Obtains", "the", "color", "state", "list", "which", "corresponds", "to", "a", "specific", "resource", "id", "from", "a", "context", "s", "theme", ".", "If", "the", "given", "resource", "id", "is", "invalid", "a", "{", "@link", "NotFoundException", "}", "w...
train
https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/ThemeUtil.java#L146-L149
openengsb/openengsb
components/edbi/hook/src/main/java/org/openengsb/framework/edbi/hook/internal/CommitConverter.java
CommitConverter.mapByClass
protected Map<Class<?>, List<OpenEngSBModel>> mapByClass(Collection<OpenEngSBModel> models) { return group(models, new Function<OpenEngSBModel, Class<?>>() { @Override public Class<?> apply(OpenEngSBModel input) { return input.getClass(); } }); }
java
protected Map<Class<?>, List<OpenEngSBModel>> mapByClass(Collection<OpenEngSBModel> models) { return group(models, new Function<OpenEngSBModel, Class<?>>() { @Override public Class<?> apply(OpenEngSBModel input) { return input.getClass(); } }); }
[ "protected", "Map", "<", "Class", "<", "?", ">", ",", "List", "<", "OpenEngSBModel", ">", ">", "mapByClass", "(", "Collection", "<", "OpenEngSBModel", ">", "models", ")", "{", "return", "group", "(", "models", ",", "new", "Function", "<", "OpenEngSBModel",...
Groups all models in the given collection by their class. @param models the models @return a map containing all given models grouped by their type
[ "Groups", "all", "models", "in", "the", "given", "collection", "by", "their", "class", "." ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/edbi/hook/src/main/java/org/openengsb/framework/edbi/hook/internal/CommitConverter.java#L94-L101
tvesalainen/util
rpm/src/main/java/org/vesalainen/pm/deb/DEBBuilder.java
DEBBuilder.addProvide
@Override public DEBBuilder addProvide(String name, String version, Condition... dependency) { control.addProvides(name); return this; }
java
@Override public DEBBuilder addProvide(String name, String version, Condition... dependency) { control.addProvides(name); return this; }
[ "@", "Override", "public", "DEBBuilder", "addProvide", "(", "String", "name", ",", "String", "version", ",", "Condition", "...", "dependency", ")", "{", "control", ".", "addProvides", "(", "name", ")", ";", "return", "this", ";", "}" ]
Add debian/control Provides field. @param name @param version Not used @param dependency Not used @return
[ "Add", "debian", "/", "control", "Provides", "field", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/rpm/src/main/java/org/vesalainen/pm/deb/DEBBuilder.java#L187-L192
h2oai/h2o-3
h2o-core/src/main/java/water/api/RequestServer.java
RequestServer.registerEndpoint
public static Route registerEndpoint( String api_name, String method_uri, Class<? extends Handler> handler_class, String handler_method, String summary ) { String[] spl = method_uri.split(" "); assert spl.length == 2 : "Unexpected method_uri parameter: " + method_uri; return registerEndpoint(api_name, spl[0], spl[1], handler_class, handler_method, summary, HandlerFactory.DEFAULT); }
java
public static Route registerEndpoint( String api_name, String method_uri, Class<? extends Handler> handler_class, String handler_method, String summary ) { String[] spl = method_uri.split(" "); assert spl.length == 2 : "Unexpected method_uri parameter: " + method_uri; return registerEndpoint(api_name, spl[0], spl[1], handler_class, handler_method, summary, HandlerFactory.DEFAULT); }
[ "public", "static", "Route", "registerEndpoint", "(", "String", "api_name", ",", "String", "method_uri", ",", "Class", "<", "?", "extends", "Handler", ">", "handler_class", ",", "String", "handler_method", ",", "String", "summary", ")", "{", "String", "[", "]"...
Register an HTTP request handler method for a given URL pattern, with parameters extracted from the URI. <p> URIs which match this pattern will have their parameters collected from the path and from the query params @param api_name suggested method name for this endpoint in the external API library. These names should be unique. If null, the api_name will be created from the class name and the handler method name. @param method_uri combined method / url pattern of the request, e.g.: "GET /3/Jobs/{job_id}" @param handler_class class which contains the handler method @param handler_method name of the handler method @param summary help string which explains the functionality of this endpoint @see Route @see water.api.RequestServer @return the Route for this request
[ "Register", "an", "HTTP", "request", "handler", "method", "for", "a", "given", "URL", "pattern", "with", "parameters", "extracted", "from", "the", "URI", ".", "<p", ">", "URIs", "which", "match", "this", "pattern", "will", "have", "their", "parameters", "col...
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/api/RequestServer.java#L189-L195
d-michail/jheaps
src/main/java/org/jheaps/tree/BinaryTreeSoftAddressableHeap.java
BinaryTreeSoftAddressableHeap.meld
@Override public void meld(MergeableAddressableHeap<K, V> other) { BinaryTreeSoftAddressableHeap<K, V> h = (BinaryTreeSoftAddressableHeap<K, V>) other; // check same comparator if (comparator != null) { if (h.comparator == null || !h.comparator.equals(comparator)) { throw new IllegalArgumentException("Cannot meld heaps using different comparators!"); } } else if (h.comparator != null) { throw new IllegalArgumentException("Cannot meld heaps using different comparators!"); } if (rankLimit != h.rankLimit) { throw new IllegalArgumentException("Cannot meld heaps with different error rates!"); } if (h.other != h) { throw new IllegalStateException("A heap cannot be used after a meld."); } // perform the meld mergeInto(h.rootList.head, h.rootList.tail); size += h.size; // clear other h.size = 0; h.rootList.head = null; h.rootList.tail = null; // take ownership h.other = this; }
java
@Override public void meld(MergeableAddressableHeap<K, V> other) { BinaryTreeSoftAddressableHeap<K, V> h = (BinaryTreeSoftAddressableHeap<K, V>) other; // check same comparator if (comparator != null) { if (h.comparator == null || !h.comparator.equals(comparator)) { throw new IllegalArgumentException("Cannot meld heaps using different comparators!"); } } else if (h.comparator != null) { throw new IllegalArgumentException("Cannot meld heaps using different comparators!"); } if (rankLimit != h.rankLimit) { throw new IllegalArgumentException("Cannot meld heaps with different error rates!"); } if (h.other != h) { throw new IllegalStateException("A heap cannot be used after a meld."); } // perform the meld mergeInto(h.rootList.head, h.rootList.tail); size += h.size; // clear other h.size = 0; h.rootList.head = null; h.rootList.tail = null; // take ownership h.other = this; }
[ "@", "Override", "public", "void", "meld", "(", "MergeableAddressableHeap", "<", "K", ",", "V", ">", "other", ")", "{", "BinaryTreeSoftAddressableHeap", "<", "K", ",", "V", ">", "h", "=", "(", "BinaryTreeSoftAddressableHeap", "<", "K", ",", "V", ">", ")", ...
{@inheritDoc} @throws IllegalArgumentException if {@code other} has a different error rate
[ "{", "@inheritDoc", "}" ]
train
https://github.com/d-michail/jheaps/blob/7146451dd6591c2a8559dc564c9c40428c4a2c10/src/main/java/org/jheaps/tree/BinaryTreeSoftAddressableHeap.java#L254-L286
groupe-sii/ogham
ogham-core/src/main/java/fr/sii/ogham/sms/message/Sms.java
Sms.to
public Sms to(String name, PhoneNumber number) { to(new Recipient(name, number)); return this; }
java
public Sms to(String name, PhoneNumber number) { to(new Recipient(name, number)); return this; }
[ "public", "Sms", "to", "(", "String", "name", ",", "PhoneNumber", "number", ")", "{", "to", "(", "new", "Recipient", "(", "name", ",", "number", ")", ")", ";", "return", "this", ";", "}" ]
Add a recipient specifying the name and the phone number. @param name the name of the recipient @param number the number of the recipient @return this instance for fluent chaining
[ "Add", "a", "recipient", "specifying", "the", "name", "and", "the", "phone", "number", "." ]
train
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/sms/message/Sms.java#L260-L263
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java
TextRowProtocol.getInternalTimeString
public String getInternalTimeString(ColumnInformation columnInfo) { if (lastValueWasNull()) { return null; } String rawValue = new String(buf, pos, length, StandardCharsets.UTF_8); if ("0000-00-00".equals(rawValue)) { return null; } if (options.maximizeMysqlCompatibility && options.useLegacyDatetimeCode && rawValue.indexOf(".") > 0) { return rawValue.substring(0, rawValue.indexOf(".")); } return rawValue; }
java
public String getInternalTimeString(ColumnInformation columnInfo) { if (lastValueWasNull()) { return null; } String rawValue = new String(buf, pos, length, StandardCharsets.UTF_8); if ("0000-00-00".equals(rawValue)) { return null; } if (options.maximizeMysqlCompatibility && options.useLegacyDatetimeCode && rawValue.indexOf(".") > 0) { return rawValue.substring(0, rawValue.indexOf(".")); } return rawValue; }
[ "public", "String", "getInternalTimeString", "(", "ColumnInformation", "columnInfo", ")", "{", "if", "(", "lastValueWasNull", "(", ")", ")", "{", "return", "null", ";", "}", "String", "rawValue", "=", "new", "String", "(", "buf", ",", "pos", ",", "length", ...
Get Time in string format from raw text format. @param columnInfo column information @return String representation of time
[ "Get", "Time", "in", "string", "format", "from", "raw", "text", "format", "." ]
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java#L847-L862
spotify/apollo
modules/metrics/src/main/java/com/spotify/apollo/metrics/semantic/SemanticServiceMetrics.java
SemanticServiceMetrics.requestDurationThresholdTracker
private Optional<DurationThresholdTracker> requestDurationThresholdTracker(MetricId id, String endpoint) { return durationThresholdConfig.getDurationThresholdForEndpoint(endpoint) .map(threshold -> Optional.of(new DurationThresholdTracker(id, metricRegistry, threshold))) .orElse(Optional.empty()); }
java
private Optional<DurationThresholdTracker> requestDurationThresholdTracker(MetricId id, String endpoint) { return durationThresholdConfig.getDurationThresholdForEndpoint(endpoint) .map(threshold -> Optional.of(new DurationThresholdTracker(id, metricRegistry, threshold))) .orElse(Optional.empty()); }
[ "private", "Optional", "<", "DurationThresholdTracker", ">", "requestDurationThresholdTracker", "(", "MetricId", "id", ",", "String", "endpoint", ")", "{", "return", "durationThresholdConfig", ".", "getDurationThresholdForEndpoint", "(", "endpoint", ")", ".", "map", "("...
Checks for endpoint-duration-goal configuration options and sets up metrics that track how many requests meet a certain duration threshold goal. @param endpoint formatted as METHOD:URI
[ "Checks", "for", "endpoint", "-", "duration", "-", "goal", "configuration", "options", "and", "sets", "up", "metrics", "that", "track", "how", "many", "requests", "meet", "a", "certain", "duration", "threshold", "goal", "." ]
train
https://github.com/spotify/apollo/blob/3aba09840538a2aff9cdac5be42cc114dd276c70/modules/metrics/src/main/java/com/spotify/apollo/metrics/semantic/SemanticServiceMetrics.java#L205-L210
alkacon/opencms-core
src-modules/org/opencms/workplace/tools/content/CmsPropertyChange.java
CmsPropertyChange.actionChange
public void actionChange() throws JspException { // save initialized instance of this class in request attribute for included sub-elements getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS, this); try { boolean recursive = Boolean.valueOf(getParamRecursive()).booleanValue(); if (performChangeOperation(recursive)) { // if no exception is caused and "true" is returned change property operation was successful setAction(ACTION_SHOWRESULT); } else { // "false" returned, display "please wait" screen getJsp().include(FILE_DIALOG_SCREEN_WAIT); } } catch (Throwable e) { // error while changing property values, show error dialog includeErrorpage(this, e); } }
java
public void actionChange() throws JspException { // save initialized instance of this class in request attribute for included sub-elements getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS, this); try { boolean recursive = Boolean.valueOf(getParamRecursive()).booleanValue(); if (performChangeOperation(recursive)) { // if no exception is caused and "true" is returned change property operation was successful setAction(ACTION_SHOWRESULT); } else { // "false" returned, display "please wait" screen getJsp().include(FILE_DIALOG_SCREEN_WAIT); } } catch (Throwable e) { // error while changing property values, show error dialog includeErrorpage(this, e); } }
[ "public", "void", "actionChange", "(", ")", "throws", "JspException", "{", "// save initialized instance of this class in request attribute for included sub-elements", "getJsp", "(", ")", ".", "getRequest", "(", ")", ".", "setAttribute", "(", "SESSION_WORKPLACE_CLASS", ",", ...
Changes the property values on the specified resources.<p> @throws JspException if problems including sub-elements occur
[ "Changes", "the", "property", "values", "on", "the", "specified", "resources", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/content/CmsPropertyChange.java#L172-L190
alipay/sofa-rpc
core-impl/client/src/main/java/com/alipay/sofa/rpc/client/AllConnectConnectionHolder.java
AllConnectConnectionHolder.printDead
protected void printDead(String interfaceId, ProviderInfo providerInfo, ClientTransport transport, Exception e) { Throwable cause = e.getCause(); if (LOGGER.isWarnEnabled(consumerConfig.getAppName())) { LOGGER.warnWithApp(consumerConfig.getAppName(), "Connect to {} provider:{} failure !! The exception is " + ExceptionUtils.toShortString(e, 1) + (cause != null ? ", cause by " + cause.getMessage() + "." : "."), interfaceId, providerInfo); } }
java
protected void printDead(String interfaceId, ProviderInfo providerInfo, ClientTransport transport, Exception e) { Throwable cause = e.getCause(); if (LOGGER.isWarnEnabled(consumerConfig.getAppName())) { LOGGER.warnWithApp(consumerConfig.getAppName(), "Connect to {} provider:{} failure !! The exception is " + ExceptionUtils.toShortString(e, 1) + (cause != null ? ", cause by " + cause.getMessage() + "." : "."), interfaceId, providerInfo); } }
[ "protected", "void", "printDead", "(", "String", "interfaceId", ",", "ProviderInfo", "providerInfo", ",", "ClientTransport", "transport", ",", "Exception", "e", ")", "{", "Throwable", "cause", "=", "e", ".", "getCause", "(", ")", ";", "if", "(", "LOGGER", "....
打印连不上日志 @param interfaceId 接口名称 @param providerInfo 服务端 @param transport 连接 @param e 错误
[ "打印连不上日志" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core-impl/client/src/main/java/com/alipay/sofa/rpc/client/AllConnectConnectionHolder.java#L726-L734
JavaMoney/jsr354-ri-bp
src/main/java/org/javamoney/moneta/spi/base/BaseExchangeRateProvider.java
BaseExchangeRateProvider.getExchangeRate
public ExchangeRate getExchangeRate(CurrencyUnit base, CurrencyUnit term){ Objects.requireNonNull(base, "Base Currency is null"); Objects.requireNonNull(term, "Term Currency is null"); return getExchangeRate(ConversionQueryBuilder.of().setBaseCurrency(base).setTermCurrency(term).build()); }
java
public ExchangeRate getExchangeRate(CurrencyUnit base, CurrencyUnit term){ Objects.requireNonNull(base, "Base Currency is null"); Objects.requireNonNull(term, "Term Currency is null"); return getExchangeRate(ConversionQueryBuilder.of().setBaseCurrency(base).setTermCurrency(term).build()); }
[ "public", "ExchangeRate", "getExchangeRate", "(", "CurrencyUnit", "base", ",", "CurrencyUnit", "term", ")", "{", "Objects", ".", "requireNonNull", "(", "base", ",", "\"Base Currency is null\"", ")", ";", "Objects", ".", "requireNonNull", "(", "term", ",", "\"Term ...
Access a {@link javax.money.convert.ExchangeRate} using the given currencies. The {@link javax.money.convert.ExchangeRate} may be, depending on the data provider, eal-time or deferred. This method should return the rate that is <i>currently</i> valid. @param base base {@link javax.money.CurrencyUnit}, not {@code null} @param term term {@link javax.money.CurrencyUnit}, not {@code null} @throws javax.money.convert.CurrencyConversionException If no such rate is available.
[ "Access", "a", "{", "@link", "javax", ".", "money", ".", "convert", ".", "ExchangeRate", "}", "using", "the", "given", "currencies", ".", "The", "{", "@link", "javax", ".", "money", ".", "convert", ".", "ExchangeRate", "}", "may", "be", "depending", "on"...
train
https://github.com/JavaMoney/jsr354-ri-bp/blob/9c147ef5623d8032a6dc4c0e5eefdfb41641a9a2/src/main/java/org/javamoney/moneta/spi/base/BaseExchangeRateProvider.java#L78-L82
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/Neighbour.java
Neighbour.addSubscription
protected void addSubscription(SIBUuid12 topicSpace, String topic, MESubscription subscription) { // Generate a key for the topicSpace/topic final String key = BusGroup.subscriptionKey(topicSpace, topic); iProxies.put(key, subscription); }
java
protected void addSubscription(SIBUuid12 topicSpace, String topic, MESubscription subscription) { // Generate a key for the topicSpace/topic final String key = BusGroup.subscriptionKey(topicSpace, topic); iProxies.put(key, subscription); }
[ "protected", "void", "addSubscription", "(", "SIBUuid12", "topicSpace", ",", "String", "topic", ",", "MESubscription", "subscription", ")", "{", "// Generate a key for the topicSpace/topic", "final", "String", "key", "=", "BusGroup", ".", "subscriptionKey", "(", "topicS...
Adds the rolled back subscription to the list. @param topicSpace @param topic
[ "Adds", "the", "rolled", "back", "subscription", "to", "the", "list", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/Neighbour.java#L683-L689
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java
BoxAuthentication.onAuthenticated
public void onAuthenticated(BoxAuthenticationInfo infoOriginal, Context context) { BoxAuthenticationInfo info = BoxAuthenticationInfo.unmodifiableObject(infoOriginal); if (!SdkUtils.isBlank(info.accessToken()) && (info.getUser() == null || SdkUtils.isBlank(info.getUser().getId()))){ // insufficient information so we need to fetch the user info first. doUserRefresh(context, info); return; } getAuthInfoMap(context).put(info.getUser().getId(), info.clone()); authStorage.storeLastAuthenticatedUserId(info.getUser().getId(), context); authStorage.storeAuthInfoMap(mCurrentAccessInfo, context); // if accessToken has not already been refreshed, issue refresh request and cache result Set<AuthListener> listeners = getListeners(); for (AuthListener listener : listeners) { listener.onAuthCreated(info); } }
java
public void onAuthenticated(BoxAuthenticationInfo infoOriginal, Context context) { BoxAuthenticationInfo info = BoxAuthenticationInfo.unmodifiableObject(infoOriginal); if (!SdkUtils.isBlank(info.accessToken()) && (info.getUser() == null || SdkUtils.isBlank(info.getUser().getId()))){ // insufficient information so we need to fetch the user info first. doUserRefresh(context, info); return; } getAuthInfoMap(context).put(info.getUser().getId(), info.clone()); authStorage.storeLastAuthenticatedUserId(info.getUser().getId(), context); authStorage.storeAuthInfoMap(mCurrentAccessInfo, context); // if accessToken has not already been refreshed, issue refresh request and cache result Set<AuthListener> listeners = getListeners(); for (AuthListener listener : listeners) { listener.onAuthCreated(info); } }
[ "public", "void", "onAuthenticated", "(", "BoxAuthenticationInfo", "infoOriginal", ",", "Context", "context", ")", "{", "BoxAuthenticationInfo", "info", "=", "BoxAuthenticationInfo", ".", "unmodifiableObject", "(", "infoOriginal", ")", ";", "if", "(", "!", "SdkUtils",...
Callback method to be called when authentication process finishes. @param infoOriginal the authentication information that successfully authenticated. @param context the current application context (that can be used to launch ui or access resources).
[ "Callback", "method", "to", "be", "called", "when", "authentication", "process", "finishes", "." ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java#L158-L173
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/util/ZooKeeperUtils.java
ZooKeeperUtils.createLeaderElectionService
public static ZooKeeperLeaderElectionService createLeaderElectionService( CuratorFramework client, Configuration configuration) throws Exception { return createLeaderElectionService(client, configuration, ""); }
java
public static ZooKeeperLeaderElectionService createLeaderElectionService( CuratorFramework client, Configuration configuration) throws Exception { return createLeaderElectionService(client, configuration, ""); }
[ "public", "static", "ZooKeeperLeaderElectionService", "createLeaderElectionService", "(", "CuratorFramework", "client", ",", "Configuration", "configuration", ")", "throws", "Exception", "{", "return", "createLeaderElectionService", "(", "client", ",", "configuration", ",", ...
Creates a {@link ZooKeeperLeaderElectionService} instance. @param client The {@link CuratorFramework} ZooKeeper client to use @param configuration {@link Configuration} object containing the configuration values @return {@link ZooKeeperLeaderElectionService} instance.
[ "Creates", "a", "{", "@link", "ZooKeeperLeaderElectionService", "}", "instance", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/util/ZooKeeperUtils.java#L202-L207
lucee/Lucee
core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java
ResourceUtil.toResourceNotExisting
public static Resource toResourceNotExisting(PageContext pc, String destination) { return toResourceNotExisting(pc, destination, pc.getConfig().allowRealPath(), false); }
java
public static Resource toResourceNotExisting(PageContext pc, String destination) { return toResourceNotExisting(pc, destination, pc.getConfig().allowRealPath(), false); }
[ "public", "static", "Resource", "toResourceNotExisting", "(", "PageContext", "pc", ",", "String", "destination", ")", "{", "return", "toResourceNotExisting", "(", "pc", ",", "destination", ",", "pc", ".", "getConfig", "(", ")", ".", "allowRealPath", "(", ")", ...
cast a String (argument destination) to a File Object, if destination is not a absolute, file object will be relative to current position (get from PageContext) existing file is preferred but dont must exist @param pc Page Context to the current position in filesystem @param destination relative or absolute path for file object @return file object from destination
[ "cast", "a", "String", "(", "argument", "destination", ")", "to", "a", "File", "Object", "if", "destination", "is", "not", "a", "absolute", "file", "object", "will", "be", "relative", "to", "current", "position", "(", "get", "from", "PageContext", ")", "ex...
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java#L313-L315
DiUS/pact-jvm
pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslJsonArray.java
LambdaDslJsonArray.minArrayLike
public LambdaDslJsonArray minArrayLike(Integer size, Consumer<LambdaDslJsonBody> nestedObject) { final PactDslJsonBody arrayLike = pactArray.minArrayLike(size); final LambdaDslJsonBody dslBody = new LambdaDslJsonBody(arrayLike); nestedObject.accept(dslBody); arrayLike.closeArray(); return this; }
java
public LambdaDslJsonArray minArrayLike(Integer size, Consumer<LambdaDslJsonBody> nestedObject) { final PactDslJsonBody arrayLike = pactArray.minArrayLike(size); final LambdaDslJsonBody dslBody = new LambdaDslJsonBody(arrayLike); nestedObject.accept(dslBody); arrayLike.closeArray(); return this; }
[ "public", "LambdaDslJsonArray", "minArrayLike", "(", "Integer", "size", ",", "Consumer", "<", "LambdaDslJsonBody", ">", "nestedObject", ")", "{", "final", "PactDslJsonBody", "arrayLike", "=", "pactArray", ".", "minArrayLike", "(", "size", ")", ";", "final", "Lambd...
Element that is an array with a minimum size where each item must match the following example @param size minimum size of the array
[ "Element", "that", "is", "an", "array", "with", "a", "minimum", "size", "where", "each", "item", "must", "match", "the", "following", "example" ]
train
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslJsonArray.java#L313-L319
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/hostchooser/GlobalHostStatusTracker.java
GlobalHostStatusTracker.reportHostStatus
public static void reportHostStatus(HostSpec hostSpec, HostStatus hostStatus) { long now = currentTimeMillis(); synchronized (hostStatusMap) { HostSpecStatus hostSpecStatus = hostStatusMap.get(hostSpec); if (hostSpecStatus == null) { hostSpecStatus = new HostSpecStatus(hostSpec); hostStatusMap.put(hostSpec, hostSpecStatus); } hostSpecStatus.status = hostStatus; hostSpecStatus.lastUpdated = now; } }
java
public static void reportHostStatus(HostSpec hostSpec, HostStatus hostStatus) { long now = currentTimeMillis(); synchronized (hostStatusMap) { HostSpecStatus hostSpecStatus = hostStatusMap.get(hostSpec); if (hostSpecStatus == null) { hostSpecStatus = new HostSpecStatus(hostSpec); hostStatusMap.put(hostSpec, hostSpecStatus); } hostSpecStatus.status = hostStatus; hostSpecStatus.lastUpdated = now; } }
[ "public", "static", "void", "reportHostStatus", "(", "HostSpec", "hostSpec", ",", "HostStatus", "hostStatus", ")", "{", "long", "now", "=", "currentTimeMillis", "(", ")", ";", "synchronized", "(", "hostStatusMap", ")", "{", "HostSpecStatus", "hostSpecStatus", "=",...
Store the actual observed host status. @param hostSpec The host whose status is known. @param hostStatus Latest known status for the host.
[ "Store", "the", "actual", "observed", "host", "status", "." ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/hostchooser/GlobalHostStatusTracker.java#L30-L41
TheHortonMachine/hortonmachine
dbs/src/main/java/jsqlite/Database.java
Database.open_blob
public Blob open_blob( String db, String table, String column, long row, boolean rw ) throws jsqlite.Exception { synchronized (this) { Blob blob = new Blob(); _open_blob(db, table, column, row, rw, blob); return blob; } }
java
public Blob open_blob( String db, String table, String column, long row, boolean rw ) throws jsqlite.Exception { synchronized (this) { Blob blob = new Blob(); _open_blob(db, table, column, row, rw, blob); return blob; } }
[ "public", "Blob", "open_blob", "(", "String", "db", ",", "String", "table", ",", "String", "column", ",", "long", "row", ",", "boolean", "rw", ")", "throws", "jsqlite", ".", "Exception", "{", "synchronized", "(", "this", ")", "{", "Blob", "blob", "=", ...
Open an SQLite3 blob. Only available in SQLite 3.4.0 and above. @param db database name @param table table name @param column column name @param row row identifier @param rw if true, open for read-write, else read-only @return a Blob object
[ "Open", "an", "SQLite3", "blob", ".", "Only", "available", "in", "SQLite", "3", ".", "4", ".", "0", "and", "above", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/dbs/src/main/java/jsqlite/Database.java#L730-L736
jsonld-java/jsonld-java
core/src/main/java/com/github/jsonldjava/utils/JsonUtils.java
JsonUtils.fromInputStream
public static Object fromInputStream(InputStream input) throws IOException { // filter BOMs from InputStream try (final BOMInputStream bOMInputStream = new BOMInputStream(input, false, ByteOrderMark.UTF_8, ByteOrderMark.UTF_16BE, ByteOrderMark.UTF_16LE, ByteOrderMark.UTF_32BE, ByteOrderMark.UTF_32LE);) { Charset charset = StandardCharsets.UTF_8; // Attempt to use the BOM if it exists if (bOMInputStream.hasBOM()) { try { charset = Charset.forName(bOMInputStream.getBOMCharsetName()); } catch (final IllegalArgumentException e) { // If there are any issues with the BOM charset, attempt to // parse with UTF_8 charset = StandardCharsets.UTF_8; } } return fromInputStream(bOMInputStream, charset); } }
java
public static Object fromInputStream(InputStream input) throws IOException { // filter BOMs from InputStream try (final BOMInputStream bOMInputStream = new BOMInputStream(input, false, ByteOrderMark.UTF_8, ByteOrderMark.UTF_16BE, ByteOrderMark.UTF_16LE, ByteOrderMark.UTF_32BE, ByteOrderMark.UTF_32LE);) { Charset charset = StandardCharsets.UTF_8; // Attempt to use the BOM if it exists if (bOMInputStream.hasBOM()) { try { charset = Charset.forName(bOMInputStream.getBOMCharsetName()); } catch (final IllegalArgumentException e) { // If there are any issues with the BOM charset, attempt to // parse with UTF_8 charset = StandardCharsets.UTF_8; } } return fromInputStream(bOMInputStream, charset); } }
[ "public", "static", "Object", "fromInputStream", "(", "InputStream", "input", ")", "throws", "IOException", "{", "// filter BOMs from InputStream", "try", "(", "final", "BOMInputStream", "bOMInputStream", "=", "new", "BOMInputStream", "(", "input", ",", "false", ",", ...
Parses a JSON-LD document from the given {@link InputStream} to an object that can be used as input for the {@link JsonLdApi} and {@link JsonLdProcessor} methods.<br> Uses UTF-8 as the character encoding when decoding the InputStream. @param input The JSON-LD document in an InputStream. @return A JSON Object. @throws JsonParseException If there was a JSON related error during parsing. @throws IOException If there was an IO error during parsing.
[ "Parses", "a", "JSON", "-", "LD", "document", "from", "the", "given", "{", "@link", "InputStream", "}", "to", "an", "object", "that", "can", "be", "used", "as", "input", "for", "the", "{", "@link", "JsonLdApi", "}", "and", "{", "@link", "JsonLdProcessor"...
train
https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/utils/JsonUtils.java#L95-L113
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedceph/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedceph.java
ApiOvhDedicatedceph.serviceName_acl_POST
public String serviceName_acl_POST(String serviceName, String[] aclList) throws IOException { String qPath = "/dedicated/ceph/{serviceName}/acl"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "aclList", aclList); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, String.class); }
java
public String serviceName_acl_POST(String serviceName, String[] aclList) throws IOException { String qPath = "/dedicated/ceph/{serviceName}/acl"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "aclList", aclList); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, String.class); }
[ "public", "String", "serviceName_acl_POST", "(", "String", "serviceName", ",", "String", "[", "]", "aclList", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/ceph/{serviceName}/acl\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ...
Create one or more new IP ACLs REST: POST /dedicated/ceph/{serviceName}/acl @param serviceName [required] ID of cluster @param aclList [required] List of new ACLs API beta
[ "Create", "one", "or", "more", "new", "IP", "ACLs" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedceph/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedceph.java#L467-L474
OpenLiberty/open-liberty
dev/com.ibm.ws.security.javaeesec.cdi/src/com/ibm/ws/security/javaeesec/cdi/beans/hash/Pbkdf2PasswordHashImpl.java
Pbkdf2PasswordHashImpl.parseParams
protected void parseParams(Map<String, String> params) { generateAlgorithm = indexOf(PARAM_ALGORITHM, DEFAULT_ALGORITHM, SUPPORTED_ALGORITHMS, params.get(PARAM_ALGORITHM)); generateIterations = parseInt(PARAM_ITERATIONS, params.get(PARAM_ITERATIONS), DEFAULT_ITERATIONS, MINIMUM_ITERATIONS); generateSaltSize = parseInt(PARAM_SALTSIZE, params.get(PARAM_SALTSIZE), DEFAULT_SALTSIZE, MINIMUM_SALTSIZE); generateKeySize = parseInt(PARAM_KEYSIZE, params.get(PARAM_KEYSIZE), DEFAULT_KEYSIZE, MINIMUM_KEYSIZE); }
java
protected void parseParams(Map<String, String> params) { generateAlgorithm = indexOf(PARAM_ALGORITHM, DEFAULT_ALGORITHM, SUPPORTED_ALGORITHMS, params.get(PARAM_ALGORITHM)); generateIterations = parseInt(PARAM_ITERATIONS, params.get(PARAM_ITERATIONS), DEFAULT_ITERATIONS, MINIMUM_ITERATIONS); generateSaltSize = parseInt(PARAM_SALTSIZE, params.get(PARAM_SALTSIZE), DEFAULT_SALTSIZE, MINIMUM_SALTSIZE); generateKeySize = parseInt(PARAM_KEYSIZE, params.get(PARAM_KEYSIZE), DEFAULT_KEYSIZE, MINIMUM_KEYSIZE); }
[ "protected", "void", "parseParams", "(", "Map", "<", "String", ",", "String", ">", "params", ")", "{", "generateAlgorithm", "=", "indexOf", "(", "PARAM_ALGORITHM", ",", "DEFAULT_ALGORITHM", ",", "SUPPORTED_ALGORITHMS", ",", "params", ".", "get", "(", "PARAM_ALGO...
Parse the parameters. If the value is not set, set the default, if the value is invalid, throw InvalidArgumentException
[ "Parse", "the", "parameters", ".", "If", "the", "value", "is", "not", "set", "set", "the", "default", "if", "the", "value", "is", "invalid", "throw", "InvalidArgumentException" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.javaeesec.cdi/src/com/ibm/ws/security/javaeesec/cdi/beans/hash/Pbkdf2PasswordHashImpl.java#L151-L156
EdwardRaff/JSAT
JSAT/src/jsat/utils/concurrent/AtomicDoubleArray.java
AtomicDoubleArray.compareAndSet
public boolean compareAndSet(int i, double expected, double update) { long expectedL = Double.doubleToRawLongBits(expected); long updateL = Double.doubleToRawLongBits(update); return larray.compareAndSet(i, expectedL, updateL); }
java
public boolean compareAndSet(int i, double expected, double update) { long expectedL = Double.doubleToRawLongBits(expected); long updateL = Double.doubleToRawLongBits(update); return larray.compareAndSet(i, expectedL, updateL); }
[ "public", "boolean", "compareAndSet", "(", "int", "i", ",", "double", "expected", ",", "double", "update", ")", "{", "long", "expectedL", "=", "Double", ".", "doubleToRawLongBits", "(", "expected", ")", ";", "long", "updateL", "=", "Double", ".", "doubleToRa...
Atomically sets the element at position {@code i} to the given updated value if the current value {@code ==} the expected value. @param i the index @param expected the expected value @param update the new value @return true if successful. False return indicates that the actual value was not equal to the expected value.
[ "Atomically", "sets", "the", "element", "at", "position", "{", "@code", "i", "}", "to", "the", "given", "updated", "value", "if", "the", "current", "value", "{", "@code", "==", "}", "the", "expected", "value", "." ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/concurrent/AtomicDoubleArray.java#L151-L156
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/cluster/RedisAdvancedClusterAsyncCommandsImpl.java
RedisAdvancedClusterAsyncCommandsImpl.executeOnMasters
protected <T> Map<String, CompletableFuture<T>> executeOnMasters( Function<RedisClusterAsyncCommands<K, V>, RedisFuture<T>> function) { return executeOnNodes(function, redisClusterNode -> redisClusterNode.is(MASTER)); }
java
protected <T> Map<String, CompletableFuture<T>> executeOnMasters( Function<RedisClusterAsyncCommands<K, V>, RedisFuture<T>> function) { return executeOnNodes(function, redisClusterNode -> redisClusterNode.is(MASTER)); }
[ "protected", "<", "T", ">", "Map", "<", "String", ",", "CompletableFuture", "<", "T", ">", ">", "executeOnMasters", "(", "Function", "<", "RedisClusterAsyncCommands", "<", "K", ",", "V", ">", ",", "RedisFuture", "<", "T", ">", ">", "function", ")", "{", ...
Run a command on all available masters, @param function function producing the command @param <T> result type @return map of a key (counter) and commands.
[ "Run", "a", "command", "on", "all", "available", "masters" ]
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/cluster/RedisAdvancedClusterAsyncCommandsImpl.java#L601-L604
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ZoneMeta.java
ZoneMeta.openOlsonResource
public static UResourceBundle openOlsonResource(UResourceBundle top, String id) { UResourceBundle res = null; int zoneIdx = getZoneIndex(id); if (zoneIdx >= 0) { try { if (top == null) { top = UResourceBundle.getBundleInstance( ICUData.ICU_BASE_NAME, ZONEINFORESNAME, ICUResourceBundle.ICU_DATA_CLASS_LOADER); } UResourceBundle zones = top.get(kZONES); UResourceBundle zone = zones.get(zoneIdx); if (zone.getType() == UResourceBundle.INT) { // resolve link zone = zones.get(zone.getInt()); } res = zone; } catch (MissingResourceException e) { res = null; } } return res; }
java
public static UResourceBundle openOlsonResource(UResourceBundle top, String id) { UResourceBundle res = null; int zoneIdx = getZoneIndex(id); if (zoneIdx >= 0) { try { if (top == null) { top = UResourceBundle.getBundleInstance( ICUData.ICU_BASE_NAME, ZONEINFORESNAME, ICUResourceBundle.ICU_DATA_CLASS_LOADER); } UResourceBundle zones = top.get(kZONES); UResourceBundle zone = zones.get(zoneIdx); if (zone.getType() == UResourceBundle.INT) { // resolve link zone = zones.get(zone.getInt()); } res = zone; } catch (MissingResourceException e) { res = null; } } return res; }
[ "public", "static", "UResourceBundle", "openOlsonResource", "(", "UResourceBundle", "top", ",", "String", "id", ")", "{", "UResourceBundle", "res", "=", "null", ";", "int", "zoneIdx", "=", "getZoneIndex", "(", "id", ")", ";", "if", "(", "zoneIdx", ">=", "0",...
Given an ID and the top-level resource of the zoneinfo resource, open the appropriate resource for the given time zone. Dereference links if necessary. @param top the top level resource of the zoneinfo resource or null. @param id zone id @return the corresponding zone resource or null if not found
[ "Given", "an", "ID", "and", "the", "top", "-", "level", "resource", "of", "the", "zoneinfo", "resource", "open", "the", "appropriate", "resource", "for", "the", "given", "time", "zone", ".", "Dereference", "links", "if", "necessary", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ZoneMeta.java#L520-L542
tango-controls/JTango
server/src/main/java/org/tango/server/servant/DeviceImpl.java
DeviceImpl.set_attribute_config_4
@Override public void set_attribute_config_4(final AttributeConfig_3[] newConf, final ClntIdent clIdent) throws DevFailed { MDC.setContextMap(contextMap); xlogger.entry(); checkInitialization(); clientIdentity.set(clIdent); if (!name.equalsIgnoreCase(getAdminDeviceName())) { clientLocking.checkClientLocking(clIdent); } deviceMonitoring.startRequest("set_attribute_config_4", clIdent); set_attribute_config_3(newConf); xlogger.exit(); }
java
@Override public void set_attribute_config_4(final AttributeConfig_3[] newConf, final ClntIdent clIdent) throws DevFailed { MDC.setContextMap(contextMap); xlogger.entry(); checkInitialization(); clientIdentity.set(clIdent); if (!name.equalsIgnoreCase(getAdminDeviceName())) { clientLocking.checkClientLocking(clIdent); } deviceMonitoring.startRequest("set_attribute_config_4", clIdent); set_attribute_config_3(newConf); xlogger.exit(); }
[ "@", "Override", "public", "void", "set_attribute_config_4", "(", "final", "AttributeConfig_3", "[", "]", "newConf", ",", "final", "ClntIdent", "clIdent", ")", "throws", "DevFailed", "{", "MDC", ".", "setContextMap", "(", "contextMap", ")", ";", "xlogger", ".", ...
Set some attribute configs. IDL4 version @param newConf the new configurations @param clIdent client id @throws DevFailed
[ "Set", "some", "attribute", "configs", ".", "IDL4", "version" ]
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/servant/DeviceImpl.java#L2036-L2049
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java
BogusExceptionDeclaration.isAnonymousInnerCtor
private static boolean isAnonymousInnerCtor(Method m, JavaClass cls) { return Values.CONSTRUCTOR.equals(m.getName()) && (cls.getClassName().lastIndexOf(Values.INNER_CLASS_SEPARATOR) >= 0); }
java
private static boolean isAnonymousInnerCtor(Method m, JavaClass cls) { return Values.CONSTRUCTOR.equals(m.getName()) && (cls.getClassName().lastIndexOf(Values.INNER_CLASS_SEPARATOR) >= 0); }
[ "private", "static", "boolean", "isAnonymousInnerCtor", "(", "Method", "m", ",", "JavaClass", "cls", ")", "{", "return", "Values", ".", "CONSTRUCTOR", ".", "equals", "(", "m", ".", "getName", "(", ")", ")", "&&", "(", "cls", ".", "getClassName", "(", ")"...
checks to see if this method is a constructor of an instance based inner class, the handling of the Exception table for this method is odd, -- doesn't seem correct, in some cases. So just ignore these cases @param m the method to check @param cls the cls that owns the method @return whether this method is a ctor of an instance based anonymous inner class
[ "checks", "to", "see", "if", "this", "method", "is", "a", "constructor", "of", "an", "instance", "based", "inner", "class", "the", "handling", "of", "the", "Exception", "table", "for", "this", "method", "is", "odd", "--", "doesn", "t", "seem", "correct", ...
train
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java#L197-L199
fabric8io/docker-maven-plugin
src/main/java/io/fabric8/maven/docker/service/BuildService.java
BuildService.buildImage
public void buildImage(ImageConfiguration imageConfig, ImagePullManager imagePullManager, BuildContext buildContext) throws DockerAccessException, MojoExecutionException { if (imagePullManager != null) { autoPullBaseImage(imageConfig, imagePullManager, buildContext); } buildImage(imageConfig, buildContext.getMojoParameters(), checkForNocache(imageConfig), addBuildArgs(buildContext)); }
java
public void buildImage(ImageConfiguration imageConfig, ImagePullManager imagePullManager, BuildContext buildContext) throws DockerAccessException, MojoExecutionException { if (imagePullManager != null) { autoPullBaseImage(imageConfig, imagePullManager, buildContext); } buildImage(imageConfig, buildContext.getMojoParameters(), checkForNocache(imageConfig), addBuildArgs(buildContext)); }
[ "public", "void", "buildImage", "(", "ImageConfiguration", "imageConfig", ",", "ImagePullManager", "imagePullManager", ",", "BuildContext", "buildContext", ")", "throws", "DockerAccessException", ",", "MojoExecutionException", "{", "if", "(", "imagePullManager", "!=", "nu...
Pull the base image if needed and run the build. @param imageConfig the image configuration @param buildContext the build context @throws DockerAccessException @throws MojoExecutionException
[ "Pull", "the", "base", "image", "if", "needed", "and", "run", "the", "build", "." ]
train
https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/service/BuildService.java#L63-L71
liyiorg/weixin-popular
src/main/java/weixin/popular/api/BizwifiAPI.java
BizwifiAPI.couponputSet
public static BaseResult couponputSet(String accessToken, CouponputSet couponputSet) { return couponputSet(accessToken, JsonUtil.toJSONString(couponputSet)); }
java
public static BaseResult couponputSet(String accessToken, CouponputSet couponputSet) { return couponputSet(accessToken, JsonUtil.toJSONString(couponputSet)); }
[ "public", "static", "BaseResult", "couponputSet", "(", "String", "accessToken", ",", "CouponputSet", "couponputSet", ")", "{", "return", "couponputSet", "(", "accessToken", ",", "JsonUtil", ".", "toJSONString", "(", "couponputSet", ")", ")", ";", "}" ]
卡券投放-设置门店卡券投放信息 调用设置门店卡劵投放信息接口后,用户可在连网流程中关注商家公众号之后,领取配置的卡券。需设置卡劵ID,投放的有效时间等。 @param accessToken accessToken @param couponputSet couponputSet @return BaseResult
[ "卡券投放", "-", "设置门店卡券投放信息", "调用设置门店卡劵投放信息接口后,用户可在连网流程中关注商家公众号之后,领取配置的卡券。需设置卡劵ID,投放的有效时间等。" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/BizwifiAPI.java#L542-L544
DV8FromTheWorld/JDA
src/main/java/net/dv8tion/jda/core/requests/restaction/pagination/PaginationAction.java
PaginationAction.takeAsync
public RequestFuture<List<T>> takeAsync(int amount) { return takeAsync0(amount, (task, list) -> forEachAsync(val -> { list.add(val); return list.size() < amount; }, task::completeExceptionally)); }
java
public RequestFuture<List<T>> takeAsync(int amount) { return takeAsync0(amount, (task, list) -> forEachAsync(val -> { list.add(val); return list.size() < amount; }, task::completeExceptionally)); }
[ "public", "RequestFuture", "<", "List", "<", "T", ">", ">", "takeAsync", "(", "int", "amount", ")", "{", "return", "takeAsync0", "(", "amount", ",", "(", "task", ",", "list", ")", "->", "forEachAsync", "(", "val", "->", "{", "list", ".", "add", "(", ...
Convenience method to retrieve an amount of entities from this pagination action. <br>This also includes already cached entities similar to {@link #forEachAsync(Procedure)}. @param amount The maximum amount to retrieve @return {@link net.dv8tion.jda.core.requests.RequestFuture RequestFuture} - Type: {@link java.util.List List} @see #forEachAsync(Procedure)
[ "Convenience", "method", "to", "retrieve", "an", "amount", "of", "entities", "from", "this", "pagination", "action", ".", "<br", ">", "This", "also", "includes", "already", "cached", "entities", "similar", "to", "{", "@link", "#forEachAsync", "(", "Procedure", ...
train
https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/requests/restaction/pagination/PaginationAction.java#L329-L335
ModeShape/modeshape
index-providers/modeshape-elasticsearch-index-provider/src/main/java/org/modeshape/jcr/index/elasticsearch/client/EsClient.java
EsClient.storeDocument
public boolean storeDocument(String name, String type, String id, EsRequest doc) throws IOException { CloseableHttpClient client = HttpClients.createDefault(); HttpPost method = new HttpPost(String.format("http://%s:%d/%s/%s/%s", host, port, name, type, id)); try { StringEntity requestEntity = new StringEntity(doc.toString(), ContentType.APPLICATION_JSON); method.setEntity(requestEntity); CloseableHttpResponse resp = client.execute(method); int statusCode = resp.getStatusLine().getStatusCode(); return statusCode == HttpStatus.SC_CREATED || statusCode == HttpStatus.SC_OK; } finally { method.releaseConnection(); } }
java
public boolean storeDocument(String name, String type, String id, EsRequest doc) throws IOException { CloseableHttpClient client = HttpClients.createDefault(); HttpPost method = new HttpPost(String.format("http://%s:%d/%s/%s/%s", host, port, name, type, id)); try { StringEntity requestEntity = new StringEntity(doc.toString(), ContentType.APPLICATION_JSON); method.setEntity(requestEntity); CloseableHttpResponse resp = client.execute(method); int statusCode = resp.getStatusLine().getStatusCode(); return statusCode == HttpStatus.SC_CREATED || statusCode == HttpStatus.SC_OK; } finally { method.releaseConnection(); } }
[ "public", "boolean", "storeDocument", "(", "String", "name", ",", "String", "type", ",", "String", "id", ",", "EsRequest", "doc", ")", "throws", "IOException", "{", "CloseableHttpClient", "client", "=", "HttpClients", ".", "createDefault", "(", ")", ";", "Http...
Indexes document. @param name the name of the index. @param type index type @param id document id @param doc document @return true if document was indexed. @throws IOException
[ "Indexes", "document", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/index-providers/modeshape-elasticsearch-index-provider/src/main/java/org/modeshape/jcr/index/elasticsearch/client/EsClient.java#L125-L138
alkacon/opencms-core
src/org/opencms/xml/content/CmsXmlContentPropertyHelper.java
CmsXmlContentPropertyHelper.getFileValueForIdOrUri
protected static CmsVfsFileValueBean getFileValueForIdOrUri(CmsObject cms, String idOrUri) throws CmsException { CmsVfsFileValueBean result; if (CmsUUID.isValidUUID(idOrUri)) { CmsUUID id = new CmsUUID(idOrUri); String uri = getUriForId(cms, id); result = new CmsVfsFileValueBean(cms.getRequestContext().addSiteRoot(uri), id); } else { String uri = idOrUri; CmsUUID id = getIdForUri(cms, idOrUri); result = new CmsVfsFileValueBean(cms.getRequestContext().addSiteRoot(uri), id); } return result; }
java
protected static CmsVfsFileValueBean getFileValueForIdOrUri(CmsObject cms, String idOrUri) throws CmsException { CmsVfsFileValueBean result; if (CmsUUID.isValidUUID(idOrUri)) { CmsUUID id = new CmsUUID(idOrUri); String uri = getUriForId(cms, id); result = new CmsVfsFileValueBean(cms.getRequestContext().addSiteRoot(uri), id); } else { String uri = idOrUri; CmsUUID id = getIdForUri(cms, idOrUri); result = new CmsVfsFileValueBean(cms.getRequestContext().addSiteRoot(uri), id); } return result; }
[ "protected", "static", "CmsVfsFileValueBean", "getFileValueForIdOrUri", "(", "CmsObject", "cms", ",", "String", "idOrUri", ")", "throws", "CmsException", "{", "CmsVfsFileValueBean", "result", ";", "if", "(", "CmsUUID", ".", "isValidUUID", "(", "idOrUri", ")", ")", ...
Given a string which might be a id or a (sitemap or VFS) URI, this method will return a bean containing the right (sitemap or vfs) root path and (sitemap entry or structure) id.<p> @param cms the current CMS context @param idOrUri a string containing an id or an URI @return a bean containing a root path and an id @throws CmsException if something goes wrong
[ "Given", "a", "string", "which", "might", "be", "a", "id", "or", "a", "(", "sitemap", "or", "VFS", ")", "URI", "this", "method", "will", "return", "a", "bean", "containing", "the", "right", "(", "sitemap", "or", "vfs", ")", "root", "path", "and", "("...
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsXmlContentPropertyHelper.java#L913-L927
SonarSource/sonarqube
server/sonar-server/src/main/java/org/sonar/server/plugins/ws/PluginWSCommons.java
PluginWSCommons.writeUpdateCenterProperties
public static void writeUpdateCenterProperties(JsonWriter json, Optional<UpdateCenter> updateCenter) { if (updateCenter.isPresent()) { json.propDateTime(PROPERTY_UPDATE_CENTER_REFRESH, updateCenter.get().getDate()); } }
java
public static void writeUpdateCenterProperties(JsonWriter json, Optional<UpdateCenter> updateCenter) { if (updateCenter.isPresent()) { json.propDateTime(PROPERTY_UPDATE_CENTER_REFRESH, updateCenter.get().getDate()); } }
[ "public", "static", "void", "writeUpdateCenterProperties", "(", "JsonWriter", "json", ",", "Optional", "<", "UpdateCenter", ">", "updateCenter", ")", "{", "if", "(", "updateCenter", ".", "isPresent", "(", ")", ")", "{", "json", ".", "propDateTime", "(", "PROPE...
Write properties of the specified UpdateCenter to the specified JsonWriter. <pre> "updateCenterRefresh": "2015-04-24T16:08:36+0200" </pre>
[ "Write", "properties", "of", "the", "specified", "UpdateCenter", "to", "the", "specified", "JsonWriter", ".", "<pre", ">", "updateCenterRefresh", ":", "2015", "-", "04", "-", "24T16", ":", "08", ":", "36", "+", "0200", "<", "/", "pre", ">" ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/plugins/ws/PluginWSCommons.java#L232-L236
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java
JsiiObject.jsiiCall
@Nullable protected final <T> T jsiiCall(final String method, final Class<T> returnType, @Nullable final Object... args) { return JsiiObjectMapper.treeToValue(JsiiObject.engine.getClient() .callMethod(this.objRef, method, JsiiObjectMapper.valueToTree(args)), returnType); }
java
@Nullable protected final <T> T jsiiCall(final String method, final Class<T> returnType, @Nullable final Object... args) { return JsiiObjectMapper.treeToValue(JsiiObject.engine.getClient() .callMethod(this.objRef, method, JsiiObjectMapper.valueToTree(args)), returnType); }
[ "@", "Nullable", "protected", "final", "<", "T", ">", "T", "jsiiCall", "(", "final", "String", "method", ",", "final", "Class", "<", "T", ">", "returnType", ",", "@", "Nullable", "final", "Object", "...", "args", ")", "{", "return", "JsiiObjectMapper", "...
Calls a JavaScript method on the object. @param method The name of the method. @param returnType The return type. @param args Method arguments. @param <T> Java type for the return value. @return A return value.
[ "Calls", "a", "JavaScript", "method", "on", "the", "object", "." ]
train
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java#L54-L61
joelittlejohn/jsonschema2pojo
jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/AnnotatorFactory.java
AnnotatorFactory.getAnnotator
public Annotator getAnnotator(Class<? extends Annotator> clazz) { if (!Annotator.class.isAssignableFrom(clazz)) { throw new IllegalArgumentException("The class name given as a custom annotator (" + clazz.getName() + ") does not refer to a class that implements " + Annotator.class.getName()); } try { try { Constructor<? extends Annotator> constructor = clazz.getConstructor(GenerationConfig.class); return constructor.newInstance(generationConfig); } catch (NoSuchMethodException e) { return clazz.newInstance(); } } catch (InvocationTargetException | InstantiationException e) { throw new IllegalArgumentException("Failed to create a custom annotator from the given class. An exception was thrown on trying to create a new instance.", e.getCause()); } catch (IllegalAccessException e) { throw new IllegalArgumentException("Failed to create a custom annotator from the given class. It appears that we do not have access to this class - is both the class and its no-arg constructor marked public?", e); } }
java
public Annotator getAnnotator(Class<? extends Annotator> clazz) { if (!Annotator.class.isAssignableFrom(clazz)) { throw new IllegalArgumentException("The class name given as a custom annotator (" + clazz.getName() + ") does not refer to a class that implements " + Annotator.class.getName()); } try { try { Constructor<? extends Annotator> constructor = clazz.getConstructor(GenerationConfig.class); return constructor.newInstance(generationConfig); } catch (NoSuchMethodException e) { return clazz.newInstance(); } } catch (InvocationTargetException | InstantiationException e) { throw new IllegalArgumentException("Failed to create a custom annotator from the given class. An exception was thrown on trying to create a new instance.", e.getCause()); } catch (IllegalAccessException e) { throw new IllegalArgumentException("Failed to create a custom annotator from the given class. It appears that we do not have access to this class - is both the class and its no-arg constructor marked public?", e); } }
[ "public", "Annotator", "getAnnotator", "(", "Class", "<", "?", "extends", "Annotator", ">", "clazz", ")", "{", "if", "(", "!", "Annotator", ".", "class", ".", "isAssignableFrom", "(", "clazz", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", ...
Create a new custom {@link Annotator} from the given class. @param clazz A class implementing {@link Annotator}. @return an instance of the given annotator type
[ "Create", "a", "new", "custom", "{", "@link", "Annotator", "}", "from", "the", "given", "class", "." ]
train
https://github.com/joelittlejohn/jsonschema2pojo/blob/0552b80db93214eb186e4ae45b40866cc1e7eb84/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/AnnotatorFactory.java#L70-L89