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
Connection getConnection(String host, String port, String dbName, String user, String password) throws Exception { // dynamically load the MySQL JDBC driver Class.forName(DRIVER_NAME); // return a connection based on the MySQL JDBC driver LOGGER.debug("Connecting to jdbc:mysql://" + mysqlHost + ":" + mysqlPort + "/" + dbName + "?user=" + mysqlUsername + "&password=XXXXXXXXXX"); return DriverManager.getConnection("jdbc:mysql://" + mysqlHost + ":" + mysqlPort + "/" + dbName, mysqlUsername, mysqlPassword); } // getConnection } // MySQLDriver
Connection getConnection(String host, String port, String dbName, String user, String password) throws Exception { Class.forName(DRIVER_NAME); LOGGER.debug(STR&password=XXXXXXXXXXSTRjdbc:mysql: mysqlUsername, mysqlPassword); } }
/** * Gets a MySQL connection. * @param host * @param port * @param dbName * @param user * @param password * @return A MySQL connection * @throws Exception */
Gets a MySQL connection
getConnection
{ "repo_name": "jmcanterafonseca/fiware-cygnus", "path": "src/main/java/com/telefonica/iot/cygnus/backends/mysql/MySQLBackend.java", "license": "agpl-3.0", "size": 12247 }
[ "java.sql.Connection" ]
import java.sql.Connection;
import java.sql.*;
[ "java.sql" ]
java.sql;
1,862,346
public PurchaseOrderItem getPurchaseOrderItem() { if (ObjectUtils.isNotNull(this.getLineItemReceivingDocument())) { if (ObjectUtils.isNull(this.getLineItemReceivingDocument())) { this.refreshReferenceObject("lineItemReceivingDocument"); } } // ideally we should do this a different way - maybe move it all into the service or save this info somehow (make sure and // update though) if (getLineItemReceivingDocument() != null) { PurchaseOrderDocument po = getLineItemReceivingDocument().getPurchaseOrderDocument(); PurchaseOrderItem poi = null; if (this.getItemType().isLineItemIndicator()) { List<PurchaseOrderItem> items = po.getItems(); poi = items.get(this.getItemLineNumber().intValue() - 1); // throw error if line numbers don't match } if (poi != null) { return poi; } else { // LOG.debug("getPurchaseOrderItem() Returning null because PurchaseOrderItem object for line number" + // getItemLineNumber() + "or itemType " + getItemTypeCode() + " is null"); return null; } } else { LOG.error("getPurchaseOrderItem() Returning null because paymentRequest object is null"); throw new PurError("Receiving Line Object in Purchase Order item line number " + getItemLineNumber() + "or itemType " + getItemTypeCode() + " is null"); } }
PurchaseOrderItem function() { if (ObjectUtils.isNotNull(this.getLineItemReceivingDocument())) { if (ObjectUtils.isNull(this.getLineItemReceivingDocument())) { this.refreshReferenceObject(STR); } } if (getLineItemReceivingDocument() != null) { PurchaseOrderDocument po = getLineItemReceivingDocument().getPurchaseOrderDocument(); PurchaseOrderItem poi = null; if (this.getItemType().isLineItemIndicator()) { List<PurchaseOrderItem> items = po.getItems(); poi = items.get(this.getItemLineNumber().intValue() - 1); } if (poi != null) { return poi; } else { return null; } } else { LOG.error(STR); throw new PurError(STR + getItemLineNumber() + STR + getItemTypeCode() + STR); } }
/** * Retreives a purchase order item by inspecting the item type to see if its above the line or below the line and returns the * appropriate type. * * @return - purchase order item */
Retreives a purchase order item by inspecting the item type to see if its above the line or below the line and returns the appropriate type
getPurchaseOrderItem
{ "repo_name": "Ariah-Group/Finance", "path": "af_webapp/src/main/java/org/kuali/kfs/module/purap/businessobject/LineItemReceivingItem.java", "license": "apache-2.0", "size": 7837 }
[ "java.util.List", "org.kuali.kfs.module.purap.document.PurchaseOrderDocument", "org.kuali.kfs.module.purap.exception.PurError", "org.kuali.rice.krad.util.ObjectUtils" ]
import java.util.List; import org.kuali.kfs.module.purap.document.PurchaseOrderDocument; import org.kuali.kfs.module.purap.exception.PurError; import org.kuali.rice.krad.util.ObjectUtils;
import java.util.*; import org.kuali.kfs.module.purap.document.*; import org.kuali.kfs.module.purap.exception.*; import org.kuali.rice.krad.util.*;
[ "java.util", "org.kuali.kfs", "org.kuali.rice" ]
java.util; org.kuali.kfs; org.kuali.rice;
2,101,428
public StatementBuilder withReference(Reference reference) { this.references.add(reference); return getThis(); }
StatementBuilder function(Reference reference) { this.references.add(reference); return getThis(); }
/** * Adds a reference to the constructed statement. * * @param reference * the reference to be added * @return builder object to continue construction */
Adds a reference to the constructed statement
withReference
{ "repo_name": "notconfusing/Wikidata-Toolkit", "path": "wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/helpers/StatementBuilder.java", "license": "apache-2.0", "size": 8870 }
[ "org.wikidata.wdtk.datamodel.interfaces.Reference" ]
import org.wikidata.wdtk.datamodel.interfaces.Reference;
import org.wikidata.wdtk.datamodel.interfaces.*;
[ "org.wikidata.wdtk" ]
org.wikidata.wdtk;
2,355,462
ReducerFactory getReducerFactory();
ReducerFactory getReducerFactory();
/** * Returns the ReducerFactory for this aggregation. If a CombinerFactory is defined, * the implemented {@link com.hazelcast.mapreduce.Reducer} has to handle values of * the returned type of the {@link com.hazelcast.mapreduce.Combiner}. * * @return the aggregation defined ReducerFactory */
Returns the ReducerFactory for this aggregation. If a CombinerFactory is defined, the implemented <code>com.hazelcast.mapreduce.Reducer</code> has to handle values of the returned type of the <code>com.hazelcast.mapreduce.Combiner</code>
getReducerFactory
{ "repo_name": "tombujok/hazelcast", "path": "hazelcast/src/main/java/com/hazelcast/mapreduce/aggregation/Aggregation.java", "license": "apache-2.0", "size": 4050 }
[ "com.hazelcast.mapreduce.ReducerFactory" ]
import com.hazelcast.mapreduce.ReducerFactory;
import com.hazelcast.mapreduce.*;
[ "com.hazelcast.mapreduce" ]
com.hazelcast.mapreduce;
1,779,926
public String toStringTags(Context context){ String stringTags = ""; TagMap tm = Controller.getTagMap(context); ArrayList<UUID> tagUuids = getTagsIds(context); // tags seperated by commas for ( int i = 0; i < tagUuids.size() - 1; i++ ) { stringTags += tm.getTag(tagUuids.get(i)).toString() + ", "; } // Last tag in list does not have a comma appended to it if ( tagUuids.size() > 0 ){ stringTags += tm.getTag(tagUuids.get(tagUuids.size() - 1)).toString(); } return stringTags; }
String function(Context context){ String stringTags = STR, "; } if ( tagUuids.size() > 0 ){ stringTags += tm.getTag(tagUuids.get(tagUuids.size() - 1)).toString(); } return stringTags; }
/** * formats and gets a string list of the tags * * @return a string of tags in list form */
formats and gets a string list of the tags
toStringTags
{ "repo_name": "CMPUT301W15T05/TrackerExpress", "path": "TrackerExpress/src/group5/trackerexpress/Claim.java", "license": "mit", "size": 11997 }
[ "android.content.Context" ]
import android.content.Context;
import android.content.*;
[ "android.content" ]
android.content;
436,610
public void writeByteArray(RandomAccessFile file, byte[] datas) throws IOException { writeByteArray(file, datas, 0, datas.length); }
void function(RandomAccessFile file, byte[] datas) throws IOException { writeByteArray(file, datas, 0, datas.length); }
/** * Write an entire <code>byte[]</code> into the file.<BR> * This is equivalent to the call <code>writeByteArray(file, datase, 0, datas.length)</code> * @param file a file to read in. * @param datas a <code>byte[]</code> to be written into the file. * @throws IOException if an I/O exception occures. */
Write an entire <code>byte[]</code> into the file. This is equivalent to the call <code>writeByteArray(file, datase, 0, datas.length)</code>
writeByteArray
{ "repo_name": "jerome-jouvie/NativeFmodEx", "path": "src-java-fmodex/org/jouvieje/fmodex/utils/FileIOUtils.java", "license": "lgpl-2.1", "size": 12581 }
[ "java.io.IOException", "java.io.RandomAccessFile" ]
import java.io.IOException; import java.io.RandomAccessFile;
import java.io.*;
[ "java.io" ]
java.io;
2,273,275
@BeanProperty(description = "The TreeModel that will provide the data.") public void setModel(TreeModel newModel) { super.setModel(newModel); rebuild(false); }
@BeanProperty(description = STR) void function(TreeModel newModel) { super.setModel(newModel); rebuild(false); }
/** * Sets the <code>TreeModel</code> that will provide the data. * * @param newModel the <code>TreeModel</code> that is to provide the data */
Sets the <code>TreeModel</code> that will provide the data
setModel
{ "repo_name": "mirkosertic/Bytecoder", "path": "classlib/java.desktop/src/main/resources/META-INF/modules/java.desktop/classes/javax/swing/tree/VariableHeightLayoutCache.java", "license": "apache-2.0", "size": 61865 }
[ "java.beans.BeanProperty" ]
import java.beans.BeanProperty;
import java.beans.*;
[ "java.beans" ]
java.beans;
1,991,355
public static final int findValueInListBox(ListBox list, String value) { for (int i=0; i<list.getItemCount(); i++) { if (value.equals(list.getValue(i))) { return i; } } return -1; }
static final int function(ListBox list, String value) { for (int i=0; i<list.getItemCount(); i++) { if (value.equals(list.getValue(i))) { return i; } } return -1; }
/** * Utility function to find the first index of a value in a * ListBox. */
Utility function to find the first index of a value in a ListBox
findValueInListBox
{ "repo_name": "tractionsoftware/gwt-traction", "path": "src/main/java/com/tractionsoftware/gwt/user/client/ui/SingleListBox.java", "license": "apache-2.0", "size": 5809 }
[ "com.google.gwt.user.client.ui.ListBox" ]
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.*;
[ "com.google.gwt" ]
com.google.gwt;
2,746,768
@Test public void testSinFunction() { UnivariateFunction f = new Sin(); FastFourierTransformer transformer; transformer = new FastFourierTransformer(DftNormalization.STANDARD); Complex result[]; int N = 1 << 8; double min, max, tolerance = 1E-12; min = 0.0; max = 2.0 * FastMath.PI; result = transformer.transform(f, min, max, N, TransformType.FORWARD); Assert.assertEquals(0.0, result[1].getReal(), tolerance); Assert.assertEquals(-(N >> 1), result[1].getImaginary(), tolerance); Assert.assertEquals(0.0, result[N-1].getReal(), tolerance); Assert.assertEquals(N >> 1, result[N-1].getImaginary(), tolerance); for (int i = 0; i < N-1; i += (i == 0 ? 2 : 1)) { Assert.assertEquals(0.0, result[i].getReal(), tolerance); Assert.assertEquals(0.0, result[i].getImaginary(), tolerance); } min = -FastMath.PI; max = FastMath.PI; result = transformer.transform(f, min, max, N, TransformType.INVERSE); Assert.assertEquals(0.0, result[1].getReal(), tolerance); Assert.assertEquals(-0.5, result[1].getImaginary(), tolerance); Assert.assertEquals(0.0, result[N-1].getReal(), tolerance); Assert.assertEquals(0.5, result[N-1].getImaginary(), tolerance); for (int i = 0; i < N-1; i += (i == 0 ? 2 : 1)) { Assert.assertEquals(0.0, result[i].getReal(), tolerance); Assert.assertEquals(0.0, result[i].getImaginary(), tolerance); } }
void function() { UnivariateFunction f = new Sin(); FastFourierTransformer transformer; transformer = new FastFourierTransformer(DftNormalization.STANDARD); Complex result[]; int N = 1 << 8; double min, max, tolerance = 1E-12; min = 0.0; max = 2.0 * FastMath.PI; result = transformer.transform(f, min, max, N, TransformType.FORWARD); Assert.assertEquals(0.0, result[1].getReal(), tolerance); Assert.assertEquals(-(N >> 1), result[1].getImaginary(), tolerance); Assert.assertEquals(0.0, result[N-1].getReal(), tolerance); Assert.assertEquals(N >> 1, result[N-1].getImaginary(), tolerance); for (int i = 0; i < N-1; i += (i == 0 ? 2 : 1)) { Assert.assertEquals(0.0, result[i].getReal(), tolerance); Assert.assertEquals(0.0, result[i].getImaginary(), tolerance); } min = -FastMath.PI; max = FastMath.PI; result = transformer.transform(f, min, max, N, TransformType.INVERSE); Assert.assertEquals(0.0, result[1].getReal(), tolerance); Assert.assertEquals(-0.5, result[1].getImaginary(), tolerance); Assert.assertEquals(0.0, result[N-1].getReal(), tolerance); Assert.assertEquals(0.5, result[N-1].getImaginary(), tolerance); for (int i = 0; i < N-1; i += (i == 0 ? 2 : 1)) { Assert.assertEquals(0.0, result[i].getReal(), tolerance); Assert.assertEquals(0.0, result[i].getImaginary(), tolerance); } }
/** * Test of transformer for the sine function. */
Test of transformer for the sine function
testSinFunction
{ "repo_name": "tknandu/CommonsMath_Modifed", "path": "math (trunk)/src/test/java/org/apache/commons/math3/transform/FastFourierTransformerTest.java", "license": "apache-2.0", "size": 23285 }
[ "org.apache.commons.math3.analysis.UnivariateFunction", "org.apache.commons.math3.analysis.function.Sin", "org.apache.commons.math3.complex.Complex", "org.apache.commons.math3.util.FastMath", "org.junit.Assert" ]
import org.apache.commons.math3.analysis.UnivariateFunction; import org.apache.commons.math3.analysis.function.Sin; import org.apache.commons.math3.complex.Complex; import org.apache.commons.math3.util.FastMath; import org.junit.Assert;
import org.apache.commons.math3.analysis.*; import org.apache.commons.math3.analysis.function.*; import org.apache.commons.math3.complex.*; import org.apache.commons.math3.util.*; import org.junit.*;
[ "org.apache.commons", "org.junit" ]
org.apache.commons; org.junit;
381,160
public ItemStack getStackInSlotOnClosing(int par1) { if (this.stackList[par1] != null) { ItemStack itemstack = this.stackList[par1]; this.stackList[par1] = null; return itemstack; } else { return null; } }
ItemStack function(int par1) { if (this.stackList[par1] != null) { ItemStack itemstack = this.stackList[par1]; this.stackList[par1] = null; return itemstack; } else { return null; } }
/** * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - * like when you close a workbench GUI. */
When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - like when you close a workbench GUI
getStackInSlotOnClosing
{ "repo_name": "wildex999/stjerncraft_mcpc", "path": "src/minecraft/net/minecraft/inventory/InventoryCrafting.java", "license": "gpl-3.0", "size": 6187 }
[ "net.minecraft.item.ItemStack" ]
import net.minecraft.item.ItemStack;
import net.minecraft.item.*;
[ "net.minecraft.item" ]
net.minecraft.item;
1,381,250
public long execute() throws SQLException { String sqlQuery = getSqlQuery(); if (sqlQuery.startsWith("select count(*)")) { return getJdbcSqlExecutor().selectCount(this); } return getJdbcSqlExecutor().executeModify(Collections.singletonList(this)); } public static class Configuration { private int limit = 0;
long function() throws SQLException { String sqlQuery = getSqlQuery(); if (sqlQuery.startsWith(STR)) { return getJdbcSqlExecutor().selectCount(this); } return getJdbcSqlExecutor().executeModify(Collections.singletonList(this)); } public static class Configuration { private int limit = 0;
/** * Modify executor. * @throws java.sql.SQLException */
Modify executor
execute
{ "repo_name": "ebonnet/Silverpeas-Core", "path": "core-api/src/main/java/org/silverpeas/core/persistence/jdbc/sql/JdbcSqlQuery.java", "license": "agpl-3.0", "size": 16832 }
[ "java.sql.SQLException", "java.util.Collections", "org.silverpeas.core.persistence.jdbc.sql.JdbcSqlExecutorProvider" ]
import java.sql.SQLException; import java.util.Collections; import org.silverpeas.core.persistence.jdbc.sql.JdbcSqlExecutorProvider;
import java.sql.*; import java.util.*; import org.silverpeas.core.persistence.jdbc.sql.*;
[ "java.sql", "java.util", "org.silverpeas.core" ]
java.sql; java.util; org.silverpeas.core;
2,690,385
public CallAdapter<?> callAdapter(Type returnType, Annotation[] annotations) { return nextCallAdapter(null, returnType, annotations); }
CallAdapter<?> function(Type returnType, Annotation[] annotations) { return nextCallAdapter(null, returnType, annotations); }
/** * Returns the {@link CallAdapter} for {@code returnType} from the available {@linkplain * #callAdapterFactories() factories}. */
Returns the <code>CallAdapter</code> for returnType from the available #callAdapterFactories() factories
callAdapter
{ "repo_name": "larsgrefer/retrofit", "path": "retrofit/src/main/java/retrofit/Retrofit.java", "license": "apache-2.0", "size": 14185 }
[ "java.lang.annotation.Annotation", "java.lang.reflect.Type" ]
import java.lang.annotation.Annotation; import java.lang.reflect.Type;
import java.lang.annotation.*; import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
70,815
static MultiHttpResource createResources(final Config config) { final String resourceOwnerName = "xpack.monitoring.exporters." + config.name(); // order controls the order that each is checked; more direct checks should always happen first (e.g., version checks) final List<HttpResource> resources = new ArrayList<>(); // block the exporter from working against a monitoring cluster with the wrong version resources.add(new VersionHttpResource(resourceOwnerName, MIN_SUPPORTED_CLUSTER_VERSION)); // load all templates (template bodies are lazily loaded on demand) configureTemplateResources(config, resourceOwnerName, resources); // load the pipeline (this will get added to as the monitoring API version increases) configurePipelineResources(config, resourceOwnerName, resources); // load the watches for cluster alerts if Watcher is available configureClusterAlertsResources(config, resourceOwnerName, resources); return new MultiHttpResource(resourceOwnerName, resources); }
static MultiHttpResource createResources(final Config config) { final String resourceOwnerName = STR + config.name(); final List<HttpResource> resources = new ArrayList<>(); resources.add(new VersionHttpResource(resourceOwnerName, MIN_SUPPORTED_CLUSTER_VERSION)); configureTemplateResources(config, resourceOwnerName, resources); configurePipelineResources(config, resourceOwnerName, resources); configureClusterAlertsResources(config, resourceOwnerName, resources); return new MultiHttpResource(resourceOwnerName, resources); }
/** * Create a {@link MultiHttpResource} that can be used to block bulk exporting until all expected resources are available. * * @param config The HTTP Exporter's configuration * @return Never {@code null}. */
Create a <code>MultiHttpResource</code> that can be used to block bulk exporting until all expected resources are available
createResources
{ "repo_name": "uschindler/elasticsearch", "path": "x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporter.java", "license": "apache-2.0", "size": 45814 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,040,444
boolean trySetComparator(Comparator<? super V> comparator);
boolean trySetComparator(Comparator<? super V> comparator);
/** * Sets new comparator only if current set is empty * * @param comparator for values * @return <code>true</code> if new comparator setted * <code>false</code> otherwise */
Sets new comparator only if current set is empty
trySetComparator
{ "repo_name": "redisson/redisson", "path": "redisson/src/main/java/org/redisson/api/RPriorityQueue.java", "license": "apache-2.0", "size": 1803 }
[ "java.util.Comparator" ]
import java.util.Comparator;
import java.util.*;
[ "java.util" ]
java.util;
1,269,698
@Override public Object parseObject(String source, ParsePosition pos) { return parser.parseObject(source, pos); }
Object function(String source, ParsePosition pos) { return parser.parseObject(source, pos); }
/** * Uses the parser Format instance. * * @param source the String source * @param pos the ParsePosition containing the position to parse from, will * be updated according to parsing success (index) or failure * (error index) * @return the parsed Object * @see Format#parseObject(String, ParsePosition) */
Uses the parser Format instance
parseObject
{ "repo_name": "SpoonLabs/astor", "path": "examples/Lang-issue-428/src/main/java/org/apache/commons/lang3/text/CompositeFormat.java", "license": "gpl-2.0", "size": 3839 }
[ "java.text.ParsePosition" ]
import java.text.ParsePosition;
import java.text.*;
[ "java.text" ]
java.text;
2,794,206
public Timestamp getDateModified() { return (Timestamp) get(1); }
Timestamp function() { return (Timestamp) get(1); }
/** * Getter for <code>sugarcrm_4_12.sc_companycontracts_accounts_c.date_modified</code>. */
Getter for <code>sugarcrm_4_12.sc_companycontracts_accounts_c.date_modified</code>
getDateModified
{ "repo_name": "SmartMedicalServices/SpringJOOQ", "path": "src/main/java/com/sms/sis/db/tables/records/ScCompanycontractsAccountsCRecord.java", "license": "gpl-3.0", "size": 7557 }
[ "java.sql.Timestamp" ]
import java.sql.Timestamp;
import java.sql.*;
[ "java.sql" ]
java.sql;
2,349,568
public boolean isDeviceCompatible(final IoDevice device) { List<IoDevice> ioDevices = new LinkedList<IoDevice>(); for (PriorityIoDeviceTuple tuple : mCompatibleDevices) { if (tuple.getIoDevice().equals(device)) { return true; } } return false; }
boolean function(final IoDevice device) { List<IoDevice> ioDevices = new LinkedList<IoDevice>(); for (PriorityIoDeviceTuple tuple : mCompatibleDevices) { if (tuple.getIoDevice().equals(device)) { return true; } } return false; }
/** * Determines whether the input {@link IoDevice} is compatible with the {@link Cursor}. * @return true if device is compatible, else false */
Determines whether the input <code>IoDevice</code> is compatible with the <code>Cursor</code>
isDeviceCompatible
{ "repo_name": "NolaDonato/GearVRf", "path": "GVRf/Extensions/3DCursor/3DCursorLibrary/src/main/java/org/gearvrf/io/cursor3d/Cursor.java", "license": "apache-2.0", "size": 24007 }
[ "java.util.LinkedList", "java.util.List" ]
import java.util.LinkedList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,272,905
service = get(TopologyService.class); topology = service.currentTopology(); }
service = get(TopologyService.class); topology = service.currentTopology(); }
/** * Initializes the context for all cluster commands. */
Initializes the context for all cluster commands
init
{ "repo_name": "sdnwiselab/onos", "path": "cli/src/main/java/org/onosproject/cli/net/TopologyCommand.java", "license": "apache-2.0", "size": 4410 }
[ "org.onosproject.net.topology.TopologyService" ]
import org.onosproject.net.topology.TopologyService;
import org.onosproject.net.topology.*;
[ "org.onosproject.net" ]
org.onosproject.net;
350,105
public ClientMessage sendMessage(SimpleString address, byte[] body) { ClientMessage message = createMessage(body); sendMessage(address, message); return message; }
ClientMessage function(SimpleString address, byte[] body) { ClientMessage message = createMessage(body); sendMessage(address, message); return message; }
/** * Create a new message with the specified body, and send the message to an queueName * * @param address the target queueName for the message * @param body the body for the new message * @return the message that was sent */
Create a new message with the specified body, and send the message to an queueName
sendMessage
{ "repo_name": "cshannon/activemq-artemis", "path": "artemis-junit/src/main/java/org/apache/activemq/artemis/junit/EmbeddedActiveMQResource.java", "license": "apache-2.0", "size": 31805 }
[ "org.apache.activemq.artemis.api.core.SimpleString", "org.apache.activemq.artemis.api.core.client.ClientMessage" ]
import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientMessage;
import org.apache.activemq.artemis.api.core.*; import org.apache.activemq.artemis.api.core.client.*;
[ "org.apache.activemq" ]
org.apache.activemq;
2,709,731
// om.removeAxiom(onto, ax); // Remove single Axiom @Pointcut("call(* org.semanticweb.owlapi.model.*.removeAxiom(..))") void callRemoveAxiom() {}
@Pointcut(STR) void callRemoveAxiom() {}
/** * quantifies over calls to methods of type addAxiom(), * dealing with single Axiom */
quantifies over calls to methods of type addAxiom(), dealing with single Axiom
callAddAxiom
{ "repo_name": "ag-csw/aspect-owlapi", "path": "src/main/java/de/fuberlin/csw/aood/owlapi/modification/OntologyModificationAspect.java", "license": "gpl-3.0", "size": 33596 }
[ "org.aspectj.lang.annotation.Pointcut" ]
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.annotation.*;
[ "org.aspectj.lang" ]
org.aspectj.lang;
104,823
public static File newFile(String path) { File file = new File(path); if(file.exists()) file.delete(); return file; }
static File function(String path) { File file = new File(path); if(file.exists()) file.delete(); return file; }
/** * Create new file by deleting the old one first (if it exists) * * @param path * @return */
Create new file by deleting the old one first (if it exists)
newFile
{ "repo_name": "ktslabbie/TwinterestExplorer", "path": "twitter/src/main/java/jp/titech/twitter/util/Util.java", "license": "mit", "size": 12891 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
1,533,488
public List<Buddy> searchBuddies(Long userId, String searchQuery, int start, int end) throws Exception;
List<Buddy> function(Long userId, String searchQuery, int start, int end) throws Exception;
/** * Returns a list of buddies based on the search query. The search will be performed * in first name, middle name, last name, screen name and email. * * @param userId Long * @param searchQuery String * @param start of the list * @param end of the list * @return List of buddies * @throws Exception */
Returns a list of buddies based on the search query. The search will be performed in first name, middle name, last name, screen name and email
searchBuddies
{ "repo_name": "marcelmika/lims", "path": "docroot/WEB-INF/src/com/marcelmika/lims/persistence/manager/SearchManager.java", "license": "mit", "size": 1911 }
[ "com.marcelmika.lims.persistence.domain.Buddy", "java.util.List" ]
import com.marcelmika.lims.persistence.domain.Buddy; import java.util.List;
import com.marcelmika.lims.persistence.domain.*; import java.util.*;
[ "com.marcelmika.lims", "java.util" ]
com.marcelmika.lims; java.util;
969,130
public static int nextPrime(int desiredCapacity) { int i = Arrays.binarySearch(primeCapacities, desiredCapacity); if (i < 0) { // desired capacity not found, choose next prime greater // than desired capacity i = -i -1; // remember the semantics of binarySearch... } return primeCapacities[i]; }
static int function(int desiredCapacity) { int i = Arrays.binarySearch(primeCapacities, desiredCapacity); if (i < 0) { i = -i -1; } return primeCapacities[i]; }
/** * Returns a prime number which is <code>&gt;= desiredCapacity</code> and * very close to <code>desiredCapacity</code> (within 11% if * <code>desiredCapacity &gt;= 1000</code>). * @param desiredCapacity the capacity desired by the user. * @return the capacity which should be used for a hashtable. */
Returns a prime number which is <code>&gt;= desiredCapacity</code> and very close to <code>desiredCapacity</code> (within 11% if <code>desiredCapacity &gt;= 1000</code>)
nextPrime
{ "repo_name": "Twixer/mondrian-3.1.5", "path": "src/main/mondrian/util/PrimeFinder.java", "license": "epl-1.0", "size": 9728 }
[ "java.util.Arrays" ]
import java.util.Arrays;
import java.util.*;
[ "java.util" ]
java.util;
30,683
private PersistentResourceToken bind(final PersistentResourceToken token) { if (token == null) { return PersistentResourceToken.NoneToken; } return token; }
PersistentResourceToken function(final PersistentResourceToken token) { if (token == null) { return PersistentResourceToken.NoneToken; } return token; }
/** * Bind the specified token into a well-typed token. It actually converts any null token to a * NoneToken that is an instance of a PersistentResourceToken class, otherwise the token is simply * returned. * * @param token the token to bind to a non null <code>PersistentResourceToken</code> instance. * @return a non null instance of PersistentResourceToken class */
Bind the specified token into a well-typed token. It actually converts any null token to a NoneToken that is an instance of a PersistentResourceToken class, otherwise the token is simply returned
bind
{ "repo_name": "ebonnet/Silverpeas-Core", "path": "core-library/src/main/java/org/silverpeas/core/security/token/persistent/service/DefaultTokenService.java", "license": "agpl-3.0", "size": 5003 }
[ "org.silverpeas.core.security.token.persistent.PersistentResourceToken" ]
import org.silverpeas.core.security.token.persistent.PersistentResourceToken;
import org.silverpeas.core.security.token.persistent.*;
[ "org.silverpeas.core" ]
org.silverpeas.core;
1,436,557
public void release() throws IOException { synchronized(this) { if (release) { return; } trace("RELEASE"); release = true; // If send/receive is done - we can reuse this object maybeRelease(); } }
void function() throws IOException { synchronized(this) { if (release) { return; } trace(STR); release = true; maybeRelease(); } }
/** * Finalize sending and receiving. * Indicates client is no longer interested, some IO may still be in flight. * If in a POST and you're not interested in the body - it may be * better to call abort(). * * MUST be called to allow connection reuse and pooling. * * @throws IOException */
Finalize sending and receiving. Indicates client is no longer interested, some IO may still be in flight. If in a POST and you're not interested in the body - it may be better to call abort(). MUST be called to allow connection reuse and pooling
release
{ "repo_name": "plumer/codana", "path": "tomcat_files/8.0.22/HttpChannel.java", "license": "mit", "size": 23226 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,365,698
@Test public void testTimestampExtractorWithAutoInterval() throws Exception { final int NUM_ELEMENTS = 10; StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime); env.getConfig().setAutoWatermarkInterval(10); env.setParallelism(1); env.getConfig().disableSysoutLogging();
void function() throws Exception { final int NUM_ELEMENTS = 10; StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime); env.getConfig().setAutoWatermarkInterval(10); env.setParallelism(1); env.getConfig().disableSysoutLogging();
/** * This tests whether timestamps are properly extracted in the timestamp * extractor and whether watermarks are also correctly forwared from this with the auto watermark * interval. */
This tests whether timestamps are properly extracted in the timestamp extractor and whether watermarks are also correctly forwared from this with the auto watermark interval
testTimestampExtractorWithAutoInterval
{ "repo_name": "WangTaoTheTonic/flink", "path": "flink-tests/src/test/java/org/apache/flink/test/streaming/runtime/TimestampITCase.java", "license": "apache-2.0", "size": 27514 }
[ "org.apache.flink.streaming.api.TimeCharacteristic", "org.apache.flink.streaming.api.environment.StreamExecutionEnvironment" ]
import org.apache.flink.streaming.api.TimeCharacteristic; import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.api.*; import org.apache.flink.streaming.api.environment.*;
[ "org.apache.flink" ]
org.apache.flink;
318,906
@Override public boolean commit() throws LoginException { if (this.principals == null) { return false; } if (this.subject.isReadOnly()) { throw new LoginException("Subject cannot be read-only."); } final Set<Principal> principalsSet = this.subject.getPrincipals(); principalsSet.addAll(this.principals); WindowsLoginModule.LOGGER.debug("committing {} principals", Integer.valueOf(this.subject.getPrincipals().size())); if (this.debug) { for (final Principal principal : principalsSet) { WindowsLoginModule.LOGGER.debug(" principal: {}", principal.getName()); } } return true; }
boolean function() throws LoginException { if (this.principals == null) { return false; } if (this.subject.isReadOnly()) { throw new LoginException(STR); } final Set<Principal> principalsSet = this.subject.getPrincipals(); principalsSet.addAll(this.principals); WindowsLoginModule.LOGGER.debug(STR, Integer.valueOf(this.subject.getPrincipals().size())); if (this.debug) { for (final Principal principal : principalsSet) { WindowsLoginModule.LOGGER.debug(STR, principal.getName()); } } return true; }
/** * Commit principals to the subject. * * @return true, if successful * @throws LoginException * the login exception */
Commit principals to the subject
commit
{ "repo_name": "vimil/waffle", "path": "Source/JNA/waffle-jna/src/main/java/waffle/jaas/WindowsLoginModule.java", "license": "epl-1.0", "size": 11458 }
[ "java.security.Principal", "java.util.Set", "javax.security.auth.login.LoginException" ]
import java.security.Principal; import java.util.Set; import javax.security.auth.login.LoginException;
import java.security.*; import java.util.*; import javax.security.auth.login.*;
[ "java.security", "java.util", "javax.security" ]
java.security; java.util; javax.security;
1,754,509
public boolean disconnectFromDB() { try { db.disconnect(); } catch (SQLException e) { JOptionPane.showMessageDialog(this, "Error disconnecting from database.", "Error", JOptionPane.ERROR_MESSAGE); return false; } connected = false; left.setEnabled(false); right.setEnabled(false); JOptionPane.showMessageDialog(this, "Successfully disconnected from database"); return true; }
boolean function() { try { db.disconnect(); } catch (SQLException e) { JOptionPane.showMessageDialog(this, STR, "Error", JOptionPane.ERROR_MESSAGE); return false; } connected = false; left.setEnabled(false); right.setEnabled(false); JOptionPane.showMessageDialog(this, STR); return true; }
/** * Disconnects from the database and disables all functions that require * database access. Will display an error and return false if the attempt * to disconnect fails. * * @return <code>true</code> if the current connection is terminated * successfully, <code>false</code> if not */
Disconnects from the database and disables all functions that require database access. Will display an error and return false if the attempt to disconnect fails
disconnectFromDB
{ "repo_name": "micwa6/PhotoDB", "path": "src/main/java/photo/db/PhotoPanel.java", "license": "gpl-3.0", "size": 23876 }
[ "java.sql.SQLException", "javax.swing.JOptionPane" ]
import java.sql.SQLException; import javax.swing.JOptionPane;
import java.sql.*; import javax.swing.*;
[ "java.sql", "javax.swing" ]
java.sql; javax.swing;
2,249,617
@ApiModelProperty(example = "null", value = "Specifies the country associated with the address.") public String getCountry() { return country; }
@ApiModelProperty(example = "null", value = STR) String function() { return country; }
/** * Specifies the country associated with the address. * @return country **/
Specifies the country associated with the address
getCountry
{ "repo_name": "docusign/docusign-java-client", "path": "src/main/java/com/docusign/esign/model/AddressInformationV2.java", "license": "mit", "size": 6010 }
[ "io.swagger.annotations.ApiModelProperty" ]
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.*;
[ "io.swagger.annotations" ]
io.swagger.annotations;
1,735,951
public void setText(final String raw, final IRepositoryIdProvider repo) { Bundle args = new Bundle(); args.putCharSequence(ARG_TEXT, raw); if (repo instanceof Serializable) args.putSerializable(ARG_REPO, (Serializable) repo); getLoaderManager().restartLoader(0, args, this); Keyboard.hideSoftInput(bodyText); showLoading(true); }
void function(final String raw, final IRepositoryIdProvider repo) { Bundle args = new Bundle(); args.putCharSequence(ARG_TEXT, raw); if (repo instanceof Serializable) args.putSerializable(ARG_REPO, (Serializable) repo); getLoaderManager().restartLoader(0, args, this); Keyboard.hideSoftInput(bodyText); showLoading(true); }
/** * Set text to render * * @param raw * @param repo */
Set text to render
setText
{ "repo_name": "njucsyyh/android", "path": "app/src/main/java/com/github/mobile/ui/comment/RenderedCommentFragment.java", "license": "apache-2.0", "size": 3593 }
[ "android.os.Bundle", "com.github.kevinsawicki.wishlist.Keyboard", "java.io.Serializable", "org.eclipse.egit.github.core.IRepositoryIdProvider" ]
import android.os.Bundle; import com.github.kevinsawicki.wishlist.Keyboard; import java.io.Serializable; import org.eclipse.egit.github.core.IRepositoryIdProvider;
import android.os.*; import com.github.kevinsawicki.wishlist.*; import java.io.*; import org.eclipse.egit.github.core.*;
[ "android.os", "com.github.kevinsawicki", "java.io", "org.eclipse.egit" ]
android.os; com.github.kevinsawicki; java.io; org.eclipse.egit;
2,126,811
public String readString(final int length) throws IOException { final byte[] bytes = new byte[length]; read(bytes); return new String(bytes, ISO_8859_1); }
String function(final int length) throws IOException { final byte[] bytes = new byte[length]; read(bytes); return new String(bytes, ISO_8859_1); }
/** * Read the specified number of bytes and return them as a string. * * @param length * the number of bytes in the string * @return the resulting string * @throws IOException * from underlying input stream */
Read the specified number of bytes and return them as a string
readString
{ "repo_name": "sg26565/hott-transmitter-config", "path": "BluetoohTest/src/main/java/de/treichels/android/bluetoohtest/HoTTReader.java", "license": "lgpl-3.0", "size": 7096 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,851,298
super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mLifecycleDisplay = (TextView) findViewById(R.id.tv_lifecycle_events_display); if (savedInstanceState != null) { if (savedInstanceState.containsKey(LIFECYCLE_CALLBACKS_TEXT_KEY)) { String allPreviousLifecycleCallbacks = savedInstanceState .getString(LIFECYCLE_CALLBACKS_TEXT_KEY); mLifecycleDisplay.setText(allPreviousLifecycleCallbacks); } } // TODO (4) Iterate backwards through mLifecycleCallbacks, appending each String and a newline to mLifecycleDisplay for(int i=0;i<mLifecycleCallbacks.size();i++){ mLifecycleDisplay.append(mLifecycleCallbacks.get(i)+"\n"); } // TODO (5) Clear mLifecycleCallbacks after iterating through it mLifecycleCallbacks.clear(); logAndAppend(ON_CREATE); }
super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mLifecycleDisplay = (TextView) findViewById(R.id.tv_lifecycle_events_display); if (savedInstanceState != null) { if (savedInstanceState.containsKey(LIFECYCLE_CALLBACKS_TEXT_KEY)) { String allPreviousLifecycleCallbacks = savedInstanceState .getString(LIFECYCLE_CALLBACKS_TEXT_KEY); mLifecycleDisplay.setText(allPreviousLifecycleCallbacks); } } for(int i=0;i<mLifecycleCallbacks.size();i++){ mLifecycleDisplay.append(mLifecycleCallbacks.get(i)+"\n"); } mLifecycleCallbacks.clear(); logAndAppend(ON_CREATE); }
/** * Called when the activity is first created. This is where you should do all of your normal * static set up: create views, bind data to lists, etc. * * Always followed by onStart(). * * @param savedInstanceState The Activity's previously frozen state, if there was one. */
Called when the activity is first created. This is where you should do all of your normal static set up: create views, bind data to lists, etc. Always followed by onStart()
onCreate
{ "repo_name": "dalinaum/ud851-Exercises-student", "path": "Lesson05a-Android-Lifecycle/T05a.03-Exercise-FixLifecycleDisplayBug/app/src/main/java/com/example/android/lifecycle/MainActivity.java", "license": "apache-2.0", "size": 7785 }
[ "android.widget.TextView" ]
import android.widget.TextView;
import android.widget.*;
[ "android.widget" ]
android.widget;
1,262,640
@Deprecated public void setReversalDate(UniversityDate reversalDate) { this.reversalDate = reversalDate; }
void function(UniversityDate reversalDate) { this.reversalDate = reversalDate; }
/** * Sets the reversalDate. * * @param reversalDate The reversalDate to set. */
Sets the reversalDate
setReversalDate
{ "repo_name": "ua-eas/ua-kfs-5.3", "path": "work/src/org/kuali/kfs/module/ld/businessobject/LaborLedgerPendingEntry.java", "license": "agpl-3.0", "size": 16220 }
[ "org.kuali.kfs.sys.businessobject.UniversityDate" ]
import org.kuali.kfs.sys.businessobject.UniversityDate;
import org.kuali.kfs.sys.businessobject.*;
[ "org.kuali.kfs" ]
org.kuali.kfs;
2,191,046
protected AmazonClientException unwrapExecutionException(ExecutionException e) { Throwable t = e.getCause(); if (t instanceof AmazonClientException) return (AmazonClientException)t; return new AmazonClientException("Unable to complete transfer: " + t.getMessage(), t); }
AmazonClientException function(ExecutionException e) { Throwable t = e.getCause(); if (t instanceof AmazonClientException) return (AmazonClientException)t; return new AmazonClientException(STR + t.getMessage(), t); }
/** * Unwraps the root exception that caused the specified ExecutionException * and returns it. If it was not an instance of AmazonClientException, it is * wrapped as an AmazonClientException. * * @param e * The ExecutionException to unwrap. * * @return The root exception that caused the specified ExecutionException. */
Unwraps the root exception that caused the specified ExecutionException and returns it. If it was not an instance of AmazonClientException, it is wrapped as an AmazonClientException
unwrapExecutionException
{ "repo_name": "apetresc/aws-sdk-for-java-on-gae", "path": "src/main/java/com/amazonaws/services/s3/transfer/Transfer.java", "license": "apache-2.0", "size": 7555 }
[ "com.amazonaws.AmazonClientException", "java.util.concurrent.ExecutionException" ]
import com.amazonaws.AmazonClientException; import java.util.concurrent.ExecutionException;
import com.amazonaws.*; import java.util.concurrent.*;
[ "com.amazonaws", "java.util" ]
com.amazonaws; java.util;
2,908,250
public boolean skipField(int tag) throws IOException { switch (WireFormat.getTagWireType(tag)) { case WireFormat.WIRETYPE_VARINT: readInt32(); return true; case WireFormat.WIRETYPE_FIXED64: readRawLittleEndian64(); return true; case WireFormat.WIRETYPE_LENGTH_DELIMITED: skipRawBytes(readRawVarint32()); return true; case WireFormat.WIRETYPE_START_GROUP: skipMessage(); checkLastTagWas( WireFormat.makeTag(WireFormat.getTagFieldNumber(tag), WireFormat.WIRETYPE_END_GROUP)); return true; case WireFormat.WIRETYPE_END_GROUP: return false; case WireFormat.WIRETYPE_FIXED32: readRawLittleEndian32(); return true; default: throw InvalidProtocolBufferException.invalidWireType(); } }
boolean function(int tag) throws IOException { switch (WireFormat.getTagWireType(tag)) { case WireFormat.WIRETYPE_VARINT: readInt32(); return true; case WireFormat.WIRETYPE_FIXED64: readRawLittleEndian64(); return true; case WireFormat.WIRETYPE_LENGTH_DELIMITED: skipRawBytes(readRawVarint32()); return true; case WireFormat.WIRETYPE_START_GROUP: skipMessage(); checkLastTagWas( WireFormat.makeTag(WireFormat.getTagFieldNumber(tag), WireFormat.WIRETYPE_END_GROUP)); return true; case WireFormat.WIRETYPE_END_GROUP: return false; case WireFormat.WIRETYPE_FIXED32: readRawLittleEndian32(); return true; default: throw InvalidProtocolBufferException.invalidWireType(); } }
/** * Reads and discards a single field, given its tag value. * * @return {@code false} if the tag is an endgroup tag, in which case * nothing is skipped. Otherwise, returns {@code true}. */
Reads and discards a single field, given its tag value
skipField
{ "repo_name": "vleo/vleo-notebook", "path": "protobuf/trunk/protobuf/java/src/main/java/com/google/protobuf/CodedInputStream.java", "license": "gpl-3.0", "size": 25309 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,093,780
@Override public TipsOfTheDayUsers fetchByPrimaryKey(long tipUserId) { return fetchByPrimaryKey((Serializable)tipUserId); }
TipsOfTheDayUsers function(long tipUserId) { return fetchByPrimaryKey((Serializable)tipUserId); }
/** * Returns the Tips of the Day Users with the primary key or returns <code>null</code> if it could not be found. * * @param tipUserId the primary key of the Tips of the Day Users * @return the Tips of the Day Users, or <code>null</code> if a Tips of the Day Users with the primary key could not be found */
Returns the Tips of the Day Users with the primary key or returns <code>null</code> if it could not be found
fetchByPrimaryKey
{ "repo_name": "rivetlogic/liferay-tip-of-the-day", "path": "modules/tip-day-services/tip-day-services-service/src/main/java/com/rivetlogic/services/service/persistence/impl/TipsOfTheDayUsersPersistenceImpl.java", "license": "gpl-3.0", "size": 36323 }
[ "com.rivetlogic.services.model.TipsOfTheDayUsers", "java.io.Serializable" ]
import com.rivetlogic.services.model.TipsOfTheDayUsers; import java.io.Serializable;
import com.rivetlogic.services.model.*; import java.io.*;
[ "com.rivetlogic.services", "java.io" ]
com.rivetlogic.services; java.io;
1,084,545
public Error setDetails(List<ErrorDetails> details) { this.details = details; return this; }
Error function(List<ErrorDetails> details) { this.details = details; return this; }
/** * Setter for details */
Setter for details
setDetails
{ "repo_name": "ERJIALI/gbdbas", "path": "src/main/java/com/paypal/api/payments/Error.java", "license": "mit", "size": 2518 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,687,745
void revealSearchView() { final int START_RADIUS = 16; int endRadius = Math.max(toolbar.getWidth(), toolbar.getHeight()); Animator animator; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { animator = ViewAnimationUtils.createCircularReveal(searchViewLayout, searchCoords[0] + 32, searchCoords[1] - 16, START_RADIUS, endRadius); } else { // TODO:ViewAnimationUtils.createCircularReveal animator = new ObjectAnimator().ofFloat(searchViewLayout, "alpha", 0f, 1f); } utils.revealShow(fabBgView, true);
void revealSearchView() { final int START_RADIUS = 16; int endRadius = Math.max(toolbar.getWidth(), toolbar.getHeight()); Animator animator; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { animator = ViewAnimationUtils.createCircularReveal(searchViewLayout, searchCoords[0] + 32, searchCoords[1] - 16, START_RADIUS, endRadius); } else { animator = new ObjectAnimator().ofFloat(searchViewLayout, "alpha", 0f, 1f); } utils.revealShow(fabBgView, true);
/** * show search view with a circular reveal animation */
show search view with a circular reveal animation
revealSearchView
{ "repo_name": "ugurtufekci/AmazeFileManager", "path": "src/fdroid/java/com/amaze/filemanager/activities/MainActivity.java", "license": "gpl-3.0", "size": 123981 }
[ "android.animation.Animator", "android.animation.ObjectAnimator", "android.os.Build", "android.view.ViewAnimationUtils" ]
import android.animation.Animator; import android.animation.ObjectAnimator; import android.os.Build; import android.view.ViewAnimationUtils;
import android.animation.*; import android.os.*; import android.view.*;
[ "android.animation", "android.os", "android.view" ]
android.animation; android.os; android.view;
852,195
if (!AccountManagerFacadeProvider.getInstance().isCachePopulated()) { // Suppress the promo if the account list isn't available yet. return false; } SigninPreferencesManager preferencesManager = SigninPreferencesManager.getInstance(); int currentMajorVersion = ChromeVersionInfo.getProductMajorVersion(); boolean wasSignedIn = TextUtils.isEmpty( PrefServiceBridge.getInstance().getString(Pref.SYNC_LAST_ACCOUNT_NAME)); List<String> accountNames = AccountUtils.toAccountNames( AccountManagerFacadeProvider.getInstance().tryGetGoogleAccounts()); Supplier<Set<String>> accountNamesSupplier = () -> new ArraySet<>(accountNames); if (!shouldLaunchSigninPromo(preferencesManager, currentMajorVersion, IdentityServicesProvider.get().getIdentityManager().hasPrimaryAccount(), wasSignedIn, accountNamesSupplier)) { return false; } SigninUtils.startSigninActivityIfAllowed(activity, SigninAccessPoint.SIGNIN_PROMO); preferencesManager.setSigninPromoLastShownVersion(currentMajorVersion); preferencesManager.setSigninPromoLastAccountNames(new ArraySet<>(accountNames)); return true; }
if (!AccountManagerFacadeProvider.getInstance().isCachePopulated()) { return false; } SigninPreferencesManager preferencesManager = SigninPreferencesManager.getInstance(); int currentMajorVersion = ChromeVersionInfo.getProductMajorVersion(); boolean wasSignedIn = TextUtils.isEmpty( PrefServiceBridge.getInstance().getString(Pref.SYNC_LAST_ACCOUNT_NAME)); List<String> accountNames = AccountUtils.toAccountNames( AccountManagerFacadeProvider.getInstance().tryGetGoogleAccounts()); Supplier<Set<String>> accountNamesSupplier = () -> new ArraySet<>(accountNames); if (!shouldLaunchSigninPromo(preferencesManager, currentMajorVersion, IdentityServicesProvider.get().getIdentityManager().hasPrimaryAccount(), wasSignedIn, accountNamesSupplier)) { return false; } SigninUtils.startSigninActivityIfAllowed(activity, SigninAccessPoint.SIGNIN_PROMO); preferencesManager.setSigninPromoLastShownVersion(currentMajorVersion); preferencesManager.setSigninPromoLastAccountNames(new ArraySet<>(accountNames)); return true; }
/** * Launches the signin promo if it needs to be displayed. * @param activity The parent activity. * @return Whether the signin promo is shown. */
Launches the signin promo if it needs to be displayed
launchSigninPromoIfNeeded
{ "repo_name": "endlessm/chromium-browser", "path": "chrome/android/java/src/org/chromium/chrome/browser/signin/SigninPromoUtil.java", "license": "bsd-3-clause", "size": 6404 }
[ "android.text.TextUtils", "androidx.collection.ArraySet", "java.util.List", "java.util.Set", "org.chromium.base.supplier.Supplier", "org.chromium.chrome.browser.ChromeVersionInfo", "org.chromium.chrome.browser.preferences.Pref", "org.chromium.chrome.browser.preferences.PrefServiceBridge", "org.chromium.components.signin.AccountManagerFacadeProvider", "org.chromium.components.signin.AccountUtils", "org.chromium.components.signin.metrics.SigninAccessPoint" ]
import android.text.TextUtils; import androidx.collection.ArraySet; import java.util.List; import java.util.Set; import org.chromium.base.supplier.Supplier; import org.chromium.chrome.browser.ChromeVersionInfo; import org.chromium.chrome.browser.preferences.Pref; import org.chromium.chrome.browser.preferences.PrefServiceBridge; import org.chromium.components.signin.AccountManagerFacadeProvider; import org.chromium.components.signin.AccountUtils; import org.chromium.components.signin.metrics.SigninAccessPoint;
import android.text.*; import androidx.collection.*; import java.util.*; import org.chromium.base.supplier.*; import org.chromium.chrome.browser.*; import org.chromium.chrome.browser.preferences.*; import org.chromium.components.signin.*; import org.chromium.components.signin.metrics.*;
[ "android.text", "androidx.collection", "java.util", "org.chromium.base", "org.chromium.chrome", "org.chromium.components" ]
android.text; androidx.collection; java.util; org.chromium.base; org.chromium.chrome; org.chromium.components;
2,435,620
public List<String> getStudentsWhoDidNotRespondToAnyQuestion() { Collections.sort(noResponse, compareByTeamNameStudentName); return noResponse; }
List<String> function() { Collections.sort(noResponse, compareByTeamNameStudentName); return noResponse; }
/** * Returns list of students who did not respond to the feedback session * sorted by teamName > studentNamelist. */
Returns list of students who did not respond to the feedback session sorted by teamName > studentNamelist
getStudentsWhoDidNotRespondToAnyQuestion
{ "repo_name": "HirdayGupta/teammates", "path": "src/main/java/teammates/common/datatransfer/FeedbackSessionResponseStatus.java", "license": "gpl-2.0", "size": 4184 }
[ "java.util.Collections", "java.util.List" ]
import java.util.Collections; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
298
public void insertRows(final int row, final T[] rowArray) { final List<T> rowList = new ArrayList<T>(rowArray.length); for (int i = 0; i < rowArray.length; i++) { rowList.add(rowArray[i]); } insertRows(row, rowList); }
void function(final int row, final T[] rowArray) { final List<T> rowList = new ArrayList<T>(rowArray.length); for (int i = 0; i < rowArray.length; i++) { rowList.add(rowArray[i]); } insertRows(row, rowList); }
/** * Insert multiple rows of data at the <code>row</code> location in the model. Notification of the row being added will be generated. * * @param row row in the model where the data will be inserted * @param rowArray each item in the Array is a separate row of data */
Insert multiple rows of data at the <code>row</code> location in the model. Notification of the row being added will be generated
insertRows
{ "repo_name": "klst-com/metasfresh", "path": "de.metas.swat/de.metas.swat.base/src/main/java/de/metas/adempiere/form/terminal/table/TerminalTableModel.java", "license": "gpl-2.0", "size": 23929 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
286,007
public void configureRangeAxes() { for (ValueAxis axis: this.rangeAxes.values()) { if (axis != null) { axis.configure(); } } }
void function() { for (ValueAxis axis: this.rangeAxes.values()) { if (axis != null) { axis.configure(); } } }
/** * Configures the range axes. * * @see #configureDomainAxes() */
Configures the range axes
configureRangeAxes
{ "repo_name": "GitoMat/jfreechart", "path": "src/main/java/org/jfree/chart/plot/XYPlot.java", "license": "lgpl-2.1", "size": 197216 }
[ "org.jfree.chart.axis.ValueAxis" ]
import org.jfree.chart.axis.ValueAxis;
import org.jfree.chart.axis.*;
[ "org.jfree.chart" ]
org.jfree.chart;
1,415,350
public void updatePolicy(State s, AbstractGroundedAction a){ HashableState hashState = this.hashFactory.hashState(s); this.policyMemory.put(hashState, a); }
void function(State s, AbstractGroundedAction a){ HashableState hashState = this.hashFactory.hashState(s); this.policyMemory.put(hashState, a); }
/** * This method must be called when the maxQ value changes, which means that the action for the current state must be updated. * @param s current state * @param a applied local action */
This method must be called when the maxQ value changes, which means that the action for the current state must be updated
updatePolicy
{ "repo_name": "f-leno/DOO-Q_BRACIS2016", "path": "code/GoldMineMultiagent/src/goldmine/DOOQPolicy.java", "license": "mit", "size": 12024 }
[ "burlap.oomdp.core.AbstractGroundedAction", "burlap.oomdp.core.states.State", "burlap.oomdp.statehashing.HashableState" ]
import burlap.oomdp.core.AbstractGroundedAction; import burlap.oomdp.core.states.State; import burlap.oomdp.statehashing.HashableState;
import burlap.oomdp.core.*; import burlap.oomdp.core.states.*; import burlap.oomdp.statehashing.*;
[ "burlap.oomdp.core", "burlap.oomdp.statehashing" ]
burlap.oomdp.core; burlap.oomdp.statehashing;
842,485
private CswServer retrieveCapabilities() throws Exception { String capabUrl = this.task.getConfiguration().get("serviceURL"); //Create XML request. if (!Lib.net.isUrlValid(capabUrl)) throw new BadParameterEx("Capabilities URL", capabUrl); URL url = new URL( task.getConfiguration().get("serviceURL") + "?request=GetCapabilities&service=CSW&acceptVersions=2.0.2&acceptFormats=application%2Fxml"); XmlRequest req = new XmlRequest(url); //Setup proxy if needed. Lib.net.setupProxy(getContext(), req); //If user and password specified, log the user on the remote site. if (StringUtils.isNotBlank(task.getConfiguration().get("userName")) && StringUtils.isNotBlank(task.getConfiguration().get("password"))) { req.setCredentials(task.getConfiguration().get("userName"), task.getConfiguration().get("password")); } Element capabil = req.execute(); if (capabil.getName().equals("ExceptionReport")) CatalogException.unmarshal(capabil); CswServer server = new CswServer(capabil); if (!checkOperation(server, "GetRecords")) throw new OperationAbortedEx("GetRecords operation not found"); if (!checkOperation(server, "GetRecordById")) throw new OperationAbortedEx("GetRecordById operation not found"); return server; }
CswServer function() throws Exception { String capabUrl = this.task.getConfiguration().get(STR); if (!Lib.net.isUrlValid(capabUrl)) throw new BadParameterEx(STR, capabUrl); URL url = new URL( task.getConfiguration().get(STR) + STR); XmlRequest req = new XmlRequest(url); Lib.net.setupProxy(getContext(), req); if (StringUtils.isNotBlank(task.getConfiguration().get(STR)) && StringUtils.isNotBlank(task.getConfiguration().get(STR))) { req.setCredentials(task.getConfiguration().get(STR), task.getConfiguration().get(STR)); } Element capabil = req.execute(); if (capabil.getName().equals(STR)) CatalogException.unmarshal(capabil); CswServer server = new CswServer(capabil); if (!checkOperation(server, STR)) throw new OperationAbortedEx(STR); if (!checkOperation(server, STR)) throw new OperationAbortedEx(STR); return server; }
/** * Does CSW GetCapabilities request * and check that operations needed for harvesting * (ie. GetRecords and GetRecordById) * are available in remote node. */
Does CSW GetCapabilities request and check that operations needed for harvesting (ie. GetRecords and GetRecordById) are available in remote node
retrieveCapabilities
{ "repo_name": "OpenWIS/openwis", "path": "openwis-metadataportal/openwis-portal/src/main/java/org/openwis/metadataportal/kernel/harvest/csw/CSWHarvester.java", "license": "gpl-3.0", "size": 24156 }
[ "org.apache.commons.lang.StringUtils", "org.fao.geonet.csw.common.CswServer", "org.fao.geonet.csw.common.exceptions.CatalogException", "org.fao.geonet.lib.Lib", "org.jdom.Element" ]
import org.apache.commons.lang.StringUtils; import org.fao.geonet.csw.common.CswServer; import org.fao.geonet.csw.common.exceptions.CatalogException; import org.fao.geonet.lib.Lib; import org.jdom.Element;
import org.apache.commons.lang.*; import org.fao.geonet.csw.common.*; import org.fao.geonet.csw.common.exceptions.*; import org.fao.geonet.lib.*; import org.jdom.*;
[ "org.apache.commons", "org.fao.geonet", "org.jdom" ]
org.apache.commons; org.fao.geonet; org.jdom;
2,716,085
private void createButtons(Composite box) { addButton = createPushButton(box, "Add");//$NON-NLS-1$ removeButton = createPushButton(box, "Remove");//$NON-NLS-1$ upButton = createPushButton(box, "Up");//$NON-NLS-1$ downButton = createPushButton(box, "Down");//$NON-NLS-1$ }
void function(Composite box) { addButton = createPushButton(box, "Add"); removeButton = createPushButton(box, STR); upButton = createPushButton(box, "Up"); downButton = createPushButton(box, "Down"); }
/** * Creates the Add, Remove, Up, and Down button in the given button box. * * @param box the box for the buttons */
Creates the Add, Remove, Up, and Down button in the given button box
createButtons
{ "repo_name": "bobwalker99/Pydev", "path": "plugins/org.python.pydev.debug/src/org/python/pydev/debug/ui/TableEditor.java", "license": "epl-1.0", "size": 14405 }
[ "org.eclipse.swt.widgets.Composite" ]
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.*;
[ "org.eclipse.swt" ]
org.eclipse.swt;
376,365
@NotNull private String getDisplayableUrl(@Nullable String urlFromGit) { return !StringUtil.isEmptyOrSpaces(urlFromGit) ? urlFromGit : findPresetHttpUrl(); }
String function(@Nullable String urlFromGit) { return !StringUtil.isEmptyOrSpaces(urlFromGit) ? urlFromGit : findPresetHttpUrl(); }
/** * Get the URL to display to the user in the authentication dialog. */
Get the URL to display to the user in the authentication dialog
getDisplayableUrl
{ "repo_name": "Soya93/Extract-Refactoring", "path": "plugins/git4idea/src/git4idea/commands/GitHttpGuiAuthenticator.java", "license": "apache-2.0", "size": 12538 }
[ "com.intellij.openapi.util.text.StringUtil", "org.jetbrains.annotations.Nullable" ]
import com.intellij.openapi.util.text.StringUtil; import org.jetbrains.annotations.Nullable;
import com.intellij.openapi.util.text.*; import org.jetbrains.annotations.*;
[ "com.intellij.openapi", "org.jetbrains.annotations" ]
com.intellij.openapi; org.jetbrains.annotations;
1,446,500
@Test public void testRandomSetLength() throws Exception { try (FileObject file = this.createScratchFolder().resolveFile("random_write.txt")) { file.createFile(); final String fileString = file.toString(); final RandomAccessContent ra = file.getContent().getRandomAccessContent(RandomAccessMode.READWRITE); // Write long string ra.writeBytes(TEST_DATA); Assert.assertEquals(fileString, TEST_DATA.length(), ra.length()); // Shrink to length 1 ra.setLength(1); Assert.assertEquals(fileString, 1, ra.length()); // now read 1 ra.seek(0); Assert.assertEquals(fileString, TEST_DATA.charAt(0), ra.readByte()); try { ra.readByte(); Assert.fail("Expected " + Exception.class.getName()); } catch (final IOException e) { // Expected } // Grow to length 2 ra.setLength(2); Assert.assertEquals(fileString, 2, ra.length()); // We have an undefined extra byte ra.seek(1); ra.readByte(); } }
void function() throws Exception { try (FileObject file = this.createScratchFolder().resolveFile(STR)) { file.createFile(); final String fileString = file.toString(); final RandomAccessContent ra = file.getContent().getRandomAccessContent(RandomAccessMode.READWRITE); ra.writeBytes(TEST_DATA); Assert.assertEquals(fileString, TEST_DATA.length(), ra.length()); ra.setLength(1); Assert.assertEquals(fileString, 1, ra.length()); ra.seek(0); Assert.assertEquals(fileString, TEST_DATA.charAt(0), ra.readByte()); try { ra.readByte(); Assert.fail(STR + Exception.class.getName()); } catch (final IOException e) { } ra.setLength(2); Assert.assertEquals(fileString, 2, ra.length()); ra.seek(1); ra.readByte(); } }
/** * Writes a file */
Writes a file
testRandomSetLength
{ "repo_name": "apache/commons-vfs", "path": "commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderRandomSetLengthTests.java", "license": "apache-2.0", "size": 3140 }
[ "java.io.IOException", "org.apache.commons.vfs2.util.RandomAccessMode", "org.junit.Assert" ]
import java.io.IOException; import org.apache.commons.vfs2.util.RandomAccessMode; import org.junit.Assert;
import java.io.*; import org.apache.commons.vfs2.util.*; import org.junit.*;
[ "java.io", "org.apache.commons", "org.junit" ]
java.io; org.apache.commons; org.junit;
947,769
@ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux<ApiContractInner> listByProductAsync( String resourceGroupName, String serviceName, String productId) { final String filter = null; final Integer top = null; final Integer skip = null; return new PagedFlux<>( () -> listByProductSinglePageAsync(resourceGroupName, serviceName, productId, filter, top, skip), nextLink -> listByProductNextSinglePageAsync(nextLink)); }
@ServiceMethod(returns = ReturnType.COLLECTION) PagedFlux<ApiContractInner> function( String resourceGroupName, String serviceName, String productId) { final String filter = null; final Integer top = null; final Integer skip = null; return new PagedFlux<>( () -> listByProductSinglePageAsync(resourceGroupName, serviceName, productId, filter, top, skip), nextLink -> listByProductNextSinglePageAsync(nextLink)); }
/** * Lists a collection of the APIs associated with a product. * * @param resourceGroupName The name of the resource group. * @param serviceName The name of the API Management service. * @param productId Product identifier. Must be unique in the current API Management service instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return paged Api list representation. */
Lists a collection of the APIs associated with a product
listByProductAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/apimanagement/azure-resourcemanager-apimanagement/src/main/java/com/azure/resourcemanager/apimanagement/implementation/ProductApisClientImpl.java", "license": "mit", "size": 53563 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedFlux", "com.azure.resourcemanager.apimanagement.fluent.models.ApiContractInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedFlux; import com.azure.resourcemanager.apimanagement.fluent.models.ApiContractInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.apimanagement.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
2,773,150
public List<Integer> getAttackParts();
List<Integer> function();
/** * Get the parts of this URL that is part of an Attack. * @return The attacked parts */
Get the parts of this URL that is part of an Attack
getAttackParts
{ "repo_name": "SecUSo/nophish", "path": "app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/backend/PhishURL.java", "license": "gpl-3.0", "size": 3603 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,073,613
@Override public boolean dispatchKeyEvent(KeyEvent event) { // Send TextEvent in two cases: // 1. This is an ACTION_MULTIPLE event. // 2. The event was generated by on-screen keyboard and Ctrl, Alt and // Meta are not pressed. // This ensures that on-screen keyboard always injects input that // correspond to what user sees on the screen, while physical keyboard // acts as if it is connected to the remote host. if (event.getAction() == KeyEvent.ACTION_MULTIPLE) { JniInterface.sendTextEvent(event.getCharacters()); return super.dispatchKeyEvent(event); } int keyCode = event.getKeyCode(); boolean pressed = event.getAction() == KeyEvent.ACTION_DOWN; // For Enter getUnicodeChar() returns 10 (line feed), but we still // want to send it as KeyEvent. int unicode = keyCode != KeyEvent.KEYCODE_ENTER ? event.getUnicodeChar() : 0; boolean no_modifiers = !event.isAltPressed() && !event.isCtrlPressed() && !event.isMetaPressed(); if (event.getDeviceId() == KeyCharacterMap.VIRTUAL_KEYBOARD && pressed && unicode != 0 && no_modifiers) { mPressedTextKeys.add(keyCode); int[] codePoints = { unicode }; JniInterface.sendTextEvent(new String(codePoints, 0, 1)); return true; } if (!pressed && mPressedTextKeys.contains(keyCode)) { mPressedTextKeys.remove(keyCode); return true; } switch (keyCode) { case KeyEvent.KEYCODE_AT: JniInterface.sendKeyEvent(KeyEvent.KEYCODE_SHIFT_LEFT, pressed); JniInterface.sendKeyEvent(KeyEvent.KEYCODE_2, pressed); return true; case KeyEvent.KEYCODE_POUND: JniInterface.sendKeyEvent(KeyEvent.KEYCODE_SHIFT_LEFT, pressed); JniInterface.sendKeyEvent(KeyEvent.KEYCODE_3, pressed); return true; case KeyEvent.KEYCODE_STAR: JniInterface.sendKeyEvent(KeyEvent.KEYCODE_SHIFT_LEFT, pressed); JniInterface.sendKeyEvent(KeyEvent.KEYCODE_8, pressed); return true; case KeyEvent.KEYCODE_PLUS: JniInterface.sendKeyEvent(KeyEvent.KEYCODE_SHIFT_LEFT, pressed); JniInterface.sendKeyEvent(KeyEvent.KEYCODE_EQUALS, pressed); return true; default: // We try to send all other key codes to the host directly. return JniInterface.sendKeyEvent(keyCode, pressed); } }
boolean function(KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_MULTIPLE) { JniInterface.sendTextEvent(event.getCharacters()); return super.dispatchKeyEvent(event); } int keyCode = event.getKeyCode(); boolean pressed = event.getAction() == KeyEvent.ACTION_DOWN; int unicode = keyCode != KeyEvent.KEYCODE_ENTER ? event.getUnicodeChar() : 0; boolean no_modifiers = !event.isAltPressed() && !event.isCtrlPressed() && !event.isMetaPressed(); if (event.getDeviceId() == KeyCharacterMap.VIRTUAL_KEYBOARD && pressed && unicode != 0 && no_modifiers) { mPressedTextKeys.add(keyCode); int[] codePoints = { unicode }; JniInterface.sendTextEvent(new String(codePoints, 0, 1)); return true; } if (!pressed && mPressedTextKeys.contains(keyCode)) { mPressedTextKeys.remove(keyCode); return true; } switch (keyCode) { case KeyEvent.KEYCODE_AT: JniInterface.sendKeyEvent(KeyEvent.KEYCODE_SHIFT_LEFT, pressed); JniInterface.sendKeyEvent(KeyEvent.KEYCODE_2, pressed); return true; case KeyEvent.KEYCODE_POUND: JniInterface.sendKeyEvent(KeyEvent.KEYCODE_SHIFT_LEFT, pressed); JniInterface.sendKeyEvent(KeyEvent.KEYCODE_3, pressed); return true; case KeyEvent.KEYCODE_STAR: JniInterface.sendKeyEvent(KeyEvent.KEYCODE_SHIFT_LEFT, pressed); JniInterface.sendKeyEvent(KeyEvent.KEYCODE_8, pressed); return true; case KeyEvent.KEYCODE_PLUS: JniInterface.sendKeyEvent(KeyEvent.KEYCODE_SHIFT_LEFT, pressed); JniInterface.sendKeyEvent(KeyEvent.KEYCODE_EQUALS, pressed); return true; default: return JniInterface.sendKeyEvent(keyCode, pressed); } }
/** * Called once when a keyboard key is pressed, then again when that same key is released. This * is not guaranteed to be notified of all soft keyboard events: certian keyboards might not * call it at all, while others might skip it in certain situations (e.g. swipe input). */
Called once when a keyboard key is pressed, then again when that same key is released. This is not guaranteed to be notified of all soft keyboard events: certian keyboards might not call it at all, while others might skip it in certain situations (e.g. swipe input)
dispatchKeyEvent
{ "repo_name": "chromium2014/src", "path": "remoting/android/java/src/org/chromium/chromoting/Desktop.java", "license": "bsd-3-clause", "size": 9702 }
[ "android.view.KeyCharacterMap", "android.view.KeyEvent", "org.chromium.chromoting.jni.JniInterface" ]
import android.view.KeyCharacterMap; import android.view.KeyEvent; import org.chromium.chromoting.jni.JniInterface;
import android.view.*; import org.chromium.chromoting.jni.*;
[ "android.view", "org.chromium.chromoting" ]
android.view; org.chromium.chromoting;
2,751,350
private void setRect(int x, int y, int width, int height) { if (this.rect == null) { this.rect = new Rectangle2D.Double(x, y, width, height); } else { this.rect.setRect(x, y, width, height); } }
void function(int x, int y, int width, int height) { if (this.rect == null) { this.rect = new Rectangle2D.Double(x, y, width, height); } else { this.rect.setRect(x, y, width, height); } }
/** * Sets the attributes of the reusable {@link Rectangle2D} object that is * used by the {@link FXGraphics2D#drawRect(int, int, int, int)} and * {@link FXGraphics2D#fillRect(int, int, int, int)} methods. * * @param x the x-coordinate. * @param y the y-coordinate. * @param width the width. * @param height the height. */
Sets the attributes of the reusable <code>Rectangle2D</code> object that is used by the <code>FXGraphics2D#drawRect(int, int, int, int)</code> and <code>FXGraphics2D#fillRect(int, int, int, int)</code> methods
setRect
{ "repo_name": "informatik-mannheim/Moduro-Toolbox", "path": "src/main/java/de/hs/mannheim/modUro/controller/diagram/fx/FXGraphics2D.java", "license": "apache-2.0", "size": 60103 }
[ "java.awt.geom.Rectangle2D" ]
import java.awt.geom.Rectangle2D;
import java.awt.geom.*;
[ "java.awt" ]
java.awt;
1,997,089
operations.add(operation); Tag<R> tag = tag(tags.size()); tags.add(tag); return tag; }
operations.add(operation); Tag<R> tag = tag(tags.size()); tags.add(tag); return tag; }
/** * Adds the supplied aggregate operation to the composite. Use the returned * {@link Tag} as a key in the {@link ItemsByTag} you get in the result of * the composite aggregation. * * @param <R> the result type of this operation */
Adds the supplied aggregate operation to the composite. Use the returned <code>Tag</code> as a key in the <code>ItemsByTag</code> you get in the result of the composite aggregation
add
{ "repo_name": "jerrinot/hazelcast", "path": "hazelcast/src/main/java/com/hazelcast/jet/aggregate/AllOfAggregationBuilder.java", "license": "apache-2.0", "size": 5323 }
[ "com.hazelcast.jet.datamodel.Tag" ]
import com.hazelcast.jet.datamodel.Tag;
import com.hazelcast.jet.datamodel.*;
[ "com.hazelcast.jet" ]
com.hazelcast.jet;
2,587,984
private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException { boolean isValueNumeric = false; try { if (value.equals("0") || !value.endsWith("0")) { Double.parseDouble(value); isValueNumeric = true; } } catch (NumberFormatException e) { isValueNumeric = false; } if (json.charAt(json.length() - 1) != '{') { json.append(','); } json.append(escapeJSON(key)); json.append(':'); if (isValueNumeric) { json.append(value); } else { json.append(escapeJSON(value)); } }
static void function(StringBuilder json, String key, String value) throws UnsupportedEncodingException { boolean isValueNumeric = false; try { if (value.equals("0") !value.endsWith("0")) { Double.parseDouble(value); isValueNumeric = true; } } catch (NumberFormatException e) { isValueNumeric = false; } if (json.charAt(json.length() - 1) != '{') { json.append(','); } json.append(escapeJSON(key)); json.append(':'); if (isValueNumeric) { json.append(value); } else { json.append(escapeJSON(value)); } }
/** * Appends a json encoded key/value pair to the given string builder. * * @param json * @param key * @param value * @throws UnsupportedEncodingException */
Appends a json encoded key/value pair to the given string builder
appendJSONPair
{ "repo_name": "marti201/StyleTP", "path": "StyleTP/src/me/marti201/styletp/MetricsLite.java", "license": "gpl-3.0", "size": 18862 }
[ "java.io.UnsupportedEncodingException" ]
import java.io.UnsupportedEncodingException;
import java.io.*;
[ "java.io" ]
java.io;
687,144
public static String readMessageTemplate(String filePath) { BufferedReader bufferedReader = null; String template = null; // Stop proceeding if required arguments are not present if (StringUtils.isEmpty(filePath)) { throw new IllegalArgumentException("File path should not be empty"); } // Reading the content of the file if (logger.isDebugEnabled()) { logger.debug("Reading template file in " + filePath); } try { String currentLine; bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(filePath), StandardCharsets.UTF_8)); StringBuilder templateBuilder = new StringBuilder(); while ((currentLine = bufferedReader.readLine()) != null) { templateBuilder.append(currentLine); templateBuilder.append(System.getProperty("line.separator")); } template = templateBuilder.toString(); } catch (IOException e) { logger.error("Error while reading email template from location " + filePath, e); } finally { try { if (bufferedReader != null) { bufferedReader.close(); } } catch (IOException e) { logger.error("Error while closing buffered reader after reading file " + filePath, e); } } return template; }
static String function(String filePath) { BufferedReader bufferedReader = null; String template = null; if (StringUtils.isEmpty(filePath)) { throw new IllegalArgumentException(STR); } if (logger.isDebugEnabled()) { logger.debug(STR + filePath); } try { String currentLine; bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(filePath), StandardCharsets.UTF_8)); StringBuilder templateBuilder = new StringBuilder(); while ((currentLine = bufferedReader.readLine()) != null) { templateBuilder.append(currentLine); templateBuilder.append(System.getProperty(STR)); } template = templateBuilder.toString(); } catch (IOException e) { logger.error(STR + filePath, e); } finally { try { if (bufferedReader != null) { bufferedReader.close(); } } catch (IOException e) { logger.error(STR + filePath, e); } } return template; }
/** * Read the file which is in given path and build the message template. * * @param filePath Path of the message template file * @return String which contains message template */
Read the file which is in given path and build the message template
readMessageTemplate
{ "repo_name": "omindu/carbon-identity-commons", "path": "components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/internal/EventUtils.java", "license": "apache-2.0", "size": 8879 }
[ "java.io.BufferedReader", "java.io.FileInputStream", "java.io.IOException", "java.io.InputStreamReader", "java.nio.charset.StandardCharsets", "org.apache.commons.lang3.StringUtils" ]
import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import org.apache.commons.lang3.StringUtils;
import java.io.*; import java.nio.charset.*; import org.apache.commons.lang3.*;
[ "java.io", "java.nio", "org.apache.commons" ]
java.io; java.nio; org.apache.commons;
2,891,816
@ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable<MicrosoftGraphDeviceInner> listDevice() { final String consistencyLevel = null; final Integer top = null; final Integer skip = null; final String search = null; final String filter = null; final Boolean count = null; final List<DevicesDeviceOrderby> orderby = null; final List<DevicesDeviceSelect> select = null; final List<DevicesDeviceExpand> expand = null; return new PagedIterable<>( listDeviceAsync(consistencyLevel, top, skip, search, filter, count, orderby, select, expand)); }
@ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable<MicrosoftGraphDeviceInner> function() { final String consistencyLevel = null; final Integer top = null; final Integer skip = null; final String search = null; final String filter = null; final Boolean count = null; final List<DevicesDeviceOrderby> orderby = null; final List<DevicesDeviceSelect> select = null; final List<DevicesDeviceExpand> expand = null; return new PagedIterable<>( listDeviceAsync(consistencyLevel, top, skip, search, filter, count, orderby, select, expand)); }
/** * Get entities from devices. * * @throws OdataErrorMainException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return entities from devices. */
Get entities from devices
listDevice
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-authorization/src/main/java/com/azure/resourcemanager/authorization/implementation/DevicesDevicesClientImpl.java", "license": "mit", "size": 45068 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedIterable", "com.azure.resourcemanager.authorization.fluent.models.DevicesDeviceExpand", "com.azure.resourcemanager.authorization.fluent.models.DevicesDeviceOrderby", "com.azure.resourcemanager.authorization.fluent.models.DevicesDeviceSelect", "com.azure.resourcemanager.authorization.fluent.models.MicrosoftGraphDeviceInner", "java.util.List" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedIterable; import com.azure.resourcemanager.authorization.fluent.models.DevicesDeviceExpand; import com.azure.resourcemanager.authorization.fluent.models.DevicesDeviceOrderby; import com.azure.resourcemanager.authorization.fluent.models.DevicesDeviceSelect; import com.azure.resourcemanager.authorization.fluent.models.MicrosoftGraphDeviceInner; import java.util.List;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.authorization.fluent.models.*; import java.util.*;
[ "com.azure.core", "com.azure.resourcemanager", "java.util" ]
com.azure.core; com.azure.resourcemanager; java.util;
147,816
boolean checkForDuplicatePerson(InstitutionalProposal institutionalProposal, InstitutionalProposalPerson newProjectPerson) { boolean valid = true; for(InstitutionalProposalPerson p: institutionalProposal.getProjectPersons()) { if (p.getClass().equals(newProjectPerson.getClass()) && p.getContact().getIdentifier().equals(newProjectPerson.getContact().getIdentifier()) && isImportantPerson(p) && isImportantPerson(newProjectPerson)) { valid = false; break; } } if(!valid) { GlobalVariables.getMessageMap().putError(PROPOSAL_PROJECT_PERSON_LIST_ERROR_KEY, ERROR_PROPOSAL_PROJECT_PERSON_EXISTS, newProjectPerson.getContact().getFullName()); } return valid; }
boolean checkForDuplicatePerson(InstitutionalProposal institutionalProposal, InstitutionalProposalPerson newProjectPerson) { boolean valid = true; for(InstitutionalProposalPerson p: institutionalProposal.getProjectPersons()) { if (p.getClass().equals(newProjectPerson.getClass()) && p.getContact().getIdentifier().equals(newProjectPerson.getContact().getIdentifier()) && isImportantPerson(p) && isImportantPerson(newProjectPerson)) { valid = false; break; } } if(!valid) { GlobalVariables.getMessageMap().putError(PROPOSAL_PROJECT_PERSON_LIST_ERROR_KEY, ERROR_PROPOSAL_PROJECT_PERSON_EXISTS, newProjectPerson.getContact().getFullName()); } return valid; }
/** * Verify no duplicate person * @param institutionalProposal * @param newProjectPerson * @return */
Verify no duplicate person
checkForDuplicatePerson
{ "repo_name": "sanjupolus/KC6.oLatest", "path": "coeus-impl/src/main/java/org/kuali/kra/institutionalproposal/contacts/InstitutionalProposalProjectPersonAddRuleImpl.java", "license": "agpl-3.0", "size": 4350 }
[ "org.kuali.kra.institutionalproposal.home.InstitutionalProposal", "org.kuali.rice.krad.util.GlobalVariables" ]
import org.kuali.kra.institutionalproposal.home.InstitutionalProposal; import org.kuali.rice.krad.util.GlobalVariables;
import org.kuali.kra.institutionalproposal.home.*; import org.kuali.rice.krad.util.*;
[ "org.kuali.kra", "org.kuali.rice" ]
org.kuali.kra; org.kuali.rice;
11,135
private void parseData(Workbook workbook, ScreenResult screenResult, IntRange plateNumberRange, boolean incrementalFlush) throws ExtantLibraryException, IOException, UnrecoverableScreenResultParseException { log.debug("incrementalFlush:" + incrementalFlush); long startTime = System.currentTimeMillis(); long loopTime = startTime; int wellsWithDataLoaded = 0; int dataSheetsParsed = 0; int totalSheets = workbook.getWorkbook().getNumberOfSheets(); int firstDataSheetIndex = workbook.getWorksheet(DATA_COLUMNS_SHEET_NAME).getSheetIndex() + 1; int totalDataSheets = Math.max(0, totalSheets - firstDataSheetIndex); plateNumberRange = plateNumberRange == null ? new IntRange(Integer.MIN_VALUE, Integer.MAX_VALUE) : plateNumberRange; // Note: we do this to make sure that the DataColumn's are persisted before we persist and clear the RV's if (screenResult.getEntityId() == null) { _genericEntityDao.persistEntity(screenResult); } else { _genericEntityDao.saveOrUpdateEntity(screenResult); } _genericEntityDao.flush(); for (int iSheet = firstDataSheetIndex; iSheet < totalSheets; ++iSheet) { String sheetName = workbook.getWorkbook().getSheet(iSheet).getName(); log.info("parsing sheet " + (dataSheetsParsed + 1) + " of " + totalDataSheets + ", " + sheetName); Worksheet worksheet = workbook.getWorksheet(iSheet).forOrigin(0, DATA_SHEET__FIRST_DATA_ROW_INDEX); for (Row row : worksheet) { // bring in the old findNextRow() logic if (row.getColumns() > 0 && !row.getCell(0).isEmpty() && row.getCell(0).getAsString().trim().length() > 0 ) { Integer plateNumber = row.getCell(WellInfoColumn.PLATE.ordinal(), true).getInteger(); Cell wellNameCell = row.getCell(WellInfoColumn.WELL_NAME.ordinal()); String wellName = _wellNameParser.parse(wellNameCell); if (!wellName.equals("")) { WellKey wellKey = new WellKey(plateNumber, wellName); if (!plateNumberRange.containsInteger(wellKey.getPlateNumber())) { if (log.isDebugEnabled()) { log.debug("Skipping, excluded range: " + plateNumberRange + ", row: " + row.getRow()); } } else { boolean duplicate = !parsedWellKeys.add(wellKey.getKey()); if (duplicate) { if (!_ignoreDuplicateErrors) { wellNameCell.addError("duplicate well: " + wellKey); } else { log.debug("duplicate well: " + wellKey + ", duplicate found at: " + wellNameCell); } } else { if (findLibraryWithPlate(wellKey.getPlateNumber()) == null) { wellNameCell.addError(NO_SUCH_LIBRARY_WITH_PLATE); } else { Well well = _librariesDao.findWell(wellKey); if (well == null) { wellNameCell.addError(NO_SUCH_WELL + ": " + wellKey); } else if (findAssayWell(well) == null) { readResultValues(screenResult, row, well, incrementalFlush); ++wellsWithDataLoaded; if (incrementalFlush && wellsWithDataLoaded % AbstractDAO.ROWS_TO_CACHE == 0) { saveResultValuesAndFlush(screenResult, incrementalFlush); if (log.isInfoEnabled() && wellsWithDataLoaded % (AbstractDAO.ROWS_TO_CACHE * 100) == 0) { long time = System.currentTimeMillis(); long cumulativeTime = time - startTime; log.info("wellsWithDataLoaded: " + wellsWithDataLoaded + ", cumulative time: " + (double)cumulativeTime/(double)60000 + " min, avg row time: " + (double)cumulativeTime/(double)wellsWithDataLoaded + ", loopTime: " + (time - loopTime) ); loopTime = time; } } // incremental } } } } } } } // for row ++dataSheetsParsed; if (wellsWithDataLoaded > 0) { saveResultValuesAndFlush(screenResult, incrementalFlush); log.info("Sheet: " + sheetName + " done, save, count: " + wellsWithDataLoaded); long time = System.currentTimeMillis(); long cumulativeTime = time - startTime; log.info("wellsWithDataLoaded: " + wellsWithDataLoaded + ", cumulative time: " + (double)cumulativeTime/(double)60000 + " min, avg row time: " + (double)cumulativeTime/(double)wellsWithDataLoaded ); } } if (dataSheetsParsed == 0) { _workbook.addError(NO_DATA_SHEETS_FOUND_ERROR); } else { log.info("done parsing " + dataSheetsParsed + " data sheet(s) " + workbook.getName()); log.info("loaded data for " + wellsWithDataLoaded + " well(s) "); } }
void function(Workbook workbook, ScreenResult screenResult, IntRange plateNumberRange, boolean incrementalFlush) throws ExtantLibraryException, IOException, UnrecoverableScreenResultParseException { log.debug(STR + incrementalFlush); long startTime = System.currentTimeMillis(); long loopTime = startTime; int wellsWithDataLoaded = 0; int dataSheetsParsed = 0; int totalSheets = workbook.getWorkbook().getNumberOfSheets(); int firstDataSheetIndex = workbook.getWorksheet(DATA_COLUMNS_SHEET_NAME).getSheetIndex() + 1; int totalDataSheets = Math.max(0, totalSheets - firstDataSheetIndex); plateNumberRange = plateNumberRange == null ? new IntRange(Integer.MIN_VALUE, Integer.MAX_VALUE) : plateNumberRange; if (screenResult.getEntityId() == null) { _genericEntityDao.persistEntity(screenResult); } else { _genericEntityDao.saveOrUpdateEntity(screenResult); } _genericEntityDao.flush(); for (int iSheet = firstDataSheetIndex; iSheet < totalSheets; ++iSheet) { String sheetName = workbook.getWorkbook().getSheet(iSheet).getName(); log.info(STR + (dataSheetsParsed + 1) + STR + totalDataSheets + STR + sheetName); Worksheet worksheet = workbook.getWorksheet(iSheet).forOrigin(0, DATA_SHEET__FIRST_DATA_ROW_INDEX); for (Row row : worksheet) { if (row.getColumns() > 0 && !row.getCell(0).isEmpty() && row.getCell(0).getAsString().trim().length() > 0 ) { Integer plateNumber = row.getCell(WellInfoColumn.PLATE.ordinal(), true).getInteger(); Cell wellNameCell = row.getCell(WellInfoColumn.WELL_NAME.ordinal()); String wellName = _wellNameParser.parse(wellNameCell); if (!wellName.equals(STRSkipping, excluded range: STR, row: STRduplicate well: STRduplicate well: STR, duplicate found at: STR: STRwellsWithDataLoaded: STR, cumulative time: STR min, avg row time: STR, loopTime: STRSheet: STR done, save, count: STRwellsWithDataLoaded: STR, cumulative time: STR min, avg row time: STRdone parsing STR data sheet(s) STRloaded data for STR well(s) "); } }
/** * Parse the workbook containing the ScreenResult data. * * @param workbook the workbook containing some or all of the raw data for a * ScreenResult * @throws ExtantLibraryException if an existing Well entity cannot be found * in the database * @throws IOException * @throws UnrecoverableScreenResultParseException */
Parse the workbook containing the ScreenResult data
parseData
{ "repo_name": "hmsiccbl/screensaver", "path": "core/src/main/java/edu/harvard/med/screensaver/io/screenresults/ScreenResultParser.java", "license": "gpl-2.0", "size": 37933 }
[ "edu.harvard.med.screensaver.io.libraries.ExtantLibraryException", "edu.harvard.med.screensaver.io.workbook2.Cell", "edu.harvard.med.screensaver.io.workbook2.Row", "edu.harvard.med.screensaver.io.workbook2.Workbook", "edu.harvard.med.screensaver.io.workbook2.Worksheet", "edu.harvard.med.screensaver.model.screenresults.ScreenResult", "java.io.IOException", "org.apache.commons.lang.math.IntRange" ]
import edu.harvard.med.screensaver.io.libraries.ExtantLibraryException; import edu.harvard.med.screensaver.io.workbook2.Cell; import edu.harvard.med.screensaver.io.workbook2.Row; import edu.harvard.med.screensaver.io.workbook2.Workbook; import edu.harvard.med.screensaver.io.workbook2.Worksheet; import edu.harvard.med.screensaver.model.screenresults.ScreenResult; import java.io.IOException; import org.apache.commons.lang.math.IntRange;
import edu.harvard.med.screensaver.io.libraries.*; import edu.harvard.med.screensaver.io.workbook2.*; import edu.harvard.med.screensaver.model.screenresults.*; import java.io.*; import org.apache.commons.lang.math.*;
[ "edu.harvard.med", "java.io", "org.apache.commons" ]
edu.harvard.med; java.io; org.apache.commons;
2,131,908
boolean valid = true; if (StringUtils.isBlank(actionBean.getNewCommitteeId())) { valid = false; GlobalVariables.getMessageMap().putError(Constants.PROTOCOL_ASSIGN_CMT_SCHED_ACTION_PROPERTY_KEY + ".committeeId", KeyConstants.ERROR_PROTOCOL_COMMITTEE_NOT_SELECTED); } if (document.getProtocol().isFollowupAction(ProtocolActionType.NOTIFIED_COMMITTEE) && StringUtils.isBlank(actionBean.getNewScheduleId())) { valid = false; GlobalVariables.getMessageMap().putError(Constants.PROTOCOL_ASSIGN_CMT_SCHED_ACTION_PROPERTY_KEY + ".scheduleId", KeyConstants.ERROR_PROTOCOL_SCHEDULE_NOT_SELECTED); } return valid; }
boolean valid = true; if (StringUtils.isBlank(actionBean.getNewCommitteeId())) { valid = false; GlobalVariables.getMessageMap().putError(Constants.PROTOCOL_ASSIGN_CMT_SCHED_ACTION_PROPERTY_KEY + STR, KeyConstants.ERROR_PROTOCOL_COMMITTEE_NOT_SELECTED); } if (document.getProtocol().isFollowupAction(ProtocolActionType.NOTIFIED_COMMITTEE) && StringUtils.isBlank(actionBean.getNewScheduleId())) { valid = false; GlobalVariables.getMessageMap().putError(Constants.PROTOCOL_ASSIGN_CMT_SCHED_ACTION_PROPERTY_KEY + STR, KeyConstants.ERROR_PROTOCOL_SCHEDULE_NOT_SELECTED); } return valid; }
/** * Verify that a committee has been selected. * @see org.kuali.kra.irb.actions.assigncmtsched.ExecuteProtocolAssignCmtSchedRule#processAssignToCommitteeSchedule(org.kuali.kra.irb.ProtocolDocument, org.kuali.kra.irb.actions.assigncmtsched.ProtocolAssignCmtSchedBean) */
Verify that a committee has been selected
processAssignToCommitteeSchedule
{ "repo_name": "mukadder/kc", "path": "coeus-impl/src/main/java/org/kuali/kra/irb/actions/assigncmtsched/ProtocolAssignCmtSchedRule.java", "license": "agpl-3.0", "size": 2673 }
[ "org.apache.commons.lang3.StringUtils", "org.kuali.kra.infrastructure.Constants", "org.kuali.kra.infrastructure.KeyConstants", "org.kuali.kra.irb.actions.ProtocolActionType", "org.kuali.rice.krad.util.GlobalVariables" ]
import org.apache.commons.lang3.StringUtils; import org.kuali.kra.infrastructure.Constants; import org.kuali.kra.infrastructure.KeyConstants; import org.kuali.kra.irb.actions.ProtocolActionType; import org.kuali.rice.krad.util.GlobalVariables;
import org.apache.commons.lang3.*; import org.kuali.kra.infrastructure.*; import org.kuali.kra.irb.actions.*; import org.kuali.rice.krad.util.*;
[ "org.apache.commons", "org.kuali.kra", "org.kuali.rice" ]
org.apache.commons; org.kuali.kra; org.kuali.rice;
1,575,233
@GwtCompatible(serializable = true) @Beta public static <K extends Enum<K>, V> ImmutableMap<K, V> immutableEnumMap( Map<K, ? extends V> map) { if (map instanceof ImmutableEnumMap) { @SuppressWarnings("unchecked") // safe covariant cast ImmutableEnumMap<K, V> result = (ImmutableEnumMap<K, V>) map; return result; } else if (map.isEmpty()) { return ImmutableMap.of(); } else { for (Map.Entry<K, ? extends V> entry : map.entrySet()) { checkNotNull(entry.getKey()); checkNotNull(entry.getValue()); } return ImmutableEnumMap.asImmutable(new EnumMap<K, V>(map)); } } /** * Creates a <i>mutable</i>, empty {@code HashMap} instance. * * <p><b>Note:</b> if mutability is not required, use {@link * ImmutableMap#of()} instead. * * <p><b>Note:</b> if {@code K} is an {@code enum} type, use {@link * #newEnumMap} instead. * * @return a new, empty {@code HashMap}
@GwtCompatible(serializable = true) static <K extends Enum<K>, V> ImmutableMap<K, V> function( Map<K, ? extends V> map) { if (map instanceof ImmutableEnumMap) { @SuppressWarnings(STR) ImmutableEnumMap<K, V> result = (ImmutableEnumMap<K, V>) map; return result; } else if (map.isEmpty()) { return ImmutableMap.of(); } else { for (Map.Entry<K, ? extends V> entry : map.entrySet()) { checkNotNull(entry.getKey()); checkNotNull(entry.getValue()); } return ImmutableEnumMap.asImmutable(new EnumMap<K, V>(map)); } } /** * Creates a <i>mutable</i>, empty {@code HashMap} instance. * * <p><b>Note:</b> if mutability is not required, use { * ImmutableMap#of()} instead. * * <p><b>Note:</b> if {@code K} is an {@code enum} type, use { * #newEnumMap} instead. * * @return a new, empty {@code HashMap}
/** * Returns an immutable map instance containing the given entries. * Internally, the returned map will be backed by an {@link EnumMap}. * * <p>The iteration order of the returned map follows the enum's iteration * order, not the order in which the elements appear in the given map. * * @param map the map to make an immutable copy of * @return an immutable map containing those entries * @since 14.0 */
Returns an immutable map instance containing the given entries. Internally, the returned map will be backed by an <code>EnumMap</code>. The iteration order of the returned map follows the enum's iteration order, not the order in which the elements appear in the given map
immutableEnumMap
{ "repo_name": "janus-project/guava.janusproject.io", "path": "guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/Maps.java", "license": "apache-2.0", "size": 99232 }
[ "com.google.common.annotations.GwtCompatible", "com.google.common.base.Preconditions", "java.util.EnumMap", "java.util.HashMap", "java.util.Map" ]
import com.google.common.annotations.GwtCompatible; import com.google.common.base.Preconditions; import java.util.EnumMap; import java.util.HashMap; import java.util.Map;
import com.google.common.annotations.*; import com.google.common.base.*; import java.util.*;
[ "com.google.common", "java.util" ]
com.google.common; java.util;
2,627,859
private TaskListForm getInitialForm() { List<TaskForm> tasks = new ArrayList<TaskForm>(); tasks.add(new TaskForm()); return new TaskListForm().setTasklist(tasks); }
TaskListForm function() { List<TaskForm> tasks = new ArrayList<TaskForm>(); tasks.add(new TaskForm()); return new TaskListForm().setTasklist(tasks); }
/** * Get the initialized form. * @return TaskListForm. */
Get the initialized form
getInitialForm
{ "repo_name": "d-saitou/Spring4MvcExample", "path": "src/main/java/com/example/springmvc/application/di/controller/TaskCreateController.java", "license": "mit", "size": 2771 }
[ "com.example.springmvc.application.form.TaskForm", "com.example.springmvc.application.form.TaskListForm", "java.util.ArrayList", "java.util.List" ]
import com.example.springmvc.application.form.TaskForm; import com.example.springmvc.application.form.TaskListForm; import java.util.ArrayList; import java.util.List;
import com.example.springmvc.application.form.*; import java.util.*;
[ "com.example.springmvc", "java.util" ]
com.example.springmvc; java.util;
2,380,490
protected Map<String, String> getGroupPermissionDetails(View view, Object dataObject, Group group) { Map<String, String> permissionDetails = new HashMap<String, String>(); permissionDetails.put(KimConstants.AttributeConstants.NAMESPACE_CODE, view.getViewNamespaceCode()); permissionDetails.put(KimConstants.AttributeConstants.VIEW_ID, view.getId()); permissionDetails.put(KimConstants.AttributeConstants.GROUP_ID, group.getId()); if (group instanceof CollectionGroup) { permissionDetails.put(KimConstants.AttributeConstants.COLLECTION_PROPERTY_NAME, ((CollectionGroup) group).getPropertyName()); } return permissionDetails; }
Map<String, String> function(View view, Object dataObject, Group group) { Map<String, String> permissionDetails = new HashMap<String, String>(); permissionDetails.put(KimConstants.AttributeConstants.NAMESPACE_CODE, view.getViewNamespaceCode()); permissionDetails.put(KimConstants.AttributeConstants.VIEW_ID, view.getId()); permissionDetails.put(KimConstants.AttributeConstants.GROUP_ID, group.getId()); if (group instanceof CollectionGroup) { permissionDetails.put(KimConstants.AttributeConstants.COLLECTION_PROPERTY_NAME, ((CollectionGroup) group).getPropertyName()); } return permissionDetails; }
/** * Builds the permission details map for a group which includes the component namespace, component name, and * group id, in addition to property name for collection groups * * @param view - view instance the group belongs to * @param dataObject - default object from the data model (used for subclasses to build details) * @param group - group instance the details are being built for * @return Map<String, String> permission details for the group */
Builds the permission details map for a group which includes the component namespace, component name, and group id, in addition to property name for collection groups
getGroupPermissionDetails
{ "repo_name": "ua-eas/ua-rice-2.1.9", "path": "krad/krad-web-framework/src/main/java/org/kuali/rice/krad/uif/view/ViewAuthorizerBase.java", "license": "apache-2.0", "size": 30338 }
[ "java.util.HashMap", "java.util.Map", "org.kuali.rice.kim.api.KimConstants", "org.kuali.rice.krad.uif.container.CollectionGroup", "org.kuali.rice.krad.uif.container.Group" ]
import java.util.HashMap; import java.util.Map; import org.kuali.rice.kim.api.KimConstants; import org.kuali.rice.krad.uif.container.CollectionGroup; import org.kuali.rice.krad.uif.container.Group;
import java.util.*; import org.kuali.rice.kim.api.*; import org.kuali.rice.krad.uif.container.*;
[ "java.util", "org.kuali.rice" ]
java.util; org.kuali.rice;
2,697,363
public ApplicationExceptionType<AssemblyDescriptorType<T>> createApplicationException() { return new ApplicationExceptionTypeImpl<AssemblyDescriptorType<T>>(this, "application-exception", childNode); }
ApplicationExceptionType<AssemblyDescriptorType<T>> function() { return new ApplicationExceptionTypeImpl<AssemblyDescriptorType<T>>(this, STR, childNode); }
/** * Creates a new <code>application-exception</code> element * @return the new created instance of <code>ApplicationExceptionType<AssemblyDescriptorType<T>></code> */
Creates a new <code>application-exception</code> element
createApplicationException
{ "repo_name": "forge/javaee-descriptors", "path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/ejbjar31/AssemblyDescriptorTypeImpl.java", "license": "epl-1.0", "size": 19919 }
[ "org.jboss.shrinkwrap.descriptor.api.ejbjar31.ApplicationExceptionType", "org.jboss.shrinkwrap.descriptor.api.ejbjar31.AssemblyDescriptorType" ]
import org.jboss.shrinkwrap.descriptor.api.ejbjar31.ApplicationExceptionType; import org.jboss.shrinkwrap.descriptor.api.ejbjar31.AssemblyDescriptorType;
import org.jboss.shrinkwrap.descriptor.api.ejbjar31.*;
[ "org.jboss.shrinkwrap" ]
org.jboss.shrinkwrap;
576,115
@SuppressWarnings("unchecked") public static EMap<Object, Object> castToEMap(Object value) { return (EMap<Object,Object>) value; }
@SuppressWarnings(STR) static EMap<Object, Object> function(Object value) { return (EMap<Object,Object>) value; }
/** * <p> * This method encapsulate an unchecked cast from Object to EMap<Object, Object>. * This case can not be performed type safe, because type parameters are not * available for reflective access to Ecore models. * </p> * * @return the same object casted to a map */
This method encapsulate an unchecked cast from Object to EMap. This case can not be performed type safe, because type parameters are not available for reflective access to Ecore models.
castToEMap
{ "repo_name": "DarwinSPL/DarwinSPL", "path": "plugins/eu.hyvar.feature.constraint.resource.hyconstraints/src-gen/eu/hyvar/feature/constraint/resource/hyconstraints/util/HyconstraintsMapUtil.java", "license": "apache-2.0", "size": 2985 }
[ "org.eclipse.emf.common.util.EMap" ]
import org.eclipse.emf.common.util.EMap;
import org.eclipse.emf.common.util.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
609,647
public void endText() throws IOException { // overridden in subclasses }
void function() throws IOException { }
/** * Called when the ET operator is encountered. This method is for overriding in subclasses, the * default implementation does nothing. * * @throws IOException if there was an error processing the text */
Called when the ET operator is encountered. This method is for overriding in subclasses, the default implementation does nothing
endText
{ "repo_name": "tamirhassan/pdfxtk", "path": "src/com/tamirhassan/pdfxtk/CustomStreamEngine.java", "license": "apache-2.0", "size": 24591 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,985,573
public static synchronized void addPropertiesFile(String filename) { if (!containsPropertiesFile(filename)) { Configuration newProps; try { newProps = new PropertiesConfiguration(filename); } catch (ConfigurationException ce) { logger.error("Error opening properties file", ce); newProps = null; } if (newProps != null) { propertiesFileNames.add(filename); config.addConfiguration(newProps); } } else { logger.warn("Config already contains properties file: " + filename); } }
static synchronized void function(String filename) { if (!containsPropertiesFile(filename)) { Configuration newProps; try { newProps = new PropertiesConfiguration(filename); } catch (ConfigurationException ce) { logger.error(STR, ce); newProps = null; } if (newProps != null) { propertiesFileNames.add(filename); config.addConfiguration(newProps); } } else { logger.warn(STR + filename); } }
/** * Adds a properties file to the configuration if it does not already exist. * NOTE: Properties in this file will NOT override existing properties * * @param filename */
Adds a properties file to the configuration if it does not already exist
addPropertiesFile
{ "repo_name": "blindio/Prospero", "path": "java/core/io/github/blindio/prospero/core/utils/Config.java", "license": "apache-2.0", "size": 27973 }
[ "org.apache.commons.configuration.Configuration", "org.apache.commons.configuration.ConfigurationException", "org.apache.commons.configuration.PropertiesConfiguration" ]
import org.apache.commons.configuration.Configuration; import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.commons.configuration.*;
[ "org.apache.commons" ]
org.apache.commons;
2,141,122
public static void disposeImages() { // dispose loaded images { for (Image image : m_imageMap.values()) { image.dispose(); } m_imageMap.clear(); } // dispose decorated images for (int i = 0; i < m_decoratedImageMap.length; i++) { Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[i]; if (cornerDecoratedImageMap != null) { for (Map<Image, Image> decoratedMap : cornerDecoratedImageMap.values()) { for (Image image : decoratedMap.values()) { image.dispose(); } decoratedMap.clear(); } cornerDecoratedImageMap.clear(); } } }
static void function() { { for (Image image : m_imageMap.values()) { image.dispose(); } m_imageMap.clear(); } for (int i = 0; i < m_decoratedImageMap.length; i++) { Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[i]; if (cornerDecoratedImageMap != null) { for (Map<Image, Image> decoratedMap : cornerDecoratedImageMap.values()) { for (Image image : decoratedMap.values()) { image.dispose(); } decoratedMap.clear(); } cornerDecoratedImageMap.clear(); } } }
/** * Dispose all of the cached {@link Image}'s. */
Dispose all of the cached <code>Image</code>'s
disposeImages
{ "repo_name": "capitalone/Hydrograph", "path": "hydrograph.ui/hydrograph.ui.common/src/main/java/hydrograph/ui/common/util/SWTResourceManager.java", "license": "apache-2.0", "size": 15614 }
[ "java.util.Map", "org.eclipse.swt.graphics.Image" ]
import java.util.Map; import org.eclipse.swt.graphics.Image;
import java.util.*; import org.eclipse.swt.graphics.*;
[ "java.util", "org.eclipse.swt" ]
java.util; org.eclipse.swt;
2,132,634
SkyKey getSkyKey() { return SkyKey.create(getType(), this); } }
SkyKey getSkyKey() { return SkyKey.create(getType(), this); } }
/** * Prefer {@link ActionLookupValue#key} to calling this method directly. * * <p>Subclasses may override if the value key contents should not be the key itself. */
Prefer <code>ActionLookupValue#key</code> to calling this method directly. Subclasses may override if the value key contents should not be the key itself
getSkyKey
{ "repo_name": "whuwxl/bazel", "path": "src/main/java/com/google/devtools/build/lib/skyframe/ActionLookupValue.java", "license": "apache-2.0", "size": 4268 }
[ "com.google.devtools.build.skyframe.SkyKey" ]
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.*;
[ "com.google.devtools" ]
com.google.devtools;
602,181
public void normalize() { // No need to normalize if already normalized. if (isNormalized()) { return; } if (needsSyncChildren()) { synchronizeChildren(); } ChildNode kid, next; for (kid = firstChild; kid != null; kid = next) { next = kid.nextSibling; // If kid is a text node, we need to check for one of two // conditions: // 1) There is an adjacent text node // 2) There is no adjacent text node, but kid is // an empty text node. if ( kid.getNodeType() == Node.TEXT_NODE ) { // If an adjacent text node, merge it with kid if ( next!=null && next.getNodeType() == Node.TEXT_NODE ) { ((Text)kid).appendData(next.getNodeValue()); removeChild( next ); next = kid; // Don't advance; there might be another. } else { // If kid is empty, remove it if ( kid.getNodeValue() == null || kid.getNodeValue().length() == 0 ) { removeChild( kid ); } } } kid.normalize(); } isNormalized(true); }
void function() { if (isNormalized()) { return; } if (needsSyncChildren()) { synchronizeChildren(); } ChildNode kid, next; for (kid = firstChild; kid != null; kid = next) { next = kid.nextSibling; if ( kid.getNodeType() == Node.TEXT_NODE ) { if ( next!=null && next.getNodeType() == Node.TEXT_NODE ) { ((Text)kid).appendData(next.getNodeValue()); removeChild( next ); next = kid; } else { if ( kid.getNodeValue() == null kid.getNodeValue().length() == 0 ) { removeChild( kid ); } } } kid.normalize(); } isNormalized(true); }
/** * Override default behavior to call normalize() on this Node's * children. It is up to implementors or Node to override normalize() * to take action. */
Override default behavior to call normalize() on this Node's children. It is up to implementors or Node to override normalize() to take action
normalize
{ "repo_name": "md-5/jdk10", "path": "src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DocumentFragmentImpl.java", "license": "gpl-2.0", "size": 5624 }
[ "org.w3c.dom.Node", "org.w3c.dom.Text" ]
import org.w3c.dom.Node; import org.w3c.dom.Text;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
2,156,110
@Override public void endTable() { try { out.write("</table>\n"); //NON-NLS } catch (IOException ex) { logger.log(Level.SEVERE, "Failed to write end of table: {0}", ex); //NON-NLS } }
void function() { try { out.write(STR); } catch (IOException ex) { logger.log(Level.SEVERE, STR, ex); } }
/** * End the current table. */
End the current table
endTable
{ "repo_name": "maxrp/autopsy", "path": "Core/src/org/sleuthkit/autopsy/report/ReportHTML.java", "license": "apache-2.0", "size": 52084 }
[ "java.io.IOException", "java.util.logging.Level" ]
import java.io.IOException; import java.util.logging.Level;
import java.io.*; import java.util.logging.*;
[ "java.io", "java.util" ]
java.io; java.util;
2,161,266
public void setPartialName(String name) { if (name.contains(".")) { throw new IllegalArgumentException( "A field partial name shall not contain a period character: " + name); } dictionary.setString(COSName.T, name); }
void function(String name) { if (name.contains(".")) { throw new IllegalArgumentException( STR + name); } dictionary.setString(COSName.T, name); }
/** * This will set the partial name of the field. * * @param name The new name for the field. * @throws IllegalArgumentException If the name contains a period character. */
This will set the partial name of the field
setPartialName
{ "repo_name": "kalaspuffar/pdfbox", "path": "pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDField.java", "license": "apache-2.0", "size": 14926 }
[ "org.apache.pdfbox.cos.COSName" ]
import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.cos.*;
[ "org.apache.pdfbox" ]
org.apache.pdfbox;
2,157,976
public Obj findServant(Servant servant) { if (servant == null) return null; Map.Entry item; Iterator iter = objects.entrySet().iterator(); Obj ref; while (iter.hasNext()) { item = (Map.Entry) iter.next(); ref = (Obj) item.getValue(); if (servant.equals(ref.servant)) return ref; } return null; }
Obj function(Servant servant) { if (servant == null) return null; Map.Entry item; Iterator iter = objects.entrySet().iterator(); Obj ref; while (iter.hasNext()) { item = (Map.Entry) iter.next(); ref = (Obj) item.getValue(); if (servant.equals(ref.servant)) return ref; } return null; }
/** * Find the reference info for the given servant. If the servant is mapped to * several objects, this returns the first found occurence. * * @param servant a servant to find. * * @return the servant/object/POA binding or null if no such found. */
Find the reference info for the given servant. If the servant is mapped to several objects, this returns the first found occurence
findServant
{ "repo_name": "taciano-perez/JamVM-PH", "path": "src/classpath/gnu/CORBA/Poa/AOM.java", "license": "gpl-2.0", "size": 10806 }
[ "java.util.Iterator", "java.util.Map", "org.omg.PortableServer" ]
import java.util.Iterator; import java.util.Map; import org.omg.PortableServer;
import java.util.*; import org.omg.*;
[ "java.util", "org.omg" ]
java.util; org.omg;
2,159,468
public static void writeBytesToFilename(String filename, byte[] bytes) { if (filename != null && bytes != null) { try (OutputStream outputStream = Files.newOutputStream(Paths.get(filename))) { outputStream.write(bytes); } catch (IOException ex) { LOG.debug(ex.getMessage(), ex); } } else { LOG.debug("writeBytesToFilename got null byte[] pointed"); } }
static void function(String filename, byte[] bytes) { if (filename != null && bytes != null) { try (OutputStream outputStream = Files.newOutputStream(Paths.get(filename))) { outputStream.write(bytes); } catch (IOException ex) { LOG.debug(ex.getMessage(), ex); } } else { LOG.debug(STR); } }
/** * Method writeBytesToFilename * * @param filename * @param bytes */
Method writeBytesToFilename
writeBytesToFilename
{ "repo_name": "md-5/jdk10", "path": "src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/utils/JavaUtils.java", "license": "gpl-2.0", "size": 7675 }
[ "java.io.IOException", "java.io.OutputStream", "java.nio.file.Files", "java.nio.file.Paths" ]
import java.io.IOException; import java.io.OutputStream; import java.nio.file.Files; import java.nio.file.Paths;
import java.io.*; import java.nio.file.*;
[ "java.io", "java.nio" ]
java.io; java.nio;
453,412
public NetworkRuleCondition withSourceAddresses(List<String> sourceAddresses) { this.sourceAddresses = sourceAddresses; return this; }
NetworkRuleCondition function(List<String> sourceAddresses) { this.sourceAddresses = sourceAddresses; return this; }
/** * Set list of source IP addresses for this rule. * * @param sourceAddresses the sourceAddresses value to set * @return the NetworkRuleCondition object itself. */
Set list of source IP addresses for this rule
withSourceAddresses
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/network/v2020_03_01/NetworkRuleCondition.java", "license": "mit", "size": 5236 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,045,139
public static void register(Context context, AppIdentification appIdentification, CrashManagerListener listener, MonitoringClient monitoringClient) { initialize(context, appIdentification, listener, false); execute(context, listener, monitoringClient); }
static void function(Context context, AppIdentification appIdentification, CrashManagerListener listener, MonitoringClient monitoringClient) { initialize(context, appIdentification, listener, false); execute(context, listener, monitoringClient); }
/** * Registers new crash manager and handles existing crash logs. * * @param context The context to use. Usually your Activity object. * @param appIdentifier App ID of your app on HockeyApp. * @param listener Implement for callback functions. */
Registers new crash manager and handles existing crash logs
register
{ "repo_name": "math4youbyusgroupillinois/apigee-android-sdk", "path": "source/src/main/java/com/apigee/sdk/apm/android/crashlogging/CrashManager.java", "license": "apache-2.0", "size": 14522 }
[ "android.content.Context", "com.apigee.sdk.AppIdentification", "com.apigee.sdk.apm.android.MonitoringClient" ]
import android.content.Context; import com.apigee.sdk.AppIdentification; import com.apigee.sdk.apm.android.MonitoringClient;
import android.content.*; import com.apigee.sdk.*; import com.apigee.sdk.apm.android.*;
[ "android.content", "com.apigee.sdk" ]
android.content; com.apigee.sdk;
469,089
private void removeBadRecordKey(CarbonTableIdentifier carbonTableIdentifier) { String badRecordLoggerKey = carbonTableIdentifier.getBadRecordLoggerKey(); BadRecordsLogger.removeBadRecordKey(badRecordLoggerKey); }
void function(CarbonTableIdentifier carbonTableIdentifier) { String badRecordLoggerKey = carbonTableIdentifier.getBadRecordLoggerKey(); BadRecordsLogger.removeBadRecordKey(badRecordLoggerKey); }
/** * This method will remove the bad record key from bad record logger * * @param carbonTableIdentifier */
This method will remove the bad record key from bad record logger
removeBadRecordKey
{ "repo_name": "nehabhardwaj01/incubator-carbondata", "path": "processing/src/main/java/org/apache/carbondata/processing/newflow/DataLoadExecutor.java", "license": "apache-2.0", "size": 3937 }
[ "org.apache.carbondata.core.metadata.CarbonTableIdentifier", "org.apache.carbondata.processing.surrogatekeysgenerator.csvbased.BadRecordsLogger" ]
import org.apache.carbondata.core.metadata.CarbonTableIdentifier; import org.apache.carbondata.processing.surrogatekeysgenerator.csvbased.BadRecordsLogger;
import org.apache.carbondata.core.metadata.*; import org.apache.carbondata.processing.surrogatekeysgenerator.csvbased.*;
[ "org.apache.carbondata" ]
org.apache.carbondata;
977,070
public List<T> findByName(String text) { Query q = getEntityManager().createQuery("select u from " + getEntityClass().getSimpleName() + " u where u.name like :name"); q.setParameter("name", "%" + text + "%"); return q.getResultList(); }
List<T> function(String text) { Query q = getEntityManager().createQuery(STR + getEntityClass().getSimpleName() + STR); q.setParameter("name", "%" + text + "%"); return q.getResultList(); }
/** * Allows to search for all records of handled entity by a string contained in name. * @param text String to search within names * @return Collection of records with text contained in name */
Allows to search for all records of handled entity by a string contained in name
findByName
{ "repo_name": "alejandroquintero/auth0_artwork", "path": "artwork-logic/src/main/java/co/edu/uniandes/csw/crud/spi/persistence/CrudPersistence.java", "license": "mit", "size": 6977 }
[ "java.util.List", "javax.persistence.Query" ]
import java.util.List; import javax.persistence.Query;
import java.util.*; import javax.persistence.*;
[ "java.util", "javax.persistence" ]
java.util; javax.persistence;
434,229
public void testInvalidToken() { LinkedHashMap<String, Object> m = new LinkedHashMap<>(); m.put("INVALID_TOKEN", Token.INVALID); PutAllOperationContext paoc = new PutAllOperationContext(m); Map<String, Object> opMap = paoc.getMap(); assertEquals(1, opMap.size()); assertEquals(true, opMap.containsKey("INVALID_TOKEN")); assertEquals(null, opMap.get("INVALID_TOKEN")); assertEquals(true, opMap.containsValue(null)); assertEquals(false, opMap.containsValue("junk")); Collection<Object> values = opMap.values(); assertEquals(1, values.size()); assertEquals(null, values.iterator().next()); Set<Map.Entry<String, Object>> entries = opMap.entrySet(); assertEquals(1, entries.size()); Map.Entry me = entries.iterator().next(); assertEquals("INVALID_TOKEN", me.getKey()); assertEquals(null, me.getValue()); assertEquals(Token.INVALID, m.get("INVALID_TOKEN")); }
void function() { LinkedHashMap<String, Object> m = new LinkedHashMap<>(); m.put(STR, Token.INVALID); PutAllOperationContext paoc = new PutAllOperationContext(m); Map<String, Object> opMap = paoc.getMap(); assertEquals(1, opMap.size()); assertEquals(true, opMap.containsKey(STR)); assertEquals(null, opMap.get(STR)); assertEquals(true, opMap.containsValue(null)); assertEquals(false, opMap.containsValue("junk")); Collection<Object> values = opMap.values(); assertEquals(1, values.size()); assertEquals(null, values.iterator().next()); Set<Map.Entry<String, Object>> entries = opMap.entrySet(); assertEquals(1, entries.size()); Map.Entry me = entries.iterator().next(); assertEquals(STR, me.getKey()); assertEquals(null, me.getValue()); assertEquals(Token.INVALID, m.get(STR)); }
/** * Make sure that we do not expose the internal Token.INVALID to customers */
Make sure that we do not expose the internal Token.INVALID to customers
testInvalidToken
{ "repo_name": "robertgeiger/incubator-geode", "path": "gemfire-core/src/test/java/com/gemstone/gemfire/internal/PutAllOperationContextJUnitTest.java", "license": "apache-2.0", "size": 7208 }
[ "com.gemstone.gemfire.cache.operations.PutAllOperationContext", "com.gemstone.gemfire.internal.cache.Token", "java.util.Collection", "java.util.LinkedHashMap", "java.util.Map", "java.util.Set" ]
import com.gemstone.gemfire.cache.operations.PutAllOperationContext; import com.gemstone.gemfire.internal.cache.Token; import java.util.Collection; import java.util.LinkedHashMap; import java.util.Map; import java.util.Set;
import com.gemstone.gemfire.cache.operations.*; import com.gemstone.gemfire.internal.cache.*; import java.util.*;
[ "com.gemstone.gemfire", "java.util" ]
com.gemstone.gemfire; java.util;
420,145
public static void contextContentsToFile(Offering offering, File outFile) throws Exception { if (offering.getContentsCount()>0) { for (Content c : offering.getContents()) { if (c.getURI()!=null) { // Referenced content throw new IllegalArgumentException("Referenced Context Content not implemented yet!"); } else { // In-line content streamCopy( new ByteArrayInputStream(c.getContent().getBytes()), new FileOutputStream(outFile, true) ); } } } else { // No contents, so must be 'result' for (Operation o : offering.getOperations()) { if (o.getResult().getURI()!=null) { // referenced result throw new IllegalArgumentException("Referenced Context Result not implemented yet!"); } else { // in-line result o.getResult().getContent(); streamCopy( new ByteArrayInputStream(o.getResult().getContent().getBytes()), new FileOutputStream(outFile, true) ); } } } }
static void function(Offering offering, File outFile) throws Exception { if (offering.getContentsCount()>0) { for (Content c : offering.getContents()) { if (c.getURI()!=null) { throw new IllegalArgumentException(STR); } else { streamCopy( new ByteArrayInputStream(c.getContent().getBytes()), new FileOutputStream(outFile, true) ); } } } else { for (Operation o : offering.getOperations()) { if (o.getResult().getURI()!=null) { throw new IllegalArgumentException(STR); } else { o.getResult().getContent(); streamCopy( new ByteArrayInputStream(o.getResult().getContent().getBytes()), new FileOutputStream(outFile, true) ); } } } }
/** Copy all in-line contents or results from the supplied {@link Offering} to * a single file. * * @param offering The Offering to process * @param outFile The resultant file * @throws Exception */
Copy all in-line contents or results from the supplied <code>Offering</code> to a single file
contextContentsToFile
{ "repo_name": "FUNCATE/Java-OpenMobility", "path": "AugTech_GeoAPI/src/main/java/com/augtech/geoapi/context/Utils.java", "license": "apache-2.0", "size": 9096 }
[ "java.io.ByteArrayInputStream", "java.io.File", "java.io.FileOutputStream", "org.opengis.context.Content", "org.opengis.context.Offering", "org.opengis.context.Operation" ]
import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileOutputStream; import org.opengis.context.Content; import org.opengis.context.Offering; import org.opengis.context.Operation;
import java.io.*; import org.opengis.context.*;
[ "java.io", "org.opengis.context" ]
java.io; org.opengis.context;
1,237,219
long readLong(String filePath, long offset) throws IOException;
long readLong(String filePath, long offset) throws IOException;
/** * This method will be used to read long from file from postion(offset), here * length will be always 8 bacause int byte size is 8 * * @param filePath fully qualified file path * @param offset reading start position, * @return read long */
This method will be used to read long from file from postion(offset), here length will be always 8 bacause int byte size is 8
readLong
{ "repo_name": "Sephiroth-Lin/incubator-carbondata", "path": "core/src/main/java/org/apache/carbondata/core/datastore/FileHolder.java", "license": "apache-2.0", "size": 3494 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,365,859
public Savepoint setSavepoint() throws SQLException { return commonSetSavepointCode(null, false); }
Savepoint function() throws SQLException { return commonSetSavepointCode(null, false); }
/** * Creates an unnamed savepoint in the current transaction and * returns the new Savepoint object that represents it. * * @return The new Savepoint object * * @exception SQLException if a database access error occurs or * this Connection object is currently in auto-commit mode */
Creates an unnamed savepoint in the current transaction and returns the new Savepoint object that represents it
setSavepoint
{ "repo_name": "trejkaz/derby", "path": "java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java", "license": "apache-2.0", "size": 142130 }
[ "java.sql.SQLException", "java.sql.Savepoint" ]
import java.sql.SQLException; import java.sql.Savepoint;
import java.sql.*;
[ "java.sql" ]
java.sql;
1,463,643
@SystemApi(client = MODULE_LIBRARIES) public static short max(short x, short y) { if (isNaN(x)) return NaN; if (isNaN(y)) return NaN; if ((x & EXPONENT_SIGNIFICAND_MASK) == 0 && (y & EXPONENT_SIGNIFICAND_MASK) == 0) { return (x & SIGN_MASK) != 0 ? y : x; } return ((x & SIGN_MASK) != 0 ? 0x8000 - (x & 0xffff) : x & 0xffff) > ((y & SIGN_MASK) != 0 ? 0x8000 - (y & 0xffff) : y & 0xffff) ? x : y; }
@SystemApi(client = MODULE_LIBRARIES) static short function(short x, short y) { if (isNaN(x)) return NaN; if (isNaN(y)) return NaN; if ((x & EXPONENT_SIGNIFICAND_MASK) == 0 && (y & EXPONENT_SIGNIFICAND_MASK) == 0) { return (x & SIGN_MASK) != 0 ? y : x; } return ((x & SIGN_MASK) != 0 ? 0x8000 - (x & 0xffff) : x & 0xffff) > ((y & SIGN_MASK) != 0 ? 0x8000 - (y & 0xffff) : y & 0xffff) ? x : y; }
/** * Returns the larger of two half-precision float values (the value closest * to positive infinity). Special values are handled in the following ways: * <ul> * <li>If either value is NaN, the result is NaN</li> * <li>{@link #POSITIVE_ZERO} is greater than {@link #NEGATIVE_ZERO}</li> * </ul> * * @param x The first half-precision value * @param y The second half-precision value * * @return The larger of the two specified half-precision values * * @hide */
Returns the larger of two half-precision float values (the value closest to positive infinity). Special values are handled in the following ways: If either value is NaN, the result is NaN <code>#POSITIVE_ZERO</code> is greater than <code>#NEGATIVE_ZERO</code>
max
{ "repo_name": "google/desugar_jdk_libs", "path": "jdk11/src/libcore/luni/src/main/java/libcore/util/FP16.java", "license": "gpl-2.0", "size": 31809 }
[ "android.annotation.SystemApi" ]
import android.annotation.SystemApi;
import android.annotation.*;
[ "android.annotation" ]
android.annotation;
764,843
public final MetaProperty<ZonedDateTime> endDate() { return _endDate; }
final MetaProperty<ZonedDateTime> function() { return _endDate; }
/** * The meta-property for the {@code endDate} property. * @return the meta-property, not null */
The meta-property for the endDate property
endDate
{ "repo_name": "ChinaQuants/OG-Platform", "path": "projects/OG-FinancialTypes/src/main/java/com/opengamma/financial/security/fra/FRASecurity.java", "license": "apache-2.0", "size": 19980 }
[ "org.joda.beans.MetaProperty", "org.threeten.bp.ZonedDateTime" ]
import org.joda.beans.MetaProperty; import org.threeten.bp.ZonedDateTime;
import org.joda.beans.*; import org.threeten.bp.*;
[ "org.joda.beans", "org.threeten.bp" ]
org.joda.beans; org.threeten.bp;
955,240
public void assertContains(AssertionInfo info, float[] actual, float[] values) { arrays.assertContains(info, failures, actual, values); }
void function(AssertionInfo info, float[] actual, float[] values) { arrays.assertContains(info, failures, actual, values); }
/** * Asserts that the given array contains the given values, in any order. * @param info contains information about the assertion. * @param actual the given array. * @param values the values that are expected to be in the given array. * @throws NullPointerException if the array of values is {@code null}. * @throws IllegalArgumentException if the array of values is empty. * @throws AssertionError if the given array is {@code null}. * @throws AssertionError if the given array does not contain the given values. */
Asserts that the given array contains the given values, in any order
assertContains
{ "repo_name": "hazendaz/assertj-core", "path": "src/main/java/org/assertj/core/internal/FloatArrays.java", "license": "apache-2.0", "size": 18006 }
[ "org.assertj.core.api.AssertionInfo" ]
import org.assertj.core.api.AssertionInfo;
import org.assertj.core.api.*;
[ "org.assertj.core" ]
org.assertj.core;
559,898
public static void loadVideoView(VideoView videoView, Form form, String mediaPath) throws IOException { MediaSource mediaSource = determineMediaSource(form, mediaPath); switch (mediaSource) { case ASSET: case URL: File tempFile = cacheMediaTempFile(form, mediaPath, mediaSource); videoView.setVideoPath(tempFile.getAbsolutePath()); return; case REPL_ASSET: form.assertPermission(Manifest.permission.READ_EXTERNAL_STORAGE); videoView.setVideoPath(replAssetPath(mediaPath)); return; case SDCARD: form.assertPermission(Manifest.permission.READ_EXTERNAL_STORAGE); videoView.setVideoPath(mediaPath); return; case FILE_URL: if (isExternalFileUrl(mediaPath)) { form.assertPermission(Manifest.permission.READ_EXTERNAL_STORAGE); } videoView.setVideoPath(fileUrlToFilePath(mediaPath)); return; case CONTENT_URI: videoView.setVideoURI(Uri.parse(mediaPath)); return; case CONTACT_URI: throw new IOException("Unable to load video for contact " + mediaPath + "."); } throw new IOException("Unable to load video " + mediaPath + "."); }
static void function(VideoView videoView, Form form, String mediaPath) throws IOException { MediaSource mediaSource = determineMediaSource(form, mediaPath); switch (mediaSource) { case ASSET: case URL: File tempFile = cacheMediaTempFile(form, mediaPath, mediaSource); videoView.setVideoPath(tempFile.getAbsolutePath()); return; case REPL_ASSET: form.assertPermission(Manifest.permission.READ_EXTERNAL_STORAGE); videoView.setVideoPath(replAssetPath(mediaPath)); return; case SDCARD: form.assertPermission(Manifest.permission.READ_EXTERNAL_STORAGE); videoView.setVideoPath(mediaPath); return; case FILE_URL: if (isExternalFileUrl(mediaPath)) { form.assertPermission(Manifest.permission.READ_EXTERNAL_STORAGE); } videoView.setVideoPath(fileUrlToFilePath(mediaPath)); return; case CONTENT_URI: videoView.setVideoURI(Uri.parse(mediaPath)); return; case CONTACT_URI: throw new IOException(STR + mediaPath + "."); } throw new IOException(STR + mediaPath + "."); }
/** * Loads the video specified by mediaPath into the given VideoView. * * Note that if the mediaPath is an asset or an URL, the video must be copied * to a temp file and then loaded from there. This could have performance * implications. * * @param videoView the VideoView * @param form the Form * @param mediaPath the path to the media */
Loads the video specified by mediaPath into the given VideoView. Note that if the mediaPath is an asset or an URL, the video must be copied to a temp file and then loaded from there. This could have performance implications
loadVideoView
{ "repo_name": "kkashi01/appinventor-sources", "path": "appinventor/components/src/com/google/appinventor/components/runtime/util/MediaUtil.java", "license": "apache-2.0", "size": 27972 }
[ "android.net.Uri", "android.widget.VideoView", "com.google.appinventor.components.runtime.Form", "java.io.File", "java.io.IOException" ]
import android.net.Uri; import android.widget.VideoView; import com.google.appinventor.components.runtime.Form; import java.io.File; import java.io.IOException;
import android.net.*; import android.widget.*; import com.google.appinventor.components.runtime.*; import java.io.*;
[ "android.net", "android.widget", "com.google.appinventor", "java.io" ]
android.net; android.widget; com.google.appinventor; java.io;
52,474
@Generated @Selector("didSave") public native void didSave();
@Selector(STR) native void function();
/** * commonly used to notify other objects after a save */
commonly used to notify other objects after a save
didSave
{ "repo_name": "multi-os-engine/moe-core", "path": "moe.apple/moe.platform.ios/src/main/java/apple/coredata/NSManagedObject.java", "license": "apache-2.0", "size": 15113 }
[ "org.moe.natj.objc.ann.Selector" ]
import org.moe.natj.objc.ann.Selector;
import org.moe.natj.objc.ann.*;
[ "org.moe.natj" ]
org.moe.natj;
2,521,880
public Component getRequestSourceComponent() { return (Component)getSource(); }
Component function() { return (Component)getSource(); }
/** * Returns the source component.<p> * * @return Component which initiated the context menu open request. */
Returns the source component
getRequestSourceComponent
{ "repo_name": "ggiudetti/opencms-core", "path": "src/org/opencms/ui/contextmenu/CmsContextMenu.java", "license": "lgpl-2.1", "size": 42508 }
[ "com.vaadin.ui.Component" ]
import com.vaadin.ui.Component;
import com.vaadin.ui.*;
[ "com.vaadin.ui" ]
com.vaadin.ui;
1,221,891
public Observable<ServiceResponse<Void>> beginUnprepareNetworkPoliciesWithServiceResponseAsync(String resourceGroupName, String virtualNetworkName, String subnetName, String serviceName) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (virtualNetworkName == null) { throw new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null."); } if (subnetName == null) { throw new IllegalArgumentException("Parameter subnetName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); }
Observable<ServiceResponse<Void>> function(String resourceGroupName, String virtualNetworkName, String subnetName, String serviceName) { if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (virtualNetworkName == null) { throw new IllegalArgumentException(STR); } if (subnetName == null) { throw new IllegalArgumentException(STR); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); }
/** * Unprepares a subnet by removing network intent policies. * * @param resourceGroupName The name of the resource group. * @param virtualNetworkName The name of the virtual network. * @param subnetName The name of the subnet. * @param serviceName The name of the service for which subnet is being unprepared for. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */
Unprepares a subnet by removing network intent policies
beginUnprepareNetworkPoliciesWithServiceResponseAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/network/v2020_03_01/implementation/SubnetsInner.java", "license": "mit", "size": 84300 }
[ "com.microsoft.rest.ServiceResponse" ]
import com.microsoft.rest.ServiceResponse;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
2,286,748
public static void checkForExceptionResponse(String xmlString) throws OWSException { Document doc = null; try { doc = DOMUtil.buildDomFromString(xmlString); } catch (Exception ex) { //This should *hopefully* never occur log.error("Error whilst attempting to parse xmlString for errors", ex); throw new OWSException("Unable to parse xmlString", ex); } checkForExceptionResponse(doc); }
static void function(String xmlString) throws OWSException { Document doc = null; try { doc = DOMUtil.buildDomFromString(xmlString); } catch (Exception ex) { log.error(STR, ex); throw new OWSException(STR, ex); } checkForExceptionResponse(doc); }
/** * Will attempt to parse an <ows:Exception> element where ows will be http://www.opengis.net/ows. * * Will throw an OWSException if document does contain an <ows:ExceptionReport>, otherwise it will do nothing * * @param doc * a string containing valid XML, this will be parsed into a W3C DOM document * @throws OWSException * the oWS exception */
Will attempt to parse an element where ows will be HREF Will throw an OWSException if document does contain an , otherwise it will do nothing
checkForExceptionResponse
{ "repo_name": "joshvote/portal-core", "path": "src/main/java/org/auscope/portal/core/services/responses/ows/OWSExceptionParser.java", "license": "gpl-3.0", "size": 4224 }
[ "org.auscope.portal.core.util.DOMUtil", "org.w3c.dom.Document" ]
import org.auscope.portal.core.util.DOMUtil; import org.w3c.dom.Document;
import org.auscope.portal.core.util.*; import org.w3c.dom.*;
[ "org.auscope.portal", "org.w3c.dom" ]
org.auscope.portal; org.w3c.dom;
1,391,752
public void setInstanceEndpoints(final ArrayList<InstanceEndpoint> instanceEndpointsValue) { this.instanceEndpoints = instanceEndpointsValue; } private String instanceErrorCode;
void function(final ArrayList<InstanceEndpoint> instanceEndpointsValue) { this.instanceEndpoints = instanceEndpointsValue; } private String instanceErrorCode;
/** * Optional. The list of instance endpoints for the role. * @param instanceEndpointsValue The InstanceEndpoints value. */
Optional. The list of instance endpoints for the role
setInstanceEndpoints
{ "repo_name": "southworkscom/azure-sdk-for-java", "path": "service-management/azure-svc-mgmt-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/RoleInstance.java", "license": "apache-2.0", "size": 15560 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
1,018,678
public boolean isWrapperFor(Class iface) throws SQLException { return true; }
boolean function(Class iface) throws SQLException { return true; }
/** * Place holder for abstract method * isWrapperFor(java.lang.Class) in java.sql.Wrapper * required by jdk 1.6 * * @param iface - a Class defining an interface. * @throws SQLException */
Place holder for abstract method isWrapperFor(java.lang.Class) in java.sql.Wrapper required by jdk 1.6
isWrapperFor
{ "repo_name": "nchandrappa/incubator-geode", "path": "gemfire-core/src/main/java/com/gemstone/gemfire/internal/datasource/GemFireConnPooledDataSource.java", "license": "apache-2.0", "size": 6912 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
2,759,239
public BufferedImage getCombinedGridImage() { switch (model.getState()) { case NEW: case DISCARDED: throw new IllegalStateException( "This method can't be invoked in the DISCARDED or NEW"+ " state."); } //view.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (!GREY_SCALE_MODEL.equals(model.getColorModel())) return null; List active = view.getActiveChannelsInGrid(); BufferedImage image = null; Iterator i = active.iterator(); for (int k = 0; k < model.getMaxC(); k++) { model.setChannelActive(k, false); } while (i.hasNext()) { //reset values. model.setChannelActive(((Integer) i.next()).intValue(), true); } if (active.size() != 0) { model.setColorModel(RGB_MODEL, false); image = model.getSplitComponentImage(); model.setColorModel(GREY_SCALE_MODEL, false); } active = model.getActiveChannels(); i = active.iterator(); while (i.hasNext()) { //reset values. model.setChannelActive(((Integer) i.next()).intValue(), true); } return image; }
BufferedImage function() { switch (model.getState()) { case NEW: case DISCARDED: throw new IllegalStateException( STR+ STR); } if (!GREY_SCALE_MODEL.equals(model.getColorModel())) return null; List active = view.getActiveChannelsInGrid(); BufferedImage image = null; Iterator i = active.iterator(); for (int k = 0; k < model.getMaxC(); k++) { model.setChannelActive(k, false); } while (i.hasNext()) { model.setChannelActive(((Integer) i.next()).intValue(), true); } if (active.size() != 0) { model.setColorModel(RGB_MODEL, false); image = model.getSplitComponentImage(); model.setColorModel(GREY_SCALE_MODEL, false); } active = model.getActiveChannels(); i = active.iterator(); while (i.hasNext()) { model.setChannelActive(((Integer) i.next()).intValue(), true); } return image; }
/** * Implemented as specified by the {@link ImViewer} interface. * @see ImViewer#getCombinedGridImage() */
Implemented as specified by the <code>ImViewer</code> interface
getCombinedGridImage
{ "repo_name": "jballanc/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerComponent.java", "license": "gpl-2.0", "size": 99058 }
[ "java.awt.image.BufferedImage", "java.util.Iterator", "java.util.List" ]
import java.awt.image.BufferedImage; import java.util.Iterator; import java.util.List;
import java.awt.image.*; import java.util.*;
[ "java.awt", "java.util" ]
java.awt; java.util;
2,913,003
public static final void validateToken(AuthToken token) throws IllegalArgumentException { if (token.getExpiresOn().before(new Date())) { throw new IllegalArgumentException("Authentication token expired: " + token.getExpiresOn()); //$NON-NLS-1$ } String validSig = generateSignature(token); if (token.getSignature() == null || !token.getSignature().equals(validSig)) { throw new IllegalArgumentException("Missing or invalid signature on the auth token."); //$NON-NLS-1$ } }
static final void function(AuthToken token) throws IllegalArgumentException { if (token.getExpiresOn().before(new Date())) { throw new IllegalArgumentException(STR + token.getExpiresOn()); } String validSig = generateSignature(token); if (token.getSignature() == null !token.getSignature().equals(validSig)) { throw new IllegalArgumentException(STR); } }
/** * Validates an auth token. This checks the expiration time of the token against * the current system time. It also checks the validity of the signature. * @param token the authentication token * @throws IllegalArgumentException when the token is invalid */
Validates an auth token. This checks the expiration time of the token against the current system time. It also checks the validity of the signature
validateToken
{ "repo_name": "jasonchaffee/apiman", "path": "common/auth/src/main/java/io/apiman/common/auth/AuthTokenUtil.java", "license": "apache-2.0", "size": 7383 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
134,879
public void run() { logger.info("benchmarking systems: " + desiredSystems); List<String> scenarios = expandScenarios(config.getScenarios()); logger.info("requested scenarios: " + scenarios); for (final String scn : scenarios) { runScenario(scn); } finalizeExecutor(); if (config.getMexOutputFile() != null) { String mexOutputFilePath = config.getMexOutputFile(); try { MEXWriter.write(benchmarkLog, mexOutputFilePath); logger.info("wrote MEX file to " + mexOutputFilePath + ".ttl"); } catch (Exception e) { e.printStackTrace(); } } if (config.getCSVOutputFile() != null) { String csvOutputFilePath = config.getCSVOutputFile(); try { CSVWriter.write(benchmarkLog, csvOutputFilePath); logger.info("wrote CSV file to " + csvOutputFilePath); } catch (IOException e) { e.printStackTrace(); } } }
void function() { logger.info(STR + desiredSystems); List<String> scenarios = expandScenarios(config.getScenarios()); logger.info(STR + scenarios); for (final String scn : scenarios) { runScenario(scn); } finalizeExecutor(); if (config.getMexOutputFile() != null) { String mexOutputFilePath = config.getMexOutputFile(); try { MEXWriter.write(benchmarkLog, mexOutputFilePath); logger.info(STR + mexOutputFilePath + ".ttl"); } catch (Exception e) { e.printStackTrace(); } } if (config.getCSVOutputFile() != null) { String csvOutputFilePath = config.getCSVOutputFile(); try { CSVWriter.write(benchmarkLog, csvOutputFilePath); logger.info(STR + csvOutputFilePath); } catch (IOException e) { e.printStackTrace(); } } }
/** * the main benchmark runner will run each scenario in the config file and optionally save mex output */
the main benchmark runner will run each scenario in the config file and optionally save mex output
run
{ "repo_name": "AKSW/SML-Bench", "path": "src/main/java/org/aksw/mlbenchmark/BenchmarkRunner.java", "license": "apache-2.0", "size": 13162 }
[ "java.io.IOException", "java.util.List", "org.aksw.mlbenchmark.outputwriters.MEXWriter" ]
import java.io.IOException; import java.util.List; import org.aksw.mlbenchmark.outputwriters.MEXWriter;
import java.io.*; import java.util.*; import org.aksw.mlbenchmark.outputwriters.*;
[ "java.io", "java.util", "org.aksw.mlbenchmark" ]
java.io; java.util; org.aksw.mlbenchmark;
2,882,089
EClass getPreop();
EClass getPreop();
/** * Returns the meta object for class '{@link org.eclipse.xtext.parser.antlr.bug296889ExTest.Preop <em>Preop</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>Preop</em>'. * @see org.eclipse.xtext.parser.antlr.bug296889ExTest.Preop * @generated */
Returns the meta object for class '<code>org.eclipse.xtext.parser.antlr.bug296889ExTest.Preop Preop</code>'.
getPreop
{ "repo_name": "miklossy/xtext-core", "path": "org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/antlr/bug296889ExTest/Bug296889ExTestPackage.java", "license": "epl-1.0", "size": 15656 }
[ "org.eclipse.emf.ecore.EClass" ]
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
53,087
public Paint getFormPaint() { return mLegendFormPaint; }
Paint function() { return mLegendFormPaint; }
/** * Returns the Paint object used for drawing the Legend forms. * * @return */
Returns the Paint object used for drawing the Legend forms
getFormPaint
{ "repo_name": "Zhangbaowen13/greenhouse", "path": "MPChartLib/src/com/github/mikephil/charting/renderer/LegendRenderer.java", "license": "apache-2.0", "size": 16713 }
[ "android.graphics.Paint" ]
import android.graphics.Paint;
import android.graphics.*;
[ "android.graphics" ]
android.graphics;
2,491,054
@Test public void testUserTypes() throws Throwable { UUID userID_1 = UUID.fromString("550e8400-e29b-41d4-a716-446655440000"); String addressType = createType("CREATE TYPE %s (street text, city text, zip_code int, phones set<text >)"); String nameType = createType("CREATE TYPE %s (firstname text, lastname text)"); createTable("CREATE TABLE %s (id uuid PRIMARY KEY, name frozen < " + nameType + " >, addresses map < text, frozen < " + addressType + " >> )"); execute("INSERT INTO %s (id, name) VALUES(?, { firstname: 'Paul', lastname: 'smith' } )", userID_1); assertRows(execute("SELECT name.firstname FROM %s WHERE id = ?", userID_1), row("Paul")); execute("UPDATE %s SET addresses = addresses + { 'home': { street: '...', city:'SF', zip_code:94102, phones:{ } } } WHERE id = ?", userID_1); // TODO: deserialize the value here and check it 's right. execute("SELECT addresses FROM %s WHERE id = ? ", userID_1); }
void function() throws Throwable { UUID userID_1 = UUID.fromString(STR); String addressType = createType(STR); String nameType = createType(STR); createTable(STR + nameType + STR + addressType + STR); execute(STR, userID_1); assertRows(execute(STR, userID_1), row("Paul")); execute(STR, userID_1); execute(STR, userID_1); }
/** * Migrated from cql_tests.py:TestCQL.user_types_test() */
Migrated from cql_tests.py:TestCQL.user_types_test()
testUserTypes
{ "repo_name": "fengshao0907/cassandra-1", "path": "test/unit/org/apache/cassandra/cql3/validation/entities/UserTypesTest.java", "license": "apache-2.0", "size": 17156 }
[ "java.util.UUID" ]
import java.util.UUID;
import java.util.*;
[ "java.util" ]
java.util;
2,890,997
default Boolean isIncludeBody() { return readBoolean(SubscribeOptionFields.include_body.getFieldName()); }
default Boolean isIncludeBody() { return readBoolean(SubscribeOptionFields.include_body.getFieldName()); }
/** * Determines whether the entity wants to receive an XMPP message body in * addition to the payload format. * * @return true to receive the message body, false otherwise */
Determines whether the entity wants to receive an XMPP message body in addition to the payload format
isIncludeBody
{ "repo_name": "igniterealtime/Smack", "path": "smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/form/SubscribeFormReader.java", "license": "apache-2.0", "size": 3083 }
[ "org.jivesoftware.smackx.pubsub.SubscribeOptionFields" ]
import org.jivesoftware.smackx.pubsub.SubscribeOptionFields;
import org.jivesoftware.smackx.pubsub.*;
[ "org.jivesoftware.smackx" ]
org.jivesoftware.smackx;
2,760,891
void checkConsumedStockMoveLineList(ManufOrder manufOrder, ManufOrder oldManufOrder) throws AxelorException;
void checkConsumedStockMoveLineList(ManufOrder manufOrder, ManufOrder oldManufOrder) throws AxelorException;
/** * Check the realized consumed stock move lines in manuf order has not changed. * * @param manufOrder a manuf order from context. * @param oldManufOrder a manuf order from database. * @throws AxelorException if the check fails. */
Check the realized consumed stock move lines in manuf order has not changed
checkConsumedStockMoveLineList
{ "repo_name": "axelor/axelor-business-suite", "path": "axelor-production/src/main/java/com/axelor/apps/production/service/manuforder/ManufOrderService.java", "license": "agpl-3.0", "size": 8912 }
[ "com.axelor.apps.production.db.ManufOrder", "com.axelor.exception.AxelorException" ]
import com.axelor.apps.production.db.ManufOrder; import com.axelor.exception.AxelorException;
import com.axelor.apps.production.db.*; import com.axelor.exception.*;
[ "com.axelor.apps", "com.axelor.exception" ]
com.axelor.apps; com.axelor.exception;
2,249,756
public static Inet4Address getIsatapIPv4Address(Inet6Address ip) { Preconditions.checkArgument(isIsatapAddress(ip), "Address '%s' is not an ISATAP address.", toAddrString(ip)); return getInet4Address(copyOfRange(ip.getAddress(), 12, 16)); }
static Inet4Address function(Inet6Address ip) { Preconditions.checkArgument(isIsatapAddress(ip), STR, toAddrString(ip)); return getInet4Address(copyOfRange(ip.getAddress(), 12, 16)); }
/** * Returns the IPv4 address embedded in an ISATAP address. * * @param ip {@link Inet6Address} to be examined for embedded IPv4 in ISATAP address * @return {@link Inet4Address} of embedded IPv4 in an ISATAP address * @throws IllegalArgumentException if the argument is not a valid IPv6 ISATAP address */
Returns the IPv4 address embedded in an ISATAP address
getIsatapIPv4Address
{ "repo_name": "AOSP-JF-MM/platform_external_guava", "path": "guava/src/com/google/common/net/InetAddresses.java", "license": "apache-2.0", "size": 37240 }
[ "com.google.common.base.Preconditions", "java.net.Inet4Address", "java.net.Inet6Address" ]
import com.google.common.base.Preconditions; import java.net.Inet4Address; import java.net.Inet6Address;
import com.google.common.base.*; import java.net.*;
[ "com.google.common", "java.net" ]
com.google.common; java.net;
2,756,148
CatalogTracker createCatalogTracker(final ZooKeeperWatcher zk, final Configuration conf, Abortable abortable) throws IOException { return new CatalogTracker(zk, conf, abortable); } // Check if we should stop every 100ms private Sleeper stopSleeper = new Sleeper(100, this);
CatalogTracker createCatalogTracker(final ZooKeeperWatcher zk, final Configuration conf, Abortable abortable) throws IOException { return new CatalogTracker(zk, conf, abortable); } private Sleeper stopSleeper = new Sleeper(100, this);
/** * Create CatalogTracker. * In its own method so can intercept and mock it over in tests. * @param zk If zk is null, we'll create an instance (and shut it down * when {@link #stop(String)} is called) else we'll use what is passed. * @param conf * @param abortable If fatal exception we'll call abort on this. May be null. * If it is we'll use the Connection associated with the passed * {@link Configuration} as our {@link Abortable}. * ({@link Object#wait(long)} when passed a <code>0</code> waits for ever). * @throws IOException */
Create CatalogTracker. In its own method so can intercept and mock it over in tests
createCatalogTracker
{ "repo_name": "cloud-software-foundation/c5", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java", "license": "apache-2.0", "size": 122438 }
[ "java.io.IOException", "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.hbase.Abortable", "org.apache.hadoop.hbase.catalog.CatalogTracker", "org.apache.hadoop.hbase.util.Sleeper", "org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher" ]
import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.Abortable; import org.apache.hadoop.hbase.catalog.CatalogTracker; import org.apache.hadoop.hbase.util.Sleeper; import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
import java.io.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.catalog.*; import org.apache.hadoop.hbase.util.*; import org.apache.hadoop.hbase.zookeeper.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
2,057,899