method stringlengths 13 441k | clean_method stringlengths 7 313k | doc stringlengths 17 17.3k | comment stringlengths 3 1.42k | method_name stringlengths 1 273 | extra dict | imports list | imports_info stringlengths 19 34.8k | cluster_imports_info stringlengths 15 3.66k | libraries list | libraries_info stringlengths 6 661 | id int64 0 2.92M |
|---|---|---|---|---|---|---|---|---|---|---|---|
public List<BigQueryError> getErrors() {
return errors;
} | List<BigQueryError> function() { return errors; } | /**
* The errors reported by the job.
*
* <p>The list is immutable.
*/ | The errors reported by the job. The list is immutable | getErrors | {
"repo_name": "vam-google/google-cloud-java",
"path": "google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/JobException.java",
"license": "apache-2.0",
"size": 1300
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,809,361 |
private String getSizeMethodCode() {
StringBuilder code = new StringBuilder();
Set<Integer> orders = new HashSet<Integer>();
// encode method
code.append("public int size(").append(cls.getName().replaceAll("\\$", "."));
code.append(" t) throws IOException {\n");
code.append("int size = 0;");
for (FieldInfo field : fields) {
boolean isList = isListType(field.getField());
// check type
if (!isList) {
checkType(field.getFieldType(), field.getField());
}
if (orders.contains(field.getOrder())) {
throw new IllegalArgumentException("Field order '" + field.getOrder() + "' on field"
+ field.getField().getName() + " already exsit.");
}
// define field
code.append(CodedConstant.getMappedTypeDefined(field.getOrder(), field.getFieldType(),
getAccessByField("t", field.getField(), cls), isList));
// compute size
code.append("if (!CodedConstant.isNull(").append(getAccessByField("t", field.getField(), cls))
.append("))\n");
code.append("{\nsize+=");
code.append(CodedConstant.getMappedTypeSize(field, field.getOrder(), field.getFieldType(), isList, debug,
outputPath));
code.append("}\n");
if (field.isRequired()) {
code.append(CodedConstant.getRequiredCheck(field.getOrder(), field.getField()));
}
}
code.append("return size;\n");
code.append("}\n");
return code.toString();
}
| String function() { StringBuilder code = new StringBuilder(); Set<Integer> orders = new HashSet<Integer>(); code.append(STR).append(cls.getName().replaceAll("\\$", ".")); code.append(STR); code.append(STR); for (FieldInfo field : fields) { boolean isList = isListType(field.getField()); if (!isList) { checkType(field.getFieldType(), field.getField()); } if (orders.contains(field.getOrder())) { throw new IllegalArgumentException(STR + field.getOrder() + STR + field.getField().getName() + STR); } code.append(CodedConstant.getMappedTypeDefined(field.getOrder(), field.getFieldType(), getAccessByField("t", field.getField(), cls), isList)); code.append(STR).append(getAccessByField("t", field.getField(), cls)) .append("))\n"); code.append(STR); code.append(CodedConstant.getMappedTypeSize(field, field.getOrder(), field.getFieldType(), isList, debug, outputPath)); code.append("}\n"); if (field.isRequired()) { code.append(CodedConstant.getRequiredCheck(field.getOrder(), field.getField())); } } code.append(STR); code.append("}\n"); return code.toString(); } | /**
* generate <code>size</code> method source code
*
* @return
*/ | generate <code>size</code> method source code | getSizeMethodCode | {
"repo_name": "gspandy/jprotobuf",
"path": "src/main/java/com/baidu/bjf/remoting/protobuf/CodeGenerator.java",
"license": "apache-2.0",
"size": 33717
} | [
"com.baidu.bjf.remoting.protobuf.utils.FieldInfo",
"java.util.HashSet",
"java.util.Set"
] | import com.baidu.bjf.remoting.protobuf.utils.FieldInfo; import java.util.HashSet; import java.util.Set; | import com.baidu.bjf.remoting.protobuf.utils.*; import java.util.*; | [
"com.baidu.bjf",
"java.util"
] | com.baidu.bjf; java.util; | 457,063 |
JButton getCancelButton(); | JButton getCancelButton(); | /**
* Gets the value for the cancelButton field.
*
* @return The value for the cancelButton field.
*/ | Gets the value for the cancelButton field | getCancelButton | {
"repo_name": "lunarray-org/model-gen-swing",
"path": "src/main/java/org/lunarray/model/generation/swing/components/FormComponent.java",
"license": "lgpl-3.0",
"size": 2708
} | [
"javax.swing.JButton"
] | import javax.swing.JButton; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 1,493,180 |
public void write(SFTPv3FileHandle handle, long fileOffset, byte[] src, int srcoff, int len) throws IOException
{
checkHandleValidAndOpen(handle);
if (len < 0)
while (len > 0)
{
int writeRequestLen = len;
if (writeRequestLen > 32768)
writeRequestLen = 32768;
int req_id = generateNextRequestID();
TypesWriter tw = new TypesWriter();
tw.writeString(handle.fileHandle, 0, handle.fileHandle.length);
tw.writeUINT64(fileOffset);
tw.writeString(src, srcoff, writeRequestLen);
if (debug != null)
{
debug.println("Sending SSH_FXP_WRITE...");
debug.flush();
}
sendMessage(Packet.SSH_FXP_WRITE, req_id, tw.getBytes());
fileOffset += writeRequestLen;
srcoff += writeRequestLen;
len -= writeRequestLen;
byte[] resp = receiveMessage(34000);
TypesReader tr = new TypesReader(resp);
int t = tr.readByte();
int rep_id = tr.readUINT32();
if (rep_id != req_id)
throw new IOException("The server sent an invalid id field.");
if (t != Packet.SSH_FXP_STATUS)
throw new IOException("The SFTP server sent an unexpected packet type (" + t + ")");
int errorCode = tr.readUINT32();
if (errorCode == ErrorCodes.SSH_FX_OK)
continue;
String errorMessage = tr.readString();
throw new SFTPException(errorMessage, errorCode);
}
} | void function(SFTPv3FileHandle handle, long fileOffset, byte[] src, int srcoff, int len) throws IOException { checkHandleValidAndOpen(handle); if (len < 0) while (len > 0) { int writeRequestLen = len; if (writeRequestLen > 32768) writeRequestLen = 32768; int req_id = generateNextRequestID(); TypesWriter tw = new TypesWriter(); tw.writeString(handle.fileHandle, 0, handle.fileHandle.length); tw.writeUINT64(fileOffset); tw.writeString(src, srcoff, writeRequestLen); if (debug != null) { debug.println(STR); debug.flush(); } sendMessage(Packet.SSH_FXP_WRITE, req_id, tw.getBytes()); fileOffset += writeRequestLen; srcoff += writeRequestLen; len -= writeRequestLen; byte[] resp = receiveMessage(34000); TypesReader tr = new TypesReader(resp); int t = tr.readByte(); int rep_id = tr.readUINT32(); if (rep_id != req_id) throw new IOException(STR); if (t != Packet.SSH_FXP_STATUS) throw new IOException(STR + t + ")"); int errorCode = tr.readUINT32(); if (errorCode == ErrorCodes.SSH_FX_OK) continue; String errorMessage = tr.readString(); throw new SFTPException(errorMessage, errorCode); } } | /**
* Write bytes to a file. If <code>len</code> > 32768, then the write operation will
* be split into multiple writes.
*
* @param handle a SFTPv3FileHandle handle.
* @param fileOffset offset (in bytes) in the file.
* @param src the source byte array.
* @param srcoff offset in the source byte array.
* @param len how many bytes to write.
* @throws IOException
*/ | Write bytes to a file. If <code>len</code> > 32768, then the write operation will be split into multiple writes | write | {
"repo_name": "handong106324/sqLogWeb",
"path": "src/ch/ethz/ssh2/SFTPv3Client.java",
"license": "lgpl-2.1",
"size": 37667
} | [
"ch.ethz.ssh2.packets.TypesReader",
"ch.ethz.ssh2.packets.TypesWriter",
"ch.ethz.ssh2.sftp.ErrorCodes",
"ch.ethz.ssh2.sftp.Packet",
"java.io.IOException"
] | import ch.ethz.ssh2.packets.TypesReader; import ch.ethz.ssh2.packets.TypesWriter; import ch.ethz.ssh2.sftp.ErrorCodes; import ch.ethz.ssh2.sftp.Packet; import java.io.IOException; | import ch.ethz.ssh2.packets.*; import ch.ethz.ssh2.sftp.*; import java.io.*; | [
"ch.ethz.ssh2",
"java.io"
] | ch.ethz.ssh2; java.io; | 2,118,026 |
public void info(Throwable throwable, String msg, Object arg0) {
logIfEnabled(Level.INFO, throwable, msg, arg0, UNKNOWN_ARG, UNKNOWN_ARG, null);
} | void function(Throwable throwable, String msg, Object arg0) { logIfEnabled(Level.INFO, throwable, msg, arg0, UNKNOWN_ARG, UNKNOWN_ARG, null); } | /**
* Log a info message with a throwable.
*/ | Log a info message with a throwable | info | {
"repo_name": "droidefense/engine",
"path": "mods/simplemagic/src/main/java/com/j256/simplemagic/logger/Logger.java",
"license": "gpl-3.0",
"size": 19636
} | [
"com.j256.simplemagic.logger.Log"
] | import com.j256.simplemagic.logger.Log; | import com.j256.simplemagic.logger.*; | [
"com.j256.simplemagic"
] | com.j256.simplemagic; | 2,368,928 |
public static ErrorManager validate(String name, String content)
{
Compiler compiler = new Compiler();
CompilerOptions options = new CompilerOptions();
// Advanced mode is used here, but additional options could be set, too.
CompilationLevel.SIMPLE_OPTIMIZATIONS.setOptionsForCompilationLevel(options);
// To get the complete set of externs, the logic in
// CompilerRunner.getDefaultExterns() should be used here.
List<SourceFile> extern = new ArrayList<SourceFile>();
extern.add(SourceFile.fromCode("externs.js", ""));
// The dummy input name "input.js" is used here so that any warnings or
// errors will cite line numbers in terms of input.js.
List<SourceFile> input = new ArrayList<SourceFile>();
input.add(SourceFile.fromCode(name, content));
compiler.init(extern, input, options);
compiler.parse();
return compiler.getErrorManager();
}
| static ErrorManager function(String name, String content) { Compiler compiler = new Compiler(); CompilerOptions options = new CompilerOptions(); CompilationLevel.SIMPLE_OPTIMIZATIONS.setOptionsForCompilationLevel(options); List<SourceFile> extern = new ArrayList<SourceFile>(); extern.add(SourceFile.fromCode(STR, "")); List<SourceFile> input = new ArrayList<SourceFile>(); input.add(SourceFile.fromCode(name, content)); compiler.init(extern, input, options); compiler.parse(); return compiler.getErrorManager(); } | /**
* Validate the specified JavaScript file
*
* @param name the name of the file
* @param content the file contents
*
* @return the error manager containing any errors from the specified file
*/ | Validate the specified JavaScript file | validate | {
"repo_name": "zgrossbart/forbiddenfunctions",
"path": "src/main/java/com/grossbart/forbiddenfunction/ForbiddenFunction.java",
"license": "apache-2.0",
"size": 22393
} | [
"com.google.javascript.jscomp.CompilationLevel",
"com.google.javascript.jscomp.Compiler",
"com.google.javascript.jscomp.CompilerOptions",
"com.google.javascript.jscomp.ErrorManager",
"com.google.javascript.jscomp.SourceFile",
"java.util.ArrayList",
"java.util.List"
] | import com.google.javascript.jscomp.CompilationLevel; import com.google.javascript.jscomp.Compiler; import com.google.javascript.jscomp.CompilerOptions; import com.google.javascript.jscomp.ErrorManager; import com.google.javascript.jscomp.SourceFile; import java.util.ArrayList; import java.util.List; | import com.google.javascript.jscomp.*; import java.util.*; | [
"com.google.javascript",
"java.util"
] | com.google.javascript; java.util; | 1,381,413 |
public final Callback<DateDetailsParameter, Boolean> getDateDetailsCallback() {
return dateDetailsCallbackProperty().get();
}
private final ObjectProperty<Callback<EntryDetailsParameter, Boolean>> entryDetailsCallback = new SimpleObjectProperty<>(this, "entryDetailsCallback"); //$NON-NLS-1$
/**
* A callback used for showing the details of a given entry. The default
* implementation of this callback displays a small {@link PopOver} but
* applications might as well display a large dialog where the user can
* freely edit the entry.
* <p>
* <h2>Code Example</h2> The code below shows the default implementation
* used by all date controls. It delegates to a private method that shows
* the popover.
* <p>
* <pre>
* setEntryDetailsCallback(param -> {
* InputEvent evt = param.getInputEvent();
* if (evt instanceof MouseEvent) {
* MouseEvent mouseEvent = (MouseEvent) evt;
* if (mouseEvent.getClickCount() == 2) {
* showEntryDetails(param.getEntryView(), param.getOwner(), param.getScreenX(), param.getScreenY());
* return true;
* }
* } else {
* showEntryDetails(param.getEntryView(), param.getOwner(), param.getScreenX(), param.getScreenY());
* return true;
* } | final Callback<DateDetailsParameter, Boolean> function() { return dateDetailsCallbackProperty().get(); } private final ObjectProperty<Callback<EntryDetailsParameter, Boolean>> entryDetailsCallback = new SimpleObjectProperty<>(this, STR); /** * A callback used for showing the details of a given entry. The default * implementation of this callback displays a small {@link PopOver} but * applications might as well display a large dialog where the user can * freely edit the entry. * <p> * <h2>Code Example</h2> The code below shows the default implementation * used by all date controls. It delegates to a private method that shows * the popover. * <p> * <pre> * setEntryDetailsCallback(param -> { * InputEvent evt = param.getInputEvent(); * if (evt instanceof MouseEvent) { * MouseEvent mouseEvent = (MouseEvent) evt; * if (mouseEvent.getClickCount() == 2) { * showEntryDetails(param.getEntryView(), param.getOwner(), param.getScreenX(), param.getScreenY()); * return true; * } * } else { * showEntryDetails(param.getEntryView(), param.getOwner(), param.getScreenX(), param.getScreenY()); * return true; * } | /**
* Returns the value of {@link #dateDetailsCallbackProperty()}.
*
* @return the date details callback
*/ | Returns the value of <code>#dateDetailsCallbackProperty()</code> | getDateDetailsCallback | {
"repo_name": "dlemmermann/CalendarFX",
"path": "CalendarFXView/src/main/java/com/calendarfx/view/DateControl.java",
"license": "apache-2.0",
"size": 106855
} | [
"org.controlsfx.control.PopOver"
] | import org.controlsfx.control.PopOver; | import org.controlsfx.control.*; | [
"org.controlsfx.control"
] | org.controlsfx.control; | 1,993,033 |
@Test
public void testDecode() {
byte[] data = new byte[12];
data[0] = 3; // type of string
data[1] = 0; // first byte of length
data[2] = 1; // second byte of length
data[3] = 65; // Latin-1 Capital 'A'
data[4] = 3;
data[5] = 0;
data[6] = 1;
data[7] = 66;
data[8] = 3;
data[9] = 0;
data[10] = 1;
data[11] = 67;
ArrayType subject = new ArrayType();
Object obj = subject.decode( data );
assertTrue( obj instanceof DataFrame );
DataFrame array = (DataFrame)obj;
assertTrue( array.size() == 3 );
DataField value1 = array.getField( 0 );
assertTrue( value1.getType() == DataField.STRING );
} | void function() { byte[] data = new byte[12]; data[0] = 3; data[1] = 0; data[2] = 1; data[3] = 65; data[4] = 3; data[5] = 0; data[6] = 1; data[7] = 66; data[8] = 3; data[9] = 0; data[10] = 1; data[11] = 67; ArrayType subject = new ArrayType(); Object obj = subject.decode( data ); assertTrue( obj instanceof DataFrame ); DataFrame array = (DataFrame)obj; assertTrue( array.size() == 3 ); DataField value1 = array.getField( 0 ); assertTrue( value1.getType() == DataField.STRING ); } | /**
* Test method for {@link coyote.dataframe.ArrayType#decode(byte[])}.
*/ | Test method for <code>coyote.dataframe.ArrayType#decode(byte[])</code> | testDecode | {
"repo_name": "sdcote/dataframe",
"path": "src/test/java/coyote/dataframe/ArrayTypeTest.java",
"license": "mit",
"size": 7927
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 900,006 |
@Override
public String toString() {
MoreObjects.ToStringHelper s = MoreObjects.toStringHelper(this);
if (initialCapacity != UNSET_INT) {
s.add("initialCapacity", initialCapacity);
}
if (concurrencyLevel != UNSET_INT) {
s.add("concurrencyLevel", concurrencyLevel);
}
if (maximumSize != UNSET_INT) {
s.add("maximumSize", maximumSize);
}
if (maximumWeight != UNSET_INT) {
s.add("maximumWeight", maximumWeight);
}
if (expireAfterWriteNanos != UNSET_INT) {
s.add("expireAfterWrite", expireAfterWriteNanos + "ns");
}
if (expireAfterAccessNanos != UNSET_INT) {
s.add("expireAfterAccess", expireAfterAccessNanos + "ns");
}
if (keyStrength != null) {
s.add("keyStrength", Ascii.toLowerCase(keyStrength.toString()));
}
if (valueStrength != null) {
s.add("valueStrength", Ascii.toLowerCase(valueStrength.toString()));
}
if (keyEquivalence != null) {
s.addValue("keyEquivalence");
}
if (valueEquivalence != null) {
s.addValue("valueEquivalence");
}
if (removalListener != null) {
s.addValue("removalListener");
}
return s.toString();
} | String function() { MoreObjects.ToStringHelper s = MoreObjects.toStringHelper(this); if (initialCapacity != UNSET_INT) { s.add(STR, initialCapacity); } if (concurrencyLevel != UNSET_INT) { s.add(STR, concurrencyLevel); } if (maximumSize != UNSET_INT) { s.add(STR, maximumSize); } if (maximumWeight != UNSET_INT) { s.add(STR, maximumWeight); } if (expireAfterWriteNanos != UNSET_INT) { s.add(STR, expireAfterWriteNanos + "ns"); } if (expireAfterAccessNanos != UNSET_INT) { s.add(STR, expireAfterAccessNanos + "ns"); } if (keyStrength != null) { s.add(STR, Ascii.toLowerCase(keyStrength.toString())); } if (valueStrength != null) { s.add(STR, Ascii.toLowerCase(valueStrength.toString())); } if (keyEquivalence != null) { s.addValue(STR); } if (valueEquivalence != null) { s.addValue(STR); } if (removalListener != null) { s.addValue(STR); } return s.toString(); } | /**
* Returns a string representation for this CacheBuilder instance. The exact form of the returned
* string is not specified.
*/ | Returns a string representation for this CacheBuilder instance. The exact form of the returned string is not specified | toString | {
"repo_name": "rgoldberg/guava",
"path": "guava/src/com/google/common/cache/CacheBuilder.java",
"license": "apache-2.0",
"size": 45681
} | [
"com.google.common.base.Ascii",
"com.google.common.base.MoreObjects"
] | import com.google.common.base.Ascii; import com.google.common.base.MoreObjects; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 1,315,846 |
@Test
public final void testPostMethod() {
String path = "/postrequest";
stubFor(post(urlEqualTo(path))
.willReturn(aResponse()
.withStatus(200)));
String name = "DoctorWho", age = "953", location = "Tardis";
httpMethodEndpoint.postRequest(name, age, location);
List<LoggedRequest> requests = findAll(postRequestedFor(urlMatching(path)));
assertFalse(requests == null);
assertFalse(requests.isEmpty());
LoggedRequest request = requests.get(0);
assertTrue(request.getMethod().equals(RequestMethod.POST));
String body = request.getBodyAsString();
assertTrue(body.contains("name=" + name));
assertTrue(body.contains("age=" + age));
assertTrue(body.contains("location=" + location));
}
| final void function() { String path = STR; stubFor(post(urlEqualTo(path)) .willReturn(aResponse() .withStatus(200))); String name = STR, age = "953", location = STR; httpMethodEndpoint.postRequest(name, age, location); List<LoggedRequest> requests = findAll(postRequestedFor(urlMatching(path))); assertFalse(requests == null); assertFalse(requests.isEmpty()); LoggedRequest request = requests.get(0); assertTrue(request.getMethod().equals(RequestMethod.POST)); String body = request.getBodyAsString(); assertTrue(body.contains("name=" + name)); assertTrue(body.contains("age=" + age)); assertTrue(body.contains(STR + location)); } | /**
* <p>Test for the request method POST.</p>
*
* @since 1.3.0
*/ | Test for the request method POST | testPostMethod | {
"repo_name": "sahan/ZombieLink",
"path": "zombielink/src/test/java/com/lonepulse/zombielink/processor/HttpMethodEndpointTest.java",
"license": "apache-2.0",
"size": 8110
} | [
"com.github.tomakehurst.wiremock.client.WireMock",
"com.github.tomakehurst.wiremock.http.RequestMethod",
"com.github.tomakehurst.wiremock.verification.LoggedRequest",
"java.util.List",
"org.junit.Assert"
] | import com.github.tomakehurst.wiremock.client.WireMock; import com.github.tomakehurst.wiremock.http.RequestMethod; import com.github.tomakehurst.wiremock.verification.LoggedRequest; import java.util.List; import org.junit.Assert; | import com.github.tomakehurst.wiremock.client.*; import com.github.tomakehurst.wiremock.http.*; import com.github.tomakehurst.wiremock.verification.*; import java.util.*; import org.junit.*; | [
"com.github.tomakehurst",
"java.util",
"org.junit"
] | com.github.tomakehurst; java.util; org.junit; | 336,704 |
public MiniZooKeeperCluster startMiniZKCluster() throws Exception {
return startMiniZKCluster(1);
} | MiniZooKeeperCluster function() throws Exception { return startMiniZKCluster(1); } | /**
* Call this if you only want a zk cluster.
*
* @return zk cluster started.
* @see #startMiniZKCluster() if you want zk + dfs + hbase mini cluster.
* @see #shutdownMiniZKCluster()
*/ | Call this if you only want a zk cluster | startMiniZKCluster | {
"repo_name": "NGDATA/lilyproject",
"path": "global/hadoop-test-fw/src/main/java/org/lilyproject/hadooptestfw/fork/HBaseTestingUtility.java",
"license": "apache-2.0",
"size": 90460
} | [
"org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster"
] | import org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster; | import org.apache.hadoop.hbase.zookeeper.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 2,594,974 |
@Override
public Locale getLocale() {
return locale;
} | Locale function() { return locale; } | /**
* Returns this formatter locale. This is the locale specified at construction time if any,
* or the {@linkplain Locale#getDefault() default locale} at construction time otherwise.
*
* @return This formatter locale (never {@code null}).
*/ | Returns this formatter locale. This is the locale specified at construction time if any, or the Locale#getDefault() default locale at construction time otherwise | getLocale | {
"repo_name": "desruisseaux/sis",
"path": "core/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java",
"license": "apache-2.0",
"size": 85230
} | [
"java.util.Locale"
] | import java.util.Locale; | import java.util.*; | [
"java.util"
] | java.util; | 2,867,597 |
@Override
public void write(Void value, TProtocolWriter protocol)
{
requireNonNull(protocol, "protocol is null");
} | void function(Void value, TProtocolWriter protocol) { requireNonNull(protocol, STR); } | /**
* Always returns without writing to the stream.
*/ | Always returns without writing to the stream | write | {
"repo_name": "electrum/drift",
"path": "drift-codec/src/main/java/io/airlift/drift/codec/internal/builtin/VoidThriftCodec.java",
"license": "apache-2.0",
"size": 1660
} | [
"io.airlift.drift.protocol.TProtocolWriter",
"java.util.Objects"
] | import io.airlift.drift.protocol.TProtocolWriter; import java.util.Objects; | import io.airlift.drift.protocol.*; import java.util.*; | [
"io.airlift.drift",
"java.util"
] | io.airlift.drift; java.util; | 1,747,657 |
public MiniZooKeeperCluster startMiniZKCluster() throws Exception {
return startMiniZKCluster(setupClusterTestBuildDir());
} | MiniZooKeeperCluster function() throws Exception { return startMiniZKCluster(setupClusterTestBuildDir()); } | /**
* Call this if you only want a zk cluster.
* @see #startMiniZKCluster() if you want zk + dfs + hbase mini cluster.
* @throws Exception
* @see #shutdownMiniZKCluster()
* @return zk cluster started.
*/ | Call this if you only want a zk cluster | startMiniZKCluster | {
"repo_name": "abaranau/hbase",
"path": "src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java",
"license": "apache-2.0",
"size": 40327
} | [
"org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster"
] | import org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster; | import org.apache.hadoop.hbase.zookeeper.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 2,767,200 |
public void storeCharacter(DBTransaction transaction, String username, String character,
RPObject player) throws SQLException, IOException {
try {
if (!StringChecker.validString(username) || !StringChecker.validString(character)) {
throw new SQLException("Invalid string username=(" + username + ") character=("
+ character + ")");
}
int objectid = DAORegister.get().get(RPObjectDAO.class).storeRPObject(transaction, player);
int id = DAORegister.get().get(AccountDAO.class).getDatabasePlayerId(transaction, username);
String query = "update characters set object_id=[object_id] where charname='[character]' and player_id=[player_id]";
Map<String, Object> params = new HashMap<String, Object>();
params.put("object_id", Integer.valueOf(objectid));
params.put("player_id", Integer.valueOf(id));
params.put("character", character);
logger.debug("storeCharacter is executing query " + query);
logger.debug("Character: " + player);
transaction.execute(query, params);
} catch (SQLException sqle) {
logger.warn("Error storing character: " + player, sqle);
throw sqle;
} catch (IOException e) {
logger.warn("Error storing character: " + player, e);
throw e;
}
} | void function(DBTransaction transaction, String username, String character, RPObject player) throws SQLException, IOException { try { if (!StringChecker.validString(username) !StringChecker.validString(character)) { throw new SQLException(STR + username + STR + character + ")"); } int objectid = DAORegister.get().get(RPObjectDAO.class).storeRPObject(transaction, player); int id = DAORegister.get().get(AccountDAO.class).getDatabasePlayerId(transaction, username); String query = STR; Map<String, Object> params = new HashMap<String, Object>(); params.put(STR, Integer.valueOf(objectid)); params.put(STR, Integer.valueOf(id)); params.put(STR, character); logger.debug(STR + query); logger.debug(STR + player); transaction.execute(query, params); } catch (SQLException sqle) { logger.warn(STR + player, sqle); throw sqle; } catch (IOException e) { logger.warn(STR + player, e); throw e; } } | /**
* This method stores a character's avatar in the database and updates the link
* with the Character table.
*
* @param transaction
* the database transaction
* @param username
* the player's username
* @param character
* the player's character name
* @param player
* the RPObject itself.
* @throws SQLException
* if there is any problem at database.
* @throws IOException
*/ | This method stores a character's avatar in the database and updates the link with the Character table | storeCharacter | {
"repo_name": "nhnb/marauroa",
"path": "src/marauroa/server/game/db/CharacterDAO.java",
"license": "gpl-2.0",
"size": 31887
} | [
"java.io.IOException",
"java.sql.SQLException",
"java.util.HashMap",
"java.util.Map"
] | import java.io.IOException; import java.sql.SQLException; import java.util.HashMap; import java.util.Map; | import java.io.*; import java.sql.*; import java.util.*; | [
"java.io",
"java.sql",
"java.util"
] | java.io; java.sql; java.util; | 1,376,602 |
CompoundInterval copy(OPT_Register r, BasicInterval stop) {
CompoundInterval result = new CompoundInterval(r);
for (Iterator<BasicInterval> i = iterator(); i.hasNext();) {
BasicInterval b = i.next();
result.add(b);
if (b.sameRange(stop)) return result;
}
return result;
} | CompoundInterval copy(OPT_Register r, BasicInterval stop) { CompoundInterval result = new CompoundInterval(r); for (Iterator<BasicInterval> i = iterator(); i.hasNext();) { BasicInterval b = i.next(); result.add(b); if (b.sameRange(stop)) return result; } return result; } | /**
* Copy the ranges into a new interval associated with a register r.
* Copy only the basic intervals up to and including stop.
*/ | Copy the ranges into a new interval associated with a register r. Copy only the basic intervals up to and including stop | copy | {
"repo_name": "rmcilroy/HeraJVM",
"path": "rvm/src/org/jikesrvm/compilers/opt/OPT_LinearScan.java",
"license": "epl-1.0",
"size": 88540
} | [
"java.util.Iterator"
] | import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 1,637,939 |
private List<String> getNames(List<IXMLElement> elements)
{
List<String> result = new ArrayList<String>();
for (IXMLElement element : elements)
{
result.add(config.getAttribute(element, "name"));
}
return result;
} | List<String> function(List<IXMLElement> elements) { List<String> result = new ArrayList<String>(); for (IXMLElement element : elements) { result.add(config.getAttribute(element, "name")); } return result; } | /**
* Returns the names associated with the supplied elements.
*
* @param elements the elements
* @return the "name" attributes
*/ | Returns the names associated with the supplied elements | getNames | {
"repo_name": "Murdock01/izpack",
"path": "izpack-panel/src/main/java/com/izforge/izpack/panels/userinput/field/ElementReader.java",
"license": "apache-2.0",
"size": 8456
} | [
"com.izforge.izpack.api.adaptator.IXMLElement",
"java.util.ArrayList",
"java.util.List"
] | import com.izforge.izpack.api.adaptator.IXMLElement; import java.util.ArrayList; import java.util.List; | import com.izforge.izpack.api.adaptator.*; import java.util.*; | [
"com.izforge.izpack",
"java.util"
] | com.izforge.izpack; java.util; | 203 |
@FeatureDescriptor(name = FEATURE_UNIFORM_LIST_VALUES)
default boolean supportsUniformListValues() {
return true;
}
}
interface FeatureSet {
} | @FeatureDescriptor(name = FEATURE_UNIFORM_LIST_VALUES) default boolean supportsUniformListValues() { return true; } } interface FeatureSet { } | /**
* Supports setting of a {@code List} value. The assumption is that the {@code List} can contain
* arbitrary serializable values that may or may not be defined as a feature itself. As this
* {@code List} is "uniform" it must contain objects of the same type.
*
* @see #supportsMixedListValues()
*/ | Supports setting of a List value. The assumption is that the List can contain arbitrary serializable values that may or may not be defined as a feature itself. As this List is "uniform" it must contain objects of the same type | supportsUniformListValues | {
"repo_name": "apache/tinkerpop",
"path": "gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java",
"license": "apache-2.0",
"size": 59525
} | [
"org.apache.tinkerpop.gremlin.structure.util.FeatureDescriptor"
] | import org.apache.tinkerpop.gremlin.structure.util.FeatureDescriptor; | import org.apache.tinkerpop.gremlin.structure.util.*; | [
"org.apache.tinkerpop"
] | org.apache.tinkerpop; | 1,474,064 |
public void setUseOutlinePaint(boolean flag) {
this.useOutlinePaint = flag;
fireChangeEvent();
}
public static class State extends XYItemRendererState {
public GeneralPath seriesPath;
private boolean lastPointGood;
public State(PlotRenderingInfo info) {
super(info);
}
| void function(boolean flag) { this.useOutlinePaint = flag; fireChangeEvent(); } public static class State extends XYItemRendererState { public GeneralPath seriesPath; private boolean lastPointGood; public State(PlotRenderingInfo info) { super(info); } | /**
* Sets the flag that controls whether the outline paint is used to draw
* shape outlines, and sends a {@link RendererChangeEvent} to all
* registered listeners.
* <p>
* Refer to <code>XYLineAndShapeRendererDemo2.java</code> to see the
* effect of this flag.
*
* @param flag the flag.
*
* @see #getUseOutlinePaint()
*/ | Sets the flag that controls whether the outline paint is used to draw shape outlines, and sends a <code>RendererChangeEvent</code> to all registered listeners. Refer to <code>XYLineAndShapeRendererDemo2.java</code> to see the effect of this flag | setUseOutlinePaint | {
"repo_name": "oskopek/jfreechart-fse",
"path": "src/main/java/org/jfree/chart/renderer/xy/XYLineAndShapeRenderer.java",
"license": "lgpl-2.1",
"size": 43100
} | [
"java.awt.geom.GeneralPath",
"org.jfree.chart.plot.PlotRenderingInfo"
] | import java.awt.geom.GeneralPath; import org.jfree.chart.plot.PlotRenderingInfo; | import java.awt.geom.*; import org.jfree.chart.plot.*; | [
"java.awt",
"org.jfree.chart"
] | java.awt; org.jfree.chart; | 304,612 |
protected boolean isUserInGroup(String user, String group) throws AuthorizationException {
GroupsService groupsService = Services.get().get(GroupsService.class);
try {
return groupsService.getGroups(user).contains(group);
}
catch (IOException ex) {
throw new AuthorizationException(ErrorCode.E0501, ex.getMessage(), ex);
}
}
/**
* Check if the user belongs to the group or not. <p/> <p/> Subclasses should override the {@link #isUserInGroup} | boolean function(String user, String group) throws AuthorizationException { GroupsService groupsService = Services.get().get(GroupsService.class); try { return groupsService.getGroups(user).contains(group); } catch (IOException ex) { throw new AuthorizationException(ErrorCode.E0501, ex.getMessage(), ex); } } /** * Check if the user belongs to the group or not. <p/> <p/> Subclasses should override the {@link #isUserInGroup} | /**
* Check if the user belongs to the group or not.
*
* @param user user name.
* @param group group name.
* @return if the user belongs to the group or not.
* @throws AuthorizationException thrown if the authorization query can not be performed.
*/ | Check if the user belongs to the group or not | isUserInGroup | {
"repo_name": "terrancesnyder/oozie-hadoop2",
"path": "core/src/main/java/org/apache/oozie/service/AuthorizationService.java",
"license": "apache-2.0",
"size": 21077
} | [
"java.io.IOException",
"org.apache.oozie.ErrorCode"
] | import java.io.IOException; import org.apache.oozie.ErrorCode; | import java.io.*; import org.apache.oozie.*; | [
"java.io",
"org.apache.oozie"
] | java.io; org.apache.oozie; | 1,915,253 |
public UpdateBuilder<T, ID> updateBuilder(); | UpdateBuilder<T, ID> function(); | /**
* Like {@link #queryBuilder()} but allows you to build an UPDATE statement. You can then call call
* {@link UpdateBuilder#prepare()} and pass the returned {@link PreparedUpdate} to {@link #update(PreparedUpdate)}.
*/ | Like <code>#queryBuilder()</code> but allows you to build an UPDATE statement. You can then call call <code>UpdateBuilder#prepare()</code> and pass the returned <code>PreparedUpdate</code> to <code>#update(PreparedUpdate)</code> | updateBuilder | {
"repo_name": "dankito/ormlite-jpa-core",
"path": "src/main/java/com/j256/ormlite/dao/Dao.java",
"license": "isc",
"size": 36726
} | [
"com.j256.ormlite.stmt.UpdateBuilder"
] | import com.j256.ormlite.stmt.UpdateBuilder; | import com.j256.ormlite.stmt.*; | [
"com.j256.ormlite"
] | com.j256.ormlite; | 863,541 |
public void test(String expectedContextProto,
String[] expectedDefaultProtos) throws NoSuchAlgorithmException {
SSLContext context = null;
try {
if (expectedContextProto != null) {
context = SSLContext.getInstance(expectedContextProto);
context.init(null, null, null);
} else {
context = SSLContext.getDefault();
}
printContextDetails(context);
} catch (KeyManagementException ex) {
error(null, ex);
}
validateContext(expectedContextProto, expectedDefaultProtos, context);
} | void function(String expectedContextProto, String[] expectedDefaultProtos) throws NoSuchAlgorithmException { SSLContext context = null; try { if (expectedContextProto != null) { context = SSLContext.getInstance(expectedContextProto); context.init(null, null, null); } else { context = SSLContext.getDefault(); } printContextDetails(context); } catch (KeyManagementException ex) { error(null, ex); } validateContext(expectedContextProto, expectedDefaultProtos, context); } | /**
* The parameter passed is the user enforced protocol. Does not catch
* NoSuchAlgorithmException, WrongProperty test will use it.
*/ | The parameter passed is the user enforced protocol. Does not catch NoSuchAlgorithmException, WrongProperty test will use it | test | {
"repo_name": "openjdk/jdk7u",
"path": "jdk/test/javax/net/ssl/TLS/TLSClientPropertyTest.java",
"license": "gpl-2.0",
"size": 7459
} | [
"java.security.KeyManagementException",
"java.security.NoSuchAlgorithmException",
"javax.net.ssl.SSLContext"
] | import java.security.KeyManagementException; import java.security.NoSuchAlgorithmException; import javax.net.ssl.SSLContext; | import java.security.*; import javax.net.ssl.*; | [
"java.security",
"javax.net"
] | java.security; javax.net; | 1,855,395 |
public void onPause() {
mainThread = null;
if (mApiClient != null) {
Wearable.DataApi.removeListener(mApiClient, this);
for (String cap : mCapabilities)
Wearable.CapabilityApi.removeCapabilityListener(mApiClient, this, cap);
mApiClient.disconnect();
mApiClient = null;
}
} | void function() { mainThread = null; if (mApiClient != null) { Wearable.DataApi.removeListener(mApiClient, this); for (String cap : mCapabilities) Wearable.CapabilityApi.removeCapabilityListener(mApiClient, this, cap); mApiClient.disconnect(); mApiClient = null; } } | /**
* Call this method in Activity's onPause
* Disconnects from Google API services
* and removes DataApi listener
*/ | Call this method in Activity's onPause Disconnects from Google API services and removes DataApi listener | onPause | {
"repo_name": "alexbat98/wearportal",
"path": "library/src/main/java/com/alexbatashev/wearportal/WearPortal.java",
"license": "lgpl-3.0",
"size": 16081
} | [
"com.google.android.gms.wearable.CapabilityApi",
"com.google.android.gms.wearable.DataApi",
"com.google.android.gms.wearable.Wearable"
] | import com.google.android.gms.wearable.CapabilityApi; import com.google.android.gms.wearable.DataApi; import com.google.android.gms.wearable.Wearable; | import com.google.android.gms.wearable.*; | [
"com.google.android"
] | com.google.android; | 2,717,585 |
public static synchronized void destroy() {
if (isInitialized()) {
Map<String, ProcessEngine> engines = new HashMap<>(processEngines);
processEngines = new HashMap<>();
for (String processEngineName : engines.keySet()) {
ProcessEngine processEngine = engines.get(processEngineName);
try {
processEngine.close();
} catch (Exception e) {
LOGGER.error("exception while closing {}", (processEngineName == null ? "the default process engine" : "process engine " + processEngineName), e);
}
}
processEngineInfosByName.clear();
processEngineInfosByResourceUrl.clear();
processEngineInfos.clear();
setInitialized(false);
}
} | static synchronized void function() { if (isInitialized()) { Map<String, ProcessEngine> engines = new HashMap<>(processEngines); processEngines = new HashMap<>(); for (String processEngineName : engines.keySet()) { ProcessEngine processEngine = engines.get(processEngineName); try { processEngine.close(); } catch (Exception e) { LOGGER.error(STR, (processEngineName == null ? STR : STR + processEngineName), e); } } processEngineInfosByName.clear(); processEngineInfosByResourceUrl.clear(); processEngineInfos.clear(); setInitialized(false); } } | /**
* closes all process engines. This method should be called when the server shuts down.
*/ | closes all process engines. This method should be called when the server shuts down | destroy | {
"repo_name": "zwets/flowable-engine",
"path": "modules/flowable-engine/src/main/java/org/flowable/engine/ProcessEngines.java",
"license": "apache-2.0",
"size": 12269
} | [
"java.util.HashMap",
"java.util.Map"
] | import java.util.HashMap; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 510,911 |
@EventHandler
public void onPlayerQuit(PlayerQuitEvent e) {
Player player = e.getPlayer();
new JLibPlayer(player).unFreeze();
this.lastMoved.remove(player);
this.lastWalked.remove(player);
} | void function(PlayerQuitEvent e) { Player player = e.getPlayer(); new JLibPlayer(player).unFreeze(); this.lastMoved.remove(player); this.lastWalked.remove(player); } | /**
* The PlayerQuitEvent listener
*
* @param e The PlayerQuitEvent
*/ | The PlayerQuitEvent listener | onPlayerQuit | {
"repo_name": "j0ach1mmall3/JLib",
"path": "src/main/java/com/j0ach1mmall3/jlib/PlayerListener.java",
"license": "gpl-3.0",
"size": 2866
} | [
"com.j0ach1mmall3.jlib.player.JLibPlayer",
"org.bukkit.entity.Player",
"org.bukkit.event.player.PlayerQuitEvent"
] | import com.j0ach1mmall3.jlib.player.JLibPlayer; import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerQuitEvent; | import com.j0ach1mmall3.jlib.player.*; import org.bukkit.entity.*; import org.bukkit.event.player.*; | [
"com.j0ach1mmall3.jlib",
"org.bukkit.entity",
"org.bukkit.event"
] | com.j0ach1mmall3.jlib; org.bukkit.entity; org.bukkit.event; | 1,329,974 |
public YafraBusinessRole insertBusinessRole(MYafraBusinessRole mybr);
public void insertMBusinessRole(MYafraBusinessRole mybr);
| YafraBusinessRole insertBusinessRole(MYafraBusinessRole mybr); public void function(MYafraBusinessRole mybr); | /**
* Insert a new user into the database
*
* @param MYafraBusinessRole model object - name is primary key
* @since 1.0
*/ | Insert a new user into the database | insertMBusinessRole | {
"repo_name": "yafraorg/yafra-java",
"path": "org.yafra.server.core/src/main/java/org/yafra/interfaces/IYafraMHYafraBusinessRole.java",
"license": "apache-2.0",
"size": 5511
} | [
"org.yafra.model.MYafraBusinessRole",
"org.yafra.orm.YafraBusinessRole"
] | import org.yafra.model.MYafraBusinessRole; import org.yafra.orm.YafraBusinessRole; | import org.yafra.model.*; import org.yafra.orm.*; | [
"org.yafra.model",
"org.yafra.orm"
] | org.yafra.model; org.yafra.orm; | 2,170,114 |
Point p = super.getLocation(reference);
Rectangle bounds = getBox();
boolean done = getTranslatedPoint(bounds.getTopLeft(), p, shift, shift);
if (!done)
done = getTranslatedPoint(bounds.getTopRight(), p, -shift, shift);
if (!done)
done = getTranslatedPoint(bounds.getBottomLeft(), p, shift, -shift);
if (!done)
done = getTranslatedPoint(bounds.getBottomRight(), p, -shift, -shift);
return p;
} | Point p = super.getLocation(reference); Rectangle bounds = getBox(); boolean done = getTranslatedPoint(bounds.getTopLeft(), p, shift, shift); if (!done) done = getTranslatedPoint(bounds.getTopRight(), p, -shift, shift); if (!done) done = getTranslatedPoint(bounds.getBottomLeft(), p, shift, -shift); if (!done) done = getTranslatedPoint(bounds.getBottomRight(), p, -shift, -shift); return p; } | /**
* Modifies the point slightly for the rounded corners.
* @return Point
*/ | Modifies the point slightly for the rounded corners | getLocation | {
"repo_name": "archimatetool/archi",
"path": "org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/internal/RoundedChopboxAnchor.java",
"license": "mit",
"size": 2807
} | [
"org.eclipse.draw2d.geometry.Point",
"org.eclipse.draw2d.geometry.Rectangle"
] | import org.eclipse.draw2d.geometry.Point; import org.eclipse.draw2d.geometry.Rectangle; | import org.eclipse.draw2d.geometry.*; | [
"org.eclipse.draw2d"
] | org.eclipse.draw2d; | 1,782,527 |
private void applyColors(Composite composite) {
// The getForeground() and getBackground() methods
// should not answer null, but IColorProvider clients
// are accustomed to null meaning use the default, so we guard
// against this assumption.
Color color = getForeground();
if (color == null)
color = getDefaultForeground();
applyForegroundColor(color, composite, getForegroundColorExclusions());
color = getBackground();
if (color == null)
color = getDefaultBackground();
applyBackgroundColor(color, composite, getBackgroundColorExclusions());
} | void function(Composite composite) { Color color = getForeground(); if (color == null) color = getDefaultForeground(); applyForegroundColor(color, composite, getForegroundColorExclusions()); color = getBackground(); if (color == null) color = getDefaultBackground(); applyBackgroundColor(color, composite, getBackgroundColorExclusions()); } | /**
* Apply any desired color to the specified composite and its children.
*
* @param composite
* the contents composite
*/ | Apply any desired color to the specified composite and its children | applyColors | {
"repo_name": "ControlSystemStudio/org.csstudio.iter",
"path": "plugins/org.eclipse.jface/src/org/eclipse/jface/dialogs/PopupDialog.java",
"license": "epl-1.0",
"size": 54110
} | [
"org.eclipse.swt.graphics.Color",
"org.eclipse.swt.widgets.Composite"
] | import org.eclipse.swt.graphics.Color; import org.eclipse.swt.widgets.Composite; | import org.eclipse.swt.graphics.*; import org.eclipse.swt.widgets.*; | [
"org.eclipse.swt"
] | org.eclipse.swt; | 2,530,408 |
@Deprecated
public Page<Map<String, Object>> paginate(Class<? extends BaseBean> cls,
Map<String, Object> attrs, String orderby) {
Table table = getTable(cls);
Config config = table.getConfig();
StringBuilder sql = new StringBuilder();
List<Object> paras = Lists.newArrayList();
config.getDialect().forModelFind(table, sql, "*", orderby, attrs, paras);
return paginate(PageContext.getPageNumber(), PageContext.getPageSize(), sql.toString(),
paras.toArray());
} | Page<Map<String, Object>> function(Class<? extends BaseBean> cls, Map<String, Object> attrs, String orderby) { Table table = getTable(cls); Config config = table.getConfig(); StringBuilder sql = new StringBuilder(); List<Object> paras = Lists.newArrayList(); config.getDialect().forModelFind(table, sql, "*", orderby, attrs, paras); return paginate(PageContext.getPageNumber(), PageContext.getPageSize(), sql.toString(), paras.toArray()); } | /**
* paginate(User.class,attrs,"order by in_time")
*
* @param cls
* @param attrs
* @param orderby
* @return
*/ | paginate(User.class,attrs,"order by in_time") | paginate | {
"repo_name": "fengjx/ttwx",
"path": "src/main/java/com/fengjx/commons/plugin/db/Model.java",
"license": "apache-2.0",
"size": 26420
} | [
"com.fengjx.commons.web.page.PageContext",
"com.google.common.collect.Lists",
"java.util.List",
"java.util.Map"
] | import com.fengjx.commons.web.page.PageContext; import com.google.common.collect.Lists; import java.util.List; import java.util.Map; | import com.fengjx.commons.web.page.*; import com.google.common.collect.*; import java.util.*; | [
"com.fengjx.commons",
"com.google.common",
"java.util"
] | com.fengjx.commons; com.google.common; java.util; | 733,806 |
@Test
public void testCreateBundle() throws IOException {
String input = IOUtils.toString(getClass().getResourceAsStream("/bryn-bundle.json"), StandardCharsets.UTF_8);
Validate.notNull(input);
myClient.create().resource(input).execute();
} | void function() throws IOException { String input = IOUtils.toString(getClass().getResourceAsStream(STR), StandardCharsets.UTF_8); Validate.notNull(input); myClient.create().resource(input).execute(); } | /**
* Issue submitted by Bryn
*/ | Issue submitted by Bryn | testCreateBundle | {
"repo_name": "SingingTree/hapi-fhir",
"path": "hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4Test.java",
"license": "apache-2.0",
"size": 239895
} | [
"java.io.IOException",
"java.nio.charset.StandardCharsets",
"org.apache.commons.io.IOUtils",
"org.apache.commons.lang3.Validate"
] | import java.io.IOException; import java.nio.charset.StandardCharsets; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.Validate; | import java.io.*; import java.nio.charset.*; import org.apache.commons.io.*; import org.apache.commons.lang3.*; | [
"java.io",
"java.nio",
"org.apache.commons"
] | java.io; java.nio; org.apache.commons; | 1,221,658 |
protected PurApItem genItemWithRetrievedAttributes( Map<String, String> itemMap, Class<? extends PurApItem> itemClass ) {
PurApItem item;
try {
item = itemClass.newInstance();
}
catch (IllegalAccessException e) {
throw new InfrastructureException("unable to complete item line population.", e);
}
catch (InstantiationException e) {
throw new InfrastructureException("unable to complete item line population.", e);
}
boolean failed = false;
for (Entry<String, String> entry : itemMap.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
try {
if (key.equals(KFSPropertyConstants.ITEM_UNIT_OF_MEASURE_CODE)) {
value = value.toUpperCase(); // force UOM code to uppercase
}
try {
ObjectUtils.setObjectProperty(item, key, value);
}
catch (FormatException e) {
String[] errorParams = { value, key, "" + lineNo };
throw new ItemParserException("invalid numeric property value: " + key + " = " + value + " (line " + lineNo + ")", ERROR_ITEMPARSER_INVALID_NUMERIC_VALUE, errorParams);
}
}
catch (ItemParserException e) {
// continue to parse the rest of the item properties after the current property fails
GlobalVariables.getMessageMap().putError( PurapConstants.ITEM_TAB_ERRORS, e.getErrorKey(), e.getErrorParameters() );
failed = true;
}
catch (IllegalAccessException e) {
throw new InfrastructureException("unable to complete item line population.", e);
}
catch (NoSuchMethodException e) {
throw new InfrastructureException("unable to complete item line population.", e);
}
catch (InvocationTargetException e) {
throw new InfrastructureException("unable to complete item line population.", e);
}
}
if (failed) {
throw new ItemParserException("empty or invalid item properties in line " + lineNo + ")", ERROR_ITEMPARSER_ITEM_PROPERTY, ""+lineNo);
}
return item;
}
| PurApItem function( Map<String, String> itemMap, Class<? extends PurApItem> itemClass ) { PurApItem item; try { item = itemClass.newInstance(); } catch (IllegalAccessException e) { throw new InfrastructureException(STR, e); } catch (InstantiationException e) { throw new InfrastructureException(STR, e); } boolean failed = false; for (Entry<String, String> entry : itemMap.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); try { if (key.equals(KFSPropertyConstants.ITEM_UNIT_OF_MEASURE_CODE)) { value = value.toUpperCase(); } try { ObjectUtils.setObjectProperty(item, key, value); } catch (FormatException e) { String[] errorParams = { value, key, STRinvalid numeric property value: STR = STR (line STR)", ERROR_ITEMPARSER_INVALID_NUMERIC_VALUE, errorParams); } } catch (ItemParserException e) { GlobalVariables.getMessageMap().putError( PurapConstants.ITEM_TAB_ERRORS, e.getErrorKey(), e.getErrorParameters() ); failed = true; } catch (IllegalAccessException e) { throw new InfrastructureException(STR, e); } catch (NoSuchMethodException e) { throw new InfrastructureException(STR, e); } catch (InvocationTargetException e) { throw new InfrastructureException(STR, e); } } if (failed) { throw new ItemParserException("empty or invalid item properties in line STR)STR"+lineNo); } return item; } | /**
* Generates an item instance and populates it with the specified attribute map.
*
* @param itemMap the specified attribute map from which attributes are populated
* @param itemClass the class of which the new item instance shall be created
* @return the populated item
*/ | Generates an item instance and populates it with the specified attribute map | genItemWithRetrievedAttributes | {
"repo_name": "ua-eas/ua-kfs-5.3",
"path": "work/src/org/kuali/kfs/module/purap/util/ItemParserBase.java",
"license": "agpl-3.0",
"size": 16119
} | [
"java.lang.reflect.InvocationTargetException",
"java.util.Map",
"org.kuali.kfs.module.purap.PurapConstants",
"org.kuali.kfs.module.purap.businessobject.PurApItem",
"org.kuali.kfs.module.purap.exception.ItemParserException",
"org.kuali.kfs.sys.KFSPropertyConstants",
"org.kuali.rice.core.web.format.FormatException",
"org.kuali.rice.krad.exception.InfrastructureException",
"org.kuali.rice.krad.util.GlobalVariables",
"org.kuali.rice.krad.util.ObjectUtils"
] | import java.lang.reflect.InvocationTargetException; import java.util.Map; import org.kuali.kfs.module.purap.PurapConstants; import org.kuali.kfs.module.purap.businessobject.PurApItem; import org.kuali.kfs.module.purap.exception.ItemParserException; import org.kuali.kfs.sys.KFSPropertyConstants; import org.kuali.rice.core.web.format.FormatException; import org.kuali.rice.krad.exception.InfrastructureException; import org.kuali.rice.krad.util.GlobalVariables; import org.kuali.rice.krad.util.ObjectUtils; | import java.lang.reflect.*; import java.util.*; import org.kuali.kfs.module.purap.*; import org.kuali.kfs.module.purap.businessobject.*; import org.kuali.kfs.module.purap.exception.*; import org.kuali.kfs.sys.*; import org.kuali.rice.core.web.format.*; import org.kuali.rice.krad.exception.*; import org.kuali.rice.krad.util.*; | [
"java.lang",
"java.util",
"org.kuali.kfs",
"org.kuali.rice"
] | java.lang; java.util; org.kuali.kfs; org.kuali.rice; | 2,088,206 |
@Test
public void testSFLMethAnn() throws Exception {
long currentThreadId = 0;
BasicStatefulLocal bean = lookupSFLBean();
// update results with bean creation
assertNotNull("Async Stateful Bean created successfully", bean);
// call bean asynchronous method
bean.test_fireAndForget();
// wait for async work to complete
BasicStatefulLocalBean.svBeanLatch.await(BasicStatefulLocalBean.MAX_ASYNC_WAIT, TimeUnit.MILLISECONDS);
svLogger.info("Asynchronous method work completed: " + BasicStatefulLocalBean.asyncWorkDone);
// update results for asynchronous work done
assertTrue("Async Stateful Bean method completed", BasicStatefulLocalBean.asyncWorkDone);
// get current thread Id for comparison to bean method thread id
currentThreadId = Thread.currentThread().getId();
svLogger.info("Test threadId = " + currentThreadId);
svLogger.info("Bean threadId = " + BasicStatefulLocalBean.beanThreadId);
// update results with current and bean method thread id comparison
assertFalse("Async Stateful Bean method completed on separate thread", (BasicStatefulLocalBean.beanThreadId == currentThreadId));
} | void function() throws Exception { long currentThreadId = 0; BasicStatefulLocal bean = lookupSFLBean(); assertNotNull(STR, bean); bean.test_fireAndForget(); BasicStatefulLocalBean.svBeanLatch.await(BasicStatefulLocalBean.MAX_ASYNC_WAIT, TimeUnit.MILLISECONDS); svLogger.info(STR + BasicStatefulLocalBean.asyncWorkDone); assertTrue(STR, BasicStatefulLocalBean.asyncWorkDone); currentThreadId = Thread.currentThread().getId(); svLogger.info(STR + currentThreadId); svLogger.info(STR + BasicStatefulLocalBean.beanThreadId); assertFalse(STR, (BasicStatefulLocalBean.beanThreadId == currentThreadId)); } | /**
* Test calling a method with an Asynchronous annotation at the method level
* on an EJB 3.1 Stateful Session Bean.
*/ | Test calling a method with an Asynchronous annotation at the method level on an EJB 3.1 Stateful Session Bean | testSFLMethAnn | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.ejbcontainer.async_fat/test-applications/AsyncTestWeb.war/src/com/ibm/ws/ejbcontainer/async/fat/web/BasicServlet.java",
"license": "epl-1.0",
"size": 7979
} | [
"com.ibm.ws.ejbcontainer.async.fat.ann.ejb.BasicStatefulLocal",
"com.ibm.ws.ejbcontainer.async.fat.ann.ejb.BasicStatefulLocalBean",
"java.util.concurrent.TimeUnit",
"org.junit.Assert"
] | import com.ibm.ws.ejbcontainer.async.fat.ann.ejb.BasicStatefulLocal; import com.ibm.ws.ejbcontainer.async.fat.ann.ejb.BasicStatefulLocalBean; import java.util.concurrent.TimeUnit; import org.junit.Assert; | import com.ibm.ws.ejbcontainer.async.fat.ann.ejb.*; import java.util.concurrent.*; import org.junit.*; | [
"com.ibm.ws",
"java.util",
"org.junit"
] | com.ibm.ws; java.util; org.junit; | 620,465 |
public void handleSpawnPainting(SPacketSpawnPainting packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
EntityPainting entitypainting = new EntityPainting(this.clientWorldController, packetIn.getPosition(), packetIn.getFacing(), packetIn.getTitle());
entitypainting.setUniqueId(packetIn.getUniqueId());
this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entitypainting);
} | void function(SPacketSpawnPainting packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); EntityPainting entitypainting = new EntityPainting(this.clientWorldController, packetIn.getPosition(), packetIn.getFacing(), packetIn.getTitle()); entitypainting.setUniqueId(packetIn.getUniqueId()); this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entitypainting); } | /**
* Handles the spawning of a painting object
*/ | Handles the spawning of a painting object | handleSpawnPainting | {
"repo_name": "TheGreatAndPowerfulWeegee/wipunknown",
"path": "build/tmp/recompileMc/sources/net/minecraft/client/network/NetHandlerPlayClient.java",
"license": "gpl-3.0",
"size": 102435
} | [
"net.minecraft.entity.item.EntityPainting",
"net.minecraft.network.PacketThreadUtil",
"net.minecraft.network.play.server.SPacketSpawnPainting"
] | import net.minecraft.entity.item.EntityPainting; import net.minecraft.network.PacketThreadUtil; import net.minecraft.network.play.server.SPacketSpawnPainting; | import net.minecraft.entity.item.*; import net.minecraft.network.*; import net.minecraft.network.play.server.*; | [
"net.minecraft.entity",
"net.minecraft.network"
] | net.minecraft.entity; net.minecraft.network; | 1,726,590 |
@Override
@SuppressWarnings("unchecked")
protected <T> Object doValidate(Object array, ValidationContext<T> context,
List<ConstraintViolationException> violations) {
int length = Array.getLength(array);
context.setCurrentTarget(ValidationTarget.ELEMENTS);
for (int i = 0; i < length; i++) {
try {
context.setCurrentIndex(i);
V oldValue = (V) Array.get(array, i);
V newValue = constraint.validate(oldValue, context);
if (oldValue != newValue)
Array.set(array, i, newValue);
} catch (ConstraintViolationException e) {
violations.add(e);
}
}
return array;
} | @SuppressWarnings(STR) <T> Object function(Object array, ValidationContext<T> context, List<ConstraintViolationException> violations) { int length = Array.getLength(array); context.setCurrentTarget(ValidationTarget.ELEMENTS); for (int i = 0; i < length; i++) { try { context.setCurrentIndex(i); V oldValue = (V) Array.get(array, i); V newValue = constraint.validate(oldValue, context); if (oldValue != newValue) Array.set(array, i, newValue); } catch (ConstraintViolationException e) { violations.add(e); } } return array; } | /**
* Checks whether all elements of the specified array conforms to the
* constraint of array elements.
*
* @param array Array whose elements to be checked.
* @param context Validation context.
* @param violations List of violations.
* @return Array with possibly modified elements if constraint of array
* elements can modify values; unmodified array otherwise.
*/ | Checks whether all elements of the specified array conforms to the constraint of array elements | doValidate | {
"repo_name": "foxinboxx/foxlabs-validation",
"path": "src/main/java/org/foxlabs/validation/constraint/ArrayElementConstraint.java",
"license": "apache-2.0",
"size": 3087
} | [
"java.lang.reflect.Array",
"java.util.List",
"org.foxlabs.validation.ValidationContext",
"org.foxlabs.validation.ValidationTarget"
] | import java.lang.reflect.Array; import java.util.List; import org.foxlabs.validation.ValidationContext; import org.foxlabs.validation.ValidationTarget; | import java.lang.reflect.*; import java.util.*; import org.foxlabs.validation.*; | [
"java.lang",
"java.util",
"org.foxlabs.validation"
] | java.lang; java.util; org.foxlabs.validation; | 121,920 |
public void executeSql(final Connection connection, final String sql, final boolean isAutoCommit) throws SQLException
{
if (sql != null) {
Statement statement = connection.createStatement();
try {
statement.execute(sql);
if (!isAutoCommit) {
connection.commit();
}
}
finally {
statement.close();
}
}
} | void function(final Connection connection, final String sql, final boolean isAutoCommit) throws SQLException { if (sql != null) { Statement statement = connection.createStatement(); try { statement.execute(sql); if (!isAutoCommit) { connection.commit(); } } finally { statement.close(); } } } | /**
* Execute the user-specified init SQL.
*
* @param connection the connection to initialize
* @param sql the SQL to execute
* @param isAutoCommit whether to commit the SQL after execution or not
* @throws SQLException throws if the init SQL execution fails
*/ | Execute the user-specified init SQL | executeSql | {
"repo_name": "guai/HikariCP",
"path": "hikaricp-common/src/main/java/ru/programpark/hikari/pool/PoolUtilities.java",
"license": "apache-2.0",
"size": 9288
} | [
"java.sql.Connection",
"java.sql.SQLException",
"java.sql.Statement"
] | import java.sql.Connection; import java.sql.SQLException; import java.sql.Statement; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,490,088 |
@Override
public XYToolTipGenerator getToolTipGenerator(int series, int item) {
XYToolTipGenerator generator
= (XYToolTipGenerator) this.toolTipGeneratorList.get(series);
if (generator == null) {
generator = this.baseToolTipGenerator;
}
return generator;
} | XYToolTipGenerator function(int series, int item) { XYToolTipGenerator generator = (XYToolTipGenerator) this.toolTipGeneratorList.get(series); if (generator == null) { generator = this.baseToolTipGenerator; } return generator; } | /**
* Returns the tooltip generator for the specified series and item.
*
* @param series the series index.
* @param item the item index.
*
* @return The tooltip generator (possibly <code>null</code>).
*
* @since 1.0.14
*/ | Returns the tooltip generator for the specified series and item | getToolTipGenerator | {
"repo_name": "hongliangpan/manydesigns.cn",
"path": "trunk/portofino-chart/jfreechat.src/org/jfree/chart/renderer/DefaultPolarItemRenderer.java",
"license": "lgpl-3.0",
"size": 33244
} | [
"org.jfree.chart.labels.XYToolTipGenerator"
] | import org.jfree.chart.labels.XYToolTipGenerator; | import org.jfree.chart.labels.*; | [
"org.jfree.chart"
] | org.jfree.chart; | 1,850,469 |
public void requestDeleteAllReturnRoutes(int nodeId)
{
this.enqueue(new DeleteReturnRouteMessageClass().doRequest(nodeId));
} | void function(int nodeId) { this.enqueue(new DeleteReturnRouteMessageClass().doRequest(nodeId)); } | /**
* Delete all return nodes from the specified node. This should be performed
* before updating the routes
*
* @param nodeId
*/ | Delete all return nodes from the specified node. This should be performed before updating the routes | requestDeleteAllReturnRoutes | {
"repo_name": "cschneider/openhab",
"path": "bundles/binding/org.openhab.binding.zwave/src/main/java/org/openhab/binding/zwave/internal/protocol/ZWaveController.java",
"license": "epl-1.0",
"size": 55071
} | [
"org.openhab.binding.zwave.internal.protocol.serialmessage.DeleteReturnRouteMessageClass"
] | import org.openhab.binding.zwave.internal.protocol.serialmessage.DeleteReturnRouteMessageClass; | import org.openhab.binding.zwave.internal.protocol.serialmessage.*; | [
"org.openhab.binding"
] | org.openhab.binding; | 1,478,608 |
@RequestMapping(value = "adCategories/{id}", method = RequestMethod.GET)
@ResponseBody
public AdCategoryHierarchicalVO loadById(@PathVariable final Long id) {
AdCategory category;
try {
category = adCategoryService.load(id);
} catch (Exception e) {
throw new EntityNotFoundException(Ad.class);
}
return adCategoryService.getHierarchicalVO(category);
} | @RequestMapping(value = STR, method = RequestMethod.GET) AdCategoryHierarchicalVO function(@PathVariable final Long id) { AdCategory category; try { category = adCategoryService.load(id); } catch (Exception e) { throw new EntityNotFoundException(Ad.class); } return adCategoryService.getHierarchicalVO(category); } | /**
* Loads an advertisement category by id
*/ | Loads an advertisement category by id | loadById | {
"repo_name": "robertoandrade/cyclos",
"path": "src/nl/strohalm/cyclos/webservices/rest/AdCategoriesRestController.java",
"license": "gpl-2.0",
"size": 2819
} | [
"nl.strohalm.cyclos.entities.ads.Ad",
"nl.strohalm.cyclos.entities.ads.AdCategory",
"nl.strohalm.cyclos.entities.exceptions.EntityNotFoundException",
"nl.strohalm.cyclos.webservices.model.AdCategoryHierarchicalVO",
"org.springframework.web.bind.annotation.PathVariable",
"org.springframework.web.bind.annotation.RequestMapping",
"org.springframework.web.bind.annotation.RequestMethod"
] | import nl.strohalm.cyclos.entities.ads.Ad; import nl.strohalm.cyclos.entities.ads.AdCategory; import nl.strohalm.cyclos.entities.exceptions.EntityNotFoundException; import nl.strohalm.cyclos.webservices.model.AdCategoryHierarchicalVO; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; | import nl.strohalm.cyclos.entities.ads.*; import nl.strohalm.cyclos.entities.exceptions.*; import nl.strohalm.cyclos.webservices.model.*; import org.springframework.web.bind.annotation.*; | [
"nl.strohalm.cyclos",
"org.springframework.web"
] | nl.strohalm.cyclos; org.springframework.web; | 1,939,136 |
public void run() {
try {
// We must remove the listener inside a thread,
// as JMS doesn't allow us to remove it within the
// call it made.
removeListener();
File crawlDir = createCrawlDir();
final HeritrixFiles files =
controller.writeHarvestFiles(
crawlDir,
job,
origHarvestInfo,
metadataEntries);
log.info(STARTCRAWL_MESSAGE + " " + job.getJobID());
Throwable crawlException = null;
try {
controller.runHarvest(files);
} catch (Throwable e) {
String msg = "Error during crawling. "
+ "The crawl may have been only "
+ "partially completed.";
log.warn(msg, e);
crawlException = e;
throw new IOFailure(msg, e);
} finally {
// This handles some message sending, so it must live
// in HCS for now, but the meat of it should be in
// HarvestController
// TODO Refactor to be able to move this out.
// TODO This may overwrite another exception, since this
// may throw exceptions.
processHarvestInfoFile(files.getCrawlDir(), crawlException);
}
} catch (Throwable e) {
String msg = "Fatal error while operating job '" + job + "'";
log.fatal(msg, e);
NotificationsFactory.getInstance().notify(msg, NotificationType.ERROR, e);
} finally {
log.info(ENDCRAWL_MESSAGE + " " + job.getJobID());
// process serverdir for files not yet uploaded.
processOldJobs();
shutdownNowOrContinue();
startAcceptingJobs();
beginListeningIfSpaceAvailable();
}
} | void function() { try { removeListener(); File crawlDir = createCrawlDir(); final HeritrixFiles files = controller.writeHarvestFiles( crawlDir, job, origHarvestInfo, metadataEntries); log.info(STARTCRAWL_MESSAGE + " " + job.getJobID()); Throwable crawlException = null; try { controller.runHarvest(files); } catch (Throwable e) { String msg = STR + STR + STR; log.warn(msg, e); crawlException = e; throw new IOFailure(msg, e); } finally { processHarvestInfoFile(files.getCrawlDir(), crawlException); } } catch (Throwable e) { String msg = STR + job + "'"; log.fatal(msg, e); NotificationsFactory.getInstance().notify(msg, NotificationType.ERROR, e); } finally { log.info(ENDCRAWL_MESSAGE + " " + job.getJobID()); processOldJobs(); shutdownNowOrContinue(); startAcceptingJobs(); beginListeningIfSpaceAvailable(); } } | /** The thread body for the harvester thread. Removes the JMS
* listener, sets up the files for Heritrix, then passes control
* to the HarvestController to perform the actual harvest.
*
* TODO Get file writing into HarvestController as well
* (requires some rearrangement of the message sending)
* @throws PermissionDenied if we cannot create the crawl directory.
* @throws IOFailure if there are problems preparing or running the
* crawl.
*/ | The thread body for the harvester thread. Removes the JMS listener, sets up the files for Heritrix, then passes control to the HarvestController to perform the actual harvest. TODO Get file writing into HarvestController as well (requires some rearrangement of the message sending) | run | {
"repo_name": "netarchivesuite/netarchivesuite-svngit-migration",
"path": "src/dk/netarkivet/harvester/harvesting/distribute/HarvestControllerServer.java",
"license": "lgpl-2.1",
"size": 38269
} | [
"dk.netarkivet.common.exceptions.IOFailure",
"dk.netarkivet.common.utils.NotificationType",
"dk.netarkivet.common.utils.NotificationsFactory",
"dk.netarkivet.harvester.harvesting.HeritrixFiles",
"java.io.File"
] | import dk.netarkivet.common.exceptions.IOFailure; import dk.netarkivet.common.utils.NotificationType; import dk.netarkivet.common.utils.NotificationsFactory; import dk.netarkivet.harvester.harvesting.HeritrixFiles; import java.io.File; | import dk.netarkivet.common.exceptions.*; import dk.netarkivet.common.utils.*; import dk.netarkivet.harvester.harvesting.*; import java.io.*; | [
"dk.netarkivet.common",
"dk.netarkivet.harvester",
"java.io"
] | dk.netarkivet.common; dk.netarkivet.harvester; java.io; | 2,256,759 |
public void startImport(final String sourceName, final File dataFile, ProgressListener listener) {
this.listener = listener;
| void function(final String sourceName, final File dataFile, ProgressListener listener) { this.listener = listener; | /**
* Start the import of the data file to the RBNB server specified in the
* constructor using the source name supplied. The status of the import will
* be posted too the listener.
* <p>
* This methods will spawn the import in another thread and return before it
* is completed.
*
* @param sourceName the source name for the RBNB server
* @param dataFile the file containing the data to import
* @param listener the listener to post status too
*/ | Start the import of the data file to the RBNB server specified in the constructor using the source name supplied. The status of the import will be posted too the listener. This methods will spawn the import in another thread and return before it is completed | startImport | {
"repo_name": "cagrierciyes/osdt",
"path": "rdv/src/org/rdv/rbnb/RBNBImport.java",
"license": "isc",
"size": 8279
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 798,993 |
public FSArray getTargetList() {
if (MMAXPointer_Type.featOkTst && ((MMAXPointer_Type)jcasType).casFeat_targetList == null)
jcasType.jcas.throwFeatMissing("targetList", "de.julielab.jules.types.mmax.MMAXPointer");
return (FSArray)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefValue(addr, ((MMAXPointer_Type)jcasType).casFeatCode_targetList)));} | FSArray function() { if (MMAXPointer_Type.featOkTst && ((MMAXPointer_Type)jcasType).casFeat_targetList == null) jcasType.jcas.throwFeatMissing(STR, STR); return (FSArray)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefValue(addr, ((MMAXPointer_Type)jcasType).casFeatCode_targetList)));} | /** getter for targetList - gets The MMAX annotations the pointer points at.
* @generated
* @return value of the feature
*/ | getter for targetList - gets The MMAX annotations the pointer points at | getTargetList | {
"repo_name": "BlueBrain/bluima",
"path": "modules/bluima_typesystem/src/main/java/de/julielab/jules/types/mmax/MMAXPointer.java",
"license": "apache-2.0",
"size": 5656
} | [
"org.apache.uima.jcas.cas.FSArray"
] | import org.apache.uima.jcas.cas.FSArray; | import org.apache.uima.jcas.cas.*; | [
"org.apache.uima"
] | org.apache.uima; | 852,749 |
@Test
public void testCheckEquality() {
try {
List<Unit> units = store.<Unit>getXMLResources("Unit");
AssertJUnit.assertTrue(units.size() > 0);
for (Unit unit: units) {
AssertJUnit.assertTrue(unit.equals(unit));
}
} catch (Exception e) {
Assert.fail(e.getMessage());
}
} | void function() { try { List<Unit> units = store.<Unit>getXMLResources("Unit"); AssertJUnit.assertTrue(units.size() > 0); for (Unit unit: units) { AssertJUnit.assertTrue(unit.equals(unit)); } } catch (Exception e) { Assert.fail(e.getMessage()); } } | /**
* Test checking equality.
*/ | Test checking equality | testCheckEquality | {
"repo_name": "martinggww/Programming",
"path": "XBRL/xbrl-api/module-api/src/test/java/org/xbrlapi/fragment/tests/UnitTestCase.java",
"license": "gpl-2.0",
"size": 2576
} | [
"java.util.List",
"org.testng.Assert",
"org.testng.AssertJUnit",
"org.xbrlapi.Unit"
] | import java.util.List; import org.testng.Assert; import org.testng.AssertJUnit; import org.xbrlapi.Unit; | import java.util.*; import org.testng.*; import org.xbrlapi.*; | [
"java.util",
"org.testng",
"org.xbrlapi"
] | java.util; org.testng; org.xbrlapi; | 1,308,654 |
public Builder withDebugInterval(long debugInterval) {
checkArgument(debugInterval >= 0);
this.debugInterval = debugInterval;
return this;
} | Builder function(long debugInterval) { checkArgument(debugInterval >= 0); this.debugInterval = debugInterval; return this; } | /**
* Number of seconds between successive debug print statements. This
* parameter is not required and defaults to an arbitrary large number.
*
* @param debugInterval number of seconds between successive debug print
* statements. It must be positive.
* @return this builder.
*/ | Number of seconds between successive debug print statements. This parameter is not required and defaults to an arbitrary large number | withDebugInterval | {
"repo_name": "catholicon/jackrabbit-oak",
"path": "oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/tool/Check.java",
"license": "apache-2.0",
"size": 17244
} | [
"com.google.common.base.Preconditions"
] | import com.google.common.base.Preconditions; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 1,422,979 |
public void testAddFirstNull() {
ArrayDeque q = new ArrayDeque();
try {
q.addFirst(null);
shouldThrow();
} catch (NullPointerException success) {}
} | void function() { ArrayDeque q = new ArrayDeque(); try { q.addFirst(null); shouldThrow(); } catch (NullPointerException success) {} } | /**
* addFirst(null) throws NPE
*/ | addFirst(null) throws NPE | testAddFirstNull | {
"repo_name": "FauxFaux/jdk9-jdk",
"path": "test/java/util/concurrent/tck/ArrayDequeTest.java",
"license": "gpl-2.0",
"size": 27210
} | [
"java.util.ArrayDeque"
] | import java.util.ArrayDeque; | import java.util.*; | [
"java.util"
] | java.util; | 1,693,679 |
public void print() {
print(new PrintWriter(System.out, true));
} | void function() { print(new PrintWriter(System.out, true)); } | /**
* Prints the contents of the constant pool table.
*/ | Prints the contents of the constant pool table | print | {
"repo_name": "erkieh/proxyhotswap",
"path": "src/main/java/io/github/proxyhotswap/javassist/bytecode/ConstPool.java",
"license": "gpl-2.0",
"size": 60250
} | [
"java.io.PrintWriter"
] | import java.io.PrintWriter; | import java.io.*; | [
"java.io"
] | java.io; | 465,659 |
public Template getTemplate(String name)
throws ResourceNotFoundException, ParseErrorException
{
return ri.getTemplate( name );
} | Template function(String name) throws ResourceNotFoundException, ParseErrorException { return ri.getTemplate( name ); } | /**
* Returns a <code>Template</code> from the Velocity
* resource management system.
*
* @param name The file name of the desired template.
* @return The template.
* @throws ResourceNotFoundException if template not found
* from any available source.
* @throws ParseErrorException if template cannot be parsed due
* to syntax (or other) error.
*/ | Returns a <code>Template</code> from the Velocity resource management system | getTemplate | {
"repo_name": "austindlawless/dotCMS",
"path": "src/org/apache/velocity/app/VelocityEngine.java",
"license": "gpl-3.0",
"size": 17365
} | [
"org.apache.velocity.Template",
"org.apache.velocity.exception.ParseErrorException",
"org.apache.velocity.exception.ResourceNotFoundException"
] | import org.apache.velocity.Template; import org.apache.velocity.exception.ParseErrorException; import org.apache.velocity.exception.ResourceNotFoundException; | import org.apache.velocity.*; import org.apache.velocity.exception.*; | [
"org.apache.velocity"
] | org.apache.velocity; | 2,600,414 |
public String getIssuerName() {
return RFC2253Parser.normalize(
this.getTextFromChildElement(Constants._TAG_X509ISSUERNAME, Constants.SignatureSpecNS)
);
} | String function() { return RFC2253Parser.normalize( this.getTextFromChildElement(Constants._TAG_X509ISSUERNAME, Constants.SignatureSpecNS) ); } | /**
* Method getIssuerName
*
* @return the issuer name
*/ | Method getIssuerName | getIssuerName | {
"repo_name": "shun634501730/java_source_cn",
"path": "src_en/com/sun/org/apache/xml/internal/security/keys/content/x509/XMLX509IssuerSerial.java",
"license": "apache-2.0",
"size": 5169
} | [
"com.sun.org.apache.xml.internal.security.utils.Constants",
"com.sun.org.apache.xml.internal.security.utils.RFC2253Parser"
] | import com.sun.org.apache.xml.internal.security.utils.Constants; import com.sun.org.apache.xml.internal.security.utils.RFC2253Parser; | import com.sun.org.apache.xml.internal.security.utils.*; | [
"com.sun.org"
] | com.sun.org; | 826,119 |
public static IndicesAliasesRequest indexAliasesRequest() {
return new IndicesAliasesRequest();
} | static IndicesAliasesRequest function() { return new IndicesAliasesRequest(); } | /**
* Creates an index aliases request allowing to add and remove aliases.
*
* @return The index aliases request
*/ | Creates an index aliases request allowing to add and remove aliases | indexAliasesRequest | {
"repo_name": "alexksikes/elasticsearch",
"path": "src/main/java/org/elasticsearch/client/Requests.java",
"license": "apache-2.0",
"size": 22432
} | [
"org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest"
] | import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest; | import org.elasticsearch.action.admin.indices.alias.*; | [
"org.elasticsearch.action"
] | org.elasticsearch.action; | 754,684 |
public View process(HttpServletRequest request, HttpServletResponse response) throws ServletException {
Blog blog = (Blog)getModel().get(Constants.BLOG_KEY);
String privateBlog = request.getParameter("private");
blog.setProperty(Blog.PRIVATE_KEY, privateBlog);
String values[] = request.getParameterValues("blogOwners");
StringBuffer blogOwners = new StringBuffer();
if (values != null) {
for (String value : values) {
blogOwners.append(value);
blogOwners.append(",");
}
}
blog.setProperty(Blog.BLOG_OWNERS_KEY, blogOwners.toString());
values = request.getParameterValues("blogPublishers");
StringBuffer blogPublishers = new StringBuffer();
if (values != null) {
for (String value : values) {
blogPublishers.append(value);
blogPublishers.append(",");
}
}
blog.setProperty(Blog.BLOG_PUBLISHERS_KEY, blogPublishers.toString());
values = request.getParameterValues("blogContributors");
StringBuffer blogContributors = new StringBuffer();
if (values != null) {
for (String value : values) {
blogContributors.append(value);
blogContributors.append(",");
}
}
blog.setProperty(Blog.BLOG_CONTRIBUTORS_KEY, blogContributors.toString());
values = request.getParameterValues("blogReaders");
StringBuffer blogReaders = new StringBuffer();
if (values != null) {
for (String value : values) {
blogReaders.append(value);
blogReaders.append(",");
}
}
blog.setProperty(Blog.BLOG_READERS_KEY, blogReaders.toString());
try {
blog.storeProperties();
blog.info("Blog security settings saved.");
} catch (BlogServiceException e) {
throw new ServletException(e);
}
return new RedirectView(blog.getUrl() + "viewBlogSecurity.secureaction");
}
| View function(HttpServletRequest request, HttpServletResponse response) throws ServletException { Blog blog = (Blog)getModel().get(Constants.BLOG_KEY); String privateBlog = request.getParameter(STR); blog.setProperty(Blog.PRIVATE_KEY, privateBlog); String values[] = request.getParameterValues(STR); StringBuffer blogOwners = new StringBuffer(); if (values != null) { for (String value : values) { blogOwners.append(value); blogOwners.append(","); } } blog.setProperty(Blog.BLOG_OWNERS_KEY, blogOwners.toString()); values = request.getParameterValues(STR); StringBuffer blogPublishers = new StringBuffer(); if (values != null) { for (String value : values) { blogPublishers.append(value); blogPublishers.append(","); } } blog.setProperty(Blog.BLOG_PUBLISHERS_KEY, blogPublishers.toString()); values = request.getParameterValues(STR); StringBuffer blogContributors = new StringBuffer(); if (values != null) { for (String value : values) { blogContributors.append(value); blogContributors.append(","); } } blog.setProperty(Blog.BLOG_CONTRIBUTORS_KEY, blogContributors.toString()); values = request.getParameterValues(STR); StringBuffer blogReaders = new StringBuffer(); if (values != null) { for (String value : values) { blogReaders.append(value); blogReaders.append(","); } } blog.setProperty(Blog.BLOG_READERS_KEY, blogReaders.toString()); try { blog.storeProperties(); blog.info(STR); } catch (BlogServiceException e) { throw new ServletException(e); } return new RedirectView(blog.getUrl() + STR); } | /**
* Peforms the processing associated with this action.
*
* @param request the HttpServletRequest instance
* @param response the HttpServletResponse instance
* @return the name of the next view
*/ | Peforms the processing associated with this action | process | {
"repo_name": "rootnix911/pebbleblog",
"path": "src/main/java/net/sourceforge/pebble/web/action/SaveBlogSecurityAction.java",
"license": "bsd-3-clause",
"size": 4829
} | [
"javax.servlet.ServletException",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"net.sourceforge.pebble.Constants",
"net.sourceforge.pebble.domain.Blog",
"net.sourceforge.pebble.domain.BlogServiceException",
"net.sourceforge.pebble.web.view.RedirectView",
"net.sourceforge.pebble.web.view.View"
] | import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import net.sourceforge.pebble.Constants; import net.sourceforge.pebble.domain.Blog; import net.sourceforge.pebble.domain.BlogServiceException; import net.sourceforge.pebble.web.view.RedirectView; import net.sourceforge.pebble.web.view.View; | import javax.servlet.*; import javax.servlet.http.*; import net.sourceforge.pebble.*; import net.sourceforge.pebble.domain.*; import net.sourceforge.pebble.web.view.*; | [
"javax.servlet",
"net.sourceforge.pebble"
] | javax.servlet; net.sourceforge.pebble; | 1,145,097 |
public static Movie getData(File nfoFilename) {
if (context == null) {
MessageManager.instance.pushMessage(new Message(MessageLevel.ERROR, nfoFilename, "message.nfo.readerror"));
return null;
}
// try to parse XML
Movie movie = null;
try {
MovieToMpNfoConnector mp = parseNFO(nfoFilename);
movie = new Movie();
movie.setTitle(mp.getTitle());
movie.setSortTitle(mp.getSorttitle());
movie.setOriginalTitle(mp.getOriginaltitle());
movie.setRating(mp.getRating());
movie.setVotes(mp.getVotes());
movie.setYear(mp.getYear());
try {
movie.setReleaseDate(mp.premiered);
}
catch (ParseException e) {
}
movie.setPlot(mp.getPlot());
movie.setTagline(mp.getTagline());
try {
String rt = mp.getRuntime().replaceAll("[^0-9]", "");
movie.setRuntime(Integer.parseInt(rt));
}
catch (Exception e) {
LOGGER.warn("could not parse runtime: " + mp.getRuntime());
}
for (Entry<String, Object> entry : mp.ids.entrySet()) {
try {
movie.setId(entry.getKey(), entry.getValue());
}
catch (Exception e) {
LOGGER.warn("could not set ID: " + entry.getKey() + " ; " + entry.getValue());
}
}
if (StringUtils.isBlank(movie.getImdbId())) {
movie.setImdbId(mp.id);
}
movie.setDirector(mp.getDirector());
movie.setWriter(mp.getCredits());
movie.setProductionCompany(mp.getStudio());
movie.setCountry(mp.getCountry());
if (!StringUtils.isEmpty(mp.getMpaa())) {
movie.setCertification(Certification.parseCertificationStringForMovieSetupCountry(mp.getMpaa()));
}
// movieset
if (mp.getSets() != null && mp.getSets().size() > 0) {
MovieSets sets = mp.getSets().get(0);
// search for that movieset
MovieList movieList = MovieList.getInstance();
MovieSet movieSet = movieList.getMovieSet(sets.getName(), 0);
// add movie to movieset
if (movieSet != null) {
movie.setMovieSet(movieSet);
movie.setSortTitle(sets.getName() + String.format("%02d", sets.getOrder()));
}
}
for (Actor actor : mp.getActors()) {
MovieActor cast = new MovieActor(actor.getName(), actor.getRole());
cast.setThumbUrl(actor.getThumb());
movie.addActor(cast);
}
for (Producer producer : mp.getProducers()) {
MovieProducer cast = new MovieProducer(producer.name, producer.role);
cast.setThumbUrl(producer.thumb);
movie.addProducer(cast);
}
for (String genre : mp.getGenres()) {
String[] genres = genre.split("/");
for (String g : genres) {
MediaGenres genreFound = MediaGenres.getGenre(g.trim());
if (genreFound != null) {
movie.addGenre(genreFound);
}
}
}
}
catch (UnmarshalException e) {
LOGGER.error("getData " + nfoFilename.getAbsolutePath(), e.getMessage());
// MessageManager.instance.pushMessage(new Message(MessageLevel.ERROR, nfoFilename, "message.nfo.readerror"));
return null;
}
catch (Exception e) {
LOGGER.error("getData " + nfoFilename.getAbsolutePath(), e);
// MessageManager.instance.pushMessage(new Message(MessageLevel.ERROR, nfoFilename, "message.nfo.readerror"));
return null;
}
// only return if a movie name has been found
if (StringUtils.isEmpty(movie.getTitle())) {
return null;
}
return movie;
} | static Movie function(File nfoFilename) { if (context == null) { MessageManager.instance.pushMessage(new Message(MessageLevel.ERROR, nfoFilename, STR)); return null; } Movie movie = null; try { MovieToMpNfoConnector mp = parseNFO(nfoFilename); movie = new Movie(); movie.setTitle(mp.getTitle()); movie.setSortTitle(mp.getSorttitle()); movie.setOriginalTitle(mp.getOriginaltitle()); movie.setRating(mp.getRating()); movie.setVotes(mp.getVotes()); movie.setYear(mp.getYear()); try { movie.setReleaseDate(mp.premiered); } catch (ParseException e) { } movie.setPlot(mp.getPlot()); movie.setTagline(mp.getTagline()); try { String rt = mp.getRuntime().replaceAll(STR, STRcould not parse runtime: STRcould not set ID: STR ; STR%02dSTR/STRgetData STRgetData " + nfoFilename.getAbsolutePath(), e); return null; } if (StringUtils.isEmpty(movie.getTitle())) { return null; } return movie; } | /**
* Gets the data.
*
* @param nfoFilename
* the nfo filename
* @return the data
*/ | Gets the data | getData | {
"repo_name": "mlaggner/tinyMediaManager",
"path": "src/org/tinymediamanager/core/movie/connector/MovieToMpNfoConnector.java",
"license": "apache-2.0",
"size": 26166
} | [
"java.io.File",
"java.text.ParseException",
"org.apache.commons.lang3.StringUtils",
"org.tinymediamanager.core.Message",
"org.tinymediamanager.core.MessageManager",
"org.tinymediamanager.core.movie.entities.Movie"
] | import java.io.File; import java.text.ParseException; import org.apache.commons.lang3.StringUtils; import org.tinymediamanager.core.Message; import org.tinymediamanager.core.MessageManager; import org.tinymediamanager.core.movie.entities.Movie; | import java.io.*; import java.text.*; import org.apache.commons.lang3.*; import org.tinymediamanager.core.*; import org.tinymediamanager.core.movie.entities.*; | [
"java.io",
"java.text",
"org.apache.commons",
"org.tinymediamanager.core"
] | java.io; java.text; org.apache.commons; org.tinymediamanager.core; | 2,748,377 |
public List<Project> getProjectsByManager(Integer managerId, boolean isFinishedAndAbandoned) throws BusinessException {
logger.debug("getProjectsByManager - START");
List<Project> projects = null;
try{
projects = projectDao.getProjectsByManager(managerId, isFinishedAndAbandoned);
} catch (Exception e) {
throw new BusinessException(ICodeException.PROJECT_GET_BY_MANAGER, e);
}
logger.debug("getProjectsByManager - END");
return projects;
}
| List<Project> function(Integer managerId, boolean isFinishedAndAbandoned) throws BusinessException { logger.debug(STR); List<Project> projects = null; try{ projects = projectDao.getProjectsByManager(managerId, isFinishedAndAbandoned); } catch (Exception e) { throw new BusinessException(ICodeException.PROJECT_GET_BY_MANAGER, e); } logger.debug(STR); return projects; } | /**
* Get the project for a certain manager
*
* @author Adelina
*
* @param managerId
* @return
* @throws BusinessException
*/ | Get the project for a certain manager | getProjectsByManager | {
"repo_name": "CodeSphere/termitaria",
"path": "TermitariaCM/src/ro/cs/cm/business/BLProject.java",
"license": "agpl-3.0",
"size": 16224
} | [
"java.util.List",
"ro.cs.cm.entity.Project",
"ro.cs.cm.exception.BusinessException",
"ro.cs.cm.exception.ICodeException"
] | import java.util.List; import ro.cs.cm.entity.Project; import ro.cs.cm.exception.BusinessException; import ro.cs.cm.exception.ICodeException; | import java.util.*; import ro.cs.cm.entity.*; import ro.cs.cm.exception.*; | [
"java.util",
"ro.cs.cm"
] | java.util; ro.cs.cm; | 663,709 |
private File buildSourceSubdir(File parentDir, int version) throws Exception {
File subdir = new File(parentDir, "subdir" + version);
subdir.mkdir();
File fooDir = new File(subdir, PKG_QUALIFIER_1);
fooDir.mkdir();
File barDir = new File(fooDir, PKG_QUALIFIER_2);
barDir.mkdir();
File sourceFile = new File(barDir, SHORT_TEST_CLASS_NAME + ".java");
IndentingPrintWriter pw = new IndentingPrintWriter(new FileWriter(sourceFile));
this.printSourceOn(pw, version);
pw.close();
this.compile(sourceFile);
return subdir;
} | File function(File parentDir, int version) throws Exception { File subdir = new File(parentDir, STR + version); subdir.mkdir(); File fooDir = new File(subdir, PKG_QUALIFIER_1); fooDir.mkdir(); File barDir = new File(fooDir, PKG_QUALIFIER_2); barDir.mkdir(); File sourceFile = new File(barDir, SHORT_TEST_CLASS_NAME + ".java"); IndentingPrintWriter pw = new IndentingPrintWriter(new FileWriter(sourceFile)); this.printSourceOn(pw, version); pw.close(); this.compile(sourceFile); return subdir; } | /**
* build a subdirectory "foo\bar" with the .java and .class
* files for the class ClassPathEntryTestsTestClass
*/ | build a subdirectory "foo\bar" with the .java and .class files for the class ClassPathEntryTestsTestClass | buildSourceSubdir | {
"repo_name": "RallySoftware/eclipselink.runtime",
"path": "utils/eclipselink.utils.workbench.test/mappingsplugin/source/org/eclipse/persistence/tools/workbench/test/mappingsmodel/spi/meta/ClasspathTestTool.java",
"license": "epl-1.0",
"size": 7766
} | [
"java.io.File",
"java.io.FileWriter",
"org.eclipse.persistence.tools.workbench.utility.io.IndentingPrintWriter"
] | import java.io.File; import java.io.FileWriter; import org.eclipse.persistence.tools.workbench.utility.io.IndentingPrintWriter; | import java.io.*; import org.eclipse.persistence.tools.workbench.utility.io.*; | [
"java.io",
"org.eclipse.persistence"
] | java.io; org.eclipse.persistence; | 2,211,500 |
// There are three cases: 1) node is last node. If so, stack's last has no
// right
// child and all stack nodes are the right children back to the root node.
// 2) node has right child node making next node to be the leftmost child
// node
// of right child. 3) node has no right child node. If so, go up stack until
// the child is a parent node's left child.
public synchronized TreeObject inorderNext(TreeObject t) {
// Find TreeObject t in Tree
Stack<TreeNode> tNodes = new Stack<TreeNode>();
boolean found = inorderNextFindHelper(t, tNodes, root);
if (found == false)
return null;
TreeNode topStack = tNodes.pop();
// check for case 2
if (topStack.right != null) {
// System.out.print( "f");
TreeNode goingLeft = topStack.right;
while (goingLeft.left != null) {
// System.out.print( "e");
goingLeft = goingLeft.left;
}
// System.out.print( "d");
return (goingLeft.data);
}
// go up the stack to find a node that is the left child node (case
// 3)
while (tNodes.isEmpty() != true) {
// System.out.print( "c");
TreeNode parentNode = tNodes.pop();
if (parentNode.left == topStack) {
// System.out.print( "b");
return (parentNode.data);
}
topStack = parentNode;
}
// if existing while loop, we are at the root node (case 1)
// System.out.print( "a");
return null;
}
/*
* // Recursive method to perform inorder traversal private boolean
* inorderNextFindHelper( TreeObject t, Stack tNodes, TreeNode node ) { if(
* node == null ) { return false; } tNodes.push( node); if(
* node.data.compare( t) < 0) { return inorderNextFindHelper( t, tNodes,
* node.left); } else if( node.data.compare( t) > 0) { return
* inorderNextFindHelper( t, tNodes, node.right); } else if( t != node.data)
* { return inorderNextFindHelper( t, tNodes, node.right); } return true; }
| synchronized TreeObject function(TreeObject t) { Stack<TreeNode> tNodes = new Stack<TreeNode>(); boolean found = inorderNextFindHelper(t, tNodes, root); if (found == false) return null; TreeNode topStack = tNodes.pop(); if (topStack.right != null) { TreeNode goingLeft = topStack.right; while (goingLeft.left != null) { goingLeft = goingLeft.left; } return (goingLeft.data); } while (tNodes.isEmpty() != true) { TreeNode parentNode = tNodes.pop(); if (parentNode.left == topStack) { return (parentNode.data); } topStack = parentNode; } return null; } /* * * inorderNextFindHelper( TreeObject t, Stack tNodes, TreeNode node ) { if( * node == null ) { return false; } tNodes.push( node); if( * node.data.compare( t) < 0) { return inorderNextFindHelper( t, tNodes, * node.left); } else if( node.data.compare( t) > 0) { return * inorderNextFindHelper( t, tNodes, node.right); } else if( t != node.data) * { return inorderNextFindHelper( t, tNodes, node.right); } return true; } | /**
* This method returns the TreeObject next in sequence. Returns null if at
* largest key in Tree. WARNING: This method is extremely slow. For large
* datasets, it is better to use inorderFirst() and
* removerFirstInOrderNode() together. (Of course, you destroy the Tree in
* the process.)
*/ | This method returns the TreeObject next in sequence. Returns null if at datasets, it is better to use inorderFirst() and removerFirstInOrderNode() together. (Of course, you destroy the Tree in the process.) | inorderNext | {
"repo_name": "chuckre/DigitalPopulations",
"path": "PopulationRealizer/Research GIS Kernel/src/mil/army/usace/ehlschlaeger/rgik/util/Tree.java",
"license": "apache-2.0",
"size": 9269
} | [
"java.util.Stack"
] | import java.util.Stack; | import java.util.*; | [
"java.util"
] | java.util; | 356,314 |
public FakeVentura.Builder setFirstName(String firstName) {
this.firstName = Preconditions.checkNotNull(firstName);
return (FakeVentura.Builder) this;
} | FakeVentura.Builder function(String firstName) { this.firstName = Preconditions.checkNotNull(firstName); return (FakeVentura.Builder) this; } | /**
* Sets the value to be returned by {@link FakeVentura#getFirstName()}.
*
* @return this {@code Builder} object
* @throws NullPointerException if {@code firstName} is null
*/ | Sets the value to be returned by <code>FakeVentura#getFirstName()</code> | setFirstName | {
"repo_name": "WillBro/assuredly-restful",
"path": "faker-example/target/generated-sources/annotations/uk/co/trycatchfinallysoftware/data/FakeVentura_Builder.java",
"license": "mit",
"size": 19175
} | [
"com.google.common.base.Preconditions"
] | import com.google.common.base.Preconditions; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 2,126,862 |
public Deferred<Boolean> processTSMetaThroughTrees(final TSMeta meta) {
if (config.enable_tree_processing()) {
return TreeBuilder.processAllTrees(this, meta);
}
return Deferred.fromResult(false);
} | Deferred<Boolean> function(final TSMeta meta) { if (config.enable_tree_processing()) { return TreeBuilder.processAllTrees(this, meta); } return Deferred.fromResult(false); } | /**
* Processes the TSMeta through all of the trees if configured to do so
* @param meta The meta data to process
* @since 2.0
*/ | Processes the TSMeta through all of the trees if configured to do so | processTSMetaThroughTrees | {
"repo_name": "pepperdata/opentsdb",
"path": "opentsdb-core/src/main/java/net/opentsdb/core/TSDB.java",
"license": "lgpl-2.1",
"size": 55721
} | [
"com.stumbleupon.async.Deferred",
"net.opentsdb.meta.TSMeta",
"net.opentsdb.tree.TreeBuilder"
] | import com.stumbleupon.async.Deferred; import net.opentsdb.meta.TSMeta; import net.opentsdb.tree.TreeBuilder; | import com.stumbleupon.async.*; import net.opentsdb.meta.*; import net.opentsdb.tree.*; | [
"com.stumbleupon.async",
"net.opentsdb.meta",
"net.opentsdb.tree"
] | com.stumbleupon.async; net.opentsdb.meta; net.opentsdb.tree; | 1,417,262 |
@Override
public V put(K key, V value) {
Assert.notNull(key, "key");
return putInternal(key, value, expirationPolicy.get(), expirationNanos.get());
}
| V function(K key, V value) { Assert.notNull(key, "key"); return putInternal(key, value, expirationPolicy.get(), expirationNanos.get()); } | /**
* Puts {@code value} in the map for {@code key}. Resets the entry's expiration unless an entry already exists for the
* same {@code key} and {@code value}.
*
* @param key to put value for
* @param value to put for key
* @return the old value
* @throws NullPointerException if {@code key} is null
*/ | Puts value in the map for key. Resets the entry's expiration unless an entry already exists for the same key and value | put | {
"repo_name": "jhalterman/expiringmap",
"path": "src/main/java/net/jodah/expiringmap/ExpiringMap.java",
"license": "apache-2.0",
"size": 45668
} | [
"net.jodah.expiringmap.internal.Assert"
] | import net.jodah.expiringmap.internal.Assert; | import net.jodah.expiringmap.internal.*; | [
"net.jodah.expiringmap"
] | net.jodah.expiringmap; | 1,985,660 |
public int deleteSelectedFileDialog(){
JFrame f = new JFrame("Delete File");
Object[] options = {"No","Yes"};
int i = JOptionPane.showOptionDialog(f, "Do you want delete the file?", "Delete File",
JOptionPane.OK_OPTION, JOptionPane.NO_OPTION, null, options, options[1]);
if(i == 1) return panelLateralProject.deleteSelectedInputNode();
else return -1;
} | int function(){ JFrame f = new JFrame(STR); Object[] options = {"No","Yes"}; int i = JOptionPane.showOptionDialog(f, STR, STR, JOptionPane.OK_OPTION, JOptionPane.NO_OPTION, null, options, options[1]); if(i == 1) return panelLateralProject.deleteSelectedInputNode(); else return -1; } | /**
* Delete from the project the current selected input file in the project tree
*
* @return i - the index of the deleted file
*/ | Delete from the project the current selected input file in the project tree | deleteSelectedFileDialog | {
"repo_name": "isti-fmt-nlp/tool-NLPtoFP",
"path": "CMT_FDE_Tool/src/view/ViewProject.java",
"license": "lgpl-3.0",
"size": 38136
} | [
"javax.swing.JFrame",
"javax.swing.JOptionPane"
] | import javax.swing.JFrame; import javax.swing.JOptionPane; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 2,655,700 |
public BankAccount getBank() {
return bank;
} | BankAccount function() { return bank; } | /**
* Get bank
*
* @return bank
**/ | Get bank | getBank | {
"repo_name": "Adyen/adyen-java-api-library",
"path": "src/main/java/com/adyen/model/checkout/StoredDetails.java",
"license": "mit",
"size": 3452
} | [
"com.adyen.model.BankAccount"
] | import com.adyen.model.BankAccount; | import com.adyen.model.*; | [
"com.adyen.model"
] | com.adyen.model; | 2,523,014 |
private byte[] getRandomKey() throws NoSuchAlgorithmException {
return this.getRandomKey(this.keySizeAES);
}
| byte[] function() throws NoSuchAlgorithmException { return this.getRandomKey(this.keySizeAES); } | /**
* Get a random byteArray of default size (this.keySizeAES).
*
* @return
* @throws NoSuchAlgorithmException
*/ | Get a random byteArray of default size (this.keySizeAES) | getRandomKey | {
"repo_name": "wessnerj/CastleCrypt",
"path": "java/de/meetr/hdr/castle_crypt/CastleCrypt.java",
"license": "lgpl-3.0",
"size": 13088
} | [
"java.security.NoSuchAlgorithmException"
] | import java.security.NoSuchAlgorithmException; | import java.security.*; | [
"java.security"
] | java.security; | 651,897 |
@GwtIncompatible("TODO")
public static long checkedPow(long b, int k) {
checkNonNegative("exponent", k);
if (b >= -2 & b <= 2) {
switch ((int) b) {
case 0:
return (k == 0) ? 1 : 0;
case 1:
return 1;
case (-1):
return ((k & 1) == 0) ? 1 : -1;
case 2:
checkNoOverflow(k < Long.SIZE - 1);
return 1L << k;
case (-2):
checkNoOverflow(k < Long.SIZE);
return ((k & 1) == 0) ? (1L << k) : (-1L << k);
default:
throw new AssertionError();
}
}
long accum = 1;
while (true) {
switch (k) {
case 0:
return accum;
case 1:
return checkedMultiply(accum, b);
default:
if ((k & 1) != 0) {
accum = checkedMultiply(accum, b);
}
k >>= 1;
if (k > 0) {
checkNoOverflow(b <= FLOOR_SQRT_MAX_LONG);
b *= b;
}
}
}
}
@VisibleForTesting static final long FLOOR_SQRT_MAX_LONG = 3037000499L;
/**
* Returns {@code n!}, that is, the product of the first {@code n} positive
* integers, {@code 1} if {@code n == 0}, or {@link Long#MAX_VALUE} if the
* result does not fit in a {@code long}.
*
* @throws IllegalArgumentException if {@code n < 0} | @GwtIncompatible("TODO") static long function(long b, int k) { checkNonNegative(STR, k); if (b >= -2 & b <= 2) { switch ((int) b) { case 0: return (k == 0) ? 1 : 0; case 1: return 1; case (-1): return ((k & 1) == 0) ? 1 : -1; case 2: checkNoOverflow(k < Long.SIZE - 1); return 1L << k; case (-2): checkNoOverflow(k < Long.SIZE); return ((k & 1) == 0) ? (1L << k) : (-1L << k); default: throw new AssertionError(); } } long accum = 1; while (true) { switch (k) { case 0: return accum; case 1: return checkedMultiply(accum, b); default: if ((k & 1) != 0) { accum = checkedMultiply(accum, b); } k >>= 1; if (k > 0) { checkNoOverflow(b <= FLOOR_SQRT_MAX_LONG); b *= b; } } } } @VisibleForTesting static final long FLOOR_SQRT_MAX_LONG = 3037000499L; /** * Returns {@code n!}, that is, the product of the first {@code n} positive * integers, {@code 1} if {@code n == 0}, or {@link Long#MAX_VALUE} if the * result does not fit in a {@code long}. * * @throws IllegalArgumentException if {@code n < 0} | /**
* Returns the {@code b} to the {@code k}th power, provided it does not overflow.
*
* @throws ArithmeticException if {@code b} to the {@code k}th power overflows in signed
* {@code long} arithmetic
*/ | Returns the b to the kth power, provided it does not overflow | checkedPow | {
"repo_name": "eoneil1942/voltdb-4.7fix",
"path": "third_party/java/src/com/google_voltpatches/common/math/LongMath.java",
"license": "agpl-3.0",
"size": 26596
} | [
"com.google_voltpatches.common.annotations.GwtIncompatible",
"com.google_voltpatches.common.annotations.VisibleForTesting",
"com.google_voltpatches.common.math.MathPreconditions"
] | import com.google_voltpatches.common.annotations.GwtIncompatible; import com.google_voltpatches.common.annotations.VisibleForTesting; import com.google_voltpatches.common.math.MathPreconditions; | import com.google_voltpatches.common.annotations.*; import com.google_voltpatches.common.math.*; | [
"com.google_voltpatches.common"
] | com.google_voltpatches.common; | 2,529,566 |
public String logout(Context context)
throws MalformedURLException, IOException {
Util.clearCookies(context);
Bundle b = new Bundle();
b.putString("method", "auth.expireSession");
String response = request(b);
setAccessToken(null);
setAccessExpires(0);
return response;
} | String function(Context context) throws MalformedURLException, IOException { Util.clearCookies(context); Bundle b = new Bundle(); b.putString(STR, STR); String response = request(b); setAccessToken(null); setAccessExpires(0); return response; } | /**
* Invalidate the current user session by removing the access token in
* memory, clearing the browser cookie, and calling auth.expireSession
* through the API.
*
* Note that this method blocks waiting for a network response, so do not
* call it in a UI thread.
*
* @param context
* The Android context in which the logout should be called: it
* should be the same context in which the login occurred in
* order to clear any stored cookies
* @throws IOException
* @throws MalformedURLException
* @return JSON string representation of the auth.expireSession response
* ("true" if successful)
*/ | Invalidate the current user session by removing the access token in memory, clearing the browser cookie, and calling auth.expireSession through the API. Note that this method blocks waiting for a network response, so do not call it in a UI thread | logout | {
"repo_name": "coffbr01/eyekabob",
"path": "android/app/src/main/java/com/eyekabob/util/facebook/Facebook.java",
"license": "apache-2.0",
"size": 38630
} | [
"android.content.Context",
"android.os.Bundle",
"java.io.IOException",
"java.net.MalformedURLException"
] | import android.content.Context; import android.os.Bundle; import java.io.IOException; import java.net.MalformedURLException; | import android.content.*; import android.os.*; import java.io.*; import java.net.*; | [
"android.content",
"android.os",
"java.io",
"java.net"
] | android.content; android.os; java.io; java.net; | 77,276 |
public void setLabelLinkStyle(PieLabelLinkStyle style) {
ParamChecks.nullNotPermitted(style, "style");
this.labelLinkStyle = style;
fireChangeEvent();
} | void function(PieLabelLinkStyle style) { ParamChecks.nullNotPermitted(style, "style"); this.labelLinkStyle = style; fireChangeEvent(); } | /**
* Sets the label link style and sends a {@link PlotChangeEvent} to all
* registered listeners.
*
* @param style the new style (<code>null</code> not permitted).
*
* @see #getLabelLinkStyle()
*
* @since 1.0.10
*/ | Sets the label link style and sends a <code>PlotChangeEvent</code> to all registered listeners | setLabelLinkStyle | {
"repo_name": "ceabie/jfreechart",
"path": "source/org/jfree/chart/plot/PiePlot.java",
"license": "lgpl-2.1",
"size": 130851
} | [
"org.jfree.chart.util.ParamChecks"
] | import org.jfree.chart.util.ParamChecks; | import org.jfree.chart.util.*; | [
"org.jfree.chart"
] | org.jfree.chart; | 2,667,726 |
default ConnectorPageSource pageSource(ConnectorTransactionHandle transactionHandle, ConnectorSession session, TupleDomain<Integer> constraint)
{
throw new UnsupportedOperationException();
} | default ConnectorPageSource pageSource(ConnectorTransactionHandle transactionHandle, ConnectorSession session, TupleDomain<Integer> constraint) { throw new UnsupportedOperationException(); } | /**
* Create a page source for the data in this table.
*
* @param session the session to use for creating the data
* @param constraint the constraints for the table columns (indexed from 0)
*/ | Create a page source for the data in this table | pageSource | {
"repo_name": "marsorp/blog",
"path": "presto166/presto-spi/src/main/java/com/facebook/presto/spi/SystemTable.java",
"license": "apache-2.0",
"size": 1866
} | [
"com.facebook.presto.spi.connector.ConnectorTransactionHandle",
"com.facebook.presto.spi.predicate.TupleDomain"
] | import com.facebook.presto.spi.connector.ConnectorTransactionHandle; import com.facebook.presto.spi.predicate.TupleDomain; | import com.facebook.presto.spi.connector.*; import com.facebook.presto.spi.predicate.*; | [
"com.facebook.presto"
] | com.facebook.presto; | 1,073,891 |
protected void setDetails(HttpServletRequest request, UsernamePasswordAuthenticationToken authRequest) {
authRequest.setDetails(authenticationDetailsSource.buildDetails(request));
} | void function(HttpServletRequest request, UsernamePasswordAuthenticationToken authRequest) { authRequest.setDetails(authenticationDetailsSource.buildDetails(request)); } | /**
* Provided so that subclasses may configure what is put into the
* authentication request's details property.
*
* @param request
* that an authentication request is being created for
* @param authRequest
* the authentication request object that should have its details
* set
*/ | Provided so that subclasses may configure what is put into the authentication request's details property | setDetails | {
"repo_name": "guoxchteam/test",
"path": "apollo-moa-webapp/src/main/java/com/ncs/security/web/StatelessLoginFilter.java",
"license": "apache-2.0",
"size": 10781
} | [
"javax.servlet.http.HttpServletRequest",
"org.springframework.security.authentication.UsernamePasswordAuthenticationToken"
] | import javax.servlet.http.HttpServletRequest; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; | import javax.servlet.http.*; import org.springframework.security.authentication.*; | [
"javax.servlet",
"org.springframework.security"
] | javax.servlet; org.springframework.security; | 2,449,044 |
public void buildComponent(StructureComponent structurecomponent, List list, Random random)
{
} | void function(StructureComponent structurecomponent, List list, Random random) { } | /**
* Initiates construction of the Structure Component picked, at the current Location of StructGen
*/ | Initiates construction of the Structure Component picked, at the current Location of StructGen | buildComponent | {
"repo_name": "sethten/MoDesserts",
"path": "mcp50/src/minecraft_server/net/minecraft/src/ComponentVillageField2.java",
"license": "gpl-3.0",
"size": 4078
} | [
"java.util.List",
"java.util.Random"
] | import java.util.List; import java.util.Random; | import java.util.*; | [
"java.util"
] | java.util; | 1,435,209 |
public UserPrincipal getLiveDataUser() {
return _liveDataUser;
} | UserPrincipal function() { return _liveDataUser; } | /**
* Gets the liveDataUser.
*
* @return the liveDataUser
*/ | Gets the liveDataUser | getLiveDataUser | {
"repo_name": "McLeodMoores/starling",
"path": "projects/integration/src/main/java/com/opengamma/integration/marketdata/PeriodicLiveDataTimeSeriesStorageServer.java",
"license": "apache-2.0",
"size": 12645
} | [
"com.opengamma.livedata.UserPrincipal"
] | import com.opengamma.livedata.UserPrincipal; | import com.opengamma.livedata.*; | [
"com.opengamma.livedata"
] | com.opengamma.livedata; | 2,811,282 |
private void sendNotification(String message) {
NotificationManager mNotificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
PendingIntent contentIntent =
PendingIntent.getActivity(this, 0, new Intent(this, MainActivity.class), 0);
// Notifications using both a large and a small icon (which yours should!) need the large
// icon as a bitmap. So we need to create that here from the resource ID, and pass the
// object along in our notification builder. Generally, you want to use the app icon as the
// small icon, so that users understand what app is triggering this notification.
Bitmap largeIcon = BitmapFactory.decodeResource(this.getResources(), R.drawable.art_storm);
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.art_clear)
.setLargeIcon(largeIcon)
.setContentTitle("Weather Alert!")
.setStyle(new NotificationCompat.BigTextStyle().bigText(message))
.setContentText(message)
.setPriority(NotificationCompat.PRIORITY_HIGH);
mBuilder.setContentIntent(contentIntent);
mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
} | void function(String message) { NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, MainActivity.class), 0); Bitmap largeIcon = BitmapFactory.decodeResource(this.getResources(), R.drawable.art_storm); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.art_clear) .setLargeIcon(largeIcon) .setContentTitle(STR) .setStyle(new NotificationCompat.BigTextStyle().bigText(message)) .setContentText(message) .setPriority(NotificationCompat.PRIORITY_HIGH); mBuilder.setContentIntent(contentIntent); mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build()); } | /**
* Put the message into a notification and post it.
* This is just one simple example of what you might choose to do with a GCM message.
*
* @param message The alert message to be posted.
*/ | Put the message into a notification and post it. This is just one simple example of what you might choose to do with a GCM message | sendNotification | {
"repo_name": "Shah-Sahab/Sunshine-Version-2",
"path": "app/src/main/java/com/example/android/sunshine/app/MyFirebaseMessagingService.java",
"license": "apache-2.0",
"size": 4340
} | [
"android.app.NotificationManager",
"android.app.PendingIntent",
"android.content.Context",
"android.content.Intent",
"android.graphics.Bitmap",
"android.graphics.BitmapFactory",
"android.support.v4.app.NotificationCompat"
] | import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.support.v4.app.NotificationCompat; | import android.app.*; import android.content.*; import android.graphics.*; import android.support.v4.app.*; | [
"android.app",
"android.content",
"android.graphics",
"android.support"
] | android.app; android.content; android.graphics; android.support; | 2,367,398 |
public static String format(final Kost2DO kost2)
{
return format(kost2, false);
} | static String function(final Kost2DO kost2) { return format(kost2, false); } | /**
* Calls format(kost2, false)
* @param kost2
* @see #format(Kost2DO, boolean)
*/ | Calls format(kost2, false) | format | {
"repo_name": "micromata/projectforge-webapp",
"path": "src/main/java/org/projectforge/fibu/KostFormatter.java",
"license": "gpl-3.0",
"size": 12521
} | [
"org.projectforge.fibu.kost.Kost2DO"
] | import org.projectforge.fibu.kost.Kost2DO; | import org.projectforge.fibu.kost.*; | [
"org.projectforge.fibu"
] | org.projectforge.fibu; | 1,896,632 |
private List<Map<String, Object>> createMultipleFireEventParam(MotionEvent motionEvent,String state) {
List<Map<String, Object>> list = new ArrayList<>(motionEvent.getHistorySize() + 1);
//list.addAll(getHistoricalEvents(motionEvent));
list.add(createFireEventParam(motionEvent, CUR_EVENT, state));
return list;
} | List<Map<String, Object>> function(MotionEvent motionEvent,String state) { List<Map<String, Object>> list = new ArrayList<>(motionEvent.getHistorySize() + 1); list.add(createFireEventParam(motionEvent, CUR_EVENT, state)); return list; } | /**
* Create a list of event for {@link WXSDKInstance#fireEvent(String, String, Map, Map)}.
* As there is a batch mechanism in MotionEvent, so this method returns a list.
* @param motionEvent motionEvent, which contains all pointers event in a period of time
* @return List of Map, which contains touch object.
*/ | Create a list of event for <code>WXSDKInstance#fireEvent(String, String, Map, Map)</code>. As there is a batch mechanism in MotionEvent, so this method returns a list | createMultipleFireEventParam | {
"repo_name": "alibaba/weex",
"path": "android/sdk/src/main/java/org/apache/weex/ui/view/gesture/WXGesture.java",
"license": "apache-2.0",
"size": 26035
} | [
"android.view.MotionEvent",
"java.util.ArrayList",
"java.util.List",
"java.util.Map"
] | import android.view.MotionEvent; import java.util.ArrayList; import java.util.List; import java.util.Map; | import android.view.*; import java.util.*; | [
"android.view",
"java.util"
] | android.view; java.util; | 1,319,058 |
private void prepareIsUseInvertedIndex(List<CarbonDimension> dims,
GraphConfigurationInfo graphConfig) {
List<Boolean> isUseInvertedIndexList = new ArrayList<Boolean>();
for (CarbonDimension dimension : dims) {
if (dimension.isUseInvertedIndex()) {
isUseInvertedIndexList.add(true);
} else {
isUseInvertedIndexList.add(false);
}
}
graphConfig.setIsUseInvertedIndex(
isUseInvertedIndexList.toArray(new Boolean[isUseInvertedIndexList.size()]));
} | void function(List<CarbonDimension> dims, GraphConfigurationInfo graphConfig) { List<Boolean> isUseInvertedIndexList = new ArrayList<Boolean>(); for (CarbonDimension dimension : dims) { if (dimension.isUseInvertedIndex()) { isUseInvertedIndexList.add(true); } else { isUseInvertedIndexList.add(false); } } graphConfig.setIsUseInvertedIndex( isUseInvertedIndexList.toArray(new Boolean[isUseInvertedIndexList.size()])); } | /**
* Preparing the boolean [] to map whether the dimension use inverted index or not.
*
* @param dims
* @param graphConfig
*/ | Preparing the boolean [] to map whether the dimension use inverted index or not | prepareIsUseInvertedIndex | {
"repo_name": "mayunSaicmotor/incubator-carbondata",
"path": "processing/src/main/java/org/apache/carbondata/processing/graphgenerator/GraphGenerator.java",
"license": "apache-2.0",
"size": 41460
} | [
"java.util.ArrayList",
"java.util.List",
"org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension",
"org.apache.carbondata.processing.graphgenerator.configuration.GraphConfigurationInfo"
] | import java.util.ArrayList; import java.util.List; import org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension; import org.apache.carbondata.processing.graphgenerator.configuration.GraphConfigurationInfo; | import java.util.*; import org.apache.carbondata.core.metadata.schema.table.column.*; import org.apache.carbondata.processing.graphgenerator.configuration.*; | [
"java.util",
"org.apache.carbondata"
] | java.util; org.apache.carbondata; | 2,776,355 |
public int writeGraphToFile(byte[] img, File to) {
try {
FileOutputStream fos = new FileOutputStream(to);
fos.write(img);
fos.close();
} catch (java.io.IOException ioe) {
return -1;
}
return 1;
}
| int function(byte[] img, File to) { try { FileOutputStream fos = new FileOutputStream(to); fos.write(img); fos.close(); } catch (java.io.IOException ioe) { return -1; } return 1; } | /**
* Writes the graph's image in a file.
*
* @param img
* A byte array containing the image of the graph.
* @param to
* A File object to where we want to write.
* @return Success: 1, Failure: -1
*/ | Writes the graph's image in a file | writeGraphToFile | {
"repo_name": "jsanchezp/e-edd",
"path": "es.ucm.fdi.edd.core/src/es/ucm/fdi/edd/core/graphviz/GraphViz.java",
"license": "gpl-3.0",
"size": 9111
} | [
"java.io.File",
"java.io.FileOutputStream"
] | import java.io.File; import java.io.FileOutputStream; | import java.io.*; | [
"java.io"
] | java.io; | 1,275,717 |
EList<GlobalStoryboard> getStoryboard();
| EList<GlobalStoryboard> getStoryboard(); | /**
* Returns the value of the '<em><b>Storyboard</b></em>' containment reference list.
* The list contents are of type {@link org.openhealthtools.mdht.emf.hl7.mif2.GlobalStoryboard}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* Descriptions of scenarios intended to be addressed by standards
* <!-- end-model-doc -->
* @return the value of the '<em>Storyboard</em>' containment reference list.
* @see org.openhealthtools.mdht.emf.hl7.mif2.Mif2Package#getPackageContent_Storyboard()
* @model containment="true" transient="true" volatile="true" derived="true"
* extendedMetaData="kind='element' name='storyboard' namespace='##targetNamespace' group='#group:0'"
* @generated
*/ | Returns the value of the 'Storyboard' containment reference list. The list contents are of type <code>org.openhealthtools.mdht.emf.hl7.mif2.GlobalStoryboard</code>. Descriptions of scenarios intended to be addressed by standards | getStoryboard | {
"repo_name": "drbgfc/mdht",
"path": "hl7/plugins/org.openhealthtools.mdht.emf.hl7.mif2/src/org/openhealthtools/mdht/emf/hl7/mif2/PackageContent.java",
"license": "epl-1.0",
"size": 21082
} | [
"org.eclipse.emf.common.util.EList"
] | import org.eclipse.emf.common.util.EList; | import org.eclipse.emf.common.util.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,186,579 |
void printMessageWithParam(CmsMessageContainer container, Object param); | void printMessageWithParam(CmsMessageContainer container, Object param); | /**
* Prints a localized message followed by a parametera and dots to the report.<p>
*
* @param container the Message to add
* @param param the Parameter to add
*/ | Prints a localized message followed by a parametera and dots to the report | printMessageWithParam | {
"repo_name": "alkacon/opencms-core",
"path": "src/org/opencms/report/I_CmsReport.java",
"license": "lgpl-2.1",
"size": 8058
} | [
"org.opencms.i18n.CmsMessageContainer"
] | import org.opencms.i18n.CmsMessageContainer; | import org.opencms.i18n.*; | [
"org.opencms.i18n"
] | org.opencms.i18n; | 2,561,716 |
public int generateClip(EditSettings editSettings) {
int err = 0;
try {
err = nativeGenerateClip(editSettings);
} catch (IllegalArgumentException ex) {
Log.e(TAG, "Illegal Argument exception in load settings");
return -1;
} catch (IllegalStateException ex) {
Log.e(TAG, "Illegal state exception in load settings");
return -1;
} catch (RuntimeException ex) {
Log.e(TAG, "Runtime exception in load settings");
return -1;
}
return err;
} | int function(EditSettings editSettings) { int err = 0; try { err = nativeGenerateClip(editSettings); } catch (IllegalArgumentException ex) { Log.e(TAG, STR); return -1; } catch (IllegalStateException ex) { Log.e(TAG, STR); return -1; } catch (RuntimeException ex) { Log.e(TAG, STR); return -1; } return err; } | /**
* Generates the clip for preview or export
*
* @param editSettings The EditSettings reference for generating
* a clip for preview or export
*
* @return error value
*/ | Generates the clip for preview or export | generateClip | {
"repo_name": "JSDemos/android-sdk-20",
"path": "src/android/media/videoeditor/MediaArtistNativeHelper.java",
"license": "apache-2.0",
"size": 145745
} | [
"android.util.Log"
] | import android.util.Log; | import android.util.*; | [
"android.util"
] | android.util; | 2,866,336 |
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
super.notifyChanged(notification);
} | void function(Notification notification) { updateChildren(notification); super.notifyChanged(notification); } | /**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This handles model notifications by calling <code>#updateChildren</code> to update any cached children and by creating a viewer notification, which it passes to <code>#fireNotifyChanged</code>. | notifyChanged | {
"repo_name": "kopl/SPLevo",
"path": "JaMoPPCartridge/org.splevo.jamopp.diffing.edit/src-gen/org/splevo/jamopp/diffing/jamoppdiff/provider/ConstructorChangeItemProvider.java",
"license": "epl-1.0",
"size": 5248
} | [
"org.eclipse.emf.common.notify.Notification"
] | import org.eclipse.emf.common.notify.Notification; | import org.eclipse.emf.common.notify.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,114,990 |
public static I18NBundle createBundle (FileHandle baseFileHandle, String encoding) {
return createBundleImpl(baseFileHandle, Locale.getDefault(), encoding);
} | static I18NBundle function (FileHandle baseFileHandle, String encoding) { return createBundleImpl(baseFileHandle, Locale.getDefault(), encoding); } | /** Creates a new bundle using the specified <code>baseFileHandle</code> and <code>encoding</code>; the default locale is used.
*
* @param baseFileHandle the file handle to the base of the bundle
* @param encoding the charter encoding
* @return a bundle for the given base file handle and locale
* @exception NullPointerException if <code>baseFileHandle</code> or <code>encoding</code> is <code>null</code>
* @exception MissingResourceException if no bundle for the specified base file handle can be found */ | Creates a new bundle using the specified <code>baseFileHandle</code> and <code>encoding</code>; the default locale is used | createBundle | {
"repo_name": "alex-dorokhov/libgdx",
"path": "gdx/src/com/badlogic/gdx/utils/I18NBundle.java",
"license": "apache-2.0",
"size": 20909
} | [
"com.badlogic.gdx.files.FileHandle",
"java.util.Locale"
] | import com.badlogic.gdx.files.FileHandle; import java.util.Locale; | import com.badlogic.gdx.files.*; import java.util.*; | [
"com.badlogic.gdx",
"java.util"
] | com.badlogic.gdx; java.util; | 1,678,814 |
public String[] getFieldValues() {
int count = getComponentCount() / 2;
String[] list = new String[count];
for (int i = 0; i < count; i++) {
Component comp = getComponent(i * 2 + 1);
list[i] = GuiUtil.getText(comp);
}
return list;
}
private static final String SUFFIX_COMP = "_comp";
private static final String SUFFIX_LABEL = "_label";
private static final long serialVersionUID = 3258135738867790641L;
private JPanel inner;
protected Hashtable<String, Component> comps = new Hashtable<String, Component>();
| String[] function() { int count = getComponentCount() / 2; String[] list = new String[count]; for (int i = 0; i < count; i++) { Component comp = getComponent(i * 2 + 1); list[i] = GuiUtil.getText(comp); } return list; } private static final String SUFFIX_COMP = "_comp"; private static final String SUFFIX_LABEL = STR; private static final long serialVersionUID = 3258135738867790641L; private JPanel inner; protected Hashtable<String, Component> comps = new Hashtable<String, Component>(); | /**
* Get at list of the values in the fields
*/ | Get at list of the values in the fields | getFieldValues | {
"repo_name": "truhanen/JSana",
"path": "JSana/src_others/org/crosswire/common/swing/FormPane.java",
"license": "gpl-2.0",
"size": 4499
} | [
"java.awt.Component",
"java.util.Hashtable",
"javax.swing.JPanel"
] | import java.awt.Component; import java.util.Hashtable; import javax.swing.JPanel; | import java.awt.*; import java.util.*; import javax.swing.*; | [
"java.awt",
"java.util",
"javax.swing"
] | java.awt; java.util; javax.swing; | 1,529,092 |
public PreparedStatement prepareStatement(String statement) throws SQLException{
Connection conn = null;
try{
conn = connection();
return conn.prepareStatement(statement);
} catch (SQLException e) {
// The statement failed to prepare... we have a useless statement and an open connection:
// Gotta free that connection.
dispose(conn);
// Pass the exception on
throw e;
}
} | PreparedStatement function(String statement) throws SQLException{ Connection conn = null; try{ conn = connection(); return conn.prepareStatement(statement); } catch (SQLException e) { dispose(conn); throw e; } } | /**
* Prepare a statement for future use.
* @param statement a statement to prepare for later use
* @return a prepared statement
* @throws SQLException if the database throws an exception when preparing a statement
*/ | Prepare a statement for future use | prepareStatement | {
"repo_name": "deleidos/digitaledge-platform",
"path": "commons-core/src/main/java/com/deleidos/rtws/commons/dao/jdbc/DataAccessUtil.java",
"license": "apache-2.0",
"size": 24723
} | [
"java.sql.Connection",
"java.sql.PreparedStatement",
"java.sql.SQLException"
] | import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,363,765 |
private Widget fieldLabel(final SingleFieldConstraint con,
boolean showBinding,
int padding) {
HorizontalPanel ab = new HorizontalPanel();
ab.setStyleName( "modeller-field-Label" );
if ( !con.isBound() ) {
if ( bindable && showBinding && !this.readOnly ) {
ClickHandler click = new ClickHandler() { | Widget function(final SingleFieldConstraint con, boolean showBinding, int padding) { HorizontalPanel ab = new HorizontalPanel(); ab.setStyleName( STR ); if ( !con.isBound() ) { if ( bindable && showBinding && !this.readOnly ) { ClickHandler click = new ClickHandler() { | /**
* get the field widget. This may be a simple label, or it may be bound (and
* show the var name) or a icon to create a binding. It will only show the
* binding option of showBinding is true.
*/ | get the field widget. This may be a simple label, or it may be bound (and show the var name) or a icon to create a binding. It will only show the binding option of showBinding is true | fieldLabel | {
"repo_name": "Rikkola/guvnor",
"path": "guvnor-webapp/src/main/java/org/drools/guvnor/client/modeldriven/ui/FactPatternWidget.java",
"license": "apache-2.0",
"size": 31652
} | [
"com.google.gwt.event.dom.client.ClickHandler",
"com.google.gwt.user.client.ui.HorizontalPanel",
"com.google.gwt.user.client.ui.Widget",
"org.drools.ide.common.client.modeldriven.brl.SingleFieldConstraint"
] | import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.user.client.ui.HorizontalPanel; import com.google.gwt.user.client.ui.Widget; import org.drools.ide.common.client.modeldriven.brl.SingleFieldConstraint; | import com.google.gwt.event.dom.client.*; import com.google.gwt.user.client.ui.*; import org.drools.ide.common.client.modeldriven.brl.*; | [
"com.google.gwt",
"org.drools.ide"
] | com.google.gwt; org.drools.ide; | 1,765,301 |
@Test
public void triangulateSuccessZoom5() {
Vector2[] vertices = this.load(EarClippingTest.class.getResourceAsStream("/org/dyn4j/data/zoom5.dat"));
// decompose the poly
List<? extends Convex> result = this.algo.triangulate(vertices);
// the result should have n - 2 triangles shapes
TestCase.assertEquals(vertices.length - 2, result.size());
}
| void function() { Vector2[] vertices = this.load(EarClippingTest.class.getResourceAsStream(STR)); List<? extends Convex> result = this.algo.triangulate(vertices); TestCase.assertEquals(vertices.length - 2, result.size()); } | /**
* Tests the triangulation implementation against the zoom5 data file.
* @since 3.1.9
*/ | Tests the triangulation implementation against the zoom5 data file | triangulateSuccessZoom5 | {
"repo_name": "satishbabusee/dyn4j",
"path": "junit/org/dyn4j/geometry/EarClippingTest.java",
"license": "bsd-3-clause",
"size": 21967
} | [
"java.util.List",
"junit.framework.TestCase",
"org.dyn4j.geometry.Convex",
"org.dyn4j.geometry.Vector2"
] | import java.util.List; import junit.framework.TestCase; import org.dyn4j.geometry.Convex; import org.dyn4j.geometry.Vector2; | import java.util.*; import junit.framework.*; import org.dyn4j.geometry.*; | [
"java.util",
"junit.framework",
"org.dyn4j.geometry"
] | java.util; junit.framework; org.dyn4j.geometry; | 2,606,502 |
@ReportableProperty(order = 31, value = "JRE vendor.")
public String getJREVendor() {
return this.jreVendor;
}
| @ReportableProperty(order = 31, value = STR) String function() { return this.jreVendor; } | /**
* Get JRE vendor.
*
* @return JRE vendor
*/ | Get JRE vendor | getJREVendor | {
"repo_name": "opf-labs/jhove2",
"path": "src/main/java/org/jhove2/core/Installation.java",
"license": "bsd-2-clause",
"size": 7590
} | [
"org.jhove2.annotation.ReportableProperty"
] | import org.jhove2.annotation.ReportableProperty; | import org.jhove2.annotation.*; | [
"org.jhove2.annotation"
] | org.jhove2.annotation; | 2,260,168 |
//-----------------------------------------------------------------------
public Builder tradeInfo(TradeInfo tradeInfo) {
this.tradeInfo = tradeInfo;
return this;
} | Builder function(TradeInfo tradeInfo) { this.tradeInfo = tradeInfo; return this; } | /**
* Sets the additional trade information, defaulted to an empty instance.
* <p>
* This allows additional information to be attached to the trade.
* @param tradeInfo the new value
* @return this, for chaining, not null
*/ | Sets the additional trade information, defaulted to an empty instance. This allows additional information to be attached to the trade | tradeInfo | {
"repo_name": "nssales/Strata",
"path": "modules/finance/src/main/java/com/opengamma/strata/finance/rate/future/IborFutureTrade.java",
"license": "apache-2.0",
"size": 17767
} | [
"com.opengamma.strata.finance.TradeInfo"
] | import com.opengamma.strata.finance.TradeInfo; | import com.opengamma.strata.finance.*; | [
"com.opengamma.strata"
] | com.opengamma.strata; | 2,568,870 |
List<Resource> getAllowedResources(PerunSession sess, Facility facility, User user); | List<Resource> getAllowedResources(PerunSession sess, Facility facility, User user); | /**
* Return all resources through which user is allowed on facility.
*
* @param sess
* @param facility
* @param user
*
* @return List of allowed resources for the user on facility
* @throws InternalErrorException
*/ | Return all resources through which user is allowed on facility | getAllowedResources | {
"repo_name": "mvocu/perun",
"path": "perun-core/src/main/java/cz/metacentrum/perun/core/implApi/ResourcesManagerImplApi.java",
"license": "bsd-2-clause",
"size": 29312
} | [
"cz.metacentrum.perun.core.api.Facility",
"cz.metacentrum.perun.core.api.PerunSession",
"cz.metacentrum.perun.core.api.Resource",
"cz.metacentrum.perun.core.api.User",
"java.util.List"
] | import cz.metacentrum.perun.core.api.Facility; import cz.metacentrum.perun.core.api.PerunSession; import cz.metacentrum.perun.core.api.Resource; import cz.metacentrum.perun.core.api.User; import java.util.List; | import cz.metacentrum.perun.core.api.*; import java.util.*; | [
"cz.metacentrum.perun",
"java.util"
] | cz.metacentrum.perun; java.util; | 1,475,988 |
public Component getComponent() {
return layout;
} | Component function() { return layout; } | /**
* Get the root component
* @return Component
*/ | Get the root component | getComponent | {
"repo_name": "neuroidss/adempiere",
"path": "zkwebui/WEB-INF/src/org/adempiere/webui/desktop/NavBarDesktop.java",
"license": "gpl-2.0",
"size": 17291
} | [
"org.zkoss.zk.ui.Component"
] | import org.zkoss.zk.ui.Component; | import org.zkoss.zk.ui.*; | [
"org.zkoss.zk"
] | org.zkoss.zk; | 524,322 |
static void validateErrorDocument(TextAnalyticsError expectedError, TextAnalyticsError actualError) {
assertEquals(expectedError.getCode(), actualError.getCode());
assertEquals(expectedError.getMessage(), actualError.getMessage());
assertEquals(expectedError.getTarget(), actualError.getTarget());
} | static void validateErrorDocument(TextAnalyticsError expectedError, TextAnalyticsError actualError) { assertEquals(expectedError.getCode(), actualError.getCode()); assertEquals(expectedError.getMessage(), actualError.getMessage()); assertEquals(expectedError.getTarget(), actualError.getTarget()); } | /**
* Helper method to verify the error document.
*
* @param expectedError the Error returned from the service.
* @param actualError the Error returned from the API.
*/ | Helper method to verify the error document | validateErrorDocument | {
"repo_name": "navalev/azure-sdk-for-java",
"path": "sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTestBase.java",
"license": "mit",
"size": 49541
} | [
"com.azure.ai.textanalytics.models.TextAnalyticsError",
"org.junit.jupiter.api.Assertions"
] | import com.azure.ai.textanalytics.models.TextAnalyticsError; import org.junit.jupiter.api.Assertions; | import com.azure.ai.textanalytics.models.*; import org.junit.jupiter.api.*; | [
"com.azure.ai",
"org.junit.jupiter"
] | com.azure.ai; org.junit.jupiter; | 1,242,391 |
void customizeNode (@Nonnull IHCNode aNode,
@Nonnull EHTMLVersion eHTMLVersion,
@Nonnull IHCHasChildrenMutable <?, ? super IHCNode> aTargetNode); | void customizeNode (@Nonnull IHCNode aNode, @Nonnull EHTMLVersion eHTMLVersion, @Nonnull IHCHasChildrenMutable <?, ? super IHCNode> aTargetNode); | /**
* Customize HC node with some predefined classes etc.
*
* @param aNode
* The element to be customized. Never <code>null</code>.
* @param eHTMLVersion
* The HTML version to be used. Never <code>null</code>.
* @param aTargetNode
* The node where additional elements should be appended to. May not be
* <code>null</code>.
*/ | Customize HC node with some predefined classes etc | customizeNode | {
"repo_name": "phax/ph-oton",
"path": "ph-oton-html/src/main/java/com/helger/html/hc/IHCCustomizer.java",
"license": "apache-2.0",
"size": 1562
} | [
"com.helger.html.EHTMLVersion",
"javax.annotation.Nonnull"
] | import com.helger.html.EHTMLVersion; import javax.annotation.Nonnull; | import com.helger.html.*; import javax.annotation.*; | [
"com.helger.html",
"javax.annotation"
] | com.helger.html; javax.annotation; | 731,537 |
@Test
public void testAppend() throws IOException {
initHRegion(tableName, name.getMethodName(), fam1);
String v1 = "Ultimate Answer to the Ultimate Question of Life,"+
" The Universe, and Everything";
String v2 = " is... 42.";
Append a = new Append(row);
a.setReturnResults(false);
a.add(fam1, qual1, Bytes.toBytes(v1));
a.add(fam1, qual2, Bytes.toBytes(v2));
assertNull(region.append(a));
a = new Append(row);
a.add(fam1, qual1, Bytes.toBytes(v2));
a.add(fam1, qual2, Bytes.toBytes(v1));
Result result = region.append(a);
assertEquals(0, Bytes.compareTo(Bytes.toBytes(v1+v2), result.getValue(fam1, qual1)));
assertEquals(0, Bytes.compareTo(Bytes.toBytes(v2+v1), result.getValue(fam1, qual2)));
} | void function() throws IOException { initHRegion(tableName, name.getMethodName(), fam1); String v1 = STR+ STR; String v2 = STR; Append a = new Append(row); a.setReturnResults(false); a.add(fam1, qual1, Bytes.toBytes(v1)); a.add(fam1, qual2, Bytes.toBytes(v2)); assertNull(region.append(a)); a = new Append(row); a.add(fam1, qual1, Bytes.toBytes(v2)); a.add(fam1, qual2, Bytes.toBytes(v1)); Result result = region.append(a); assertEquals(0, Bytes.compareTo(Bytes.toBytes(v1+v2), result.getValue(fam1, qual1))); assertEquals(0, Bytes.compareTo(Bytes.toBytes(v2+v1), result.getValue(fam1, qual2))); } | /**
* Test basic append operation.
* More tests in
* @see org.apache.hadoop.hbase.client.TestFromClientSide#testAppend()
*/ | Test basic append operation. More tests in | testAppend | {
"repo_name": "justintung/hbase",
"path": "hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestAtomicOperation.java",
"license": "apache-2.0",
"size": 23024
} | [
"java.io.IOException",
"org.apache.hadoop.hbase.client.Append",
"org.apache.hadoop.hbase.client.Result",
"org.apache.hadoop.hbase.util.Bytes",
"org.junit.Assert"
] | import java.io.IOException; import org.apache.hadoop.hbase.client.Append; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.util.Bytes; import org.junit.Assert; | import java.io.*; import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.util.*; import org.junit.*; | [
"java.io",
"org.apache.hadoop",
"org.junit"
] | java.io; org.apache.hadoop; org.junit; | 2,890,390 |
protected byte[] sign(byte[] data, byte[] key, SigningAlgorithm algorithm)
throws ClientException {
try {
Mac mac = Mac.getInstance(algorithm.toString());
mac.init(new SecretKeySpec(key, algorithm.toString()));
return mac.doFinal(data);
} catch (Exception e) {
throw new ClientException("Unable to calculate a request signature: " + e.getMessage(),
e);
}
} | byte[] function(byte[] data, byte[] key, SigningAlgorithm algorithm) throws ClientException { try { Mac mac = Mac.getInstance(algorithm.toString()); mac.init(new SecretKeySpec(key, algorithm.toString())); return mac.doFinal(data); } catch (Exception e) { throw new ClientException(STR + e.getMessage(), e); } } | /**
* Computes an RFC 2104-compliant HMAC signature for an array of bytes and returns the result as
* a Base64 encoded string.
*
* @param data Data needed to sign.
* @param key The key to sign data.
* @param algorithm The algorithm to sign data.
* @return byte[] of Signed string.
* @throws ClientException ClientException.
*/ | Computes an RFC 2104-compliant HMAC signature for an array of bytes and returns the result as a Base64 encoded string | sign | {
"repo_name": "NetEase-Cloudsearch/streamproxy-sdk-java",
"path": "streamproxy-sdk-java/src/main/java/com/netease/cloud/auth/AbstractStringSigner.java",
"license": "apache-2.0",
"size": 4606
} | [
"com.netease.cloud.exception.ClientException",
"javax.crypto.Mac",
"javax.crypto.spec.SecretKeySpec"
] | import com.netease.cloud.exception.ClientException; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; | import com.netease.cloud.exception.*; import javax.crypto.*; import javax.crypto.spec.*; | [
"com.netease.cloud",
"javax.crypto"
] | com.netease.cloud; javax.crypto; | 1,372,376 |
public void addMetaText(double beat, String text) {
// ignored, since we're setting the beat afterward
logger.debug("adding meta text '{}'", text);
long tick = 0;
// TODO add these factories to MIDIEvent
MidiEvent event = MIDIUtils.createMetaTextMessage(
tick,
MIDIUtils.META_TEXT,
text);
MIDIEvent e = new MIDIEvent(event, this);
// we're used to thinking in beats starting at 1 not zero.
e.setStartBeat(beat - 1d);
this.events.add(e);
this.changes.firePropertyChange(MODIFIED, null, this);
} | void function(double beat, String text) { logger.debug(STR, text); long tick = 0; MidiEvent event = MIDIUtils.createMetaTextMessage( tick, MIDIUtils.META_TEXT, text); MIDIEvent e = new MIDIEvent(event, this); e.setStartBeat(beat - 1d); this.events.add(e); this.changes.firePropertyChange(MODIFIED, null, this); } | /**
* Adds a meta text message at the specified beat.
*
* @param beat
* the beat where the text is inserted
* @param text
* the text to insert
*/ | Adds a meta text message at the specified beat | addMetaText | {
"repo_name": "genedelisa/rockymusic",
"path": "rockymusic-core/src/main/java/com/rockhoppertech/music/midi/js/MIDITrack.java",
"license": "apache-2.0",
"size": 74678
} | [
"javax.sound.midi.MidiEvent"
] | import javax.sound.midi.MidiEvent; | import javax.sound.midi.*; | [
"javax.sound"
] | javax.sound; | 1,904,451 |
public Set<Integer> getTargetMismatches() {
return targetMismatches;
} | Set<Integer> function() { return targetMismatches; } | /**
* Returns a set of targets that is known to be inconsistent. Listens for these targets should be
* re-established without resume tokens.
*/ | Returns a set of targets that is known to be inconsistent. Listens for these targets should be re-established without resume tokens | getTargetMismatches | {
"repo_name": "firebase/firebase-android-sdk",
"path": "firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteEvent.java",
"license": "apache-2.0",
"size": 3195
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 390,977 |
@Test(groups = "wso2.das4mb.publish", description = "Test database read time data publishing")
public void testDatabaseReadTimeData() throws XPathExpressionException, MalformedObjectNameException, IOException,
AnalyticsIndexException, InterruptedException {
int metricsRecordsCount = this.analyticsDataAPI.searchCount(-1234,
TestConstants.ORG_WSO2_METRICS_STREAM_TIMER, "*:*");
int mbRecordsCount = this.analyticsDataAPI.searchCount(-1234,
TestConstants.ORG_WSO2_MB_ANALYTICS_STREAM_TIMER_STATS_MINUTE, "_name :\"org.wso2.mb.database.read\"");
Assert.assertTrue(metricsRecordsCount > 0, "Expected metrics record count > 0 but found " + metricsRecordsCount);
Assert.assertTrue(mbRecordsCount > 0, "Expected, db read record count is 1 but found " + mbRecordsCount);
} | @Test(groups = STR, description = STR) void function() throws XPathExpressionException, MalformedObjectNameException, IOException, AnalyticsIndexException, InterruptedException { int metricsRecordsCount = this.analyticsDataAPI.searchCount(-1234, TestConstants.ORG_WSO2_METRICS_STREAM_TIMER, "*:*"); int mbRecordsCount = this.analyticsDataAPI.searchCount(-1234, TestConstants.ORG_WSO2_MB_ANALYTICS_STREAM_TIMER_STATS_MINUTE, STRorg.wso2.mb.database.read\STRExpected metrics record count > 0 but found STRExpected, db read record count is 1 but found " + mbRecordsCount); } | /**
* Publish database read time data to ORG_WSO2_METRICS_STREAM_TIMER stream
* FilterStreamExecutionPlan should insert record to ORG_WSO2_MB_ANALYTICS_STREAM_TIMER_STATS_MINUTE table if published data match
* with filtering criteria
* Wait 10 seconds until processing execution complete
* Assert both table and verify records added
*
* @throws XPathExpressionException
* @throws MalformedObjectNameException
* @throws IOException
* @throws AnalyticsIndexException
* @throws InterruptedException
*/ | Publish database read time data to ORG_WSO2_METRICS_STREAM_TIMER stream FilterStreamExecutionPlan should insert record to ORG_WSO2_MB_ANALYTICS_STREAM_TIMER_STATS_MINUTE table if published data match with filtering criteria Wait 10 seconds until processing execution complete Assert both table and verify records added | testDatabaseReadTimeData | {
"repo_name": "indikasampath2000/analytics-mb",
"path": "product/integration/tests-integration/src/test/java/org/wso2/das/integration/tests/mb/MBAnalyticsDataPublishingAndSiddhiExecutionTestCase.java",
"license": "apache-2.0",
"size": 25588
} | [
"java.io.IOException",
"javax.management.MalformedObjectNameException",
"javax.xml.xpath.XPathExpressionException",
"org.testng.annotations.Test",
"org.wso2.carbon.analytics.dataservice.commons.exception.AnalyticsIndexException",
"org.wso2.das.integration.common.utils.TestConstants"
] | import java.io.IOException; import javax.management.MalformedObjectNameException; import javax.xml.xpath.XPathExpressionException; import org.testng.annotations.Test; import org.wso2.carbon.analytics.dataservice.commons.exception.AnalyticsIndexException; import org.wso2.das.integration.common.utils.TestConstants; | import java.io.*; import javax.management.*; import javax.xml.xpath.*; import org.testng.annotations.*; import org.wso2.carbon.analytics.dataservice.commons.exception.*; import org.wso2.das.integration.common.utils.*; | [
"java.io",
"javax.management",
"javax.xml",
"org.testng.annotations",
"org.wso2.carbon",
"org.wso2.das"
] | java.io; javax.management; javax.xml; org.testng.annotations; org.wso2.carbon; org.wso2.das; | 1,000,506 |
@VisibleForTesting
public void extractUrlsInSection(String html) {
StringUtil.fromHtml(html, imageGetter, null);
} | void function(String html) { StringUtil.fromHtml(html, imageGetter, null); } | /**
* Extracts image source URLs from input HTML in one section.
*
* @param html the input HTML string
*/ | Extracts image source URLs from input HTML in one section | extractUrlsInSection | {
"repo_name": "anirudh24seven/apps-android-wikipedia",
"path": "app/src/main/java/org/wikipedia/savedpages/ImageUrlMap.java",
"license": "apache-2.0",
"size": 4785
} | [
"org.wikipedia.util.StringUtil"
] | import org.wikipedia.util.StringUtil; | import org.wikipedia.util.*; | [
"org.wikipedia.util"
] | org.wikipedia.util; | 622,530 |
private List<LayoutFile> getUnallocFiles(Content c) {
UnallocVisitor uv = new UnallocVisitor();
try {
for (Content contentChild : c.getChildren()) {
if (contentChild instanceof AbstractContent) {
return contentChild.accept(uv); //call on first non-artifact child added to database
}
}
} catch (TskCoreException tce) {
logger.log(Level.WARNING, "Couldn't get a list of Unallocated Files, failed at sending out the visitor ", tce); //NON-NLS
}
return Collections.emptyList();
}
private class ExtractUnallocWorker extends SwingWorker<Integer, Integer> {
private ProgressHandle progress;
private boolean canceled = false;
private List<UnallocStruct> lus = new ArrayList<UnallocStruct>();
private File currentlyProcessing;
private int totalSizeinMegs;
long totalBytes = 0;
ExtractUnallocWorker(UnallocStruct us) {
//Getting the total megs this worker is going to be doing
if (!lockedVols.contains(us.getFileName())) {
this.lus.add(us);
totalBytes = us.getSizeInBytes();
totalSizeinMegs = toMb(totalBytes);
lockedVols.add(us.getFileName());
}
}
ExtractUnallocWorker(List<UnallocStruct> lst) {
//Getting the total megs this worker is going to be doing
for (UnallocStruct lu : lst) {
if (!lockedVols.contains(lu.getFileName())) {
totalBytes += lu.getSizeInBytes();
lockedVols.add(lu.getFileName());
this.lus.add(lu);
}
}
totalSizeinMegs = toMb(totalBytes);
lockedImages.add(currentImage);
} | List<LayoutFile> function(Content c) { UnallocVisitor uv = new UnallocVisitor(); try { for (Content contentChild : c.getChildren()) { if (contentChild instanceof AbstractContent) { return contentChild.accept(uv); } } } catch (TskCoreException tce) { logger.log(Level.WARNING, STR, tce); } return Collections.emptyList(); } private class ExtractUnallocWorker extends SwingWorker<Integer, Integer> { private ProgressHandle progress; private boolean canceled = false; private List<UnallocStruct> lus = new ArrayList<UnallocStruct>(); private File currentlyProcessing; private int totalSizeinMegs; long totalBytes = 0; ExtractUnallocWorker(UnallocStruct us) { if (!lockedVols.contains(us.getFileName())) { this.lus.add(us); totalBytes = us.getSizeInBytes(); totalSizeinMegs = toMb(totalBytes); lockedVols.add(us.getFileName()); } } ExtractUnallocWorker(List<UnallocStruct> lst) { for (UnallocStruct lu : lst) { if (!lockedVols.contains(lu.getFileName())) { totalBytes += lu.getSizeInBytes(); lockedVols.add(lu.getFileName()); this.lus.add(lu); } } totalSizeinMegs = toMb(totalBytes); lockedImages.add(currentImage); } | /**
* Gets all the unallocated files in a given Content.
*
* @param c Content to get Unallocated Files from
*
* @return A list<LayoutFile> if it didn't crash List may be empty.
*/ | Gets all the unallocated files in a given Content | getUnallocFiles | {
"repo_name": "dgrove727/autopsy",
"path": "Core/src/org/sleuthkit/autopsy/directorytree/ExtractUnallocAction.java",
"license": "apache-2.0",
"size": 22811
} | [
"java.io.File",
"java.util.ArrayList",
"java.util.Collections",
"java.util.List",
"java.util.logging.Level",
"javax.swing.SwingWorker",
"org.netbeans.api.progress.ProgressHandle",
"org.sleuthkit.datamodel.AbstractContent",
"org.sleuthkit.datamodel.Content",
"org.sleuthkit.datamodel.LayoutFile",
"org.sleuthkit.datamodel.TskCoreException"
] | import java.io.File; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.logging.Level; import javax.swing.SwingWorker; import org.netbeans.api.progress.ProgressHandle; import org.sleuthkit.datamodel.AbstractContent; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.LayoutFile; import org.sleuthkit.datamodel.TskCoreException; | import java.io.*; import java.util.*; import java.util.logging.*; import javax.swing.*; import org.netbeans.api.progress.*; import org.sleuthkit.datamodel.*; | [
"java.io",
"java.util",
"javax.swing",
"org.netbeans.api",
"org.sleuthkit.datamodel"
] | java.io; java.util; javax.swing; org.netbeans.api; org.sleuthkit.datamodel; | 2,820,697 |
//#ifdef JAVA4
public synchronized Date getDate(
String parameterName) throws SQLException {
return getDate(findParameterIndex(parameterName));
}
//#endif JAVA4 | synchronized Date function( String parameterName) throws SQLException { return getDate(findParameterIndex(parameterName)); } | /**
* <!-- start generic documentation -->
*
* Retrieves the value of a JDBC <code>DATE</code> parameter as a
* <code>java.sql.Date</code> object.
*
* <!-- end generic documentation -->
*
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* HSQLDB supports this feature. <p>
*
* </div>
* <!-- end release-specific documentation -->
*
* @param parameterName the name of the parameter
* @return the parameter value. If the value is SQL <code>NULL</code>, the result
* is <code>null</code>.
* @exception SQLException if a database access error occurs or
* this method is called on a closed <code>CallableStatement</code>
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support
* this method
* @see #setDate
* @since JDK 1.4, HSQLDB 1.7.0
*/ | Retrieves the value of a JDBC <code>DATE</code> parameter as a <code>java.sql.Date</code> object. HSQLDB-Specific Information: HSQLDB supports this feature. | getDate | {
"repo_name": "malin1993ml/h-store",
"path": "src/hsqldb19b3/org/hsqldb/jdbc/JDBCCallableStatement.java",
"license": "gpl-3.0",
"size": 186064
} | [
"java.sql.Date",
"java.sql.SQLException"
] | import java.sql.Date; import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,343,353 |
public void testBYIons() {
MascotDatfile lMascotDatfile = new MascotDatfile(TestCaseLM.getFullFilePath("F010983.dat"));
//QQMENYPK
PeptideHit lPeptideHit = lMascotDatfile.getQueryToPeptideMap().getPeptideHitOfOneQuery(263, 1);
PeptideHitAnnotation lPeptideHitAnnotation = lPeptideHit.getPeptideHitAnnotation(lMascotDatfile.getMasses(), lMascotDatfile.getParametersSection());
FragmentIon[] lFragmentIonsArray = null;
//Get Bions.
lFragmentIonsArray = lPeptideHitAnnotation.getBions();
Assert.assertEquals(112.03987000000001, lFragmentIonsArray[0].getMZ(), 0.0);
Assert.assertEquals("b", lFragmentIonsArray[0].getType());
Assert.assertEquals(2, lFragmentIonsArray[1].getNumber());
Assert.assertEquals(FragmentIon.B_ION, lFragmentIonsArray[1].getID());
Assert.assertEquals(890.3354540000001, lFragmentIonsArray[6].getMZ(), 0.0);
try {
lFragmentIonsArray[7].getMZ();
fail("The array with double charged ions is bigger then it should be.");
} catch (ArrayIndexOutOfBoundsException aiob) {
//Do nothing because an error should be thrown!
}
//Get Yions.
lFragmentIonsArray = lPeptideHitAnnotation.getYions();
Assert.assertEquals(147.11334499999998, lFragmentIonsArray[0].getMZ(), 0.0);
Assert.assertEquals("y", lFragmentIonsArray[0].getType());
Assert.assertEquals(2, lFragmentIonsArray[1].getNumber());
Assert.assertEquals(FragmentIon.Y_ION, lFragmentIonsArray[1].getID(), 0.0);
Assert.assertEquals(925.4089290000001, lFragmentIonsArray[6].getMZ(), 0.0);
try {
lFragmentIonsArray[7].getMZ();
fail("The array with double charged ions is bigger then it should be.");
} catch (ArrayIndexOutOfBoundsException aiob) {
//Do nothing because an error should be thrown!
}
} | void function() { MascotDatfile lMascotDatfile = new MascotDatfile(TestCaseLM.getFullFilePath(STR)); PeptideHit lPeptideHit = lMascotDatfile.getQueryToPeptideMap().getPeptideHitOfOneQuery(263, 1); PeptideHitAnnotation lPeptideHitAnnotation = lPeptideHit.getPeptideHitAnnotation(lMascotDatfile.getMasses(), lMascotDatfile.getParametersSection()); FragmentIon[] lFragmentIonsArray = null; lFragmentIonsArray = lPeptideHitAnnotation.getBions(); Assert.assertEquals(112.03987000000001, lFragmentIonsArray[0].getMZ(), 0.0); Assert.assertEquals("b", lFragmentIonsArray[0].getType()); Assert.assertEquals(2, lFragmentIonsArray[1].getNumber()); Assert.assertEquals(FragmentIon.B_ION, lFragmentIonsArray[1].getID()); Assert.assertEquals(890.3354540000001, lFragmentIonsArray[6].getMZ(), 0.0); try { lFragmentIonsArray[7].getMZ(); fail(STR); } catch (ArrayIndexOutOfBoundsException aiob) { } lFragmentIonsArray = lPeptideHitAnnotation.getYions(); Assert.assertEquals(147.11334499999998, lFragmentIonsArray[0].getMZ(), 0.0); Assert.assertEquals("y", lFragmentIonsArray[0].getType()); Assert.assertEquals(2, lFragmentIonsArray[1].getNumber()); Assert.assertEquals(FragmentIon.Y_ION, lFragmentIonsArray[1].getID(), 0.0); Assert.assertEquals(925.4089290000001, lFragmentIonsArray[6].getMZ(), 0.0); try { lFragmentIonsArray[7].getMZ(); fail(STR); } catch (ArrayIndexOutOfBoundsException aiob) { } } | /**
* This method will test the B and Y ion genereation in the constructor.
*/ | This method will test the B and Y ion genereation in the constructor | testBYIons | {
"repo_name": "compomics/mascotdatfile",
"path": "src/test/java/com/compomics/mascotdatfile/util/mascot/TestPeptideHitAnnotation.java",
"license": "apache-2.0",
"size": 39808
} | [
"com.compomics.mascotdatfile.util.interfaces.FragmentIon",
"com.compomics.util.junit.TestCaseLM",
"junit.framework.Assert"
] | import com.compomics.mascotdatfile.util.interfaces.FragmentIon; import com.compomics.util.junit.TestCaseLM; import junit.framework.Assert; | import com.compomics.mascotdatfile.util.interfaces.*; import com.compomics.util.junit.*; import junit.framework.*; | [
"com.compomics.mascotdatfile",
"com.compomics.util",
"junit.framework"
] | com.compomics.mascotdatfile; com.compomics.util; junit.framework; | 1,339,906 |
public void setBaseNegativeItemLabelPosition(ItemLabelPosition position) {
setBaseNegativeItemLabelPosition(position, true);
}
| void function(ItemLabelPosition position) { setBaseNegativeItemLabelPosition(position, true); } | /**
* Sets the base item label position for negative values and sends a
* {@link RendererChangeEvent} to all registered listeners.
*
* @param position the position (<code>null</code> not permitted).
*
* @see #getBaseNegativeItemLabelPosition()
*/ | Sets the base item label position for negative values and sends a <code>RendererChangeEvent</code> to all registered listeners | setBaseNegativeItemLabelPosition | {
"repo_name": "sternze/CurrentTopics_JFreeChart",
"path": "source/org/jfree/chart/renderer/AbstractRenderer.java",
"license": "lgpl-2.1",
"size": 142562
} | [
"org.jfree.chart.labels.ItemLabelPosition"
] | import org.jfree.chart.labels.ItemLabelPosition; | import org.jfree.chart.labels.*; | [
"org.jfree.chart"
] | org.jfree.chart; | 1,194,980 |
@XmlElement(name = "dataCenters")
public Integer getDataCenters() {
return dataCenters;
} | @XmlElement(name = STR) Integer function() { return dataCenters; } | /**
* Number of data centers for storage pool
*
* Valid value: Intergers
*/ | Number of data centers for storage pool Valid value: Intergers | getDataCenters | {
"repo_name": "emcvipr/controller-client-java",
"path": "models/src/main/java/com/emc/storageos/model/pools/StoragePoolRestRep.java",
"license": "apache-2.0",
"size": 16373
} | [
"javax.xml.bind.annotation.XmlElement"
] | import javax.xml.bind.annotation.XmlElement; | import javax.xml.bind.annotation.*; | [
"javax.xml"
] | javax.xml; | 2,402,206 |
ArrayList<SectionItemInterface> getSortedOrganizedVideosByCourse(String courseId); | ArrayList<SectionItemInterface> getSortedOrganizedVideosByCourse(String courseId); | /**
* This method will return a list of all Downloaded videos with
* Chapter and Section header in the Course in the order as being sent from the server
* @param courseId
* @return
*/ | This method will return a list of all Downloaded videos with Chapter and Section header in the Course in the order as being sent from the server | getSortedOrganizedVideosByCourse | {
"repo_name": "FDoubleman/wd-edx-android",
"path": "VideoLocker/src/main/java/org/edx/mobile/module/storage/IStorage.java",
"license": "apache-2.0",
"size": 4838
} | [
"java.util.ArrayList",
"org.edx.mobile.interfaces.SectionItemInterface"
] | import java.util.ArrayList; import org.edx.mobile.interfaces.SectionItemInterface; | import java.util.*; import org.edx.mobile.interfaces.*; | [
"java.util",
"org.edx.mobile"
] | java.util; org.edx.mobile; | 211,630 |
public static void ignore(Log log,Throwable th)
{
if (log.isTraceEnabled()) log.trace(IGNORED,th);
} | static void function(Log log,Throwable th) { if (log.isTraceEnabled()) log.trace(IGNORED,th); } | /**
* Ignore an exception unless trace is enabled.
* This works around the problem that log4j does not support the trace level.
*/ | Ignore an exception unless trace is enabled. This works around the problem that log4j does not support the trace level | ignore | {
"repo_name": "Jimmy-Gao/browsermob-proxy",
"path": "src/main/java/org/browsermob/proxy/jetty/util/LogSupport.java",
"license": "apache-2.0",
"size": 1635
} | [
"org.apache.commons.logging.Log"
] | import org.apache.commons.logging.Log; | import org.apache.commons.logging.*; | [
"org.apache.commons"
] | org.apache.commons; | 799,262 |
public static boolean matches(String pattern, CharSequence input) {
input = new InterruptibleCharSequence(input);
Matcher m = getMatcher(pattern, input);
boolean res = m.matches();
recycleMatcher(m);
return res;
} | static boolean function(String pattern, CharSequence input) { input = new InterruptibleCharSequence(input); Matcher m = getMatcher(pattern, input); boolean res = m.matches(); recycleMatcher(m); return res; } | /**
* Utility method using a precompiled pattern instead of using the matches
* method of the String class. This method will also be reusing Matcher
* objects.
*
* @see java.util.regex.Pattern
* @param pattern precompiled Pattern to match against
* @param input the character sequence to check
* @return true if character sequence matches
*/ | Utility method using a precompiled pattern instead of using the matches method of the String class. This method will also be reusing Matcher objects | matches | {
"repo_name": "gaowangyizu/myHeritrix",
"path": "myHeritrix/src/org/archive/util/TextUtils.java",
"license": "apache-2.0",
"size": 9259
} | [
"java.util.regex.Matcher"
] | import java.util.regex.Matcher; | import java.util.regex.*; | [
"java.util"
] | java.util; | 2,144,156 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.