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
sequence
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
sequence
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public List<WebElement> getPopupSuggestionElements() { List<WebElement> tables = getSuggestionPopup() .findElements(By.tagName("table")); if (tables == null || tables.isEmpty()) { return Collections.emptyList(); } WebElement table = tables.get(0); return table.findElements(By.tagName("td")); }
List<WebElement> function() { List<WebElement> tables = getSuggestionPopup() .findElements(By.tagName("table")); if (tables == null tables.isEmpty()) { return Collections.emptyList(); } WebElement table = tables.get(0); return table.findElements(By.tagName("td")); }
/** * Gets the elements of all suggestions on the current page. * <p> * Opens the popup if not already open. * * @return a list of elements for the suggestions on the current page */
Gets the elements of all suggestions on the current page. Opens the popup if not already open
getPopupSuggestionElements
{ "repo_name": "Legioth/vaadin", "path": "testbench-api/src/main/java/com/vaadin/testbench/elements/ComboBoxElement.java", "license": "apache-2.0", "size": 7898 }
[ "com.vaadin.testbench.By", "java.util.Collections", "java.util.List", "org.openqa.selenium.WebElement" ]
import com.vaadin.testbench.By; import java.util.Collections; import java.util.List; import org.openqa.selenium.WebElement;
import com.vaadin.testbench.*; import java.util.*; import org.openqa.selenium.*;
[ "com.vaadin.testbench", "java.util", "org.openqa.selenium" ]
com.vaadin.testbench; java.util; org.openqa.selenium;
1,172,823
public int key() throws ConcurrentModificationException, NoSuchElementException { if (referenceCount != count) { throw new ConcurrentModificationException(); } if (current < 0) { throw new NoSuchElementException(); } return keys[current]; }
int function() throws ConcurrentModificationException, NoSuchElementException { if (referenceCount != count) { throw new ConcurrentModificationException(); } if (current < 0) { throw new NoSuchElementException(); } return keys[current]; }
/** * Get the key of current entry. * @return key of current entry * @exception ConcurrentModificationException if the map is modified during iteration * @exception NoSuchElementException if there is no element left in the map */
Get the key of current entry
key
{ "repo_name": "sdinot/hipparchus", "path": "hipparchus-core/src/main/java/org/hipparchus/util/OpenIntToDoubleHashMap.java", "license": "apache-2.0", "size": 18088 }
[ "java.util.ConcurrentModificationException", "java.util.NoSuchElementException" ]
import java.util.ConcurrentModificationException; import java.util.NoSuchElementException;
import java.util.*;
[ "java.util" ]
java.util;
494,306
@EventHandler(priority = EventPriority.MONITOR) public void onPlayerDeath(final PlayerDeathEvent event) { final Player player = event.getEntity(); final MovingData data = MovingData.getData(player); data.clearFlyData(); data.clearMorePacketsData(); data.setSetBack(player.getLocation(useLoc)); // TODO: Monitor this change (!). useLoc.setWorld(null); }
@EventHandler(priority = EventPriority.MONITOR) void function(final PlayerDeathEvent event) { final Player player = event.getEntity(); final MovingData data = MovingData.getData(player); data.clearFlyData(); data.clearMorePacketsData(); data.setSetBack(player.getLocation(useLoc)); useLoc.setWorld(null); }
/** * Clear fly data on death. * @param event */
Clear fly data on death
onPlayerDeath
{ "repo_name": "MyPictures/NoCheatPlus", "path": "NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java", "license": "gpl-3.0", "size": 63675 }
[ "org.bukkit.entity.Player", "org.bukkit.event.EventHandler", "org.bukkit.event.EventPriority", "org.bukkit.event.entity.PlayerDeathEvent" ]
import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.entity.*; import org.bukkit.event.*; import org.bukkit.event.entity.*;
[ "org.bukkit.entity", "org.bukkit.event" ]
org.bukkit.entity; org.bukkit.event;
2,080,957
public void generateQueryParameters(String query) { filterQuery = query.trim(); try { q = parseQuery(filterQuery.toLowerCase()); } catch (ParseException | InvalidParametersException e) { this.queryMessage = "Error with the query: " + e.getMessage(); } }
void function(String query) { filterQuery = query.trim(); try { q = parseQuery(filterQuery.toLowerCase()); } catch (ParseException InvalidParametersException e) { this.queryMessage = STR + e.getMessage(); } }
/** * Creates a QueryParameters object used for filtering */
Creates a QueryParameters object used for filtering
generateQueryParameters
{ "repo_name": "belyabl9/teammates", "path": "src/main/java/teammates/ui/controller/AdminActivityLogPageData.java", "license": "gpl-2.0", "size": 16515 }
[ "java.text.ParseException" ]
import java.text.ParseException;
import java.text.*;
[ "java.text" ]
java.text;
2,759,560
if (matrix.rows() < matrix.columns()) { throw new IllegalArgumentException("Wrong matrix size: " + "rows < columns"); } Matrix qr = matrix.copy(); Vector rdiag = factory.createVector(qr.columns()); for (int k = 0; k < qr.columns(); k++) { double norm = 0.0; for (int i = k; i < qr.rows(); i++) { norm = Math.hypot(norm, qr.get(i, k)); } if (Math.abs(norm) > Matrices.EPS) { if (qr.get(k, k) < 0.0) { norm = -norm; } for (int i = k; i < qr.rows(); i++) { qr.update(i, k, Matrices.asDivFunction(norm)); } qr.update(k, k, Matrices.INC_FUNCTION); for (int j = k + 1; j < qr.columns(); j++) { double summand = 0.0; for (int i = k; i < qr.rows(); i++) { summand += qr.get(i, k) * qr.get(i, j); } summand = -summand / qr.get(k, k); for (int i = k; i < qr.rows(); i++) { qr.update(i, j, Matrices.asPlusFunction(summand * qr.get(i, k))); } } } rdiag.set(k, -norm); } Matrix q = qr.blank(factory); for (int k = q.columns() - 1; k >= 0; k--) { q.set(k, k, 1.0); for (int j = k; j < q.columns(); j++) { if (Math.abs(qr.get(k, k)) > Matrices.EPS) { double summand = 0.0; for (int i = k; i < q.rows(); i++) { summand += qr.get(i, k) * q.get(i, j); } summand = -summand / qr.get(k, k); for (int i = k; i < q.rows(); i++) { q.update(i, j, Matrices.asPlusFunction(summand * qr.get(i, k))); } } } } Matrix r = factory.createSquareMatrix(qr.columns()); for (int i = 0; i < r.rows(); i++) { for (int j = i; j < r.columns(); j++) { if (i < j) { r.set(i, j, qr.get(i, j)); } else if (i == j) { r.set(i, j, rdiag.get(i)); } } } return new Matrix[] { q, r }; }
if (matrix.rows() < matrix.columns()) { throw new IllegalArgumentException(STR + STR); } Matrix qr = matrix.copy(); Vector rdiag = factory.createVector(qr.columns()); for (int k = 0; k < qr.columns(); k++) { double norm = 0.0; for (int i = k; i < qr.rows(); i++) { norm = Math.hypot(norm, qr.get(i, k)); } if (Math.abs(norm) > Matrices.EPS) { if (qr.get(k, k) < 0.0) { norm = -norm; } for (int i = k; i < qr.rows(); i++) { qr.update(i, k, Matrices.asDivFunction(norm)); } qr.update(k, k, Matrices.INC_FUNCTION); for (int j = k + 1; j < qr.columns(); j++) { double summand = 0.0; for (int i = k; i < qr.rows(); i++) { summand += qr.get(i, k) * qr.get(i, j); } summand = -summand / qr.get(k, k); for (int i = k; i < qr.rows(); i++) { qr.update(i, j, Matrices.asPlusFunction(summand * qr.get(i, k))); } } } rdiag.set(k, -norm); } Matrix q = qr.blank(factory); for (int k = q.columns() - 1; k >= 0; k--) { q.set(k, k, 1.0); for (int j = k; j < q.columns(); j++) { if (Math.abs(qr.get(k, k)) > Matrices.EPS) { double summand = 0.0; for (int i = k; i < q.rows(); i++) { summand += qr.get(i, k) * q.get(i, j); } summand = -summand / qr.get(k, k); for (int i = k; i < q.rows(); i++) { q.update(i, j, Matrices.asPlusFunction(summand * qr.get(i, k))); } } } } Matrix r = factory.createSquareMatrix(qr.columns()); for (int i = 0; i < r.rows(); i++) { for (int j = i; j < r.columns(); j++) { if (i < j) { r.set(i, j, qr.get(i, j)); } else if (i == j) { r.set(i, j, rdiag.get(i)); } } } return new Matrix[] { q, r }; }
/** * Returns the result of QR decomposition of given matrix * <p> * See <a href="http://mathworld.wolfram.com/QRDecomposition.html"> * http://mathworld.wolfram.com/QRDecomposition.html</a> for more details. * </p> * * @param matrix * @param factory * @return { Q, R } */
Returns the result of QR decomposition of given matrix See HREF for more details.
decompose
{ "repo_name": "hisohito/la4j", "path": "src/main/java/org/la4j/decomposition/QRDecompositor.java", "license": "apache-2.0", "size": 4049 }
[ "org.la4j.matrix.Matrices", "org.la4j.matrix.Matrix", "org.la4j.vector.Vector" ]
import org.la4j.matrix.Matrices; import org.la4j.matrix.Matrix; import org.la4j.vector.Vector;
import org.la4j.matrix.*; import org.la4j.vector.*;
[ "org.la4j.matrix", "org.la4j.vector" ]
org.la4j.matrix; org.la4j.vector;
532,974
private void processClientMetricsUpdateMessage(TcpDiscoveryClientMetricsUpdateMessage msg) { assert msg.client(); ClientMessageWorker wrk = clientMsgWorkers.get(msg.creatorNodeId()); if (wrk != null) wrk.metrics(msg.metrics()); else if (log.isDebugEnabled()) log.debug("Received client metrics update message from unknown client node: " + msg); }
void function(TcpDiscoveryClientMetricsUpdateMessage msg) { assert msg.client(); ClientMessageWorker wrk = clientMsgWorkers.get(msg.creatorNodeId()); if (wrk != null) wrk.metrics(msg.metrics()); else if (log.isDebugEnabled()) log.debug(STR + msg); }
/** * Processes client metrics update message. * * @param msg Client metrics update message. */
Processes client metrics update message
processClientMetricsUpdateMessage
{ "repo_name": "psadusumilli/ignite", "path": "modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java", "license": "apache-2.0", "size": 268088 }
[ "org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryClientMetricsUpdateMessage" ]
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryClientMetricsUpdateMessage;
import org.apache.ignite.spi.discovery.tcp.messages.*;
[ "org.apache.ignite" ]
org.apache.ignite;
1,595,933
public static short[] loadFromFile(String f, boolean littleEndian) throws IOException { FileInputStream fis = null; try { fis = new FileInputStream(f); byte[] buffer = new byte[fis.available()]; int size = fis.read(buffer); if(size <= 0) { throw new IOException("File " + f + " is empty or some IO error occurred"); } short[] program = new short[size / 2 + size % 2]; for(int i = 0; i < size; i++) { int shift = 8 * (((littleEndian) ? i : i + 1) % 2); program[i / 2] |= (buffer[i] & 0xff) << shift; } return program; } finally { if(fis != null) { fis.close(); } } }
static short[] function(String f, boolean littleEndian) throws IOException { FileInputStream fis = null; try { fis = new FileInputStream(f); byte[] buffer = new byte[fis.available()]; int size = fis.read(buffer); if(size <= 0) { throw new IOException(STR + f + STR); } short[] program = new short[size / 2 + size % 2]; for(int i = 0; i < size; i++) { int shift = 8 * (((littleEndian) ? i : i + 1) % 2); program[i / 2] = (buffer[i] & 0xff) << shift; } return program; } finally { if(fis != null) { fis.close(); } } }
/** * Read program from file and returns short array * @param f file path (relative or absolute) * @param littleEndian think that words is file are little endian * @return program short array * @throws IOException on some IO errors */
Read program from file and returns short array
loadFromFile
{ "repo_name": "taviscaron/dcpu16-vm", "path": "src/net/taviscaron/dcpu16vm/util/ProgramUtils.java", "license": "mit", "size": 1581 }
[ "java.io.FileInputStream", "java.io.IOException" ]
import java.io.FileInputStream; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
292,745
public IndexShardRoutingTable shardRoutingTable(String index, int shardId) { IndexRoutingTable indexRouting = index(index); if (indexRouting == null) { throw new IndexNotFoundException(index); } return shardRoutingTable(indexRouting, shardId); } /** * All shards for the provided {@link ShardId}
IndexShardRoutingTable function(String index, int shardId) { IndexRoutingTable indexRouting = index(index); if (indexRouting == null) { throw new IndexNotFoundException(index); } return shardRoutingTable(indexRouting, shardId); } /** * All shards for the provided {@link ShardId}
/** * All shards for the provided index and shard id * @return All the shard routing entries for the given index and shard id * @throws IndexNotFoundException if provided index does not exist * @throws ShardNotFoundException if provided shard id is unknown */
All shards for the provided index and shard id
shardRoutingTable
{ "repo_name": "crate/crate", "path": "server/src/main/java/org/elasticsearch/cluster/routing/RoutingTable.java", "license": "apache-2.0", "size": 25618 }
[ "org.elasticsearch.index.IndexNotFoundException", "org.elasticsearch.index.shard.ShardId" ]
import org.elasticsearch.index.IndexNotFoundException; import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.index.*; import org.elasticsearch.index.shard.*;
[ "org.elasticsearch.index" ]
org.elasticsearch.index;
1,493,403
public HiveSubQRemoveRelBuilder join(JoinRelType joinType, String... fieldNames) { final List<RexNode> conditions = new ArrayList<>(); for (String fieldName : fieldNames) { conditions.add( call(SqlStdOperatorTable.EQUALS, field(2, 0, fieldName), field(2, 1, fieldName))); } return join(joinType, conditions); }
HiveSubQRemoveRelBuilder function(JoinRelType joinType, String... fieldNames) { final List<RexNode> conditions = new ArrayList<>(); for (String fieldName : fieldNames) { conditions.add( call(SqlStdOperatorTable.EQUALS, field(2, 0, fieldName), field(2, 1, fieldName))); } return join(joinType, conditions); }
/** Creates a {@link org.apache.calcite.rel.core.Join} using USING syntax. * * <p>For each of the field names, both left and right inputs must have a * field of that name. Constructs a join condition that the left and right * fields are equal. * * @param joinType Join type * @param fieldNames Field names */
Creates a <code>org.apache.calcite.rel.core.Join</code> using USING syntax. For each of the field names, both left and right inputs must have a field of that name. Constructs a join condition that the left and right fields are equal
join
{ "repo_name": "vergilchiu/hive", "path": "ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/HiveSubQRemoveRelBuilder.java", "license": "apache-2.0", "size": 62500 }
[ "java.util.ArrayList", "java.util.List", "org.apache.calcite.rel.core.JoinRelType", "org.apache.calcite.rex.RexNode", "org.apache.calcite.sql.fun.SqlStdOperatorTable" ]
import java.util.ArrayList; import java.util.List; import org.apache.calcite.rel.core.JoinRelType; import org.apache.calcite.rex.RexNode; import org.apache.calcite.sql.fun.SqlStdOperatorTable;
import java.util.*; import org.apache.calcite.rel.core.*; import org.apache.calcite.rex.*; import org.apache.calcite.sql.fun.*;
[ "java.util", "org.apache.calcite" ]
java.util; org.apache.calcite;
223,894
public void setColorPalette(Color[] colors) { // Not implemented. Color always maps to phase. }
void function(Color[] colors) { }
/** * Sets the colors that will be used between the floor and ceiling values. * Not implemented. Color always maps to phase. * @param colors */
Sets the colors that will be used between the floor and ceiling values. Not implemented. Color always maps to phase
setColorPalette
{ "repo_name": "OpenSourcePhysics/osp", "path": "src/org/opensourcephysics/display2d/ComplexSurfacePlot.java", "license": "gpl-3.0", "size": 44193 }
[ "java.awt.Color" ]
import java.awt.Color;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,448,391
@Override protected long getCompleteCacheFlushSequenceId(final long currentSequenceId) { LinkedList<TransactionState> transactionStates; synchronized (transactionsById) { transactionStates = new LinkedList<TransactionState>(transactionsById .values()); } long minPendingStartSequenceId = currentSequenceId; for (TransactionState transactionState : transactionStates) { minPendingStartSequenceId = Math.min(minPendingStartSequenceId, transactionState.getHLogStartSequenceId()); } return minPendingStartSequenceId; }
long function(final long currentSequenceId) { LinkedList<TransactionState> transactionStates; synchronized (transactionsById) { transactionStates = new LinkedList<TransactionState>(transactionsById .values()); } long minPendingStartSequenceId = currentSequenceId; for (TransactionState transactionState : transactionStates) { minPendingStartSequenceId = Math.min(minPendingStartSequenceId, transactionState.getHLogStartSequenceId()); } return minPendingStartSequenceId; }
/** * We need to make sure that we don't complete a cache flush between running * transactions. If we did, then we would not find all log messages needed to * restore the transaction, as some of them would be before the last * "complete" flush id. */
We need to make sure that we don't complete a cache flush between running transactions. If we did, then we would not find all log messages needed to restore the transaction, as some of them would be before the last "complete" flush id
getCompleteCacheFlushSequenceId
{ "repo_name": "adragomir/hbaseindex", "path": "src/contrib/transactional/src/java/org/apache/hadoop/hbase/regionserver/transactional/TransactionalRegion.java", "license": "apache-2.0", "size": 25212 }
[ "java.util.LinkedList" ]
import java.util.LinkedList;
import java.util.*;
[ "java.util" ]
java.util;
812,291
@Override public String formatRecursively(Interchange interchange) { return Edifatto.formatRecursively(interchange); }
String function(Interchange interchange) { return Edifatto.formatRecursively(interchange); }
/** Formats a full interchange structure recursively as String. * @param interchange the Edifact interchange to format * @return a string representation of the interchange */
Formats a full interchange structure recursively as String
formatRecursively
{ "repo_name": "AludraTest/aludratest", "path": "src/main/java/org/aludratest/content/edifact/edifatto/EdifattoContent.java", "license": "apache-2.0", "size": 6031 }
[ "org.databene.edifatto.Edifatto", "org.databene.edifatto.model.Interchange" ]
import org.databene.edifatto.Edifatto; import org.databene.edifatto.model.Interchange;
import org.databene.edifatto.*; import org.databene.edifatto.model.*;
[ "org.databene.edifatto" ]
org.databene.edifatto;
2,544,498
public int hashCode() { int h = 0, n = size(); final ObjectIterator<? extends Entry<Integer>> i = entrySet().iterator(); while (n-- != 0) h += i.next().hashCode(); return h; }
int function() { int h = 0, n = size(); final ObjectIterator<? extends Entry<Integer>> i = entrySet().iterator(); while (n-- != 0) h += i.next().hashCode(); return h; }
/** * Returns a hash code for this map. * The hash code of a map is computed by summing the hash codes of its entries. * * @return a hash code for this map. */
Returns a hash code for this map. The hash code of a map is computed by summing the hash codes of its entries
hashCode
{ "repo_name": "koendeschacht/bow-utils-extra", "path": "src/main/java/be/bagofwords/cache/fastutil/AbstractLong2IntMap.java", "license": "mit", "size": 9183 }
[ "it.unimi.dsi.fastutil.objects.ObjectIterator" ]
import it.unimi.dsi.fastutil.objects.ObjectIterator;
import it.unimi.dsi.fastutil.objects.*;
[ "it.unimi.dsi" ]
it.unimi.dsi;
275,241
getLog().info("Sending an email"); getLog().info(" subject = " + subject); getLog().info(" body = " + body); // The '\n' when coming in via parameter are getting double-slashed. // Replace with an explicit line separator. body = body.replace("\\n", System.lineSeparator()); Properties config; try { config = ConfigUtility.getConfigProperties(); } catch (Exception e1) { throw new MojoExecutionException("Failed to retrieve config properties"); } String notificationRecipients = config.getProperty("send.notification.recipients"); if (config.getProperty("send.notification.recipients") == null) { throw new MojoExecutionException("Email was requested, but no recipients specified in the config file."); } try { // send the message String from; if (config.containsKey("mail.smtp.from")) { from = config.getProperty("mail.smtp.from"); } else { from = config.getProperty("mail.smtp.user"); } Properties props = new Properties(); props.put("mail.smtp.user", config.getProperty("mail.smtp.user")); props.put("mail.smtp.password", config.getProperty("mail.smtp.password")); props.put("mail.smtp.host", config.getProperty("mail.smtp.host")); props.put("mail.smtp.port", config.getProperty("mail.smtp.port")); props.put("mail.smtp.starttls.enable", config.getProperty("mail.smtp.starttls.enable")); props.put("mail.smtp.auth", config.getProperty("mail.smtp.auth")); try { ConfigUtility.sendEmail(subject, from, notificationRecipients, body, props, "true".equals(config.getProperty("mail.smtp.auth"))); } catch (Exception e) { // Don't allow an error here to stop processing e.printStackTrace(); } } catch (Exception e) { e.printStackTrace(); throw new MojoExecutionException("Sending email failed.", e); } }
getLog().info(STR); getLog().info(STR + subject); getLog().info(STR + body); body = body.replace("\\n", System.lineSeparator()); Properties config; try { config = ConfigUtility.getConfigProperties(); } catch (Exception e1) { throw new MojoExecutionException(STR); } String notificationRecipients = config.getProperty(STR); if (config.getProperty(STR) == null) { throw new MojoExecutionException(STR); } try { String from; if (config.containsKey(STR)) { from = config.getProperty(STR); } else { from = config.getProperty(STR); } Properties props = new Properties(); props.put(STR, config.getProperty(STR)); props.put(STR, config.getProperty(STR)); props.put(STR, config.getProperty(STR)); props.put(STR, config.getProperty(STR)); props.put(STR, config.getProperty(STR)); props.put(STR, config.getProperty(STR)); try { ConfigUtility.sendEmail(subject, from, notificationRecipients, body, props, "true".equals(config.getProperty(STR))); } catch (Exception e) { e.printStackTrace(); } } catch (Exception e) { e.printStackTrace(); throw new MojoExecutionException(STR, e); } }
/** * Executes the plugin. * * @throws MojoExecutionException the mojo execution exception */
Executes the plugin
execute
{ "repo_name": "IHTSDO/OTF-Mapping-Service", "path": "mojo/src/main/java/org/ihtsdo/otf/mapping/mojo/SendEmailMojo.java", "license": "apache-2.0", "size": 2689 }
[ "java.util.Properties", "org.apache.maven.plugin.MojoExecutionException", "org.ihtsdo.otf.mapping.services.helpers.ConfigUtility" ]
import java.util.Properties; import org.apache.maven.plugin.MojoExecutionException; import org.ihtsdo.otf.mapping.services.helpers.ConfigUtility;
import java.util.*; import org.apache.maven.plugin.*; import org.ihtsdo.otf.mapping.services.helpers.*;
[ "java.util", "org.apache.maven", "org.ihtsdo.otf" ]
java.util; org.apache.maven; org.ihtsdo.otf;
2,139,388
public ProcessOrder2UserPersistence getProcessOrder2UserPersistence() { return processOrder2UserPersistence; }
ProcessOrder2UserPersistence function() { return processOrder2UserPersistence; }
/** * Returns the process order2 user persistence. * * @return the process order2 user persistence */
Returns the process order2 user persistence
getProcessOrder2UserPersistence
{ "repo_name": "openegovplatform/OEPv2", "path": "oep-processmgt-portlet/docroot/WEB-INF/src/org/oep/processmgt/service/base/DocFile2ProcessOrderServiceBaseImpl.java", "license": "apache-2.0", "size": 35831 }
[ "org.oep.processmgt.service.persistence.ProcessOrder2UserPersistence" ]
import org.oep.processmgt.service.persistence.ProcessOrder2UserPersistence;
import org.oep.processmgt.service.persistence.*;
[ "org.oep.processmgt" ]
org.oep.processmgt;
22,066
@Override public int hashCode() { if (hashCode == 0) { hashCode = Arrays.hashCode(bytes); } return hashCode; }
int function() { if (hashCode == 0) { hashCode = Arrays.hashCode(bytes); } return hashCode; }
/** * The hashcode is cached except for the case where it is computed as 0, in which * case we compute the hashcode on every call. * * @return the hashcode */
The hashcode is cached except for the case where it is computed as 0, in which case we compute the hashcode on every call
hashCode
{ "repo_name": "lemonJun/Jkafka", "path": "jkafka-core/src/main/java/org/apache/kafka/common/utils/Bytes.java", "license": "apache-2.0", "size": 5490 }
[ "java.util.Arrays" ]
import java.util.Arrays;
import java.util.*;
[ "java.util" ]
java.util;
2,884,723
String getMetaServerAddress(Env targetEnv);
String getMetaServerAddress(Env targetEnv);
/** * Provide the Apollo meta server address, could be a domain url or comma separated ip addresses, like http://1.2.3.4:8080,http://2.3.4.5:8080. * <br/> * In production environment, we suggest using one single domain like http://config.xxx.com(backed by software load balancers like nginx) instead of multiple ip addresses */
Provide the Apollo meta server address, could be a domain url or comma separated ip addresses, like HREF In production environment, we suggest using one single domain like HREF(backed by software load balancers like nginx) instead of multiple ip addresses
getMetaServerAddress
{ "repo_name": "nobodyiam/apollo", "path": "apollo-core/src/main/java/com/ctrip/framework/apollo/core/spi/MetaServerProvider.java", "license": "apache-2.0", "size": 1163 }
[ "com.ctrip.framework.apollo.core.enums.Env" ]
import com.ctrip.framework.apollo.core.enums.Env;
import com.ctrip.framework.apollo.core.enums.*;
[ "com.ctrip.framework" ]
com.ctrip.framework;
105,253
protected void retrySlotClick(int slotId, int clickedButton, boolean mode, EntityPlayer playerIn) { this.slotClick(slotId, clickedButton, ClickType.QUICK_MOVE, playerIn); }
void function(int slotId, int clickedButton, boolean mode, EntityPlayer playerIn) { this.slotClick(slotId, clickedButton, ClickType.QUICK_MOVE, playerIn); }
/** * Retries slotClick() in case of failure */
Retries slotClick() in case of failure
retrySlotClick
{ "repo_name": "F1r3w477/CustomWorldGen", "path": "build/tmp/recompileMc/sources/net/minecraft/inventory/Container.java", "license": "lgpl-3.0", "size": 29844 }
[ "net.minecraft.entity.player.EntityPlayer" ]
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.*;
[ "net.minecraft.entity" ]
net.minecraft.entity;
1,130,265
public static void maybeInitProcessGlobals() { if (isWebViewProcess()) { PathUtils.setPrivateDataDirectorySuffix("webview", "WebView"); CommandLineUtil.initCommandLine(); // TODO(crbug.com/1182693): Do set up a native UMA recorder once we support recording // metrics from native nonembedded code. UmaRecorderHolder.setUpNativeUmaRecorder(false); UmaRecorderHolder.setNonNativeDelegate(new AwNonembeddedUmaRecorder()); // Only register nonembedded SafeMode actions for webview_apk or webview_service // processes. SafeModeController controller = SafeModeController.getInstance(); controller.registerActions(NonembeddedSafeModeActionsList.sList); } // Limit to N+ since external services were added in N. if (!LibraryLoader.getInstance().isLoadedByZygote() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { LibraryLoader.getInstance().setNativeLibraryPreloader(new WebViewLibraryPreloader()); } }
static void function() { if (isWebViewProcess()) { PathUtils.setPrivateDataDirectorySuffix(STR, STR); CommandLineUtil.initCommandLine(); UmaRecorderHolder.setUpNativeUmaRecorder(false); UmaRecorderHolder.setNonNativeDelegate(new AwNonembeddedUmaRecorder()); SafeModeController controller = SafeModeController.getInstance(); controller.registerActions(NonembeddedSafeModeActionsList.sList); } if (!LibraryLoader.getInstance().isLoadedByZygote() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { LibraryLoader.getInstance().setNativeLibraryPreloader(new WebViewLibraryPreloader()); } }
/** * Initializes globals needed for components that run in the "webview_apk" or "webview_service" * process. * * This is also called by MonochromeApplication, so the initialization here will run * for those processes regardless of whether the WebView is standalone or Monochrome. */
Initializes globals needed for components that run in the "webview_apk" or "webview_service" process. This is also called by MonochromeApplication, so the initialization here will run for those processes regardless of whether the WebView is standalone or Monochrome
maybeInitProcessGlobals
{ "repo_name": "ric2b/Vivaldi-browser", "path": "chromium/android_webview/nonembedded/java/src/org/chromium/android_webview/nonembedded/WebViewApkApplication.java", "license": "bsd-3-clause", "size": 8513 }
[ "android.os.Build", "com.android.webview.chromium.WebViewLibraryPreloader", "org.chromium.android_webview.common.CommandLineUtil", "org.chromium.android_webview.common.SafeModeController", "org.chromium.base.PathUtils", "org.chromium.base.library_loader.LibraryLoader", "org.chromium.base.metrics.UmaRecorderHolder" ]
import android.os.Build; import com.android.webview.chromium.WebViewLibraryPreloader; import org.chromium.android_webview.common.CommandLineUtil; import org.chromium.android_webview.common.SafeModeController; import org.chromium.base.PathUtils; import org.chromium.base.library_loader.LibraryLoader; import org.chromium.base.metrics.UmaRecorderHolder;
import android.os.*; import com.android.webview.chromium.*; import org.chromium.android_webview.common.*; import org.chromium.base.*; import org.chromium.base.library_loader.*; import org.chromium.base.metrics.*;
[ "android.os", "com.android.webview", "org.chromium.android_webview", "org.chromium.base" ]
android.os; com.android.webview; org.chromium.android_webview; org.chromium.base;
1,134,081
protected void toggleNetworkError(boolean toggle, View.OnClickListener onClickListener) { if (null == mVaryViewHelperController) { throw new IllegalArgumentException("You must return a right target view for loading"); } if (toggle) { mVaryViewHelperController.showNetworkError(onClickListener); } else { mVaryViewHelperController.restore(); } }
void function(boolean toggle, View.OnClickListener onClickListener) { if (null == mVaryViewHelperController) { throw new IllegalArgumentException(STR); } if (toggle) { mVaryViewHelperController.showNetworkError(onClickListener); } else { mVaryViewHelperController.restore(); } }
/** * toggle show network error * * @param toggle */
toggle show network error
toggleNetworkError
{ "repo_name": "tmx0456/TanExample", "path": "TanLibrary/src/main/java/app/tan/lib/base/BaseFragmentActivity.java", "license": "mit", "size": 18404 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
2,303,631
AuthorDTO getAuthorByID(Long id) throws IllegalArgumentException;
AuthorDTO getAuthorByID(Long id) throws IllegalArgumentException;
/** * Method fetches author from DAO layer based on given input ID. If there is * no match null is returned. * * @param id of author to be found * @return author with given id, null otherwise * @throws IllegalArgumentException if ID is out of valid range */
Method fetches author from DAO layer based on given input ID. If there is no match null is returned
getAuthorByID
{ "repo_name": "empt-ak/bis", "path": "bis-api/src/main/java/cz/muni/ics/phil/bis/api/AuthorService.java", "license": "apache-2.0", "size": 7534 }
[ "cz.muni.ics.phil.bis.api.domain.AuthorDTO" ]
import cz.muni.ics.phil.bis.api.domain.AuthorDTO;
import cz.muni.ics.phil.bis.api.domain.*;
[ "cz.muni.ics" ]
cz.muni.ics;
1,130,945
public ResultSet executeQuery(String sql) throws SQLException { try { debugCodeCall("executeQuery", sql); throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT); } catch (Exception e) { throw logAndConvert(e); } }
ResultSet function(String sql) throws SQLException { try { debugCodeCall(STR, sql); throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT); } catch (Exception e) { throw logAndConvert(e); } }
/** * Calling this method is not legal on a PreparedStatement. * * @param sql ignored * @throws SQLException Unsupported Feature */
Calling this method is not legal on a PreparedStatement
executeQuery
{ "repo_name": "titus08/frostwire-desktop", "path": "lib/jars-src/h2-1.3.164/org/h2/jdbc/JdbcPreparedStatement.java", "license": "gpl-3.0", "size": 51957 }
[ "java.sql.ResultSet", "java.sql.SQLException", "org.h2.constant.ErrorCode", "org.h2.message.DbException" ]
import java.sql.ResultSet; import java.sql.SQLException; import org.h2.constant.ErrorCode; import org.h2.message.DbException;
import java.sql.*; import org.h2.constant.*; import org.h2.message.*;
[ "java.sql", "org.h2.constant", "org.h2.message" ]
java.sql; org.h2.constant; org.h2.message;
1,186,765
private void gotoImport() { try { ImportController importer = (ImportController) replaceSceneContent("ui/fxml/Import.fxml"); importer.setApp(this); } catch (Exception e) { // An error occurred e.printStackTrace(); } }
void function() { try { ImportController importer = (ImportController) replaceSceneContent(STR); importer.setApp(this); } catch (Exception e) { e.printStackTrace(); } }
/** * Navigate to the import view */
Navigate to the import view
gotoImport
{ "repo_name": "dinder-mufflin/igtv", "path": "GUI/src/com/igtv/Main.java", "license": "mit", "size": 4123 }
[ "com.igtv.ui.ImportController" ]
import com.igtv.ui.ImportController;
import com.igtv.ui.*;
[ "com.igtv.ui" ]
com.igtv.ui;
1,991,748
public String[] getPropertyNames(String prefix) { // This gives us a list of all non-suppressed properties String[] propertyNames = getPropertyNames(); return PropertyUtil.getPropertyNames(propertyNames, prefix); }
String[] function(String prefix) { String[] propertyNames = getPropertyNames(); return PropertyUtil.getPropertyNames(propertyNames, prefix); }
/** * Returns an array of <code>String</code>s recognized as names by * this property source that begin with the supplied prefix. If * no property names match, <code>null</code> will be returned. * The comparison is done in a case-independent manner. * * <p> The default implementation calls <code>getPropertyNames()</code> * and searches the list of names for matches. * * @return an array of <code>String</code>s giving the valid * property names. */
Returns an array of <code>String</code>s recognized as names by this property source that begin with the supplied prefix. If no property names match, <code>null</code> will be returned. The comparison is done in a case-independent manner. The default implementation calls <code>getPropertyNames()</code> and searches the list of names for matches
getPropertyNames
{ "repo_name": "RoProducts/rastertheque", "path": "JAILibrary/src/javax/media/jai/PropertyEnvironment.java", "license": "gpl-2.0", "size": 12657 }
[ "com.sun.media.jai.util.PropertyUtil" ]
import com.sun.media.jai.util.PropertyUtil;
import com.sun.media.jai.util.*;
[ "com.sun.media" ]
com.sun.media;
178,922
public Collection<String> listSections() { return sections.keySet(); }
Collection<String> function() { return sections.keySet(); }
/** * Return a collection of all the sections. * * @since 1.0 */
Return a collection of all the sections
listSections
{ "repo_name": "joval/jSAF", "path": "src/jsaf/util/IniFile.java", "license": "lgpl-2.1", "size": 8212 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
2,101,257
public void selectAll() { int i; for ( i = 0; i < nrSteps(); i++ ) { StepMeta stepMeta = getStep( i ); stepMeta.setSelected( true ); } for ( i = 0; i < nrNotes(); i++ ) { NotePadMeta ni = getNote( i ); ni.setSelected( true ); } setChanged(); notifyObservers( "refreshGraph" ); }
void function() { int i; for ( i = 0; i < nrSteps(); i++ ) { StepMeta stepMeta = getStep( i ); stepMeta.setSelected( true ); } for ( i = 0; i < nrNotes(); i++ ) { NotePadMeta ni = getNote( i ); ni.setSelected( true ); } setChanged(); notifyObservers( STR ); }
/** * Mark all steps in the transformation as selected. * */
Mark all steps in the transformation as selected
selectAll
{ "repo_name": "eayoungs/pentaho-kettle", "path": "engine/src/org/pentaho/di/trans/TransMeta.java", "license": "apache-2.0", "size": 221441 }
[ "org.pentaho.di.core.NotePadMeta", "org.pentaho.di.trans.step.StepMeta" ]
import org.pentaho.di.core.NotePadMeta; import org.pentaho.di.trans.step.StepMeta;
import org.pentaho.di.core.*; import org.pentaho.di.trans.step.*;
[ "org.pentaho.di" ]
org.pentaho.di;
2,316,578
logger.info("extract"); String text = "In publishing and graphic design, lorem ipsum[1] is a placeholder text (filler text) commonly used to demonstrate the graphic elements of a document or visual presentation, such as font, typography, and layout, by removing the distraction of meaningful content. The lorem ipsum text is typically a section of a Latin text by Cicero with words altered, added, and removed that make it nonsensical and not proper Latin.[1] In publishing and graphic design, lorem ipsum[1] is a placeholder text (filler text) commonly used to demonstrate the graphic elements of a document or visual presentation, such as font, typography, and layout, by removing the distraction of meaningful content. The lorem ipsum text is typically a section of a Latin text by Cicero with words altered, added, and removed that make it nonsensical and not proper Latin.[1]"; NgramsExtractor.Parameters p = new NgramsExtractor.Parameters(); p.setMaxDistanceBetweenKwds(0); NgramsExtractor instance = new NgramsExtractor(p); Map<String, Double> expResult = new HashMap<>(); expResult.put("In", 2.0); expResult.put("publishing", 2.0); expResult.put("and", 8.0); expResult.put("graphic", 4.0); expResult.put("design,", 2.0); expResult.put("lorem", 4.0); expResult.put("ipsum[1]", 2.0); expResult.put("is", 4.0); expResult.put("a", 8.0); expResult.put("placeholder", 2.0); expResult.put("text", 6.0); expResult.put("(filler", 2.0); expResult.put("text)", 2.0); expResult.put("commonly", 2.0); expResult.put("used", 2.0); expResult.put("to", 2.0); expResult.put("demonstrate", 2.0); expResult.put("the", 4.0); expResult.put("elements", 2.0); expResult.put("of", 6.0); expResult.put("document", 2.0); expResult.put("or", 2.0); expResult.put("visual", 2.0); expResult.put("presentation,", 2.0); expResult.put("such", 2.0); expResult.put("as", 2.0); expResult.put("font,", 2.0); expResult.put("typography,", 2.0); expResult.put("layout,", 2.0); expResult.put("by", 4.0); expResult.put("removing", 2.0); expResult.put("distraction", 2.0); expResult.put("meaningful", 2.0); expResult.put("content.", 2.0); expResult.put("The", 2.0); expResult.put("ipsum", 2.0); expResult.put("typically", 2.0); expResult.put("section", 2.0); expResult.put("Latin", 2.0); expResult.put("Cicero", 2.0); expResult.put("with", 2.0); expResult.put("words", 2.0); expResult.put("altered,", 2.0); expResult.put("added,", 2.0); expResult.put("removed", 2.0); expResult.put("that", 2.0); expResult.put("make", 2.0); expResult.put("it", 2.0); expResult.put("nonsensical", 2.0); expResult.put("not", 2.0); expResult.put("proper", 2.0); expResult.put("Latin.[1]", 2.0); expResult.put("In publishing", 2.0); expResult.put("publishing and", 2.0); expResult.put("and graphic", 2.0); expResult.put("graphic design,", 2.0); expResult.put("design, lorem", 2.0); expResult.put("lorem ipsum[1]", 2.0); expResult.put("ipsum[1] is", 2.0); expResult.put("is a", 2.0); expResult.put("a placeholder", 2.0); expResult.put("placeholder text", 2.0); expResult.put("text (filler", 2.0); expResult.put("(filler text)", 2.0); expResult.put("text) commonly", 2.0); expResult.put("commonly used", 2.0); expResult.put("used to", 2.0); expResult.put("to demonstrate", 2.0); expResult.put("demonstrate the", 2.0); expResult.put("the graphic", 2.0); expResult.put("graphic elements", 2.0); expResult.put("elements of", 2.0); expResult.put("of a", 4.0); expResult.put("a document", 2.0); expResult.put("document or", 2.0); expResult.put("or visual", 2.0); expResult.put("visual presentation,", 2.0); expResult.put("presentation, such", 2.0); expResult.put("such as", 2.0); expResult.put("as font,", 2.0); expResult.put("font, typography,", 2.0); expResult.put("typography, and", 2.0); expResult.put("and layout,", 2.0); expResult.put("layout, by", 2.0); expResult.put("by removing", 2.0); expResult.put("removing the", 2.0); expResult.put("the distraction", 2.0); expResult.put("distraction of", 2.0); expResult.put("of meaningful", 2.0); expResult.put("meaningful content.", 2.0); expResult.put("content. The", 2.0); expResult.put("The lorem", 2.0); expResult.put("lorem ipsum", 2.0); expResult.put("ipsum text", 2.0); expResult.put("text is", 2.0); expResult.put("is typically", 2.0); expResult.put("typically a", 2.0); expResult.put("a section", 2.0); expResult.put("section of", 2.0); expResult.put("a Latin", 2.0); expResult.put("Latin text", 2.0); expResult.put("text by", 2.0); expResult.put("by Cicero", 2.0); expResult.put("Cicero with", 2.0); expResult.put("with words", 2.0); expResult.put("words altered,", 2.0); expResult.put("altered, added,", 2.0); expResult.put("added, and", 2.0); expResult.put("and removed", 2.0); expResult.put("removed that", 2.0); expResult.put("that make", 2.0); expResult.put("make it", 2.0); expResult.put("it nonsensical", 2.0); expResult.put("nonsensical and", 2.0); expResult.put("and not", 2.0); expResult.put("not proper", 2.0); expResult.put("proper Latin.[1]", 2.0); expResult.put("Latin.[1] In", 1.0); expResult.put("In publishing and", 2.0); expResult.put("publishing and graphic", 2.0); expResult.put("and graphic design,", 2.0); expResult.put("graphic design, lorem", 2.0); expResult.put("design, lorem ipsum[1]", 2.0); expResult.put("lorem ipsum[1] is", 2.0); expResult.put("ipsum[1] is a", 2.0); expResult.put("is a placeholder", 2.0); expResult.put("a placeholder text", 2.0); expResult.put("placeholder text (filler", 2.0); expResult.put("text (filler text)", 2.0); expResult.put("(filler text) commonly", 2.0); expResult.put("text) commonly used", 2.0); expResult.put("commonly used to", 2.0); expResult.put("used to demonstrate", 2.0); expResult.put("to demonstrate the", 2.0); expResult.put("demonstrate the graphic", 2.0); expResult.put("the graphic elements", 2.0); expResult.put("graphic elements of", 2.0); expResult.put("elements of a", 2.0); expResult.put("of a document", 2.0); expResult.put("a document or", 2.0); expResult.put("document or visual", 2.0); expResult.put("or visual presentation,", 2.0); expResult.put("visual presentation, such", 2.0); expResult.put("presentation, such as", 2.0); expResult.put("such as font,", 2.0); expResult.put("as font, typography,", 2.0); expResult.put("font, typography, and", 2.0); expResult.put("typography, and layout,", 2.0); expResult.put("and layout, by", 2.0); expResult.put("layout, by removing", 2.0); expResult.put("by removing the", 2.0); expResult.put("removing the distraction", 2.0); expResult.put("the distraction of", 2.0); expResult.put("distraction of meaningful", 2.0); expResult.put("of meaningful content.", 2.0); expResult.put("meaningful content. The", 2.0); expResult.put("content. The lorem", 2.0); expResult.put("The lorem ipsum", 2.0); expResult.put("lorem ipsum text", 2.0); expResult.put("ipsum text is", 2.0); expResult.put("text is typically", 2.0); expResult.put("is typically a", 2.0); expResult.put("typically a section", 2.0); expResult.put("a section of", 2.0); expResult.put("section of a", 2.0); expResult.put("of a Latin", 2.0); expResult.put("a Latin text", 2.0); expResult.put("Latin text by", 2.0); expResult.put("text by Cicero", 2.0); expResult.put("by Cicero with", 2.0); expResult.put("Cicero with words", 2.0); expResult.put("with words altered,", 2.0); expResult.put("words altered, added,", 2.0); expResult.put("altered, added, and", 2.0); expResult.put("added, and removed", 2.0); expResult.put("and removed that", 2.0); expResult.put("removed that make", 2.0); expResult.put("that make it", 2.0); expResult.put("make it nonsensical", 2.0); expResult.put("it nonsensical and", 2.0); expResult.put("nonsensical and not", 2.0); expResult.put("and not proper", 2.0); expResult.put("not proper Latin.[1]", 2.0); expResult.put("proper Latin.[1] In", 1.0); expResult.put("Latin.[1] In publishing", 1.0); Map<String, Double> result = instance.extract(text); assertEquals(expResult, result); }
logger.info(STR); String text = STR; NgramsExtractor.Parameters p = new NgramsExtractor.Parameters(); p.setMaxDistanceBetweenKwds(0); NgramsExtractor instance = new NgramsExtractor(p); Map<String, Double> expResult = new HashMap<>(); expResult.put("In", 2.0); expResult.put(STR, 2.0); expResult.put("and", 8.0); expResult.put(STR, 4.0); expResult.put(STR, 2.0); expResult.put("lorem", 4.0); expResult.put(STR, 2.0); expResult.put("is", 4.0); expResult.put("a", 8.0); expResult.put(STR, 2.0); expResult.put("text", 6.0); expResult.put(STR, 2.0); expResult.put("text)", 2.0); expResult.put(STR, 2.0); expResult.put("used", 2.0); expResult.put("to", 2.0); expResult.put(STR, 2.0); expResult.put("the", 4.0); expResult.put(STR, 2.0); expResult.put("of", 6.0); expResult.put(STR, 2.0); expResult.put("or", 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put("such", 2.0); expResult.put("as", 2.0); expResult.put("font,", 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put("by", 4.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put("The", 2.0); expResult.put("ipsum", 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put("Latin", 2.0); expResult.put(STR, 2.0); expResult.put("with", 2.0); expResult.put("words", 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put("that", 2.0); expResult.put("make", 2.0); expResult.put("it", 2.0); expResult.put(STR, 2.0); expResult.put("not", 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 4.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 1.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 2.0); expResult.put(STR, 1.0); expResult.put(STR, 1.0); Map<String, Double> result = instance.extract(text); assertEquals(expResult, result); }
/** * Test of extract method, of class NgramsExtractor. */
Test of extract method, of class NgramsExtractor
testExtract
{ "repo_name": "datumbox/datumbox-framework", "path": "datumbox-framework-core/src/test/java/com/datumbox/framework/core/common/text/extractors/NgramsExtractorTest.java", "license": "apache-2.0", "size": 10622 }
[ "java.util.HashMap", "java.util.Map", "org.junit.Assert" ]
import java.util.HashMap; import java.util.Map; import org.junit.Assert;
import java.util.*; import org.junit.*;
[ "java.util", "org.junit" ]
java.util; org.junit;
176,269
public synchronized LegacyVpnInfo getLegacyVpnInfo() { // Check if the caller is authorized. enforceControlPermission(); if (mLegacyVpnRunner == null) return null; final LegacyVpnInfo info = new LegacyVpnInfo(); info.key = mConfig.user; info.state = LegacyVpnInfo.stateFromNetworkInfo(mNetworkInfo); if (mNetworkInfo.isConnected()) { info.intent = mStatusIntent; } return info; }
synchronized LegacyVpnInfo function() { enforceControlPermission(); if (mLegacyVpnRunner == null) return null; final LegacyVpnInfo info = new LegacyVpnInfo(); info.key = mConfig.user; info.state = LegacyVpnInfo.stateFromNetworkInfo(mNetworkInfo); if (mNetworkInfo.isConnected()) { info.intent = mStatusIntent; } return info; }
/** * Return the information of the current ongoing legacy VPN. */
Return the information of the current ongoing legacy VPN
getLegacyVpnInfo
{ "repo_name": "indashnet/InDashNet.Open.UN2000", "path": "android/frameworks/base/services/java/com/android/server/connectivity/Vpn.java", "license": "apache-2.0", "size": 47525 }
[ "com.android.internal.net.LegacyVpnInfo" ]
import com.android.internal.net.LegacyVpnInfo;
import com.android.internal.net.*;
[ "com.android.internal" ]
com.android.internal;
953,985
ThingTypeUID thingTypeUID = new ThingTypeUID(BINDING_ID, device.getCategory()); return new ThingUID(thingTypeUID, account.getUID(), device.getId()); }
ThingTypeUID thingTypeUID = new ThingTypeUID(BINDING_ID, device.getCategory()); return new ThingUID(thingTypeUID, account.getUID(), device.getId()); }
/** * Generates the ThingUID for the given device in the given account. */
Generates the ThingUID for the given device in the given account
generateThingUID
{ "repo_name": "theoweiss/openhab2", "path": "bundles/org.openhab.binding.gardena/src/main/java/org/openhab/binding/gardena/internal/util/UidUtils.java", "license": "epl-1.0", "size": 2356 }
[ "org.eclipse.smarthome.core.thing.ThingTypeUID", "org.eclipse.smarthome.core.thing.ThingUID" ]
import org.eclipse.smarthome.core.thing.ThingTypeUID; import org.eclipse.smarthome.core.thing.ThingUID;
import org.eclipse.smarthome.core.thing.*;
[ "org.eclipse.smarthome" ]
org.eclipse.smarthome;
1,107,931
public boolean isOpaqueCube(IBlockState state) { return false; }
boolean function(IBlockState state) { return false; }
/** * Used to determine ambient occlusion and culling when rebuilding chunks for render */
Used to determine ambient occlusion and culling when rebuilding chunks for render
isOpaqueCube
{ "repo_name": "lucemans/ShapeClient-SRC", "path": "net/minecraft/block/BlockBrewingStand.java", "license": "mpl-2.0", "size": 7509 }
[ "net.minecraft.block.state.IBlockState" ]
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.state.*;
[ "net.minecraft.block" ]
net.minecraft.block;
2,112,878
Observable<SiteVnetInfo> getVnetConnectionAsync(String resourceGroupName, String name, String vnetName);
Observable<SiteVnetInfo> getVnetConnectionAsync(String resourceGroupName, String name, String vnetName);
/** * Gets a virtual network the app (or deployment slot) is connected to by name. * Gets a virtual network the app (or deployment slot) is connected to by name. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the app. * @param vnetName Name of the virtual network. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */
Gets a virtual network the app (or deployment slot) is connected to by name. Gets a virtual network the app (or deployment slot) is connected to by name
getVnetConnectionAsync
{ "repo_name": "hovsepm/azure-sdk-for-java", "path": "appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/WebApps.java", "license": "mit", "size": 204730 }
[ "com.microsoft.azure.management.appservice.v2018_02_01.SiteVnetInfo" ]
import com.microsoft.azure.management.appservice.v2018_02_01.SiteVnetInfo;
import com.microsoft.azure.management.appservice.v2018_02_01.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
1,027,038
JPanel panel = new PaintPanel(); panel.setPreferredSize(new Dimension(WINDOW_SIZE, WINDOW_SIZE)); // Create an instance of the Listener class, which is a KeyListener // with methods filled in so that interesting things happen when // certain keys are pressed. Add the Listener instance to this panel // so that, if the panel has focus and keys are pressed, the // methods of the Listener instance will be called. panel.addKeyListener(new Listener()); return panel; } private class PaintPanel extends JPanel { private static final long serialVersionUID = 1L;
JPanel panel = new PaintPanel(); panel.setPreferredSize(new Dimension(WINDOW_SIZE, WINDOW_SIZE)); panel.addKeyListener(new Listener()); return panel; } private class PaintPanel extends JPanel { private static final long serialVersionUID = 1L;
/** * Create GUI layout. Add a Listener instance to the main panel so that * key events will be recognized when the panel has focus. * * @return GUI layout (as a JPanel). */
Create GUI layout. Add a Listener instance to the main panel so that key events will be recognized when the panel has focus
makeMainPanel
{ "repo_name": "nerdkid93/cis284", "path": "assignment08/src/edu/messiah/cb1442/cis284/KeyListenerDemo.java", "license": "mit", "size": 7315 }
[ "java.awt.Dimension", "javax.swing.JPanel" ]
import java.awt.Dimension; import javax.swing.JPanel;
import java.awt.*; import javax.swing.*;
[ "java.awt", "javax.swing" ]
java.awt; javax.swing;
25,489
public void checkSuperuserPrivilege() throws AccessControlException { if (!isSuperUser()) { throw new AccessControlException("Access denied for user " + getUser() + ". Superuser privilege is required"); } } /** * Check whether current user have permissions to access the path. * Traverse is always checked. * * Parent path means the parent directory for the path. * Ancestor path means the last (the closest) existing ancestor directory * of the path. * Note that if the parent path exists, * then the parent path and the ancestor path are the same. * * For example, suppose the path is "/foo/bar/baz". * No matter baz is a file or a directory, * the parent path is "/foo/bar". * If bar exists, then the ancestor path is also "/foo/bar". * If bar does not exist and foo exists, * then the ancestor path is "/foo". * Further, if both foo and bar do not exist, * then the ancestor path is "/". * * @param doCheckOwner Require user to be the owner of the path? * @param ancestorAccess The access required by the ancestor of the path. * @param parentAccess The access required by the parent of the path. * @param access The access required by the path. * @param subAccess If path is a directory, * it is the access required of the path and all the sub-directories. * If path is not a directory, there is no effect. * @param ignoreEmptyDir Ignore permission checking for empty directory? * @throws AccessControlException * * Guarded by {@link FSNamesystem#readLock()}
void function() throws AccessControlException { if (!isSuperUser()) { throw new AccessControlException(STR + getUser() + STR); } } /** * Check whether current user have permissions to access the path. * Traverse is always checked. * * Parent path means the parent directory for the path. * Ancestor path means the last (the closest) existing ancestor directory * of the path. * Note that if the parent path exists, * then the parent path and the ancestor path are the same. * * For example, suppose the path is STR. * No matter baz is a file or a directory, * the parent path is STR. * If bar exists, then the ancestor path is also STR. * If bar does not exist and foo exists, * then the ancestor path is "/foo". * Further, if both foo and bar do not exist, * then the ancestor path is "/". * * @param doCheckOwner Require user to be the owner of the path? * @param ancestorAccess The access required by the ancestor of the path. * @param parentAccess The access required by the parent of the path. * @param access The access required by the path. * @param subAccess If path is a directory, * it is the access required of the path and all the sub-directories. * If path is not a directory, there is no effect. * @param ignoreEmptyDir Ignore permission checking for empty directory? * @throws AccessControlException * * Guarded by {@link FSNamesystem#readLock()}
/** * Verify if the caller has the required permission. This will result into * an exception if the caller is not allowed to access the resource. */
Verify if the caller has the required permission. This will result into an exception if the caller is not allowed to access the resource
checkSuperuserPrivilege
{ "repo_name": "leechoongyon/HadoopSourceAnalyze", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSPermissionChecker.java", "license": "apache-2.0", "size": 22747 }
[ "org.apache.hadoop.security.AccessControlException" ]
import org.apache.hadoop.security.AccessControlException;
import org.apache.hadoop.security.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
2,370,369
public JPanel getPanelLeft() { return m_PanelLeft; }
JPanel function() { return m_PanelLeft; }
/** * Returns the left panel. * * @return the left panel */
Returns the left panel
getPanelLeft
{ "repo_name": "waikato-datamining/adams-base", "path": "adams-weka/src/main/java/adams/gui/tools/wekainvestigator/tab/AttributeSelectionTab.java", "license": "gpl-3.0", "size": 36377 }
[ "javax.swing.JPanel" ]
import javax.swing.JPanel;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
498,193
public void sendTo(AbstractPacket message, EntityPlayerMP player) { this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER); this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player); this.channels.get(Side.SERVER).writeAndFlush(message); }
void function(AbstractPacket message, EntityPlayerMP player) { this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER); this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player); this.channels.get(Side.SERVER).writeAndFlush(message); }
/** * Send this message to the specified player. * <p/> * Adapted from CPW's code in cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper * * @param message The message to send * @param player The player to send it to */
Send this message to the specified player. Adapted from CPW's code in cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper
sendTo
{ "repo_name": "BloodMists/Blood-s-Travel-Gear", "path": "src/main/java/travellersgear/common/network/TGPacketPipeline.java", "license": "gpl-3.0", "size": 8502 }
[ "net.minecraft.entity.player.EntityPlayerMP" ]
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.*;
[ "net.minecraft.entity" ]
net.minecraft.entity;
2,441,688
public static void clearBackStack(FragmentActivity activity) { FragmentManager fm = activity.getSupportFragmentManager(); clearBackStack(fm); }
static void function(FragmentActivity activity) { FragmentManager fm = activity.getSupportFragmentManager(); clearBackStack(fm); }
/** * A helper method for clearing the backstack. * @param activity the activity to get the fragment manager from. */
A helper method for clearing the backstack
clearBackStack
{ "repo_name": "CIS-Extra/mazes_and_minotaurs", "path": "MazesAndMinotaurs/app/src/main/java/com/example/cis/mazeminotaurs/util/Util.java", "license": "gpl-3.0", "size": 3304 }
[ "android.support.v4.app.FragmentActivity", "android.support.v4.app.FragmentManager" ]
import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager;
import android.support.v4.app.*;
[ "android.support" ]
android.support;
1,307,233
public AngularObject removeAndNotifyRemoteProcess(final String name, final String noteId, final String paragraphId) { RemoteInterpreterProcess remoteInterpreterProcess = getRemoteInterpreterProcess(); if (remoteInterpreterProcess == null || !remoteInterpreterProcess.isRunning()) { return super.remove(name, noteId, paragraphId); }
AngularObject function(final String name, final String noteId, final String paragraphId) { RemoteInterpreterProcess remoteInterpreterProcess = getRemoteInterpreterProcess(); if (remoteInterpreterProcess == null !remoteInterpreterProcess.isRunning()) { return super.remove(name, noteId, paragraphId); }
/** * When ZeppelinServer side code want to remove angularObject from the registry, * this method should be used instead of remove() * @param name * @param noteId * @param paragraphId * @return */
When ZeppelinServer side code want to remove angularObject from the registry, this method should be used instead of remove()
removeAndNotifyRemoteProcess
{ "repo_name": "karuppayya/zeppelin", "path": "zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteAngularObjectRegistry.java", "license": "apache-2.0", "size": 4797 }
[ "org.apache.zeppelin.display.AngularObject" ]
import org.apache.zeppelin.display.AngularObject;
import org.apache.zeppelin.display.*;
[ "org.apache.zeppelin" ]
org.apache.zeppelin;
468,307
private int parseWindingRule() { final String windingRule = (String) getParameter( GeneralPathObjectDescription.WINDING_RULE_NAME ); int wRule = -1; if ( windingRule == null ) { return wRule; } if ( windingRule.equals( GeneralPathObjectDescription.WINDING_RULE_EVEN_ODD ) ) { wRule = PathIterator.WIND_EVEN_ODD; } else if ( windingRule.equals( GeneralPathObjectDescription.WINDING_RULE_NON_ZERO ) ) { wRule = PathIterator.WIND_NON_ZERO; } return wRule; }
int function() { final String windingRule = (String) getParameter( GeneralPathObjectDescription.WINDING_RULE_NAME ); int wRule = -1; if ( windingRule == null ) { return wRule; } if ( windingRule.equals( GeneralPathObjectDescription.WINDING_RULE_EVEN_ODD ) ) { wRule = PathIterator.WIND_EVEN_ODD; } else if ( windingRule.equals( GeneralPathObjectDescription.WINDING_RULE_NON_ZERO ) ) { wRule = PathIterator.WIND_NON_ZERO; } return wRule; }
/** * Translates the winding rule parameter into a predefined PathIterator constant. * * @return the translated winding rule or -1 if the rule was invalid. */
Translates the winding rule parameter into a predefined PathIterator constant
parseWindingRule
{ "repo_name": "EgorZhuk/pentaho-reporting", "path": "engine/core/src/main/java/org/pentaho/reporting/engine/classic/core/modules/parser/ext/factory/objects/GeneralPathObjectDescription.java", "license": "lgpl-2.1", "size": 7952 }
[ "java.awt.geom.PathIterator" ]
import java.awt.geom.PathIterator;
import java.awt.geom.*;
[ "java.awt" ]
java.awt;
518,581
protected String getLabel(String typeName) { try { return ModelEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type"); } catch(MissingResourceException mre) { ModelEditorPlugin.INSTANCE.log(mre); } return typeName; }
String function(String typeName) { try { return ModelEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type"); } catch(MissingResourceException mre) { ModelEditorPlugin.INSTANCE.log(mre); } return typeName; }
/** * Returns the label for the specified type name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
Returns the label for the specified type name.
getLabel
{ "repo_name": "alexlenk/CloudStandby", "path": "org/cloudstandby/model.editor/src/model/presentation/ModelModelWizard.java", "license": "agpl-3.0", "size": 17611 }
[ "java.util.MissingResourceException" ]
import java.util.MissingResourceException;
import java.util.*;
[ "java.util" ]
java.util;
30,973
@CanIgnoreReturnValue // TODO(kak): Consider removing this? @Nullable public static <T> T getOnlyElement(Iterator<? extends T> iterator, @Nullable T defaultValue) { return iterator.hasNext() ? getOnlyElement(iterator) : defaultValue; }
@CanIgnoreReturnValue static <T> T function(Iterator<? extends T> iterator, @Nullable T defaultValue) { return iterator.hasNext() ? getOnlyElement(iterator) : defaultValue; }
/** * Returns the single element contained in {@code iterator}, or {@code * defaultValue} if the iterator is empty. * * @throws IllegalArgumentException if the iterator contains multiple * elements. The state of the iterator is unspecified. */
Returns the single element contained in iterator, or defaultValue if the iterator is empty
getOnlyElement
{ "repo_name": "tli2/guava", "path": "guava/src/com/google/common/collect/Iterators.java", "license": "apache-2.0", "size": 45046 }
[ "com.google.errorprone.annotations.CanIgnoreReturnValue", "java.util.Iterator", "javax.annotation.Nullable" ]
import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.Iterator; import javax.annotation.Nullable;
import com.google.errorprone.annotations.*; import java.util.*; import javax.annotation.*;
[ "com.google.errorprone", "java.util", "javax.annotation" ]
com.google.errorprone; java.util; javax.annotation;
698,614
public Control createControl(Composite parent) { Display display= parent.getDisplay(); fBackgroundColor= display.getSystemColor(SWT.COLOR_LIST_BACKGROUND); fForegroundColor= display.getSystemColor(SWT.COLOR_LIST_FOREGROUND); fSeparatorColor= new Color(display, 152, 170, 203); JFaceResources.getFontRegistry().addListener(this);
Control function(Composite parent) { Display display= parent.getDisplay(); fBackgroundColor= display.getSystemColor(SWT.COLOR_LIST_BACKGROUND); fForegroundColor= display.getSystemColor(SWT.COLOR_LIST_FOREGROUND); fSeparatorColor= new Color(display, 152, 170, 203); JFaceResources.getFontRegistry().addListener(this);
/** * Creates the control of the source attachment form. * * @param parent the parent composite * @return the creates source attachment form */
Creates the control of the source attachment form
createControl
{ "repo_name": "elucash/eclipse-oxygen", "path": "org.eclipse.jdt.ui/src/org/eclipse/jdt/internal/ui/javaeditor/ClassFileEditor.java", "license": "epl-1.0", "size": 33462 }
[ "org.eclipse.jface.resource.JFaceResources", "org.eclipse.swt.graphics.Color", "org.eclipse.swt.widgets.Composite", "org.eclipse.swt.widgets.Control", "org.eclipse.swt.widgets.Display" ]
import org.eclipse.jface.resource.JFaceResources; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display;
import org.eclipse.jface.resource.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.widgets.*;
[ "org.eclipse.jface", "org.eclipse.swt" ]
org.eclipse.jface; org.eclipse.swt;
32,934
public CompletableFuture<?> executeRunnables(Stream<Runnable> runnables);
CompletableFuture<?> function(Stream<Runnable> runnables);
/** * Executes the given runnables, returning a future that will be done once all runnables finish. * * This execution is executed on a limited number of threads. * * @param runnables * @return a CompletableFuture that will be done on once all runnables finish. */
Executes the given runnables, returning a future that will be done once all runnables finish. This execution is executed on a limited number of threads
executeRunnables
{ "repo_name": "jerolba/torodb", "path": "engine/core/src/main/java/com/torodb/core/concurrent/StreamExecutor.java", "license": "agpl-3.0", "size": 2390 }
[ "java.util.concurrent.CompletableFuture", "java.util.stream.Stream" ]
import java.util.concurrent.CompletableFuture; import java.util.stream.Stream;
import java.util.concurrent.*; import java.util.stream.*;
[ "java.util" ]
java.util;
2,358,966
public static List<PageDecorator> getPageDecorators() { // this method may be called to render start up errors, at which point Hudson doesn't exist yet. see JENKINS-3608 if(Jenkins.getInstanceOrNull()==null) return Collections.emptyList(); return PageDecorator.all(); }
static List<PageDecorator> function() { if(Jenkins.getInstanceOrNull()==null) return Collections.emptyList(); return PageDecorator.all(); }
/** * Gets all the {@link PageDecorator}s. */
Gets all the <code>PageDecorator</code>s
getPageDecorators
{ "repo_name": "rsandell/jenkins", "path": "core/src/main/java/hudson/Functions.java", "license": "mit", "size": 84169 }
[ "hudson.model.PageDecorator", "java.util.Collections", "java.util.List" ]
import hudson.model.PageDecorator; import java.util.Collections; import java.util.List;
import hudson.model.*; import java.util.*;
[ "hudson.model", "java.util" ]
hudson.model; java.util;
2,576,205
@Test public void testTimeout2() throws Exception { IPhynixxXAConnection<ITestConnection> xaCon = factory1.getXAConnection(); ITestConnection con = xaCon.getConnection(); XAResource xaresource = xaCon.getXAResource(); try { xaresource.setTransactionTimeout(2); throw new AssertionFailedError("Timeout not supported"); } catch (Exception e) { } try { this.getTransactionManager().begin(); // act transactional and enlist the current resource con.act(1); // sleeping 7 secs to provoke timeout TestUtils.sleep(3 * 1000); con.act(1); try { this.getTransactionManager().commit(); throw new AssertionFailedError("RollbackedException expected"); } catch (javax.transaction.RollbackException e) { } } finally { if (con != null) { con.close(); } } }
void function() throws Exception { IPhynixxXAConnection<ITestConnection> xaCon = factory1.getXAConnection(); ITestConnection con = xaCon.getConnection(); XAResource xaresource = xaCon.getXAResource(); try { xaresource.setTransactionTimeout(2); throw new AssertionFailedError(STR); } catch (Exception e) { } try { this.getTransactionManager().begin(); con.act(1); TestUtils.sleep(3 * 1000); con.act(1); try { this.getTransactionManager().commit(); throw new AssertionFailedError(STR); } catch (javax.transaction.RollbackException e) { } } finally { if (con != null) { con.close(); } } }
/** * scenario: transaction timeout is set to 2 secs. The call of a method of * the connection has to fail, when the XAResource expired * * @throws Exception */
scenario: transaction timeout is set to 2 secs. The call of a method of the connection has to fail, when the XAResource expired
testTimeout2
{ "repo_name": "csc19601128/Phynixx", "path": "phynixx/phynixx-xa/src/test/java/org/csc/phynixx/xa/JotmIntegrationTest.java", "license": "apache-2.0", "size": 45549 }
[ "javax.transaction.xa.XAResource", "junit.framework.AssertionFailedError", "org.csc.phynixx.common.TestUtils", "org.csc.phynixx.phynixx.testconnection.ITestConnection" ]
import javax.transaction.xa.XAResource; import junit.framework.AssertionFailedError; import org.csc.phynixx.common.TestUtils; import org.csc.phynixx.phynixx.testconnection.ITestConnection;
import javax.transaction.xa.*; import junit.framework.*; import org.csc.phynixx.common.*; import org.csc.phynixx.phynixx.testconnection.*;
[ "javax.transaction", "junit.framework", "org.csc.phynixx" ]
javax.transaction; junit.framework; org.csc.phynixx;
1,677,701
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { if (this.field_150948_b) { return super.onItemUse(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10); } else if (par1ItemStack.stackSize == 0) { return false; } else if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack)) { return false; } else { Block block = par3World.getBlock(par4, par5, par6); int i1 = par3World.getBlockMetadata(par4, par5, par6); int j1 = i1 & 7; boolean flag = (i1 & 8) != 0; if ((par7 == 1 && !flag || par7 == 0 && flag) && block == this.field_150949_c && j1 == par1ItemStack.getItemDamage()) { if (par3World.checkNoEntityCollision(this.field_150947_d.getCollisionBoundingBoxFromPool(par3World, par4, par5, par6)) && par3World.setBlock(par4, par5, par6, this.field_150947_d, j1, 3)) { par3World.playSoundEffect((double)((float)par4 + 0.5F), (double)((float)par5 + 0.5F), (double)((float)par6 + 0.5F), this.field_150947_d.stepSound.func_150496_b(), (this.field_150947_d.stepSound.getVolume() + 1.0F) / 2.0F, this.field_150947_d.stepSound.getPitch() * 0.8F); --par1ItemStack.stackSize; } return true; } else { return this.func_150946_a(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7) ? true : super.onItemUse(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10); } } }
boolean function(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { if (this.field_150948_b) { return super.onItemUse(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10); } else if (par1ItemStack.stackSize == 0) { return false; } else if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack)) { return false; } else { Block block = par3World.getBlock(par4, par5, par6); int i1 = par3World.getBlockMetadata(par4, par5, par6); int j1 = i1 & 7; boolean flag = (i1 & 8) != 0; if ((par7 == 1 && !flag par7 == 0 && flag) && block == this.field_150949_c && j1 == par1ItemStack.getItemDamage()) { if (par3World.checkNoEntityCollision(this.field_150947_d.getCollisionBoundingBoxFromPool(par3World, par4, par5, par6)) && par3World.setBlock(par4, par5, par6, this.field_150947_d, j1, 3)) { par3World.playSoundEffect((double)((float)par4 + 0.5F), (double)((float)par5 + 0.5F), (double)((float)par6 + 0.5F), this.field_150947_d.stepSound.func_150496_b(), (this.field_150947_d.stepSound.getVolume() + 1.0F) / 2.0F, this.field_150947_d.stepSound.getPitch() * 0.8F); --par1ItemStack.stackSize; } return true; } else { return this.func_150946_a(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7) ? true : super.onItemUse(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10); } } }
/** * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return * True if something happen and false if it don't. This is for ITEMS, not BLOCKS */
Callback for item usage. If the item does something special on right clicking, he will have one of those. Return True if something happen and false if it don't. This is for ITEMS, not BLOCKS
onItemUse
{ "repo_name": "KeeperofMee/Color-Blocks", "path": "colorblocks/items/CbWhitePinkSlabItem.java", "license": "gpl-3.0", "size": 8497 }
[ "net.minecraft.block.Block", "net.minecraft.entity.player.EntityPlayer", "net.minecraft.item.ItemStack", "net.minecraft.world.World" ]
import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World;
import net.minecraft.block.*; import net.minecraft.entity.player.*; import net.minecraft.item.*; import net.minecraft.world.*;
[ "net.minecraft.block", "net.minecraft.entity", "net.minecraft.item", "net.minecraft.world" ]
net.minecraft.block; net.minecraft.entity; net.minecraft.item; net.minecraft.world;
1,449,631
@Test(timeout = 60000) public void testBookieContinueWritingIfMultipleLedgersPresent() throws Exception { startNewBookieWithMultipleLedgerDirs(2); File[] ledgerDirs = bsConfs.get(1).getLedgerDirs(); assertEquals("Only one ledger dir should be present", 2, ledgerDirs.length); Bookie bookie = bs.get(1).getBookie(); LedgerHandle ledger = bkc.createLedger(2, 2, DigestType.MAC, "".getBytes()); LedgerDirsManager ledgerDirsManager = bookie.getLedgerDirsManager(); for (int i = 0; i < 10; i++) { ledger.addEntry("data".getBytes()); } // Now add the current ledger dir to filled dirs list ledgerDirsManager.addToFilledDirs(new File(ledgerDirs[0], "current")); for (int i = 0; i < 10; i++) { ledger.addEntry("data".getBytes()); } assertEquals("writable dirs should have one dir", 1, ledgerDirsManager .getWritableLedgerDirs().size()); assertTrue("Bookie should shutdown if readOnlyMode not enabled", bookie.isAlive()); }
@Test(timeout = 60000) void function() throws Exception { startNewBookieWithMultipleLedgerDirs(2); File[] ledgerDirs = bsConfs.get(1).getLedgerDirs(); assertEquals(STR, 2, ledgerDirs.length); Bookie bookie = bs.get(1).getBookie(); LedgerHandle ledger = bkc.createLedger(2, 2, DigestType.MAC, STRdataSTRcurrentSTRdataSTRwritable dirs should have one dirSTRBookie should shutdown if readOnlyMode not enabled", bookie.isAlive()); }
/** * Check multiple ledger dirs */
Check multiple ledger dirs
testBookieContinueWritingIfMultipleLedgersPresent
{ "repo_name": "fengshao0907/bookkeeper", "path": "bookkeeper-server/src/test/java/org/apache/bookkeeper/test/ReadOnlyBookieTest.java", "license": "apache-2.0", "size": 13567 }
[ "java.io.File", "org.apache.bookkeeper.bookie.Bookie", "org.apache.bookkeeper.client.BookKeeper", "org.apache.bookkeeper.client.LedgerHandle", "org.junit.Test" ]
import java.io.File; import org.apache.bookkeeper.bookie.Bookie; import org.apache.bookkeeper.client.BookKeeper; import org.apache.bookkeeper.client.LedgerHandle; import org.junit.Test;
import java.io.*; import org.apache.bookkeeper.bookie.*; import org.apache.bookkeeper.client.*; import org.junit.*;
[ "java.io", "org.apache.bookkeeper", "org.junit" ]
java.io; org.apache.bookkeeper; org.junit;
435,848
ServiceFuture<CloudPool> getAsync(String poolId, final ServiceCallback<CloudPool> serviceCallback);
ServiceFuture<CloudPool> getAsync(String poolId, final ServiceCallback<CloudPool> serviceCallback);
/** * Gets information about the specified Pool. * * @param poolId The ID of the Pool to get. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */
Gets information about the specified Pool
getAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/batch/microsoft-azure-batch/src/main/java/com/microsoft/azure/batch/protocol/Pools.java", "license": "mit", "size": 116628 }
[ "com.microsoft.azure.batch.protocol.models.CloudPool", "com.microsoft.rest.ServiceCallback", "com.microsoft.rest.ServiceFuture" ]
import com.microsoft.azure.batch.protocol.models.CloudPool; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture;
import com.microsoft.azure.batch.protocol.models.*; import com.microsoft.rest.*;
[ "com.microsoft.azure", "com.microsoft.rest" ]
com.microsoft.azure; com.microsoft.rest;
2,915,109
private static boolean isLastEmptyLine(DetailNode newLine) { DetailNode nextNode = JavadocUtils.getNextSibling(newLine); while (nextNode != null && nextNode.getType() != JavadocTokenTypes.JAVADOC_TAG) { if (nextNode.getType() == JavadocTokenTypes.TEXT && nextNode.getChildren().length > 1 || nextNode.getType() == JavadocTokenTypes.HTML_ELEMENT) { return false; } nextNode = JavadocUtils.getNextSibling(nextNode); } return true; }
static boolean function(DetailNode newLine) { DetailNode nextNode = JavadocUtils.getNextSibling(newLine); while (nextNode != null && nextNode.getType() != JavadocTokenTypes.JAVADOC_TAG) { if (nextNode.getType() == JavadocTokenTypes.TEXT && nextNode.getChildren().length > 1 nextNode.getType() == JavadocTokenTypes.HTML_ELEMENT) { return false; } nextNode = JavadocUtils.getNextSibling(nextNode); } return true; }
/** * Tests if NEWLINE node is a last node in javadoc. * @param newLine NEWLINE node. * @return true, if NEWLINE node is a last node in javadoc. */
Tests if NEWLINE node is a last node in javadoc
isLastEmptyLine
{ "repo_name": "attatrol/checkstyle", "path": "src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocParagraphCheck.java", "license": "lgpl-2.1", "size": 9802 }
[ "com.puppycrawl.tools.checkstyle.api.DetailNode", "com.puppycrawl.tools.checkstyle.api.JavadocTokenTypes", "com.puppycrawl.tools.checkstyle.utils.JavadocUtils" ]
import com.puppycrawl.tools.checkstyle.api.DetailNode; import com.puppycrawl.tools.checkstyle.api.JavadocTokenTypes; import com.puppycrawl.tools.checkstyle.utils.JavadocUtils;
import com.puppycrawl.tools.checkstyle.api.*; import com.puppycrawl.tools.checkstyle.utils.*;
[ "com.puppycrawl.tools" ]
com.puppycrawl.tools;
551,143
@Deprecated public static String[] getHosts(String strInterface) throws UnknownHostException { return getHosts(strInterface, null); }
static String[] function(String strInterface) throws UnknownHostException { return getHosts(strInterface, null); }
/** * Returns all the host names associated by the default nameserver with the * address bound to the specified network interface * * @param strInterface * The name of the network interface to query (e.g. eth0) * @return The list of host names associated with IPs bound to the network * interface * @throws UnknownHostException * If one is encountered while querying the deault interface * */
Returns all the host names associated by the default nameserver with the address bound to the specified network interface
getHosts
{ "repo_name": "shakamunyi/hadoop-20", "path": "src/core/org/apache/hadoop/net/DNS.java", "license": "apache-2.0", "size": 8000 }
[ "java.net.UnknownHostException" ]
import java.net.UnknownHostException;
import java.net.*;
[ "java.net" ]
java.net;
1,605,627
private static List<AnnotationNode> merge(List<AnnotationNode> from, List<AnnotationNode> to, String type, String name) { try { if (from == null) { return to; } if (to == null) { to = new ArrayList<AnnotationNode>(); } for (AnnotationNode annotation : from) { if (!Annotations.isMergeableAnnotation(annotation)) { continue; } for (Iterator<AnnotationNode> iter = to.iterator(); iter.hasNext();) { if (iter.next().desc.equals(annotation.desc)) { iter.remove(); break; } } to.add(annotation); } } catch (Exception ex) { MixinService.getService().getLogger("mixin").warn("Exception encountered whilst merging annotations for {} {}", type, name); } return to; }
static List<AnnotationNode> function(List<AnnotationNode> from, List<AnnotationNode> to, String type, String name) { try { if (from == null) { return to; } if (to == null) { to = new ArrayList<AnnotationNode>(); } for (AnnotationNode annotation : from) { if (!Annotations.isMergeableAnnotation(annotation)) { continue; } for (Iterator<AnnotationNode> iter = to.iterator(); iter.hasNext();) { if (iter.next().desc.equals(annotation.desc)) { iter.remove(); break; } } to.add(annotation); } } catch (Exception ex) { MixinService.getService().getLogger("mixin").warn(STR, type, name); } return to; }
/** * Merge annotations from the source list to the target list. Returns the * target list or a new list if the target list was null. * * @param from Annotations to merge * @param to Annotation list to merge into * @param type Type of element being merged * @param name Name of the item being merged, for debugging purposes * @return The merged list (or a new list if the target list was null) */
Merge annotations from the source list to the target list. Returns the target list or a new list if the target list was null
merge
{ "repo_name": "SpongePowered/Mixin", "path": "src/main/java/org/spongepowered/asm/util/Annotations.java", "license": "mit", "size": 31514 }
[ "java.util.ArrayList", "java.util.Iterator", "java.util.List", "org.objectweb.asm.tree.AnnotationNode", "org.spongepowered.asm.service.MixinService" ]
import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.objectweb.asm.tree.AnnotationNode; import org.spongepowered.asm.service.MixinService;
import java.util.*; import org.objectweb.asm.tree.*; import org.spongepowered.asm.service.*;
[ "java.util", "org.objectweb.asm", "org.spongepowered.asm" ]
java.util; org.objectweb.asm; org.spongepowered.asm;
1,426,949
private static ScanResult loadExcept(URL ignored) { Set<URL> preScanned = ClassPathScanner.forResource(REGISTRY_FILE, false); ScanResult result = null; for (URL u : preScanned) { if (ignored!= null && u.toString().startsWith(ignored.toString())) { continue; } try (InputStream reflections = u.openStream()) { ScanResult ref = reader.readValue(reflections); if (result == null) { result = ref; } else { result = result.merge(ref); } } catch (IOException e) { throw new DrillRuntimeException("can't read function registry at " + u, e); } } if (result != null) { logger.info(format("Loaded prescanned packages %s from locations %s", result.getScannedPackages(), preScanned)); return result; } else { return ClassPathScanner.emptyResult(); } }
static ScanResult function(URL ignored) { Set<URL> preScanned = ClassPathScanner.forResource(REGISTRY_FILE, false); ScanResult result = null; for (URL u : preScanned) { if (ignored!= null && u.toString().startsWith(ignored.toString())) { continue; } try (InputStream reflections = u.openStream()) { ScanResult ref = reader.readValue(reflections); if (result == null) { result = ref; } else { result = result.merge(ref); } } catch (IOException e) { throw new DrillRuntimeException(STR + u, e); } } if (result != null) { logger.info(format(STR, result.getScannedPackages(), preScanned)); return result; } else { return ClassPathScanner.emptyResult(); } }
/** * loads all the prescanned resources from classpath * (except for the target location in case it already exists) * @return the result of the previous scan */
loads all the prescanned resources from classpath (except for the target location in case it already exists)
loadExcept
{ "repo_name": "mehant/drill", "path": "common/src/main/java/org/apache/drill/common/scanner/BuildTimeScan.java", "license": "apache-2.0", "size": 5353 }
[ "java.io.IOException", "java.io.InputStream", "java.util.Set", "org.apache.drill.common.exceptions.DrillRuntimeException", "org.apache.drill.common.scanner.persistence.ScanResult" ]
import java.io.IOException; import java.io.InputStream; import java.util.Set; import org.apache.drill.common.exceptions.DrillRuntimeException; import org.apache.drill.common.scanner.persistence.ScanResult;
import java.io.*; import java.util.*; import org.apache.drill.common.exceptions.*; import org.apache.drill.common.scanner.persistence.*;
[ "java.io", "java.util", "org.apache.drill" ]
java.io; java.util; org.apache.drill;
1,473,992
public List<FfpItem> getItems() { return this.items; }
List<FfpItem> function() { return this.items; }
/** * Gets the item watched. * * @return the item watched */
Gets the item watched
getItems
{ "repo_name": "Judikael/FreeboxFilePusher", "path": "src/main/java/eu/gaki/ffp/domain/FilePusher.java", "license": "gpl-2.0", "size": 855 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
386,144
@DoesServiceRequest public final void uploadMetadata() throws StorageException { this.uploadMetadata(null , null , null ); }
final void function() throws StorageException { this.uploadMetadata(null , null , null ); }
/** * Uploads the blob's metadata to the storage service. * <p> * Use {@link CloudBlob#downloadAttributes} to retrieve the latest values for the blob's properties and metadata * from the Microsoft Azure storage service. * * @throws StorageException * If a storage service error occurred. */
Uploads the blob's metadata to the storage service. Use <code>CloudBlob#downloadAttributes</code> to retrieve the latest values for the blob's properties and metadata from the Microsoft Azure storage service
uploadMetadata
{ "repo_name": "esummers-msft/azure-storage-java", "path": "microsoft-azure-storage/src/com/microsoft/azure/storage/blob/CloudBlob.java", "license": "apache-2.0", "size": 133882 }
[ "com.microsoft.azure.storage.StorageException" ]
import com.microsoft.azure.storage.StorageException;
import com.microsoft.azure.storage.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
1,260,216
public static void bind(ServerSocket socket, InetSocketAddress address, int backlog) throws IOException { try { socket.bind(address, backlog); } catch (BindException e) { BindException bindException = new BindException("Problem binding to " + address + " : " + e.getMessage()); bindException.initCause(e); throw bindException; } catch (SocketException e) { // If they try to bind to a different host's address, give a better // error message. if ("Unresolved address".equals(e.getMessage())) { throw new UnknownHostException("Invalid hostname for server: " + address.getHostName()); } throw e; } }
static void function(ServerSocket socket, InetSocketAddress address, int backlog) throws IOException { try { socket.bind(address, backlog); } catch (BindException e) { BindException bindException = new BindException(STR + address + STR + e.getMessage()); bindException.initCause(e); throw bindException; } catch (SocketException e) { if (STR.equals(e.getMessage())) { throw new UnknownHostException(STR + address.getHostName()); } throw e; } }
/** * A convenience method to bind to a given address and report * better exceptions if the address is not a valid host. * @param socket the socket to bind * @param address the address to bind to * @param backlog the number of connections allowed in the queue * @throws BindException if the address can't be bound * @throws UnknownHostException if the address isn't a valid host name * @throws IOException other random errors from bind */
A convenience method to bind to a given address and report better exceptions if the address is not a valid host
bind
{ "repo_name": "francisliu/hbase_namespace", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java", "license": "apache-2.0", "size": 96031 }
[ "java.io.IOException", "java.net.BindException", "java.net.InetSocketAddress", "java.net.ServerSocket", "java.net.SocketException", "java.net.UnknownHostException" ]
import java.io.IOException; import java.net.BindException; import java.net.InetSocketAddress; import java.net.ServerSocket; import java.net.SocketException; import java.net.UnknownHostException;
import java.io.*; import java.net.*;
[ "java.io", "java.net" ]
java.io; java.net;
1,128,845
public static void main(String[] argv) { try { AppGameContainer container = new AppGameContainer( new GeomUtilTileTest()); container.setDisplayMode(800, 600, false); container.start(); } catch (SlickException e) { e.printStackTrace(); } }
static void function(String[] argv) { try { AppGameContainer container = new AppGameContainer( new GeomUtilTileTest()); container.setDisplayMode(800, 600, false); container.start(); } catch (SlickException e) { e.printStackTrace(); } }
/** * Entry point to our test * * @param argv * The arguments passed to the test */
Entry point to our test
main
{ "repo_name": "dbank-so/fadableUnicodeFont", "path": "src/org/newdawn/slick/tests/GeomUtilTileTest.java", "license": "bsd-3-clause", "size": 11328 }
[ "org.newdawn.slick.AppGameContainer", "org.newdawn.slick.SlickException" ]
import org.newdawn.slick.AppGameContainer; import org.newdawn.slick.SlickException;
import org.newdawn.slick.*;
[ "org.newdawn.slick" ]
org.newdawn.slick;
1,161,909
protected void collectStats(NovoaRun novoa, double perfInf) { Solution<?> solution = (Solution<?>) novoa.getMsa().getCurrentSolution(); int failures = novoa.getInstance().getRequestCount() - getSize(); double cost = novoa.getStatus() == ReturnStatus.NORMAL ? solution.getCost() : -1; double gap = novoa.getStatus() == ReturnStatus.NORMAL ? (cost - perfInf) / perfInf : -1; mStatsCollector.collect(Integer.valueOf(getRun()), novoa.getInstance().getName(), getSize(), (int) novoa.getInstance().getFleet().getVehicle().getCapacity(), Double.valueOf(novoa.getMsa().getTimer().readTimeS()), Double.valueOf(cost), Double.valueOf(perfInf), Integer.valueOf(failures), Double.valueOf(novoa.getTravelInvertSpeed()), comment, Arrays.toString(seeds), novoa.getStatus().toString(), Double.valueOf(gap)); }
void function(NovoaRun novoa, double perfInf) { Solution<?> solution = (Solution<?>) novoa.getMsa().getCurrentSolution(); int failures = novoa.getInstance().getRequestCount() - getSize(); double cost = novoa.getStatus() == ReturnStatus.NORMAL ? solution.getCost() : -1; double gap = novoa.getStatus() == ReturnStatus.NORMAL ? (cost - perfInf) / perfInf : -1; mStatsCollector.collect(Integer.valueOf(getRun()), novoa.getInstance().getName(), getSize(), (int) novoa.getInstance().getFleet().getVehicle().getCapacity(), Double.valueOf(novoa.getMsa().getTimer().readTimeS()), Double.valueOf(cost), Double.valueOf(perfInf), Integer.valueOf(failures), Double.valueOf(novoa.getTravelInvertSpeed()), comment, Arrays.toString(seeds), novoa.getStatus().toString(), Double.valueOf(gap)); }
/** * Collect statistics. * * @param novoa * the novoa * @param perfInf * the perfect information cost */
Collect statistics
collectStats
{ "repo_name": "vpillac/vroom", "path": "jMSA/bench/vroom/optimization/online/jmsa/benchmarking/NovoaBenchmarking.java", "license": "gpl-3.0", "size": 37944 }
[ "java.util.Arrays" ]
import java.util.Arrays;
import java.util.*;
[ "java.util" ]
java.util;
114,511
public static void systemCallSoundSystemVolumeGetInputMute( Wrapper<ReturnCode> outReturnCode, Wrapper<SoundReturnCode> outSoundReturnCode, Wrapper<Boolean> outMute ){ List<Parameter> params = new ArrayList<>(); QAMessage response = Kernel.systemCall("de.silveryard.basesystem.systemcall.sound.systemvolume.getinputmute", params); outReturnCode.value = ReturnCode.getEnumValue(response.getParameters().get(0).getInt()); outSoundReturnCode.value = SoundReturnCode.getEnumValue(response.getParameters().get(1).getInt()); outMute.value = response.getParameters().get(2).getBoolean(); }
static void function( Wrapper<ReturnCode> outReturnCode, Wrapper<SoundReturnCode> outSoundReturnCode, Wrapper<Boolean> outMute ){ List<Parameter> params = new ArrayList<>(); QAMessage response = Kernel.systemCall(STR, params); outReturnCode.value = ReturnCode.getEnumValue(response.getParameters().get(0).getInt()); outSoundReturnCode.value = SoundReturnCode.getEnumValue(response.getParameters().get(1).getInt()); outMute.value = response.getParameters().get(2).getBoolean(); }
/** * Fetches the mute flag of the systems input driver * @param outReturnCode General Return Code * @param outSoundReturnCode Sound Return Code * @param outMute Mute flag value */
Fetches the mute flag of the systems input driver
systemCallSoundSystemVolumeGetInputMute
{ "repo_name": "Silveryard/BaseSystem", "path": "Libraries/App/Java/AppSDK/src/main/java/de/silveryard/basesystem/sdk/kernel/sound/SystemVolume.java", "license": "mit", "size": 15257 }
[ "de.silveryard.basesystem.sdk.kernel.Kernel", "de.silveryard.basesystem.sdk.kernel.ReturnCode", "de.silveryard.basesystem.sdk.kernel.Wrapper", "de.silveryard.transport.Parameter", "de.silveryard.transport.highlevelprotocols.qa.QAMessage", "java.util.ArrayList", "java.util.List" ]
import de.silveryard.basesystem.sdk.kernel.Kernel; import de.silveryard.basesystem.sdk.kernel.ReturnCode; import de.silveryard.basesystem.sdk.kernel.Wrapper; import de.silveryard.transport.Parameter; import de.silveryard.transport.highlevelprotocols.qa.QAMessage; import java.util.ArrayList; import java.util.List;
import de.silveryard.basesystem.sdk.kernel.*; import de.silveryard.transport.*; import de.silveryard.transport.highlevelprotocols.qa.*; import java.util.*;
[ "de.silveryard.basesystem", "de.silveryard.transport", "java.util" ]
de.silveryard.basesystem; de.silveryard.transport; java.util;
432,298
@Generated @Selector("image") public native UIImage image();
@Selector("image") native UIImage function();
/** * The image displayed on the button. * <p> * Animated images are not supported. If an animated image is assigned, only the first image will be used. */
The image displayed on the button. Animated images are not supported. If an animated image is assigned, only the first image will be used
image
{ "repo_name": "multi-os-engine/moe-core", "path": "moe.apple/moe.platform.ios/src/main/java/apple/carplay/CPMapButton.java", "license": "apache-2.0", "size": 7964 }
[ "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,268,862
public void add(JavaProject project, int includeMask, HashSet projectsToBeAdded) throws JavaModelException { add(project, null, includeMask, projectsToBeAdded, new HashSet(2), null); }
void function(JavaProject project, int includeMask, HashSet projectsToBeAdded) throws JavaModelException { add(project, null, includeMask, projectsToBeAdded, new HashSet(2), null); }
/** * Add java project all fragment roots to current java search scope. * @see #add(JavaProject, IPath, int, HashSet, HashSet, IClasspathEntry) */
Add java project all fragment roots to current java search scope
add
{ "repo_name": "alexVengrovsk/che", "path": "plugins/plugin-java/che-plugin-java-ext-jdt/org-eclipse-jdt-ui/src/main/java/org/eclipse/jdt/internal/core/search/JavaSearchScope.java", "license": "epl-1.0", "size": 33368 }
[ "java.util.HashSet", "org.eclipse.jdt.core.JavaModelException", "org.eclipse.jdt.internal.core.JavaProject" ]
import java.util.HashSet; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.internal.core.JavaProject;
import java.util.*; import org.eclipse.jdt.core.*; import org.eclipse.jdt.internal.core.*;
[ "java.util", "org.eclipse.jdt" ]
java.util; org.eclipse.jdt;
708,479
EList<DataObjectSet> getSource();
EList<DataObjectSet> getSource();
/** * Returns the value of the '<em><b>Source</b></em>' reference list. * The list contents are of type {@link orgomg.cwm.analysis.transformation.DataObjectSet}. * It is bidirectional and its opposite is '{@link orgomg.cwm.analysis.transformation.DataObjectSet#getSourceTransformation <em>Source Transformation</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * Identifies the sources of the Transformation * <!-- end-model-doc --> * @return the value of the '<em>Source</em>' reference list. * @see orgomg.cwm.analysis.transformation.TransformationPackage#getTransformation_Source() * @see orgomg.cwm.analysis.transformation.DataObjectSet#getSourceTransformation * @model opposite="sourceTransformation" * @generated */
Returns the value of the 'Source' reference list. The list contents are of type <code>orgomg.cwm.analysis.transformation.DataObjectSet</code>. It is bidirectional and its opposite is '<code>orgomg.cwm.analysis.transformation.DataObjectSet#getSourceTransformation Source Transformation</code>'. Identifies the sources of the Transformation
getSource
{ "repo_name": "dresden-ocl/dresdenocl", "path": "plugins/org.dresdenocl.tools.CWM/src/orgomg/cwm/analysis/transformation/Transformation.java", "license": "lgpl-3.0", "size": 6990 }
[ "org.eclipse.emf.common.util.EList" ]
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
984,654
public double paintXByColumn(int column) { if (getOwner().hasAlignmentModel() && (getOwner().getAlignmentModel() instanceof ConcatenatedAlignmentModel)) { throw new InternalError("not implemented"); //TODO Implement and consider that different alignment parts may have different token widths here. } else { PaintSettings settings = getOwner().getPaintSettings(); return column * settings.getTokenPainterList().painterByColumn(0).getPreferredWidth() * settings.getZoomX() + getOwner().getSizeManager().getGlobalMaxLengthBeforeStart(); //TODO Catch IllegalStateException? } }
double function(int column) { if (getOwner().hasAlignmentModel() && (getOwner().getAlignmentModel() instanceof ConcatenatedAlignmentModel)) { throw new InternalError(STR); } else { PaintSettings settings = getOwner().getPaintSettings(); return column * settings.getTokenPainterList().painterByColumn(0).getPreferredWidth() * settings.getZoomX() + getOwner().getSizeManager().getGlobalMaxLengthBeforeStart(); } }
/** * Returns the left most x-coordinate of the specified columns in this area. Use this method to convert between cell indices and * paint coordinates. This method takes the current horizontal zoom factor into account. * * @param column the column painted at the returned x-position * @return a value >= 0 */
Returns the left most x-coordinate of the specified columns in this area. Use this method to convert between cell indices and paint coordinates. This method takes the current horizontal zoom factor into account
paintXByColumn
{ "repo_name": "bioinfweb/LibrAlign", "path": "main/info.bioinfweb.libralign.core/src/info/bioinfweb/libralign/alignmentarea/content/AlignmentContentArea.java", "license": "lgpl-3.0", "size": 23679 }
[ "info.bioinfweb.libralign.alignmentarea.paintsettings.PaintSettings", "info.bioinfweb.libralign.model.concatenated.ConcatenatedAlignmentModel" ]
import info.bioinfweb.libralign.alignmentarea.paintsettings.PaintSettings; import info.bioinfweb.libralign.model.concatenated.ConcatenatedAlignmentModel;
import info.bioinfweb.libralign.alignmentarea.paintsettings.*; import info.bioinfweb.libralign.model.concatenated.*;
[ "info.bioinfweb.libralign" ]
info.bioinfweb.libralign;
1,191,520
//---------------// // checkForSplit // //---------------// private AbstractChordInter checkForSplit () { final Scale scale = sig.getSystem().getSheet().getScale(); final double maxChordDy = constants.maxChordDy.getValue(); // Make sure all chords are part of the same group // We check the vertical distance between any chord and the beams above or below the chord. for (AbstractChordInter chord : getChords()) { if (chord.isVip()) { logger.info("VIP checkForSplit on {}", chord); } final Rectangle chordBox = chord.getBounds(); final Point tail = chord.getTailLocation(); // Get the collection of questionable beams WRT chord List<AbstractBeamInter> questionableBeams = new ArrayList<>(); for (Inter bInter : getMembers()) { final AbstractBeamInter beam = (AbstractBeamInter) bInter; // Skip beam hooks // Skip beams attached to this chord // Skip beams with no abscissa overlap WRT this chord if (!beam.isHook() && !beam.getChords().contains(chord) && (GeoUtil.xOverlap(beam.getBounds(), chordBox) > 0)) { // Check vertical gap int lineY = (int) Math.rint(LineUtil.yAtX(beam.getMedian(), tail.x)); int yOverlap = Math.min(lineY, chordBox.y + chordBox.height) - Math.max( lineY, chordBox.y); if (yOverlap < 0) { questionableBeams.add(beam); } } } if (questionableBeams.isEmpty()) { continue; // No problem found around the chord at hand } // Sort these questionable beams vertically, at chord stem abscissa, // according to distance from chord tail. Collections.sort(questionableBeams, (b1, b2) -> { final double y1 = LineUtil.yAtX(b1.getMedian(), tail.x); final double tailDy1 = Math.abs(y1 - tail.y); final double y2 = LineUtil.yAtX(b2.getMedian(), tail.x); final double tailDy2 = Math.abs(y2 - tail.y); return Double.compare(tailDy1, tailDy2); }); AbstractBeamInter nearestBeam = questionableBeams.get(0); int lineY = (int) Math.rint(LineUtil.yAtX(nearestBeam.getMedian(), tail.x)); int tailDy = Math.abs(lineY - tail.y); double normedDy = scale.pixelsToFrac(tailDy); if (normedDy > maxChordDy) { logger.debug( "Vertical gap between {} and {}, {} vs {}", chord, nearestBeam, normedDy, maxChordDy); // Split the beam group here return chord; } } return null; // everything is OK }
AbstractChordInter function () { final Scale scale = sig.getSystem().getSheet().getScale(); final double maxChordDy = constants.maxChordDy.getValue(); for (AbstractChordInter chord : getChords()) { if (chord.isVip()) { logger.info(STR, chord); } final Rectangle chordBox = chord.getBounds(); final Point tail = chord.getTailLocation(); List<AbstractBeamInter> questionableBeams = new ArrayList<>(); for (Inter bInter : getMembers()) { final AbstractBeamInter beam = (AbstractBeamInter) bInter; if (!beam.isHook() && !beam.getChords().contains(chord) && (GeoUtil.xOverlap(beam.getBounds(), chordBox) > 0)) { int lineY = (int) Math.rint(LineUtil.yAtX(beam.getMedian(), tail.x)); int yOverlap = Math.min(lineY, chordBox.y + chordBox.height) - Math.max( lineY, chordBox.y); if (yOverlap < 0) { questionableBeams.add(beam); } } } if (questionableBeams.isEmpty()) { continue; } Collections.sort(questionableBeams, (b1, b2) -> { final double y1 = LineUtil.yAtX(b1.getMedian(), tail.x); final double tailDy1 = Math.abs(y1 - tail.y); final double y2 = LineUtil.yAtX(b2.getMedian(), tail.x); final double tailDy2 = Math.abs(y2 - tail.y); return Double.compare(tailDy1, tailDy2); }); AbstractBeamInter nearestBeam = questionableBeams.get(0); int lineY = (int) Math.rint(LineUtil.yAtX(nearestBeam.getMedian(), tail.x)); int tailDy = Math.abs(lineY - tail.y); double normedDy = scale.pixelsToFrac(tailDy); if (normedDy > maxChordDy) { logger.debug( STR, chord, nearestBeam, normedDy, maxChordDy); return chord; } } return null; }
/** * Run a consistency check on the group, and detect when a group has to be split. * * @return the detected alien chord, or null if no split is needed */
Run a consistency check on the group, and detect when a group has to be split
checkForSplit
{ "repo_name": "Audiveris/audiveris", "path": "src/main/org/audiveris/omr/sig/inter/BeamGroupInter.java", "license": "agpl-3.0", "size": 60733 }
[ "java.awt.Point", "java.awt.Rectangle", "java.util.ArrayList", "java.util.Collections", "java.util.List", "org.audiveris.omr.math.GeoUtil", "org.audiveris.omr.math.LineUtil", "org.audiveris.omr.sheet.Scale" ]
import java.awt.Point; import java.awt.Rectangle; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.audiveris.omr.math.GeoUtil; import org.audiveris.omr.math.LineUtil; import org.audiveris.omr.sheet.Scale;
import java.awt.*; import java.util.*; import org.audiveris.omr.math.*; import org.audiveris.omr.sheet.*;
[ "java.awt", "java.util", "org.audiveris.omr" ]
java.awt; java.util; org.audiveris.omr;
888,158
@NotNull protected AwkMatcher getAwkMatcher() { return m__Instance; }
AwkMatcher function() { return m__Instance; }
/** * Retrieves an instance of AwkMatcher class. * @return the adapted matcher. */
Retrieves an instance of AwkMatcher class
getAwkMatcher
{ "repo_name": "rydnr/java-commons", "path": "src/main/java/org/acmsl/commons/regexpplugin/jakartaoro/AwkMatcherOROAdapter.java", "license": "gpl-2.0", "size": 4626 }
[ "org.apache.oro.text.awk.AwkMatcher" ]
import org.apache.oro.text.awk.AwkMatcher;
import org.apache.oro.text.awk.*;
[ "org.apache.oro" ]
org.apache.oro;
2,640,540
public static String optionalAttributeValue(Map<Object, Object> attributeMap, String name) { Object value = attributeMap.get(name); if (value != null) { String text = value.toString(); if (!Strings.isBlank(text)) { return text; } } return null; }
static String function(Map<Object, Object> attributeMap, String name) { Object value = attributeMap.get(name); if (value != null) { String text = value.toString(); if (!Strings.isBlank(text)) { return text; } } return null; }
/** * Returns the optional String value of the given name */
Returns the optional String value of the given name
optionalAttributeValue
{ "repo_name": "mwringe/fabric8", "path": "forge/addons/camel/src/main/java/io/fabric8/forge/camel/commands/project/ConfigureEndpointPropertiesStep.java", "license": "apache-2.0", "size": 20109 }
[ "java.util.Map", "org.jboss.forge.roaster.model.util.Strings" ]
import java.util.Map; import org.jboss.forge.roaster.model.util.Strings;
import java.util.*; import org.jboss.forge.roaster.model.util.*;
[ "java.util", "org.jboss.forge" ]
java.util; org.jboss.forge;
2,049,457
public List<String> getChildren() { return children; }
List<String> function() { return children; }
/** * Gets children. * * @return the children */
Gets children
getChildren
{ "repo_name": "allure-framework/allure-java", "path": "allure-model/src/main/java/io/qameta/allure/model/TestResultContainer.java", "license": "apache-2.0", "size": 6115 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,845,290
public static <E> Optional<E> maybeOne(E[] array) { return new MaybeOneElement<E>().apply(new ArrayIterator<>(array)); }
static <E> Optional<E> function(E[] array) { return new MaybeOneElement<E>().apply(new ArrayIterator<>(array)); }
/** * Yields the only element if found, nothing otherwise. * * @param <E> the array element type * @param array the array that will be consumed * @throws IllegalStateException if the iterator contains more than one * element * @return just the element or nothing */
Yields the only element if found, nothing otherwise
maybeOne
{ "repo_name": "emaze/emaze-dysfunctional", "path": "src/main/java/net/emaze/dysfunctional/Consumers.java", "license": "bsd-3-clause", "size": 28336 }
[ "java.util.Optional", "net.emaze.dysfunctional.consumers.MaybeOneElement", "net.emaze.dysfunctional.iterations.ArrayIterator" ]
import java.util.Optional; import net.emaze.dysfunctional.consumers.MaybeOneElement; import net.emaze.dysfunctional.iterations.ArrayIterator;
import java.util.*; import net.emaze.dysfunctional.consumers.*; import net.emaze.dysfunctional.iterations.*;
[ "java.util", "net.emaze.dysfunctional" ]
java.util; net.emaze.dysfunctional;
77,933
@Test void perfect_different_cameras() { standardScene(); cameraA = new CameraPinhole(600, 600, 0.1, 400, 410, 800, 600); cameraB = new CameraPinhole(600, 650, 0, 400, 410, 800, 600); cameraC = new CameraPinhole(1200, 1250, 0, 0, 0, 800, 600); simulateScene(0); DMatrixRMaj K1 = PerspectiveOps.pinholeToMatrix(cameraA, (DMatrixRMaj)null); DMatrixRMaj K2 = PerspectiveOps.pinholeToMatrix(cameraB, (DMatrixRMaj)null); var alg = new TwoViewToCalibratingHomography(); alg.initialize(F21, P2); assertTrue(alg.process(K1, K2, observations2)); checkSolution(alg); }
@Test void perfect_different_cameras() { standardScene(); cameraA = new CameraPinhole(600, 600, 0.1, 400, 410, 800, 600); cameraB = new CameraPinhole(600, 650, 0, 400, 410, 800, 600); cameraC = new CameraPinhole(1200, 1250, 0, 0, 0, 800, 600); simulateScene(0); DMatrixRMaj K1 = PerspectiveOps.pinholeToMatrix(cameraA, (DMatrixRMaj)null); DMatrixRMaj K2 = PerspectiveOps.pinholeToMatrix(cameraB, (DMatrixRMaj)null); var alg = new TwoViewToCalibratingHomography(); alg.initialize(F21, P2); assertTrue(alg.process(K1, K2, observations2)); checkSolution(alg); }
/** * Have 3 different cameras render the scene */
Have 3 different cameras render the scene
perfect_different_cameras
{ "repo_name": "lessthanoptimal/BoofCV", "path": "main/boofcv-geo/src/test/java/boofcv/alg/geo/selfcalib/TestTwoViewToCalibratingHomography.java", "license": "apache-2.0", "size": 6975 }
[ "org.ejml.data.DMatrixRMaj", "org.junit.jupiter.api.Assertions", "org.junit.jupiter.api.Test" ]
import org.ejml.data.DMatrixRMaj; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test;
import org.ejml.data.*; import org.junit.jupiter.api.*;
[ "org.ejml.data", "org.junit.jupiter" ]
org.ejml.data; org.junit.jupiter;
1,781,148
@RequestMapping(value = "/ngsi10/contextEntities/{entityID}/attributes", method = RequestMethod.GET, consumes = { "*/*" }, produces = { CONTENT_TYPE_XML, CONTENT_TYPE_JSON }) public ResponseEntity<ContextElementResponse> simpleQueryAttributesContainerGet( @PathVariable("entityID") String id) { logger.info(" <--- NGSI-10 has received request for Query ( GET ) to Attribute container of individual context entity ---> \n"); return simpleQueryIdGet(id); }
@RequestMapping(value = STR, method = RequestMethod.GET, consumes = { "*/*" }, produces = { CONTENT_TYPE_XML, CONTENT_TYPE_JSON }) ResponseEntity<ContextElementResponse> function( @PathVariable(STR) String id) { logger.info(STR); return simpleQueryIdGet(id); }
/** * Executes the convenience method for querying an individual context * entity. * * @param id * The id of the target context entity. * @return The response body. */
Executes the convenience method for querying an individual context entity
simpleQueryAttributesContainerGet
{ "repo_name": "loretrisolini/Aeron", "path": "eu.neclab.iotplatform.iotbroker.restcontroller/src/main/java/eu/neclab/iotplatform/iotbroker/restcontroller/RestProviderController.java", "license": "bsd-3-clause", "size": 51236 }
[ "eu.neclab.iotplatform.ngsi.api.datamodel.ContextElementResponse", "org.springframework.http.ResponseEntity", "org.springframework.web.bind.annotation.PathVariable", "org.springframework.web.bind.annotation.RequestMapping", "org.springframework.web.bind.annotation.RequestMethod" ]
import eu.neclab.iotplatform.ngsi.api.datamodel.ContextElementResponse; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod;
import eu.neclab.iotplatform.ngsi.api.datamodel.*; import org.springframework.http.*; import org.springframework.web.bind.annotation.*;
[ "eu.neclab.iotplatform", "org.springframework.http", "org.springframework.web" ]
eu.neclab.iotplatform; org.springframework.http; org.springframework.web;
2,419,860
protected static Header buildHeaderFromDeletedMetadata(Dbms dbms, DeletedMetadata dm, String prefix, String appPath) throws SQLException { // Try to disseminate format if not by schema then by conversion if (!prefix.equals(dm.getSchema())) { if (!Lib.existsConverter(dm.getSchema(), appPath, prefix)) { return null; } } Header header = new Header(); header.setIdentifier(dm.getUrn()); header.setDeleted(true); header.setDateStamp(new ISODate(dm.getDeletionDate())); header.addSet(new CategoryManager(dbms).getCategoryById(dm.getCategory()).getName()); return header; }
static Header function(Dbms dbms, DeletedMetadata dm, String prefix, String appPath) throws SQLException { if (!prefix.equals(dm.getSchema())) { if (!Lib.existsConverter(dm.getSchema(), appPath, prefix)) { return null; } } Header header = new Header(); header.setIdentifier(dm.getUrn()); header.setDeleted(true); header.setDateStamp(new ISODate(dm.getDeletionDate())); header.addSet(new CategoryManager(dbms).getCategoryById(dm.getCategory()).getName()); return header; }
/** * Build an OAI-PMH header from a deleted metadata * * @param dbms * @param dm * @param prefix * @param appPath * @return * @throws SQLException */
Build an OAI-PMH header from a deleted metadata
buildHeaderFromDeletedMetadata
{ "repo_name": "OpenWIS/openwis", "path": "openwis-metadataportal/openwis-portal/src/main/java/org/fao/geonet/kernel/oaipmh/services/AbstractTokenLister.java", "license": "gpl-3.0", "size": 8263 }
[ "java.sql.SQLException", "org.fao.geonet.kernel.oaipmh.Lib", "org.fao.oaipmh.responses.Header", "org.fao.oaipmh.util.ISODate", "org.openwis.metadataportal.kernel.category.CategoryManager", "org.openwis.metadataportal.model.metadata.DeletedMetadata" ]
import java.sql.SQLException; import org.fao.geonet.kernel.oaipmh.Lib; import org.fao.oaipmh.responses.Header; import org.fao.oaipmh.util.ISODate; import org.openwis.metadataportal.kernel.category.CategoryManager; import org.openwis.metadataportal.model.metadata.DeletedMetadata;
import java.sql.*; import org.fao.geonet.kernel.oaipmh.*; import org.fao.oaipmh.responses.*; import org.fao.oaipmh.util.*; import org.openwis.metadataportal.kernel.category.*; import org.openwis.metadataportal.model.metadata.*;
[ "java.sql", "org.fao.geonet", "org.fao.oaipmh", "org.openwis.metadataportal" ]
java.sql; org.fao.geonet; org.fao.oaipmh; org.openwis.metadataportal;
2,841,412
private void applyPoolConfiguration(PoolConfiguration pc, org.ironjacamar.common.api.metadata.common.Timeout t) { if (t != null) { if (t.getBlockingTimeoutMillis() != null) pc.setBlockingTimeout(t.getBlockingTimeoutMillis().longValue()); if (t.getIdleTimeoutMinutes() != null) pc.setIdleTimeoutMinutes(t.getIdleTimeoutMinutes().intValue()); } }
void function(PoolConfiguration pc, org.ironjacamar.common.api.metadata.common.Timeout t) { if (t != null) { if (t.getBlockingTimeoutMillis() != null) pc.setBlockingTimeout(t.getBlockingTimeoutMillis().longValue()); if (t.getIdleTimeoutMinutes() != null) pc.setIdleTimeoutMinutes(t.getIdleTimeoutMinutes().intValue()); } }
/** * Apply timeout to pool configuration * @param pc The pool configuration * @param t The timeout definition */
Apply timeout to pool configuration
applyPoolConfiguration
{ "repo_name": "jandsu/ironjacamar", "path": "deployers/src/main/java/org/ironjacamar/deployers/common/AbstractResourceAdapterDeployer.java", "license": "epl-1.0", "size": 56166 }
[ "org.ironjacamar.core.api.connectionmanager.pool.PoolConfiguration" ]
import org.ironjacamar.core.api.connectionmanager.pool.PoolConfiguration;
import org.ironjacamar.core.api.connectionmanager.pool.*;
[ "org.ironjacamar.core" ]
org.ironjacamar.core;
2,328,479
public static File find(File dir, String fileName) { if (dir == null) throw new NullPointerException(); FileTreeIterator iter = new FileTreeIterator(dir); while (iter.hasNext()) { File f = iter.next(); if (f.getName().equals(fileName)) return f; } return null; }
static File function(File dir, String fileName) { if (dir == null) throw new NullPointerException(); FileTreeIterator iter = new FileTreeIterator(dir); while (iter.hasNext()) { File f = iter.next(); if (f.getName().equals(fileName)) return f; } return null; }
/** * This finds the first file in the directory that matches the name * provided. * * @param dir * @param fileName * @return a file nested inside dir that matches the file name provided, or * null if no such file is found. */
This finds the first file in the directory that matches the name provided
find
{ "repo_name": "mickleness/pumpernickel", "path": "src/main/java/com/pump/io/FileTreeIterator.java", "license": "mit", "size": 7643 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
760,994
void enterContinueError(@NotNull jazzikParser.ContinueErrorContext ctx); void exitContinueError(@NotNull jazzikParser.ContinueErrorContext ctx);
void enterContinueError(@NotNull jazzikParser.ContinueErrorContext ctx); void exitContinueError(@NotNull jazzikParser.ContinueErrorContext ctx);
/** * Exit a parse tree produced by {@link jazzikParser#ContinueError}. * @param ctx the parse tree */
Exit a parse tree produced by <code>jazzikParser#ContinueError</code>
exitContinueError
{ "repo_name": "petersch/jazzik", "path": "src/parser/jazzikListener.java", "license": "gpl-3.0", "size": 16952 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
872,357
@Test public void testDirectedGraphDfsInvalid() { Graph<Integer> graph = createDummy(true); boolean isExisting = graph.isNodeExistingDfs(42); Assert.assertFalse(isExisting); }
void function() { Graph<Integer> graph = createDummy(true); boolean isExisting = graph.isNodeExistingDfs(42); Assert.assertFalse(isExisting); }
/** * Iterates through an undirected graph using bfs and expect a value not to be found */
Iterates through an undirected graph using bfs and expect a value not to be found
testDirectedGraphDfsInvalid
{ "repo_name": "Scavi/BrainSqueeze", "path": "src/test/java/com/scavi/brainsqueeze/tree/GraphTest.java", "license": "apache-2.0", "size": 4785 }
[ "com.scavi.brainsqueeze.util.graph.Graph", "org.junit.Assert" ]
import com.scavi.brainsqueeze.util.graph.Graph; import org.junit.Assert;
import com.scavi.brainsqueeze.util.graph.*; import org.junit.*;
[ "com.scavi.brainsqueeze", "org.junit" ]
com.scavi.brainsqueeze; org.junit;
2,781,059
private static String getNewText(String s) { int[] upperCase = new int[s.toCharArray().length]; int upperCounter = 0; int[] index = new int[s.toCharArray().length]; int counter = 0; char[] symbols = new char[s.toCharArray().length]; int charCounter = 0; char[] testChars = s.toCharArray(); for (int i = 0; i < testChars.length; i++) { if (Character.isLetter(testChars[i])) { if (Character.isUpperCase(testChars[i])) { testChars[i] = Character.toLowerCase(testChars[i]); upperCase[upperCounter++] = i; } } else { index[counter++] = i; symbols[charCounter++] = testChars[i]; } } Arrays.sort(testChars); List<Character> liste = new ArrayList<Character>(); for (int i = 0; i < testChars.length; i++) { liste.add(testChars[i]); } for (int i = 0; i < counter; i++) { liste.remove(0); } for (int i = 0; i < counter; i++) { liste.add(index[i], symbols[i]); } for (int i = 0; i < upperCounter; i++) { Character temp = liste.get(upperCase[i]); liste.set(upperCase[i], Character.toUpperCase(temp)); } String result = ""; for (Character c : liste) { result += c; } return result; }
static String function(String s) { int[] upperCase = new int[s.toCharArray().length]; int upperCounter = 0; int[] index = new int[s.toCharArray().length]; int counter = 0; char[] symbols = new char[s.toCharArray().length]; int charCounter = 0; char[] testChars = s.toCharArray(); for (int i = 0; i < testChars.length; i++) { if (Character.isLetter(testChars[i])) { if (Character.isUpperCase(testChars[i])) { testChars[i] = Character.toLowerCase(testChars[i]); upperCase[upperCounter++] = i; } } else { index[counter++] = i; symbols[charCounter++] = testChars[i]; } } Arrays.sort(testChars); List<Character> liste = new ArrayList<Character>(); for (int i = 0; i < testChars.length; i++) { liste.add(testChars[i]); } for (int i = 0; i < counter; i++) { liste.remove(0); } for (int i = 0; i < counter; i++) { liste.add(index[i], symbols[i]); } for (int i = 0; i < upperCounter; i++) { Character temp = liste.get(upperCase[i]); liste.set(upperCase[i], Character.toUpperCase(temp)); } String result = ""; for (Character c : liste) { result += c; } return result; }
/** * Sorting the seperated textes and returning the completely restored version * @param s * @return */
Sorting the seperated textes and returning the completely restored version
getNewText
{ "repo_name": "timgrossmann/dailyProgrammer", "path": "Challenges/Java/manglingSentences/Mangler.java", "license": "mit", "size": 2010 }
[ "java.util.ArrayList", "java.util.Arrays", "java.util.List" ]
import java.util.ArrayList; import java.util.Arrays; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,251,618
@Pure @ScalaOperator("*") public Matrix2d $times(double scalar) { return operator_multiply(scalar); }
@ScalaOperator("*") public Matrix2d $times(double scalar) { return operator_multiply(scalar); }
/** Replies the multiplication of the given scalar and this matrix: {@code this * scalar}. * * <p>This function is an implementation of the operator for * the <a href="http://scala-lang.org/">Scala Language</a>. * * <p>The operation {@code scalar * this} is supported by * {@link org.arakhne.afc.math.extensions.scala.MatrixExtensions#$times(double, Matrix2d)}. * * @param scalar the scalar. * @return the multiplication of the scalar and the matrix. * @see #mul(Matrix2d) * @see org.arakhne.afc.math.extensions.scala.MatrixExtensions#$times(double, Matrix2d) */
Replies the multiplication of the given scalar and this matrix: this * scalar. This function is an implementation of the operator for the Scala Language. The operation scalar * this is supported by <code>org.arakhne.afc.math.extensions.scala.MatrixExtensions#$times(double, Matrix2d)</code>
$times
{ "repo_name": "gallandarakhneorg/afc", "path": "core/maths/mathgeom/src/main/java/org/arakhne/afc/math/matrix/Matrix2d.java", "license": "apache-2.0", "size": 55348 }
[ "org.arakhne.afc.vmutil.annotations.ScalaOperator" ]
import org.arakhne.afc.vmutil.annotations.ScalaOperator;
import org.arakhne.afc.vmutil.annotations.*;
[ "org.arakhne.afc" ]
org.arakhne.afc;
19,350
public static void main(String[] args) { // read the integers from a file In in = new In(args[0]); int[] whitelist = in.readAllInts(); // sort the array Arrays.sort(whitelist); // read integer key from standard input; print if not in whitelist while (!StdIn.isEmpty()) { int key = StdIn.readInt(); if (BinarySearch.indexOf(whitelist, key) == -1) StdOut.println(key); } } } /****************************************************************************** * Copyright 2002-2019, Robert Sedgewick and Kevin Wayne. * * This file is part of algs4.jar, which accompanies the textbook * * Algorithms, 4th edition by Robert Sedgewick and Kevin Wayne, * Addison-Wesley Professional, 2011, ISBN 0-321-57351-X. * http://algs4.cs.princeton.edu * * * algs4.jar is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * algs4.jar is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with algs4.jar. If not, see http://www.gnu.org/licenses.
static void function(String[] args) { In in = new In(args[0]); int[] whitelist = in.readAllInts(); Arrays.sort(whitelist); while (!StdIn.isEmpty()) { int key = StdIn.readInt(); if (BinarySearch.indexOf(whitelist, key) == -1) StdOut.println(key); } } } /****************************************************************************** * Copyright 2002-2019, Robert Sedgewick and Kevin Wayne. * * This file is part of algs4.jar, which accompanies the textbook * * Algorithms, 4th edition by Robert Sedgewick and Kevin Wayne, * Addison-Wesley Professional, 2011, ISBN 0-321-57351-X. * http: * * * algs4.jar is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * algs4.jar is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with algs4.jar. If not, see http:
/** * Reads in a sequence of integers from the whitelist file, specified as * a command-line argument; reads in integers from standard input; * prints to standard output those integers that do <em>not</em> appear in the file. * * @param args the command-line arguments */
Reads in a sequence of integers from the whitelist file, specified as a command-line argument; reads in integers from standard input; prints to standard output those integers that do not appear in the file
main
{ "repo_name": "JohnyPeng/Note", "path": "algs4/libs/algs4/edu/princeton/cs/algs4/BinarySearch.java", "license": "gpl-3.0", "size": 4631 }
[ "java.util.Arrays" ]
import java.util.Arrays;
import java.util.*;
[ "java.util" ]
java.util;
2,778,193
public void delete(URL resourceUrl, String etag) throws IOException, ServiceException { GDataRequest request = createDeleteRequest(resourceUrl); try { startVersionScope(); request.setEtag(etag); request.execute(); } finally { request.end(); } }
void function(URL resourceUrl, String etag) throws IOException, ServiceException { GDataRequest request = createDeleteRequest(resourceUrl); try { startVersionScope(); request.setEtag(etag); request.execute(); } finally { request.end(); } }
/** * Deletes an existing entry (and associated media content, if any) using the * specified edit URL. This delete is conditional upon the provided tag * matching the current entity tag for the entry. If (and only if) they match, * the deletion will be performed. * * @param resourceUrl the edit or medit edit url associated with the resource. * @param etag the entity tag value that is the expected value for the target * resource. A value of {@code null} will not set an etag * precondition and a value of <code>"*"</code> will perform an * unconditional delete. * @throws IOException error communicating with the GData service. * @throws com.google.gdata.util.ResourceNotFoundException invalid entry URL. * @throws ServiceException delete request failed due to system error. */
Deletes an existing entry (and associated media content, if any) using the specified edit URL. This delete is conditional upon the provided tag matching the current entity tag for the entry. If (and only if) they match, the deletion will be performed
delete
{ "repo_name": "elhoim/gdata-client-java", "path": "java/src/com/google/gdata/client/Service.java", "license": "apache-2.0", "size": 78599 }
[ "com.google.gdata.util.ServiceException", "java.io.IOException" ]
import com.google.gdata.util.ServiceException; import java.io.IOException;
import com.google.gdata.util.*; import java.io.*;
[ "com.google.gdata", "java.io" ]
com.google.gdata; java.io;
1,154,023
public int waitForWindowShown(String windowName) { if (getScopeServices().getConnection() == null) { throw new CommunicationException( "waiting for a window failed because Opera is not connected."); } return getScopeServices() .waitForDesktopWindowShown(windowName, OperaIntervals.WINDOW_EVENT_TIMEOUT.getMs()); }
int function(String windowName) { if (getScopeServices().getConnection() == null) { throw new CommunicationException( STR); } return getScopeServices() .waitForDesktopWindowShown(windowName, OperaIntervals.WINDOW_EVENT_TIMEOUT.getMs()); }
/** * Waits until the window is shown, and then returns the window id of the window * * @param windowName - window to wait for shown event on * @return id of window */
Waits until the window is shown, and then returns the window id of the window
waitForWindowShown
{ "repo_name": "operasoftware/operaprestodriver", "path": "src/com/opera/core/systems/OperaDesktopDriver.java", "license": "apache-2.0", "size": 31451 }
[ "com.opera.core.systems.scope.exceptions.CommunicationException", "com.opera.core.systems.scope.internal.OperaIntervals" ]
import com.opera.core.systems.scope.exceptions.CommunicationException; import com.opera.core.systems.scope.internal.OperaIntervals;
import com.opera.core.systems.scope.exceptions.*; import com.opera.core.systems.scope.internal.*;
[ "com.opera.core" ]
com.opera.core;
2,587,391
public void updateTicketFieldValue(final GepardTestClass tc, final String ticket, final String fieldName, final String value) throws JSONException, IOException { String ticketFields = getTicketFields(ticket); JSONObject obj = new JSONObject(ticketFields); obj = obj.getJSONObject("fields"); if (obj.has(fieldName)) { Object o = obj.get(fieldName); setTicketFieldValue(tc, ticket, fieldName, value); } else { throw new SimpleGepardException("Ticket: " + ticket + " field: " + fieldName + " cannot find."); } }
void function(final GepardTestClass tc, final String ticket, final String fieldName, final String value) throws JSONException, IOException { String ticketFields = getTicketFields(ticket); JSONObject obj = new JSONObject(ticketFields); obj = obj.getJSONObject(STR); if (obj.has(fieldName)) { Object o = obj.get(fieldName); setTicketFieldValue(tc, ticket, fieldName, value); } else { throw new SimpleGepardException(STR + ticket + STR + fieldName + STR); } }
/** * Update a field of a JIRA ticket to a specified value. * * @param tc is the caller test. * @param ticket is the jira ticket id * @param fieldName is the name of the field * @param value is the new value * @throws JSONException in case of problem * @throws IOException in case of problem */
Update a field of a JIRA ticket to a specified value
updateTicketFieldValue
{ "repo_name": "epam/Gepard", "path": "gepard-rest/src/main/java/com/epam/gepard/rest/jira/JiraSiteHandler.java", "license": "gpl-3.0", "size": 18425 }
[ "com.epam.gepard.exception.SimpleGepardException", "com.epam.gepard.generic.GepardTestClass", "java.io.IOException", "org.json.JSONException", "org.json.JSONObject" ]
import com.epam.gepard.exception.SimpleGepardException; import com.epam.gepard.generic.GepardTestClass; import java.io.IOException; import org.json.JSONException; import org.json.JSONObject;
import com.epam.gepard.exception.*; import com.epam.gepard.generic.*; import java.io.*; import org.json.*;
[ "com.epam.gepard", "java.io", "org.json" ]
com.epam.gepard; java.io; org.json;
286,097
public void setEndDate(final java.util.Date endDate) { this.endDate = endDate; }
void function(final java.util.Date endDate) { this.endDate = endDate; }
/** * Sets the end date. * * @param endDate * the new end date */
Sets the end date
setEndDate
{ "repo_name": "alarulrajan/CodeFest", "path": "src/com/technoetic/xplanner/db/AggregateTimesheetQuery.java", "license": "gpl-2.0", "size": 6876 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
2,303,777
public ResizeResponse split(ResizeRequest resizeRequest, RequestOptions options) throws IOException { return restHighLevelClient.performRequestAndParseEntity(resizeRequest, IndicesRequestConverters::split, options, ResizeResponse::fromXContent, emptySet()); } /** * Splits an index using the Split Index API. * <p> * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-split-index.html"> * Split Index API on elastic.co</a> * @deprecated {@link #split(ResizeRequest, RequestOptions)}
ResizeResponse function(ResizeRequest resizeRequest, RequestOptions options) throws IOException { return restHighLevelClient.performRequestAndParseEntity(resizeRequest, IndicesRequestConverters::split, options, ResizeResponse::fromXContent, emptySet()); } /** * Splits an index using the Split Index API. * <p> * See <a href="https: * Split Index API on elastic.co</a> * @deprecated {@link #split(ResizeRequest, RequestOptions)}
/** * Splits an index using the Split Index API. * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-split-index.html"> * Split Index API on elastic.co</a> * @param resizeRequest the request * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized * @return the response * @throws IOException in case there is a problem sending the request or parsing back the response */
Splits an index using the Split Index API. See Split Index API on elastic.co
split
{ "repo_name": "strapdata/elassandra", "path": "client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesClient.java", "license": "apache-2.0", "size": 103949 }
[ "java.io.IOException", "java.util.Collections", "org.elasticsearch.action.admin.indices.shrink.ResizeRequest", "org.elasticsearch.action.admin.indices.shrink.ResizeResponse" ]
import java.io.IOException; import java.util.Collections; import org.elasticsearch.action.admin.indices.shrink.ResizeRequest; import org.elasticsearch.action.admin.indices.shrink.ResizeResponse;
import java.io.*; import java.util.*; import org.elasticsearch.action.admin.indices.shrink.*;
[ "java.io", "java.util", "org.elasticsearch.action" ]
java.io; java.util; org.elasticsearch.action;
1,888,955
// compute vector 2-norm double norm2 = 0; for (int i = 0; i < vector.length; i++) { norm2 += vector[i] * vector[i]; } norm2 = (double) Math.sqrt(norm2); if (norm2 == 0) { Arrays.fill(vector, 1); } else { for (int i = 0; i < vector.length; i++) { vector[i] = vector[i] / norm2; } } return vector; }
double norm2 = 0; for (int i = 0; i < vector.length; i++) { norm2 += vector[i] * vector[i]; } norm2 = (double) Math.sqrt(norm2); if (norm2 == 0) { Arrays.fill(vector, 1); } else { for (int i = 0; i < vector.length; i++) { vector[i] = vector[i] / norm2; } } return vector; }
/** * This method applies L2 normalization on a given array of doubles. The passed vector is modified by the * method. * * @param vector * the original vector * @return the L2 normalized vector */
This method applies L2 normalization on a given array of doubles. The passed vector is modified by the method
normalizeL2
{ "repo_name": "socialsensor/diverse-image-search", "path": "src/eu/socialSensor/diverseImages2014/utils/Normalizations.java", "license": "apache-2.0", "size": 1874 }
[ "java.util.Arrays" ]
import java.util.Arrays;
import java.util.*;
[ "java.util" ]
java.util;
1,265,095
private Map<String, Object> getKerberosDescriptor(String stackName, String stackVersion, String serviceName) throws NoSuchParentResourceException, IOException { return serviceName == null ? buildStackDescriptor(stackName, stackVersion) : getServiceDescriptor(stackName, stackVersion, serviceName); }
Map<String, Object> function(String stackName, String stackVersion, String serviceName) throws NoSuchParentResourceException, IOException { return serviceName == null ? buildStackDescriptor(stackName, stackVersion) : getServiceDescriptor(stackName, stackVersion, serviceName); }
/** * Get a kerberos descriptor. * * @param stackName stack name * @param stackVersion stack version * @param serviceName service name * * @return map of kerberos descriptor data or null if no descriptor exists * * @throws IOException if unable to parse the associated kerberos descriptor file * @throws NoSuchParentResourceException if the parent stack or stack service doesn't exist */
Get a kerberos descriptor
getKerberosDescriptor
{ "repo_name": "radicalbit/ambari", "path": "ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackArtifactResourceProvider.java", "license": "apache-2.0", "size": 26411 }
[ "java.io.IOException", "java.util.Map", "org.apache.ambari.server.controller.spi.NoSuchParentResourceException" ]
import java.io.IOException; import java.util.Map; import org.apache.ambari.server.controller.spi.NoSuchParentResourceException;
import java.io.*; import java.util.*; import org.apache.ambari.server.controller.spi.*;
[ "java.io", "java.util", "org.apache.ambari" ]
java.io; java.util; org.apache.ambari;
367,452
private static FriendingQuota doGetOrCreateQuota(Objectify ofy, String userEmail) { return doGetOrCreateQuota(ofy, userEmail, null); }
static FriendingQuota function(Objectify ofy, String userEmail) { return doGetOrCreateQuota(ofy, userEmail, null); }
/** * Gets or creates a FriendingQuota for the given userEmail. * * @param ofy * @param userEmail * @return */
Gets or creates a FriendingQuota for the given userEmail
doGetOrCreateQuota
{ "repo_name": "getlantern/lantern-controller", "path": "src/main/java/org/lantern/friending/Friending.java", "license": "gpl-3.0", "size": 17650 }
[ "com.googlecode.objectify.Objectify", "org.lantern.data.FriendingQuota" ]
import com.googlecode.objectify.Objectify; import org.lantern.data.FriendingQuota;
import com.googlecode.objectify.*; import org.lantern.data.*;
[ "com.googlecode.objectify", "org.lantern.data" ]
com.googlecode.objectify; org.lantern.data;
2,468,285
DataOutputStream getUserDataStream() { expectState(State.WRITING); return userDataStream; }
DataOutputStream getUserDataStream() { expectState(State.WRITING); return userDataStream; }
/** * Returns the stream for the user to write to. The block writer takes care * of handling compression and buffering for caching on write. Can only be * called in the "writing" state. * * @return the data output stream for the user to write to */
Returns the stream for the user to write to. The block writer takes care of handling compression and buffering for caching on write. Can only be called in the "writing" state
getUserDataStream
{ "repo_name": "juwi/hbase", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileBlock.java", "license": "apache-2.0", "size": 76522 }
[ "java.io.DataOutputStream" ]
import java.io.DataOutputStream;
import java.io.*;
[ "java.io" ]
java.io;
2,078,761
public List retrievePhotos() throws DatabaseDownException, SQLException { logger.debug("PhotoModel.retrievePhotos: retrieving photos..."); List list = dao.retrieve(); logger.debug("PhotoModel.retrievePhotos: photos retrieved."); return list; }
List function() throws DatabaseDownException, SQLException { logger.debug(STR); List list = dao.retrieve(); logger.debug(STR); return list; }
/** * This method retrieves all photos from database * * @return An ArrayList object with Photo objects * * @throws DatabaseDownException If the database is down * @throws SQLException If some SQL Exception occurs */
This method retrieves all photos from database
retrievePhotos
{ "repo_name": "BackupTheBerlios/arara-svn", "path": "core/tags/arara-1.0/src/main/java/net/indrix/arara/model/PhotoModel.java", "license": "gpl-2.0", "size": 27864 }
[ "java.sql.SQLException", "java.util.List", "net.indrix.arara.dao.DatabaseDownException" ]
import java.sql.SQLException; import java.util.List; import net.indrix.arara.dao.DatabaseDownException;
import java.sql.*; import java.util.*; import net.indrix.arara.dao.*;
[ "java.sql", "java.util", "net.indrix.arara" ]
java.sql; java.util; net.indrix.arara;
3,248
public PageList<ApplicationValue> getAllApplications(AuthzSubject subject, PageControl pc) throws PermissionException, NotFoundException; /** * @return {@link List} of {@link Resource}
PageList<ApplicationValue> function(AuthzSubject subject, PageControl pc) throws PermissionException, NotFoundException; /** * @return {@link List} of {@link Resource}
/** * Get all applications. * @param subject The subject trying to list applications. * @return A List of ApplicationValue objects representing all of the * applications that the given subject is allowed to view. */
Get all applications
getAllApplications
{ "repo_name": "cc14514/hq6", "path": "hq-server/src/main/java/org/hyperic/hq/appdef/shared/ApplicationManager.java", "license": "unlicense", "size": 8029 }
[ "java.util.List", "org.hyperic.hq.authz.server.session.AuthzSubject", "org.hyperic.hq.authz.server.session.Resource", "org.hyperic.hq.authz.shared.PermissionException", "org.hyperic.hq.common.NotFoundException", "org.hyperic.util.pager.PageControl", "org.hyperic.util.pager.PageList" ]
import java.util.List; import org.hyperic.hq.authz.server.session.AuthzSubject; import org.hyperic.hq.authz.server.session.Resource; import org.hyperic.hq.authz.shared.PermissionException; import org.hyperic.hq.common.NotFoundException; import org.hyperic.util.pager.PageControl; import org.hyperic.util.pager.PageList;
import java.util.*; import org.hyperic.hq.authz.server.session.*; import org.hyperic.hq.authz.shared.*; import org.hyperic.hq.common.*; import org.hyperic.util.pager.*;
[ "java.util", "org.hyperic.hq", "org.hyperic.util" ]
java.util; org.hyperic.hq; org.hyperic.util;
2,586,701
@TargetApi(Build.VERSION_CODES.KITKAT) private static boolean codecSupportsAdaptivePlayback(MediaCodec mediaCodec, String mime) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT || mediaCodec == null) { return false; } try { MediaCodecInfo info = mediaCodec.getCodecInfo(); if (info.isEncoder()) { return false; } MediaCodecInfo.CodecCapabilities capabilities = info.getCapabilitiesForType(mime); return (capabilities != null) && capabilities.isFeatureSupported( MediaCodecInfo.CodecCapabilities.FEATURE_AdaptivePlayback); } catch (IllegalArgumentException e) { Log.e(TAG, "Cannot retrieve codec information", e); } return false; }
@TargetApi(Build.VERSION_CODES.KITKAT) static boolean function(MediaCodec mediaCodec, String mime) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT mediaCodec == null) { return false; } try { MediaCodecInfo info = mediaCodec.getCodecInfo(); if (info.isEncoder()) { return false; } MediaCodecInfo.CodecCapabilities capabilities = info.getCapabilitiesForType(mime); return (capabilities != null) && capabilities.isFeatureSupported( MediaCodecInfo.CodecCapabilities.FEATURE_AdaptivePlayback); } catch (IllegalArgumentException e) { Log.e(TAG, STR, e); } return false; }
/** * Returns true if the given codec supports adaptive playback (dynamic resolution change). * @param mediaCodec the codec. * @param mime MIME type that corresponds to the codec creation. * @return true if this codec and mime type combination supports adaptive playback. */
Returns true if the given codec supports adaptive playback (dynamic resolution change)
codecSupportsAdaptivePlayback
{ "repo_name": "highweb-project/highweb-webcl-html5spec", "path": "media/base/android/java/src/org/chromium/media/MediaCodecUtil.java", "license": "bsd-3-clause", "size": 13334 }
[ "android.annotation.TargetApi", "android.media.MediaCodec", "android.media.MediaCodecInfo", "android.os.Build", "org.chromium.base.Log" ]
import android.annotation.TargetApi; import android.media.MediaCodec; import android.media.MediaCodecInfo; import android.os.Build; import org.chromium.base.Log;
import android.annotation.*; import android.media.*; import android.os.*; import org.chromium.base.*;
[ "android.annotation", "android.media", "android.os", "org.chromium.base" ]
android.annotation; android.media; android.os; org.chromium.base;
1,630,076
public IConnectionDescription getRegistryClientConnection();
IConnectionDescription function();
/** * Gets the client side Registry <code>IConnectionDescription</code> of this actor. * * @return the client side Registry connection */
Gets the client side Registry <code>IConnectionDescription</code> of this actor
getRegistryClientConnection
{ "repo_name": "jembi/openxds", "path": "openxds-api/src/main/java/org/openhealthtools/openxds/repository/api/XdsRepository.java", "license": "apache-2.0", "size": 1379 }
[ "org.openhealthtools.openexchange.actorconfig.net.IConnectionDescription" ]
import org.openhealthtools.openexchange.actorconfig.net.IConnectionDescription;
import org.openhealthtools.openexchange.actorconfig.net.*;
[ "org.openhealthtools.openexchange" ]
org.openhealthtools.openexchange;
1,480,030
public static boolean filterSeat(SeatBidOrBuilder seatbid, @Nullable String seatFilter) { return seatFilter == null ? !seatbid.hasSeat() : seatFilter == SEAT_ANY || seatFilter.equals(seatbid.getSeat()); }
static boolean function(SeatBidOrBuilder seatbid, @Nullable String seatFilter) { return seatFilter == null ? !seatbid.hasSeat() : seatFilter == SEAT_ANY seatFilter.equals(seatbid.getSeat()); }
/** * Performs a filter by seat. * * @param seatbid Seat to filter * @param seatFilter Filter for seat. You can use {@code null} to select the anonymous seat, * or {@link #SEAT_ANY} to not filter by seat * @return {@code true} if the seat passes the filter */
Performs a filter by seat
filterSeat
{ "repo_name": "opinali/openrtb", "path": "openrtb-core/src/main/java/com/google/openrtb/util/OpenRtbUtils.java", "license": "apache-2.0", "size": 16663 }
[ "com.google.openrtb.OpenRtb", "javax.annotation.Nullable" ]
import com.google.openrtb.OpenRtb; import javax.annotation.Nullable;
import com.google.openrtb.*; import javax.annotation.*;
[ "com.google.openrtb", "javax.annotation" ]
com.google.openrtb; javax.annotation;
2,551,274
private boolean hasBacklog() { final long cursor = ringBuffer.getCursor(); for (final Sequence consumer : consumerRepository.getLastSequenceInChain(false)) { if (cursor > consumer.get()) { return true; } } return false; }
boolean function() { final long cursor = ringBuffer.getCursor(); for (final Sequence consumer : consumerRepository.getLastSequenceInChain(false)) { if (cursor > consumer.get()) { return true; } } return false; }
/** * Confirms if all messages have been consumed by all event processors */
Confirms if all messages have been consumed by all event processors
hasBacklog
{ "repo_name": "sgulinski/disruptor", "path": "src/main/java/com/lmax/disruptor/dsl/Disruptor.java", "license": "apache-2.0", "size": 22048 }
[ "com.lmax.disruptor.Sequence" ]
import com.lmax.disruptor.Sequence;
import com.lmax.disruptor.*;
[ "com.lmax.disruptor" ]
com.lmax.disruptor;
2,007,352
public void setTint(int tint) { setTintList(ColorStateList.valueOf(tint)); } public void setTintList(ColorStateList tint) {}
void function(int tint) { setTintList(ColorStateList.valueOf(tint)); } void functionList(ColorStateList tint) {}
/** * Specifies a tint for this drawable. * <p> * Setting a color filter via {@link #setColorFilter(ColorFilter)} overrides * tint. * * @param tint Color to use for tinting this drawable * @see #setTintMode(PorterDuff.Mode) */
Specifies a tint for this drawable. Setting a color filter via <code>#setColorFilter(ColorFilter)</code> overrides tint
setTint
{ "repo_name": "EnterPrayz/RippleDrawable", "path": "app/src/main/java/codetail/graphics/drawables/LollipopDrawable.java", "license": "mit", "size": 4068 }
[ "android.content.res.ColorStateList" ]
import android.content.res.ColorStateList;
import android.content.res.*;
[ "android.content" ]
android.content;
1,859,156
public static HttpServletRequest getHttpRequest() { return requests != null? requests.get() : null; }
static HttpServletRequest function() { return requests != null? requests.get() : null; }
/** * The HttpServletResponse for the current request if the request is via HTTP. * Returns null if the client is using a non-HTTP channel. * Available for users. */
The HttpServletResponse for the current request if the request is via HTTP. Returns null if the client is using a non-HTTP channel. Available for users
getHttpRequest
{ "repo_name": "Groostav/CMPT880-term-project", "path": "intruder/benchs/blazeds/src/flex/messaging/FlexContext.java", "license": "apache-2.0", "size": 14705 }
[ "javax.servlet.http.HttpServletRequest" ]
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.*;
[ "javax.servlet" ]
javax.servlet;
2,550,780
public WebElement getWebElementByFieldName(String fieldName) throws Exception { return testExecController.getWebElementByFieldName(fieldName); }
WebElement function(String fieldName) throws Exception { return testExecController.getWebElementByFieldName(fieldName); }
/** * Find web element with fieldname * * @param fieldName * @return * @throws Exception */
Find web element with fieldname
getWebElementByFieldName
{ "repo_name": "saiscode/kheera", "path": "src/main/java/in/ramachandr/automation/core/BaseStepDef.java", "license": "gpl-3.0", "size": 12163 }
[ "org.openqa.selenium.WebElement" ]
import org.openqa.selenium.WebElement;
import org.openqa.selenium.*;
[ "org.openqa.selenium" ]
org.openqa.selenium;
1,108,440
JSModule getDeepestCommonDependency(JSModule m1, JSModule m2) { int m1Depth = m1.getDepth(); int m2Depth = m2.getDepth(); // According our definition of depth, the result must have a strictly // smaller depth than either m1 or m2. for (int depth = Math.min(m1Depth, m2Depth) - 1; depth >= 0; depth--) { List<JSModule> modulesAtDepth = modulesByDepth.get(depth); // Look at the modules at this depth in reverse order, so that we use the // original ordering of the modules to break ties (later meaning deeper). for (int i = modulesAtDepth.size() - 1; i >= 0; i--) { JSModule m = modulesAtDepth.get(i); if (dependsOn(m1, m) && dependsOn(m2, m)) { return m; } } } return null; }
JSModule getDeepestCommonDependency(JSModule m1, JSModule m2) { int m1Depth = m1.getDepth(); int m2Depth = m2.getDepth(); for (int depth = Math.min(m1Depth, m2Depth) - 1; depth >= 0; depth--) { List<JSModule> modulesAtDepth = modulesByDepth.get(depth); for (int i = modulesAtDepth.size() - 1; i >= 0; i--) { JSModule m = modulesAtDepth.get(i); if (dependsOn(m1, m) && dependsOn(m2, m)) { return m; } } } return null; }
/** * Finds the deepest common dependency of two modules, not including the two * modules themselves. * * @param m1 A module in this graph * @param m2 A module in this graph * @return The deepest common dep of {@code m1} and {@code m2}, or null if * they have no common dependencies */
Finds the deepest common dependency of two modules, not including the two modules themselves
getDeepestCommonDependency
{ "repo_name": "Dandandan/wikiprogramming", "path": "jsrepl/tools/closure-compiler/trunk/src/com/google/javascript/jscomp/JSModuleGraph.java", "license": "mit", "size": 14236 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,161,446
public void writeMessageSetTo(final CodedOutputStream output) throws IOException { for (int i = 0; i < fields.getNumArrayEntries(); i++) { writeMessageSetTo(fields.getArrayEntryAt(i), output); } for (final Map.Entry<FieldDescriptorType, Object> entry : fields.getOverflowEntries()) { writeMessageSetTo(entry, output); } }
void function(final CodedOutputStream output) throws IOException { for (int i = 0; i < fields.getNumArrayEntries(); i++) { writeMessageSetTo(fields.getArrayEntryAt(i), output); } for (final Map.Entry<FieldDescriptorType, Object> entry : fields.getOverflowEntries()) { writeMessageSetTo(entry, output); } }
/** * Like {@link #writeTo} but uses MessageSet wire format. */
Like <code>#writeTo</code> but uses MessageSet wire format
writeMessageSetTo
{ "repo_name": "benmcclelland/kinetic-c", "path": "vendor/protobuf-2.6.0/java/src/main/java/com/google/protobuf/FieldSet.java", "license": "lgpl-2.1", "size": 33255 }
[ "java.io.IOException", "java.util.Map" ]
import java.io.IOException; import java.util.Map;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
964,166
public void test5() { validationText = Messages.getText("couldnt_add_some_panel_exception") + "\n " + Messages.getText("couldnt_load_panels_from_list_exception") + "\n Error cargando un panel: / by zero.\n Panel de etiqueta Information_LABEL sin tamaño inicial definido.\n " + Messages.getText("empty_panel_group_exception"); try { System.out.println("----- Test 5 -----"); loader = new PanelGroupLoaderFromList(Samples_Data.TEST8_CLASSES); // Begin: Test the normal load panelGroup.loadPanels(loader); // End: Test the normal load } catch (BaseException bE) { localizedMessage = bE.getLocalizedMessageStack(); System.out.println(localizedMessage); System.out.println("------------------"); assertEquals(localizedMessage, validationText); return; } catch (Exception e) { e.printStackTrace(); System.out.println("------------------"); fail(); return; } System.out.println("------------------"); fail(); }
void function() { validationText = Messages.getText(STR) + STR + Messages.getText(STR) + STR + Messages.getText(STR); try { System.out.println(STR); loader = new PanelGroupLoaderFromList(Samples_Data.TEST8_CLASSES); panelGroup.loadPanels(loader); } catch (BaseException bE) { localizedMessage = bE.getLocalizedMessageStack(); System.out.println(localizedMessage); System.out.println(STR); assertEquals(localizedMessage, validationText); return; } catch (Exception e) { e.printStackTrace(); System.out.println(STR); fail(); return; } System.out.println(STR); fail(); }
/** * <p>Test the 'PanelGroup' exceptions </p> */
Test the 'PanelGroup' exceptions
test5
{ "repo_name": "iCarto/siga", "path": "libUIComponent/src-test-ui/org/gvsig/gui/beans/panelGroup/Test1ExceptionsUsingTreePanel.java", "license": "gpl-3.0", "size": 8702 }
[ "org.gvsig.exceptions.BaseException", "org.gvsig.gui.beans.Messages", "org.gvsig.gui.beans.panelGroup.loaders.PanelGroupLoaderFromList" ]
import org.gvsig.exceptions.BaseException; import org.gvsig.gui.beans.Messages; import org.gvsig.gui.beans.panelGroup.loaders.PanelGroupLoaderFromList;
import org.gvsig.exceptions.*; import org.gvsig.gui.beans.*;
[ "org.gvsig.exceptions", "org.gvsig.gui" ]
org.gvsig.exceptions; org.gvsig.gui;
1,134,704
protected boolean handleDirtyConflict() { return MessageDialog.openQuestion (getSite().getShell(), getString("_UI_FileConflict_label"), getString("_WARN_FileConflict")); } public apsEditor() { super(); initializeEditingDomain(); }
boolean function() { return MessageDialog.openQuestion (getSite().getShell(), getString(STR), getString(STR)); } public apsEditor() { super(); initializeEditingDomain(); }
/** * Shows a dialog that asks if conflicting changes should be discarded. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
Shows a dialog that asks if conflicting changes should be discarded.
handleDirtyConflict
{ "repo_name": "KAMP-Research/KAMP4APS", "path": "edu.kit.ipd.sdq.kamp4aps.aps.editor/src/edu/kit/ipd/sdq/kamp4aps/model/aPS/presentation/apsEditor.java", "license": "apache-2.0", "size": 57529 }
[ "org.eclipse.jface.dialogs.MessageDialog" ]
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.*;
[ "org.eclipse.jface" ]
org.eclipse.jface;
1,365,956
public Future<List<generated.classic.jdbc.regular.vertx.tables.pojos.Something>> findManyBySomehugenumber(Collection<Long> values) { return findManyByCondition(Something.SOMETHING.SOMEHUGENUMBER.in(values)); }
Future<List<generated.classic.jdbc.regular.vertx.tables.pojos.Something>> function(Collection<Long> values) { return findManyByCondition(Something.SOMETHING.SOMEHUGENUMBER.in(values)); }
/** * Find records that have <code>SOMEHUGENUMBER IN (values)</code> * asynchronously */
Find records that have <code>SOMEHUGENUMBER IN (values)</code> asynchronously
findManyBySomehugenumber
{ "repo_name": "jklingsporn/vertx-jooq", "path": "vertx-jooq-generate/src/test/java/generated/classic/jdbc/regular/vertx/tables/daos/SomethingDao.java", "license": "mit", "size": 9803 }
[ "io.vertx.core.Future", "java.util.Collection", "java.util.List" ]
import io.vertx.core.Future; import java.util.Collection; import java.util.List;
import io.vertx.core.*; import java.util.*;
[ "io.vertx.core", "java.util" ]
io.vertx.core; java.util;
1,188,450
Registry registry = EPackage.Registry.INSTANCE; HashSet<Entry<String, Object>> entries = new LinkedHashSet<Entry<String, Object>>(registry.entrySet()); Set<EPackage> packages = new LinkedHashSet<EPackage>(); for (Entry<String, Object> entry : entries) { if (!filterKnown || !isKnownPackage(entry.getKey())) { try { EPackage ePackage = EPackage.Registry.INSTANCE.getEPackage(entry.getKey()); packages.add(ePackage); // BEGIN SUPRESS CATCH EXCEPTION } catch (RuntimeException e) { // END SUPRESS CATCH EXCEPTION WorkspaceUtil.logWarning("Failed to load EPackage", e); } } } return packages; }
Registry registry = EPackage.Registry.INSTANCE; HashSet<Entry<String, Object>> entries = new LinkedHashSet<Entry<String, Object>>(registry.entrySet()); Set<EPackage> packages = new LinkedHashSet<EPackage>(); for (Entry<String, Object> entry : entries) { if (!filterKnown !isKnownPackage(entry.getKey())) { try { EPackage ePackage = EPackage.Registry.INSTANCE.getEPackage(entry.getKey()); packages.add(ePackage); } catch (RuntimeException e) { WorkspaceUtil.logWarning(STR, e); } } } return packages; }
/** * Gets all available EPackages from the EPackageRegistry. * * @param filterKnown weather known packages should be filtered or not. * @return the available packages * */
Gets all available EPackages from the EPackageRegistry
getAvailablePackages
{ "repo_name": "edgarmueller/emfstore-rest", "path": "bundles/org.eclipse.emf.emfstore.client.ui/src/org/eclipse/emf/emfstore/internal/client/ui/epackages/EPackageRegistryHelper.java", "license": "epl-1.0", "size": 8355 }
[ "java.util.HashSet", "java.util.LinkedHashSet", "java.util.Map", "java.util.Set", "org.eclipse.emf.ecore.EPackage", "org.eclipse.emf.emfstore.internal.client.model.util.WorkspaceUtil" ]
import java.util.HashSet; import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.emfstore.internal.client.model.util.WorkspaceUtil;
import java.util.*; import org.eclipse.emf.ecore.*; import org.eclipse.emf.emfstore.internal.client.model.util.*;
[ "java.util", "org.eclipse.emf" ]
java.util; org.eclipse.emf;
582,757