repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/PriceListUrl.java
PriceListUrl.deletePriceListUrl
public static MozuUrl deletePriceListUrl(Boolean cascadeDeleteEntries, String priceListCode) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/pricelists/{priceListCode}?cascadeDeleteEntries={cascadeDeleteEntries}"); formatter.formatUrl("cascadeDeleteEntries", cascadeDeleteEntries); formatter.formatUrl("priceListCode", priceListCode); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl deletePriceListUrl(Boolean cascadeDeleteEntries, String priceListCode) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/pricelists/{priceListCode}?cascadeDeleteEntries={cascadeDeleteEntries}"); formatter.formatUrl("cascadeDeleteEntries", cascadeDeleteEntries); formatter.formatUrl("priceListCode", priceListCode); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "deletePriceListUrl", "(", "Boolean", "cascadeDeleteEntries", ",", "String", "priceListCode", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/catalog/admin/pricelists/{priceListCode}?cascadeDeleteEntries={cas...
Get Resource Url for DeletePriceList @param cascadeDeleteEntries Specifies whether to deletes all price list entries associated with the price list. @param priceListCode The unique, user-defined code of the price list. @return String Resource Url
[ "Get", "Resource", "Url", "for", "DeletePriceList" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/PriceListUrl.java#L124-L130
apache/flink
flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontendParser.java
CliFrontendParser.mergeOptions
public static Options mergeOptions(@Nullable Options optionsA, @Nullable Options optionsB) { final Options resultOptions = new Options(); if (optionsA != null) { for (Option option : optionsA.getOptions()) { resultOptions.addOption(option); } } if (optionsB != null) { for (Option option : optionsB.getOptions()) { resultOptions.addOption(option); } } return resultOptions; }
java
public static Options mergeOptions(@Nullable Options optionsA, @Nullable Options optionsB) { final Options resultOptions = new Options(); if (optionsA != null) { for (Option option : optionsA.getOptions()) { resultOptions.addOption(option); } } if (optionsB != null) { for (Option option : optionsB.getOptions()) { resultOptions.addOption(option); } } return resultOptions; }
[ "public", "static", "Options", "mergeOptions", "(", "@", "Nullable", "Options", "optionsA", ",", "@", "Nullable", "Options", "optionsB", ")", "{", "final", "Options", "resultOptions", "=", "new", "Options", "(", ")", ";", "if", "(", "optionsA", "!=", "null",...
Merges the given {@link Options} into a new Options object. @param optionsA options to merge, can be null if none @param optionsB options to merge, can be null if none @return
[ "Merges", "the", "given", "{", "@link", "Options", "}", "into", "a", "new", "Options", "object", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontendParser.java#L445-L460
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/transform/ii/IntegralImageOps.java
IntegralImageOps.isInBounds
public static boolean isInBounds( int x , int y , IntegralKernel kernel , int width , int height ) { for(ImageRectangle r : kernel.blocks ) { if( x+r.x0 < 0 || y+r.y0 < 0 ) return false; if( x+r.x1 >= width || y+r.y1 >= height ) return false; } return true; }
java
public static boolean isInBounds( int x , int y , IntegralKernel kernel , int width , int height ) { for(ImageRectangle r : kernel.blocks ) { if( x+r.x0 < 0 || y+r.y0 < 0 ) return false; if( x+r.x1 >= width || y+r.y1 >= height ) return false; } return true; }
[ "public", "static", "boolean", "isInBounds", "(", "int", "x", ",", "int", "y", ",", "IntegralKernel", "kernel", ",", "int", "width", ",", "int", "height", ")", "{", "for", "(", "ImageRectangle", "r", ":", "kernel", ".", "blocks", ")", "{", "if", "(", ...
Checks to see if the kernel is applied at this specific spot if all the pixels would be inside the image bounds or not @param x location where the kernel is applied. x-axis @param y location where the kernel is applied. y-axis @param kernel The kernel @param width Image's width @param height Image's height @return true if in bounds and false if out of bounds
[ "Checks", "to", "see", "if", "the", "kernel", "is", "applied", "at", "this", "specific", "spot", "if", "all", "the", "pixels", "would", "be", "inside", "the", "image", "bounds", "or", "not" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/ii/IntegralImageOps.java#L560-L570
jbundle/jbundle
thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PDatabase.java
PDatabase.init
public void init(PhysicalDatabaseParent pDatabaseOwner, String strDbName, char charPDatabaseType) { m_htTableList = new Hashtable<Object,PTable>(); m_strDBName = strDbName; m_charPDatabaseType = charPDatabaseType; this.setPDatabaseParent(pDatabaseOwner); }
java
public void init(PhysicalDatabaseParent pDatabaseOwner, String strDbName, char charPDatabaseType) { m_htTableList = new Hashtable<Object,PTable>(); m_strDBName = strDbName; m_charPDatabaseType = charPDatabaseType; this.setPDatabaseParent(pDatabaseOwner); }
[ "public", "void", "init", "(", "PhysicalDatabaseParent", "pDatabaseOwner", ",", "String", "strDbName", ",", "char", "charPDatabaseType", ")", "{", "m_htTableList", "=", "new", "Hashtable", "<", "Object", ",", "PTable", ">", "(", ")", ";", "m_strDBName", "=", "...
Constructor. @param pDatabaseOwner The raw data database owner (optional). @param strDBName The database name (The key for lookup). @param charPDatabaseType The database type.
[ "Constructor", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PDatabase.java#L97-L103
google/closure-templates
java/src/com/google/template/soy/pysrc/internal/TranslateToPyExprVisitor.java
TranslateToPyExprVisitor.visitFunctionNode
@Override protected PyExpr visitFunctionNode(FunctionNode node) { Object soyFunction = node.getSoyFunction(); if (soyFunction instanceof BuiltinFunction) { return visitNonPluginFunction(node, (BuiltinFunction) soyFunction); } else if (soyFunction instanceof SoyPythonSourceFunction) { return pluginValueFactory.applyFunction( node.getSourceLocation(), node.getFunctionName(), (SoyPythonSourceFunction) soyFunction, visitChildren(node)); } else if (soyFunction instanceof SoyPySrcFunction) { List<PyExpr> args = visitChildren(node); return ((SoyPySrcFunction) soyFunction).computeForPySrc(args); } else if (soyFunction instanceof LoggingFunction) { // trivial logging function support return new PyStringExpr("'" + ((LoggingFunction) soyFunction).getPlaceholder() + "'"); } else { errorReporter.report( node.getSourceLocation(), SOY_PY_SRC_FUNCTION_NOT_FOUND, node.getFunctionName()); return ERROR; } }
java
@Override protected PyExpr visitFunctionNode(FunctionNode node) { Object soyFunction = node.getSoyFunction(); if (soyFunction instanceof BuiltinFunction) { return visitNonPluginFunction(node, (BuiltinFunction) soyFunction); } else if (soyFunction instanceof SoyPythonSourceFunction) { return pluginValueFactory.applyFunction( node.getSourceLocation(), node.getFunctionName(), (SoyPythonSourceFunction) soyFunction, visitChildren(node)); } else if (soyFunction instanceof SoyPySrcFunction) { List<PyExpr> args = visitChildren(node); return ((SoyPySrcFunction) soyFunction).computeForPySrc(args); } else if (soyFunction instanceof LoggingFunction) { // trivial logging function support return new PyStringExpr("'" + ((LoggingFunction) soyFunction).getPlaceholder() + "'"); } else { errorReporter.report( node.getSourceLocation(), SOY_PY_SRC_FUNCTION_NOT_FOUND, node.getFunctionName()); return ERROR; } }
[ "@", "Override", "protected", "PyExpr", "visitFunctionNode", "(", "FunctionNode", "node", ")", "{", "Object", "soyFunction", "=", "node", ".", "getSoyFunction", "(", ")", ";", "if", "(", "soyFunction", "instanceof", "BuiltinFunction", ")", "{", "return", "visitN...
{@inheritDoc} <p>The source of available functions is a look-up map provided by Guice in {@link SharedModule#provideSoyFunctionsMap}. @see BuiltinFunction @see SoyPySrcFunction
[ "{", "@inheritDoc", "}" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/pysrc/internal/TranslateToPyExprVisitor.java#L471-L493
ManfredTremmel/gwt-bean-validators
gwt-mt-widgets/src/main/java/de/knightsoftnet/mtwidgets/client/ui/widget/resourceloader/JsResources.java
JsResources.whenReady
public static void whenReady(final String scriptname, final EventListener function) { List<EventListener> eventList = JsResources.eventLisenerQueue.get(scriptname); if (eventList == null) { eventList = new ArrayList<>(); JsResources.eventLisenerQueue.put(scriptname, eventList); } eventList.add(function); if (BooleanUtils.isTrue(JsResources.initializationStarted.get(scriptname)) || JsResources.isInHeader(scriptname)) { if (JsResources.isInitialized(scriptname)) { JsResources.eventLisenerQueue.get(scriptname) .forEach(action -> action.handleEvent(JsResources.rememberEvent.get(scriptname))); JsResources.eventLisenerQueue.get(scriptname).clear(); } return; } JsResources.initializationStarted.put(scriptname, Boolean.TRUE); final ScriptElement jsScript = Browser.getDocument().createScriptElement(); if (StringUtils.endsWith(scriptname, ".js")) { jsScript.setSrc(scriptname); } else { jsScript.setInnerHTML(scriptname); } jsScript.setType(JsResources.SCRIPT_TYPE); Browser.getDocument().getHead().appendChild(jsScript); jsScript.setOnload(event -> { JsResources.eventLisenerQueue.get(scriptname).forEach(action -> action.handleEvent(event)); JsResources.eventLisenerQueue.get(scriptname).clear(); JsResources.rememberEvent.put(scriptname, event); }); }
java
public static void whenReady(final String scriptname, final EventListener function) { List<EventListener> eventList = JsResources.eventLisenerQueue.get(scriptname); if (eventList == null) { eventList = new ArrayList<>(); JsResources.eventLisenerQueue.put(scriptname, eventList); } eventList.add(function); if (BooleanUtils.isTrue(JsResources.initializationStarted.get(scriptname)) || JsResources.isInHeader(scriptname)) { if (JsResources.isInitialized(scriptname)) { JsResources.eventLisenerQueue.get(scriptname) .forEach(action -> action.handleEvent(JsResources.rememberEvent.get(scriptname))); JsResources.eventLisenerQueue.get(scriptname).clear(); } return; } JsResources.initializationStarted.put(scriptname, Boolean.TRUE); final ScriptElement jsScript = Browser.getDocument().createScriptElement(); if (StringUtils.endsWith(scriptname, ".js")) { jsScript.setSrc(scriptname); } else { jsScript.setInnerHTML(scriptname); } jsScript.setType(JsResources.SCRIPT_TYPE); Browser.getDocument().getHead().appendChild(jsScript); jsScript.setOnload(event -> { JsResources.eventLisenerQueue.get(scriptname).forEach(action -> action.handleEvent(event)); JsResources.eventLisenerQueue.get(scriptname).clear(); JsResources.rememberEvent.put(scriptname, event); }); }
[ "public", "static", "void", "whenReady", "(", "final", "String", "scriptname", ",", "final", "EventListener", "function", ")", "{", "List", "<", "EventListener", ">", "eventList", "=", "JsResources", ".", "eventLisenerQueue", ".", "get", "(", "scriptname", ")", ...
async load of resources. @param function function to call on load
[ "async", "load", "of", "resources", "." ]
train
https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwt-mt-widgets/src/main/java/de/knightsoftnet/mtwidgets/client/ui/widget/resourceloader/JsResources.java#L32-L65
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/AFPChainXMLParser.java
AFPChainXMLParser.fromXML
public static AFPChain fromXML(String xml, String name1, String name2, Atom[] ca1, Atom[] ca2) throws IOException, StructureException{ AFPChain[] afps = parseMultiXML( xml); if ( afps.length > 0 ) { AFPChain afpChain = afps[0]; String n1 = afpChain.getName1(); String n2 = afpChain.getName2(); if ( n1 == null ) n1 = ""; if ( n2 == null) n2 = ""; //System.out.println("from AFPCHAIN: " + n1 + " " + n2); if ( n1.equals(name2) && n2.equals(name1)){ // flipped order //System.out.println("AfpChain in wrong order, flipping..."); afpChain = AFPChainFlipper.flipChain(afpChain); } rebuildAFPChain(afpChain, ca1, ca2); return afpChain; } return null; }
java
public static AFPChain fromXML(String xml, String name1, String name2, Atom[] ca1, Atom[] ca2) throws IOException, StructureException{ AFPChain[] afps = parseMultiXML( xml); if ( afps.length > 0 ) { AFPChain afpChain = afps[0]; String n1 = afpChain.getName1(); String n2 = afpChain.getName2(); if ( n1 == null ) n1 = ""; if ( n2 == null) n2 = ""; //System.out.println("from AFPCHAIN: " + n1 + " " + n2); if ( n1.equals(name2) && n2.equals(name1)){ // flipped order //System.out.println("AfpChain in wrong order, flipping..."); afpChain = AFPChainFlipper.flipChain(afpChain); } rebuildAFPChain(afpChain, ca1, ca2); return afpChain; } return null; }
[ "public", "static", "AFPChain", "fromXML", "(", "String", "xml", ",", "String", "name1", ",", "String", "name2", ",", "Atom", "[", "]", "ca1", ",", "Atom", "[", "]", "ca2", ")", "throws", "IOException", ",", "StructureException", "{", "AFPChain", "[", "]...
new utility method that checks that the order of the pair in the XML alignment is correct and flips the direction if needed @param xml @param name1 @param name1 @param ca1 @param ca2 @return
[ "new", "utility", "method", "that", "checks", "that", "the", "order", "of", "the", "pair", "in", "the", "XML", "alignment", "is", "correct", "and", "flips", "the", "direction", "if", "needed" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/AFPChainXMLParser.java#L64-L90
auth0/java-jwt
lib/src/main/java/com/auth0/jwt/impl/JsonNodeClaim.java
JsonNodeClaim.extractClaim
static Claim extractClaim(String claimName, Map<String, JsonNode> tree, ObjectReader objectReader) { JsonNode node = tree.get(claimName); return claimFromNode(node, objectReader); }
java
static Claim extractClaim(String claimName, Map<String, JsonNode> tree, ObjectReader objectReader) { JsonNode node = tree.get(claimName); return claimFromNode(node, objectReader); }
[ "static", "Claim", "extractClaim", "(", "String", "claimName", ",", "Map", "<", "String", ",", "JsonNode", ">", "tree", ",", "ObjectReader", "objectReader", ")", "{", "JsonNode", "node", "=", "tree", ".", "get", "(", "claimName", ")", ";", "return", "claim...
Helper method to extract a Claim from the given JsonNode tree. @param claimName the Claim to search for. @param tree the JsonNode tree to search the Claim in. @return a valid non-null Claim.
[ "Helper", "method", "to", "extract", "a", "Claim", "from", "the", "given", "JsonNode", "tree", "." ]
train
https://github.com/auth0/java-jwt/blob/890538970a9699b7251a4bfe4f26e8d7605ad530/lib/src/main/java/com/auth0/jwt/impl/JsonNodeClaim.java#L138-L141
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/CharSequences.java
CharSequences.matchAfter
@Deprecated public static int matchAfter(CharSequence a, CharSequence b, int aIndex, int bIndex) { int i = aIndex, j = bIndex; int alen = a.length(); int blen = b.length(); for (; i < alen && j < blen; ++i, ++j) { char ca = a.charAt(i); char cb = b.charAt(j); if (ca != cb) { break; } } // if we failed a match make sure that we didn't match half a character int result = i - aIndex; if (result != 0 && !onCharacterBoundary(a, i) && !onCharacterBoundary(b, j)) { --result; // backup } return result; }
java
@Deprecated public static int matchAfter(CharSequence a, CharSequence b, int aIndex, int bIndex) { int i = aIndex, j = bIndex; int alen = a.length(); int blen = b.length(); for (; i < alen && j < blen; ++i, ++j) { char ca = a.charAt(i); char cb = b.charAt(j); if (ca != cb) { break; } } // if we failed a match make sure that we didn't match half a character int result = i - aIndex; if (result != 0 && !onCharacterBoundary(a, i) && !onCharacterBoundary(b, j)) { --result; // backup } return result; }
[ "@", "Deprecated", "public", "static", "int", "matchAfter", "(", "CharSequence", "a", ",", "CharSequence", "b", ",", "int", "aIndex", ",", "int", "bIndex", ")", "{", "int", "i", "=", "aIndex", ",", "j", "=", "bIndex", ";", "int", "alen", "=", "a", "....
Find the longest n such that a[aIndex,n] = b[bIndex,n], and n is on a character boundary. @deprecated This API is ICU internal only. @hide draft / provisional / internal are hidden on Android
[ "Find", "the", "longest", "n", "such", "that", "a", "[", "aIndex", "n", "]", "=", "b", "[", "bIndex", "n", "]", "and", "n", "is", "on", "a", "character", "boundary", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/CharSequences.java#L54-L72
RestComm/media-core
rtp/src/main/java/org/restcomm/media/core/rtp/crypto/SRTPCryptoContext.java
SRTPCryptoContext.computeIv
private void computeIv(long label, long index) { long key_id; if (keyDerivationRate == 0) { key_id = label << 48; } else { key_id = ((label << 48) | (index / keyDerivationRate)); } for (int i = 0; i < 7; i++) { ivStore[i] = masterSalt[i]; } for (int i = 7; i < 14; i++) { ivStore[i] = (byte) ((byte) (0xFF & (key_id >> (8 * (13 - i)))) ^ masterSalt[i]); } ivStore[14] = ivStore[15] = 0; }
java
private void computeIv(long label, long index) { long key_id; if (keyDerivationRate == 0) { key_id = label << 48; } else { key_id = ((label << 48) | (index / keyDerivationRate)); } for (int i = 0; i < 7; i++) { ivStore[i] = masterSalt[i]; } for (int i = 7; i < 14; i++) { ivStore[i] = (byte) ((byte) (0xFF & (key_id >> (8 * (13 - i)))) ^ masterSalt[i]); } ivStore[14] = ivStore[15] = 0; }
[ "private", "void", "computeIv", "(", "long", "label", ",", "long", "index", ")", "{", "long", "key_id", ";", "if", "(", "keyDerivationRate", "==", "0", ")", "{", "key_id", "=", "label", "<<", "48", ";", "}", "else", "{", "key_id", "=", "(", "(", "l...
Compute the initialization vector, used later by encryption algorithms, based on the lable, the packet index, key derivation rate and master salt key. @param label label specified for each type of iv @param index 48bit RTP packet index
[ "Compute", "the", "initialization", "vector", "used", "later", "by", "encryption", "algorithms", "based", "on", "the", "lable", "the", "packet", "index", "key", "derivation", "rate", "and", "master", "salt", "key", "." ]
train
https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/rtp/src/main/java/org/restcomm/media/core/rtp/crypto/SRTPCryptoContext.java#L587-L602
bmwcarit/joynr
java/backend-services/domain-access-controller/src/main/java/io/joynr/accesscontrol/global/GlobalDomainAccessControlListEditorProviderImpl.java
GlobalDomainAccessControlListEditorProviderImpl.hasRoleMaster
private boolean hasRoleMaster(String userId, String domain) { DomainRoleEntry domainRole = domainAccessStore.getDomainRole(userId, Role.MASTER); if (domainRole == null || !Arrays.asList(domainRole.getDomains()).contains(domain)) { return false; } return true; }
java
private boolean hasRoleMaster(String userId, String domain) { DomainRoleEntry domainRole = domainAccessStore.getDomainRole(userId, Role.MASTER); if (domainRole == null || !Arrays.asList(domainRole.getDomains()).contains(domain)) { return false; } return true; }
[ "private", "boolean", "hasRoleMaster", "(", "String", "userId", ",", "String", "domain", ")", "{", "DomainRoleEntry", "domainRole", "=", "domainAccessStore", ".", "getDomainRole", "(", "userId", ",", "Role", ".", "MASTER", ")", ";", "if", "(", "domainRole", "=...
Indicates if the given user has master role for the given domain
[ "Indicates", "if", "the", "given", "user", "has", "master", "role", "for", "the", "given", "domain" ]
train
https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/backend-services/domain-access-controller/src/main/java/io/joynr/accesscontrol/global/GlobalDomainAccessControlListEditorProviderImpl.java#L86-L94
relayrides/pushy
micrometer-metrics-listener/src/main/java/com/turo/pushy/apns/metrics/micrometer/MicrometerApnsClientMetricsListener.java
MicrometerApnsClientMetricsListener.handleWriteFailure
@Override public void handleWriteFailure(final ApnsClient apnsClient, final long notificationId) { this.notificationStartTimes.remove(notificationId); this.writeFailures.increment(); }
java
@Override public void handleWriteFailure(final ApnsClient apnsClient, final long notificationId) { this.notificationStartTimes.remove(notificationId); this.writeFailures.increment(); }
[ "@", "Override", "public", "void", "handleWriteFailure", "(", "final", "ApnsClient", "apnsClient", ",", "final", "long", "notificationId", ")", "{", "this", ".", "notificationStartTimes", ".", "remove", "(", "notificationId", ")", ";", "this", ".", "writeFailures"...
Records a failed attempt to send a notification and updates metrics accordingly. @param apnsClient the client that failed to write the notification; note that this is ignored by {@code MicrometerApnsClientMetricsListener} instances, which should always be used for exactly one client @param notificationId an opaque, unique identifier for the notification that could not be written
[ "Records", "a", "failed", "attempt", "to", "send", "a", "notification", "and", "updates", "metrics", "accordingly", "." ]
train
https://github.com/relayrides/pushy/blob/1f6f9a0e07d785c815d74c2320a8d87c80231d36/micrometer-metrics-listener/src/main/java/com/turo/pushy/apns/metrics/micrometer/MicrometerApnsClientMetricsListener.java#L183-L187
jenkinsci/jenkins
core/src/main/java/hudson/slaves/Channels.java
Channels.newJVM
public static Channel newJVM(String displayName, TaskListener listener, FilePath workDir, ClasspathBuilder classpath, Map<String,String> systemProperties) throws IOException { JVMBuilder vmb = new JVMBuilder(); vmb.systemProperties(systemProperties); return newJVM(displayName,listener,vmb,workDir,classpath); }
java
public static Channel newJVM(String displayName, TaskListener listener, FilePath workDir, ClasspathBuilder classpath, Map<String,String> systemProperties) throws IOException { JVMBuilder vmb = new JVMBuilder(); vmb.systemProperties(systemProperties); return newJVM(displayName,listener,vmb,workDir,classpath); }
[ "public", "static", "Channel", "newJVM", "(", "String", "displayName", ",", "TaskListener", "listener", ",", "FilePath", "workDir", ",", "ClasspathBuilder", "classpath", ",", "Map", "<", "String", ",", "String", ">", "systemProperties", ")", "throws", "IOException...
Launches a new JVM with the given classpath and system properties, establish a communication channel, and return a {@link Channel} to it. @param displayName Human readable name of what this JVM represents. For example "Selenium grid" or "Hadoop". This token is used for messages to {@code listener}. @param listener The progress of the launcher and the failure information will be sent here. Must not be null. @param workDir If non-null, the new JVM will have this directory as the working directory. This must be a local path. @param classpath The classpath of the new JVM. Can be null if you just need {@code agent.jar} (and everything else can be sent over the channel.) But if you have jars that are known to be necessary by the new JVM, setting it here will improve the classloading performance (by avoiding remote class file transfer.) Classes in this classpath will also take precedence over any other classes that's sent via the channel later, so it's also useful for making sure you get the version of the classes you want. @param systemProperties If the new JVM should have a certain system properties set. Can be null. @return never null @since 1.300
[ "Launches", "a", "new", "JVM", "with", "the", "given", "classpath", "and", "system", "properties", "establish", "a", "communication", "channel", "and", "return", "a", "{", "@link", "Channel", "}", "to", "it", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/slaves/Channels.java#L180-L185
facebookarchive/hadoop-20
src/core/org/apache/hadoop/io/SequenceFile.java
SequenceFile.createWriter
public static Writer createWriter(Configuration conf, FSDataOutputStream out, Class keyClass, Class valClass, CompressionType compressionType, CompressionCodec codec, Metadata metadata) throws IOException { if ((codec instanceof GzipCodec) && !NativeCodeLoader.isNativeCodeLoaded() && !ZlibFactory.isNativeZlibLoaded(conf)) { throw new IllegalArgumentException("SequenceFile doesn't work with " + "GzipCodec without native-hadoop code!"); } Writer writer = null; if (compressionType == CompressionType.NONE) { writer = new Writer(conf, out, keyClass, valClass, metadata); } else if (compressionType == CompressionType.RECORD) { writer = new RecordCompressWriter(conf, out, keyClass, valClass, codec, metadata); } else if (compressionType == CompressionType.BLOCK){ writer = new BlockCompressWriter(conf, out, keyClass, valClass, codec, metadata); } return writer; }
java
public static Writer createWriter(Configuration conf, FSDataOutputStream out, Class keyClass, Class valClass, CompressionType compressionType, CompressionCodec codec, Metadata metadata) throws IOException { if ((codec instanceof GzipCodec) && !NativeCodeLoader.isNativeCodeLoaded() && !ZlibFactory.isNativeZlibLoaded(conf)) { throw new IllegalArgumentException("SequenceFile doesn't work with " + "GzipCodec without native-hadoop code!"); } Writer writer = null; if (compressionType == CompressionType.NONE) { writer = new Writer(conf, out, keyClass, valClass, metadata); } else if (compressionType == CompressionType.RECORD) { writer = new RecordCompressWriter(conf, out, keyClass, valClass, codec, metadata); } else if (compressionType == CompressionType.BLOCK){ writer = new BlockCompressWriter(conf, out, keyClass, valClass, codec, metadata); } return writer; }
[ "public", "static", "Writer", "createWriter", "(", "Configuration", "conf", ",", "FSDataOutputStream", "out", ",", "Class", "keyClass", ",", "Class", "valClass", ",", "CompressionType", "compressionType", ",", "CompressionCodec", "codec", ",", "Metadata", "metadata", ...
Construct the preferred type of 'raw' SequenceFile Writer. @param conf The configuration. @param out The stream on top which the writer is to be constructed. @param keyClass The 'key' type. @param valClass The 'value' type. @param compressionType The compression type. @param codec The compression codec. @param metadata The metadata of the file. @return Returns the handle to the constructed SequenceFile Writer. @throws IOException
[ "Construct", "the", "preferred", "type", "of", "raw", "SequenceFile", "Writer", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/SequenceFile.java#L651-L674
kefirfromperm/kefirbb
src/org/kefirsf/bb/proc/ProcText.java
ProcText.parse
public boolean parse(Context context, ProcPatternElement terminator) throws NestingException { // Prepare a child context Context child = new Context(context); child.checkNesting(); StringBuilder target = new StringBuilder(); child.setTarget(target); if (scope != null) { child.setScope(scope); } child.setTerminator(terminator); // Parse it boolean parsed = child.getScope().process(child); if (parsed) { // If parsing success if (transparent) { child.mergeWithParent(); } setAttribute(context, target); return true; } else { return false; } }
java
public boolean parse(Context context, ProcPatternElement terminator) throws NestingException { // Prepare a child context Context child = new Context(context); child.checkNesting(); StringBuilder target = new StringBuilder(); child.setTarget(target); if (scope != null) { child.setScope(scope); } child.setTerminator(terminator); // Parse it boolean parsed = child.getScope().process(child); if (parsed) { // If parsing success if (transparent) { child.mergeWithParent(); } setAttribute(context, target); return true; } else { return false; } }
[ "public", "boolean", "parse", "(", "Context", "context", ",", "ProcPatternElement", "terminator", ")", "throws", "NestingException", "{", "// Prepare a child context", "Context", "child", "=", "new", "Context", "(", "context", ")", ";", "child", ".", "checkNesting",...
Парсит элемент @param context контекст @return true - если удалось распарсить константу false - если не удалось @throws NestingException if nesting is too big.
[ "Парсит", "элемент" ]
train
https://github.com/kefirfromperm/kefirbb/blob/8c36fc3d3dc27459b0cdc179b87582df30420856/src/org/kefirsf/bb/proc/ProcText.java#L47-L71
spotify/helios
helios-services/src/main/java/com/spotify/helios/master/resources/VersionResource.java
VersionResource.versionCheck
@GET @Path("/check") @Produces(APPLICATION_JSON) @Timed @ExceptionMetered public VersionCheckResponse versionCheck( @QueryParam("client") @DefaultValue("") final String client) { final PomVersion serverVersion = PomVersion.parse(Version.POM_VERSION); final VersionCompatibility.Status status; if (isNullOrEmpty(client)) { return new VersionCheckResponse(VersionCompatibility.Status.MISSING, serverVersion, Version.RECOMMENDED_VERSION); } final PomVersion clientVersion = PomVersion.parse(client); status = VersionCompatibility.getStatus(serverVersion, clientVersion); return new VersionCheckResponse(status, serverVersion, Version.RECOMMENDED_VERSION); }
java
@GET @Path("/check") @Produces(APPLICATION_JSON) @Timed @ExceptionMetered public VersionCheckResponse versionCheck( @QueryParam("client") @DefaultValue("") final String client) { final PomVersion serverVersion = PomVersion.parse(Version.POM_VERSION); final VersionCompatibility.Status status; if (isNullOrEmpty(client)) { return new VersionCheckResponse(VersionCompatibility.Status.MISSING, serverVersion, Version.RECOMMENDED_VERSION); } final PomVersion clientVersion = PomVersion.parse(client); status = VersionCompatibility.getStatus(serverVersion, clientVersion); return new VersionCheckResponse(status, serverVersion, Version.RECOMMENDED_VERSION); }
[ "@", "GET", "@", "Path", "(", "\"/check\"", ")", "@", "Produces", "(", "APPLICATION_JSON", ")", "@", "Timed", "@", "ExceptionMetered", "public", "VersionCheckResponse", "versionCheck", "(", "@", "QueryParam", "(", "\"client\"", ")", "@", "DefaultValue", "(", "...
Given the client version, returns the version status, i.e. whether or not they should be compatible or not. @param client The client version. @return The VersionCheckResponse object.
[ "Given", "the", "client", "version", "returns", "the", "version", "status", "i", ".", "e", ".", "whether", "or", "not", "they", "should", "be", "compatible", "or", "not", "." ]
train
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/master/resources/VersionResource.java#L64-L82
infinispan/infinispan
server/integration/commons/src/main/java/org/infinispan/server/commons/controller/Operations.java
Operations.createReadAttributeOperation
public static ModelNode createReadAttributeOperation(PathAddress address, String name) { return createAttributeOperation(ModelDescriptionConstants.READ_ATTRIBUTE_OPERATION, address, name); }
java
public static ModelNode createReadAttributeOperation(PathAddress address, String name) { return createAttributeOperation(ModelDescriptionConstants.READ_ATTRIBUTE_OPERATION, address, name); }
[ "public", "static", "ModelNode", "createReadAttributeOperation", "(", "PathAddress", "address", ",", "String", "name", ")", "{", "return", "createAttributeOperation", "(", "ModelDescriptionConstants", ".", "READ_ATTRIBUTE_OPERATION", ",", "address", ",", "name", ")", ";...
Creates a read-attribute operation using the specified address and name. @param address a resource path @param name an attribute name @return a read-attribute operation
[ "Creates", "a", "read", "-", "attribute", "operation", "using", "the", "specified", "address", "and", "name", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/integration/commons/src/main/java/org/infinispan/server/commons/controller/Operations.java#L106-L108
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/MainFieldHandler.java
MainFieldHandler.syncClonedListener
public boolean syncClonedListener(BaseField field, FieldListener listener, boolean bInitCalled) { if (!bInitCalled) ((MainFieldHandler)listener).init(null, keyName); return super.syncClonedListener(field, listener, true); }
java
public boolean syncClonedListener(BaseField field, FieldListener listener, boolean bInitCalled) { if (!bInitCalled) ((MainFieldHandler)listener).init(null, keyName); return super.syncClonedListener(field, listener, true); }
[ "public", "boolean", "syncClonedListener", "(", "BaseField", "field", ",", "FieldListener", "listener", ",", "boolean", "bInitCalled", ")", "{", "if", "(", "!", "bInitCalled", ")", "(", "(", "MainFieldHandler", ")", "listener", ")", ".", "init", "(", "null", ...
Set this cloned listener to the same state at this listener. @param field The field this new listener will be added to. @param The new listener to sync to this. @param Has the init method been called? @return True if I called init.
[ "Set", "this", "cloned", "listener", "to", "the", "same", "state", "at", "this", "listener", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/MainFieldHandler.java#L95-L100
svenkubiak/mangooio
mangooio-core/src/main/java/io/mangoo/i18n/Messages.java
Messages.get
public String get(Key key, Object... arguments) { return get(key.toString(), arguments); }
java
public String get(Key key, Object... arguments) { return get(key.toString(), arguments); }
[ "public", "String", "get", "(", "Key", "key", ",", "Object", "...", "arguments", ")", "{", "return", "get", "(", "key", ".", "toString", "(", ")", ",", "arguments", ")", ";", "}" ]
Returns a localized value for a given key stored in messages_xx.properties and passing the given arguments @param key The key enum to lookup up the localized value @param arguments The arguments to use @return The localized value or null value if the given key is not configured
[ "Returns", "a", "localized", "value", "for", "a", "given", "key", "stored", "in", "messages_xx", ".", "properties", "and", "passing", "the", "given", "arguments" ]
train
https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/i18n/Messages.java#L74-L76
EdwardRaff/JSAT
JSAT/src/jsat/distributions/kernels/BaseL2Kernel.java
BaseL2Kernel.getSqrdNorm
protected double getSqrdNorm(int i, Vec y, List<Double> qi, List<? extends Vec> vecs, List<Double> cache) { if(cache == null) return Math.pow(vecs.get(i).pNormDist(2.0, y), 2); return cache.get(i)+qi.get(0)-2*vecs.get(i).dot(y); }
java
protected double getSqrdNorm(int i, Vec y, List<Double> qi, List<? extends Vec> vecs, List<Double> cache) { if(cache == null) return Math.pow(vecs.get(i).pNormDist(2.0, y), 2); return cache.get(i)+qi.get(0)-2*vecs.get(i).dot(y); }
[ "protected", "double", "getSqrdNorm", "(", "int", "i", ",", "Vec", "y", ",", "List", "<", "Double", ">", "qi", ",", "List", "<", "?", "extends", "Vec", ">", "vecs", ",", "List", "<", "Double", ">", "cache", ")", "{", "if", "(", "cache", "==", "nu...
Returns the squared L<sup>2</sup> norm between a point in the cache and one with a provided qi value @param i the index in the vector list @param y the other vector @param qi the acceleration values for the other vector @param vecs the list of vectors to make the collection @param cache the cache of values for each vector in the collection @return the squared norm ||x<sub>i</sub>-y||<sup>2</sup>
[ "Returns", "the", "squared", "L<sup", ">", "2<", "/", "sup", ">", "norm", "between", "a", "point", "in", "the", "cache", "and", "one", "with", "a", "provided", "qi", "value" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/kernels/BaseL2Kernel.java#L73-L78
akarnokd/akarnokd-xml
src/main/java/hu/akarnokd/xml/XNElement.java
XNElement.getInt
public int getInt(String attribute, String namespace) { return Integer.parseInt(get(attribute, namespace)); }
java
public int getInt(String attribute, String namespace) { return Integer.parseInt(get(attribute, namespace)); }
[ "public", "int", "getInt", "(", "String", "attribute", ",", "String", "namespace", ")", "{", "return", "Integer", ".", "parseInt", "(", "get", "(", "attribute", ",", "namespace", ")", ")", ";", "}" ]
Retrieve an integer attribute or the default value if not exists. @param attribute the attribute name @param namespace the attribute namespace URI @return the value
[ "Retrieve", "an", "integer", "attribute", "or", "the", "default", "value", "if", "not", "exists", "." ]
train
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XNElement.java#L828-L830
JohnPersano/SuperToasts
library/src/main/java/com/github/johnpersano/supertoasts/library/utils/BackgroundUtils.java
BackgroundUtils.getBackground
public static Drawable getBackground(Style style, int color) { // If a frame has been manually set, return the appropriate background if (style.frame > 0) { switch (style.frame) { case Style.FRAME_STANDARD: return BackgroundUtils.getStandardBackground(color); case Style.FRAME_KITKAT: return BackgroundUtils.getKitkatBackground(color); case Style.FRAME_LOLLIPOP: return BackgroundUtils.getLollipopBackground(color); } } // The frame has NOT been manually set so set the frame to correspond with SDK level final int sdkVersion = Build.VERSION.SDK_INT; // These statements should be ordered by highest SDK level to lowest if (sdkVersion >= Build.VERSION_CODES.LOLLIPOP) { style.frame = Style.FRAME_LOLLIPOP; return BackgroundUtils.getLollipopBackground(color); } else if (sdkVersion >= Build.VERSION_CODES.KITKAT) { style.frame = Style.FRAME_KITKAT; return BackgroundUtils.getKitkatBackground(color); } else { style.frame = Style.FRAME_STANDARD; return BackgroundUtils.getStandardBackground(color); } }
java
public static Drawable getBackground(Style style, int color) { // If a frame has been manually set, return the appropriate background if (style.frame > 0) { switch (style.frame) { case Style.FRAME_STANDARD: return BackgroundUtils.getStandardBackground(color); case Style.FRAME_KITKAT: return BackgroundUtils.getKitkatBackground(color); case Style.FRAME_LOLLIPOP: return BackgroundUtils.getLollipopBackground(color); } } // The frame has NOT been manually set so set the frame to correspond with SDK level final int sdkVersion = Build.VERSION.SDK_INT; // These statements should be ordered by highest SDK level to lowest if (sdkVersion >= Build.VERSION_CODES.LOLLIPOP) { style.frame = Style.FRAME_LOLLIPOP; return BackgroundUtils.getLollipopBackground(color); } else if (sdkVersion >= Build.VERSION_CODES.KITKAT) { style.frame = Style.FRAME_KITKAT; return BackgroundUtils.getKitkatBackground(color); } else { style.frame = Style.FRAME_STANDARD; return BackgroundUtils.getStandardBackground(color); } }
[ "public", "static", "Drawable", "getBackground", "(", "Style", "style", ",", "int", "color", ")", "{", "// If a frame has been manually set, return the appropriate background", "if", "(", "style", ".", "frame", ">", "0", ")", "{", "switch", "(", "style", ".", "fra...
Returns a {@link GradientDrawable} with the desired background color. If no {@link Style.Frame} is set prior to calling this method, an appropriate {@link Style.Frame} will be chosen based on the device's SDK level. @param style The current {@link Style} @param color The desired color @return {@link GradientDrawable}
[ "Returns", "a", "{", "@link", "GradientDrawable", "}", "with", "the", "desired", "background", "color", ".", "If", "no", "{", "@link", "Style", ".", "Frame", "}", "is", "set", "prior", "to", "calling", "this", "method", "an", "appropriate", "{", "@link", ...
train
https://github.com/JohnPersano/SuperToasts/blob/5394db6a2f5c38410586d5d001d61f731da1132a/library/src/main/java/com/github/johnpersano/supertoasts/library/utils/BackgroundUtils.java#L44-L69
dita-ot/dita-ot
src/main/java/org/dita/dost/reader/IndexTermReader.java
IndexTermReader.trimSpaceAtStart
private static String trimSpaceAtStart(final String temp, final String termName) { if (termName != null && termName.charAt(termName.length() - 1) == ' ') { if (temp.charAt(0) == ' ') { return temp.substring(1); } } return temp; }
java
private static String trimSpaceAtStart(final String temp, final String termName) { if (termName != null && termName.charAt(termName.length() - 1) == ' ') { if (temp.charAt(0) == ' ') { return temp.substring(1); } } return temp; }
[ "private", "static", "String", "trimSpaceAtStart", "(", "final", "String", "temp", ",", "final", "String", "termName", ")", "{", "if", "(", "termName", "!=", "null", "&&", "termName", ".", "charAt", "(", "termName", ".", "length", "(", ")", "-", "1", ")"...
Trim whitespace from start of the string. If last character of termName and first character of temp is a space character, remove leading string from temp @return trimmed temp value
[ "Trim", "whitespace", "from", "start", "of", "the", "string", ".", "If", "last", "character", "of", "termName", "and", "first", "character", "of", "temp", "is", "a", "space", "character", "remove", "leading", "string", "from", "temp" ]
train
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/reader/IndexTermReader.java#L505-L512
influxdata/influxdb-java
src/main/java/org/influxdb/impl/InfluxDBResultMapper.java
InfluxDBResultMapper.toPOJO
public <T> List<T> toPOJO(final QueryResult queryResult, final Class<T> clazz) throws InfluxDBMapperException { return toPOJO(queryResult, clazz, TimeUnit.MILLISECONDS); }
java
public <T> List<T> toPOJO(final QueryResult queryResult, final Class<T> clazz) throws InfluxDBMapperException { return toPOJO(queryResult, clazz, TimeUnit.MILLISECONDS); }
[ "public", "<", "T", ">", "List", "<", "T", ">", "toPOJO", "(", "final", "QueryResult", "queryResult", ",", "final", "Class", "<", "T", ">", "clazz", ")", "throws", "InfluxDBMapperException", "{", "return", "toPOJO", "(", "queryResult", ",", "clazz", ",", ...
<p> Process a {@link QueryResult} object returned by the InfluxDB client inspecting the internal data structure and creating the respective object instances based on the Class passed as parameter. </p> @param queryResult the InfluxDB result object @param clazz the Class that will be used to hold your measurement data @param <T> the target type @return a {@link List} of objects from the same Class passed as parameter and sorted on the same order as received from InfluxDB. @throws InfluxDBMapperException If {@link QueryResult} parameter contain errors, <code>clazz</code> parameter is not annotated with &#64;Measurement or it was not possible to define the values of your POJO (e.g. due to an unsupported field type).
[ "<p", ">", "Process", "a", "{", "@link", "QueryResult", "}", "object", "returned", "by", "the", "InfluxDB", "client", "inspecting", "the", "internal", "data", "structure", "and", "creating", "the", "respective", "object", "instances", "based", "on", "the", "Cl...
train
https://github.com/influxdata/influxdb-java/blob/8ae777f34aa2e598f609208cf4fa12d4642f83f5/src/main/java/org/influxdb/impl/InfluxDBResultMapper.java#L86-L88
undertow-io/undertow
core/src/main/java/io/undertow/util/ConnectionUtils.java
ConnectionUtils.cleanClose
public static void cleanClose(StreamConnection connection, Closeable... additional) { try { connection.getSinkChannel().shutdownWrites(); if (!connection.getSinkChannel().flush()) { connection.getSinkChannel().setWriteListener(ChannelListeners.flushingChannelListener(new ChannelListener<ConduitStreamSinkChannel>() { @Override public void handleEvent(ConduitStreamSinkChannel channel) { doDrain(connection, additional); } }, new ChannelExceptionHandler<ConduitStreamSinkChannel>() { @Override public void handleException(ConduitStreamSinkChannel channel, IOException exception) { UndertowLogger.REQUEST_IO_LOGGER.ioException(exception); IoUtils.safeClose(connection); IoUtils.safeClose(additional); } })); connection.getSinkChannel().resumeWrites(); } else { doDrain(connection, additional); } } catch (Throwable e) { if (e instanceof IOException) { UndertowLogger.REQUEST_IO_LOGGER.ioException((IOException) e); } else { UndertowLogger.REQUEST_IO_LOGGER.ioException(new IOException(e)); } IoUtils.safeClose(connection); IoUtils.safeClose(additional); } }
java
public static void cleanClose(StreamConnection connection, Closeable... additional) { try { connection.getSinkChannel().shutdownWrites(); if (!connection.getSinkChannel().flush()) { connection.getSinkChannel().setWriteListener(ChannelListeners.flushingChannelListener(new ChannelListener<ConduitStreamSinkChannel>() { @Override public void handleEvent(ConduitStreamSinkChannel channel) { doDrain(connection, additional); } }, new ChannelExceptionHandler<ConduitStreamSinkChannel>() { @Override public void handleException(ConduitStreamSinkChannel channel, IOException exception) { UndertowLogger.REQUEST_IO_LOGGER.ioException(exception); IoUtils.safeClose(connection); IoUtils.safeClose(additional); } })); connection.getSinkChannel().resumeWrites(); } else { doDrain(connection, additional); } } catch (Throwable e) { if (e instanceof IOException) { UndertowLogger.REQUEST_IO_LOGGER.ioException((IOException) e); } else { UndertowLogger.REQUEST_IO_LOGGER.ioException(new IOException(e)); } IoUtils.safeClose(connection); IoUtils.safeClose(additional); } }
[ "public", "static", "void", "cleanClose", "(", "StreamConnection", "connection", ",", "Closeable", "...", "additional", ")", "{", "try", "{", "connection", ".", "getSinkChannel", "(", ")", ".", "shutdownWrites", "(", ")", ";", "if", "(", "!", "connection", "...
Cleanly close a connection, by shutting down and flushing writes and then draining reads. <p> If this fails the connection is forcibly closed. @param connection The connection @param additional Any additional resources to close once the connection has been closed
[ "Cleanly", "close", "a", "connection", "by", "shutting", "down", "and", "flushing", "writes", "and", "then", "draining", "reads", ".", "<p", ">", "If", "this", "fails", "the", "connection", "is", "forcibly", "closed", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/util/ConnectionUtils.java#L55-L86
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.getAsFloatWithDefault
public float getAsFloatWithDefault(String key, float defaultValue) { Object value = getAsObject(key); return FloatConverter.toFloatWithDefault(value, defaultValue); }
java
public float getAsFloatWithDefault(String key, float defaultValue) { Object value = getAsObject(key); return FloatConverter.toFloatWithDefault(value, defaultValue); }
[ "public", "float", "getAsFloatWithDefault", "(", "String", "key", ",", "float", "defaultValue", ")", "{", "Object", "value", "=", "getAsObject", "(", "key", ")", ";", "return", "FloatConverter", ".", "toFloatWithDefault", "(", "value", ",", "defaultValue", ")", ...
Converts map element into a flot or returns default value if conversion is not possible. @param key a key of element to get. @param defaultValue the default value @return flot value of the element or default value if conversion is not supported. @see FloatConverter#toFloatWithDefault(Object, float)
[ "Converts", "map", "element", "into", "a", "flot", "or", "returns", "default", "value", "if", "conversion", "is", "not", "possible", "." ]
train
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L332-L335
threerings/nenya
core/src/main/java/com/threerings/media/util/LineSegmentPath.java
LineSegmentPath.headToNextNode
protected boolean headToNextNode (Pathable pable, long startstamp, long now) { if (_niter == null) { throw new IllegalStateException("headToNextNode() called before init()"); } // check to see if we've completed our path if (!_niter.hasNext()) { // move the pathable to the location of our last destination pable.setLocation(_dest.loc.x, _dest.loc.y); pable.pathCompleted(now); return true; } // our previous destination is now our source _src = _dest; // pop the next node off the path _dest = getNextNode(); // adjust the pathable's orientation if (_dest.dir != NONE) { pable.setOrientation(_dest.dir); } // make a note of when we started traversing this node _nodestamp = startstamp; // figure out the distance from source to destination _seglength = MathUtil.distance( _src.loc.x, _src.loc.y, _dest.loc.x, _dest.loc.y); // if we're already there (the segment length is zero), we skip to // the next segment if (_seglength == 0) { return headToNextNode(pable, startstamp, now); } // now update the pathable's position based on our progress thus far return tick(pable, now); }
java
protected boolean headToNextNode (Pathable pable, long startstamp, long now) { if (_niter == null) { throw new IllegalStateException("headToNextNode() called before init()"); } // check to see if we've completed our path if (!_niter.hasNext()) { // move the pathable to the location of our last destination pable.setLocation(_dest.loc.x, _dest.loc.y); pable.pathCompleted(now); return true; } // our previous destination is now our source _src = _dest; // pop the next node off the path _dest = getNextNode(); // adjust the pathable's orientation if (_dest.dir != NONE) { pable.setOrientation(_dest.dir); } // make a note of when we started traversing this node _nodestamp = startstamp; // figure out the distance from source to destination _seglength = MathUtil.distance( _src.loc.x, _src.loc.y, _dest.loc.x, _dest.loc.y); // if we're already there (the segment length is zero), we skip to // the next segment if (_seglength == 0) { return headToNextNode(pable, startstamp, now); } // now update the pathable's position based on our progress thus far return tick(pable, now); }
[ "protected", "boolean", "headToNextNode", "(", "Pathable", "pable", ",", "long", "startstamp", ",", "long", "now", ")", "{", "if", "(", "_niter", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"headToNextNode() called before init()\"", ")"...
Place the pathable moving along the path at the end of the previous path node, face it appropriately for the next node, and start it on its way. Returns whether the pathable position moved.
[ "Place", "the", "pathable", "moving", "along", "the", "path", "at", "the", "end", "of", "the", "previous", "path", "node", "face", "it", "appropriately", "for", "the", "next", "node", "and", "start", "it", "on", "its", "way", ".", "Returns", "whether", "...
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/util/LineSegmentPath.java#L251-L291
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/MariaDbPooledConnection.java
MariaDbPooledConnection.fireStatementClosed
public void fireStatementClosed(Statement st) { if (st instanceof PreparedStatement) { StatementEvent event = new StatementEvent(this, (PreparedStatement) st); for (StatementEventListener listener : statementEventListeners) { listener.statementClosed(event); } } }
java
public void fireStatementClosed(Statement st) { if (st instanceof PreparedStatement) { StatementEvent event = new StatementEvent(this, (PreparedStatement) st); for (StatementEventListener listener : statementEventListeners) { listener.statementClosed(event); } } }
[ "public", "void", "fireStatementClosed", "(", "Statement", "st", ")", "{", "if", "(", "st", "instanceof", "PreparedStatement", ")", "{", "StatementEvent", "event", "=", "new", "StatementEvent", "(", "this", ",", "(", "PreparedStatement", ")", "st", ")", ";", ...
Fire statement close event to listeners. @param st statement
[ "Fire", "statement", "close", "event", "to", "listeners", "." ]
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbPooledConnection.java#L189-L196
twilio/authy-java
src/main/java/com/authy/api/Users.java
Users.createUser
public com.authy.api.User createUser(String email, String phone, String countryCode) throws AuthyException { User user = new User(email, phone, countryCode); final Response response = this.post(NEW_USER_PATH, user); return userFromJson(response.getStatus(), response.getBody()); }
java
public com.authy.api.User createUser(String email, String phone, String countryCode) throws AuthyException { User user = new User(email, phone, countryCode); final Response response = this.post(NEW_USER_PATH, user); return userFromJson(response.getStatus(), response.getBody()); }
[ "public", "com", ".", "authy", ".", "api", ".", "User", "createUser", "(", "String", "email", ",", "String", "phone", ",", "String", "countryCode", ")", "throws", "AuthyException", "{", "User", "user", "=", "new", "User", "(", "email", ",", "phone", ",",...
Create a new user using his e-mail, phone and country code. @param email @param phone @param countryCode @return a User instance
[ "Create", "a", "new", "user", "using", "his", "e", "-", "mail", "phone", "and", "country", "code", "." ]
train
https://github.com/twilio/authy-java/blob/55e3a5ff57a93b3eb36f5b59e8824e60af2b8b91/src/main/java/com/authy/api/Users.java#L46-L50
VoltDB/voltdb
src/frontend/org/voltcore/messaging/ForeignHost.java
ForeignHost.deliverMessage
private void deliverMessage(long destinationHSId, VoltMessage message) { if (!m_hostMessenger.validateForeignHostId(m_hostId)) { hostLog.warn(String.format("Message (%s) sent to site id: %s @ (%s) at %d from %s " + "which is a known failed host. The message will be dropped\n", message.getClass().getSimpleName(), CoreUtils.hsIdToString(destinationHSId), m_socket.getRemoteSocketAddress().toString(), m_hostMessenger.getHostId(), CoreUtils.hsIdToString(message.m_sourceHSId))); return; } Mailbox mailbox = m_hostMessenger.getMailbox(destinationHSId); /* * At this point we are OK with messages going to sites that don't exist * because we are saying that things can come and go */ if (mailbox == null) { hostLog.info(String.format("Message (%s) sent to unknown site id: %s @ (%s) at %d from %s \n", message.getClass().getSimpleName(), CoreUtils.hsIdToString(destinationHSId), m_socket.getRemoteSocketAddress().toString(), m_hostMessenger.getHostId(), CoreUtils.hsIdToString(message.m_sourceHSId))); /* * If it is for the wrong host, that definitely isn't cool */ if (m_hostMessenger.getHostId() != (int)destinationHSId) { VoltDB.crashLocalVoltDB("Received a message at wrong host", false, null); } return; } // deliver the message to the mailbox mailbox.deliver(message); }
java
private void deliverMessage(long destinationHSId, VoltMessage message) { if (!m_hostMessenger.validateForeignHostId(m_hostId)) { hostLog.warn(String.format("Message (%s) sent to site id: %s @ (%s) at %d from %s " + "which is a known failed host. The message will be dropped\n", message.getClass().getSimpleName(), CoreUtils.hsIdToString(destinationHSId), m_socket.getRemoteSocketAddress().toString(), m_hostMessenger.getHostId(), CoreUtils.hsIdToString(message.m_sourceHSId))); return; } Mailbox mailbox = m_hostMessenger.getMailbox(destinationHSId); /* * At this point we are OK with messages going to sites that don't exist * because we are saying that things can come and go */ if (mailbox == null) { hostLog.info(String.format("Message (%s) sent to unknown site id: %s @ (%s) at %d from %s \n", message.getClass().getSimpleName(), CoreUtils.hsIdToString(destinationHSId), m_socket.getRemoteSocketAddress().toString(), m_hostMessenger.getHostId(), CoreUtils.hsIdToString(message.m_sourceHSId))); /* * If it is for the wrong host, that definitely isn't cool */ if (m_hostMessenger.getHostId() != (int)destinationHSId) { VoltDB.crashLocalVoltDB("Received a message at wrong host", false, null); } return; } // deliver the message to the mailbox mailbox.deliver(message); }
[ "private", "void", "deliverMessage", "(", "long", "destinationHSId", ",", "VoltMessage", "message", ")", "{", "if", "(", "!", "m_hostMessenger", ".", "validateForeignHostId", "(", "m_hostId", ")", ")", "{", "hostLog", ".", "warn", "(", "String", ".", "format",...
Deliver a deserialized message from the network to a local mailbox
[ "Deliver", "a", "deserialized", "message", "from", "the", "network", "to", "a", "local", "mailbox" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/messaging/ForeignHost.java#L313-L347
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/hyphenation/HyphenationTree.java
HyphenationTree.addPattern
public void addPattern(String pattern, String ivalue) { int k = ivalues.find(ivalue); if (k <= 0) { k = packValues(ivalue); ivalues.insert(ivalue, (char)k); } insert(pattern, (char)k); }
java
public void addPattern(String pattern, String ivalue) { int k = ivalues.find(ivalue); if (k <= 0) { k = packValues(ivalue); ivalues.insert(ivalue, (char)k); } insert(pattern, (char)k); }
[ "public", "void", "addPattern", "(", "String", "pattern", ",", "String", "ivalue", ")", "{", "int", "k", "=", "ivalues", ".", "find", "(", "ivalue", ")", ";", "if", "(", "k", "<=", "0", ")", "{", "k", "=", "packValues", "(", "ivalue", ")", ";", "...
Add a pattern to the tree. Mainly, to be used by {@link SimplePatternParser SimplePatternParser} class as callback to add a pattern to the tree. @param pattern the hyphenation pattern @param ivalue interletter weight values indicating the desirability and priority of hyphenating at a given point within the pattern. It should contain only digit characters. (i.e. '0' to '9').
[ "Add", "a", "pattern", "to", "the", "tree", ".", "Mainly", "to", "be", "used", "by", "{" ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/hyphenation/HyphenationTree.java#L441-L448
Azure/azure-sdk-for-java
applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/AnalyticsItemsInner.java
AnalyticsItemsInner.listAsync
public Observable<List<ApplicationInsightsComponentAnalyticsItemInner>> listAsync(String resourceGroupName, String resourceName, ItemScopePath scopePath, ItemScope scope, ItemTypeParameter type, Boolean includeContent) { return listWithServiceResponseAsync(resourceGroupName, resourceName, scopePath, scope, type, includeContent).map(new Func1<ServiceResponse<List<ApplicationInsightsComponentAnalyticsItemInner>>, List<ApplicationInsightsComponentAnalyticsItemInner>>() { @Override public List<ApplicationInsightsComponentAnalyticsItemInner> call(ServiceResponse<List<ApplicationInsightsComponentAnalyticsItemInner>> response) { return response.body(); } }); }
java
public Observable<List<ApplicationInsightsComponentAnalyticsItemInner>> listAsync(String resourceGroupName, String resourceName, ItemScopePath scopePath, ItemScope scope, ItemTypeParameter type, Boolean includeContent) { return listWithServiceResponseAsync(resourceGroupName, resourceName, scopePath, scope, type, includeContent).map(new Func1<ServiceResponse<List<ApplicationInsightsComponentAnalyticsItemInner>>, List<ApplicationInsightsComponentAnalyticsItemInner>>() { @Override public List<ApplicationInsightsComponentAnalyticsItemInner> call(ServiceResponse<List<ApplicationInsightsComponentAnalyticsItemInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "ApplicationInsightsComponentAnalyticsItemInner", ">", ">", "listAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "ItemScopePath", "scopePath", ",", "ItemScope", "scope", ",", "ItemTypeParameter", ...
Gets a list of Analytics Items defined within an Application Insights component. @param resourceGroupName The name of the resource group. @param resourceName The name of the Application Insights component resource. @param scopePath Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component. Possible values include: 'analyticsItems', 'myanalyticsItems' @param scope Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component. Possible values include: 'shared', 'user' @param type Enum indicating the type of the Analytics item. Possible values include: 'none', 'query', 'function', 'folder', 'recent' @param includeContent Flag indicating whether or not to return the content of each applicable item. If false, only return the item information. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;ApplicationInsightsComponentAnalyticsItemInner&gt; object
[ "Gets", "a", "list", "of", "Analytics", "Items", "defined", "within", "an", "Application", "Insights", "component", "." ]
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/AnalyticsItemsInner.java#L216-L223
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/util/JsonUtil.java
JsonUtil.getString
public static String getString(JsonObject object, String field) { final JsonValue value = object.get(field); throwExceptionIfNull(value, field); return value.asString(); }
java
public static String getString(JsonObject object, String field) { final JsonValue value = object.get(field); throwExceptionIfNull(value, field); return value.asString(); }
[ "public", "static", "String", "getString", "(", "JsonObject", "object", ",", "String", "field", ")", "{", "final", "JsonValue", "value", "=", "object", ".", "get", "(", "field", ")", ";", "throwExceptionIfNull", "(", "value", ",", "field", ")", ";", "retur...
Returns a field in a Json object as a string. Throws IllegalArgumentException if the field value is null. @param object the Json Object @param field the field in the Json object to return @return the Json field value as a string
[ "Returns", "a", "field", "in", "a", "Json", "object", "as", "a", "string", ".", "Throws", "IllegalArgumentException", "if", "the", "field", "value", "is", "null", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/JsonUtil.java#L168-L172
apache/flink
flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java
Graph.mapEdges
@SuppressWarnings({ "unchecked", "rawtypes" }) public <NV> Graph<K, VV, NV> mapEdges(final MapFunction<Edge<K, EV>, NV> mapper) { TypeInformation<K> keyType = ((TupleTypeInfo<?>) edges.getType()).getTypeAt(0); TypeInformation<NV> valueType; if (mapper instanceof ResultTypeQueryable) { valueType = ((ResultTypeQueryable) mapper).getProducedType(); } else { valueType = TypeExtractor.createTypeInfo(MapFunction.class, mapper.getClass(), 1, edges.getType(), null); } TypeInformation<Edge<K, NV>> returnType = (TypeInformation<Edge<K, NV>>) new TupleTypeInfo( Edge.class, keyType, keyType, valueType); return mapEdges(mapper, returnType); }
java
@SuppressWarnings({ "unchecked", "rawtypes" }) public <NV> Graph<K, VV, NV> mapEdges(final MapFunction<Edge<K, EV>, NV> mapper) { TypeInformation<K> keyType = ((TupleTypeInfo<?>) edges.getType()).getTypeAt(0); TypeInformation<NV> valueType; if (mapper instanceof ResultTypeQueryable) { valueType = ((ResultTypeQueryable) mapper).getProducedType(); } else { valueType = TypeExtractor.createTypeInfo(MapFunction.class, mapper.getClass(), 1, edges.getType(), null); } TypeInformation<Edge<K, NV>> returnType = (TypeInformation<Edge<K, NV>>) new TupleTypeInfo( Edge.class, keyType, keyType, valueType); return mapEdges(mapper, returnType); }
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", ",", "\"rawtypes\"", "}", ")", "public", "<", "NV", ">", "Graph", "<", "K", ",", "VV", ",", "NV", ">", "mapEdges", "(", "final", "MapFunction", "<", "Edge", "<", "K", ",", "EV", ">", ",", "NV", ">...
Apply a function to the attribute of each edge in the graph. @param mapper the map function to apply. @return a new graph
[ "Apply", "a", "function", "to", "the", "attribute", "of", "each", "edge", "in", "the", "graph", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L577-L594
nabedge/mixer2
src/main/java/org/mixer2/xhtml/util/GetDescendantsUtil.java
GetDescendantsUtil.getDescendants
public static <T extends AbstractJaxb> List<T> getDescendants(T target, List<T> resultList, Class<T> tagType) { return execute(target, resultList, tagType, null); }
java
public static <T extends AbstractJaxb> List<T> getDescendants(T target, List<T> resultList, Class<T> tagType) { return execute(target, resultList, tagType, null); }
[ "public", "static", "<", "T", "extends", "AbstractJaxb", ">", "List", "<", "T", ">", "getDescendants", "(", "T", "target", ",", "List", "<", "T", ">", "resultList", ",", "Class", "<", "T", ">", "tagType", ")", "{", "return", "execute", "(", "target", ...
タグ指定で子孫要素を返す @param <T> tag class type. (i.e. Div.class, Span.class...) @param target objects for scan @param resultList usually, pass new ArrayList @param tagType tag class @return
[ "タグ指定で子孫要素を返す" ]
train
https://github.com/nabedge/mixer2/blob/8c2db27cfcd65bf0b1e0242ef9362ebd8033777c/src/main/java/org/mixer2/xhtml/util/GetDescendantsUtil.java#L52-L55
Azure/azure-sdk-for-java
iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java
IotHubResourcesInner.beginCreateOrUpdate
public IotHubDescriptionInner beginCreateOrUpdate(String resourceGroupName, String resourceName, IotHubDescriptionInner iotHubDescription, String ifMatch) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, iotHubDescription, ifMatch).toBlocking().single().body(); }
java
public IotHubDescriptionInner beginCreateOrUpdate(String resourceGroupName, String resourceName, IotHubDescriptionInner iotHubDescription, String ifMatch) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, iotHubDescription, ifMatch).toBlocking().single().body(); }
[ "public", "IotHubDescriptionInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "IotHubDescriptionInner", "iotHubDescription", ",", "String", "ifMatch", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", ...
Create or update the metadata of an IoT hub. Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. @param resourceGroupName The name of the resource group that contains the IoT hub. @param resourceName The name of the IoT hub. @param iotHubDescription The IoT hub metadata and security metadata. @param ifMatch ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorDetailsException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the IotHubDescriptionInner object if successful.
[ "Create", "or", "update", "the", "metadata", "of", "an", "IoT", "hub", ".", "Create", "or", "update", "the", "metadata", "of", "an", "Iot", "hub", ".", "The", "usual", "pattern", "to", "modify", "a", "property", "is", "to", "retrieve", "the", "IoT", "h...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java#L577-L579
aws/aws-sdk-java
jmespath-java/src/main/java/com/amazonaws/jmespath/JmesPathFilter.java
JmesPathFilter.accept
@Override public <Input, Output> Output accept(JmesPathVisitor<Input, Output> visitor, Input input) throws InvalidTypeException { return visitor.visit(this, input); }
java
@Override public <Input, Output> Output accept(JmesPathVisitor<Input, Output> visitor, Input input) throws InvalidTypeException { return visitor.visit(this, input); }
[ "@", "Override", "public", "<", "Input", ",", "Output", ">", "Output", "accept", "(", "JmesPathVisitor", "<", "Input", ",", "Output", ">", "visitor", ",", "Input", "input", ")", "throws", "InvalidTypeException", "{", "return", "visitor", ".", "visit", "(", ...
Delegates to either the CodeGen visitor(JmesPathFilter) or Evaluation visitor(JmesPathFilter) based on the type of JmesPath visitor @param visitor CodeGen visitor or Evaluation visitor @param input Input expression that needs to be evaluated @param <Input> Input type for the visitor CodeGen visitor: Void Evaluation visitor: JsonNode @param <Output> Output type for the visitor CodeGen visitor: String Evaluation visitor: JsonNode @return Corresponding output is returned. Evaluated String in the case of CodeGen visitor or an evaluated JsonNode in the case of Evaluation visitor @throws InvalidTypeException
[ "Delegates", "to", "either", "the", "CodeGen", "visitor", "(", "JmesPathFilter", ")", "or", "Evaluation", "visitor", "(", "JmesPathFilter", ")", "based", "on", "the", "type", "of", "JmesPath", "visitor" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/jmespath-java/src/main/java/com/amazonaws/jmespath/JmesPathFilter.java#L76-L79
algolia/algoliasearch-client-java
src/main/java/com/algolia/search/saas/Index.java
Index.batchRules
public JSONObject batchRules(List<JSONObject> rules, boolean forwardToReplicas, boolean clearExistingRules) throws AlgoliaException { return this.batchRules(rules, forwardToReplicas, clearExistingRules, RequestOptions.empty); }
java
public JSONObject batchRules(List<JSONObject> rules, boolean forwardToReplicas, boolean clearExistingRules) throws AlgoliaException { return this.batchRules(rules, forwardToReplicas, clearExistingRules, RequestOptions.empty); }
[ "public", "JSONObject", "batchRules", "(", "List", "<", "JSONObject", ">", "rules", ",", "boolean", "forwardToReplicas", ",", "boolean", "clearExistingRules", ")", "throws", "AlgoliaException", "{", "return", "this", ".", "batchRules", "(", "rules", ",", "forwardT...
Add or Replace a list of synonyms @param rules the list of rules to add/replace @param forwardToReplicas Forward this operation to the replica indices @param clearExistingRules Replace the existing query rules with this batch
[ "Add", "or", "Replace", "a", "list", "of", "synonyms" ]
train
https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L1724-L1726
crnk-project/crnk-framework
crnk-core/src/main/java/io/crnk/core/engine/internal/utils/ExceptionUtil.java
ExceptionUtil.wrapCatchedExceptions
public static <T> T wrapCatchedExceptions(Callable<T> callable, String messageFormat, Object... params) { try { return callable.call(); } catch (Exception e) { String formattedMessage = String.format(messageFormat, params); throw new IllegalStateException(formattedMessage, e); } }
java
public static <T> T wrapCatchedExceptions(Callable<T> callable, String messageFormat, Object... params) { try { return callable.call(); } catch (Exception e) { String formattedMessage = String.format(messageFormat, params); throw new IllegalStateException(formattedMessage, e); } }
[ "public", "static", "<", "T", ">", "T", "wrapCatchedExceptions", "(", "Callable", "<", "T", ">", "callable", ",", "String", "messageFormat", ",", "Object", "...", "params", ")", "{", "try", "{", "return", "callable", ".", "call", "(", ")", ";", "}", "c...
Use this method for exceptiosn that are "never" happen, like missing UTF8 encoding. This method also will make sure no coverage gets lost for such cases. <p> Allows to specify a formatted message with optional parameters.
[ "Use", "this", "method", "for", "exceptiosn", "that", "are", "never", "happen", "like", "missing", "UTF8", "encoding", ".", "This", "method", "also", "will", "make", "sure", "no", "coverage", "gets", "lost", "for", "such", "cases", ".", "<p", ">", "Allows"...
train
https://github.com/crnk-project/crnk-framework/blob/2fd3ef9a991788d46fd2e83b43c8ea37cbaf8681/crnk-core/src/main/java/io/crnk/core/engine/internal/utils/ExceptionUtil.java#L32-L39
lecho/hellocharts-android
hellocharts-library/src/lecho/lib/hellocharts/renderer/PieChartRenderer.java
PieChartRenderer.getValueForAngle
public SliceValue getValueForAngle(int angle, SelectedValue selectedValue) { final PieChartData data = dataProvider.getPieChartData(); final float touchAngle = (angle - rotation + 360f) % 360f; final float sliceScale = 360f / maxSum; float lastAngle = 0f; int sliceIndex = 0; for (SliceValue sliceValue : data.getValues()) { final float tempAngle = Math.abs(sliceValue.getValue()) * sliceScale; if (touchAngle >= lastAngle) { if (null != selectedValue) { selectedValue.set(sliceIndex, sliceIndex, SelectedValueType.NONE); } return sliceValue; } lastAngle += tempAngle; ++sliceIndex; } return null; }
java
public SliceValue getValueForAngle(int angle, SelectedValue selectedValue) { final PieChartData data = dataProvider.getPieChartData(); final float touchAngle = (angle - rotation + 360f) % 360f; final float sliceScale = 360f / maxSum; float lastAngle = 0f; int sliceIndex = 0; for (SliceValue sliceValue : data.getValues()) { final float tempAngle = Math.abs(sliceValue.getValue()) * sliceScale; if (touchAngle >= lastAngle) { if (null != selectedValue) { selectedValue.set(sliceIndex, sliceIndex, SelectedValueType.NONE); } return sliceValue; } lastAngle += tempAngle; ++sliceIndex; } return null; }
[ "public", "SliceValue", "getValueForAngle", "(", "int", "angle", ",", "SelectedValue", "selectedValue", ")", "{", "final", "PieChartData", "data", "=", "dataProvider", ".", "getPieChartData", "(", ")", ";", "final", "float", "touchAngle", "=", "(", "angle", "-",...
Returns SliceValue that is under given angle, selectedValue (if not null) will be hold slice index.
[ "Returns", "SliceValue", "that", "is", "under", "given", "angle", "selectedValue", "(", "if", "not", "null", ")", "will", "be", "hold", "slice", "index", "." ]
train
https://github.com/lecho/hellocharts-android/blob/c41419c9afa097452dee823c7eba0e5136aa96bd/hellocharts-library/src/lecho/lib/hellocharts/renderer/PieChartRenderer.java#L471-L489
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/SuperPositions.java
SuperPositions.getRmsdAtOrigin
public static double getRmsdAtOrigin(Point3d[] fixed, Point3d[] moved) { superposer.setCentered(true); return superposer.getRmsd(fixed, moved); }
java
public static double getRmsdAtOrigin(Point3d[] fixed, Point3d[] moved) { superposer.setCentered(true); return superposer.getRmsd(fixed, moved); }
[ "public", "static", "double", "getRmsdAtOrigin", "(", "Point3d", "[", "]", "fixed", ",", "Point3d", "[", "]", "moved", ")", "{", "superposer", ".", "setCentered", "(", "true", ")", ";", "return", "superposer", ".", "getRmsd", "(", "fixed", ",", "moved", ...
Use the {@link SuperPosition#getRmsd(Point3d[], Point3d[])} method of the default static SuperPosition algorithm contained in this Class, assuming that the point arrays are centered at the origin.
[ "Use", "the", "{" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/SuperPositions.java#L99-L102
google/closure-compiler
src/com/google/javascript/jscomp/NodeUtil.java
NodeUtil.allResultsMatch
static boolean allResultsMatch(Node n, Predicate<Node> p) { switch (n.getToken()) { case CAST: return allResultsMatch(n.getFirstChild(), p); case ASSIGN: case COMMA: return allResultsMatch(n.getLastChild(), p); case AND: case OR: return allResultsMatch(n.getFirstChild(), p) && allResultsMatch(n.getLastChild(), p); case HOOK: return allResultsMatch(n.getSecondChild(), p) && allResultsMatch(n.getLastChild(), p); default: return p.apply(n); } }
java
static boolean allResultsMatch(Node n, Predicate<Node> p) { switch (n.getToken()) { case CAST: return allResultsMatch(n.getFirstChild(), p); case ASSIGN: case COMMA: return allResultsMatch(n.getLastChild(), p); case AND: case OR: return allResultsMatch(n.getFirstChild(), p) && allResultsMatch(n.getLastChild(), p); case HOOK: return allResultsMatch(n.getSecondChild(), p) && allResultsMatch(n.getLastChild(), p); default: return p.apply(n); } }
[ "static", "boolean", "allResultsMatch", "(", "Node", "n", ",", "Predicate", "<", "Node", ">", "p", ")", "{", "switch", "(", "n", ".", "getToken", "(", ")", ")", "{", "case", "CAST", ":", "return", "allResultsMatch", "(", "n", ".", "getFirstChild", "(",...
Apply the supplied predicate against all possible result Nodes of the expression.
[ "Apply", "the", "supplied", "predicate", "against", "all", "possible", "result", "Nodes", "of", "the", "expression", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeUtil.java#L1798-L1815
lessthanoptimal/ejml
main/ejml-dsparse/src/org/ejml/sparse/csc/decomposition/qr/QrStructuralCounts_DSCC.java
QrStructuralCounts_DSCC.createRowElementLinkedLists
void createRowElementLinkedLists( int leftmost[] , int w[]) { for (int k = 0; k < n; k++) { w[head+k] = -1; w[tail+k] = -1; w[nque+k] = 0; } // scan rows in reverse order creating a linked list of nz element indexes in each row for (int i = m-1; i >= 0; i--) { int k = leftmost[i]; // 'k' = left most column in row 'i' if( k == -1 ) // row 'i' is empty continue; if( w[nque+k]++ == 0 ) w[tail+k] = i; w[next+i] = w[head+k]; w[head+k] = i; } }
java
void createRowElementLinkedLists( int leftmost[] , int w[]) { for (int k = 0; k < n; k++) { w[head+k] = -1; w[tail+k] = -1; w[nque+k] = 0; } // scan rows in reverse order creating a linked list of nz element indexes in each row for (int i = m-1; i >= 0; i--) { int k = leftmost[i]; // 'k' = left most column in row 'i' if( k == -1 ) // row 'i' is empty continue; if( w[nque+k]++ == 0 ) w[tail+k] = i; w[next+i] = w[head+k]; w[head+k] = i; } }
[ "void", "createRowElementLinkedLists", "(", "int", "leftmost", "[", "]", ",", "int", "w", "[", "]", ")", "{", "for", "(", "int", "k", "=", "0", ";", "k", "<", "n", ";", "k", "++", ")", "{", "w", "[", "head", "+", "k", "]", "=", "-", "1", ";...
Constructs a linked list in w that specifies which elements in each row are not zero (nz) @param leftmost index first elements in each row @param w work space array
[ "Constructs", "a", "linked", "list", "in", "w", "that", "specifies", "which", "elements", "in", "each", "row", "are", "not", "zero", "(", "nz", ")" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/decomposition/qr/QrStructuralCounts_DSCC.java#L179-L194
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/mock/MockResponse.java
MockResponse.setHeader
@Override public void setHeader(final String name, final String value) { LOG.debug("Setting header, " + name + '=' + value); headers.put(name, value); }
java
@Override public void setHeader(final String name, final String value) { LOG.debug("Setting header, " + name + '=' + value); headers.put(name, value); }
[ "@", "Override", "public", "void", "setHeader", "(", "final", "String", "name", ",", "final", "String", "value", ")", "{", "LOG", ".", "debug", "(", "\"Setting header, \"", "+", "name", "+", "'", "'", "+", "value", ")", ";", "headers", ".", "put", "(",...
Sets a header. @param name the header name. @param value the header value.
[ "Sets", "a", "header", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/mock/MockResponse.java#L107-L111
apache/incubator-druid
server/src/main/java/org/apache/druid/segment/loading/SegmentLoaderLocalCacheManager.java
SegmentLoaderLocalCacheManager.loadSegmentWithRetry
private StorageLocation loadSegmentWithRetry(DataSegment segment, String storageDirStr) throws SegmentLoadingException { for (StorageLocation loc : locations) { if (loc.canHandle(segment)) { File storageDir = new File(loc.getPath(), storageDirStr); try { loadInLocationWithStartMarker(segment, storageDir); return loc; } catch (SegmentLoadingException e) { log.makeAlert( e, "Failed to load segment in current location %s, try next location if any", loc.getPath().getAbsolutePath() ) .addData("location", loc.getPath().getAbsolutePath()) .emit(); cleanupCacheFiles(loc.getPath(), storageDir); } } } throw new SegmentLoadingException("Failed to load segment %s in all locations.", segment.getId()); }
java
private StorageLocation loadSegmentWithRetry(DataSegment segment, String storageDirStr) throws SegmentLoadingException { for (StorageLocation loc : locations) { if (loc.canHandle(segment)) { File storageDir = new File(loc.getPath(), storageDirStr); try { loadInLocationWithStartMarker(segment, storageDir); return loc; } catch (SegmentLoadingException e) { log.makeAlert( e, "Failed to load segment in current location %s, try next location if any", loc.getPath().getAbsolutePath() ) .addData("location", loc.getPath().getAbsolutePath()) .emit(); cleanupCacheFiles(loc.getPath(), storageDir); } } } throw new SegmentLoadingException("Failed to load segment %s in all locations.", segment.getId()); }
[ "private", "StorageLocation", "loadSegmentWithRetry", "(", "DataSegment", "segment", ",", "String", "storageDirStr", ")", "throws", "SegmentLoadingException", "{", "for", "(", "StorageLocation", "loc", ":", "locations", ")", "{", "if", "(", "loc", ".", "canHandle", ...
location may fail because of IO failure, most likely in two cases:<p> 1. druid don't have the write access to this location, most likely the administrator doesn't config it correctly<p> 2. disk failure, druid can't read/write to this disk anymore
[ "location", "may", "fail", "because", "of", "IO", "failure", "most", "likely", "in", "two", "cases", ":", "<p", ">", "1", ".", "druid", "don", "t", "have", "the", "write", "access", "to", "this", "location", "most", "likely", "the", "administrator", "doe...
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/segment/loading/SegmentLoaderLocalCacheManager.java#L180-L204
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WApplication.java
WApplication.addJsFile
public ApplicationResource addJsFile(final String fileName) { if (Util.empty(fileName)) { throw new IllegalArgumentException("A file name must be provided."); } InternalResource resource = new InternalResource(fileName, fileName); ApplicationResource res = new ApplicationResource(resource); addJsResource(res); return res; }
java
public ApplicationResource addJsFile(final String fileName) { if (Util.empty(fileName)) { throw new IllegalArgumentException("A file name must be provided."); } InternalResource resource = new InternalResource(fileName, fileName); ApplicationResource res = new ApplicationResource(resource); addJsResource(res); return res; }
[ "public", "ApplicationResource", "addJsFile", "(", "final", "String", "fileName", ")", "{", "if", "(", "Util", ".", "empty", "(", "fileName", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"A file name must be provided.\"", ")", ";", "}", "Int...
Add custom JavaScript held as an internal resource to be used by the application. @param fileName the JavaScript file name @return the application resource in which the resource details are held
[ "Add", "custom", "JavaScript", "held", "as", "an", "internal", "resource", "to", "be", "used", "by", "the", "application", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WApplication.java#L183-L191
Azure/azure-sdk-for-java
notificationhubs/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2016_03_01/implementation/NamespacesInner.java
NamespacesInner.createOrUpdate
public NamespaceResourceInner createOrUpdate(String resourceGroupName, String namespaceName, NamespaceCreateOrUpdateParameters parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).toBlocking().single().body(); }
java
public NamespaceResourceInner createOrUpdate(String resourceGroupName, String namespaceName, NamespaceCreateOrUpdateParameters parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).toBlocking().single().body(); }
[ "public", "NamespaceResourceInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "namespaceName", ",", "NamespaceCreateOrUpdateParameters", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "namesp...
Creates/Updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. @param resourceGroupName The name of the resource group. @param namespaceName The namespace name. @param parameters Parameters supplied to create a Namespace Resource. @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 NamespaceResourceInner object if successful.
[ "Creates", "/", "Updates", "a", "service", "namespace", ".", "Once", "created", "this", "namespace", "s", "resource", "manifest", "is", "immutable", ".", "This", "operation", "is", "idempotent", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/notificationhubs/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2016_03_01/implementation/NamespacesInner.java#L235-L237
igniterealtime/Smack
smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java
Roster.createItem
public void createItem(BareJid jid, String name, String[] groups) throws NotLoggedInException, NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { final XMPPConnection connection = getAuthenticatedConnectionOrThrow(); // Create and send roster entry creation packet. RosterPacket rosterPacket = new RosterPacket(); rosterPacket.setType(IQ.Type.set); RosterPacket.Item item = new RosterPacket.Item(jid, name); if (groups != null) { for (String group : groups) { if (group != null && group.trim().length() > 0) { item.addGroupName(group); } } } rosterPacket.addRosterItem(item); connection.createStanzaCollectorAndSend(rosterPacket).nextResultOrThrow(); }
java
public void createItem(BareJid jid, String name, String[] groups) throws NotLoggedInException, NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { final XMPPConnection connection = getAuthenticatedConnectionOrThrow(); // Create and send roster entry creation packet. RosterPacket rosterPacket = new RosterPacket(); rosterPacket.setType(IQ.Type.set); RosterPacket.Item item = new RosterPacket.Item(jid, name); if (groups != null) { for (String group : groups) { if (group != null && group.trim().length() > 0) { item.addGroupName(group); } } } rosterPacket.addRosterItem(item); connection.createStanzaCollectorAndSend(rosterPacket).nextResultOrThrow(); }
[ "public", "void", "createItem", "(", "BareJid", "jid", ",", "String", "name", ",", "String", "[", "]", "groups", ")", "throws", "NotLoggedInException", ",", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", ...
Creates a new roster item. The server will asynchronously update the roster with the subscription status. <p> There will be no presence subscription request. Consider using {@link #createItemAndRequestSubscription(BareJid, String, String[])} if you also want to request a presence subscription from the contact. </p> @param jid the XMPP address of the contact (e.g. johndoe@jabber.org) @param name the nickname of the user. @param groups the list of group names the entry will belong to, or <tt>null</tt> if the the roster entry won't belong to a group. @throws NoResponseException if there was no response from the server. @throws XMPPErrorException if an XMPP exception occurs. @throws NotLoggedInException If not logged in. @throws NotConnectedException @throws InterruptedException @since 4.4.0
[ "Creates", "a", "new", "roster", "item", ".", "The", "server", "will", "asynchronously", "update", "the", "roster", "with", "the", "subscription", "status", ".", "<p", ">", "There", "will", "be", "no", "presence", "subscription", "request", ".", "Consider", ...
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java#L674-L690
census-instrumentation/opencensus-java
contrib/zpages/src/main/java/io/opencensus/contrib/zpages/TraceConfigzZPageHandler.java
TraceConfigzZPageHandler.emitTraceParamsTable
@SuppressWarnings("deprecation") private static void emitTraceParamsTable(TraceParams params, PrintWriter out) { out.write( "<b class=\"title\">Active tracing parameters:</b><br>\n" + "<table class=\"small\" rules=\"all\">\n" + " <tr>\n" + " <td class=\"col_headR\">Name</td>\n" + " <td class=\"col_head\">Value</td>\n" + " </tr>\n"); out.printf( " <tr>%n <td>Sampler</td>%n <td>%s</td>%n </tr>%n", params.getSampler().getDescription()); out.printf( " <tr>%n <td>MaxNumberOfAttributes</td>%n <td>%d</td>%n </tr>%n", params.getMaxNumberOfAttributes()); out.printf( " <tr>%n <td>MaxNumberOfAnnotations</td>%n <td>%d</td>%n </tr>%n", params.getMaxNumberOfAnnotations()); out.printf( " <tr>%n <td>MaxNumberOfNetworkEvents</td>%n <td>%d</td>%n </tr>%n", params.getMaxNumberOfNetworkEvents()); out.printf( " <tr>%n <td>MaxNumberOfLinks</td>%n <td>%d</td>%n </tr>%n", params.getMaxNumberOfLinks()); out.write("</table>\n"); }
java
@SuppressWarnings("deprecation") private static void emitTraceParamsTable(TraceParams params, PrintWriter out) { out.write( "<b class=\"title\">Active tracing parameters:</b><br>\n" + "<table class=\"small\" rules=\"all\">\n" + " <tr>\n" + " <td class=\"col_headR\">Name</td>\n" + " <td class=\"col_head\">Value</td>\n" + " </tr>\n"); out.printf( " <tr>%n <td>Sampler</td>%n <td>%s</td>%n </tr>%n", params.getSampler().getDescription()); out.printf( " <tr>%n <td>MaxNumberOfAttributes</td>%n <td>%d</td>%n </tr>%n", params.getMaxNumberOfAttributes()); out.printf( " <tr>%n <td>MaxNumberOfAnnotations</td>%n <td>%d</td>%n </tr>%n", params.getMaxNumberOfAnnotations()); out.printf( " <tr>%n <td>MaxNumberOfNetworkEvents</td>%n <td>%d</td>%n </tr>%n", params.getMaxNumberOfNetworkEvents()); out.printf( " <tr>%n <td>MaxNumberOfLinks</td>%n <td>%d</td>%n </tr>%n", params.getMaxNumberOfLinks()); out.write("</table>\n"); }
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "private", "static", "void", "emitTraceParamsTable", "(", "TraceParams", "params", ",", "PrintWriter", "out", ")", "{", "out", ".", "write", "(", "\"<b class=\\\"title\\\">Active tracing parameters:</b><br>\\n\"", "+",...
Prints a table to a PrintWriter that shows existing trace parameters.
[ "Prints", "a", "table", "to", "a", "PrintWriter", "that", "shows", "existing", "trace", "parameters", "." ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/contrib/zpages/src/main/java/io/opencensus/contrib/zpages/TraceConfigzZPageHandler.java#L192-L218
transloadit/java-sdk
src/main/java/com/transloadit/sdk/Transloadit.java
Transloadit.cancelAssembly
public AssemblyResponse cancelAssembly(String url) throws RequestException, LocalOperationException { Request request = new Request(this); return new AssemblyResponse(request.delete(url, new HashMap<String, Object>())); }
java
public AssemblyResponse cancelAssembly(String url) throws RequestException, LocalOperationException { Request request = new Request(this); return new AssemblyResponse(request.delete(url, new HashMap<String, Object>())); }
[ "public", "AssemblyResponse", "cancelAssembly", "(", "String", "url", ")", "throws", "RequestException", ",", "LocalOperationException", "{", "Request", "request", "=", "new", "Request", "(", "this", ")", ";", "return", "new", "AssemblyResponse", "(", "request", "...
cancels a running assembly. @param url full url of the Assembly. @return {@link AssemblyResponse} @throws RequestException if request to transloadit server fails. @throws LocalOperationException if something goes wrong while running non-http operations.
[ "cancels", "a", "running", "assembly", "." ]
train
https://github.com/transloadit/java-sdk/blob/9326c540a66f77b3d907d0b2c05bff1145ca14f7/src/main/java/com/transloadit/sdk/Transloadit.java#L152-L156
xvik/dropwizard-guicey
src/main/java/ru/vyarus/dropwizard/guice/module/jersey/hk2/GuiceBindingsModule.java
GuiceBindingsModule.jerseyToGuiceBinding
private void jerseyToGuiceBinding(final Class<?> type, final boolean global) { final ScopedBindingBuilder binding = bindJerseyComponent(binder(), provider, type); if (!global && guiceServletSupport) { binding.in(RequestScoped.class); } }
java
private void jerseyToGuiceBinding(final Class<?> type, final boolean global) { final ScopedBindingBuilder binding = bindJerseyComponent(binder(), provider, type); if (!global && guiceServletSupport) { binding.in(RequestScoped.class); } }
[ "private", "void", "jerseyToGuiceBinding", "(", "final", "Class", "<", "?", ">", "type", ",", "final", "boolean", "global", ")", "{", "final", "ScopedBindingBuilder", "binding", "=", "bindJerseyComponent", "(", "binder", "(", ")", ",", "provider", ",", "type",...
Important moment: request scoped jersey objects must be bound to guice request scope (if guice web used) because otherwise scope delegation to other thread will not work (see {@link com.google.inject.servlet.ServletScopes#transferRequest(java.util.concurrent.Callable)}). <p> WARNING: bean instance must be obtained in current (request) thread in order to be us used later inside transferred thread (simply call {@code provider.get()} (for jersey-managed bean like {@link UriInfo}) before {@code ServletScopes.transferRequest()}. @param type jersey type to bind @param global true for global type binding
[ "Important", "moment", ":", "request", "scoped", "jersey", "objects", "must", "be", "bound", "to", "guice", "request", "scope", "(", "if", "guice", "web", "used", ")", "because", "otherwise", "scope", "delegation", "to", "other", "thread", "will", "not", "wo...
train
https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/jersey/hk2/GuiceBindingsModule.java#L97-L102
psamsotha/jersey-properties
src/main/java/com/github/psamsotha/jersey/properties/JerseyPropertiesFeature.java
JerseyPropertiesFeature.addConfigProviderToMap
private void addConfigProviderToMap(Map<String, String> propertiesMap, Configuration config) { ConfigurationPropertiesProvider provider = new ConfigurationPropertiesProvider(config); propertiesMap.putAll(provider.getProperties()); }
java
private void addConfigProviderToMap(Map<String, String> propertiesMap, Configuration config) { ConfigurationPropertiesProvider provider = new ConfigurationPropertiesProvider(config); propertiesMap.putAll(provider.getProperties()); }
[ "private", "void", "addConfigProviderToMap", "(", "Map", "<", "String", ",", "String", ">", "propertiesMap", ",", "Configuration", "config", ")", "{", "ConfigurationPropertiesProvider", "provider", "=", "new", "ConfigurationPropertiesProvider", "(", "config", ")", ";"...
Add JAX-RS {@code Configuration} properties to global properties. @param propertiesMap the global properties map. @param config the JAX-RX {@code Configuration} object.
[ "Add", "JAX", "-", "RS", "{" ]
train
https://github.com/psamsotha/jersey-properties/blob/97ea8c5d31189c64688ca60bf3995239fce8830b/src/main/java/com/github/psamsotha/jersey/properties/JerseyPropertiesFeature.java#L150-L153
krummas/DrizzleJDBC
src/main/java/org/drizzle/jdbc/DrizzlePreparedStatement.java
DrizzlePreparedStatement.setBlob
public void setBlob(final int parameterIndex, final InputStream inputStream, final long length) throws SQLException { if(inputStream == null) { setNull(parameterIndex, Types.BLOB); return; } try { setParameter(parameterIndex, new StreamParameter(inputStream, length)); } catch (IOException e) { throw SQLExceptionMapper.getSQLException("Could not read stream", e); } }
java
public void setBlob(final int parameterIndex, final InputStream inputStream, final long length) throws SQLException { if(inputStream == null) { setNull(parameterIndex, Types.BLOB); return; } try { setParameter(parameterIndex, new StreamParameter(inputStream, length)); } catch (IOException e) { throw SQLExceptionMapper.getSQLException("Could not read stream", e); } }
[ "public", "void", "setBlob", "(", "final", "int", "parameterIndex", ",", "final", "InputStream", "inputStream", ",", "final", "long", "length", ")", "throws", "SQLException", "{", "if", "(", "inputStream", "==", "null", ")", "{", "setNull", "(", "parameterInde...
Sets the designated parameter to a <code>InputStream</code> object. The inputstream must contain the number of characters specified by length otherwise a <code>SQLException</code> will be generated when the <code>PreparedStatement</code> is executed. This method differs from the <code>setBinaryStream (int, InputStream, int)</code> method because it informs the driver that the parameter value should be sent to the server as a <code>BLOB</code>. When the <code>setBinaryStream</code> method is used, the driver may have to do extra work to determine whether the parameter data should be sent to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code> @param parameterIndex index of the first parameter is 1, the second is 2, ... @param inputStream An object that contains the data to set the parameter value to. @param length the number of bytes in the parameter data. @throws java.sql.SQLException if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs; this method is called on a closed <code>PreparedStatement</code>; if the length specified is less than zero or if the number of bytes in the inputstream does not match the specfied length. @throws java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support this method @since 1.6
[ "Sets", "the", "designated", "parameter", "to", "a", "<code", ">", "InputStream<", "/", "code", ">", "object", ".", "The", "inputstream", "must", "contain", "the", "number", "of", "characters", "specified", "by", "length", "otherwise", "a", "<code", ">", "SQ...
train
https://github.com/krummas/DrizzleJDBC/blob/716f31fd71f3cc289edf69844d8117deb86d98d6/src/main/java/org/drizzle/jdbc/DrizzlePreparedStatement.java#L601-L612
datastax/java-driver
core/src/main/java/com/datastax/oss/driver/internal/core/type/codec/ParseUtils.java
ParseUtils.skipSpaces
public static int skipSpaces(String toParse, int idx) { while (isBlank(toParse.charAt(idx)) && idx < toParse.length()) ++idx; return idx; }
java
public static int skipSpaces(String toParse, int idx) { while (isBlank(toParse.charAt(idx)) && idx < toParse.length()) ++idx; return idx; }
[ "public", "static", "int", "skipSpaces", "(", "String", "toParse", ",", "int", "idx", ")", "{", "while", "(", "isBlank", "(", "toParse", ".", "charAt", "(", "idx", ")", ")", "&&", "idx", "<", "toParse", ".", "length", "(", ")", ")", "++", "idx", ";...
Returns the index of the first character in toParse from idx that is not a "space". @param toParse the string to skip space on. @param idx the index to start skipping space from. @return the index of the first character in toParse from idx that is not a "space.
[ "Returns", "the", "index", "of", "the", "first", "character", "in", "toParse", "from", "idx", "that", "is", "not", "a", "space", "." ]
train
https://github.com/datastax/java-driver/blob/612a63f2525618e2020e86c9ad75ab37adba6132/core/src/main/java/com/datastax/oss/driver/internal/core/type/codec/ParseUtils.java#L27-L30
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.asImmutable
public static <K, V> SortedMap<K, V> asImmutable(SortedMap<K, V> self) { return asUnmodifiable(new TreeMap<K, V>(self)); }
java
public static <K, V> SortedMap<K, V> asImmutable(SortedMap<K, V> self) { return asUnmodifiable(new TreeMap<K, V>(self)); }
[ "public", "static", "<", "K", ",", "V", ">", "SortedMap", "<", "K", ",", "V", ">", "asImmutable", "(", "SortedMap", "<", "K", ",", "V", ">", "self", ")", "{", "return", "asUnmodifiable", "(", "new", "TreeMap", "<", "K", ",", "V", ">", "(", "self"...
A convenience method for creating an immutable SortedMap. @param self a SortedMap @return an unmodifiable view of a copy of the original, i.e. an effectively immutable copy @see #asImmutable(java.util.List) @see #asUnmodifiable(java.util.SortedMap) @since 1.0
[ "A", "convenience", "method", "for", "creating", "an", "immutable", "SortedMap", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L8265-L8267
CloudSlang/cs-actions
cs-commons/src/main/java/io/cloudslang/content/utils/StringEscapeUtilities.java
StringEscapeUtilities.escapeChar
@NotNull public static String escapeChar(@NotNull final String string, final char toEscape) { final String toEscapeStr = String.valueOf(toEscape); return string.replaceAll("\\\\" + toEscapeStr, toEscapeStr).replaceAll(toEscapeStr, "\\\\" + toEscapeStr); }
java
@NotNull public static String escapeChar(@NotNull final String string, final char toEscape) { final String toEscapeStr = String.valueOf(toEscape); return string.replaceAll("\\\\" + toEscapeStr, toEscapeStr).replaceAll(toEscapeStr, "\\\\" + toEscapeStr); }
[ "@", "NotNull", "public", "static", "String", "escapeChar", "(", "@", "NotNull", "final", "String", "string", ",", "final", "char", "toEscape", ")", "{", "final", "String", "toEscapeStr", "=", "String", ".", "valueOf", "(", "toEscape", ")", ";", "return", ...
Escapes all the occurrences of the <toEscape> character from the <string> if it's not escaped already @param string the string from which to escape the character @param toEscape the character to escape @return a new string with the escaped <toEscape> character
[ "Escapes", "all", "the", "occurrences", "of", "the", "<toEscape", ">", "character", "from", "the", "<string", ">", "if", "it", "s", "not", "escaped", "already" ]
train
https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-commons/src/main/java/io/cloudslang/content/utils/StringEscapeUtilities.java#L39-L43
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/classify/LinearClassifierFactory.java
LinearClassifierFactory.trainSemiSupGE
public LinearClassifier<L,F> trainSemiSupGE(GeneralDataset<L, F> labeledDataset, List<? extends Datum<L, F>> unlabeledDataList) { List<F> GEFeatures = getHighPrecisionFeatures(labeledDataset,0.9,10); return trainSemiSupGE(labeledDataset, unlabeledDataList, GEFeatures,0.5); }
java
public LinearClassifier<L,F> trainSemiSupGE(GeneralDataset<L, F> labeledDataset, List<? extends Datum<L, F>> unlabeledDataList) { List<F> GEFeatures = getHighPrecisionFeatures(labeledDataset,0.9,10); return trainSemiSupGE(labeledDataset, unlabeledDataList, GEFeatures,0.5); }
[ "public", "LinearClassifier", "<", "L", ",", "F", ">", "trainSemiSupGE", "(", "GeneralDataset", "<", "L", ",", "F", ">", "labeledDataset", ",", "List", "<", "?", "extends", "Datum", "<", "L", ",", "F", ">", ">", "unlabeledDataList", ")", "{", "List", "...
Trains the linear classifier using Generalized Expectation criteria as described in <tt>Generalized Expectation Criteria for Semi Supervised Learning of Conditional Random Fields</tt>, Mann and McCallum, ACL 2008. The original algorithm is proposed for CRFs but has been adopted to LinearClassifier (which is a simpler, special case of a CRF). Automatically discovers high precision, high frequency labeled features to be used as GE constraints. IMPORTANT: the current feature selector assumes the features are binary. The GE constraints assume the constraining features are binary anyway, although it doesn't make such assumptions about other features.
[ "Trains", "the", "linear", "classifier", "using", "Generalized", "Expectation", "criteria", "as", "described", "in", "<tt", ">", "Generalized", "Expectation", "Criteria", "for", "Semi", "Supervised", "Learning", "of", "Conditional", "Random", "Fields<", "/", "tt", ...
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/LinearClassifierFactory.java#L192-L195
vigna/Sux4J
src/it/unimi/dsi/sux4j/io/ChunkedHashStore.java
ChunkedHashStore.checkAndRetry
public void checkAndRetry(final Iterable<? extends T> iterable, final LongIterable values) throws IOException { final RandomGenerator random = new XoRoShiRo128PlusRandomGenerator(); int duplicates = 0; for(;;) try { check(); break; } catch (final DuplicateException e) { if (duplicates++ > 3) throw new IllegalArgumentException("The input list contains duplicates"); LOGGER.warn("Found duplicate. Recomputing triples..."); reset(random.nextLong()); addAll(iterable.iterator(), values.iterator()); } checkedForDuplicates = true; }
java
public void checkAndRetry(final Iterable<? extends T> iterable, final LongIterable values) throws IOException { final RandomGenerator random = new XoRoShiRo128PlusRandomGenerator(); int duplicates = 0; for(;;) try { check(); break; } catch (final DuplicateException e) { if (duplicates++ > 3) throw new IllegalArgumentException("The input list contains duplicates"); LOGGER.warn("Found duplicate. Recomputing triples..."); reset(random.nextLong()); addAll(iterable.iterator(), values.iterator()); } checkedForDuplicates = true; }
[ "public", "void", "checkAndRetry", "(", "final", "Iterable", "<", "?", "extends", "T", ">", "iterable", ",", "final", "LongIterable", "values", ")", "throws", "IOException", "{", "final", "RandomGenerator", "random", "=", "new", "XoRoShiRo128PlusRandomGenerator", ...
Checks that this store has no duplicate triples, and try to rebuild if this fails to happen. @param iterable the elements with which the store will be refilled if there are duplicate triples. @param values the values that will be associated with the elements returned by <code>iterable</code>. @throws IllegalArgumentException if after a few trials the store still contains duplicate triples.
[ "Checks", "that", "this", "store", "has", "no", "duplicate", "triples", "and", "try", "to", "rebuild", "if", "this", "fails", "to", "happen", "." ]
train
https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/io/ChunkedHashStore.java#L547-L564
geomajas/geomajas-project-client-gwt
plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/util/FavouritesCommService.java
FavouritesCommService.saveSearchFavourite
public static void saveSearchFavourite(SearchFavourite sf, final DataCallback<SearchFavourite> onFinished) { SaveSearchFavouriteRequest ssfr = new SaveSearchFavouriteRequest(); ssfr.setSearchFavourite(sf); GwtCommand command = new GwtCommand(SaveSearchFavouriteRequest.COMMAND); command.setCommandRequest(ssfr); GwtCommandDispatcher.getInstance().execute(command, new AbstractCommandCallback<SaveSearchFavouriteResponse>() { public void execute(SaveSearchFavouriteResponse response) { if (onFinished != null) { onFinished.execute(response.getSearchFavourite()); } } }); }
java
public static void saveSearchFavourite(SearchFavourite sf, final DataCallback<SearchFavourite> onFinished) { SaveSearchFavouriteRequest ssfr = new SaveSearchFavouriteRequest(); ssfr.setSearchFavourite(sf); GwtCommand command = new GwtCommand(SaveSearchFavouriteRequest.COMMAND); command.setCommandRequest(ssfr); GwtCommandDispatcher.getInstance().execute(command, new AbstractCommandCallback<SaveSearchFavouriteResponse>() { public void execute(SaveSearchFavouriteResponse response) { if (onFinished != null) { onFinished.execute(response.getSearchFavourite()); } } }); }
[ "public", "static", "void", "saveSearchFavourite", "(", "SearchFavourite", "sf", ",", "final", "DataCallback", "<", "SearchFavourite", ">", "onFinished", ")", "{", "SaveSearchFavouriteRequest", "ssfr", "=", "new", "SaveSearchFavouriteRequest", "(", ")", ";", "ssfr", ...
Returns the persisted instance (this has extra properties + id set). @param sf search favourite @param onFinished callback when finished
[ "Returns", "the", "persisted", "instance", "(", "this", "has", "extra", "properties", "+", "id", "set", ")", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/util/FavouritesCommService.java#L62-L74
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
FileUtil.writeBytes
public static File writeBytes(byte[] data, String path) throws IORuntimeException { return writeBytes(data, touch(path)); }
java
public static File writeBytes(byte[] data, String path) throws IORuntimeException { return writeBytes(data, touch(path)); }
[ "public", "static", "File", "writeBytes", "(", "byte", "[", "]", "data", ",", "String", "path", ")", "throws", "IORuntimeException", "{", "return", "writeBytes", "(", "data", ",", "touch", "(", "path", ")", ")", ";", "}" ]
写数据到文件中 @param data 数据 @param path 目标文件 @return 目标文件 @throws IORuntimeException IO异常
[ "写数据到文件中" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L3114-L3116
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/event/SoftDeleteHandler.java
SoftDeleteHandler.doLocalCriteria
public boolean doLocalCriteria(StringBuffer strbFilter, boolean bIncludeFileName, Vector<BaseField> vParamList) { boolean bDontSkip = super.doLocalCriteria(strbFilter, bIncludeFileName, vParamList); if (bDontSkip == true) { if (m_bFilterThisRecord) bDontSkip = !this.isRecordSoftDeleted(); // If set, skip it! } return bDontSkip; // Don't skip (no criteria) }
java
public boolean doLocalCriteria(StringBuffer strbFilter, boolean bIncludeFileName, Vector<BaseField> vParamList) { boolean bDontSkip = super.doLocalCriteria(strbFilter, bIncludeFileName, vParamList); if (bDontSkip == true) { if (m_bFilterThisRecord) bDontSkip = !this.isRecordSoftDeleted(); // If set, skip it! } return bDontSkip; // Don't skip (no criteria) }
[ "public", "boolean", "doLocalCriteria", "(", "StringBuffer", "strbFilter", ",", "boolean", "bIncludeFileName", ",", "Vector", "<", "BaseField", ">", "vParamList", ")", "{", "boolean", "bDontSkip", "=", "super", ".", "doLocalCriteria", "(", "strbFilter", ",", "bInc...
Set up/do the local criteria. @param strbFilter The SQL query string to add to. @param bIncludeFileName Include the file name with this query? @param vParamList The param list to add the raw data to (for prepared statements). @return True if you should not skip this record (does a check on the local data).
[ "Set", "up", "/", "do", "the", "local", "criteria", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/SoftDeleteHandler.java#L100-L109
pressgang-ccms/PressGangCCMSCommonUtilities
src/main/java/org/jboss/pressgang/ccms/utils/common/FileUtilities.java
FileUtilities.saveFile
public static void saveFile(final File file, byte[] fileContents) throws IOException { if (file.isDirectory()) { throw new IOException("Unable to save file contents as a directory."); } final FileOutputStream fos = new FileOutputStream(file); fos.write(fileContents); fos.flush(); fos.close(); }
java
public static void saveFile(final File file, byte[] fileContents) throws IOException { if (file.isDirectory()) { throw new IOException("Unable to save file contents as a directory."); } final FileOutputStream fos = new FileOutputStream(file); fos.write(fileContents); fos.flush(); fos.close(); }
[ "public", "static", "void", "saveFile", "(", "final", "File", "file", ",", "byte", "[", "]", "fileContents", ")", "throws", "IOException", "{", "if", "(", "file", ".", "isDirectory", "(", ")", ")", "{", "throw", "new", "IOException", "(", "\"Unable to save...
Save the data, represented as a byte array to a file @param file The location/name of the file to be saved. @param fileContents The data that is to be written to the file. @throws IOException
[ "Save", "the", "data", "represented", "as", "a", "byte", "array", "to", "a", "file" ]
train
https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/FileUtilities.java#L261-L270
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/Pager.java
Pager.getHeaderValue
private String getHeaderValue(Response response, String key) throws GitLabApiException { String value = response.getHeaderString(key); value = (value != null ? value.trim() : null); if (value == null || value.length() == 0) { return (null); } return (value); }
java
private String getHeaderValue(Response response, String key) throws GitLabApiException { String value = response.getHeaderString(key); value = (value != null ? value.trim() : null); if (value == null || value.length() == 0) { return (null); } return (value); }
[ "private", "String", "getHeaderValue", "(", "Response", "response", ",", "String", "key", ")", "throws", "GitLabApiException", "{", "String", "value", "=", "response", ".", "getHeaderString", "(", "key", ")", ";", "value", "=", "(", "value", "!=", "null", "?...
Get the specified header value from the Response instance. @param response the Response instance to get the value from @param key the HTTP header key to get the value for @return the specified header value from the Response instance, or null if the header is not present @throws GitLabApiException if any error occurs
[ "Get", "the", "specified", "header", "value", "from", "the", "Response", "instance", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/Pager.java#L139-L148
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
NodeImpl.doUnlock
protected void doUnlock() throws RepositoryException { PlainChangesLog changesLog = new PlainChangesLogImpl(new ArrayList<ItemState>(), session, ExtendedEvent.UNLOCK); ItemData lockOwner = dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_LOCKOWNER, 0), ItemType.PROPERTY); changesLog.add(ItemState.createDeletedState(lockOwner)); ItemData lockIsDeep = dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_LOCKISDEEP, 0), ItemType.PROPERTY); changesLog.add(ItemState.createDeletedState(lockIsDeep)); dataManager.getTransactManager().save(changesLog); }
java
protected void doUnlock() throws RepositoryException { PlainChangesLog changesLog = new PlainChangesLogImpl(new ArrayList<ItemState>(), session, ExtendedEvent.UNLOCK); ItemData lockOwner = dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_LOCKOWNER, 0), ItemType.PROPERTY); changesLog.add(ItemState.createDeletedState(lockOwner)); ItemData lockIsDeep = dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_LOCKISDEEP, 0), ItemType.PROPERTY); changesLog.add(ItemState.createDeletedState(lockIsDeep)); dataManager.getTransactManager().save(changesLog); }
[ "protected", "void", "doUnlock", "(", ")", "throws", "RepositoryException", "{", "PlainChangesLog", "changesLog", "=", "new", "PlainChangesLogImpl", "(", "new", "ArrayList", "<", "ItemState", ">", "(", ")", ",", "session", ",", "ExtendedEvent", ".", "UNLOCK", ")...
Remove mix:lockable properties. @throws RepositoryException if error occurs
[ "Remove", "mix", ":", "lockable", "properties", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java#L2823-L2838
foundation-runtime/logging
logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/TransactionLogger.java
TransactionLogger.addProperty
public static void addProperty(String key, String value) { TransactionLogger instance = getInstance(); if (instance != null) { instance.properties.put(key, value); } }
java
public static void addProperty(String key, String value) { TransactionLogger instance = getInstance(); if (instance != null) { instance.properties.put(key, value); } }
[ "public", "static", "void", "addProperty", "(", "String", "key", ",", "String", "value", ")", "{", "TransactionLogger", "instance", "=", "getInstance", "(", ")", ";", "if", "(", "instance", "!=", "null", ")", "{", "instance", ".", "properties", ".", "put",...
Add property to 'properties' map on transaction @param key - of property @param value - of property
[ "Add", "property", "to", "properties", "map", "on", "transaction" ]
train
https://github.com/foundation-runtime/logging/blob/cd0a07b3c5b458ecf90ab92a1e0c72a067f5cbd6/logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/TransactionLogger.java#L205-L210
mozilla/rhino
src/org/mozilla/classfile/ClassFileWriter.java
ClassFileWriter.addField
public void addField(String fieldName, String type, short flags) { short fieldNameIndex = itsConstantPool.addUtf8(fieldName); short typeIndex = itsConstantPool.addUtf8(type); itsFields.add(new ClassFileField(fieldNameIndex, typeIndex, flags)); }
java
public void addField(String fieldName, String type, short flags) { short fieldNameIndex = itsConstantPool.addUtf8(fieldName); short typeIndex = itsConstantPool.addUtf8(type); itsFields.add(new ClassFileField(fieldNameIndex, typeIndex, flags)); }
[ "public", "void", "addField", "(", "String", "fieldName", ",", "String", "type", ",", "short", "flags", ")", "{", "short", "fieldNameIndex", "=", "itsConstantPool", ".", "addUtf8", "(", "fieldName", ")", ";", "short", "typeIndex", "=", "itsConstantPool", ".", ...
Add a field to the class. @param fieldName the name of the field @param type the type of the field using ... @param flags the attributes of the field, such as ACC_PUBLIC, etc. bitwise or'd together
[ "Add", "a", "field", "to", "the", "class", "." ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/classfile/ClassFileWriter.java#L135-L139
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JBaseScreen.java
JBaseScreen.doAction
public boolean doAction(String strAction, int iOptions) { if (strAction == Constants.SUBMIT) { this.controlsToFields(); // Move screen data to record } else if (strAction == Constants.RESET) { this.resetFields(); } return super.doAction(strAction, iOptions); }
java
public boolean doAction(String strAction, int iOptions) { if (strAction == Constants.SUBMIT) { this.controlsToFields(); // Move screen data to record } else if (strAction == Constants.RESET) { this.resetFields(); } return super.doAction(strAction, iOptions); }
[ "public", "boolean", "doAction", "(", "String", "strAction", ",", "int", "iOptions", ")", "{", "if", "(", "strAction", "==", "Constants", ".", "SUBMIT", ")", "{", "this", ".", "controlsToFields", "(", ")", ";", "// Move screen data to record", "}", "else", "...
Process this action. This class calls controltofields on submit and resetfields on reset. @param strAction The message or command to propagate.
[ "Process", "this", "action", ".", "This", "class", "calls", "controltofields", "on", "submit", "and", "resetfields", "on", "reset", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JBaseScreen.java#L291-L302
unbescape/unbescape
src/main/java/org/unbescape/uri/UriEscape.java
UriEscape.unescapeUriPathSegment
public static String unescapeUriPathSegment(final String text, final String encoding) { if (encoding == null) { throw new IllegalArgumentException("Argument 'encoding' cannot be null"); } return UriEscapeUtil.unescape(text, UriEscapeUtil.UriEscapeType.PATH_SEGMENT, encoding); }
java
public static String unescapeUriPathSegment(final String text, final String encoding) { if (encoding == null) { throw new IllegalArgumentException("Argument 'encoding' cannot be null"); } return UriEscapeUtil.unescape(text, UriEscapeUtil.UriEscapeType.PATH_SEGMENT, encoding); }
[ "public", "static", "String", "unescapeUriPathSegment", "(", "final", "String", "text", ",", "final", "String", "encoding", ")", "{", "if", "(", "encoding", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Argument 'encoding' cannot be nul...
<p> Perform am URI path segment <strong>unescape</strong> operation on a <tt>String</tt> input. </p> <p> This method will unescape every percent-encoded (<tt>%HH</tt>) sequences present in input, even for those characters that do not need to be percent-encoded in this context (unreserved characters can be percent-encoded even if/when this is not required, though it is not generally considered a good practice). </p> <p> This method will use specified <tt>encoding</tt> in order to determine the characters specified in the percent-encoded byte sequences. </p> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>String</tt> to be unescaped. @param encoding the encoding to be used for unescaping. @return The unescaped result <tt>String</tt>. As a memory-performance improvement, will return the exact same object as the <tt>text</tt> input argument if no unescaping modifications were required (and no additional <tt>String</tt> objects will be created during processing). Will return <tt>null</tt> if input is <tt>null</tt>.
[ "<p", ">", "Perform", "am", "URI", "path", "segment", "<strong", ">", "unescape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "String<", "/", "tt", ">", "input", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "will", "unescape", ...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/uri/UriEscape.java#L1633-L1638
avarabyeu/restendpoint
src/main/java/com/github/avarabyeu/restendpoint/http/IOUtils.java
IOUtils.loadKeyStore
public static KeyStore loadKeyStore(InputStream keyStore, String password) throws CertificateException, NoSuchAlgorithmException, IOException, KeyStoreException { try { KeyStore trustStore = KeyStore.getInstance("JKS"); trustStore.load(keyStore, password.toCharArray()); return trustStore; } finally { IOUtils.closeQuietly(keyStore); } }
java
public static KeyStore loadKeyStore(InputStream keyStore, String password) throws CertificateException, NoSuchAlgorithmException, IOException, KeyStoreException { try { KeyStore trustStore = KeyStore.getInstance("JKS"); trustStore.load(keyStore, password.toCharArray()); return trustStore; } finally { IOUtils.closeQuietly(keyStore); } }
[ "public", "static", "KeyStore", "loadKeyStore", "(", "InputStream", "keyStore", ",", "String", "password", ")", "throws", "CertificateException", ",", "NoSuchAlgorithmException", ",", "IOException", ",", "KeyStoreException", "{", "try", "{", "KeyStore", "trustStore", ...
Loads keystore @param keyStore Keystore InputStream @param password Keystore password @return Loaded Keystore @throws CertificateException In case of Certificate error @throws NoSuchAlgorithmException If no such algorithm present @throws IOException In case if some IO errors @throws KeyStoreException If there is some error with KeyStore
[ "Loads", "keystore" ]
train
https://github.com/avarabyeu/restendpoint/blob/e11fc0813ea4cefbe4d8bca292cd48b40abf185d/src/main/java/com/github/avarabyeu/restendpoint/http/IOUtils.java#L88-L97
pravega/pravega
common/src/main/java/io/pravega/common/util/BitConverter.java
BitConverter.writeInt
public static int writeInt(ArrayView target, int offset, int value) { return writeInt(target.array(), target.arrayOffset() + offset, value); }
java
public static int writeInt(ArrayView target, int offset, int value) { return writeInt(target.array(), target.arrayOffset() + offset, value); }
[ "public", "static", "int", "writeInt", "(", "ArrayView", "target", ",", "int", "offset", ",", "int", "value", ")", "{", "return", "writeInt", "(", "target", ".", "array", "(", ")", ",", "target", ".", "arrayOffset", "(", ")", "+", "offset", ",", "value...
Writes the given 32-bit Integer to the given ArrayView at the given offset. @param target The ArrayView to write to. @param offset The offset within the ArrayView to write at. @param value The value to write. @return The number of bytes written.
[ "Writes", "the", "given", "32", "-", "bit", "Integer", "to", "the", "given", "ArrayView", "at", "the", "given", "offset", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/BitConverter.java#L56-L58
alkacon/opencms-core
src-gwt/org/opencms/gwt/rebind/rpc/CmsRpcProxyCreator.java
CmsRpcProxyCreator.generateSyncOverride
protected void generateSyncOverride(SourceWriter srcWriter, Map<JMethod, JMethod> syncMethToAsyncMethMap) { srcWriter.println("@Override"); srcWriter.println("public boolean isSync(String methodName) {"); JMethod[] syncMethods = serviceIntf.getOverridableMethods(); for (JMethod syncMethod : syncMethods) { JMethod asyncMethod = syncMethToAsyncMethMap.get(syncMethod); if (!asyncMethod.isAnnotationPresent(SynchronizedRpcRequest.class)) { continue; } srcWriter.indentln( "if (methodName.equals(\"" + getProxySimpleName() + "." + syncMethod.getName() + "\")) {"); srcWriter.indentln("return true;"); srcWriter.indentln("}"); } srcWriter.indentln("return false;"); srcWriter.println("}"); }
java
protected void generateSyncOverride(SourceWriter srcWriter, Map<JMethod, JMethod> syncMethToAsyncMethMap) { srcWriter.println("@Override"); srcWriter.println("public boolean isSync(String methodName) {"); JMethod[] syncMethods = serviceIntf.getOverridableMethods(); for (JMethod syncMethod : syncMethods) { JMethod asyncMethod = syncMethToAsyncMethMap.get(syncMethod); if (!asyncMethod.isAnnotationPresent(SynchronizedRpcRequest.class)) { continue; } srcWriter.indentln( "if (methodName.equals(\"" + getProxySimpleName() + "." + syncMethod.getName() + "\")) {"); srcWriter.indentln("return true;"); srcWriter.indentln("}"); } srcWriter.indentln("return false;"); srcWriter.println("}"); }
[ "protected", "void", "generateSyncOverride", "(", "SourceWriter", "srcWriter", ",", "Map", "<", "JMethod", ",", "JMethod", ">", "syncMethToAsyncMethMap", ")", "{", "srcWriter", ".", "println", "(", "\"@Override\"", ")", ";", "srcWriter", ".", "println", "(", "\"...
Generates a method to check if a given RPC method has to be synchronized.<p> @param srcWriter the source write to generate the code with @param syncMethToAsyncMethMap the method map
[ "Generates", "a", "method", "to", "check", "if", "a", "given", "RPC", "method", "has", "to", "be", "synchronized", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/rebind/rpc/CmsRpcProxyCreator.java#L65-L83
Azure/azure-sdk-for-java
recoveryservices.backup/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_06_01/implementation/RestoresInner.java
RestoresInner.triggerAsync
public Observable<Void> triggerAsync(String vaultName, String resourceGroupName, String fabricName, String containerName, String protectedItemName, String recoveryPointId, RestoreRequestResource resourceRestoreRequest) { return triggerWithServiceResponseAsync(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, recoveryPointId, resourceRestoreRequest).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> triggerAsync(String vaultName, String resourceGroupName, String fabricName, String containerName, String protectedItemName, String recoveryPointId, RestoreRequestResource resourceRestoreRequest) { return triggerWithServiceResponseAsync(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, recoveryPointId, resourceRestoreRequest).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "triggerAsync", "(", "String", "vaultName", ",", "String", "resourceGroupName", ",", "String", "fabricName", ",", "String", "containerName", ",", "String", "protectedItemName", ",", "String", "recoveryPointId", ",", "Restore...
Restores the specified backup data. This is an asynchronous operation. To know the status of this API call, use GetProtectedItemOperationResult API. @param vaultName The name of the Recovery Services vault. @param resourceGroupName The name of the resource group associated with the Recovery Services vault. @param fabricName The fabric name associated with the backup items. @param containerName The container name associated with the backup items. @param protectedItemName The backup item to be restored. @param recoveryPointId The recovery point ID for the backup data to be restored. @param resourceRestoreRequest The resource restore request. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Restores", "the", "specified", "backup", "data", ".", "This", "is", "an", "asynchronous", "operation", ".", "To", "know", "the", "status", "of", "this", "API", "call", "use", "GetProtectedItemOperationResult", "API", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices.backup/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_06_01/implementation/RestoresInner.java#L112-L119
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
NodeImpl.getNextChildIndex
private int getNextChildIndex(InternalQName nameToAdd, InternalQName primaryTypeName, NodeData parentNode, NodeDefinitionData def) throws RepositoryException, ItemExistsException { boolean allowSns = def.isAllowsSameNameSiblings(); int ind = 1; boolean hasSibling = dataManager.hasItemData(parentNode, new QPathEntry(nameToAdd, ind), ItemType.NODE); while (hasSibling) { if (allowSns) { ind++; hasSibling = dataManager.hasItemData(parentNode, new QPathEntry(nameToAdd, ind), ItemType.NODE); } else { throw new ItemExistsException("The node " + nameToAdd + " already exists in " + getPath() + " and same name sibling is not allowed "); } }; return ind; }
java
private int getNextChildIndex(InternalQName nameToAdd, InternalQName primaryTypeName, NodeData parentNode, NodeDefinitionData def) throws RepositoryException, ItemExistsException { boolean allowSns = def.isAllowsSameNameSiblings(); int ind = 1; boolean hasSibling = dataManager.hasItemData(parentNode, new QPathEntry(nameToAdd, ind), ItemType.NODE); while (hasSibling) { if (allowSns) { ind++; hasSibling = dataManager.hasItemData(parentNode, new QPathEntry(nameToAdd, ind), ItemType.NODE); } else { throw new ItemExistsException("The node " + nameToAdd + " already exists in " + getPath() + " and same name sibling is not allowed "); } }; return ind; }
[ "private", "int", "getNextChildIndex", "(", "InternalQName", "nameToAdd", ",", "InternalQName", "primaryTypeName", ",", "NodeData", "parentNode", ",", "NodeDefinitionData", "def", ")", "throws", "RepositoryException", ",", "ItemExistsException", "{", "boolean", "allowSns"...
Calculates next child node index. Is used existed node definition, if no - get one based on node name and node type.
[ "Calculates", "next", "child", "node", "index", ".", "Is", "used", "existed", "node", "definition", "if", "no", "-", "get", "one", "based", "on", "node", "name", "and", "node", "type", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java#L3025-L3048
jenkinsci/jenkins
core/src/main/java/jenkins/mvn/SettingsProvider.java
SettingsProvider.getSettingsRemotePath
public static String getSettingsRemotePath(SettingsProvider settings, AbstractBuild<?, ?> build, TaskListener listener) { FilePath fp = getSettingsFilePath(settings, build, listener); return fp == null ? null : fp.getRemote(); }
java
public static String getSettingsRemotePath(SettingsProvider settings, AbstractBuild<?, ?> build, TaskListener listener) { FilePath fp = getSettingsFilePath(settings, build, listener); return fp == null ? null : fp.getRemote(); }
[ "public", "static", "String", "getSettingsRemotePath", "(", "SettingsProvider", "settings", ",", "AbstractBuild", "<", "?", ",", "?", ">", "build", ",", "TaskListener", "listener", ")", "{", "FilePath", "fp", "=", "getSettingsFilePath", "(", "settings", ",", "bu...
Convenience method handling all <code>null</code> checks. Provides the path on the (possible) remote settings file. @param settings the provider to be used @param build the active build @param listener the listener of the current build @return the path to the settings.xml
[ "Convenience", "method", "handling", "all", "<code", ">", "null<", "/", "code", ">", "checks", ".", "Provides", "the", "path", "on", "the", "(", "possible", ")", "remote", "settings", "file", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/mvn/SettingsProvider.java#L69-L72
interedition/collatex
collatex-core/src/main/java/eu/interedition/collatex/suffixarray/QSufSort.java
QSufSort.choose_pivot
private int choose_pivot(int p, int n) { int pl, pm, pn;// pointers int s; pm = p + (n >> 1); /* small arrays, middle element. */ if (n > 7) { pl = p; pn = p + n - 1; if (n > 40) { /* big arrays, pseudomedian of 9. */ s = n >> 3; pl = MED3(pl, pl + s, pl + s + s); pm = MED3(pm - s, pm, pm + s); pn = MED3(pn - s - s, pn - s, pn); } pm = MED3(pl, pm, pn); /* midsize arrays, median of 3. */ } return KEY(pm); }
java
private int choose_pivot(int p, int n) { int pl, pm, pn;// pointers int s; pm = p + (n >> 1); /* small arrays, middle element. */ if (n > 7) { pl = p; pn = p + n - 1; if (n > 40) { /* big arrays, pseudomedian of 9. */ s = n >> 3; pl = MED3(pl, pl + s, pl + s + s); pm = MED3(pm - s, pm, pm + s); pn = MED3(pn - s - s, pn - s, pn); } pm = MED3(pl, pm, pn); /* midsize arrays, median of 3. */ } return KEY(pm); }
[ "private", "int", "choose_pivot", "(", "int", "p", ",", "int", "n", ")", "{", "int", "pl", ",", "pm", ",", "pn", ";", "// pointers", "int", "s", ";", "pm", "=", "p", "+", "(", "n", ">>", "1", ")", ";", "/* small arrays, middle element. */", "if", "...
Subroutine for {@link #sort_split(int, int)} , algorithm by Bentley & McIlroy.
[ "Subroutine", "for", "{" ]
train
https://github.com/interedition/collatex/blob/76dd1fcc36047bc66a87d31142e72e98b5347821/collatex-core/src/main/java/eu/interedition/collatex/suffixarray/QSufSort.java#L231-L248
oboehm/jfachwert
src/main/java/de/jfachwert/util/ToFachwertSerializer.java
ToFachwertSerializer.serialize
@Override public void serialize(Fachwert fachwert, JsonGenerator jgen, SerializerProvider provider) throws IOException { serialize(fachwert.toMap(), jgen, provider); }
java
@Override public void serialize(Fachwert fachwert, JsonGenerator jgen, SerializerProvider provider) throws IOException { serialize(fachwert.toMap(), jgen, provider); }
[ "@", "Override", "public", "void", "serialize", "(", "Fachwert", "fachwert", ",", "JsonGenerator", "jgen", ",", "SerializerProvider", "provider", ")", "throws", "IOException", "{", "serialize", "(", "fachwert", ".", "toMap", "(", ")", ",", "jgen", ",", "provid...
Fuer die Serialisierung wird der uebergebenen Fachwert nach seinen einzelnen Elementen aufgeteilt und serialisiert. @param fachwert Fachwert @param jgen Json-Generator @param provider Provider @throws IOException sollte nicht auftreten
[ "Fuer", "die", "Serialisierung", "wird", "der", "uebergebenen", "Fachwert", "nach", "seinen", "einzelnen", "Elementen", "aufgeteilt", "und", "serialisiert", "." ]
train
https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/util/ToFachwertSerializer.java#L59-L62
google/closure-compiler
src/com/google/javascript/jscomp/DevirtualizePrototypeMethods.java
DevirtualizePrototypeMethods.isEligibleCallSite
private boolean isEligibleCallSite(Node access, Node definitionSite) { Node invocation = access.getParent(); if (!NodeUtil.isInvocationTarget(access) || !invocation.isCall()) { // TODO(nickreid): Use the same definition of "a call" as // `OptimizeCalls::ReferenceMap::isCallTarget`. // // Accessing the property in any way besides CALL has issues: // - tear-off: invocations can't be tracked // - as constructor: unsupported rewrite // - as tagged template string: unspported rewrite return false; } // We can't rewrite functions called in modules that do not depend on the defining module. // This is due to a subtle execution order change introduced by rewriting. Example: // // `x.foo().bar()` => `JSCompiler_StaticMethods_bar(x.foo())` // // Note how `JSCompiler_StaticMethods_bar` will be resolved before `x.foo()` is executed. In // the case that `x.foo()` defines `JSCompiler_StaticMethods_bar` (e.g. by dynamically loading // the defining module) this change in ordering will cause a `ReferenceError`. No error would // be thrown by the original code because `bar` would be resolved later. // // We choose to use module ordering to avoid this issue because: // - The other eligibility checks for devirtualization prevent any other dangerous cases // that JSCompiler supports. // - Rewriting all call-sites in a way that preserves exact ordering (e.g. using // `ExpressionDecomposer`) has a significant code-size impact (circa 2018-11-19). JSModuleGraph moduleGraph = compiler.getModuleGraph(); @Nullable JSModule definitionModule = moduleForNode(definitionSite); @Nullable JSModule callModule = moduleForNode(access); if (definitionModule == callModule) { // Do nothing. } else if (callModule == null) { return false; } else if (!moduleGraph.dependsOn(callModule, definitionModule)) { return false; } return true; }
java
private boolean isEligibleCallSite(Node access, Node definitionSite) { Node invocation = access.getParent(); if (!NodeUtil.isInvocationTarget(access) || !invocation.isCall()) { // TODO(nickreid): Use the same definition of "a call" as // `OptimizeCalls::ReferenceMap::isCallTarget`. // // Accessing the property in any way besides CALL has issues: // - tear-off: invocations can't be tracked // - as constructor: unsupported rewrite // - as tagged template string: unspported rewrite return false; } // We can't rewrite functions called in modules that do not depend on the defining module. // This is due to a subtle execution order change introduced by rewriting. Example: // // `x.foo().bar()` => `JSCompiler_StaticMethods_bar(x.foo())` // // Note how `JSCompiler_StaticMethods_bar` will be resolved before `x.foo()` is executed. In // the case that `x.foo()` defines `JSCompiler_StaticMethods_bar` (e.g. by dynamically loading // the defining module) this change in ordering will cause a `ReferenceError`. No error would // be thrown by the original code because `bar` would be resolved later. // // We choose to use module ordering to avoid this issue because: // - The other eligibility checks for devirtualization prevent any other dangerous cases // that JSCompiler supports. // - Rewriting all call-sites in a way that preserves exact ordering (e.g. using // `ExpressionDecomposer`) has a significant code-size impact (circa 2018-11-19). JSModuleGraph moduleGraph = compiler.getModuleGraph(); @Nullable JSModule definitionModule = moduleForNode(definitionSite); @Nullable JSModule callModule = moduleForNode(access); if (definitionModule == callModule) { // Do nothing. } else if (callModule == null) { return false; } else if (!moduleGraph.dependsOn(callModule, definitionModule)) { return false; } return true; }
[ "private", "boolean", "isEligibleCallSite", "(", "Node", "access", ",", "Node", "definitionSite", ")", "{", "Node", "invocation", "=", "access", ".", "getParent", "(", ")", ";", "if", "(", "!", "NodeUtil", ".", "isInvocationTarget", "(", "access", ")", "||",...
Determines if a method call is eligible for rewrite as a global function. <p>In order to be eligible for rewrite, the call must: <ul> <li>Property is never accessed outside a function call context. </ul>
[ "Determines", "if", "a", "method", "call", "is", "eligible", "for", "rewrite", "as", "a", "global", "function", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/DevirtualizePrototypeMethods.java#L300-L341
socialsensor/geo-util
src/main/java/eu/socialsensor/geo/ReverseGeocoder.java
ReverseGeocoder.getCountryByLatLon
public String getCountryByLatLon(double lat, double lon){ double[] q = new double[2]; q[0] = lat; q[1] = lon; LightweightGeoObject city = null; try { city = (LightweightGeoObject)tree.nearest(q); } catch (KeySizeException e) { logger.error(e.getMessage()); } if (city == null) return null; return countryCodes.get(city.getCountryCode()); }
java
public String getCountryByLatLon(double lat, double lon){ double[] q = new double[2]; q[0] = lat; q[1] = lon; LightweightGeoObject city = null; try { city = (LightweightGeoObject)tree.nearest(q); } catch (KeySizeException e) { logger.error(e.getMessage()); } if (city == null) return null; return countryCodes.get(city.getCountryCode()); }
[ "public", "String", "getCountryByLatLon", "(", "double", "lat", ",", "double", "lon", ")", "{", "double", "[", "]", "q", "=", "new", "double", "[", "2", "]", ";", "q", "[", "0", "]", "=", "lat", ";", "q", "[", "1", "]", "=", "lon", ";", "Lightw...
Given a pair of lat/lon coordinates return the country where it belongs. @param lat @param lon @return Name of country where it belongs.
[ "Given", "a", "pair", "of", "lat", "/", "lon", "coordinates", "return", "the", "country", "where", "it", "belongs", "." ]
train
https://github.com/socialsensor/geo-util/blob/ffe729896187dc589f4a362d6e6819fc155ced1d/src/main/java/eu/socialsensor/geo/ReverseGeocoder.java#L30-L42
alkacon/opencms-core
src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageHandler.java
CmsContainerpageHandler.createMenuEntryForTemplateContext
private CmsContextMenuEntry createMenuEntryForTemplateContext( final String cookieName, final String value, String label, boolean isActive, I_CmsContextMenuHandler handler, CmsUUID structureId) { CmsContextMenuEntry menuEntry = new CmsContextMenuEntry(handler, structureId, new I_CmsContextMenuCommand() { public void execute( CmsUUID innerStructureId, I_CmsContextMenuHandler innerHandler, CmsContextMenuEntryBean bean) { changeTemplateContextManually(cookieName, value); } public A_CmsContextMenuItem getItemWidget( CmsUUID innerStructureId, I_CmsContextMenuHandler innerHandler, CmsContextMenuEntryBean bean) { return null; } public boolean hasItemWidget() { return false; } }); CmsContextMenuEntryBean bean = new CmsContextMenuEntryBean(); bean.setLabel(label); I_CmsInputCss inputCss = I_CmsInputLayoutBundle.INSTANCE.inputCss(); bean.setIconClass(isActive ? inputCss.checkBoxImageChecked() : ""); bean.setActive(true); bean.setVisible(true); menuEntry.setBean(bean); return menuEntry; }
java
private CmsContextMenuEntry createMenuEntryForTemplateContext( final String cookieName, final String value, String label, boolean isActive, I_CmsContextMenuHandler handler, CmsUUID structureId) { CmsContextMenuEntry menuEntry = new CmsContextMenuEntry(handler, structureId, new I_CmsContextMenuCommand() { public void execute( CmsUUID innerStructureId, I_CmsContextMenuHandler innerHandler, CmsContextMenuEntryBean bean) { changeTemplateContextManually(cookieName, value); } public A_CmsContextMenuItem getItemWidget( CmsUUID innerStructureId, I_CmsContextMenuHandler innerHandler, CmsContextMenuEntryBean bean) { return null; } public boolean hasItemWidget() { return false; } }); CmsContextMenuEntryBean bean = new CmsContextMenuEntryBean(); bean.setLabel(label); I_CmsInputCss inputCss = I_CmsInputLayoutBundle.INSTANCE.inputCss(); bean.setIconClass(isActive ? inputCss.checkBoxImageChecked() : ""); bean.setActive(true); bean.setVisible(true); menuEntry.setBean(bean); return menuEntry; }
[ "private", "CmsContextMenuEntry", "createMenuEntryForTemplateContext", "(", "final", "String", "cookieName", ",", "final", "String", "value", ",", "String", "label", ",", "boolean", "isActive", ",", "I_CmsContextMenuHandler", "handler", ",", "CmsUUID", "structureId", ")...
Creates a context menu entry for selecting a template context.<p> @param cookieName the name of the cookie @param value the value of the cookie @param label the text for the menu entry @param isActive true if context is currently active @param handler the context menu handler @param structureId the current page's structure id @return the created context menu entry
[ "Creates", "a", "context", "menu", "entry", "for", "selecting", "a", "template", "context", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageHandler.java#L1650-L1691
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/validation/SheetBindingErrors.java
SheetBindingErrors.registerFieldFormatter
public void registerFieldFormatter(final String field, final Class<?> fieldType, final FieldFormatter<?> formatter) { registerFieldFormatter(field, fieldType, formatter, false); }
java
public void registerFieldFormatter(final String field, final Class<?> fieldType, final FieldFormatter<?> formatter) { registerFieldFormatter(field, fieldType, formatter, false); }
[ "public", "void", "registerFieldFormatter", "(", "final", "String", "field", ",", "final", "Class", "<", "?", ">", "fieldType", ",", "final", "FieldFormatter", "<", "?", ">", "formatter", ")", "{", "registerFieldFormatter", "(", "field", ",", "fieldType", ",",...
フィールドに対するフォーマッタを登録する。 @since 2.0 @param field フィールド名 @param fieldType フィールドのクラスタイプ @param formatter フォーマッタ
[ "フィールドに対するフォーマッタを登録する。" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/validation/SheetBindingErrors.java#L663-L667
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/api/histogram/PercentileTimer.java
PercentileTimer.get
public static PercentileTimer get(Registry registry, Id id) { return computeIfAbsent(registry, id, 0L, Long.MAX_VALUE); }
java
public static PercentileTimer get(Registry registry, Id id) { return computeIfAbsent(registry, id, 0L, Long.MAX_VALUE); }
[ "public", "static", "PercentileTimer", "get", "(", "Registry", "registry", ",", "Id", "id", ")", "{", "return", "computeIfAbsent", "(", "registry", ",", "id", ",", "0L", ",", "Long", ".", "MAX_VALUE", ")", ";", "}" ]
Creates a timer object that can be used for estimating percentiles. <b>Percentile timers are expensive compared to basic timers from the registry.</b> Be diligent with ensuring that any additional dimensions have a small bounded cardinality. It is also highly recommended to explicitly set a range (see {@link Builder#withRange(long, long, TimeUnit)}) whenever possible. @param registry Registry to use. @param id Identifier for the metric being registered. @return Timer that keeps track of counts by buckets that can be used to estimate the percentiles for the distribution.
[ "Creates", "a", "timer", "object", "that", "can", "be", "used", "for", "estimating", "percentiles", ".", "<b", ">", "Percentile", "timers", "are", "expensive", "compared", "to", "basic", "timers", "from", "the", "registry", ".", "<", "/", "b", ">", "Be", ...
train
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/api/histogram/PercentileTimer.java#L98-L100
skyscreamer/JSONassert
src/main/java/org/skyscreamer/jsonassert/JSONAssert.java
JSONAssert.assertEquals
public static void assertEquals(JSONObject expected, JSONObject actual, boolean strict) throws JSONException { assertEquals(expected, actual, strict ? JSONCompareMode.STRICT : JSONCompareMode.LENIENT); }
java
public static void assertEquals(JSONObject expected, JSONObject actual, boolean strict) throws JSONException { assertEquals(expected, actual, strict ? JSONCompareMode.STRICT : JSONCompareMode.LENIENT); }
[ "public", "static", "void", "assertEquals", "(", "JSONObject", "expected", ",", "JSONObject", "actual", ",", "boolean", "strict", ")", "throws", "JSONException", "{", "assertEquals", "(", "expected", ",", "actual", ",", "strict", "?", "JSONCompareMode", ".", "ST...
Asserts that the JSONObject provided matches the expected JSONObject. If it isn't it throws an {@link AssertionError}. @param expected Expected JSONObject @param actual JSONObject to compare @param strict Enables strict checking @throws JSONException JSON parsing error
[ "Asserts", "that", "the", "JSONObject", "provided", "matches", "the", "expected", "JSONObject", ".", "If", "it", "isn", "t", "it", "throws", "an", "{", "@link", "AssertionError", "}", "." ]
train
https://github.com/skyscreamer/JSONassert/blob/830efcf546d07f955d8a213cc5c8a1db34d78f04/src/main/java/org/skyscreamer/jsonassert/JSONAssert.java#L527-L530
auth0/Lock.Android
lib/src/main/java/com/auth0/android/lock/AuthenticationCallback.java
AuthenticationCallback.parseAuthentication
private void parseAuthentication(Intent data) { String idToken = data.getStringExtra(Constants.ID_TOKEN_EXTRA); String accessToken = data.getStringExtra(Constants.ACCESS_TOKEN_EXTRA); String tokenType = data.getStringExtra(Constants.TOKEN_TYPE_EXTRA); String refreshToken = data.getStringExtra(Constants.REFRESH_TOKEN_EXTRA); long expiresIn = data.getLongExtra(Constants.EXPIRES_IN_EXTRA, 0); Credentials credentials = new Credentials(idToken, accessToken, tokenType, refreshToken, expiresIn); Log.d(TAG, "User authenticated!"); onAuthentication(credentials); }
java
private void parseAuthentication(Intent data) { String idToken = data.getStringExtra(Constants.ID_TOKEN_EXTRA); String accessToken = data.getStringExtra(Constants.ACCESS_TOKEN_EXTRA); String tokenType = data.getStringExtra(Constants.TOKEN_TYPE_EXTRA); String refreshToken = data.getStringExtra(Constants.REFRESH_TOKEN_EXTRA); long expiresIn = data.getLongExtra(Constants.EXPIRES_IN_EXTRA, 0); Credentials credentials = new Credentials(idToken, accessToken, tokenType, refreshToken, expiresIn); Log.d(TAG, "User authenticated!"); onAuthentication(credentials); }
[ "private", "void", "parseAuthentication", "(", "Intent", "data", ")", "{", "String", "idToken", "=", "data", ".", "getStringExtra", "(", "Constants", ".", "ID_TOKEN_EXTRA", ")", ";", "String", "accessToken", "=", "data", ".", "getStringExtra", "(", "Constants", ...
Extracts the Authentication data from the intent data. @param data the intent received at the end of the login process.
[ "Extracts", "the", "Authentication", "data", "from", "the", "intent", "data", "." ]
train
https://github.com/auth0/Lock.Android/blob/8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220/lib/src/main/java/com/auth0/android/lock/AuthenticationCallback.java#L73-L83
wisdom-framework/wisdom
core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/TypeScriptCompilerMojo.java
TypeScriptCompilerMojo.getOutputFile
public File getOutputFile(File input, String ext) { File source; File destination; if (input.getAbsolutePath().startsWith(internalSources.getAbsolutePath())) { source = internalSources; destination = destinationForInternals; } else if (input.getAbsolutePath().startsWith(externalSources.getAbsolutePath())) { source = externalSources; destination = destinationForExternals; } else { return null; } String jsFileName = input.getName().substring(0, input.getName().length() - ".ts".length()) + "." + ext; String path = input.getParentFile().getAbsolutePath().substring(source.getAbsolutePath().length()); return new File(destination, path + "/" + jsFileName); }
java
public File getOutputFile(File input, String ext) { File source; File destination; if (input.getAbsolutePath().startsWith(internalSources.getAbsolutePath())) { source = internalSources; destination = destinationForInternals; } else if (input.getAbsolutePath().startsWith(externalSources.getAbsolutePath())) { source = externalSources; destination = destinationForExternals; } else { return null; } String jsFileName = input.getName().substring(0, input.getName().length() - ".ts".length()) + "." + ext; String path = input.getParentFile().getAbsolutePath().substring(source.getAbsolutePath().length()); return new File(destination, path + "/" + jsFileName); }
[ "public", "File", "getOutputFile", "(", "File", "input", ",", "String", "ext", ")", "{", "File", "source", ";", "File", "destination", ";", "if", "(", "input", ".", "getAbsolutePath", "(", ")", ".", "startsWith", "(", "internalSources", ".", "getAbsolutePath...
Gets the output file for the given input and the given extension. @param input the input file @param ext the extension @return the output file, may not exist
[ "Gets", "the", "output", "file", "for", "the", "given", "input", "and", "the", "given", "extension", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/TypeScriptCompilerMojo.java#L263-L280
actorapp/actor-platform
actor-sdk/sdk-core/runtime/runtime-android/src/main/java/im/actor/runtime/android/time/SntpClient.java
SntpClient.requestTime
public boolean requestTime(String host, int timeout) { DatagramSocket socket = null; try { socket = new DatagramSocket(); socket.setSoTimeout(timeout); InetAddress address = InetAddress.getByName(host); byte[] buffer = new byte[NTP_PACKET_SIZE]; DatagramPacket request = new DatagramPacket(buffer, buffer.length, address, NTP_PORT); // set mode = 3 (client) and version = 3 // mode is in low 3 bits of first byte // version is in bits 3-5 of first byte buffer[0] = NTP_MODE_CLIENT | (NTP_VERSION << 3); // get current time and write it to the request packet long requestTime = System.currentTimeMillis(); long requestTicks = SystemClock.elapsedRealtime(); writeTimeStamp(buffer, TRANSMIT_TIME_OFFSET, requestTime); socket.send(request); // read the response DatagramPacket response = new DatagramPacket(buffer, buffer.length); socket.receive(response); long responseTicks = SystemClock.elapsedRealtime(); long responseTime = requestTime + (responseTicks - requestTicks); // extract the results long originateTime = readTimeStamp(buffer, ORIGINATE_TIME_OFFSET); long receiveTime = readTimeStamp(buffer, RECEIVE_TIME_OFFSET); long transmitTime = readTimeStamp(buffer, TRANSMIT_TIME_OFFSET); long roundTripTime = responseTicks - requestTicks - (transmitTime - receiveTime); // receiveTime = originateTime + transit + skew // responseTime = transmitTime + transit - skew // clockOffset = ((receiveTime - originateTime) + (transmitTime - responseTime))/2 // = ((originateTime + transit + skew - originateTime) + // (transmitTime - (transmitTime + transit - skew)))/2 // = ((transit + skew) + (transmitTime - transmitTime - transit + skew))/2 // = (transit + skew - transit + skew)/2 // = (2 * skew)/2 = skew mClockOffset = ((receiveTime - originateTime) + (transmitTime - responseTime)) / 2; // if (false) Log.d(TAG, "round trip: " + roundTripTime + " ms"); // if (false) Log.d(TAG, "clock offset: " + clockOffset + " ms"); // save our results - use the times on this side of the network latency // (response rather than request time) mNtpTime = responseTime + mClockOffset; mNtpTimeReference = responseTicks; mRoundTripTime = roundTripTime; } catch (Exception e) { return false; } finally { if (socket != null) { socket.close(); } } return true; }
java
public boolean requestTime(String host, int timeout) { DatagramSocket socket = null; try { socket = new DatagramSocket(); socket.setSoTimeout(timeout); InetAddress address = InetAddress.getByName(host); byte[] buffer = new byte[NTP_PACKET_SIZE]; DatagramPacket request = new DatagramPacket(buffer, buffer.length, address, NTP_PORT); // set mode = 3 (client) and version = 3 // mode is in low 3 bits of first byte // version is in bits 3-5 of first byte buffer[0] = NTP_MODE_CLIENT | (NTP_VERSION << 3); // get current time and write it to the request packet long requestTime = System.currentTimeMillis(); long requestTicks = SystemClock.elapsedRealtime(); writeTimeStamp(buffer, TRANSMIT_TIME_OFFSET, requestTime); socket.send(request); // read the response DatagramPacket response = new DatagramPacket(buffer, buffer.length); socket.receive(response); long responseTicks = SystemClock.elapsedRealtime(); long responseTime = requestTime + (responseTicks - requestTicks); // extract the results long originateTime = readTimeStamp(buffer, ORIGINATE_TIME_OFFSET); long receiveTime = readTimeStamp(buffer, RECEIVE_TIME_OFFSET); long transmitTime = readTimeStamp(buffer, TRANSMIT_TIME_OFFSET); long roundTripTime = responseTicks - requestTicks - (transmitTime - receiveTime); // receiveTime = originateTime + transit + skew // responseTime = transmitTime + transit - skew // clockOffset = ((receiveTime - originateTime) + (transmitTime - responseTime))/2 // = ((originateTime + transit + skew - originateTime) + // (transmitTime - (transmitTime + transit - skew)))/2 // = ((transit + skew) + (transmitTime - transmitTime - transit + skew))/2 // = (transit + skew - transit + skew)/2 // = (2 * skew)/2 = skew mClockOffset = ((receiveTime - originateTime) + (transmitTime - responseTime)) / 2; // if (false) Log.d(TAG, "round trip: " + roundTripTime + " ms"); // if (false) Log.d(TAG, "clock offset: " + clockOffset + " ms"); // save our results - use the times on this side of the network latency // (response rather than request time) mNtpTime = responseTime + mClockOffset; mNtpTimeReference = responseTicks; mRoundTripTime = roundTripTime; } catch (Exception e) { return false; } finally { if (socket != null) { socket.close(); } } return true; }
[ "public", "boolean", "requestTime", "(", "String", "host", ",", "int", "timeout", ")", "{", "DatagramSocket", "socket", "=", "null", ";", "try", "{", "socket", "=", "new", "DatagramSocket", "(", ")", ";", "socket", ".", "setSoTimeout", "(", "timeout", ")",...
Sends an SNTP request to the given host and processes the response. @param host host name of the server. @param timeout network timeout in milliseconds. @return true if the transaction was successful.
[ "Sends", "an", "SNTP", "request", "to", "the", "given", "host", "and", "processes", "the", "response", "." ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/runtime/runtime-android/src/main/java/im/actor/runtime/android/time/SntpClient.java#L72-L130
bullhorn/sdk-rest
src/main/java/com/bullhornsdk/data/api/StandardBullhornData.java
StandardBullhornData.handleQueryForEntityEditHistory
protected <T extends EditHistoryEntity> EditHistoryListWrapper handleQueryForEntityEditHistory(Class<T> entityType, String where, Set<String> fieldSet, QueryParams params) { Map<String, String> uriVariables = restUriVariablesFactory.getUriVariablesForEditHistoryQuery(BullhornEntityInfo.getTypesRestEntityName(entityType), where, fieldSet, params); String url = restUrlFactory.assembleQueryUrl(params); return this.performGetRequest(url, EditHistoryListWrapper.class, uriVariables); }
java
protected <T extends EditHistoryEntity> EditHistoryListWrapper handleQueryForEntityEditHistory(Class<T> entityType, String where, Set<String> fieldSet, QueryParams params) { Map<String, String> uriVariables = restUriVariablesFactory.getUriVariablesForEditHistoryQuery(BullhornEntityInfo.getTypesRestEntityName(entityType), where, fieldSet, params); String url = restUrlFactory.assembleQueryUrl(params); return this.performGetRequest(url, EditHistoryListWrapper.class, uriVariables); }
[ "protected", "<", "T", "extends", "EditHistoryEntity", ">", "EditHistoryListWrapper", "handleQueryForEntityEditHistory", "(", "Class", "<", "T", ">", "entityType", ",", "String", "where", ",", "Set", "<", "String", ">", "fieldSet", ",", "QueryParams", "params", ")...
Makes the "query" api call for EditHistory <p> <p> HTTP Method: GET @param entityType the EditHistoryEntity type @param where a SQL type where clause @param fieldSet the fields to return, if null or emtpy will default to "*" all @param params optional QueryParams. @return a EditHistoryListWrapper containing the records plus some additional information
[ "Makes", "the", "query", "api", "call", "for", "EditHistory", "<p", ">", "<p", ">", "HTTP", "Method", ":", "GET" ]
train
https://github.com/bullhorn/sdk-rest/blob/0c75a141c768bb31510afc3a412c11bd101eca06/src/main/java/com/bullhornsdk/data/api/StandardBullhornData.java#L963-L969
burberius/eve-esi
src/main/java/net/troja/eve/esi/api/WarsApi.java
WarsApi.getWarsWarId
public WarResponse getWarsWarId(Integer warId, String datasource, String ifNoneMatch) throws ApiException { ApiResponse<WarResponse> resp = getWarsWarIdWithHttpInfo(warId, datasource, ifNoneMatch); return resp.getData(); }
java
public WarResponse getWarsWarId(Integer warId, String datasource, String ifNoneMatch) throws ApiException { ApiResponse<WarResponse> resp = getWarsWarIdWithHttpInfo(warId, datasource, ifNoneMatch); return resp.getData(); }
[ "public", "WarResponse", "getWarsWarId", "(", "Integer", "warId", ",", "String", "datasource", ",", "String", "ifNoneMatch", ")", "throws", "ApiException", "{", "ApiResponse", "<", "WarResponse", ">", "resp", "=", "getWarsWarIdWithHttpInfo", "(", "warId", ",", "da...
Get war information Return details about a war --- This route is cached for up to 3600 seconds @param warId ID for a war (required) @param datasource The server name you would like data from (optional, default to tranquility) @param ifNoneMatch ETag from a previous request. A 304 will be returned if this matches the current ETag (optional) @return WarResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Get", "war", "information", "Return", "details", "about", "a", "war", "---", "This", "route", "is", "cached", "for", "up", "to", "3600", "seconds" ]
train
https://github.com/burberius/eve-esi/blob/24a941c592cfc15f23471ef849b282fbc582ca13/src/main/java/net/troja/eve/esi/api/WarsApi.java#L282-L285
EMCECS/nfs-client-java
src/main/java/com/emc/ecs/nfsclient/rpc/RpcWrapper.java
RpcWrapper.probeIps
private String[] probeIps() { Set<String> ips = new TreeSet<String>(); for (int i = 0; i < 32; ++i) { InetSocketAddress sa = new InetSocketAddress(_server, _port); ips.add(sa.getAddress().getHostAddress()); } if (LOG.isDebugEnabled()) { StringBuffer sb = new StringBuffer(); for (String ip : ips) { sb.append(ip); sb.append(" "); } LOG.debug(sb.toString()); } return (String[]) ips.toArray(new String[0]); }
java
private String[] probeIps() { Set<String> ips = new TreeSet<String>(); for (int i = 0; i < 32; ++i) { InetSocketAddress sa = new InetSocketAddress(_server, _port); ips.add(sa.getAddress().getHostAddress()); } if (LOG.isDebugEnabled()) { StringBuffer sb = new StringBuffer(); for (String ip : ips) { sb.append(ip); sb.append(" "); } LOG.debug(sb.toString()); } return (String[]) ips.toArray(new String[0]); }
[ "private", "String", "[", "]", "probeIps", "(", ")", "{", "Set", "<", "String", ">", "ips", "=", "new", "TreeSet", "<", "String", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "32", ";", "++", "i", ")", "{", "InetSocket...
Find possible IP addresses for communicating with the server. @return The array of addresses.
[ "Find", "possible", "IP", "addresses", "for", "communicating", "with", "the", "server", "." ]
train
https://github.com/EMCECS/nfs-client-java/blob/7ba25bad5052b95cd286052745327729288b2843/src/main/java/com/emc/ecs/nfsclient/rpc/RpcWrapper.java#L319-L336
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/jitdeploy/RMItoIDL.java
RMItoIDL.getPropertyName
private static String getPropertyName(String methodName, int beginIndex) { String propertyName; int secondIndex = beginIndex + 1; if (methodName.length() <= secondIndex || Character.isLowerCase(methodName.charAt(secondIndex))) { // no second letter, or second letter is lowercase, so lowercase // the first letter as well. StringBuilder namebldr = new StringBuilder(methodName); namebldr.setCharAt(beginIndex, Character.toLowerCase(namebldr.charAt(beginIndex))); propertyName = namebldr.substring(beginIndex); } else { // second letter is uppercase (or at least not lowercase, like '_'), // so leave the case of the first letter alone. propertyName = methodName.substring(beginIndex); } return propertyName; }
java
private static String getPropertyName(String methodName, int beginIndex) { String propertyName; int secondIndex = beginIndex + 1; if (methodName.length() <= secondIndex || Character.isLowerCase(methodName.charAt(secondIndex))) { // no second letter, or second letter is lowercase, so lowercase // the first letter as well. StringBuilder namebldr = new StringBuilder(methodName); namebldr.setCharAt(beginIndex, Character.toLowerCase(namebldr.charAt(beginIndex))); propertyName = namebldr.substring(beginIndex); } else { // second letter is uppercase (or at least not lowercase, like '_'), // so leave the case of the first letter alone. propertyName = methodName.substring(beginIndex); } return propertyName; }
[ "private", "static", "String", "getPropertyName", "(", "String", "methodName", ",", "int", "beginIndex", ")", "{", "String", "propertyName", ";", "int", "secondIndex", "=", "beginIndex", "+", "1", ";", "if", "(", "methodName", ".", "length", "(", ")", "<=", ...
Returns the OMG IDL property name for the specified java 'get', 'is', or 'set' method. <p> Basically, the OMG IDL property name is the same as the method name, with the 'get', 'is', or 'set' string stripped off the front, and the first letter changed to lowercase, if the second letter is NOT uppercase. <p> Note that the second letter is strictly for performance, as it is expected that the caller will know if the method name begins with 'get', 'is', or 'set'. <p> @param methodName method name to be converted to a property name @param beginIndex index to the first letter in the method name after 'get', 'is', or 'set' (i.e. the length of either 'get', 'is', or 'set').
[ "Returns", "the", "OMG", "IDL", "property", "name", "for", "the", "specified", "java", "get", "is", "or", "set", "method", ".", "<p", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/jitdeploy/RMItoIDL.java#L904-L926
scalecube/scalecube-services
services-api/src/main/java/io/scalecube/services/transport/api/ServiceMessageCodec.java
ServiceMessageCodec.decodeData
public static ServiceMessage decodeData(ServiceMessage message, Class<?> dataType) throws MessageCodecException { if (dataType == null || !message.hasData(ByteBuf.class) || ((ByteBuf) message.data()).readableBytes() == 0) { return message; } Object data; Class<?> targetType = message.isError() ? ErrorData.class : dataType; ByteBuf dataBuffer = message.data(); try (ByteBufInputStream inputStream = new ByteBufInputStream(dataBuffer, true)) { DataCodec dataCodec = DataCodec.getInstance(message.dataFormatOrDefault()); data = dataCodec.decode(inputStream, targetType); } catch (Throwable ex) { throw new MessageCodecException( "Failed to decode data on message q=" + message.qualifier(), ex); } return ServiceMessage.from(message).data(data).build(); }
java
public static ServiceMessage decodeData(ServiceMessage message, Class<?> dataType) throws MessageCodecException { if (dataType == null || !message.hasData(ByteBuf.class) || ((ByteBuf) message.data()).readableBytes() == 0) { return message; } Object data; Class<?> targetType = message.isError() ? ErrorData.class : dataType; ByteBuf dataBuffer = message.data(); try (ByteBufInputStream inputStream = new ByteBufInputStream(dataBuffer, true)) { DataCodec dataCodec = DataCodec.getInstance(message.dataFormatOrDefault()); data = dataCodec.decode(inputStream, targetType); } catch (Throwable ex) { throw new MessageCodecException( "Failed to decode data on message q=" + message.qualifier(), ex); } return ServiceMessage.from(message).data(data).build(); }
[ "public", "static", "ServiceMessage", "decodeData", "(", "ServiceMessage", "message", ",", "Class", "<", "?", ">", "dataType", ")", "throws", "MessageCodecException", "{", "if", "(", "dataType", "==", "null", "||", "!", "message", ".", "hasData", "(", "ByteBuf...
Decode message. @param message the original message (with {@link ByteBuf} data) @param dataType the type of the data. @return a new Service message that upon {@link ServiceMessage#data()} returns the actual data (of type data type) @throws MessageCodecException when decode fails
[ "Decode", "message", "." ]
train
https://github.com/scalecube/scalecube-services/blob/76c8de6019e5480a1436d12b37acf163f70eea47/services-api/src/main/java/io/scalecube/services/transport/api/ServiceMessageCodec.java#L107-L128
raydac/java-binary-block-parser
jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitOutputStream.java
JBBPBitOutputStream.writeDouble
public void writeDouble(final double value, final JBBPByteOrder byteOrder) throws IOException { final long longValue = Double.doubleToLongBits(value); if (byteOrder == JBBPByteOrder.BIG_ENDIAN) { this.writeInt((int) (longValue >>> 32), byteOrder); this.writeInt((int) longValue, byteOrder); } else { this.writeInt((int) longValue, byteOrder); this.writeInt((int) (longValue >>> 32), byteOrder); } }
java
public void writeDouble(final double value, final JBBPByteOrder byteOrder) throws IOException { final long longValue = Double.doubleToLongBits(value); if (byteOrder == JBBPByteOrder.BIG_ENDIAN) { this.writeInt((int) (longValue >>> 32), byteOrder); this.writeInt((int) longValue, byteOrder); } else { this.writeInt((int) longValue, byteOrder); this.writeInt((int) (longValue >>> 32), byteOrder); } }
[ "public", "void", "writeDouble", "(", "final", "double", "value", ",", "final", "JBBPByteOrder", "byteOrder", ")", "throws", "IOException", "{", "final", "long", "longValue", "=", "Double", ".", "doubleToLongBits", "(", "value", ")", ";", "if", "(", "byteOrder...
Write a double value into the output stream. @param value a value to be written into the output stream. @param byteOrder the byte order of the value bytes to be used for writing. @throws IOException it will be thrown for transport errors @see JBBPByteOrder#BIG_ENDIAN @see JBBPByteOrder#LITTLE_ENDIAN @since 1.4.0
[ "Write", "a", "double", "value", "into", "the", "output", "stream", "." ]
train
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitOutputStream.java#L171-L180
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/temperature/TemperatureConversion.java
TemperatureConversion.convertToCelsius
public static double convertToCelsius (TemperatureScale from, double temperature) { switch(from) { case FARENHEIT: return convertFarenheitToCelsius(temperature); case CELSIUS: return temperature; case KELVIN: return convertKelvinToCelsius(temperature); case RANKINE: return convertRankineToCelsius(temperature); default: throw(new RuntimeException("Invalid termpature conversion")); } }
java
public static double convertToCelsius (TemperatureScale from, double temperature) { switch(from) { case FARENHEIT: return convertFarenheitToCelsius(temperature); case CELSIUS: return temperature; case KELVIN: return convertKelvinToCelsius(temperature); case RANKINE: return convertRankineToCelsius(temperature); default: throw(new RuntimeException("Invalid termpature conversion")); } }
[ "public", "static", "double", "convertToCelsius", "(", "TemperatureScale", "from", ",", "double", "temperature", ")", "{", "switch", "(", "from", ")", "{", "case", "FARENHEIT", ":", "return", "convertFarenheitToCelsius", "(", "temperature", ")", ";", "case", "CE...
Convert a temperature value from another temperature scale into the Celsius temperature scale. @param from TemperatureScale @param temperature value from other scale @return converted temperature value in degrees centigrade
[ "Convert", "a", "temperature", "value", "from", "another", "temperature", "scale", "into", "the", "Celsius", "temperature", "scale", "." ]
train
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/temperature/TemperatureConversion.java#L145-L160
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java
ModuleSummaryBuilder.buildModuleDescription
public void buildModuleDescription(XMLNode node, Content moduleContentTree) { if (!configuration.nocomment) { moduleWriter.addModuleDescription(moduleContentTree); } }
java
public void buildModuleDescription(XMLNode node, Content moduleContentTree) { if (!configuration.nocomment) { moduleWriter.addModuleDescription(moduleContentTree); } }
[ "public", "void", "buildModuleDescription", "(", "XMLNode", "node", ",", "Content", "moduleContentTree", ")", "{", "if", "(", "!", "configuration", ".", "nocomment", ")", "{", "moduleWriter", ".", "addModuleDescription", "(", "moduleContentTree", ")", ";", "}", ...
Build the description for the module. @param node the XML element that specifies which components to document @param moduleContentTree the tree to which the module description will be added
[ "Build", "the", "description", "for", "the", "module", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java#L207-L211
knowm/XChart
xchart/src/main/java/org/knowm/xchart/internal/chartpart/ChartTitle.java
ChartTitle.getBoundsHint
private Rectangle2D getBoundsHint() { if (chart.getStyler().isChartTitleVisible() && chart.getTitle().length() > 0) { TextLayout textLayout = new TextLayout( chart.getTitle(), chart.getStyler().getChartTitleFont(), new FontRenderContext(null, true, false)); Rectangle2D rectangle = textLayout.getBounds(); double width = 2 * chart.getStyler().getChartTitlePadding() + rectangle.getWidth(); double height = 2 * chart.getStyler().getChartTitlePadding() + rectangle.getHeight(); return new Rectangle2D.Double( Double.NaN, Double.NaN, width, height); // Double.NaN indicates not sure yet. } else { return new Rectangle2D .Double(); // Constructs a new Rectangle2D, initialized to location (0, 0) and size (0, // 0). } }
java
private Rectangle2D getBoundsHint() { if (chart.getStyler().isChartTitleVisible() && chart.getTitle().length() > 0) { TextLayout textLayout = new TextLayout( chart.getTitle(), chart.getStyler().getChartTitleFont(), new FontRenderContext(null, true, false)); Rectangle2D rectangle = textLayout.getBounds(); double width = 2 * chart.getStyler().getChartTitlePadding() + rectangle.getWidth(); double height = 2 * chart.getStyler().getChartTitlePadding() + rectangle.getHeight(); return new Rectangle2D.Double( Double.NaN, Double.NaN, width, height); // Double.NaN indicates not sure yet. } else { return new Rectangle2D .Double(); // Constructs a new Rectangle2D, initialized to location (0, 0) and size (0, // 0). } }
[ "private", "Rectangle2D", "getBoundsHint", "(", ")", "{", "if", "(", "chart", ".", "getStyler", "(", ")", ".", "isChartTitleVisible", "(", ")", "&&", "chart", ".", "getTitle", "(", ")", ".", "length", "(", ")", ">", "0", ")", "{", "TextLayout", "textLa...
get the height of the chart title including the chart title padding @return a Rectangle2D defining the height of the chart title including the chart title padding
[ "get", "the", "height", "of", "the", "chart", "title", "including", "the", "chart", "title", "padding" ]
train
https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/internal/chartpart/ChartTitle.java#L102-L122
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java
ApiOvhDedicatedserver.serviceName_statistics_pci_GET
public ArrayList<OvhRtmPci> serviceName_statistics_pci_GET(String serviceName) throws IOException { String qPath = "/dedicated/server/{serviceName}/statistics/pci"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t8); }
java
public ArrayList<OvhRtmPci> serviceName_statistics_pci_GET(String serviceName) throws IOException { String qPath = "/dedicated/server/{serviceName}/statistics/pci"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t8); }
[ "public", "ArrayList", "<", "OvhRtmPci", ">", "serviceName_statistics_pci_GET", "(", "String", "serviceName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/server/{serviceName}/statistics/pci\"", ";", "StringBuilder", "sb", "=", "path", "(", "...
Get server PCI devices informations REST: GET /dedicated/server/{serviceName}/statistics/pci @param serviceName [required] The internal name of your dedicated server
[ "Get", "server", "PCI", "devices", "informations" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L1277-L1282
EdwardRaff/JSAT
JSAT/src/jsat/distributions/kernels/KernelPoints.java
KernelPoints.setErrorTolerance
public void setErrorTolerance(double errorTolerance) { if(Double.isNaN(errorTolerance) || errorTolerance < 0 || errorTolerance > 1) throw new IllegalArgumentException("Error tolerance must be in [0, 1], not " + errorTolerance); this.errorTolerance = errorTolerance; for(KernelPoint kp : points) kp.setErrorTolerance(errorTolerance); }
java
public void setErrorTolerance(double errorTolerance) { if(Double.isNaN(errorTolerance) || errorTolerance < 0 || errorTolerance > 1) throw new IllegalArgumentException("Error tolerance must be in [0, 1], not " + errorTolerance); this.errorTolerance = errorTolerance; for(KernelPoint kp : points) kp.setErrorTolerance(errorTolerance); }
[ "public", "void", "setErrorTolerance", "(", "double", "errorTolerance", ")", "{", "if", "(", "Double", ".", "isNaN", "(", "errorTolerance", ")", "||", "errorTolerance", "<", "0", "||", "errorTolerance", ">", "1", ")", "throw", "new", "IllegalArgumentException", ...
Sets the error tolerance used for projection maintenance strategies such as {@link KernelPoint.BudgetStrategy#PROJECTION} @param errorTolerance the error tolerance in [0, 1]
[ "Sets", "the", "error", "tolerance", "used", "for", "projection", "maintenance", "strategies", "such", "as", "{" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/kernels/KernelPoints.java#L128-L135
facebook/fresco
imagepipeline/src/main/java/com/facebook/imagepipeline/platform/GingerbreadPurgeableDecoder.java
GingerbreadPurgeableDecoder.decodeByteArrayAsPurgeable
@Override protected Bitmap decodeByteArrayAsPurgeable( CloseableReference<PooledByteBuffer> bytesRef, BitmapFactory.Options options) { return decodeFileDescriptorAsPurgeable(bytesRef, bytesRef.get().size(), null, options); }
java
@Override protected Bitmap decodeByteArrayAsPurgeable( CloseableReference<PooledByteBuffer> bytesRef, BitmapFactory.Options options) { return decodeFileDescriptorAsPurgeable(bytesRef, bytesRef.get().size(), null, options); }
[ "@", "Override", "protected", "Bitmap", "decodeByteArrayAsPurgeable", "(", "CloseableReference", "<", "PooledByteBuffer", ">", "bytesRef", ",", "BitmapFactory", ".", "Options", "options", ")", "{", "return", "decodeFileDescriptorAsPurgeable", "(", "bytesRef", ",", "byte...
Decodes a byteArray into a purgeable bitmap @param bytesRef the byte buffer that contains the encoded bytes @param options the options passed to the BitmapFactory @return the decoded bitmap
[ "Decodes", "a", "byteArray", "into", "a", "purgeable", "bitmap" ]
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/platform/GingerbreadPurgeableDecoder.java#L55-L59
ixa-ehu/kaflib
src/main/java/ixa/kaflib/KAFDocument.java
KAFDocument.newEntity
public Entity newEntity(String id, List<Span<Term>> references) { idManager.updateCounter(AnnotationType.ENTITY, id); Entity newEntity = new Entity(id, references); annotationContainer.add(newEntity, Layer.ENTITIES, AnnotationType.ENTITY); return newEntity; }
java
public Entity newEntity(String id, List<Span<Term>> references) { idManager.updateCounter(AnnotationType.ENTITY, id); Entity newEntity = new Entity(id, references); annotationContainer.add(newEntity, Layer.ENTITIES, AnnotationType.ENTITY); return newEntity; }
[ "public", "Entity", "newEntity", "(", "String", "id", ",", "List", "<", "Span", "<", "Term", ">", ">", "references", ")", "{", "idManager", ".", "updateCounter", "(", "AnnotationType", ".", "ENTITY", ",", "id", ")", ";", "Entity", "newEntity", "=", "new"...
Creates an Entity object to load an existing entity. It receives the ID as an argument. The entity is added to the document object. @param id the ID of the named entity. @param type entity type. 8 values are posible: Person, Organization, Location, Date, Time, Money, Percent, Misc. @param references it contains one or more span elements. A span can be used to reference the different occurrences of the same named entity in the document. If the entity is composed by multiple words, multiple target elements are used. @return a new named entity.
[ "Creates", "an", "Entity", "object", "to", "load", "an", "existing", "entity", ".", "It", "receives", "the", "ID", "as", "an", "argument", ".", "The", "entity", "is", "added", "to", "the", "document", "object", "." ]
train
https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L732-L737
podio/podio-java
src/main/java/com/podio/task/TaskAPI.java
TaskAPI.updateDueDate
public void updateDueDate(int taskId, LocalDate dueDate) { getResourceFactory() .getApiResource("/task/" + taskId + "/due_date") .entity(new TaskDueDate(dueDate), MediaType.APPLICATION_JSON_TYPE).put(); }
java
public void updateDueDate(int taskId, LocalDate dueDate) { getResourceFactory() .getApiResource("/task/" + taskId + "/due_date") .entity(new TaskDueDate(dueDate), MediaType.APPLICATION_JSON_TYPE).put(); }
[ "public", "void", "updateDueDate", "(", "int", "taskId", ",", "LocalDate", "dueDate", ")", "{", "getResourceFactory", "(", ")", ".", "getApiResource", "(", "\"/task/\"", "+", "taskId", "+", "\"/due_date\"", ")", ".", "entity", "(", "new", "TaskDueDate", "(", ...
Updates the due date of the task to the given value @param taskId The id of the task @param dueDate The new due date of the task
[ "Updates", "the", "due", "date", "of", "the", "task", "to", "the", "given", "value" ]
train
https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/task/TaskAPI.java#L114-L119
santhosh-tekuri/jlibs
core/src/main/java/jlibs/core/lang/RuntimeUtil.java
RuntimeUtil.runCommand
public static String runCommand(String command, String[] envp, File workingDir) throws IOException{ String cmd[]; if(OS.get().isUnix()) cmd = new String[]{ "sh", "-c", command }; else cmd = new String[]{ "cmd", "/C", command }; Process p = Runtime.getRuntime().exec(cmd, envp, workingDir); ByteArrayOutputStream output = new ByteArrayOutputStream(); redirectStreams(p, output, System.err); try{ p.waitFor(); }catch(InterruptedException ex){ throw new RuntimeException("interrupted", ex); } if(p.exitValue()!=0) throw new IOException("exitValue is "+p.exitValue()); return output.toString(); }
java
public static String runCommand(String command, String[] envp, File workingDir) throws IOException{ String cmd[]; if(OS.get().isUnix()) cmd = new String[]{ "sh", "-c", command }; else cmd = new String[]{ "cmd", "/C", command }; Process p = Runtime.getRuntime().exec(cmd, envp, workingDir); ByteArrayOutputStream output = new ByteArrayOutputStream(); redirectStreams(p, output, System.err); try{ p.waitFor(); }catch(InterruptedException ex){ throw new RuntimeException("interrupted", ex); } if(p.exitValue()!=0) throw new IOException("exitValue is "+p.exitValue()); return output.toString(); }
[ "public", "static", "String", "runCommand", "(", "String", "command", ",", "String", "[", "]", "envp", ",", "File", "workingDir", ")", "throws", "IOException", "{", "String", "cmd", "[", "]", ";", "if", "(", "OS", ".", "get", "(", ")", ".", "isUnix", ...
Runs the specified <code>command</code> in terminal (sh in *nix/cmd in windows) and returns the command output. @param command complete command to be executed @param envp array of strings, each element of which has environment variable settings in the format <i>name</i>=<i>value</i>, or <tt>null</tt> if the subprocess should inherit the environment of the current process. @param workingDir the working directory of the subprocess, or <tt>null</tt> if the subprocess should inherit the working directory of the current process. @return output of the command. @throws IOException If an I/O error occurs @see #runCommand(String)
[ "Runs", "the", "specified", "<code", ">", "command<", "/", "code", ">", "in", "terminal", "(", "sh", "in", "*", "nix", "/", "cmd", "in", "windows", ")", "and", "returns", "the", "command", "output", "." ]
train
https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/core/src/main/java/jlibs/core/lang/RuntimeUtil.java#L73-L92