repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
194
func_name
stringlengths
6
111
whole_func_string
stringlengths
80
3.8k
language
stringclasses
1 value
func_code_string
stringlengths
80
3.8k
func_code_tokens
listlengths
20
697
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
434
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
jasminb/jsonapi-converter
src/main/java/com/github/jasminb/jsonapi/JSONAPIDocument.java
JSONAPIDocument.addLink
public void addLink(String linkName, Link link) { if (links == null) { links = new Links(new HashMap<String, Link>()); } links.addLink(linkName, link); }
java
public void addLink(String linkName, Link link) { if (links == null) { links = new Links(new HashMap<String, Link>()); } links.addLink(linkName, link); }
[ "public", "void", "addLink", "(", "String", "linkName", ",", "Link", "link", ")", "{", "if", "(", "links", "==", "null", ")", "{", "links", "=", "new", "Links", "(", "new", "HashMap", "<", "String", ",", "Link", ">", "(", ")", ")", ";", "}", "lin...
Adds a named link. @param linkName the named link to add @param link the link to add
[ "Adds", "a", "named", "link", "." ]
train
https://github.com/jasminb/jsonapi-converter/blob/73b41c3b9274e70e62b3425071ca8afdc7bddaf6/src/main/java/com/github/jasminb/jsonapi/JSONAPIDocument.java#L173-L178
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/lock/ExclusiveLockStrategy.java
ExclusiveLockStrategy.unlock
@Override public void unlock(EJSContainer c, Object lockName, Locker locker) { c.getLockManager().unlock(lockName, locker); }
java
@Override public void unlock(EJSContainer c, Object lockName, Locker locker) { c.getLockManager().unlock(lockName, locker); }
[ "@", "Override", "public", "void", "unlock", "(", "EJSContainer", "c", ",", "Object", "lockName", ",", "Locker", "locker", ")", "{", "c", ".", "getLockManager", "(", ")", ".", "unlock", "(", "lockName", ",", "locker", ")", ";", "}" ]
Release the lock identified by the given lock name and held by the given locker. <p>
[ "Release", "the", "lock", "identified", "by", "the", "given", "lock", "name", "and", "held", "by", "the", "given", "locker", ".", "<p", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/lock/ExclusiveLockStrategy.java#L71-L75
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/Deflater.java
Deflater.setInput
public void setInput(byte[] b, int off, int len) { if (b== null) { throw new NullPointerException(); } if (off < 0 || len < 0 || off > b.length - len) { throw new ArrayIndexOutOfBoundsException(); } synchronized (zsRef) { this.buf = b; this.off = off; this.len = len; } }
java
public void setInput(byte[] b, int off, int len) { if (b== null) { throw new NullPointerException(); } if (off < 0 || len < 0 || off > b.length - len) { throw new ArrayIndexOutOfBoundsException(); } synchronized (zsRef) { this.buf = b; this.off = off; this.len = len; } }
[ "public", "void", "setInput", "(", "byte", "[", "]", "b", ",", "int", "off", ",", "int", "len", ")", "{", "if", "(", "b", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";", "}", "if", "(", "off", "<", "0", "||", "len...
Sets input data for compression. This should be called whenever needsInput() returns true indicating that more input data is required. @param b the input data bytes @param off the start offset of the data @param len the length of the data @see Deflater#needsInput
[ "Sets", "input", "data", "for", "compression", ".", "This", "should", "be", "called", "whenever", "needsInput", "()", "returns", "true", "indicating", "that", "more", "input", "data", "is", "required", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/Deflater.java#L201-L213
GwtMaterialDesign/gwt-material
gwt-material/src/main/java/gwt/material/design/client/ui/MaterialListValueBox.java
MaterialListValueBox.insertItem
public void insertItem(T value, Direction dir, int index, boolean reload) { index += getIndexOffset(); insertItemInternal(value, dir, index, reload); }
java
public void insertItem(T value, Direction dir, int index, boolean reload) { index += getIndexOffset(); insertItemInternal(value, dir, index, reload); }
[ "public", "void", "insertItem", "(", "T", "value", ",", "Direction", "dir", ",", "int", "index", ",", "boolean", "reload", ")", "{", "index", "+=", "getIndexOffset", "(", ")", ";", "insertItemInternal", "(", "value", ",", "dir", ",", "index", ",", "reloa...
Inserts an item into the list box, specifying its direction. Has the same effect as <pre>insertItem(value, dir, item, index)</pre> @param value the item's value, to be submitted if it is part of a {@link FormPanel}. @param dir the item's direction @param index the index at which to insert it @param reload perform a 'material select' reload to update the DOM.
[ "Inserts", "an", "item", "into", "the", "list", "box", "specifying", "its", "direction", ".", "Has", "the", "same", "effect", "as", "<pre", ">", "insertItem", "(", "value", "dir", "item", "index", ")", "<", "/", "pre", ">" ]
train
https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialListValueBox.java#L359-L362
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/DateField.java
DateField.setCalendar
public int setCalendar(Calendar value, boolean bDisplayOption, int moveMode) { // Set this field's value if (value != null) { value.set(Calendar.HOUR_OF_DAY, 0); value.set(Calendar.MINUTE, 0); value.set(Calendar.SECOND, 0); value.set(Calendar.MILLISECOND, 0); } return super.setCalendar(value, bDisplayOption, moveMode); }
java
public int setCalendar(Calendar value, boolean bDisplayOption, int moveMode) { // Set this field's value if (value != null) { value.set(Calendar.HOUR_OF_DAY, 0); value.set(Calendar.MINUTE, 0); value.set(Calendar.SECOND, 0); value.set(Calendar.MILLISECOND, 0); } return super.setCalendar(value, bDisplayOption, moveMode); }
[ "public", "int", "setCalendar", "(", "Calendar", "value", ",", "boolean", "bDisplayOption", ",", "int", "moveMode", ")", "{", "// Set this field's value", "if", "(", "value", "!=", "null", ")", "{", "value", ".", "set", "(", "Calendar", ".", "HOUR_OF_DAY", "...
SetValue in current calendar. @param value The date (as a calendar value) to set (only date portion is used). @param bDisplayOption Display changed fields if true. @param iMoveMode The move mode. @return The error code (or NORMAL_RETURN).
[ "SetValue", "in", "current", "calendar", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/DateField.java#L156-L166
Netflix/eureka
eureka-core/src/main/java/com/netflix/eureka/registry/AbstractInstanceRegistry.java
AbstractInstanceRegistry.getInstanceByAppAndId
@Override public InstanceInfo getInstanceByAppAndId(String appName, String id, boolean includeRemoteRegions) { Map<String, Lease<InstanceInfo>> leaseMap = registry.get(appName); Lease<InstanceInfo> lease = null; if (leaseMap != null) { lease = leaseMap.get(id); } if (lease != null && (!isLeaseExpirationEnabled() || !lease.isExpired())) { return decorateInstanceInfo(lease); } else if (includeRemoteRegions) { for (RemoteRegionRegistry remoteRegistry : this.regionNameVSRemoteRegistry.values()) { Application application = remoteRegistry.getApplication(appName); if (application != null) { return application.getByInstanceId(id); } } } return null; }
java
@Override public InstanceInfo getInstanceByAppAndId(String appName, String id, boolean includeRemoteRegions) { Map<String, Lease<InstanceInfo>> leaseMap = registry.get(appName); Lease<InstanceInfo> lease = null; if (leaseMap != null) { lease = leaseMap.get(id); } if (lease != null && (!isLeaseExpirationEnabled() || !lease.isExpired())) { return decorateInstanceInfo(lease); } else if (includeRemoteRegions) { for (RemoteRegionRegistry remoteRegistry : this.regionNameVSRemoteRegistry.values()) { Application application = remoteRegistry.getApplication(appName); if (application != null) { return application.getByInstanceId(id); } } } return null; }
[ "@", "Override", "public", "InstanceInfo", "getInstanceByAppAndId", "(", "String", "appName", ",", "String", "id", ",", "boolean", "includeRemoteRegions", ")", "{", "Map", "<", "String", ",", "Lease", "<", "InstanceInfo", ">", ">", "leaseMap", "=", "registry", ...
Gets the {@link InstanceInfo} information. @param appName the application name for which the information is requested. @param id the unique identifier of the instance. @param includeRemoteRegions true, if we need to include applications from remote regions as indicated by the region {@link URL} by this property {@link EurekaServerConfig#getRemoteRegionUrls()}, false otherwise @return the information about the instance.
[ "Gets", "the", "{", "@link", "InstanceInfo", "}", "information", "." ]
train
https://github.com/Netflix/eureka/blob/48446d956be09df6650a3c00b7ebd7e2d1e1544f/eureka-core/src/main/java/com/netflix/eureka/registry/AbstractInstanceRegistry.java#L1022-L1041
logic-ng/LogicNG
src/main/java/org/logicng/graphs/datastructures/Graph.java
Graph.disconnect
public void disconnect(Node<T> o, Node<T> t) { if (!o.equals(t)) { o.disconnectFrom(t); t.disconnectFrom(o); } }
java
public void disconnect(Node<T> o, Node<T> t) { if (!o.equals(t)) { o.disconnectFrom(t); t.disconnectFrom(o); } }
[ "public", "void", "disconnect", "(", "Node", "<", "T", ">", "o", ",", "Node", "<", "T", ">", "t", ")", "{", "if", "(", "!", "o", ".", "equals", "(", "t", ")", ")", "{", "o", ".", "disconnectFrom", "(", "t", ")", ";", "t", ".", "disconnectFrom...
Removes the edge between two given nodes. (Does nothing if the nodes are not connected) @param o the first given node @param t the second given node
[ "Removes", "the", "edge", "between", "two", "given", "nodes", ".", "(", "Does", "nothing", "if", "the", "nodes", "are", "not", "connected", ")" ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/graphs/datastructures/Graph.java#L102-L107
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/data/ArtFinder.java
ArtFinder.getArtwork
AlbumArt getArtwork(int artworkId, SlotReference slot, CdjStatus.TrackType trackType, Client client) throws IOException { // Send the artwork request Message response = client.simpleRequest(Message.KnownType.ALBUM_ART_REQ, Message.KnownType.ALBUM_ART, client.buildRMST(Message.MenuIdentifier.DATA, slot.slot, trackType), new NumberField((long)artworkId)); // Create an image from the response bytes return new AlbumArt(new DataReference(slot, artworkId), ((BinaryField)response.arguments.get(3)).getValue()); }
java
AlbumArt getArtwork(int artworkId, SlotReference slot, CdjStatus.TrackType trackType, Client client) throws IOException { // Send the artwork request Message response = client.simpleRequest(Message.KnownType.ALBUM_ART_REQ, Message.KnownType.ALBUM_ART, client.buildRMST(Message.MenuIdentifier.DATA, slot.slot, trackType), new NumberField((long)artworkId)); // Create an image from the response bytes return new AlbumArt(new DataReference(slot, artworkId), ((BinaryField)response.arguments.get(3)).getValue()); }
[ "AlbumArt", "getArtwork", "(", "int", "artworkId", ",", "SlotReference", "slot", ",", "CdjStatus", ".", "TrackType", "trackType", ",", "Client", "client", ")", "throws", "IOException", "{", "// Send the artwork request", "Message", "response", "=", "client", ".", ...
Request the artwork with a particular artwork ID, given a connection to a player that has already been set up. @param artworkId identifies the album art to retrieve @param slot the slot identifier from which the associated track was loaded @param trackType the kind of track that owns the artwork @param client the dbserver client that is communicating with the appropriate player @return the track's artwork, or null if none is available @throws IOException if there is a problem communicating with the player
[ "Request", "the", "artwork", "with", "a", "particular", "artwork", "ID", "given", "a", "connection", "to", "a", "player", "that", "has", "already", "been", "set", "up", "." ]
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/ArtFinder.java#L360-L369
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/CollectionsApi.java
CollectionsApi.getTree
public CollectionTree getTree(String collectionId, String userId) throws JinxException { Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.collections.getTree"); if (!JinxUtils.isNullOrEmpty(collectionId)) { params.put("collection_id", collectionId); } if (!JinxUtils.isNullOrEmpty(userId)) { params.put("user_id", userId); } return jinx.flickrGet(params, CollectionTree.class); }
java
public CollectionTree getTree(String collectionId, String userId) throws JinxException { Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.collections.getTree"); if (!JinxUtils.isNullOrEmpty(collectionId)) { params.put("collection_id", collectionId); } if (!JinxUtils.isNullOrEmpty(userId)) { params.put("user_id", userId); } return jinx.flickrGet(params, CollectionTree.class); }
[ "public", "CollectionTree", "getTree", "(", "String", "collectionId", ",", "String", "userId", ")", "throws", "JinxException", "{", "Map", "<", "String", ",", "String", ">", "params", "=", "new", "TreeMap", "<>", "(", ")", ";", "params", ".", "put", "(", ...
Returns a tree (or sub tree) of collections belonging to a given user. <br> This method does not require authentication. @param collectionId Optional. The ID of the collection to fetch a tree for, or zero to fetch the root collection. Defaults to zero. @param userId Optional. The ID of the account to fetch the collection tree for. Deafults to the calling user. @return nested tree of collections, and the collections and sets they contain. @throws JinxException if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.collections.getTree.html">flickr.collections.getTree</a>
[ "Returns", "a", "tree", "(", "or", "sub", "tree", ")", "of", "collections", "belonging", "to", "a", "given", "user", ".", "<br", ">", "This", "method", "does", "not", "require", "authentication", "." ]
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/CollectionsApi.java#L73-L83
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/util/FileUtils.java
FileUtils.writeToFile
public static void writeToFile(String content, File file, Charset charset) { if (log.isDebugEnabled()) { log.debug(String.format("Writing file resource: '%s' (encoding is '%s')", file.getName(), charset.displayName())); } if (!file.getParentFile().exists()) { if (!file.getParentFile().mkdirs()) { throw new CitrusRuntimeException("Unable to create folder structure for file: " + file.getPath()); } } try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(file))) { fos.write(content.getBytes(charset)); fos.flush(); } catch (IOException e) { throw new CitrusRuntimeException("Failed to write file", e); } }
java
public static void writeToFile(String content, File file, Charset charset) { if (log.isDebugEnabled()) { log.debug(String.format("Writing file resource: '%s' (encoding is '%s')", file.getName(), charset.displayName())); } if (!file.getParentFile().exists()) { if (!file.getParentFile().mkdirs()) { throw new CitrusRuntimeException("Unable to create folder structure for file: " + file.getPath()); } } try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(file))) { fos.write(content.getBytes(charset)); fos.flush(); } catch (IOException e) { throw new CitrusRuntimeException("Failed to write file", e); } }
[ "public", "static", "void", "writeToFile", "(", "String", "content", ",", "File", "file", ",", "Charset", "charset", ")", "{", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "log", ".", "debug", "(", "String", ".", "format", "(", "\"Writi...
Writes String content to file with given charset encoding. Automatically closes file output streams when done. @param content @param file
[ "Writes", "String", "content", "to", "file", "with", "given", "charset", "encoding", ".", "Automatically", "closes", "file", "output", "streams", "when", "done", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/util/FileUtils.java#L156-L173
jamesagnew/hapi-fhir
hapi-fhir-base/src/main/java/ca/uhn/fhir/util/StopWatch.java
StopWatch.getEstimatedTimeRemaining
public String getEstimatedTimeRemaining(double theCompleteToDate, double theTotal) { double millis = getMillis(); long millisRemaining = (long) (((theTotal / theCompleteToDate) * millis) - (millis)); return formatMillis(millisRemaining); }
java
public String getEstimatedTimeRemaining(double theCompleteToDate, double theTotal) { double millis = getMillis(); long millisRemaining = (long) (((theTotal / theCompleteToDate) * millis) - (millis)); return formatMillis(millisRemaining); }
[ "public", "String", "getEstimatedTimeRemaining", "(", "double", "theCompleteToDate", ",", "double", "theTotal", ")", "{", "double", "millis", "=", "getMillis", "(", ")", ";", "long", "millisRemaining", "=", "(", "long", ")", "(", "(", "(", "theTotal", "/", "...
Given an amount of something completed so far, and a total amount, calculates how long it will take for something to complete @param theCompleteToDate The amount so far @param theTotal The total (must be higher than theCompleteToDate @return A formatted amount of time
[ "Given", "an", "amount", "of", "something", "completed", "so", "far", "and", "a", "total", "amount", "calculates", "how", "long", "it", "will", "take", "for", "something", "to", "complete" ]
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/StopWatch.java#L180-L184
vkostyukov/la4j
src/main/java/org/la4j/vector/SparseVector.java
SparseVector.random
public static SparseVector random(int length, double density, Random random) { return CompressedVector.random(length, density, random); }
java
public static SparseVector random(int length, double density, Random random) { return CompressedVector.random(length, density, random); }
[ "public", "static", "SparseVector", "random", "(", "int", "length", ",", "double", "density", ",", "Random", "random", ")", "{", "return", "CompressedVector", ".", "random", "(", "length", ",", "density", ",", "random", ")", ";", "}" ]
Creates a constant {@link SparseVector} of the given {@code length} with the given {@code value}.
[ "Creates", "a", "constant", "{" ]
train
https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/vector/SparseVector.java#L90-L92
alkacon/opencms-core
src-modules/org/opencms/workplace/tools/database/CmsHtmlImport.java
CmsHtmlImport.getBasePath
private String getBasePath(String path1, String path2) { StringBuffer base = new StringBuffer(); path1 = path1.replace('\\', '/'); path2 = path2.replace('\\', '/'); String[] parts1 = path1.split("/"); String[] parts2 = path2.split("/"); for (int i = 0; i < parts1.length; i++) { if (i >= parts2.length) { break; } if (parts1[i].equals(parts2[i])) { base.append(parts1[i] + "/"); } } return base.toString(); }
java
private String getBasePath(String path1, String path2) { StringBuffer base = new StringBuffer(); path1 = path1.replace('\\', '/'); path2 = path2.replace('\\', '/'); String[] parts1 = path1.split("/"); String[] parts2 = path2.split("/"); for (int i = 0; i < parts1.length; i++) { if (i >= parts2.length) { break; } if (parts1[i].equals(parts2[i])) { base.append(parts1[i] + "/"); } } return base.toString(); }
[ "private", "String", "getBasePath", "(", "String", "path1", ",", "String", "path2", ")", "{", "StringBuffer", "base", "=", "new", "StringBuffer", "(", ")", ";", "path1", "=", "path1", ".", "replace", "(", "'", "'", ",", "'", "'", ")", ";", "path2", "...
Compares two path's for the base part which have both equal.<p> @param path1 the first path to compare @param path2 the second path to compare @return the base path of both which are equal
[ "Compares", "two", "path", "s", "for", "the", "base", "part", "which", "have", "both", "equal", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/database/CmsHtmlImport.java#L1321-L1340
Ordinastie/MalisisCore
src/main/java/net/malisis/core/renderer/animation/transformation/AlphaTransform.java
AlphaTransform.doTransform
@Override protected void doTransform(ITransformable.Alpha transformable, float comp) { if (comp <= 0) return; float from = reversed ? toAlpha : fromAlpha; float to = reversed ? fromAlpha : toAlpha; transformable.setAlpha((int) (from + (to - from) * comp)); }
java
@Override protected void doTransform(ITransformable.Alpha transformable, float comp) { if (comp <= 0) return; float from = reversed ? toAlpha : fromAlpha; float to = reversed ? fromAlpha : toAlpha; transformable.setAlpha((int) (from + (to - from) * comp)); }
[ "@", "Override", "protected", "void", "doTransform", "(", "ITransformable", ".", "Alpha", "transformable", ",", "float", "comp", ")", "{", "if", "(", "comp", "<=", "0", ")", "return", ";", "float", "from", "=", "reversed", "?", "toAlpha", ":", "fromAlpha",...
Calculates the transformation. @param transformable the transformable @param comp the comp
[ "Calculates", "the", "transformation", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/renderer/animation/transformation/AlphaTransform.java#L91-L101
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/query/SearchFilter.java
SearchFilter.matchSet
public void matchSet(String[] ElementNames, String[] ElementValues, int op) throws DBException { // Delete the old search filter m_filter = null; // If this is not a logical operator, throw an exception if ((op & LOGICAL_OPER_MASK) == 0) { throw new DBException(); // Create a vector that will hold the leaf nodes for all elements in the hashtable } Vector leafVector = new Vector(); // For each of the elements in the array, create a leaf node for the match int numnames = ElementNames.length; for (int i = 0; i < numnames; i++) { // Create a leaf node for this list and store it as the filter SearchBaseLeaf leafnode = new SearchBaseLeaf(ElementNames[i], IN, ElementValues[i]); // Add this leaf node to the vector leafVector.addElement(leafnode); } // Now return a node that holds this set of leaf nodes m_filter = new SearchBaseNode(op, leafVector); }
java
public void matchSet(String[] ElementNames, String[] ElementValues, int op) throws DBException { // Delete the old search filter m_filter = null; // If this is not a logical operator, throw an exception if ((op & LOGICAL_OPER_MASK) == 0) { throw new DBException(); // Create a vector that will hold the leaf nodes for all elements in the hashtable } Vector leafVector = new Vector(); // For each of the elements in the array, create a leaf node for the match int numnames = ElementNames.length; for (int i = 0; i < numnames; i++) { // Create a leaf node for this list and store it as the filter SearchBaseLeaf leafnode = new SearchBaseLeaf(ElementNames[i], IN, ElementValues[i]); // Add this leaf node to the vector leafVector.addElement(leafnode); } // Now return a node that holds this set of leaf nodes m_filter = new SearchBaseNode(op, leafVector); }
[ "public", "void", "matchSet", "(", "String", "[", "]", "ElementNames", ",", "String", "[", "]", "ElementValues", ",", "int", "op", ")", "throws", "DBException", "{", "// Delete the old search filter\r", "m_filter", "=", "null", ";", "// If this is not a logical oper...
Change the search filter to one that specifies a set of elements and their values that must match, and the operator to use to combine the elements. Each element name is compared for an equal match to the value, and all comparisons are combined by the specified logical operator (OR or AND). The old search filter is deleted. @param ElementNames is an array of names of elements to be tested @param ElementValues is an array of values for the corresponding element @param op is the logical operator to be used to combine the comparisons @exception DBException
[ "Change", "the", "search", "filter", "to", "one", "that", "specifies", "a", "set", "of", "elements", "and", "their", "values", "that", "must", "match", "and", "the", "operator", "to", "use", "to", "combine", "the", "elements", ".", "Each", "element", "name...
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/query/SearchFilter.java#L266-L288
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/time/DateUtils.java
DateUtils.setYears
public static Date setYears(final Date date, final int amount) { return set(date, Calendar.YEAR, amount); }
java
public static Date setYears(final Date date, final int amount) { return set(date, Calendar.YEAR, amount); }
[ "public", "static", "Date", "setYears", "(", "final", "Date", "date", ",", "final", "int", "amount", ")", "{", "return", "set", "(", "date", ",", "Calendar", ".", "YEAR", ",", "amount", ")", ";", "}" ]
Sets the years field to a date returning a new object. The original {@code Date} is unchanged. @param date the date, not null @param amount the amount to set @return a new {@code Date} set with the specified value @throws IllegalArgumentException if the date is null @since 2.4
[ "Sets", "the", "years", "field", "to", "a", "date", "returning", "a", "new", "object", ".", "The", "original", "{", "@code", "Date", "}", "is", "unchanged", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/time/DateUtils.java#L540-L542
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UCharacterName.java
UCharacterName.setToken
boolean setToken(char token[], byte tokenstring[]) { if (token != null && tokenstring != null && token.length > 0 && tokenstring.length > 0) { m_tokentable_ = token; m_tokenstring_ = tokenstring; return true; } return false; }
java
boolean setToken(char token[], byte tokenstring[]) { if (token != null && tokenstring != null && token.length > 0 && tokenstring.length > 0) { m_tokentable_ = token; m_tokenstring_ = tokenstring; return true; } return false; }
[ "boolean", "setToken", "(", "char", "token", "[", "]", ",", "byte", "tokenstring", "[", "]", ")", "{", "if", "(", "token", "!=", "null", "&&", "tokenstring", "!=", "null", "&&", "token", ".", "length", ">", "0", "&&", "tokenstring", ".", "length", ">...
Sets the token data @param token array of tokens @param tokenstring array of string values of the tokens @return false if there is a data error
[ "Sets", "the", "token", "data" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UCharacterName.java#L965-L974
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPP8Reader.java
MPP8Reader.populateMemberData
private void populateMemberData(MPPReader reader, ProjectFile file, DirectoryEntry root) throws IOException { m_reader = reader; m_root = root; m_file = file; m_eventManager = file.getEventManager(); m_calendarMap = new HashMap<Integer, ProjectCalendar>(); m_projectDir = (DirectoryEntry) root.getEntry(" 1"); m_viewDir = (DirectoryEntry) root.getEntry(" 2"); m_file.getProjectProperties().setMppFileType(Integer.valueOf(8)); }
java
private void populateMemberData(MPPReader reader, ProjectFile file, DirectoryEntry root) throws IOException { m_reader = reader; m_root = root; m_file = file; m_eventManager = file.getEventManager(); m_calendarMap = new HashMap<Integer, ProjectCalendar>(); m_projectDir = (DirectoryEntry) root.getEntry(" 1"); m_viewDir = (DirectoryEntry) root.getEntry(" 2"); m_file.getProjectProperties().setMppFileType(Integer.valueOf(8)); }
[ "private", "void", "populateMemberData", "(", "MPPReader", "reader", ",", "ProjectFile", "file", ",", "DirectoryEntry", "root", ")", "throws", "IOException", "{", "m_reader", "=", "reader", ";", "m_root", "=", "root", ";", "m_file", "=", "file", ";", "m_eventM...
Populate member data used by the rest of the reader. @param reader parent file reader @param file parent MPP file @param root Root of the POI file system.
[ "Populate", "member", "data", "used", "by", "the", "rest", "of", "the", "reader", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP8Reader.java#L125-L137
TheCoder4eu/BootsFaces-OSP
src/main/java/net/bootsfaces/component/button/ButtonRenderer.java
ButtonRenderer.determineTargetURL
private String determineTargetURL(FacesContext context, Button button, String outcome) { ConfigurableNavigationHandler cnh = (ConfigurableNavigationHandler) context.getApplication() .getNavigationHandler(); NavigationCase navCase = cnh.getNavigationCase(context, null, outcome); /* * Param Name: javax.faces.PROJECT_STAGE Default Value: The default * value is ProjectStage#Production but IDE can set it differently in * web.xml Expected Values: Development, Production, SystemTest, * UnitTest Since: 2.0 * * If we cannot get an outcome we use an Alert to give a feedback to the * Developer if this build is in the Development Stage */ if (navCase == null) { if (FacesContext.getCurrentInstance().getApplication().getProjectStage().equals(ProjectStage.Development)) { return "alert('WARNING! " + C.W_NONAVCASE_BUTTON + "');"; } else { return ""; } } // throw new FacesException("The outcome '"+outcome+"' cannot be // resolved."); } String vId = navCase.getToViewId(context); Map<String, List<String>> params = getParams(navCase, button); String url; url = context.getApplication().getViewHandler().getBookmarkableURL(context, vId, params, button.isIncludeViewParams() || navCase.isIncludeViewParams()); return url; }
java
private String determineTargetURL(FacesContext context, Button button, String outcome) { ConfigurableNavigationHandler cnh = (ConfigurableNavigationHandler) context.getApplication() .getNavigationHandler(); NavigationCase navCase = cnh.getNavigationCase(context, null, outcome); /* * Param Name: javax.faces.PROJECT_STAGE Default Value: The default * value is ProjectStage#Production but IDE can set it differently in * web.xml Expected Values: Development, Production, SystemTest, * UnitTest Since: 2.0 * * If we cannot get an outcome we use an Alert to give a feedback to the * Developer if this build is in the Development Stage */ if (navCase == null) { if (FacesContext.getCurrentInstance().getApplication().getProjectStage().equals(ProjectStage.Development)) { return "alert('WARNING! " + C.W_NONAVCASE_BUTTON + "');"; } else { return ""; } } // throw new FacesException("The outcome '"+outcome+"' cannot be // resolved."); } String vId = navCase.getToViewId(context); Map<String, List<String>> params = getParams(navCase, button); String url; url = context.getApplication().getViewHandler().getBookmarkableURL(context, vId, params, button.isIncludeViewParams() || navCase.isIncludeViewParams()); return url; }
[ "private", "String", "determineTargetURL", "(", "FacesContext", "context", ",", "Button", "button", ",", "String", "outcome", ")", "{", "ConfigurableNavigationHandler", "cnh", "=", "(", "ConfigurableNavigationHandler", ")", "context", ".", "getApplication", "(", ")", ...
Translate the outcome attribute value to the target URL. @param context the current FacesContext @param outcome the value of the outcome attribute @return the target URL of the navigation rule (or the outcome if there's not navigation rule)
[ "Translate", "the", "outcome", "attribute", "value", "to", "the", "target", "URL", "." ]
train
https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/button/ButtonRenderer.java#L297-L325
knowm/XChart
xchart/src/main/java/org/knowm/xchart/CSVExporter.java
CSVExporter.writeCSVColumns
public static void writeCSVColumns(XYChart chart, String path2Dir) { for (XYSeries xySeries : chart.getSeriesMap().values()) { writeCSVColumns(xySeries, path2Dir); } }
java
public static void writeCSVColumns(XYChart chart, String path2Dir) { for (XYSeries xySeries : chart.getSeriesMap().values()) { writeCSVColumns(xySeries, path2Dir); } }
[ "public", "static", "void", "writeCSVColumns", "(", "XYChart", "chart", ",", "String", "path2Dir", ")", "{", "for", "(", "XYSeries", "xySeries", ":", "chart", ".", "getSeriesMap", "(", ")", ".", "values", "(", ")", ")", "{", "writeCSVColumns", "(", "xySeri...
Export all XYChart series as columns in separate CSV files. @param chart @param path2Dir
[ "Export", "all", "XYChart", "series", "as", "columns", "in", "separate", "CSV", "files", "." ]
train
https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/CSVExporter.java#L91-L96
datumbox/datumbox-framework
datumbox-framework-common/src/main/java/com/datumbox/framework/common/dataobjects/TransposeDataCollection.java
TransposeDataCollection.put
public final FlatDataCollection put(Object key, FlatDataCollection value) { return internalData.put(key, value); }
java
public final FlatDataCollection put(Object key, FlatDataCollection value) { return internalData.put(key, value); }
[ "public", "final", "FlatDataCollection", "put", "(", "Object", "key", ",", "FlatDataCollection", "value", ")", "{", "return", "internalData", ".", "put", "(", "key", ",", "value", ")", ";", "}" ]
Adds a particular key-value into the internal map. It returns the previous value which was associated with that key. @param key @param value @return
[ "Adds", "a", "particular", "key", "-", "value", "into", "the", "internal", "map", ".", "It", "returns", "the", "previous", "value", "which", "was", "associated", "with", "that", "key", "." ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-common/src/main/java/com/datumbox/framework/common/dataobjects/TransposeDataCollection.java#L79-L81
OpenBEL/openbel-framework
org.openbel.framework.common/src/main/java/org/openbel/framework/common/BELUtilities.java
BELUtilities.computeHashSHA256
public static String computeHashSHA256(final InputStream input) throws IOException { if (input == null) { throw new InvalidArgument("input", input); } MessageDigest sha256; try { sha256 = MessageDigest.getInstance("SHA-256"); } catch (NoSuchAlgorithmException e) { throw new MissingAlgorithmException(SHA_256, e); } final DigestInputStream dis = new DigestInputStream(input, sha256); while (dis.read() != -1) {} byte[] mdbytes = sha256.digest(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < mdbytes.length; i++) { sb.append(Integer.toString((mdbytes[i] & 0xff) + 0x100, 16) .substring(1)); } return sb.toString(); }
java
public static String computeHashSHA256(final InputStream input) throws IOException { if (input == null) { throw new InvalidArgument("input", input); } MessageDigest sha256; try { sha256 = MessageDigest.getInstance("SHA-256"); } catch (NoSuchAlgorithmException e) { throw new MissingAlgorithmException(SHA_256, e); } final DigestInputStream dis = new DigestInputStream(input, sha256); while (dis.read() != -1) {} byte[] mdbytes = sha256.digest(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < mdbytes.length; i++) { sb.append(Integer.toString((mdbytes[i] & 0xff) + 0x100, 16) .substring(1)); } return sb.toString(); }
[ "public", "static", "String", "computeHashSHA256", "(", "final", "InputStream", "input", ")", "throws", "IOException", "{", "if", "(", "input", "==", "null", ")", "{", "throw", "new", "InvalidArgument", "(", "\"input\"", ",", "input", ")", ";", "}", "Message...
Computes a SHA-256 hash of data from the {@link InputStream input}. @param input the data {@link InputStream input stream}, which cannot be {@code null} @return the {@link String SHA-256 hash} @throws IOException Thrown if an IO error occurred reading from the {@link InputStream input} @throws InvalidArgument Thrown if {@code input} is {@code null}
[ "Computes", "a", "SHA", "-", "256", "hash", "of", "data", "from", "the", "{", "@link", "InputStream", "input", "}", "." ]
train
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/BELUtilities.java#L208-L233
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java
DataNode.instantiateDataNode
public static DataNode instantiateDataNode(String args[], Configuration conf) throws IOException { if (conf == null) conf = new Configuration(); if (!parseArguments(args, conf)) { printUsage(); return null; } if (conf.get("dfs.network.script") != null) { LOG.error("This configuration for rack identification is not supported" + " anymore. RackID resolution is handled by the NameNode."); System.exit(-1); } String[] dataDirs = getListOfDataDirs(conf); dnThreadName = "DataNode: [" + StringUtils.arrayToString(dataDirs) + "]"; return makeInstance(dataDirs, conf); }
java
public static DataNode instantiateDataNode(String args[], Configuration conf) throws IOException { if (conf == null) conf = new Configuration(); if (!parseArguments(args, conf)) { printUsage(); return null; } if (conf.get("dfs.network.script") != null) { LOG.error("This configuration for rack identification is not supported" + " anymore. RackID resolution is handled by the NameNode."); System.exit(-1); } String[] dataDirs = getListOfDataDirs(conf); dnThreadName = "DataNode: [" + StringUtils.arrayToString(dataDirs) + "]"; return makeInstance(dataDirs, conf); }
[ "public", "static", "DataNode", "instantiateDataNode", "(", "String", "args", "[", "]", ",", "Configuration", "conf", ")", "throws", "IOException", "{", "if", "(", "conf", "==", "null", ")", "conf", "=", "new", "Configuration", "(", ")", ";", "if", "(", ...
Instantiate a single datanode object. This must be run by invoking {@link DataNode#runDatanodeDaemon(DataNode)} subsequently.
[ "Instantiate", "a", "single", "datanode", "object", ".", "This", "must", "be", "run", "by", "invoking", "{" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java#L2347-L2364
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-scaleout/deeplearning4j-aws/src/main/java/org/deeplearning4j/aws/ec2/provision/HostProvisioner.java
HostProvisioner.uploadForDeployment
public void uploadForDeployment(String from, String to) throws Exception { File fromFile = new File(from); if (!to.isEmpty() && fromFile.isDirectory()) mkDir(to); else upload(from, to); }
java
public void uploadForDeployment(String from, String to) throws Exception { File fromFile = new File(from); if (!to.isEmpty() && fromFile.isDirectory()) mkDir(to); else upload(from, to); }
[ "public", "void", "uploadForDeployment", "(", "String", "from", ",", "String", "to", ")", "throws", "Exception", "{", "File", "fromFile", "=", "new", "File", "(", "from", ")", ";", "if", "(", "!", "to", ".", "isEmpty", "(", ")", "&&", "fromFile", ".", ...
Creates the directory for the file if necessary and uploads the file @param from the directory to upload from @param to the destination directory on the remote server @throws Exception
[ "Creates", "the", "directory", "for", "the", "file", "if", "necessary", "and", "uploads", "the", "file" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/deeplearning4j-aws/src/main/java/org/deeplearning4j/aws/ec2/provision/HostProvisioner.java#L150-L158
ModeShape/modeshape
modeshape-schematic/src/main/java/org/modeshape/schematic/DocumentFactory.java
DocumentFactory.newArray
public static EditableArray newArray( Collection<?> values ) { BasicArray array = new BasicArray(values.size()); array.addAllValues(values); return new ArrayEditor(array, DEFAULT_FACTORY); }
java
public static EditableArray newArray( Collection<?> values ) { BasicArray array = new BasicArray(values.size()); array.addAllValues(values); return new ArrayEditor(array, DEFAULT_FACTORY); }
[ "public", "static", "EditableArray", "newArray", "(", "Collection", "<", "?", ">", "values", ")", "{", "BasicArray", "array", "=", "new", "BasicArray", "(", "values", ".", "size", "(", ")", ")", ";", "array", ".", "addAllValues", "(", "values", ")", ";",...
Create a new editable array that can be used as a new array value in other documents. @param values the initial values for the array @return the editable array; never null
[ "Create", "a", "new", "editable", "array", "that", "can", "be", "used", "as", "a", "new", "array", "value", "in", "other", "documents", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-schematic/src/main/java/org/modeshape/schematic/DocumentFactory.java#L171-L175
astrapi69/mystic-crypt
crypt-data/src/main/java/de/alpharogroup/crypto/key/writer/EncryptedPrivateKeyWriter.java
EncryptedPrivateKeyWriter.encryptPrivateKeyWithPassword
public static byte[] encryptPrivateKeyWithPassword(final PrivateKey privateKey, final String password) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException, InvalidParameterSpecException, IOException { final byte[] privateKeyEncoded = privateKey.getEncoded(); final SecureRandom random = new SecureRandom(); final byte[] salt = new byte[8]; random.nextBytes(salt); final AlgorithmParameterSpec algorithmParameterSpec = AlgorithmParameterSpecFactory .newPBEParameterSpec(salt, 20); final SecretKey secretKey = SecretKeyFactoryExtensions.newSecretKey(password.toCharArray(), CompoundAlgorithm.PBE_WITH_SHA1_AND_DES_EDE.getAlgorithm()); final Cipher pbeCipher = Cipher .getInstance(CompoundAlgorithm.PBE_WITH_SHA1_AND_DES_EDE.getAlgorithm()); pbeCipher.init(Cipher.ENCRYPT_MODE, secretKey, algorithmParameterSpec); final byte[] ciphertext = pbeCipher.doFinal(privateKeyEncoded); final AlgorithmParameters algparms = AlgorithmParameters .getInstance(CompoundAlgorithm.PBE_WITH_SHA1_AND_DES_EDE.getAlgorithm()); algparms.init(algorithmParameterSpec); final EncryptedPrivateKeyInfo encinfo = new EncryptedPrivateKeyInfo(algparms, ciphertext); return encinfo.getEncoded(); }
java
public static byte[] encryptPrivateKeyWithPassword(final PrivateKey privateKey, final String password) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException, InvalidParameterSpecException, IOException { final byte[] privateKeyEncoded = privateKey.getEncoded(); final SecureRandom random = new SecureRandom(); final byte[] salt = new byte[8]; random.nextBytes(salt); final AlgorithmParameterSpec algorithmParameterSpec = AlgorithmParameterSpecFactory .newPBEParameterSpec(salt, 20); final SecretKey secretKey = SecretKeyFactoryExtensions.newSecretKey(password.toCharArray(), CompoundAlgorithm.PBE_WITH_SHA1_AND_DES_EDE.getAlgorithm()); final Cipher pbeCipher = Cipher .getInstance(CompoundAlgorithm.PBE_WITH_SHA1_AND_DES_EDE.getAlgorithm()); pbeCipher.init(Cipher.ENCRYPT_MODE, secretKey, algorithmParameterSpec); final byte[] ciphertext = pbeCipher.doFinal(privateKeyEncoded); final AlgorithmParameters algparms = AlgorithmParameters .getInstance(CompoundAlgorithm.PBE_WITH_SHA1_AND_DES_EDE.getAlgorithm()); algparms.init(algorithmParameterSpec); final EncryptedPrivateKeyInfo encinfo = new EncryptedPrivateKeyInfo(algparms, ciphertext); return encinfo.getEncoded(); }
[ "public", "static", "byte", "[", "]", "encryptPrivateKeyWithPassword", "(", "final", "PrivateKey", "privateKey", ",", "final", "String", "password", ")", "throws", "NoSuchAlgorithmException", ",", "InvalidKeySpecException", ",", "NoSuchPaddingException", ",", "InvalidKeyE...
Encrypt the given {@link PrivateKey} with the given password and return the resulted byte array. @param privateKey the private key to encrypt @param password the password @return the byte[] @throws NoSuchAlgorithmException is thrown if instantiation of the SecretKeyFactory object fails. @throws InvalidKeySpecException is thrown if generation of the SecretKey object fails. @throws NoSuchPaddingException the no such padding exception @throws InvalidKeyException is thrown if initialization of the cipher object fails @throws InvalidAlgorithmParameterException is thrown if initialization of the cypher object fails. @throws IllegalBlockSizeException the illegal block size exception @throws BadPaddingException the bad padding exception @throws InvalidParameterSpecException the invalid parameter spec exception @throws IOException Signals that an I/O exception has occurred.
[ "Encrypt", "the", "given", "{", "@link", "PrivateKey", "}", "with", "the", "given", "password", "and", "return", "the", "resulted", "byte", "array", "." ]
train
https://github.com/astrapi69/mystic-crypt/blob/7f51ef5e4457e24de7ff391f10bfc5609e6f1a34/crypt-data/src/main/java/de/alpharogroup/crypto/key/writer/EncryptedPrivateKeyWriter.java#L92-L122
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocFile.java
DocFile.copyFile
public void copyFile(DocFile fromFile) throws DocFileIOException { try (OutputStream output = openOutputStream()) { try (InputStream input = fromFile.openInputStream()) { byte[] bytearr = new byte[1024]; int len; while ((len = read(fromFile, input, bytearr)) != -1) { write(this, output, bytearr, len); } } catch (IOException e) { throw new DocFileIOException(fromFile, DocFileIOException.Mode.READ, e); } } catch (IOException e) { throw new DocFileIOException(this, DocFileIOException.Mode.WRITE, e); } }
java
public void copyFile(DocFile fromFile) throws DocFileIOException { try (OutputStream output = openOutputStream()) { try (InputStream input = fromFile.openInputStream()) { byte[] bytearr = new byte[1024]; int len; while ((len = read(fromFile, input, bytearr)) != -1) { write(this, output, bytearr, len); } } catch (IOException e) { throw new DocFileIOException(fromFile, DocFileIOException.Mode.READ, e); } } catch (IOException e) { throw new DocFileIOException(this, DocFileIOException.Mode.WRITE, e); } }
[ "public", "void", "copyFile", "(", "DocFile", "fromFile", ")", "throws", "DocFileIOException", "{", "try", "(", "OutputStream", "output", "=", "openOutputStream", "(", ")", ")", "{", "try", "(", "InputStream", "input", "=", "fromFile", ".", "openInputStream", ...
Copy the contents of another file directly to this file. @param fromFile the file to be copied @throws DocFileIOException if there is a problem file copying the file
[ "Copy", "the", "contents", "of", "another", "file", "directly", "to", "this", "file", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocFile.java#L142-L156
alkacon/opencms-core
src/org/opencms/ade/configuration/CmsADEConfigurationSequence.java
CmsADEConfigurationSequence.getParent
public Optional<CmsADEConfigurationSequence> getParent() { if (m_configIndex <= 0) { return Optional.absent(); } return Optional.fromNullable(new CmsADEConfigurationSequence(m_configDatas, m_configIndex - 1)); }
java
public Optional<CmsADEConfigurationSequence> getParent() { if (m_configIndex <= 0) { return Optional.absent(); } return Optional.fromNullable(new CmsADEConfigurationSequence(m_configDatas, m_configIndex - 1)); }
[ "public", "Optional", "<", "CmsADEConfigurationSequence", ">", "getParent", "(", ")", "{", "if", "(", "m_configIndex", "<=", "0", ")", "{", "return", "Optional", ".", "absent", "(", ")", ";", "}", "return", "Optional", ".", "fromNullable", "(", "new", "Cms...
Returns a sequence which only differs from this instance in that its index is one less.<p> However, if the index of this instance is already 0, Optional.absent will be returned. @return the parent sequence, or Optional.absent if we are already at the start of the sequence
[ "Returns", "a", "sequence", "which", "only", "differs", "from", "this", "instance", "in", "that", "its", "index", "is", "one", "less", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsADEConfigurationSequence.java#L89-L95
fcrepo4/fcrepo4
fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/StreamUtils.java
StreamUtils.iteratorToStream
public static <T> Stream<T> iteratorToStream(final Iterator<T> iterator, final Boolean parallel) { return stream(spliteratorUnknownSize(iterator, IMMUTABLE), parallel); }
java
public static <T> Stream<T> iteratorToStream(final Iterator<T> iterator, final Boolean parallel) { return stream(spliteratorUnknownSize(iterator, IMMUTABLE), parallel); }
[ "public", "static", "<", "T", ">", "Stream", "<", "T", ">", "iteratorToStream", "(", "final", "Iterator", "<", "T", ">", "iterator", ",", "final", "Boolean", "parallel", ")", "{", "return", "stream", "(", "spliteratorUnknownSize", "(", "iterator", ",", "IM...
Convert an Iterator to a Stream @param <T> the type of the Stream @param iterator the iterator @param parallel whether to parallelize the stream @return the stream
[ "Convert", "an", "Iterator", "to", "a", "Stream" ]
train
https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/StreamUtils.java#L76-L78
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/sax/Excel03SaxReader.java
Excel03SaxReader.read
public Excel03SaxReader read(POIFSFileSystem fs, int sheetIndex) throws POIException { this.sheetIndex = sheetIndex; formatListener = new FormatTrackingHSSFListener(new MissingRecordAwareHSSFListener(this)); final HSSFRequest request = new HSSFRequest(); if (isOutputFormulaValues) { request.addListenerForAllRecords(formatListener); } else { workbookBuildingListener = new SheetRecordCollectingListener(formatListener); request.addListenerForAllRecords(workbookBuildingListener); } final HSSFEventFactory factory = new HSSFEventFactory(); try { factory.processWorkbookEvents(request, fs); } catch (IOException e) { throw new POIException(e); } return this; }
java
public Excel03SaxReader read(POIFSFileSystem fs, int sheetIndex) throws POIException { this.sheetIndex = sheetIndex; formatListener = new FormatTrackingHSSFListener(new MissingRecordAwareHSSFListener(this)); final HSSFRequest request = new HSSFRequest(); if (isOutputFormulaValues) { request.addListenerForAllRecords(formatListener); } else { workbookBuildingListener = new SheetRecordCollectingListener(formatListener); request.addListenerForAllRecords(workbookBuildingListener); } final HSSFEventFactory factory = new HSSFEventFactory(); try { factory.processWorkbookEvents(request, fs); } catch (IOException e) { throw new POIException(e); } return this; }
[ "public", "Excel03SaxReader", "read", "(", "POIFSFileSystem", "fs", ",", "int", "sheetIndex", ")", "throws", "POIException", "{", "this", ".", "sheetIndex", "=", "sheetIndex", ";", "formatListener", "=", "new", "FormatTrackingHSSFListener", "(", "new", "MissingRecor...
读取 @param fs {@link POIFSFileSystem} @param sheetIndex sheet序号 @return this @throws POIException IO异常包装
[ "读取" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/sax/Excel03SaxReader.java#L109-L127
btrplace/scheduler
choco/src/main/java/org/btrplace/scheduler/choco/extensions/pack/KnapsackDecorator.java
KnapsackDecorator.filterFullDim
@SuppressWarnings("squid:S3346") private void filterFullDim(int bin, int dim) throws ContradictionException { for (int i = candidate.get(bin).nextSetBit(0); i >= 0; i = candidate.get(bin).nextSetBit(i + 1)) { if (prop.iSizes[dim][i] == 0) { continue; } // ISSUE 86: the event 'i removed from bin' can already been in the propagation stack but not yet considered // ie. !prop.bins[i].contains(bin) && candidate[bin].contains(i): in this case, do not process it yet if (prop.bins[i].removeValue(bin, prop)) { candidate.get(bin).clear(i); prop.updateLoads(i, bin); if (prop.bins[i].isInstantiated()) { prop.assignItem(i, prop.bins[i].getValue()); } } } if (candidate.get(bin).isEmpty()) { assert prop.potentialLoad[dim][bin].get() == prop.assignedLoad[dim][bin].get(); assert prop.loads[dim][bin].getUB() == prop.potentialLoad[dim][bin].get(); } }
java
@SuppressWarnings("squid:S3346") private void filterFullDim(int bin, int dim) throws ContradictionException { for (int i = candidate.get(bin).nextSetBit(0); i >= 0; i = candidate.get(bin).nextSetBit(i + 1)) { if (prop.iSizes[dim][i] == 0) { continue; } // ISSUE 86: the event 'i removed from bin' can already been in the propagation stack but not yet considered // ie. !prop.bins[i].contains(bin) && candidate[bin].contains(i): in this case, do not process it yet if (prop.bins[i].removeValue(bin, prop)) { candidate.get(bin).clear(i); prop.updateLoads(i, bin); if (prop.bins[i].isInstantiated()) { prop.assignItem(i, prop.bins[i].getValue()); } } } if (candidate.get(bin).isEmpty()) { assert prop.potentialLoad[dim][bin].get() == prop.assignedLoad[dim][bin].get(); assert prop.loads[dim][bin].getUB() == prop.potentialLoad[dim][bin].get(); } }
[ "@", "SuppressWarnings", "(", "\"squid:S3346\"", ")", "private", "void", "filterFullDim", "(", "int", "bin", ",", "int", "dim", ")", "throws", "ContradictionException", "{", "for", "(", "int", "i", "=", "candidate", ".", "get", "(", "bin", ")", ".", "nextS...
remove all candidate items from a bin that is full then synchronize potentialLoad and sup(binLoad) accordingly if an item becomes instantiated then propagate the newly assigned bin @param bin the full bin @throws ContradictionException
[ "remove", "all", "candidate", "items", "from", "a", "bin", "that", "is", "full", "then", "synchronize", "potentialLoad", "and", "sup", "(", "binLoad", ")", "accordingly", "if", "an", "item", "becomes", "instantiated", "then", "propagate", "the", "newly", "assi...
train
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/extensions/pack/KnapsackDecorator.java#L118-L140
qiujiayu/AutoLoadCache
src/main/java/com/jarvis/cache/script/AbstractScriptParser.java
AbstractScriptParser.getRealExpire
public int getRealExpire(int expire, String expireExpression, Object[] arguments, Object result) throws Exception { Integer tmpExpire = null; if (null != expireExpression && expireExpression.length() > 0) { tmpExpire = this.getElValue(expireExpression, null, arguments, result, true, Integer.class); if (null != tmpExpire && tmpExpire.intValue() >= 0) { // 返回缓存时间表达式计算的时间 return tmpExpire.intValue(); } } return expire; }
java
public int getRealExpire(int expire, String expireExpression, Object[] arguments, Object result) throws Exception { Integer tmpExpire = null; if (null != expireExpression && expireExpression.length() > 0) { tmpExpire = this.getElValue(expireExpression, null, arguments, result, true, Integer.class); if (null != tmpExpire && tmpExpire.intValue() >= 0) { // 返回缓存时间表达式计算的时间 return tmpExpire.intValue(); } } return expire; }
[ "public", "int", "getRealExpire", "(", "int", "expire", ",", "String", "expireExpression", ",", "Object", "[", "]", "arguments", ",", "Object", "result", ")", "throws", "Exception", "{", "Integer", "tmpExpire", "=", "null", ";", "if", "(", "null", "!=", "e...
获取真实的缓存时间值 @param expire 缓存时间 @param expireExpression 缓存时间表达式 @param arguments 方法参数 @param result 方法执行返回结果 @return real expire @throws Exception 异常
[ "获取真实的缓存时间值" ]
train
https://github.com/qiujiayu/AutoLoadCache/blob/8121c146f1a420fa6d6832e849acadb547c13622/src/main/java/com/jarvis/cache/script/AbstractScriptParser.java#L188-L198
vigna/Sux4J
src/it/unimi/dsi/sux4j/mph/HypergraphSorter.java
HypergraphSorter.tripleToEdge
public static void tripleToEdge(final long[] triple, final long seed, final int numVertices, final int partSize, final int e[]) { if (numVertices == 0) { e[0] = e[1] = e[2] = -1; return; } final long[] hash = new long[3]; Hashes.spooky4(triple, seed, hash); e[0] = (int)((hash[0] & 0x7FFFFFFFFFFFFFFFL) % partSize); e[1] = (int)(partSize + (hash[1] & 0x7FFFFFFFFFFFFFFFL) % partSize); e[2] = (int)((partSize << 1) + (hash[2] & 0x7FFFFFFFFFFFFFFFL) % partSize); }
java
public static void tripleToEdge(final long[] triple, final long seed, final int numVertices, final int partSize, final int e[]) { if (numVertices == 0) { e[0] = e[1] = e[2] = -1; return; } final long[] hash = new long[3]; Hashes.spooky4(triple, seed, hash); e[0] = (int)((hash[0] & 0x7FFFFFFFFFFFFFFFL) % partSize); e[1] = (int)(partSize + (hash[1] & 0x7FFFFFFFFFFFFFFFL) % partSize); e[2] = (int)((partSize << 1) + (hash[2] & 0x7FFFFFFFFFFFFFFFL) % partSize); }
[ "public", "static", "void", "tripleToEdge", "(", "final", "long", "[", "]", "triple", ",", "final", "long", "seed", ",", "final", "int", "numVertices", ",", "final", "int", "partSize", ",", "final", "int", "e", "[", "]", ")", "{", "if", "(", "numVertic...
Turns a triple of longs into a 3-hyperedge. @param triple a triple of intermediate hashes. @param seed the seed for the hash function. @param numVertices the number of vertices in the underlying hypergraph. @param partSize <code>numVertices</code>/3 (to avoid a division). @param e an array to store the resulting edge. @see #bitVectorToEdge(BitVector, long, int, int, int[])
[ "Turns", "a", "triple", "of", "longs", "into", "a", "3", "-", "hyperedge", "." ]
train
https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/mph/HypergraphSorter.java#L232-L242
MenoData/Time4J
base/src/main/java/net/time4j/AnnualDate.java
AnnualDate.parseXML
public static AnnualDate parseXML(String xml) throws ParseException { if ((xml.length() == 7) && (xml.charAt(0) == '-') && (xml.charAt(1) == '-') && (xml.charAt(4) == '-')) { int m1 = toDigit(xml, 2); int m2 = toDigit(xml, 3); int d1 = toDigit(xml, 5); int d2 = toDigit(xml, 6); return new AnnualDate(m1 * 10 + m2, d1 * 10 + d2); } else { throw new ParseException("Not compatible to standard XML-format: " + xml, xml.length()); } }
java
public static AnnualDate parseXML(String xml) throws ParseException { if ((xml.length() == 7) && (xml.charAt(0) == '-') && (xml.charAt(1) == '-') && (xml.charAt(4) == '-')) { int m1 = toDigit(xml, 2); int m2 = toDigit(xml, 3); int d1 = toDigit(xml, 5); int d2 = toDigit(xml, 6); return new AnnualDate(m1 * 10 + m2, d1 * 10 + d2); } else { throw new ParseException("Not compatible to standard XML-format: " + xml, xml.length()); } }
[ "public", "static", "AnnualDate", "parseXML", "(", "String", "xml", ")", "throws", "ParseException", "{", "if", "(", "(", "xml", ".", "length", "(", ")", "==", "7", ")", "&&", "(", "xml", ".", "charAt", "(", "0", ")", "==", "'", "'", ")", "&&", "...
/*[deutsch] <p>Interpretiert den angegebenen Text als Jahrestag im XML-Format &quot;--MM-dd&quot;. </p> @param xml string compatible to lexical space of xsd:gMonthDay @return AnnualDate @throws ParseException if parsing fails @see #toString()
[ "/", "*", "[", "deutsch", "]", "<p", ">", "Interpretiert", "den", "angegebenen", "Text", "als", "Jahrestag", "im", "XML", "-", "Format", "&quot", ";", "--", "MM", "-", "dd&quot", ";", ".", "<", "/", "p", ">" ]
train
https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/AnnualDate.java#L472-L484
threerings/nenya
core/src/main/java/com/threerings/media/sprite/SpriteManager.java
SpriteManager.getHitSprites
public void getHitSprites (List<Sprite> list, int x, int y) { for (int ii = _sprites.size() - 1; ii >= 0; ii--) { Sprite sprite = _sprites.get(ii); if (sprite.hitTest(x, y)) { list.add(sprite); } } }
java
public void getHitSprites (List<Sprite> list, int x, int y) { for (int ii = _sprites.size() - 1; ii >= 0; ii--) { Sprite sprite = _sprites.get(ii); if (sprite.hitTest(x, y)) { list.add(sprite); } } }
[ "public", "void", "getHitSprites", "(", "List", "<", "Sprite", ">", "list", ",", "int", "x", ",", "int", "y", ")", "{", "for", "(", "int", "ii", "=", "_sprites", ".", "size", "(", ")", "-", "1", ";", "ii", ">=", "0", ";", "ii", "--", ")", "{"...
When an animated view is determining what entity in its view is under the mouse pointer, it may require a list of sprites that are "hit" by a particular pixel. The sprites' bounds are first checked and sprites with bounds that contain the supplied point are further checked for a non-transparent at the specified location. @param list the list to fill with any intersecting sprites, the sprites with the highest render order provided first. @param x the x (screen) coordinate to be checked. @param y the y (screen) coordinate to be checked.
[ "When", "an", "animated", "view", "is", "determining", "what", "entity", "in", "its", "view", "is", "under", "the", "mouse", "pointer", "it", "may", "require", "a", "list", "of", "sprites", "that", "are", "hit", "by", "a", "particular", "pixel", ".", "Th...
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/sprite/SpriteManager.java#L72-L80
NoraUi/NoraUi
src/main/java/com/github/noraui/application/steps/CommonSteps.java
CommonSteps.selectCheckbox
@Lorsque("Je mets à jour la case à cocher '(.*)-(.*)' avec '(.*)' à partir de ces valeurs:") @Then("I update checkbox '(.*)-(.*)' with '(.*)' from these values:") public void selectCheckbox(String page, String elementKey, String value, Map<String, Boolean> values) throws TechnicalException, FailureException { selectCheckbox(Page.getInstance(page).getPageElementByKey('-' + elementKey), value, values); }
java
@Lorsque("Je mets à jour la case à cocher '(.*)-(.*)' avec '(.*)' à partir de ces valeurs:") @Then("I update checkbox '(.*)-(.*)' with '(.*)' from these values:") public void selectCheckbox(String page, String elementKey, String value, Map<String, Boolean> values) throws TechnicalException, FailureException { selectCheckbox(Page.getInstance(page).getPageElementByKey('-' + elementKey), value, values); }
[ "@", "Lorsque", "(", "\"Je mets à jour la case à cocher '(.*)-(.*)' avec '(.*)' à partir de ces valeurs:\")\r", "", "@", "Then", "(", "\"I update checkbox '(.*)-(.*)' with '(.*)' from these values:\"", ")", "public", "void", "selectCheckbox", "(", "String", "page", ",", "String", ...
Updates the value of a html checkbox element with conditions regarding the provided keys/values map. @param page The concerned page of elementKey @param elementKey The key of PageElement to select @param value A key to map with 'values' to find the final right checkbox value @param values A list of keys/values to map a scenario input value with a checkbox value @throws TechnicalException if the scenario encounters a technical error @throws FailureException if the scenario encounters a functional error
[ "Updates", "the", "value", "of", "a", "html", "checkbox", "element", "with", "conditions", "regarding", "the", "provided", "keys", "/", "values", "map", "." ]
train
https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/CommonSteps.java#L912-L916
alkacon/opencms-core
src/org/opencms/db/CmsSubscriptionManager.java
CmsSubscriptionManager.unsubscribeAllResourcesFor
public void unsubscribeAllResourcesFor(CmsObject cms, CmsPrincipal principal) throws CmsException { if (!isEnabled()) { throw new CmsRuntimeException(Messages.get().container(Messages.ERR_SUBSCRIPTION_MANAGER_DISABLED_0)); } m_securityManager.unsubscribeAllResourcesFor(cms.getRequestContext(), getPoolName(), principal); }
java
public void unsubscribeAllResourcesFor(CmsObject cms, CmsPrincipal principal) throws CmsException { if (!isEnabled()) { throw new CmsRuntimeException(Messages.get().container(Messages.ERR_SUBSCRIPTION_MANAGER_DISABLED_0)); } m_securityManager.unsubscribeAllResourcesFor(cms.getRequestContext(), getPoolName(), principal); }
[ "public", "void", "unsubscribeAllResourcesFor", "(", "CmsObject", "cms", ",", "CmsPrincipal", "principal", ")", "throws", "CmsException", "{", "if", "(", "!", "isEnabled", "(", ")", ")", "{", "throw", "new", "CmsRuntimeException", "(", "Messages", ".", "get", ...
Unsubscribes the user or group from all resources.<p> @param cms the current users context @param principal the principal that unsubscribes from all resources @throws CmsException if something goes wrong
[ "Unsubscribes", "the", "user", "or", "group", "from", "all", "resources", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSubscriptionManager.java#L426-L432
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/BlogApi.java
BlogApi.postPhoto
public Response postPhoto(String blogId, String photoId, String title, String description, String blogPassword, String serviceId) throws JinxException { JinxUtils.validateParams(photoId, title, description); Map<String, String> params = new TreeMap<String, String>(); params.put("method", "flickr.blogs.postPhoto"); params.put("photo_id", photoId); params.put("title", title); params.put("description", description); if (blogId != null) { params.put("blog_id", blogId); } if (blogPassword != null) { params.put("blog_password", blogPassword); } if (serviceId != null) { params.put("service", serviceId); } return jinx.flickrPost(params, Response.class); }
java
public Response postPhoto(String blogId, String photoId, String title, String description, String blogPassword, String serviceId) throws JinxException { JinxUtils.validateParams(photoId, title, description); Map<String, String> params = new TreeMap<String, String>(); params.put("method", "flickr.blogs.postPhoto"); params.put("photo_id", photoId); params.put("title", title); params.put("description", description); if (blogId != null) { params.put("blog_id", blogId); } if (blogPassword != null) { params.put("blog_password", blogPassword); } if (serviceId != null) { params.put("service", serviceId); } return jinx.flickrPost(params, Response.class); }
[ "public", "Response", "postPhoto", "(", "String", "blogId", ",", "String", "photoId", ",", "String", "title", ",", "String", "description", ",", "String", "blogPassword", ",", "String", "serviceId", ")", "throws", "JinxException", "{", "JinxUtils", ".", "validat...
Post a photo to a blogging service. <br> Authentication <br> This method requires authentication with 'write' permission. <br> Note: This method requires an HTTP POST request. <br> <br> This method has no specific response - It returns an empty success response if it completes without error. <p> The blogId and serviceId are marked optional, but you must provide one of them so that Flickr knows where you want to post the photo. </p> @param blogId (Optional) the id of the blog to post to. @param photoId (Required) the id of the photo to blog @param title (Required) the blog post title @param description (Required) the blog post body @param blogPassword (Optional) the password for the blog (used when the blog does not have a stored password). @param serviceId (Optional) a Flickr supported blogging service. Instead of passing a blog id you can pass a service id and we'll post to the first blog of that service we find. @return response object indicating success or fail. @throws JinxException if required parameters are missing or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.blogs.postPhoto.html">flickr.blogs.postPhoto</a>
[ "Post", "a", "photo", "to", "a", "blogging", "service", ".", "<br", ">", "Authentication", "<br", ">", "This", "method", "requires", "authentication", "with", "write", "permission", ".", "<br", ">", "Note", ":", "This", "method", "requires", "an", "HTTP", ...
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/BlogApi.java#L109-L128
landawn/AbacusUtil
src/com/landawn/abacus/util/DateUtil.java
DateUtil.setMonths
public static <T extends java.util.Date> T setMonths(final T date, final int amount) { return set(date, Calendar.MONTH, amount); }
java
public static <T extends java.util.Date> T setMonths(final T date, final int amount) { return set(date, Calendar.MONTH, amount); }
[ "public", "static", "<", "T", "extends", "java", ".", "util", ".", "Date", ">", "T", "setMonths", "(", "final", "T", "date", ",", "final", "int", "amount", ")", "{", "return", "set", "(", "date", ",", "Calendar", ".", "MONTH", ",", "amount", ")", "...
Copied from Apache Commons Lang under Apache License v2. <br /> Sets the months field to a date returning a new object. The original {@code Date} is unchanged. @param date the date, not null @param amount the amount to set @return a new {@code Date} set with the specified value @throws IllegalArgumentException if the date is null @since 2.4
[ "Copied", "from", "Apache", "Commons", "Lang", "under", "Apache", "License", "v2", ".", "<br", "/", ">" ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/DateUtil.java#L714-L716
undertow-io/undertow
core/src/main/java/io/undertow/Handlers.java
Handlers.requestLimitingHandler
public static RequestLimitingHandler requestLimitingHandler(final int maxRequest, final int queueSize, HttpHandler next) { return new RequestLimitingHandler(maxRequest, queueSize, next); }
java
public static RequestLimitingHandler requestLimitingHandler(final int maxRequest, final int queueSize, HttpHandler next) { return new RequestLimitingHandler(maxRequest, queueSize, next); }
[ "public", "static", "RequestLimitingHandler", "requestLimitingHandler", "(", "final", "int", "maxRequest", ",", "final", "int", "queueSize", ",", "HttpHandler", "next", ")", "{", "return", "new", "RequestLimitingHandler", "(", "maxRequest", ",", "queueSize", ",", "n...
Returns a handler that limits the maximum number of requests that can run at a time. @param maxRequest The maximum number of requests @param queueSize The maximum number of queued requests @param next The next handler @return The handler
[ "Returns", "a", "handler", "that", "limits", "the", "maximum", "number", "of", "requests", "that", "can", "run", "at", "a", "time", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/Handlers.java#L465-L467
xebia/Xebium
src/main/java/com/xebia/incubator/xebium/SeleniumDriverFixture.java
SeleniumDriverFixture.doOnWith
public boolean doOnWith(final String command, final String target, final String value) { LOG.info("Performing | " + command + " | " + target + " | " + value + " |"); return executeDoCommand(command, new String[] { unalias(target), unalias(value) }); }
java
public boolean doOnWith(final String command, final String target, final String value) { LOG.info("Performing | " + command + " | " + target + " | " + value + " |"); return executeDoCommand(command, new String[] { unalias(target), unalias(value) }); }
[ "public", "boolean", "doOnWith", "(", "final", "String", "command", ",", "final", "String", "target", ",", "final", "String", "value", ")", "{", "LOG", ".", "info", "(", "\"Performing | \"", "+", "command", "+", "\" | \"", "+", "target", "+", "\" | \"", "+...
<p><code> | ensure | do | <i>type</i> | on | <i>searchString</i> | with | <i>some text</i> | </code></p> @param command @param target @param value @return
[ "<p", ">", "<code", ">", "|", "ensure", "|", "do", "|", "<i", ">", "type<", "/", "i", ">", "|", "on", "|", "<i", ">", "searchString<", "/", "i", ">", "|", "with", "|", "<i", ">", "some", "text<", "/", "i", ">", "|", "<", "/", "code", ">", ...
train
https://github.com/xebia/Xebium/blob/594f6d9e65622acdbd03dba0700b17645981da1f/src/main/java/com/xebia/incubator/xebium/SeleniumDriverFixture.java#L370-L373
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2017_06_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2017_06_01_preview/implementation/RegistriesInner.java
RegistriesInner.beginUpdate
public RegistryInner beginUpdate(String resourceGroupName, String registryName, RegistryUpdateParameters registryUpdateParameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, registryName, registryUpdateParameters).toBlocking().single().body(); }
java
public RegistryInner beginUpdate(String resourceGroupName, String registryName, RegistryUpdateParameters registryUpdateParameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, registryName, registryUpdateParameters).toBlocking().single().body(); }
[ "public", "RegistryInner", "beginUpdate", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "RegistryUpdateParameters", "registryUpdateParameters", ")", "{", "return", "beginUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "registryName", ...
Updates a container registry with the specified parameters. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param registryUpdateParameters The parameters for updating a container registry. @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 RegistryInner object if successful.
[ "Updates", "a", "container", "registry", "with", "the", "specified", "parameters", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2017_06_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2017_06_01_preview/implementation/RegistriesInner.java#L717-L719
Netflix/spectator
spectator-web-spring/src/main/java/com/netflix/spectator/controllers/MetricsController.java
MetricsController.encodeRegistry
Map<String, MetricValues> encodeRegistry( Registry sourceRegistry, Predicate<Measurement> filter) { Map<String, MetricValues> metricMap = new HashMap<>(); /* * Flatten the meter measurements into a map of measurements keyed by * the name and mapped to the different tag variants. */ for (Meter meter : sourceRegistry) { String kind = knownMeterKinds.computeIfAbsent( meter.id(), k -> meterToKind(sourceRegistry, meter)); for (Measurement measurement : meter.measure()) { if (!filter.test(measurement)) { continue; } if (Double.isNaN(measurement.value())) { continue; } String meterName = measurement.id().name(); MetricValues have = metricMap.get(meterName); if (have == null) { metricMap.put(meterName, new MetricValues(kind, measurement)); } else { have.addMeasurement(measurement); } } } return metricMap; }
java
Map<String, MetricValues> encodeRegistry( Registry sourceRegistry, Predicate<Measurement> filter) { Map<String, MetricValues> metricMap = new HashMap<>(); /* * Flatten the meter measurements into a map of measurements keyed by * the name and mapped to the different tag variants. */ for (Meter meter : sourceRegistry) { String kind = knownMeterKinds.computeIfAbsent( meter.id(), k -> meterToKind(sourceRegistry, meter)); for (Measurement measurement : meter.measure()) { if (!filter.test(measurement)) { continue; } if (Double.isNaN(measurement.value())) { continue; } String meterName = measurement.id().name(); MetricValues have = metricMap.get(meterName); if (have == null) { metricMap.put(meterName, new MetricValues(kind, measurement)); } else { have.addMeasurement(measurement); } } } return metricMap; }
[ "Map", "<", "String", ",", "MetricValues", ">", "encodeRegistry", "(", "Registry", "sourceRegistry", ",", "Predicate", "<", "Measurement", ">", "filter", ")", "{", "Map", "<", "String", ",", "MetricValues", ">", "metricMap", "=", "new", "HashMap", "<>", "(",...
Internal API for encoding a registry that can be encoded as JSON. This is a helper function for the REST endpoint and to test against.
[ "Internal", "API", "for", "encoding", "a", "registry", "that", "can", "be", "encoded", "as", "JSON", ".", "This", "is", "a", "helper", "function", "for", "the", "REST", "endpoint", "and", "to", "test", "against", "." ]
train
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-web-spring/src/main/java/com/netflix/spectator/controllers/MetricsController.java#L126-L156
ThreeTen/threetenbp
src/main/java/org/threeten/bp/format/DateTimeFormatterBuilder.java
DateTimeFormatterBuilder.appendInternal
private int appendInternal(DateTimePrinterParser pp) { Jdk8Methods.requireNonNull(pp, "pp"); if (active.padNextWidth > 0) { if (pp != null) { pp = new PadPrinterParserDecorator(pp, active.padNextWidth, active.padNextChar); } active.padNextWidth = 0; active.padNextChar = 0; } active.printerParsers.add(pp); active.valueParserIndex = -1; return active.printerParsers.size() - 1; }
java
private int appendInternal(DateTimePrinterParser pp) { Jdk8Methods.requireNonNull(pp, "pp"); if (active.padNextWidth > 0) { if (pp != null) { pp = new PadPrinterParserDecorator(pp, active.padNextWidth, active.padNextChar); } active.padNextWidth = 0; active.padNextChar = 0; } active.printerParsers.add(pp); active.valueParserIndex = -1; return active.printerParsers.size() - 1; }
[ "private", "int", "appendInternal", "(", "DateTimePrinterParser", "pp", ")", "{", "Jdk8Methods", ".", "requireNonNull", "(", "pp", ",", "\"pp\"", ")", ";", "if", "(", "active", ".", "padNextWidth", ">", "0", ")", "{", "if", "(", "pp", "!=", "null", ")", ...
Appends a printer and/or parser to the internal list handling padding. @param pp the printer-parser to add, not null @return the index into the active parsers list
[ "Appends", "a", "printer", "and", "/", "or", "parser", "to", "the", "internal", "list", "handling", "padding", "." ]
train
https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/format/DateTimeFormatterBuilder.java#L1834-L1846
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java
AppServiceCertificateOrdersInner.resendEmailAsync
public Observable<Void> resendEmailAsync(String resourceGroupName, String certificateOrderName) { return resendEmailWithServiceResponseAsync(resourceGroupName, certificateOrderName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> resendEmailAsync(String resourceGroupName, String certificateOrderName) { return resendEmailWithServiceResponseAsync(resourceGroupName, certificateOrderName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "resendEmailAsync", "(", "String", "resourceGroupName", ",", "String", "certificateOrderName", ")", "{", "return", "resendEmailWithServiceResponseAsync", "(", "resourceGroupName", ",", "certificateOrderName", ")", ".", "map", "(...
Resend certificate email. Resend certificate email. @param resourceGroupName Name of the resource group to which the resource belongs. @param certificateOrderName Name of the certificate order. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Resend", "certificate", "email", ".", "Resend", "certificate", "email", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java#L1804-L1811
zxing/zxing
android/src/com/google/zxing/client/android/camera/CameraManager.java
CameraManager.setTorch
public synchronized void setTorch(boolean newSetting) { OpenCamera theCamera = camera; if (theCamera != null && newSetting != configManager.getTorchState(theCamera.getCamera())) { boolean wasAutoFocusManager = autoFocusManager != null; if (wasAutoFocusManager) { autoFocusManager.stop(); autoFocusManager = null; } configManager.setTorch(theCamera.getCamera(), newSetting); if (wasAutoFocusManager) { autoFocusManager = new AutoFocusManager(context, theCamera.getCamera()); autoFocusManager.start(); } } }
java
public synchronized void setTorch(boolean newSetting) { OpenCamera theCamera = camera; if (theCamera != null && newSetting != configManager.getTorchState(theCamera.getCamera())) { boolean wasAutoFocusManager = autoFocusManager != null; if (wasAutoFocusManager) { autoFocusManager.stop(); autoFocusManager = null; } configManager.setTorch(theCamera.getCamera(), newSetting); if (wasAutoFocusManager) { autoFocusManager = new AutoFocusManager(context, theCamera.getCamera()); autoFocusManager.start(); } } }
[ "public", "synchronized", "void", "setTorch", "(", "boolean", "newSetting", ")", "{", "OpenCamera", "theCamera", "=", "camera", ";", "if", "(", "theCamera", "!=", "null", "&&", "newSetting", "!=", "configManager", ".", "getTorchState", "(", "theCamera", ".", "...
Convenience method for {@link com.google.zxing.client.android.CaptureActivity} @param newSetting if {@code true}, light should be turned on if currently off. And vice versa.
[ "Convenience", "method", "for", "{", "@link", "com", ".", "google", ".", "zxing", ".", "client", ".", "android", ".", "CaptureActivity", "}" ]
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android/src/com/google/zxing/client/android/camera/CameraManager.java#L174-L188
jlinn/quartz-redis-jobstore
src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java
AbstractRedisStorage.applyMisfire
protected boolean applyMisfire(OperableTrigger trigger, T jedis) throws JobPersistenceException { long misfireTime = System.currentTimeMillis(); if(misfireThreshold > 0){ misfireTime -= misfireThreshold; } final Date nextFireTime = trigger.getNextFireTime(); if(nextFireTime == null || nextFireTime.getTime() > misfireTime || trigger.getMisfireInstruction() == Trigger.MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY){ return false; } Calendar calendar = null; if(trigger.getCalendarName() != null){ calendar = retrieveCalendar(trigger.getCalendarName(), jedis); } signaler.notifyTriggerListenersMisfired((OperableTrigger) trigger.clone()); trigger.updateAfterMisfire(calendar); storeTrigger(trigger, true, jedis); if(trigger.getNextFireTime() == null){ setTriggerState(RedisTriggerState.COMPLETED, (double) System.currentTimeMillis(), redisSchema.triggerHashKey(trigger.getKey()), jedis); signaler.notifySchedulerListenersFinalized(trigger); } else if(nextFireTime.equals(trigger.getNextFireTime())){ return false; } return true; }
java
protected boolean applyMisfire(OperableTrigger trigger, T jedis) throws JobPersistenceException { long misfireTime = System.currentTimeMillis(); if(misfireThreshold > 0){ misfireTime -= misfireThreshold; } final Date nextFireTime = trigger.getNextFireTime(); if(nextFireTime == null || nextFireTime.getTime() > misfireTime || trigger.getMisfireInstruction() == Trigger.MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY){ return false; } Calendar calendar = null; if(trigger.getCalendarName() != null){ calendar = retrieveCalendar(trigger.getCalendarName(), jedis); } signaler.notifyTriggerListenersMisfired((OperableTrigger) trigger.clone()); trigger.updateAfterMisfire(calendar); storeTrigger(trigger, true, jedis); if(trigger.getNextFireTime() == null){ setTriggerState(RedisTriggerState.COMPLETED, (double) System.currentTimeMillis(), redisSchema.triggerHashKey(trigger.getKey()), jedis); signaler.notifySchedulerListenersFinalized(trigger); } else if(nextFireTime.equals(trigger.getNextFireTime())){ return false; } return true; }
[ "protected", "boolean", "applyMisfire", "(", "OperableTrigger", "trigger", ",", "T", "jedis", ")", "throws", "JobPersistenceException", "{", "long", "misfireTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "if", "(", "misfireThreshold", ">", "0", "...
Determine whether or not the given trigger has misfired. If so, notify the {@link org.quartz.spi.SchedulerSignaler} and update the trigger. @param trigger the trigger to check for misfire @param jedis a thread-safe Redis connection @return false if the trigger has misfired; true otherwise @throws JobPersistenceException
[ "Determine", "whether", "or", "not", "the", "given", "trigger", "has", "misfired", ".", "If", "so", "notify", "the", "{" ]
train
https://github.com/jlinn/quartz-redis-jobstore/blob/be9a52ee776d8a09866fe99fd9718bc13a0cb992/src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java#L560-L588
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRSceneObject.java
GVRSceneObject.prettyPrint
public void prettyPrint(StringBuffer sb, int indent) { sb.append(Log.getSpaces(indent)); sb.append(getClass().getSimpleName()); sb.append(" [name="); sb.append(this.getName()); sb.append("]"); sb.append(System.lineSeparator()); GVRRenderData rdata = getRenderData(); GVRTransform trans = getTransform(); if (rdata == null) { sb.append(Log.getSpaces(indent + 2)); sb.append("RenderData: null"); sb.append(System.lineSeparator()); } else { rdata.prettyPrint(sb, indent + 2); } sb.append(Log.getSpaces(indent + 2)); sb.append("Transform: "); sb.append(trans); sb.append(System.lineSeparator()); // dump its children for (GVRSceneObject child : getChildren()) { child.prettyPrint(sb, indent + 2); } }
java
public void prettyPrint(StringBuffer sb, int indent) { sb.append(Log.getSpaces(indent)); sb.append(getClass().getSimpleName()); sb.append(" [name="); sb.append(this.getName()); sb.append("]"); sb.append(System.lineSeparator()); GVRRenderData rdata = getRenderData(); GVRTransform trans = getTransform(); if (rdata == null) { sb.append(Log.getSpaces(indent + 2)); sb.append("RenderData: null"); sb.append(System.lineSeparator()); } else { rdata.prettyPrint(sb, indent + 2); } sb.append(Log.getSpaces(indent + 2)); sb.append("Transform: "); sb.append(trans); sb.append(System.lineSeparator()); // dump its children for (GVRSceneObject child : getChildren()) { child.prettyPrint(sb, indent + 2); } }
[ "public", "void", "prettyPrint", "(", "StringBuffer", "sb", ",", "int", "indent", ")", "{", "sb", ".", "append", "(", "Log", ".", "getSpaces", "(", "indent", ")", ")", ";", "sb", ".", "append", "(", "getClass", "(", ")", ".", "getSimpleName", "(", ")...
Generate debug dump of the tree from the scene object. It should include a newline character at the end. @param sb the {@code StringBuffer} to dump the object. @param indent indentation level as number of spaces.
[ "Generate", "debug", "dump", "of", "the", "tree", "from", "the", "scene", "object", ".", "It", "should", "include", "a", "newline", "character", "at", "the", "end", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRSceneObject.java#L1183-L1208
thombergs/docx-stamper
src/main/java/org/wickedsource/docxstamper/el/ExpressionResolver.java
ExpressionResolver.resolveExpression
public Object resolveExpression(String expressionString, Object contextRoot) { if ((expressionString.startsWith("${") || expressionString.startsWith("#{")) && expressionString.endsWith("}")) { expressionString = expressionUtil.stripExpression(expressionString); } ExpressionParser parser = new SpelExpressionParser(); StandardEvaluationContext evaluationContext = new StandardEvaluationContext(contextRoot); evaluationContextConfigurer.configureEvaluationContext(evaluationContext); Expression expression = parser.parseExpression(expressionString); return expression.getValue(evaluationContext); }
java
public Object resolveExpression(String expressionString, Object contextRoot) { if ((expressionString.startsWith("${") || expressionString.startsWith("#{")) && expressionString.endsWith("}")) { expressionString = expressionUtil.stripExpression(expressionString); } ExpressionParser parser = new SpelExpressionParser(); StandardEvaluationContext evaluationContext = new StandardEvaluationContext(contextRoot); evaluationContextConfigurer.configureEvaluationContext(evaluationContext); Expression expression = parser.parseExpression(expressionString); return expression.getValue(evaluationContext); }
[ "public", "Object", "resolveExpression", "(", "String", "expressionString", ",", "Object", "contextRoot", ")", "{", "if", "(", "(", "expressionString", ".", "startsWith", "(", "\"${\"", ")", "||", "expressionString", ".", "startsWith", "(", "\"#{\"", ")", ")", ...
Runs the given expression against the given context object and returns the result of the evaluated expression. @param expressionString the expression to evaluate. @param contextRoot the context object against which the expression is evaluated. @return the result of the evaluated expression.
[ "Runs", "the", "given", "expression", "against", "the", "given", "context", "object", "and", "returns", "the", "result", "of", "the", "evaluated", "expression", "." ]
train
https://github.com/thombergs/docx-stamper/blob/f1a7e3e92a59abaffac299532fe49450c3b041eb/src/main/java/org/wickedsource/docxstamper/el/ExpressionResolver.java#L30-L39
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapComposedElement.java
MapComposedElement.addPoint
public int addPoint(double x, double y, int groupIndex) { final int groupCount = getGroupCount(); if (groupIndex < 0) { throw new IndexOutOfBoundsException(groupIndex + "<0"); //$NON-NLS-1$ } if (groupIndex >= groupCount) { throw new IndexOutOfBoundsException(groupIndex + ">=" + groupCount); //$NON-NLS-1$ } int pointIndex; if (this.pointCoordinates == null) { this.pointCoordinates = new double[] {x, y}; this.partIndexes = null; pointIndex = 0; } else { pointIndex = lastInGroup(groupIndex); double[] pts = new double[this.pointCoordinates.length + 2]; pointIndex += 2; System.arraycopy(this.pointCoordinates, 0, pts, 0, pointIndex); System.arraycopy(this.pointCoordinates, pointIndex, pts, pointIndex + 2, this.pointCoordinates.length - pointIndex); pts[pointIndex] = x; pts[pointIndex + 1] = y; this.pointCoordinates = pts; pts = null; //Shift the following groups's indexes if (this.partIndexes != null) { for (int idx = groupIndex; idx < this.partIndexes.length; ++idx) { this.partIndexes[idx] += 2; } } pointIndex /= 2.; } fireShapeChanged(); fireElementChanged(); return pointIndex; }
java
public int addPoint(double x, double y, int groupIndex) { final int groupCount = getGroupCount(); if (groupIndex < 0) { throw new IndexOutOfBoundsException(groupIndex + "<0"); //$NON-NLS-1$ } if (groupIndex >= groupCount) { throw new IndexOutOfBoundsException(groupIndex + ">=" + groupCount); //$NON-NLS-1$ } int pointIndex; if (this.pointCoordinates == null) { this.pointCoordinates = new double[] {x, y}; this.partIndexes = null; pointIndex = 0; } else { pointIndex = lastInGroup(groupIndex); double[] pts = new double[this.pointCoordinates.length + 2]; pointIndex += 2; System.arraycopy(this.pointCoordinates, 0, pts, 0, pointIndex); System.arraycopy(this.pointCoordinates, pointIndex, pts, pointIndex + 2, this.pointCoordinates.length - pointIndex); pts[pointIndex] = x; pts[pointIndex + 1] = y; this.pointCoordinates = pts; pts = null; //Shift the following groups's indexes if (this.partIndexes != null) { for (int idx = groupIndex; idx < this.partIndexes.length; ++idx) { this.partIndexes[idx] += 2; } } pointIndex /= 2.; } fireShapeChanged(); fireElementChanged(); return pointIndex; }
[ "public", "int", "addPoint", "(", "double", "x", ",", "double", "y", ",", "int", "groupIndex", ")", "{", "final", "int", "groupCount", "=", "getGroupCount", "(", ")", ";", "if", "(", "groupIndex", "<", "0", ")", "{", "throw", "new", "IndexOutOfBoundsExce...
Add the specified point at the end of the specified group. @param x x coordinate @param y y coordinate @param groupIndex the index of the group. @return the index of the point in the element. @throws IndexOutOfBoundsException in case of error.
[ "Add", "the", "specified", "point", "at", "the", "end", "of", "the", "specified", "group", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapComposedElement.java#L604-L647
oboehm/jfachwert
src/main/java/de/jfachwert/bank/Geldbetrag.java
Geldbetrag.ofMinor
public static Geldbetrag ofMinor(CurrencyUnit currency, long amountMinor, int fractionDigits) { return of(BigDecimal.valueOf(amountMinor, fractionDigits), currency); }
java
public static Geldbetrag ofMinor(CurrencyUnit currency, long amountMinor, int fractionDigits) { return of(BigDecimal.valueOf(amountMinor, fractionDigits), currency); }
[ "public", "static", "Geldbetrag", "ofMinor", "(", "CurrencyUnit", "currency", ",", "long", "amountMinor", ",", "int", "fractionDigits", ")", "{", "return", "of", "(", "BigDecimal", ".", "valueOf", "(", "amountMinor", ",", "fractionDigits", ")", ",", "currency", ...
Legt einen Geldbetrag unter Angabe der Unter-Einheit an. So liefert {@code ofMinor(EUR, 12345)} die Instanz fuer '123,45 EUR' zurueck. <p> Die Methode wurde aus Kompatibitaetsgrunden zur Money-Klasse hinzugefuegt. </p> @param currency Waehrung @param amountMinor Betrag der Unter-Einzeit (z.B. 12345 Cents) @param fractionDigits Anzahl der Nachkommastellen @return Geldbetrag @since 1.0.1
[ "Legt", "einen", "Geldbetrag", "unter", "Angabe", "der", "Unter", "-", "Einheit", "an", ".", "So", "liefert", "{", "@code", "ofMinor", "(", "EUR", "12345", ")", "}", "die", "Instanz", "fuer", "123", "45", "EUR", "zurueck", ".", "<p", ">", "Die", "Metho...
train
https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/bank/Geldbetrag.java#L208-L210
Azure/azure-sdk-for-java
storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java
StorageAccountsInner.getManagementPolicies
public StorageAccountManagementPoliciesInner getManagementPolicies(String resourceGroupName, String accountName) { return getManagementPoliciesWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); }
java
public StorageAccountManagementPoliciesInner getManagementPolicies(String resourceGroupName, String accountName) { return getManagementPoliciesWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); }
[ "public", "StorageAccountManagementPoliciesInner", "getManagementPolicies", "(", "String", "resourceGroupName", ",", "String", "accountName", ")", "{", "return", "getManagementPoliciesWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ")", ".", "toBlocking...
Gets the data policy rules associated with the specified storage account. @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. @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 StorageAccountManagementPoliciesInner object if successful.
[ "Gets", "the", "data", "policy", "rules", "associated", "with", "the", "specified", "storage", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java#L1202-L1204
elki-project/elki
elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/cash/ParameterizationFunction.java
ParameterizationFunction.determineGlobalExtremum
private void determineGlobalExtremum() { alphaExtremum = new double[vec.getDimensionality() - 1]; for(int n = alphaExtremum.length - 1; n >= 0; n--) { alphaExtremum[n] = extremum_alpha_n(n, alphaExtremum); if(Double.isNaN(alphaExtremum[n])) { throw new IllegalStateException("Houston, we have a problem!\n" + this + "\n" + vec + "\n" + FormatUtil.format(alphaExtremum)); } } determineGlobalExtremumType(); }
java
private void determineGlobalExtremum() { alphaExtremum = new double[vec.getDimensionality() - 1]; for(int n = alphaExtremum.length - 1; n >= 0; n--) { alphaExtremum[n] = extremum_alpha_n(n, alphaExtremum); if(Double.isNaN(alphaExtremum[n])) { throw new IllegalStateException("Houston, we have a problem!\n" + this + "\n" + vec + "\n" + FormatUtil.format(alphaExtremum)); } } determineGlobalExtremumType(); }
[ "private", "void", "determineGlobalExtremum", "(", ")", "{", "alphaExtremum", "=", "new", "double", "[", "vec", ".", "getDimensionality", "(", ")", "-", "1", "]", ";", "for", "(", "int", "n", "=", "alphaExtremum", ".", "length", "-", "1", ";", "n", ">=...
Determines the global extremum of this parameterization function.
[ "Determines", "the", "global", "extremum", "of", "this", "parameterization", "function", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/cash/ParameterizationFunction.java#L439-L449
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/AutomationAccountsInner.java
AutomationAccountsInner.createOrUpdate
public AutomationAccountInner createOrUpdate(String resourceGroupName, String automationAccountName, AutomationAccountCreateOrUpdateParameters parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, parameters).toBlocking().single().body(); }
java
public AutomationAccountInner createOrUpdate(String resourceGroupName, String automationAccountName, AutomationAccountCreateOrUpdateParameters parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, parameters).toBlocking().single().body(); }
[ "public", "AutomationAccountInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "AutomationAccountCreateOrUpdateParameters", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ...
Create or update automation account. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param parameters Parameters supplied to the create or update automation account. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the AutomationAccountInner object if successful.
[ "Create", "or", "update", "automation", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/AutomationAccountsInner.java#L207-L209
rey5137/material
material/src/main/java/com/rey/material/widget/EditText.java
EditText.performFiltering
protected void performFiltering(CharSequence text, int keyCode) { switch (mAutoCompleteMode){ case AUTOCOMPLETE_MODE_SINGLE: ((InternalAutoCompleteTextView)mInputView).superPerformFiltering(text, keyCode); break; case AUTOCOMPLETE_MODE_MULTI: ((InternalMultiAutoCompleteTextView)mInputView).superPerformFiltering(text, keyCode); break; } }
java
protected void performFiltering(CharSequence text, int keyCode) { switch (mAutoCompleteMode){ case AUTOCOMPLETE_MODE_SINGLE: ((InternalAutoCompleteTextView)mInputView).superPerformFiltering(text, keyCode); break; case AUTOCOMPLETE_MODE_MULTI: ((InternalMultiAutoCompleteTextView)mInputView).superPerformFiltering(text, keyCode); break; } }
[ "protected", "void", "performFiltering", "(", "CharSequence", "text", ",", "int", "keyCode", ")", "{", "switch", "(", "mAutoCompleteMode", ")", "{", "case", "AUTOCOMPLETE_MODE_SINGLE", ":", "(", "(", "InternalAutoCompleteTextView", ")", "mInputView", ")", ".", "su...
<p>Starts filtering the content of the drop down list. The filtering pattern is the content of the edit box. Subclasses should override this method to filter with a different pattern, for instance a substring of <code>text</code>.</p> @param text the filtering pattern @param keyCode the last character inserted in the edit box; beware that this will be null when text is being added through a soft input method.
[ "<p", ">", "Starts", "filtering", "the", "content", "of", "the", "drop", "down", "list", ".", "The", "filtering", "pattern", "is", "the", "content", "of", "the", "edit", "box", ".", "Subclasses", "should", "override", "this", "method", "to", "filter", "wit...
train
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/EditText.java#L739-L748
openbase/jul
communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractRemoteClient.java
AbstractRemoteClient.callMethod
@Override public <R> R callMethod(String methodName, long timeout) throws CouldNotPerformException, InterruptedException { return callMethod(methodName, null, timeout); }
java
@Override public <R> R callMethod(String methodName, long timeout) throws CouldNotPerformException, InterruptedException { return callMethod(methodName, null, timeout); }
[ "@", "Override", "public", "<", "R", ">", "R", "callMethod", "(", "String", "methodName", ",", "long", "timeout", ")", "throws", "CouldNotPerformException", ",", "InterruptedException", "{", "return", "callMethod", "(", "methodName", ",", "null", ",", "timeout",...
{@inheritDoc} @throws org.openbase.jul.exception.CouldNotPerformException {@inheritDoc} @throws java.lang.InterruptedException {@inheritDoc}
[ "{", "@inheritDoc", "}" ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractRemoteClient.java#L751-L754
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java
MathUtils.idf
public static double idf(double totalDocs, double numTimesWordAppearedInADocument) { //return totalDocs > 0 ? Math.log10(totalDocs/numTimesWordAppearedInADocument) : 0; if (totalDocs == 0) return 0; double idf = Math.log10(totalDocs / numTimesWordAppearedInADocument); return idf; }
java
public static double idf(double totalDocs, double numTimesWordAppearedInADocument) { //return totalDocs > 0 ? Math.log10(totalDocs/numTimesWordAppearedInADocument) : 0; if (totalDocs == 0) return 0; double idf = Math.log10(totalDocs / numTimesWordAppearedInADocument); return idf; }
[ "public", "static", "double", "idf", "(", "double", "totalDocs", ",", "double", "numTimesWordAppearedInADocument", ")", "{", "//return totalDocs > 0 ? Math.log10(totalDocs/numTimesWordAppearedInADocument) : 0;", "if", "(", "totalDocs", "==", "0", ")", "return", "0", ";", ...
Inverse document frequency: the total docs divided by the number of times the word appeared in a document @param totalDocs the total documents for the data applyTransformToDestination @param numTimesWordAppearedInADocument the number of times the word occurred in a document @return log(10) (totalDocs/numTImesWordAppearedInADocument)
[ "Inverse", "document", "frequency", ":", "the", "total", "docs", "divided", "by", "the", "number", "of", "times", "the", "word", "appeared", "in", "a", "document" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java#L256-L262
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlContainerContext.java
ControlContainerContext.dispatchEvent
public Object dispatchEvent(ControlHandle handle, EventRef event, Object [] args) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { ControlBean bean = getBean(handle.getControlID()); if (bean == null) throw new IllegalArgumentException("Invalid bean ID: " + handle.getControlID()); return bean.dispatchEvent(event, args); }
java
public Object dispatchEvent(ControlHandle handle, EventRef event, Object [] args) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { ControlBean bean = getBean(handle.getControlID()); if (bean == null) throw new IllegalArgumentException("Invalid bean ID: " + handle.getControlID()); return bean.dispatchEvent(event, args); }
[ "public", "Object", "dispatchEvent", "(", "ControlHandle", "handle", ",", "EventRef", "event", ",", "Object", "[", "]", "args", ")", "throws", "IllegalArgumentException", ",", "IllegalAccessException", ",", "InvocationTargetException", "{", "ControlBean", "bean", "=",...
Dispatch an operation or an event to a bean within this container bean context. @param handle the control handle identifying the target bean @param event the event to be invoked on the target bean @param args the arguments to be passed to the target method invocation
[ "Dispatch", "an", "operation", "or", "an", "event", "to", "a", "bean", "within", "this", "container", "bean", "context", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlContainerContext.java#L152-L160
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java
AppServiceEnvironmentsInner.listVips
public AddressResponseInner listVips(String resourceGroupName, String name) { return listVipsWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body(); }
java
public AddressResponseInner listVips(String resourceGroupName, String name) { return listVipsWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body(); }
[ "public", "AddressResponseInner", "listVips", "(", "String", "resourceGroupName", ",", "String", "name", ")", "{", "return", "listVipsWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", ...
Get IP addresses assigned to an App Service Environment. Get IP addresses assigned to an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @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 AddressResponseInner object if successful.
[ "Get", "IP", "addresses", "assigned", "to", "an", "App", "Service", "Environment", ".", "Get", "IP", "addresses", "assigned", "to", "an", "App", "Service", "Environment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L1426-L1428
googleapis/google-cloud-java
google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java
DataLabelingServiceClient.listExamples
public final ListExamplesPagedResponse listExamples(String parent, String filter) { ANNOTATED_DATASET_PATH_TEMPLATE.validate(parent, "listExamples"); ListExamplesRequest request = ListExamplesRequest.newBuilder().setParent(parent).setFilter(filter).build(); return listExamples(request); }
java
public final ListExamplesPagedResponse listExamples(String parent, String filter) { ANNOTATED_DATASET_PATH_TEMPLATE.validate(parent, "listExamples"); ListExamplesRequest request = ListExamplesRequest.newBuilder().setParent(parent).setFilter(filter).build(); return listExamples(request); }
[ "public", "final", "ListExamplesPagedResponse", "listExamples", "(", "String", "parent", ",", "String", "filter", ")", "{", "ANNOTATED_DATASET_PATH_TEMPLATE", ".", "validate", "(", "parent", ",", "\"listExamples\"", ")", ";", "ListExamplesRequest", "request", "=", "Li...
Lists examples in an annotated dataset. Pagination is supported. <p>Sample code: <pre><code> try (DataLabelingServiceClient dataLabelingServiceClient = DataLabelingServiceClient.create()) { String formattedParent = DataLabelingServiceClient.formatAnnotatedDatasetName("[PROJECT]", "[DATASET]", "[ANNOTATED_DATASET]"); String filter = ""; for (Example element : dataLabelingServiceClient.listExamples(formattedParent, filter).iterateAll()) { // doThingsWith(element); } } </code></pre> @param parent Required. Example resource parent. @param filter Optional. An expression for filtering Examples. For annotated datasets that have annotation spec set, filter by annotation_spec.display_name is supported. Format "annotation_spec.display_name = {display_name}" @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Lists", "examples", "in", "an", "annotated", "dataset", ".", "Pagination", "is", "supported", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java#L1990-L1995
OpenFeign/feign
core/src/main/java/feign/template/UriUtils.java
UriUtils.queryParamEncode
public static String queryParamEncode(String queryParam, Charset charset) { return encodeReserved(queryParam, FragmentType.QUERY_PARAM, charset); }
java
public static String queryParamEncode(String queryParam, Charset charset) { return encodeReserved(queryParam, FragmentType.QUERY_PARAM, charset); }
[ "public", "static", "String", "queryParamEncode", "(", "String", "queryParam", ",", "Charset", "charset", ")", "{", "return", "encodeReserved", "(", "queryParam", ",", "FragmentType", ".", "QUERY_PARAM", ",", "charset", ")", ";", "}" ]
Uri Encode a Query Parameter name or value. @param queryParam containing the query parameter. @param charset to use. @return the encoded query fragment.
[ "Uri", "Encode", "a", "Query", "Parameter", "name", "or", "value", "." ]
train
https://github.com/OpenFeign/feign/blob/318fb0e955b8cfcf64f70d6aeea0ba5795f8a7eb/core/src/main/java/feign/template/UriUtils.java#L117-L119
ZuInnoTe/hadoopcryptoledger
examples/spark-bitcoinblock/src/main/java/org/zuinnote/spark/bitcoin/example/SparkBitcoinBlockCounter.java
SparkBitcoinBlockCounter.jobTotalNumOfTransactions
public static void jobTotalNumOfTransactions(JavaSparkContext sc, Configuration hadoopConf, String inputFile, String outputFile) { // read bitcoin data from HDFS JavaPairRDD<BytesWritable, BitcoinBlock> bitcoinBlocksRDD = sc.newAPIHadoopFile(inputFile, BitcoinBlockFileInputFormat.class, BytesWritable.class, BitcoinBlock.class,hadoopConf); // extract the no transactions / block (map) JavaPairRDD<String, Long> noOfTransactionPair = bitcoinBlocksRDD.mapToPair(new PairFunction<Tuple2<BytesWritable,BitcoinBlock>, String, Long>() { @Override public Tuple2<String, Long> call(Tuple2<BytesWritable,BitcoinBlock> tupleBlock) { return mapNoOfTransaction(tupleBlock._2()); } }); // combine the results from all blocks JavaPairRDD<String, Long> totalCount = noOfTransactionPair.reduceByKey(new Function2<Long, Long, Long>() { @Override public Long call(Long a, Long b) { return reduceSumUpTransactions(a,b); } }); // write results to HDFS totalCount.repartition(1).saveAsTextFile(outputFile); }
java
public static void jobTotalNumOfTransactions(JavaSparkContext sc, Configuration hadoopConf, String inputFile, String outputFile) { // read bitcoin data from HDFS JavaPairRDD<BytesWritable, BitcoinBlock> bitcoinBlocksRDD = sc.newAPIHadoopFile(inputFile, BitcoinBlockFileInputFormat.class, BytesWritable.class, BitcoinBlock.class,hadoopConf); // extract the no transactions / block (map) JavaPairRDD<String, Long> noOfTransactionPair = bitcoinBlocksRDD.mapToPair(new PairFunction<Tuple2<BytesWritable,BitcoinBlock>, String, Long>() { @Override public Tuple2<String, Long> call(Tuple2<BytesWritable,BitcoinBlock> tupleBlock) { return mapNoOfTransaction(tupleBlock._2()); } }); // combine the results from all blocks JavaPairRDD<String, Long> totalCount = noOfTransactionPair.reduceByKey(new Function2<Long, Long, Long>() { @Override public Long call(Long a, Long b) { return reduceSumUpTransactions(a,b); } }); // write results to HDFS totalCount.repartition(1).saveAsTextFile(outputFile); }
[ "public", "static", "void", "jobTotalNumOfTransactions", "(", "JavaSparkContext", "sc", ",", "Configuration", "hadoopConf", ",", "String", "inputFile", ",", "String", "outputFile", ")", "{", "// read bitcoin data from HDFS", "JavaPairRDD", "<", "BytesWritable", ",", "Bi...
a job for counting the total number of transactions @param sc context @param hadoopConf Configuration for input format @param inputFile Input file @param output outputFile file
[ "a", "job", "for", "counting", "the", "total", "number", "of", "transactions" ]
train
https://github.com/ZuInnoTe/hadoopcryptoledger/blob/5c9bfb61dd1a82374cd0de8413a7c66391ee4414/examples/spark-bitcoinblock/src/main/java/org/zuinnote/spark/bitcoin/example/SparkBitcoinBlockCounter.java#L80-L99
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/matchers/structure/tree/spsm/ted/TreeEditDistance.java
TreeEditDistance.getWorstCaseSubstituteAll
public double getWorstCaseSubstituteAll() { double worstCase = -1; // make a copy of editDistanceGraph SimpleDirectedWeightedGraph worstCaseGraph = new SimpleDirectedWeightedGraph(); Set vertices = editDistanceGraph.vertexSet(); Set edges = editDistanceGraph.edgeSet(); worstCaseGraph.addAllVertices(vertices); worstCaseGraph.addAllEdges(edges); edges = worstCaseGraph.edgeSet(); for (Object o : edges) { Edge edge = (Edge) o; GraphVertexTuple vertex1 = (GraphVertexTuple) edge.getSource(); GraphVertexTuple vertex2 = (GraphVertexTuple) edge.getTarget(); // check if this edge is a diagonal if (vertex2.getLeft() == vertex1.getLeft() + 1 && vertex2.getRight() == vertex1.getRight() + 1) { edge.setWeight(weightSubstitute); } } DijkstraShortestPath shortestPath = new DijkstraShortestPath(worstCaseGraph, firstVertex, lastVertex, pathLengthLimit); worstCase = shortestPath.getPathLength(); return worstCase; }
java
public double getWorstCaseSubstituteAll() { double worstCase = -1; // make a copy of editDistanceGraph SimpleDirectedWeightedGraph worstCaseGraph = new SimpleDirectedWeightedGraph(); Set vertices = editDistanceGraph.vertexSet(); Set edges = editDistanceGraph.edgeSet(); worstCaseGraph.addAllVertices(vertices); worstCaseGraph.addAllEdges(edges); edges = worstCaseGraph.edgeSet(); for (Object o : edges) { Edge edge = (Edge) o; GraphVertexTuple vertex1 = (GraphVertexTuple) edge.getSource(); GraphVertexTuple vertex2 = (GraphVertexTuple) edge.getTarget(); // check if this edge is a diagonal if (vertex2.getLeft() == vertex1.getLeft() + 1 && vertex2.getRight() == vertex1.getRight() + 1) { edge.setWeight(weightSubstitute); } } DijkstraShortestPath shortestPath = new DijkstraShortestPath(worstCaseGraph, firstVertex, lastVertex, pathLengthLimit); worstCase = shortestPath.getPathLength(); return worstCase; }
[ "public", "double", "getWorstCaseSubstituteAll", "(", ")", "{", "double", "worstCase", "=", "-", "1", ";", "// make a copy of editDistanceGraph\r", "SimpleDirectedWeightedGraph", "worstCaseGraph", "=", "new", "SimpleDirectedWeightedGraph", "(", ")", ";", "Set", "vertices"...
This worst-case is computed as follows: We look at the original graph <code>editDistanceGraph</code>, and change the weights of all diagonal edges to {@link #weightSubstitute}. Previously their weights depended on whether the node-tuple is equal or not. But now we look at it as if all the labels in both trees were different. Then we compute again the shortest path through this altered graph. By considering the shortestPath, we are still able to insert nodes prior to delete others. This is not possible in: {@link #getWorstCaseRetainStructure()}. @return the worst-case scenario of edit operations
[ "This", "worst", "-", "case", "is", "computed", "as", "follows", ":", "We", "look", "at", "the", "original", "graph", "<code", ">", "editDistanceGraph<", "/", "code", ">", "and", "change", "the", "weights", "of", "all", "diagonal", "edges", "to", "{", "@...
train
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/structure/tree/spsm/ted/TreeEditDistance.java#L463-L488
Stratio/cassandra-lucene-index
builder/src/main/java/com/stratio/cassandra/lucene/builder/Builder.java
Builder.bitemporalMapper
public static BitemporalMapper bitemporalMapper(String vtFrom, String vtTo, String ttFrom, String ttTo) { return new BitemporalMapper(vtFrom, vtTo, ttFrom, ttTo); }
java
public static BitemporalMapper bitemporalMapper(String vtFrom, String vtTo, String ttFrom, String ttTo) { return new BitemporalMapper(vtFrom, vtTo, ttFrom, ttTo); }
[ "public", "static", "BitemporalMapper", "bitemporalMapper", "(", "String", "vtFrom", ",", "String", "vtTo", ",", "String", "ttFrom", ",", "String", "ttTo", ")", "{", "return", "new", "BitemporalMapper", "(", "vtFrom", ",", "vtTo", ",", "ttFrom", ",", "ttTo", ...
Returns a new {@link BitemporalMapper}. @param vtFrom the column name containing the valid time start @param vtTo the column name containing the valid time stop @param ttFrom the column name containing the transaction time start @param ttTo the column name containing the transaction time stop @return a new {@link BitemporalMapper}
[ "Returns", "a", "new", "{", "@link", "BitemporalMapper", "}", "." ]
train
https://github.com/Stratio/cassandra-lucene-index/blob/a94a4d9af6c25d40e1108729974c35c27c54441c/builder/src/main/java/com/stratio/cassandra/lucene/builder/Builder.java#L101-L103
fcrepo3/fcrepo
fcrepo-common/src/main/java/org/fcrepo/utilities/xml/XercesXmlSerializers.java
XercesXmlSerializers.writeXmlNoSpace
public static void writeXmlNoSpace(Document doc, String encoding, Writer out) throws IOException { XMLSerializer ser = new XMLSerializer(out, getXmlNoSpace(encoding)); ser.serialize(doc); out.close(); }
java
public static void writeXmlNoSpace(Document doc, String encoding, Writer out) throws IOException { XMLSerializer ser = new XMLSerializer(out, getXmlNoSpace(encoding)); ser.serialize(doc); out.close(); }
[ "public", "static", "void", "writeXmlNoSpace", "(", "Document", "doc", ",", "String", "encoding", ",", "Writer", "out", ")", "throws", "IOException", "{", "XMLSerializer", "ser", "=", "new", "XMLSerializer", "(", "out", ",", "getXmlNoSpace", "(", "encoding", "...
Serialize the dom Document with no preserved space between elements, but without indenting, line wrapping, omission of XML declaration, or omission of doctype @param doc @param encoding @param out @throws IOException
[ "Serialize", "the", "dom", "Document", "with", "no", "preserved", "space", "between", "elements", "but", "without", "indenting", "line", "wrapping", "omission", "of", "XML", "declaration", "or", "omission", "of", "doctype" ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-common/src/main/java/org/fcrepo/utilities/xml/XercesXmlSerializers.java#L31-L37
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/filter/Filter.java
Filter.conjunctiveNormalFormSplit
public List<Filter<S>> conjunctiveNormalFormSplit() { final List<Filter<S>> list = new ArrayList<Filter<S>>(); conjunctiveNormalForm().accept(new Visitor<S, Object, Object>() { @Override public Object visit(OrFilter<S> filter, Object param) { list.add(filter); return null; } @Override public Object visit(PropertyFilter<S> filter, Object param) { list.add(filter); return null; } @Override public Object visit(ExistsFilter<S> filter, Object param) { list.add(filter); return null; } }, null); return Collections.unmodifiableList(list); }
java
public List<Filter<S>> conjunctiveNormalFormSplit() { final List<Filter<S>> list = new ArrayList<Filter<S>>(); conjunctiveNormalForm().accept(new Visitor<S, Object, Object>() { @Override public Object visit(OrFilter<S> filter, Object param) { list.add(filter); return null; } @Override public Object visit(PropertyFilter<S> filter, Object param) { list.add(filter); return null; } @Override public Object visit(ExistsFilter<S> filter, Object param) { list.add(filter); return null; } }, null); return Collections.unmodifiableList(list); }
[ "public", "List", "<", "Filter", "<", "S", ">", ">", "conjunctiveNormalFormSplit", "(", ")", "{", "final", "List", "<", "Filter", "<", "S", ">", ">", "list", "=", "new", "ArrayList", "<", "Filter", "<", "S", ">", ">", "(", ")", ";", "conjunctiveNorma...
Splits the filter from its conjunctive normal form. And'ng the filters together produces the full conjunctive normal form. @return unmodifiable list of sub filters which don't perform any 'and' operations @since 1.1.1
[ "Splits", "the", "filter", "from", "its", "conjunctive", "normal", "form", ".", "And", "ng", "the", "filters", "together", "produces", "the", "full", "conjunctive", "normal", "form", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/filter/Filter.java#L517-L541
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/ContentKeyPoliciesInner.java
ContentKeyPoliciesInner.getPolicyPropertiesWithSecretsAsync
public Observable<ContentKeyPolicyPropertiesInner> getPolicyPropertiesWithSecretsAsync(String resourceGroupName, String accountName, String contentKeyPolicyName) { return getPolicyPropertiesWithSecretsWithServiceResponseAsync(resourceGroupName, accountName, contentKeyPolicyName).map(new Func1<ServiceResponse<ContentKeyPolicyPropertiesInner>, ContentKeyPolicyPropertiesInner>() { @Override public ContentKeyPolicyPropertiesInner call(ServiceResponse<ContentKeyPolicyPropertiesInner> response) { return response.body(); } }); }
java
public Observable<ContentKeyPolicyPropertiesInner> getPolicyPropertiesWithSecretsAsync(String resourceGroupName, String accountName, String contentKeyPolicyName) { return getPolicyPropertiesWithSecretsWithServiceResponseAsync(resourceGroupName, accountName, contentKeyPolicyName).map(new Func1<ServiceResponse<ContentKeyPolicyPropertiesInner>, ContentKeyPolicyPropertiesInner>() { @Override public ContentKeyPolicyPropertiesInner call(ServiceResponse<ContentKeyPolicyPropertiesInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ContentKeyPolicyPropertiesInner", ">", "getPolicyPropertiesWithSecretsAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "contentKeyPolicyName", ")", "{", "return", "getPolicyPropertiesWithSecretsWithServiceRespo...
Get a Content Key Policy with secrets. Get a Content Key Policy including secret values. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param contentKeyPolicyName The Content Key Policy name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ContentKeyPolicyPropertiesInner object
[ "Get", "a", "Content", "Key", "Policy", "with", "secrets", ".", "Get", "a", "Content", "Key", "Policy", "including", "secret", "values", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/ContentKeyPoliciesInner.java#L810-L817
alkacon/opencms-core
src/org/opencms/ui/sitemap/CmsCopyPageDialog.java
CmsCopyPageDialog.getInitialTarget
private String getInitialTarget(CmsObject cms, CmsResource resource) { String sitePath = cms.getSitePath(resource); String parent = CmsResource.getParentFolder(sitePath); if (parent != null) { return parent; } else { String rootParent = CmsResource.getParentFolder(resource.getRootPath()); if (rootParent != null) { return rootParent; } else { return sitePath; } } }
java
private String getInitialTarget(CmsObject cms, CmsResource resource) { String sitePath = cms.getSitePath(resource); String parent = CmsResource.getParentFolder(sitePath); if (parent != null) { return parent; } else { String rootParent = CmsResource.getParentFolder(resource.getRootPath()); if (rootParent != null) { return rootParent; } else { return sitePath; } } }
[ "private", "String", "getInitialTarget", "(", "CmsObject", "cms", ",", "CmsResource", "resource", ")", "{", "String", "sitePath", "=", "cms", ".", "getSitePath", "(", "resource", ")", ";", "String", "parent", "=", "CmsResource", ".", "getParentFolder", "(", "s...
Gets the initial target path to display, based on the selected resource.<p> @param cms the cms context @param resource the selected resource @return the initial target path
[ "Gets", "the", "initial", "target", "path", "to", "display", "based", "on", "the", "selected", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/sitemap/CmsCopyPageDialog.java#L287-L301
pippo-java/pippo
pippo-core/src/main/java/ro/pippo/core/route/Route.java
Route.OPTIONS
public static Route OPTIONS(String uriPattern, RouteHandler routeHandler) { return new Route(HttpConstants.Method.OPTIONS, uriPattern, routeHandler); }
java
public static Route OPTIONS(String uriPattern, RouteHandler routeHandler) { return new Route(HttpConstants.Method.OPTIONS, uriPattern, routeHandler); }
[ "public", "static", "Route", "OPTIONS", "(", "String", "uriPattern", ",", "RouteHandler", "routeHandler", ")", "{", "return", "new", "Route", "(", "HttpConstants", ".", "Method", ".", "OPTIONS", ",", "uriPattern", ",", "routeHandler", ")", ";", "}" ]
Create an {@code OPTIONS} route. @param uriPattern @param routeHandler @return
[ "Create", "an", "{", "@code", "OPTIONS", "}", "route", "." ]
train
https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/route/Route.java#L136-L138
OpenLiberty/open-liberty
dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/jaas/modules/UsernameAndPasswordLoginModule.java
UsernameAndPasswordLoginModule.getRequiredCallbacks
@Override public Callback[] getRequiredCallbacks(CallbackHandler callbackHandler) throws IOException, UnsupportedCallbackException { Callback[] callbacks = new Callback[2]; callbacks[0] = new NameCallback("Username: "); callbacks[1] = new PasswordCallback("Password: ", false); callbackHandler.handle(callbacks); return callbacks; }
java
@Override public Callback[] getRequiredCallbacks(CallbackHandler callbackHandler) throws IOException, UnsupportedCallbackException { Callback[] callbacks = new Callback[2]; callbacks[0] = new NameCallback("Username: "); callbacks[1] = new PasswordCallback("Password: ", false); callbackHandler.handle(callbacks); return callbacks; }
[ "@", "Override", "public", "Callback", "[", "]", "getRequiredCallbacks", "(", "CallbackHandler", "callbackHandler", ")", "throws", "IOException", ",", "UnsupportedCallbackException", "{", "Callback", "[", "]", "callbacks", "=", "new", "Callback", "[", "2", "]", ";...
Gets the required Callback objects needed by this login module. @param callbackHandler @return @throws IOException @throws UnsupportedCallbackException
[ "Gets", "the", "required", "Callback", "objects", "needed", "by", "this", "login", "module", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/jaas/modules/UsernameAndPasswordLoginModule.java#L121-L129
google/closure-compiler
src/com/google/javascript/jscomp/parsing/JsDocInfoParser.java
JsDocInfoParser.createJSTypeExpression
JSTypeExpression createJSTypeExpression(Node n) { return n == null ? null : new JSTypeExpression(n, getSourceName()); }
java
JSTypeExpression createJSTypeExpression(Node n) { return n == null ? null : new JSTypeExpression(n, getSourceName()); }
[ "JSTypeExpression", "createJSTypeExpression", "(", "Node", "n", ")", "{", "return", "n", "==", "null", "?", "null", ":", "new", "JSTypeExpression", "(", "n", ",", "getSourceName", "(", ")", ")", ";", "}" ]
Constructs a new {@code JSTypeExpression}. @param n A node. May be null.
[ "Constructs", "a", "new", "{" ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/parsing/JsDocInfoParser.java#L1637-L1640
aws/aws-sdk-java
aws-java-sdk-lex/src/main/java/com/amazonaws/services/lexruntime/model/PostTextRequest.java
PostTextRequest.withSessionAttributes
public PostTextRequest withSessionAttributes(java.util.Map<String, String> sessionAttributes) { setSessionAttributes(sessionAttributes); return this; }
java
public PostTextRequest withSessionAttributes(java.util.Map<String, String> sessionAttributes) { setSessionAttributes(sessionAttributes); return this; }
[ "public", "PostTextRequest", "withSessionAttributes", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "sessionAttributes", ")", "{", "setSessionAttributes", "(", "sessionAttributes", ")", ";", "return", "this", ";", "}" ]
<p> Application-specific information passed between Amazon Lex and a client application. </p> <p> For more information, see <a href="http://docs.aws.amazon.com/lex/latest/dg/context-mgmt.html#context-mgmt-session-attribs">Setting Session Attributes</a>. </p> @param sessionAttributes Application-specific information passed between Amazon Lex and a client application.</p> <p> For more information, see <a href="http://docs.aws.amazon.com/lex/latest/dg/context-mgmt.html#context-mgmt-session-attribs">Setting Session Attributes</a>. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Application", "-", "specific", "information", "passed", "between", "Amazon", "Lex", "and", "a", "client", "application", ".", "<", "/", "p", ">", "<p", ">", "For", "more", "information", "see", "<a", "href", "=", "http", ":", "//", "docs", ...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-lex/src/main/java/com/amazonaws/services/lexruntime/model/PostTextRequest.java#L482-L485
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java
Calendar.getInstance
public static Calendar getInstance(TimeZone zone, Locale aLocale) { return getInstanceInternal(zone, ULocale.forLocale(aLocale)); }
java
public static Calendar getInstance(TimeZone zone, Locale aLocale) { return getInstanceInternal(zone, ULocale.forLocale(aLocale)); }
[ "public", "static", "Calendar", "getInstance", "(", "TimeZone", "zone", ",", "Locale", "aLocale", ")", "{", "return", "getInstanceInternal", "(", "zone", ",", "ULocale", ".", "forLocale", "(", "aLocale", ")", ")", ";", "}" ]
Returns a calendar with the specified time zone and locale. @param zone the time zone to use @param aLocale the locale for the week data @return a Calendar.
[ "Returns", "a", "calendar", "with", "the", "specified", "time", "zone", "and", "locale", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java#L1667-L1669
wigforss/Ka-Commons-Reflection
src/main/java/org/kasource/commons/util/StringUtils.java
StringUtils.resolveVariable
private static Object resolveVariable (String variableName, Map<String, Object> variables, boolean systemOverrideMode) { Object variable = (variables != null) ? variables.get(variableName) : null; String environmentValue = System.getenv(variableName); String systemValue = System.getProperty(variableName); if(systemOverrideMode) { return (systemValue != null ? systemValue : (environmentValue != null) ? environmentValue : variable); } else { return (variable != null ? variable : (systemValue != null) ? systemValue : environmentValue); } }
java
private static Object resolveVariable (String variableName, Map<String, Object> variables, boolean systemOverrideMode) { Object variable = (variables != null) ? variables.get(variableName) : null; String environmentValue = System.getenv(variableName); String systemValue = System.getProperty(variableName); if(systemOverrideMode) { return (systemValue != null ? systemValue : (environmentValue != null) ? environmentValue : variable); } else { return (variable != null ? variable : (systemValue != null) ? systemValue : environmentValue); } }
[ "private", "static", "Object", "resolveVariable", "(", "String", "variableName", ",", "Map", "<", "String", ",", "Object", ">", "variables", ",", "boolean", "systemOverrideMode", ")", "{", "Object", "variable", "=", "(", "variables", "!=", "null", ")", "?", ...
Helper to {@link #replaceVariables(String, Map, boolean)} which resolves and returns a variable value depending on mode. @param variableName Name of the variable to find @param variables Map of variable values @param systemOverrideMode Override = true, Fall back = false @return The variable value for variableName.
[ "Helper", "to", "{", "@link", "#replaceVariables", "(", "String", "Map", "boolean", ")", "}", "which", "resolves", "and", "returns", "a", "variable", "value", "depending", "on", "mode", "." ]
train
https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/util/StringUtils.java#L69-L79
jenkinsci/jenkins
core/src/main/java/hudson/FilePath.java
FilePath.installIfNecessaryFrom
public boolean installIfNecessaryFrom(@Nonnull URL archive, @CheckForNull TaskListener listener, @Nonnull String message) throws IOException, InterruptedException { return installIfNecessaryFrom(archive, listener, message, MAX_REDIRECTS); }
java
public boolean installIfNecessaryFrom(@Nonnull URL archive, @CheckForNull TaskListener listener, @Nonnull String message) throws IOException, InterruptedException { return installIfNecessaryFrom(archive, listener, message, MAX_REDIRECTS); }
[ "public", "boolean", "installIfNecessaryFrom", "(", "@", "Nonnull", "URL", "archive", ",", "@", "CheckForNull", "TaskListener", "listener", ",", "@", "Nonnull", "String", "message", ")", "throws", "IOException", ",", "InterruptedException", "{", "return", "installIf...
Given a tgz/zip file, extracts it to the given target directory, if necessary. <p> This method is a convenience method designed for installing a binary package to a location that supports upgrade and downgrade. Specifically, <ul> <li>If the target directory doesn't exist {@linkplain #mkdirs() it will be created}. <li>The timestamp of the archive is left in the installation directory upon extraction. <li>If the timestamp left in the directory does not match the timestamp of the current archive file, the directory contents will be discarded and the archive file will be re-extracted. <li>If the connection is refused but the target directory already exists, it is left alone. </ul> @param archive The resource that represents the tgz/zip file. This URL must support the {@code Last-Modified} header. (For example, you could use {@link ClassLoader#getResource}.) @param listener If non-null, a message will be printed to this listener once this method decides to extract an archive, or if there is any issue. @param message a message to be printed in case extraction will proceed. @return true if the archive was extracted. false if the extraction was skipped because the target directory was considered up to date. @since 1.299
[ "Given", "a", "tgz", "/", "zip", "file", "extracts", "it", "to", "the", "given", "target", "directory", "if", "necessary", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/FilePath.java#L844-L846
forge/core
parser-java/api/src/main/java/org/jboss/forge/addon/parser/java/utils/JLSValidator.java
JLSValidator.validateVariableName
public static ValidationResult validateVariableName(String identifier) { if (Strings.isNullOrEmpty(identifier)) return new ValidationResult(ERROR, Messages.notNullOrEmpty(VARIABLE_NAME)); return validateIdentifier(identifier, IdentifierType.VARIABLE_NAME); }
java
public static ValidationResult validateVariableName(String identifier) { if (Strings.isNullOrEmpty(identifier)) return new ValidationResult(ERROR, Messages.notNullOrEmpty(VARIABLE_NAME)); return validateIdentifier(identifier, IdentifierType.VARIABLE_NAME); }
[ "public", "static", "ValidationResult", "validateVariableName", "(", "String", "identifier", ")", "{", "if", "(", "Strings", ".", "isNullOrEmpty", "(", "identifier", ")", ")", "return", "new", "ValidationResult", "(", "ERROR", ",", "Messages", ".", "notNullOrEmpty...
Validates whether the <code>identifier</code> parameter is a valid variable name. @param identifier @return
[ "Validates", "whether", "the", "<code", ">", "identifier<", "/", "code", ">", "parameter", "is", "a", "valid", "variable", "name", "." ]
train
https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/parser-java/api/src/main/java/org/jboss/forge/addon/parser/java/utils/JLSValidator.java#L51-L56
bwkimmel/java-util
src/main/java/ca/eandb/util/io/FileUtil.java
FileUtil.setFileContents
public static void setFileContents(File file, byte[] contents, boolean createDirectory) throws IOException { if (createDirectory) { File directory = file.getParentFile(); if (!directory.exists()) { directory.mkdirs(); } } FileOutputStream stream = new FileOutputStream(file); stream.write(contents); stream.close(); }
java
public static void setFileContents(File file, byte[] contents, boolean createDirectory) throws IOException { if (createDirectory) { File directory = file.getParentFile(); if (!directory.exists()) { directory.mkdirs(); } } FileOutputStream stream = new FileOutputStream(file); stream.write(contents); stream.close(); }
[ "public", "static", "void", "setFileContents", "(", "File", "file", ",", "byte", "[", "]", "contents", ",", "boolean", "createDirectory", ")", "throws", "IOException", "{", "if", "(", "createDirectory", ")", "{", "File", "directory", "=", "file", ".", "getPa...
Writes the specified byte array to a file. @param file The <code>File</code> to write. @param contents The byte array to write to the file. @param createDirectory A value indicating whether the directory containing the file to be written should be created if it does not exist. @throws IOException If the file could not be written.
[ "Writes", "the", "specified", "byte", "array", "to", "a", "file", "." ]
train
https://github.com/bwkimmel/java-util/blob/0c03664d42f0e6b111f64447f222aa73c2819e5c/src/main/java/ca/eandb/util/io/FileUtil.java#L110-L121
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/BarcodePostnet.java
BarcodePostnet.getBarcodeSize
public Rectangle getBarcodeSize() { float width = ((code.length() + 1) * 5 + 1) * n + x; return new Rectangle(width, barHeight); }
java
public Rectangle getBarcodeSize() { float width = ((code.length() + 1) * 5 + 1) * n + x; return new Rectangle(width, barHeight); }
[ "public", "Rectangle", "getBarcodeSize", "(", ")", "{", "float", "width", "=", "(", "(", "code", ".", "length", "(", ")", "+", "1", ")", "*", "5", "+", "1", ")", "*", "n", "+", "x", ";", "return", "new", "Rectangle", "(", "width", ",", "barHeight...
Gets the maximum area that the barcode and the text, if any, will occupy. The lower left corner is always (0, 0). @return the size the barcode occupies.
[ "Gets", "the", "maximum", "area", "that", "the", "barcode", "and", "the", "text", "if", "any", "will", "occupy", ".", "The", "lower", "left", "corner", "is", "always", "(", "0", "0", ")", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/BarcodePostnet.java#L118-L121
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/security/CredentialReference.java
CredentialReference.credentialReferencePartAsStringIfDefined
public static String credentialReferencePartAsStringIfDefined(ModelNode credentialReferenceValue, String name) throws OperationFailedException { assert credentialReferenceValue.isDefined() : credentialReferenceValue; ModelNode result = credentialReferenceValue.get(name); if (result.isDefined()) { return result.asString(); } return null; }
java
public static String credentialReferencePartAsStringIfDefined(ModelNode credentialReferenceValue, String name) throws OperationFailedException { assert credentialReferenceValue.isDefined() : credentialReferenceValue; ModelNode result = credentialReferenceValue.get(name); if (result.isDefined()) { return result.asString(); } return null; }
[ "public", "static", "String", "credentialReferencePartAsStringIfDefined", "(", "ModelNode", "credentialReferenceValue", ",", "String", "name", ")", "throws", "OperationFailedException", "{", "assert", "credentialReferenceValue", ".", "isDefined", "(", ")", ":", "credentialR...
Utility method to return part of {@link ObjectTypeAttributeDefinition} for credential reference attribute. {@see CredentialReference#getAttributeDefinition} @param credentialReferenceValue value of credential reference attribute @param name name of part to return (supported names: {@link #STORE} {@link #ALIAS} {@link #TYPE} {@link #CLEAR_TEXT} @return value of part as {@link String} @throws OperationFailedException when something goes wrong
[ "Utility", "method", "to", "return", "part", "of", "{", "@link", "ObjectTypeAttributeDefinition", "}", "for", "credential", "reference", "attribute", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/security/CredentialReference.java#L275-L282
openbase/jul
pattern/default/src/main/java/org/openbase/jul/pattern/ObservableImpl.java
ObservableImpl.waitForValue
@Override public void waitForValue(final long timeout, final TimeUnit timeUnit) throws CouldNotPerformException, InterruptedException { synchronized (VALUE_LOCK) { if (value != null) { return; } // if 0 wait forever like the default java wait() implementation. if (timeUnit.toMillis(timeout) == 0) { VALUE_LOCK.wait(); } else { timeUnit.timedWait(VALUE_LOCK, timeout); } if (value == null) { throw new NotAvailableException(Observable.class, new TimeoutException()); } } //waitUntilNotificationIsFinished(); }
java
@Override public void waitForValue(final long timeout, final TimeUnit timeUnit) throws CouldNotPerformException, InterruptedException { synchronized (VALUE_LOCK) { if (value != null) { return; } // if 0 wait forever like the default java wait() implementation. if (timeUnit.toMillis(timeout) == 0) { VALUE_LOCK.wait(); } else { timeUnit.timedWait(VALUE_LOCK, timeout); } if (value == null) { throw new NotAvailableException(Observable.class, new TimeoutException()); } } //waitUntilNotificationIsFinished(); }
[ "@", "Override", "public", "void", "waitForValue", "(", "final", "long", "timeout", ",", "final", "TimeUnit", "timeUnit", ")", "throws", "CouldNotPerformException", ",", "InterruptedException", "{", "synchronized", "(", "VALUE_LOCK", ")", "{", "if", "(", "value", ...
{@inheritDoc} @param timeout {@inheritDoc} @param timeUnit {@inheritDoc} @throws InterruptedException {@inheritDoc} @throws CouldNotPerformException {@inheritDoc}
[ "{", "@inheritDoc", "}" ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/pattern/default/src/main/java/org/openbase/jul/pattern/ObservableImpl.java#L99-L117
iipc/openwayback-access-control
oracle/src/main/java/org/archive/accesscontrol/webui/SurtNode.java
SurtNode.nodesFromSurt
public static List<SurtNode> nodesFromSurt(String surt) { List<SurtNode> list = new ArrayList<SurtNode>(); String running = ""; for (String token: new NewSurtTokenizer(surt)) { running += token; list.add(new SurtNode(token, running)); } return list; }
java
public static List<SurtNode> nodesFromSurt(String surt) { List<SurtNode> list = new ArrayList<SurtNode>(); String running = ""; for (String token: new NewSurtTokenizer(surt)) { running += token; list.add(new SurtNode(token, running)); } return list; }
[ "public", "static", "List", "<", "SurtNode", ">", "nodesFromSurt", "(", "String", "surt", ")", "{", "List", "<", "SurtNode", ">", "list", "=", "new", "ArrayList", "<", "SurtNode", ">", "(", ")", ";", "String", "running", "=", "\"\"", ";", "for", "(", ...
Return a list of the elements in a given SURT. For example for "(org,archive," we return: [new SurtNode("(", "("), new SurtNode("org,", "(org"), new SurtNode("archive,", "archive,")] @param surt @return
[ "Return", "a", "list", "of", "the", "elements", "in", "a", "given", "SURT", "." ]
train
https://github.com/iipc/openwayback-access-control/blob/4a0f70f200fd8d7b6e313624b7628656d834bf31/oracle/src/main/java/org/archive/accesscontrol/webui/SurtNode.java#L42-L50
Appendium/objectlabkit
datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/ccy/DefaultCurrencyCalculatorConfig.java
DefaultCurrencyCalculatorConfig.setCurrenciesSubjectToCrossCcyForT1
public void setCurrenciesSubjectToCrossCcyForT1(final Map<String, Set<String>> currenciesSubjectToCrossCcyForT1) { final Map<String, Set<String>> copy = new HashMap<>(); if (currenciesSubjectToCrossCcyForT1 != null) { copy.putAll(currenciesSubjectToCrossCcyForT1); } this.currenciesSubjectToCrossCcyForT1 = copy; }
java
public void setCurrenciesSubjectToCrossCcyForT1(final Map<String, Set<String>> currenciesSubjectToCrossCcyForT1) { final Map<String, Set<String>> copy = new HashMap<>(); if (currenciesSubjectToCrossCcyForT1 != null) { copy.putAll(currenciesSubjectToCrossCcyForT1); } this.currenciesSubjectToCrossCcyForT1 = copy; }
[ "public", "void", "setCurrenciesSubjectToCrossCcyForT1", "(", "final", "Map", "<", "String", ",", "Set", "<", "String", ">", ">", "currenciesSubjectToCrossCcyForT1", ")", "{", "final", "Map", "<", "String", ",", "Set", "<", "String", ">", ">", "copy", "=", "...
Will take a copy of a non null set but doing so by replacing the internal one in one go for consistency.
[ "Will", "take", "a", "copy", "of", "a", "non", "null", "set", "but", "doing", "so", "by", "replacing", "the", "internal", "one", "in", "one", "go", "for", "consistency", "." ]
train
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/ccy/DefaultCurrencyCalculatorConfig.java#L46-L52
Azure/azure-sdk-for-java
applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/WorkbooksInner.java
WorkbooksInner.listByResourceGroup
public List<WorkbookInner> listByResourceGroup(String resourceGroupName, CategoryType category, List<String> tags, Boolean canFetchContent) { return listByResourceGroupWithServiceResponseAsync(resourceGroupName, category, tags, canFetchContent).toBlocking().single().body(); }
java
public List<WorkbookInner> listByResourceGroup(String resourceGroupName, CategoryType category, List<String> tags, Boolean canFetchContent) { return listByResourceGroupWithServiceResponseAsync(resourceGroupName, category, tags, canFetchContent).toBlocking().single().body(); }
[ "public", "List", "<", "WorkbookInner", ">", "listByResourceGroup", "(", "String", "resourceGroupName", ",", "CategoryType", "category", ",", "List", "<", "String", ">", "tags", ",", "Boolean", "canFetchContent", ")", "{", "return", "listByResourceGroupWithServiceResp...
Get all Workbooks defined within a specified resource group and category. @param resourceGroupName The name of the resource group. @param category Category of workbook to return. Possible values include: 'workbook', 'TSG', 'performance', 'retention' @param tags Tags presents on each workbook returned. @param canFetchContent Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content for workbooks. @throws IllegalArgumentException thrown if parameters fail the validation @throws WorkbookErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;WorkbookInner&gt; object if successful.
[ "Get", "all", "Workbooks", "defined", "within", "a", "specified", "resource", "group", "and", "category", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/WorkbooksInner.java#L184-L186
actorapp/actor-platform
actor-sdk/sdk-core-android/android-sdk/src/main/java/android/support/v7/widget/ChatLinearLayoutManager.java
ChatLinearLayoutManager.recycleByLayoutState
private void recycleByLayoutState(RecyclerView.Recycler recycler, LayoutState layoutState) { if (!layoutState.mRecycle) { return; } if (layoutState.mLayoutDirection == LayoutState.LAYOUT_START) { recycleViewsFromEnd(recycler, layoutState.mScrollingOffset); } else { recycleViewsFromStart(recycler, layoutState.mScrollingOffset); } }
java
private void recycleByLayoutState(RecyclerView.Recycler recycler, LayoutState layoutState) { if (!layoutState.mRecycle) { return; } if (layoutState.mLayoutDirection == LayoutState.LAYOUT_START) { recycleViewsFromEnd(recycler, layoutState.mScrollingOffset); } else { recycleViewsFromStart(recycler, layoutState.mScrollingOffset); } }
[ "private", "void", "recycleByLayoutState", "(", "RecyclerView", ".", "Recycler", "recycler", ",", "LayoutState", "layoutState", ")", "{", "if", "(", "!", "layoutState", ".", "mRecycle", ")", "{", "return", ";", "}", "if", "(", "layoutState", ".", "mLayoutDirec...
Helper method to call appropriate recycle method depending on current layout direction @param recycler Current recycler that is attached to RecyclerView @param layoutState Current layout state. Right now, this object does not change but we may consider moving it out of this view so passing around as a parameter for now, rather than accessing {@link #mLayoutState} @see #recycleViewsFromStart(RecyclerView.Recycler, int) @see #recycleViewsFromEnd(RecyclerView.Recycler, int) @see LayoutState#mLayoutDirection
[ "Helper", "method", "to", "call", "appropriate", "recycle", "method", "depending", "on", "current", "layout", "direction" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/android/support/v7/widget/ChatLinearLayoutManager.java#L1279-L1288
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/AccountsApi.java
AccountsApi.updatePermissionProfile
public PermissionProfile updatePermissionProfile(String accountId, String permissionProfileId, PermissionProfile permissionProfile) throws ApiException { return updatePermissionProfile(accountId, permissionProfileId, permissionProfile, null); }
java
public PermissionProfile updatePermissionProfile(String accountId, String permissionProfileId, PermissionProfile permissionProfile) throws ApiException { return updatePermissionProfile(accountId, permissionProfileId, permissionProfile, null); }
[ "public", "PermissionProfile", "updatePermissionProfile", "(", "String", "accountId", ",", "String", "permissionProfileId", ",", "PermissionProfile", "permissionProfile", ")", "throws", "ApiException", "{", "return", "updatePermissionProfile", "(", "accountId", ",", "permis...
Updates a permission profile within the specified account. @param accountId The external account number (int) or account ID Guid. (required) @param permissionProfileId (required) @param permissionProfile (optional) @return PermissionProfile
[ "Updates", "a", "permission", "profile", "within", "the", "specified", "account", "." ]
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/AccountsApi.java#L2907-L2909
finmath/finmath-lib
src/main/java/net/finmath/functions/LinearAlgebra.java
LinearAlgebra.solveLinearEquationTikonov
public static double[] solveLinearEquationTikonov(double[][] matrixA, double[] b, double lambda) { if(lambda == 0) { return solveLinearEquationLeastSquare(matrixA, b); } /* * The copy of the array is inefficient, but the use cases for this method are currently limited. * And SVD is an alternative to this method. */ int rows = matrixA.length; int cols = matrixA[0].length; double[][] matrixRegularized = new double[rows+cols][cols]; double[] bRegularized = new double[rows+cols]; // Note the JVM initializes arrays to zero. for(int i=0; i<rows; i++) { System.arraycopy(matrixA[i], 0, matrixRegularized[i], 0, cols); } System.arraycopy(b, 0, bRegularized, 0, rows); for(int j=0; j<cols; j++) { double[] matrixRow = matrixRegularized[rows+j]; matrixRow[j] = lambda; } // return solveLinearEquationLeastSquare(matrixRegularized, bRegularized); DecompositionSolver solver = new QRDecomposition(new Array2DRowRealMatrix(matrixRegularized, false)).getSolver(); return solver.solve(new ArrayRealVector(bRegularized, false)).toArray(); }
java
public static double[] solveLinearEquationTikonov(double[][] matrixA, double[] b, double lambda) { if(lambda == 0) { return solveLinearEquationLeastSquare(matrixA, b); } /* * The copy of the array is inefficient, but the use cases for this method are currently limited. * And SVD is an alternative to this method. */ int rows = matrixA.length; int cols = matrixA[0].length; double[][] matrixRegularized = new double[rows+cols][cols]; double[] bRegularized = new double[rows+cols]; // Note the JVM initializes arrays to zero. for(int i=0; i<rows; i++) { System.arraycopy(matrixA[i], 0, matrixRegularized[i], 0, cols); } System.arraycopy(b, 0, bRegularized, 0, rows); for(int j=0; j<cols; j++) { double[] matrixRow = matrixRegularized[rows+j]; matrixRow[j] = lambda; } // return solveLinearEquationLeastSquare(matrixRegularized, bRegularized); DecompositionSolver solver = new QRDecomposition(new Array2DRowRealMatrix(matrixRegularized, false)).getSolver(); return solver.solve(new ArrayRealVector(bRegularized, false)).toArray(); }
[ "public", "static", "double", "[", "]", "solveLinearEquationTikonov", "(", "double", "[", "]", "[", "]", "matrixA", ",", "double", "[", "]", "b", ",", "double", "lambda", ")", "{", "if", "(", "lambda", "==", "0", ")", "{", "return", "solveLinearEquationL...
Find a solution of the linear equation A x = b where <ul> <li>A is an n x m - matrix given as double[n][m]</li> <li>b is an m - vector given as double[m],</li> <li>x is an n - vector given as double[n],</li> </ul> using a standard Tikhonov regularization, i.e., we solve in the least square sense A* x = b* where A* = (A^T, lambda I)^T and b* = (b^T , 0)^T. @param matrixA The matrix A (left hand side of the linear equation). @param b The vector (right hand of the linear equation). @param lambda The parameter lambda of the Tikhonov regularization. Lambda effectively measures which small numbers are considered zero. @return A solution x to A x = b.
[ "Find", "a", "solution", "of", "the", "linear", "equation", "A", "x", "=", "b", "where", "<ul", ">", "<li", ">", "A", "is", "an", "n", "x", "m", "-", "matrix", "given", "as", "double", "[", "n", "]", "[", "m", "]", "<", "/", "li", ">", "<li",...
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/functions/LinearAlgebra.java#L81-L109
betfair/cougar
cougar-codegen-plugin/src/main/java/com/betfair/cougar/codegen/IdlToDSMojo.java
IdlToDSMojo.derivePackageName
private String derivePackageName(Service service, Document iddDoc) { String packageName = service.getPackageName(); if (packageName == null) { packageName = readNamespaceAttr(iddDoc); if (packageName == null) { throw new PluginException("Cannot find a package name " + "(not specified in plugin and no namespace in IDD"); } } return packageName; }
java
private String derivePackageName(Service service, Document iddDoc) { String packageName = service.getPackageName(); if (packageName == null) { packageName = readNamespaceAttr(iddDoc); if (packageName == null) { throw new PluginException("Cannot find a package name " + "(not specified in plugin and no namespace in IDD"); } } return packageName; }
[ "private", "String", "derivePackageName", "(", "Service", "service", ",", "Document", "iddDoc", ")", "{", "String", "packageName", "=", "service", ".", "getPackageName", "(", ")", ";", "if", "(", "packageName", "==", "null", ")", "{", "packageName", "=", "re...
Package name comes from explicit plugin param (if set), else the namespace definition, else skream and die. <p> Having the plugin override allows backwards compatibility as well as being useful for fiddling and tweaking.
[ "Package", "name", "comes", "from", "explicit", "plugin", "param", "(", "if", "set", ")", "else", "the", "namespace", "definition", "else", "skream", "and", "die", ".", "<p", ">", "Having", "the", "plugin", "override", "allows", "backwards", "compatibility", ...
train
https://github.com/betfair/cougar/blob/08d1fe338fbd0e8572a9c2305bb5796402d5b1f5/cougar-codegen-plugin/src/main/java/com/betfair/cougar/codegen/IdlToDSMojo.java#L478-L489
facebookarchive/swift
swift-codec/src/main/java/com/facebook/swift/codec/internal/compiler/ThriftCodecByteCodeGenerator.java
ThriftCodecByteCodeGenerator.buildStruct
private LocalVariableDefinition buildStruct(MethodDefinition read, Map<Short, LocalVariableDefinition> structData) { // construct the instance and store it in the instance local variable LocalVariableDefinition instance = constructStructInstance(read, structData); // inject fields injectStructFields(read, instance, structData); // inject methods injectStructMethods(read, instance, structData); // invoke factory method if present invokeFactoryMethod(read, structData, instance); return instance; }
java
private LocalVariableDefinition buildStruct(MethodDefinition read, Map<Short, LocalVariableDefinition> structData) { // construct the instance and store it in the instance local variable LocalVariableDefinition instance = constructStructInstance(read, structData); // inject fields injectStructFields(read, instance, structData); // inject methods injectStructMethods(read, instance, structData); // invoke factory method if present invokeFactoryMethod(read, structData, instance); return instance; }
[ "private", "LocalVariableDefinition", "buildStruct", "(", "MethodDefinition", "read", ",", "Map", "<", "Short", ",", "LocalVariableDefinition", ">", "structData", ")", "{", "// construct the instance and store it in the instance local variable", "LocalVariableDefinition", "instan...
Defines the code to build the struct instance using the data in the local variables.
[ "Defines", "the", "code", "to", "build", "the", "struct", "instance", "using", "the", "data", "in", "the", "local", "variables", "." ]
train
https://github.com/facebookarchive/swift/blob/3f1f098a50d6106f50cd6fe1c361dd373ede0197/swift-codec/src/main/java/com/facebook/swift/codec/internal/compiler/ThriftCodecByteCodeGenerator.java#L404-L419
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/SegmentMetadataUpdateTransaction.java
SegmentMetadataUpdateTransaction.acceptAsTargetSegment
void acceptAsTargetSegment(MergeSegmentOperation operation, SegmentMetadataUpdateTransaction sourceMetadata) throws MetadataUpdateException { ensureSegmentId(operation); if (operation.getStreamSegmentOffset() != this.length) { throw new MetadataUpdateException(containerId, String.format("MergeSegmentOperation target offset mismatch. Expected %d, actual %d.", this.length, operation.getStreamSegmentOffset())); } long transLength = operation.getLength(); if (transLength < 0 || transLength != sourceMetadata.length) { throw new MetadataUpdateException(containerId, "MergeSegmentOperation does not seem to have been pre-processed: " + operation.toString()); } this.length += transLength; this.isChanged = true; }
java
void acceptAsTargetSegment(MergeSegmentOperation operation, SegmentMetadataUpdateTransaction sourceMetadata) throws MetadataUpdateException { ensureSegmentId(operation); if (operation.getStreamSegmentOffset() != this.length) { throw new MetadataUpdateException(containerId, String.format("MergeSegmentOperation target offset mismatch. Expected %d, actual %d.", this.length, operation.getStreamSegmentOffset())); } long transLength = operation.getLength(); if (transLength < 0 || transLength != sourceMetadata.length) { throw new MetadataUpdateException(containerId, "MergeSegmentOperation does not seem to have been pre-processed: " + operation.toString()); } this.length += transLength; this.isChanged = true; }
[ "void", "acceptAsTargetSegment", "(", "MergeSegmentOperation", "operation", ",", "SegmentMetadataUpdateTransaction", "sourceMetadata", ")", "throws", "MetadataUpdateException", "{", "ensureSegmentId", "(", "operation", ")", ";", "if", "(", "operation", ".", "getStreamSegmen...
Accepts the given MergeSegmentOperation as a Target Segment (where it will be merged into). @param operation The operation to accept. @param sourceMetadata The metadata for the Source Segment to merge. @throws MetadataUpdateException If the operation cannot be processed because of the current state of the metadata. @throws IllegalArgumentException If the operation is for a different Segment.
[ "Accepts", "the", "given", "MergeSegmentOperation", "as", "a", "Target", "Segment", "(", "where", "it", "will", "be", "merged", "into", ")", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/SegmentMetadataUpdateTransaction.java#L574-L591
microfocus-idol/java-content-parameter-api
src/main/java/com/hp/autonomy/aci/content/fieldtext/FieldTextBuilder.java
FieldTextBuilder.WHEN
@Override public FieldTextBuilder WHEN(final FieldText fieldText) { Validate.notNull(fieldText, "FieldText should not be null"); Validate.isTrue(fieldText.size() >= 1, "FieldText must have a size greater or equal to 1"); if(size() < 1) { throw new IllegalStateException("Size must be greater than or equal to 1"); } // Here we assume that A WHEN A => A but is there an edge case where this doesn't work? if(fieldText == this || toString().equals(fieldText.toString())) { return this; } if(MATCHNOTHING.equals(this) || MATCHNOTHING.equals(fieldText)) { return setFieldText(MATCHNOTHING); } return binaryOperation("WHEN", fieldText); }
java
@Override public FieldTextBuilder WHEN(final FieldText fieldText) { Validate.notNull(fieldText, "FieldText should not be null"); Validate.isTrue(fieldText.size() >= 1, "FieldText must have a size greater or equal to 1"); if(size() < 1) { throw new IllegalStateException("Size must be greater than or equal to 1"); } // Here we assume that A WHEN A => A but is there an edge case where this doesn't work? if(fieldText == this || toString().equals(fieldText.toString())) { return this; } if(MATCHNOTHING.equals(this) || MATCHNOTHING.equals(fieldText)) { return setFieldText(MATCHNOTHING); } return binaryOperation("WHEN", fieldText); }
[ "@", "Override", "public", "FieldTextBuilder", "WHEN", "(", "final", "FieldText", "fieldText", ")", "{", "Validate", ".", "notNull", "(", "fieldText", ",", "\"FieldText should not be null\"", ")", ";", "Validate", ".", "isTrue", "(", "fieldText", ".", "size", "(...
Appends the specified fieldtext onto the builder using the WHEN operator. A simplification is made in the case where the passed {@code fieldText} is equal to {@code this}: <p> <pre>(A WHEN A) {@literal =>} A</pre> @param fieldText A fieldtext expression or specifier. @return {@code this}
[ "Appends", "the", "specified", "fieldtext", "onto", "the", "builder", "using", "the", "WHEN", "operator", ".", "A", "simplification", "is", "made", "in", "the", "case", "where", "the", "passed", "{", "@code", "fieldText", "}", "is", "equal", "to", "{", "@c...
train
https://github.com/microfocus-idol/java-content-parameter-api/blob/8d33dc633f8df2a470a571ac7694e423e7004ad0/src/main/java/com/hp/autonomy/aci/content/fieldtext/FieldTextBuilder.java#L228-L247
Waikato/moa
moa/src/main/java/moa/core/Utils.java
Utils.roundDouble
public static /*@pure@*/ double roundDouble(double value,int afterDecimalPoint) { double mask = Math.pow(10.0, (double)afterDecimalPoint); return (double)(Math.round(value * mask)) / mask; }
java
public static /*@pure@*/ double roundDouble(double value,int afterDecimalPoint) { double mask = Math.pow(10.0, (double)afterDecimalPoint); return (double)(Math.round(value * mask)) / mask; }
[ "public", "static", "/*@pure@*/", "double", "roundDouble", "(", "double", "value", ",", "int", "afterDecimalPoint", ")", "{", "double", "mask", "=", "Math", ".", "pow", "(", "10.0", ",", "(", "double", ")", "afterDecimalPoint", ")", ";", "return", "(", "do...
Rounds a double to the given number of decimal places. @param value the double value @param afterDecimalPoint the number of digits after the decimal point @return the double rounded to the given precision
[ "Rounds", "a", "double", "to", "the", "given", "number", "of", "decimal", "places", "." ]
train
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/core/Utils.java#L1307-L1312
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLTypeComputer.java
SARLTypeComputer._computeTypes
protected void _computeTypes(SarlAssertExpression object, ITypeComputationState state) { state.withExpectation(getTypeForName(Boolean.class, state)).computeTypes(object.getCondition()); }
java
protected void _computeTypes(SarlAssertExpression object, ITypeComputationState state) { state.withExpectation(getTypeForName(Boolean.class, state)).computeTypes(object.getCondition()); }
[ "protected", "void", "_computeTypes", "(", "SarlAssertExpression", "object", ",", "ITypeComputationState", "state", ")", "{", "state", ".", "withExpectation", "(", "getTypeForName", "(", "Boolean", ".", "class", ",", "state", ")", ")", ".", "computeTypes", "(", ...
Compute the type of an assert expression. @param object the expression. @param state the state of the type resolver.
[ "Compute", "the", "type", "of", "an", "assert", "expression", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLTypeComputer.java#L191-L193
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.telephony_settings_GET
public OvhSettings telephony_settings_GET() throws IOException { String qPath = "/me/telephony/settings"; StringBuilder sb = path(qPath); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhSettings.class); }
java
public OvhSettings telephony_settings_GET() throws IOException { String qPath = "/me/telephony/settings"; StringBuilder sb = path(qPath); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhSettings.class); }
[ "public", "OvhSettings", "telephony_settings_GET", "(", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/telephony/settings\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", ...
Get the telephony settings linked to the customer account REST: GET /me/telephony/settings
[ "Get", "the", "telephony", "settings", "linked", "to", "the", "customer", "account" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L1801-L1806
galaxyproject/blend4j
src/main/java/com/github/jmchilton/blend4j/BaseClient.java
BaseClient.deleteResponse
protected ClientResponse deleteResponse(final WebResource webResource, final boolean checkResponse) { final ClientResponse response = webResource.accept(MediaType.APPLICATION_JSON).delete(ClientResponse.class); if(checkResponse) { this.checkResponse(response); } return response; }
java
protected ClientResponse deleteResponse(final WebResource webResource, final boolean checkResponse) { final ClientResponse response = webResource.accept(MediaType.APPLICATION_JSON).delete(ClientResponse.class); if(checkResponse) { this.checkResponse(response); } return response; }
[ "protected", "ClientResponse", "deleteResponse", "(", "final", "WebResource", "webResource", ",", "final", "boolean", "checkResponse", ")", "{", "final", "ClientResponse", "response", "=", "webResource", ".", "accept", "(", "MediaType", ".", "APPLICATION_JSON", ")", ...
Gets the response for a DELETE request. @param webResource The {@link WebResource} to send the request to. @param checkResponse True if an exception should be thrown on failure, false otherwise. @return The {@link ClientResponse} for this request. @throws ResponseException If the response was not successful.
[ "Gets", "the", "response", "for", "a", "DELETE", "request", "." ]
train
https://github.com/galaxyproject/blend4j/blob/a2ec4e412be40013bb88a3a2cf2478abd19ce162/src/main/java/com/github/jmchilton/blend4j/BaseClient.java#L105-L111
authlete/authlete-java-common
src/main/java/com/authlete/common/util/TypedProperties.java
TypedProperties.setEnum
public <TEnum extends Enum<TEnum>> void setEnum(Enum<?> key, TEnum value) { if (key == null) { return; } setEnum(key.name(), value); }
java
public <TEnum extends Enum<TEnum>> void setEnum(Enum<?> key, TEnum value) { if (key == null) { return; } setEnum(key.name(), value); }
[ "public", "<", "TEnum", "extends", "Enum", "<", "TEnum", ">", ">", "void", "setEnum", "(", "Enum", "<", "?", ">", "key", ",", "TEnum", "value", ")", "{", "if", "(", "key", "==", "null", ")", "{", "return", ";", "}", "setEnum", "(", "key", ".", ...
Equivalent to {@link #setEnum(String, Enum) setEnum}{@code (key.name(), value)}. If {@code key} is null, nothing is done.
[ "Equivalent", "to", "{" ]
train
https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/util/TypedProperties.java#L772-L780
raydac/java-comment-preprocessor
jcp/src/main/java/com/igormaznitsa/meta/common/utils/Assertions.java
Assertions.assertNull
public static <T> T assertNull(@Nullable final String failMessage, @Nullable final T object) { if (object != null) { final String txt = failMessage == null ? "Object must be NULL" : failMessage; final AssertionError error = new AssertionError(txt); MetaErrorListeners.fireError(txt, error); throw error; } return object; }
java
public static <T> T assertNull(@Nullable final String failMessage, @Nullable final T object) { if (object != null) { final String txt = failMessage == null ? "Object must be NULL" : failMessage; final AssertionError error = new AssertionError(txt); MetaErrorListeners.fireError(txt, error); throw error; } return object; }
[ "public", "static", "<", "T", ">", "T", "assertNull", "(", "@", "Nullable", "final", "String", "failMessage", ",", "@", "Nullable", "final", "T", "object", ")", "{", "if", "(", "object", "!=", "null", ")", "{", "final", "String", "txt", "=", "failMessa...
Assert that value is null @param <T> type of the object to check @param failMessage the message to be provided for failure, can be null @param object the object to check @return the same input parameter if all is ok @throws AssertionError it will be thrown if the value is not null @since 1.1.0
[ "Assert", "that", "value", "is", "null" ]
train
https://github.com/raydac/java-comment-preprocessor/blob/83ac87b575ac084914d77695a8c8673de3b8300c/jcp/src/main/java/com/igormaznitsa/meta/common/utils/Assertions.java#L90-L98
UrielCh/ovh-java-sdk
ovh-java-sdk-licensevirtuozzo/src/main/java/net/minidev/ovh/api/ApiOvhLicensevirtuozzo.java
ApiOvhLicensevirtuozzo.orderableVersions_GET
public ArrayList<OvhVirtuozzoOrderConfiguration> orderableVersions_GET(String ip) throws IOException { String qPath = "/license/virtuozzo/orderableVersions"; StringBuilder sb = path(qPath); query(sb, "ip", ip); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t4); }
java
public ArrayList<OvhVirtuozzoOrderConfiguration> orderableVersions_GET(String ip) throws IOException { String qPath = "/license/virtuozzo/orderableVersions"; StringBuilder sb = path(qPath); query(sb, "ip", ip); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t4); }
[ "public", "ArrayList", "<", "OvhVirtuozzoOrderConfiguration", ">", "orderableVersions_GET", "(", "String", "ip", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/license/virtuozzo/orderableVersions\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath",...
Get the orderable Virtuozzo versions REST: GET /license/virtuozzo/orderableVersions @param ip [required] Your license Ip
[ "Get", "the", "orderable", "Virtuozzo", "versions" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-licensevirtuozzo/src/main/java/net/minidev/ovh/api/ApiOvhLicensevirtuozzo.java#L257-L263
powermock/powermock
powermock-api/powermock-api-support/src/main/java/org/powermock/api/support/Stubber.java
Stubber.stubMethod
public static void stubMethod(Class<?> declaringClass, String methodName, Object returnObject) { if (declaringClass == null) { throw new IllegalArgumentException("declaringClass cannot be null"); } if (methodName == null || methodName.length() == 0) { throw new IllegalArgumentException("methodName cannot be empty"); } Method[] methods = Whitebox.getMethods(declaringClass, methodName); if (methods.length == 0) { throw new MethodNotFoundException(String.format("Couldn't find a method with name %s in the class hierarchy of %s", methodName, declaringClass.getName())); } else if (methods.length > 1) { throw new TooManyMethodsFoundException(String.format("Found %d methods with name %s in the class hierarchy of %s.", methods.length, methodName, declaringClass.getName())); } MockRepository.putMethodToStub(methods[0], returnObject); }
java
public static void stubMethod(Class<?> declaringClass, String methodName, Object returnObject) { if (declaringClass == null) { throw new IllegalArgumentException("declaringClass cannot be null"); } if (methodName == null || methodName.length() == 0) { throw new IllegalArgumentException("methodName cannot be empty"); } Method[] methods = Whitebox.getMethods(declaringClass, methodName); if (methods.length == 0) { throw new MethodNotFoundException(String.format("Couldn't find a method with name %s in the class hierarchy of %s", methodName, declaringClass.getName())); } else if (methods.length > 1) { throw new TooManyMethodsFoundException(String.format("Found %d methods with name %s in the class hierarchy of %s.", methods.length, methodName, declaringClass.getName())); } MockRepository.putMethodToStub(methods[0], returnObject); }
[ "public", "static", "void", "stubMethod", "(", "Class", "<", "?", ">", "declaringClass", ",", "String", "methodName", ",", "Object", "returnObject", ")", "{", "if", "(", "declaringClass", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(",...
Add a method that should be intercepted and return another value ( {@code returnObject}) (i.e. the method is stubbed).
[ "Add", "a", "method", "that", "should", "be", "intercepted", "and", "return", "another", "value", "(", "{" ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-support/src/main/java/org/powermock/api/support/Stubber.java#L38-L55
michael-rapp/AndroidMaterialValidation
library/src/main/java/de/mrapp/android/validation/Validators.java
Validators.notEmpty
public static Validator<CharSequence> notEmpty(@NonNull final Context context, @StringRes final int resourceId) { return new NotEmptyValidator(context, resourceId); }
java
public static Validator<CharSequence> notEmpty(@NonNull final Context context, @StringRes final int resourceId) { return new NotEmptyValidator(context, resourceId); }
[ "public", "static", "Validator", "<", "CharSequence", ">", "notEmpty", "(", "@", "NonNull", "final", "Context", "context", ",", "@", "StringRes", "final", "int", "resourceId", ")", "{", "return", "new", "NotEmptyValidator", "(", "context", ",", "resourceId", "...
Creates and returns a validator, which allows to validate texts to ensure, that they are not empty. @param context The context, which should be used to retrieve the error message, as an instance of the class {@link Context}. The context may not be null @param resourceId The resource ID of the string resource, which contains the error message, which should be set, as an {@link Integer} value. The resource ID must correspond to a valid string resource @return The validator, which has been created, as an instance of the type {@link Validator}
[ "Creates", "and", "returns", "a", "validator", "which", "allows", "to", "validate", "texts", "to", "ensure", "that", "they", "are", "not", "empty", "." ]
train
https://github.com/michael-rapp/AndroidMaterialValidation/blob/ac8693baeac7abddf2e38a47da4c1849d4661a8b/library/src/main/java/de/mrapp/android/validation/Validators.java#L372-L375
wildfly/wildfly-core
patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java
IdentityPatchContext.createRollbackElement
protected static PatchElement createRollbackElement(final PatchEntry entry) { final PatchElement patchElement = entry.element; final String patchId; final Patch.PatchType patchType = patchElement.getProvider().getPatchType(); if (patchType == Patch.PatchType.CUMULATIVE) { patchId = entry.getCumulativePatchID(); } else { patchId = patchElement.getId(); } return createPatchElement(entry, patchId, entry.rollbackActions); }
java
protected static PatchElement createRollbackElement(final PatchEntry entry) { final PatchElement patchElement = entry.element; final String patchId; final Patch.PatchType patchType = patchElement.getProvider().getPatchType(); if (patchType == Patch.PatchType.CUMULATIVE) { patchId = entry.getCumulativePatchID(); } else { patchId = patchElement.getId(); } return createPatchElement(entry, patchId, entry.rollbackActions); }
[ "protected", "static", "PatchElement", "createRollbackElement", "(", "final", "PatchEntry", "entry", ")", "{", "final", "PatchElement", "patchElement", "=", "entry", ".", "element", ";", "final", "String", "patchId", ";", "final", "Patch", ".", "PatchType", "patch...
Create a patch element for the rollback patch. @param entry the entry @return the new patch element
[ "Create", "a", "patch", "element", "for", "the", "rollback", "patch", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java#L940-L950