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 void testReadByteArrayIntInt() { for (int testIteration = 0; testIteration < TEST_ITERATIONS; ++testIteration) { TestInputData inData = new TestInputData(); byte[] destination = new byte[32 * 1024]; ByteArrayOutputStream siphonedCopy = new ByteArrayOutputStream(32 * 1024); WritableByteChannel siphoningChannel = Channels.newChannel(siphonedCopy); WriteChannelSiphoningInputStream siphon = new WriteChannelSiphoningInputStream(inData.getTestDataAsInputStream(), siphoningChannel); int byteCount = 0; byte[] temp = new byte[1024]; try { for (int bytesRead = siphon.read(temp, 32, 42); bytesRead != -1; bytesRead = siphon.read(temp, 32, 42)) { System.arraycopy(temp, 32, destination, byteCount, bytesRead); byteCount += bytesRead; } siphon.synchronousClose(1L, TimeUnit.SECONDS); } catch (IOException x) { x.printStackTrace(); fail(x.getMessage()); } catch (InterruptedException x) { x.printStackTrace(); fail(x.getMessage()); } assertContentsEquals(destination, siphonedCopy, byteCount); } }
void function() { for (int testIteration = 0; testIteration < TEST_ITERATIONS; ++testIteration) { TestInputData inData = new TestInputData(); byte[] destination = new byte[32 * 1024]; ByteArrayOutputStream siphonedCopy = new ByteArrayOutputStream(32 * 1024); WritableByteChannel siphoningChannel = Channels.newChannel(siphonedCopy); WriteChannelSiphoningInputStream siphon = new WriteChannelSiphoningInputStream(inData.getTestDataAsInputStream(), siphoningChannel); int byteCount = 0; byte[] temp = new byte[1024]; try { for (int bytesRead = siphon.read(temp, 32, 42); bytesRead != -1; bytesRead = siphon.read(temp, 32, 42)) { System.arraycopy(temp, 32, destination, byteCount, bytesRead); byteCount += bytesRead; } siphon.synchronousClose(1L, TimeUnit.SECONDS); } catch (IOException x) { x.printStackTrace(); fail(x.getMessage()); } catch (InterruptedException x) { x.printStackTrace(); fail(x.getMessage()); } assertContentsEquals(destination, siphonedCopy, byteCount); } }
/** * Test method for * {@link gov.va.med.imaging.channels.WriteChannelSiphoningInputStream#read(byte[], int, int)}. */
Test method for <code>gov.va.med.imaging.channels.WriteChannelSiphoningInputStream#read(byte[], int, int)</code>
testReadByteArrayIntInt
{ "repo_name": "VHAINNOVATIONS/Telepathology", "path": "Source/Java/ImagingCommon/main/test/java/gov/va/med/imaging/channels/WriteChannelSiphoningInputStreamTest.java", "license": "apache-2.0", "size": 7236 }
[ "java.io.ByteArrayOutputStream", "java.io.IOException", "java.nio.channels.Channels", "java.nio.channels.WritableByteChannel", "java.util.concurrent.TimeUnit" ]
import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.channels.Channels; import java.nio.channels.WritableByteChannel; import java.util.concurrent.TimeUnit;
import java.io.*; import java.nio.channels.*; import java.util.concurrent.*;
[ "java.io", "java.nio", "java.util" ]
java.io; java.nio; java.util;
1,643,453
public long uploadTsvFileToTable(String tableId, File file) throws BridgeSynapseException, IOException, SynapseException { // Upload TSV as a file handle. FileHandle tableFileHandle = createFileHandleWithRetry(file); String fileHandleId = tableFileHandle.getId(); // start tsv import CsvTableDescriptor tableDesc = new CsvTableDescriptor(); tableDesc.setIsFirstLineHeader(true); tableDesc.setSeparator("\t"); String jobToken = uploadTsvStartWithRetry(tableId, fileHandleId, tableDesc); // poll asyncGet until success or timeout boolean success = false; Long linesProcessed = null; for (int loops = 0; loops < asyncTimeoutLoops; loops++) { if (asyncIntervalMillis > 0) { try { Thread.sleep(asyncIntervalMillis); } catch (InterruptedException ex) { // noop } } // poll UploadToTableResult uploadResult = getUploadTsvStatus(jobToken, tableId); if (uploadResult != null) { linesProcessed = uploadResult.getRowsProcessed(); success = true; break; } // Result not ready. Loop around again. } if (!success) { throw new BridgeSynapseException("Timed out uploading file handle " + fileHandleId); } if (linesProcessed == null) { // Not sure if Synapse will ever do this, but code defensively, just in case. throw new BridgeSynapseException("Null rows processed"); } return linesProcessed; }
long function(String tableId, File file) throws BridgeSynapseException, IOException, SynapseException { FileHandle tableFileHandle = createFileHandleWithRetry(file); String fileHandleId = tableFileHandle.getId(); CsvTableDescriptor tableDesc = new CsvTableDescriptor(); tableDesc.setIsFirstLineHeader(true); tableDesc.setSeparator("\t"); String jobToken = uploadTsvStartWithRetry(tableId, fileHandleId, tableDesc); boolean success = false; Long linesProcessed = null; for (int loops = 0; loops < asyncTimeoutLoops; loops++) { if (asyncIntervalMillis > 0) { try { Thread.sleep(asyncIntervalMillis); } catch (InterruptedException ex) { } } UploadToTableResult uploadResult = getUploadTsvStatus(jobToken, tableId); if (uploadResult != null) { linesProcessed = uploadResult.getRowsProcessed(); success = true; break; } } if (!success) { throw new BridgeSynapseException(STR + fileHandleId); } if (linesProcessed == null) { throw new BridgeSynapseException(STR); } return linesProcessed; }
/** * Takes a TSV file from disk and uploads and applies its rows to a Synapse table. * * @param tableId * Synapse table ID to upload the TSV to * @param file * TSV file to apply to the table * @return number of rows processed * @throws BridgeSynapseException * if there's a general error calling Synapse * @throws IOException * if there's an error uploading the file handle * @throws SynapseException * if there's an error calling Synapse */
Takes a TSV file from disk and uploads and applies its rows to a Synapse table
uploadTsvFileToTable
{ "repo_name": "Sage-Bionetworks/bridge-base", "path": "src/main/java/org/sagebionetworks/bridge/synapse/SynapseHelper.java", "license": "apache-2.0", "size": 45617 }
[ "java.io.File", "java.io.IOException", "org.sagebionetworks.bridge.exceptions.BridgeSynapseException", "org.sagebionetworks.client.exceptions.SynapseException", "org.sagebionetworks.repo.model.file.FileHandle", "org.sagebionetworks.repo.model.table.CsvTableDescriptor", "org.sagebionetworks.repo.model.table.UploadToTableResult" ]
import java.io.File; import java.io.IOException; import org.sagebionetworks.bridge.exceptions.BridgeSynapseException; import org.sagebionetworks.client.exceptions.SynapseException; import org.sagebionetworks.repo.model.file.FileHandle; import org.sagebionetworks.repo.model.table.CsvTableDescriptor; import org.sagebionetworks.repo.model.table.UploadToTableResult;
import java.io.*; import org.sagebionetworks.bridge.exceptions.*; import org.sagebionetworks.client.exceptions.*; import org.sagebionetworks.repo.model.file.*; import org.sagebionetworks.repo.model.table.*;
[ "java.io", "org.sagebionetworks.bridge", "org.sagebionetworks.client", "org.sagebionetworks.repo" ]
java.io; org.sagebionetworks.bridge; org.sagebionetworks.client; org.sagebionetworks.repo;
223,564
public Future<Channel> renegotiate(final Promise<Channel> promise) { if (promise == null) { throw new NullPointerException("promise"); } ChannelHandlerContext ctx = this.ctx; if (ctx == null) { throw new IllegalStateException(); }
Future<Channel> function(final Promise<Channel> promise) { if (promise == null) { throw new NullPointerException(STR); } ChannelHandlerContext ctx = this.ctx; if (ctx == null) { throw new IllegalStateException(); }
/** * Performs TLS renegotiation. */
Performs TLS renegotiation
renegotiate
{ "repo_name": "balaprasanna/netty", "path": "handler/src/main/java/io/netty/handler/ssl/SslHandler.java", "license": "apache-2.0", "size": 56172 }
[ "io.netty.channel.Channel", "io.netty.channel.ChannelHandlerContext", "io.netty.util.concurrent.Future", "io.netty.util.concurrent.Promise" ]
import io.netty.channel.Channel; import io.netty.channel.ChannelHandlerContext; import io.netty.util.concurrent.Future; import io.netty.util.concurrent.Promise;
import io.netty.channel.*; import io.netty.util.concurrent.*;
[ "io.netty.channel", "io.netty.util" ]
io.netty.channel; io.netty.util;
961,554
public double calculateFitness(Die theDie);
double function(Die theDie);
/** * Calculates the fitness of a given die. * * @param theDie the die to calculate the fitness off * @return the fitness */
Calculates the fitness of a given die
calculateFitness
{ "repo_name": "mrosseel/dice", "path": "src/main/java/be/miker/dice/fitness/DieFitness.java", "license": "gpl-2.0", "size": 599 }
[ "be.miker.dice.data.Die" ]
import be.miker.dice.data.Die;
import be.miker.dice.data.*;
[ "be.miker.dice" ]
be.miker.dice;
1,724,213
public void setSettings(final Settings settings) { this.settings = settings; }
void function(final Settings settings) { this.settings = settings; }
/** * Setter for the JNDI injected Settings bean. This allows us to also test * the code, by invoking these setters on the instantiated Object. * * @param settings Settings Bean */
Setter for the JNDI injected Settings bean. This allows us to also test the code, by invoking these setters on the instantiated Object
setSettings
{ "repo_name": "IWSDevelopers/iws", "path": "iws-ejb/src/main/java/net/iaeste/iws/ejb/SessionRequestBean.java", "license": "apache-2.0", "size": 14067 }
[ "net.iaeste.iws.common.configuration.Settings" ]
import net.iaeste.iws.common.configuration.Settings;
import net.iaeste.iws.common.configuration.*;
[ "net.iaeste.iws" ]
net.iaeste.iws;
494,273
@Nonnull public static String getFormatted (final long nValue, @Nonnull final Locale aDisplayLocale) { ValueEnforcer.notNull (aDisplayLocale, "DisplayLocale"); return NumberFormat.getIntegerInstance (aDisplayLocale).format (nValue); }
static String function (final long nValue, @Nonnull final Locale aDisplayLocale) { ValueEnforcer.notNull (aDisplayLocale, STR); return NumberFormat.getIntegerInstance (aDisplayLocale).format (nValue); }
/** * Format the passed value according to the rules specified by the given * locale. All calls to {@link Long#toString(long)} that are displayed to the * user should instead use this method. * * @param nValue * The value to be formatted. * @param aDisplayLocale * The locale to be used. May not be <code>null</code>. * @return The formatted string. */
Format the passed value according to the rules specified by the given locale. All calls to <code>Long#toString(long)</code> that are displayed to the user should instead use this method
getFormatted
{ "repo_name": "phax/ph-commons", "path": "ph-commons/src/main/java/com/helger/commons/locale/LocaleFormatter.java", "license": "apache-2.0", "size": 8255 }
[ "com.helger.commons.ValueEnforcer", "java.text.NumberFormat", "java.util.Locale", "javax.annotation.Nonnull" ]
import com.helger.commons.ValueEnforcer; import java.text.NumberFormat; import java.util.Locale; import javax.annotation.Nonnull;
import com.helger.commons.*; import java.text.*; import java.util.*; import javax.annotation.*;
[ "com.helger.commons", "java.text", "java.util", "javax.annotation" ]
com.helger.commons; java.text; java.util; javax.annotation;
789,924
public static String replaceVariables(final VariableResolver pResolver, final String pExpression, final String pOpen, final String pClose) throws ParseException { final char[] s = pExpression.toCharArray(); final char[] open = pOpen.toCharArray(); final char[] close = pClose.toCharArray(); final StringBuilder out = new StringBuilder(); StringBuilder sb = new StringBuilder(); char[] watch = open; int w = 0; for (int i = 0; i < s.length; i++) { char c = s[i]; if (c == watch[w]) { w++; if (watch.length == w) { // found the full token to watch for if (watch == open) { // found open out.append(sb); sb.setLength(0); // search for close watch = close; } else if (watch == close) { // found close final String variable = pResolver.get(sb.toString()); if (variable != null) { out.append(variable); } else { throw new ParseException("Unknown variable " + sb, i); } sb.setLength(0); // search for open watch = open; } w = 0; } } else { if (w > 0) { sb.append(watch, 0, w); } sb.append(c); w = 0; } } if (watch == close) { out.append(open); } out.append(sb); return out.toString(); }
static String function(final VariableResolver pResolver, final String pExpression, final String pOpen, final String pClose) throws ParseException { final char[] s = pExpression.toCharArray(); final char[] open = pOpen.toCharArray(); final char[] close = pClose.toCharArray(); final StringBuilder out = new StringBuilder(); StringBuilder sb = new StringBuilder(); char[] watch = open; int w = 0; for (int i = 0; i < s.length; i++) { char c = s[i]; if (c == watch[w]) { w++; if (watch.length == w) { if (watch == open) { out.append(sb); sb.setLength(0); watch = close; } else if (watch == close) { final String variable = pResolver.get(sb.toString()); if (variable != null) { out.append(variable); } else { throw new ParseException(STR + sb, i); } sb.setLength(0); watch = open; } w = 0; } } else { if (w > 0) { sb.append(watch, 0, w); } sb.append(c); w = 0; } } if (watch == close) { out.append(open); } out.append(sb); return out.toString(); }
/** * Substitute the variables in the given expression with the * values from the resolver * * @param pVariables * @param pExpression * @return */
Substitute the variables in the given expression with the values from the resolver
replaceVariables
{ "repo_name": "jkeillor/jdeb", "path": "src/main/java/org/vafer/jdeb/utils/Utils.java", "license": "apache-2.0", "size": 4279 }
[ "java.text.ParseException" ]
import java.text.ParseException;
import java.text.*;
[ "java.text" ]
java.text;
2,301,948
public TypeMirror getAdaptedType() { return adaptedType; }
TypeMirror function() { return adaptedType; }
/** * The type that is being adapted by this adapter. * * @return The type that is being adapted by this adapter. */
The type that is being adapted by this adapter
getAdaptedType
{ "repo_name": "uniqueid001/enunciate", "path": "jackson/src/main/java/com/webcohesion/enunciate/modules/jackson/model/adapters/AdapterType.java", "license": "apache-2.0", "size": 7871 }
[ "javax.lang.model.type.TypeMirror" ]
import javax.lang.model.type.TypeMirror;
import javax.lang.model.type.*;
[ "javax.lang" ]
javax.lang;
1,853,756
private CompletableFuture<TransactionData> loadFromStore(String key) { log.trace("Loading key from the store key = {}", key); return readFromStore(key) .thenApplyAsync(copyFromStore -> { Preconditions.checkState(null != copyFromStore, "Data from table store must not be null. key=%s", key); Preconditions.checkState(null != copyFromStore.dbObject, "Missing tracking object. key=%s", key); log.trace("Done Loading key from the store key = {}", copyFromStore.getKey()); if (null != copyFromStore.getValue()) { Preconditions.checkState(0 != copyFromStore.getVersion(), "Version is not initialized. key=%s", key); } return insertInBuffer(key, copyFromStore); }, executor); }
CompletableFuture<TransactionData> function(String key) { log.trace(STR, key); return readFromStore(key) .thenApplyAsync(copyFromStore -> { Preconditions.checkState(null != copyFromStore, STR, key); Preconditions.checkState(null != copyFromStore.dbObject, STR, key); log.trace(STR, copyFromStore.getKey()); if (null != copyFromStore.getValue()) { Preconditions.checkState(0 != copyFromStore.getVersion(), STR, key); } return insertInBuffer(key, copyFromStore); }, executor); }
/** * Loads value from store. */
Loads value from store
loadFromStore
{ "repo_name": "pravega/pravega", "path": "segmentstore/storage/src/main/java/io/pravega/segmentstore/storage/metadata/BaseMetadataStore.java", "license": "apache-2.0", "size": 43734 }
[ "com.google.common.base.Preconditions", "java.util.concurrent.CompletableFuture" ]
import com.google.common.base.Preconditions; import java.util.concurrent.CompletableFuture;
import com.google.common.base.*; import java.util.concurrent.*;
[ "com.google.common", "java.util" ]
com.google.common; java.util;
1,942,455
void setType(TypeType value);
void setType(TypeType value);
/** * Sets the value of the '{@link net.opengis.gml311.TimeTopologyPrimitivePropertyType#getType <em>Type</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Type</em>' attribute. * @see org.w3.xlink.TypeType * @see #isSetType() * @see #unsetType() * @see #getType() * @generated */
Sets the value of the '<code>net.opengis.gml311.TimeTopologyPrimitivePropertyType#getType Type</code>' attribute.
setType
{ "repo_name": "geotools/geotools", "path": "modules/ogc/net.opengis.wmts/src/net/opengis/gml311/TimeTopologyPrimitivePropertyType.java", "license": "lgpl-2.1", "size": 15375 }
[ "org.w3.xlink.TypeType" ]
import org.w3.xlink.TypeType;
import org.w3.xlink.*;
[ "org.w3.xlink" ]
org.w3.xlink;
696,183
public String getId() { if (failure != null) { return failure.getId(); } if (response instanceof IndexResponse) { return ((IndexResponse) response).getId(); } else if (response instanceof DeleteResponse) { return ((DeleteResponse) response).getId(); } else if (response instanceof UpdateResponse) { return ((UpdateResponse) response).getId(); } return null; }
String function() { if (failure != null) { return failure.getId(); } if (response instanceof IndexResponse) { return ((IndexResponse) response).getId(); } else if (response instanceof DeleteResponse) { return ((DeleteResponse) response).getId(); } else if (response instanceof UpdateResponse) { return ((UpdateResponse) response).getId(); } return null; }
/** * The id of the action. */
The id of the action
getId
{ "repo_name": "OnePaaS/elasticsearch", "path": "src/main/java/org/elasticsearch/action/bulk/BulkItemResponse.java", "license": "apache-2.0", "size": 8969 }
[ "org.elasticsearch.action.delete.DeleteResponse", "org.elasticsearch.action.index.IndexResponse", "org.elasticsearch.action.update.UpdateResponse" ]
import org.elasticsearch.action.delete.DeleteResponse; import org.elasticsearch.action.index.IndexResponse; import org.elasticsearch.action.update.UpdateResponse;
import org.elasticsearch.action.delete.*; import org.elasticsearch.action.index.*; import org.elasticsearch.action.update.*;
[ "org.elasticsearch.action" ]
org.elasticsearch.action;
2,484,634
public Object value( InternalContextAdapter context) throws MethodInvocationException { Object left = jjtGetChild(0).value( context ); Object right = jjtGetChild(1).value( context ); if (left == null || right == null) { Logger.error(this,(left == null ? "Left" : "Right") + " side of range operator [n..m] has null value." + " Operation not possible. " + VelocityException.formatFileString(this)); return null; } if ( !( left instanceof Number ) || !( right instanceof Number )) { Logger.error(this,(!(left instanceof Number) ? "Left" : "Right") + " side of range operator is not a valid type. " + "Currently only integers (1,2,3...) and the Number type are supported. " + VelocityException.formatFileString(this)); return null; } int l = ((Number) left).intValue() ; int r = ((Number) right).intValue(); int nbrElements = Math.abs( l - r ); nbrElements += 1; int delta = ( l >= r ) ? -1 : 1; List elements = new ArrayList(nbrElements); int value = l; for (int i = 0; i < nbrElements; i++) { // TODO: JDK 1.4+ -> valueOf() elements.add(new Integer(value)); value += delta; } return elements; }
Object function( InternalContextAdapter context) throws MethodInvocationException { Object left = jjtGetChild(0).value( context ); Object right = jjtGetChild(1).value( context ); if (left == null right == null) { Logger.error(this,(left == null ? "Left" : "Right") + STR + STR + VelocityException.formatFileString(this)); return null; } if ( !( left instanceof Number ) !( right instanceof Number )) { Logger.error(this,(!(left instanceof Number) ? "Left" : "Right") + STR + STR + VelocityException.formatFileString(this)); return null; } int l = ((Number) left).intValue() ; int r = ((Number) right).intValue(); int nbrElements = Math.abs( l - r ); nbrElements += 1; int delta = ( l >= r ) ? -1 : 1; List elements = new ArrayList(nbrElements); int value = l; for (int i = 0; i < nbrElements; i++) { elements.add(new Integer(value)); value += delta; } return elements; }
/** * does the real work. Creates an Vector of Integers with the * right value range * * @param context app context used if Left or Right of .. is a ref * @return Object array of Integers * @throws MethodInvocationException */
does the real work. Creates an Vector of Integers with the right value range
value
{ "repo_name": "jtesser/core-2.x", "path": "src/org/apache/velocity/runtime/parser/node/ASTIntegerRange.java", "license": "gpl-3.0", "size": 4297 }
[ "com.dotmarketing.util.Logger", "java.util.ArrayList", "java.util.List", "org.apache.velocity.context.InternalContextAdapter", "org.apache.velocity.exception.MethodInvocationException", "org.apache.velocity.exception.VelocityException" ]
import com.dotmarketing.util.Logger; import java.util.ArrayList; import java.util.List; import org.apache.velocity.context.InternalContextAdapter; import org.apache.velocity.exception.MethodInvocationException; import org.apache.velocity.exception.VelocityException;
import com.dotmarketing.util.*; import java.util.*; import org.apache.velocity.context.*; import org.apache.velocity.exception.*;
[ "com.dotmarketing.util", "java.util", "org.apache.velocity" ]
com.dotmarketing.util; java.util; org.apache.velocity;
199,057
public void disconnect() { try { datain.close(); } catch (IOException e) { logger.error("can't close datain", e); } try { dataout.close(); } catch (IOException e) { logger.error("can't close dataout", e); } }
void function() { try { datain.close(); } catch (IOException e) { logger.error(STR, e); } try { dataout.close(); } catch (IOException e) { logger.error(STR, e); } }
/** * disconnect from heatpump */
disconnect from heatpump
disconnect
{ "repo_name": "jowiho/openhab", "path": "bundles/binding/org.openhab.binding.novelanheatpump/src/main/java/org/openhab/binding/novelanheatpump/internal/HeatpumpConnector.java", "license": "epl-1.0", "size": 4695 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
596,317
currentObject = 0; stack = new Stack<String>(); stack.push("subject"); query = ""; foundNamedClasses = new ArrayList<String>(); } public SparqlQueryDescriptionConvertVisitor() { stack.push("subject"); }
currentObject = 0; stack = new Stack<String>(); stack.push(STR); query = ""; foundNamedClasses = new ArrayList<String>(); } public SparqlQueryDescriptionConvertVisitor() { stack.push(STR); }
/** * resets internal variables */
resets internal variables
reset
{ "repo_name": "daftano/dl-learner", "path": "components-core/src/main/java/org/dllearner/kb/sparql/SparqlQueryDescriptionConvertVisitor.java", "license": "gpl-3.0", "size": 26245 }
[ "java.util.ArrayList", "java.util.Stack" ]
import java.util.ArrayList; import java.util.Stack;
import java.util.*;
[ "java.util" ]
java.util;
1,086,944
private void sendBroadcastNewDownload(DownloadFileOperation download, String linkedToRemotePath) { Intent added = new Intent(getDownloadAddedMessage()); added.putExtra(ACCOUNT_NAME, download.getAccount().name); added.putExtra(EXTRA_REMOTE_PATH, download.getRemotePath()); added.putExtra(EXTRA_FILE_PATH, download.getSavePath()); added.putExtra(EXTRA_LINKED_TO_PATH, linkedToRemotePath); added.setPackage(getPackageName()); sendStickyBroadcast(added); }
void function(DownloadFileOperation download, String linkedToRemotePath) { Intent added = new Intent(getDownloadAddedMessage()); added.putExtra(ACCOUNT_NAME, download.getAccount().name); added.putExtra(EXTRA_REMOTE_PATH, download.getRemotePath()); added.putExtra(EXTRA_FILE_PATH, download.getSavePath()); added.putExtra(EXTRA_LINKED_TO_PATH, linkedToRemotePath); added.setPackage(getPackageName()); sendStickyBroadcast(added); }
/** * Sends a broadcast when a new download is added to the queue. * * @param download Added download operation * @param linkedToRemotePath Path in the downloads tree where the download was linked to */
Sends a broadcast when a new download is added to the queue
sendBroadcastNewDownload
{ "repo_name": "Flole998/android", "path": "src/main/java/com/owncloud/android/files/services/FileDownloader.java", "license": "gpl-2.0", "size": 27870 }
[ "android.content.Intent", "com.owncloud.android.operations.DownloadFileOperation" ]
import android.content.Intent; import com.owncloud.android.operations.DownloadFileOperation;
import android.content.*; import com.owncloud.android.operations.*;
[ "android.content", "com.owncloud.android" ]
android.content; com.owncloud.android;
741,204
@Override public void write(char[] chr, int st, int len) throws IOException { try { beforeWrite(len); out.write(chr, st, len); afterWrite(len); } catch (IOException e) { handleIOException(e); } }
void function(char[] chr, int st, int len) throws IOException { try { beforeWrite(len); out.write(chr, st, len); afterWrite(len); } catch (IOException e) { handleIOException(e); } }
/** * Invokes the delegate's <code>write(char[], int, int)</code> method. * @param chr the characters to write * @param st The start offset * @param len The number of characters to write * @throws IOException if an I/O error occurs */
Invokes the delegate's <code>write(char[], int, int)</code> method
write
{ "repo_name": "fesch/Moenagade", "path": "src/org/apache/commons/io/output/ProxyWriter.java", "license": "gpl-3.0", "size": 8776 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,343,077
public static Collection<String> getServiceNames(Connection connection) throws XMPPException { final List<String> answer = new ArrayList<String>(); ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection); DiscoverItems items = discoManager.discoverItems(connection.getServiceName()); for (Iterator<DiscoverItems.Item> it = items.getItems(); it.hasNext();) { DiscoverItems.Item item = it.next(); try { DiscoverInfo info = discoManager.discoverInfo(item.getEntityID()); if (info.containsFeature("http://jabber.org/protocol/muc")) { answer.add(item.getEntityID()); } } catch (XMPPException e) { // Trouble finding info in some cases. This is a workaround for // discovering info on remote servers. } } return answer; }
static Collection<String> function(Connection connection) throws XMPPException { final List<String> answer = new ArrayList<String>(); ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection); DiscoverItems items = discoManager.discoverItems(connection.getServiceName()); for (Iterator<DiscoverItems.Item> it = items.getItems(); it.hasNext();) { DiscoverItems.Item item = it.next(); try { DiscoverInfo info = discoManager.discoverInfo(item.getEntityID()); if (info.containsFeature("http: answer.add(item.getEntityID()); } } catch (XMPPException e) { } } return answer; }
/** * Returns a collection with the XMPP addresses of the Multi-User Chat services. * * @param connection the XMPP connection to use for discovering Multi-User Chat services. * @return a collection with the XMPP addresses of the Multi-User Chat services. * @throws XMPPException if an error occured while trying to discover MUC services. */
Returns a collection with the XMPP addresses of the Multi-User Chat services
getServiceNames
{ "repo_name": "masach/FaceWhat", "path": "FacewhatDroid/asmack/org/jivesoftware/smackx/muc/MultiUserChat.java", "license": "gpl-3.0", "size": 122766 }
[ "java.util.ArrayList", "java.util.Collection", "java.util.Iterator", "java.util.List", "org.jivesoftware.smack.Connection", "org.jivesoftware.smack.XMPPException", "org.jivesoftware.smackx.ServiceDiscoveryManager", "org.jivesoftware.smackx.packet.DiscoverInfo", "org.jivesoftware.smackx.packet.DiscoverItems" ]
import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; import org.jivesoftware.smack.Connection; import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smackx.ServiceDiscoveryManager; import org.jivesoftware.smackx.packet.DiscoverInfo; import org.jivesoftware.smackx.packet.DiscoverItems;
import java.util.*; import org.jivesoftware.smack.*; import org.jivesoftware.smackx.*; import org.jivesoftware.smackx.packet.*;
[ "java.util", "org.jivesoftware.smack", "org.jivesoftware.smackx" ]
java.util; org.jivesoftware.smack; org.jivesoftware.smackx;
2,805,488
static Coverage getOnlyTheseCcSources(Coverage coverage, Set<String> sourcesToKeep) { if (coverage == null || sourcesToKeep == null) { throw new IllegalArgumentException("Coverage and sourcesToKeep should not be null."); } if (coverage.isEmpty()) { return coverage; } if (sourcesToKeep.isEmpty()) { return new Coverage(); } Coverage finalCoverage = new Coverage(); for (SourceFileCoverage source : coverage.getAllSourceFiles()) { if (!isCcSourceFile(source.sourceFileName()) || sourcesToKeep.contains(source.sourceFileName())) { finalCoverage.add(source); } } return finalCoverage; }
static Coverage getOnlyTheseCcSources(Coverage coverage, Set<String> sourcesToKeep) { if (coverage == null sourcesToKeep == null) { throw new IllegalArgumentException(STR); } if (coverage.isEmpty()) { return coverage; } if (sourcesToKeep.isEmpty()) { return new Coverage(); } Coverage finalCoverage = new Coverage(); for (SourceFileCoverage source : coverage.getAllSourceFiles()) { if (!isCcSourceFile(source.sourceFileName()) sourcesToKeep.contains(source.sourceFileName())) { finalCoverage.add(source); } } return finalCoverage; }
/** * Returns {@link Coverage} only for the given CC source filenames, filtering out every other CC * sources of the given coverage. Other types of source files (e.g. Java) will not be filtered * out. * * @param coverage The initial coverage. * @param sourcesToKeep The filenames of the sources to keep from the initial coverage. */
Returns <code>Coverage</code> only for the given CC source filenames, filtering out every other CC sources of the given coverage. Other types of source files (e.g. Java) will not be filtered out
getOnlyTheseCcSources
{ "repo_name": "davidzchen/bazel", "path": "tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator/Coverage.java", "license": "apache-2.0", "size": 5027 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
1,668,816
public ServletContext getServletContext(){ return _servletContext; }
ServletContext function(){ return _servletContext; }
/** * Returns related Servlet Context * @return ServletContext */
Returns related Servlet Context
getServletContext
{ "repo_name": "OpenLiberty/open-liberty", "path": "dev/com.ibm.ws.sipcontainer/src/com/ibm/websphere/sip/unmatchedMessages/events/UnmatchedRequestEvent.java", "license": "epl-1.0", "size": 1820 }
[ "javax.servlet.ServletContext" ]
import javax.servlet.ServletContext;
import javax.servlet.*;
[ "javax.servlet" ]
javax.servlet;
431,442
protected IMenuManager createFileMenu(IWorkbenchWindow window) { IMenuManager menu = new MenuManager(getString("_UI_Menu_File_label"), IWorkbenchActionConstants.M_FILE); menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START)); IMenuManager newMenu = new MenuManager(getString("_UI_Menu_New_label"), "new"); newMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); menu.add(newMenu); menu.add(new Separator()); menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); menu.add(new Separator()); addToMenuAndRegister(menu, ActionFactory.CLOSE.create(window)); addToMenuAndRegister(menu, ActionFactory.CLOSE_ALL.create(window)); menu.add(new Separator()); addToMenuAndRegister(menu, ActionFactory.SAVE.create(window)); addToMenuAndRegister(menu, ActionFactory.SAVE_AS.create(window)); addToMenuAndRegister(menu, ActionFactory.SAVE_ALL.create(window)); menu.add(new Separator()); addToMenuAndRegister(menu, ActionFactory.QUIT.create(window)); menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END)); return menu; }
IMenuManager function(IWorkbenchWindow window) { IMenuManager menu = new MenuManager(getString(STR), IWorkbenchActionConstants.M_FILE); menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START)); IMenuManager newMenu = new MenuManager(getString(STR), "new"); newMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); menu.add(newMenu); menu.add(new Separator()); menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); menu.add(new Separator()); addToMenuAndRegister(menu, ActionFactory.CLOSE.create(window)); addToMenuAndRegister(menu, ActionFactory.CLOSE_ALL.create(window)); menu.add(new Separator()); addToMenuAndRegister(menu, ActionFactory.SAVE.create(window)); addToMenuAndRegister(menu, ActionFactory.SAVE_AS.create(window)); addToMenuAndRegister(menu, ActionFactory.SAVE_ALL.create(window)); menu.add(new Separator()); addToMenuAndRegister(menu, ActionFactory.QUIT.create(window)); menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END)); return menu; }
/** * Creates the 'File' menu. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
Creates the 'File' menu.
createFileMenu
{ "repo_name": "mondo-project/mondo-demo-wt", "path": "MONDO-Collab/org.mondo.wt.cstudy.metamodel.online.editor/src/WTSpec4M/presentation/WTSpec4MEditorAdvisor.java", "license": "epl-1.0", "size": 14965 }
[ "org.eclipse.jface.action.GroupMarker", "org.eclipse.jface.action.IMenuManager", "org.eclipse.jface.action.MenuManager", "org.eclipse.jface.action.Separator", "org.eclipse.ui.IWorkbenchActionConstants", "org.eclipse.ui.IWorkbenchWindow", "org.eclipse.ui.actions.ActionFactory" ]
import org.eclipse.jface.action.GroupMarker; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; import org.eclipse.ui.IWorkbenchActionConstants; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.jface.action.*; import org.eclipse.ui.*; import org.eclipse.ui.actions.*;
[ "org.eclipse.jface", "org.eclipse.ui" ]
org.eclipse.jface; org.eclipse.ui;
1,284,271
void unregisterForMmiInitiate(Handler h);
void unregisterForMmiInitiate(Handler h);
/** * Unregisters for new MMI initiate notification. * Extraneous calls are tolerated silently */
Unregisters for new MMI initiate notification. Extraneous calls are tolerated silently
unregisterForMmiInitiate
{ "repo_name": "mateor/PDroidHistory", "path": "frameworks/base/telephony/java/com/android/internal/telephony/Phone.java", "license": "gpl-3.0", "size": 61641 }
[ "android.os.Handler" ]
import android.os.Handler;
import android.os.*;
[ "android.os" ]
android.os;
440,862
public static AmqpQueueRawConnectorProxy create (final ConnectorConfiguration configuration) { final AmqpQueueRawConnectorProxy proxy = new AmqpQueueRawConnectorProxy (configuration); return (proxy); }
static AmqpQueueRawConnectorProxy function (final ConnectorConfiguration configuration) { final AmqpQueueRawConnectorProxy proxy = new AmqpQueueRawConnectorProxy (configuration); return (proxy); }
/** * Returns a proxy for AMQP queuing systems. * * @param configuration * the execution environment of a connector * @return the proxy */
Returns a proxy for AMQP queuing systems
create
{ "repo_name": "mosaic-cloud/mosaic-java-platform", "path": "connectors/src/main/java/eu/mosaic_cloud/platform/implementation/v2/connectors/queue/amqp/AmqpQueueRawConnectorProxy.java", "license": "apache-2.0", "size": 20805 }
[ "eu.mosaic_cloud.platform.implementation.v2.connectors.core.ConnectorConfiguration" ]
import eu.mosaic_cloud.platform.implementation.v2.connectors.core.ConnectorConfiguration;
import eu.mosaic_cloud.platform.implementation.v2.connectors.core.*;
[ "eu.mosaic_cloud.platform" ]
eu.mosaic_cloud.platform;
962,842
private Number genericObjectToNumber(Object obj, int ds_type) { if (obj instanceof String) { String str = (String)obj; try { if (ds_type == DataSource.TYPE_GAUGE) return (new Double(str)); else return (new Long(str)); } catch (NumberFormatException e) { return (null); } } else if (obj instanceof Byte) { return (new Byte((Byte)obj)); } else if (obj instanceof Short) { return (new Short((Short)obj)); } else if (obj instanceof Integer) { return (new Integer((Integer)obj)); } else if (obj instanceof Long) { return (new Long((Long)obj)); } else if (obj instanceof Float) { return (new Float((Float)obj)); } else if (obj instanceof Double) { return (new Double((Double)obj)); } else if (obj instanceof BigDecimal) { return (BigDecimal.ZERO.add((BigDecimal)obj)); } else if (obj instanceof BigInteger) { return (BigInteger.ZERO.add((BigInteger)obj)); } else if (obj instanceof AtomicInteger) { return (new Integer(((AtomicInteger)obj).get())); } else if (obj instanceof AtomicLong) { return (new Long(((AtomicLong)obj).get())); } else if (obj instanceof Boolean) { return (Boolean)obj ? 1 : 0; }
Number function(Object obj, int ds_type) { if (obj instanceof String) { String str = (String)obj; try { if (ds_type == DataSource.TYPE_GAUGE) return (new Double(str)); else return (new Long(str)); } catch (NumberFormatException e) { return (null); } } else if (obj instanceof Byte) { return (new Byte((Byte)obj)); } else if (obj instanceof Short) { return (new Short((Short)obj)); } else if (obj instanceof Integer) { return (new Integer((Integer)obj)); } else if (obj instanceof Long) { return (new Long((Long)obj)); } else if (obj instanceof Float) { return (new Float((Float)obj)); } else if (obj instanceof Double) { return (new Double((Double)obj)); } else if (obj instanceof BigDecimal) { return (BigDecimal.ZERO.add((BigDecimal)obj)); } else if (obj instanceof BigInteger) { return (BigInteger.ZERO.add((BigInteger)obj)); } else if (obj instanceof AtomicInteger) { return (new Integer(((AtomicInteger)obj).get())); } else if (obj instanceof AtomicLong) { return (new Long(((AtomicLong)obj).get())); } else if (obj instanceof Boolean) { return (Boolean)obj ? 1 : 0; }
/** * Converts a generic (OpenType) object to a number. * * Returns null if a conversion is not possible or not implemented. */
Converts a generic (OpenType) object to a number. Returns null if a conversion is not possible or not implemented
genericObjectToNumber
{ "repo_name": "maryamtahhan/collectd", "path": "bindings/java/org/collectd/java/GenericJMXConfValue.java", "license": "gpl-2.0", "size": 18144 }
[ "java.math.BigDecimal", "java.math.BigInteger", "java.util.concurrent.atomic.AtomicInteger", "java.util.concurrent.atomic.AtomicLong", "org.collectd.api.DataSource" ]
import java.math.BigDecimal; import java.math.BigInteger; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; import org.collectd.api.DataSource;
import java.math.*; import java.util.concurrent.atomic.*; import org.collectd.api.*;
[ "java.math", "java.util", "org.collectd.api" ]
java.math; java.util; org.collectd.api;
1,703,293
@Test @Parameters({BIND_ADDRESS, SERVER_BIND_ADDRESS}) public void testCreateGatewayReceiverWithDefaultsAndAddressProperties(String addressPropertyKey) throws Exception { String receiverGroup = "receiverGroup"; Integer locator1Port = locatorSite1.getPort(); String expectedBindAddress = getBindAddress(); Properties props = new Properties(); props.setProperty(GROUPS, receiverGroup); props.setProperty(addressPropertyKey, expectedBindAddress); server1 = clusterStartupRule.startServerVM(1, props, locator1Port); server2 = clusterStartupRule.startServerVM(2, props, locator1Port); server3 = clusterStartupRule.startServerVM(3, props, locator1Port); String command = CliStrings.CREATE_GATEWAYRECEIVER + " --" + GROUP + "=" + receiverGroup; gfsh.executeAndAssertThat(command).statusIsSuccess() .tableHasColumnWithExactValuesInAnyOrder("Member", SERVER_1, SERVER_2, SERVER_3) .tableHasColumnWithValuesContaining("Message", "GatewayReceiver created on member \"" + SERVER_1 + "\"", "GatewayReceiver created on member \"" + SERVER_2 + "\"", "GatewayReceiver created on member \"" + SERVER_3 + "\""); invokeInEveryMember(() -> { // verify bind-address used when provided as a gemfire property verifyGatewayReceiverProfile(expectedBindAddress); verifyGatewayReceiverServerLocations(locator1Port, expectedBindAddress); verifyReceiverCreationWithAttributes(!GatewayReceiver.DEFAULT_MANUAL_START, GatewayReceiver.DEFAULT_START_PORT, GatewayReceiver.DEFAULT_END_PORT, GatewayReceiver.DEFAULT_BIND_ADDRESS, GatewayReceiver.DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS, GatewayReceiver.DEFAULT_SOCKET_BUFFER_SIZE, null, GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS); }, server1, server2, server3); }
@Parameters({BIND_ADDRESS, SERVER_BIND_ADDRESS}) void function(String addressPropertyKey) throws Exception { String receiverGroup = STR; Integer locator1Port = locatorSite1.getPort(); String expectedBindAddress = getBindAddress(); Properties props = new Properties(); props.setProperty(GROUPS, receiverGroup); props.setProperty(addressPropertyKey, expectedBindAddress); server1 = clusterStartupRule.startServerVM(1, props, locator1Port); server2 = clusterStartupRule.startServerVM(2, props, locator1Port); server3 = clusterStartupRule.startServerVM(3, props, locator1Port); String command = CliStrings.CREATE_GATEWAYRECEIVER + STR + GROUP + "=" + receiverGroup; gfsh.executeAndAssertThat(command).statusIsSuccess() .tableHasColumnWithExactValuesInAnyOrder(STR, SERVER_1, SERVER_2, SERVER_3) .tableHasColumnWithValuesContaining(STR, STRSTR\"", STR" + SERVER_2 + "\"", STR" + SERVER_3 + "\""); invokeInEveryMember(() -> { verifyGatewayReceiverProfile(expectedBindAddress); verifyGatewayReceiverServerLocations(locator1Port, expectedBindAddress); verifyReceiverCreationWithAttributes(!GatewayReceiver.DEFAULT_MANUAL_START, GatewayReceiver.DEFAULT_START_PORT, GatewayReceiver.DEFAULT_END_PORT, GatewayReceiver.DEFAULT_BIND_ADDRESS, GatewayReceiver.DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS, GatewayReceiver.DEFAULT_SOCKET_BUFFER_SIZE, null, GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS); }, server1, server2, server3); }
/** * GatewayReceiver with all default attributes and bind-address / server-bind-address in * gemfire-properties */
GatewayReceiver with all default attributes and bind-address / server-bind-address in gemfire-properties
testCreateGatewayReceiverWithDefaultsAndAddressProperties
{ "repo_name": "masaki-yamakawa/geode", "path": "geode-wan/src/distributedTest/java/org/apache/geode/internal/cache/wan/wancommand/CreateGatewayReceiverCommandDUnitTest.java", "license": "apache-2.0", "size": 35747 }
[ "java.util.Properties", "org.apache.geode.cache.wan.GatewayReceiver", "org.apache.geode.internal.cache.wan.wancommand.WANCommandUtils", "org.apache.geode.management.internal.i18n.CliStrings", "org.apache.geode.test.junit.rules.VMProvider" ]
import java.util.Properties; import org.apache.geode.cache.wan.GatewayReceiver; import org.apache.geode.internal.cache.wan.wancommand.WANCommandUtils; import org.apache.geode.management.internal.i18n.CliStrings; import org.apache.geode.test.junit.rules.VMProvider;
import java.util.*; import org.apache.geode.cache.wan.*; import org.apache.geode.internal.cache.wan.wancommand.*; import org.apache.geode.management.internal.i18n.*; import org.apache.geode.test.junit.rules.*;
[ "java.util", "org.apache.geode" ]
java.util; org.apache.geode;
1,600,875
private void generateImage() { // Clean the folder int pixelsize = 1; if (linkedMatrix.getHeight() < 400 && linkedMatrix.getWidth() < 400) { // Compute size of pixels pixelsize = 400 / linkedMatrix.getHeight(); } BufferedImage img = new BufferedImage(pixelsize * linkedMatrix.getWidth(), pixelsize * linkedMatrix.getHeight(), BufferedImage.TYPE_3BYTE_BGR); // Create background matrix setImageBackground(img, linkedMatrix, pixelsize); // Set rectangles in stack and current one setRectangleStack(img, stack, pixelsize); // Set current Point setCurrentPoint(img, currentPoint, pixelsize); // Save image if (!movie) { try { ImageIO.write(img, "jpg", new File("images/image" + step + ".jpg")); } catch (IOException e) { e.printStackTrace(); } } else { listImages.add(img); } }
void function() { int pixelsize = 1; if (linkedMatrix.getHeight() < 400 && linkedMatrix.getWidth() < 400) { pixelsize = 400 / linkedMatrix.getHeight(); } BufferedImage img = new BufferedImage(pixelsize * linkedMatrix.getWidth(), pixelsize * linkedMatrix.getHeight(), BufferedImage.TYPE_3BYTE_BGR); setImageBackground(img, linkedMatrix, pixelsize); setRectangleStack(img, stack, pixelsize); setCurrentPoint(img, currentPoint, pixelsize); if (!movie) { try { ImageIO.write(img, "jpg", new File(STR + step + ".jpg")); } catch (IOException e) { e.printStackTrace(); } } else { listImages.add(img); } }
/** * Generate a picture of the current state * * @param linkedMatrix * @param rectangles * @param stack * @param currentPoint2 * @param step */
Generate a picture of the current state
generateImage
{ "repo_name": "jsubercaze/wsrm", "path": "src/main/java/fr/tse/lt2c/satin/matrix/extraction/linkedmatrix/refactored/WSMRDecomposerWithLogs.java", "license": "apache-2.0", "size": 41417 }
[ "java.awt.image.BufferedImage", "java.io.File", "java.io.IOException", "javax.imageio.ImageIO" ]
import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO;
import java.awt.image.*; import java.io.*; import javax.imageio.*;
[ "java.awt", "java.io", "javax.imageio" ]
java.awt; java.io; javax.imageio;
391,184
// ! Appends a text node comment. public List<IComment> appendComment(final String commentText) throws com.google.security.zynamics.binnavi.API.disassembly.CouldntSaveDataException, com.google.security.zynamics.binnavi.API.disassembly.CouldntLoadDataException { try { return m_node.appendComment(commentText); } catch (final CouldntSaveDataException exception) { throw new com.google.security.zynamics.binnavi.API.disassembly.CouldntSaveDataException( exception); } catch (final CouldntLoadDataException exception) { throw new com.google.security.zynamics.binnavi.API.disassembly.CouldntLoadDataException( exception); } }
List<IComment> function(final String commentText) throws com.google.security.zynamics.binnavi.API.disassembly.CouldntSaveDataException, com.google.security.zynamics.binnavi.API.disassembly.CouldntLoadDataException { try { return m_node.appendComment(commentText); } catch (final CouldntSaveDataException exception) { throw new com.google.security.zynamics.binnavi.API.disassembly.CouldntSaveDataException( exception); } catch (final CouldntLoadDataException exception) { throw new com.google.security.zynamics.binnavi.API.disassembly.CouldntLoadDataException( exception); } }
/** * Appends a text node comment. * * @param commentText The text for the newly generated comment. * * @return The List of {@link IComment} comments currently associated to the text node. * @throws com.google.security.zynamics.binnavi.API.disassembly.CouldntSaveDataException * @throws com.google.security.zynamics.binnavi.API.disassembly.CouldntLoadDataException */
Appends a text node comment
appendComment
{ "repo_name": "dgrif/binnavi", "path": "src/main/java/com/google/security/zynamics/binnavi/API/disassembly/TextNode.java", "license": "apache-2.0", "size": 6840 }
[ "com.google.security.zynamics.binnavi.Database", "com.google.security.zynamics.binnavi.Gui", "java.util.List" ]
import com.google.security.zynamics.binnavi.Database; import com.google.security.zynamics.binnavi.Gui; import java.util.List;
import com.google.security.zynamics.binnavi.*; import java.util.*;
[ "com.google.security", "java.util" ]
com.google.security; java.util;
1,580,186
public Builder putAllMetadata(Map<String, String> map) { if (this.metadata == null) { this.metadata = new HashMap<>(); } this.metadata.putAll(map); return this; } } public enum AccountHolderType implements ApiRequestParams.EnumParam { @SerializedName("company") COMPANY("company"), @SerializedName("individual") INDIVIDUAL("individual"); @Getter(onMethod_ = {@Override}) private final String value; AccountHolderType(String value) { this.value = value; } }
Builder function(Map<String, String> map) { if (this.metadata == null) { this.metadata = new HashMap<>(); } this.metadata.putAll(map); return this; } } public enum AccountHolderType implements ApiRequestParams.EnumParam { @SerializedName(STR) COMPANY(STR), @SerializedName(STR) INDIVIDUAL(STR); @Getter(onMethod_ = {@Override}) private final String value; AccountHolderType(String value) { this.value = value; } }
/** * Add all map key/value pairs to `metadata` map. A map is initialized for the first * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. * See {@link BankAccountUpdateOnAccountParams#metadata} for the field documentation. */
Add all map key/value pairs to `metadata` map. A map is initialized for the first `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. See <code>BankAccountUpdateOnAccountParams#metadata</code> for the field documentation
putAllMetadata
{ "repo_name": "stripe/stripe-java", "path": "src/main/java/com/stripe/param/BankAccountUpdateOnAccountParams.java", "license": "mit", "size": 7095 }
[ "com.google.gson.annotations.SerializedName", "com.stripe.net.ApiRequestParams", "java.util.HashMap", "java.util.Map" ]
import com.google.gson.annotations.SerializedName; import com.stripe.net.ApiRequestParams; import java.util.HashMap; import java.util.Map;
import com.google.gson.annotations.*; import com.stripe.net.*; import java.util.*;
[ "com.google.gson", "com.stripe.net", "java.util" ]
com.google.gson; com.stripe.net; java.util;
366,561
void printConfig() { if (!configShown && logger.isDebugEnabled()) { configShown = true; StringBuilder sb = new StringBuilder(); sb.append("SSL Configuration: \n"); sb.append(" ssl-enabled = ").append(this.sslConfig.isEnabled()).append("\n"); // add other options here.... for (String key : System.getProperties().stringPropertyNames()) { // fix for 46822 if (key.startsWith("javax.net.ssl")) { String possiblyRedactedValue = ArgumentRedactor.redactArgumentIfNecessary(key, System.getProperty(key)); sb.append(" ").append(key).append(" = ").append(possiblyRedactedValue).append("\n"); } } logger.debug(sb.toString()); } }
void printConfig() { if (!configShown && logger.isDebugEnabled()) { configShown = true; StringBuilder sb = new StringBuilder(); sb.append(STR); sb.append(STR).append(this.sslConfig.isEnabled()).append("\n"); for (String key : System.getProperties().stringPropertyNames()) { if (key.startsWith(STR)) { String possiblyRedactedValue = ArgumentRedactor.redactArgumentIfNecessary(key, System.getProperty(key)); sb.append(" ").append(key).append(STR).append(possiblyRedactedValue).append("\n"); } } logger.debug(sb.toString()); } }
/** * Print current configured state to log. */
Print current configured state to log
printConfig
{ "repo_name": "davinash/geode", "path": "geode-core/src/main/java/org/apache/geode/internal/net/SocketCreator.java", "license": "apache-2.0", "size": 32144 }
[ "org.apache.geode.internal.util.ArgumentRedactor" ]
import org.apache.geode.internal.util.ArgumentRedactor;
import org.apache.geode.internal.util.*;
[ "org.apache.geode" ]
org.apache.geode;
1,335,257
public DataSet build() throws Exception; } // Local Variables: // tab-width: 4
DataSet function() throws Exception; }
/** * Retrieves a DataSet - a collection of DataPoints - from the current * input source. The DataSet should contain all DataPoints defined by * the input source. * @return a DataSet built from the current input source. * @throws Exception if an error occurred reading from the input source. */
Retrieves a DataSet - a collection of DataPoints - from the current input source. The DataSet should contain all DataPoints defined by the input source
build
{ "repo_name": "etheriau/OpenForecast", "path": "src/main/java/net/sourceforge/openforecast/input/Builder.java", "license": "lgpl-2.1", "size": 1898 }
[ "net.sourceforge.openforecast.DataSet" ]
import net.sourceforge.openforecast.DataSet;
import net.sourceforge.openforecast.*;
[ "net.sourceforge.openforecast" ]
net.sourceforge.openforecast;
2,227,538
private void setTreeCellFactory(TreeView<FileBrowserElement> tree) { PseudoClass firstElementPseudoClass = PseudoClass.getPseudoClass("first-tree-item");
void function(TreeView<FileBrowserElement> tree) { PseudoClass firstElementPseudoClass = PseudoClass.getPseudoClass(STR);
/** * Customizing treeView * * @param tree treeView */
Customizing treeView
setTreeCellFactory
{ "repo_name": "slonikmak/ariADDna", "path": "desktop-gui/src/main/java/com/stnetix/ariaddna/desktopgui/views/TreeViewFactory.java", "license": "apache-2.0", "size": 8207 }
[ "com.stnetix.ariaddna.desktopgui.models.FileBrowserElement" ]
import com.stnetix.ariaddna.desktopgui.models.FileBrowserElement;
import com.stnetix.ariaddna.desktopgui.models.*;
[ "com.stnetix.ariaddna" ]
com.stnetix.ariaddna;
1,479,520
private void deleteMetaRegion(byte[] metaKey) throws IOException { Delete d = new Delete(metaKey); meta.delete(d); meta.flushCommits(); LOG.info("Deleted " + Bytes.toString(metaKey) + " from META" ); }
void function(byte[] metaKey) throws IOException { Delete d = new Delete(metaKey); meta.delete(d); meta.flushCommits(); LOG.info(STR + Bytes.toString(metaKey) + STR ); }
/** * Deletes region from meta table */
Deletes region from meta table
deleteMetaRegion
{ "repo_name": "cloud-software-foundation/c5", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java", "license": "apache-2.0", "size": 140505 }
[ "java.io.IOException", "org.apache.hadoop.hbase.client.Delete" ]
import java.io.IOException; import org.apache.hadoop.hbase.client.Delete;
import java.io.*; import org.apache.hadoop.hbase.client.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
2,781,234
@RequestMapping(value = "/loginSubmit", method = RequestMethod.POST) public ModelAndView performLogin(HttpSession session,@RequestParam("email")String email,@RequestParam("password")String password) { User user=loginAuthService.authenticate(email,password); if(user!=null) { setUserDetails(user,session); if (session.getAttribute("redirectTo") != null) { return new ModelAndView("redirect:" + (String) session.getAttribute("redirectTo")); } return new ModelAndView("redirect:/"); } else return new ModelAndView("loginError"); }
@RequestMapping(value = STR, method = RequestMethod.POST) ModelAndView function(HttpSession session,@RequestParam("email")String email,@RequestParam(STR)String password) { User user=loginAuthService.authenticate(email,password); if(user!=null) { setUserDetails(user,session); if (session.getAttribute(STR) != null) { return new ModelAndView(STR + (String) session.getAttribute(STR)); } return new ModelAndView(STR); } else return new ModelAndView(STR); }
/** * Method to handle login requests * * @param session * @param email * @param password * @return The appropriate view */
Method to handle login requests
performLogin
{ "repo_name": "kumar-pratyaksh/AceMyRideFrontendBackEnd", "path": "AceMyRideFrontend/src/main/java/com/avizva/controller/LoginController.java", "license": "gpl-3.0", "size": 2068 }
[ "com.avizva.model.User", "javax.servlet.http.HttpSession", "org.springframework.web.bind.annotation.RequestMapping", "org.springframework.web.bind.annotation.RequestMethod", "org.springframework.web.bind.annotation.RequestParam", "org.springframework.web.servlet.ModelAndView" ]
import com.avizva.model.User; import javax.servlet.http.HttpSession; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView;
import com.avizva.model.*; import javax.servlet.http.*; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.*;
[ "com.avizva.model", "javax.servlet", "org.springframework.web" ]
com.avizva.model; javax.servlet; org.springframework.web;
1,841,932
public Document createBasicDocument() { doc = null; element = null; try { DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance(); fact.setNamespaceAware(true); doc = fact.newDocumentBuilder().newDocument(); Element el = doc.createElementNS(getNamespaceURI(), name); doc.appendChild(el); element = doc.getDocumentElement(); buildTopLevel(doc, element); if (!element.hasAttributeNS( XMLConstants.XMLNS_NAMESPACE_URI, XMLConstants.XMLNS_PREFIX)) { element.setAttributeNS(XMLConstants.XMLNS_NAMESPACE_URI, XMLConstants.XMLNS_PREFIX, getNamespaceURI()); } } catch (Exception e) { //TODO this is ugly because there may be subsequent failures like NPEs log.error("Error while trying to instantiate a DOM Document", e); } return doc; }
Document function() { doc = null; element = null; try { DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance(); fact.setNamespaceAware(true); doc = fact.newDocumentBuilder().newDocument(); Element el = doc.createElementNS(getNamespaceURI(), name); doc.appendChild(el); element = doc.getDocumentElement(); buildTopLevel(doc, element); if (!element.hasAttributeNS( XMLConstants.XMLNS_NAMESPACE_URI, XMLConstants.XMLNS_PREFIX)) { element.setAttributeNS(XMLConstants.XMLNS_NAMESPACE_URI, XMLConstants.XMLNS_PREFIX, getNamespaceURI()); } } catch (Exception e) { log.error(STR, e); } return doc; }
/** * Create an empty DOM document * * @return DOM document */
Create an empty DOM document
createBasicDocument
{ "repo_name": "StrategyObject/fop", "path": "src/java/org/apache/fop/fo/XMLObj.java", "license": "apache-2.0", "size": 6997 }
[ "javax.xml.parsers.DocumentBuilderFactory", "org.apache.fop.util.XMLConstants", "org.w3c.dom.Document", "org.w3c.dom.Element" ]
import javax.xml.parsers.DocumentBuilderFactory; import org.apache.fop.util.XMLConstants; import org.w3c.dom.Document; import org.w3c.dom.Element;
import javax.xml.parsers.*; import org.apache.fop.util.*; import org.w3c.dom.*;
[ "javax.xml", "org.apache.fop", "org.w3c.dom" ]
javax.xml; org.apache.fop; org.w3c.dom;
2,384,923
public void setTargetEditPart(EditPart part) { targetEditPart = part; }
void function(EditPart part) { targetEditPart = part; }
/** * Sets the target of the Connection to the given EditPart. * * @param part * the target EditPart */
Sets the target of the Connection to the given EditPart
setTargetEditPart
{ "repo_name": "ghillairet/gef-gwt", "path": "src/main/java/org/eclipse/gef/requests/CreateConnectionRequest.java", "license": "epl-1.0", "size": 2310 }
[ "org.eclipse.gef.EditPart" ]
import org.eclipse.gef.EditPart;
import org.eclipse.gef.*;
[ "org.eclipse.gef" ]
org.eclipse.gef;
2,310,674
public int getDayOfMonth() { return m_calendar.get(Calendar.DAY_OF_MONTH); } // getDayOfMonth
int function() { return m_calendar.get(Calendar.DAY_OF_MONTH); }
/** * Get the day of month. * @return the day of month. */
Get the day of month
getDayOfMonth
{ "repo_name": "OpenCollabZA/sakai", "path": "calendar/calendar-util/util/src/java/org/sakaiproject/util/CalendarUtil.java", "license": "apache-2.0", "size": 17701 }
[ "java.util.Calendar" ]
import java.util.Calendar;
import java.util.*;
[ "java.util" ]
java.util;
2,312,840
public SearchSourceBuilder query(BytesReference queryBinary) { this.queryBinary = queryBinary; return this; }
SearchSourceBuilder function(BytesReference queryBinary) { this.queryBinary = queryBinary; return this; }
/** * Constructs a new search source builder with a raw search query. */
Constructs a new search source builder with a raw search query
query
{ "repo_name": "zuoyebushiwo/ElasticSearch-Final", "path": "src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java", "license": "apache-2.0", "size": 29934 }
[ "org.elasticsearch.common.bytes.BytesReference" ]
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.bytes.*;
[ "org.elasticsearch.common" ]
org.elasticsearch.common;
1,981,559
@Test public void aspectDescriptions() throws Exception { scratch.file( "test/aspect.bzl", "def _a_impl(target,ctx):", " s = str(target.label) + str(target.aspect_ids) + '@' + ctx.aspect_id + '='", " value = []", " if ctx.rule.attr.dep:", " d = ctx.rule.attr.dep", " s += str(d.label) + str(d.aspect_ids) + ',' + str(ctx.aspect_id in d.aspect_ids)", " value += ctx.rule.attr.dep.ap", " else:", " s += 'None'", " value.append(s)", " return struct(ap = value)", "a = aspect(_a_impl, attr_aspects = ['dep'])", "def _r_impl(ctx):", " if not ctx.attr.dep:", " return struct(result = [])", " return struct(result = ctx.attr.dep.ap)", "r = rule(_r_impl, attrs = { 'dep' : attr.label(aspects = [a])})" ); scratch.file( "test/BUILD", "load(':aspect.bzl', 'r')", "r(name = 'r0')", "r(name = 'r1', dep = ':r0')", "r(name = 'r2', dep = ':r1')" ); AnalysisResult analysisResult = update("//test:r2"); ConfiguredTarget target = Iterables.getOnlyElement(analysisResult.getTargetsToBuild()); SkylarkList<?> result = (SkylarkList<?>) target.get("result"); assertThat(result).containsExactly( "//test:r0[]@//test:aspect.bzl%a=None", "//test:r1[]@//test:aspect.bzl%a=//test:r0[\"//test:aspect.bzl%a\"],True"); }
void function() throws Exception { scratch.file( STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR ); scratch.file( STR, STR, STR, STR, STR ); AnalysisResult analysisResult = update(STRresultSTR " }
/** * Linear aspects-on-aspects with alias rule. */
Linear aspects-on-aspects with alias rule
aspectDescriptions
{ "repo_name": "hermione521/bazel", "path": "src/test/java/com/google/devtools/build/lib/skylark/SkylarkAspectsTest.java", "license": "apache-2.0", "size": 64349 }
[ "com.google.devtools.build.lib.analysis.BuildView" ]
import com.google.devtools.build.lib.analysis.BuildView;
import com.google.devtools.build.lib.analysis.*;
[ "com.google.devtools" ]
com.google.devtools;
1,637,302
@Override protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); }
void function(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); }
/** * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children * that can be created under this object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds <code>org.eclipse.emf.edit.command.CommandParameter</code>s describing the children that can be created under this object.
collectNewChildDescriptors
{ "repo_name": "markus1978/citygml4emf", "path": "de.hub.citygml.emf.ecore.edit/src/net/opengis/gml/provider/AbstractCurveSegmentTypeItemProvider.java", "license": "apache-2.0", "size": 6685 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
1,128,740
void sessionInactivated(Session session);
void sessionInactivated(Session session);
/** * Called when a session becomes inactive because the underlying channel has been closed. * All references to the Session should be removed, as it will no longer be valid. * * @param session the Session which will become inactive */
Called when a session becomes inactive because the underlying channel has been closed. All references to the Session should be removed, as it will no longer be valid
sessionInactivated
{ "repo_name": "flow/network", "path": "src/main/java/com/flowpowered/network/ConnectionManager.java", "license": "mit", "size": 2196 }
[ "com.flowpowered.network.session.Session" ]
import com.flowpowered.network.session.Session;
import com.flowpowered.network.session.*;
[ "com.flowpowered.network" ]
com.flowpowered.network;
773,233
private void storeServiceInjectionPoint(InjectionPoint injectionPoint) { Type key = injectionPoint.getType(); if (!typeToIpMap.containsKey(key)) { typeToIpMap.put(key, new CopyOnWriteArraySet<InjectionPoint>()); } typeToIpMap.get(key).add(injectionPoint); }
void function(InjectionPoint injectionPoint) { Type key = injectionPoint.getType(); if (!typeToIpMap.containsKey(key)) { typeToIpMap.put(key, new CopyOnWriteArraySet<InjectionPoint>()); } typeToIpMap.get(key).add(injectionPoint); }
/** * Stores the given injection point in the {@code typeToIpMap}. * * @param injectionPoint */
Stores the given injection point in the typeToIpMap
storeServiceInjectionPoint
{ "repo_name": "grgrzybek/org.ops4j.pax.cdi", "path": "pax-cdi-extension/src/main/java/org/ops4j/pax/cdi/extension/impl/OsgiExtension.java", "license": "apache-2.0", "size": 10658 }
[ "java.lang.reflect.Type", "java.util.concurrent.CopyOnWriteArraySet", "javax.enterprise.inject.spi.InjectionPoint" ]
import java.lang.reflect.Type; import java.util.concurrent.CopyOnWriteArraySet; import javax.enterprise.inject.spi.InjectionPoint;
import java.lang.reflect.*; import java.util.concurrent.*; import javax.enterprise.inject.spi.*;
[ "java.lang", "java.util", "javax.enterprise" ]
java.lang; java.util; javax.enterprise;
294,299
@SuppressWarnings("unchecked") public void addKey(StorableKey<S> key) { if (key == null) { throw new IllegalArgumentException(); } add(new StorableIndex<S>(key, Direction.UNSPECIFIED)); }
@SuppressWarnings(STR) void function(StorableKey<S> key) { if (key == null) { throw new IllegalArgumentException(); } add(new StorableIndex<S>(key, Direction.UNSPECIFIED)); }
/** * Adds the key as a unique index, preserving the property arrangement. * * @throws IllegalArgumentException if key is null */
Adds the key as a unique index, preserving the property arrangement
addKey
{ "repo_name": "Carbonado/Carbonado", "path": "src/main/java/com/amazon/carbonado/qe/StorableIndexSet.java", "license": "apache-2.0", "size": 19711 }
[ "com.amazon.carbonado.info.Direction", "com.amazon.carbonado.info.StorableIndex", "com.amazon.carbonado.info.StorableKey" ]
import com.amazon.carbonado.info.Direction; import com.amazon.carbonado.info.StorableIndex; import com.amazon.carbonado.info.StorableKey;
import com.amazon.carbonado.info.*;
[ "com.amazon.carbonado" ]
com.amazon.carbonado;
17,964
public static DenseMatrix64F createFundamental(DenseMatrix64F E, DenseMatrix64F K1, DenseMatrix64F K2) { DenseMatrix64F K1_inv = new DenseMatrix64F(3,3); CommonOps.invert(K1,K1_inv); DenseMatrix64F K2_inv = new DenseMatrix64F(3,3); CommonOps.invert(K2,K2_inv); DenseMatrix64F F = new DenseMatrix64F(3,3); DenseMatrix64F temp = new DenseMatrix64F(3,3); CommonOps.multTransA(K2_inv,E,temp); CommonOps.mult(temp,K1_inv,F); return F; }
static DenseMatrix64F function(DenseMatrix64F E, DenseMatrix64F K1, DenseMatrix64F K2) { DenseMatrix64F K1_inv = new DenseMatrix64F(3,3); CommonOps.invert(K1,K1_inv); DenseMatrix64F K2_inv = new DenseMatrix64F(3,3); CommonOps.invert(K2,K2_inv); DenseMatrix64F F = new DenseMatrix64F(3,3); DenseMatrix64F temp = new DenseMatrix64F(3,3); CommonOps.multTransA(K2_inv,E,temp); CommonOps.mult(temp,K1_inv,F); return F; }
/** * Computes a Fundamental matrix given an Essential matrix and the camera calibration matrix. * * F = (K2<sup>-1</sup>)<sup>T</sup>*E*K1<sup>-1</sup> * * @param E Essential matrix * @param K1 Intrinsic camera calibration matrix for camera 1 * @param K2 Intrinsic camera calibration matrix for camera 2 * @return Fundamental matrix */
Computes a Fundamental matrix given an Essential matrix and the camera calibration matrix. F = (K2-1)T*E*K1-1
createFundamental
{ "repo_name": "pacozaa/BoofCV", "path": "main/geo/src/boofcv/alg/geo/MultiViewOps.java", "license": "apache-2.0", "size": 28990 }
[ "org.ejml.data.DenseMatrix64F", "org.ejml.ops.CommonOps" ]
import org.ejml.data.DenseMatrix64F; import org.ejml.ops.CommonOps;
import org.ejml.data.*; import org.ejml.ops.*;
[ "org.ejml.data", "org.ejml.ops" ]
org.ejml.data; org.ejml.ops;
1,559,893
public static <T> PVectorByteBufferedIntegral2s8<T> createWithBase( final ByteBuffer b, final MutableLongType base, final int offset) { return new PVectorByteBufferedIntegral2s8<>(b, base, offset); }
static <T> PVectorByteBufferedIntegral2s8<T> function( final ByteBuffer b, final MutableLongType base, final int offset) { return new PVectorByteBufferedIntegral2s8<>(b, base, offset); }
/** * <p>Return a new vector that is backed by the given byte buffer {@code * b}</p> * * <p>The data for the instance will be taken from the data at the current * value of {@code base.get() + offset}, each time a field is requested or * set.</p> * * <p>No initialization of the data is performed.</p> * * @param <T> A phantom type parameter * @param b The byte buffer * @param base The base address * @param offset A constant offset * * @return A new buffered vector */
Return a new vector that is backed by the given byte buffer b The data for the instance will be taken from the data at the current value of base.get() + offset, each time a field is requested or set. No initialization of the data is performed
createWithBase
{ "repo_name": "io7m/jtensors", "path": "com.io7m.jtensors.storage.bytebuffered/src/main/java/com/io7m/jtensors/storage/bytebuffered/PVectorByteBufferedIntegral2s8.java", "license": "isc", "size": 2541 }
[ "com.io7m.mutable.numbers.core.MutableLongType", "java.nio.ByteBuffer" ]
import com.io7m.mutable.numbers.core.MutableLongType; import java.nio.ByteBuffer;
import com.io7m.mutable.numbers.core.*; import java.nio.*;
[ "com.io7m.mutable", "java.nio" ]
com.io7m.mutable; java.nio;
1,015,422
private int parseSection() { int section = buf[pos]; if (false) Assert.that(section >= INSTANCE_FIELDS && section <= STATIC_METHODS); pos++; sectionStart[section] = (short)pos; sectionCount[section] = 0; while (pos < buf.length) { int lengthOrSection = buf[pos]; if (lengthOrSection >= 0 && lengthOrSection <= STATIC_METHODS) { break; } lengthOrSection = readUnsignedShort(); pos += lengthOrSection; sectionCount[section]++; } return section; }
int function() { int section = buf[pos]; if (false) Assert.that(section >= INSTANCE_FIELDS && section <= STATIC_METHODS); pos++; sectionStart[section] = (short)pos; sectionCount[section] = 0; while (pos < buf.length) { int lengthOrSection = buf[pos]; if (lengthOrSection >= 0 && lengthOrSection <= STATIC_METHODS) { break; } lengthOrSection = readUnsignedShort(); pos += lengthOrSection; sectionCount[section]++; } return section; }
/** * Parses a single member section. The current parse position must be * at the section identifier byte. */
Parses a single member section. The current parse position must be at the section identifier byte
parseSection
{ "repo_name": "sics-sse/moped", "path": "squawk/cldc/preprocessed/com/sun/squawk/SymbolParser.java", "license": "gpl-2.0", "size": 41211 }
[ "com.sun.squawk.util.Assert" ]
import com.sun.squawk.util.Assert;
import com.sun.squawk.util.*;
[ "com.sun.squawk" ]
com.sun.squawk;
1,619,333
private Pair<Long, NodeRef> getNodePairNotNull(NodeRef nodeRef) throws InvalidNodeRefException { ParameterCheck.mandatory("nodeRef", nodeRef); Pair<Long, NodeRef> unchecked = nodeDAO.getNodePair(nodeRef); if (unchecked == null) { Status nodeStatus = nodeDAO.getNodeRefStatus(nodeRef); throw new InvalidNodeRefException("Node does not exist: " + nodeRef + " (status:" + nodeStatus + ")", nodeRef); } return unchecked; }
Pair<Long, NodeRef> function(NodeRef nodeRef) throws InvalidNodeRefException { ParameterCheck.mandatory(STR, nodeRef); Pair<Long, NodeRef> unchecked = nodeDAO.getNodePair(nodeRef); if (unchecked == null) { Status nodeStatus = nodeDAO.getNodeRefStatus(nodeRef); throw new InvalidNodeRefException(STR + nodeRef + STR + nodeStatus + ")", nodeRef); } return unchecked; }
/** * Performs a null-safe get of the node * * @param nodeRef the node to retrieve * @return Returns the node entity (never null) * @throws InvalidNodeRefException if the referenced node could not be found */
Performs a null-safe get of the node
getNodePairNotNull
{ "repo_name": "Alfresco/community-edition", "path": "projects/repository/source/java/org/alfresco/repo/node/db/DbNodeServiceImpl.java", "license": "lgpl-3.0", "size": 141832 }
[ "org.alfresco.service.cmr.repository.InvalidNodeRefException", "org.alfresco.service.cmr.repository.NodeRef", "org.alfresco.util.Pair", "org.alfresco.util.ParameterCheck" ]
import org.alfresco.service.cmr.repository.InvalidNodeRefException; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.util.Pair; import org.alfresco.util.ParameterCheck;
import org.alfresco.service.cmr.repository.*; import org.alfresco.util.*;
[ "org.alfresco.service", "org.alfresco.util" ]
org.alfresco.service; org.alfresco.util;
869,672
public void setEntityResolver(EntityResolver entityResolver){ this.entityResolver = entityResolver; }
void function(EntityResolver entityResolver){ this.entityResolver = entityResolver; }
/** * Set the <code>EntityResolver</code> used by SAX when resolving * public id and system id. * This must be called before the first call to <code>parse()</code>. * @param entityResolver a class that implement the <code>EntityResolver</code> interface. */
Set the <code>EntityResolver</code> used by SAX when resolving public id and system id. This must be called before the first call to <code>parse()</code>
setEntityResolver
{ "repo_name": "ProfilingLabs/Usemon2", "path": "usemon-agent-commons-java/src/main/java/com/usemon/lib/org/apache/commons/digester/Digester.java", "license": "mpl-2.0", "size": 104184 }
[ "org.xml.sax.EntityResolver" ]
import org.xml.sax.EntityResolver;
import org.xml.sax.*;
[ "org.xml.sax" ]
org.xml.sax;
1,606,519
public void setSelectorDrawable(int res) { mViewBehind.setSelectorBitmap(BitmapFactory.decodeResource(getResources(), res)); }
void function(int res) { mViewBehind.setSelectorBitmap(BitmapFactory.decodeResource(getResources(), res)); }
/** * Sets the selector drawable. * * @param res a resource ID for the selector drawable */
Sets the selector drawable
setSelectorDrawable
{ "repo_name": "banlyst/MyApplication3", "path": "libraries/slidingmenu/src/com/jeremyfeinstein/slidingmenu/lib/SlidingMenu.java", "license": "apache-2.0", "size": 28696 }
[ "android.graphics.BitmapFactory" ]
import android.graphics.BitmapFactory;
import android.graphics.*;
[ "android.graphics" ]
android.graphics;
2,405,391
public void setMediaPlaybackRequiresUserGesture(boolean require) { if (TRACE) Log.i(LOGTAG, "setMediaPlaybackRequiresUserGesture=" + require); synchronized (mAwSettingsLock) { if (mMediaPlaybackRequiresUserGesture != require) { mMediaPlaybackRequiresUserGesture = require; mEventHandler.updateWebkitPreferencesLocked(); } } }
void function(boolean require) { if (TRACE) Log.i(LOGTAG, STR + require); synchronized (mAwSettingsLock) { if (mMediaPlaybackRequiresUserGesture != require) { mMediaPlaybackRequiresUserGesture = require; mEventHandler.updateWebkitPreferencesLocked(); } } }
/** * See {@link android.webkit.WebSettings#setMediaPlaybackRequiresUserGesture}. */
See <code>android.webkit.WebSettings#setMediaPlaybackRequiresUserGesture</code>
setMediaPlaybackRequiresUserGesture
{ "repo_name": "ric2b/Vivaldi-browser", "path": "chromium/android_webview/java/src/org/chromium/android_webview/AwSettings.java", "license": "bsd-3-clause", "size": 65230 }
[ "android.util.Log" ]
import android.util.Log;
import android.util.*;
[ "android.util" ]
android.util;
1,318,906
protected void validate() { // no one of the 2 classpaths handling styles are defined // how could bnd work ? if (classpath == null && classpathReference == null) { log("Unable to get a classpath ...attributes not set"); throw new BuildException("No one of the classpath or classpathref defined..."); } if (classpathDirectlySet == true && classpathReference != null) { log("Unable to choose between classpath & classpathref !!"); throw new BuildException("Can't choose between classpath & classpathref"); } } // updates classpath for classpathref and nested classpath
void function() { if (classpath == null && classpathReference == null) { log(STR); throw new BuildException(STR); } if (classpathDirectlySet == true && classpathReference != null) { log(STR); throw new BuildException(STR); } }
/** * validate required parameters before starting execution * * @throws BuildException , if build is impossible */
validate required parameters before starting execution
validate
{ "repo_name": "psoreide/bnd", "path": "biz.aQute.bnd/src/aQute/bnd/ant/BndTask.java", "license": "apache-2.0", "size": 12617 }
[ "org.apache.tools.ant.BuildException" ]
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.*;
[ "org.apache.tools" ]
org.apache.tools;
2,642,356
LinkedList<Integer> followingControlNode_ids = this.dbControlFlow.getFollowingControlNodes(controlNode_id); for (int followingControlNode_id : followingControlNode_ids) { ControlNodeInstance followingControlNodeInstance = createFollowingNodeInstance(followingControlNode_id); //enable following instances followingControlNodeInstance.enableControlFlow(); } }
LinkedList<Integer> followingControlNode_ids = this.dbControlFlow.getFollowingControlNodes(controlNode_id); for (int followingControlNode_id : followingControlNode_ids) { ControlNodeInstance followingControlNodeInstance = createFollowingNodeInstance(followingControlNode_id); followingControlNodeInstance.enableControlFlow(); } }
/** * Set all following control nodes to control flow enabled and initializes them. */
Set all following control nodes to control flow enabled and initializes them
enableFollowing
{ "repo_name": "BP2014W1/JEngine", "path": "src/main/java/de/uni_potsdam/hpi/bpt/bp2014/jcore/ParallelOutgoingBehavior.java", "license": "mit", "size": 1561 }
[ "java.util.LinkedList" ]
import java.util.LinkedList;
import java.util.*;
[ "java.util" ]
java.util;
2,563,213
public void testSize() { ConcurrentSkipListMap map = map5(); ConcurrentSkipListMap empty = new ConcurrentSkipListMap(); assertEquals(0, empty.size()); assertEquals(5, map.size()); }
void function() { ConcurrentSkipListMap map = map5(); ConcurrentSkipListMap empty = new ConcurrentSkipListMap(); assertEquals(0, empty.size()); assertEquals(5, map.size()); }
/** * size returns the correct values */
size returns the correct values
testSize
{ "repo_name": "FauxFaux/jdk9-jdk", "path": "test/java/util/concurrent/tck/ConcurrentSkipListMapTest.java", "license": "gpl-2.0", "size": 40653 }
[ "java.util.concurrent.ConcurrentSkipListMap" ]
import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
962,350
public static <E> OutputMatcher<E> outputWithSize(org.hamcrest.Matcher<? super java.lang.Integer> sizeMatcher) { return OutputMatcherFactory.create(OutputWithSize.<E>outputWithSize(sizeMatcher)); }
static <E> OutputMatcher<E> function(org.hamcrest.Matcher<? super java.lang.Integer> sizeMatcher) { return OutputMatcherFactory.create(OutputWithSize.<E>outputWithSize(sizeMatcher)); }
/** * Creates a matcher for output that matches when the <code>size</code> of the output * satisfies the specified matcher. * * @param sizeMatcher a matcher for the length of an examined array */
Creates a matcher for output that matches when the <code>size</code> of the output satisfies the specified matcher
outputWithSize
{ "repo_name": "ottogroup/flink-spector", "path": "flinkspector-core/src/main/java/io/flinkspector/core/quantify/OutputMatchers.java", "license": "apache-2.0", "size": 3448 }
[ "io.flinkspector.core.quantify.records.OutputWithSize" ]
import io.flinkspector.core.quantify.records.OutputWithSize;
import io.flinkspector.core.quantify.records.*;
[ "io.flinkspector.core" ]
io.flinkspector.core;
593,043
return conv.compareTo(convInfo.conv); } } public ConversationPagerAdapter(Context context, Server server) { this.server = server; conversations = new LinkedList<ConversationInfo>(); views = new HashMap<Integer, View>(); }
return conv.compareTo(convInfo.conv); } } public ConversationPagerAdapter(Context context, Server server) { this.server = server; conversations = new LinkedList<ConversationInfo>(); views = new HashMap<Integer, View>(); }
/** * Compares this ConversationInfo with another ConversationInfo. * This compares the two ConversationInfos by their Conversations. * * @param convInfo The ConversationInfo to compare */
Compares this ConversationInfo with another ConversationInfo. This compares the two ConversationInfos by their Conversations
compareTo
{ "repo_name": "thelinuxgeekcommunity/simpleirc", "path": "application/src/main/java/tk/jordynsmediagroup/simpleirc/adapter/ConversationPagerAdapter.java", "license": "gpl-3.0", "size": 8750 }
[ "android.content.Context", "android.view.View", "java.util.HashMap", "java.util.LinkedList", "tk.jordynsmediagroup.simpleirc.model.Server" ]
import android.content.Context; import android.view.View; import java.util.HashMap; import java.util.LinkedList; import tk.jordynsmediagroup.simpleirc.model.Server;
import android.content.*; import android.view.*; import java.util.*; import tk.jordynsmediagroup.simpleirc.model.*;
[ "android.content", "android.view", "java.util", "tk.jordynsmediagroup.simpleirc" ]
android.content; android.view; java.util; tk.jordynsmediagroup.simpleirc;
1,480,236
@CheckReturnValue public Description.Builder buildDescription(DiagnosticPosition position) { return Description.builder(position, canonicalName(), linkUrl(), defaultSeverity(), message()); }
Description.Builder function(DiagnosticPosition position) { return Description.builder(position, canonicalName(), linkUrl(), defaultSeverity(), message()); }
/** * Returns a Description builder, which allows you to customize the diagnostic with a custom * message or multiple fixes. */
Returns a Description builder, which allows you to customize the diagnostic with a custom message or multiple fixes
buildDescription
{ "repo_name": "cushon/error-prone", "path": "check_api/src/main/java/com/google/errorprone/bugpatterns/BugChecker.java", "license": "apache-2.0", "size": 18518 }
[ "com.google.errorprone.matchers.Description", "com.sun.tools.javac.util.JCDiagnostic" ]
import com.google.errorprone.matchers.Description; import com.sun.tools.javac.util.JCDiagnostic;
import com.google.errorprone.matchers.*; import com.sun.tools.javac.util.*;
[ "com.google.errorprone", "com.sun.tools" ]
com.google.errorprone; com.sun.tools;
2,376,900
protected void handleHotDeployment(File webapp, List<WebContextParameter> webContextParams, List<Object> applicationEventListeners) throws CarbonException { String filename = webapp.getName(); if (webapp.isDirectory()) { handleExplodedWebappDeployment(webapp, webContextParams, applicationEventListeners); } else if (filename.endsWith(".war")) { handleWarWebappDeployment(webapp, webContextParams, applicationEventListeners); } else if (filename.endsWith(".zip")) { handleZipWebappDeployment(webapp, webContextParams, applicationEventListeners); } }
void function(File webapp, List<WebContextParameter> webContextParams, List<Object> applicationEventListeners) throws CarbonException { String filename = webapp.getName(); if (webapp.isDirectory()) { handleExplodedWebappDeployment(webapp, webContextParams, applicationEventListeners); } else if (filename.endsWith(".war")) { handleWarWebappDeployment(webapp, webContextParams, applicationEventListeners); } else if (filename.endsWith(".zip")) { handleZipWebappDeployment(webapp, webContextParams, applicationEventListeners); } }
/** * Hot deploy a webapp. i.e., deploy a webapp that has newly become available. * * @param webapp The webapp WAR or directory that needs to be deployed * @param webContextParams ServletContext params for this webapp * @param applicationEventListeners Application event listeners * @throws CarbonException If an error occurs during deployment */
Hot deploy a webapp. i.e., deploy a webapp that has newly become available
handleHotDeployment
{ "repo_name": "pubudu08/carbon-deployment", "path": "components/webapp-mgt/org.wso2.carbon.webapp.mgt/src/main/java/org/wso2/carbon/webapp/mgt/TomcatGenericWebappsDeployer.java", "license": "apache-2.0", "size": 29341 }
[ "java.io.File", "java.util.List", "org.wso2.carbon.CarbonException" ]
import java.io.File; import java.util.List; import org.wso2.carbon.CarbonException;
import java.io.*; import java.util.*; import org.wso2.carbon.*;
[ "java.io", "java.util", "org.wso2.carbon" ]
java.io; java.util; org.wso2.carbon;
851,034
public StorageType labStorageType() { return this.labStorageType; }
StorageType function() { return this.labStorageType; }
/** * Get the labStorageType value. * * @return the labStorageType value */
Get the labStorageType value
labStorageType
{ "repo_name": "martinsawicki/azure-sdk-for-java", "path": "azure-mgmt-devtestlab/src/main/java/com/microsoft/azure/management/devtestlab/implementation/LabInner.java", "license": "mit", "size": 6168 }
[ "com.microsoft.azure.management.devtestlab.StorageType" ]
import com.microsoft.azure.management.devtestlab.StorageType;
import com.microsoft.azure.management.devtestlab.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
2,486,077
public CorporateCommands contextCommands(String topicmapID, String viewmode, Session session, CorporateDirectives directives) { CorporateCommands commands = new CorporateCommands(as); // int editorContext = as.editorContext(topicmapID); commands.addNavigationCommands(this, editorContext, session); // EDITOR_CONTEXT_VIEW only // --- publish --- if (editorContext == EDITOR_CONTEXT_PERSONAL) { commands.addPublishCommand(getID(), session, directives); } // --- export --- commands.addSeparator(); commands.addExportCommand(session, directives); // commands.addStandardCommands(this, editorContext, viewmode, session, directives); // return commands; }
CorporateCommands function(String topicmapID, String viewmode, Session session, CorporateDirectives directives) { CorporateCommands commands = new CorporateCommands(as); commands.addNavigationCommands(this, editorContext, session); if (editorContext == EDITOR_CONTEXT_PERSONAL) { commands.addPublishCommand(getID(), session, directives); } commands.addSeparator(); commands.addExportCommand(session, directives); }
/** * Creates the action commands for a <code>TopicMapTopic</code> and returns them. * <p> * A <code>TopicMapTopic</code> provides two commands: <i>publishing</i> and * <i>exporting</i>. * * @see de.deepamehta.service.ApplicationService#showTopicMenu */
Creates the action commands for a <code>TopicMapTopic</code> and returns them. A <code>TopicMapTopic</code> provides two commands: publishing and exporting
contextCommands
{ "repo_name": "mukil/deepamehta2", "path": "develop/src/de/deepamehta/topics/TopicMapTopic.java", "license": "gpl-3.0", "size": 48623 }
[ "de.deepamehta.service.CorporateCommands", "de.deepamehta.service.CorporateDirectives", "de.deepamehta.service.Session" ]
import de.deepamehta.service.CorporateCommands; import de.deepamehta.service.CorporateDirectives; import de.deepamehta.service.Session;
import de.deepamehta.service.*;
[ "de.deepamehta.service" ]
de.deepamehta.service;
1,191,214
@Beta public String join(Iterable<? extends Entry<?, ?>> entries) { return join(entries.iterator()); }
String function(Iterable<? extends Entry<?, ?>> entries) { return join(entries.iterator()); }
/** * Returns a string containing the string representation of each entry in {@code entries}, using * the previously configured separator and key-value separator. * * @since 10.0 */
Returns a string containing the string representation of each entry in entries, using the previously configured separator and key-value separator
join
{ "repo_name": "wspeirs/sop4j-base", "path": "src/main/java/com/sop4j/base/google/common/base/Joiner.java", "license": "apache-2.0", "size": 16504 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,576,706
public void setEnabledTable(final String tableName) throws KeeperException { setTableState(tableName, ZooKeeperProtos.Table.State.ENABLED); }
void function(final String tableName) throws KeeperException { setTableState(tableName, ZooKeeperProtos.Table.State.ENABLED); }
/** * Sets the ENABLED state in the cache and creates or force updates a node to * ENABLED state for the specified table * * @param tableName * @throws org.apache.zookeeper.KeeperException */
Sets the ENABLED state in the cache and creates or force updates a node to ENABLED state for the specified table
setEnabledTable
{ "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", "org.apache.zookeeper.KeeperException" ]
import com.alibaba.wasp.protobuf.generated.ZooKeeperProtos; import org.apache.zookeeper.KeeperException;
import com.alibaba.wasp.protobuf.generated.*; import org.apache.zookeeper.*;
[ "com.alibaba.wasp", "org.apache.zookeeper" ]
com.alibaba.wasp; org.apache.zookeeper;
1,515,301
public void updateAbrufbestellposition( BestellpositionDto abrufbestellpositionDtoI, String sPreispflegeI, Integer artikellieferantstaffelIId_ZuAendern) throws ExceptionLP { try { bestellpositionFac .updateAbrufbestellposition(abrufbestellpositionDtoI, sPreispflegeI, artikellieferantstaffelIId_ZuAendern, LPMain.getTheClient()); } catch (Throwable t) { handleThrowable(t); } }
void function( BestellpositionDto abrufbestellpositionDtoI, String sPreispflegeI, Integer artikellieferantstaffelIId_ZuAendern) throws ExceptionLP { try { bestellpositionFac .updateAbrufbestellposition(abrufbestellpositionDtoI, sPreispflegeI, artikellieferantstaffelIId_ZuAendern, LPMain.getTheClient()); } catch (Throwable t) { handleThrowable(t); } }
/** * Eine Abrufbestellposition wird korrigiert. Damit mussen auch die Mengen * in der Rahmenbestellung angepasst werden. * * @param abrufbestellpositionDtoI * die Abrufbestellposition mit den aktuellen Werten * @throws ExceptionLP * Ausnahme */
Eine Abrufbestellposition wird korrigiert. Damit mussen auch die Mengen in der Rahmenbestellung angepasst werden
updateAbrufbestellposition
{ "repo_name": "erdincay/lpclientpc", "path": "src/com/lp/client/frame/delegate/BestellungDelegate.java", "license": "agpl-3.0", "size": 43582 }
[ "com.lp.client.frame.ExceptionLP", "com.lp.client.pc.LPMain", "com.lp.server.bestellung.service.BestellpositionDto" ]
import com.lp.client.frame.ExceptionLP; import com.lp.client.pc.LPMain; import com.lp.server.bestellung.service.BestellpositionDto;
import com.lp.client.frame.*; import com.lp.client.pc.*; import com.lp.server.bestellung.service.*;
[ "com.lp.client", "com.lp.server" ]
com.lp.client; com.lp.server;
2,583,393
public static Collection<QuestionContainerHeader> getClosedQuestionContainers(Connection con, QuestionContainerPK questionContainerPK) throws SQLException { SilverTrace.info("questionContainer", "QuestionContainerDAO.getClosedQuestionContainers()", "root.MSG_GEN_ENTER_METHOD", "questionContainerPK = " + questionContainerPK); ResultSet rs = null; QuestionContainerHeader questionContainerHeader = null; String selectStatement = "select " + QUESTIONCONTAINERCOLUMNNAMES + " from " + questionContainerPK.getTableName() + " where ( ? > qcEndDate " + " or qcIsClosed = 1 )" + " and instanceId = ? "; PreparedStatement prepStmt = null; try { prepStmt = con.prepareStatement(selectStatement); prepStmt.setString(1, formatter.format(new java.util.Date())); prepStmt.setString(2, questionContainerPK.getComponentName()); rs = prepStmt.executeQuery(); List<QuestionContainerHeader> list = new ArrayList<QuestionContainerHeader>(); while (rs.next()) { questionContainerHeader = getQuestionContainerHeaderFromResultSet(rs, questionContainerPK); list.add(questionContainerHeader); } return list; } finally { DBUtil.close(rs, prepStmt); } }
static Collection<QuestionContainerHeader> function(Connection con, QuestionContainerPK questionContainerPK) throws SQLException { SilverTrace.info(STR, STR, STR, STR + questionContainerPK); ResultSet rs = null; QuestionContainerHeader questionContainerHeader = null; String selectStatement = STR + QUESTIONCONTAINERCOLUMNNAMES + STR + questionContainerPK.getTableName() + STR + STR + STR; PreparedStatement prepStmt = null; try { prepStmt = con.prepareStatement(selectStatement); prepStmt.setString(1, formatter.format(new java.util.Date())); prepStmt.setString(2, questionContainerPK.getComponentName()); rs = prepStmt.executeQuery(); List<QuestionContainerHeader> list = new ArrayList<QuestionContainerHeader>(); while (rs.next()) { questionContainerHeader = getQuestionContainerHeaderFromResultSet(rs, questionContainerPK); list.add(questionContainerHeader); } return list; } finally { DBUtil.close(rs, prepStmt); } }
/** * Method declaration * @param con * @param questionContainerPK * @return * @throws SQLException * @see */
Method declaration
getClosedQuestionContainers
{ "repo_name": "CecileBONIN/Silverpeas-Core", "path": "ejb-core/questioncontainer/src/main/java/com/stratelia/webactiv/util/questionContainer/ejb/QuestionContainerDAO.java", "license": "agpl-3.0", "size": 27841 }
[ "com.stratelia.silverpeas.silvertrace.SilverTrace", "com.stratelia.webactiv.util.DBUtil", "com.stratelia.webactiv.util.questionContainer.model.QuestionContainerHeader", "com.stratelia.webactiv.util.questionContainer.model.QuestionContainerPK", "java.sql.Connection", "java.sql.PreparedStatement", "java.sql.ResultSet", "java.sql.SQLException", "java.util.ArrayList", "java.util.Collection", "java.util.List" ]
import com.stratelia.silverpeas.silvertrace.SilverTrace; import com.stratelia.webactiv.util.DBUtil; import com.stratelia.webactiv.util.questionContainer.model.QuestionContainerHeader; import com.stratelia.webactiv.util.questionContainer.model.QuestionContainerPK; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.Collection; import java.util.List;
import com.stratelia.silverpeas.silvertrace.*; import com.stratelia.webactiv.util.*; import java.sql.*; import java.util.*;
[ "com.stratelia.silverpeas", "com.stratelia.webactiv", "java.sql", "java.util" ]
com.stratelia.silverpeas; com.stratelia.webactiv; java.sql; java.util;
51,334
@GlobalFilesystem public static File injectStoreFile(ApplicationScope scope) { return new File(injectStore(scope)); }
static File function(ApplicationScope scope) { return new File(injectStore(scope)); }
/** * get the {@link File} object representing the base of the store. * * @param scope * the scope object. * @return the object. */
get the <code>File</code> object representing the base of the store
injectStoreFile
{ "repo_name": "sarah-happy/happy-archive", "path": "archive/src/main/java/org/yi/happy/archive/MyInjector.java", "license": "apache-2.0", "size": 15090 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
1,094,391
public static ProductCanonicalCondition createCanonicalCondition( @Nullable ProductCanonicalConditionCondition condition) { ProductCanonicalCondition productCanonicalCondition = new ProductCanonicalCondition(); productCanonicalCondition.setCondition(condition); return productCanonicalCondition; }
static ProductCanonicalCondition function( @Nullable ProductCanonicalConditionCondition condition) { ProductCanonicalCondition productCanonicalCondition = new ProductCanonicalCondition(); productCanonicalCondition.setCondition(condition); return productCanonicalCondition; }
/** * Creates a new ProductCanonicalCondition. * * @param condition may be null if creating an "other" dimension */
Creates a new ProductCanonicalCondition
createCanonicalCondition
{ "repo_name": "stoksey69/googleads-java-lib", "path": "modules/adwords_axis/src/main/java/com/google/api/ads/adwords/axis/utils/v201506/shopping/ProductDimensions.java", "license": "apache-2.0", "size": 6392 }
[ "com.google.api.ads.adwords.axis.v201506.cm.ProductCanonicalCondition", "com.google.api.ads.adwords.axis.v201506.cm.ProductCanonicalConditionCondition", "javax.annotation.Nullable" ]
import com.google.api.ads.adwords.axis.v201506.cm.ProductCanonicalCondition; import com.google.api.ads.adwords.axis.v201506.cm.ProductCanonicalConditionCondition; import javax.annotation.Nullable;
import com.google.api.ads.adwords.axis.v201506.cm.*; import javax.annotation.*;
[ "com.google.api", "javax.annotation" ]
com.google.api; javax.annotation;
1,653,401
public String toString() { switch (tag) { case JDWPConstants.Tag.BOOLEAN_TAG: return "boolean: " + getBooleanValue(); case JDWPConstants.Tag.BYTE_TAG: return "byte: " + getByteValue(); case JDWPConstants.Tag.CHAR_TAG: return "char: " + getCharValue(); case JDWPConstants.Tag.DOUBLE_TAG: return "double: " + getDoubleValue(); case JDWPConstants.Tag.FLOAT_TAG: return "float: " + getFloatValue(); case JDWPConstants.Tag.INT_TAG: return "int: " + getIntValue(); case JDWPConstants.Tag.LONG_TAG: return "long: " + getLongValue(); case JDWPConstants.Tag.SHORT_TAG: return "short: " + getShortValue(); case JDWPConstants.Tag.STRING_TAG: return "StringID: " + getLongValue(); case JDWPConstants.Tag.ARRAY_TAG: return "ObjectID: " + getLongValue(); case JDWPConstants.Tag.CLASS_LOADER_TAG: return "ClassLoaderID: " + getLongValue(); case JDWPConstants.Tag.CLASS_OBJECT_TAG: return "ClassObjectID: " + getLongValue(); case JDWPConstants.Tag.OBJECT_TAG: return "ObjectID: " + getLongValue(); case JDWPConstants.Tag.THREAD_GROUP_TAG: return "ThreadGroupID: " + getLongValue(); case JDWPConstants.Tag.THREAD_TAG: return "ThreadID: " + getLongValue(); } throw new TestErrorException("Illegal tag value: " + tag); }
String function() { switch (tag) { case JDWPConstants.Tag.BOOLEAN_TAG: return STR + getBooleanValue(); case JDWPConstants.Tag.BYTE_TAG: return STR + getByteValue(); case JDWPConstants.Tag.CHAR_TAG: return STR + getCharValue(); case JDWPConstants.Tag.DOUBLE_TAG: return STR + getDoubleValue(); case JDWPConstants.Tag.FLOAT_TAG: return STR + getFloatValue(); case JDWPConstants.Tag.INT_TAG: return STR + getIntValue(); case JDWPConstants.Tag.LONG_TAG: return STR + getLongValue(); case JDWPConstants.Tag.SHORT_TAG: return STR + getShortValue(); case JDWPConstants.Tag.STRING_TAG: return STR + getLongValue(); case JDWPConstants.Tag.ARRAY_TAG: return STR + getLongValue(); case JDWPConstants.Tag.CLASS_LOADER_TAG: return STR + getLongValue(); case JDWPConstants.Tag.CLASS_OBJECT_TAG: return STR + getLongValue(); case JDWPConstants.Tag.OBJECT_TAG: return STR + getLongValue(); case JDWPConstants.Tag.THREAD_GROUP_TAG: return STR + getLongValue(); case JDWPConstants.Tag.THREAD_TAG: return STR + getLongValue(); } throw new TestErrorException(STR + tag); }
/** * Converts this value to string representation for printing. */
Converts this value to string representation for printing
toString
{ "repo_name": "skyHALud/codenameone", "path": "Ports/iOSPort/xmlvm/apache-harmony-6.0-src-r991881/jdktools/modules/jpda/src/test/java/org/apache/harmony/jpda/tests/framework/jdwp/Value.java", "license": "gpl-2.0", "size": 8335 }
[ "org.apache.harmony.jpda.tests.framework.TestErrorException", "org.apache.harmony.jpda.tests.framework.jdwp.JDWPConstants" ]
import org.apache.harmony.jpda.tests.framework.TestErrorException; import org.apache.harmony.jpda.tests.framework.jdwp.JDWPConstants;
import org.apache.harmony.jpda.tests.framework.*; import org.apache.harmony.jpda.tests.framework.jdwp.*;
[ "org.apache.harmony" ]
org.apache.harmony;
2,702,534
ServiceInstance toServiceInstance() { ServiceInstance serviceInstance = new ServiceInstance(); serviceInstance.setName(destServiceInstanceName); serviceInstance.setServiceName(destServiceName); serviceInstance.setNodeType(destNodeType); serviceInstance.setEndpointName(destEndpointName); serviceInstance.setLatency(latency); serviceInstance.setStatus(status); serviceInstance.setResponseCode(responseCode); serviceInstance.setHttpResponseStatusCode(httpResponseStatusCode); serviceInstance.setRpcStatusCode(rpcStatusCode); serviceInstance.setType(type); serviceInstance.setTags(tags); serviceInstance.setTimeBucket(timeBucket); return serviceInstance; }
ServiceInstance toServiceInstance() { ServiceInstance serviceInstance = new ServiceInstance(); serviceInstance.setName(destServiceInstanceName); serviceInstance.setServiceName(destServiceName); serviceInstance.setNodeType(destNodeType); serviceInstance.setEndpointName(destEndpointName); serviceInstance.setLatency(latency); serviceInstance.setStatus(status); serviceInstance.setResponseCode(responseCode); serviceInstance.setHttpResponseStatusCode(httpResponseStatusCode); serviceInstance.setRpcStatusCode(rpcStatusCode); serviceInstance.setType(type); serviceInstance.setTags(tags); serviceInstance.setTimeBucket(timeBucket); return serviceInstance; }
/** * Service instance meta and metrics of {@link #destServiceInstanceName} related source. The metrics base on the OAL * scripts. */
Service instance meta and metrics of <code>#destServiceInstanceName</code> related source. The metrics base on the OAL scripts
toServiceInstance
{ "repo_name": "ascrutae/sky-walking", "path": "oap-server/analyzer/agent-analyzer/src/main/java/org/apache/skywalking/oap/server/analyzer/provider/trace/parser/listener/SourceBuilder.java", "license": "apache-2.0", "size": 12731 }
[ "org.apache.skywalking.oap.server.core.source.ServiceInstance" ]
import org.apache.skywalking.oap.server.core.source.ServiceInstance;
import org.apache.skywalking.oap.server.core.source.*;
[ "org.apache.skywalking" ]
org.apache.skywalking;
1,339,896
int generateTOC(final StringBuilder toc, final List<BlogPostHeaderMetadata> headerMetadataList, final int listIndex, final boolean[] haveUnclosedLiOnLevels) throws IOException { if (headerMetadataList.isEmpty()) { return 0; } int headersCnt = 0; if (listIndex < 0) { HashSet<String> hashSet = new HashSet<>(); for (BlogPostHeaderMetadata hm : headerMetadataList) { LogicAssert.assertTrue(hashSet.add(hm.headerIdForAnchor), "there're conflicted headers, %s", hm.headerIdForAnchor); } // "{{readmore}}" is added, else // append current time millis to html elements id, // since blog list page may include many TOC, it'll cause issue. final StringBuilder tocHeadHtml = AssetsLoader.readAssetAsText("html/toc-head.html"); StringUtils.replaceFirst(tocHeadHtml, "${toc-title}", blogPostInfoHolder.getLocale().equals("zh") ? "目录" : "Contents"); toc.append(tocHeadHtml); headersCnt = generateTOC(toc, headerMetadataList, 0, haveUnclosedLiOnLevels); toc.append(AssetsLoader.readAssetAsText("html/toc-tail.html")); } else { final int currentLevel = headerMetadataList.get(listIndex).level; toc.append("<ul>\n"); for (int i = listIndex, len = headerMetadataList.size(); i < len;) { final BlogPostHeaderMetadata hm = headerMetadataList.get(i); final int level = hm.level; if (level == currentLevel) { if (haveUnclosedLiOnLevels[currentLevel]) { toc.append("</li>\n"); } else { haveUnclosedLiOnLevels[currentLevel] = true; } toc.append("<li><a href=\"#").append(hm.headerIdForAnchor).append("\">") .append(hm.headerText).append("</a>"); i++; headersCnt++; } else if (level > currentLevel) { LogicAssert.assertTrue(level - currentLevel == 1, "invalid header: %s, previous level is %d", hm, currentLevel); final int subHeadersCnt = generateTOC(toc, headerMetadataList, i, haveUnclosedLiOnLevels); toc.append("</li>\n"); haveUnclosedLiOnLevels[currentLevel] = false; i += subHeadersCnt; headersCnt += subHeadersCnt; } else { // level < currentLevel , sub-headers finished if (haveUnclosedLiOnLevels[currentLevel]) { toc.append("</li>\n"); haveUnclosedLiOnLevels[currentLevel] = false; } break; } } if (haveUnclosedLiOnLevels[currentLevel]) { toc.append("</li>\n"); haveUnclosedLiOnLevels[currentLevel] = false; } toc.append("</ul>\n"); } return headersCnt; } static final class StrRegion { final String str; final int start; final int end; public StrRegion(String str, int start, int end) { this.str = str; this.start = start; this.end = end; }
int generateTOC(final StringBuilder toc, final List<BlogPostHeaderMetadata> headerMetadataList, final int listIndex, final boolean[] haveUnclosedLiOnLevels) throws IOException { if (headerMetadataList.isEmpty()) { return 0; } int headersCnt = 0; if (listIndex < 0) { HashSet<String> hashSet = new HashSet<>(); for (BlogPostHeaderMetadata hm : headerMetadataList) { LogicAssert.assertTrue(hashSet.add(hm.headerIdForAnchor), STR, hm.headerIdForAnchor); } final StringBuilder tocHeadHtml = AssetsLoader.readAssetAsText(STR); StringUtils.replaceFirst(tocHeadHtml, STR, blogPostInfoHolder.getLocale().equals("zh") ? "目录" : STR); toc.append(tocHeadHtml); headersCnt = generateTOC(toc, headerMetadataList, 0, haveUnclosedLiOnLevels); toc.append(AssetsLoader.readAssetAsText(STR)); } else { final int currentLevel = headerMetadataList.get(listIndex).level; toc.append(STR); for (int i = listIndex, len = headerMetadataList.size(); i < len;) { final BlogPostHeaderMetadata hm = headerMetadataList.get(i); final int level = hm.level; if (level == currentLevel) { if (haveUnclosedLiOnLevels[currentLevel]) { toc.append(STR); } else { haveUnclosedLiOnLevels[currentLevel] = true; } toc.append(STR#STR\">") .append(hm.headerText).append("</a>"); i++; headersCnt++; } else if (level > currentLevel) { LogicAssert.assertTrue(level - currentLevel == 1, STR, hm, currentLevel); final int subHeadersCnt = generateTOC(toc, headerMetadataList, i, haveUnclosedLiOnLevels); toc.append(STR); haveUnclosedLiOnLevels[currentLevel] = false; i += subHeadersCnt; headersCnt += subHeadersCnt; } else { if (haveUnclosedLiOnLevels[currentLevel]) { toc.append(STR); haveUnclosedLiOnLevels[currentLevel] = false; } break; } } if (haveUnclosedLiOnLevels[currentLevel]) { toc.append(STR); haveUnclosedLiOnLevels[currentLevel] = false; } toc.append(STR); } return headersCnt; } static final class StrRegion { final String str; final int start; final int end; public StrRegion(String str, int start, int end) { this.str = str; this.start = start; this.end = end; }
/** * it's invoked at the end of process * * @param toc * "table of contents" storage * @param headerMetadataList * complete header metadata list * @param listIndex * headerMetadataList index * @param haveUnclosedLiOnLevels * represent whether current level has unclosed &lt;li&gt;, it must be closed before * creating another same level &lt;li&gt;. Index [1,6] will be used for [h1,h6], so its * size must be greater than 7. * @return headers count */
it's invoked at the end of process
generateTOC
{ "repo_name": "zenzhong8383/BloggerClient", "path": "src/blogger/BlogPostProcessor.java", "license": "gpl-3.0", "size": 28814 }
[ "java.io.IOException", "java.util.HashSet", "java.util.List" ]
import java.io.IOException; import java.util.HashSet; import java.util.List;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
1,864,729
public static BigDecimal computeProbabilityOfConsecutiveHeadsB(int n, int k) { final int showdigits = 20; BigDecimal f = new BigDecimal( kStepFib( k, n + 2) ); BigDecimal p = new BigDecimal( (new BigInteger( "2" )).pow( n ) ); String fs = f.toString(); //System.out.println( "\nfib(" + k + "," + (n+2) + ") = " + fs.substring(0, showdigits) + " (" + (fs.length() - showdigits ) + " digits elided)" ); String ps = p.toString(); //System.out.println( "2^" + n + " = " + ps.substring(0, showdigits) + " (" + (ps.length() - showdigits ) + " digits elided)" ); BigDecimal answer = f.divide(p); answer = (new BigDecimal(1)).subtract(answer); String s = answer.toString(); //System.out.println( "Div = " + s.substring(0, showdigits ) + " (" + (s.length() - showdigits ) + " digits elided)" ); return answer; }
static BigDecimal function(int n, int k) { final int showdigits = 20; BigDecimal f = new BigDecimal( kStepFib( k, n + 2) ); BigDecimal p = new BigDecimal( (new BigInteger( "2" )).pow( n ) ); String fs = f.toString(); String ps = p.toString(); BigDecimal answer = f.divide(p); answer = (new BigDecimal(1)).subtract(answer); String s = answer.toString(); return answer; }
/** * Check http://marknelson.us/2011/01/17/20-heads-in-a-row-what-are-the-odds/ * for detailed explanation * @param n number of events (coin-tosses) * @param k number of consecutive heads * @return p the probability of having at least k consecutive heads */
Check HREF for detailed explanation
computeProbabilityOfConsecutiveHeadsB
{ "repo_name": "genomeartist/genomeartist", "path": "sources_java/guiTransposon/src/testing/probability/utils/ProbabilityDrafts.java", "license": "gpl-3.0", "size": 10525 }
[ "java.math.BigDecimal", "java.math.BigInteger" ]
import java.math.BigDecimal; import java.math.BigInteger;
import java.math.*;
[ "java.math" ]
java.math;
2,480,419
public void setCloseTickPaint(Paint paint) { this.closeTickPaint = paint; notifyListeners(new RendererChangeEvent(this)); }
void function(Paint paint) { this.closeTickPaint = paint; notifyListeners(new RendererChangeEvent(this)); }
/** * Sets the paint used to draw the ticks for the close values and sends a * {@link RendererChangeEvent} to all registered listeners. If you set * this to <code>null</code> (the default), the series paint is used * instead. * * @param paint the paint (<code>null</code> permitted). */
Sets the paint used to draw the ticks for the close values and sends a <code>RendererChangeEvent</code> to all registered listeners. If you set this to <code>null</code> (the default), the series paint is used instead
setCloseTickPaint
{ "repo_name": "raedle/univis", "path": "lib/jfreechart-1.0.1/src/org/jfree/chart/renderer/xy/HighLowRenderer.java", "license": "lgpl-2.1", "size": 17475 }
[ "java.awt.Paint", "org.jfree.chart.event.RendererChangeEvent" ]
import java.awt.Paint; import org.jfree.chart.event.RendererChangeEvent;
import java.awt.*; import org.jfree.chart.event.*;
[ "java.awt", "org.jfree.chart" ]
java.awt; org.jfree.chart;
759,153
boolean shouldRetry(Job submittedJob, int tryCount);
boolean shouldRetry(Job submittedJob, int tryCount);
/** * Check if the job should be retried * * @param submittedJob Job that ran and failed * @param tryCount How many times have we tried to run the job until now * * @return True iff job should be retried */
Check if the job should be retried
shouldRetry
{ "repo_name": "dcrankshaw/giraph", "path": "giraph-core/src/main/java/org/apache/giraph/job/GiraphJobRetryChecker.java", "license": "apache-2.0", "size": 1290 }
[ "org.apache.hadoop.mapreduce.Job" ]
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
1,033,833
public void refreshPlaylist(HlsUrl url) { playlistBundles.get(url).loadPlaylist(); }
void function(HlsUrl url) { playlistBundles.get(url).loadPlaylist(); }
/** * Triggers a playlist refresh and whitelists it. * * @param url The {@link HlsUrl} of the playlist to be refreshed. */
Triggers a playlist refresh and whitelists it
refreshPlaylist
{ "repo_name": "michalliu/ExoPlayer", "path": "library/hls/src/main/java/com/google/android/exoplayer2/source/hls/playlist/HlsPlaylistTracker.java", "license": "apache-2.0", "size": 21353 }
[ "com.google.android.exoplayer2.source.hls.playlist.HlsMasterPlaylist" ]
import com.google.android.exoplayer2.source.hls.playlist.HlsMasterPlaylist;
import com.google.android.exoplayer2.source.hls.playlist.*;
[ "com.google.android" ]
com.google.android;
1,577,662
protected BufferedImage create_MEASURED_VALUE_Image(final int WIDTH, final Color COLOR, final double ROTATION_OFFSET) { if (WIDTH <= 36) // 36 is needed otherwise the image size could be smaller than 1 { return UTIL.createImage(1, 1, Transparency.TRANSLUCENT); } final int IMAGE_HEIGHT = (int) (WIDTH * 0.0280373832); final int IMAGE_WIDTH = IMAGE_HEIGHT; final BufferedImage IMAGE = UTIL.createImage(IMAGE_WIDTH, IMAGE_HEIGHT, Transparency.TRANSLUCENT); final Graphics2D G2 = IMAGE.createGraphics(); G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); G2.rotate(ROTATION_OFFSET, IMAGE_WIDTH / 2.0, IMAGE_HEIGHT / 2.0); final GeneralPath INDICATOR = new GeneralPath(); INDICATOR.setWindingRule(Path2D.WIND_EVEN_ODD); INDICATOR.moveTo(IMAGE_WIDTH * 0.5, IMAGE_HEIGHT); INDICATOR.lineTo(0.0, 0.0); INDICATOR.lineTo(IMAGE_WIDTH, 0.0); INDICATOR.closePath(); G2.setColor(COLOR); G2.fill(INDICATOR); G2.dispose(); return IMAGE; }
BufferedImage function(final int WIDTH, final Color COLOR, final double ROTATION_OFFSET) { if (WIDTH <= 36) { return UTIL.createImage(1, 1, Transparency.TRANSLUCENT); } final int IMAGE_HEIGHT = (int) (WIDTH * 0.0280373832); final int IMAGE_WIDTH = IMAGE_HEIGHT; final BufferedImage IMAGE = UTIL.createImage(IMAGE_WIDTH, IMAGE_HEIGHT, Transparency.TRANSLUCENT); final Graphics2D G2 = IMAGE.createGraphics(); G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); G2.rotate(ROTATION_OFFSET, IMAGE_WIDTH / 2.0, IMAGE_HEIGHT / 2.0); final GeneralPath INDICATOR = new GeneralPath(); INDICATOR.setWindingRule(Path2D.WIND_EVEN_ODD); INDICATOR.moveTo(IMAGE_WIDTH * 0.5, IMAGE_HEIGHT); INDICATOR.lineTo(0.0, 0.0); INDICATOR.lineTo(IMAGE_WIDTH, 0.0); INDICATOR.closePath(); G2.setColor(COLOR); G2.fill(INDICATOR); G2.dispose(); return IMAGE; }
/** * Returns the image of the MinMeasuredValue and MaxMeasuredValue dependend * @param WIDTH * @param COLOR * @param ROTATION_OFFSET * @return the image of the min or max measured value */
Returns the image of the MinMeasuredValue and MaxMeasuredValue dependend
create_MEASURED_VALUE_Image
{ "repo_name": "hervegirod/j6dof-flight-sim", "path": "src/steelseries/eu/hansolo/steelseries/gauges/AbstractRadial.java", "license": "gpl-3.0", "size": 156025 }
[ "java.awt.Color", "java.awt.Graphics2D", "java.awt.RenderingHints", "java.awt.Transparency", "java.awt.geom.GeneralPath", "java.awt.geom.Path2D", "java.awt.image.BufferedImage" ]
import java.awt.Color; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.Transparency; import java.awt.geom.GeneralPath; import java.awt.geom.Path2D; import java.awt.image.BufferedImage;
import java.awt.*; import java.awt.geom.*; import java.awt.image.*;
[ "java.awt" ]
java.awt;
321,419
public CountDownLatch createChannelAsync(com.mozu.api.contracts.commerceruntime.channels.Channel channel, String responseFields, AsyncCallback<com.mozu.api.contracts.commerceruntime.channels.Channel> callback) throws Exception { MozuClient<com.mozu.api.contracts.commerceruntime.channels.Channel> client = com.mozu.api.clients.commerce.ChannelClient.createChannelClient( channel, responseFields); client.setContext(_apiContext); return client.executeRequest(callback); }
CountDownLatch function(com.mozu.api.contracts.commerceruntime.channels.Channel channel, String responseFields, AsyncCallback<com.mozu.api.contracts.commerceruntime.channels.Channel> callback) throws Exception { MozuClient<com.mozu.api.contracts.commerceruntime.channels.Channel> client = com.mozu.api.clients.commerce.ChannelClient.createChannelClient( channel, responseFields); client.setContext(_apiContext); return client.executeRequest(callback); }
/** * Creates a new channel that defines a new logical business division to use for financial reporting. * <p><pre><code> * Channel channel = new Channel(); * CountDownLatch latch = channel.createChannel( channel, responseFields, callback ); * latch.await() * </code></pre></p> * @param responseFields Use this field to include those fields which are not included by default. * @param callback callback handler for asynchronous operations * @param channel Properties of a channel used to divide a company into logical business divisions, such as "US Retail," "US Online," or "Amazon." All sites and orders are associated with a channel. * @return com.mozu.api.contracts.commerceruntime.channels.Channel * @see com.mozu.api.contracts.commerceruntime.channels.Channel * @see com.mozu.api.contracts.commerceruntime.channels.Channel */
Creates a new channel that defines a new logical business division to use for financial reporting. <code><code> Channel channel = new Channel(); CountDownLatch latch = channel.createChannel( channel, responseFields, callback ); latch.await() * </code></code>
createChannelAsync
{ "repo_name": "sanjaymandadi/mozu-java", "path": "mozu-javaasync-core/src/main/java/com/mozu/api/resources/commerce/ChannelResource.java", "license": "mit", "size": 20153 }
[ "com.mozu.api.AsyncCallback", "com.mozu.api.MozuClient", "java.util.concurrent.CountDownLatch" ]
import com.mozu.api.AsyncCallback; import com.mozu.api.MozuClient; import java.util.concurrent.CountDownLatch;
import com.mozu.api.*; import java.util.concurrent.*;
[ "com.mozu.api", "java.util" ]
com.mozu.api; java.util;
1,957,793
@Test public void testRemoveArray() { for(PlateDouble[] array : arrays) { StackDouble stack = new StackDouble(testStack); stack.add(array); stack.remove(array); assertFalse(stack.contains(array)); } }
void function() { for(PlateDouble[] array : arrays) { StackDouble stack = new StackDouble(testStack); stack.add(array); stack.remove(array); assertFalse(stack.contains(array)); } }
/** * Tests the remove method using a plate array. */
Tests the remove method using a plate array
testRemoveArray
{ "repo_name": "jessemull/MicroFlex", "path": "src/test/java/com/github/jessemull/microflex/plate/StackDoubleTest.java", "license": "apache-2.0", "size": 56531 }
[ "com.github.jessemull.microflex.doubleflex.plate.PlateDouble", "com.github.jessemull.microflex.doubleflex.plate.StackDouble", "org.junit.Assert" ]
import com.github.jessemull.microflex.doubleflex.plate.PlateDouble; import com.github.jessemull.microflex.doubleflex.plate.StackDouble; import org.junit.Assert;
import com.github.jessemull.microflex.doubleflex.plate.*; import org.junit.*;
[ "com.github.jessemull", "org.junit" ]
com.github.jessemull; org.junit;
255,130
public Property getProperty(String relPath) throws PathNotFoundException, RepositoryException { if (relPath.equals("jcr:data")) { return new FileDataProperty(_path); } else return super.getProperty(relPath); }
Property function(String relPath) throws PathNotFoundException, RepositoryException { if (relPath.equals(STR)) { return new FileDataProperty(_path); } else return super.getProperty(relPath); }
/** * Returns the property based on the relative path. */
Returns the property based on the relative path
getProperty
{ "repo_name": "christianchristensen/resin", "path": "modules/extra/src/com/caucho/jcr/file/FileContentNode.java", "license": "gpl-2.0", "size": 2586 }
[ "javax.jcr.PathNotFoundException", "javax.jcr.Property", "javax.jcr.RepositoryException" ]
import javax.jcr.PathNotFoundException; import javax.jcr.Property; import javax.jcr.RepositoryException;
import javax.jcr.*;
[ "javax.jcr" ]
javax.jcr;
1,183,993
public BaseTimer getTimer( String sipAppSessionId, Integer timerId) { if (c_logger.isTraceEntryExitEnabled()) { c_logger.traceEntry(null, "getTimer", new Object[]{sipAppSessionId, timerId}); } BaseTimer timer = m_timersRepository.get(sipAppSessionId,timerId); if (c_logger.isTraceEntryExitEnabled()) { c_logger.traceExit(null, "getTimer", timer); } return timer; }
BaseTimer function( String sipAppSessionId, Integer timerId) { if (c_logger.isTraceEntryExitEnabled()) { c_logger.traceEntry(null, STR, new Object[]{sipAppSessionId, timerId}); } BaseTimer timer = m_timersRepository.get(sipAppSessionId,timerId); if (c_logger.isTraceEntryExitEnabled()) { c_logger.traceExit(null, STR, timer); } return timer; }
/** * Get a timer from repository * @param sipAppSessionId - the owner SAS ID * @param timerId - the timer ID * @return the timer */
Get a timer from repository
getTimer
{ "repo_name": "kgibm/open-liberty", "path": "dev/com.ibm.ws.sipcontainer/src/com/ibm/ws/sip/container/failover/repository/SessionRepository.java", "license": "epl-1.0", "size": 17879 }
[ "com.ibm.ws.sip.container.timer.BaseTimer" ]
import com.ibm.ws.sip.container.timer.BaseTimer;
import com.ibm.ws.sip.container.timer.*;
[ "com.ibm.ws" ]
com.ibm.ws;
2,682,623
protected String getDatasource() { return null; } /** * Strips out the specified hooks. Pass in 'ALL' or {@link #REMOVE_ALL_HOOKS} * to remove all the hooks on the node. * @param node - root {@link JsonNode}
String function() { return null; } /** * Strips out the specified hooks. Pass in 'ALL' or {@link #REMOVE_ALL_HOOKS} * to remove all the hooks on the node. * @param node - root {@link JsonNode}
/** * Override to set the datasource values for all metadata to the returned * value of this method. By default <code>null</code> will be returned * disabling this feature. * @return String name of datasource to use in all metadata. */
Override to set the datasource values for all metadata to the returned value of this method. By default <code>null</code> will be returned disabling this feature
getDatasource
{ "repo_name": "BVulaj/lightblue-core", "path": "test/src/main/java/com/redhat/lightblue/test/AbstractCRUDTestController.java", "license": "gpl-3.0", "size": 11305 }
[ "com.fasterxml.jackson.databind.JsonNode" ]
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.*;
[ "com.fasterxml.jackson" ]
com.fasterxml.jackson;
1,336,722
public void removeAll (Iterator ids) { container.removeAll(ids); }
void function (Iterator ids) { container.removeAll(ids); }
/** * Removes the objects with the identifiers given by the iterator * <tt>ids</tt>.<br> * The default implementation calls <tt>remove(id)</tt> for each * identifier of <tt>ids</tt>. * * @param ids an iterator containing identifiers of objects. * @throws NoSuchElementException if an object with an identifier * of <tt>ids</tt> is not in the container. */
Removes the objects with the identifiers given by the iterator ids. The default implementation calls remove(id) for each identifier of ids
removeAll
{ "repo_name": "hannoman/xxl", "path": "src/xxl/core/collections/containers/DecoratorContainer.java", "license": "lgpl-3.0", "size": 20142 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
1,096,112
public void removeCurrentDirectoryChangedListener( CurrentDirectoryChangedListener listener ) { if ( listener != null ) { currentDirectoryChangedListeners.remove( listener ); } }
void function( CurrentDirectoryChangedListener listener ) { if ( listener != null ) { currentDirectoryChangedListeners.remove( listener ); } }
/** * Add a listener to be notified of design-time changes to current directory variable */
Add a listener to be notified of design-time changes to current directory variable
removeCurrentDirectoryChangedListener
{ "repo_name": "kurtwalker/pentaho-kettle", "path": "engine/src/main/java/org/pentaho/di/base/AbstractMeta.java", "license": "apache-2.0", "size": 55564 }
[ "org.pentaho.di.core.listeners.CurrentDirectoryChangedListener" ]
import org.pentaho.di.core.listeners.CurrentDirectoryChangedListener;
import org.pentaho.di.core.listeners.*;
[ "org.pentaho.di" ]
org.pentaho.di;
1,161,820
private static boolean shouldBeUploadedToSharedCache(ContainerImpl container, LocalResourceRequest resource) { return container.resourceSet.getResourcesUploadPolicies().get(resource); }
static boolean function(ContainerImpl container, LocalResourceRequest resource) { return container.resourceSet.getResourcesUploadPolicies().get(resource); }
/** * Returns whether the specific resource should be uploaded to the shared * cache. */
Returns whether the specific resource should be uploaded to the shared cache
shouldBeUploadedToSharedCache
{ "repo_name": "ctrezzo/hadoop", "path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/container/ContainerImpl.java", "license": "apache-2.0", "size": 86546 }
[ "org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.LocalResourceRequest" ]
import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.LocalResourceRequest;
import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
1,767,401
private boolean isFunctionInvokeAndPropAccess(Node n, String fnQualifiedName, Set<String> props) { // mode.getMode().localDev // mode [property] -> // getMode [call] // ${property} [string] if (!n.isGetProp()) { return false; } Node call = n.getFirstChild(); if (!call.isCall()) { return false; } Node fullQualifiedFnName = call.getFirstChild(); if (fullQualifiedFnName == null) { return false; } String qualifiedName = fullQualifiedFnName.getQualifiedName(); if (qualifiedName != null && qualifiedName.endsWith(fnQualifiedName)) { Node maybeProp = n.getSecondChild(); if (maybeProp != null && maybeProp.isString()) { String name = maybeProp.getString(); for (String prop : props) { if (prop == name) { return true; } } } } return false; }
boolean function(Node n, String fnQualifiedName, Set<String> props) { if (!n.isGetProp()) { return false; } Node call = n.getFirstChild(); if (!call.isCall()) { return false; } Node fullQualifiedFnName = call.getFirstChild(); if (fullQualifiedFnName == null) { return false; } String qualifiedName = fullQualifiedFnName.getQualifiedName(); if (qualifiedName != null && qualifiedName.endsWith(fnQualifiedName)) { Node maybeProp = n.getSecondChild(); if (maybeProp != null && maybeProp.isString()) { String name = maybeProp.getString(); for (String prop : props) { if (prop == name) { return true; } } } } return false; }
/** * Predicate for any <code>fnQualifiedName</code>.<code>props</code> call. * example: * isFunctionInvokeAndPropAccess(n, "getMode", "test"); // matches `getMode().test` */
Predicate for any <code>fnQualifiedName</code>.<code>props</code> call. example: isFunctionInvokeAndPropAccess(n, "getMode", "test"); // matches `getMode().test`
isFunctionInvokeAndPropAccess
{ "repo_name": "widespace-os/amphtml", "path": "build-system/runner/src/org/ampproject/AmpPass.java", "license": "apache-2.0", "size": 12038 }
[ "com.google.javascript.rhino.Node", "java.util.Set" ]
import com.google.javascript.rhino.Node; import java.util.Set;
import com.google.javascript.rhino.*; import java.util.*;
[ "com.google.javascript", "java.util" ]
com.google.javascript; java.util;
2,144,426
if (fig.getJrElement() instanceof JRDesignElement) { Rectangle r = fig.getBounds(); Graphics2D g = ComponentFigure.getG2D(graphics); if (g != null) { Stroke oldStroke = g.getStroke(); g.setStroke(J2DUtils.getInvertedZoomedStroke(oldStroke, graphics.getAbsoluteScale())); String tagValue = ""; String startString = ""; String fullString = ""; String endString = ""; boolean drawstart = false; boolean drawend = false; JRPropertiesMap v = fig.getJrElement().getPropertiesMap(); for (int i = 0; i < tags.length; i += 2) { String prop = tags[i]; String label = tags[i + 1]; tagValue = v.getProperty(prop); if (tagValue != null) { if (tagValue.equals("true")) { drawstart = true; fullString += label + " "; } else if (tagValue.equals(START)) { drawstart = true; startString += label + " "; } else if (tagValue.equals(END)) { drawend = true; endString = label + " " + endString; } } } if (drawstart) drawStart(g, r); if (drawend) drawEnd(g, r); Font f = g.getFont(); Color color = g.getColor(); startString = startString.trim(); endString = endString.trim(); fullString = fullString.trim(); g.setFont(JSS_TEXT_FONT); g.setColor(JSS_TEXT_COLOR); if (startString.length() > 0) { g.drawString(startString, r.x + 4, r.y + 11); } if (endString.length() > 0) { int strWidth = g.getFontMetrics().stringWidth(endString); g.drawString(endString, r.x + r.width - strWidth - 6, r.y + r.height - 6); } if (fullString.length() > 0) { int strWidth = 0; if (startString.length() > 0) strWidth = g.getFontMetrics().stringWidth(startString + " "); AttributedString as = new AttributedString(fullString); as.addAttribute(TextAttribute.FONT, g.getFont()); as.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON); g.drawString(as.getIterator(), r.x + 4 + strWidth, r.y + 11); } g.setFont(f); g.setColor(color); } } }
if (fig.getJrElement() instanceof JRDesignElement) { Rectangle r = fig.getBounds(); Graphics2D g = ComponentFigure.getG2D(graphics); if (g != null) { Stroke oldStroke = g.getStroke(); g.setStroke(J2DUtils.getInvertedZoomedStroke(oldStroke, graphics.getAbsoluteScale())); String tagValue = STRSTRSTRSTRtrueSTR STR STR STR "); AttributedString as = new AttributedString(fullString); as.addAttribute(TextAttribute.FONT, g.getFont()); as.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON); g.drawString(as.getIterator(), r.x + 4 + strWidth, r.y + 11); } g.setFont(f); g.setColor(color); } } }
/** * Print on the element it's selected xsl tags */
Print on the element it's selected xsl tags
paint
{ "repo_name": "OpenSoftwareSolutions/PDFReporter-Studio", "path": "com.jaspersoft.studio/src/com/jaspersoft/studio/editor/gef/decorator/xls/XLSDecorator.java", "license": "lgpl-3.0", "size": 8027 }
[ "com.jaspersoft.studio.editor.gef.figures.ComponentFigure", "com.jaspersoft.studio.editor.java2d.J2DUtils", "java.awt.Graphics2D", "java.awt.Stroke", "java.awt.font.TextAttribute", "java.text.AttributedString", "net.sf.jasperreports.engine.design.JRDesignElement", "org.eclipse.draw2d.geometry.Rectangle" ]
import com.jaspersoft.studio.editor.gef.figures.ComponentFigure; import com.jaspersoft.studio.editor.java2d.J2DUtils; import java.awt.Graphics2D; import java.awt.Stroke; import java.awt.font.TextAttribute; import java.text.AttributedString; import net.sf.jasperreports.engine.design.JRDesignElement; import org.eclipse.draw2d.geometry.Rectangle;
import com.jaspersoft.studio.editor.gef.figures.*; import com.jaspersoft.studio.editor.java2d.*; import java.awt.*; import java.awt.font.*; import java.text.*; import net.sf.jasperreports.engine.design.*; import org.eclipse.draw2d.geometry.*;
[ "com.jaspersoft.studio", "java.awt", "java.text", "net.sf.jasperreports", "org.eclipse.draw2d" ]
com.jaspersoft.studio; java.awt; java.text; net.sf.jasperreports; org.eclipse.draw2d;
1,420,117
public static int getColumnNumber(Configuration conf) { return conf.getInt(RCFile.COLUMN_NUMBER_CONF_STR, 0); }
static int function(Configuration conf) { return conf.getInt(RCFile.COLUMN_NUMBER_CONF_STR, 0); }
/** * Returns the number of columns set in the conf for writers. * * @param conf * @return number of columns for RCFile's writer */
Returns the number of columns set in the conf for writers
getColumnNumber
{ "repo_name": "canojim/elephant-bird", "path": "rcfile/src/main/java/com/twitter/elephantbird/mapreduce/output/RCFileOutputFormat.java", "license": "apache-2.0", "size": 4516 }
[ "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.hive.ql.io.RCFile" ]
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hive.ql.io.RCFile;
import org.apache.hadoop.conf.*; import org.apache.hadoop.hive.ql.io.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
1,712,750
ModelAndView mav = new ModelAndView("students"); mav.addObject("allstudents", studentService.getAllStudents()); mav.addObject("school_name", Global.SCHOOL_NAME); return mav; }
ModelAndView mav = new ModelAndView(STR); mav.addObject(STR, studentService.getAllStudents()); mav.addObject(STR, Global.SCHOOL_NAME); return mav; }
/** * Gets the list of all users. * * @return the list of all users */
Gets the list of all users
getAllStudents
{ "repo_name": "cs3250-team6/msubanner", "path": "src/main/java/edu/msudenver/cs3250/group6/msubanner/controllers/StudentController.java", "license": "mit", "size": 5909 }
[ "edu.msudenver.cs3250.group6.msubanner.Global", "org.springframework.web.servlet.ModelAndView" ]
import edu.msudenver.cs3250.group6.msubanner.Global; import org.springframework.web.servlet.ModelAndView;
import edu.msudenver.cs3250.group6.msubanner.*; import org.springframework.web.servlet.*;
[ "edu.msudenver.cs3250", "org.springframework.web" ]
edu.msudenver.cs3250; org.springframework.web;
2,022,651
List<Integer> getEmpty();
List<Integer> getEmpty();
/** * Get empty array value []. * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the List&lt;Integer&gt; object if successful. */
Get empty array value []
getEmpty
{ "repo_name": "balajikris/autorest", "path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/bodyarray/Arrays.java", "license": "mit", "size": 104816 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
120,423
@Source("com/google/appinventor/images/slider.png") ImageResource slider();
@Source(STR) ImageResource slider();
/** * Designer palette item: Slider */
Designer palette item: Slider
slider
{ "repo_name": "jisqyv/appinventor-sources", "path": "appinventor/appengine/src/com/google/appinventor/client/Images.java", "license": "apache-2.0", "size": 19490 }
[ "com.google.gwt.resources.client.ImageResource" ]
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.resources.client.*;
[ "com.google.gwt" ]
com.google.gwt;
1,697,617
ControllerServiceEntity getControllerService(String controllerServiceId);
ControllerServiceEntity getControllerService(String controllerServiceId);
/** * Gets the specified controller service. * * @param controllerServiceId id * @return service */
Gets the specified controller service
getControllerService
{ "repo_name": "jskora/nifi", "path": "nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiServiceFacade.java", "license": "apache-2.0", "size": 83710 }
[ "org.apache.nifi.web.api.entity.ControllerServiceEntity" ]
import org.apache.nifi.web.api.entity.ControllerServiceEntity;
import org.apache.nifi.web.api.entity.*;
[ "org.apache.nifi" ]
org.apache.nifi;
1,253,484
private PendingIntent getIgnoredPendingIntent(Context context) { Intent ankiDroidIntent = new Intent(context, UpdateService.class); ankiDroidIntent.setAction(ACTION_IGNORE); return PendingIntent.getService(context, 0, ankiDroidIntent, 0); }
PendingIntent function(Context context) { Intent ankiDroidIntent = new Intent(context, UpdateService.class); ankiDroidIntent.setAction(ACTION_IGNORE); return PendingIntent.getService(context, 0, ankiDroidIntent, 0); }
/** * Returns a pending intent that is ignored by the service. */
Returns a pending intent that is ignored by the service
getIgnoredPendingIntent
{ "repo_name": "nachtfisch/Anki-Android", "path": "src/com/ichi2/widget/AnkiDroidWidgetMedium.java", "license": "gpl-3.0", "size": 16287 }
[ "android.app.PendingIntent", "android.content.Context", "android.content.Intent" ]
import android.app.PendingIntent; import android.content.Context; import android.content.Intent;
import android.app.*; import android.content.*;
[ "android.app", "android.content" ]
android.app; android.content;
2,263,218
HandlerRegistration addGeometryIndexDeselectedHandler(GeometryIndexDeselectedHandler handler);
HandlerRegistration addGeometryIndexDeselectedHandler(GeometryIndexDeselectedHandler handler);
/** * Register a {@link GeometryIndexDeselectedHandler} to listen to deselection events of sub-geometries, vertices and * edges. * * @param handler * The {@link GeometryIndexDeselectedHandler} to add as listener. * @return The registration of the handler. */
Register a <code>GeometryIndexDeselectedHandler</code> to listen to deselection events of sub-geometries, vertices and edges
addGeometryIndexDeselectedHandler
{ "repo_name": "olivermay/geomajas", "path": "plugin/geomajas-plugin-editing/editing/src/main/java/org/geomajas/plugin/editing/client/service/GeometryIndexStateService.java", "license": "agpl-3.0", "size": 11385 }
[ "com.google.gwt.event.shared.HandlerRegistration", "org.geomajas.plugin.editing.client.event.state.GeometryIndexDeselectedHandler" ]
import com.google.gwt.event.shared.HandlerRegistration; import org.geomajas.plugin.editing.client.event.state.GeometryIndexDeselectedHandler;
import com.google.gwt.event.shared.*; import org.geomajas.plugin.editing.client.event.state.*;
[ "com.google.gwt", "org.geomajas.plugin" ]
com.google.gwt; org.geomajas.plugin;
867,515
public void addView(View view) { throw new RuntimeException("Not supported with MergeSpinnerAdapter"); }
void function(View view) { throw new RuntimeException(STR); }
/** * Adds a new View to the roster of things to appear in * the aggregate list. * * @param view * Single view to add */
Adds a new View to the roster of things to appear in the aggregate list
addView
{ "repo_name": "haodynasty/AndroidBleManager", "path": "app/src/main/java/com/blakequ/androidblemanager/adapter/viewadapter/MergeSpinnerAdapter.java", "license": "apache-2.0", "size": 3089 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
2,130,373
public Collection getQueuedOrphans(String entityName);
Collection function(String entityName);
/** * Get the "queued" orphans * * @param entityName The name of the entity that makes up the elements * * @return The orphaned elements */
Get the "queued" orphans
getQueuedOrphans
{ "repo_name": "kevin-chen-hw/LDAE", "path": "com.huawei.soa.ldae/src/main/java/org/hibernate/collection/spi/PersistentCollection.java", "license": "lgpl-2.1", "size": 13745 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
1,286,552
@Test public void testOverwriteRow() { TupleMetadata schema = new SchemaBuilder() .add("a", MinorType.INT) .addMapArray("m") .add("b", MinorType.INT) .add("c", MinorType.VARCHAR) .resumeSchema() .buildSchema(); ResultSetLoaderImpl.ResultSetOptions options = new OptionBuilder() .setSchema(schema) .setRowCountLimit(ValueVector.MAX_ROW_COUNT) .build(); ResultSetLoader rsLoader = new ResultSetLoaderImpl(fixture.allocator(), options); RowSetLoader rootWriter = rsLoader.writer(); // Can't use the shortcut to populate rows when doing overwrites. ScalarWriter aWriter = rootWriter.scalar("a"); ArrayWriter maWriter = rootWriter.array("m"); TupleWriter mWriter = maWriter.tuple(); ScalarWriter bWriter = mWriter.scalar("b"); ScalarWriter cWriter = mWriter.scalar("c"); // Write 100,000 rows, overwriting 99% of them. This will cause vector // overflow and data corruption if overwrite does not work; but will happily // produce the correct result if everything works as it should. byte value[] = new byte[512]; Arrays.fill(value, (byte) 'X'); int count = 0; rsLoader.startBatch(); while (count < 10_000) { rootWriter.start(); count++; aWriter.setInt(count); for (int i = 0; i < 10; i++) { bWriter.setInt(count * 10 + i); cWriter.setBytes(value, value.length); maWriter.save(); } if (count % 100 == 0) { rootWriter.save(); } } // Verify using a reader. RowSet result = fixture.wrap(rsLoader.harvest()); assertEquals(count / 100, result.rowCount()); RowSetReader reader = result.reader(); ArrayReader maReader = reader.array("m"); TupleReader mReader = maReader.tuple(); int rowId = 1; while (reader.next()) { assertEquals(rowId * 100, reader.scalar("a").getInt()); assertEquals(10, maReader.size()); for (int i = 0; i < 10; i++) { assert(maReader.next()); assertEquals(rowId * 1000 + i, mReader.scalar("b").getInt()); assertTrue(Arrays.equals(value, mReader.scalar("c").getBytes())); } rowId++; } result.clear(); rsLoader.close(); }
void function() { TupleMetadata schema = new SchemaBuilder() .add("a", MinorType.INT) .addMapArray("m") .add("b", MinorType.INT) .add("c", MinorType.VARCHAR) .resumeSchema() .buildSchema(); ResultSetLoaderImpl.ResultSetOptions options = new OptionBuilder() .setSchema(schema) .setRowCountLimit(ValueVector.MAX_ROW_COUNT) .build(); ResultSetLoader rsLoader = new ResultSetLoaderImpl(fixture.allocator(), options); RowSetLoader rootWriter = rsLoader.writer(); ScalarWriter aWriter = rootWriter.scalar("a"); ArrayWriter maWriter = rootWriter.array("m"); TupleWriter mWriter = maWriter.tuple(); ScalarWriter bWriter = mWriter.scalar("b"); ScalarWriter cWriter = mWriter.scalar("c"); byte value[] = new byte[512]; Arrays.fill(value, (byte) 'X'); int count = 0; rsLoader.startBatch(); while (count < 10_000) { rootWriter.start(); count++; aWriter.setInt(count); for (int i = 0; i < 10; i++) { bWriter.setInt(count * 10 + i); cWriter.setBytes(value, value.length); maWriter.save(); } if (count % 100 == 0) { rootWriter.save(); } } RowSet result = fixture.wrap(rsLoader.harvest()); assertEquals(count / 100, result.rowCount()); RowSetReader reader = result.reader(); ArrayReader maReader = reader.array("m"); TupleReader mReader = maReader.tuple(); int rowId = 1; while (reader.next()) { assertEquals(rowId * 100, reader.scalar("a").getInt()); assertEquals(10, maReader.size()); for (int i = 0; i < 10; i++) { assert(maReader.next()); assertEquals(rowId * 1000 + i, mReader.scalar("b").getInt()); assertTrue(Arrays.equals(value, mReader.scalar("c").getBytes())); } rowId++; } result.clear(); rsLoader.close(); }
/** * Version of the {#link TestResultSetLoaderProtocol#testOverwriteRow()} test * that uses nested columns inside an array of maps. Here we must call * <tt>start()</tt> to reset the array back to the initial start position after * each "discard." */
Version of the {#link TestResultSetLoaderProtocol#testOverwriteRow()} test that uses nested columns inside an array of maps. Here we must call start() to reset the array back to the initial start position after each "discard."
testOverwriteRow
{ "repo_name": "Ben-Zvi/drill", "path": "exec/java-exec/src/test/java/org/apache/drill/exec/physical/resultSet/impl/TestResultSetLoaderMapArray.java", "license": "apache-2.0", "size": 17794 }
[ "java.util.Arrays", "org.apache.drill.common.types.TypeProtos", "org.apache.drill.exec.physical.resultSet.ResultSetLoader", "org.apache.drill.exec.physical.resultSet.RowSetLoader", "org.apache.drill.exec.physical.rowSet.RowSet", "org.apache.drill.exec.physical.rowSet.RowSetReader", "org.apache.drill.exec.record.metadata.SchemaBuilder", "org.apache.drill.exec.record.metadata.TupleMetadata", "org.apache.drill.exec.vector.ValueVector", "org.apache.drill.exec.vector.accessor.ArrayReader", "org.apache.drill.exec.vector.accessor.ArrayWriter", "org.apache.drill.exec.vector.accessor.ScalarWriter", "org.apache.drill.exec.vector.accessor.TupleReader", "org.apache.drill.exec.vector.accessor.TupleWriter", "org.junit.Assert" ]
import java.util.Arrays; import org.apache.drill.common.types.TypeProtos; import org.apache.drill.exec.physical.resultSet.ResultSetLoader; import org.apache.drill.exec.physical.resultSet.RowSetLoader; import org.apache.drill.exec.physical.rowSet.RowSet; import org.apache.drill.exec.physical.rowSet.RowSetReader; import org.apache.drill.exec.record.metadata.SchemaBuilder; import org.apache.drill.exec.record.metadata.TupleMetadata; import org.apache.drill.exec.vector.ValueVector; import org.apache.drill.exec.vector.accessor.ArrayReader; import org.apache.drill.exec.vector.accessor.ArrayWriter; import org.apache.drill.exec.vector.accessor.ScalarWriter; import org.apache.drill.exec.vector.accessor.TupleReader; import org.apache.drill.exec.vector.accessor.TupleWriter; import org.junit.Assert;
import java.util.*; import org.apache.drill.common.types.*; import org.apache.drill.exec.physical.*; import org.apache.drill.exec.record.metadata.*; import org.apache.drill.exec.vector.*; import org.apache.drill.exec.vector.accessor.*; import org.junit.*;
[ "java.util", "org.apache.drill", "org.junit" ]
java.util; org.apache.drill; org.junit;
2,576,446
int insert(@Param("record") ConnectionRecordModel record);
int insert(@Param(STR) ConnectionRecordModel record);
/** * Inserts the given connection record. * * @param record * The connection record to insert. * * @return * The number of rows inserted. */
Inserts the given connection record
insert
{ "repo_name": "mike-jumper/incubator-guacamole-client", "path": "extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.java", "license": "apache-2.0", "size": 5203 }
[ "org.apache.ibatis.annotations.Param" ]
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.*;
[ "org.apache.ibatis" ]
org.apache.ibatis;
1,194,466
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); if (null == connectivityManager) return Connectivity.NO_INTERNET; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { Network activeNetwork = connectivityManager.getActiveNetwork(); if (null == activeNetwork) return Connectivity.NO_INTERNET; NetworkCapabilities actNw = connectivityManager.getNetworkCapabilities(activeNetwork); if (null == actNw) return Connectivity.NO_INTERNET; // Below code _does not_ detect wifi properly when there's a VPN on -> using WifiManager instead (!) WifiManager wifiManager = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE); if (wifiManager != null && wifiManager.isWifiEnabled() && wifiManager.getConnectionInfo().getBSSID() != null) return Connectivity.WIFI; else return Connectivity.OTHER; } else { NetworkInfo info = connectivityManager.getActiveNetworkInfo(); if (null == info) return Connectivity.NO_INTERNET; NetworkInfo mWifi = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI); if (mWifi != null && mWifi.isConnected()) return Connectivity.WIFI; else return Connectivity.OTHER; } }
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); if (null == connectivityManager) return Connectivity.NO_INTERNET; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { Network activeNetwork = connectivityManager.getActiveNetwork(); if (null == activeNetwork) return Connectivity.NO_INTERNET; NetworkCapabilities actNw = connectivityManager.getNetworkCapabilities(activeNetwork); if (null == actNw) return Connectivity.NO_INTERNET; WifiManager wifiManager = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE); if (wifiManager != null && wifiManager.isWifiEnabled() && wifiManager.getConnectionInfo().getBSSID() != null) return Connectivity.WIFI; else return Connectivity.OTHER; } else { NetworkInfo info = connectivityManager.getActiveNetworkInfo(); if (null == info) return Connectivity.NO_INTERNET; NetworkInfo mWifi = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI); if (mWifi != null && mWifi.isConnected()) return Connectivity.WIFI; else return Connectivity.OTHER; } }
/** * Return the device's current connectivity * * @param context Context to be used * @return Device's current connectivity */
Return the device's current connectivity
getConnectivity
{ "repo_name": "AVnetWS/Hentoid", "path": "app/src/main/java/me/devsaki/hentoid/util/network/NetworkHelper.java", "license": "apache-2.0", "size": 3809 }
[ "android.content.Context", "android.net.ConnectivityManager", "android.net.Network", "android.net.NetworkCapabilities", "android.net.NetworkInfo", "android.net.wifi.WifiManager", "android.os.Build" ]
import android.content.Context; import android.net.ConnectivityManager; import android.net.Network; import android.net.NetworkCapabilities; import android.net.NetworkInfo; import android.net.wifi.WifiManager; import android.os.Build;
import android.content.*; import android.net.*; import android.net.wifi.*; import android.os.*;
[ "android.content", "android.net", "android.os" ]
android.content; android.net; android.os;
341,358
public Principal get(String id) { return (Principal) _cache.get(id); }
Principal function(String id) { return (Principal) _cache.get(id); }
/** * Returns any saved single signon entry. */
Returns any saved single signon entry
get
{ "repo_name": "mdaniel/svn-caucho-com-resin", "path": "modules/resin/src/com/caucho/security/ClusterSingleSignon.java", "license": "gpl-2.0", "size": 2686 }
[ "java.security.Principal" ]
import java.security.Principal;
import java.security.*;
[ "java.security" ]
java.security;
316,604
PolIsikudVastus findPolIsiku(String isikukood, String eesnimi, String perenimi, Date synniaeg) throws XRoadServiceConsumptionException;
PolIsikudVastus findPolIsiku(String isikukood, String eesnimi, String perenimi, Date synniaeg) throws XRoadServiceConsumptionException;
/** * <code>liiklusregister.pol_isikud.v1</code> service. */
<code>liiklusregister.pol_isikud.v1</code> service
findPolIsiku
{ "repo_name": "nortal/j-road", "path": "client-service/liiklusregister/src/main/java/com/nortal/jroad/client/liiklusregister/LiiklusregisterXTeeService.java", "license": "apache-2.0", "size": 2875 }
[ "com.nortal.jroad.client.exception.XRoadServiceConsumptionException", "com.nortal.jroad.client.liiklusregister.types.ee.riik.xtee.liiklusregister.producers.producer.liiklusregister.PolIsikudVastus", "java.util.Date" ]
import com.nortal.jroad.client.exception.XRoadServiceConsumptionException; import com.nortal.jroad.client.liiklusregister.types.ee.riik.xtee.liiklusregister.producers.producer.liiklusregister.PolIsikudVastus; import java.util.Date;
import com.nortal.jroad.client.exception.*; import com.nortal.jroad.client.liiklusregister.types.ee.riik.xtee.liiklusregister.producers.producer.liiklusregister.*; import java.util.*;
[ "com.nortal.jroad", "java.util" ]
com.nortal.jroad; java.util;
529,106
private void processPartition(GridDhtLocalPartition part, SchemaIndexCacheVisitorClosure clo) throws IgniteCheckedException { checkCancelled(); boolean reserved = false; if (part != null && part.state() != EVICTED) reserved = (part.state() == OWNING || part.state() == RENTING) && part.reserve(); if (!reserved) return; try { GridCursor<? extends CacheDataRow> cursor = part.dataStore().cursor(cctx.cacheId(), null, null, CacheDataRowAdapter.RowData.KEY_ONLY); boolean locked = false; try { int cntr = 0; while (cursor.next()) { KeyCacheObject key = cursor.get().key(); if (!locked) { cctx.shared().database().checkpointReadLock(); locked = true; } processKey(key, clo); if (++cntr % BATCH_SIZE == 0) { cctx.shared().database().checkpointReadUnlock(); locked = false; } if (part.state() == RENTING) break; } } finally { if (locked) cctx.shared().database().checkpointReadUnlock(); } } finally { part.release(); } }
void function(GridDhtLocalPartition part, SchemaIndexCacheVisitorClosure clo) throws IgniteCheckedException { checkCancelled(); boolean reserved = false; if (part != null && part.state() != EVICTED) reserved = (part.state() == OWNING part.state() == RENTING) && part.reserve(); if (!reserved) return; try { GridCursor<? extends CacheDataRow> cursor = part.dataStore().cursor(cctx.cacheId(), null, null, CacheDataRowAdapter.RowData.KEY_ONLY); boolean locked = false; try { int cntr = 0; while (cursor.next()) { KeyCacheObject key = cursor.get().key(); if (!locked) { cctx.shared().database().checkpointReadLock(); locked = true; } processKey(key, clo); if (++cntr % BATCH_SIZE == 0) { cctx.shared().database().checkpointReadUnlock(); locked = false; } if (part.state() == RENTING) break; } } finally { if (locked) cctx.shared().database().checkpointReadUnlock(); } } finally { part.release(); } }
/** * Process partition. * * @param part Partition. * @param clo Index closure. * @throws IgniteCheckedException If failed. */
Process partition
processPartition
{ "repo_name": "dream-x/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorImpl.java", "license": "apache-2.0", "size": 6759 }
[ "org.apache.ignite.IgniteCheckedException", "org.apache.ignite.internal.processors.cache.KeyCacheObject", "org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition", "org.apache.ignite.internal.processors.cache.persistence.CacheDataRow", "org.apache.ignite.internal.processors.cache.persistence.CacheDataRowAdapter", "org.apache.ignite.internal.util.lang.GridCursor" ]
import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.internal.processors.cache.KeyCacheObject; import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition; import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow; import org.apache.ignite.internal.processors.cache.persistence.CacheDataRowAdapter; import org.apache.ignite.internal.util.lang.GridCursor;
import org.apache.ignite.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.distributed.dht.*; import org.apache.ignite.internal.processors.cache.persistence.*; import org.apache.ignite.internal.util.lang.*;
[ "org.apache.ignite" ]
org.apache.ignite;
1,290,885
public boolean isOptOut() { synchronized (optOutLock) { try { // Reload the metrics file configuration.load(getConfigFile()); } catch (IOException ex) { if (debug) { Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage()); } return true; } catch (InvalidConfigurationException ex) { if (debug) { Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage()); } return true; } return configuration.getBoolean("opt-out", false); } }
boolean function() { synchronized (optOutLock) { try { configuration.load(getConfigFile()); } catch (IOException ex) { if (debug) { Bukkit.getLogger().log(Level.INFO, STR + ex.getMessage()); } return true; } catch (InvalidConfigurationException ex) { if (debug) { Bukkit.getLogger().log(Level.INFO, STR + ex.getMessage()); } return true; } return configuration.getBoolean(STR, false); } }
/** * Has the server owner denied plugin metrics? * * @return true if metrics should be opted out of it */
Has the server owner denied plugin metrics
isOptOut
{ "repo_name": "BurkeyOnline/UltraShop", "path": "UltraShopp/src/main/java/com/cjburkey/plugin/ushop/stat/Metrics.java", "license": "mit", "size": 25687 }
[ "java.io.IOException", "java.util.logging.Level", "org.bukkit.Bukkit", "org.bukkit.configuration.InvalidConfigurationException" ]
import java.io.IOException; import java.util.logging.Level; import org.bukkit.Bukkit; import org.bukkit.configuration.InvalidConfigurationException;
import java.io.*; import java.util.logging.*; import org.bukkit.*; import org.bukkit.configuration.*;
[ "java.io", "java.util", "org.bukkit", "org.bukkit.configuration" ]
java.io; java.util; org.bukkit; org.bukkit.configuration;
120,887
public BundleContext getBundleContext() { return m_context; }
BundleContext function() { return m_context; }
/** * Returns reference to this bundle's <code>BundleContext</code> * * @return This bundle's <code>BundleContext</code> */
Returns reference to this bundle's <code>BundleContext</code>
getBundleContext
{ "repo_name": "akquinet/osgi-deployment-admin", "path": "deployment-admin-impl/src/main/java/de/akquinet/gomobile/deploymentadmin/DeploymentAdminImpl.java", "license": "apache-2.0", "size": 22512 }
[ "org.osgi.framework.BundleContext" ]
import org.osgi.framework.BundleContext;
import org.osgi.framework.*;
[ "org.osgi.framework" ]
org.osgi.framework;
1,803,151
protected List<String> scan(Path path) { try { List<String> files = Lists.newArrayList(); if(java.nio.file.Files.isDirectory(path)) { Iterator<Path> it = java.nio.file.Files .newDirectoryStream(path).iterator(); while (it.hasNext()) { files.addAll(scan(it.next())); } } else { files.add(path.toString()); } return files; } catch (IOException e) { throw Throwables.propagate(e); } } protected static class ImportOptions extends Options { @Parameter(names = { "-d", "--data" }, description = "The path to the file or directory to import", required = true) public String data; @Parameter(names = "--numThreads", description = "The number of worker threads to use for a multithreaded import") public int numThreads = 1; @Parameter(names = { "-r", "--resolveKey" }, description = "The key to use when resolving data into existing records") public String resolveKey = null; }
List<String> function(Path path) { try { List<String> files = Lists.newArrayList(); if(java.nio.file.Files.isDirectory(path)) { Iterator<Path> it = java.nio.file.Files .newDirectoryStream(path).iterator(); while (it.hasNext()) { files.addAll(scan(it.next())); } } else { files.add(path.toString()); } return files; } catch (IOException e) { throw Throwables.propagate(e); } } protected static class ImportOptions extends Options { @Parameter(names = { "-d", STR }, description = STR, required = true) public String data; @Parameter(names = STR, description = STR) public int numThreads = 1; @Parameter(names = { "-r", STR }, description = STR) public String resolveKey = null; }
/** * Recursively scan and collect all the files in the directory defined by * {@code path}. * * @param path * @return the list of files in the directory */
Recursively scan and collect all the files in the directory defined by path
scan
{ "repo_name": "bigtreeljc/concourse", "path": "concourse-import/src/main/java/org/cinchapi/concourse/importer/cli/ImportCli.java", "license": "apache-2.0", "size": 4839 }
[ "com.beust.jcommander.Parameter", "com.google.common.base.Throwables", "com.google.common.collect.Lists", "java.io.IOException", "java.nio.file.Path", "java.util.Iterator", "java.util.List", "org.cinchapi.concourse.cli.Options" ]
import com.beust.jcommander.Parameter; import com.google.common.base.Throwables; import com.google.common.collect.Lists; import java.io.IOException; import java.nio.file.Path; import java.util.Iterator; import java.util.List; import org.cinchapi.concourse.cli.Options;
import com.beust.jcommander.*; import com.google.common.base.*; import com.google.common.collect.*; import java.io.*; import java.nio.file.*; import java.util.*; import org.cinchapi.concourse.cli.*;
[ "com.beust.jcommander", "com.google.common", "java.io", "java.nio", "java.util", "org.cinchapi.concourse" ]
com.beust.jcommander; com.google.common; java.io; java.nio; java.util; org.cinchapi.concourse;
1,340,828
public void createOn(final @NotNull String cqName, final @NotNull Connection conn, final @NotNull String queryStr, final int cqState, final boolean isDurable, final @NotNull DataPolicy regionDataPolicy) { CreateCQOp.executeOn(pool, conn, cqName, queryStr, cqState, isDurable, regionDataPolicy); }
void function(final @NotNull String cqName, final @NotNull Connection conn, final @NotNull String queryStr, final int cqState, final boolean isDurable, final @NotNull DataPolicy regionDataPolicy) { CreateCQOp.executeOn(pool, conn, cqName, queryStr, cqState, isDurable, regionDataPolicy); }
/** * Create a continuous query on the given server * * @param conn the connection to use * @param cqName name of the CQ to create * @param queryStr string OQL statement to be executed * @param cqState int cqState to be set. * @param isDurable true if CQ is durable * @param regionDataPolicy the data policy ordinal of the region */
Create a continuous query on the given server
createOn
{ "repo_name": "jdeppe-pivotal/geode", "path": "geode-cq/src/main/java/org/apache/geode/cache/query/cq/internal/ops/ServerCQProxyImpl.java", "license": "apache-2.0", "size": 4063 }
[ "org.apache.geode.cache.DataPolicy", "org.apache.geode.cache.client.internal.Connection", "org.jetbrains.annotations.NotNull" ]
import org.apache.geode.cache.DataPolicy; import org.apache.geode.cache.client.internal.Connection; import org.jetbrains.annotations.NotNull;
import org.apache.geode.cache.*; import org.apache.geode.cache.client.internal.*; import org.jetbrains.annotations.*;
[ "org.apache.geode", "org.jetbrains.annotations" ]
org.apache.geode; org.jetbrains.annotations;
2,060,615