method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public Map<String, ColladaElement> getIdMap() { if (idMap == null) idMap = addToIdMap(new HashMap<String, ColladaElement>()); return idMap; }
Map<String, ColladaElement> function() { if (idMap == null) idMap = addToIdMap(new HashMap<String, ColladaElement>()); return idMap; }
/** * Returns the Map that maps Collada Id's to ColladaNodes. * The first request actually allocates and fills the map, before it is returned. */
Returns the Map that maps Collada Id's to ColladaNodes. The first request actually allocates and fills the map, before it is returned
getIdMap
{ "repo_name": "jankolkmeier/HmiCore", "path": "HmiGraphics/src/hmi/graphics/collada/ColladaElement.java", "license": "mit", "size": 8931 }
[ "java.util.HashMap", "java.util.Map" ]
import java.util.HashMap; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,970,472
private TreePath findTreePathByRuleAndArtifactClauseName(String ruleName, String clauseName) { @SuppressWarnings("unchecked") Enumeration<DefaultMutableTreeNode> enumeration = rootNode.preorderEnumeration(); boolean insideRule = false; while (enumeration.hasMoreElements()) { DefaultMutableTreeNode node = enumeration.nextElement(); Item item = (Item) node.getUserObject(); if (item.getItemType() == ItemType.RULE) { insideRule = node.toString().equalsIgnoreCase(ruleName); } if ((insideRule == true) && (item.getItemType() == ItemType.ARTIFACT_CLAUSE) && (item.getName().compareTo(clauseName) == 0)) { return new TreePath(node.getPath()); } } return null; }
TreePath function(String ruleName, String clauseName) { @SuppressWarnings(STR) Enumeration<DefaultMutableTreeNode> enumeration = rootNode.preorderEnumeration(); boolean insideRule = false; while (enumeration.hasMoreElements()) { DefaultMutableTreeNode node = enumeration.nextElement(); Item item = (Item) node.getUserObject(); if (item.getItemType() == ItemType.RULE) { insideRule = node.toString().equalsIgnoreCase(ruleName); } if ((insideRule == true) && (item.getItemType() == ItemType.ARTIFACT_CLAUSE) && (item.getName().compareTo(clauseName) == 0)) { return new TreePath(node.getPath()); } } return null; }
/** * Get the TreePath to this Artifact clause given a String rule and clause * name * * @param ruleName the rule name to find * @param clauseName the clause name to find * * @return */
Get the TreePath to this Artifact clause given a String rule and clause name
findTreePathByRuleAndArtifactClauseName
{ "repo_name": "APriestman/autopsy", "path": "Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/FileExporterSettingsPanel.java", "license": "apache-2.0", "size": 104378 }
[ "java.util.Enumeration", "javax.swing.tree.DefaultMutableTreeNode", "javax.swing.tree.TreePath" ]
import java.util.Enumeration; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreePath;
import java.util.*; import javax.swing.tree.*;
[ "java.util", "javax.swing" ]
java.util; javax.swing;
564,263
public long reduceEntriesToLong(long parallelismThreshold, ObjectToLong<Map.Entry<K,V>> transformer, long basis, LongByLongToLong reducer) { if (transformer == null || reducer == null) throw new NullPointerException(); return new MapReduceEntriesToLongTask<K,V> (null, batchFor(parallelismThreshold), 0, 0, table, null, transformer, basis, reducer).invoke(); }
long function(long parallelismThreshold, ObjectToLong<Map.Entry<K,V>> transformer, long basis, LongByLongToLong reducer) { if (transformer == null reducer == null) throw new NullPointerException(); return new MapReduceEntriesToLongTask<K,V> (null, batchFor(parallelismThreshold), 0, 0, table, null, transformer, basis, reducer).invoke(); }
/** * Returns the result of accumulating the given transformation * of all entries using the given reducer to combine values, * and the given basis as an identity value. * * @param parallelismThreshold the (estimated) number of elements * needed for this operation to be executed in parallel * @param transformer a function returning the transformation * for an element * @param basis the identity (initial default value) for the reduction * @param reducer a commutative associative combining function * @return the result of accumulating the given transformation * of all entries * @since 1.8 */
Returns the result of accumulating the given transformation of all entries using the given reducer to combine values, and the given basis as an identity value
reduceEntriesToLong
{ "repo_name": "afredlyj/learn-netty", "path": "common/src/main/java/io/netty/util/internal/chmv8/ConcurrentHashMapV8.java", "license": "apache-2.0", "size": 262268 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
452,059
@Test public void testLessThan() { assertThat(frequency1, is(lessThan(frequency2))); assertThat(frequency1.isLessThan(frequency2), is(true)); }
void function() { assertThat(frequency1, is(lessThan(frequency2))); assertThat(frequency1.isLessThan(frequency2), is(true)); }
/** * Tests the first object is less than the second object. */
Tests the first object is less than the second object
testLessThan
{ "repo_name": "LorenzReinhart/ONOSnew", "path": "utils/misc/src/test/java/org/onlab/util/FrequencyTest.java", "license": "apache-2.0", "size": 5670 }
[ "org.hamcrest.MatcherAssert", "org.hamcrest.Matchers" ]
import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers;
import org.hamcrest.*;
[ "org.hamcrest" ]
org.hamcrest;
481,050
private boolean applyConfigurations() { Iterator<Map.Entry<InnerConfigPosition, JsonNode>> iter = jsons.entrySet().iterator(); Map.Entry<InnerConfigPosition, JsonNode> entry; InnerConfigPosition key; JsonNode node; String subjectKey; String subjectString; String configKey; boolean isSuccess = true; while (iter.hasNext()) { entry = iter.next(); node = entry.getValue(); key = entry.getKey(); subjectKey = key.subjectKey(); subjectString = key.subject(); configKey = key.configKey(); Class<? extends Config> configClass = networkConfigService.getConfigClass(subjectKey, configKey); //Check that the config class has been imported if (configClass != null) { Object subject = networkConfigService.getSubjectFactory(subjectKey). createSubject(subjectString); try { //Apply the configuration networkConfigService.applyConfig(subject, configClass, node); } catch (IllegalArgumentException e) { log.warn("Error parsing config " + subjectKey + "/" + subject + "/" + configKey); isSuccess = false; } //Now that it has been applied the corresponding JSON entry is no longer needed iter.remove(); } } return isSuccess; }
boolean function() { Iterator<Map.Entry<InnerConfigPosition, JsonNode>> iter = jsons.entrySet().iterator(); Map.Entry<InnerConfigPosition, JsonNode> entry; InnerConfigPosition key; JsonNode node; String subjectKey; String subjectString; String configKey; boolean isSuccess = true; while (iter.hasNext()) { entry = iter.next(); node = entry.getValue(); key = entry.getKey(); subjectKey = key.subjectKey(); subjectString = key.subject(); configKey = key.configKey(); Class<? extends Config> configClass = networkConfigService.getConfigClass(subjectKey, configKey); if (configClass != null) { Object subject = networkConfigService.getSubjectFactory(subjectKey). createSubject(subjectString); try { networkConfigService.applyConfig(subject, configClass, node); } catch (IllegalArgumentException e) { log.warn(STR + subjectKey + "/" + subject + "/" + configKey); isSuccess = false; } iter.remove(); } } return isSuccess; }
/** * Apply the configurations associated with all of the config classes that * are imported and have not yet been applied. * * @return false if any of the configuration parsing fails */
Apply the configurations associated with all of the config classes that are imported and have not yet been applied
applyConfigurations
{ "repo_name": "donNewtonAlpha/onos", "path": "core/net/src/main/java/org/onosproject/net/config/impl/NetworkConfigLoader.java", "license": "apache-2.0", "size": 8209 }
[ "com.fasterxml.jackson.databind.JsonNode", "java.util.Iterator", "java.util.Map", "org.onosproject.net.config.Config" ]
import com.fasterxml.jackson.databind.JsonNode; import java.util.Iterator; import java.util.Map; import org.onosproject.net.config.Config;
import com.fasterxml.jackson.databind.*; import java.util.*; import org.onosproject.net.config.*;
[ "com.fasterxml.jackson", "java.util", "org.onosproject.net" ]
com.fasterxml.jackson; java.util; org.onosproject.net;
610,170
@Test() public void testConstructor2() throws Exception { ByteStringBuffer buffer = new ByteStringBuffer(10); assertEquals(buffer.capacity(), 10); assertTrue(buffer.isEmpty()); assertEquals(buffer.length(), 0); assertEquals(buffer.getBackingArray().length, 10); assertEquals(buffer.toByteArray().length, 0); assertEquals(buffer.toByteString().getValue().length, 0); assertEquals(buffer.toString().length(), 0); buffer.hashCode(); }
@Test() void function() throws Exception { ByteStringBuffer buffer = new ByteStringBuffer(10); assertEquals(buffer.capacity(), 10); assertTrue(buffer.isEmpty()); assertEquals(buffer.length(), 0); assertEquals(buffer.getBackingArray().length, 10); assertEquals(buffer.toByteArray().length, 0); assertEquals(buffer.toByteString().getValue().length, 0); assertEquals(buffer.toString().length(), 0); buffer.hashCode(); }
/** * Provides test coverage for the second constructor. * * @throws Exception If an unexpected problem occurs. */
Provides test coverage for the second constructor
testConstructor2
{ "repo_name": "UnboundID/ldapsdk", "path": "tests/unit/src/com/unboundid/util/ByteStringBufferTestCase.java", "license": "gpl-2.0", "size": 141047 }
[ "org.testng.annotations.Test" ]
import org.testng.annotations.Test;
import org.testng.annotations.*;
[ "org.testng.annotations" ]
org.testng.annotations;
2,813,083
@NonNull public Invoker setPlaceHolderValues(@NonNull Map<String, Object> keyValuePairs) { mPlaceholders.putAll(keyValuePairs); return thisAsT(); }
Invoker function(@NonNull Map<String, Object> keyValuePairs) { mPlaceholders.putAll(keyValuePairs); return thisAsT(); }
/** * Adds placeholders names and associated values for substitution. * @return itself. */
Adds placeholders names and associated values for substitution
setPlaceHolderValues
{ "repo_name": "marcinkwiatkowski/buck", "path": "third-party/java/aosp/src/com/android/manifmerger/ManifestMerger2.java", "license": "apache-2.0", "size": 47767 }
[ "com.android.annotations.NonNull", "java.util.Map" ]
import com.android.annotations.NonNull; import java.util.Map;
import com.android.annotations.*; import java.util.*;
[ "com.android.annotations", "java.util" ]
com.android.annotations; java.util;
918,950
private void checkRequestCaching(String requestUrl, CacheSetting cacheSetting, ExpectedOutcome outcome) throws Exception { URL url = new URL(requestUrl); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setUseCaches(cacheSetting == CacheSetting.USE_CACHE); if (outcome == ExpectedOutcome.SUCCESS) { assertEquals(200, connection.getResponseCode()); assertEquals("this is a cacheable file\n", getResponseAsString(connection)); } else { try { connection.getResponseCode(); fail(); } catch (IOException e) { // Expected. } } connection.disconnect(); }
void function(String requestUrl, CacheSetting cacheSetting, ExpectedOutcome outcome) throws Exception { URL url = new URL(requestUrl); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setUseCaches(cacheSetting == CacheSetting.USE_CACHE); if (outcome == ExpectedOutcome.SUCCESS) { assertEquals(200, connection.getResponseCode()); assertEquals(STR, getResponseAsString(connection)); } else { try { connection.getResponseCode(); fail(); } catch (IOException e) { } } connection.disconnect(); }
/** * Helper method to make a request with cache enabled or disabled, and check * whether the request is successful. * @param requestUrl request url. * @param cacheSetting indicates cache should be used. * @param outcome indicates request is expected to be successful. */
Helper method to make a request with cache enabled or disabled, and check whether the request is successful
checkRequestCaching
{ "repo_name": "guorendong/iridium-browser-ubuntu", "path": "components/cronet/android/test/javatests/src/org/chromium/net/urlconnection/CronetHttpURLConnectionTest.java", "license": "bsd-3-clause", "size": 42112 }
[ "java.io.IOException", "java.net.HttpURLConnection" ]
import java.io.IOException; import java.net.HttpURLConnection;
import java.io.*; import java.net.*;
[ "java.io", "java.net" ]
java.io; java.net;
646,278
public int doRandomAction() { int nTrans = model_.getNumActions(); BitSet tried = new BitSet(nTrans); int index = rand_.nextInt(nTrans); //System.out.println("DEBUG: random choice is "+index+" out of "+nTrans // +" tried.card="+tried.cardinality()); while (tried.cardinality() < nTrans) { while (tried.get(index)) { index = rand_.nextInt(nTrans); //System.out.println("DEBUG: random RETRY gives "+index); } tried.set(index); // mark this one as having been tried. if (model_.doAction(index)) { //System.out.println("DEBUG: done action "+index); return index; } } return -1; }
int function() { int nTrans = model_.getNumActions(); BitSet tried = new BitSet(nTrans); int index = rand_.nextInt(nTrans); while (tried.cardinality() < nTrans) { while (tried.get(index)) { index = rand_.nextInt(nTrans); } tried.set(index); if (model_.doAction(index)) { return index; } } return -1; }
/** Take any randomly-chosen Action that is enabled. * Returns the number of the Action taken, -1 if all are disabled. * @return The Action taken, or -1 if none are enabled. */
Take any randomly-chosen Action that is enabled. Returns the number of the Action taken, -1 if all are disabled
doRandomAction
{ "repo_name": "patrickfav/tuwien", "path": "master/swt workspace/ModelJUnit 2.0 beta1/modeljunit/src/main/java/nz/ac/waikato/modeljunit/RandomTester.java", "license": "apache-2.0", "size": 5153 }
[ "java.util.BitSet" ]
import java.util.BitSet;
import java.util.*;
[ "java.util" ]
java.util;
2,245,535
private static byte[] salt(char[] password) { SecureRandom random = new SecureRandom(); byte[] salt = new byte[SALT_BYTE_SIZE]; random.nextBytes(salt); return salt; }
static byte[] function(char[] password) { SecureRandom random = new SecureRandom(); byte[] salt = new byte[SALT_BYTE_SIZE]; random.nextBytes(salt); return salt; }
/** * "Sale" un mot de passe * * @param password * le mot de passe à saler * * @return un tableau d'octets représentant un mot de passe salé */
"Sale" un mot de passe
salt
{ "repo_name": "ThomasFerro/lup1", "path": "src/main/java/fr/da2i/lup1/security/Passwords.java", "license": "gpl-3.0", "size": 7390 }
[ "java.security.SecureRandom" ]
import java.security.SecureRandom;
import java.security.*;
[ "java.security" ]
java.security;
1,383,810
public String getFieldEnclosingType(Variable variable) { String fieldEnclosingType = ""; if (variable instanceof SourceVariable) { SourceVariable srcReceiver = (SourceVariable) variable; IVariableBinding varBinding = srcReceiver.getBinding(); if (varBinding.isField()) { ITypeBinding declaringClass = varBinding.getDeclaringClass(); if (declaringClass != null) { fieldEnclosingType = declaringClass.getQualifiedName(); } else { int debug = 0; debug++; } } // It's a local variable, then it does not have a declaring class else { int debug = 0; debug++; // XXX. TOEBI: Set breakpoint here return getVariableEnclosingClass(varBinding); } } // When accessing an inherited field from a superclass, gotta find its declaring class // Seems like there is no way to do this in TAC; gotta go down to AST else if (variable instanceof TempVariable) { TempVariable tmp = (TempVariable) variable; ASTNode node2 = tmp.getNode(); if (node2 instanceof SimpleName) { SimpleName sName = (SimpleName) node2; IBinding resolveBinding = sName.resolveBinding(); if (resolveBinding instanceof IVariableBinding) { IVariableBinding varBinding = (IVariableBinding) resolveBinding; if (varBinding.isField()) { ITypeBinding declaringClass = varBinding.getDeclaringClass(); if (declaringClass != null) { fieldEnclosingType = declaringClass.getQualifiedName(); } else { int debug = 0; debug++; } } // It's a local variable... else { int debug = 0; debug++; // XXX. TOEBI: Set breakpoint here return getVariableEnclosingClass(varBinding); } } } else if (node2 instanceof CastExpression) { CastExpression castExpr = (CastExpression) node2; Expression expression = castExpr.getExpression(); if (expression instanceof SimpleName) { SimpleName sName = (SimpleName) expression; IBinding resolveBinding = sName.resolveBinding(); if (resolveBinding instanceof IVariableBinding) { IVariableBinding varBinding = (IVariableBinding) resolveBinding; if (varBinding.isField()) { ITypeBinding declaringClass = varBinding.getDeclaringClass(); if (declaringClass != null) { fieldEnclosingType = declaringClass.getQualifiedName(); } else { int debug = 0; debug++; } } // It's a local variable... else { int debug = 0; debug++; // XXX. TOEBI: Set breakpoint here return getVariableEnclosingClass(varBinding); } } } } else if (node2 instanceof FieldAccess) { FieldAccess feildAccessExpr = (FieldAccess) node2; IVariableBinding fieldBinding = feildAccessExpr.resolveFieldBinding(); fieldEnclosingType = fieldBinding.getDeclaringClass().getQualifiedName(); } } return fieldEnclosingType; }
String function(Variable variable) { String fieldEnclosingType = ""; if (variable instanceof SourceVariable) { SourceVariable srcReceiver = (SourceVariable) variable; IVariableBinding varBinding = srcReceiver.getBinding(); if (varBinding.isField()) { ITypeBinding declaringClass = varBinding.getDeclaringClass(); if (declaringClass != null) { fieldEnclosingType = declaringClass.getQualifiedName(); } else { int debug = 0; debug++; } } else { int debug = 0; debug++; return getVariableEnclosingClass(varBinding); } } else if (variable instanceof TempVariable) { TempVariable tmp = (TempVariable) variable; ASTNode node2 = tmp.getNode(); if (node2 instanceof SimpleName) { SimpleName sName = (SimpleName) node2; IBinding resolveBinding = sName.resolveBinding(); if (resolveBinding instanceof IVariableBinding) { IVariableBinding varBinding = (IVariableBinding) resolveBinding; if (varBinding.isField()) { ITypeBinding declaringClass = varBinding.getDeclaringClass(); if (declaringClass != null) { fieldEnclosingType = declaringClass.getQualifiedName(); } else { int debug = 0; debug++; } } else { int debug = 0; debug++; return getVariableEnclosingClass(varBinding); } } } else if (node2 instanceof CastExpression) { CastExpression castExpr = (CastExpression) node2; Expression expression = castExpr.getExpression(); if (expression instanceof SimpleName) { SimpleName sName = (SimpleName) expression; IBinding resolveBinding = sName.resolveBinding(); if (resolveBinding instanceof IVariableBinding) { IVariableBinding varBinding = (IVariableBinding) resolveBinding; if (varBinding.isField()) { ITypeBinding declaringClass = varBinding.getDeclaringClass(); if (declaringClass != null) { fieldEnclosingType = declaringClass.getQualifiedName(); } else { int debug = 0; debug++; } } else { int debug = 0; debug++; return getVariableEnclosingClass(varBinding); } } } } else if (node2 instanceof FieldAccess) { FieldAccess feildAccessExpr = (FieldAccess) node2; IVariableBinding fieldBinding = feildAccessExpr.resolveFieldBinding(); fieldEnclosingType = fieldBinding.getDeclaringClass().getQualifiedName(); } } return fieldEnclosingType; }
/** * Given a variable, if it a s field, return the name of the declaring/enclosing class. * * If this returns NULL, it is NOT a field. So don't try to look it up as such... * @param variable * @return */
Given a variable, if it a s field, return the name of the declaring/enclosing class. If this returns NULL, it is NOT a field. So don't try to look it up as such..
getFieldEnclosingType
{ "repo_name": "aroog/code", "path": "OOGRE/src/oogre/analysis/OOGContext.java", "license": "gpl-3.0", "size": 16871 }
[ "edu.cmu.cs.crystal.tac.model.SourceVariable", "edu.cmu.cs.crystal.tac.model.TempVariable", "edu.cmu.cs.crystal.tac.model.Variable", "org.eclipse.jdt.core.dom.ASTNode", "org.eclipse.jdt.core.dom.CastExpression", "org.eclipse.jdt.core.dom.Expression", "org.eclipse.jdt.core.dom.FieldAccess", "org.eclips...
import edu.cmu.cs.crystal.tac.model.SourceVariable; import edu.cmu.cs.crystal.tac.model.TempVariable; import edu.cmu.cs.crystal.tac.model.Variable; import org.eclipse.jdt.core.dom.ASTNode; import org.eclipse.jdt.core.dom.CastExpression; import org.eclipse.jdt.core.dom.Expression; import org.eclipse.jdt.core.dom.FieldAccess; import org.eclipse.jdt.core.dom.IBinding; import org.eclipse.jdt.core.dom.ITypeBinding; import org.eclipse.jdt.core.dom.IVariableBinding; import org.eclipse.jdt.core.dom.SimpleName;
import edu.cmu.cs.crystal.tac.model.*; import org.eclipse.jdt.core.dom.*;
[ "edu.cmu.cs", "org.eclipse.jdt" ]
edu.cmu.cs; org.eclipse.jdt;
2,249,674
@Override public void exitNo_comma_or_semicolon(@NotNull FunctionParser.No_comma_or_semicolonContext ctx) { }
@Override public void exitNo_comma_or_semicolon(@NotNull FunctionParser.No_comma_or_semicolonContext ctx) { }
/** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */
The default implementation does nothing
enterNo_comma_or_semicolon
{ "repo_name": "octopus-platform/joern", "path": "projects/extensions/joern-fuzzyc/src/main/java/antlr/FunctionBaseListener.java", "license": "lgpl-3.0", "size": 42232 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
647,287
Optional<ZonedDateTime> getExpiration();
Optional<ZonedDateTime> getExpiration();
/** * Returns the expiration date of the resource, if present. * * @return Expiration date, either from the Cache-Control or Expires header. If empty, * the server did not provide an expiration date, or forbid caching. * @since 2.10 */
Returns the expiration date of the resource, if present
getExpiration
{ "repo_name": "shred/acme4j", "path": "acme4j-client/src/main/java/org/shredzone/acme4j/connector/Connection.java", "license": "apache-2.0", "size": 7364 }
[ "java.time.ZonedDateTime", "java.util.Optional" ]
import java.time.ZonedDateTime; import java.util.Optional;
import java.time.*; import java.util.*;
[ "java.time", "java.util" ]
java.time; java.util;
776,557
private boolean eventShouldBeHandled(EventBundle events) { if (events.isEmpty()) { return false; } if ("system".equals(events.peek().getContext().getPrincipal().getName())) { return false; } return getEventsToHandle().stream().anyMatch((events::containsEventName)); }
boolean function(EventBundle events) { if (events.isEmpty()) { return false; } if (STR.equals(events.peek().getContext().getPrincipal().getName())) { return false; } return getEventsToHandle().stream().anyMatch((events::containsEventName)); }
/** * Checks if the event bundle contains any of the events we want to handle * * @param events a collection of events fired * @return true if event should be handled; false otherwise */
Checks if the event bundle contains any of the events we want to handle
eventShouldBeHandled
{ "repo_name": "First-Peoples-Cultural-Council/fv-web-ui", "path": "modules/common/firstvoices-maintenance/src/main/java/ca/firstvoices/maintenance/listeners/PostCommitCleanupListener.java", "license": "apache-2.0", "size": 11733 }
[ "org.nuxeo.ecm.core.event.EventBundle" ]
import org.nuxeo.ecm.core.event.EventBundle;
import org.nuxeo.ecm.core.event.*;
[ "org.nuxeo.ecm" ]
org.nuxeo.ecm;
1,447,539
protected void drawBackground (Batch batch, float parentAlpha, float x, float y) { if (background == null) return; Color color = getColor(); batch.setColor(color.r, color.g, color.b, color.a * parentAlpha); background.draw(batch, x, y, getWidth(), getHeight()); }
void function (Batch batch, float parentAlpha, float x, float y) { if (background == null) return; Color color = getColor(); batch.setColor(color.r, color.g, color.b, color.a * parentAlpha); background.draw(batch, x, y, getWidth(), getHeight()); }
/** Called to draw the background, before clipping is applied (if enabled). Default implementation draws the background * drawable. */
Called to draw the background, before clipping is applied (if enabled). Default implementation draws the background
drawBackground
{ "repo_name": "codepoke/libgdx", "path": "gdx/src/com/badlogic/gdx/scenes/scene2d/ui/Table.java", "license": "apache-2.0", "size": 43795 }
[ "com.badlogic.gdx.graphics.Color", "com.badlogic.gdx.graphics.g2d.Batch" ]
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.*; import com.badlogic.gdx.graphics.g2d.*;
[ "com.badlogic.gdx" ]
com.badlogic.gdx;
36,777
protected CloseableDataset getDataset(final HttpResponse response) throws IOException { assertEquals(OK.getStatusCode(), getStatus(response)); final CloseableDataset result = parseTriples(response.getEntity()); logger.trace("Retrieved RDF: {}", result); return result; }
CloseableDataset function(final HttpResponse response) throws IOException { assertEquals(OK.getStatusCode(), getStatus(response)); final CloseableDataset result = parseTriples(response.getEntity()); logger.trace(STR, result); return result; }
/** * Parses the RDF found in and HTTP response, returning it in a {@link CloseableDataset}. * * @param response the response to parse * @return the graph retrieved * @throws IOException in case of IOException */
Parses the RDF found in and HTTP response, returning it in a <code>CloseableDataset</code>
getDataset
{ "repo_name": "lsitu/fcrepo4", "path": "fcrepo-http-api/src/test/java/org/fcrepo/integration/http/api/AbstractResourceIT.java", "license": "apache-2.0", "size": 25342 }
[ "java.io.IOException", "javax.ws.rs.core.Response", "org.apache.http.HttpResponse", "org.fcrepo.http.commons.test.util.CloseableDataset", "org.fcrepo.http.commons.test.util.TestHelpers", "org.junit.Assert" ]
import java.io.IOException; import javax.ws.rs.core.Response; import org.apache.http.HttpResponse; import org.fcrepo.http.commons.test.util.CloseableDataset; import org.fcrepo.http.commons.test.util.TestHelpers; import org.junit.Assert;
import java.io.*; import javax.ws.rs.core.*; import org.apache.http.*; import org.fcrepo.http.commons.test.util.*; import org.junit.*;
[ "java.io", "javax.ws", "org.apache.http", "org.fcrepo.http", "org.junit" ]
java.io; javax.ws; org.apache.http; org.fcrepo.http; org.junit;
2,062,442
default OptionalLong metadataDelete(ConnectorSession session, ConnectorTableHandle tableHandle, ConnectorTableLayoutHandle tableLayoutHandle) { throw new PrestoException(NOT_SUPPORTED, "This connector does not support deletes"); }
default OptionalLong metadataDelete(ConnectorSession session, ConnectorTableHandle tableHandle, ConnectorTableLayoutHandle tableLayoutHandle) { throw new PrestoException(NOT_SUPPORTED, STR); }
/** * Delete the provided table layout * @return number of rows deleted, or null for unknown */
Delete the provided table layout
metadataDelete
{ "repo_name": "lingochamp/presto", "path": "presto-spi/src/main/java/com/facebook/presto/spi/ConnectorMetadata.java", "license": "apache-2.0", "size": 10029 }
[ "java.util.OptionalLong" ]
import java.util.OptionalLong;
import java.util.*;
[ "java.util" ]
java.util;
1,199,039
private List<Node> possibleParents(Node x, List<Node> nodes, IKnowledge knowledge) { List<Node> possibleParents = new LinkedList<Node>(); String _x = x.getName(); for (Node z : nodes) { String _z = z.getName(); if (possibleParentOf(_z, _x, knowledge)) { possibleParents.add(z); } } return possibleParents; }
List<Node> function(Node x, List<Node> nodes, IKnowledge knowledge) { List<Node> possibleParents = new LinkedList<Node>(); String _x = x.getName(); for (Node z : nodes) { String _z = z.getName(); if (possibleParentOf(_z, _x, knowledge)) { possibleParents.add(z); } } return possibleParents; }
/** * Removes from the list of nodes any that cannot be parents of x given the background knowledge. */
Removes from the list of nodes any that cannot be parents of x given the background knowledge
possibleParents
{ "repo_name": "ajsedgewick/tetrad", "path": "tetrad-lib/src/main/java/edu/cmu/tetrad/search/SepsetsPossibleDsep.java", "license": "gpl-2.0", "size": 6059 }
[ "edu.cmu.tetrad.data.IKnowledge", "edu.cmu.tetrad.graph.Node", "java.util.LinkedList", "java.util.List" ]
import edu.cmu.tetrad.data.IKnowledge; import edu.cmu.tetrad.graph.Node; import java.util.LinkedList; import java.util.List;
import edu.cmu.tetrad.data.*; import edu.cmu.tetrad.graph.*; import java.util.*;
[ "edu.cmu.tetrad", "java.util" ]
edu.cmu.tetrad; java.util;
2,011,107
protected void postValidations() throws APIRestGeneratorException { this.postValidationResponseCodeSuccess() ; this.postValidationNoArrayOfFiles() ; }
void function() throws APIRestGeneratorException { this.postValidationResponseCodeSuccess() ; this.postValidationNoArrayOfFiles() ; }
/** * Post validations * @throws APIRestGeneratorException with an occurred exception */
Post validations
postValidations
{ "repo_name": "BBVA-CIB/APIRestGenerator", "path": "parser.swagger/src/main/java/com/bbva/kltt/apirest/parser/swagger/responses/ResponsesPostValidator.java", "license": "apache-2.0", "size": 4631 }
[ "com.bbva.kltt.apirest.core.util.APIRestGeneratorException" ]
import com.bbva.kltt.apirest.core.util.APIRestGeneratorException;
import com.bbva.kltt.apirest.core.util.*;
[ "com.bbva.kltt" ]
com.bbva.kltt;
2,269,054
@Transactional(propagation=Propagation.REQUIRED) public List<QueryHistoryDTO> retrieveQueryHistory(String username) throws DataAccessException { // List to hold the results List<QueryHistoryDTO> queryHistoryRecords = new ArrayList<QueryHistoryDTO>(); // Determine the number of results to a return (read from config) int numberOfQueriesToReturn = NCIAConfig.getNumberOfQueriesOnHistoryPage(); // Build criteria to get user's query history QueryHistory qh = new QueryHistory(); qh.setUserId(this.getUser(username).getUserId()); DetachedCriteria crit = DetachedCriteria.forClass(QueryHistory.class); crit.add(Example.create(qh)); // Load saved query data in the same query crit.setFetchMode("savedQuery", FetchMode.JOIN); // Need to do this to avoid a 1+N problem on last execute date // Because it is a one-to-one, Hibernate always tries to pull it in crit.setFetchMode("savedQuery.lastExecuteDate", FetchMode.JOIN); // Need to do distinct because query will actually return // one row for each query criterion, resulting in duplicate rows crit.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); // Sort query history in descending order crit.addOrder(Order.desc("executeTime")); List results = getHibernateTemplate().findByCriteria(crit); // Loop through results and build the DTOs Iterator iter = results.iterator(); int count = 0; while (iter.hasNext() && (count < numberOfQueriesToReturn)) { QueryHistory queryHistory = (QueryHistory) iter.next(); QueryHistoryDTO dto = new QueryHistoryDTO(); dto.setId(queryHistory.getId()); dto.setExecutionTime(queryHistory.getExecuteTime()); // Set the list of criteria dto.setCriteriaList(getCriteriaFromStoredAttributes(queryHistory.getQueryHistoryAttributes())); // If the query history record is associated with a saved query, // get some data from the saved query SavedQuery associatedSavedQuery = queryHistory.getSavedQuery(); if (associatedSavedQuery != null) { dto.setQueryName(associatedSavedQuery.getQueryName()); dto.setSavedQueryIsInactive(!associatedSavedQuery.getActive()); dto.setSavedQueryId(associatedSavedQuery.getId()); } queryHistoryRecords.add(dto); // Count so that it only returns the proper amount count++; } return queryHistoryRecords; }
@Transactional(propagation=Propagation.REQUIRED) List<QueryHistoryDTO> function(String username) throws DataAccessException { List<QueryHistoryDTO> queryHistoryRecords = new ArrayList<QueryHistoryDTO>(); int numberOfQueriesToReturn = NCIAConfig.getNumberOfQueriesOnHistoryPage(); QueryHistory qh = new QueryHistory(); qh.setUserId(this.getUser(username).getUserId()); DetachedCriteria crit = DetachedCriteria.forClass(QueryHistory.class); crit.add(Example.create(qh)); crit.setFetchMode(STR, FetchMode.JOIN); crit.setFetchMode(STR, FetchMode.JOIN); crit.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); crit.addOrder(Order.desc(STR)); List results = getHibernateTemplate().findByCriteria(crit); Iterator iter = results.iterator(); int count = 0; while (iter.hasNext() && (count < numberOfQueriesToReturn)) { QueryHistory queryHistory = (QueryHistory) iter.next(); QueryHistoryDTO dto = new QueryHistoryDTO(); dto.setId(queryHistory.getId()); dto.setExecutionTime(queryHistory.getExecuteTime()); dto.setCriteriaList(getCriteriaFromStoredAttributes(queryHistory.getQueryHistoryAttributes())); SavedQuery associatedSavedQuery = queryHistory.getSavedQuery(); if (associatedSavedQuery != null) { dto.setQueryName(associatedSavedQuery.getQueryName()); dto.setSavedQueryIsInactive(!associatedSavedQuery.getActive()); dto.setSavedQueryId(associatedSavedQuery.getId()); } queryHistoryRecords.add(dto); count++; } return queryHistoryRecords; }
/** * Retrieves a list of query history records for a user. It will * not return all records; the results will be limited to a certain * number. * * @param username - login id of the user * @return - a list of DTOs for the user's queries * @throws Exception */
Retrieves a list of query history records for a user. It will not return all records; the results will be limited to a certain number
retrieveQueryHistory
{ "repo_name": "NCIP/national-biomedical-image-archive", "path": "software/nbia-dao/src/gov/nih/nci/nbia/querystorage/QueryStorageManagerImpl.java", "license": "bsd-3-clause", "size": 22502 }
[ "gov.nih.nci.nbia.dto.QueryHistoryDTO", "gov.nih.nci.nbia.internaldomain.QueryHistory", "gov.nih.nci.nbia.internaldomain.SavedQuery", "gov.nih.nci.nbia.util.NCIAConfig", "java.util.ArrayList", "java.util.Iterator", "java.util.List", "org.hibernate.Criteria", "org.hibernate.FetchMode", "org.hiberna...
import gov.nih.nci.nbia.dto.QueryHistoryDTO; import gov.nih.nci.nbia.internaldomain.QueryHistory; import gov.nih.nci.nbia.internaldomain.SavedQuery; import gov.nih.nci.nbia.util.NCIAConfig; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.hibernate.Criteria; import org.hibernate.FetchMode; import org.hibernate.criterion.DetachedCriteria; import org.hibernate.criterion.Example; import org.hibernate.criterion.Order; import org.springframework.dao.DataAccessException; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional;
import gov.nih.nci.nbia.dto.*; import gov.nih.nci.nbia.internaldomain.*; import gov.nih.nci.nbia.util.*; import java.util.*; import org.hibernate.*; import org.hibernate.criterion.*; import org.springframework.dao.*; import org.springframework.transaction.annotation.*;
[ "gov.nih.nci", "java.util", "org.hibernate", "org.hibernate.criterion", "org.springframework.dao", "org.springframework.transaction" ]
gov.nih.nci; java.util; org.hibernate; org.hibernate.criterion; org.springframework.dao; org.springframework.transaction;
2,599,211
@Test public void removeMdc() { logging.removeMdc("test"); verify(context).remove("test"); }
void function() { logging.removeMdc("test"); verify(context).remove("test"); }
/** * Verifies that values from shared MDC can be removed. */
Verifies that values from shared MDC can be removed
removeMdc
{ "repo_name": "pmwmedia/tinylog", "path": "jboss-tinylog/src/test/java/org/tinylog/jboss/TinylogLoggerProviderTest.java", "license": "apache-2.0", "size": 3945 }
[ "org.mockito.Mockito" ]
import org.mockito.Mockito;
import org.mockito.*;
[ "org.mockito" ]
org.mockito;
1,942,561
protected Resolution getCreateView() { // TODO spezzare in popup/non-popup? if (isPopup()) { return new ForwardResolution("/m/crud/popup/create.jsp" + getMenuLevel()); } else { return new ForwardResolution("/m/crud/create.jsp" + getMenuLevel()); } }
Resolution function() { if (isPopup()) { return new ForwardResolution(STR + getMenuLevel()); } else { return new ForwardResolution(STR + getMenuLevel()); } }
/** * Returns the Resolution used to show the Create page. */
Returns the Resolution used to show the Create page
getCreateView
{ "repo_name": "hongliangpan/manydesigns.cn", "path": "trunk/portofino-war-jee/src/main/java/com/manydesigns/portofino/pageactions/crud/CrudAction4UpdateByRole.java", "license": "lgpl-3.0", "size": 8555 }
[ "net.sourceforge.stripes.action.ForwardResolution", "net.sourceforge.stripes.action.Resolution" ]
import net.sourceforge.stripes.action.ForwardResolution; import net.sourceforge.stripes.action.Resolution;
import net.sourceforge.stripes.action.*;
[ "net.sourceforge.stripes" ]
net.sourceforge.stripes;
1,729,710
public static ByteBuffer makeByteBuffer(byte[] array) { ByteBuffer bb = ByteBuffer.allocateDirect(array.length); bb.order(ByteOrder.nativeOrder()); bb.put(array); bb.position(0); return bb; }
static ByteBuffer function(byte[] array) { ByteBuffer bb = ByteBuffer.allocateDirect(array.length); bb.order(ByteOrder.nativeOrder()); bb.put(array); bb.position(0); return bb; }
/** * Make a direct NIO ByteBuffer from an array of floats. * * @param array The byte array * @return The newly created FloatBuffer */
Make a direct NIO ByteBuffer from an array of floats
makeByteBuffer
{ "repo_name": "javocsoft/javocsoft-toolbox", "path": "src/es/javocsoft/android/lib/toolbox/ToolBox.java", "license": "gpl-3.0", "size": 316451 }
[ "java.nio.ByteBuffer", "java.nio.ByteOrder" ]
import java.nio.ByteBuffer; import java.nio.ByteOrder;
import java.nio.*;
[ "java.nio" ]
java.nio;
227,852
final boolean hasStatus = !isNull(cursor, Data.STATUS); final boolean hasTimestamp = !isNull(cursor, Data.STATUS_TIMESTAMP); // Bail early when not valid status, or when previous status was // found and we can't compare this one. if (!hasStatus) return; if (isValid() && !hasTimestamp) return; if (hasTimestamp) { // Compare timestamps and bail if older status final long newTimestamp = getLong(cursor, Data.STATUS_TIMESTAMP, -1); if (newTimestamp < mTimestamp) return; mTimestamp = newTimestamp; } // Fill in remaining details from cursor fromCursor(cursor); }
final boolean hasStatus = !isNull(cursor, Data.STATUS); final boolean hasTimestamp = !isNull(cursor, Data.STATUS_TIMESTAMP); if (!hasStatus) return; if (isValid() && !hasTimestamp) return; if (hasTimestamp) { final long newTimestamp = getLong(cursor, Data.STATUS_TIMESTAMP, -1); if (newTimestamp < mTimestamp) return; mTimestamp = newTimestamp; } fromCursor(cursor); }
/** * Attempt updating this {@link DataStatus} based on values at the * current row of the given {@link Cursor}. */
Attempt updating this <code>DataStatus</code> based on values at the current row of the given <code>Cursor</code>
possibleUpdate
{ "repo_name": "s20121035/rk3288_android5.1_repo", "path": "packages/apps/ContactsCommon/src/com/android/contacts/common/util/DataStatus.java", "license": "gpl-3.0", "size": 5808 }
[ "android.provider.ContactsContract" ]
import android.provider.ContactsContract;
import android.provider.*;
[ "android.provider" ]
android.provider;
2,379,604
@Override public int getMaxItemUseDuration(ItemStack par1ItemStack) { return 32; }
int function(ItemStack par1ItemStack) { return 32; }
/** * How long it takes to use or consume an item */
How long it takes to use or consume an item
getMaxItemUseDuration
{ "repo_name": "VegasGoat/TFCraft", "path": "src/Common/com/bioxx/tfc/Items/Tools/ItemCustomBucketMilk.java", "license": "gpl-3.0", "size": 5459 }
[ "net.minecraft.item.ItemStack" ]
import net.minecraft.item.ItemStack;
import net.minecraft.item.*;
[ "net.minecraft.item" ]
net.minecraft.item;
1,171,403
public HotlinkingManager getHotlinkingManager();
HotlinkingManager function();
/** * If a static resource is hotlinking protected * ({@link #isHotlinkingProtected()}), then this is the * component responsible to that protection. * <p> * Will be <code>null</code> if the resource * is not hotlinking protected. */
If a static resource is hotlinking protected (<code>#isHotlinkingProtected()</code>), then this is the component responsible to that protection. Will be <code>null</code> if the resource is not hotlinking protected
getHotlinkingManager
{ "repo_name": "spincast/spincast-framework", "path": "spincast-core-parent/spincast-core/src/main/java/org/spincast/core/routing/StaticResource.java", "license": "apache-2.0", "size": 3024 }
[ "org.spincast.core.routing.hotlinking.HotlinkingManager" ]
import org.spincast.core.routing.hotlinking.HotlinkingManager;
import org.spincast.core.routing.hotlinking.*;
[ "org.spincast.core" ]
org.spincast.core;
836,612
@Test() public void testNoOperationControlExtendedOperation() throws Exception { final InMemoryDirectoryServer ds = getTestDS(true, true); ldapPasswordModify(ResultCode.SUCCESS, "--hostname", "localhost", "--port", String.valueOf(ds.getListenPort()), "--userIdentity", "uid=test.user,ou=People,dc=example,dc=com", "--currentPassword", "password", "--passwordChangeMethod", "password-modify-extended-operation", "--noOperation", "--verbose"); }
@Test() void function() throws Exception { final InMemoryDirectoryServer ds = getTestDS(true, true); ldapPasswordModify(ResultCode.SUCCESS, STR, STR, STR, String.valueOf(ds.getListenPort()), STR, STR, STR, STR, STR, STR, STR, STR); }
/** * Tests the behavior when changing the password using a password modify * extended operation when the no operation request control was provided. * * @throws Exception If an unexpected problem occurs. */
Tests the behavior when changing the password using a password modify extended operation when the no operation request control was provided
testNoOperationControlExtendedOperation
{ "repo_name": "UnboundID/ldapsdk", "path": "tests/unit/src/com/unboundid/ldap/sdk/unboundidds/tools/LDAPPasswordModifyTestCase.java", "license": "gpl-2.0", "size": 58733 }
[ "com.unboundid.ldap.listener.InMemoryDirectoryServer", "com.unboundid.ldap.sdk.ResultCode", "org.testng.annotations.Test" ]
import com.unboundid.ldap.listener.InMemoryDirectoryServer; import com.unboundid.ldap.sdk.ResultCode; import org.testng.annotations.Test;
import com.unboundid.ldap.listener.*; import com.unboundid.ldap.sdk.*; import org.testng.annotations.*;
[ "com.unboundid.ldap", "org.testng.annotations" ]
com.unboundid.ldap; org.testng.annotations;
1,367,589
public boolean isMoveableDown(DownloadManager dm);
boolean function(DownloadManager dm);
/** * Retrieve whether a DownloadManager can move down in the GlobalManager list * @param dm DownloadManager to check * @return True - Can move down */
Retrieve whether a DownloadManager can move down in the GlobalManager list
isMoveableDown
{ "repo_name": "thangbn/Direct-File-Downloader", "path": "src/src/org/gudy/azureus2/core3/global/GlobalManager.java", "license": "gpl-2.0", "size": 13911 }
[ "org.gudy.azureus2.core3.download.DownloadManager" ]
import org.gudy.azureus2.core3.download.DownloadManager;
import org.gudy.azureus2.core3.download.*;
[ "org.gudy.azureus2" ]
org.gudy.azureus2;
1,419,693
public static SamService fromContext() { return forUser(Context.requireUser()); }
static SamService function() { return forUser(Context.requireUser()); }
/** * Factory method for class that talks to SAM. Pulls the current server and user from the context. */
Factory method for class that talks to SAM. Pulls the current server and user from the context
fromContext
{ "repo_name": "DataBiosphere/terra-cli", "path": "src/main/java/bio/terra/cli/service/SamService.java", "license": "bsd-3-clause", "size": 29722 }
[ "bio.terra.cli.businessobject.Context" ]
import bio.terra.cli.businessobject.Context;
import bio.terra.cli.businessobject.*;
[ "bio.terra.cli" ]
bio.terra.cli;
2,111,397
private void registerGsakExtensions(final Element cacheParent) { for (final String gsakNamespace : GSAK_NS) { final Element gsak = cacheParent.getChild(gsakNamespace, "wptExtension"); gsak.getChild(gsakNamespace, "Watch").setEndTextElementListener(new EndTextElementListener() {
void function(final Element cacheParent) { for (final String gsakNamespace : GSAK_NS) { final Element gsak = cacheParent.getChild(gsakNamespace, STR); gsak.getChild(gsakNamespace, "Watch").setEndTextElementListener(new EndTextElementListener() {
/** * Add listeners for GSAK extensions * */
Add listeners for GSAK extensions
registerGsakExtensions
{ "repo_name": "schwabe/cgeo", "path": "main/src/cgeo/geocaching/files/GPXParser.java", "license": "apache-2.0", "size": 43848 }
[ "android.sax.Element", "android.sax.EndTextElementListener" ]
import android.sax.Element; import android.sax.EndTextElementListener;
import android.sax.*;
[ "android.sax" ]
android.sax;
1,323,626
Connection getConnection() throws SQLException;
Connection getConnection() throws SQLException;
/** * Should return a connection to the database in use for this context. * The generator will call this method only one time for each context. * The generator will close the connection. * * @return * @throws SQLException */
Should return a connection to the database in use for this context. The generator will call this method only one time for each context. The generator will close the connection
getConnection
{ "repo_name": "hobbitmr/MutiMybatisGenerator", "path": "mybatis-generator-core/src/main/java/org/mybatis/generator/api/ConnectionFactory.java", "license": "apache-2.0", "size": 1474 }
[ "java.sql.Connection", "java.sql.SQLException" ]
import java.sql.Connection; import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
2,776,606
protected EObject createInitialModel() { EClass eClass = (EClass)corePackage.getEClassifier(initialObjectCreationPage.getInitialObjectName()); EObject rootObject = coreFactory.create(eClass); return rootObject; }
EObject function() { EClass eClass = (EClass)corePackage.getEClassifier(initialObjectCreationPage.getInitialObjectName()); EObject rootObject = coreFactory.create(eClass); return rootObject; }
/** * Create a new model. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
Create a new model.
createInitialModel
{ "repo_name": "CloudScale-Project/Environment", "path": "plugins/org.scaledl.overview.editor/src/org/scaledl/overview/core/presentation/CoreModelWizard.java", "license": "epl-1.0", "size": 15716 }
[ "org.eclipse.emf.ecore.EClass", "org.eclipse.emf.ecore.EObject" ]
import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,518,519
public ActionForward deletePersonnelAttachment(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ProtocolDocument protocolDocument = (ProtocolDocument) ((ProtocolForm) form).getProtocolDocument(); ProtocolPerson protocolPerson = (ProtocolPerson) protocolDocument.getProtocol().getProtocolPerson(getSelectedPersonIndex(request, protocolDocument)); ProtocolAttachmentPersonnel attachment = (ProtocolAttachmentPersonnel) protocolPerson.getAttachmentPersonnels().get(getSelectedLine(request)); final StrutsConfirmation confirm = buildParameterizedConfirmationQuestion(mapping, form, request, response, CONFIRM_YES_DELETE_ATTACHMENT_PERSONNEL, KeyConstants.QUESTION_DELETE_ATTACHMENT_CONFIRMATION, attachment.getAttachmentDescription(), attachment.getFile().getName()); return confirm(confirm, CONFIRM_YES_DELETE_ATTACHMENT_PERSONNEL, CONFIRM_NO_DELETE); }
ActionForward function(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ProtocolDocument protocolDocument = (ProtocolDocument) ((ProtocolForm) form).getProtocolDocument(); ProtocolPerson protocolPerson = (ProtocolPerson) protocolDocument.getProtocol().getProtocolPerson(getSelectedPersonIndex(request, protocolDocument)); ProtocolAttachmentPersonnel attachment = (ProtocolAttachmentPersonnel) protocolPerson.getAttachmentPersonnels().get(getSelectedLine(request)); final StrutsConfirmation confirm = buildParameterizedConfirmationQuestion(mapping, form, request, response, CONFIRM_YES_DELETE_ATTACHMENT_PERSONNEL, KeyConstants.QUESTION_DELETE_ATTACHMENT_CONFIRMATION, attachment.getAttachmentDescription(), attachment.getFile().getName()); return confirm(confirm, CONFIRM_YES_DELETE_ATTACHMENT_PERSONNEL, CONFIRM_NO_DELETE); }
/** * Method called when deleting an attachment from a person. * * @param mapping * @param form * @param request * @param response * @return * @throws Exception */
Method called when deleting an attachment from a person
deletePersonnelAttachment
{ "repo_name": "kuali/kc", "path": "coeus-impl/src/main/java/org/kuali/kra/irb/personnel/ProtocolPersonnelAction.java", "license": "agpl-3.0", "size": 21153 }
[ "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "org.apache.struts.action.ActionForm", "org.apache.struts.action.ActionForward", "org.apache.struts.action.ActionMapping", "org.kuali.coeus.sys.framework.controller.StrutsConfirmation", "org.kuali.kra.infrastructure.KeyCo...
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.kuali.coeus.sys.framework.controller.StrutsConfirmation; import org.kuali.kra.infrastructure.KeyConstants; import org.kuali.kra.irb.ProtocolDocument; import org.kuali.kra.irb.ProtocolForm; import org.kuali.kra.irb.noteattachment.ProtocolAttachmentPersonnel;
import javax.servlet.http.*; import org.apache.struts.action.*; import org.kuali.coeus.sys.framework.controller.*; import org.kuali.kra.infrastructure.*; import org.kuali.kra.irb.*; import org.kuali.kra.irb.noteattachment.*;
[ "javax.servlet", "org.apache.struts", "org.kuali.coeus", "org.kuali.kra" ]
javax.servlet; org.apache.struts; org.kuali.coeus; org.kuali.kra;
455,522
public MessageDestinationType<T> removeLookupName() { childNode.removeChildren("lookup-name"); return this; } // --------------------------------------------------------------------------------------------------------|| // ClassName: MessageDestinationType ElementName: xsd:ID ElementType : id // MaxOccurs: - isGeneric: true isAttribute: true isEnum: false isDataType: true // --------------------------------------------------------------------------------------------------------||
MessageDestinationType<T> function() { childNode.removeChildren(STR); return this; }
/** * Removes the <code>lookup-name</code> element * @return the current instance of <code>MessageDestinationType<T></code> */
Removes the <code>lookup-name</code> element
removeLookupName
{ "repo_name": "forge/javaee-descriptors", "path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/javaee6/MessageDestinationTypeImpl.java", "license": "epl-1.0", "size": 12103 }
[ "org.jboss.shrinkwrap.descriptor.api.javaee6.MessageDestinationType" ]
import org.jboss.shrinkwrap.descriptor.api.javaee6.MessageDestinationType;
import org.jboss.shrinkwrap.descriptor.api.javaee6.*;
[ "org.jboss.shrinkwrap" ]
org.jboss.shrinkwrap;
1,277,517
public List<MatrixRun> getRuns() { List<MatrixRun> r = new ArrayList<MatrixRun>(); for(MatrixConfiguration c : getParent().getItems()) { MatrixRun b = c.getBuildByNumber(getNumber()); if (b != null) r.add(b); } return r; }
List<MatrixRun> function() { List<MatrixRun> r = new ArrayList<MatrixRun>(); for(MatrixConfiguration c : getParent().getItems()) { MatrixRun b = c.getBuildByNumber(getNumber()); if (b != null) r.add(b); } return r; }
/** * Returns all {@link MatrixRun}s for this {@link MatrixBuild}. */
Returns all <code>MatrixRun</code>s for this <code>MatrixBuild</code>
getRuns
{ "repo_name": "vivek/hudson", "path": "core/src/main/java/hudson/matrix/MatrixBuild.java", "license": "mit", "size": 13174 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,334,241
protected void safeModeChecking( RowMetaInterface row ) throws KettleRowException { if ( row == null ) { return; } if ( inputReferenceRow == null ) { inputReferenceRow = row.clone(); // copy it! // Check for double field names. // String[] fieldnames = row.getFieldNames(); Arrays.sort( fieldnames ); for ( int i = 0; i < fieldnames.length - 1; i++ ) { if ( fieldnames[ i ].equals( fieldnames[ i + 1 ] ) ) { throw new KettleRowException( BaseMessages.getString( PKG, "BaseStep.SafeMode.Exception.DoubleFieldnames", fieldnames[ i ] ) ); } } } else { safeModeChecking( inputReferenceRow, row ); } }
void function( RowMetaInterface row ) throws KettleRowException { if ( row == null ) { return; } if ( inputReferenceRow == null ) { inputReferenceRow = row.clone(); Arrays.sort( fieldnames ); for ( int i = 0; i < fieldnames.length - 1; i++ ) { if ( fieldnames[ i ].equals( fieldnames[ i + 1 ] ) ) { throw new KettleRowException( BaseMessages.getString( PKG, STR, fieldnames[ i ] ) ); } } } else { safeModeChecking( inputReferenceRow, row ); } }
/** * Safe mode checking. * * @param row the row * @throws KettleRowException the kettle row exception */
Safe mode checking
safeModeChecking
{ "repo_name": "SergeyTravin/pentaho-kettle", "path": "engine/src/main/java/org/pentaho/di/trans/step/BaseStep.java", "license": "apache-2.0", "size": 127829 }
[ "java.util.Arrays", "org.pentaho.di.core.exception.KettleRowException", "org.pentaho.di.core.row.RowMetaInterface", "org.pentaho.di.i18n.BaseMessages" ]
import java.util.Arrays; import org.pentaho.di.core.exception.KettleRowException; import org.pentaho.di.core.row.RowMetaInterface; import org.pentaho.di.i18n.BaseMessages;
import java.util.*; import org.pentaho.di.core.exception.*; import org.pentaho.di.core.row.*; import org.pentaho.di.i18n.*;
[ "java.util", "org.pentaho.di" ]
java.util; org.pentaho.di;
1,130,607
@javax.annotation.Nullable @ApiModelProperty( value = "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds") public String getKind() { return kind; }
@javax.annotation.Nullable @ApiModelProperty( value = "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https: String function() { return kind; }
/** * Kind is a string value representing the REST resource this object represents. Servers may infer * this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More * info: * https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds * * @return kind */
Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: HREF
getKind
{ "repo_name": "kubernetes-client/java", "path": "kubernetes/src/main/java/io/kubernetes/client/openapi/models/V1StorageClassList.java", "license": "apache-2.0", "size": 6011 }
[ "io.swagger.annotations.ApiModelProperty" ]
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.*;
[ "io.swagger.annotations" ]
io.swagger.annotations;
2,290,435
@Nullable static StarlarkAspect loadStarlarkAspect( Environment env, Label extensionLabel, String starlarkValueName) throws AspectCreationException, InterruptedException { SkyKey importFileKey = BzlLoadValue.keyForBuild(extensionLabel); try { BzlLoadValue bzlLoadValue = (BzlLoadValue) env.getValueOrThrow(importFileKey, BzlLoadFailedException.class); if (bzlLoadValue == null) { Preconditions.checkState( env.valuesMissing(), "no Starlark import value for %s", importFileKey); return null; } Object starlarkValue = bzlLoadValue.getModule().getGlobal(starlarkValueName); if (starlarkValue == null) { throw new ConversionException( String.format( "%s is not exported from %s", starlarkValueName, extensionLabel.toString())); } if (!(starlarkValue instanceof StarlarkAspect)) { throw new ConversionException( String.format( "%s from %s is not an aspect", starlarkValueName, extensionLabel.toString())); } return (StarlarkAspect) starlarkValue; } catch (BzlLoadFailedException e) { env.getListener().handle(Event.error(e.getMessage())); throw new AspectCreationException(e.getMessage(), extensionLabel, e.getDetailedExitCode()); } catch (ConversionException e) { env.getListener().handle(Event.error(e.getMessage())); throw new AspectCreationException(e.getMessage(), extensionLabel); } }
static StarlarkAspect loadStarlarkAspect( Environment env, Label extensionLabel, String starlarkValueName) throws AspectCreationException, InterruptedException { SkyKey importFileKey = BzlLoadValue.keyForBuild(extensionLabel); try { BzlLoadValue bzlLoadValue = (BzlLoadValue) env.getValueOrThrow(importFileKey, BzlLoadFailedException.class); if (bzlLoadValue == null) { Preconditions.checkState( env.valuesMissing(), STR, importFileKey); return null; } Object starlarkValue = bzlLoadValue.getModule().getGlobal(starlarkValueName); if (starlarkValue == null) { throw new ConversionException( String.format( STR, starlarkValueName, extensionLabel.toString())); } if (!(starlarkValue instanceof StarlarkAspect)) { throw new ConversionException( String.format( STR, starlarkValueName, extensionLabel.toString())); } return (StarlarkAspect) starlarkValue; } catch (BzlLoadFailedException e) { env.getListener().handle(Event.error(e.getMessage())); throw new AspectCreationException(e.getMessage(), extensionLabel, e.getDetailedExitCode()); } catch (ConversionException e) { env.getListener().handle(Event.error(e.getMessage())); throw new AspectCreationException(e.getMessage(), extensionLabel); } }
/** * Load Starlark aspect from an extension file. Is to be called from a SkyFunction. * * @return {@code null} if dependencies cannot be satisfied. */
Load Starlark aspect from an extension file. Is to be called from a SkyFunction
loadStarlarkAspect
{ "repo_name": "davidzchen/bazel", "path": "src/main/java/com/google/devtools/build/lib/skyframe/AspectFunction.java", "license": "apache-2.0", "size": 32814 }
[ "com.google.common.base.Preconditions", "com.google.devtools.build.lib.cmdline.Label", "com.google.devtools.build.lib.events.Event", "com.google.devtools.build.lib.packages.StarlarkAspect", "com.google.devtools.build.lib.packages.Type", "com.google.devtools.build.lib.skyframe.BzlLoadFunction", "com.goog...
import com.google.common.base.Preconditions; import com.google.devtools.build.lib.cmdline.Label; import com.google.devtools.build.lib.events.Event; import com.google.devtools.build.lib.packages.StarlarkAspect; import com.google.devtools.build.lib.packages.Type; import com.google.devtools.build.lib.skyframe.BzlLoadFunction; import com.google.devtools.build.skyframe.SkyKey;
import com.google.common.base.*; import com.google.devtools.build.lib.cmdline.*; import com.google.devtools.build.lib.events.*; import com.google.devtools.build.lib.packages.*; import com.google.devtools.build.lib.skyframe.*; import com.google.devtools.build.skyframe.*;
[ "com.google.common", "com.google.devtools" ]
com.google.common; com.google.devtools;
1,482,012
public int av_get_frame_filename(Pointer<Byte > buf, int buf_size, Pointer<Byte > path, int number) { return av_get_frame_filename(Pointer.getPeer(buf), buf_size, Pointer.getPeer(path), number); }
int function(Pointer<Byte > buf, int buf_size, Pointer<Byte > path, int number) { return av_get_frame_filename(Pointer.getPeer(buf), buf_size, Pointer.getPeer(path), number); }
/** * Return in 'buf' the path with '%d' replaced by a number.<br> * Also handles the '%0nd' format where 'n' is the total number<br> * of digits and '%%'.<br> * @param buf destination buffer<br> * @param buf_size destination buffer size<br> * @param path numbered sequence string<br> * @param number frame number<br> * @return 0 if OK, -1 on format error<br> * Original signature : <code>int av_get_frame_filename(char*, int, const char*, int)</code><br> * <i>native declaration : ffmpeg_build/include/libavformat/avformat.h:1087</i> */
Return in 'buf' the path with '%d' replaced by a number. Also handles the '%0nd' format where 'n' is the total number of digits and '%%'
av_get_frame_filename
{ "repo_name": "mutars/java_libav", "path": "wrapper/src/main/java/com/mutar/libav/bridge/avformat/AvformatLibrary.java", "license": "gpl-2.0", "size": 136321 }
[ "org.bridj.Pointer" ]
import org.bridj.Pointer;
import org.bridj.*;
[ "org.bridj" ]
org.bridj;
1,917,349
private static synchronized void setTimerForTokenRenewal(DelegationTokenToRenew token, boolean firstTime) throws IOException { // calculate timer time long now = System.currentTimeMillis(); long renewIn; if(firstTime) { renewIn = now; } else { long expiresIn = (token.expirationDate - now); renewIn = now + expiresIn - expiresIn/10; // little bit before the expiration } // need to create new task every time TimerTask tTask = new RenewalTimerTask(token); token.setTimerTask(tTask); // keep reference to the timer if (renewalTimer == null) { renewalTimer = new Timer(true); } renewalTimer.schedule(token.timerTask, new Date(renewIn)); }
static synchronized void function(DelegationTokenToRenew token, boolean firstTime) throws IOException { long now = System.currentTimeMillis(); long renewIn; if(firstTime) { renewIn = now; } else { long expiresIn = (token.expirationDate - now); renewIn = now + expiresIn - expiresIn/10; } TimerTask tTask = new RenewalTimerTask(token); token.setTimerTask(tTask); if (renewalTimer == null) { renewalTimer = new Timer(true); } renewalTimer.schedule(token.timerTask, new Date(renewIn)); }
/** * set task to renew the token */
set task to renew the token
setTimerForTokenRenewal
{ "repo_name": "williamsentosa/hadoop-modified", "path": "src/mapred/org/apache/hadoop/mapreduce/security/token/DelegationTokenRenewal.java", "license": "apache-2.0", "size": 9878 }
[ "java.io.IOException", "java.util.Date", "java.util.Timer", "java.util.TimerTask" ]
import java.io.IOException; import java.util.Date; import java.util.Timer; import java.util.TimerTask;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
979,524
// Update retry counter if (response != Policy.RETRY) { setRetryCount(0); } else { setRetryCount(mRetryCount + 1); } if (response == Policy.LICENSED) { // Update server policy data Map<String, String> extras = decodeExtras(rawData.extra); mLastResponse = response; setValidityTimestamp(extras.get("VT")); setRetryUntil(extras.get("GT")); setMaxRetries(extras.get("GR")); } else if (response == Policy.NOT_LICENSED) { // Clear out stale policy data setValidityTimestamp(DEFAULT_VALIDITY_TIMESTAMP); setRetryUntil(DEFAULT_RETRY_UNTIL); setMaxRetries(DEFAULT_MAX_RETRIES); } setLastResponse(response); mPreferences.commit(); }
if (response != Policy.RETRY) { setRetryCount(0); } else { setRetryCount(mRetryCount + 1); } if (response == Policy.LICENSED) { Map<String, String> extras = decodeExtras(rawData.extra); mLastResponse = response; setValidityTimestamp(extras.get("VT")); setRetryUntil(extras.get("GT")); setMaxRetries(extras.get("GR")); } else if (response == Policy.NOT_LICENSED) { setValidityTimestamp(DEFAULT_VALIDITY_TIMESTAMP); setRetryUntil(DEFAULT_RETRY_UNTIL); setMaxRetries(DEFAULT_MAX_RETRIES); } setLastResponse(response); mPreferences.commit(); }
/** * Process a new response from the license server. * <p> * This data will be used for computing future policy decisions. The * following parameters are processed: * <ul> * <li>VT: the timestamp that the client should consider the response * valid until * <li>GT: the timestamp that the client should ignore retry errors until * <li>GR: the number of retry errors that the client should ignore * </ul> * * @param response the result from validating the server response * @param rawData the raw server response data */
Process a new response from the license server. This data will be used for computing future policy decisions. The following parameters are processed: valid until
processServerResponse
{ "repo_name": "luisbrito/baker-android-refactor", "path": "app/src/main/java/com/google/android/vending/licensing/ServerManagedPolicy.java", "license": "bsd-3-clause", "size": 10482 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,237,255
public TaskService getTaskService() { return taskService; }
TaskService function() { return taskService; }
/** * Returns the task remote service. * * @return the task remote service */
Returns the task remote service
getTaskService
{ "repo_name": "rivetlogic/liferay-todos", "path": "modules/todos-service/todos-service-service/src/main/java/com/rivetlogic/todo/service/base/TaskServiceBaseImpl.java", "license": "gpl-3.0", "size": 9517 }
[ "com.rivetlogic.todo.service.TaskService" ]
import com.rivetlogic.todo.service.TaskService;
import com.rivetlogic.todo.service.*;
[ "com.rivetlogic.todo" ]
com.rivetlogic.todo;
951,042
@Test public void testFINNIS() { CuteNetlibCase.doTest("FINNIS.SIF", "172791.0655956116", null, NumberContext.of(7, 4)); }
void function() { CuteNetlibCase.doTest(STR, STR, null, NumberContext.of(7, 4)); }
/** * <pre> * 2019-02-13: Objective obtained/verified by CPLEX * </pre> */
<code> 2019-02-13: Objective obtained/verified by CPLEX </code>
testFINNIS
{ "repo_name": "optimatika/ojAlgo", "path": "src/test/java/org/ojalgo/optimisation/linear/CuteNetlibCase.java", "license": "mit", "size": 42381 }
[ "org.ojalgo.type.context.NumberContext" ]
import org.ojalgo.type.context.NumberContext;
import org.ojalgo.type.context.*;
[ "org.ojalgo.type" ]
org.ojalgo.type;
1,383,479
@Transactional public List<ApprovalRange> findWhereUpdatedByEquals(String updatedBy) throws ApprovalRangeDaoException { try { return jdbcTemplate.query("SELECT id, username, role_code, from_amount, to_amount, is_active, is_delete, created_by, created_date, updated_by, updated_date FROM " + getTableName() + " WHERE updated_by = ? ORDER BY updated_by", this, updatedBy); } catch (Exception e) { throw new ApprovalRangeDaoException("Query failed", e); } }
List<ApprovalRange> function(String updatedBy) throws ApprovalRangeDaoException { try { return jdbcTemplate.query(STR + getTableName() + STR, this, updatedBy); } catch (Exception e) { throw new ApprovalRangeDaoException(STR, e); } }
/** * Returns all rows from the approval_range table that match the criteria * 'updated_by = :updatedBy'. */
Returns all rows from the approval_range table that match the criteria 'updated_by = :updatedBy'
findWhereUpdatedByEquals
{ "repo_name": "rmage/gnvc-ims", "path": "src/java/com/app/wms/engine/db/dao/spring/ApprovalRangeDaoImpl.java", "license": "lgpl-3.0", "size": 17983 }
[ "com.app.wms.engine.db.dto.ApprovalRange", "com.app.wms.engine.db.exceptions.ApprovalRangeDaoException", "java.util.List" ]
import com.app.wms.engine.db.dto.ApprovalRange; import com.app.wms.engine.db.exceptions.ApprovalRangeDaoException; import java.util.List;
import com.app.wms.engine.db.dto.*; import com.app.wms.engine.db.exceptions.*; import java.util.*;
[ "com.app.wms", "java.util" ]
com.app.wms; java.util;
2,028,490
public void writeAbstractFeature(XMLStreamWriter writer, AbstractFeature bean) throws XMLStreamException { if (bean instanceof FeatureCollection) writeFeatureCollection(writer, (FeatureCollection)bean); else { QName qName = bean.getQName(); writer.writeStartElement(qName.getNamespaceURI(), qName.getLocalPart()); this.writeNamespaces(writer); this.writeAbstractFeatureTypeAttributes(writer, bean); this.writeAbstractFeatureTypeElements(writer, bean); writer.writeEndElement(); } }
void function(XMLStreamWriter writer, AbstractFeature bean) throws XMLStreamException { if (bean instanceof FeatureCollection) writeFeatureCollection(writer, (FeatureCollection)bean); else { QName qName = bean.getQName(); writer.writeStartElement(qName.getNamespaceURI(), qName.getLocalPart()); this.writeNamespaces(writer); this.writeAbstractFeatureTypeAttributes(writer, bean); this.writeAbstractFeatureTypeElements(writer, bean); writer.writeEndElement(); } }
/** * Dispatcher method for writing classes derived from AbstractFeature */
Dispatcher method for writing classes derived from AbstractFeature
writeAbstractFeature
{ "repo_name": "sensiasoft/lib-swe-common", "path": "swe-common-om/src/main/java/net/opengis/gml/v32/bind/XMLStreamBindings.java", "license": "mpl-2.0", "size": 77403 }
[ "javax.xml.namespace.QName", "javax.xml.stream.XMLStreamException", "javax.xml.stream.XMLStreamWriter", "net.opengis.gml.v32.AbstractFeature", "net.opengis.gml.v32.FeatureCollection" ]
import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import net.opengis.gml.v32.AbstractFeature; import net.opengis.gml.v32.FeatureCollection;
import javax.xml.namespace.*; import javax.xml.stream.*; import net.opengis.gml.v32.*;
[ "javax.xml", "net.opengis.gml" ]
javax.xml; net.opengis.gml;
563,981
public boolean render(InternalContextAdapter context, Writer writer, Node node) { context.put(key, new Reference(context, this)); return true; }
boolean function(InternalContextAdapter context, Writer writer, Node node) { context.put(key, new Reference(context, this)); return true; }
/** * directive.render() simply makes an instance of the Block inner class * and places it into the context as indicated. */
directive.render() simply makes an instance of the Block inner class and places it into the context as indicated
render
{ "repo_name": "apache/velocity-engine", "path": "velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Define.java", "license": "apache-2.0", "size": 4042 }
[ "java.io.Writer", "org.apache.velocity.context.InternalContextAdapter", "org.apache.velocity.runtime.parser.node.Node" ]
import java.io.Writer; import org.apache.velocity.context.InternalContextAdapter; import org.apache.velocity.runtime.parser.node.Node;
import java.io.*; import org.apache.velocity.context.*; import org.apache.velocity.runtime.parser.node.*;
[ "java.io", "org.apache.velocity" ]
java.io; org.apache.velocity;
2,578,006
@SuppressWarnings("nls") public final void printSay(final String timestamp, final String user, final String text) { appendToPane(timestamp, Color.LIGHT_GRAY); appendToPane(" " + user, Color.CYAN); appendToPane(" " + text + "\n", Color.ORANGE); resume(); }
@SuppressWarnings("nls") final void function(final String timestamp, final String user, final String text) { appendToPane(timestamp, Color.LIGHT_GRAY); appendToPane(" " + user, Color.CYAN); appendToPane(" " + text + "\n", Color.ORANGE); resume(); }
/** * Prints on the console a {@code say} message. * <hr> * @param timestamp Time stamp of the message. * @param user User name being the sender of the message. * @param text Text of the message. */
Prints on the console a say message.
printSay
{ "repo_name": "ressec/athena", "path": "athena-base/src/main/java/com/heliosphere/athena/base/terminal/OutputTerminal.java", "license": "apache-2.0", "size": 3430 }
[ "java.awt.Color" ]
import java.awt.Color;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,314,295
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }
void function(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }
/** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */
Handles the HTTP <code>GET</code> method
doGet
{ "repo_name": "Camozor/GestionBureau", "path": "GestionBureau/GestionBureau-war/src/java/Visiteur/VisiteurListePersonnes.java", "license": "gpl-2.0", "size": 2850 }
[ "java.io.IOException", "javax.servlet.ServletException", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse" ]
import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;
import java.io.*; import javax.servlet.*; import javax.servlet.http.*;
[ "java.io", "javax.servlet" ]
java.io; javax.servlet;
434,556
@Override public void notifyChanged(Notification notification) { updateChildren(notification); super.notifyChanged(notification); }
void function(Notification notification) { updateChildren(notification); super.notifyChanged(notification); }
/** * This handles model notifications by calling {@link #updateChildren} to update any cached * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */
This handles model notifications by calling <code>#updateChildren</code> to update any cached children and by creating a viewer notification, which it passes to <code>#fireNotifyChanged</code>.
notifyChanged
{ "repo_name": "bmaggi/Papyrus-SysML11", "path": "plugins/org.eclipse.papyrus.sysml.edit/src/org/eclipse/papyrus/sysml/blocks/provider/NestedConnectorEndItemProvider.java", "license": "epl-1.0", "size": 5452 }
[ "org.eclipse.emf.common.notify.Notification" ]
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,197,068
@Test public void should_fail_because_value_is_not_of_any_of_types() throws Exception { WritableAssertionInfo info = new WritableAssertionInfo(); info.description("description"); Table table = new Table(); TableAssert tableAssert = assertThat(table); try { List<Value> list = new ArrayList<>(Arrays.asList(getValue(null, 8), getValue(null, "test"))); AssertionsOnColumnType.isOfAnyTypeIn(tableAssert, info, list, ValueType.TEXT, ValueType.DATE); fail("An exception must be raised"); } catch (AssertionError e) { Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[description] %n" + "Expecting that the value at index 0:%n" + " <8>%n" + "to be of type%n" + " <[TEXT, DATE]>%n" + "but was of type%n" + " <NUMBER>")); } try { List<Value> list = new ArrayList<>(Arrays.asList(getValue(null, null), getValue(null, "test"))); AssertionsOnColumnType.isOfAnyTypeIn(tableAssert, info, list, ValueType.TEXT, ValueType.DATE); fail("An exception must be raised"); } catch (AssertionError e) { Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[description] %n" + "Expecting that the value at index 0:%n" + " <null>%n" + "to be of type%n" + " <[TEXT, DATE]>%n" + "but was of type%n" + " <NOT_IDENTIFIED>")); } try { List<Value> list = new ArrayList<>(Arrays.asList(getValue(null, Locale.FRENCH), getValue(null, "test"))); AssertionsOnColumnType.isOfAnyTypeIn(tableAssert, info, list, ValueType.TEXT, ValueType.DATE); fail("An exception must be raised"); } catch (AssertionError e) { Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[description] %n" + "Expecting that the value at index 0:%n" + " <fr>%n" + "to be of type%n" + " <[TEXT, DATE]>%n" + "but was of type%n" + " <NOT_IDENTIFIED> (java.util.Locale)")); } }
void function() throws Exception { WritableAssertionInfo info = new WritableAssertionInfo(); info.description(STR); Table table = new Table(); TableAssert tableAssert = assertThat(table); try { List<Value> list = new ArrayList<>(Arrays.asList(getValue(null, 8), getValue(null, "test"))); AssertionsOnColumnType.isOfAnyTypeIn(tableAssert, info, list, ValueType.TEXT, ValueType.DATE); fail(STR); } catch (AssertionError e) { Assertions.assertThat(e.getMessage()).isEqualTo(String.format(STR + STR + STR + STR + STR + STR + STR)); } try { List<Value> list = new ArrayList<>(Arrays.asList(getValue(null, null), getValue(null, "test"))); AssertionsOnColumnType.isOfAnyTypeIn(tableAssert, info, list, ValueType.TEXT, ValueType.DATE); fail(STR); } catch (AssertionError e) { Assertions.assertThat(e.getMessage()).isEqualTo(String.format(STR + STR + STR + STR + STR + STR + STR)); } try { List<Value> list = new ArrayList<>(Arrays.asList(getValue(null, Locale.FRENCH), getValue(null, "test"))); AssertionsOnColumnType.isOfAnyTypeIn(tableAssert, info, list, ValueType.TEXT, ValueType.DATE); fail(STR); } catch (AssertionError e) { Assertions.assertThat(e.getMessage()).isEqualTo(String.format(STR + STR + STR + STR + STR + STR + STR)); } }
/** * This method should fail because the value is not of any of types. */
This method should fail because the value is not of any of types
should_fail_because_value_is_not_of_any_of_types
{ "repo_name": "otoniel-isidoro/assertj-db", "path": "src/test/java/org/assertj/db/api/assertions/impl/AssertionsOnColumnType_IsOfAnyTypeIn_Test.java", "license": "apache-2.0", "size": 8421 }
[ "java.util.ArrayList", "java.util.Arrays", "java.util.List", "java.util.Locale", "org.assertj.core.api.Assertions", "org.assertj.core.api.WritableAssertionInfo", "org.assertj.db.api.Assertions", "org.assertj.db.api.TableAssert", "org.assertj.db.type.Table", "org.assertj.db.type.Value", "org.asse...
import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Locale; import org.assertj.core.api.Assertions; import org.assertj.core.api.WritableAssertionInfo; import org.assertj.db.api.Assertions; import org.assertj.db.api.TableAssert; import org.assertj.db.type.Table; import org.assertj.db.type.Value; import org.assertj.db.type.ValueType; import org.junit.Assert;
import java.util.*; import org.assertj.core.api.*; import org.assertj.db.api.*; import org.assertj.db.type.*; import org.junit.*;
[ "java.util", "org.assertj.core", "org.assertj.db", "org.junit" ]
java.util; org.assertj.core; org.assertj.db; org.junit;
886,861
public void waitTopologyFuture(GridKernalContext ctx) throws IgniteCheckedException { GridCacheContext<K, V> cctx = cacheContext(ctx); if (!cctx.isLocal()) { cacheContext(ctx).affinity().affinityReadyFuture(initTopVer).get(); for (int partId = 0; partId < cacheContext(ctx).affinity().partitions(); partId++) getOrCreatePartitionRecovery(ctx, partId); } }
void function(GridKernalContext ctx) throws IgniteCheckedException { GridCacheContext<K, V> cctx = cacheContext(ctx); if (!cctx.isLocal()) { cacheContext(ctx).affinity().affinityReadyFuture(initTopVer).get(); for (int partId = 0; partId < cacheContext(ctx).affinity().partitions(); partId++) getOrCreatePartitionRecovery(ctx, partId); } }
/** * Wait topology. */
Wait topology
waitTopologyFuture
{ "repo_name": "DoudTechData/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java", "license": "apache-2.0", "size": 52112 }
[ "org.apache.ignite.IgniteCheckedException", "org.apache.ignite.internal.GridKernalContext", "org.apache.ignite.internal.processors.cache.GridCacheContext" ]
import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.internal.GridKernalContext; import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.*;
[ "org.apache.ignite" ]
org.apache.ignite;
702,436
Future<MessageSender> getOrCreateEventSender(String tenantId);
Future<MessageSender> getOrCreateEventSender(String tenantId);
/** * Gets a client for sending events to a Hono server. * * @param tenantId The ID of the tenant to send events for. * @return A future that will complete with the sender once the link has been established. The future will fail if * the link cannot be established, e.g. because this client is not connected or if a concurrent request to * create a sender for the same tenant is already being executed. * @throws NullPointerException if the tenant is {@code null}. */
Gets a client for sending events to a Hono server
getOrCreateEventSender
{ "repo_name": "dejanb/hono", "path": "client/src/main/java/org/eclipse/hono/client/HonoClient.java", "license": "epl-1.0", "size": 25603 }
[ "io.vertx.core.Future" ]
import io.vertx.core.Future;
import io.vertx.core.*;
[ "io.vertx.core" ]
io.vertx.core;
1,416,739
protected I_CmsHistoryResource internalCreateResource(ResultSet res) throws SQLException { int resourceVersion = res.getInt(m_sqlManager.readQuery("C_RESOURCES_VERSION")); int structureVersion = res.getInt(m_sqlManager.readQuery("C_RESOURCES_STRUCTURE_VERSION")); int tagId = res.getInt(m_sqlManager.readQuery("C_RESOURCES_PUBLISH_TAG")); CmsUUID structureId = new CmsUUID(res.getString(m_sqlManager.readQuery("C_RESOURCES_STRUCTURE_ID"))); CmsUUID resourceId = new CmsUUID(res.getString(m_sqlManager.readQuery("C_RESOURCES_RESOURCE_ID"))); String resourcePath = res.getString(m_sqlManager.readQuery("C_RESOURCES_RESOURCE_PATH")); int resourceType = res.getInt(m_sqlManager.readQuery("C_RESOURCES_RESOURCE_TYPE")); int resourceFlags = res.getInt(m_sqlManager.readQuery("C_RESOURCES_RESOURCE_FLAGS")); CmsUUID projectLastModified = new CmsUUID( res.getString(m_sqlManager.readQuery("C_RESOURCES_PROJECT_LASTMODIFIED"))); int state = Math.max( res.getInt(m_sqlManager.readQuery("C_RESOURCES_STATE")), res.getInt(m_sqlManager.readQuery("C_RESOURCES_STRUCTURE_STATE"))); long dateCreated = res.getLong(m_sqlManager.readQuery("C_RESOURCES_DATE_CREATED")); long dateLastModified = res.getLong(m_sqlManager.readQuery("C_RESOURCES_DATE_LASTMODIFIED")); long dateReleased = res.getLong(m_sqlManager.readQuery("C_RESOURCES_DATE_RELEASED")); long dateExpired = res.getLong(m_sqlManager.readQuery("C_RESOURCES_DATE_EXPIRED")); int resourceSize = res.getInt(m_sqlManager.readQuery("C_RESOURCES_SIZE")); CmsUUID userLastModified = new CmsUUID(res.getString(m_sqlManager.readQuery("C_RESOURCES_USER_LASTMODIFIED"))); CmsUUID userCreated = new CmsUUID(res.getString(m_sqlManager.readQuery("C_RESOURCES_USER_CREATED"))); CmsUUID parentId = new CmsUUID(res.getString(m_sqlManager.readQuery("C_RESOURCES_HISTORY_PARENTID"))); long dateContent = res.getLong(m_sqlManager.readQuery("C_RESOURCES_DATE_CONTENT")); boolean isFolder = resourcePath.endsWith("/"); if (isFolder) { return new CmsHistoryFolder( tagId, structureId, resourceId, resourcePath, resourceType, resourceFlags, projectLastModified, CmsResourceState.valueOf(state), dateCreated, userCreated, dateLastModified, userLastModified, dateReleased, dateExpired, resourceVersion + structureVersion, parentId, resourceVersion, structureVersion); } else { return new CmsHistoryFile( tagId, structureId, resourceId, resourcePath, resourceType, resourceFlags, projectLastModified, CmsResourceState.valueOf(state), dateCreated, userCreated, dateLastModified, userLastModified, dateReleased, dateExpired, resourceSize, dateContent, resourceVersion + structureVersion, parentId, null, resourceVersion, structureVersion); } }
I_CmsHistoryResource function(ResultSet res) throws SQLException { int resourceVersion = res.getInt(m_sqlManager.readQuery(STR)); int structureVersion = res.getInt(m_sqlManager.readQuery(STR)); int tagId = res.getInt(m_sqlManager.readQuery(STR)); CmsUUID structureId = new CmsUUID(res.getString(m_sqlManager.readQuery(STR))); CmsUUID resourceId = new CmsUUID(res.getString(m_sqlManager.readQuery(STR))); String resourcePath = res.getString(m_sqlManager.readQuery(STR)); int resourceType = res.getInt(m_sqlManager.readQuery(STR)); int resourceFlags = res.getInt(m_sqlManager.readQuery(STR)); CmsUUID projectLastModified = new CmsUUID( res.getString(m_sqlManager.readQuery(STR))); int state = Math.max( res.getInt(m_sqlManager.readQuery(STR)), res.getInt(m_sqlManager.readQuery(STR))); long dateCreated = res.getLong(m_sqlManager.readQuery(STR)); long dateLastModified = res.getLong(m_sqlManager.readQuery(STR)); long dateReleased = res.getLong(m_sqlManager.readQuery(STR)); long dateExpired = res.getLong(m_sqlManager.readQuery(STR)); int resourceSize = res.getInt(m_sqlManager.readQuery(STR)); CmsUUID userLastModified = new CmsUUID(res.getString(m_sqlManager.readQuery(STR))); CmsUUID userCreated = new CmsUUID(res.getString(m_sqlManager.readQuery(STR))); CmsUUID parentId = new CmsUUID(res.getString(m_sqlManager.readQuery(STR))); long dateContent = res.getLong(m_sqlManager.readQuery(STR)); boolean isFolder = resourcePath.endsWith("/"); if (isFolder) { return new CmsHistoryFolder( tagId, structureId, resourceId, resourcePath, resourceType, resourceFlags, projectLastModified, CmsResourceState.valueOf(state), dateCreated, userCreated, dateLastModified, userLastModified, dateReleased, dateExpired, resourceVersion + structureVersion, parentId, resourceVersion, structureVersion); } else { return new CmsHistoryFile( tagId, structureId, resourceId, resourcePath, resourceType, resourceFlags, projectLastModified, CmsResourceState.valueOf(state), dateCreated, userCreated, dateLastModified, userLastModified, dateReleased, dateExpired, resourceSize, dateContent, resourceVersion + structureVersion, parentId, null, resourceVersion, structureVersion); } }
/** * Creates a valid {@link I_CmsHistoryResource} instance from a JDBC ResultSet.<p> * * @param res the JDBC result set * * @return the new historical resource instance * * @throws SQLException if a requested attribute was not found in the result set */
Creates a valid <code>I_CmsHistoryResource</code> instance from a JDBC ResultSet
internalCreateResource
{ "repo_name": "victos/opencms-core", "path": "src/org/opencms/db/generic/CmsHistoryDriver.java", "license": "lgpl-2.1", "size": 82025 }
[ "java.sql.ResultSet", "java.sql.SQLException", "org.opencms.db.CmsResourceState", "org.opencms.file.history.CmsHistoryFile", "org.opencms.file.history.CmsHistoryFolder", "org.opencms.util.CmsUUID" ]
import java.sql.ResultSet; import java.sql.SQLException; import org.opencms.db.CmsResourceState; import org.opencms.file.history.CmsHistoryFile; import org.opencms.file.history.CmsHistoryFolder; import org.opencms.util.CmsUUID;
import java.sql.*; import org.opencms.db.*; import org.opencms.file.history.*; import org.opencms.util.*;
[ "java.sql", "org.opencms.db", "org.opencms.file", "org.opencms.util" ]
java.sql; org.opencms.db; org.opencms.file; org.opencms.util;
200,823
private String generateSMSOTP() { char[] chars = IdentityRecoveryConstants.SMS_OTP_GENERATE_CHAR_SET.toCharArray(); SecureRandom rnd = new SecureRandom(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < IdentityRecoveryConstants.SMS_OTP_CODE_LENGTH; i++) { sb.append(chars[rnd.nextInt(chars.length)]); } return sb.toString(); }
String function() { char[] chars = IdentityRecoveryConstants.SMS_OTP_GENERATE_CHAR_SET.toCharArray(); SecureRandom rnd = new SecureRandom(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < IdentityRecoveryConstants.SMS_OTP_CODE_LENGTH; i++) { sb.append(chars[rnd.nextInt(chars.length)]); } return sb.toString(); }
/** * Generate an OTP for password recovery via mobile Channel * * @return OTP */
Generate an OTP for password recovery via mobile Channel
generateSMSOTP
{ "repo_name": "IsuraD/identity-governance", "path": "components/org.wso2.carbon.identity.recovery/src/main/java/org/wso2/carbon/identity/recovery/handler/UserSelfRegistrationHandler.java", "license": "apache-2.0", "size": 22277 }
[ "java.security.SecureRandom", "org.wso2.carbon.identity.recovery.IdentityRecoveryConstants" ]
import java.security.SecureRandom; import org.wso2.carbon.identity.recovery.IdentityRecoveryConstants;
import java.security.*; import org.wso2.carbon.identity.recovery.*;
[ "java.security", "org.wso2.carbon" ]
java.security; org.wso2.carbon;
1,485,973
EClass getStructuralFeatureValue();
EClass getStructuralFeatureValue();
/** * Returns the meta object for class '{@link ca.mcgill.cs.sel.ram.StructuralFeatureValue <em>Structural Feature Value</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>Structural Feature Value</em>'. * @see ca.mcgill.cs.sel.ram.StructuralFeatureValue * @generated */
Returns the meta object for class '<code>ca.mcgill.cs.sel.ram.StructuralFeatureValue Structural Feature Value</code>'.
getStructuralFeatureValue
{ "repo_name": "mjorod/textram", "path": "tool/ca.mcgill.sel.ram/src/ca/mcgill/cs/sel/ram/RamPackage.java", "license": "mit", "size": 271132 }
[ "org.eclipse.emf.ecore.EClass" ]
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,065,351
public void setDr(Ip4Address dr) { this.dr = dr; }
void function(Ip4Address dr) { this.dr = dr; }
/** * Sets DRs IP address. * * @param dr DRs IP address */
Sets DRs IP address
setDr
{ "repo_name": "sdnwiselab/onos", "path": "protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/ospfpacket/types/HelloPacket.java", "license": "apache-2.0", "size": 11971 }
[ "org.onlab.packet.Ip4Address" ]
import org.onlab.packet.Ip4Address;
import org.onlab.packet.*;
[ "org.onlab.packet" ]
org.onlab.packet;
1,763,942
Service getProxiedBy();
Service getProxiedBy();
/** * Gets the service that produced a proxy-granting ticket. * * @return Service that produced proxy-granting ticket or null if this is not a proxy-granting ticket. * @since 4.1 */
Gets the service that produced a proxy-granting ticket
getProxiedBy
{ "repo_name": "pdrados/cas", "path": "api/cas-server-core-api-ticket/src/main/java/org/apereo/cas/ticket/TicketGrantingTicket.java", "license": "apache-2.0", "size": 3738 }
[ "org.apereo.cas.authentication.principal.Service" ]
import org.apereo.cas.authentication.principal.Service;
import org.apereo.cas.authentication.principal.*;
[ "org.apereo.cas" ]
org.apereo.cas;
1,031,039
public static void mergeInto(AssociationIF target, AssociationIF source) { moveReifier(target, source); moveItemIdentifiers(target, source); // set up key map Map<String, AssociationRoleIF> keys = new HashMap<String, AssociationRoleIF>(); Iterator<AssociationRoleIF> it = target.getRoles().iterator(); while (it.hasNext()) { AssociationRoleIF role = it.next(); keys.put(KeyGenerator.makeAssociationRoleKey(role), role); } // merge the roles it = source.getRoles().iterator(); while (it.hasNext()) { AssociationRoleIF srole = it.next(); AssociationRoleIF trole = keys.get(KeyGenerator.makeAssociationRoleKey(srole)); if (trole == null) throw new ConstraintViolationException("Cannot merge unequal associations"); mergeIntoChecked(trole, srole); } source.remove(); }
static void function(AssociationIF target, AssociationIF source) { moveReifier(target, source); moveItemIdentifiers(target, source); Map<String, AssociationRoleIF> keys = new HashMap<String, AssociationRoleIF>(); Iterator<AssociationRoleIF> it = target.getRoles().iterator(); while (it.hasNext()) { AssociationRoleIF role = it.next(); keys.put(KeyGenerator.makeAssociationRoleKey(role), role); } it = source.getRoles().iterator(); while (it.hasNext()) { AssociationRoleIF srole = it.next(); AssociationRoleIF trole = keys.get(KeyGenerator.makeAssociationRoleKey(srole)); if (trole == null) throw new ConstraintViolationException(STR); mergeIntoChecked(trole, srole); } source.remove(); }
/** * PUBLIC: Merges the source association into the target * association. The two associations must be in the same topic * map. If the two associations are not actually equal a * ConstraintViolationException is thrown. * @since 5.1.0 */
association. The two associations must be in the same topic map. If the two associations are not actually equal a ConstraintViolationException is thrown
mergeInto
{ "repo_name": "ontopia/ontopia", "path": "ontopia-engine/src/main/java/net/ontopia/topicmaps/utils/MergeUtils.java", "license": "apache-2.0", "size": 47604 }
[ "java.util.HashMap", "java.util.Iterator", "java.util.Map", "net.ontopia.topicmaps.core.AssociationIF", "net.ontopia.topicmaps.core.AssociationRoleIF", "net.ontopia.topicmaps.core.ConstraintViolationException" ]
import java.util.HashMap; import java.util.Iterator; import java.util.Map; import net.ontopia.topicmaps.core.AssociationIF; import net.ontopia.topicmaps.core.AssociationRoleIF; import net.ontopia.topicmaps.core.ConstraintViolationException;
import java.util.*; import net.ontopia.topicmaps.core.*;
[ "java.util", "net.ontopia.topicmaps" ]
java.util; net.ontopia.topicmaps;
450,181
@Nullable private static Bitmap drawableToBitmap(@Nullable Drawable drawable, int maxDims) { if (drawable == null) { return null; } final int actualWidth = Math.max(1, drawable.getIntrinsicWidth()); final int actualHeight = Math.max(1, drawable.getIntrinsicHeight()); final double scaleWidth = ((double) maxDims) / actualWidth; final double scaleHeight = ((double) maxDims) / actualHeight; final double scale = Math.min(1.0, Math.min(scaleWidth, scaleHeight)); final int width = (int) (actualWidth * scale); final int height = (int) (actualHeight * scale); if (drawable instanceof BitmapDrawable) { final BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable; if (actualWidth != width || actualHeight != height) { return Bitmap.createScaledBitmap( bitmapDrawable.getBitmap(), width, height, false); } else { return bitmapDrawable.getBitmap(); } } else { final Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); final Canvas canvas = new Canvas(bitmap); drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); drawable.draw(canvas); return bitmap; } }
static Bitmap function(@Nullable Drawable drawable, int maxDims) { if (drawable == null) { return null; } final int actualWidth = Math.max(1, drawable.getIntrinsicWidth()); final int actualHeight = Math.max(1, drawable.getIntrinsicHeight()); final double scaleWidth = ((double) maxDims) / actualWidth; final double scaleHeight = ((double) maxDims) / actualHeight; final double scale = Math.min(1.0, Math.min(scaleWidth, scaleHeight)); final int width = (int) (actualWidth * scale); final int height = (int) (actualHeight * scale); if (drawable instanceof BitmapDrawable) { final BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable; if (actualWidth != width actualHeight != height) { return Bitmap.createScaledBitmap( bitmapDrawable.getBitmap(), width, height, false); } else { return bitmapDrawable.getBitmap(); } } else { final Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); final Canvas canvas = new Canvas(bitmap); drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); drawable.draw(canvas); return bitmap; } }
/** * Returns a Bitmap representation of the Drawable * * @param drawable The drawable to convert. * @param maxDims The maximum edge length of the resulting bitmap (in pixels). */
Returns a Bitmap representation of the Drawable
drawableToBitmap
{ "repo_name": "aosp-mirror/platform_frameworks_support", "path": "textclassifier/src/main/java/androidx/textclassifier/TextClassification.java", "license": "apache-2.0", "size": 23281 }
[ "android.graphics.Bitmap", "android.graphics.Canvas", "android.graphics.drawable.BitmapDrawable", "android.graphics.drawable.Drawable", "androidx.annotation.Nullable" ]
import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import androidx.annotation.Nullable;
import android.graphics.*; import android.graphics.drawable.*; import androidx.annotation.*;
[ "android.graphics", "androidx.annotation" ]
android.graphics; androidx.annotation;
1,862,727
if (baseReader != null) { return new InputSource(baseReader); } if (baseInputStream == null) { try { URL url = StringUtils.getURL(null, wsdlLocation); // If file is on the local file system we don't need to // use the proxy information. if ("file".equals(url.getProtocol())) { baseInputStream = StringUtils.getContentAsInputStream(url); } else { URLConnection con = url.openConnection(); createAuthString(); if (authString != null) { con.setRequestProperty(PROXY_AUTH, authString); } baseInputStream = con.getInputStream(); } //if (url != null) { documentBase = url.toString(); //} } catch (Exception e) { documentBase = wsdlLocation; } } if (baseInputStream == null) { return null; } return new InputSource(baseInputStream); }
if (baseReader != null) { return new InputSource(baseReader); } if (baseInputStream == null) { try { URL url = StringUtils.getURL(null, wsdlLocation); if ("file".equals(url.getProtocol())) { baseInputStream = StringUtils.getContentAsInputStream(url); } else { URLConnection con = url.openConnection(); createAuthString(); if (authString != null) { con.setRequestProperty(PROXY_AUTH, authString); } baseInputStream = con.getInputStream(); } documentBase = url.toString(); } catch (Exception e) { documentBase = wsdlLocation; } } if (baseInputStream == null) { return null; } return new InputSource(baseInputStream); }
/** * Get an InputSource for the base wsdl document. Returns null if the document * cannot be located. * @return The InputSource or null if the import cannot be resolved */
Get an InputSource for the base wsdl document. Returns null if the document cannot be located
getBaseInputSource
{ "repo_name": "vthangathurai/SOA-Runtime", "path": "codegen/codegen-tools/src/main/java/org/ebayopensource/turmeric/tools/codegen/external/wsdl/parser/AuthenticatingProxyWSDLLocatorImpl.java", "license": "apache-2.0", "size": 10703 }
[ "com.ibm.wsdl.util.StringUtils", "java.net.URLConnection", "org.xml.sax.InputSource" ]
import com.ibm.wsdl.util.StringUtils; import java.net.URLConnection; import org.xml.sax.InputSource;
import com.ibm.wsdl.util.*; import java.net.*; import org.xml.sax.*;
[ "com.ibm.wsdl", "java.net", "org.xml.sax" ]
com.ibm.wsdl; java.net; org.xml.sax;
177,958
public OutboundRuleInner withFrontendIPConfigurations(List<SubResource> frontendIPConfigurations) { this.frontendIPConfigurations = frontendIPConfigurations; return this; }
OutboundRuleInner function(List<SubResource> frontendIPConfigurations) { this.frontendIPConfigurations = frontendIPConfigurations; return this; }
/** * Set the Frontend IP addresses of the load balancer. * * @param frontendIPConfigurations the frontendIPConfigurations value to set * @return the OutboundRuleInner object itself. */
Set the Frontend IP addresses of the load balancer
withFrontendIPConfigurations
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/network/v2020_05_01/implementation/OutboundRuleInner.java", "license": "mit", "size": 8253 }
[ "com.microsoft.azure.SubResource", "java.util.List" ]
import com.microsoft.azure.SubResource; import java.util.List;
import com.microsoft.azure.*; import java.util.*;
[ "com.microsoft.azure", "java.util" ]
com.microsoft.azure; java.util;
1,862,026
@Nullable public ParsedQuery parseInnerFilter(XContentParser parser) throws IOException { reset(parser); try { parseFieldMatcher(indexSettings.getParseFieldMatcher()); Query filter = QueryBuilder.rewriteQuery(parseContext().parseInnerQueryBuilder(), this).toFilter(this); if (filter == null) { return null; } return new ParsedQuery(filter, copyNamedQueries()); } finally { reset(null); } }
ParsedQuery function(XContentParser parser) throws IOException { reset(parser); try { parseFieldMatcher(indexSettings.getParseFieldMatcher()); Query filter = QueryBuilder.rewriteQuery(parseContext().parseInnerQueryBuilder(), this).toFilter(this); if (filter == null) { return null; } return new ParsedQuery(filter, copyNamedQueries()); } finally { reset(null); } }
/** * Parses an inner filter, returning null if the filter should be ignored. */
Parses an inner filter, returning null if the filter should be ignored
parseInnerFilter
{ "repo_name": "xuzha/elasticsearch", "path": "core/src/main/java/org/elasticsearch/index/query/QueryShardContext.java", "license": "apache-2.0", "size": 14753 }
[ "java.io.IOException", "org.apache.lucene.search.Query", "org.elasticsearch.common.xcontent.XContentParser" ]
import java.io.IOException; import org.apache.lucene.search.Query; import org.elasticsearch.common.xcontent.XContentParser;
import java.io.*; import org.apache.lucene.search.*; import org.elasticsearch.common.xcontent.*;
[ "java.io", "org.apache.lucene", "org.elasticsearch.common" ]
java.io; org.apache.lucene; org.elasticsearch.common;
365,638
public final boolean shouldRecordInSrcSnapshot(final int latestInDst) { Preconditions.checkState(!isReference()); if (latestInDst == Snapshot.CURRENT_STATE_ID) { return true; } INodeReference withCount = getParentReference(); if (withCount != null) { int dstSnapshotId = withCount.getParentReference().getDstSnapshotId(); if (dstSnapshotId != Snapshot.CURRENT_STATE_ID && dstSnapshotId >= latestInDst) { return true; } } return false; } /** * This inode is being modified. The previous version of the inode needs to * be recorded in the latest snapshot. * * @param latestSnapshotId The id of the latest snapshot that has been taken. * Note that it is {@link Snapshot#CURRENT_STATE_ID}
final boolean function(final int latestInDst) { Preconditions.checkState(!isReference()); if (latestInDst == Snapshot.CURRENT_STATE_ID) { return true; } INodeReference withCount = getParentReference(); if (withCount != null) { int dstSnapshotId = withCount.getParentReference().getDstSnapshotId(); if (dstSnapshotId != Snapshot.CURRENT_STATE_ID && dstSnapshotId >= latestInDst) { return true; } } return false; } /** * This inode is being modified. The previous version of the inode needs to * be recorded in the latest snapshot. * * @param latestSnapshotId The id of the latest snapshot that has been taken. * Note that it is {@link Snapshot#CURRENT_STATE_ID}
/** * When {@link #recordModification} is called on a referred node, * this method tells which snapshot the modification should be * associated with: the snapshot that belongs to the SRC tree of the rename * operation, or the snapshot belonging to the DST tree. * * @param latestInDst * id of the latest snapshot in the DST tree above the reference node * @return True: the modification should be recorded in the snapshot that * belongs to the SRC tree. False: the modification should be * recorded in the snapshot that belongs to the DST tree. */
When <code>#recordModification</code> is called on a referred node, this method tells which snapshot the modification should be associated with: the snapshot that belongs to the SRC tree of the rename operation, or the snapshot belonging to the DST tree
shouldRecordInSrcSnapshot
{ "repo_name": "Bizyroth/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/INode.java", "license": "apache-2.0", "size": 29295 }
[ "com.google.common.base.Preconditions", "org.apache.hadoop.hdfs.server.namenode.snapshot.Snapshot" ]
import com.google.common.base.Preconditions; import org.apache.hadoop.hdfs.server.namenode.snapshot.Snapshot;
import com.google.common.base.*; import org.apache.hadoop.hdfs.server.namenode.snapshot.*;
[ "com.google.common", "org.apache.hadoop" ]
com.google.common; org.apache.hadoop;
1,208,744
public List<ParcelUuid> getServiceUuids() { try { return Collections.unmodifiableList(mBluetoothGatt.getAdvServiceUuids()); } catch (RemoteException e) { Log.e(TAG, "Unable to get service uuids.", e); return null; } }
List<ParcelUuid> function() { try { return Collections.unmodifiableList(mBluetoothGatt.getAdvServiceUuids()); } catch (RemoteException e) { Log.e(TAG, STR, e); return null; } }
/** * Returns an immutable list of service uuids that will be advertised. */
Returns an immutable list of service uuids that will be advertised
getServiceUuids
{ "repo_name": "JuudeDemos/android-sdk-20", "path": "src/android/bluetooth/BluetoothAdvScanData.java", "license": "apache-2.0", "size": 4415 }
[ "android.os.ParcelUuid", "android.os.RemoteException", "android.util.Log", "java.util.Collections", "java.util.List" ]
import android.os.ParcelUuid; import android.os.RemoteException; import android.util.Log; import java.util.Collections; import java.util.List;
import android.os.*; import android.util.*; import java.util.*;
[ "android.os", "android.util", "java.util" ]
android.os; android.util; java.util;
2,833,138
public final void setUtc(final boolean utc) { // reset the timezone associated with this instance.. this.timezone = null; if (utc) { getFormat().setTimeZone(TimeZones.getUtcTimeZone()); } else { resetTimeZone(); } time = new Time(time, getFormat().getTimeZone(), utc); }
final void function(final boolean utc) { this.timezone = null; if (utc) { getFormat().setTimeZone(TimeZones.getUtcTimeZone()); } else { resetTimeZone(); } time = new Time(time, getFormat().getTimeZone(), utc); }
/** * Updates this date-time to display in UTC time if the argument is true. * Otherwise, resets to the default timezone. * * @param utc * The utc to set. */
Updates this date-time to display in UTC time if the argument is true. Otherwise, resets to the default timezone
setUtc
{ "repo_name": "vbonamy/ical4j", "path": "src/main/java/net/fortuna/ical4j/model/DateTime.java", "license": "bsd-3-clause", "size": 16838 }
[ "net.fortuna.ical4j.util.TimeZones" ]
import net.fortuna.ical4j.util.TimeZones;
import net.fortuna.ical4j.util.*;
[ "net.fortuna.ical4j" ]
net.fortuna.ical4j;
2,106,704
void logTruncate(String src, String clientName, String clientMachine, long size, long timestamp, Block truncateBlock) { TruncateOp op = TruncateOp.getInstance(cache.get()) .setPath(src) .setClientName(clientName) .setClientMachine(clientMachine) .setNewLength(size) .setTimestamp(timestamp) .setTruncateBlock(truncateBlock); logEdit(op); }
void logTruncate(String src, String clientName, String clientMachine, long size, long timestamp, Block truncateBlock) { TruncateOp op = TruncateOp.getInstance(cache.get()) .setPath(src) .setClientName(clientName) .setClientMachine(clientMachine) .setNewLength(size) .setTimestamp(timestamp) .setTruncateBlock(truncateBlock); logEdit(op); }
/** * Add truncate file record to edit log */
Add truncate file record to edit log
logTruncate
{ "repo_name": "jiayuhan-it/yarn-jyhtest", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java", "license": "apache-2.0", "size": 54047 }
[ "org.apache.hadoop.hdfs.protocol.Block", "org.apache.hadoop.hdfs.server.namenode.FSEditLogOp" ]
import org.apache.hadoop.hdfs.protocol.Block; import org.apache.hadoop.hdfs.server.namenode.FSEditLogOp;
import org.apache.hadoop.hdfs.protocol.*; import org.apache.hadoop.hdfs.server.namenode.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
1,811,575
public void insertTabString(BaseDocument doc, int dotPos) throws BadLocationException { doc.atomicLock(); try { // Determine first white char before dotPos int rsPos = Utilities.getRowStart(doc, dotPos); int startPos = Utilities.getFirstNonWhiteBwd(doc, dotPos, rsPos); startPos = (startPos >= 0) ? (startPos + 1) : rsPos; int startCol = Utilities.getVisualColumn(doc, startPos); int endCol = Utilities.getNextTabColumn(doc, dotPos); String tabStr = Analyzer.getWhitespaceString(startCol, endCol, expandTabs(), doc.getTabSize()); // Search for the first non-common char char[] removeChars = doc.getChars(startPos, dotPos - startPos); int ind = 0; while (ind < removeChars.length && removeChars[ind] == tabStr.charAt(ind)) { ind++; } startPos += ind; doc.remove(startPos, dotPos - startPos); doc.insertString(startPos, tabStr.substring(ind), null); } finally { doc.atomicUnlock(); } }
void function(BaseDocument doc, int dotPos) throws BadLocationException { doc.atomicLock(); try { int rsPos = Utilities.getRowStart(doc, dotPos); int startPos = Utilities.getFirstNonWhiteBwd(doc, dotPos, rsPos); startPos = (startPos >= 0) ? (startPos + 1) : rsPos; int startCol = Utilities.getVisualColumn(doc, startPos); int endCol = Utilities.getNextTabColumn(doc, dotPos); String tabStr = Analyzer.getWhitespaceString(startCol, endCol, expandTabs(), doc.getTabSize()); char[] removeChars = doc.getChars(startPos, dotPos - startPos); int ind = 0; while (ind < removeChars.length && removeChars[ind] == tabStr.charAt(ind)) { ind++; } startPos += ind; doc.remove(startPos, dotPos - startPos); doc.insertString(startPos, tabStr.substring(ind), null); } finally { doc.atomicUnlock(); } }
/** Modify the line to move the text starting at dotPos one tab * column to the right. Whitespace preceeding dotPos may be * replaced by a TAB character if tabs expanding is on. * @param doc document to operate on * @param dotPos insertion point */
Modify the line to move the text starting at dotPos one tab column to the right. Whitespace preceeding dotPos may be replaced by a TAB character if tabs expanding is on
insertTabString
{ "repo_name": "sitsang/studio", "path": "src/main/java/org/netbeans/editor/Formatter.java", "license": "gpl-3.0", "size": 17303 }
[ "javax.swing.text.BadLocationException" ]
import javax.swing.text.BadLocationException;
import javax.swing.text.*;
[ "javax.swing" ]
javax.swing;
1,626,923
public void abortTransaction() throws ProducerFencedException { throwIfNoTransactionManager(); TransactionalRequestResult result = transactionManager.beginAbort(); sender.wakeup(); result.await(); }
void function() throws ProducerFencedException { throwIfNoTransactionManager(); TransactionalRequestResult result = transactionManager.beginAbort(); sender.wakeup(); result.await(); }
/** * Aborts the ongoing transaction. Any unflushed produce messages will be aborted when this call is made. * This call will throw an exception immediately if any prior {@link #send(ProducerRecord)} calls failed with a * {@link ProducerFencedException} or an instance of {@link org.apache.kafka.common.errors.AuthorizationException}. * * @throws IllegalStateException if no transactional.id has been configured or no transaction has been started * @throws ProducerFencedException fatal error indicating another producer with the same transactional.id is active * @throws org.apache.kafka.common.errors.UnsupportedVersionException fatal error indicating the broker * does not support transactions (i.e. if its version is lower than 0.11.0.0) * @throws org.apache.kafka.common.errors.AuthorizationException fatal error indicating that the configured * transactional.id is not authorized * @throws KafkaException if the producer has encountered a previous fatal error or for any other unexpected error */
Aborts the ongoing transaction. Any unflushed produce messages will be aborted when this call is made. This call will throw an exception immediately if any prior <code>#send(ProducerRecord)</code> calls failed with a <code>ProducerFencedException</code> or an instance of <code>org.apache.kafka.common.errors.AuthorizationException</code>
abortTransaction
{ "repo_name": "wangcy6/storm_app", "path": "frame/kafka-0.11.0/kafka-0.11.0.1-src/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java", "license": "apache-2.0", "size": 65211 }
[ "org.apache.kafka.clients.producer.internals.TransactionalRequestResult", "org.apache.kafka.common.errors.ProducerFencedException" ]
import org.apache.kafka.clients.producer.internals.TransactionalRequestResult; import org.apache.kafka.common.errors.ProducerFencedException;
import org.apache.kafka.clients.producer.internals.*; import org.apache.kafka.common.errors.*;
[ "org.apache.kafka" ]
org.apache.kafka;
1,668,629
@BeforeClass public static void initializeTests() throws Exception { trustStoreFile = File.createTempFile("truststore", ".jks"); serverSSLConfig1 = new SSLConfig(TestSSLUtils.createSslProps("DC2,DC3", SSLFactory.Mode.SERVER, trustStoreFile, "server1")); serverSSLConfig2 = new SSLConfig(TestSSLUtils.createSslProps("DC1,DC3", SSLFactory.Mode.SERVER, trustStoreFile, "server2")); serverSSLConfig3 = new SSLConfig(TestSSLUtils.createSslProps("DC1,DC2", SSLFactory.Mode.SERVER, trustStoreFile, "server3")); VerifiableProperties sslClientProps = TestSSLUtils.createSslProps("DC1,DC2,DC3", SSLFactory.Mode.CLIENT, trustStoreFile, "client"); sslConfig = new SSLConfig(sslClientProps); sslEnabledClusterMapConfig = new ClusterMapConfig(sslClientProps); Properties props = new Properties(); props.setProperty("clustermap.cluster.name", "test"); props.setProperty("clustermap.datacenter.name", "dc1"); props.setProperty("clustermap.host.name", "localhost"); plainTextClusterMapConfig = new ClusterMapConfig(new VerifiableProperties(props)); sslFactory = new SSLFactory(sslConfig); SSLContext sslContext = sslFactory.getSSLContext(); sslSocketFactory = sslContext.getSocketFactory(); } public BlockingChannelConnectionPoolTest() throws Exception { Properties props = new Properties(); props.setProperty("port", "6667"); props.setProperty("clustermap.cluster.name", "test"); props.setProperty("clustermap.datacenter.name", "dc1"); props.setProperty("clustermap.host.name", "localhost"); VerifiableProperties propverify = new VerifiableProperties(props); NetworkConfig config = new NetworkConfig(propverify); ArrayList<Port> ports = new ArrayList<Port>(); ports.add(new Port(6667, PortType.PLAINTEXT)); ports.add(new Port(7667, PortType.SSL)); server1 = new SocketServer(config, serverSSLConfig1, new MetricRegistry(), ports); server1.start(); props.setProperty("port", "6668"); propverify = new VerifiableProperties(props); config = new NetworkConfig(propverify); ports = new ArrayList<Port>(); ports.add(new Port(6668, PortType.PLAINTEXT)); ports.add(new Port(7668, PortType.SSL)); server2 = new SocketServer(config, serverSSLConfig2, new MetricRegistry(), ports); server2.start(); props.setProperty("port", "6669"); propverify = new VerifiableProperties(props); config = new NetworkConfig(propverify); ports = new ArrayList<Port>(); ports.add(new Port(6669, PortType.PLAINTEXT)); ports.add(new Port(7669, PortType.SSL)); server3 = new SocketServer(config, serverSSLConfig3, new MetricRegistry(), ports); server3.start(); }
static void function() throws Exception { trustStoreFile = File.createTempFile(STR, ".jks"); serverSSLConfig1 = new SSLConfig(TestSSLUtils.createSslProps(STR, SSLFactory.Mode.SERVER, trustStoreFile, STR)); serverSSLConfig2 = new SSLConfig(TestSSLUtils.createSslProps(STR, SSLFactory.Mode.SERVER, trustStoreFile, STR)); serverSSLConfig3 = new SSLConfig(TestSSLUtils.createSslProps(STR, SSLFactory.Mode.SERVER, trustStoreFile, STR)); VerifiableProperties sslClientProps = TestSSLUtils.createSslProps(STR, SSLFactory.Mode.CLIENT, trustStoreFile, STR); sslConfig = new SSLConfig(sslClientProps); sslEnabledClusterMapConfig = new ClusterMapConfig(sslClientProps); Properties props = new Properties(); props.setProperty(STR, "test"); props.setProperty(STR, "dc1"); props.setProperty(STR, STR); plainTextClusterMapConfig = new ClusterMapConfig(new VerifiableProperties(props)); sslFactory = new SSLFactory(sslConfig); SSLContext sslContext = sslFactory.getSSLContext(); sslSocketFactory = sslContext.getSocketFactory(); } public BlockingChannelConnectionPoolTest() throws Exception { Properties props = new Properties(); props.setProperty("port", "6667"); props.setProperty(STR, "test"); props.setProperty(STR, "dc1"); props.setProperty(STR, STR); VerifiableProperties propverify = new VerifiableProperties(props); NetworkConfig config = new NetworkConfig(propverify); ArrayList<Port> ports = new ArrayList<Port>(); ports.add(new Port(6667, PortType.PLAINTEXT)); ports.add(new Port(7667, PortType.SSL)); server1 = new SocketServer(config, serverSSLConfig1, new MetricRegistry(), ports); server1.start(); props.setProperty("port", "6668"); propverify = new VerifiableProperties(props); config = new NetworkConfig(propverify); ports = new ArrayList<Port>(); ports.add(new Port(6668, PortType.PLAINTEXT)); ports.add(new Port(7668, PortType.SSL)); server2 = new SocketServer(config, serverSSLConfig2, new MetricRegistry(), ports); server2.start(); props.setProperty("port", "6669"); propverify = new VerifiableProperties(props); config = new NetworkConfig(propverify); ports = new ArrayList<Port>(); ports.add(new Port(6669, PortType.PLAINTEXT)); ports.add(new Port(7669, PortType.SSL)); server3 = new SocketServer(config, serverSSLConfig3, new MetricRegistry(), ports); server3.start(); }
/** * Run only once for all tests */
Run only once for all tests
initializeTests
{ "repo_name": "xiahome/ambry", "path": "ambry-network/src/test/java/com.github.ambry.network/BlockingChannelConnectionPoolTest.java", "license": "apache-2.0", "size": 23107 }
[ "com.codahale.metrics.MetricRegistry", "com.github.ambry.commons.SSLFactory", "com.github.ambry.commons.TestSSLUtils", "com.github.ambry.config.ClusterMapConfig", "com.github.ambry.config.NetworkConfig", "com.github.ambry.config.SSLConfig", "com.github.ambry.config.VerifiableProperties", "java.io.File...
import com.codahale.metrics.MetricRegistry; import com.github.ambry.commons.SSLFactory; import com.github.ambry.commons.TestSSLUtils; import com.github.ambry.config.ClusterMapConfig; import com.github.ambry.config.NetworkConfig; import com.github.ambry.config.SSLConfig; import com.github.ambry.config.VerifiableProperties; import java.io.File; import java.util.ArrayList; import java.util.Properties; import javax.net.ssl.SSLContext;
import com.codahale.metrics.*; import com.github.ambry.commons.*; import com.github.ambry.config.*; import java.io.*; import java.util.*; import javax.net.ssl.*;
[ "com.codahale.metrics", "com.github.ambry", "java.io", "java.util", "javax.net" ]
com.codahale.metrics; com.github.ambry; java.io; java.util; javax.net;
1,072,817
@ApiModelProperty(example = "null", value = "") public VbTaskStatusEnum getStatus() { return status; }
@ApiModelProperty(example = "null", value = "") VbTaskStatusEnum function() { return status; }
/** * Get status * @return status **/
Get status
getStatus
{ "repo_name": "jbocharov/voicebase-java-samples", "path": "v3-upload-transcribe/src/main/java/com/voicebase/sample/v3client/model/VbProgress.java", "license": "mit", "size": 4536 }
[ "com.voicebase.sample.v3client.model.VbTaskStatusEnum", "io.swagger.annotations.ApiModelProperty" ]
import com.voicebase.sample.v3client.model.VbTaskStatusEnum; import io.swagger.annotations.ApiModelProperty;
import com.voicebase.sample.v3client.model.*; import io.swagger.annotations.*;
[ "com.voicebase.sample", "io.swagger.annotations" ]
com.voicebase.sample; io.swagger.annotations;
2,153,892
@ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<Flux<ByteBuffer>>> createOrUpdateWithResponseAsync( String resourceGroupName, String gatewayName, VpnGatewayInner vpnGatewayParameters);
@ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<Flux<ByteBuffer>>> createOrUpdateWithResponseAsync( String resourceGroupName, String gatewayName, VpnGatewayInner vpnGatewayParameters);
/** * Creates a virtual wan vpn gateway if it doesn't exist else updates the existing gateway. * * @param resourceGroupName The resource group name of the VpnGateway. * @param gatewayName The name of the gateway. * @param vpnGatewayParameters Parameters supplied to create or Update a virtual wan vpn gateway. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.resourcemanager.network.models.ErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return vpnGateway Resource. */
Creates a virtual wan vpn gateway if it doesn't exist else updates the existing gateway
createOrUpdateWithResponseAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanagerhybrid/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/fluent/VpnGatewaysClient.java", "license": "mit", "size": 24769 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.Response", "com.azure.resourcemanager.network.fluent.models.VpnGatewayInner", "java.nio.ByteBuffer" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.resourcemanager.network.fluent.models.VpnGatewayInner; import java.nio.ByteBuffer;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.network.fluent.models.*; import java.nio.*;
[ "com.azure.core", "com.azure.resourcemanager", "java.nio" ]
com.azure.core; com.azure.resourcemanager; java.nio;
1,836,349
private Attribute sourceFile(DirectClassFile cf, int offset, int length, ParseObserver observer) { if (length != 2) { throwBadLength(2); } ByteArray bytes = cf.getBytes(); ConstantPool pool = cf.getConstantPool(); int idx = bytes.getUnsignedShort(offset); CstString cst = (CstString) pool.get(idx); Attribute result = new AttSourceFile(cst); if (observer != null) { observer.parsed(bytes, offset, 2, "source: " + cst); } return result; }
Attribute function(DirectClassFile cf, int offset, int length, ParseObserver observer) { if (length != 2) { throwBadLength(2); } ByteArray bytes = cf.getBytes(); ConstantPool pool = cf.getConstantPool(); int idx = bytes.getUnsignedShort(offset); CstString cst = (CstString) pool.get(idx); Attribute result = new AttSourceFile(cst); if (observer != null) { observer.parsed(bytes, offset, 2, STR + cst); } return result; }
/** * Parses a {@code SourceFile} attribute. */
Parses a SourceFile attribute
sourceFile
{ "repo_name": "nikita36078/J2ME-Loader", "path": "dexlib/src/main/java/com/android/dx/cf/direct/StdAttributeFactory.java", "license": "apache-2.0", "size": 27928 }
[ "com.android.dx.cf.attrib.AttSourceFile", "com.android.dx.cf.iface.Attribute", "com.android.dx.cf.iface.ParseObserver", "com.android.dx.rop.cst.ConstantPool", "com.android.dx.rop.cst.CstString", "com.android.dx.util.ByteArray" ]
import com.android.dx.cf.attrib.AttSourceFile; import com.android.dx.cf.iface.Attribute; import com.android.dx.cf.iface.ParseObserver; import com.android.dx.rop.cst.ConstantPool; import com.android.dx.rop.cst.CstString; import com.android.dx.util.ByteArray;
import com.android.dx.cf.attrib.*; import com.android.dx.cf.iface.*; import com.android.dx.rop.cst.*; import com.android.dx.util.*;
[ "com.android.dx" ]
com.android.dx;
736,742
public static void pauseScheduler() throws SQLException, AuthorizeException { synchronized(HarvestScheduler.lock) { HarvestScheduler.interrupt = HarvestScheduler.HARVESTER_INTERRUPT_PAUSE; HarvestScheduler.lock.notify(); } }
static void function() throws SQLException, AuthorizeException { synchronized(HarvestScheduler.lock) { HarvestScheduler.interrupt = HarvestScheduler.HARVESTER_INTERRUPT_PAUSE; HarvestScheduler.lock.notify(); } }
/** * Pause an active harvest scheduler. */
Pause an active harvest scheduler
pauseScheduler
{ "repo_name": "mdiggory/dryad-repo", "path": "dspace-api/src/main/java/org/dspace/harvest/OAIHarvester.java", "license": "bsd-3-clause", "size": 52145 }
[ "java.sql.SQLException", "org.dspace.authorize.AuthorizeException" ]
import java.sql.SQLException; import org.dspace.authorize.AuthorizeException;
import java.sql.*; import org.dspace.authorize.*;
[ "java.sql", "org.dspace.authorize" ]
java.sql; org.dspace.authorize;
878,281
private JMenuBar getMenu () { // New menu bar JMenuBar menuBar = new JMenuBar (); JMenu fileMenuBar = new JMenu ("File"); fileMenuBar.setMnemonic('F'); JMenu editMenuBar = new JMenu ("Edit"); editMenuBar.setMnemonic('E'); JMenu helpMenuBar = new JMenu ("Help"); helpMenuBar.setMnemonic('H'); menuBar.add (fileMenuBar); menuBar.add (editMenuBar); menuBar.add (helpMenuBar); // Create menu items menuSave = new JMenuItem ("Save", 'S'); fileMenuBar.add (menuSave); menuQuit = new JMenuItem ("Quit", 'Q'); fileMenuBar.add (menuQuit); menuCut = new JMenuItem ("Cut", 'T'); editMenuBar.add (menuCut); menuCopy = new JMenuItem ("Copy", 'Q'); editMenuBar.add (menuCopy); menuPaste = new JMenuItem ("Paste", 'p'); editMenuBar.add (menuPaste); menuUsage = new JMenuItem ("Usage", 'U'); helpMenuBar.add (menuUsage); menuAbout = new JMenuItem ("About", 'A'); helpMenuBar.add (menuAbout); return menuBar; }
JMenuBar function () { JMenuBar menuBar = new JMenuBar (); JMenu fileMenuBar = new JMenu ("File"); fileMenuBar.setMnemonic('F'); JMenu editMenuBar = new JMenu ("Edit"); editMenuBar.setMnemonic('E'); JMenu helpMenuBar = new JMenu ("Help"); helpMenuBar.setMnemonic('H'); menuBar.add (fileMenuBar); menuBar.add (editMenuBar); menuBar.add (helpMenuBar); menuSave = new JMenuItem ("Save", 'S'); fileMenuBar.add (menuSave); menuQuit = new JMenuItem ("Quit", 'Q'); fileMenuBar.add (menuQuit); menuCut = new JMenuItem ("Cut", 'T'); editMenuBar.add (menuCut); menuCopy = new JMenuItem ("Copy", 'Q'); editMenuBar.add (menuCopy); menuPaste = new JMenuItem ("Paste", 'p'); editMenuBar.add (menuPaste); menuUsage = new JMenuItem ("Usage", 'U'); helpMenuBar.add (menuUsage); menuAbout = new JMenuItem ("About", 'A'); helpMenuBar.add (menuAbout); return menuBar; }
/** * Return menu bar. * * @return */
Return menu bar
getMenu
{ "repo_name": "lsilvestre/Jogre", "path": "util/src/org/jogre/properties/JogrePropertiesEditor.java", "license": "gpl-2.0", "size": 10185 }
[ "java.io.File", "javax.swing.JMenu", "javax.swing.JMenuBar", "javax.swing.JMenuItem" ]
import java.io.File; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem;
import java.io.*; import javax.swing.*;
[ "java.io", "javax.swing" ]
java.io; javax.swing;
2,284,723
public void setSubTreeNodeInRAMap(Map<String, Node> subTreeNodeInRAMap) { this.subTreeNodeInRAMap = subTreeNodeInRAMap; }
void function(Map<String, Node> subTreeNodeInRAMap) { this.subTreeNodeInRAMap = subTreeNodeInRAMap; }
/** * Sets the sub tree node in ra map. * * @param subTreeNodeInRAMap * the sub tree node in ra map */
Sets the sub tree node in ra map
setSubTreeNodeInRAMap
{ "repo_name": "MeasureAuthoringTool/MeasureAuthoringTool_LatestSprint", "path": "mat/src/main/java/mat/server/hqmf/qdm_5_4/HQMFClauseLogicGenerator.java", "license": "cc0-1.0", "size": 134287 }
[ "java.util.Map", "org.w3c.dom.Node" ]
import java.util.Map; import org.w3c.dom.Node;
import java.util.*; import org.w3c.dom.*;
[ "java.util", "org.w3c.dom" ]
java.util; org.w3c.dom;
1,109,509
List<Split> getSplits();
List<Split> getSplits();
/** * Returns all splits of the dataset. * <p> * For feeding the whole dataset into a batch job. * </p> * @return A list of {@link Split}s. */
Returns all splits of the dataset. For feeding the whole dataset into a batch job.
getSplits
{ "repo_name": "chtyim/cdap", "path": "cdap-api/src/main/java/co/cask/cdap/api/data/batch/BatchReadable.java", "license": "apache-2.0", "size": 1565 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,689,649
public List<T> initGetNullPermutations() { return getNullPermutations(PERM_LIMIT); }
List<T> function() { return getNullPermutations(PERM_LIMIT); }
/** * Use this method to pre-populate the object with default values and * nullify all the primitive * * @return a list of all possible combinations resulting from complex object * is set to null at any level */
Use this method to pre-populate the object with default values and nullify all the primitive
initGetNullPermutations
{ "repo_name": "mrfawy/Java-Null-pointer-checker", "path": "src/main/java/com/mrfawy/npc/populator/ComplexNullifyPopulator.java", "license": "mit", "size": 3473 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
623,622
public String getCurrentIp() throws UnknownHostException { try { Enumeration<NetworkInterface> networkInterfaces = NetworkInterface .getNetworkInterfaces(); while (networkInterfaces.hasMoreElements()) { NetworkInterface ni = networkInterfaces.nextElement(); Enumeration<InetAddress> nias = ni.getInetAddresses(); while(nias.hasMoreElements()) { InetAddress ia= nias.nextElement(); if (!ia.isLinkLocalAddress() && !ia.isLoopbackAddress() && ia instanceof Inet4Address) { return ia.getHostAddress(); } } } } catch (SocketException e) { System.out.println("unable to get current IP "); } return null; }
String function() throws UnknownHostException { try { Enumeration<NetworkInterface> networkInterfaces = NetworkInterface .getNetworkInterfaces(); while (networkInterfaces.hasMoreElements()) { NetworkInterface ni = networkInterfaces.nextElement(); Enumeration<InetAddress> nias = ni.getInetAddresses(); while(nias.hasMoreElements()) { InetAddress ia= nias.nextElement(); if (!ia.isLinkLocalAddress() && !ia.isLoopbackAddress() && ia instanceof Inet4Address) { return ia.getHostAddress(); } } } } catch (SocketException e) { System.out.println(STR); } return null; }
/** * Gets the current IP address of the host * @return - the IP as a string * @throws UnknownHostException */
Gets the current IP address of the host
getCurrentIp
{ "repo_name": "acf5118/BLELocationApp", "path": "app/src/main/java/server/Server.java", "license": "gpl-3.0", "size": 4798 }
[ "java.net.Inet4Address", "java.net.InetAddress", "java.net.NetworkInterface", "java.net.SocketException", "java.net.UnknownHostException", "java.util.Enumeration" ]
import java.net.Inet4Address; import java.net.InetAddress; import java.net.NetworkInterface; import java.net.SocketException; import java.net.UnknownHostException; import java.util.Enumeration;
import java.net.*; import java.util.*;
[ "java.net", "java.util" ]
java.net; java.util;
847,458
public Builder checkStartsWith(boolean checkStartsWith) { this.checkStartsWith = checkStartsWith; return this; } /** * Handshake timeout in mills, when handshake timeout, will trigger user * event {@link ClientHandshakeStateEvent#HANDSHAKE_TIMEOUT}
Builder function(boolean checkStartsWith) { this.checkStartsWith = checkStartsWith; return this; } /** * Handshake timeout in mills, when handshake timeout, will trigger user * event {@link ClientHandshakeStateEvent#HANDSHAKE_TIMEOUT}
/** * {@code true} to handle all requests, where URI path component starts from * {@link WebSocketServerProtocolConfig#websocketPath()}, {@code false} for exact match (default). */
true to handle all requests, where URI path component starts from <code>WebSocketServerProtocolConfig#websocketPath()</code>, false for exact match (default)
checkStartsWith
{ "repo_name": "gerdriesselmann/netty", "path": "codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerProtocolConfig.java", "license": "apache-2.0", "size": 9845 }
[ "io.netty.handler.codec.http.websocketx.WebSocketClientProtocolHandler" ]
import io.netty.handler.codec.http.websocketx.WebSocketClientProtocolHandler;
import io.netty.handler.codec.http.websocketx.*;
[ "io.netty.handler" ]
io.netty.handler;
2,163,459
@Apply(MapCommands.PutIfAbsent.class) protected Object putIfAbsent(Commit<MapCommands.PutIfAbsent> commit) { updateTime(commit); Commit<? extends MapCommands.TtlCommand> command = map.putIfAbsent(commit.operation().key(), commit); return isActive(command) ? command.operation().value : null; }
@Apply(MapCommands.PutIfAbsent.class) Object function(Commit<MapCommands.PutIfAbsent> commit) { updateTime(commit); Commit<? extends MapCommands.TtlCommand> command = map.putIfAbsent(commit.operation().key(), commit); return isActive(command) ? command.operation().value : null; }
/** * Handles a put if absent commit. */
Handles a put if absent commit
putIfAbsent
{ "repo_name": "arnonmoscona/copycat", "path": "collections/src/main/java/net/kuujo/copycat/collections/state/MapState.java", "license": "apache-2.0", "size": 6517 }
[ "net.kuujo.copycat.raft.server.Apply", "net.kuujo.copycat.raft.server.Commit" ]
import net.kuujo.copycat.raft.server.Apply; import net.kuujo.copycat.raft.server.Commit;
import net.kuujo.copycat.raft.server.*;
[ "net.kuujo.copycat" ]
net.kuujo.copycat;
2,478,622
public boolean isValueValidForType(String value, SystemPropertyFieldType type);
boolean function(String value, SystemPropertyFieldType type);
/** * Determines if the given value is valid for the specified type * * @param sp * @return whether or not the SystemProperty is in a valid state */
Determines if the given value is valid for the specified type
isValueValidForType
{ "repo_name": "akdasari/SparkCommon", "path": "src/main/java/org/sparkcommerce/common/config/service/SystemPropertiesService.java", "license": "apache-2.0", "size": 2333 }
[ "org.sparkcommerce.common.config.service.type.SystemPropertyFieldType" ]
import org.sparkcommerce.common.config.service.type.SystemPropertyFieldType;
import org.sparkcommerce.common.config.service.type.*;
[ "org.sparkcommerce.common" ]
org.sparkcommerce.common;
2,348,569
public RunnerDetail updateRunner(Integer runnerId, String description, Boolean active, List<String> tagList, Boolean runUntagged, Boolean locked, RunnerDetail.RunnerAccessLevel accessLevel) throws GitLabApiException { if (runnerId == null) { throw new RuntimeException("runnerId cannot be null"); } GitLabApiForm formData = new GitLabApiForm() .withParam("description", description, false) .withParam("active", active, false) .withParam("tag_list", tagList, false) .withParam("run_untagged", runUntagged, false) .withParam("locked", locked, false) .withParam("access_level", accessLevel, false); Response response = put(Response.Status.OK, formData.asMap(), "runners", runnerId); return (response.readEntity(RunnerDetail.class)); }
RunnerDetail function(Integer runnerId, String description, Boolean active, List<String> tagList, Boolean runUntagged, Boolean locked, RunnerDetail.RunnerAccessLevel accessLevel) throws GitLabApiException { if (runnerId == null) { throw new RuntimeException(STR); } GitLabApiForm formData = new GitLabApiForm() .withParam(STR, description, false) .withParam(STR, active, false) .withParam(STR, tagList, false) .withParam(STR, runUntagged, false) .withParam(STR, locked, false) .withParam(STR, accessLevel, false); Response response = put(Response.Status.OK, formData.asMap(), STR, runnerId); return (response.readEntity(RunnerDetail.class)); }
/** * Update details of a runner. * * <pre><code>GitLab Endpoint: PUT /runners/:id</code></pre> * * @param runnerId The ID of a runner * @param description The description of a runner * @param active The state of a runner; can be set to true or false * @param tagList The list of tags for a runner; put array of tags, that should be finally assigned to a runner * @param runUntagged Flag indicating the runner can execute untagged jobs * @param locked Flag indicating the runner is locked * @param accessLevel The access_level of the runner; not_protected or ref_protected * @return RunnerDetail instance. * @throws GitLabApiException if any exception occurs */
Update details of a runner. <code><code>GitLab Endpoint: PUT /runners/:id</code></code>
updateRunner
{ "repo_name": "gmessner/gitlab4j-api", "path": "src/main/java/org/gitlab4j/api/RunnersApi.java", "license": "mit", "size": 24346 }
[ "java.util.List", "javax.ws.rs.core.Response", "org.gitlab4j.api.models.RunnerDetail" ]
import java.util.List; import javax.ws.rs.core.Response; import org.gitlab4j.api.models.RunnerDetail;
import java.util.*; import javax.ws.rs.core.*; import org.gitlab4j.api.models.*;
[ "java.util", "javax.ws", "org.gitlab4j.api" ]
java.util; javax.ws; org.gitlab4j.api;
1,733,753
public void copy(File sourceFileOrDirectory, File targetParentDirectory, CopyPolicy policy, Comparator comparator, TaskMonitor monitor, OutputStreamListener listener) throws IOException, TaskCancelledException { if (sourceFileOrDirectory == null || targetParentDirectory == null) { throw new IllegalArgumentException("Source : " + sourceFileOrDirectory + ", Destination : " + targetParentDirectory); } if (monitor != null) { monitor.checkTaskState(); } if (FileSystemManager.isFile(sourceFileOrDirectory)) { if (policy == null || policy.accept(new File(targetParentDirectory, FileSystemManager.getName(sourceFileOrDirectory)))) { copyFile(sourceFileOrDirectory, targetParentDirectory, FileSystemManager.getName(sourceFileOrDirectory), monitor, listener); } } else { File td = new File(targetParentDirectory, FileSystemManager.getName(sourceFileOrDirectory)); this.createDir(td); this.copyDirectoryContent(sourceFileOrDirectory, td, policy, comparator, monitor, listener); } }
void function(File sourceFileOrDirectory, File targetParentDirectory, CopyPolicy policy, Comparator comparator, TaskMonitor monitor, OutputStreamListener listener) throws IOException, TaskCancelledException { if (sourceFileOrDirectory == null targetParentDirectory == null) { throw new IllegalArgumentException(STR + sourceFileOrDirectory + STR + targetParentDirectory); } if (monitor != null) { monitor.checkTaskState(); } if (FileSystemManager.isFile(sourceFileOrDirectory)) { if (policy == null policy.accept(new File(targetParentDirectory, FileSystemManager.getName(sourceFileOrDirectory)))) { copyFile(sourceFileOrDirectory, targetParentDirectory, FileSystemManager.getName(sourceFileOrDirectory), monitor, listener); } } else { File td = new File(targetParentDirectory, FileSystemManager.getName(sourceFileOrDirectory)); this.createDir(td); this.copyDirectoryContent(sourceFileOrDirectory, td, policy, comparator, monitor, listener); } }
/** * Copy the source file or directory in the parent destination. */
Copy the source file or directory in the parent destination
copy
{ "repo_name": "wintonBy/areca-backup-release-mirror", "path": "src/com/myJava/file/FileTool.java", "license": "gpl-2.0", "size": 16224 }
[ "java.io.File", "java.io.IOException", "java.util.Comparator" ]
import java.io.File; import java.io.IOException; import java.util.Comparator;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
230,025
public static int findClosestDatapoint(double key, double mzValues[], double mzTolerance) { int index = Arrays.binarySearch(mzValues, key); if (index >= 0) return index; // Get "insertion point" index = (index * -1) - 1; // If key value is bigger than biggest m/z value in array if (index == mzValues.length) index--; else if (index > 0) { // Check insertion point value and previous one, see which one // is closer if (Math.abs(mzValues[index - 1] - key) < Math.abs(mzValues[index] - key)) index--; } // Check m/z tolerancee if (Math.abs(mzValues[index] - key) <= mzTolerance) return index; // Nothing was found return -1; }
static int function(double key, double mzValues[], double mzTolerance) { int index = Arrays.binarySearch(mzValues, key); if (index >= 0) return index; index = (index * -1) - 1; if (index == mzValues.length) index--; else if (index > 0) { if (Math.abs(mzValues[index - 1] - key) < Math.abs(mzValues[index] - key)) index--; } if (Math.abs(mzValues[index] - key) <= mzTolerance) return index; return -1; }
/** * Returns index of m/z value in a given array, which is closest to given value, limited by given * m/z tolerance. We assume the m/z array is sorted. * * @return index of best match, or -1 if no datapoint was found */
Returns index of m/z value in a given array, which is closest to given value, limited by given m/z tolerance. We assume the m/z array is sorted
findClosestDatapoint
{ "repo_name": "photocyte/mzmine2", "path": "src/main/java/net/sf/mzmine/util/ScanUtils.java", "license": "gpl-2.0", "size": 18087 }
[ "java.util.Arrays" ]
import java.util.Arrays;
import java.util.*;
[ "java.util" ]
java.util;
2,277,940
public static String encode(String s, String encoding) throws UnsupportedEncodingException { int length = s.length(); int start = 0; int i = 0; StringBuffer result = new StringBuffer(length); while (true) { while (i < length && isSafe(s.charAt(i))) i++; // Safe character can just be added result.append(s.substring(start, i)); // Are we done? if (i >= length) return result.toString(); else if (s.charAt(i) == ' ') { result.append('+'); // Replace space char with plus symbol. i++; } else { // Get all unsafe characters start = i; char c; while (i < length && (c = s.charAt(i)) != ' ' && ! isSafe(c)) i++; // Convert them to %XY encoded strings String unsafe = s.substring(start, i); byte[] bytes = unsafe.getBytes(encoding); for (int j = 0; j < bytes.length; j++) { result.append('%'); int val = bytes[j]; result.append(hex.charAt((val & 0xf0) >> 4)); result.append(hex.charAt(val & 0x0f)); } } start = i; } }
static String function(String s, String encoding) throws UnsupportedEncodingException { int length = s.length(); int start = 0; int i = 0; StringBuffer result = new StringBuffer(length); while (true) { while (i < length && isSafe(s.charAt(i))) i++; result.append(s.substring(start, i)); if (i >= length) return result.toString(); else if (s.charAt(i) == ' ') { result.append('+'); i++; } else { start = i; char c; while (i < length && (c = s.charAt(i)) != ' ' && ! isSafe(c)) i++; String unsafe = s.substring(start, i); byte[] bytes = unsafe.getBytes(encoding); for (int j = 0; j < bytes.length; j++) { result.append('%'); int val = bytes[j]; result.append(hex.charAt((val & 0xf0) >> 4)); result.append(hex.charAt(val & 0x0f)); } } start = i; } }
/** * This method translates the passed in string into x-www-form-urlencoded * format using the character encoding to hex-encode the unsafe characters. * * @param s The String to convert * @param encoding The encoding to use for unsafe characters * * @return The converted String * * @exception UnsupportedEncodingException If the named encoding is not * supported * * @since 1.4 */
This method translates the passed in string into x-www-form-urlencoded format using the character encoding to hex-encode the unsafe characters
encode
{ "repo_name": "aosm/gcc_40", "path": "libjava/java/net/URLEncoder.java", "license": "gpl-2.0", "size": 6032 }
[ "java.io.UnsupportedEncodingException" ]
import java.io.UnsupportedEncodingException;
import java.io.*;
[ "java.io" ]
java.io;
2,554,158
public static void prepareCapsQueriesEl(JID compJid, JID to, String[] caps_nodes, Queue<Element> results) { if (caps_nodes != null) { for (String caps_node : caps_nodes) { if (!nodeFeatures.containsKey(caps_node)) { results.offer(prepareCapsQueryEl(to, compJid, caps_node)); } } } }
static void function(JID compJid, JID to, String[] caps_nodes, Queue<Element> results) { if (caps_nodes != null) { for (String caps_node : caps_nodes) { if (!nodeFeatures.containsKey(caps_node)) { results.offer(prepareCapsQueryEl(to, compJid, caps_node)); } } } }
/** * Method description * * * @param compJid * @param to * @param caps_nodes * @param results */
Method description
prepareCapsQueriesEl
{ "repo_name": "f24-ag/tigase", "path": "src/main/java/tigase/xmpp/impl/PresenceCapabilitiesManager.java", "license": "agpl-3.0", "size": 9773 }
[ "java.util.Queue" ]
import java.util.Queue;
import java.util.*;
[ "java.util" ]
java.util;
1,064,402
protected void bindPropertyProvider(final PropertyProvider propertyProvider, final Map<String, Object> props) { logger.debug("bindPropertyProvider: Binding PropertyProvider {}", propertyProvider); synchronized (lock) { this.bindPropertyProviderInteral(propertyProvider, props); } }
void function(final PropertyProvider propertyProvider, final Map<String, Object> props) { logger.debug(STR, propertyProvider); synchronized (lock) { this.bindPropertyProviderInteral(propertyProvider, props); } }
/** * Bind a new property provider. */
Bind a new property provider
bindPropertyProvider
{ "repo_name": "tteofili/sling", "path": "bundles/extensions/discovery/oak/src/main/java/org/apache/sling/discovery/oak/OakDiscoveryService.java", "license": "apache-2.0", "size": 27781 }
[ "java.util.Map", "org.apache.sling.discovery.PropertyProvider" ]
import java.util.Map; import org.apache.sling.discovery.PropertyProvider;
import java.util.*; import org.apache.sling.discovery.*;
[ "java.util", "org.apache.sling" ]
java.util; org.apache.sling;
1,321,893
protected void emit_WhileStatement_LoopKeyword_5_q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) { acceptNodes(transition, nodes); }
void function(EObject semanticObject, ISynNavigable transition, List<INode> nodes) { acceptNodes(transition, nodes); }
/** * Ambiguous syntax: * 'loop'? * * This ambiguous syntax occurs at: * condition=Expression 'loop' 'end' (ambiguity) ';' (rule end) * condition=Expression 'loop' 'end' (ambiguity) ';' pragmas+=Pragma * condition=Expression 'loop' 'end' (ambiguity) (rule end) * statements+=Statement 'end' (ambiguity) ';' (rule end) * statements+=Statement 'end' (ambiguity) ';' pragmas+=Pragma * statements+=Statement 'end' (ambiguity) (rule end) */
Ambiguous syntax: 'loop'? This ambiguous syntax occurs at: condition=Expression 'loop' 'end' (ambiguity) ';' (rule end) condition=Expression 'loop' 'end' (ambiguity) ';' pragmas+=Pragma condition=Expression 'loop' 'end' (ambiguity) (rule end) statements+=Statement 'end' (ambiguity) ';' (rule end) statements+=Statement 'end' (ambiguity) ';' pragmas+=Pragma statements+=Statement 'end' (ambiguity) (rule end)
emit_WhileStatement_LoopKeyword_5_q
{ "repo_name": "TypeFox/bridgepoint", "path": "src/org.xtuml.bp.xtext.masl.parent/org.xtuml.bp.xtext.masl/src-gen/org/xtuml/bp/xtext/masl/serializer/MASLSyntacticSequencer.java", "license": "apache-2.0", "size": 52664 }
[ "java.util.List", "org.eclipse.emf.ecore.EObject", "org.eclipse.xtext.nodemodel.INode", "org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider" ]
import java.util.List; import org.eclipse.emf.ecore.EObject; import org.eclipse.xtext.nodemodel.INode; import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider;
import java.util.*; import org.eclipse.emf.ecore.*; import org.eclipse.xtext.nodemodel.*; import org.eclipse.xtext.serializer.analysis.*;
[ "java.util", "org.eclipse.emf", "org.eclipse.xtext" ]
java.util; org.eclipse.emf; org.eclipse.xtext;
2,302,869
public boolean canDelete(Object ho) { if (model.getState() == DISCARDED) throw new IllegalStateException( "This method cannot be invoked in the DISCARDED state."); long id = DataBrowserAgent.getUserDetails().getId(); if (EditorUtil.isUserOwner(ho, id)) return true; //user it the owner. if (!(ho instanceof DataObject)) return false; DataObject data = (DataObject) ho; return data.canDelete(); }
boolean function(Object ho) { if (model.getState() == DISCARDED) throw new IllegalStateException( STR); long id = DataBrowserAgent.getUserDetails().getId(); if (EditorUtil.isUserOwner(ho, id)) return true; if (!(ho instanceof DataObject)) return false; DataObject data = (DataObject) ho; return data.canDelete(); }
/** * Implemented as specified by the {@link DataBrowser} interface. * @see DataBrowser#canDelete(Object) */
Implemented as specified by the <code>DataBrowser</code> interface
canDelete
{ "repo_name": "stelfrich/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/agents/dataBrowser/view/DataBrowserComponent.java", "license": "gpl-2.0", "size": 57454 }
[ "org.openmicroscopy.shoola.agents.dataBrowser.DataBrowserAgent", "org.openmicroscopy.shoola.agents.util.EditorUtil" ]
import org.openmicroscopy.shoola.agents.dataBrowser.DataBrowserAgent; import org.openmicroscopy.shoola.agents.util.EditorUtil;
import org.openmicroscopy.shoola.agents.*; import org.openmicroscopy.shoola.agents.util.*;
[ "org.openmicroscopy.shoola" ]
org.openmicroscopy.shoola;
2,120,276
public static Date getNextWeekDate(Date date, int dayOfTheWeek) { Calendar c = Calendar.getInstance(); c.setTime(date); c.setFirstDayOfWeek(dayOfTheWeek); c.set(Calendar.DAY_OF_WEEK, dayOfTheWeek); c.add(Calendar.DATE, 7); return c.getTime(); }
static Date function(Date date, int dayOfTheWeek) { Calendar c = Calendar.getInstance(); c.setTime(date); c.setFirstDayOfWeek(dayOfTheWeek); c.set(Calendar.DAY_OF_WEEK, dayOfTheWeek); c.add(Calendar.DATE, 7); return c.getTime(); }
/** * Get Next week date * @param date Date Object * @param dayOfTheWeek Day Of the week * @return Date */
Get Next week date
getNextWeekDate
{ "repo_name": "thunder413/DateTimeUtils", "path": "DateTimeUtils/src/main/java/com/github/thunder413/datetimeutils/DateTimeUtils.java", "license": "mit", "size": 22350 }
[ "java.util.Calendar", "java.util.Date" ]
import java.util.Calendar; import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
1,195,254
public Location toLocation(World world, float yaw, float pitch) { return new Location(world, x, y, z, yaw, pitch); }
Location function(World world, float yaw, float pitch) { return new Location(world, x, y, z, yaw, pitch); }
/** * Gets a Location version of this vector. * * @param world The world to link the location to. * @param yaw The desired yaw. * @param pitch The desired pitch. * @return the location */
Gets a Location version of this vector
toLocation
{ "repo_name": "MasterMarkHarmon/Spigot", "path": "src/main/java/org/bukkit/util/Vector.java", "license": "gpl-3.0", "size": 16205 }
[ "org.bukkit.Location", "org.bukkit.World" ]
import org.bukkit.Location; import org.bukkit.World;
import org.bukkit.*;
[ "org.bukkit" ]
org.bukkit;
1,532,737
public static CellID fromPerAligned(byte[] encodedBytes) { CellID result = new CellID(); result.decodePerAligned(new BitStreamReader(encodedBytes)); return result; }
static CellID function(byte[] encodedBytes) { CellID result = new CellID(); result.decodePerAligned(new BitStreamReader(encodedBytes)); return result; }
/** * Creates a new CellID from encoded stream. */
Creates a new CellID from encoded stream
fromPerAligned
{ "repo_name": "google/supl-client", "path": "src/main/java/com/google/location/suplclient/asn1/supl2/rrlp_components/CellID.java", "license": "apache-2.0", "size": 2863 }
[ "com.google.location.suplclient.asn1.base.BitStreamReader" ]
import com.google.location.suplclient.asn1.base.BitStreamReader;
import com.google.location.suplclient.asn1.base.*;
[ "com.google.location" ]
com.google.location;
1,549,995
@Override public boolean onDefaultPaste(SignalEvent event, String text) { SelectionModel selection = this.getScheme().getInputController().getSelection(); int column = selection.getCursorColumn(); getScheme().getInputController().getEditorDocumentMutator() .insertText(selection.getCursorLine(), selection.getCursorLineNumber(), column, text); return true; } };
boolean function(SignalEvent event, String text) { SelectionModel selection = this.getScheme().getInputController().getSelection(); int column = selection.getCursorColumn(); getScheme().getInputController().getEditorDocumentMutator() .insertText(selection.getCursorLine(), selection.getCursorLineNumber(), column, text); return true; } };
/** * Insert more than one character directly into the document */
Insert more than one character directly into the document
onDefaultPaste
{ "repo_name": "WeTheInternet/collide", "path": "client/src/main/java/com/google/collide/client/editor/input/DefaultScheme.java", "license": "apache-2.0", "size": 18149 }
[ "com.google.collide.client.editor.selection.SelectionModel", "org.waveprotocol.wave.client.common.util.SignalEvent" ]
import com.google.collide.client.editor.selection.SelectionModel; import org.waveprotocol.wave.client.common.util.SignalEvent;
import com.google.collide.client.editor.selection.*; import org.waveprotocol.wave.client.common.util.*;
[ "com.google.collide", "org.waveprotocol.wave" ]
com.google.collide; org.waveprotocol.wave;
431,253
@Idempotent public BatchedEntries<CacheDirectiveEntry> listCacheDirectives( long prevId, CacheDirectiveInfo filter) throws IOException;
BatchedEntries<CacheDirectiveEntry> function( long prevId, CacheDirectiveInfo filter) throws IOException;
/** * List the set of cached paths of a cache pool. Incrementally fetches results * from the server. * * @param prevId The last listed entry ID, or -1 if this is the first call to * listCacheDirectives. * @param filter Parameters to use to filter the list results, * or null to display all directives visible to us. * @return A batch of CacheDirectiveEntry objects. */
List the set of cached paths of a cache pool. Incrementally fetches results from the server
listCacheDirectives
{ "repo_name": "bysslord/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java", "license": "apache-2.0", "size": 58964 }
[ "java.io.IOException", "org.apache.hadoop.fs.BatchedRemoteIterator" ]
import java.io.IOException; import org.apache.hadoop.fs.BatchedRemoteIterator;
import java.io.*; import org.apache.hadoop.fs.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
2,063,251
Optional<MemoryLocation> getRepresentedLocation();
Optional<MemoryLocation> getRepresentedLocation();
/** * Returns the memory location this symbolic value represents. */
Returns the memory location this symbolic value represents
getRepresentedLocation
{ "repo_name": "nishanttotla/predator", "path": "cpachecker/src/org/sosy_lab/cpachecker/cpa/value/symbolic/type/SymbolicValue.java", "license": "gpl-3.0", "size": 1565 }
[ "com.google.common.base.Optional", "org.sosy_lab.cpachecker.util.states.MemoryLocation" ]
import com.google.common.base.Optional; import org.sosy_lab.cpachecker.util.states.MemoryLocation;
import com.google.common.base.*; import org.sosy_lab.cpachecker.util.states.*;
[ "com.google.common", "org.sosy_lab.cpachecker" ]
com.google.common; org.sosy_lab.cpachecker;
1,272,371
synchronized (this.cache) { List<String> children = ZKUtil.listChildrenNoWatch(this.watcher, this.watcher.tableZNode); if (children == null) return; for (String child : children) { ZooKeeperProtos.Table.State state = ZKTableReadOnly.getTableState( this.watcher, child); if (state != null) this.cache.put(child, state); } } }
synchronized (this.cache) { List<String> children = ZKUtil.listChildrenNoWatch(this.watcher, this.watcher.tableZNode); if (children == null) return; for (String child : children) { ZooKeeperProtos.Table.State state = ZKTableReadOnly.getTableState( this.watcher, child); if (state != null) this.cache.put(child, state); } } }
/** * Gets a list of all the tables set as disabled in zookeeper. * * @throws org.apache.zookeeper.KeeperException */
Gets a list of all the tables set as disabled in zookeeper
populateTableStates
{ "repo_name": "alibaba/wasp", "path": "src/main/java/com/alibaba/wasp/zookeeper/ZKTable.java", "license": "apache-2.0", "size": 13550 }
[ "com.alibaba.wasp.protobuf.generated.ZooKeeperProtos", "java.util.List" ]
import com.alibaba.wasp.protobuf.generated.ZooKeeperProtos; import java.util.List;
import com.alibaba.wasp.protobuf.generated.*; import java.util.*;
[ "com.alibaba.wasp", "java.util" ]
com.alibaba.wasp; java.util;
1,515,293
EReference getDocumentRoot_LiteralValue();
EReference getDocumentRoot_LiteralValue();
/** * Returns the meta object for the containment reference '{@link net.opengis.wps20.DocumentRoot#getLiteralValue <em>Literal Value</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference '<em>Literal Value</em>'. * @see net.opengis.wps20.DocumentRoot#getLiteralValue() * @see #getDocumentRoot() * @generated */
Returns the meta object for the containment reference '<code>net.opengis.wps20.DocumentRoot#getLiteralValue Literal Value</code>'.
getDocumentRoot_LiteralValue
{ "repo_name": "geotools/geotools", "path": "modules/ogc/net.opengis.wps/src/net/opengis/wps20/Wps20Package.java", "license": "lgpl-2.1", "size": 228745 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
173,178
public TweetsResult getTweetsFromMentionsTimeline( TweetDao sinceTweet ) throws TwitterActionException { return getTweetsFromTimeline(sinceTweet, TimeLine.Mentions); }
TweetsResult function( TweetDao sinceTweet ) throws TwitterActionException { return getTweetsFromTimeline(sinceTweet, TimeLine.Mentions); }
/** * Method which get all tweets from mentions time line * * @param sinceTweet * last tweet since which we try get tweets * @return * @throws TwitterActionException */
Method which get all tweets from mentions time line
getTweetsFromMentionsTimeline
{ "repo_name": "voncuver/cwierkacz", "path": "src/main/java/com/pk/cwierkacz/twitter/TwitterAccount.java", "license": "agpl-3.0", "size": 20730 }
[ "com.pk.cwierkacz.model.dao.TweetDao" ]
import com.pk.cwierkacz.model.dao.TweetDao;
import com.pk.cwierkacz.model.dao.*;
[ "com.pk.cwierkacz" ]
com.pk.cwierkacz;
225,493
private void registerFluidModel(final IFluidBlock fluidBlock) { }
void function(final IFluidBlock fluidBlock) { }
/** * Register the block and item model for a {@link Fluid}. * * @param fluidBlock The Fluid's Block */
Register the block and item model for a <code>Fluid</code>
registerFluidModel
{ "repo_name": "halvors/Quantum", "path": "src/main/java/org/halvors/nuclearphysics/client/event/ModelEventHandler.java", "license": "gpl-3.0", "size": 1863 }
[ "net.minecraftforge.fluids.IFluidBlock" ]
import net.minecraftforge.fluids.IFluidBlock;
import net.minecraftforge.fluids.*;
[ "net.minecraftforge.fluids" ]
net.minecraftforge.fluids;
866,216
private void drawShadows(Canvas canvas) { int height = (int)(1.5 * getItemHeight()); topShadow.setBounds(0, 0, getWidth(), height); topShadow.draw(canvas); bottomShadow.setBounds(0, getHeight() - height, getWidth(), getHeight()); bottomShadow.draw(canvas); }
void function(Canvas canvas) { int height = (int)(1.5 * getItemHeight()); topShadow.setBounds(0, 0, getWidth(), height); topShadow.draw(canvas); bottomShadow.setBounds(0, getHeight() - height, getWidth(), getHeight()); bottomShadow.draw(canvas); }
/** * Draws shadows on top and bottom of control * @param canvas the canvas for drawing */
Draws shadows on top and bottom of control
drawShadows
{ "repo_name": "socoolby/CoolClock", "path": "app/src/main/java/clock/socoolby/com/clock/widget/WheelView.java", "license": "gpl-3.0", "size": 23193 }
[ "android.graphics.Canvas" ]
import android.graphics.Canvas;
import android.graphics.*;
[ "android.graphics" ]
android.graphics;
2,108,181