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
|
---|---|---|---|---|---|---|---|---|---|---|---|
@Override
public void stop(BundleContext bc) throws Exception {
context = null;
} | void function(BundleContext bc) throws Exception { context = null; } | /**
* Called whenever the OSGi framework stops our bundle
*/ | Called whenever the OSGi framework stops our bundle | stop | {
"repo_name": "paphko/smarthome",
"path": "extensions/ui/org.eclipse.smarthome.ui.classic/src/main/java/org/eclipse/smarthome/ui/classic/internal/WebAppActivator.java",
"license": "epl-1.0",
"size": 1065
} | [
"org.osgi.framework.BundleContext"
] | import org.osgi.framework.BundleContext; | import org.osgi.framework.*; | [
"org.osgi.framework"
] | org.osgi.framework; | 1,980,277 |
@Override
protected synchronized Collection<GCSimpleMessage> iteration() {
if (this.isFinished()) {
return null;
}
Collection<Referenced> refs = this.getReferenced();
this.log(Level.DEBUG, "Sending GC Message to: " + refs);
Vector<GCSimpleMessage> messages = new Vector<GCSimpleMessage>(refs.size());
for (Referenced r : refs) {
messages.add(new GCSimpleMessage(r, this.body.getID(), false, this.dummyActivity));
}
return messages;
} | synchronized Collection<GCSimpleMessage> function() { if (this.isFinished()) { return null; } Collection<Referenced> refs = this.getReferenced(); this.log(Level.DEBUG, STR + refs); Vector<GCSimpleMessage> messages = new Vector<GCSimpleMessage>(refs.size()); for (Referenced r : refs) { messages.add(new GCSimpleMessage(r, this.body.getID(), false, this.dummyActivity)); } return messages; } | /**
* Called by the broadcasting thread to ping all known referenced
*/ | Called by the broadcasting thread to ping all known referenced | iteration | {
"repo_name": "jrochas/scale-proactive",
"path": "src/Core/org/objectweb/proactive/core/gc/HalfBodies.java",
"license": "agpl-3.0",
"size": 6041
} | [
"java.util.Collection",
"java.util.Vector",
"org.apache.log4j.Level"
] | import java.util.Collection; import java.util.Vector; import org.apache.log4j.Level; | import java.util.*; import org.apache.log4j.*; | [
"java.util",
"org.apache.log4j"
] | java.util; org.apache.log4j; | 2,207,037 |
LOGGER.trace("Checking if database table \"{}\" in schema \"{}\" exists", tableName, tableSchema);
try (PreparedStatement statement = connection.prepareStatement(
"SELECT * FROM INFORMATION_SCHEMA.TABLES " +
"WHERE TABLE_SCHEMA = ? " +
"AND TABLE_NAME = ?"
)) {
statement.setString(1, tableSchema);
statement.setString(2, tableName);
try (ResultSet result = statement.executeQuery()) {
if (result.next()) {
LOGGER.trace("Database table \"{}\" found", tableName);
return true;
} else {
LOGGER.trace("Database table \"{}\" not found", tableName);
return false;
}
}
}
} | LOGGER.trace(STR{}\STR{}\STR, tableName, tableSchema); try (PreparedStatement statement = connection.prepareStatement( STR + STR + STR )) { statement.setString(1, tableSchema); statement.setString(2, tableName); try (ResultSet result = statement.executeQuery()) { if (result.next()) { LOGGER.trace(STR{}\STR, tableName); return true; } else { LOGGER.trace(STR{}\STR, tableName); return false; } } } } | /**
* Checks if a named table exists
*
* @param connection the {@link Connection} to use while performing the check
* @param tableName the name of the table to check for existence
* @param tableSchema the table schema for the table to check for existence
*
* @return <code>true</code> if a table with the given name in the given
* schema exists, <code>false</code> otherwise
*
* @throws SQLException
*/ | Checks if a named table exists | tableExists | {
"repo_name": "UniversalMediaServer/UniversalMediaServer",
"path": "src/main/java/net/pms/database/DatabaseHelper.java",
"license": "gpl-2.0",
"size": 15838
} | [
"java.sql.PreparedStatement",
"java.sql.ResultSet"
] | import java.sql.PreparedStatement; import java.sql.ResultSet; | import java.sql.*; | [
"java.sql"
] | java.sql; | 418,670 |
public void setParentView(View parentView) {
this.parentView = parentView;
} | void function(View parentView) { this.parentView = parentView; } | /**
* Modifica a view pai
*
* @param parentView {@code View} Tela pai
*/ | Modifica a view pai | setParentView | {
"repo_name": "mohawkeagle/OD-Controler",
"path": "src/main/java/br/com/urcontroler/main/view/sub/SubView.java",
"license": "gpl-2.0",
"size": 1489
} | [
"br.com.urcontroler.main.view.View"
] | import br.com.urcontroler.main.view.View; | import br.com.urcontroler.main.view.*; | [
"br.com.urcontroler"
] | br.com.urcontroler; | 1,640,243 |
return this.name;
}
@NamedParameter(doc = "Checkpoint prefix.", short_name = "checkpoint_prefix", default_value = "reef")
public static final class CheckpointName implements Name<String> {
} | return this.name; } @NamedParameter(doc = STR, short_name = STR, default_value = "reef") public static final class CheckpointName implements Name<String> { } | /**
* Generate a new checkpoint Name.
*
* @return the checkpoint name
*/ | Generate a new checkpoint Name | getNewName | {
"repo_name": "yunseong/reef",
"path": "lang/java/reef-checkpoint/src/main/java/org/apache/reef/io/checkpoint/SimpleNamingService.java",
"license": "apache-2.0",
"size": 1732
} | [
"org.apache.reef.tang.annotations.Name",
"org.apache.reef.tang.annotations.NamedParameter"
] | import org.apache.reef.tang.annotations.Name; import org.apache.reef.tang.annotations.NamedParameter; | import org.apache.reef.tang.annotations.*; | [
"org.apache.reef"
] | org.apache.reef; | 149,779 |
final int readBits(int n) throws IOException {
int bits; // The read bits
// Can we get all bits from the bit buffer?
if (n <= bpos) {
return (bbuf >> (bpos-=n)) & ((1<<n)-1);
}
else {
// NOTE: The implementation need not be recursive but the not
// recursive one exploits a bug in the IBM x86 JIT and caused
// incorrect decoding (Diego Santa Cruz).
bits = 0;
do {
// Get all the bits we can from the bit buffer
bits <<= bpos;
n -= bpos;
bits |= readBits(bpos);
// Get an extra bit to load next byte (here bpos is 0)
if (bbuf != 0xFF) { // No bit stuffing
if(usebais)
bbuf = bais.read();
else
bbuf = in.read();
bpos = 8;
if (bbuf == 0xFF) { // If new bit stuffing get next byte
if(usebais)
nextbbuf = bais.read();
else
nextbbuf = in.read();
}
}
else { // We had bit stuffing, nextbuf can not be 0xFF
bbuf = nextbbuf;
bpos = 7;
}
} while (n > bpos);
// Get the last bits, if any
bits <<= n;
bits |= (bbuf >> (bpos-=n)) & ((1<<n)-1);
// Return result
return bits;
}
} | final int readBits(int n) throws IOException { int bits; if (n <= bpos) { return (bbuf >> (bpos-=n)) & ((1<<n)-1); } else { bits = 0; do { bits <<= bpos; n -= bpos; bits = readBits(bpos); if (bbuf != 0xFF) { if(usebais) bbuf = bais.read(); else bbuf = in.read(); bpos = 8; if (bbuf == 0xFF) { if(usebais) nextbbuf = bais.read(); else nextbbuf = in.read(); } } else { bbuf = nextbbuf; bpos = 7; } } while (n > bpos); bits <<= n; bits = (bbuf >> (bpos-=n)) & ((1<<n)-1); return bits; } } | /**
* Reads a specified number of bits and returns them in a single
* integer. The bits are returned in the 'n' least significant bits of the
* returned integer. The maximum number of bits that can be read is 31.
*
* @param n The number of bits to read
*
* @return The read bits, packed in the 'n' LSBs.
* @exception IOException If an I/O error occurred
*
* @exception EOFException If teh end of file has been reached
*
* */ | Reads a specified number of bits and returns them in a single integer. The bits are returned in the 'n' least significant bits of the returned integer. The maximum number of bits that can be read is 31 | readBits | {
"repo_name": "GoogleCloudPlatform/healthcare-dicom-dicomweb-adapter",
"path": "third_party/jai-imageio-jpeg2000/src/main/java/jj2000/j2k/codestream/reader/PktHeaderBitReader.java",
"license": "apache-2.0",
"size": 8201
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,772,606 |
StreamEvent find(StateEvent matchingEvent, CompiledCondition compiledCondition); | StreamEvent find(StateEvent matchingEvent, CompiledCondition compiledCondition); | /**
* To find events from the processor event pool, that the matches the matchingEvent based on finder logic.
*
* @param matchingEvent the event to be matched with the events at the processor
* @param compiledCondition the execution element responsible for matching the corresponding events that matches
* the matchingEvent based on pool of events at Processor
* @return the matched events
*/ | To find events from the processor event pool, that the matches the matchingEvent based on finder logic | find | {
"repo_name": "gokul/siddhi",
"path": "modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/FindableProcessor.java",
"license": "apache-2.0",
"size": 3024
} | [
"io.siddhi.core.event.state.StateEvent",
"io.siddhi.core.event.stream.StreamEvent",
"io.siddhi.core.util.collection.operator.CompiledCondition"
] | import io.siddhi.core.event.state.StateEvent; import io.siddhi.core.event.stream.StreamEvent; import io.siddhi.core.util.collection.operator.CompiledCondition; | import io.siddhi.core.event.state.*; import io.siddhi.core.event.stream.*; import io.siddhi.core.util.collection.operator.*; | [
"io.siddhi.core"
] | io.siddhi.core; | 2,882,575 |
@SuppressWarnings("TypeMayBeWeakened")
void writeLinkedList(LinkedList<?> list) throws IOException {
int size = list.size();
writeInt(size);
for (Object obj : list)
writeObject0(obj);
} | @SuppressWarnings(STR) void writeLinkedList(LinkedList<?> list) throws IOException { int size = list.size(); writeInt(size); for (Object obj : list) writeObject0(obj); } | /**
* Writes {@link LinkedList}.
*
* @param list List.
* @throws IOException In case of error.
*/ | Writes <code>LinkedList</code> | writeLinkedList | {
"repo_name": "endian675/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/marshaller/optimized/OptimizedObjectOutputStream.java",
"license": "apache-2.0",
"size": 25260
} | [
"java.io.IOException",
"java.util.LinkedList"
] | import java.io.IOException; import java.util.LinkedList; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 237,780 |
public static byte[] toByteArray(URL url) throws IOException {
try (InputStream inputStream = url.openStream()) {
return ByteStreams.toByteArray(inputStream);
}
} | static byte[] function(URL url) throws IOException { try (InputStream inputStream = url.openStream()) { return ByteStreams.toByteArray(inputStream); } } | /**
* Reads all bytes from a URL into a byte array.
*
* @param url the URL to read from
* @return a byte array containing all the bytes from the URL
* @throws IOException if an I/O error occurs
*/ | Reads all bytes from a URL into a byte array | toByteArray | {
"repo_name": "Alexey1Gavrilov/dropwizard",
"path": "dropwizard-util/src/main/java/io/dropwizard/util/Resources.java",
"license": "apache-2.0",
"size": 3039
} | [
"java.io.IOException",
"java.io.InputStream"
] | import java.io.IOException; import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 2,855,742 |
SnapshotsStatusRequestBuilder prepareSnapshotStatus(String repository); | SnapshotsStatusRequestBuilder prepareSnapshotStatus(String repository); | /**
* Get snapshot status.
*/ | Get snapshot status | prepareSnapshotStatus | {
"repo_name": "jprante/elasticsearch-server",
"path": "server/src/main/java/org/elasticsearch/client/ClusterAdminClient.java",
"license": "apache-2.0",
"size": 26854
} | [
"org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusRequestBuilder"
] | import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusRequestBuilder; | import org.elasticsearch.action.admin.cluster.snapshots.status.*; | [
"org.elasticsearch.action"
] | org.elasticsearch.action; | 2,118,500 |
public MigrateSyncCompleteCommandInput withCommitTimestamp(OffsetDateTime commitTimestamp) {
this.commitTimestamp = commitTimestamp;
return this;
} | MigrateSyncCompleteCommandInput function(OffsetDateTime commitTimestamp) { this.commitTimestamp = commitTimestamp; return this; } | /**
* Set the commitTimestamp property: Time stamp to complete.
*
* @param commitTimestamp the commitTimestamp value to set.
* @return the MigrateSyncCompleteCommandInput object itself.
*/ | Set the commitTimestamp property: Time stamp to complete | withCommitTimestamp | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/datamigration/azure-resourcemanager-datamigration/src/main/java/com/azure/resourcemanager/datamigration/models/MigrateSyncCompleteCommandInput.java",
"license": "mit",
"size": 2552
} | [
"java.time.OffsetDateTime"
] | import java.time.OffsetDateTime; | import java.time.*; | [
"java.time"
] | java.time; | 1,457,916 |
public void paintIcon(Component c, Graphics g, int x, int y) {
Graphics2D g2 = (Graphics2D) g;
// copy graphics settings
RenderingHints oldHints = g2.getRenderingHints();
AffineTransform oldAt = g2.getTransform();
Color oldColor = g2.getColor();
// new settings
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2.scale(size, size); // the point size
g2.setColor(c.getForeground()); // foreground will be used as default painting color
// draw formula box
box.draw(g2, (x + insets.left) / size, (y + insets.top) / size
+ box.getHeight());
// restore graphics settings
g2.setRenderingHints(oldHints);
g2.setTransform(oldAt);
g2.setColor(oldColor);
}
| void function(Component c, Graphics g, int x, int y) { Graphics2D g2 = (Graphics2D) g; RenderingHints oldHints = g2.getRenderingHints(); AffineTransform oldAt = g2.getTransform(); Color oldColor = g2.getColor(); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.scale(size, size); g2.setColor(c.getForeground()); box.draw(g2, (x + insets.left) / size, (y + insets.top) / size + box.getHeight()); g2.setRenderingHints(oldHints); g2.setTransform(oldAt); g2.setColor(oldColor); } | /**
* Paint the {@link TeXFormula} that created this icon.
*/ | Paint the <code>TeXFormula</code> that created this icon | paintIcon | {
"repo_name": "tectronics/ingatan",
"path": "src/be/ugent/caagt/jmathtex/TeXIcon.java",
"license": "gpl-3.0",
"size": 5601
} | [
"java.awt.Color",
"java.awt.Component",
"java.awt.Graphics",
"java.awt.Graphics2D",
"java.awt.RenderingHints",
"java.awt.geom.AffineTransform"
] | import java.awt.Color; import java.awt.Component; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.geom.AffineTransform; | import java.awt.*; import java.awt.geom.*; | [
"java.awt"
] | java.awt; | 1,584,138 |
HttpUrl getWmsUrl(FstepFile.Type type, URI uri); | HttpUrl getWmsUrl(FstepFile.Type type, URI uri); | /**
* <p>Generate an appropriate WMS URL for the given file.</p>
*
* @param type
* @param uri
* @return
*/ | Generate an appropriate WMS URL for the given file | getWmsUrl | {
"repo_name": "antonio-cuomo/fstep",
"path": "fs-tep-catalogue/src/main/java/com/cgi/eoss/fstep/catalogue/CatalogueService.java",
"license": "agpl-3.0",
"size": 4135
} | [
"com.cgi.eoss.fstep.model.FstepFile"
] | import com.cgi.eoss.fstep.model.FstepFile; | import com.cgi.eoss.fstep.model.*; | [
"com.cgi.eoss"
] | com.cgi.eoss; | 2,221,311 |
public CreateServiceInstanceRequestBuilder serviceDefinition(ServiceDefinition serviceDefinition) {
this.serviceDefinition = serviceDefinition;
return this;
} | CreateServiceInstanceRequestBuilder function(ServiceDefinition serviceDefinition) { this.serviceDefinition = serviceDefinition; return this; } | /**
* Set the fully resolved service definition.
*
* @param serviceDefinition the service definition
* @return the builder
* @see #getServiceDefinition()
*/ | Set the fully resolved service definition | serviceDefinition | {
"repo_name": "spring-cloud/spring-cloud-cloudfoundry-service-broker",
"path": "spring-cloud-open-service-broker-core/src/main/java/org/springframework/cloud/servicebroker/model/instance/CreateServiceInstanceRequest.java",
"license": "apache-2.0",
"size": 18778
} | [
"org.springframework.cloud.servicebroker.model.catalog.ServiceDefinition"
] | import org.springframework.cloud.servicebroker.model.catalog.ServiceDefinition; | import org.springframework.cloud.servicebroker.model.catalog.*; | [
"org.springframework.cloud"
] | org.springframework.cloud; | 2,708,374 |
public LoadingOptions getLoadingOptions() {
return getOptions(LoadingOptions.class);
} | LoadingOptions function() { return getOptions(LoadingOptions.class); } | /**
* Returns the set of options related to the loading phase.
*/ | Returns the set of options related to the loading phase | getLoadingOptions | {
"repo_name": "Asana/bazel",
"path": "src/main/java/com/google/devtools/build/lib/buildtool/BuildRequest.java",
"license": "apache-2.0",
"size": 19217
} | [
"com.google.devtools.build.lib.pkgcache.LoadingOptions"
] | import com.google.devtools.build.lib.pkgcache.LoadingOptions; | import com.google.devtools.build.lib.pkgcache.*; | [
"com.google.devtools"
] | com.google.devtools; | 516,830 |
@SetProperty(value = "Anfangsdatum", index = 0)
public void metaSetStartDate(String startDate) throws SetDataException{
Calendar cal;
try {
cal = QueryUtil.convertToCalendar(startDate);
cal.get(Calendar.DAY_OF_MONTH); // these throw IllegalArgument...
cal.get(Calendar.MONTH);
cal.get(Calendar.YEAR);
} catch (NumberFormatException e) { // converting failure
throw new SetDataException("Anfangsdatum nicht im richtigen Format. "
+ "Bitte in folgendem Format angeben: dd.mm.yyy");
} catch (IllegalArgumentException e) { // illegal date
throw new SetDataException("Das Anfangsdatum ist kein valides Datum.");
}
this.setStartDate(cal);
}
| @SetProperty(value = STR, index = 0) void function(String startDate) throws SetDataException{ Calendar cal; try { cal = QueryUtil.convertToCalendar(startDate); cal.get(Calendar.DAY_OF_MONTH); cal.get(Calendar.MONTH); cal.get(Calendar.YEAR); } catch (NumberFormatException e) { throw new SetDataException(STR + STR); } catch (IllegalArgumentException e) { throw new SetDataException(STR); } this.setStartDate(cal); } | /**
* Set the start date of this query. Inclusive the given date. Format of the string has to be
* d[d].m[m].yyyy
*
* @throws SetDataException
*/ | Set the start date of this query. Inclusive the given date. Format of the string has to be d[d].m[m].yyyy | metaSetStartDate | {
"repo_name": "DavidGutknecht/elexis-3-base",
"path": "bundles/waelti.statistics/src/waelti/statistics/queries/AbstractTimeSeries.java",
"license": "epl-1.0",
"size": 3835
} | [
"java.util.Calendar"
] | import java.util.Calendar; | import java.util.*; | [
"java.util"
] | java.util; | 5,397 |
public static synchronized ProfilerEventHandler getInstance(ConnectionImpl conn) throws SQLException {
ProfilerEventHandler handler = (ProfilerEventHandler) CONNECTIONS_TO_SINKS
.get(conn);
if (handler == null) {
handler = (ProfilerEventHandler)Util.getInstance(conn.getProfilerEventHandler(), new Class[0], new Object[0], conn.getExceptionInterceptor());
// we do it this way to not require
// exposing the connection properties
// for all who utilize it
conn.initializeExtension(handler);
CONNECTIONS_TO_SINKS.put(conn, handler);
}
return handler;
} | static synchronized ProfilerEventHandler function(ConnectionImpl conn) throws SQLException { ProfilerEventHandler handler = (ProfilerEventHandler) CONNECTIONS_TO_SINKS .get(conn); if (handler == null) { handler = (ProfilerEventHandler)Util.getInstance(conn.getProfilerEventHandler(), new Class[0], new Object[0], conn.getExceptionInterceptor()); conn.initializeExtension(handler); CONNECTIONS_TO_SINKS.put(conn, handler); } return handler; } | /**
* Returns the ProfilerEventHandlerFactory that handles profiler events for the given
* connection.
*
* @param conn
* the connection to handle events for
* @return the ProfilerEventHandlerFactory that handles profiler events
*/ | Returns the ProfilerEventHandlerFactory that handles profiler events for the given connection | getInstance | {
"repo_name": "yyuu/libmysql-java",
"path": "src/com/mysql/jdbc/profiler/ProfilerEventHandlerFactory.java",
"license": "gpl-2.0",
"size": 2809
} | [
"com.mysql.jdbc.ConnectionImpl",
"com.mysql.jdbc.Util",
"java.sql.SQLException"
] | import com.mysql.jdbc.ConnectionImpl; import com.mysql.jdbc.Util; import java.sql.SQLException; | import com.mysql.jdbc.*; import java.sql.*; | [
"com.mysql.jdbc",
"java.sql"
] | com.mysql.jdbc; java.sql; | 2,761,950 |
private void addNonEmptyStatement(
Node n, Context context, boolean allowNonBlockChild) {
Node nodeToProcess = n;
if (!allowNonBlockChild && !n.isNormalBlock()) {
throw new Error("Missing BLOCK child.");
}
// Strip unneeded blocks, that is blocks with <2 children unless
// the CodePrinter specifically wants to keep them.
if (n.isNormalBlock()) {
int count = getNonEmptyChildCount(n, 2);
if (count == 0) {
if (cc.shouldPreserveExtraBlocks()) {
cc.beginBlock();
cc.endBlock(cc.breakAfterBlockFor(n, context == Context.STATEMENT));
} else {
cc.endStatement(true);
}
return;
}
if (count == 1) {
// Preserve the block only if needed or requested.
//'let', 'const', etc are not allowed by themselves in "if" and other
// structures. Also, hack around a IE6/7 browser bug that needs a block around DOs.
Node firstAndOnlyChild = getFirstNonEmptyChild(n);
boolean alwaysWrapInBlock = cc.shouldPreserveExtraBlocks();
if (alwaysWrapInBlock || isBlockDeclOrDo(firstAndOnlyChild)) {
cc.beginBlock();
add(firstAndOnlyChild, Context.STATEMENT);
cc.maybeLineBreak();
cc.endBlock(cc.breakAfterBlockFor(n, context == Context.STATEMENT));
return;
} else {
// Continue with the only child.
nodeToProcess = firstAndOnlyChild;
}
}
}
if (nodeToProcess.isEmpty()) {
cc.endStatement(true);
} else {
add(nodeToProcess, context);
}
} | void function( Node n, Context context, boolean allowNonBlockChild) { Node nodeToProcess = n; if (!allowNonBlockChild && !n.isNormalBlock()) { throw new Error(STR); } if (n.isNormalBlock()) { int count = getNonEmptyChildCount(n, 2); if (count == 0) { if (cc.shouldPreserveExtraBlocks()) { cc.beginBlock(); cc.endBlock(cc.breakAfterBlockFor(n, context == Context.STATEMENT)); } else { cc.endStatement(true); } return; } if (count == 1) { Node firstAndOnlyChild = getFirstNonEmptyChild(n); boolean alwaysWrapInBlock = cc.shouldPreserveExtraBlocks(); if (alwaysWrapInBlock isBlockDeclOrDo(firstAndOnlyChild)) { cc.beginBlock(); add(firstAndOnlyChild, Context.STATEMENT); cc.maybeLineBreak(); cc.endBlock(cc.breakAfterBlockFor(n, context == Context.STATEMENT)); return; } else { nodeToProcess = firstAndOnlyChild; } } } if (nodeToProcess.isEmpty()) { cc.endStatement(true); } else { add(nodeToProcess, context); } } | /**
* Adds a block or expression, substituting a VOID with an empty statement.
* This is used for "for (...);" and "if (...);" type statements.
*
* @param n The node to print.
* @param context The context to determine how the node should be printed.
*/ | Adds a block or expression, substituting a VOID with an empty statement. This is used for "for (...);" and "if (...);" type statements | addNonEmptyStatement | {
"repo_name": "brad4d/closure-compiler",
"path": "src/com/google/javascript/jscomp/CodeGenerator.java",
"license": "apache-2.0",
"size": 58499
} | [
"com.google.javascript.rhino.Node"
] | import com.google.javascript.rhino.Node; | import com.google.javascript.rhino.*; | [
"com.google.javascript"
] | com.google.javascript; | 779,348 |
public MutableDateTime set(String text, Locale locale) {
iInstant.setMillis(getField().set(iInstant.getMillis(), text, locale));
return iInstant;
}
| MutableDateTime function(String text, Locale locale) { iInstant.setMillis(getField().set(iInstant.getMillis(), text, locale)); return iInstant; } | /**
* Sets a text value.
*
* @param text the text value to set
* @param locale optional locale to use for selecting a text symbol
* @return the mutable datetime being used, so calls can be chained
* @throws IllegalArgumentException if the text value isn't valid
* @see DateTimeField#set(long,java.lang.String,java.util.Locale)
*/ | Sets a text value | set | {
"repo_name": "timrdf/csv2rdf4lod-automation",
"path": "lib/joda-time-2.0/src/main/java/org/joda/time/MutableDateTime.java",
"license": "apache-2.0",
"size": 52049
} | [
"java.util.Locale"
] | import java.util.Locale; | import java.util.*; | [
"java.util"
] | java.util; | 879,977 |
public static void deleteAllEmails(String protocol) throws MessagingException {
deleteAllEmails(protocol, primaryUser);
} | static void function(String protocol) throws MessagingException { deleteAllEmails(protocol, primaryUser); } | /**
* Overloaded method to delete all the mails in the primary user's store
* @param protocol
* @throws MessagingException
*/ | Overloaded method to delete all the mails in the primary user's store | deleteAllEmails | {
"repo_name": "wso2/product-ei",
"path": "integration/mediation-tests/tests-common/integration-test-utils/src/main/java/org/wso2/esb/integration/common/utils/servers/GreenMailServer.java",
"license": "apache-2.0",
"size": 10603
} | [
"javax.mail.MessagingException"
] | import javax.mail.MessagingException; | import javax.mail.*; | [
"javax.mail"
] | javax.mail; | 427,318 |
default boolean arePreconditionsValid(Problem state) {
return getPreconditions().stream().map(p -> p.isValid(state, this)).reduce(true, Boolean::logicalAnd);
} | default boolean arePreconditionsValid(Problem state) { return getPreconditions().stream().map(p -> p.isValid(state, this)).reduce(true, Boolean::logicalAnd); } | /**
* Check if all preconditions of the action are valid in the given state.
*
* @param state the state to validate
* @return true iff all preconditions are valid in the given state
*/ | Check if all preconditions of the action are valid in the given state | arePreconditionsValid | {
"repo_name": "oskopek/TransportEditor",
"path": "transport-core/src/main/java/com/oskopek/transport/model/domain/action/Action.java",
"license": "mit",
"size": 3028
} | [
"com.oskopek.transport.model.problem.Problem"
] | import com.oskopek.transport.model.problem.Problem; | import com.oskopek.transport.model.problem.*; | [
"com.oskopek.transport"
] | com.oskopek.transport; | 371,962 |
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try {
processRequest(request, response);
} catch (SQLException ex) {
Logger.getLogger(SEscribearticulo.class.getName()).log(Level.SEVERE, null, ex);
} catch (Exception ex) {
Logger.getLogger(SEscribearticulo.class.getName()).log(Level.SEVERE, null, ex);
}
} | void function(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { processRequest(request, response); } catch (SQLException ex) { Logger.getLogger(SEscribearticulo.class.getName()).log(Level.SEVERE, null, ex); } catch (Exception ex) { Logger.getLogger(SEscribearticulo.class.getName()).log(Level.SEVERE, null, ex); } } | /**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/ | Handles the HTTP <code>POST</code> method | doPost | {
"repo_name": "StromInc/Strongfit",
"path": "StrongFit/src/java/servlets/SEscribearticulo.java",
"license": "apache-2.0",
"size": 4952
} | [
"java.io.IOException",
"java.sql.SQLException",
"java.util.logging.Level",
"java.util.logging.Logger",
"javax.servlet.ServletException",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse"
] | import java.io.IOException; import java.sql.SQLException; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; | import java.io.*; import java.sql.*; import java.util.logging.*; import javax.servlet.*; import javax.servlet.http.*; | [
"java.io",
"java.sql",
"java.util",
"javax.servlet"
] | java.io; java.sql; java.util; javax.servlet; | 1,725,442 |
public static Class<?> detectClass(Object obj) {
assert obj != null;
if (obj instanceof GridPeerDeployAware)
return ((GridPeerDeployAware)obj).deployClass();
if (U.isPrimitiveArray(obj))
return obj.getClass();
if (!U.isJdk(obj.getClass()))
return obj.getClass();
if (obj instanceof Iterable<?>) {
Object o = F.first((Iterable<?>)obj);
// No point to continue, if null.
return o != null ? o.getClass() : obj.getClass();
}
if (obj instanceof Map) {
Map.Entry<?, ?> e = F.firstEntry((Map<?, ?>)obj);
if (e != null) {
Object k = e.getKey();
if (k != null && !U.isJdk(k.getClass()))
return k.getClass();
Object v = e.getValue();
return v != null ? v.getClass() : obj.getClass();
}
}
if (obj.getClass().isArray()) {
int len = Array.getLength(obj);
if (len > 0) {
Object o = Array.get(obj, 0);
return o != null ? o.getClass() : obj.getClass();
}
else
return obj.getClass().getComponentType();
}
return obj.getClass();
} | static Class<?> function(Object obj) { assert obj != null; if (obj instanceof GridPeerDeployAware) return ((GridPeerDeployAware)obj).deployClass(); if (U.isPrimitiveArray(obj)) return obj.getClass(); if (!U.isJdk(obj.getClass())) return obj.getClass(); if (obj instanceof Iterable<?>) { Object o = F.first((Iterable<?>)obj); return o != null ? o.getClass() : obj.getClass(); } if (obj instanceof Map) { Map.Entry<?, ?> e = F.firstEntry((Map<?, ?>)obj); if (e != null) { Object k = e.getKey(); if (k != null && !U.isJdk(k.getClass())) return k.getClass(); Object v = e.getValue(); return v != null ? v.getClass() : obj.getClass(); } } if (obj.getClass().isArray()) { int len = Array.getLength(obj); if (len > 0) { Object o = Array.get(obj, 0); return o != null ? o.getClass() : obj.getClass(); } else return obj.getClass().getComponentType(); } return obj.getClass(); } | /**
* Tries to detect user class from passed in object inspecting
* collections, arrays or maps.
*
* @param obj Object.
* @return First non-JDK or deployment aware class or passed in object class.
*/ | Tries to detect user class from passed in object inspecting collections, arrays or maps | detectClass | {
"repo_name": "NSAmelchev/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java",
"license": "apache-2.0",
"size": 388551
} | [
"java.lang.reflect.Array",
"java.util.Map",
"org.apache.ignite.internal.util.lang.GridPeerDeployAware",
"org.apache.ignite.internal.util.typedef.F",
"org.apache.ignite.internal.util.typedef.internal.U"
] | import java.lang.reflect.Array; import java.util.Map; import org.apache.ignite.internal.util.lang.GridPeerDeployAware; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.internal.U; | import java.lang.reflect.*; import java.util.*; import org.apache.ignite.internal.util.lang.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; | [
"java.lang",
"java.util",
"org.apache.ignite"
] | java.lang; java.util; org.apache.ignite; | 1,549,712 |
protected ClassLoader getClassLoaderFromJar(File classjar) throws IOException {
Path lookupPath = new Path(getTask().getProject());
lookupPath.setLocation(classjar);
Path classpath = getCombinedClasspath();
if (classpath != null) {
lookupPath.append(classpath);
}
return getTask().getProject().createClassLoader(lookupPath);
} | ClassLoader function(File classjar) throws IOException { Path lookupPath = new Path(getTask().getProject()); lookupPath.setLocation(classjar); Path classpath = getCombinedClasspath(); if (classpath != null) { lookupPath.append(classpath); } return getTask().getProject().createClassLoader(lookupPath); } | /**
* Helper method invoked by isRebuildRequired to get a ClassLoader for a
* Jar File passed to it.
*
* @param classjar java.io.File representing jar file to get classes from.
* @return a classloader for the jar file.
* @throws IOException if there is an error.
*/ | Helper method invoked by isRebuildRequired to get a ClassLoader for a Jar File passed to it | getClassLoaderFromJar | {
"repo_name": "Mayo-WE01051879/mayosapp",
"path": "Build/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WebsphereDeploymentTool.java",
"license": "mit",
"size": 31621
} | [
"java.io.File",
"java.io.IOException",
"org.apache.tools.ant.types.Path"
] | import java.io.File; import java.io.IOException; import org.apache.tools.ant.types.Path; | import java.io.*; import org.apache.tools.ant.types.*; | [
"java.io",
"org.apache.tools"
] | java.io; org.apache.tools; | 851,750 |
private void duplicateBlock(long blockId) throws IOException {
try(AutoCloseableLock lock = fds.acquireDatasetLock()) {
ReplicaInfo b = FsDatasetTestUtil.fetchReplicaInfo(fds, bpid, blockId);
try (FsDatasetSpi.FsVolumeReferences volumes =
fds.getFsVolumeReferences()) {
for (FsVolumeSpi v : volumes) {
if (v.getStorageID().equals(b.getVolume().getStorageID())) {
continue;
}
// Volume without a copy of the block. Make a copy now.
File sourceBlock = b.getBlockFile();
File sourceMeta = b.getMetaFile();
String sourceRoot = b.getVolume().getBasePath();
String destRoot = v.getBasePath();
String relativeBlockPath =
new File(sourceRoot).toURI().relativize(sourceBlock.toURI())
.getPath();
String relativeMetaPath =
new File(sourceRoot).toURI().relativize(sourceMeta.toURI())
.getPath();
File destBlock = new File(destRoot, relativeBlockPath);
File destMeta = new File(destRoot, relativeMetaPath);
destBlock.getParentFile().mkdirs();
FileUtils.copyFile(sourceBlock, destBlock);
FileUtils.copyFile(sourceMeta, destMeta);
if (destBlock.exists() && destMeta.exists()) {
LOG.info("Copied " + sourceBlock + " ==> " + destBlock);
LOG.info("Copied " + sourceMeta + " ==> " + destMeta);
}
}
}
}
} | void function(long blockId) throws IOException { try(AutoCloseableLock lock = fds.acquireDatasetLock()) { ReplicaInfo b = FsDatasetTestUtil.fetchReplicaInfo(fds, bpid, blockId); try (FsDatasetSpi.FsVolumeReferences volumes = fds.getFsVolumeReferences()) { for (FsVolumeSpi v : volumes) { if (v.getStorageID().equals(b.getVolume().getStorageID())) { continue; } File sourceBlock = b.getBlockFile(); File sourceMeta = b.getMetaFile(); String sourceRoot = b.getVolume().getBasePath(); String destRoot = v.getBasePath(); String relativeBlockPath = new File(sourceRoot).toURI().relativize(sourceBlock.toURI()) .getPath(); String relativeMetaPath = new File(sourceRoot).toURI().relativize(sourceMeta.toURI()) .getPath(); File destBlock = new File(destRoot, relativeBlockPath); File destMeta = new File(destRoot, relativeMetaPath); destBlock.getParentFile().mkdirs(); FileUtils.copyFile(sourceBlock, destBlock); FileUtils.copyFile(sourceMeta, destMeta); if (destBlock.exists() && destMeta.exists()) { LOG.info(STR + sourceBlock + STR + destBlock); LOG.info(STR + sourceMeta + STR + destMeta); } } } } } | /**
* Duplicate the given block on all volumes.
* @param blockId
* @throws IOException
*/ | Duplicate the given block on all volumes | duplicateBlock | {
"repo_name": "leechoongyon/HadoopSourceAnalyze",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDirectoryScanner.java",
"license": "apache-2.0",
"size": 32843
} | [
"java.io.File",
"java.io.IOException",
"org.apache.commons.io.FileUtils",
"org.apache.hadoop.hdfs.server.datanode.fsdataset.FsDatasetSpi",
"org.apache.hadoop.hdfs.server.datanode.fsdataset.FsVolumeSpi",
"org.apache.hadoop.hdfs.server.datanode.fsdataset.impl.FsDatasetTestUtil",
"org.apache.hadoop.util.AutoCloseableLock"
] | import java.io.File; import java.io.IOException; import org.apache.commons.io.FileUtils; import org.apache.hadoop.hdfs.server.datanode.fsdataset.FsDatasetSpi; import org.apache.hadoop.hdfs.server.datanode.fsdataset.FsVolumeSpi; import org.apache.hadoop.hdfs.server.datanode.fsdataset.impl.FsDatasetTestUtil; import org.apache.hadoop.util.AutoCloseableLock; | import java.io.*; import org.apache.commons.io.*; import org.apache.hadoop.hdfs.server.datanode.fsdataset.*; import org.apache.hadoop.hdfs.server.datanode.fsdataset.impl.*; import org.apache.hadoop.util.*; | [
"java.io",
"org.apache.commons",
"org.apache.hadoop"
] | java.io; org.apache.commons; org.apache.hadoop; | 2,269,474 |
protected List<Long> getPreferredHostsFromGroupVMIds(List<Long> vmIds) {
return new ArrayList<>(getHostIdSet(vmIds));
} | List<Long> function(List<Long> vmIds) { return new ArrayList<>(getHostIdSet(vmIds)); } | /**
* Get preferred host ids list from the affinity group VMs
*/ | Get preferred host ids list from the affinity group VMs | getPreferredHostsFromGroupVMIds | {
"repo_name": "GabrielBrascher/cloudstack",
"path": "plugins/affinity-group-processors/host-affinity/src/main/java/org/apache/cloudstack/affinity/HostAffinityProcessor.java",
"license": "apache-2.0",
"size": 4947
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,251,212 |
protected CharSequence getURL()
{
return urlFor(ILinkListener.INTERFACE, new PageParameters());
} | CharSequence function() { return urlFor(ILinkListener.INTERFACE, new PageParameters()); } | /**
* Gets the url to use for this link.
*
* @return The URL that this link links to
*/ | Gets the url to use for this link | getURL | {
"repo_name": "topicusonderwijs/wicket",
"path": "wicket-core/src/main/java/org/apache/wicket/markup/html/link/InlineFrame.java",
"license": "apache-2.0",
"size": 5307
} | [
"org.apache.wicket.request.mapper.parameter.PageParameters"
] | import org.apache.wicket.request.mapper.parameter.PageParameters; | import org.apache.wicket.request.mapper.parameter.*; | [
"org.apache.wicket"
] | org.apache.wicket; | 2,202,050 |
protected synchronized void release(boolean userAccess) {
SessionState.detachSession();
if (ThreadWithGarbageCleanup.currentThread() instanceof ThreadWithGarbageCleanup) {
ThreadWithGarbageCleanup currentThread =
(ThreadWithGarbageCleanup) ThreadWithGarbageCleanup.currentThread();
currentThread.cacheThreadLocalRawStore();
}
if (userAccess) {
lastAccessTime = System.currentTimeMillis();
}
if (opHandleSet.isEmpty()) {
lastIdleTime = System.currentTimeMillis();
} else {
lastIdleTime = 0;
}
} | synchronized void function(boolean userAccess) { SessionState.detachSession(); if (ThreadWithGarbageCleanup.currentThread() instanceof ThreadWithGarbageCleanup) { ThreadWithGarbageCleanup currentThread = (ThreadWithGarbageCleanup) ThreadWithGarbageCleanup.currentThread(); currentThread.cacheThreadLocalRawStore(); } if (userAccess) { lastAccessTime = System.currentTimeMillis(); } if (opHandleSet.isEmpty()) { lastIdleTime = System.currentTimeMillis(); } else { lastIdleTime = 0; } } | /**
* 1. We'll remove the ThreadLocal SessionState as this thread might now serve
* other requests.
* 2. We'll cache the ThreadLocal RawStore object for this background thread for an orderly cleanup
* when this thread is garbage collected later.
* @see org.apache.hive.service.server.ThreadWithGarbageCleanup#finalize()
*/ | 1. We'll remove the ThreadLocal SessionState as this thread might now serve other requests. 2. We'll cache the ThreadLocal RawStore object for this background thread for an orderly cleanup when this thread is garbage collected later | release | {
"repo_name": "mahak/spark",
"path": "sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/session/HiveSessionImpl.java",
"license": "apache-2.0",
"size": 31296
} | [
"org.apache.hadoop.hive.ql.session.SessionState",
"org.apache.hive.service.server.ThreadWithGarbageCleanup"
] | import org.apache.hadoop.hive.ql.session.SessionState; import org.apache.hive.service.server.ThreadWithGarbageCleanup; | import org.apache.hadoop.hive.ql.session.*; import org.apache.hive.service.server.*; | [
"org.apache.hadoop",
"org.apache.hive"
] | org.apache.hadoop; org.apache.hive; | 2,427,279 |
private Intent getIntentToEnableOsPerAppPermission(Context context) {
if (enabledForChrome(context)) return null;
return getAppInfoIntent(context);
} | Intent function(Context context) { if (enabledForChrome(context)) return null; return getAppInfoIntent(context); } | /**
* Returns the OS Intent to use to enable a per-app permission, or null if the permission is
* already enabled. Android M and above provides two ways of doing this for some permissions,
* most notably Location, one that is per-app and another that is global.
*/ | Returns the OS Intent to use to enable a per-app permission, or null if the permission is already enabled. Android M and above provides two ways of doing this for some permissions, most notably Location, one that is per-app and another that is global | getIntentToEnableOsPerAppPermission | {
"repo_name": "js0701/chromium-crosswalk",
"path": "chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SiteSettingsCategory.java",
"license": "bsd-3-clause",
"size": 18386
} | [
"android.content.Context",
"android.content.Intent"
] | import android.content.Context; import android.content.Intent; | import android.content.*; | [
"android.content"
] | android.content; | 2,639,909 |
private void groupVersions(final Map<Gav, Map<Version, List<StorageFileItem>>> groupArtifactToVersions,
final Map<Version, List<StorageFileItem>> versionsAndFiles,
final Gav gav)
{
//ga only coordinates
Gav ga = new Gav(gav.getGroupId(), gav.getArtifactId(), "");
if (!groupArtifactToVersions.containsKey(ga)) {
groupArtifactToVersions.put(ga, Maps.newHashMap(versionsAndFiles));
}
groupArtifactToVersions.get(ga).putAll(versionsAndFiles);
} | void function(final Map<Gav, Map<Version, List<StorageFileItem>>> groupArtifactToVersions, final Map<Version, List<StorageFileItem>> versionsAndFiles, final Gav gav) { Gav ga = new Gav(gav.getGroupId(), gav.getArtifactId(), ""); if (!groupArtifactToVersions.containsKey(ga)) { groupArtifactToVersions.put(ga, Maps.newHashMap(versionsAndFiles)); } groupArtifactToVersions.get(ga).putAll(versionsAndFiles); } | /**
* Map Group + Artifact to each version with those GA coordinates
*/ | Map Group + Artifact to each version with those GA coordinates | groupVersions | {
"repo_name": "scmod/nexus-public",
"path": "components/nexus-core/src/main/java/org/sonatype/nexus/maven/tasks/WalkerReleaseRemoverBackend.java",
"license": "epl-1.0",
"size": 11642
} | [
"com.google.common.collect.Maps",
"java.util.List",
"java.util.Map",
"org.sonatype.aether.version.Version",
"org.sonatype.nexus.proxy.item.StorageFileItem",
"org.sonatype.nexus.proxy.maven.gav.Gav"
] | import com.google.common.collect.Maps; import java.util.List; import java.util.Map; import org.sonatype.aether.version.Version; import org.sonatype.nexus.proxy.item.StorageFileItem; import org.sonatype.nexus.proxy.maven.gav.Gav; | import com.google.common.collect.*; import java.util.*; import org.sonatype.aether.version.*; import org.sonatype.nexus.proxy.item.*; import org.sonatype.nexus.proxy.maven.gav.*; | [
"com.google.common",
"java.util",
"org.sonatype.aether",
"org.sonatype.nexus"
] | com.google.common; java.util; org.sonatype.aether; org.sonatype.nexus; | 1,167,359 |
private void executeAsynchronously(Runnable runnable) {
this.threadExecutor.execute(runnable);
}
private static class CacheWriter implements Runnable {
private final FileManager fileManager;
private final File fileToWrite;
private final String fileContent;
CacheWriter(FileManager fileManager, File fileToWrite, String fileContent) {
this.fileManager = fileManager;
this.fileToWrite = fileToWrite;
this.fileContent = fileContent;
} | void function(Runnable runnable) { this.threadExecutor.execute(runnable); } private static class CacheWriter implements Runnable { private final FileManager fileManager; private final File fileToWrite; private final String fileContent; CacheWriter(FileManager fileManager, File fileToWrite, String fileContent) { this.fileManager = fileManager; this.fileToWrite = fileToWrite; this.fileContent = fileContent; } | /**
* Executes a {@link Runnable} in another Thread.
*
* @param runnable {@link Runnable} to execute
*/ | Executes a <code>Runnable</code> in another Thread | executeAsynchronously | {
"repo_name": "novemio/CleanMvpArchitecture",
"path": "app/src/main/java/com/xix/cleanMvpArchitecture/data/cache/DataCacheImpl.java",
"license": "apache-2.0",
"size": 6718
} | [
"com.xix.cleanMvpArchitecture.data.cache.fileManager.FileManager",
"java.io.File"
] | import com.xix.cleanMvpArchitecture.data.cache.fileManager.FileManager; import java.io.File; | import com.xix.*; import java.io.*; | [
"com.xix",
"java.io"
] | com.xix; java.io; | 774,652 |
public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox)
{
fillWithBlocks(par1World, par3StructureBoundingBox, 0, 3, 0, 4, 4, 18, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
fillWithBlocks(par1World, par3StructureBoundingBox, 1, 5, 0, 3, 7, 18, 0, 0, false);
fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5, 0, 0, 5, 18, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
fillWithBlocks(par1World, par3StructureBoundingBox, 4, 5, 0, 4, 5, 18, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 0, 4, 2, 5, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 13, 4, 2, 18, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 4, 1, 3, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 15, 4, 1, 18, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
for (int i = 0; i <= 4; i++)
{
for (int j = 0; j <= 2; j++)
{
fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, i, -1, j, par3StructureBoundingBox);
fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, i, -1, 18 - j, par3StructureBoundingBox);
}
}
fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 1, 0, 4, 1, Block.netherFence.blockID, Block.netherFence.blockID, false);
fillWithBlocks(par1World, par3StructureBoundingBox, 0, 3, 4, 0, 4, 4, Block.netherFence.blockID, Block.netherFence.blockID, false);
fillWithBlocks(par1World, par3StructureBoundingBox, 0, 3, 14, 0, 4, 14, Block.netherFence.blockID, Block.netherFence.blockID, false);
fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 17, 0, 4, 17, Block.netherFence.blockID, Block.netherFence.blockID, false);
fillWithBlocks(par1World, par3StructureBoundingBox, 4, 1, 1, 4, 4, 1, Block.netherFence.blockID, Block.netherFence.blockID, false);
fillWithBlocks(par1World, par3StructureBoundingBox, 4, 3, 4, 4, 4, 4, Block.netherFence.blockID, Block.netherFence.blockID, false);
fillWithBlocks(par1World, par3StructureBoundingBox, 4, 3, 14, 4, 4, 14, Block.netherFence.blockID, Block.netherFence.blockID, false);
fillWithBlocks(par1World, par3StructureBoundingBox, 4, 1, 17, 4, 4, 17, Block.netherFence.blockID, Block.netherFence.blockID, false);
return true;
} | boolean function(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) { fillWithBlocks(par1World, par3StructureBoundingBox, 0, 3, 0, 4, 4, 18, Block.netherBrick.blockID, Block.netherBrick.blockID, false); fillWithBlocks(par1World, par3StructureBoundingBox, 1, 5, 0, 3, 7, 18, 0, 0, false); fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5, 0, 0, 5, 18, Block.netherBrick.blockID, Block.netherBrick.blockID, false); fillWithBlocks(par1World, par3StructureBoundingBox, 4, 5, 0, 4, 5, 18, Block.netherBrick.blockID, Block.netherBrick.blockID, false); fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 0, 4, 2, 5, Block.netherBrick.blockID, Block.netherBrick.blockID, false); fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 13, 4, 2, 18, Block.netherBrick.blockID, Block.netherBrick.blockID, false); fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 4, 1, 3, Block.netherBrick.blockID, Block.netherBrick.blockID, false); fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 15, 4, 1, 18, Block.netherBrick.blockID, Block.netherBrick.blockID, false); for (int i = 0; i <= 4; i++) { for (int j = 0; j <= 2; j++) { fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, i, -1, j, par3StructureBoundingBox); fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, i, -1, 18 - j, par3StructureBoundingBox); } } fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 1, 0, 4, 1, Block.netherFence.blockID, Block.netherFence.blockID, false); fillWithBlocks(par1World, par3StructureBoundingBox, 0, 3, 4, 0, 4, 4, Block.netherFence.blockID, Block.netherFence.blockID, false); fillWithBlocks(par1World, par3StructureBoundingBox, 0, 3, 14, 0, 4, 14, Block.netherFence.blockID, Block.netherFence.blockID, false); fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 17, 0, 4, 17, Block.netherFence.blockID, Block.netherFence.blockID, false); fillWithBlocks(par1World, par3StructureBoundingBox, 4, 1, 1, 4, 4, 1, Block.netherFence.blockID, Block.netherFence.blockID, false); fillWithBlocks(par1World, par3StructureBoundingBox, 4, 3, 4, 4, 4, 4, Block.netherFence.blockID, Block.netherFence.blockID, false); fillWithBlocks(par1World, par3StructureBoundingBox, 4, 3, 14, 4, 4, 14, Block.netherFence.blockID, Block.netherFence.blockID, false); fillWithBlocks(par1World, par3StructureBoundingBox, 4, 1, 17, 4, 4, 17, Block.netherFence.blockID, Block.netherFence.blockID, false); return true; } | /**
* second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at
* the end, it adds Fences...
*/ | second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at the end, it adds Fences.. | addComponentParts | {
"repo_name": "sethten/MoDesserts",
"path": "mcp50/src/minecraft_server/net/minecraft/src/ComponentNetherBridgeStraight.java",
"license": "gpl-3.0",
"size": 4424
} | [
"java.util.Random"
] | import java.util.Random; | import java.util.*; | [
"java.util"
] | java.util; | 189,301 |
public static CandidateEntry findByC_U_First(long companyId, long userId,
OrderByComparator<CandidateEntry> orderByComparator)
throws com.liferay.micro.maintainance.candidate.exception.NoSuchEntryException {
return getPersistence()
.findByC_U_First(companyId, userId, orderByComparator);
} | static CandidateEntry function(long companyId, long userId, OrderByComparator<CandidateEntry> orderByComparator) throws com.liferay.micro.maintainance.candidate.exception.NoSuchEntryException { return getPersistence() .findByC_U_First(companyId, userId, orderByComparator); } | /**
* Returns the first candidate entry in the ordered set where companyId = ? and userId = ?.
*
* @param companyId the company ID
* @param userId the user ID
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the first matching candidate entry
* @throws NoSuchEntryException if a matching candidate entry could not be found
*/ | Returns the first candidate entry in the ordered set where companyId = ? and userId = ? | findByC_U_First | {
"repo_name": "moltam89/OWXP",
"path": "modules/micro-maintainance-candidate/micro-maintainance-candidate-api/src/main/java/com/liferay/micro/maintainance/candidate/service/persistence/CandidateEntryUtil.java",
"license": "gpl-3.0",
"size": 103522
} | [
"com.liferay.micro.maintainance.candidate.model.CandidateEntry",
"com.liferay.portal.kernel.util.OrderByComparator"
] | import com.liferay.micro.maintainance.candidate.model.CandidateEntry; import com.liferay.portal.kernel.util.OrderByComparator; | import com.liferay.micro.maintainance.candidate.model.*; import com.liferay.portal.kernel.util.*; | [
"com.liferay.micro",
"com.liferay.portal"
] | com.liferay.micro; com.liferay.portal; | 1,684,289 |
public static java.util.List extractActivityActionList(ims.domain.ILightweightDomainFactory domainFactory, ims.dtomove.vo.ActivityActionVoCollection voCollection)
{
return extractActivityActionList(domainFactory, voCollection, null, new HashMap());
}
| static java.util.List function(ims.domain.ILightweightDomainFactory domainFactory, ims.dtomove.vo.ActivityActionVoCollection voCollection) { return extractActivityActionList(domainFactory, voCollection, null, new HashMap()); } | /**
* Create the ims.dto_move.domain.objects.ActivityAction list from the value object collection.
* @param domainFactory - used to create existing (persistent) domain objects.
* @param voCollection - the collection of value objects
*/ | Create the ims.dto_move.domain.objects.ActivityAction list from the value object collection | extractActivityActionList | {
"repo_name": "FreudianNM/openMAXIMS",
"path": "Source Library/openmaxims_workspace/ValueObjects/src/ims/dtomove/vo/domain/ActivityActionVoAssembler.java",
"license": "agpl-3.0",
"size": 18425
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 1,515,235 |
@Override
protected void setFields( BaseFileField... fields ) throws Exception {
throw new RuntimeException( "Not implemented" );
} | void function( BaseFileField... fields ) throws Exception { throw new RuntimeException( STR ); } | /**
* For BaseFileInput fields.
*/ | For BaseFileInput fields | setFields | {
"repo_name": "tkafalas/pentaho-kettle",
"path": "engine/src/test/java/org/pentaho/di/trans/steps/fixedinput/BaseFixedParsingTest.java",
"license": "apache-2.0",
"size": 2910
} | [
"org.pentaho.di.trans.steps.file.BaseFileField"
] | import org.pentaho.di.trans.steps.file.BaseFileField; | import org.pentaho.di.trans.steps.file.*; | [
"org.pentaho.di"
] | org.pentaho.di; | 1,217,901 |
public UUID setupContinuousDeployment(
final ContinuousDeploymentSetupData configData,
final String project) {
final UUID locationId = UUID.fromString("c5788899-1e84-439b-b5f9-dbc10ecffe24"); //$NON-NLS-1$
final ApiResourceVersion apiVersion = new ApiResourceVersion("3.1-preview.2"); //$NON-NLS-1$
final Map<String, Object> routeValues = new HashMap<String, Object>();
routeValues.put("project", project); //$NON-NLS-1$
final VssRestRequest httpRequest = super.createRequest(HttpMethod.POST,
locationId,
routeValues,
apiVersion,
configData,
VssMediaTypes.APPLICATION_JSON_TYPE,
VssMediaTypes.APPLICATION_JSON_TYPE);
return super.sendRequest(httpRequest, UUID.class);
} | UUID function( final ContinuousDeploymentSetupData configData, final String project) { final UUID locationId = UUID.fromString(STR); final ApiResourceVersion apiVersion = new ApiResourceVersion(STR); final Map<String, Object> routeValues = new HashMap<String, Object>(); routeValues.put(STR, project); final VssRestRequest httpRequest = super.createRequest(HttpMethod.POST, locationId, routeValues, apiVersion, configData, VssMediaTypes.APPLICATION_JSON_TYPE, VssMediaTypes.APPLICATION_JSON_TYPE); return super.sendRequest(httpRequest, UUID.class); } | /**
* [Preview API 3.1-preview.2]
*
* @param configData
*
* @param project
* Project ID or project name
* @return UUID
*/ | [Preview API 3.1-preview.2] | setupContinuousDeployment | {
"repo_name": "Microsoft/vso-httpclient-java",
"path": "Rest/alm-releasemanagement-client/src/main/generated/com/microsoft/alm/visualstudio/services/releasemanagement/webapi/ReleaseHttpClientBase.java",
"license": "mit",
"size": 186198
} | [
"com.microsoft.alm.client.HttpMethod",
"com.microsoft.alm.client.VssMediaTypes",
"com.microsoft.alm.client.VssRestRequest",
"com.microsoft.alm.visualstudio.services.releasemanagement.webapi.contracts.ContinuousDeploymentSetupData",
"com.microsoft.alm.visualstudio.services.webapi.ApiResourceVersion",
"java.util.HashMap",
"java.util.Map",
"java.util.UUID"
] | import com.microsoft.alm.client.HttpMethod; import com.microsoft.alm.client.VssMediaTypes; import com.microsoft.alm.client.VssRestRequest; import com.microsoft.alm.visualstudio.services.releasemanagement.webapi.contracts.ContinuousDeploymentSetupData; import com.microsoft.alm.visualstudio.services.webapi.ApiResourceVersion; import java.util.HashMap; import java.util.Map; import java.util.UUID; | import com.microsoft.alm.client.*; import com.microsoft.alm.visualstudio.services.releasemanagement.webapi.contracts.*; import com.microsoft.alm.visualstudio.services.webapi.*; import java.util.*; | [
"com.microsoft.alm",
"java.util"
] | com.microsoft.alm; java.util; | 321,807 |
@Ignore("This test will fail until KULRICE-752 is resolved")
@Test public void testInitiatorRoleDisapprove() throws WorkflowException {
// test initiator disapproval of their own doc via InitiatorRoleAttribute
WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("arh14"), "InitiatorRoleApprovalTest");
document.route("routing document");
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("arh14"), document.getDocumentId());
document.disapprove("disapproving the document");
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("arh14"), document.getDocumentId());
assertFalse("Initiator should not have an Ack request from disapproval because they were the disapprover user", document.isAcknowledgeRequested());
} | @Ignore(STR) @Test void function() throws WorkflowException { WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("arh14"), STR); document.route(STR); document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("arh14"), document.getDocumentId()); document.disapprove(STR); document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("arh14"), document.getDocumentId()); assertFalse(STR, document.isAcknowledgeRequested()); } | /**
* Tests whether the initator who disapproved a doc gets an acknowledgement
*
*/ | Tests whether the initator who disapproved a doc gets an acknowledgement | testInitiatorRoleDisapprove | {
"repo_name": "sbower/kuali-rice-1",
"path": "it/kew/src/test/java/org/kuali/rice/kew/actions/DisapproveActionTest.java",
"license": "apache-2.0",
"size": 12427
} | [
"org.junit.Assert",
"org.junit.Ignore",
"org.junit.Test",
"org.kuali.rice.kew.api.WorkflowDocument",
"org.kuali.rice.kew.api.WorkflowDocumentFactory",
"org.kuali.rice.kew.exception.WorkflowException"
] | import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; import org.kuali.rice.kew.api.WorkflowDocument; import org.kuali.rice.kew.api.WorkflowDocumentFactory; import org.kuali.rice.kew.exception.WorkflowException; | import org.junit.*; import org.kuali.rice.kew.api.*; import org.kuali.rice.kew.exception.*; | [
"org.junit",
"org.kuali.rice"
] | org.junit; org.kuali.rice; | 1,725,218 |
private String initializerKey(final ASTNode method)
{
final int lineNumber = ASTTools.lineNumber(method);
final StringBuffer buffer = new StringBuffer("");
// type or instance initializer
if (method instanceof Initializer)
{
final boolean isStatic = Modifier.isStatic(((Initializer) method).getModifiers());
buffer.append(isStatic ? "<clinit@" : "<init@");
buffer.append(lineNumber);
buffer.append(">()");
return buffer.toString();
}
// field or local variable initializer
if (method instanceof Expression)
{
final VariableDeclarationFragment fragment = (VariableDeclarationFragment) method.getParent();
final IVariableBinding variable = fragment.resolveBinding();
// field initializers are part of static or instance initializers
if (variable.isField())
{
final boolean isStatic = Modifier.isStatic(variable.getModifiers());
buffer.append(isStatic ? "<clinit@" : "<init@");
buffer.append(lineNumber);
buffer.append(">()");
return buffer.toString();
}
// local variable initializers are executed during method execution
else
{
buffer.append("<vinit@");
buffer.append(lineNumber);
buffer.append(">()");
return buffer.toString();
}
}
// unknown initializer
return "<_init@" + lineNumber + ">()";
} | String function(final ASTNode method) { final int lineNumber = ASTTools.lineNumber(method); final StringBuffer buffer = new StringBuffer(STR<clinit@STR<init@STR>()STR<clinit@STR<init@STR>()STR<vinit@STR>()STR<_init@STR>()"; } | /**
* During static analysis, each initializer must be distinguished since they may appear in many
* different syntactic structures. At run-time, static initializers are executed during class
* load, instance initializers during object creation, and local initializers when their source
* lines are executed.
*/ | During static analysis, each initializer must be distinguished since they may appear in many different syntactic structures. At run-time, static initializers are executed during class load, instance initializers during object creation, and local initializers when their source lines are executed | initializerKey | {
"repo_name": "UBPL/jive",
"path": "edu.buffalo.cse.jive.core.ast/src/edu/buffalo/cse/jive/internal/core/ast/ASTTools.java",
"license": "epl-1.0",
"size": 24711
} | [
"org.eclipse.jdt.core.dom.ASTNode"
] | import org.eclipse.jdt.core.dom.ASTNode; | import org.eclipse.jdt.core.dom.*; | [
"org.eclipse.jdt"
] | org.eclipse.jdt; | 199,410 |
public Map<String, SortedMap<Float, CmsWorkplaceEditorConfiguration>> getConfigurableEditors() {
Map<String, SortedMap<Float, CmsWorkplaceEditorConfiguration>> configurableEditors = new HashMap<String, SortedMap<Float, CmsWorkplaceEditorConfiguration>>();
Iterator<CmsWorkplaceEditorConfiguration> i = m_editorConfigurations.iterator();
while (i.hasNext()) {
CmsWorkplaceEditorConfiguration currentConfig = i.next();
// get all resource types specified for the current editor configuration
Iterator<String> k = currentConfig.getResourceTypes().keySet().iterator();
while (k.hasNext()) {
// key is the current resource type of the configuration
String key = k.next();
// check if the current resource type is only a reference to another resource type
CmsExplorerTypeSettings settings = OpenCms.getWorkplaceManager().getExplorerTypeSetting(key);
if ((settings == null) || CmsStringUtil.isNotEmpty(settings.getReference())) {
// skip this resource type
continue;
}
if ((currentConfig.getMappingForResourceType(key) == null)
|| currentConfig.getMappingForResourceType(key).equals(key)) {
// editor is configurable for specified resource type
SortedMap<Float, CmsWorkplaceEditorConfiguration> editorConfigs = configurableEditors.get(key);
if (editorConfigs == null) {
// no configuration map present for resource type, create one
editorConfigs = new TreeMap<Float, CmsWorkplaceEditorConfiguration>();
}
// put the current editor configuration to the resource map with ranking value as key
editorConfigs.put(new Float(currentConfig.getRankingForResourceType(key)), currentConfig);
// put the resource map to the result map with resource type as key
configurableEditors.put(key, editorConfigs);
}
}
}
return configurableEditors;
} | Map<String, SortedMap<Float, CmsWorkplaceEditorConfiguration>> function() { Map<String, SortedMap<Float, CmsWorkplaceEditorConfiguration>> configurableEditors = new HashMap<String, SortedMap<Float, CmsWorkplaceEditorConfiguration>>(); Iterator<CmsWorkplaceEditorConfiguration> i = m_editorConfigurations.iterator(); while (i.hasNext()) { CmsWorkplaceEditorConfiguration currentConfig = i.next(); Iterator<String> k = currentConfig.getResourceTypes().keySet().iterator(); while (k.hasNext()) { String key = k.next(); CmsExplorerTypeSettings settings = OpenCms.getWorkplaceManager().getExplorerTypeSetting(key); if ((settings == null) CmsStringUtil.isNotEmpty(settings.getReference())) { continue; } if ((currentConfig.getMappingForResourceType(key) == null) currentConfig.getMappingForResourceType(key).equals(key)) { SortedMap<Float, CmsWorkplaceEditorConfiguration> editorConfigs = configurableEditors.get(key); if (editorConfigs == null) { editorConfigs = new TreeMap<Float, CmsWorkplaceEditorConfiguration>(); } editorConfigs.put(new Float(currentConfig.getRankingForResourceType(key)), currentConfig); configurableEditors.put(key, editorConfigs); } } } return configurableEditors; } | /**
* Returns a map of configurable editors for the workplace preferences dialog.<p>
*
* This map has the resource type name as key, the value is a sorted map with
* the ranking as key and a CmsWorkplaceEditorConfiguration object as value.<p>
*
* @return configurable editors for the workplace preferences dialog
*/ | Returns a map of configurable editors for the workplace preferences dialog. This map has the resource type name as key, the value is a sorted map with the ranking as key and a CmsWorkplaceEditorConfiguration object as value | getConfigurableEditors | {
"repo_name": "mediaworx/opencms-core",
"path": "src/org/opencms/workplace/editors/CmsWorkplaceEditorManager.java",
"license": "lgpl-2.1",
"size": 18281
} | [
"java.util.HashMap",
"java.util.Iterator",
"java.util.Map",
"java.util.SortedMap",
"java.util.TreeMap",
"org.opencms.main.OpenCms",
"org.opencms.util.CmsStringUtil",
"org.opencms.workplace.explorer.CmsExplorerTypeSettings"
] | import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.SortedMap; import java.util.TreeMap; import org.opencms.main.OpenCms; import org.opencms.util.CmsStringUtil; import org.opencms.workplace.explorer.CmsExplorerTypeSettings; | import java.util.*; import org.opencms.main.*; import org.opencms.util.*; import org.opencms.workplace.explorer.*; | [
"java.util",
"org.opencms.main",
"org.opencms.util",
"org.opencms.workplace"
] | java.util; org.opencms.main; org.opencms.util; org.opencms.workplace; | 2,843,924 |
HTTPMixIn soapMixIn = new HTTPMixIn();
soapMixIn.initialize();
try {
String port = System.getProperty("org.switchyard.component.soap.client.port", "8080");
String result = soapMixIn.postFile("http://localhost:" + port + "/quickstart-bean/OrderService", XML);
System.out.println("SOAP Reply:\n" + result);
} finally {
soapMixIn.uninitialize();
}
} | HTTPMixIn soapMixIn = new HTTPMixIn(); soapMixIn.initialize(); try { String port = System.getProperty(STR, "8080"); String result = soapMixIn.postFile(STRSOAP Reply:\n" + result); } finally { soapMixIn.uninitialize(); } } | /**
* Only execution point for this application.
* @param ignored not used.
* @throws Exception if something goes wrong.
*/ | Only execution point for this application | main | {
"repo_name": "jboss-fuse/quickstarts",
"path": "switchyard/bean-service/src/test/java/org/switchyard/quickstarts/bean/service/BeanClient.java",
"license": "apache-2.0",
"size": 1821
} | [
"org.switchyard.component.test.mixins.http.HTTPMixIn"
] | import org.switchyard.component.test.mixins.http.HTTPMixIn; | import org.switchyard.component.test.mixins.http.*; | [
"org.switchyard.component"
] | org.switchyard.component; | 2,146,972 |
@Nullable private GridCacheGateway<K, V> gate() {
GridCacheContext<K, V> cacheContext = delegate.context();
return cacheContext != null ? cacheContext.gate() : null;
} | @Nullable GridCacheGateway<K, V> function() { GridCacheContext<K, V> cacheContext = delegate.context(); return cacheContext != null ? cacheContext.gate() : null; } | /**
* Safely get CacheGateway.
*
* @return Cache Gateway.
*/ | Safely get CacheGateway | gate | {
"repo_name": "voipp/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GatewayProtectedCacheProxy.java",
"license": "apache-2.0",
"size": 43639
} | [
"org.jetbrains.annotations.Nullable"
] | import org.jetbrains.annotations.Nullable; | import org.jetbrains.annotations.*; | [
"org.jetbrains.annotations"
] | org.jetbrains.annotations; | 1,403,862 |
File getSource(); | File getSource(); | /**
* The location on the file system which this mod came from
*/ | The location on the file system which this mod came from | getSource | {
"repo_name": "Scrik/Cauldron-1",
"path": "eclipse/cauldron/src/main/java/cpw/mods/fml/common/ModContainer.java",
"license": "gpl-3.0",
"size": 3745
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 2,246,466 |
public static ims.ocrr.orderingresults.domain.objects.OcsOrderSession extractOcsOrderSession(ims.domain.ILightweightDomainFactory domainFactory, ims.ocrr.vo.OcsOrderShortVo valueObject)
{
return extractOcsOrderSession(domainFactory, valueObject, new HashMap());
} | static ims.ocrr.orderingresults.domain.objects.OcsOrderSession function(ims.domain.ILightweightDomainFactory domainFactory, ims.ocrr.vo.OcsOrderShortVo valueObject) { return extractOcsOrderSession(domainFactory, valueObject, new HashMap()); } | /**
* Create the domain object from the value object.
* @param domainFactory - used to create existing (persistent) domain objects.
* @param valueObject - extract the domain object fields from this.
*/ | Create the domain object from the value object | extractOcsOrderSession | {
"repo_name": "open-health-hub/openMAXIMS",
"path": "openmaxims_workspace/ValueObjects/src/ims/ocrr/vo/domain/OcsOrderShortVoAssembler.java",
"license": "agpl-3.0",
"size": 28458
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 2,216,731 |
public VMapInfo getDefaultMapsMenu(String user) throws MapsException; | VMapInfo function(String user) throws MapsException; | /**
* get the default map for specified user in input
* if exists null otherwise
*
* @param user a {@link java.lang.String} object.
* @return a MapMenu object.
* @throws org.opennms.web.map.MapsException if any.
*/ | get the default map for specified user in input if exists null otherwise | getDefaultMapsMenu | {
"repo_name": "vishwaAbhinav/OpenNMS",
"path": "opennms-webapp/src/main/java/org/opennms/web/map/view/Manager.java",
"license": "gpl-2.0",
"size": 8198
} | [
"org.opennms.web.map.MapsException"
] | import org.opennms.web.map.MapsException; | import org.opennms.web.map.*; | [
"org.opennms.web"
] | org.opennms.web; | 2,661,921 |
IntHashtable getCategories() {
final IntHashtable categories = new IntHashtable();
try {
// Read in all records from the Category table
final Statement statement =
_db.createStatement("SELECT * FROM Category");
statement.prepare();
final Cursor cursor = statement.getCursor();
Row row;
int id;
String name;
Category category;
// Iterate through the result set. For each row, create a new
// Category object and add it to the hash table.
while (cursor.next()) {
row = cursor.getRow();
id = row.getInteger(0);
name = row.getString(1);
category = new Category(id, name);
categories.put(id, category);
}
statement.close();
cursor.close();
} catch (final DatabaseException dbe) {
SQLiteDemo.errorDialog(dbe.toString());
} catch (final DataTypeException dte) {
SQLiteDemo.errorDialog(dte.toString());
}
return categories;
}
| IntHashtable getCategories() { final IntHashtable categories = new IntHashtable(); try { final Statement statement = _db.createStatement(STR); statement.prepare(); final Cursor cursor = statement.getCursor(); Row row; int id; String name; Category category; while (cursor.next()) { row = cursor.getRow(); id = row.getInteger(0); name = row.getString(1); category = new Category(id, name); categories.put(id, category); } statement.close(); cursor.close(); } catch (final DatabaseException dbe) { SQLiteDemo.errorDialog(dbe.toString()); } catch (final DataTypeException dte) { SQLiteDemo.errorDialog(dte.toString()); } return categories; } | /**
* Retrieves all records in the Category database table and returns a hash
* table of Category objects.
*
* @return A hash table of Category objects, one for each record in the
* Category table
*/ | Retrieves all records in the Category database table and returns a hash table of Category objects | getCategories | {
"repo_name": "blackberry/JDE-Samples",
"path": "com/rim/samples/device/sqlitedemo/SQLManager.java",
"license": "apache-2.0",
"size": 11351
} | [
"net.rim.device.api.database.Cursor",
"net.rim.device.api.database.DataTypeException",
"net.rim.device.api.database.DatabaseException",
"net.rim.device.api.database.Row",
"net.rim.device.api.database.Statement",
"net.rim.device.api.util.IntHashtable"
] | import net.rim.device.api.database.Cursor; import net.rim.device.api.database.DataTypeException; import net.rim.device.api.database.DatabaseException; import net.rim.device.api.database.Row; import net.rim.device.api.database.Statement; import net.rim.device.api.util.IntHashtable; | import net.rim.device.api.database.*; import net.rim.device.api.util.*; | [
"net.rim.device"
] | net.rim.device; | 46,684 |
void basicInvalidate(EntryEventImpl event) throws EntryNotFoundException {
basicInvalidate(event, isInitialized());
} | void basicInvalidate(EntryEventImpl event) throws EntryNotFoundException { basicInvalidate(event, isInitialized()); } | /**
* Return true if invalidation occurred; false if it did not, for example if it was already
* invalidated
*
* @see DistributedRegion#basicInvalidate(EntryEventImpl)
*/ | Return true if invalidation occurred; false if it did not, for example if it was already invalidated | basicInvalidate | {
"repo_name": "shankarh/geode",
"path": "geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java",
"license": "apache-2.0",
"size": 428183
} | [
"org.apache.geode.cache.EntryNotFoundException"
] | import org.apache.geode.cache.EntryNotFoundException; | import org.apache.geode.cache.*; | [
"org.apache.geode"
] | org.apache.geode; | 2,553,017 |
@Nullable
FailureDetail failureDetail(); | FailureDetail failureDetail(); | /**
* A detailed representation of what failed if {@link #status} is not {@link Status#SUCCESS}, and
* {@code null} otherwise.
*/ | A detailed representation of what failed if <code>#status</code> is not <code>Status#SUCCESS</code>, and null otherwise | failureDetail | {
"repo_name": "cushon/bazel",
"path": "src/main/java/com/google/devtools/build/lib/actions/SpawnResult.java",
"license": "apache-2.0",
"size": 19416
} | [
"com.google.devtools.build.lib.server.FailureDetails"
] | import com.google.devtools.build.lib.server.FailureDetails; | import com.google.devtools.build.lib.server.*; | [
"com.google.devtools"
] | com.google.devtools; | 1,581,823 |
public void onTickInGui(GuiScreen guiScreen)
{
if (guiScreen instanceof GuiMainMenu) //If the GUI is the main menu, reset ticks and world properties.
{
if (!MCA.getInstance().hasCompletedMainMenuTick)
{
//Check for random splash text.
if (Utility.getBooleanWithProbability(10))
{
ObfuscationReflectionHelper.setPrivateValue(GuiMainMenu.class, (GuiMainMenu)guiScreen, "Minecraft Comes Alive!", 4);
}
//Reset world specific data.
MCA.getInstance().hasNotifiedOfBabyReadyToGrow = false;
MCA.getInstance().playerWorldManagerMap.clear();
MCA.getInstance().hasReceivedClientSetup = false;
//Check to see if dialogue should be reloaded.
if (!MCA.getInstance().languageLoaded)
{
MCA.getInstance().getLanguageLoader().loadLanguage(Minecraft.getMinecraft().gameSettings.language);
MCA.getInstance().languageLoaded = true;
}
MCA.getInstance().hasCompletedMainMenuTick = true;
}
}
else if (guiScreen instanceof GuiOptions)
{
//Check to see if dialogue should be reloaded.
if (!MCA.getInstance().languageLoaded)
{
MCA.getInstance().getLanguageLoader().loadLanguage(Minecraft.getMinecraft().gameSettings.language);
MCA.getInstance().languageLoaded = true;
}
}
//If the GUI screen is the Select World screen, empty all world properties.
else if (guiScreen instanceof GuiSelectWorld)
{
WorldPropertiesManager.emptyOldWorldProperties();
}
//If the GUI screen is the Select Language screen, set language loaded to false so
//that it is reloaded.
else if (guiScreen instanceof GuiLanguage)
{
MCA.getInstance().languageLoaded = false;
MCA.getInstance().hasCompletedMainMenuTick = false;
}
//Reset the menu ticks when in the ingame menu.
else if (guiScreen instanceof GuiIngameMenu)
{
MCA.getInstance().hasCompletedMainMenuTick = false;
}
//If it's the original game over screen, override it with MCA's game over screen IN HARDCORE MODE ONLY.
else if (guiScreen instanceof GuiGameOver)
{
final WorldPropertiesManager manager = MCA.getInstance().playerWorldManagerMap.get(Minecraft.getMinecraft().thePlayer.getCommandSenderName());
if (!doEzioComment)
{
final EntityPlayer player = Minecraft.getMinecraft().thePlayer;
final List<Entity> entityList = (List<Entity>) LogicHelper.getAllEntitiesOfTypeWithinDistanceOfEntity(player, EntityPlayerChild.class, 15);
for (final Entity entity : entityList)
{
if (entity instanceof EntityPlayerChild)
{
final EntityPlayerChild playerChild = (EntityPlayerChild)entity;
if (playerChild.familyTree.getIDsWithRelation(EnumRelation.Parent).contains(MCA.getInstance().getIdOfPlayer(player)) &&
!doEzioComment && playerChild.name.equals("Ezio"))
{
doEzioComment = true;
playerChild.say("Requiescat in pace.");
break;
}
}
}
}
if (manager != null && manager.worldProperties.isMonarch)
{
manager.worldProperties.isMonarch = false;
manager.saveWorldProperties();
}
//FIXME
// if (Minecraft.getMinecraft().theWorld.getWorldInfo().isHardcoreModeEnabled() || MCA.getInstance().debugDoSimulateHardcore)
// {
// Minecraft.getMinecraft().displayGuiScreen(new GuiHardcoreGameOver(Minecraft.getMinecraft().thePlayer));
// }
}
//If it's MCA's game over screen, check the player's health as it sometimes remains stuck
//on the screen after the player respawns. If their health is not zero, remove the gui
//screen.
else if (guiScreen instanceof GuiHardcoreGameOver && Minecraft.getMinecraft().thePlayer.getHealth() > 0.0F)
{
Minecraft.getMinecraft().displayGuiScreen(null);
}
} | void function(GuiScreen guiScreen) { if (guiScreen instanceof GuiMainMenu) { if (!MCA.getInstance().hasCompletedMainMenuTick) { if (Utility.getBooleanWithProbability(10)) { ObfuscationReflectionHelper.setPrivateValue(GuiMainMenu.class, (GuiMainMenu)guiScreen, STR, 4); } MCA.getInstance().hasNotifiedOfBabyReadyToGrow = false; MCA.getInstance().playerWorldManagerMap.clear(); MCA.getInstance().hasReceivedClientSetup = false; if (!MCA.getInstance().languageLoaded) { MCA.getInstance().getLanguageLoader().loadLanguage(Minecraft.getMinecraft().gameSettings.language); MCA.getInstance().languageLoaded = true; } MCA.getInstance().hasCompletedMainMenuTick = true; } } else if (guiScreen instanceof GuiOptions) { if (!MCA.getInstance().languageLoaded) { MCA.getInstance().getLanguageLoader().loadLanguage(Minecraft.getMinecraft().gameSettings.language); MCA.getInstance().languageLoaded = true; } } else if (guiScreen instanceof GuiSelectWorld) { WorldPropertiesManager.emptyOldWorldProperties(); } else if (guiScreen instanceof GuiLanguage) { MCA.getInstance().languageLoaded = false; MCA.getInstance().hasCompletedMainMenuTick = false; } else if (guiScreen instanceof GuiIngameMenu) { MCA.getInstance().hasCompletedMainMenuTick = false; } else if (guiScreen instanceof GuiGameOver) { final WorldPropertiesManager manager = MCA.getInstance().playerWorldManagerMap.get(Minecraft.getMinecraft().thePlayer.getCommandSenderName()); if (!doEzioComment) { final EntityPlayer player = Minecraft.getMinecraft().thePlayer; final List<Entity> entityList = (List<Entity>) LogicHelper.getAllEntitiesOfTypeWithinDistanceOfEntity(player, EntityPlayerChild.class, 15); for (final Entity entity : entityList) { if (entity instanceof EntityPlayerChild) { final EntityPlayerChild playerChild = (EntityPlayerChild)entity; if (playerChild.familyTree.getIDsWithRelation(EnumRelation.Parent).contains(MCA.getInstance().getIdOfPlayer(player)) && !doEzioComment && playerChild.name.equals("Ezio")) { doEzioComment = true; playerChild.say(STR); break; } } } } if (manager != null && manager.worldProperties.isMonarch) { manager.worldProperties.isMonarch = false; manager.saveWorldProperties(); } } else if (guiScreen instanceof GuiHardcoreGameOver && Minecraft.getMinecraft().thePlayer.getHealth() > 0.0F) { Minecraft.getMinecraft().displayGuiScreen(null); } } | /**
* Fires once per tick when a GUI screen is open.
*
* @param guiScreen The GUI that is currently open.
*/ | Fires once per tick when a GUI screen is open | onTickInGui | {
"repo_name": "MrPonyCaptain/minecraft-comes-alive",
"path": "Minecraft/1.7.10/src/main/java/mca/core/forge/ClientTickHandler.java",
"license": "gpl-3.0",
"size": 5474
} | [
"com.radixshock.radixcore.logic.LogicHelper",
"java.util.List",
"net.minecraft.client.Minecraft",
"net.minecraft.client.gui.GuiGameOver",
"net.minecraft.client.gui.GuiIngameMenu",
"net.minecraft.client.gui.GuiLanguage",
"net.minecraft.client.gui.GuiMainMenu",
"net.minecraft.client.gui.GuiOptions",
"net.minecraft.client.gui.GuiScreen",
"net.minecraft.client.gui.GuiSelectWorld",
"net.minecraft.entity.Entity",
"net.minecraft.entity.player.EntityPlayer"
] | import com.radixshock.radixcore.logic.LogicHelper; import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGameOver; import net.minecraft.client.gui.GuiIngameMenu; import net.minecraft.client.gui.GuiLanguage; import net.minecraft.client.gui.GuiMainMenu; import net.minecraft.client.gui.GuiOptions; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiSelectWorld; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; | import com.radixshock.radixcore.logic.*; import java.util.*; import net.minecraft.client.*; import net.minecraft.client.gui.*; import net.minecraft.entity.*; import net.minecraft.entity.player.*; | [
"com.radixshock.radixcore",
"java.util",
"net.minecraft.client",
"net.minecraft.entity"
] | com.radixshock.radixcore; java.util; net.minecraft.client; net.minecraft.entity; | 2,869,348 |
public Container getServerGui(int ID, EntityPlayer player, World world, int x, int y, int z)
{
TileEntity tileEntity = world.getTileEntity(x, y, z);
switch(ID)
{
case 0:
return new ContainerDictionary(player.inventory);
case 2:
return new ContainerDigitalMiner(player.inventory, (TileEntityDigitalMiner)tileEntity);
case 3:
return new ContainerElectricMachine(player.inventory, (TileEntityElectricMachine)tileEntity);
case 4:
return new ContainerAdvancedElectricMachine(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity);
case 5:
return new ContainerAdvancedElectricMachine(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity);
case 6:
return new ContainerElectricMachine(player.inventory, (TileEntityElectricMachine)tileEntity);
case 7:
return new ContainerRotaryCondensentrator(player.inventory, (TileEntityRotaryCondensentrator)tileEntity);
case 8:
return new ContainerEnergyCube(player.inventory, (TileEntityEnergyCube)tileEntity);
case 9:
return new ContainerNull(player, (TileEntityContainerBlock)tileEntity);
case 10:
return new ContainerGasTank(player.inventory, (TileEntityGasTank)tileEntity);
case 11:
return new ContainerFactory(player.inventory, (TileEntityFactory)tileEntity);
case 12:
return new ContainerMetallurgicInfuser(player.inventory, (TileEntityMetallurgicInfuser)tileEntity);
case 13:
return new ContainerTeleporter(player.inventory, (TileEntityTeleporter)tileEntity);
case 14:
ItemStack itemStack = player.getCurrentEquippedItem();
if(itemStack != null && itemStack.getItem() instanceof ItemPortableTeleporter)
{
return new ContainerNull();
}
case 15:
return new ContainerAdvancedElectricMachine(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity);
case 16:
return new ContainerElectricMachine(player.inventory, (TileEntityElectricMachine)tileEntity);
case 17:
return new ContainerElectricPump(player.inventory, (TileEntityElectricPump)tileEntity);
case 18:
return new ContainerDynamicTank(player.inventory, (TileEntityDynamicTank)tileEntity);
case 21:
EntityRobit robit = (EntityRobit)world.getEntityByID(x);
if(robit != null)
{
return new ContainerRobitMain(player.inventory, robit);
}
case 22:
return new ContainerRobitCrafting(player.inventory, world);
case 23:
EntityRobit robit1 = (EntityRobit)world.getEntityByID(x);
if(robit1 != null)
{
return new ContainerRobitInventory(player.inventory, robit1);
}
case 24:
EntityRobit robit2 = (EntityRobit)world.getEntityByID(x);
if(robit2 != null)
{
return new ContainerRobitSmelting(player.inventory, robit2);
}
case 25:
return new ContainerRobitRepair(player.inventory, world);
case 26:
return new ContainerNull(player, (TileEntityContainerBlock)tileEntity);
case 27:
return new ContainerFilter(player.inventory, (TileEntityContainerBlock)tileEntity);
case 28:
return new ContainerFilter(player.inventory, (TileEntityContainerBlock)tileEntity);
case 29:
return new ContainerChemicalOxidizer(player.inventory, (TileEntityChemicalOxidizer)tileEntity);
case 30:
return new ContainerChemicalInfuser(player.inventory, (TileEntityChemicalInfuser)tileEntity);
case 31:
return new ContainerAdvancedElectricMachine(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity);
case 32:
return new ContainerElectrolyticSeparator(player.inventory, (TileEntityElectrolyticSeparator)tileEntity);
case 33:
return new ContainerSolarEvaporationController(player.inventory, (TileEntitySolarEvaporationController)tileEntity);
case 34:
return new ContainerChanceMachine(player.inventory, (TileEntityChanceMachine)tileEntity);
case 35:
return new ContainerChemicalDissolutionChamber(player.inventory, (TileEntityChemicalDissolutionChamber)tileEntity);
case 36:
return new ContainerChemicalWasher(player.inventory, (TileEntityChemicalWasher)tileEntity);
case 37:
return new ContainerChemicalCrystallizer(player.inventory, (TileEntityChemicalCrystallizer)tileEntity);
case 39:
return new ContainerSeismicVibrator(player.inventory, (TileEntitySeismicVibrator)tileEntity);
case 40:
return new ContainerPRC(player.inventory, (TileEntityPRC)tileEntity);
case 41:
return new ContainerPortableTank(player.inventory, (TileEntityPortableTank)tileEntity);
case 42:
return new ContainerFluidicPlenisher(player.inventory, (TileEntityFluidicPlenisher)tileEntity);
case 43:
return new ContainerUpgradeManagement(player.inventory, (IUpgradeTile)tileEntity);
case 44:
return new ContainerLaserAmplifier(player.inventory, (TileEntityLaserAmplifier)tileEntity);
case 45:
return new ContainerLaserTractorBeam(player.inventory, (TileEntityLaserTractorBeam)tileEntity);
case 46:
return new ContainerNull(player, (TileEntityContainerBlock)tileEntity);
case 47:
return new ContainerSolarNeutronActivator(player.inventory, (TileEntitySolarNeutronActivator)tileEntity);
case 48:
return new ContainerNull(player, (TileEntityContainerBlock)tileEntity);
case 49:
return new ContainerInductionMatrix(player.inventory, (TileEntityInductionCasing)tileEntity);
case 50:
return new ContainerNull(player, (TileEntityContainerBlock)tileEntity);
case 51:
return new ContainerNull(player, (TileEntityContainerBlock)tileEntity);
case 52:
return new ContainerOredictionificator(player.inventory, (TileEntityOredictionificator)tileEntity);
}
return null;
}
public void preInit() {} | Container function(int ID, EntityPlayer player, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); switch(ID) { case 0: return new ContainerDictionary(player.inventory); case 2: return new ContainerDigitalMiner(player.inventory, (TileEntityDigitalMiner)tileEntity); case 3: return new ContainerElectricMachine(player.inventory, (TileEntityElectricMachine)tileEntity); case 4: return new ContainerAdvancedElectricMachine(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity); case 5: return new ContainerAdvancedElectricMachine(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity); case 6: return new ContainerElectricMachine(player.inventory, (TileEntityElectricMachine)tileEntity); case 7: return new ContainerRotaryCondensentrator(player.inventory, (TileEntityRotaryCondensentrator)tileEntity); case 8: return new ContainerEnergyCube(player.inventory, (TileEntityEnergyCube)tileEntity); case 9: return new ContainerNull(player, (TileEntityContainerBlock)tileEntity); case 10: return new ContainerGasTank(player.inventory, (TileEntityGasTank)tileEntity); case 11: return new ContainerFactory(player.inventory, (TileEntityFactory)tileEntity); case 12: return new ContainerMetallurgicInfuser(player.inventory, (TileEntityMetallurgicInfuser)tileEntity); case 13: return new ContainerTeleporter(player.inventory, (TileEntityTeleporter)tileEntity); case 14: ItemStack itemStack = player.getCurrentEquippedItem(); if(itemStack != null && itemStack.getItem() instanceof ItemPortableTeleporter) { return new ContainerNull(); } case 15: return new ContainerAdvancedElectricMachine(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity); case 16: return new ContainerElectricMachine(player.inventory, (TileEntityElectricMachine)tileEntity); case 17: return new ContainerElectricPump(player.inventory, (TileEntityElectricPump)tileEntity); case 18: return new ContainerDynamicTank(player.inventory, (TileEntityDynamicTank)tileEntity); case 21: EntityRobit robit = (EntityRobit)world.getEntityByID(x); if(robit != null) { return new ContainerRobitMain(player.inventory, robit); } case 22: return new ContainerRobitCrafting(player.inventory, world); case 23: EntityRobit robit1 = (EntityRobit)world.getEntityByID(x); if(robit1 != null) { return new ContainerRobitInventory(player.inventory, robit1); } case 24: EntityRobit robit2 = (EntityRobit)world.getEntityByID(x); if(robit2 != null) { return new ContainerRobitSmelting(player.inventory, robit2); } case 25: return new ContainerRobitRepair(player.inventory, world); case 26: return new ContainerNull(player, (TileEntityContainerBlock)tileEntity); case 27: return new ContainerFilter(player.inventory, (TileEntityContainerBlock)tileEntity); case 28: return new ContainerFilter(player.inventory, (TileEntityContainerBlock)tileEntity); case 29: return new ContainerChemicalOxidizer(player.inventory, (TileEntityChemicalOxidizer)tileEntity); case 30: return new ContainerChemicalInfuser(player.inventory, (TileEntityChemicalInfuser)tileEntity); case 31: return new ContainerAdvancedElectricMachine(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity); case 32: return new ContainerElectrolyticSeparator(player.inventory, (TileEntityElectrolyticSeparator)tileEntity); case 33: return new ContainerSolarEvaporationController(player.inventory, (TileEntitySolarEvaporationController)tileEntity); case 34: return new ContainerChanceMachine(player.inventory, (TileEntityChanceMachine)tileEntity); case 35: return new ContainerChemicalDissolutionChamber(player.inventory, (TileEntityChemicalDissolutionChamber)tileEntity); case 36: return new ContainerChemicalWasher(player.inventory, (TileEntityChemicalWasher)tileEntity); case 37: return new ContainerChemicalCrystallizer(player.inventory, (TileEntityChemicalCrystallizer)tileEntity); case 39: return new ContainerSeismicVibrator(player.inventory, (TileEntitySeismicVibrator)tileEntity); case 40: return new ContainerPRC(player.inventory, (TileEntityPRC)tileEntity); case 41: return new ContainerPortableTank(player.inventory, (TileEntityPortableTank)tileEntity); case 42: return new ContainerFluidicPlenisher(player.inventory, (TileEntityFluidicPlenisher)tileEntity); case 43: return new ContainerUpgradeManagement(player.inventory, (IUpgradeTile)tileEntity); case 44: return new ContainerLaserAmplifier(player.inventory, (TileEntityLaserAmplifier)tileEntity); case 45: return new ContainerLaserTractorBeam(player.inventory, (TileEntityLaserTractorBeam)tileEntity); case 46: return new ContainerNull(player, (TileEntityContainerBlock)tileEntity); case 47: return new ContainerSolarNeutronActivator(player.inventory, (TileEntitySolarNeutronActivator)tileEntity); case 48: return new ContainerNull(player, (TileEntityContainerBlock)tileEntity); case 49: return new ContainerInductionMatrix(player.inventory, (TileEntityInductionCasing)tileEntity); case 50: return new ContainerNull(player, (TileEntityContainerBlock)tileEntity); case 51: return new ContainerNull(player, (TileEntityContainerBlock)tileEntity); case 52: return new ContainerOredictionificator(player.inventory, (TileEntityOredictionificator)tileEntity); } return null; } public void preInit() {} | /**
* Get the container for a GUI. Common.
* @param ID - gui ID
* @param player - player that opened the GUI
* @param world - world the GUI was opened in
* @param x - gui's x position
* @param y - gui's y position
* @param z - gui's z position
* @return the Container of the GUI
*/ | Get the container for a GUI. Common | getServerGui | {
"repo_name": "Microsoft/vsminecraft",
"path": "minecraftpkg/MekanismModSample/src/main/java/mekanism/common/CommonProxy.java",
"license": "mit",
"size": 30056
} | [
"net.minecraft.entity.player.EntityPlayer",
"net.minecraft.inventory.Container",
"net.minecraft.item.ItemStack",
"net.minecraft.tileentity.TileEntity",
"net.minecraft.world.World"
] | import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; | import net.minecraft.entity.player.*; import net.minecraft.inventory.*; import net.minecraft.item.*; import net.minecraft.tileentity.*; import net.minecraft.world.*; | [
"net.minecraft.entity",
"net.minecraft.inventory",
"net.minecraft.item",
"net.minecraft.tileentity",
"net.minecraft.world"
] | net.minecraft.entity; net.minecraft.inventory; net.minecraft.item; net.minecraft.tileentity; net.minecraft.world; | 1,504,537 |
Serializable get(String key);
void put(String key, Serializable value);
| Serializable get(String key); void put(String key, Serializable value); | /**
* store a value in the cache, that can be retrieved later using get().
*/ | store a value in the cache, that can be retrieved later using get() | put | {
"repo_name": "smhoekstra/iaf",
"path": "JavaSource/nl/nn/adapterframework/cache/ICacheAdapter.java",
"license": "apache-2.0",
"size": 1849
} | [
"java.io.Serializable"
] | import java.io.Serializable; | import java.io.*; | [
"java.io"
] | java.io; | 1,661,619 |
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected)
{
} | void function(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) { } | /**
* Called each tick as long the item is on a player inventory. Uses by maps to check if is on a player hand and
* update it's contents.
*/ | Called each tick as long the item is on a player inventory. Uses by maps to check if is on a player hand and update it's contents | onUpdate | {
"repo_name": "Im-Jrotica/forge_latest",
"path": "build/tmp/recompileMc/sources/net/minecraft/item/Item.java",
"license": "lgpl-2.1",
"size": 82426
} | [
"net.minecraft.entity.Entity",
"net.minecraft.world.World"
] | import net.minecraft.entity.Entity; import net.minecraft.world.World; | import net.minecraft.entity.*; import net.minecraft.world.*; | [
"net.minecraft.entity",
"net.minecraft.world"
] | net.minecraft.entity; net.minecraft.world; | 2,820,080 |
@Test
public void testAllowAccessByDefaultForMethodsMissingPermissions() throws Exception {
Callable<Void> callable = () -> {
final SecurityTestRemoteView allowAccessBean = InitialContext.doLookup("java:global/" + APP_NAME + "/" + MODULE_THREE_NAME + "/" + SecuredBeanThree.class.getSimpleName() + "!" + SecurityTestRemoteView.class.getName());
// first invoke on a method which has a specific role and that invocation should pass
final String callerPrincipalName = allowAccessBean.methodWithSpecificRole();
Assert.assertEquals("Unexpected caller prinicpal", "user1", callerPrincipalName);
// now invoke on a method which doesn't have an explicit security configuration. The SecuredBeanTwo (deployment) is configured for
// <missing-method-permissions-deny-access>true</missing-method-permissions-deny-access>
// so the invocation on such a method is expected to fail
final String callerPrincipalForMethodWithNoRole = allowAccessBean.methodWithNoRole();
Assert.assertEquals("Unexpected caller prinicpal when invoking method with no role", "user1", callerPrincipalForMethodWithNoRole);
return null;
};
// establish an identity using the security domain associated with the beans in the JARs in the EAR deployment
Util.switchIdentity("user1", "password1", callable, SecuredBeanOne.class.getClassLoader());
} | void function() throws Exception { Callable<Void> callable = () -> { final SecurityTestRemoteView allowAccessBean = InitialContext.doLookup(STR + APP_NAME + "/" + MODULE_THREE_NAME + "/" + SecuredBeanThree.class.getSimpleName() + "!" + SecurityTestRemoteView.class.getName()); final String callerPrincipalName = allowAccessBean.methodWithSpecificRole(); Assert.assertEquals(STR, "user1", callerPrincipalName); final String callerPrincipalForMethodWithNoRole = allowAccessBean.methodWithNoRole(); Assert.assertEquals(STR, "user1", callerPrincipalForMethodWithNoRole); return null; }; Util.switchIdentity("user1", STR, callable, SecuredBeanOne.class.getClassLoader()); } | /**
* Tests that methods without any explicit security permissions or any entry in the descriptor are allowed
*
* @throws Exception
*/ | Tests that methods without any explicit security permissions or any entry in the descriptor are allowed | testAllowAccessByDefaultForMethodsMissingPermissions | {
"repo_name": "xasx/wildfly",
"path": "testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/security/missingmethodpermission/MissingMethodPermissionsDefaultAllowedTestCase.java",
"license": "lgpl-2.1",
"size": 13751
} | [
"java.util.concurrent.Callable",
"javax.naming.InitialContext",
"org.jboss.as.test.shared.integration.ejb.security.Util",
"org.junit.Assert"
] | import java.util.concurrent.Callable; import javax.naming.InitialContext; import org.jboss.as.test.shared.integration.ejb.security.Util; import org.junit.Assert; | import java.util.concurrent.*; import javax.naming.*; import org.jboss.as.test.shared.integration.ejb.security.*; import org.junit.*; | [
"java.util",
"javax.naming",
"org.jboss.as",
"org.junit"
] | java.util; javax.naming; org.jboss.as; org.junit; | 2,128,722 |
ServiceFuture<Void> postOptionalArrayHeaderAsync(List<String> headerParameter, final ServiceCallback<Void> serviceCallback); | ServiceFuture<Void> postOptionalArrayHeaderAsync(List<String> headerParameter, final ServiceCallback<Void> serviceCallback); | /**
* Test explicitly optional integer. Please put a header 'headerParameter' => null.
*
* @param headerParameter the List<String> value
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @return the {@link ServiceFuture} object
*/ | Test explicitly optional integer. Please put a header 'headerParameter' => null | postOptionalArrayHeaderAsync | {
"repo_name": "anudeepsharma/autorest",
"path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/requiredoptional/Explicits.java",
"license": "mit",
"size": 43451
} | [
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture",
"java.util.List"
] | import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; import java.util.List; | import com.microsoft.rest.*; import java.util.*; | [
"com.microsoft.rest",
"java.util"
] | com.microsoft.rest; java.util; | 775,739 |
public void setThreadBuf(final ThreadLocal<ByteBuffer> threadBuf) {
this.threadBuf = threadBuf;
} | void function(final ThreadLocal<ByteBuffer> threadBuf) { this.threadBuf = threadBuf; } | /**
* Replace thread local with buffers. Thread local should provide direct buffer with one page in length.
*
* @param threadBuf new thread-local with buffers for the checkpoint threads.
*/ | Replace thread local with buffers. Thread local should provide direct buffer with one page in length | setThreadBuf | {
"repo_name": "amirakhmedov/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java",
"license": "apache-2.0",
"size": 164324
} | [
"java.nio.ByteBuffer"
] | import java.nio.ByteBuffer; | import java.nio.*; | [
"java.nio"
] | java.nio; | 2,306,783 |
private void normalizeNodeTypes(Node n) {
normalizeBlocks(n);
for (Node child = n.getFirstChild();
child != null; child = child.getNext()) {
// This pass is run during the CompilerTestCase validation, so this
// parent pointer check serves as a more general check.
Preconditions.checkState(child.getParent() == n);
normalizeNodeTypes(child);
}
} | void function(Node n) { normalizeBlocks(n); for (Node child = n.getFirstChild(); child != null; child = child.getNext()) { Preconditions.checkState(child.getParent() == n); normalizeNodeTypes(child); } } | /**
* Covert EXPR_VOID to EXPR_RESULT to simplify the rest of the code.
*/ | Covert EXPR_VOID to EXPR_RESULT to simplify the rest of the code | normalizeNodeTypes | {
"repo_name": "dushmis/closure-compiler",
"path": "src/com/google/javascript/jscomp/PrepareAst.java",
"license": "apache-2.0",
"size": 4708
} | [
"com.google.common.base.Preconditions",
"com.google.javascript.rhino.Node"
] | import com.google.common.base.Preconditions; import com.google.javascript.rhino.Node; | import com.google.common.base.*; import com.google.javascript.rhino.*; | [
"com.google.common",
"com.google.javascript"
] | com.google.common; com.google.javascript; | 455,823 |
public @Nonnull Iterable<String> listShares(@Nonnull String providerImageId) throws CloudException, InternalException;
/**
* Lists the image classes supported in this cloud.
* @return the supported image classes
* @throws CloudException an error occurred with the cloud provider
* @throws InternalException a local error occurred in the Dasein Cloud implementation
* @deprecated use {@link ImageCapabilities#listSupportedImageClasses()} | @Nonnull Iterable<String> function(@Nonnull String providerImageId) throws CloudException, InternalException; /** * Lists the image classes supported in this cloud. * @return the supported image classes * @throws CloudException an error occurred with the cloud provider * @throws InternalException a local error occurred in the Dasein Cloud implementation * @deprecated use {@link ImageCapabilities#listSupportedImageClasses()} | /**
* Provides the account numbers for all accounts which which the specified machine image has been shared. This method
* should return an empty list when sharing is unsupported.
* @param providerImageId the unique ID of the image being checked
* @return a list of account numbers with which the target image has been shared
* @throws CloudException an error occurred with the cloud provider
* @throws InternalException a local error occurred in the Dasein Cloud implementation
*/ | Provides the account numbers for all accounts which which the specified machine image has been shared. This method should return an empty list when sharing is unsupported | listShares | {
"repo_name": "OSS-TheWeatherCompany/dasein-cloud-core",
"path": "src/main/java/org/dasein/cloud/compute/MachineImageSupport.java",
"license": "apache-2.0",
"size": 38337
} | [
"javax.annotation.Nonnull",
"org.dasein.cloud.CloudException",
"org.dasein.cloud.InternalException"
] | import javax.annotation.Nonnull; import org.dasein.cloud.CloudException; import org.dasein.cloud.InternalException; | import javax.annotation.*; import org.dasein.cloud.*; | [
"javax.annotation",
"org.dasein.cloud"
] | javax.annotation; org.dasein.cloud; | 2,639,315 |
public static int get(String username) {
Message.debug("Retrieving a player ID for " + username);
int playerId = -1;
QueryResult playerRow = Query.table(PlayerStats.TableName)
.column(PlayerStats.PlayerId)
.condition(PlayerStats.Name, username)
.condition(PlayerStats.UUID, "NULL")
.select();
if(playerRow == null) {
Message.debug("User ID of Player "+username+" not found.");
return -1;
}
playerId = playerRow.asInt(PlayerStats.PlayerId);
Message.debug("User ID (" + playerId +") found.");
return playerId;
} | static int function(String username) { Message.debug(STR + username); int playerId = -1; QueryResult playerRow = Query.table(PlayerStats.TableName) .column(PlayerStats.PlayerId) .condition(PlayerStats.Name, username) .condition(PlayerStats.UUID, "NULL") .select(); if(playerRow == null) { Message.debug(STR+username+STR); return -1; } playerId = playerRow.asInt(PlayerStats.PlayerId); Message.debug(STR + playerId +STR); return playerId; } | /**
* Returns the player ID based on his name.<br />
* Very resource-heavy; if possible, use <code>get(Player player);</code>
* @param username Player name to look up
* @return Player ID or -1 if players wasn#t found
*/ | Returns the player ID based on his name. Very resource-heavy; if possible, use <code>get(Player player);</code> | get | {
"repo_name": "BukkitStatistics/Plugin",
"path": "src/com/wolvencraft/yasp/util/cache/PlayerCache.java",
"license": "gpl-3.0",
"size": 8403
} | [
"com.wolvencraft.yasp.db.Query",
"com.wolvencraft.yasp.db.tables.Normal",
"com.wolvencraft.yasp.util.Message"
] | import com.wolvencraft.yasp.db.Query; import com.wolvencraft.yasp.db.tables.Normal; import com.wolvencraft.yasp.util.Message; | import com.wolvencraft.yasp.db.*; import com.wolvencraft.yasp.db.tables.*; import com.wolvencraft.yasp.util.*; | [
"com.wolvencraft.yasp"
] | com.wolvencraft.yasp; | 1,046,753 |
public ApiResponse<VersionInfo> getCodeWithHttpInfo() throws ApiException {
okhttp3.Call localVarCall = getCodeValidateBeforeCall(null);
Type localVarReturnType = new TypeToken<VersionInfo>() {}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
} | ApiResponse<VersionInfo> function() throws ApiException { okhttp3.Call localVarCall = getCodeValidateBeforeCall(null); Type localVarReturnType = new TypeToken<VersionInfo>() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } | /**
* get the code version
*
* @return ApiResponse<VersionInfo>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the
* response body
* @http.response.details
* <table summary="Response Details" border="1">
* <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
* <tr><td> 200 </td><td> OK </td><td> - </td></tr>
* <tr><td> 401 </td><td> Unauthorized </td><td> - </td></tr>
* </table>
*/ | get the code version | getCodeWithHttpInfo | {
"repo_name": "kubernetes-client/java",
"path": "kubernetes/src/main/java/io/kubernetes/client/openapi/apis/VersionApi.java",
"license": "apache-2.0",
"size": 6039
} | [
"com.google.gson.reflect.TypeToken",
"io.kubernetes.client.openapi.ApiException",
"io.kubernetes.client.openapi.ApiResponse",
"io.kubernetes.client.openapi.models.VersionInfo",
"java.lang.reflect.Type"
] | import com.google.gson.reflect.TypeToken; import io.kubernetes.client.openapi.ApiException; import io.kubernetes.client.openapi.ApiResponse; import io.kubernetes.client.openapi.models.VersionInfo; import java.lang.reflect.Type; | import com.google.gson.reflect.*; import io.kubernetes.client.openapi.*; import io.kubernetes.client.openapi.models.*; import java.lang.reflect.*; | [
"com.google.gson",
"io.kubernetes.client",
"java.lang"
] | com.google.gson; io.kubernetes.client; java.lang; | 1,591,300 |
public void testGetSubTypes()
{
assertEquals(3, t.getSubTypes().size());
final Map types = t.getSubTypes();
System.out.println("\n64 Bit Signed DPTs:");
final Collection c = types.values();
for (final Iterator i = c.iterator(); i.hasNext();) {
final DPT dpt = (DPT) i.next();
System.out.println(dpt.toString());
}
} | void function() { assertEquals(3, t.getSubTypes().size()); final Map types = t.getSubTypes(); System.out.println(STR); final Collection c = types.values(); for (final Iterator i = c.iterator(); i.hasNext();) { final DPT dpt = (DPT) i.next(); System.out.println(dpt.toString()); } } | /**
* Test method for {@link tuwien.auto.calimero.dptxlator.DPTXlator4ByteSigned#getSubTypes()}.
*/ | Test method for <code>tuwien.auto.calimero.dptxlator.DPTXlator4ByteSigned#getSubTypes()</code> | testGetSubTypes | {
"repo_name": "CumpsD/calimero",
"path": "test/tuwien/auto/calimero/dptxlator/DPTXlator64BitSignedTest.java",
"license": "gpl-2.0",
"size": 10192
} | [
"java.util.Collection",
"java.util.Iterator",
"java.util.Map"
] | import java.util.Collection; import java.util.Iterator; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,080,718 |
@Generated
@CVariable()
@MappedReturn(ObjCStringMapper.class)
public static native String NSURLAuthenticationMethodHTTPBasic(); | @CVariable() @MappedReturn(ObjCStringMapper.class) static native String function(); | /**
* [@const] NSURLAuthenticationMethodHTTPBasic
* <p>
* HTTP basic authentication. Equivalent to
* NSURLAuthenticationMethodDefault for http.
*/ | [@const] NSURLAuthenticationMethodHTTPBasic HTTP basic authentication. Equivalent to NSURLAuthenticationMethodDefault for http | NSURLAuthenticationMethodHTTPBasic | {
"repo_name": "multi-os-engine/moe-core",
"path": "moe.apple/moe.platform.ios/src/main/java/apple/foundation/c/Foundation.java",
"license": "apache-2.0",
"size": 156135
} | [
"org.moe.natj.c.ann.CVariable",
"org.moe.natj.general.ann.MappedReturn",
"org.moe.natj.objc.map.ObjCStringMapper"
] | import org.moe.natj.c.ann.CVariable; import org.moe.natj.general.ann.MappedReturn; import org.moe.natj.objc.map.ObjCStringMapper; | import org.moe.natj.c.ann.*; import org.moe.natj.general.ann.*; import org.moe.natj.objc.map.*; | [
"org.moe.natj"
] | org.moe.natj; | 2,658,086 |
@Override
public Quote createQuote(Quote quote, Span span) throws BadRequestException {
String id = quote.getQuoteId();
if (id == null || id.isEmpty()) {
quote.setQuoteId(String.format("%d", s_counter.nextInt() & 0x7FFFFFFF));
} else {
if (getQuote(id, span) != null) {
throw new BadRequestException(String.format("Duplicate: the quote '%s' already exists", id));
}
}
quotes.add(quote);
return quote;
} | Quote function(Quote quote, Span span) throws BadRequestException { String id = quote.getQuoteId(); if (id == null id.isEmpty()) { quote.setQuoteId(String.format("%d", s_counter.nextInt() & 0x7FFFFFFF)); } else { if (getQuote(id, span) != null) { throw new BadRequestException(String.format(STR, id)); } } quotes.add(quote); return quote; } | /**
* Creates a new quote from information edited by a client.
*
* @param quote
* The client quote information.
* @return A Quote object.
*/ | Creates a new quote from information edited by a client | createQuote | {
"repo_name": "dtzar/PartsUnlimitedMRPmicro",
"path": "QuoteSrvc/src/main/java/smpl/quote/repository/mock/MockQuoteRepository.java",
"license": "mit",
"size": 4378
} | [
"io.opentracing.Span"
] | import io.opentracing.Span; | import io.opentracing.*; | [
"io.opentracing"
] | io.opentracing; | 1,994,256 |
public List<IgniteUuid> idsForPath(IgfsPath path) throws IgniteCheckedException {
return client ? runClientTask(new IgfsClientMetaIdsForPathCallable(cfg.getName(), path)) : fileIds(path);
} | List<IgniteUuid> function(IgfsPath path) throws IgniteCheckedException { return client ? runClientTask(new IgfsClientMetaIdsForPathCallable(cfg.getName(), path)) : fileIds(path); } | /**
* Get IDs for the given path.
*
* @param path Path.
* @return IDs.
* @throws IgniteCheckedException If failed.
*/ | Get IDs for the given path | idsForPath | {
"repo_name": "tkpanther/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java",
"license": "apache-2.0",
"size": 131189
} | [
"java.util.List",
"org.apache.ignite.IgniteCheckedException",
"org.apache.ignite.igfs.IgfsPath",
"org.apache.ignite.internal.processors.igfs.client.meta.IgfsClientMetaIdsForPathCallable",
"org.apache.ignite.lang.IgniteUuid"
] | import java.util.List; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.igfs.IgfsPath; import org.apache.ignite.internal.processors.igfs.client.meta.IgfsClientMetaIdsForPathCallable; import org.apache.ignite.lang.IgniteUuid; | import java.util.*; import org.apache.ignite.*; import org.apache.ignite.igfs.*; import org.apache.ignite.internal.processors.igfs.client.meta.*; import org.apache.ignite.lang.*; | [
"java.util",
"org.apache.ignite"
] | java.util; org.apache.ignite; | 810,274 |
CompassQuerySpanNearBuilder add(CompassSpanQuery query); | CompassQuerySpanNearBuilder add(CompassSpanQuery query); | /**
* Adds a single span query to the next span match.
*/ | Adds a single span query to the next span match | add | {
"repo_name": "vthriller/opensymphony-compass-backup",
"path": "src/main/src/org/compass/core/CompassQueryBuilder.java",
"license": "apache-2.0",
"size": 27584
} | [
"org.compass.core.CompassQuery"
] | import org.compass.core.CompassQuery; | import org.compass.core.*; | [
"org.compass.core"
] | org.compass.core; | 1,194,175 |
public boolean dispatchKeyEvent(KeyEvent event) {
return mDragging;
} | boolean function(KeyEvent event) { return mDragging; } | /**
* Call this from a drag source view like this:
*
* <pre>
* @Override
* public boolean dispatchKeyEvent(KeyEvent event) {
* return mDragController.dispatchKeyEvent(this, event)
* || super.dispatchKeyEvent(event);
* </pre>
*/ | Call this from a drag source view like this: <code> | dispatchKeyEvent | {
"repo_name": "Lesik/open-gel-plus",
"path": "src/com/lesikapk/opengelplus/DragController.java",
"license": "gpl-2.0",
"size": 28509
} | [
"android.view.KeyEvent"
] | import android.view.KeyEvent; | import android.view.*; | [
"android.view"
] | android.view; | 874,342 |
public Bound<GenericRecord> withSchema(String schema) {
return withSchema((new Schema.Parser()).parse(schema));
} | Bound<GenericRecord> function(String schema) { return withSchema((new Schema.Parser()).parse(schema)); } | /**
* Returns a new {@link PTransform} that's like this one but
* that reads Avro file(s) containing records of the specified schema
* in a JSON-encoded string form.
*
* <p>Does not modify this object.
*/ | Returns a new <code>PTransform</code> that's like this one but that reads Avro file(s) containing records of the specified schema in a JSON-encoded string form. Does not modify this object | withSchema | {
"repo_name": "amitsela/incubator-beam",
"path": "sdks/java/core/src/main/java/org/apache/beam/sdk/io/AvroIO.java",
"license": "apache-2.0",
"size": 39700
} | [
"org.apache.avro.Schema",
"org.apache.avro.generic.GenericRecord"
] | import org.apache.avro.Schema; import org.apache.avro.generic.GenericRecord; | import org.apache.avro.*; import org.apache.avro.generic.*; | [
"org.apache.avro"
] | org.apache.avro; | 1,993,717 |
return Settings.System.getInt(context.getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 0) == 1;
} | return Settings.System.getInt(context.getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 0) == 1; } | /**
* Checks to see if the user has rotation enabled/disabled in their phone settings.
*
* @param context The current Context or Activity that this method is called from
* @return true if rotation is enabled, otherwise false.
*/ | Checks to see if the user has rotation enabled/disabled in their phone settings | isRotationEnabled | {
"repo_name": "hjhrq1991/C-Car",
"path": "Common/src/main/java/com/hjhrq1991/tool/Util/PhoneUtils.java",
"license": "apache-2.0",
"size": 3491
} | [
"android.provider.Settings"
] | import android.provider.Settings; | import android.provider.*; | [
"android.provider"
] | android.provider; | 1,351,752 |
@Override
public ManagedChannelImpl shutdown() {
logger.log(Level.FINE, "[{0}] shutdown() called", getLogId());
if (!shutdown.compareAndSet(false, true)) {
return this;
}
phantom.shutdown = true; | ManagedChannelImpl function() { logger.log(Level.FINE, STR, getLogId()); if (!shutdown.compareAndSet(false, true)) { return this; } phantom.shutdown = true; | /**
* Initiates an orderly shutdown in which preexisting calls continue but new calls are immediately
* cancelled.
*/ | Initiates an orderly shutdown in which preexisting calls continue but new calls are immediately cancelled | shutdown | {
"repo_name": "pieterjanpintens/grpc-java",
"path": "core/src/main/java/io/grpc/internal/ManagedChannelImpl.java",
"license": "apache-2.0",
"size": 38797
} | [
"java.util.logging.Level"
] | import java.util.logging.Level; | import java.util.logging.*; | [
"java.util"
] | java.util; | 844,249 |
public void setUsernameParameter(String usernameParameter) {
Assert.hasText(usernameParameter, "Username parameter must not be empty or null");
this.usernameParameter = usernameParameter;
} | void function(String usernameParameter) { Assert.hasText(usernameParameter, STR); this.usernameParameter = usernameParameter; } | /**
* Sets the parameter name which will be used to obtain the username from
* the login request.
*
* @param usernameParameter
* the parameter name. Defaults to "username".
*/ | Sets the parameter name which will be used to obtain the username from the login request | setUsernameParameter | {
"repo_name": "guoxchteam/test",
"path": "apollo-moa-webapp/src/main/java/com/ncs/security/web/StatelessLoginFilter.java",
"license": "apache-2.0",
"size": 10781
} | [
"org.springframework.util.Assert"
] | import org.springframework.util.Assert; | import org.springframework.util.*; | [
"org.springframework.util"
] | org.springframework.util; | 2,449,041 |
public boolean inKeyguardRestrictedInputMode() {
try {
return mWM.inKeyguardRestrictedInputMode();
} catch (RemoteException ex) {
return false;
}
} | boolean function() { try { return mWM.inKeyguardRestrictedInputMode(); } catch (RemoteException ex) { return false; } } | /**
* If keyguard screen is showing or in restricted key input mode (i.e. in
* keyguard password emergency screen). When in such mode, certain keys,
* such as the Home key and the right soft keys, don't work.
*
* @return true if in keyguard restricted input mode.
*
* @see android.view.WindowManagerPolicy#inKeyguardRestrictedKeyInputMode
*/ | If keyguard screen is showing or in restricted key input mode (i.e. in keyguard password emergency screen). When in such mode, certain keys, such as the Home key and the right soft keys, don't work | inKeyguardRestrictedInputMode | {
"repo_name": "mateor/PDroidHistory",
"path": "frameworks/base/core/java/android/app/KeyguardManager.java",
"license": "gpl-3.0",
"size": 5784
} | [
"android.os.RemoteException"
] | import android.os.RemoteException; | import android.os.*; | [
"android.os"
] | android.os; | 2,396,986 |
try {
Scanner getFileInput = new Scanner(new BufferedReader(new FileReader(f)));
String text = "";
if (getFileInput.hasNext()) {
text = getFileInput.next();
}
String usedDataContainer = "";
randData = scrubData(randData);
FileOutputStream fs = new FileOutputStream(new File(filename+".blk"));
while (!text.equals("")) {
text = scrubData(text);
String output = "";
//todo: output "output" into a file at the end of each of these loops
if (randData.length() > text.length()) {
for(int x = 0; x < text.length(); x++) {
char[] textchars = text.toCharArray();
char[] data = randData.toCharArray();
int outint = -1;
if ((int)textchars[x] + (int)data[x] <= 255) {
outint = (int)textchars[x] + (int)data[x];
} else {
outint = (int)textchars[x] + (int)data[x] - 255;
}
output += (char)outint;
}
usedDataContainer += randData.substring(0, text.length() - 1);
randData = randData.substring(text.length() - 1);
} else {
int preexisting = 0;
int strcounter = 0;
for(int x = 0; x < text.length(); x++) {
if (strcounter + 1 == randData.length() && !usedDataContainer.equals("")) {
usedDataContainer += randData;
randData = usedDataContainer;
usedDataContainer = "";
preexisting += strcounter;
strcounter = 0;
} else if (strcounter + 1 == randData.length() && usedDataContainer.equals("")) {
preexisting += strcounter;
strcounter = 0;
}
char[] textchars = text.toCharArray();
char[] data = randData.toCharArray();
int outint = -1;
if ((int)textchars[x] + (int)data[strcounter] <= 255) {
outint = (int)textchars[x] + (int)data[strcounter];
} else {
outint = (int)textchars[x] + (int)data[strcounter] - 255;
}
output += (char)outint;
strcounter++;
}
usedDataContainer += randData.substring(0, text.length() - 1 - preexisting);
randData = randData.substring(text.length() - 1 - preexisting);
if (randData.equals("")) {
randData = usedDataContainer;
usedDataContainer = "";
}
}
fs.write(output.getBytes());
if (getFileInput.hasNext()) {
text = getFileInput.next();
} else {
text = "";
}
}
fs.close();
} catch (Exception e) {
System.out.println("Error generating OTP.");
e.printStackTrace();
}
File file = new File(filename+".blk");
return file;
} | try { Scanner getFileInput = new Scanner(new BufferedReader(new FileReader(f))); String text = STRSTR.blkSTRSTRSTRSTRSTRSTRSTRSTRSTRError generating OTP.STR.blk"); return file; } | /**
* Generate an OTP using bytes read from a file salted with a collection of random data.
* @param f The file to use to create the new OTP. Can be anything, but will cause a RAM overload if it's too big.
* @param randData The data to salt the file with.
* @param filename The name to use for the OTP file.
* @return The newly created OTP file.
*/ | Generate an OTP using bytes read from a file salted with a collection of random data | generateOTP | {
"repo_name": "YellowLineSoftworks/VIPER-Engine",
"path": "src/crypto/OTP.java",
"license": "bsd-3-clause",
"size": 9834
} | [
"java.io.BufferedReader",
"java.io.FileReader",
"java.util.Scanner"
] | import java.io.BufferedReader; import java.io.FileReader; import java.util.Scanner; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 60,806 |
public static Point getPoint(IPreferenceStore store, String name) {
return basicGetPoint(store.getString(name));
} | static Point function(IPreferenceStore store, String name) { return basicGetPoint(store.getString(name)); } | /**
* Returns the current value of the point-valued preference with the
* given name in the given preference store.
* Returns the default-default value (<code>POINT_DEFAULT_DEFAULT</code>)
* if there is no preference with the given name, or if the current value
* cannot be treated as a point.
*
* @param store the preference store
* @param name the name of the preference
* @return the point-valued preference
*/ | Returns the current value of the point-valued preference with the given name in the given preference store. Returns the default-default value (<code>POINT_DEFAULT_DEFAULT</code>) if there is no preference with the given name, or if the current value cannot be treated as a point | getPoint | {
"repo_name": "ControlSystemStudio/org.csstudio.iter",
"path": "plugins/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceConverter.java",
"license": "epl-1.0",
"size": 21471
} | [
"org.eclipse.swt.graphics.Point"
] | import org.eclipse.swt.graphics.Point; | import org.eclipse.swt.graphics.*; | [
"org.eclipse.swt"
] | org.eclipse.swt; | 1,512,619 |
@Test
public void unitTestHexStringSplit() {
HexStringSplit splitter = new HexStringSplit();
// Check splitting while starting from scratch
byte[][] twoRegionsSplits = splitter.split(2);
assertEquals(1, twoRegionsSplits.length);
assertArrayEquals("80000000".getBytes(), twoRegionsSplits[0]);
byte[][] threeRegionsSplits = splitter.split(3);
assertEquals(2, threeRegionsSplits.length);
byte[] expectedSplit0 = "55555555".getBytes();
assertArrayEquals(expectedSplit0, threeRegionsSplits[0]);
byte[] expectedSplit1 = "aaaaaaaa".getBytes();
assertArrayEquals(expectedSplit1, threeRegionsSplits[1]);
// Check splitting existing regions that have start and end points
byte[] splitPoint = splitter.split("10000000".getBytes(), "30000000".getBytes());
assertArrayEquals("20000000".getBytes(), splitPoint);
byte[] lastRow = "ffffffff".getBytes();
assertArrayEquals(lastRow, splitter.lastRow());
byte[] firstRow = "00000000".getBytes();
assertArrayEquals(firstRow, splitter.firstRow());
// Halfway between 00... and 20... should be 10...
splitPoint = splitter.split(firstRow, "20000000".getBytes());
assertArrayEquals("10000000".getBytes(), splitPoint);
// Halfway between df... and ff... should be ef....
splitPoint = splitter.split("dfffffff".getBytes(), lastRow);
assertArrayEquals("efffffff".getBytes(), splitPoint);
// Check splitting region with multiple mappers per region
byte[][] splits = splitter.split("00000000".getBytes(), "30000000".getBytes(), 3, false);
assertEquals(2, splits.length);
assertArrayEquals("10000000".getBytes(), splits[0]);
assertArrayEquals("20000000".getBytes(), splits[1]);
splits = splitter.split("00000000".getBytes(), "20000000".getBytes(), 2, true);
assertEquals(3, splits.length);
assertArrayEquals("10000000".getBytes(), splits[1]);
} | void function() { HexStringSplit splitter = new HexStringSplit(); byte[][] twoRegionsSplits = splitter.split(2); assertEquals(1, twoRegionsSplits.length); assertArrayEquals(STR.getBytes(), twoRegionsSplits[0]); byte[][] threeRegionsSplits = splitter.split(3); assertEquals(2, threeRegionsSplits.length); byte[] expectedSplit0 = STR.getBytes(); assertArrayEquals(expectedSplit0, threeRegionsSplits[0]); byte[] expectedSplit1 = STR.getBytes(); assertArrayEquals(expectedSplit1, threeRegionsSplits[1]); byte[] splitPoint = splitter.split(STR.getBytes(), STR.getBytes()); assertArrayEquals(STR.getBytes(), splitPoint); byte[] lastRow = STR.getBytes(); assertArrayEquals(lastRow, splitter.lastRow()); byte[] firstRow = STR.getBytes(); assertArrayEquals(firstRow, splitter.firstRow()); splitPoint = splitter.split(firstRow, STR.getBytes()); assertArrayEquals(STR.getBytes(), splitPoint); splitPoint = splitter.split(STR.getBytes(), lastRow); assertArrayEquals(STR.getBytes(), splitPoint); byte[][] splits = splitter.split(STR.getBytes(), STR.getBytes(), 3, false); assertEquals(2, splits.length); assertArrayEquals(STR.getBytes(), splits[0]); assertArrayEquals(STR.getBytes(), splits[1]); splits = splitter.split(STR.getBytes(), STR.getBytes(), 2, true); assertEquals(3, splits.length); assertArrayEquals(STR.getBytes(), splits[1]); } | /**
* Unit tests for the HexStringSplit algorithm. Makes sure it divides up the
* space of keys in the way that we expect.
*/ | Unit tests for the HexStringSplit algorithm. Makes sure it divides up the space of keys in the way that we expect | unitTestHexStringSplit | {
"repo_name": "vincentpoon/hbase",
"path": "hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestRegionSplitter.java",
"license": "apache-2.0",
"size": 19716
} | [
"org.apache.hadoop.hbase.util.RegionSplitter",
"org.junit.Assert"
] | import org.apache.hadoop.hbase.util.RegionSplitter; import org.junit.Assert; | import org.apache.hadoop.hbase.util.*; import org.junit.*; | [
"org.apache.hadoop",
"org.junit"
] | org.apache.hadoop; org.junit; | 1,358,791 |
EClass getComposicion(); | EClass getComposicion(); | /**
* Returns the meta object for class '{@link visualizacionMetricas3.visualizacion.Composicion <em>Composicion</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Composicion</em>'.
* @see visualizacionMetricas3.visualizacion.Composicion
* @generated
*/ | Returns the meta object for class '<code>visualizacionMetricas3.visualizacion.Composicion Composicion</code>'. | getComposicion | {
"repo_name": "lfmendivelso10/AppModernization",
"path": "source/i2/VisualizacionMetricas3/src/visualizacionMetricas3/visualizacion/VisualizacionPackage.java",
"license": "mit",
"size": 96014
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,504,831 |
public List<FeedbackSessionAttributes> getFeedbackSessionsForUserInCourse(
String courseId, String userEmail)
throws EntityDoesNotExistException {
if (!coursesLogic.isCoursePresent(courseId)) {
throw new EntityDoesNotExistException(ERROR_NON_EXISTENT_COURSE);
}
return getFeedbackSessionsForUserInCourseSkipCheck(courseId, userEmail);
} | List<FeedbackSessionAttributes> function( String courseId, String userEmail) throws EntityDoesNotExistException { if (!coursesLogic.isCoursePresent(courseId)) { throw new EntityDoesNotExistException(ERROR_NON_EXISTENT_COURSE); } return getFeedbackSessionsForUserInCourseSkipCheck(courseId, userEmail); } | /**
* Checks if the specified course exists, then gets the feedback sessions for
* the specified user in the course if it does exist.
*
* @return a list of viewable feedback sessions for any user for his course.
*/ | Checks if the specified course exists, then gets the feedback sessions for the specified user in the course if it does exist | getFeedbackSessionsForUserInCourse | {
"repo_name": "shivanshsoni/teammates",
"path": "src/main/java/teammates/logic/core/FeedbackSessionsLogic.java",
"license": "gpl-2.0",
"size": 114711
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 172,834 |
public Content encodeXML(String name, Namespace ns); | Content function(String name, Namespace ns); | /**
* encode parameter to xml.
* @param name of element
* @param ns Namespace of elements
* @return JDom Content object
*/ | encode parameter to xml | encodeXML | {
"repo_name": "mksmbrtsh/LLRPexplorer",
"path": "src/org/llrp/ltk/generated/interfaces/AccessCommandOpSpecResult.java",
"license": "apache-2.0",
"size": 1789
} | [
"org.jdom2.Content",
"org.jdom2.Namespace"
] | import org.jdom2.Content; import org.jdom2.Namespace; | import org.jdom2.*; | [
"org.jdom2"
] | org.jdom2; | 2,121,086 |
private void markDone(UUID id)
{
BoundStatement delete = new BoundStatement(deleteFromNotDoneStmt);
bindUUIDWhere(delete, id);
getSession().execute(delete);
} | void function(UUID id) { BoundStatement delete = new BoundStatement(deleteFromNotDoneStmt); bindUUIDWhere(delete, id); getSession().execute(delete); } | /**
* Marks an index as done indexing.
*
* @param id
*/ | Marks an index as done indexing | markDone | {
"repo_name": "PearsonEducation/Docussandra",
"path": "cassandra/src/main/java/com/pearson/docussandra/persistence/impl/IndexStatusRepositoryImpl.java",
"license": "apache-2.0",
"size": 14023
} | [
"com.datastax.driver.core.BoundStatement"
] | import com.datastax.driver.core.BoundStatement; | import com.datastax.driver.core.*; | [
"com.datastax.driver"
] | com.datastax.driver; | 2,432,922 |
public V[] toArray(V[] array) {
if (array.length < size) {
array = Arrays.copyOf(array, size);
}
System.arraycopy(objects, 0, array, 0, size);
return array;
}
| V[] function(V[] array) { if (array.length < size) { array = Arrays.copyOf(array, size); } System.arraycopy(objects, 0, array, 0, size); return array; } | /**
* <p>
* Returns a copy of the array of objects associated to the values.
* </p>
*
* <p>
* If the size of the given array is larger or equal to the size of the
* objects array the given array is reused.
* </p>
*
* @return An array of objects associated to the values.
*/ | Returns a copy of the array of objects associated to the values. If the size of the given array is larger or equal to the size of the objects array the given array is reused. | toArray | {
"repo_name": "AKSW/topicmodeling",
"path": "topicmodeling.commons/src/main/java/org/dice_research/topicmodeling/commons/collections/TopDoubleObjectCollection.java",
"license": "lgpl-3.0",
"size": 10665
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 1,308,987 |
@Override
public boolean performCommand(ConsoleInput ci, DownloadManager dm, List args)
{
if (args.isEmpty()) {
ci.out.println("> Command 'hack': Not enough parameters for subcommand '" + getCommandName() + "'");
return false;
}
int newSpeed = Math.max(-1, Integer.parseInt((String) args.get(0)));
dm.getStats().setUploadRateLimitBytesPerSecond(newSpeed*DisplayFormatters.getKinB());
return true;
}
}
private static class HackUploads extends TorrentSubCommand
{
public HackUploads()
{
super("uploads", "v");
} | boolean function(ConsoleInput ci, DownloadManager dm, List args) { if (args.isEmpty()) { ci.out.println(STR + getCommandName() + "'"); return false; } int newSpeed = Math.max(-1, Integer.parseInt((String) args.get(0))); dm.getStats().setUploadRateLimitBytesPerSecond(newSpeed*DisplayFormatters.getKinB()); return true; } } private static class HackUploads extends TorrentSubCommand { public HackUploads() { super(STR, "v"); } | /**
* locate the appropriate subcommand and execute it
*/ | locate the appropriate subcommand and execute it | performCommand | {
"repo_name": "BiglySoftware/BiglyBT",
"path": "uis/src/com/biglybt/ui/console/commands/Hack.java",
"license": "gpl-2.0",
"size": 15473
} | [
"com.biglybt.core.download.DownloadManager",
"com.biglybt.core.util.DisplayFormatters",
"com.biglybt.ui.console.ConsoleInput",
"java.util.List"
] | import com.biglybt.core.download.DownloadManager; import com.biglybt.core.util.DisplayFormatters; import com.biglybt.ui.console.ConsoleInput; import java.util.List; | import com.biglybt.core.download.*; import com.biglybt.core.util.*; import com.biglybt.ui.console.*; import java.util.*; | [
"com.biglybt.core",
"com.biglybt.ui",
"java.util"
] | com.biglybt.core; com.biglybt.ui; java.util; | 1,951,915 |
@Test(dependsOnMethods = "init")
public void getCommentsOnId() throws Exception {
final ArticleQueryService articleQueryService = getArticleQueryService();
final JSONObject result = articleQueryService.getArticles(Requests.buildPaginationRequest("1/10/20"));
Assert.assertNotNull(result);
Assert.assertEquals(result.getJSONArray(Article.ARTICLES).length(), 1);
final JSONObject article =
result.getJSONArray(Article.ARTICLES).getJSONObject(0);
final String articleId = article.getString(Keys.OBJECT_ID);
final CommentQueryService commentQueryService = getCommentQueryService();
final List<JSONObject> comments =
commentQueryService.getComments(articleId);
Assert.assertNotNull(comments);
Assert.assertEquals(comments.size(), 1);
} | @Test(dependsOnMethods = "init") void function() throws Exception { final ArticleQueryService articleQueryService = getArticleQueryService(); final JSONObject result = articleQueryService.getArticles(Requests.buildPaginationRequest(STR)); Assert.assertNotNull(result); Assert.assertEquals(result.getJSONArray(Article.ARTICLES).length(), 1); final JSONObject article = result.getJSONArray(Article.ARTICLES).getJSONObject(0); final String articleId = article.getString(Keys.OBJECT_ID); final CommentQueryService commentQueryService = getCommentQueryService(); final List<JSONObject> comments = commentQueryService.getComments(articleId); Assert.assertNotNull(comments); Assert.assertEquals(comments.size(), 1); } | /**
* Get Comment on id.
*
* @throws Exception exception
*/ | Get Comment on id | getCommentsOnId | {
"repo_name": "sshiting/solo",
"path": "src/test/java/org/b3log/solo/service/CommentQueryServiceTestCase.java",
"license": "apache-2.0",
"size": 3439
} | [
"java.util.List",
"org.b3log.latke.Keys",
"org.b3log.latke.util.Requests",
"org.b3log.solo.model.Article",
"org.json.JSONObject",
"org.testng.Assert",
"org.testng.annotations.Test"
] | import java.util.List; import org.b3log.latke.Keys; import org.b3log.latke.util.Requests; import org.b3log.solo.model.Article; import org.json.JSONObject; import org.testng.Assert; import org.testng.annotations.Test; | import java.util.*; import org.b3log.latke.*; import org.b3log.latke.util.*; import org.b3log.solo.model.*; import org.json.*; import org.testng.*; import org.testng.annotations.*; | [
"java.util",
"org.b3log.latke",
"org.b3log.solo",
"org.json",
"org.testng",
"org.testng.annotations"
] | java.util; org.b3log.latke; org.b3log.solo; org.json; org.testng; org.testng.annotations; | 1,439,091 |
@Test
public void testAsBytes() throws Exception {
channelBuffer = ChannelBuffers.copiedBuffer(tlv);
hostNameTlv.readFrom(channelBuffer);
result1 = hostNameTlv.asBytes();
assertThat(result1, is(notNullValue()));
} | void function() throws Exception { channelBuffer = ChannelBuffers.copiedBuffer(tlv); hostNameTlv.readFrom(channelBuffer); result1 = hostNameTlv.asBytes(); assertThat(result1, is(notNullValue())); } | /**
* Tests asBytes() method.
*/ | Tests asBytes() method | testAsBytes | {
"repo_name": "donNewtonAlpha/onos",
"path": "protocols/isis/isisio/src/test/java/org/onosproject/isis/io/isispacket/tlv/HostNameTlvTest.java",
"license": "apache-2.0",
"size": 2980
} | [
"org.hamcrest.MatcherAssert",
"org.hamcrest.Matchers",
"org.jboss.netty.buffer.ChannelBuffers"
] | import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.jboss.netty.buffer.ChannelBuffers; | import org.hamcrest.*; import org.jboss.netty.buffer.*; | [
"org.hamcrest",
"org.jboss.netty"
] | org.hamcrest; org.jboss.netty; | 2,737,525 |
public void setSelector(LiteralOption selector)
{
setParam(null, null, selector);
} | void function(LiteralOption selector) { setParam(null, null, selector); } | /**
* Set's the Selector
*
* @param selector
* Selector
*/ | Set's the Selector | setSelector | {
"repo_name": "tectronics/wiquery",
"path": "wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/resizable/ResizableContainment.java",
"license": "mit",
"size": 5094
} | [
"org.odlabs.wiquery.core.options.LiteralOption"
] | import org.odlabs.wiquery.core.options.LiteralOption; | import org.odlabs.wiquery.core.options.*; | [
"org.odlabs.wiquery"
] | org.odlabs.wiquery; | 1,566,299 |
public void write(int b) throws IOException {
byte buffer[] = { (byte) b };
writeBytes(buffer, 0, buffer.length);
} | void function(int b) throws IOException { byte buffer[] = { (byte) b }; writeBytes(buffer, 0, buffer.length); } | /**
* Writes the specified byte to this file. The write starts at the current
* file pointer.
*
* @param b
* the <code>byte</code> to be written.
* @throws IOException
* if an I/O error occurs.
*/ | Writes the specified byte to this file. The write starts at the current file pointer | write | {
"repo_name": "skoulouzis/vlet",
"path": "source/core/nl.uva.vlet.vfs.irods/irodssrc/edu/sdsc/grid/io/GeneralRandomAccessFile.java",
"license": "apache-2.0",
"size": 74263
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 690,299 |
private synchronized boolean removeFromBackups(NetworkId networkId,
DeviceId deviceId, NodeId nodeId) {
Map<DeviceId, List<NodeId>> backups = getBackups(networkId);
List<NodeId> stbys = backups.getOrDefault(deviceId, new ArrayList<>());
boolean modified = stbys.remove(nodeId);
backups.put(deviceId, stbys);
return modified;
} | synchronized boolean function(NetworkId networkId, DeviceId deviceId, NodeId nodeId) { Map<DeviceId, List<NodeId>> backups = getBackups(networkId); List<NodeId> stbys = backups.getOrDefault(deviceId, new ArrayList<>()); boolean modified = stbys.remove(nodeId); backups.put(deviceId, stbys); return modified; } | /**
* Remove backup node for a device.
*
* @param networkId a virtual network identifier
* @param deviceId a virtual device identifier
* @param nodeId a node identifier
* @return True if success
*/ | Remove backup node for a device | removeFromBackups | {
"repo_name": "osinstom/onos",
"path": "incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/SimpleVirtualMastershipStore.java",
"license": "apache-2.0",
"size": 19359
} | [
"java.util.ArrayList",
"java.util.List",
"java.util.Map",
"org.onosproject.cluster.NodeId",
"org.onosproject.incubator.net.virtual.NetworkId",
"org.onosproject.net.DeviceId"
] | import java.util.ArrayList; import java.util.List; import java.util.Map; import org.onosproject.cluster.NodeId; import org.onosproject.incubator.net.virtual.NetworkId; import org.onosproject.net.DeviceId; | import java.util.*; import org.onosproject.cluster.*; import org.onosproject.incubator.net.virtual.*; import org.onosproject.net.*; | [
"java.util",
"org.onosproject.cluster",
"org.onosproject.incubator",
"org.onosproject.net"
] | java.util; org.onosproject.cluster; org.onosproject.incubator; org.onosproject.net; | 908,589 |
public void deleteTodo(UUID id, UUID workspaceId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling deleteTodo");
}
// create path and map variables
String localVarPath = "/todos/{id}".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarQueryParams.addAll(apiClient.parameterToPairs("", "workspaceId", workspaceId));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "token" };
apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
} | void function(UUID id, UUID workspaceId) throws ApiException { Object localVarPostBody = null; if (id == null) { throw new ApiException(400, STR); } String localVarPath = STR.replaceAll(STR,"json") .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); localVarQueryParams.addAll(apiClient.parameterToPairs(STRworkspaceIdSTRapplication/jsonSTRapplication/jsonSTRtokenSTRDELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); } | /**
* deleteTodo
* deletes a todo item based on provided id.
* @param id the id of the todo item (required)
* @param workspaceId the workspaceId in case that the SYSTEM deletes the todo (optional)
* @throws ApiException if fails to make API call
*/ | deleteTodo deletes a todo item based on provided id | deleteTodo | {
"repo_name": "leanix/leanix-sdk-java",
"path": "src/main/java/net/leanix/api/TodosApi.java",
"license": "mit",
"size": 10314
} | [
"java.util.ArrayList",
"java.util.HashMap",
"java.util.List",
"java.util.Map",
"net.leanix.api.common.ApiException",
"net.leanix.api.common.Pair"
] | import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import net.leanix.api.common.ApiException; import net.leanix.api.common.Pair; | import java.util.*; import net.leanix.api.common.*; | [
"java.util",
"net.leanix.api"
] | java.util; net.leanix.api; | 1,946,928 |
@Override public void exitSelectorNullValue(@NotNull QueryGrammarParser.SelectorNullValueContext ctx) { } | @Override public void exitSelectorNullValue(@NotNull QueryGrammarParser.SelectorNullValueContext ctx) { } | /**
* {@inheritDoc}
* <p/>
* The default implementation does nothing.
*/ | The default implementation does nothing | enterSelectorNullValue | {
"repo_name": "pmeisen/dis-timeintervaldataanalyzer",
"path": "src/net/meisen/dissertation/impl/parser/query/generated/QueryGrammarBaseListener.java",
"license": "bsd-3-clause",
"size": 33327
} | [
"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; | 1,760,870 |
public boolean canGrow(World worldIn, BlockPos pos, IBlockState state, boolean isClient)
{
return ((Integer)state.getValue(AGE)).intValue() != 7;
} | boolean function(World worldIn, BlockPos pos, IBlockState state, boolean isClient) { return ((Integer)state.getValue(AGE)).intValue() != 7; } | /**
* Whether this IGrowable can grow
*/ | Whether this IGrowable can grow | canGrow | {
"repo_name": "Im-Jrotica/forge_latest",
"path": "build/tmp/recompileMc/sources/net/minecraft/block/BlockStem.java",
"license": "lgpl-2.1",
"size": 7467
} | [
"net.minecraft.block.state.IBlockState",
"net.minecraft.util.math.BlockPos",
"net.minecraft.world.World"
] | import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; | import net.minecraft.block.state.*; import net.minecraft.util.math.*; import net.minecraft.world.*; | [
"net.minecraft.block",
"net.minecraft.util",
"net.minecraft.world"
] | net.minecraft.block; net.minecraft.util; net.minecraft.world; | 2,463,320 |
@Nullable private static QueryPropertyAccessor findProperty(String prop, Class<?> cls) {
StringBuilder getBldr = new StringBuilder("get");
getBldr.append(prop);
getBldr.setCharAt(3, Character.toUpperCase(getBldr.charAt(3)));
StringBuilder setBldr = new StringBuilder("set");
setBldr.append(prop);
setBldr.setCharAt(3, Character.toUpperCase(setBldr.charAt(3)));
try {
Method getter = cls.getMethod(getBldr.toString());
Method setter;
try {
// Setter has to have the same name like 'setXxx' and single param of the same type
// as the return type of the getter.
setter = cls.getMethod(setBldr.toString(), getter.getReturnType());
}
catch (NoSuchMethodException ignore) {
// Have getter, but no setter - return read-only accessor.
return new QueryReadOnlyMethodsAccessor(getter, prop);
}
return new QueryMethodsAccessor(getter, setter, prop);
}
catch (NoSuchMethodException ignore) {
// No-op.
}
getBldr = new StringBuilder("is");
getBldr.append(prop);
getBldr.setCharAt(2, Character.toUpperCase(getBldr.charAt(2)));
// We do nothing about setBldr here as it corresponds to setProperty name which is what we need
// for boolean property setter as well
try {
Method getter = cls.getMethod(getBldr.toString());
Method setter;
try {
// Setter has to have the same name like 'setXxx' and single param of the same type
// as the return type of the getter.
setter = cls.getMethod(setBldr.toString(), getter.getReturnType());
}
catch (NoSuchMethodException ignore) {
// Have getter, but no setter - return read-only accessor.
return new QueryReadOnlyMethodsAccessor(getter, prop);
}
return new QueryMethodsAccessor(getter, setter, prop);
}
catch (NoSuchMethodException ignore) {
// No-op.
}
Class cls0 = cls;
while (cls0 != null)
try {
return new QueryFieldAccessor(cls0.getDeclaredField(prop));
}
catch (NoSuchFieldException ignored) {
cls0 = cls0.getSuperclass();
}
try {
Method getter = cls.getMethod(prop);
Method setter;
try {
// Setter has to have the same name and single param of the same type
// as the return type of the getter.
setter = cls.getMethod(prop, getter.getReturnType());
}
catch (NoSuchMethodException ignore) {
// Have getter, but no setter - return read-only accessor.
return new QueryReadOnlyMethodsAccessor(getter, prop);
}
return new QueryMethodsAccessor(getter, setter, prop);
}
catch (NoSuchMethodException ignored) {
// No-op.
}
// No luck.
return null;
} | @Nullable static QueryPropertyAccessor function(String prop, Class<?> cls) { StringBuilder getBldr = new StringBuilder("get"); getBldr.append(prop); getBldr.setCharAt(3, Character.toUpperCase(getBldr.charAt(3))); StringBuilder setBldr = new StringBuilder("set"); setBldr.append(prop); setBldr.setCharAt(3, Character.toUpperCase(setBldr.charAt(3))); try { Method getter = cls.getMethod(getBldr.toString()); Method setter; try { setter = cls.getMethod(setBldr.toString(), getter.getReturnType()); } catch (NoSuchMethodException ignore) { return new QueryReadOnlyMethodsAccessor(getter, prop); } return new QueryMethodsAccessor(getter, setter, prop); } catch (NoSuchMethodException ignore) { } getBldr = new StringBuilder("is"); getBldr.append(prop); getBldr.setCharAt(2, Character.toUpperCase(getBldr.charAt(2))); try { Method getter = cls.getMethod(getBldr.toString()); Method setter; try { setter = cls.getMethod(setBldr.toString(), getter.getReturnType()); } catch (NoSuchMethodException ignore) { return new QueryReadOnlyMethodsAccessor(getter, prop); } return new QueryMethodsAccessor(getter, setter, prop); } catch (NoSuchMethodException ignore) { } Class cls0 = cls; while (cls0 != null) try { return new QueryFieldAccessor(cls0.getDeclaredField(prop)); } catch (NoSuchFieldException ignored) { cls0 = cls0.getSuperclass(); } try { Method getter = cls.getMethod(prop); Method setter; try { setter = cls.getMethod(prop, getter.getReturnType()); } catch (NoSuchMethodException ignore) { return new QueryReadOnlyMethodsAccessor(getter, prop); } return new QueryMethodsAccessor(getter, setter, prop); } catch (NoSuchMethodException ignored) { } return null; } | /**
* Find a member (either a getter method or a field) with given name of given class.
* @param prop Property name.
* @param cls Class to search for a member in.
* @return Member for given name.
*/ | Find a member (either a getter method or a field) with given name of given class | findProperty | {
"repo_name": "endian675/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java",
"license": "apache-2.0",
"size": 49969
} | [
"java.lang.reflect.Method",
"org.apache.ignite.internal.processors.query.property.QueryFieldAccessor",
"org.apache.ignite.internal.processors.query.property.QueryMethodsAccessor",
"org.apache.ignite.internal.processors.query.property.QueryPropertyAccessor",
"org.apache.ignite.internal.processors.query.property.QueryReadOnlyMethodsAccessor",
"org.jetbrains.annotations.Nullable"
] | import java.lang.reflect.Method; import org.apache.ignite.internal.processors.query.property.QueryFieldAccessor; import org.apache.ignite.internal.processors.query.property.QueryMethodsAccessor; import org.apache.ignite.internal.processors.query.property.QueryPropertyAccessor; import org.apache.ignite.internal.processors.query.property.QueryReadOnlyMethodsAccessor; import org.jetbrains.annotations.Nullable; | import java.lang.reflect.*; import org.apache.ignite.internal.processors.query.property.*; import org.jetbrains.annotations.*; | [
"java.lang",
"org.apache.ignite",
"org.jetbrains.annotations"
] | java.lang; org.apache.ignite; org.jetbrains.annotations; | 2,787,005 |
protected void initializeEditingDomain() {
// Create an adapter factory that yields item providers.
//
adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new UppaalItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new CoreItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new TypesItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new DeclarationsItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new GlobalItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new SystemItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new TemplatesItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new StatementsItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new ExpressionsItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new VisualsItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
// Create the command stack that will notify this editor as commands are executed.
//
BasicCommandStack commandStack = new BasicCommandStack();
| void function() { adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE); adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory()); adapterFactory.addAdapterFactory(new UppaalItemProviderAdapterFactory()); adapterFactory.addAdapterFactory(new CoreItemProviderAdapterFactory()); adapterFactory.addAdapterFactory(new TypesItemProviderAdapterFactory()); adapterFactory.addAdapterFactory(new DeclarationsItemProviderAdapterFactory()); adapterFactory.addAdapterFactory(new GlobalItemProviderAdapterFactory()); adapterFactory.addAdapterFactory(new SystemItemProviderAdapterFactory()); adapterFactory.addAdapterFactory(new TemplatesItemProviderAdapterFactory()); adapterFactory.addAdapterFactory(new StatementsItemProviderAdapterFactory()); adapterFactory.addAdapterFactory(new ExpressionsItemProviderAdapterFactory()); adapterFactory.addAdapterFactory(new VisualsItemProviderAdapterFactory()); adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory()); BasicCommandStack commandStack = new BasicCommandStack(); | /**
* This sets up the editing domain for the model editor.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This sets up the editing domain for the model editor. | initializeEditingDomain | {
"repo_name": "uppaal-emf/uppaal",
"path": "metamodel/org.muml.uppaal.editor/src/org/muml/uppaal/visuals/presentation/VisualsEditor.java",
"license": "epl-1.0",
"size": 57266
} | [
"org.eclipse.emf.common.command.BasicCommandStack",
"org.eclipse.emf.edit.provider.ComposedAdapterFactory",
"org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory",
"org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory",
"org.muml.uppaal.core.provider.CoreItemProviderAdapterFactory",
"org.muml.uppaal.declarations.global.provider.GlobalItemProviderAdapterFactory",
"org.muml.uppaal.declarations.provider.DeclarationsItemProviderAdapterFactory",
"org.muml.uppaal.declarations.system.provider.SystemItemProviderAdapterFactory",
"org.muml.uppaal.expressions.provider.ExpressionsItemProviderAdapterFactory",
"org.muml.uppaal.provider.UppaalItemProviderAdapterFactory",
"org.muml.uppaal.statements.provider.StatementsItemProviderAdapterFactory",
"org.muml.uppaal.templates.provider.TemplatesItemProviderAdapterFactory",
"org.muml.uppaal.types.provider.TypesItemProviderAdapterFactory",
"org.muml.uppaal.visuals.provider.VisualsItemProviderAdapterFactory"
] | import org.eclipse.emf.common.command.BasicCommandStack; import org.eclipse.emf.edit.provider.ComposedAdapterFactory; import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory; import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory; import org.muml.uppaal.core.provider.CoreItemProviderAdapterFactory; import org.muml.uppaal.declarations.global.provider.GlobalItemProviderAdapterFactory; import org.muml.uppaal.declarations.provider.DeclarationsItemProviderAdapterFactory; import org.muml.uppaal.declarations.system.provider.SystemItemProviderAdapterFactory; import org.muml.uppaal.expressions.provider.ExpressionsItemProviderAdapterFactory; import org.muml.uppaal.provider.UppaalItemProviderAdapterFactory; import org.muml.uppaal.statements.provider.StatementsItemProviderAdapterFactory; import org.muml.uppaal.templates.provider.TemplatesItemProviderAdapterFactory; import org.muml.uppaal.types.provider.TypesItemProviderAdapterFactory; import org.muml.uppaal.visuals.provider.VisualsItemProviderAdapterFactory; | import org.eclipse.emf.common.command.*; import org.eclipse.emf.edit.provider.*; import org.eclipse.emf.edit.provider.resource.*; import org.muml.uppaal.core.provider.*; import org.muml.uppaal.declarations.global.provider.*; import org.muml.uppaal.declarations.provider.*; import org.muml.uppaal.declarations.system.provider.*; import org.muml.uppaal.expressions.provider.*; import org.muml.uppaal.provider.*; import org.muml.uppaal.statements.provider.*; import org.muml.uppaal.templates.provider.*; import org.muml.uppaal.types.provider.*; import org.muml.uppaal.visuals.provider.*; | [
"org.eclipse.emf",
"org.muml.uppaal"
] | org.eclipse.emf; org.muml.uppaal; | 427,917 |
private void closeChannel(Channel channel) {
if (channel != null) {
try {
channel.close();
} catch (IOException e1) {
LoggerUtils.logMsg(logger, repImpl, formatter, Level.WARNING,
"Exception during cleanup: " +
e1.getMessage());
}
}
} | void function(Channel channel) { if (channel != null) { try { channel.close(); } catch (IOException e1) { LoggerUtils.logMsg(logger, repImpl, formatter, Level.WARNING, STR + e1.getMessage()); } } } | /**
* Closes the channel, logging any resulting exceptions.
*
* @param channel the channel being closed
*/ | Closes the channel, logging any resulting exceptions | closeChannel | {
"repo_name": "bjorndm/prebake",
"path": "code/third_party/bdb/src/com/sleepycat/je/rep/utilint/ServiceDispatcher.java",
"license": "apache-2.0",
"size": 37175
} | [
"com.sleepycat.je.utilint.LoggerUtils",
"java.io.IOException",
"java.nio.channels.Channel",
"java.util.logging.Level"
] | import com.sleepycat.je.utilint.LoggerUtils; import java.io.IOException; import java.nio.channels.Channel; import java.util.logging.Level; | import com.sleepycat.je.utilint.*; import java.io.*; import java.nio.channels.*; import java.util.logging.*; | [
"com.sleepycat.je",
"java.io",
"java.nio",
"java.util"
] | com.sleepycat.je; java.io; java.nio; java.util; | 1,701,984 |
public CppLinkActionBuilder addLinkParams(
CcLinkParams linkParams, RuleErrorConsumer errorListener) throws InterruptedException {
addLinkopts(linkParams.flattenedLinkopts());
addLibraries(linkParams.getLibraries());
ExtraLinkTimeLibraries extraLinkTimeLibraries = linkParams.getExtraLinkTimeLibraries();
if (extraLinkTimeLibraries != null) {
for (ExtraLinkTimeLibrary extraLibrary : extraLinkTimeLibraries.getExtraLibraries()) {
addLibraries(extraLibrary.buildLibraries(ruleContext));
}
}
addLinkstamps(CppHelper.resolveLinkstamps(errorListener, linkParams));
return this;
} | CppLinkActionBuilder function( CcLinkParams linkParams, RuleErrorConsumer errorListener) throws InterruptedException { addLinkopts(linkParams.flattenedLinkopts()); addLibraries(linkParams.getLibraries()); ExtraLinkTimeLibraries extraLinkTimeLibraries = linkParams.getExtraLinkTimeLibraries(); if (extraLinkTimeLibraries != null) { for (ExtraLinkTimeLibrary extraLibrary : extraLinkTimeLibraries.getExtraLibraries()) { addLibraries(extraLibrary.buildLibraries(ruleContext)); } } addLinkstamps(CppHelper.resolveLinkstamps(errorListener, linkParams)); return this; } | /**
* Merges the given link params into this builder by calling {@link #addLinkopts}, {@link
* #addLibraries}, and {@link #addLinkstamps}.
*/ | Merges the given link params into this builder by calling <code>#addLinkopts</code>, <code>#addLibraries</code>, and <code>#addLinkstamps</code> | addLinkParams | {
"repo_name": "LuminateWireless/bazel",
"path": "src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java",
"license": "apache-2.0",
"size": 67732
} | [
"com.google.devtools.build.lib.packages.RuleErrorConsumer"
] | import com.google.devtools.build.lib.packages.RuleErrorConsumer; | import com.google.devtools.build.lib.packages.*; | [
"com.google.devtools"
] | com.google.devtools; | 58,219 |
public Object eval(String script, Map<String, Object> bindings) {
return createEvaluator().eval(script, bindings);
} | Object function(String script, Map<String, Object> bindings) { return createEvaluator().eval(script, bindings); } | /**
* Evaluate script with given bindings
*
* @param script
* the script
* @param bindings
* the bindings
* @return the object
*/ | Evaluate script with given bindings | eval | {
"repo_name": "SirmaITT/conservation-space-1.7.0",
"path": "docker/sirma-platform/platform/seip-parent/extensions/scripts/src/test/java/com/sirma/itt/seip/script/ScriptTest.java",
"license": "lgpl-3.0",
"size": 3914
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 854,628 |
@Test
public void testBlockIdCKDecommission() throws Exception {
final short REPL_FACTOR = 1;
short NUM_DN = 2;
final long blockSize = 512;
boolean checkDecommissionInProgress = false;
String [] racks = {"/rack1", "/rack2"};
String [] hosts = {"host1", "host2"};
Configuration conf = new Configuration();
conf.setLong(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, blockSize);
conf.setInt(DFSConfigKeys.DFS_REPLICATION_KEY, 2);
MiniDFSCluster cluster;
DistributedFileSystem dfs ;
cluster =
new MiniDFSCluster.Builder(conf).numDataNodes(NUM_DN).hosts(hosts)
.racks(racks).build();
assertNotNull("Failed Cluster Creation", cluster);
cluster.waitClusterUp();
dfs = cluster.getFileSystem();
assertNotNull("Failed to get FileSystem", dfs);
DFSTestUtil util = new DFSTestUtil.Builder().
setName(getClass().getSimpleName()).setNumFiles(1).build();
//create files
final String pathString = new String("/testfile");
final Path path = new Path(pathString);
util.createFile(dfs, path, 1024, REPL_FACTOR, 1000L);
util.waitReplication(dfs, path, REPL_FACTOR);
StringBuilder sb = new StringBuilder();
for (LocatedBlock lb: util.getAllBlocks(dfs, path)){
sb.append(lb.getBlock().getLocalBlock().getBlockName()+" ");
}
String[] bIds = sb.toString().split(" ");
try {
//make sure datanode that has replica is fine before decommission
String outStr = runFsck(conf, 0, true, "/", "-blockId", bIds[0]);
System.out.println(outStr);
assertTrue(outStr.contains(NamenodeFsck.HEALTHY_STATUS));
//decommission datanode
FSNamesystem fsn = cluster.getNameNode().getNamesystem();
BlockManager bm = fsn.getBlockManager();
ExtendedBlock eb = util.getFirstBlock(dfs, path);
BlockCollection bc = null;
try {
fsn.writeLock();
BlockInfo bi = bm.getStoredBlock(eb.getLocalBlock());
bc = bm.getBlockCollection(bi);
} finally {
fsn.writeUnlock();
}
DatanodeDescriptor dn = bc.getBlocks()[0].getDatanode(0);
bm.getDatanodeManager().getDecomManager().startDecommission(dn);
String dnName = dn.getXferAddr();
//wait for decommission start
DatanodeInfo datanodeInfo = null;
int count = 0;
do {
Thread.sleep(2000);
for (DatanodeInfo info : dfs.getDataNodeStats()) {
if (dnName.equals(info.getXferAddr())) {
datanodeInfo = info;
}
}
//check decommissioning only once
if(!checkDecommissionInProgress && datanodeInfo != null
&& datanodeInfo.isDecommissionInProgress()) {
String fsckOut = runFsck(conf, 3, true, "/", "-blockId", bIds[0]);
assertTrue(fsckOut.contains(NamenodeFsck.DECOMMISSIONING_STATUS));
checkDecommissionInProgress = true;
}
} while (datanodeInfo != null && !datanodeInfo.isDecommissioned());
//check decommissioned
String fsckOut = runFsck(conf, 2, true, "/", "-blockId", bIds[0]);
assertTrue(fsckOut.contains(NamenodeFsck.DECOMMISSIONED_STATUS));
} finally {
if (cluster != null) {
cluster.shutdown();
}
}
} | void function() throws Exception { final short REPL_FACTOR = 1; short NUM_DN = 2; final long blockSize = 512; boolean checkDecommissionInProgress = false; String [] racks = {STR, STR}; String [] hosts = {"host1", "host2"}; Configuration conf = new Configuration(); conf.setLong(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, blockSize); conf.setInt(DFSConfigKeys.DFS_REPLICATION_KEY, 2); MiniDFSCluster cluster; DistributedFileSystem dfs ; cluster = new MiniDFSCluster.Builder(conf).numDataNodes(NUM_DN).hosts(hosts) .racks(racks).build(); assertNotNull(STR, cluster); cluster.waitClusterUp(); dfs = cluster.getFileSystem(); assertNotNull(STR, dfs); DFSTestUtil util = new DFSTestUtil.Builder(). setName(getClass().getSimpleName()).setNumFiles(1).build(); final String pathString = new String(STR); final Path path = new Path(pathString); util.createFile(dfs, path, 1024, REPL_FACTOR, 1000L); util.waitReplication(dfs, path, REPL_FACTOR); StringBuilder sb = new StringBuilder(); for (LocatedBlock lb: util.getAllBlocks(dfs, path)){ sb.append(lb.getBlock().getLocalBlock().getBlockName()+" "); } String[] bIds = sb.toString().split(" "); try { String outStr = runFsck(conf, 0, true, "/", STR, bIds[0]); System.out.println(outStr); assertTrue(outStr.contains(NamenodeFsck.HEALTHY_STATUS)); FSNamesystem fsn = cluster.getNameNode().getNamesystem(); BlockManager bm = fsn.getBlockManager(); ExtendedBlock eb = util.getFirstBlock(dfs, path); BlockCollection bc = null; try { fsn.writeLock(); BlockInfo bi = bm.getStoredBlock(eb.getLocalBlock()); bc = bm.getBlockCollection(bi); } finally { fsn.writeUnlock(); } DatanodeDescriptor dn = bc.getBlocks()[0].getDatanode(0); bm.getDatanodeManager().getDecomManager().startDecommission(dn); String dnName = dn.getXferAddr(); DatanodeInfo datanodeInfo = null; int count = 0; do { Thread.sleep(2000); for (DatanodeInfo info : dfs.getDataNodeStats()) { if (dnName.equals(info.getXferAddr())) { datanodeInfo = info; } } if(!checkDecommissionInProgress && datanodeInfo != null && datanodeInfo.isDecommissionInProgress()) { String fsckOut = runFsck(conf, 3, true, "/", STR, bIds[0]); assertTrue(fsckOut.contains(NamenodeFsck.DECOMMISSIONING_STATUS)); checkDecommissionInProgress = true; } } while (datanodeInfo != null && !datanodeInfo.isDecommissioned()); String fsckOut = runFsck(conf, 2, true, "/", STR, bIds[0]); assertTrue(fsckOut.contains(NamenodeFsck.DECOMMISSIONED_STATUS)); } finally { if (cluster != null) { cluster.shutdown(); } } } | /**
* Test for blockIdCK with datanode decommission
*/ | Test for blockIdCK with datanode decommission | testBlockIdCKDecommission | {
"repo_name": "Microsoft-CISL/hadoop-prototype",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestFsck.java",
"license": "apache-2.0",
"size": 66364
} | [
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.hdfs.DFSConfigKeys",
"org.apache.hadoop.hdfs.DFSTestUtil",
"org.apache.hadoop.hdfs.DistributedFileSystem",
"org.apache.hadoop.hdfs.MiniDFSCluster",
"org.apache.hadoop.hdfs.protocol.DatanodeInfo",
"org.apache.hadoop.hdfs.protocol.ExtendedBlock",
"org.apache.hadoop.hdfs.protocol.LocatedBlock",
"org.apache.hadoop.hdfs.server.blockmanagement.BlockCollection",
"org.apache.hadoop.hdfs.server.blockmanagement.BlockInfo",
"org.apache.hadoop.hdfs.server.blockmanagement.BlockManager",
"org.apache.hadoop.hdfs.server.blockmanagement.DatanodeDescriptor",
"org.junit.Assert"
] | import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hdfs.DFSConfigKeys; import org.apache.hadoop.hdfs.DFSTestUtil; import org.apache.hadoop.hdfs.DistributedFileSystem; import org.apache.hadoop.hdfs.MiniDFSCluster; import org.apache.hadoop.hdfs.protocol.DatanodeInfo; import org.apache.hadoop.hdfs.protocol.ExtendedBlock; import org.apache.hadoop.hdfs.protocol.LocatedBlock; import org.apache.hadoop.hdfs.server.blockmanagement.BlockCollection; import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfo; import org.apache.hadoop.hdfs.server.blockmanagement.BlockManager; import org.apache.hadoop.hdfs.server.blockmanagement.DatanodeDescriptor; import org.junit.Assert; | import org.apache.hadoop.conf.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hdfs.*; import org.apache.hadoop.hdfs.protocol.*; import org.apache.hadoop.hdfs.server.blockmanagement.*; import org.junit.*; | [
"org.apache.hadoop",
"org.junit"
] | org.apache.hadoop; org.junit; | 1,744,424 |
private void findEigenVectorsFromSchur(final SchurTransformer schur) {
final double[][] matrixT = schur.getT().getData();
final double[][] matrixP = schur.getP().getData();
final int n = matrixT.length;
// compute matrix norm
double norm = 0.0;
for (int i = 0; i < n; i++) {
for (int j = FastMath.max(i - 1, 0); j < n; j++) {
norm = norm + FastMath.abs(matrixT[i][j]);
}
}
if (Precision.equals(norm, 0.0)) {
// TODO: we can not handle a zero matrix, what exception to throw?
return;
}
// Backsubstitute to find vectors of upper triangular form
double r = 0.0;
double s = 0.0;
double z = 0.0;
for (int idx = n - 1; idx >= 0; idx--) {
double p = realEigenvalues[idx];
double q = imagEigenvalues[idx];
if (Precision.equals(q, 0.0)) {
// Real vector
int l = idx;
matrixT[idx][idx] = 1.0;
for (int i = idx - 1; i >= 0; i--) {
double w = matrixT[i][i] - p;
r = 0.0;
for (int j = l; j <= idx; j++) {
r = r + matrixT[i][j] * matrixT[j][idx];
}
if (Precision.compareTo(imagEigenvalues[i], 0.0, epsilon) < 0.0) {
z = w;
s = r;
} else {
l = i;
if (Precision.equals(imagEigenvalues[i], 0.0)) {
if (w != 0.0) {
matrixT[i][idx] = -r / w;
} else {
matrixT[i][idx] = -r / (Precision.EPSILON * norm);
}
} else {
// Solve real equations
double x = matrixT[i][i + 1];
double y = matrixT[i + 1][i];
q = (realEigenvalues[i] - p) * (realEigenvalues[i] - p) +
imagEigenvalues[i] * imagEigenvalues[i];
double t = (x * s - z * r) / q;
matrixT[i][idx] = t;
if (FastMath.abs(x) > FastMath.abs(z)) {
matrixT[i + 1][idx] = (-r - w * t) / x;
} else {
matrixT[i + 1][idx] = (-s - y * t) / z;
}
}
// Overflow control
double t = FastMath.abs(matrixT[i][idx]);
if ((Precision.EPSILON * t) * t > 1) {
for (int j = i; j <= idx; j++) {
matrixT[j][idx] = matrixT[j][idx] / t;
}
}
}
}
} else if (q < 0.0) {
// Complex vector
int l = idx - 1;
// Last vector component imaginary so matrix is triangular
if (FastMath.abs(matrixT[idx][idx - 1]) > FastMath.abs(matrixT[idx - 1][idx])) {
matrixT[idx - 1][idx - 1] = q / matrixT[idx][idx - 1];
matrixT[idx - 1][idx] = -(matrixT[idx][idx] - p) / matrixT[idx][idx - 1];
} else {
final Complex result = cdiv(0.0, -matrixT[idx - 1][idx],
matrixT[idx - 1][idx - 1] - p, q);
matrixT[idx - 1][idx - 1] = result.getReal();
matrixT[idx - 1][idx] = result.getImaginary();
}
matrixT[idx][idx - 1] = 0.0;
matrixT[idx][idx] = 1.0;
for (int i = idx - 2; i >= 0; i--) {
double ra = 0.0;
double sa = 0.0;
for (int j = l; j <= idx; j++) {
ra = ra + matrixT[i][j] * matrixT[j][idx - 1];
sa = sa + matrixT[i][j] * matrixT[j][idx];
}
double w = matrixT[i][i] - p;
if (Precision.compareTo(imagEigenvalues[i], 0.0, epsilon) < 0.0) {
z = w;
r = ra;
s = sa;
} else {
l = i;
if (Precision.equals(imagEigenvalues[i], 0.0)) {
final Complex c = cdiv(-ra, -sa, w, q);
matrixT[i][idx - 1] = c.getReal();
matrixT[i][idx] = c.getImaginary();
} else {
// Solve complex equations
double x = matrixT[i][i + 1];
double y = matrixT[i + 1][i];
double vr = (realEigenvalues[i] - p) * (realEigenvalues[i] - p) +
imagEigenvalues[i] * imagEigenvalues[i] - q * q;
final double vi = (realEigenvalues[i] - p) * 2.0 * q;
if (Precision.equals(vr, 0.0) && Precision.equals(vi, 0.0)) {
vr = Precision.EPSILON * norm *
(FastMath.abs(w) + FastMath.abs(q) + FastMath.abs(x) +
FastMath.abs(y) + FastMath.abs(z));
}
final Complex c = cdiv(x * r - z * ra + q * sa,
x * s - z * sa - q * ra, vr, vi);
matrixT[i][idx - 1] = c.getReal();
matrixT[i][idx] = c.getImaginary();
if (FastMath.abs(x) > (FastMath.abs(z) + FastMath.abs(q))) {
matrixT[i + 1][idx - 1] = (-ra - w * matrixT[i][idx - 1] +
q * matrixT[i][idx]) / x;
matrixT[i + 1][idx] = (-sa - w * matrixT[i][idx] -
q * matrixT[i][idx - 1]) / x;
} else {
final Complex c2 = cdiv(-r - y * matrixT[i][idx - 1],
-s - y * matrixT[i][idx], z, q);
matrixT[i + 1][idx - 1] = c2.getReal();
matrixT[i + 1][idx] = c2.getImaginary();
}
}
// Overflow control
double t = FastMath.max(FastMath.abs(matrixT[i][idx - 1]),
FastMath.abs(matrixT[i][idx]));
if ((Precision.EPSILON * t) * t > 1) {
for (int j = i; j <= idx; j++) {
matrixT[j][idx - 1] = matrixT[j][idx - 1] / t;
matrixT[j][idx] = matrixT[j][idx] / t;
}
}
}
}
}
}
// Vectors of isolated roots
for (int i = 0; i < n; i++) {
if (i < 0 | i > n - 1) {
for (int j = i; j < n; j++) {
matrixP[i][j] = matrixT[i][j];
}
}
}
// Back transformation to get eigenvectors of original matrix
for (int j = n - 1; j >= 0; j--) {
for (int i = 0; i <= n - 1; i++) {
z = 0.0;
for (int k = 0; k <= FastMath.min(j, n - 1); k++) {
z = z + matrixP[i][k] * matrixT[k][j];
}
matrixP[i][j] = z;
}
}
eigenvectors = new ArrayRealVector[n];
final double[] tmp = new double[n];
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
tmp[j] = matrixP[j][i];
}
eigenvectors[i] = new ArrayRealVector(tmp);
}
} | void function(final SchurTransformer schur) { final double[][] matrixT = schur.getT().getData(); final double[][] matrixP = schur.getP().getData(); final int n = matrixT.length; double norm = 0.0; for (int i = 0; i < n; i++) { for (int j = FastMath.max(i - 1, 0); j < n; j++) { norm = norm + FastMath.abs(matrixT[i][j]); } } if (Precision.equals(norm, 0.0)) { return; } double r = 0.0; double s = 0.0; double z = 0.0; for (int idx = n - 1; idx >= 0; idx--) { double p = realEigenvalues[idx]; double q = imagEigenvalues[idx]; if (Precision.equals(q, 0.0)) { int l = idx; matrixT[idx][idx] = 1.0; for (int i = idx - 1; i >= 0; i--) { double w = matrixT[i][i] - p; r = 0.0; for (int j = l; j <= idx; j++) { r = r + matrixT[i][j] * matrixT[j][idx]; } if (Precision.compareTo(imagEigenvalues[i], 0.0, epsilon) < 0.0) { z = w; s = r; } else { l = i; if (Precision.equals(imagEigenvalues[i], 0.0)) { if (w != 0.0) { matrixT[i][idx] = -r / w; } else { matrixT[i][idx] = -r / (Precision.EPSILON * norm); } } else { double x = matrixT[i][i + 1]; double y = matrixT[i + 1][i]; q = (realEigenvalues[i] - p) * (realEigenvalues[i] - p) + imagEigenvalues[i] * imagEigenvalues[i]; double t = (x * s - z * r) / q; matrixT[i][idx] = t; if (FastMath.abs(x) > FastMath.abs(z)) { matrixT[i + 1][idx] = (-r - w * t) / x; } else { matrixT[i + 1][idx] = (-s - y * t) / z; } } double t = FastMath.abs(matrixT[i][idx]); if ((Precision.EPSILON * t) * t > 1) { for (int j = i; j <= idx; j++) { matrixT[j][idx] = matrixT[j][idx] / t; } } } } } else if (q < 0.0) { int l = idx - 1; if (FastMath.abs(matrixT[idx][idx - 1]) > FastMath.abs(matrixT[idx - 1][idx])) { matrixT[idx - 1][idx - 1] = q / matrixT[idx][idx - 1]; matrixT[idx - 1][idx] = -(matrixT[idx][idx] - p) / matrixT[idx][idx - 1]; } else { final Complex result = cdiv(0.0, -matrixT[idx - 1][idx], matrixT[idx - 1][idx - 1] - p, q); matrixT[idx - 1][idx - 1] = result.getReal(); matrixT[idx - 1][idx] = result.getImaginary(); } matrixT[idx][idx - 1] = 0.0; matrixT[idx][idx] = 1.0; for (int i = idx - 2; i >= 0; i--) { double ra = 0.0; double sa = 0.0; for (int j = l; j <= idx; j++) { ra = ra + matrixT[i][j] * matrixT[j][idx - 1]; sa = sa + matrixT[i][j] * matrixT[j][idx]; } double w = matrixT[i][i] - p; if (Precision.compareTo(imagEigenvalues[i], 0.0, epsilon) < 0.0) { z = w; r = ra; s = sa; } else { l = i; if (Precision.equals(imagEigenvalues[i], 0.0)) { final Complex c = cdiv(-ra, -sa, w, q); matrixT[i][idx - 1] = c.getReal(); matrixT[i][idx] = c.getImaginary(); } else { double x = matrixT[i][i + 1]; double y = matrixT[i + 1][i]; double vr = (realEigenvalues[i] - p) * (realEigenvalues[i] - p) + imagEigenvalues[i] * imagEigenvalues[i] - q * q; final double vi = (realEigenvalues[i] - p) * 2.0 * q; if (Precision.equals(vr, 0.0) && Precision.equals(vi, 0.0)) { vr = Precision.EPSILON * norm * (FastMath.abs(w) + FastMath.abs(q) + FastMath.abs(x) + FastMath.abs(y) + FastMath.abs(z)); } final Complex c = cdiv(x * r - z * ra + q * sa, x * s - z * sa - q * ra, vr, vi); matrixT[i][idx - 1] = c.getReal(); matrixT[i][idx] = c.getImaginary(); if (FastMath.abs(x) > (FastMath.abs(z) + FastMath.abs(q))) { matrixT[i + 1][idx - 1] = (-ra - w * matrixT[i][idx - 1] + q * matrixT[i][idx]) / x; matrixT[i + 1][idx] = (-sa - w * matrixT[i][idx] - q * matrixT[i][idx - 1]) / x; } else { final Complex c2 = cdiv(-r - y * matrixT[i][idx - 1], -s - y * matrixT[i][idx], z, q); matrixT[i + 1][idx - 1] = c2.getReal(); matrixT[i + 1][idx] = c2.getImaginary(); } } double t = FastMath.max(FastMath.abs(matrixT[i][idx - 1]), FastMath.abs(matrixT[i][idx])); if ((Precision.EPSILON * t) * t > 1) { for (int j = i; j <= idx; j++) { matrixT[j][idx - 1] = matrixT[j][idx - 1] / t; matrixT[j][idx] = matrixT[j][idx] / t; } } } } } } for (int i = 0; i < n; i++) { if (i < 0 i > n - 1) { for (int j = i; j < n; j++) { matrixP[i][j] = matrixT[i][j]; } } } for (int j = n - 1; j >= 0; j--) { for (int i = 0; i <= n - 1; i++) { z = 0.0; for (int k = 0; k <= FastMath.min(j, n - 1); k++) { z = z + matrixP[i][k] * matrixT[k][j]; } matrixP[i][j] = z; } } eigenvectors = new ArrayRealVector[n]; final double[] tmp = new double[n]; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { tmp[j] = matrixP[j][i]; } eigenvectors[i] = new ArrayRealVector(tmp); } } | /**
* Find eigenvectors from a matrix transformed to Schur form.
*
* @param schur the schur transformation of the matrix
*/ | Find eigenvectors from a matrix transformed to Schur form | findEigenVectorsFromSchur | {
"repo_name": "SpoonLabs/astor",
"path": "examples/math_32/src/main/java/org/apache/commons/math3/linear/EigenDecomposition.java",
"license": "gpl-2.0",
"size": 34614
} | [
"org.apache.commons.math3.complex.Complex",
"org.apache.commons.math3.util.FastMath",
"org.apache.commons.math3.util.Precision"
] | import org.apache.commons.math3.complex.Complex; import org.apache.commons.math3.util.FastMath; import org.apache.commons.math3.util.Precision; | import org.apache.commons.math3.complex.*; import org.apache.commons.math3.util.*; | [
"org.apache.commons"
] | org.apache.commons; | 2,732,593 |
public static int[] getRanks(String name){
//remove accents
String name_no_accents=Datagram.removeAccents(name);
//get scores
String ranks=getWsAnswer("getrank.php?name="+name_no_accents);
if(ranks==null){
return null;
}
//{"name":"Ersatz","general_rank":3,"hunter_rank":3,"brute_rank":2,"winner_rank":3,"star_rank":5,"nb_players":82}
try{
Object obj=JSONValue.parse(ranks);
JSONObject jso=(JSONObject)obj;
int general_rank=Integer.parseInt(jso.get("general_rank").toString());
int hunter_rank=Integer.parseInt(jso.get("hunter_rank").toString());
int brute_rank=Integer.parseInt(jso.get("brute_rank").toString());
int winner_rank=Integer.parseInt(jso.get("winner_rank").toString());
int star_rank=Integer.parseInt(jso.get("star_rank").toString());
int nb_players=Integer.parseInt(jso.get("nb_players").toString());
return new int[]{general_rank,nb_players,hunter_rank,brute_rank,winner_rank,star_rank};
}catch(Exception e){
SimpleLog.logger.warn("Error while parsing json for rank");
return null;
}
} | static int[] function(String name){ String name_no_accents=Datagram.removeAccents(name); String ranks=getWsAnswer(STR+name_no_accents); if(ranks==null){ return null; } try{ Object obj=JSONValue.parse(ranks); JSONObject jso=(JSONObject)obj; int general_rank=Integer.parseInt(jso.get(STR).toString()); int hunter_rank=Integer.parseInt(jso.get(STR).toString()); int brute_rank=Integer.parseInt(jso.get(STR).toString()); int winner_rank=Integer.parseInt(jso.get(STR).toString()); int star_rank=Integer.parseInt(jso.get(STR).toString()); int nb_players=Integer.parseInt(jso.get(STR).toString()); return new int[]{general_rank,nb_players,hunter_rank,brute_rank,winner_rank,star_rank}; }catch(Exception e){ SimpleLog.logger.warn(STR); return null; } } | /**
* Get all the ranks for a given name
* @param name the name for which to search the ranks
* @return the ranks as an in array
*/ | Get all the ranks for a given name | getRanks | {
"repo_name": "inouire/baggle",
"path": "baggle-client/src/inouire/baggle/client/threads/MasterServerHTTPConnection.java",
"license": "gpl-3.0",
"size": 9031
} | [
"org.json.simple.JSONObject",
"org.json.simple.JSONValue"
] | import org.json.simple.JSONObject; import org.json.simple.JSONValue; | import org.json.simple.*; | [
"org.json.simple"
] | org.json.simple; | 1,878,179 |
@Override
public void internalInitialize(BeanDeployerEnvironment environment) {
super.internalInitialize(environment);
checkEJBTypeAllowed();
checkConflictingRoles();
checkObserverMethods();
checkScopeAllowed();
} | void function(BeanDeployerEnvironment environment) { super.internalInitialize(environment); checkEJBTypeAllowed(); checkConflictingRoles(); checkObserverMethods(); checkScopeAllowed(); } | /**
* Initializes the bean and its metadata
*/ | Initializes the bean and its metadata | internalInitialize | {
"repo_name": "weld/core",
"path": "modules/ejb/src/main/java/org/jboss/weld/module/ejb/SessionBeanImpl.java",
"license": "apache-2.0",
"size": 12156
} | [
"org.jboss.weld.bootstrap.BeanDeployerEnvironment"
] | import org.jboss.weld.bootstrap.BeanDeployerEnvironment; | import org.jboss.weld.bootstrap.*; | [
"org.jboss.weld"
] | org.jboss.weld; | 345,707 |
public void playAnimatedLogo(BaseGifImage gifImage) {
mLoadingView.hideLoadingUI();
mAnimatedLogoDrawable = new BaseGifDrawable(gifImage, Config.ARGB_8888);
mAnimatedLogoMatrix = new Matrix();
setMatrix(mAnimatedLogoDrawable.getIntrinsicWidth(),
mAnimatedLogoDrawable.getIntrinsicHeight(), mAnimatedLogoMatrix, false);
// Set callback here to ensure #invalidateDrawable() is called.
mAnimatedLogoDrawable.setCallback(this);
mAnimatedLogoDrawable.start();
} | void function(BaseGifImage gifImage) { mLoadingView.hideLoadingUI(); mAnimatedLogoDrawable = new BaseGifDrawable(gifImage, Config.ARGB_8888); mAnimatedLogoMatrix = new Matrix(); setMatrix(mAnimatedLogoDrawable.getIntrinsicWidth(), mAnimatedLogoDrawable.getIntrinsicHeight(), mAnimatedLogoMatrix, false); mAnimatedLogoDrawable.setCallback(this); mAnimatedLogoDrawable.start(); } | /**
* Starts playing the given animated GIF logo.
*/ | Starts playing the given animated GIF logo | playAnimatedLogo | {
"repo_name": "ric2b/Vivaldi-browser",
"path": "chromium/chrome/android/java/src/org/chromium/chrome/browser/ntp/LogoView.java",
"license": "bsd-3-clause",
"size": 15340
} | [
"android.graphics.Bitmap",
"android.graphics.Matrix",
"jp.tomorrowkey.android.gifplayer.BaseGifDrawable",
"jp.tomorrowkey.android.gifplayer.BaseGifImage"
] | import android.graphics.Bitmap; import android.graphics.Matrix; import jp.tomorrowkey.android.gifplayer.BaseGifDrawable; import jp.tomorrowkey.android.gifplayer.BaseGifImage; | import android.graphics.*; import jp.tomorrowkey.android.gifplayer.*; | [
"android.graphics",
"jp.tomorrowkey.android"
] | android.graphics; jp.tomorrowkey.android; | 1,934,425 |
public LcnDefs.Var getLastRequestedVarWithoutTypeInResponse() {
return this.lastRequestedVarWithoutTypeInResponse;
}
| LcnDefs.Var function() { return this.lastRequestedVarWithoutTypeInResponse; } | /**
* Gets the last requested variable whose response will not contain the variables type.
*
* @return the "typeless" variable
*/ | Gets the last requested variable whose response will not contain the variables type | getLastRequestedVarWithoutTypeInResponse | {
"repo_name": "paixaop/openhab",
"path": "bundles/binding/org.openhab.binding.lcn/src/main/java/org/openhab/binding/lcn/connection/ModInfo.java",
"license": "epl-1.0",
"size": 11276
} | [
"org.openhab.binding.lcn.common.LcnDefs"
] | import org.openhab.binding.lcn.common.LcnDefs; | import org.openhab.binding.lcn.common.*; | [
"org.openhab.binding"
] | org.openhab.binding; | 2,880,712 |
private FileStatus getFileStatus(FTPClient client, Path file)
throws IOException {
FileStatus fileStat = null;
Path workDir = new Path(client.printWorkingDirectory());
Path absolute = makeAbsolute(workDir, file);
Path parentPath = absolute.getParent();
if (parentPath == null) { // root dir
long length = -1; // Length of root dir on server not known
boolean isDir = true;
int blockReplication = 1;
long blockSize = DEFAULT_BLOCK_SIZE; // Block Size not known.
long modTime = -1; // Modification time of root dir not known.
Path root = new Path("/");
return new FileStatus(length, isDir, blockReplication, blockSize,
modTime, root.makeQualified(this));
}
String pathName = parentPath.toUri().getPath();
FTPFile[] ftpFiles = client.listFiles(pathName);
if (ftpFiles != null) {
for (FTPFile ftpFile : ftpFiles) {
if (ftpFile.getName().equals(file.getName())) { // file found in
// dir
fileStat = getFileStatus(ftpFile, parentPath);
break;
}
}
if (fileStat == null) {
throw new FileNotFoundException("File " + file
+ " does not exist.");
}
} else {
throw new FileNotFoundException("File " + file + " does not exist.");
}
return fileStat;
} | FileStatus function(FTPClient client, Path file) throws IOException { FileStatus fileStat = null; Path workDir = new Path(client.printWorkingDirectory()); Path absolute = makeAbsolute(workDir, file); Path parentPath = absolute.getParent(); if (parentPath == null) { long length = -1; boolean isDir = true; int blockReplication = 1; long blockSize = DEFAULT_BLOCK_SIZE; long modTime = -1; Path root = new Path("/"); return new FileStatus(length, isDir, blockReplication, blockSize, modTime, root.makeQualified(this)); } String pathName = parentPath.toUri().getPath(); FTPFile[] ftpFiles = client.listFiles(pathName); if (ftpFiles != null) { for (FTPFile ftpFile : ftpFiles) { if (ftpFile.getName().equals(file.getName())) { fileStat = getFileStatus(ftpFile, parentPath); break; } } if (fileStat == null) { throw new FileNotFoundException(STR + file + STR); } } else { throw new FileNotFoundException(STR + file + STR); } return fileStat; } | /**
* Convenience method, so that we don't open a new connection when using
* this method from within another method. Otherwise every API invocation
* incurs the overhead of opening/closing a TCP connection.
*/ | Convenience method, so that we don't open a new connection when using this method from within another method. Otherwise every API invocation incurs the overhead of opening/closing a TCP connection | getFileStatus | {
"repo_name": "shot/hadoop-source-reading",
"path": "src/core/org/apache/hadoop/fs/ftp/FTPFileSystem.java",
"license": "apache-2.0",
"size": 19410
} | [
"java.io.FileNotFoundException",
"java.io.IOException",
"org.apache.commons.net.ftp.FTPClient",
"org.apache.commons.net.ftp.FTPFile",
"org.apache.hadoop.fs.FileStatus",
"org.apache.hadoop.fs.Path"
] | import java.io.FileNotFoundException; import java.io.IOException; import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPFile; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.Path; | import java.io.*; import org.apache.commons.net.ftp.*; import org.apache.hadoop.fs.*; | [
"java.io",
"org.apache.commons",
"org.apache.hadoop"
] | java.io; org.apache.commons; org.apache.hadoop; | 2,405,100 |
@JsonProperty("indicadorExportadorFabricante")
public IndicadorExportadorFabricanteCover getIndicadorExportadorFabricante() {
return indicadorExportadorFabricante;
} | @JsonProperty(STR) IndicadorExportadorFabricanteCover function() { return indicadorExportadorFabricante; } | /**
* Get indicadorExportadorFabricante
* @return indicadorExportadorFabricante
**/ | Get indicadorExportadorFabricante | getIndicadorExportadorFabricante | {
"repo_name": "samuelfac/portalunico.siscomex.gov.br",
"path": "src/main/java/br/gov/siscomex/portalunico/duimp_api/model/ItemConsultaCover.java",
"license": "mit",
"size": 14215
} | [
"com.fasterxml.jackson.annotation.JsonProperty"
] | import com.fasterxml.jackson.annotation.JsonProperty; | import com.fasterxml.jackson.annotation.*; | [
"com.fasterxml.jackson"
] | com.fasterxml.jackson; | 2,227,806 |
private void setBounds() {
double xmin, xmax, ymin, ymax;
Object val;
String val1 = (String) Xmin.getValue();
Vector v = (Vector) ((SpinnerListModel) Xmin.getModel()).getList();
xmin = v.indexOf(val1) + 1;
String val2 = (String) Xmax.getValue();
Vector v2 = (Vector) ((SpinnerListModel) Xmax.getModel()).getList();
xmax = v2.indexOf(val2) + 1;
val = Ymin.getValue();
if (val instanceof Number) {
ymin = ((Number) val).doubleValue();
} else {
ymin = graph.getYRange()[0];
}
val = Ymax.getValue();
if (val instanceof Number) {
ymax = ((Number) val).doubleValue();
} else {
ymax = graph.getYRange()[1];
}
// Sets bounds
graph.setXRange(xmin, xmax);
graph.setYRange(ymin, ymax);
graph.repaint();
} | void function() { double xmin, xmax, ymin, ymax; Object val; String val1 = (String) Xmin.getValue(); Vector v = (Vector) ((SpinnerListModel) Xmin.getModel()).getList(); xmin = v.indexOf(val1) + 1; String val2 = (String) Xmax.getValue(); Vector v2 = (Vector) ((SpinnerListModel) Xmax.getModel()).getList(); xmax = v2.indexOf(val2) + 1; val = Ymin.getValue(); if (val instanceof Number) { ymin = ((Number) val).doubleValue(); } else { ymin = graph.getYRange()[0]; } val = Ymax.getValue(); if (val instanceof Number) { ymax = ((Number) val).doubleValue(); } else { ymax = graph.getYRange()[1]; } graph.setXRange(xmin, xmax); graph.setYRange(ymin, ymax); graph.repaint(); } | /**
* Used when a spinne value is updated
*/ | Used when a spinne value is updated | setBounds | {
"repo_name": "HOMlab/QN-ACTR-Release",
"path": "QN-ACTR Java/src/jmt/gui/jwat/trafficAnalysis/panels/GraphArrivalPanel.java",
"license": "lgpl-3.0",
"size": 26416
} | [
"java.util.Vector",
"javax.swing.SpinnerListModel"
] | import java.util.Vector; import javax.swing.SpinnerListModel; | import java.util.*; import javax.swing.*; | [
"java.util",
"javax.swing"
] | java.util; javax.swing; | 46,604 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.