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 ShiftType getAdjustmentType() {
return adjustmentType;
} | ShiftType function() { return adjustmentType; } | /**
* Gets the shift type applied to the unadjusted value and the adjustment.
* (value, seasonality) -> adjustmentType.applyShift(value, seasonality).
* @return the value of the property, not null
*/ | Gets the shift type applied to the unadjusted value and the adjustment. (value, seasonality) -> adjustmentType.applyShift(value, seasonality) | getAdjustmentType | {
"repo_name": "ChinaQuants/Strata",
"path": "modules/market/src/main/java/com/opengamma/strata/market/curve/SeasonalityDefinition.java",
"license": "apache-2.0",
"size": 12099
} | [
"com.opengamma.strata.market.ShiftType"
] | import com.opengamma.strata.market.ShiftType; | import com.opengamma.strata.market.*; | [
"com.opengamma.strata"
] | com.opengamma.strata; | 2,325,701 |
private View getChildViews(ViewGroup view) {
if (view != null) {
for (int i = 0; i < view.getChildCount(); i++) {
View cb = view.getChildAt(i);
if (cb != null && cb instanceof ViewGroup) {
return getChildViews((ViewGroup) cb);
} else if (cb instanceof CheckBox) {
return cb;
}
}
}
return null;
} | View function(ViewGroup view) { if (view != null) { for (int i = 0; i < view.getChildCount(); i++) { View cb = view.getChildAt(i); if (cb != null && cb instanceof ViewGroup) { return getChildViews((ViewGroup) cb); } else if (cb instanceof CheckBox) { return cb; } } } return null; } | /**
* recursive called method, used from getCheckboxList method
*
* @param View
* @return View
*/ | recursive called method, used from getCheckboxList method | getChildViews | {
"repo_name": "SmruthiManjunath/owncloud_friends",
"path": "src/com/owncloud/android/ui/activity/InstantUploadActivity.java",
"license": "gpl-2.0",
"size": 18737
} | [
"android.view.View",
"android.view.ViewGroup",
"android.widget.CheckBox"
] | import android.view.View; import android.view.ViewGroup; import android.widget.CheckBox; | import android.view.*; import android.widget.*; | [
"android.view",
"android.widget"
] | android.view; android.widget; | 1,966,513 |
protected void preRenderCallback(EntityLivingBase p_77041_1_, float p_77041_2_)
{
this.preRenderCallback((AbstractClientPlayer)p_77041_1_, p_77041_2_);
} | void function(EntityLivingBase p_77041_1_, float p_77041_2_) { this.preRenderCallback((AbstractClientPlayer)p_77041_1_, p_77041_2_); } | /**
* Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
* entityLiving, partialTickTime
*/ | Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args: entityLiving, partialTickTime | preRenderCallback | {
"repo_name": "4Space/4Space-5",
"path": "src/main/java/net/minecraft/client/renderer/entity/RenderPlayer.java",
"license": "gpl-3.0",
"size": 25561
} | [
"net.minecraft.client.entity.AbstractClientPlayer",
"net.minecraft.entity.EntityLivingBase"
] | import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.entity.EntityLivingBase; | import net.minecraft.client.entity.*; import net.minecraft.entity.*; | [
"net.minecraft.client",
"net.minecraft.entity"
] | net.minecraft.client; net.minecraft.entity; | 2,713,909 |
@Test
public void testLastModifiedUpdatedAfterUpdates() throws IOException {
// create directory containing a file in filesystem
final File fed = new File("target/test-classes/test-objects");
final String id = getRandomUniqueId();
final File dir = new File(fed, id);
final File child = new File(dir, "child");
final long timestamp1 = currentTimeMillis();
dir.mkdir();
child.mkdir();
// TODO this seems really brittle
try {
sleep(2000);
} catch (final InterruptedException e) {
}
// check Last-Modified header is current
final long lastmod1;
try (final CloseableHttpResponse resp1 = execute(headObjMethod("files/" + id))) {
assertEquals(OK.getStatusCode(), getStatus(resp1));
lastmod1 = headerFormat.parse(resp1.getFirstHeader("Last-Modified").getValue()).getTime();
assertTrue((timestamp1 - lastmod1) < 1000); // because rounding
// remove the file and wait for the TTL to expire
final long timestamp2 = currentTimeMillis();
child.delete();
try {
sleep(2000);
} catch (final InterruptedException e) {
}
// check Last-Modified header is updated
try (final CloseableHttpResponse resp2 = execute(headObjMethod("files/" + id))) {
assertEquals(OK.getStatusCode(), getStatus(resp2));
final long lastmod2 = headerFormat.parse(resp2.getFirstHeader("Last-Modified").getValue()).getTime();
assertTrue((timestamp2 - lastmod2) < 1000); // because rounding
assertFalse("Last-Modified headers should have changed", lastmod1 == lastmod2);
} catch (final ParseException e) {
fail();
}
} catch (final ParseException e) {
fail();
}
} | void function() throws IOException { final File fed = new File(STR); final String id = getRandomUniqueId(); final File dir = new File(fed, id); final File child = new File(dir, "child"); final long timestamp1 = currentTimeMillis(); dir.mkdir(); child.mkdir(); try { sleep(2000); } catch (final InterruptedException e) { } final long lastmod1; try (final CloseableHttpResponse resp1 = execute(headObjMethod(STR + id))) { assertEquals(OK.getStatusCode(), getStatus(resp1)); lastmod1 = headerFormat.parse(resp1.getFirstHeader(STR).getValue()).getTime(); assertTrue((timestamp1 - lastmod1) < 1000); final long timestamp2 = currentTimeMillis(); child.delete(); try { sleep(2000); } catch (final InterruptedException e) { } try (final CloseableHttpResponse resp2 = execute(headObjMethod(STR + id))) { assertEquals(OK.getStatusCode(), getStatus(resp2)); final long lastmod2 = headerFormat.parse(resp2.getFirstHeader(STR).getValue()).getTime(); assertTrue((timestamp2 - lastmod2) < 1000); assertFalse(STR, lastmod1 == lastmod2); } catch (final ParseException e) { fail(); } } catch (final ParseException e) { fail(); } } | /**
* When I make changes to a resource in a federated filesystem, the parent folder's Last-Modified header should be
* updated.
*
* @throws IOException in case of IOException
**/ | When I make changes to a resource in a federated filesystem, the parent folder's Last-Modified header should be updated | testLastModifiedUpdatedAfterUpdates | {
"repo_name": "nianma/fcrepo4",
"path": "fcrepo-http-api/src/test/java/org/fcrepo/integration/http/api/FedoraLdpIT.java",
"license": "apache-2.0",
"size": 97175
} | [
"java.io.File",
"java.io.IOException",
"java.lang.System",
"java.lang.Thread",
"java.text.ParseException",
"javax.ws.rs.core.Response",
"org.apache.http.client.methods.CloseableHttpResponse",
"org.junit.Assert"
] | import java.io.File; import java.io.IOException; import java.lang.System; import java.lang.Thread; import java.text.ParseException; import javax.ws.rs.core.Response; import org.apache.http.client.methods.CloseableHttpResponse; import org.junit.Assert; | import java.io.*; import java.lang.*; import java.text.*; import javax.ws.rs.core.*; import org.apache.http.client.methods.*; import org.junit.*; | [
"java.io",
"java.lang",
"java.text",
"javax.ws",
"org.apache.http",
"org.junit"
] | java.io; java.lang; java.text; javax.ws; org.apache.http; org.junit; | 1,326,925 |
@Test
public void testReadFrom() throws Exception {
isisHeader.readFrom(channelBuffer);
assertThat(isisHeader, is(notNullValue()));
} | void function() throws Exception { isisHeader.readFrom(channelBuffer); assertThat(isisHeader, is(notNullValue())); } | /**
* Tests readFrom() method.
*/ | Tests readFrom() method | testReadFrom | {
"repo_name": "harikrushna-Huawei/hackathon",
"path": "protocols/isis/isisio/src/test/java/org/onosproject/isis/io/isispacket/IsisHeaderTest.java",
"license": "apache-2.0",
"size": 8318
} | [
"org.hamcrest.MatcherAssert",
"org.hamcrest.Matchers"
] | import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; | import org.hamcrest.*; | [
"org.hamcrest"
] | org.hamcrest; | 1,334,117 |
public boolean isUpArrow() {
return getNativeKeyCode() == KeyCodes.KEY_UP;
} | boolean function() { return getNativeKeyCode() == KeyCodes.KEY_UP; } | /**
* Is this a up arrow?
*
* @return whether this is a right arrow key event
*/ | Is this a up arrow | isUpArrow | {
"repo_name": "Legioth/vaadin",
"path": "client/src/main/java/com/vaadin/client/widget/grid/events/GridKeyDownEvent.java",
"license": "apache-2.0",
"size": 3531
} | [
"com.google.gwt.event.dom.client.KeyCodes"
] | import com.google.gwt.event.dom.client.KeyCodes; | import com.google.gwt.event.dom.client.*; | [
"com.google.gwt"
] | com.google.gwt; | 317,809 |
default PermissionInfo getPermissionInfo(HibUser user, HibBaseElement element) {
PermissionInfo info = new PermissionInfo();
Set<InternalPermission> permissions = getPermissions(user, element);
for (InternalPermission perm : permissions) {
info.set(perm.getRestPerm(), true);
}
info.setOthers(false, element.hasPublishPermissions());
return info;
} | default PermissionInfo getPermissionInfo(HibUser user, HibBaseElement element) { PermissionInfo info = new PermissionInfo(); Set<InternalPermission> permissions = getPermissions(user, element); for (InternalPermission perm : permissions) { info.set(perm.getRestPerm(), true); } info.setOthers(false, element.hasPublishPermissions()); return info; } | /**
* Return the permission info object for the given vertex.
*
* @param user
* @param element
* @return
*/ | Return the permission info object for the given vertex | getPermissionInfo | {
"repo_name": "gentics/mesh",
"path": "mdm/common/src/main/java/com/gentics/mesh/core/data/dao/PersistingUserDao.java",
"license": "apache-2.0",
"size": 25440
} | [
"com.gentics.mesh.core.data.HibBaseElement",
"com.gentics.mesh.core.data.perm.InternalPermission",
"com.gentics.mesh.core.data.user.HibUser",
"com.gentics.mesh.core.rest.common.PermissionInfo",
"java.util.Set"
] | import com.gentics.mesh.core.data.HibBaseElement; import com.gentics.mesh.core.data.perm.InternalPermission; import com.gentics.mesh.core.data.user.HibUser; import com.gentics.mesh.core.rest.common.PermissionInfo; import java.util.Set; | import com.gentics.mesh.core.data.*; import com.gentics.mesh.core.data.perm.*; import com.gentics.mesh.core.data.user.*; import com.gentics.mesh.core.rest.common.*; import java.util.*; | [
"com.gentics.mesh",
"java.util"
] | com.gentics.mesh; java.util; | 2,910,243 |
public static Spanned htmlToSpanned(String html) {
return Html.fromHtml(html, null, new ListTagHandler());
} | static Spanned function(String html) { return Html.fromHtml(html, null, new ListTagHandler()); } | /**
* Convert HTML to a {@link Spanned} that can be used in a {@link android.widget.TextView}.
*
* @param html
* The HTML fragment to be converted.
*
* @return A {@link Spanned} containing the text in {@code html} formatted using spans.
*/ | Convert HTML to a <code>Spanned</code> that can be used in a <code>android.widget.TextView</code> | htmlToSpanned | {
"repo_name": "philipwhiuk/k-9",
"path": "k9mail/src/main/java/com/fsck/k9/message/html/HtmlConverter.java",
"license": "apache-2.0",
"size": 18752
} | [
"android.text.Html",
"android.text.Spanned"
] | import android.text.Html; import android.text.Spanned; | import android.text.*; | [
"android.text"
] | android.text; | 1,216,958 |
public ServletType<T> displayName(String ... values)
{
if (values != null)
{
for(String name: values)
{
childNode.createChild("display-name").text(name);
}
}
return this;
} | ServletType<T> function(String ... values) { if (values != null) { for(String name: values) { childNode.createChild(STR).text(name); } } return this; } | /**
* Creates for all String objects representing <code>display-name</code> elements,
* a new <code>display-name</code> element
* @param values list of <code>display-name</code> objects
* @return the current instance of <code>ServletType<T></code>
*/ | Creates for all String objects representing <code>display-name</code> elements, a new <code>display-name</code> element | displayName | {
"repo_name": "forge/javaee-descriptors",
"path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/webcommon31/ServletTypeImpl.java",
"license": "epl-1.0",
"size": 23086
} | [
"org.jboss.shrinkwrap.descriptor.api.webcommon31.ServletType"
] | import org.jboss.shrinkwrap.descriptor.api.webcommon31.ServletType; | import org.jboss.shrinkwrap.descriptor.api.webcommon31.*; | [
"org.jboss.shrinkwrap"
] | org.jboss.shrinkwrap; | 2,200,617 |
boolean isValid(HttpServletRequest request); | boolean isValid(HttpServletRequest request); | /**
* Checks if the token is valid.
*
* @param request the request
* @return true, if the token is valid
*/ | Checks if the token is valid | isValid | {
"repo_name": "willmorejg/net.ljcomputing.ecsr-neo4j",
"path": "src/main/java/net/ljcomputing/ecsr/security/service/JwtTokenService.java",
"license": "apache-2.0",
"size": 1431
} | [
"javax.servlet.http.HttpServletRequest"
] | import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.*; | [
"javax.servlet"
] | javax.servlet; | 37,775 |
EAttribute getBinaryOpExpression_FunctionName(); | EAttribute getBinaryOpExpression_FunctionName(); | /**
* Returns the meta object for the attribute '{@link org.eclipse.xtext.testlanguages.backtracking.beeLangTestLanguage.BinaryOpExpression#getFunctionName <em>Function Name</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Function Name</em>'.
* @see org.eclipse.xtext.testlanguages.backtracking.beeLangTestLanguage.BinaryOpExpression#getFunctionName()
* @see #getBinaryOpExpression()
* @generated
*/ | Returns the meta object for the attribute '<code>org.eclipse.xtext.testlanguages.backtracking.beeLangTestLanguage.BinaryOpExpression#getFunctionName Function Name</code>'. | getBinaryOpExpression_FunctionName | {
"repo_name": "miklossy/xtext-core",
"path": "org.eclipse.xtext.testlanguages/src-gen/org/eclipse/xtext/testlanguages/backtracking/beeLangTestLanguage/BeeLangTestLanguagePackage.java",
"license": "epl-1.0",
"size": 161651
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 682,278 |
@JsonProperty("buildable")
public Boolean getBuildable() {
return buildable;
} | @JsonProperty(STR) Boolean function() { return buildable; } | /**
* Get buildable
* @return buildable
**/ | Get buildable | getBuildable | {
"repo_name": "cliffano/swaggy-jenkins",
"path": "clients/jaxrs-cxf-client/generated/src/gen/java/org/openapitools/model/QueueBlockedItem.java",
"license": "mit",
"size": 6593
} | [
"com.fasterxml.jackson.annotation.JsonProperty"
] | import com.fasterxml.jackson.annotation.JsonProperty; | import com.fasterxml.jackson.annotation.*; | [
"com.fasterxml.jackson"
] | com.fasterxml.jackson; | 299,351 |
public void handle(String url, WebDriver webDriver);
| void function(String url, WebDriver webDriver); | /**
* This method will look for the best matching handler and invoke it.
*
* @param url
* @param webDriver
*/ | This method will look for the best matching handler and invoke it | handle | {
"repo_name": "markysoft1/vani",
"path": "vani-core/src/main/java/org/markysoft/vani/core/locating/page/PageHandler.java",
"license": "mit",
"size": 1155
} | [
"org.openqa.selenium.WebDriver"
] | import org.openqa.selenium.WebDriver; | import org.openqa.selenium.*; | [
"org.openqa.selenium"
] | org.openqa.selenium; | 1,768,862 |
@Override
public void dispose() {
//System.out.println("[DEBUG]: Disposing...");
Container cp = getContentPane();
for (int i=0; i<cp.getComponentCount(); i++) {
// Okay if listener is already removed
cp.getComponent(i).removeMouseListener(tipListener);
}
ft.removeListeners();
super.dispose();
}
| void function() { Container cp = getContentPane(); for (int i=0; i<cp.getComponentCount(); i++) { cp.getComponent(i).removeMouseListener(tipListener); } ft.removeListeners(); super.dispose(); } | /**
* Disposes of this window.
*/ | Disposes of this window | dispose | {
"repo_name": "curiosag/ftc",
"path": "RSyntaxTextArea/src/main/java/org/fife/ui/rsyntaxtextarea/focusabletip/TipWindow.java",
"license": "gpl-3.0",
"size": 10231
} | [
"java.awt.Container"
] | import java.awt.Container; | import java.awt.*; | [
"java.awt"
] | java.awt; | 735,750 |
public List<Email> getEmailAddresses(int id) {
List<Email> emails = new ArrayList<Email>();
ContentResolver cr = ArsApplication.getInstance().getApplicationContext().getContentResolver();
Cursor emailCur = cr.query(ContactsContract.CommonDataKinds.Email.CONTENT_URI, null,
ContactsContract.CommonDataKinds.Email.CONTACT_ID + " = ?", new String[] { String.valueOf(id) }, null);
while (emailCur.moveToNext()) {
// This would allow you get several email addresses
Email e = new Email(
emailCur.getString(emailCur.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA)),
emailCur.getInt(emailCur.getColumnIndex(ContactsContract.CommonDataKinds.Email.TYPE)));
emails.add(e);
}
emailCur.close();
return emails;
}
| List<Email> function(int id) { List<Email> emails = new ArrayList<Email>(); ContentResolver cr = ArsApplication.getInstance().getApplicationContext().getContentResolver(); Cursor emailCur = cr.query(ContactsContract.CommonDataKinds.Email.CONTENT_URI, null, ContactsContract.CommonDataKinds.Email.CONTACT_ID + STR, new String[] { String.valueOf(id) }, null); while (emailCur.moveToNext()) { Email e = new Email( emailCur.getString(emailCur.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA)), emailCur.getInt(emailCur.getColumnIndex(ContactsContract.CommonDataKinds.Email.TYPE))); emails.add(e); } emailCur.close(); return emails; } | /**
* Returns a list of contact email addresses.
* @param id ID of the contact
* @return List of contact email addresses
*/ | Returns a list of contact email addresses | getEmailAddresses | {
"repo_name": "vityokkv73/android_retrieval_system",
"path": "src/net/deerhunter/ars/contact_structs/ContactsManager.java",
"license": "gpl-3.0",
"size": 9342
} | [
"android.content.ContentResolver",
"android.database.Cursor",
"android.provider.ContactsContract",
"java.util.ArrayList",
"java.util.List",
"net.deerhunter.ars.application.ArsApplication"
] | import android.content.ContentResolver; import android.database.Cursor; import android.provider.ContactsContract; import java.util.ArrayList; import java.util.List; import net.deerhunter.ars.application.ArsApplication; | import android.content.*; import android.database.*; import android.provider.*; import java.util.*; import net.deerhunter.ars.application.*; | [
"android.content",
"android.database",
"android.provider",
"java.util",
"net.deerhunter.ars"
] | android.content; android.database; android.provider; java.util; net.deerhunter.ars; | 118,696 |
static ArrayNode createArray(Vector vl, int index) throws AspException {
Integer size = Types.coerceToInteger(vl.get(index));
ArrayNode array = new ArrayNode(size.intValue()+1);
if (index < vl.size() - 1) {
for (int i = 0; i <= size.intValue(); i++) {
ArrayNode an = createArray(vl, index+1);
array._setValue(i, an);
}
}
return array;
} | static ArrayNode createArray(Vector vl, int index) throws AspException { Integer size = Types.coerceToInteger(vl.get(index)); ArrayNode array = new ArrayNode(size.intValue()+1); if (index < vl.size() - 1) { for (int i = 0; i <= size.intValue(); i++) { ArrayNode an = createArray(vl, index+1); array._setValue(i, an); } } return array; } | /**
* Internal function which creates an array from a list of dimensions.
* @param vl List of dimensions
* @param index Current position, initially should be 0
* @return new ArrayNode
*/ | Internal function which creates an array from a list of dimensions | createArray | {
"repo_name": "lazerdye/arrowheadasp",
"path": "src/com/tripi/asp/RedimNode.java",
"license": "gpl-2.0",
"size": 4465
} | [
"java.util.Vector"
] | import java.util.Vector; | import java.util.*; | [
"java.util"
] | java.util; | 2,522,228 |
@Override
public void onMessage(String message) {
try {
JSONObject messageObj = new JSONObject(message);
com.gmt2001.Console.debug.println("[PubSub Raw Message] " + messageObj);
if (!messageObj.has("type")) {
return;
}
if (messageObj.getString("type").equalsIgnoreCase("response")) {
if (messageObj.getString("nonce").equalsIgnoreCase("moderator")) {
this.hasModerator = !(messageObj.has("error") && messageObj.getString("error").length() > 0);
com.gmt2001.Console.debug.println("Got chat_moderator_actions response " + this.hasModerator);
if (!this.hasModerator) {
com.gmt2001.Console.err.println("WARNING: This APIOauth token was rejected for Moderation Feed (You can ignore the error if you aren't using this feature)");
com.gmt2001.Console.debug.println("TwitchPubSubWS Error: " + messageObj.getString("error"));
return;
}
} else if (messageObj.getString("nonce").equalsIgnoreCase("redemptions")) {
this.hasRedemptions = !(messageObj.has("error") && messageObj.getString("error").length() > 0);
com.gmt2001.Console.debug.println("Got channel-points-channel-v1 response " + this.hasRedemptions);
if (!this.hasRedemptions) {
com.gmt2001.Console.err.println("WARNING: This APIOauth token was rejected for Channel Points (You can ignore the error if you aren't using this feature)");
com.gmt2001.Console.debug.println("TwitchPubSubWS Error: " + messageObj.getString("error"));
return;
}
}
} else if (messageObj.has("error") && messageObj.getString("error").length() > 0) {
com.gmt2001.Console.err.println("TwitchPubSubWS Error: " + messageObj.getString("error"));
return;
}
if (messageObj.getString("type").equalsIgnoreCase("reconnect")) {
com.gmt2001.Console.out.println("Received RECONNECT from Twitch PubSub");
this.twitchPubSub.reconnect(true);
return;
}
if (messageObj.getString("type").equalsIgnoreCase("pong")) {
com.gmt2001.Console.debug.println("TwitchPubSubWS: Got a PONG.");
return;
}
parse(messageObj);
} catch (JSONException ex) {
com.gmt2001.Console.err.logStackTrace(ex);
}
}
private class PingTask extends TimerTask { | void function(String message) { try { JSONObject messageObj = new JSONObject(message); com.gmt2001.Console.debug.println(STR + messageObj); if (!messageObj.has("type")) { return; } if (messageObj.getString("type").equalsIgnoreCase(STR)) { if (messageObj.getString("nonce").equalsIgnoreCase(STR)) { this.hasModerator = !(messageObj.has("error") && messageObj.getString("error").length() > 0); com.gmt2001.Console.debug.println(STR + this.hasModerator); if (!this.hasModerator) { com.gmt2001.Console.err.println(STR); com.gmt2001.Console.debug.println(STR + messageObj.getString("error")); return; } } else if (messageObj.getString("nonce").equalsIgnoreCase(STR)) { this.hasRedemptions = !(messageObj.has("error") && messageObj.getString("error").length() > 0); com.gmt2001.Console.debug.println(STR + this.hasRedemptions); if (!this.hasRedemptions) { com.gmt2001.Console.err.println(STR); com.gmt2001.Console.debug.println(STR + messageObj.getString("error")); return; } } } else if (messageObj.has("error") && messageObj.getString("error").length() > 0) { com.gmt2001.Console.err.println(STR + messageObj.getString("error")); return; } if (messageObj.getString("type").equalsIgnoreCase(STR)) { com.gmt2001.Console.out.println(STR); this.twitchPubSub.reconnect(true); return; } if (messageObj.getString("type").equalsIgnoreCase("pong")) { com.gmt2001.Console.debug.println(STR); return; } parse(messageObj); } catch (JSONException ex) { com.gmt2001.Console.err.logStackTrace(ex); } } private class PingTask extends TimerTask { | /**
* Handles the event of when we get messages from the socket.
*
* @param {String} message Message the socket sent.
*/ | Handles the event of when we get messages from the socket | onMessage | {
"repo_name": "Stargamers/PhantomBot",
"path": "source/tv/phantombot/twitch/pubsub/TwitchPubSub.java",
"license": "gpl-3.0",
"size": 23637
} | [
"java.util.TimerTask",
"org.json.JSONException",
"org.json.JSONObject"
] | import java.util.TimerTask; import org.json.JSONException; import org.json.JSONObject; | import java.util.*; import org.json.*; | [
"java.util",
"org.json"
] | java.util; org.json; | 2,151,810 |
public Field getFieldByIndex(int fieldIndex)
{
checkElementIndex(fieldIndex, allFields.size(), "fieldIndex");
return allFields.get(fieldIndex);
} | Field function(int fieldIndex) { checkElementIndex(fieldIndex, allFields.size(), STR); return allFields.get(fieldIndex); } | /**
* Gets the field at the specified index.
*/ | Gets the field at the specified index | getFieldByIndex | {
"repo_name": "Nasdaq/presto",
"path": "presto-main/src/main/java/com/facebook/presto/sql/analyzer/RelationType.java",
"license": "apache-2.0",
"size": 6297
} | [
"com.google.common.base.Preconditions"
] | import com.google.common.base.Preconditions; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 1,237,652 |
public void stream(XmldbURL xmldbURL, File tmp) throws IOException {
stream(xmldbURL, tmp, null);
}
| void function(XmldbURL xmldbURL, File tmp) throws IOException { stream(xmldbURL, tmp, null); } | /**
* Read document and write data to database.
*
* @param xmldbURL Location in database.
* @param tmp Document that is inserted.
* @throws IOException
*/ | Read document and write data to database | stream | {
"repo_name": "kingargyle/exist-1.4.x",
"path": "src/org/exist/protocolhandler/embedded/EmbeddedUpload.java",
"license": "lgpl-2.1",
"size": 8496
} | [
"java.io.File",
"java.io.IOException",
"org.exist.protocolhandler.xmldb.XmldbURL"
] | import java.io.File; import java.io.IOException; import org.exist.protocolhandler.xmldb.XmldbURL; | import java.io.*; import org.exist.protocolhandler.xmldb.*; | [
"java.io",
"org.exist.protocolhandler"
] | java.io; org.exist.protocolhandler; | 2,751,449 |
@RequestMapping("/downloadAsZip.do")
public ModelAndView downloadAsZip(HttpServletRequest request,
HttpServletResponse response) {
String jobIdStr = request.getParameter("jobId");
String filesParam = request.getParameter("files");
CMARJob job = null;
String errorString = null;
if (jobIdStr != null) {
try {
int jobId = Integer.parseInt(jobIdStr);
job = jobManager.getJobById(jobId);
} catch (NumberFormatException e) {
logger.error("Error parsing job ID!");
}
}
if (job != null && filesParam != null) {
String[] fileNames = filesParam.split(",");
logger.debug("Archiving " + fileNames.length + " file(s) of job " +
jobIdStr);
response.setContentType("application/zip");
response.setHeader("Content-Disposition",
"attachment; filename=\"jobfiles.zip\"");
try {
boolean readOneOrMoreFiles = false;
ZipOutputStream zout = new ZipOutputStream(
response.getOutputStream());
for (String fileName : fileNames) {
File f = new File(job.getRemoteOutputDir()+File.separator+fileName);
if (!f.canRead()) {
// if a file could not be read we go ahead and try the
// next one.
logger.error("File "+f.getPath()+" not readable!");
} else {
byte[] buffer = new byte[16384];
int count = 0;
zout.putNextEntry(new ZipEntry(fileName));
FileInputStream fin = new FileInputStream(f);
while ((count = fin.read(buffer)) != -1) {
zout.write(buffer, 0, count);
}
zout.closeEntry();
readOneOrMoreFiles = true;
}
}
if (readOneOrMoreFiles) {
zout.finish();
zout.flush();
zout.close();
return null;
} else {
zout.close();
errorString = new String("Could not access the files!");
logger.error(errorString);
}
} catch (IOException e) {
errorString = new String("Could not create ZIP file: " +
e.getMessage());
logger.error(errorString);
}
}
// We only end up here in case of an error so return a suitable message
if (errorString == null) {
if (job == null) {
errorString = new String("Invalid job specified!");
logger.error(errorString);
} else if (filesParam == null) {
errorString = new String("No filename(s) provided!");
logger.error(errorString);
} else {
// should never get here
errorString = new String("Something went wrong.");
logger.error(errorString);
}
}
return new ModelAndView("joblist", "error", errorString);
} | @RequestMapping(STR) ModelAndView function(HttpServletRequest request, HttpServletResponse response) { String jobIdStr = request.getParameter("jobId"); String filesParam = request.getParameter("files"); CMARJob job = null; String errorString = null; if (jobIdStr != null) { try { int jobId = Integer.parseInt(jobIdStr); job = jobManager.getJobById(jobId); } catch (NumberFormatException e) { logger.error(STR); } } if (job != null && filesParam != null) { String[] fileNames = filesParam.split(","); logger.debug(STR + fileNames.length + STR + jobIdStr); response.setContentType(STR); response.setHeader(STR, STRjobfiles.zip\STRFile STR not readable!STRCould not access the files!STRCould not create ZIP file: STRInvalid job specified!STRNo filename(s) provided!STRSomething went wrong.STRjoblistSTRerror", errorString); } | /**
* Sends the contents of one or more job files as a ZIP archive to the
* client.
*
* @param request The servlet request including a jobId parameter and a
* files parameter with the filenames separated by comma
* @param response The servlet response receiving the data
*
* @return null on success or the joblist view with an error parameter on
* failure.
*/ | Sends the contents of one or more job files as a ZIP archive to the client | downloadAsZip | {
"repo_name": "AuScope/CMAR-Portal",
"path": "src/main/java/org/auscope/portal/server/web/controllers/JobListController.java",
"license": "gpl-3.0",
"size": 24438
} | [
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"org.auscope.portal.server.gridjob.CMARJob",
"org.springframework.web.bind.annotation.RequestMapping",
"org.springframework.web.servlet.ModelAndView"
] | import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.auscope.portal.server.gridjob.CMARJob; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; | import javax.servlet.http.*; import org.auscope.portal.server.gridjob.*; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.*; | [
"javax.servlet",
"org.auscope.portal",
"org.springframework.web"
] | javax.servlet; org.auscope.portal; org.springframework.web; | 326,749 |
private void setDetectedArtifactsOnScanningContext(ScanningContext context,
Properties properties,
Map overridenProperties,
boolean excludeIfNotOverriden) {
boolean detectClasses = false;
boolean detectHbm = false;
String detectSetting = overridenProperties != null ?
(String) overridenProperties.get( AvailableSettings.AUTODETECTION ) :
null;
detectSetting = detectSetting == null ?
properties.getProperty( AvailableSettings.AUTODETECTION) :
detectSetting;
if ( detectSetting == null && excludeIfNotOverriden) {
//not overriden through HibernatePersistence.AUTODETECTION so we comply with the spec excludeUnlistedClasses
context.detectClasses( false ).detectHbmFiles( false );
return;
}
if ( detectSetting == null){
detectSetting = "class,hbm";
}
StringTokenizer st = new StringTokenizer( detectSetting, ", ", false );
while ( st.hasMoreElements() ) {
String element = (String) st.nextElement();
if ( "class".equalsIgnoreCase( element ) ) detectClasses = true;
if ( "hbm".equalsIgnoreCase( element ) ) detectHbm = true;
}
log.debug( "Detect class: {}; detect hbm: {}", detectClasses, detectHbm );
context.detectClasses( detectClasses ).detectHbmFiles( detectHbm );
} | void function(ScanningContext context, Properties properties, Map overridenProperties, boolean excludeIfNotOverriden) { boolean detectClasses = false; boolean detectHbm = false; String detectSetting = overridenProperties != null ? (String) overridenProperties.get( AvailableSettings.AUTODETECTION ) : null; detectSetting = detectSetting == null ? properties.getProperty( AvailableSettings.AUTODETECTION) : detectSetting; if ( detectSetting == null && excludeIfNotOverriden) { context.detectClasses( false ).detectHbmFiles( false ); return; } if ( detectSetting == null){ detectSetting = STR; } StringTokenizer st = new StringTokenizer( detectSetting, STR, false ); while ( st.hasMoreElements() ) { String element = (String) st.nextElement(); if ( "class".equalsIgnoreCase( element ) ) detectClasses = true; if ( "hbm".equalsIgnoreCase( element ) ) detectHbm = true; } log.debug( STR, detectClasses, detectHbm ); context.detectClasses( detectClasses ).detectHbmFiles( detectHbm ); } | /**
* Set ScanningContext detectClasses and detectHbmFiles according to context
*/ | Set ScanningContext detectClasses and detectHbmFiles according to context | setDetectedArtifactsOnScanningContext | {
"repo_name": "ControlSystemStudio/cs-studio",
"path": "thirdparty/plugins/org.csstudio.platform.libs.hibernate/project/entitymanager/src/main/java/org/hibernate/ejb/Ejb3Configuration.java",
"license": "epl-1.0",
"size": 60232
} | [
"java.util.Map",
"java.util.Properties",
"java.util.StringTokenizer"
] | import java.util.Map; import java.util.Properties; import java.util.StringTokenizer; | import java.util.*; | [
"java.util"
] | java.util; | 953,420 |
public SearchSourceBuilder timeout(TimeValue timeout) {
this.timeout = timeout;
return this;
} | SearchSourceBuilder function(TimeValue timeout) { this.timeout = timeout; return this; } | /**
* An optional timeout to control how long search is allowed to take.
*/ | An optional timeout to control how long search is allowed to take | timeout | {
"repo_name": "fuchao01/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java",
"license": "apache-2.0",
"size": 58416
} | [
"org.elasticsearch.common.unit.TimeValue"
] | import org.elasticsearch.common.unit.TimeValue; | import org.elasticsearch.common.unit.*; | [
"org.elasticsearch.common"
] | org.elasticsearch.common; | 1,750,991 |
private boolean executeDeployment() {
try {
//determine batch file
File batchFile = new File(status.getDeploymentDirectory(), DeploymentArchiver.RUN_SCRIPT_NAME + ".bat");
if(!SystemUtils.isWindows()) {
//chmod run file
batchFile = new File(status.getDeploymentDirectory(), DeploymentArchiver.RUN_SCRIPT_NAME + ".sh");
List<String> chmodCmds = Arrays.asList("sudo", "chmod", "777", batchFile.getAbsolutePath());
LOG.info("Executing chmod: " + StringUtils.join(chmodCmds, " "));
SystemUtils.executeSystemCommand(batchFile.getParent(), chmodCmds);
}
//read command
String cmdString = buildCommandString(batchFile);
LOG.info("***************** Executing system command: ***********************************");
LOG.info(cmdString);
LOG.info("***************** /Executing system command ***********************************");
executeProcess(cmdString);
} catch (Exception e) {
LOG.error("Error installing deployment: " + e.getMessage());
status.setErrorMessage(e.getMessage());
return false;
}
return true;
} | boolean function() { try { File batchFile = new File(status.getDeploymentDirectory(), DeploymentArchiver.RUN_SCRIPT_NAME + ".bat"); if(!SystemUtils.isWindows()) { batchFile = new File(status.getDeploymentDirectory(), DeploymentArchiver.RUN_SCRIPT_NAME + ".sh"); List<String> chmodCmds = Arrays.asList("sudo", "chmod", "777", batchFile.getAbsolutePath()); LOG.info(STR + StringUtils.join(chmodCmds, " ")); SystemUtils.executeSystemCommand(batchFile.getParent(), chmodCmds); } String cmdString = buildCommandString(batchFile); LOG.info(STR); LOG.info(cmdString); LOG.info(STR); executeProcess(cmdString); } catch (Exception e) { LOG.error(STR + e.getMessage()); status.setErrorMessage(e.getMessage()); return false; } return true; } | /**
* Executes a system command, using the batch file that
* has been generated by the deployment archiver class.
* Returns true if the process execution was successful.
*/ | Executes a system command, using the batch file that has been generated by the deployment archiver class. Returns true if the process execution was successful | executeDeployment | {
"repo_name": "syd711/callete",
"path": "callete-deployment/src/main/java/callete/deployment/server/Deployment.java",
"license": "mit",
"size": 8150
} | [
"java.io.File",
"java.util.Arrays",
"java.util.List",
"org.apache.commons.lang.StringUtils"
] | import java.io.File; import java.util.Arrays; import java.util.List; import org.apache.commons.lang.StringUtils; | import java.io.*; import java.util.*; import org.apache.commons.lang.*; | [
"java.io",
"java.util",
"org.apache.commons"
] | java.io; java.util; org.apache.commons; | 522,515 |
public boolean willCreateFullOuterJoin() {
Collection<QueryGraphNode> vertices = jungGraph.getVertices();
for (QueryGraphNode node : vertices) {
if (node.isRequiredNode()) {
return false;
}
}
return true;
}
| boolean function() { Collection<QueryGraphNode> vertices = jungGraph.getVertices(); for (QueryGraphNode node : vertices) { if (node.isRequiredNode()) { return false; } } return true; } | /**
* Scans the QueryGraph to detect full outer join.
*
* <p style="color: #F90;">Support DBvolution at
* <a href="http://patreon.com/dbvolution" target=new>Patreon</a></p>
*
* @return TRUE contains only optional tables, FALSE otherwise.
*/ | Scans the QueryGraph to detect full outer join. Support DBvolution at Patreon | willCreateFullOuterJoin | {
"repo_name": "gregorydgraham/DBvolution",
"path": "src/main/java/nz/co/gregs/dbvolution/internal/querygraph/QueryGraph.java",
"license": "apache-2.0",
"size": 15283
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 1,434,711 |
public Map<String, Object> getAsMap() {
HashMap<String, Object> result = new HashMap<String, Object>();
String limitString = (null == limit) ? "" : " LIMIT " + (null == offset ? "" : offset + ", ") + limit;
String query = "FOR x IN `" + Database.getCollectionName(valueType) + "` " + propertyFilter.getFilterString() + propertySort.getSortString() + limitString + " RETURN x";
result.put("query", query);
result.put("count", count);
result.put("batchSize", batchSize);
result.put("bindVars", propertyFilter.getBindVars());
return result;
} | Map<String, Object> function() { HashMap<String, Object> result = new HashMap<String, Object>(); String limitString = (null == limit) ? STR LIMIT STRSTR, STRFOR x IN `STR` STR RETURN xSTRquerySTRcountSTRbatchSizeSTRbindVars", propertyFilter.getBindVars()); return result; } | /**
* Get the AQL query as a map
*
* @return Map<String, Object> the map
*/ | Get the AQL query as a map | getAsMap | {
"repo_name": "triAGENS/arangodb-objectmapper",
"path": "src/main/java/org/arangodb/objectmapper/ArangoDbQuery.java",
"license": "apache-2.0",
"size": 6764
} | [
"java.util.HashMap",
"java.util.Map"
] | import java.util.HashMap; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 886,354 |
public void onAsyncTaskCompleted(boolean success, int messageId) {
removeDialog(DIALOG_PROGRESS_ID);
Toast.makeText(this, messageId, success ? Toast.LENGTH_SHORT : Toast.LENGTH_LONG).show();
Intent intent = IntentUtils.newIntent(this, TrackListActivity.class);
startActivity(intent);
} | void function(boolean success, int messageId) { removeDialog(DIALOG_PROGRESS_ID); Toast.makeText(this, messageId, success ? Toast.LENGTH_SHORT : Toast.LENGTH_LONG).show(); Intent intent = IntentUtils.newIntent(this, TrackListActivity.class); startActivity(intent); } | /**
* Invokes when the associated AsyncTask completes.
*
* @param success true if the AsyncTask is successful
* @param messageId message id to display to user
*/ | Invokes when the associated AsyncTask completes | onAsyncTaskCompleted | {
"repo_name": "AdaDeb/septracks",
"path": "MyTracks/src/com/google/android/apps/mytracks/io/backup/RestoreActivity.java",
"license": "gpl-2.0",
"size": 3203
} | [
"android.content.Intent",
"android.widget.Toast",
"com.google.android.apps.mytracks.TrackListActivity",
"com.google.android.apps.mytracks.util.IntentUtils"
] | import android.content.Intent; import android.widget.Toast; import com.google.android.apps.mytracks.TrackListActivity; import com.google.android.apps.mytracks.util.IntentUtils; | import android.content.*; import android.widget.*; import com.google.android.apps.mytracks.*; import com.google.android.apps.mytracks.util.*; | [
"android.content",
"android.widget",
"com.google.android"
] | android.content; android.widget; com.google.android; | 2,555,018 |
//-----------------------------------------------------------------------
public ExternalIdBean getBondId() {
return _bondId;
} | ExternalIdBean function() { return _bondId; } | /**
* Gets the bond ref id.
* @return the value of the property
*/ | Gets the bond ref id | getBondId | {
"repo_name": "McLeodMoores/starling",
"path": "projects/master-db/src/main/java/com/opengamma/masterdb/security/hibernate/cds/CDSIndexComponentBean.java",
"license": "apache-2.0",
"size": 10684
} | [
"com.opengamma.masterdb.security.hibernate.ExternalIdBean"
] | import com.opengamma.masterdb.security.hibernate.ExternalIdBean; | import com.opengamma.masterdb.security.hibernate.*; | [
"com.opengamma.masterdb"
] | com.opengamma.masterdb; | 2,557,646 |
public Builder uninterpreted_option(List<UninterpretedOption> uninterpreted_option) {
this.uninterpreted_option = checkForNulls(uninterpreted_option);
return this;
} | Builder function(List<UninterpretedOption> uninterpreted_option) { this.uninterpreted_option = checkForNulls(uninterpreted_option); return this; } | /**
* The parser stores options it doesn't recognize here. See above.
*/ | The parser stores options it doesn't recognize here. See above | uninterpreted_option | {
"repo_name": "wakandan/wire",
"path": "wire-runtime/src/test/java/com/google/protobuf/MessageOptions.java",
"license": "apache-2.0",
"size": 6411
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,658,566 |
int compare(Object[] lObjects, Object[] rObjects ) throws DataException;
| int compare(Object[] lObjects, Object[] rObjects ) throws DataException; | /**
* Compares the two specified key objects.
*
* @return
* @throws DataException
*/ | Compares the two specified key objects | compare | {
"repo_name": "sguan-actuate/birt",
"path": "data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/impl/jointdataset/IJoinConditionMatcher.java",
"license": "epl-1.0",
"size": 1336
} | [
"org.eclipse.birt.data.engine.core.DataException"
] | import org.eclipse.birt.data.engine.core.DataException; | import org.eclipse.birt.data.engine.core.*; | [
"org.eclipse.birt"
] | org.eclipse.birt; | 1,718,787 |
private void initializeZKBasedSystemTrackers()
throws IOException, KeeperException, ReplicationException {
if (maintenanceMode) {
// in maintenance mode, always use MaintenanceLoadBalancer.
conf.unset(LoadBalancer.HBASE_RSGROUP_LOADBALANCER_CLASS);
conf.setClass(HConstants.HBASE_MASTER_LOADBALANCER_CLASS, MaintenanceLoadBalancer.class,
LoadBalancer.class);
}
this.balancer = new RSGroupBasedLoadBalancer();
this.loadBalancerTracker = new LoadBalancerTracker(zooKeeper, this);
this.loadBalancerTracker.start();
this.regionNormalizerManager =
RegionNormalizerFactory.createNormalizerManager(conf, zooKeeper, this);
this.configurationManager.registerObserver(regionNormalizerManager);
this.regionNormalizerManager.start();
this.splitOrMergeTracker = new SplitOrMergeTracker(zooKeeper, conf, this);
this.splitOrMergeTracker.start();
// This is for backwards compatible. We do not need the CP for rs group now but if user want to
// load it, we need to enable rs group.
String[] cpClasses = conf.getStrings(MasterCoprocessorHost.MASTER_COPROCESSOR_CONF_KEY);
if (cpClasses != null) {
for (String cpClass : cpClasses) {
if (RSGroupAdminEndpoint.class.getName().equals(cpClass)) {
RSGroupUtil.enableRSGroup(conf);
break;
}
}
}
this.rsGroupInfoManager = RSGroupInfoManager.create(this);
this.replicationPeerManager = ReplicationPeerManager.create(zooKeeper, conf, clusterId);
this.drainingServerTracker = new DrainingServerTracker(zooKeeper, this, this.serverManager);
this.drainingServerTracker.start();
this.snapshotCleanupTracker = new SnapshotCleanupTracker(zooKeeper, this);
this.snapshotCleanupTracker.start();
String clientQuorumServers = conf.get(HConstants.CLIENT_ZOOKEEPER_QUORUM);
boolean clientZkObserverMode = conf.getBoolean(HConstants.CLIENT_ZOOKEEPER_OBSERVER_MODE,
HConstants.DEFAULT_CLIENT_ZOOKEEPER_OBSERVER_MODE);
if (clientQuorumServers != null && !clientZkObserverMode) {
// we need to take care of the ZK information synchronization
// if given client ZK are not observer nodes
ZKWatcher clientZkWatcher = new ZKWatcher(conf,
getProcessName() + ":" + rpcServices.getSocketAddress().getPort() + "-clientZK", this,
false, true);
this.metaLocationSyncer = new MetaLocationSyncer(zooKeeper, clientZkWatcher, this);
this.metaLocationSyncer.start();
this.masterAddressSyncer = new MasterAddressSyncer(zooKeeper, clientZkWatcher, this);
this.masterAddressSyncer.start();
// set cluster id is a one-go effort
ZKClusterId.setClusterId(clientZkWatcher, fileSystemManager.getClusterId());
}
// Set the cluster as up. If new RSs, they'll be waiting on this before
// going ahead with their startup.
boolean wasUp = this.clusterStatusTracker.isClusterUp();
if (!wasUp) this.clusterStatusTracker.setClusterUp();
LOG.info("Active/primary master=" + this.serverName +
", sessionid=0x" +
Long.toHexString(this.zooKeeper.getRecoverableZooKeeper().getSessionId()) +
", setting cluster-up flag (Was=" + wasUp + ")");
// create/initialize the snapshot manager and other procedure managers
this.snapshotManager = new SnapshotManager();
this.mpmHost = new MasterProcedureManagerHost();
this.mpmHost.register(this.snapshotManager);
this.mpmHost.register(new MasterFlushTableProcedureManager());
this.mpmHost.loadProcedures(conf);
this.mpmHost.initialize(this, this.metricsMaster);
} | void function() throws IOException, KeeperException, ReplicationException { if (maintenanceMode) { conf.unset(LoadBalancer.HBASE_RSGROUP_LOADBALANCER_CLASS); conf.setClass(HConstants.HBASE_MASTER_LOADBALANCER_CLASS, MaintenanceLoadBalancer.class, LoadBalancer.class); } this.balancer = new RSGroupBasedLoadBalancer(); this.loadBalancerTracker = new LoadBalancerTracker(zooKeeper, this); this.loadBalancerTracker.start(); this.regionNormalizerManager = RegionNormalizerFactory.createNormalizerManager(conf, zooKeeper, this); this.configurationManager.registerObserver(regionNormalizerManager); this.regionNormalizerManager.start(); this.splitOrMergeTracker = new SplitOrMergeTracker(zooKeeper, conf, this); this.splitOrMergeTracker.start(); String[] cpClasses = conf.getStrings(MasterCoprocessorHost.MASTER_COPROCESSOR_CONF_KEY); if (cpClasses != null) { for (String cpClass : cpClasses) { if (RSGroupAdminEndpoint.class.getName().equals(cpClass)) { RSGroupUtil.enableRSGroup(conf); break; } } } this.rsGroupInfoManager = RSGroupInfoManager.create(this); this.replicationPeerManager = ReplicationPeerManager.create(zooKeeper, conf, clusterId); this.drainingServerTracker = new DrainingServerTracker(zooKeeper, this, this.serverManager); this.drainingServerTracker.start(); this.snapshotCleanupTracker = new SnapshotCleanupTracker(zooKeeper, this); this.snapshotCleanupTracker.start(); String clientQuorumServers = conf.get(HConstants.CLIENT_ZOOKEEPER_QUORUM); boolean clientZkObserverMode = conf.getBoolean(HConstants.CLIENT_ZOOKEEPER_OBSERVER_MODE, HConstants.DEFAULT_CLIENT_ZOOKEEPER_OBSERVER_MODE); if (clientQuorumServers != null && !clientZkObserverMode) { ZKWatcher clientZkWatcher = new ZKWatcher(conf, getProcessName() + ":" + rpcServices.getSocketAddress().getPort() + STR, this, false, true); this.metaLocationSyncer = new MetaLocationSyncer(zooKeeper, clientZkWatcher, this); this.metaLocationSyncer.start(); this.masterAddressSyncer = new MasterAddressSyncer(zooKeeper, clientZkWatcher, this); this.masterAddressSyncer.start(); ZKClusterId.setClusterId(clientZkWatcher, fileSystemManager.getClusterId()); } boolean wasUp = this.clusterStatusTracker.isClusterUp(); if (!wasUp) this.clusterStatusTracker.setClusterUp(); LOG.info(STR + this.serverName + STR + Long.toHexString(this.zooKeeper.getRecoverableZooKeeper().getSessionId()) + STR + wasUp + ")"); this.snapshotManager = new SnapshotManager(); this.mpmHost = new MasterProcedureManagerHost(); this.mpmHost.register(this.snapshotManager); this.mpmHost.register(new MasterFlushTableProcedureManager()); this.mpmHost.loadProcedures(conf); this.mpmHost.initialize(this, this.metricsMaster); } | /**
* Initialize all ZK based system trackers. But do not include {@link RegionServerTracker}, it
* should have already been initialized along with {@link ServerManager}.
*/ | Initialize all ZK based system trackers. But do not include <code>RegionServerTracker</code>, it should have already been initialized along with <code>ServerManager</code> | initializeZKBasedSystemTrackers | {
"repo_name": "mahak/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java",
"license": "apache-2.0",
"size": 169117
} | [
"java.io.IOException",
"org.apache.hadoop.hbase.HConstants",
"org.apache.hadoop.hbase.master.balancer.MaintenanceLoadBalancer",
"org.apache.hadoop.hbase.master.normalizer.RegionNormalizerFactory",
"org.apache.hadoop.hbase.master.replication.ReplicationPeerManager",
"org.apache.hadoop.hbase.master.snapshot.SnapshotManager",
"org.apache.hadoop.hbase.master.zksyncer.MasterAddressSyncer",
"org.apache.hadoop.hbase.master.zksyncer.MetaLocationSyncer",
"org.apache.hadoop.hbase.procedure.MasterProcedureManagerHost",
"org.apache.hadoop.hbase.procedure.flush.MasterFlushTableProcedureManager",
"org.apache.hadoop.hbase.replication.ReplicationException",
"org.apache.hadoop.hbase.rsgroup.RSGroupAdminEndpoint",
"org.apache.hadoop.hbase.rsgroup.RSGroupBasedLoadBalancer",
"org.apache.hadoop.hbase.rsgroup.RSGroupInfoManager",
"org.apache.hadoop.hbase.rsgroup.RSGroupUtil",
"org.apache.hadoop.hbase.zookeeper.LoadBalancerTracker",
"org.apache.hadoop.hbase.zookeeper.SnapshotCleanupTracker",
"org.apache.hadoop.hbase.zookeeper.ZKClusterId",
"org.apache.hadoop.hbase.zookeeper.ZKWatcher",
"org.apache.zookeeper.KeeperException"
] | import java.io.IOException; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.master.balancer.MaintenanceLoadBalancer; import org.apache.hadoop.hbase.master.normalizer.RegionNormalizerFactory; import org.apache.hadoop.hbase.master.replication.ReplicationPeerManager; import org.apache.hadoop.hbase.master.snapshot.SnapshotManager; import org.apache.hadoop.hbase.master.zksyncer.MasterAddressSyncer; import org.apache.hadoop.hbase.master.zksyncer.MetaLocationSyncer; import org.apache.hadoop.hbase.procedure.MasterProcedureManagerHost; import org.apache.hadoop.hbase.procedure.flush.MasterFlushTableProcedureManager; import org.apache.hadoop.hbase.replication.ReplicationException; import org.apache.hadoop.hbase.rsgroup.RSGroupAdminEndpoint; import org.apache.hadoop.hbase.rsgroup.RSGroupBasedLoadBalancer; import org.apache.hadoop.hbase.rsgroup.RSGroupInfoManager; import org.apache.hadoop.hbase.rsgroup.RSGroupUtil; import org.apache.hadoop.hbase.zookeeper.LoadBalancerTracker; import org.apache.hadoop.hbase.zookeeper.SnapshotCleanupTracker; import org.apache.hadoop.hbase.zookeeper.ZKClusterId; import org.apache.hadoop.hbase.zookeeper.ZKWatcher; import org.apache.zookeeper.KeeperException; | import java.io.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.master.balancer.*; import org.apache.hadoop.hbase.master.normalizer.*; import org.apache.hadoop.hbase.master.replication.*; import org.apache.hadoop.hbase.master.snapshot.*; import org.apache.hadoop.hbase.master.zksyncer.*; import org.apache.hadoop.hbase.procedure.*; import org.apache.hadoop.hbase.procedure.flush.*; import org.apache.hadoop.hbase.replication.*; import org.apache.hadoop.hbase.rsgroup.*; import org.apache.hadoop.hbase.zookeeper.*; import org.apache.zookeeper.*; | [
"java.io",
"org.apache.hadoop",
"org.apache.zookeeper"
] | java.io; org.apache.hadoop; org.apache.zookeeper; | 203,289 |
public UpdateRequest doc(XContentBuilder source) {
safeDoc().source(source);
return this;
} | UpdateRequest function(XContentBuilder source) { safeDoc().source(source); return this; } | /**
* Sets the doc to use for updates when a script is not specified.
*/ | Sets the doc to use for updates when a script is not specified | doc | {
"repo_name": "lchennup/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/action/update/UpdateRequest.java",
"license": "apache-2.0",
"size": 25820
} | [
"org.elasticsearch.common.xcontent.XContentBuilder"
] | import org.elasticsearch.common.xcontent.XContentBuilder; | import org.elasticsearch.common.xcontent.*; | [
"org.elasticsearch.common"
] | org.elasticsearch.common; | 1,230,496 |
List<Object> findIds(); | List<Object> findIds(); | /**
* Execute the query returning the list of Id's.
* <p>
* This query will execute against the EbeanServer that was used to create it.
* </p>
*
* @see EbeanServer#findIds(Query, Transaction)
*/ | Execute the query returning the list of Id's. This query will execute against the EbeanServer that was used to create it. | findIds | {
"repo_name": "gzwfdy/meetime",
"path": "src/main/java/com/avaje/ebean/Query.java",
"license": "apache-2.0",
"size": 39139
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 681,442 |
@Nonnull
public java.util.concurrent.CompletableFuture<CertificateBasedAuthConfiguration> putAsync(@Nonnull final CertificateBasedAuthConfiguration srcCertificateBasedAuthConfiguration) {
final JsonObject payload = new JsonObject();
payload.add("@odata.id", new JsonPrimitive(this.getClient().getServiceRoot() + "/certificateBasedAuthConfiguration/" + srcCertificateBasedAuthConfiguration.id));
return sendAsync(HttpMethod.PUT, payload);
} | java.util.concurrent.CompletableFuture<CertificateBasedAuthConfiguration> function(@Nonnull final CertificateBasedAuthConfiguration srcCertificateBasedAuthConfiguration) { final JsonObject payload = new JsonObject(); payload.add(STR, new JsonPrimitive(this.getClient().getServiceRoot() + STR + srcCertificateBasedAuthConfiguration.id)); return sendAsync(HttpMethod.PUT, payload); } | /**
* Puts the CertificateBasedAuthConfiguration
*
* @param srcCertificateBasedAuthConfiguration the CertificateBasedAuthConfiguration reference to PUT
* @return a future with the result
*/ | Puts the CertificateBasedAuthConfiguration | putAsync | {
"repo_name": "microsoftgraph/msgraph-sdk-java",
"path": "src/main/java/com/microsoft/graph/requests/CertificateBasedAuthConfigurationReferenceRequest.java",
"license": "mit",
"size": 3931
} | [
"com.google.gson.JsonObject",
"com.google.gson.JsonPrimitive",
"com.microsoft.graph.http.HttpMethod",
"com.microsoft.graph.models.CertificateBasedAuthConfiguration",
"javax.annotation.Nonnull"
] | import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; import com.microsoft.graph.http.HttpMethod; import com.microsoft.graph.models.CertificateBasedAuthConfiguration; import javax.annotation.Nonnull; | import com.google.gson.*; import com.microsoft.graph.http.*; import com.microsoft.graph.models.*; import javax.annotation.*; | [
"com.google.gson",
"com.microsoft.graph",
"javax.annotation"
] | com.google.gson; com.microsoft.graph; javax.annotation; | 1,015,430 |
public T decodeJson(byte[] data) throws IOException {
return decodeJson(new String(data, UTF8), null);
} | T function(byte[] data) throws IOException { return decodeJson(new String(data, UTF8), null); } | /**
* Decode json data.
*
* @param data the data
* @return the decoded object
* @throws IOException Signals that an I/O exception has occurred.
*/ | Decode json data | decodeJson | {
"repo_name": "kallelzied/kaa",
"path": "common/endpoint-shared/src/main/java/org/kaaproject/kaa/common/avro/GenericAvroConverter.java",
"license": "apache-2.0",
"size": 7261
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,605,267 |
public Short getFromPortMap(IOFSwitch sw, long mac, short vlan) {
if (vlan == (short) 0xffff) {
vlan = 0;
}
Map<MacVlanPair,Short> swMap = macVlanToSwitchPortMap.get(sw);
if (swMap != null)
return swMap.get(new MacVlanPair(mac, vlan));
// if none found
return null;
} | Short function(IOFSwitch sw, long mac, short vlan) { if (vlan == (short) 0xffff) { vlan = 0; } Map<MacVlanPair,Short> swMap = macVlanToSwitchPortMap.get(sw); if (swMap != null) return swMap.get(new MacVlanPair(mac, vlan)); return null; } | /**
* Get the port that a MAC/VLAN pair is associated with
* @param sw The switch to get the mapping from
* @param mac The MAC address to get
* @param vlan The VLAN number to get
* @return The port the host is on
*/ | Get the port that a MAC/VLAN pair is associated with | getFromPortMap | {
"repo_name": "rjellinek/floodlight",
"path": "src/main/java/net/floodlightcontroller/learningswitch/LearningSwitch.java",
"license": "apache-2.0",
"size": 27734
} | [
"java.util.Map",
"net.floodlightcontroller.core.IOFSwitch",
"net.floodlightcontroller.core.types.MacVlanPair"
] | import java.util.Map; import net.floodlightcontroller.core.IOFSwitch; import net.floodlightcontroller.core.types.MacVlanPair; | import java.util.*; import net.floodlightcontroller.core.*; import net.floodlightcontroller.core.types.*; | [
"java.util",
"net.floodlightcontroller.core"
] | java.util; net.floodlightcontroller.core; | 1,667,437 |
public static String getFormattedTimeWithDiff(DateFormat dateFormat,
long finishTime, long startTime){
StringBuilder buf = new StringBuilder();
if (0 != finishTime) {
buf.append(dateFormat.format(new Date(finishTime)));
if (0 != startTime){
buf.append(" (" + formatTimeDiff(finishTime , startTime) + ")");
}
}
return buf.toString();
} | static String function(DateFormat dateFormat, long finishTime, long startTime){ StringBuilder buf = new StringBuilder(); if (0 != finishTime) { buf.append(dateFormat.format(new Date(finishTime))); if (0 != startTime){ buf.append(STR + formatTimeDiff(finishTime , startTime) + ")"); } } return buf.toString(); } | /**
* Formats time in ms and appends difference (finishTime - startTime)
* as returned by formatTimeDiff().
* If finish time is 0, empty string is returned, if start time is 0
* then difference is not appended to return value.
* @param dateFormat date format to use
* @param finishTime fnish time
* @param startTime start time
* @return formatted value.
*/ | Formats time in ms and appends difference (finishTime - startTime) as returned by formatTimeDiff(). If finish time is 0, empty string is returned, if start time is 0 then difference is not appended to return value | getFormattedTimeWithDiff | {
"repo_name": "ZhangXFeng/hadoop",
"path": "src/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/StringUtils.java",
"license": "apache-2.0",
"size": 33076
} | [
"java.text.DateFormat",
"java.util.Date"
] | import java.text.DateFormat; import java.util.Date; | import java.text.*; import java.util.*; | [
"java.text",
"java.util"
] | java.text; java.util; | 2,784,573 |
void deleteUserAffiliations(JID userJid) throws NodeStoreException; | void deleteUserAffiliations(JID userJid) throws NodeStoreException; | /**
* Delete affiliations for a user
*
* @param userJid
* @throws NodeStoreException
*/ | Delete affiliations for a user | deleteUserAffiliations | {
"repo_name": "buddycloud/buddycloud-server-java",
"path": "src/main/java/org/buddycloud/channelserver/db/NodeStore.java",
"license": "apache-2.0",
"size": 20538
} | [
"org.buddycloud.channelserver.db.exception.NodeStoreException"
] | import org.buddycloud.channelserver.db.exception.NodeStoreException; | import org.buddycloud.channelserver.db.exception.*; | [
"org.buddycloud.channelserver"
] | org.buddycloud.channelserver; | 614,543 |
public HttpClientWrapper useBrowserCompatibleCookies() {
LOG.debug("useBrowserCompatibleCookies()");
assertNotInitialized();
m_cookieSpec = CookieSpecs.BROWSER_COMPATIBILITY;
return this;
} | HttpClientWrapper function() { LOG.debug(STR); assertNotInitialized(); m_cookieSpec = CookieSpecs.BROWSER_COMPATIBILITY; return this; } | /**
* Use browser-compatible cookies rather than the default.
*/ | Use browser-compatible cookies rather than the default | useBrowserCompatibleCookies | {
"repo_name": "roskens/opennms-pre-github",
"path": "core/web/src/main/java/org/opennms/core/web/HttpClientWrapper.java",
"license": "agpl-3.0",
"size": 19836
} | [
"org.apache.http.client.config.CookieSpecs"
] | import org.apache.http.client.config.CookieSpecs; | import org.apache.http.client.config.*; | [
"org.apache.http"
] | org.apache.http; | 2,068,987 |
public static @Nullable String build(@Nullable final Enumeration<?> enumeration,
@Nullable final String indent) {
final Buffer buffer = new Buffer();
build(buffer, enumeration, indent);
if (buffer.size() == 0) return null;
try {
return buffer.readUtf8();
}
finally {
buffer.close();
}
} | static @Nullable String function(@Nullable final Enumeration<?> enumeration, @Nullable final String indent) { final Buffer buffer = new Buffer(); build(buffer, enumeration, indent); if (buffer.size() == 0) return null; try { return buffer.readUtf8(); } finally { buffer.close(); } } | /**
* Converts the given list (enumeration) representation of a json array to its string representation.
* @param enumeration the json array.
* @param indent the indentation string (tabs or spaces), which can be null.
* @return either a string or null if the enumeration doesn't represent a valid json array.
*/ | Converts the given list (enumeration) representation of a json array to its string representation | build | {
"repo_name": "programingjd/okjson",
"path": "src/main/java/info/jdavid/ok/json/Builder.java",
"license": "apache-2.0",
"size": 25524
} | [
"java.util.Enumeration",
"javax.annotation.Nullable"
] | import java.util.Enumeration; import javax.annotation.Nullable; | import java.util.*; import javax.annotation.*; | [
"java.util",
"javax.annotation"
] | java.util; javax.annotation; | 2,316,146 |
public static void addMessageProperties(ClientMessage message, Map<String, Object> properties) {
if (properties != null && properties.size() > 0) {
for (Map.Entry<String, Object> property : properties.entrySet()) {
message.putObjectProperty(property.getKey(), property.getValue());
}
}
} | static void function(ClientMessage message, Map<String, Object> properties) { if (properties != null && properties.size() > 0) { for (Map.Entry<String, Object> property : properties.entrySet()) { message.putObjectProperty(property.getKey(), property.getValue()); } } } | /**
* Adds properties to a ClientMessage
*
* @param message
* @param properties
*/ | Adds properties to a ClientMessage | addMessageProperties | {
"repo_name": "paulgallagher75/activemq-artemis",
"path": "artemis-junit/src/main/java/org/apache/activemq/artemis/junit/EmbeddedActiveMQResource.java",
"license": "apache-2.0",
"size": 31465
} | [
"java.util.Map",
"org.apache.activemq.artemis.api.core.client.ClientMessage"
] | import java.util.Map; import org.apache.activemq.artemis.api.core.client.ClientMessage; | import java.util.*; import org.apache.activemq.artemis.api.core.client.*; | [
"java.util",
"org.apache.activemq"
] | java.util; org.apache.activemq; | 1,654,503 |
public static SystemUiHider getInstance(Activity activity, View anchorView, int flags) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
return new SystemUiHiderHoneycomb(activity, anchorView, flags);
} else {
return new SystemUiHiderBase(activity, anchorView, flags);
}
} | static SystemUiHider function(Activity activity, View anchorView, int flags) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { return new SystemUiHiderHoneycomb(activity, anchorView, flags); } else { return new SystemUiHiderBase(activity, anchorView, flags); } } | /**
* Creates and returns an instance of {@link SystemUiHider} that is
* appropriate for this device. The object will be either a
* {@link SystemUiHiderBase} or {@link SystemUiHiderHoneycomb} depending on
* the device.
*
* @param activity The activity whose window's system UI should be controlled by
* this class.
* @param anchorView The view on which {@link View#setSystemUiVisibility(int)} will
* be called.
* @param flags Either 0 or any combination of {@link #FLAG_FULLSCREEN},
* {@link #FLAG_HIDE_NAVIGATION}, and
* {@link #FLAG_LAYOUT_IN_SCREEN_OLDER_DEVICES}.
*/ | Creates and returns an instance of <code>SystemUiHider</code> that is appropriate for this device. The object will be either a <code>SystemUiHiderBase</code> or <code>SystemUiHiderHoneycomb</code> depending on the device | getInstance | {
"repo_name": "joaomneto/TitanCompanion",
"path": "src/main/java/pt/joaomneto/titancompanion/util/SystemUiHider.java",
"license": "lgpl-3.0",
"size": 5839
} | [
"android.app.Activity",
"android.os.Build",
"android.view.View"
] | import android.app.Activity; import android.os.Build; import android.view.View; | import android.app.*; import android.os.*; import android.view.*; | [
"android.app",
"android.os",
"android.view"
] | android.app; android.os; android.view; | 1,656,836 |
String text;
try {
Parser p = new Parser(documentURL);
NodeFilter nodeFilter;
if (WikiSyntax.valueByAlias(wikiSyntax).equals(WikiSyntax.MEDIAWIKI)) {
nodeFilter = new HasAttributeFilter("id", "bodyContent");
text = HTMLToTextConverter.getPlainTextOfParagraphs(p.parse(nodeFilter).toHtml());
} else if (WikiSyntax.valueByAlias(wikiSyntax).equals(WikiSyntax.TWIKI)) {
nodeFilter = new HasAttributeFilter("id", "patternMainContents");
text = HTMLToTextConverter.getPlainText(p.parse(nodeFilter).toHtml());
} else {
nodeFilter = new TagNameFilter("body");
text = HTMLToTextConverter.getPlainTextOfParagraphs(p.parse(nodeFilter).toHtml());
}
// cutting the text after the limit is reached by finding the next full stop followed by empty spaced.
if (text.length() > limit) {
int cutterPoint = text.indexOf(". ", limit);
if (cutterPoint > -1) {
text = text.substring(0, cutterPoint+1);
}
}
} catch (ParserException e) {
text = "";
e.printStackTrace();
}
return text;
}
| String text; try { Parser p = new Parser(documentURL); NodeFilter nodeFilter; if (WikiSyntax.valueByAlias(wikiSyntax).equals(WikiSyntax.MEDIAWIKI)) { nodeFilter = new HasAttributeFilter("id", STR); text = HTMLToTextConverter.getPlainTextOfParagraphs(p.parse(nodeFilter).toHtml()); } else if (WikiSyntax.valueByAlias(wikiSyntax).equals(WikiSyntax.TWIKI)) { nodeFilter = new HasAttributeFilter("id", STR); text = HTMLToTextConverter.getPlainText(p.parse(nodeFilter).toHtml()); } else { nodeFilter = new TagNameFilter("body"); text = HTMLToTextConverter.getPlainTextOfParagraphs(p.parse(nodeFilter).toHtml()); } if (text.length() > limit) { int cutterPoint = text.indexOf(STR, limit); if (cutterPoint > -1) { text = text.substring(0, cutterPoint+1); } } } catch (ParserException e) { text = ""; e.printStackTrace(); } return text; } | /**
* Generates plain text for the input of keyphrase extractor.
* @param documentURL the URL of the document to encode.
* @param limit after this limit, the text will be cut.
* @param wikiSyntax the wiki syntax
* @return
*/ | Generates plain text for the input of keyphrase extractor | getText | {
"repo_name": "UKPLab/wikulu",
"path": "de.tudarmstadt.ukp.wikulu.wikiapi/src/main/java/de/tudarmstadt/ukp/dkpro/semantics/wiki/util/PlainTextForKeyphrasesExtractionExtractor.java",
"license": "gpl-3.0",
"size": 2982
} | [
"de.tudarmstadt.ukp.dkpro.semantics.wiki.util.constant.WikiSyntax",
"de.tudarmstadt.ukp.dkpro.semantics.wiki.util.helper.HTMLToTextConverter",
"org.htmlparser.NodeFilter",
"org.htmlparser.Parser",
"org.htmlparser.filters.HasAttributeFilter",
"org.htmlparser.filters.TagNameFilter",
"org.htmlparser.util.ParserException"
] | import de.tudarmstadt.ukp.dkpro.semantics.wiki.util.constant.WikiSyntax; import de.tudarmstadt.ukp.dkpro.semantics.wiki.util.helper.HTMLToTextConverter; import org.htmlparser.NodeFilter; import org.htmlparser.Parser; import org.htmlparser.filters.HasAttributeFilter; import org.htmlparser.filters.TagNameFilter; import org.htmlparser.util.ParserException; | import de.tudarmstadt.ukp.dkpro.semantics.wiki.util.constant.*; import de.tudarmstadt.ukp.dkpro.semantics.wiki.util.helper.*; import org.htmlparser.*; import org.htmlparser.filters.*; import org.htmlparser.util.*; | [
"de.tudarmstadt.ukp",
"org.htmlparser",
"org.htmlparser.filters",
"org.htmlparser.util"
] | de.tudarmstadt.ukp; org.htmlparser; org.htmlparser.filters; org.htmlparser.util; | 592,176 |
RandomVariableInterface[] getInitialState(); | RandomVariableInterface[] getInitialState(); | /**
* Returns the initial value of the state variable of the process <i>Y</i>, not to be
* confused with the initial value of the model <i>X</i> (which is the state space transform
* applied to this state value.
*
* @return The initial value of the state variable of the process <i>Y(t=0)</i>.
*/ | Returns the initial value of the state variable of the process Y, not to be confused with the initial value of the model X (which is the state space transform applied to this state value | getInitialState | {
"repo_name": "BBreiden/finmath-lib",
"path": "src/main/java6/net/finmath/montecarlo/model/AbstractModelInterface.java",
"license": "apache-2.0",
"size": 7694
} | [
"net.finmath.stochastic.RandomVariableInterface"
] | import net.finmath.stochastic.RandomVariableInterface; | import net.finmath.stochastic.*; | [
"net.finmath.stochastic"
] | net.finmath.stochastic; | 2,250,715 |
@Override
public boolean equals(@Nullable final Object object)
{
final boolean result =
equals(
object,
getThreadBasedHashCode(),
buildThreadBasedHashCode(
Thread.currentThread()),
getTargetDataSource());
return result;
} | boolean function(@Nullable final Object object) { final boolean result = equals( object, getThreadBasedHashCode(), buildThreadBasedHashCode( Thread.currentThread()), getTargetDataSource()); return result; } | /**
* Checks if the data source is equal logically to given object.
* @param object the object to compare to.
* @return true if both data sources represents the same entity.
*/ | Checks if the data source is equal logically to given object | equals | {
"repo_name": "rydnr/queryj-sql",
"path": "src/main/java/org/acmsl/queryj/sql/dao/ThreadAwareDataSourceWrapper.java",
"license": "gpl-3.0",
"size": 11312
} | [
"org.jetbrains.annotations.Nullable"
] | import org.jetbrains.annotations.Nullable; | import org.jetbrains.annotations.*; | [
"org.jetbrains.annotations"
] | org.jetbrains.annotations; | 2,600,439 |
public ItemBuilder setLeatherArmorColor(Color color){
try{
LeatherArmorMeta im = (LeatherArmorMeta)is.getItemMeta();
im.setColor(color);
is.setItemMeta(im);
}catch(ClassCastException expected){}
return this;
} | ItemBuilder function(Color color){ try{ LeatherArmorMeta im = (LeatherArmorMeta)is.getItemMeta(); im.setColor(color); is.setItemMeta(im); }catch(ClassCastException expected){} return this; } | /**
* Sets the armor color of a leather armor piece. Works only on leather armor pieces.
* @param color The color to set it to.
*/ | Sets the armor color of a leather armor piece. Works only on leather armor pieces | setLeatherArmorColor | {
"repo_name": "EvanTheOG/RevolutionCore",
"path": "src/me/evanog/revolutioncore/utils/ItemBuilder.java",
"license": "mit",
"size": 7215
} | [
"org.bukkit.Color",
"org.bukkit.inventory.meta.LeatherArmorMeta"
] | import org.bukkit.Color; import org.bukkit.inventory.meta.LeatherArmorMeta; | import org.bukkit.*; import org.bukkit.inventory.meta.*; | [
"org.bukkit",
"org.bukkit.inventory"
] | org.bukkit; org.bukkit.inventory; | 1,698,396 |
RESULT_TYPE visitInterestRateFutureOptionMarginTransactionDefinition(InterestRateFutureOptionMarginTransactionDefinition futureOption, DATA_TYPE data); | RESULT_TYPE visitInterestRateFutureOptionMarginTransactionDefinition(InterestRateFutureOptionMarginTransactionDefinition futureOption, DATA_TYPE data); | /**
* Interest rate future option with margin transaction method that takes data.
* @param futureOption An interest rate future option with margin transaction
* @param data The data
* @return The result
*/ | Interest rate future option with margin transaction method that takes data | visitInterestRateFutureOptionMarginTransactionDefinition | {
"repo_name": "jerome79/OG-Platform",
"path": "projects/OG-Analytics/src/main/java/com/opengamma/analytics/financial/instrument/InstrumentDefinitionVisitor.java",
"license": "apache-2.0",
"size": 78879
} | [
"com.opengamma.analytics.financial.instrument.future.InterestRateFutureOptionMarginTransactionDefinition"
] | import com.opengamma.analytics.financial.instrument.future.InterestRateFutureOptionMarginTransactionDefinition; | import com.opengamma.analytics.financial.instrument.future.*; | [
"com.opengamma.analytics"
] | com.opengamma.analytics; | 2,216,799 |
private static String createSamePackageRegexp(int firstPackageDomainsCount,
DetailAST packageNode) {
final String packageFullPath = getFullImportIdent(packageNode);
return getFirstDomainsFromIdent(firstPackageDomainsCount, packageFullPath);
} | static String function(int firstPackageDomainsCount, DetailAST packageNode) { final String packageFullPath = getFullImportIdent(packageNode); return getFirstDomainsFromIdent(firstPackageDomainsCount, packageFullPath); } | /**
* Creates samePackageDomainsRegExp of the first package domains.
* @param firstPackageDomainsCount
* number of first package domains.
* @param packageNode
* package node.
* @return same package regexp.
*/ | Creates samePackageDomainsRegExp of the first package domains | createSamePackageRegexp | {
"repo_name": "liscju/checkstyle",
"path": "src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheck.java",
"license": "lgpl-2.1",
"size": 33535
} | [
"com.puppycrawl.tools.checkstyle.api.DetailAST"
] | import com.puppycrawl.tools.checkstyle.api.DetailAST; | import com.puppycrawl.tools.checkstyle.api.*; | [
"com.puppycrawl.tools"
] | com.puppycrawl.tools; | 1,354,386 |
@Test
public void testEventIDPrapogationOnServerDuringRegionClear() {
clearRegion();
Boolean pass = (Boolean) vm0.invoke(() -> EventIDVerificationDUnitTest.verifyResult());
assertTrue(pass.booleanValue());
pass = (Boolean) vm1.invoke(() -> EventIDVerificationDUnitTest.verifyResult());
assertTrue(pass.booleanValue());
} | void function() { clearRegion(); Boolean pass = (Boolean) vm0.invoke(() -> EventIDVerificationDUnitTest.verifyResult()); assertTrue(pass.booleanValue()); pass = (Boolean) vm1.invoke(() -> EventIDVerificationDUnitTest.verifyResult()); assertTrue(pass.booleanValue()); } | /**
* Verify that EventId is prapogated to server in case of region clear. It also checks that peer
* nodes also get the same EventID.
*
*/ | Verify that EventId is prapogated to server in case of region clear. It also checks that peer nodes also get the same EventID | testEventIDPrapogationOnServerDuringRegionClear | {
"repo_name": "smgoller/geode",
"path": "geode-core/src/distributedTest/java/org/apache/geode/internal/cache/tier/sockets/EventIDVerificationDUnitTest.java",
"license": "apache-2.0",
"size": 15972
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,697,795 |
public static void queueUserMessageFromNode(AdhocData<AdhocFind> userPacket){
userMessagesFromPhone.add(userPacket);
Log.i(TAG, " Queued user message");
synchronized (queueLock) {
queueLock.notify();
}
}
| static void function(AdhocData<AdhocFind> userPacket){ userMessagesFromPhone.add(userPacket); Log.i(TAG, STR); synchronized (queueLock) { queueLock.notify(); } } | /**
* Used by the application layer to queue messages that are to be handled by
* the RWG protocol.
* @param userPacket
*/ | Used by the application layer to queue messages that are to be handled by the RWG protocol | queueUserMessageFromNode | {
"repo_name": "sanyaade-g2g-repos/posit-mobile.haiti",
"path": "src/org/hfoss/posit/rwg/RwgSender.java",
"license": "lgpl-2.1",
"size": 7572
} | [
"android.util.Log",
"org.hfoss.adhoc.AdhocData",
"org.hfoss.adhoc.AdhocFind"
] | import android.util.Log; import org.hfoss.adhoc.AdhocData; import org.hfoss.adhoc.AdhocFind; | import android.util.*; import org.hfoss.adhoc.*; | [
"android.util",
"org.hfoss.adhoc"
] | android.util; org.hfoss.adhoc; | 2,445,433 |
public void initializeThisValue(AnnotationMirror a, TypeMirror underlyingType) {
if (a != null) {
thisValue = analysis.createSingleAnnotationValue(a, underlyingType);
}
} | void function(AnnotationMirror a, TypeMirror underlyingType) { if (a != null) { thisValue = analysis.createSingleAnnotationValue(a, underlyingType); } } | /**
* Set the value of the current object. Any previous information is erased;
* this method should only be used to initialize the value.
*/ | Set the value of the current object. Any previous information is erased; this method should only be used to initialize the value | initializeThisValue | {
"repo_name": "pbsf/checker-framework",
"path": "framework/src/org/checkerframework/framework/flow/CFAbstractStore.java",
"license": "gpl-2.0",
"size": 43819
} | [
"javax.lang.model.element.AnnotationMirror",
"javax.lang.model.type.TypeMirror"
] | import javax.lang.model.element.AnnotationMirror; import javax.lang.model.type.TypeMirror; | import javax.lang.model.element.*; import javax.lang.model.type.*; | [
"javax.lang"
] | javax.lang; | 270,317 |
public void visit(SmcTransition transition)
{
SmcState state = transition.getState();
SmcMap map = state.getMap();
String packageName = map.getFSM().getPackage();
String context = map.getFSM().getContext();
String fsmClassName = map.getFSM().getFsmClassName();
String mapName = map.getName();
String stateName = state.getInstanceName();
String transName = transition.getName();
boolean nullCondition = false;
List<SmcGuard> guards = transition.getGuards();
Iterator<SmcGuard> git;
SmcGuard guard;
// If a package has been specified,
if (packageName != null && packageName.length() > 0)
{
context = packageName + "_" + context;
fsmClassName = packageName + "_" + fsmClassName;
mapName = packageName + "_" + mapName;
}
if (stateName.equals("DefaultState") == false)
{
_source.println();
_source.print("#undef ");
_source.print(mapName);
_source.print("_");
_source.print(stateName);
_source.print("_");
_source.println(transName);
}
_source.print("static void ");
_source.print(mapName);
_source.print("_");
_source.print(stateName);
_source.print("_");
_source.print(transName);
_source.print("(struct ");
_source.print(fsmClassName);
_source.print(" *fsm");
// Add user-defined parameters.
for (SmcParameter parameter: transition.getParameters())
{
_source.print(", ");
parameter.accept(this);
}
_source.println(")");
_source.println("{");
// All transitions have a "ctxt" local variable.
// 8/14/2003:
// Do this only if there are any transition actions or
// guard conditions which reference it.
if (transition.hasCtxtReference() == true)
{
_source.print(" struct ");
_source.print(context);
_source.println("* ctxt = getOwner(fsm);");
}
// ANSI C requires all local variables be declared
// at the code block's start before any control
// statements. If this transition appears only once
// in the state, has at least one action and it is a
// loopback and debugging is on, then visit(SmcGuard)
// will generate a local variable declaration after the
// debug if clause - an ANSI syntax error.
// So we need to check if this transition meets that
// condition and generate the local variable declaration
// here rather than in visit(SmcGuard).
//
// Note: when guard count is > 1, then the guard code
// is placed into an if or else block - and so the
// end state variable will appear at the start of that
// block, nullifying the debug if clauses affect.
_guardCount = guards.size();
if (_guardCount == 1)
{
guard = (SmcGuard) guards.get(0);
if (guard.getActions().isEmpty() == false &&
isLoopback(
guard.getTransType(), guard.getEndState())
== true)
{
_source.print(" const struct ");
_source.print(context);
_source.println(
"State* EndStateName = getState(fsm);");
}
}
_source.println();
// Print the transition to the verbose log.
if (_debugLevel >= DEBUG_LEVEL_0)
{
_source.println(" if (getDebugFlag(fsm) != 0) {");
_source.print(" TRACE(\"LEAVING STATE : ");
_source.print(mapName);
_source.print("_");
_source.print(stateName);
_source.println(")\\n\");");
_source.println(" }");
}
// Loop through the guards and print each one.
for (git = guards.iterator(), _guardIndex = 0;
git.hasNext() == true;
++_guardIndex)
{
guard = git.next();
// Count up the number of guards with no condition.
if (guard.getCondition().length() == 0)
{
nullCondition = true;
}
guard.accept(this);
}
// If all guards have a condition, then create a final
// "else" clause which passes control to the default
// transition.
if (_guardIndex > 0 && nullCondition == false)
{
// If there is only one transition definition, then
// close off the guard.
if (_guardCount == 1)
{
_source.println(" }");
}
_source.println(" else {");
_source.print(" ");
if (stateName.equals("DefaultState") == false)
{
_source.print(mapName);
_source.print("_DefaultState_");
}
else
{
_source.print(context);
_source.print("State_");
}
_source.print(transName);
_source.print("(fsm");
// Output user-defined parameters.
for (SmcParameter param: transition.getParameters())
{
_source.print(", ");
_source.print(param.getName());
}
_source.println(");");
_source.println(" }");
}
else if (_guardCount > 1)
{
_source.println();
}
_source.println("}");
return;
} // end of visit(SmcTransition) | void function(SmcTransition transition) { SmcState state = transition.getState(); SmcMap map = state.getMap(); String packageName = map.getFSM().getPackage(); String context = map.getFSM().getContext(); String fsmClassName = map.getFSM().getFsmClassName(); String mapName = map.getName(); String stateName = state.getInstanceName(); String transName = transition.getName(); boolean nullCondition = false; List<SmcGuard> guards = transition.getGuards(); Iterator<SmcGuard> git; SmcGuard guard; if (packageName != null && packageName.length() > 0) { context = packageName + "_" + context; fsmClassName = packageName + "_" + fsmClassName; mapName = packageName + "_" + mapName; } if (stateName.equals(STR) == false) { _source.println(); _source.print(STR); _source.print(mapName); _source.print("_"); _source.print(stateName); _source.print("_"); _source.println(transName); } _source.print(STR); _source.print(mapName); _source.print("_"); _source.print(stateName); _source.print("_"); _source.print(transName); _source.print(STR); _source.print(fsmClassName); _source.print(STR); for (SmcParameter parameter: transition.getParameters()) { _source.print(STR); parameter.accept(this); } _source.println(")"); _source.println("{"); if (transition.hasCtxtReference() == true) { _source.print(STR); _source.print(context); _source.println(STR); } _guardCount = guards.size(); if (_guardCount == 1) { guard = (SmcGuard) guards.get(0); if (guard.getActions().isEmpty() == false && isLoopback( guard.getTransType(), guard.getEndState()) == true) { _source.print(STR); _source.print(context); _source.println( STR); } } _source.println(); if (_debugLevel >= DEBUG_LEVEL_0) { _source.println(STR); _source.print(STRLEAVING STATE : STR_STR)\\n\");"); _source.println(STR); } for (git = guards.iterator(), _guardIndex = 0; git.hasNext() == true; ++_guardIndex) { guard = git.next(); if (guard.getCondition().length() == 0) { nullCondition = true; } guard.accept(this); } if (_guardIndex > 0 && nullCondition == false) { if (_guardCount == 1) { _source.println(STR); } _source.println(STR); _source.print(" "); if (stateName.equals(STR) == false) { _source.print(mapName); _source.print(STR); } else { _source.print(context); _source.print(STR); } _source.print(transName); _source.print("(fsm"); for (SmcParameter param: transition.getParameters()) { _source.print(STR); _source.print(param.getName()); } _source.println(");"); _source.println(STR); } else if (_guardCount > 1) { _source.println(); } _source.println("}"); return; } | /**
* Emits C code for this FSM transition. Generates the
* transition subroutine and then each of the guards within
* that routine.
* @param transition emit C code for this FSM transition.
*/ | Emits C code for this FSM transition. Generates the transition subroutine and then each of the guards within that routine | visit | {
"repo_name": "Praveen-1987/devstack-Quantumleap",
"path": "smc/net/sf/smc/generator/SmcCGenerator.java",
"license": "apache-2.0",
"size": 51242
} | [
"java.util.Iterator",
"java.util.List",
"net.sf.smc.model.SmcGuard",
"net.sf.smc.model.SmcMap",
"net.sf.smc.model.SmcParameter",
"net.sf.smc.model.SmcState",
"net.sf.smc.model.SmcTransition"
] | import java.util.Iterator; import java.util.List; import net.sf.smc.model.SmcGuard; import net.sf.smc.model.SmcMap; import net.sf.smc.model.SmcParameter; import net.sf.smc.model.SmcState; import net.sf.smc.model.SmcTransition; | import java.util.*; import net.sf.smc.model.*; | [
"java.util",
"net.sf.smc"
] | java.util; net.sf.smc; | 2,656,240 |
@Test
public void testRecoverableErrorThrownWithNoFallback() {
TestHystrixCommand<?> command = getRecoverableErrorCommand(ExecutionIsolationStrategy.THREAD, AbstractTestHystrixCommand.FallbackResult.UNIMPLEMENTED);
try {
command.execute();
fail("we expect to receive a " + Error.class.getSimpleName());
} catch (Exception e) {
// the actual error is an extra cause level deep because Hystrix needs to wrap Throwable/Error as it's public
// methods only support Exception and it's not a strong enough reason to break backwards compatibility and jump to version 2.x
// so HystrixRuntimeException -> wrapper Exception -> actual Error
assertEquals("Execution ERROR for TestHystrixCommand", e.getCause().getCause().getMessage());
}
assertEquals("Execution ERROR for TestHystrixCommand", command.getFailedExecutionException().getCause().getMessage());
assertTrue(command.getExecutionTimeInMilliseconds() > -1);
assertTrue(command.isFailedExecution());
assertEquals(0, command.metrics.getRollingCount(HystrixRollingNumberEvent.SUCCESS));
assertEquals(1, command.metrics.getRollingCount(HystrixRollingNumberEvent.FAILURE));
assertEquals(1, command.metrics.getRollingCount(HystrixRollingNumberEvent.EXCEPTION_THROWN));
assertEquals(0, command.metrics.getRollingCount(HystrixRollingNumberEvent.BAD_REQUEST));
assertEquals(0, command.metrics.getCurrentConcurrentExecutionCount());
} | void function() { TestHystrixCommand<?> command = getRecoverableErrorCommand(ExecutionIsolationStrategy.THREAD, AbstractTestHystrixCommand.FallbackResult.UNIMPLEMENTED); try { command.execute(); fail(STR + Error.class.getSimpleName()); } catch (Exception e) { assertEquals(STR, e.getCause().getCause().getMessage()); } assertEquals(STR, command.getFailedExecutionException().getCause().getMessage()); assertTrue(command.getExecutionTimeInMilliseconds() > -1); assertTrue(command.isFailedExecution()); assertEquals(0, command.metrics.getRollingCount(HystrixRollingNumberEvent.SUCCESS)); assertEquals(1, command.metrics.getRollingCount(HystrixRollingNumberEvent.FAILURE)); assertEquals(1, command.metrics.getRollingCount(HystrixRollingNumberEvent.EXCEPTION_THROWN)); assertEquals(0, command.metrics.getRollingCount(HystrixRollingNumberEvent.BAD_REQUEST)); assertEquals(0, command.metrics.getCurrentConcurrentExecutionCount()); } | /**
* Test a recoverable java.lang.Error being thrown with no fallback
*/ | Test a recoverable java.lang.Error being thrown with no fallback | testRecoverableErrorThrownWithNoFallback | {
"repo_name": "manwithharmonica/Hystrix",
"path": "hystrix-core/src/test/java/com/netflix/hystrix/HystrixCommandTest.java",
"license": "apache-2.0",
"size": 265467
} | [
"com.netflix.hystrix.HystrixCommandProperties",
"com.netflix.hystrix.util.HystrixRollingNumberEvent",
"org.junit.Assert"
] | import com.netflix.hystrix.HystrixCommandProperties; import com.netflix.hystrix.util.HystrixRollingNumberEvent; import org.junit.Assert; | import com.netflix.hystrix.*; import com.netflix.hystrix.util.*; import org.junit.*; | [
"com.netflix.hystrix",
"org.junit"
] | com.netflix.hystrix; org.junit; | 920,219 |
public Thread startNewThread() {
final Thread thread = new Log4jThread(this);
thread.start();
return thread;
} | Thread function() { final Thread thread = new Log4jThread(this); thread.start(); return thread; } | /**
* Start this server in a new thread.
*
* @return the new thread that running this server.
*/ | Start this server in a new thread | startNewThread | {
"repo_name": "lqbweb/logging-log4j2",
"path": "log4j-core/src/main/java/org/apache/logging/log4j/core/net/server/AbstractSocketServer.java",
"license": "apache-2.0",
"size": 4700
} | [
"org.apache.logging.log4j.core.util.Log4jThread"
] | import org.apache.logging.log4j.core.util.Log4jThread; | import org.apache.logging.log4j.core.util.*; | [
"org.apache.logging"
] | org.apache.logging; | 2,800,946 |
private void cleanup() {
if (request.getDestination() != null) {
File dest = new File(request.getDestination());
if (dest.exists()) {
boolean rc = dest.delete();
Log.d(TAG, "Deleted file " + dest.getName() + "; Result: "
+ rc);
} else {
Log.d(TAG, "cleanup() didn't delete file: does not exist.");
}
}
} | void function() { if (request.getDestination() != null) { File dest = new File(request.getDestination()); if (dest.exists()) { boolean rc = dest.delete(); Log.d(TAG, STR + dest.getName() + STR + rc); } else { Log.d(TAG, STR); } } } | /**
* Deletes unfinished downloads.
*/ | Deletes unfinished downloads | cleanup | {
"repo_name": "TimB0/AntennaPod",
"path": "core/src/main/java/de/danoeh/antennapod/core/service/download/HttpDownloader.java",
"license": "mit",
"size": 15525
} | [
"android.util.Log",
"java.io.File"
] | import android.util.Log; import java.io.File; | import android.util.*; import java.io.*; | [
"android.util",
"java.io"
] | android.util; java.io; | 1,022,574 |
public List<T> findAll();
| List<T> function(); | /**
* Method that return a list with all Entities.
*
* @return list of user entity.
*/ | Method that return a list with all Entities | findAll | {
"repo_name": "tuliobraga/tech-gallery",
"path": "src/main/java/com/ciandt/techgallery/persistence/dao/GenericDAO.java",
"license": "apache-2.0",
"size": 1038
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,597,656 |
public static Database inMemory(String name) {
return inMemory(name, ImmutableMap.<String, Object>of());
} | static Database function(String name) { return inMemory(name, ImmutableMap.<String, Object>of()); } | /**
* Create an in-memory H2 database.
*
* @param name the database name
* @return a configured in-memory h2 database
*/ | Create an in-memory H2 database | inMemory | {
"repo_name": "benmccann/playframework",
"path": "persistence/play-java-jdbc/src/main/java/play/db/Databases.java",
"license": "apache-2.0",
"size": 6202
} | [
"com.google.common.collect.ImmutableMap"
] | import com.google.common.collect.ImmutableMap; | import com.google.common.collect.*; | [
"com.google.common"
] | com.google.common; | 2,522,388 |
static GoalDecider getGoalDecider(final AIUnit aiUnit,
final boolean deferOK) {
GoalDecider gd = new GoalDecider() {
private PathNode bestPath = null;
private int bestValue = Integer.MIN_VALUE;
@Override
public PathNode getGoal() { return bestPath; } | static GoalDecider getGoalDecider(final AIUnit aiUnit, final boolean deferOK) { GoalDecider gd = new GoalDecider() { private PathNode bestPath = null; private int bestValue = Integer.MIN_VALUE; public PathNode getGoal() { return bestPath; } | /**
* Makes a goal decider that checks cash in sites.
*
* @param aiUnit The <code>AIUnit</code> to search with.
* @param deferOK Keep track of the nearest colonies to use as a
* fallback destination.
* @return A suitable <code>GoalDecider</code>.
*/ | Makes a goal decider that checks cash in sites | getGoalDecider | {
"repo_name": "edijman/SOEN_6431_Colonization_Game",
"path": "src/net/sf/freecol/server/ai/mission/CashInTreasureTrainMission.java",
"license": "gpl-2.0",
"size": 17399
} | [
"net.sf.freecol.common.model.PathNode",
"net.sf.freecol.common.model.pathfinding.GoalDecider",
"net.sf.freecol.server.ai.AIUnit"
] | import net.sf.freecol.common.model.PathNode; import net.sf.freecol.common.model.pathfinding.GoalDecider; import net.sf.freecol.server.ai.AIUnit; | import net.sf.freecol.common.model.*; import net.sf.freecol.common.model.pathfinding.*; import net.sf.freecol.server.ai.*; | [
"net.sf.freecol"
] | net.sf.freecol; | 1,136,738 |
@Test
public void testPDF417CodeWidthModifiedSizeAndImageType() throws Exception {
out.reset();
out.expectedBodiesReceived(MSG);
image.expectedMessageCount(1);
template.sendBody("direct:code4", MSG);
assertMockEndpointsSatisfied(60, TimeUnit.SECONDS);
this.checkImage(image, "JPEG", BarcodeFormat.PDF_417);
} | void function() throws Exception { out.reset(); out.expectedBodiesReceived(MSG); image.expectedMessageCount(1); template.sendBody(STR, MSG); assertMockEndpointsSatisfied(60, TimeUnit.SECONDS); this.checkImage(image, "JPEG", BarcodeFormat.PDF_417); } | /**
* tests barcode (PDF-417) with modiefied size and image taype generation and reading.
*
* @throws Exception
*/ | tests barcode (PDF-417) with modiefied size and image taype generation and reading | testPDF417CodeWidthModifiedSizeAndImageType | {
"repo_name": "coderczp/camel",
"path": "components/camel-barcode/src/test/java/org/apache/camel/dataformat/barcode/BarcodeDataFormatCamelTest.java",
"license": "apache-2.0",
"size": 6581
} | [
"com.google.zxing.BarcodeFormat",
"java.util.concurrent.TimeUnit"
] | import com.google.zxing.BarcodeFormat; import java.util.concurrent.TimeUnit; | import com.google.zxing.*; import java.util.concurrent.*; | [
"com.google.zxing",
"java.util"
] | com.google.zxing; java.util; | 418,354 |
@SuppressWarnings("unchecked")
GridQueryFieldsResult queryLocalSqlFields(final String schemaName, final String qry,
@Nullable final Collection<Object> params, final IndexingQueryFilter filter, boolean enforceJoinOrder,
final int timeout, final GridQueryCancel cancel) throws IgniteCheckedException {
final Connection conn = connectionForSchema(schemaName);
H2Utils.setupConnection(conn, false, enforceJoinOrder);
final PreparedStatement stmt = preparedStatementWithParams(conn, qry, params, true);
if (GridSqlQueryParser.checkMultipleStatements(stmt))
throw new IgniteSQLException("Multiple statements queries are not supported for local queries");
Prepared p = GridSqlQueryParser.prepared(stmt);
if (DmlStatementsProcessor.isDmlStatement(p)) {
SqlFieldsQuery fldsQry = new SqlFieldsQuery(qry);
if (params != null)
fldsQry.setArgs(params.toArray());
fldsQry.setEnforceJoinOrder(enforceJoinOrder);
fldsQry.setTimeout(timeout, TimeUnit.MILLISECONDS);
return dmlProc.updateSqlFieldsLocal(schemaName, conn, p, fldsQry, filter, cancel);
}
else if (DdlStatementsProcessor.isDdlStatement(p))
throw new IgniteSQLException("DDL statements are supported for the whole cluster only",
IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
List<GridQueryFieldMetadata> meta;
try {
meta = H2Utils.meta(stmt.getMetaData());
}
catch (SQLException e) {
throw new IgniteCheckedException("Cannot prepare query metadata", e);
}
final GridH2QueryContext ctx = new GridH2QueryContext(nodeId, nodeId, 0, LOCAL)
.filter(filter).distributedJoinMode(OFF); | @SuppressWarnings(STR) GridQueryFieldsResult queryLocalSqlFields(final String schemaName, final String qry, @Nullable final Collection<Object> params, final IndexingQueryFilter filter, boolean enforceJoinOrder, final int timeout, final GridQueryCancel cancel) throws IgniteCheckedException { final Connection conn = connectionForSchema(schemaName); H2Utils.setupConnection(conn, false, enforceJoinOrder); final PreparedStatement stmt = preparedStatementWithParams(conn, qry, params, true); if (GridSqlQueryParser.checkMultipleStatements(stmt)) throw new IgniteSQLException(STR); Prepared p = GridSqlQueryParser.prepared(stmt); if (DmlStatementsProcessor.isDmlStatement(p)) { SqlFieldsQuery fldsQry = new SqlFieldsQuery(qry); if (params != null) fldsQry.setArgs(params.toArray()); fldsQry.setEnforceJoinOrder(enforceJoinOrder); fldsQry.setTimeout(timeout, TimeUnit.MILLISECONDS); return dmlProc.updateSqlFieldsLocal(schemaName, conn, p, fldsQry, filter, cancel); } else if (DdlStatementsProcessor.isDdlStatement(p)) throw new IgniteSQLException(STR, IgniteQueryErrorCode.UNSUPPORTED_OPERATION); List<GridQueryFieldMetadata> meta; try { meta = H2Utils.meta(stmt.getMetaData()); } catch (SQLException e) { throw new IgniteCheckedException(STR, e); } final GridH2QueryContext ctx = new GridH2QueryContext(nodeId, nodeId, 0, LOCAL) .filter(filter).distributedJoinMode(OFF); | /**
* Queries individual fields (generally used by JDBC drivers).
*
* @param schemaName Schema name.
* @param qry Query.
* @param params Query parameters.
* @param filter Cache name and key filter.
* @param enforceJoinOrder Enforce join order of tables in the query.
* @param timeout Query timeout in milliseconds.
* @param cancel Query cancel.
* @return Query result.
* @throws IgniteCheckedException If failed.
*/ | Queries individual fields (generally used by JDBC drivers) | queryLocalSqlFields | {
"repo_name": "sk0x50/ignite",
"path": "modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java",
"license": "apache-2.0",
"size": 114428
} | [
"java.sql.Connection",
"java.sql.PreparedStatement",
"java.sql.SQLException",
"java.util.Collection",
"java.util.List",
"java.util.concurrent.TimeUnit",
"org.apache.ignite.IgniteCheckedException",
"org.apache.ignite.cache.query.SqlFieldsQuery",
"org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode",
"org.apache.ignite.internal.processors.query.GridQueryCancel",
"org.apache.ignite.internal.processors.query.GridQueryFieldMetadata",
"org.apache.ignite.internal.processors.query.GridQueryFieldsResult",
"org.apache.ignite.internal.processors.query.IgniteSQLException",
"org.apache.ignite.internal.processors.query.h2.ddl.DdlStatementsProcessor",
"org.apache.ignite.internal.processors.query.h2.opt.DistributedJoinMode",
"org.apache.ignite.internal.processors.query.h2.opt.GridH2QueryContext",
"org.apache.ignite.internal.processors.query.h2.sql.GridSqlQueryParser",
"org.apache.ignite.spi.indexing.IndexingQueryFilter",
"org.h2.command.Prepared",
"org.jetbrains.annotations.Nullable"
] | import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.Collection; import java.util.List; import java.util.concurrent.TimeUnit; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.cache.query.SqlFieldsQuery; import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode; import org.apache.ignite.internal.processors.query.GridQueryCancel; import org.apache.ignite.internal.processors.query.GridQueryFieldMetadata; import org.apache.ignite.internal.processors.query.GridQueryFieldsResult; import org.apache.ignite.internal.processors.query.IgniteSQLException; import org.apache.ignite.internal.processors.query.h2.ddl.DdlStatementsProcessor; import org.apache.ignite.internal.processors.query.h2.opt.DistributedJoinMode; import org.apache.ignite.internal.processors.query.h2.opt.GridH2QueryContext; import org.apache.ignite.internal.processors.query.h2.sql.GridSqlQueryParser; import org.apache.ignite.spi.indexing.IndexingQueryFilter; import org.h2.command.Prepared; import org.jetbrains.annotations.Nullable; | import java.sql.*; import java.util.*; import java.util.concurrent.*; import org.apache.ignite.*; import org.apache.ignite.cache.query.*; import org.apache.ignite.internal.processors.cache.query.*; import org.apache.ignite.internal.processors.query.*; import org.apache.ignite.internal.processors.query.h2.ddl.*; import org.apache.ignite.internal.processors.query.h2.opt.*; import org.apache.ignite.internal.processors.query.h2.sql.*; import org.apache.ignite.spi.indexing.*; import org.h2.command.*; import org.jetbrains.annotations.*; | [
"java.sql",
"java.util",
"org.apache.ignite",
"org.h2.command",
"org.jetbrains.annotations"
] | java.sql; java.util; org.apache.ignite; org.h2.command; org.jetbrains.annotations; | 2,681,976 |
@Override
public void setCharacterEncoding(String enc)
throws UnsupportedEncodingException {
if (usingReader) {
return;
}
// Ensure that the specified encoding is valid
byte buffer[] = new byte[1];
buffer[0] = (byte) 'a';
// Confirm that the encoding name is valid
B2CConverter.getCharset(enc);
// Save the validated encoding
coyoteRequest.setCharacterEncoding(enc);
} | void function(String enc) throws UnsupportedEncodingException { if (usingReader) { return; } byte buffer[] = new byte[1]; buffer[0] = (byte) 'a'; B2CConverter.getCharset(enc); coyoteRequest.setCharacterEncoding(enc); } | /**
* Overrides the name of the character encoding used in the body of
* this request. This method must be called prior to reading request
* parameters or reading input using <code>getReader()</code>.
*
* @param enc The character encoding to be used
*
* @exception UnsupportedEncodingException if the specified encoding
* is not supported
*
* @since Servlet 2.3
*/ | Overrides the name of the character encoding used in the body of this request. This method must be called prior to reading request parameters or reading input using <code>getReader()</code> | setCharacterEncoding | {
"repo_name": "wenzhucjy/tomcat_source",
"path": "tomcat-7.0.63-sourcecode/target/classes/org/apache/catalina/connector/Request.java",
"license": "apache-2.0",
"size": 101883
} | [
"java.io.UnsupportedEncodingException",
"org.apache.tomcat.util.buf.B2CConverter"
] | import java.io.UnsupportedEncodingException; import org.apache.tomcat.util.buf.B2CConverter; | import java.io.*; import org.apache.tomcat.util.buf.*; | [
"java.io",
"org.apache.tomcat"
] | java.io; org.apache.tomcat; | 1,895,528 |
public void draw(Graphics g)
{
g.setColor(backgroundcolor);//set the backgroundimage
g.fillRect(0, 0, gc.getWidth(), gc.getHeight());//draw the backgrund
if(normalBackground != null)//if there is a background
{g.drawImage(normalBackground, 0, 0);}//draw the backgroundimage
}
| void function(Graphics g) { g.setColor(backgroundcolor); g.fillRect(0, 0, gc.getWidth(), gc.getHeight()); if(normalBackground != null) {g.drawImage(normalBackground, 0, 0);} } | /** draw the background
* @param g the graphics
*/ | draw the background | draw | {
"repo_name": "krakdustten/JAVA-GAME",
"path": "JAVA-GAME/src/drawers/BackGround.java",
"license": "epl-1.0",
"size": 1214
} | [
"org.newdawn.slick.Graphics"
] | import org.newdawn.slick.Graphics; | import org.newdawn.slick.*; | [
"org.newdawn.slick"
] | org.newdawn.slick; | 571,254 |
protected static String buildGroupBy(Query q, DatabaseSchema schema,
State state) throws ObjectStoreException {
StringBuffer retval = new StringBuffer();
boolean needComma = false;
for (QueryNode node : q.getGroupBy()) {
retval.append(needComma ? ", " : " GROUP BY ");
needComma = true;
if (node instanceof QueryClass) {
queryClassToString(retval, (QueryClass) node, q, schema, NO_ALIASES_ALL_FIELDS,
state);
} else {
queryEvaluableToString(retval, (QueryEvaluable) node, q, state);
}
}
return retval.toString();
} | static String function(Query q, DatabaseSchema schema, State state) throws ObjectStoreException { StringBuffer retval = new StringBuffer(); boolean needComma = false; for (QueryNode node : q.getGroupBy()) { retval.append(needComma ? STR : STR); needComma = true; if (node instanceof QueryClass) { queryClassToString(retval, (QueryClass) node, q, schema, NO_ALIASES_ALL_FIELDS, state); } else { queryEvaluableToString(retval, (QueryEvaluable) node, q, state); } } return retval.toString(); } | /**
* Builds a String representing the GROUP BY component of the Sql query.
*
* @param q the Query
* @param schema the DatabaseSchema in which to look up metadata
* @param state a State object
* @return a String
* @throws ObjectStoreException if something goes wrong
*/ | Builds a String representing the GROUP BY component of the Sql query | buildGroupBy | {
"repo_name": "drhee/toxoMine",
"path": "intermine/objectstore/main/src/org/intermine/objectstore/intermine/SqlGenerator.java",
"license": "lgpl-2.1",
"size": 134620
} | [
"org.intermine.objectstore.ObjectStoreException",
"org.intermine.objectstore.query.Query",
"org.intermine.objectstore.query.QueryClass",
"org.intermine.objectstore.query.QueryEvaluable",
"org.intermine.objectstore.query.QueryNode"
] | import org.intermine.objectstore.ObjectStoreException; import org.intermine.objectstore.query.Query; import org.intermine.objectstore.query.QueryClass; import org.intermine.objectstore.query.QueryEvaluable; import org.intermine.objectstore.query.QueryNode; | import org.intermine.objectstore.*; import org.intermine.objectstore.query.*; | [
"org.intermine.objectstore"
] | org.intermine.objectstore; | 166,151 |
public Drawer withListView(ListView listView) {
this.mListView = listView;
return this;
}
// an adapter to use for the list
protected BaseDrawerAdapter mAdapter; | Drawer function(ListView listView) { this.mListView = listView; return this; } protected BaseDrawerAdapter mAdapter; | /**
* Set the list which is added within the slider
*
* @param listView
* @return
*/ | Set the list which is added within the slider | withListView | {
"repo_name": "aaaliua/MaterialDrawer",
"path": "library/src/main/java/com/mikepenz/materialdrawer/Drawer.java",
"license": "apache-2.0",
"size": 46426
} | [
"android.widget.ListView",
"com.mikepenz.materialdrawer.adapter.BaseDrawerAdapter"
] | import android.widget.ListView; import com.mikepenz.materialdrawer.adapter.BaseDrawerAdapter; | import android.widget.*; import com.mikepenz.materialdrawer.adapter.*; | [
"android.widget",
"com.mikepenz.materialdrawer"
] | android.widget; com.mikepenz.materialdrawer; | 913,350 |
@SuppressWarnings("unused")
@Test
public void test_Spring() throws Exception {
// Get service
UserService service = (UserService) APP_CONTEXT.getBean("userService");
User user = service.create(user1);
user.setOrganizationName("new org");
service.update(user);
user = service.get(user.getId());
user = service.getByUsername(user.getUsername());
SearchResult<User> result = service.search(new UserSearchCriteria());
service.delete(user.getId());
} | @SuppressWarnings(STR) void function() throws Exception { UserService service = (UserService) APP_CONTEXT.getBean(STR); User user = service.create(user1); user.setOrganizationName(STR); service.update(user); user = service.get(user.getId()); user = service.getByUsername(user.getUsername()); SearchResult<User> result = service.search(new UserSearchCriteria()); service.delete(user.getId()); } | /**
* <p>
* Accuracy test with Spring.<br>
* </p>
*
* @throws Exception
* to JUnit.
* @since 1.1
*/ | Accuracy test with Spring. | test_Spring | {
"repo_name": "NASA-Tournament-Lab/CoECI-CMS-Healthcare-Fraud-Prevention",
"path": "hub/src/java/tests/com/hfpp/network/hub/services/impl/UserServiceImplUnitTests.java",
"license": "apache-2.0",
"size": 23393
} | [
"com.hfpp.network.hub.services.UserService",
"com.hfpp.network.models.SearchResult",
"com.hfpp.network.models.User",
"com.hfpp.network.models.UserSearchCriteria"
] | import com.hfpp.network.hub.services.UserService; import com.hfpp.network.models.SearchResult; import com.hfpp.network.models.User; import com.hfpp.network.models.UserSearchCriteria; | import com.hfpp.network.hub.services.*; import com.hfpp.network.models.*; | [
"com.hfpp.network"
] | com.hfpp.network; | 1,112,192 |
protected List<String> getMetaData() {
return metaData;
}
protected void process(RandomAccessFile dataStream, String filename) throws Exception {} | List<String> function() { return metaData; } protected void process(RandomAccessFile dataStream, String filename) throws Exception {} | /**
* Returns the meta data ArrayList.
*/ | Returns the meta data ArrayList | getMetaData | {
"repo_name": "alexeq/datacrown",
"path": "datacrow-client/_source/net/datacrow/fileimporter/movie/FileProperties.java",
"license": "gpl-3.0",
"size": 14077
} | [
"java.io.RandomAccessFile",
"java.util.List"
] | import java.io.RandomAccessFile; import java.util.List; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,411,698 |
@Override
public PageFormat defaultPage(PageFormat page) {
PageFormat newPage = (PageFormat)page.clone();
getDefaultPage(newPage);
return newPage;
} | PageFormat function(PageFormat page) { PageFormat newPage = (PageFormat)page.clone(); getDefaultPage(newPage); return newPage; } | /**
* The passed in PageFormat will be copied and altered to describe
* the default page size and orientation of the PrinterJob's
* current printer.
* Note: PageFormat.getPaper() returns a clone and getDefaultPage()
* gets that clone so it won't overwrite the original paper.
*/ | The passed in PageFormat will be copied and altered to describe the default page size and orientation of the PrinterJob's current printer. Note: PageFormat.getPaper() returns a clone and getDefaultPage() gets that clone so it won't overwrite the original paper | defaultPage | {
"repo_name": "FauxFaux/jdk9-jdk",
"path": "src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java",
"license": "gpl-2.0",
"size": 77832
} | [
"java.awt.print.PageFormat"
] | import java.awt.print.PageFormat; | import java.awt.print.*; | [
"java.awt"
] | java.awt; | 2,371,066 |
public Traverser<Object> flatMapEvent(long now, @Nullable T event, int partitionIndex, long nativeEventTime) {
assert traverser.isEmpty() : "the traverser returned previously not yet drained: remove all " +
"items from the traverser before you call this method again.";
if (event == null) {
handleNoEventInternal(now, Long.MAX_VALUE);
return traverser;
}
long eventTime;
if (timestampFn != null) {
eventTime = timestampFn.applyAsLong(event);
} else {
eventTime = nativeEventTime;
if (eventTime == NO_NATIVE_TIME) {
throw new JetException("Neither timestampFn nor nativeEventTime specified");
}
}
handleEventInternal(now, partitionIndex, eventTime);
return traverser.append(wrapFn.apply(event, eventTime));
} | Traverser<Object> function(long now, @Nullable T event, int partitionIndex, long nativeEventTime) { assert traverser.isEmpty() : STR + STR; if (event == null) { handleNoEventInternal(now, Long.MAX_VALUE); return traverser; } long eventTime; if (timestampFn != null) { eventTime = timestampFn.applyAsLong(event); } else { eventTime = nativeEventTime; if (eventTime == NO_NATIVE_TIME) { throw new JetException(STR); } } handleEventInternal(now, partitionIndex, eventTime); return traverser.append(wrapFn.apply(event, eventTime)); } | /**
* A lower-level variant of {@link #flatMapEvent(Object, int, long)
* flatMapEvent(T, int, long)} that accepts an explicit result of a
* {@code System.nanoTime()} call. Use this variant if you're calling it in
* a hot loop, in order to avoid repeating the expensive
* {@code System.nanoTime()} call.
*/ | A lower-level variant of <code>#flatMapEvent(Object, int, long) flatMapEvent(T, int, long)</code> that accepts an explicit result of a System.nanoTime() call. Use this variant if you're calling it in a hot loop, in order to avoid repeating the expensive System.nanoTime() call | flatMapEvent | {
"repo_name": "jerrinot/hazelcast",
"path": "hazelcast/src/main/java/com/hazelcast/jet/core/EventTimeMapper.java",
"license": "apache-2.0",
"size": 16117
} | [
"com.hazelcast.jet.JetException",
"com.hazelcast.jet.Traverser",
"javax.annotation.Nullable"
] | import com.hazelcast.jet.JetException; import com.hazelcast.jet.Traverser; import javax.annotation.Nullable; | import com.hazelcast.jet.*; import javax.annotation.*; | [
"com.hazelcast.jet",
"javax.annotation"
] | com.hazelcast.jet; javax.annotation; | 2,882,424 |
private double linear(Collection<Double> window) {
double avg = 0;
long totalWeight = 1;
long current = 1;
for (double value : window) {
avg += value * current;
totalWeight += current;
current += 1;
}
return avg / totalWeight;
} | double function(Collection<Double> window) { double avg = 0; long totalWeight = 1; long current = 1; for (double value : window) { avg += value * current; totalWeight += current; current += 1; } return avg / totalWeight; } | /**
* Linearly weighted moving avg
*
* @param window Window of values to compute movavg for
*/ | Linearly weighted moving avg | linear | {
"repo_name": "tebriel/elasticsearch",
"path": "core/src/test/java/org/elasticsearch/search/aggregations/pipeline/moving/avg/MovAvgIT.java",
"license": "apache-2.0",
"size": 64572
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 2,704,790 |
private static long skipBytes(FileInputStream fis, int toSkip, long space)
throws IOException {
long skip = fis.skip(toSkip);
if (skip != toSkip) {
throw new RuntimeException("skip() returns " + skip
+ " but expected " + toSkip);
}
long newSpace = space - toSkip;
long remaining = newSpace > 0 ? newSpace : 0;
int avail = fis.available();
if (avail != remaining) {
throw new RuntimeException("available() returns " + avail
+ " but expected " + remaining);
}
System.out.println("Skipped " + skip + " bytes "
+ " available() returns " + avail);
return newSpace;
} | static long function(FileInputStream fis, int toSkip, long space) throws IOException { long skip = fis.skip(toSkip); if (skip != toSkip) { throw new RuntimeException(STR + skip + STR + toSkip); } long newSpace = space - toSkip; long remaining = newSpace > 0 ? newSpace : 0; int avail = fis.available(); if (avail != remaining) { throw new RuntimeException(STR + avail + STR + remaining); } System.out.println(STR + skip + STR + STR + avail); return newSpace; } | /**
* Skip toSkip number of bytes and return the remaining bytes of the file.
*/ | Skip toSkip number of bytes and return the remaining bytes of the file | skipBytes | {
"repo_name": "rokn/Count_Words_2015",
"path": "testing/openjdk2/jdk/test/java/io/FileInputStream/NegativeAvailable.java",
"license": "mit",
"size": 3548
} | [
"java.io.FileInputStream",
"java.io.IOException"
] | import java.io.FileInputStream; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 308,643 |
private void setUpFlowObjectiveService() {
expect(flowObjectiveService.allocateNextId()).andReturn(NEXT_ID);
replay(flowObjectiveService);
} | void function() { expect(flowObjectiveService.allocateNextId()).andReturn(NEXT_ID); replay(flowObjectiveService); } | /**
* Sets up FlowObjectiveService.
*/ | Sets up FlowObjectiveService | setUpFlowObjectiveService | {
"repo_name": "LorenzReinhart/ONOSnew",
"path": "apps/routing/fibinstaller/src/test/java/org/onosproject/routing/fibinstaller/FibInstallerTest.java",
"license": "apache-2.0",
"size": 16963
} | [
"org.easymock.EasyMock"
] | import org.easymock.EasyMock; | import org.easymock.*; | [
"org.easymock"
] | org.easymock; | 2,226,373 |
void compact(final TableName tableName) throws IOException; | void compact(final TableName tableName) throws IOException; | /**
* Compact a table. Asynchronous operation.
*
* @param tableName table to compact
* @throws IOException if a remote or network exception occurs
*/ | Compact a table. Asynchronous operation | compact | {
"repo_name": "gustavoanatoly/hbase",
"path": "hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java",
"license": "apache-2.0",
"size": 97415
} | [
"java.io.IOException",
"org.apache.hadoop.hbase.TableName"
] | import java.io.IOException; import org.apache.hadoop.hbase.TableName; | import java.io.*; import org.apache.hadoop.hbase.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 90,700 |
CommandPacket getCommandPacket(PacketPayload payload, CommandPacketType type, ConnectionSession connectionSession) throws SQLException; | CommandPacket getCommandPacket(PacketPayload payload, CommandPacketType type, ConnectionSession connectionSession) throws SQLException; | /**
* Get command packet.
*
* @param payload packet payload
* @param type command packet type
* @param connectionSession connection session
* @return command packet
* @throws SQLException SQL exception
*/ | Get command packet | getCommandPacket | {
"repo_name": "apache/incubator-shardingsphere",
"path": "shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-spi/src/main/java/org/apache/shardingsphere/proxy/frontend/command/CommandExecuteEngine.java",
"license": "apache-2.0",
"size": 3557
} | [
"java.sql.SQLException",
"org.apache.shardingsphere.db.protocol.packet.CommandPacket",
"org.apache.shardingsphere.db.protocol.packet.CommandPacketType",
"org.apache.shardingsphere.db.protocol.payload.PacketPayload",
"org.apache.shardingsphere.proxy.backend.session.ConnectionSession"
] | import java.sql.SQLException; import org.apache.shardingsphere.db.protocol.packet.CommandPacket; import org.apache.shardingsphere.db.protocol.packet.CommandPacketType; import org.apache.shardingsphere.db.protocol.payload.PacketPayload; import org.apache.shardingsphere.proxy.backend.session.ConnectionSession; | import java.sql.*; import org.apache.shardingsphere.db.protocol.packet.*; import org.apache.shardingsphere.db.protocol.payload.*; import org.apache.shardingsphere.proxy.backend.session.*; | [
"java.sql",
"org.apache.shardingsphere"
] | java.sql; org.apache.shardingsphere; | 2,698,092 |
public Object next()
{
try
{
if (hasNext()) {
Object result = contextNode;
contextNode = navigator.getParentNode(contextNode);
return result;
}
throw new NoSuchElementException("Exhausted ancestor-or-self axis");
}
catch (UnsupportedAxisException e)
{
throw new JaxenRuntimeException(e);
}
}
| Object function() { try { if (hasNext()) { Object result = contextNode; contextNode = navigator.getParentNode(contextNode); return result; } throw new NoSuchElementException(STR); } catch (UnsupportedAxisException e) { throw new JaxenRuntimeException(e); } } | /**
* Returns the next ancestor-or-self node.
*
* @return the next ancestor-or-self node
*
* @throws NoSuchElementException if no ancestors remain
*
* @see java.util.Iterator#next()
*/ | Returns the next ancestor-or-self node | next | {
"repo_name": "hidekatsu-izuno/xmlic",
"path": "src/main/java/net/arnx/xmlic/internal/org/jaxen/util/AncestorOrSelfAxisIterator.java",
"license": "apache-2.0",
"size": 4792
} | [
"java.util.NoSuchElementException",
"net.arnx.xmlic.internal.org.jaxen.JaxenRuntimeException",
"net.arnx.xmlic.internal.org.jaxen.UnsupportedAxisException"
] | import java.util.NoSuchElementException; import net.arnx.xmlic.internal.org.jaxen.JaxenRuntimeException; import net.arnx.xmlic.internal.org.jaxen.UnsupportedAxisException; | import java.util.*; import net.arnx.xmlic.internal.org.jaxen.*; | [
"java.util",
"net.arnx.xmlic"
] | java.util; net.arnx.xmlic; | 2,708,179 |
void heartbeatCheck() {
if (isInSafeMode()) {
// not to check dead nodes if in safemode
return;
}
boolean allAlive = false;
while (!allAlive) {
boolean foundDead = false;
DatanodeID nodeID = null;
// locate the first dead node.
synchronized(heartbeats) {
for (Iterator<DatanodeDescriptor> it = heartbeats.iterator();
it.hasNext();) {
DatanodeDescriptor nodeInfo = it.next();
if (isDatanodeDead(nodeInfo)) {
foundDead = true;
nodeID = nodeInfo;
break;
}
}
}
// acquire the fsnamesystem lock, and then remove the dead node.
if (foundDead) {
synchronized (this) {
synchronized(heartbeats) {
synchronized (datanodeMap) {
DatanodeDescriptor nodeInfo = null;
try {
nodeInfo = getDatanode(nodeID);
} catch (IOException e) {
nodeInfo = null;
}
if (nodeInfo != null && isDatanodeDead(nodeInfo)) {
NameNode.stateChangeLog.info("BLOCK* NameSystem.heartbeatCheck: "
+ "lost heartbeat from " + nodeInfo.getName());
removeDatanode(nodeInfo);
}
}
}
}
}
allAlive = !foundDead;
}
} | void heartbeatCheck() { if (isInSafeMode()) { return; } boolean allAlive = false; while (!allAlive) { boolean foundDead = false; DatanodeID nodeID = null; synchronized(heartbeats) { for (Iterator<DatanodeDescriptor> it = heartbeats.iterator(); it.hasNext();) { DatanodeDescriptor nodeInfo = it.next(); if (isDatanodeDead(nodeInfo)) { foundDead = true; nodeID = nodeInfo; break; } } } if (foundDead) { synchronized (this) { synchronized(heartbeats) { synchronized (datanodeMap) { DatanodeDescriptor nodeInfo = null; try { nodeInfo = getDatanode(nodeID); } catch (IOException e) { nodeInfo = null; } if (nodeInfo != null && isDatanodeDead(nodeInfo)) { NameNode.stateChangeLog.info(STR + STR + nodeInfo.getName()); removeDatanode(nodeInfo); } } } } } allAlive = !foundDead; } } | /**
* Check if there are any expired heartbeats, and if so,
* whether any blocks have to be re-replicated.
* While removing dead datanodes, make sure that only one datanode is marked
* dead at a time within the synchronized section. Otherwise, a cascading
* effect causes more datanodes to be declared dead.
*/ | Check if there are any expired heartbeats, and if so, whether any blocks have to be re-replicated. While removing dead datanodes, make sure that only one datanode is marked dead at a time within the synchronized section. Otherwise, a cascading effect causes more datanodes to be declared dead | heartbeatCheck | {
"repo_name": "andy8788/hadoop-hdfs",
"path": "src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java",
"license": "apache-2.0",
"size": 214042
} | [
"java.io.IOException",
"java.util.Iterator",
"org.apache.hadoop.hdfs.protocol.DatanodeID"
] | import java.io.IOException; import java.util.Iterator; import org.apache.hadoop.hdfs.protocol.DatanodeID; | import java.io.*; import java.util.*; import org.apache.hadoop.hdfs.protocol.*; | [
"java.io",
"java.util",
"org.apache.hadoop"
] | java.io; java.util; org.apache.hadoop; | 1,530,294 |
private void copyPrivateRawResuorceToPubliclyAccessibleFile() {
InputStream inputStream = null;
FileOutputStream outputStream = null;
try {
inputStream = getResources().openRawResource(R.raw.robot);
outputStream = openFileOutput(SHARED_FILE_NAME,
Context.MODE_WORLD_READABLE | Context.MODE_APPEND);
byte[] buffer = new byte[1024];
int length = 0;
try {
while ((length = inputStream.read(buffer)) > 0){
outputStream.write(buffer, 0, length);
}
} catch (IOException ioe) {
}
} catch (FileNotFoundException fnfe) {
} finally {
try {
inputStream.close();
} catch (IOException ioe) {
}
try {
outputStream.close();
} catch (IOException ioe) {
}
}
} | void function() { InputStream inputStream = null; FileOutputStream outputStream = null; try { inputStream = getResources().openRawResource(R.raw.robot); outputStream = openFileOutput(SHARED_FILE_NAME, Context.MODE_WORLD_READABLE Context.MODE_APPEND); byte[] buffer = new byte[1024]; int length = 0; try { while ((length = inputStream.read(buffer)) > 0){ outputStream.write(buffer, 0, length); } } catch (IOException ioe) { } } catch (FileNotFoundException fnfe) { } finally { try { inputStream.close(); } catch (IOException ioe) { } try { outputStream.close(); } catch (IOException ioe) { } } } | /**
* Copies a private raw resource content to a publicly readable
* file such that the latter can be shared with other applications.
*/ | Copies a private raw resource content to a publicly readable file such that the latter can be shared with other applications | copyPrivateRawResuorceToPubliclyAccessibleFile | {
"repo_name": "luoqii/ApkLauncher",
"path": "app/samples/android-21/legacy/ApiDemos/src/com/example/android/apis/app/ActionBarShareActionProviderActivity.java",
"license": "apache-2.0",
"size": 4716
} | [
"android.content.Context",
"java.io.FileNotFoundException",
"java.io.FileOutputStream",
"java.io.IOException",
"java.io.InputStream"
] | import android.content.Context; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; | import android.content.*; import java.io.*; | [
"android.content",
"java.io"
] | android.content; java.io; | 2,738,543 |
@FIXVersion(introduced = "5.0SP1")
@TagNumRef(tagNum = TagNum.DerivativeSettlMethod)
public void setDerivativeSettlMethod(SettlMethod derivativeSettlMethod) {
this.derivativeSettlMethod = derivativeSettlMethod;
} | @FIXVersion(introduced = STR) @TagNumRef(tagNum = TagNum.DerivativeSettlMethod) void function(SettlMethod derivativeSettlMethod) { this.derivativeSettlMethod = derivativeSettlMethod; } | /**
* Message field setter.
* @param derivativeSettlMethod field value
*/ | Message field setter | setDerivativeSettlMethod | {
"repo_name": "marvisan/HadesFIX",
"path": "Model/src/main/java/net/hades/fix/message/comp/DerivativeInstrument.java",
"license": "gpl-3.0",
"size": 83551
} | [
"net.hades.fix.message.anno.FIXVersion",
"net.hades.fix.message.anno.TagNumRef",
"net.hades.fix.message.type.SettlMethod",
"net.hades.fix.message.type.TagNum"
] | import net.hades.fix.message.anno.FIXVersion; import net.hades.fix.message.anno.TagNumRef; import net.hades.fix.message.type.SettlMethod; import net.hades.fix.message.type.TagNum; | import net.hades.fix.message.anno.*; import net.hades.fix.message.type.*; | [
"net.hades.fix"
] | net.hades.fix; | 2,057,200 |
public synchronized static String id(Context context) {
if (sID == null) {
File installation = new File(context.getFilesDir(), INSTALLATION);
try {
if (!installation.exists()) {
writeInstallationFile(installation);
WrapperBackupAgent.dataChanged(context);
}
sID = readInstallationFile(installation);
Utils.d(context, "Installation id loaded: "+sID);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return sID;
} | synchronized static String function(Context context) { if (sID == null) { File installation = new File(context.getFilesDir(), INSTALLATION); try { if (!installation.exists()) { writeInstallationFile(installation); WrapperBackupAgent.dataChanged(context); } sID = readInstallationFile(installation); Utils.d(context, STR+sID); } catch (Exception e) { throw new RuntimeException(e); } } return sID; } | /**
* id of the installation, created as a UUID
*
* @param context
* @return
*/ | id of the installation, created as a UUID | id | {
"repo_name": "matboehmer/appsensor",
"path": "de.dfki.appsensor/src/de/dfki/appsensor/logging/DeviceObserver.java",
"license": "gpl-2.0",
"size": 4702
} | [
"android.content.Context",
"de.dfki.appsensor.backup.WrapperBackupAgent",
"de.dfki.appsensor.utils.Utils",
"java.io.File"
] | import android.content.Context; import de.dfki.appsensor.backup.WrapperBackupAgent; import de.dfki.appsensor.utils.Utils; import java.io.File; | import android.content.*; import de.dfki.appsensor.backup.*; import de.dfki.appsensor.utils.*; import java.io.*; | [
"android.content",
"de.dfki.appsensor",
"java.io"
] | android.content; de.dfki.appsensor; java.io; | 1,705,924 |
public void save(ProjectMember member, Writer w, Integer indent)
throws SaveException {
if (w == null) {
throw new IllegalArgumentException("No Writer specified!");
}
try {
ProjectMemberModel pmm = (ProjectMemberModel) member;
Object model = pmm.getModel();
File tempFile = null;
Writer writer = null;
if (indent != null) {
// If we have an indent then we are adding this file
// to a superfile.
// That is most likely inserting the XMI into the .uml file
tempFile = File.createTempFile("xmi", null);
tempFile.deleteOnExit();
writer =
new BufferedWriter(
new OutputStreamWriter(
new FileOutputStream(tempFile), "UTF-8"));
//writer = new FileWriter(tempFile);
XmiWriter xmiWriter = Model.getXmiWriter(model, writer);
xmiWriter.write();
addXmlFileToWriter((PrintWriter) w, tempFile,
indent.intValue());
} else {
// Othewise we are writing into a zip writer.
XmiWriter xmiWriter = Model.getXmiWriter(model, w);
xmiWriter.write();
}
} catch (IOException e) {
throw new SaveException(e);
} catch (UmlException e) {
throw new SaveException(e);
}
} | void function(ProjectMember member, Writer w, Integer indent) throws SaveException { if (w == null) { throw new IllegalArgumentException(STR); } try { ProjectMemberModel pmm = (ProjectMemberModel) member; Object model = pmm.getModel(); File tempFile = null; Writer writer = null; if (indent != null) { tempFile = File.createTempFile("xmi", null); tempFile.deleteOnExit(); writer = new BufferedWriter( new OutputStreamWriter( new FileOutputStream(tempFile), "UTF-8")); XmiWriter xmiWriter = Model.getXmiWriter(model, writer); xmiWriter.write(); addXmlFileToWriter((PrintWriter) w, tempFile, indent.intValue()); } else { XmiWriter xmiWriter = Model.getXmiWriter(model, w); xmiWriter.write(); } } catch (IOException e) { throw new SaveException(e); } catch (UmlException e) { throw new SaveException(e); } } | /**
* Save the project model to XMI.
*
* @see org.argouml.persistence.MemberFilePersister#save(
* org.argouml.kernel.ProjectMember, java.io.Writer,
* java.lang.Integer)
*/ | Save the project model to XMI | save | {
"repo_name": "carvalhomb/tsmells",
"path": "sample/argouml/argouml/org/argouml/persistence/ModelMemberFilePersister.java",
"license": "gpl-2.0",
"size": 6279
} | [
"java.io.BufferedWriter",
"java.io.File",
"java.io.FileOutputStream",
"java.io.IOException",
"java.io.OutputStreamWriter",
"java.io.PrintWriter",
"java.io.Writer",
"org.argouml.kernel.ProjectMember",
"org.argouml.model.Model",
"org.argouml.model.UmlException",
"org.argouml.model.XmiWriter",
"org.argouml.uml.ProjectMemberModel"
] | import java.io.BufferedWriter; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.Writer; import org.argouml.kernel.ProjectMember; import org.argouml.model.Model; import org.argouml.model.UmlException; import org.argouml.model.XmiWriter; import org.argouml.uml.ProjectMemberModel; | import java.io.*; import org.argouml.kernel.*; import org.argouml.model.*; import org.argouml.uml.*; | [
"java.io",
"org.argouml.kernel",
"org.argouml.model",
"org.argouml.uml"
] | java.io; org.argouml.kernel; org.argouml.model; org.argouml.uml; | 1,631,409 |
public Builder filteredEgressPoints(Set<FilteredConnectPoint> egressPoints) {
this.egressPoints = ImmutableSet.copyOf(egressPoints);
return this;
} | Builder function(Set<FilteredConnectPoint> egressPoints) { this.egressPoints = ImmutableSet.copyOf(egressPoints); return this; } | /**
* Sets the filtered egress points of the single point to multi point intent
* that will be built.
*
* @param egressPoints egress connect points
* @return this builder
*/ | Sets the filtered egress points of the single point to multi point intent that will be built | filteredEgressPoints | {
"repo_name": "gkatsikas/onos",
"path": "core/api/src/main/java/org/onosproject/net/intent/LinkCollectionIntent.java",
"license": "apache-2.0",
"size": 11181
} | [
"com.google.common.collect.ImmutableSet",
"java.util.Set",
"org.onosproject.net.FilteredConnectPoint"
] | import com.google.common.collect.ImmutableSet; import java.util.Set; import org.onosproject.net.FilteredConnectPoint; | import com.google.common.collect.*; import java.util.*; import org.onosproject.net.*; | [
"com.google.common",
"java.util",
"org.onosproject.net"
] | com.google.common; java.util; org.onosproject.net; | 189,750 |
private static void assertWeekIterator(Iterator<?> it, Calendar start) {
Calendar end = (Calendar) start.clone();
end.add(Calendar.DATE, 6);
assertWeekIterator(it, start, end);
} | static void function(Iterator<?> it, Calendar start) { Calendar end = (Calendar) start.clone(); end.add(Calendar.DATE, 6); assertWeekIterator(it, start, end); } | /**
* This checks that this is a 7 element iterator of Calendar objects
* that are dates (no time), and exactly 1 day spaced after each other.
*/ | This checks that this is a 7 element iterator of Calendar objects that are dates (no time), and exactly 1 day spaced after each other | assertWeekIterator | {
"repo_name": "Shoreray/CommonsLang",
"path": "src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java",
"license": "apache-2.0",
"size": 74191
} | [
"java.util.Calendar",
"java.util.Iterator"
] | import java.util.Calendar; import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 1,151,021 |
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
super.collectNewChildDescriptors(newChildDescriptors, object);
newChildDescriptors.add
(createChildParameter
(EsbPackage.Literals.ABSTRACT_LOCATION_KEY_RESOURCE__KEY,
EsbFactory.eINSTANCE.createRegistryKeyProperty()));
} | void function(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); newChildDescriptors.add (createChildParameter (EsbPackage.Literals.ABSTRACT_LOCATION_KEY_RESOURCE__KEY, EsbFactory.eINSTANCE.createRegistryKeyProperty())); } | /**
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
* that can be created under this object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This adds <code>org.eclipse.emf.edit.command.CommandParameter</code>s describing the children that can be created under this object. | collectNewChildDescriptors | {
"repo_name": "thiliniish/developer-studio",
"path": "esb/org.wso2.developerstudio.eclipse.gmf.esb.edit/src/org/wso2/developerstudio/eclipse/gmf/esb/provider/AbstractLocationKeyResourceItemProvider.java",
"license": "apache-2.0",
"size": 5789
} | [
"java.util.Collection",
"org.wso2.developerstudio.eclipse.gmf.esb.EsbFactory",
"org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage"
] | import java.util.Collection; import org.wso2.developerstudio.eclipse.gmf.esb.EsbFactory; import org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage; | import java.util.*; import org.wso2.developerstudio.eclipse.gmf.esb.*; | [
"java.util",
"org.wso2.developerstudio"
] | java.util; org.wso2.developerstudio; | 2,119,669 |
public static double[][] readMatrix(Reader input) {
try {
StreamTokenizer tokenizer= new StreamTokenizer(input);
// Although StreamTokenizer will parse numbers, it doesn't recognize
// scientific notation (E or D); however, Double.valueOf does.
// The strategy here is to disable StreamTokenizer's number parsing.
// We'll only get whitespace delimited words, EOL's and EOF's.
// These words should all be numbers, for Double.valueOf to parse.
tokenizer.resetSyntax();
tokenizer.wordChars(0,255);
tokenizer.whitespaceChars(0, ' ');
tokenizer.eolIsSignificant(true);
ArrayList<Double> first_row = new ArrayList<Double>();
ArrayList<double[]> all_rows = new ArrayList<double[]>();
// Ignore initial empty lines
while (tokenizer.nextToken() == StreamTokenizer.TT_EOL);
if (tokenizer.ttype == StreamTokenizer.TT_EOF)
throw new java.io.IOException("Unexpected EOF on matrix read.");
do {
first_row.add(Double.valueOf(tokenizer.sval)); // Read & store 1st row.
} while (tokenizer.nextToken() == StreamTokenizer.TT_WORD);
int n = first_row.size(); // Now we've got the number of columns!
double row[] = new double[n];
for (int j=0; j<n; j++) // extract the elements of the 1st row.
row[j]=first_row.get(j).doubleValue();
first_row.clear();
all_rows.add(row); // Now process the rows
while (tokenizer.nextToken() == StreamTokenizer.TT_WORD) {
// While non-empty lines
all_rows.add(row = new double[n]);
int j = 0;
do {
if (j >= n) throw new java.io.IOException
("Row " + all_rows.size() + " is too long.");
row[j++] = Double.valueOf(tokenizer.sval).doubleValue();
} while (tokenizer.nextToken() == StreamTokenizer.TT_WORD);
if (j < n) throw new java.io.IOException
("Row " + all_rows.size() + " is too short.");
}
double[][] A = all_rows.toArray(new double[all_rows.size()][]);
return A;
} catch(IOException e) {
// Make this a RuntimeException so this is easier to call from
// the interpreter.
throw new IllegalStateException(e.getMessage());
}
}
| static double[][] function(Reader input) { try { StreamTokenizer tokenizer= new StreamTokenizer(input); tokenizer.resetSyntax(); tokenizer.wordChars(0,255); tokenizer.whitespaceChars(0, ' '); tokenizer.eolIsSignificant(true); ArrayList<Double> first_row = new ArrayList<Double>(); ArrayList<double[]> all_rows = new ArrayList<double[]>(); while (tokenizer.nextToken() == StreamTokenizer.TT_EOL); if (tokenizer.ttype == StreamTokenizer.TT_EOF) throw new java.io.IOException(STR); do { first_row.add(Double.valueOf(tokenizer.sval)); } while (tokenizer.nextToken() == StreamTokenizer.TT_WORD); int n = first_row.size(); double row[] = new double[n]; for (int j=0; j<n; j++) row[j]=first_row.get(j).doubleValue(); first_row.clear(); all_rows.add(row); while (tokenizer.nextToken() == StreamTokenizer.TT_WORD) { all_rows.add(row = new double[n]); int j = 0; do { if (j >= n) throw new java.io.IOException (STR + all_rows.size() + STR); row[j++] = Double.valueOf(tokenizer.sval).doubleValue(); } while (tokenizer.nextToken() == StreamTokenizer.TT_WORD); if (j < n) throw new java.io.IOException (STR + all_rows.size() + STR); } double[][] A = all_rows.toArray(new double[all_rows.size()][]); return A; } catch(IOException e) { throw new IllegalStateException(e.getMessage()); } } | /**
* Read a double[][] from a stream. The format is fairly general, where
* the elements are separated by whitespace and all the elements for each
* row appear on a single line, and the last row is followed by a blank
* line.
* @param input A Reader instance.
* @return The matrix as a double[][].
*/ | Read a double[][] from a stream. The format is fairly general, where the elements are separated by whitespace and all the elements for each row appear on a single line, and the last row is followed by a blank line | readMatrix | {
"repo_name": "queenBNE/javaplex",
"path": "src/java/edu/stanford/math/plex/Plex.java",
"license": "bsd-3-clause",
"size": 37221
} | [
"java.io.IOException",
"java.io.Reader",
"java.io.StreamTokenizer",
"java.util.ArrayList"
] | import java.io.IOException; import java.io.Reader; import java.io.StreamTokenizer; import java.util.ArrayList; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,974,911 |
public static void ensureExclusiveAccess(Path socketFile) throws IOException {
LocalSocketAddress address =
new LocalSocketAddress(socketFile.getPathFile());
if (socketFile.exists()) {
try {
new LocalClientSocket(address).close();
} catch (IOException e) {
// The previous server process is dead--unlink the file:
socketFile.delete();
return;
}
// TODO(bazel-team): (2009) Read the previous server's pid from the "hello" message
// and add it to the message.
throw new IOException("Socket file " + socketFile.getPathString()
+ " is locked by another server");
}
} | static void function(Path socketFile) throws IOException { LocalSocketAddress address = new LocalSocketAddress(socketFile.getPathFile()); if (socketFile.exists()) { try { new LocalClientSocket(address).close(); } catch (IOException e) { socketFile.delete(); return; } throw new IOException(STR + socketFile.getPathString() + STR); } } | /**
* Ensures no other server is running for the current socket file. This
* guarantees that no two servers are running against the same output
* directory.
*
* @throws IOException if another server holds the lock for the socket file.
*/ | Ensures no other server is running for the current socket file. This guarantees that no two servers are running against the same output directory | ensureExclusiveAccess | {
"repo_name": "vt09/bazel",
"path": "src/main/java/com/google/devtools/build/lib/server/RPCServer.java",
"license": "apache-2.0",
"size": 21291
} | [
"com.google.devtools.build.lib.unix.LocalClientSocket",
"com.google.devtools.build.lib.unix.LocalSocketAddress",
"com.google.devtools.build.lib.vfs.Path",
"java.io.IOException"
] | import com.google.devtools.build.lib.unix.LocalClientSocket; import com.google.devtools.build.lib.unix.LocalSocketAddress; import com.google.devtools.build.lib.vfs.Path; import java.io.IOException; | import com.google.devtools.build.lib.unix.*; import com.google.devtools.build.lib.vfs.*; import java.io.*; | [
"com.google.devtools",
"java.io"
] | com.google.devtools; java.io; | 2,131,285 |
private List<Integer> decrementParenthesisList( List<Integer> parenthesisList ) {
List<Integer> newParentList = new LinkedList<Integer>();
Iterator<Integer> it = parenthesisList.listIterator();
while ( it.hasNext() ) {
Integer integer = it.next();
newParentList.add( Integer.valueOf(integer.intValue() - 1 ) );
}
return newParentList;
} | List<Integer> function( List<Integer> parenthesisList ) { List<Integer> newParentList = new LinkedList<Integer>(); Iterator<Integer> it = parenthesisList.listIterator(); while ( it.hasNext() ) { Integer integer = it.next(); newParentList.add( Integer.valueOf(integer.intValue() - 1 ) ); } return newParentList; } | /**
* Decreases all members of parenthesis list by one.
*
* @param parenthesisList A List of Integers.
* @return The List with all members decreased by one.
*/ | Decreases all members of parenthesis list by one | decrementParenthesisList | {
"repo_name": "OurGrid/OurGrid",
"path": "src/main/java/org/ourgrid/peer/business/controller/matcher/ExpressionTranslator.java",
"license": "lgpl-3.0",
"size": 10647
} | [
"java.util.Iterator",
"java.util.LinkedList",
"java.util.List"
] | import java.util.Iterator; import java.util.LinkedList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,820,364 |
public void updateTask()
{
--this.idleTime;
this.idleEntity.getLookHelper().setLookPosition(this.idleEntity.posX + this.lookX, this.idleEntity.posY + (double) this.idleEntity.getEyeHeight(), this.idleEntity.posZ + this.lookZ, 10.0F, (float) this.idleEntity.getVerticalFaceSpeed());
if (this.idleTime == 20)
{
((EntityDodo) this.idleEntity).setEyesOpen(false);
// LogHelper.info("EntityDodoAILookIdle: Closed eyes");
}
else if (this.idleTime <= 10)
{
((EntityDodo) this.idleEntity).setEyesOpen(true);
// LogHelper.info("EntityDodoAILookIdle: Opened eyes");
}
} | void function() { --this.idleTime; this.idleEntity.getLookHelper().setLookPosition(this.idleEntity.posX + this.lookX, this.idleEntity.posY + (double) this.idleEntity.getEyeHeight(), this.idleEntity.posZ + this.lookZ, 10.0F, (float) this.idleEntity.getVerticalFaceSpeed()); if (this.idleTime == 20) { ((EntityDodo) this.idleEntity).setEyesOpen(false); } else if (this.idleTime <= 10) { ((EntityDodo) this.idleEntity).setEyesOpen(true); } } | /**
* Updates the task
*/ | Updates the task | updateTask | {
"repo_name": "LewisMcReu/ARKCraft-Code",
"path": "src/main/java/com/arkcraft/module/creature/common/entity/ai/EntityDodoAILookIdle.java",
"license": "mit",
"size": 2286
} | [
"com.arkcraft.module.creature.common.entity.passive.EntityDodo"
] | import com.arkcraft.module.creature.common.entity.passive.EntityDodo; | import com.arkcraft.module.creature.common.entity.passive.*; | [
"com.arkcraft.module"
] | com.arkcraft.module; | 469,780 |
public List<Map<String, Object>> getToolsContentEditor(); | List<Map<String, Object>> function(); | /**
* Get a list of tools that can return content for the editor
*/ | Get a list of tools that can return content for the editor | getToolsContentEditor | {
"repo_name": "conder/sakai",
"path": "basiclti/basiclti-api/src/java/org/sakaiproject/lti/api/LTIService.java",
"license": "apache-2.0",
"size": 24025
} | [
"java.util.List",
"java.util.Map"
] | import java.util.List; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,726,066 |
Result executeDeleteStatement(Session session) {
int count = 0;
RowSetNavigatorLinkedList oldRows = new RowSetNavigatorLinkedList();
RangeIterator it = RangeVariable.getIterator(session,
targetRangeVariables);
while (it.next()) {
Row currentRow = it.getCurrentRow();
oldRows.add(currentRow);
}
count = delete(session, baseTable, oldRows);
if (restartIdentity && targetTable.identitySequence != null) {
targetTable.identitySequence.reset();
}
return Result.getUpdateCountResult(count);
} | Result executeDeleteStatement(Session session) { int count = 0; RowSetNavigatorLinkedList oldRows = new RowSetNavigatorLinkedList(); RangeIterator it = RangeVariable.getIterator(session, targetRangeVariables); while (it.next()) { Row currentRow = it.getCurrentRow(); oldRows.add(currentRow); } count = delete(session, baseTable, oldRows); if (restartIdentity && targetTable.identitySequence != null) { targetTable.identitySequence.reset(); } return Result.getUpdateCountResult(count); } | /**
* Executes a DELETE statement. It is assumed that the argument is
* of the correct type.
*
* @return the result of executing the statement
*/ | Executes a DELETE statement. It is assumed that the argument is of the correct type | executeDeleteStatement | {
"repo_name": "ifcharming/original2.0",
"path": "src/hsqldb19b3/org/hsqldb_voltpatches/StatementDML.java",
"license": "gpl-3.0",
"size": 53577
} | [
"org.hsqldb_voltpatches.navigator.RangeIterator",
"org.hsqldb_voltpatches.navigator.RowSetNavigatorLinkedList",
"org.hsqldb_voltpatches.result.Result"
] | import org.hsqldb_voltpatches.navigator.RangeIterator; import org.hsqldb_voltpatches.navigator.RowSetNavigatorLinkedList; import org.hsqldb_voltpatches.result.Result; | import org.hsqldb_voltpatches.navigator.*; import org.hsqldb_voltpatches.result.*; | [
"org.hsqldb_voltpatches.navigator",
"org.hsqldb_voltpatches.result"
] | org.hsqldb_voltpatches.navigator; org.hsqldb_voltpatches.result; | 950,240 |
public String sendString(String endpointURL, String request, String method) {
String response = null;
try {
HttpResponse httpResponse = sendStringAndGetMethod(endpointURL, request, method);
response = EntityUtils.toString(httpResponse.getEntity());
} catch (IOException ioe) {
_logger.error("Unable to get response", ioe);
}
return response;
} | String function(String endpointURL, String request, String method) { String response = null; try { HttpResponse httpResponse = sendStringAndGetMethod(endpointURL, request, method); response = EntityUtils.toString(httpResponse.getEntity()); } catch (IOException ioe) { _logger.error(STR, ioe); } return response; } | /**
* Send the specified request payload to the specified HTTP endpoint using the method specified.
* @param endpointURL The HTTP endpoint URL.
* @param request The request payload.
* @param method The request method.
* @return The HTTP response payload.
*/ | Send the specified request payload to the specified HTTP endpoint using the method specified | sendString | {
"repo_name": "tadayosi/switchyard",
"path": "components/test/mixins/http/src/main/java/org/switchyard/component/test/mixins/http/HTTPMixIn.java",
"license": "apache-2.0",
"size": 18480
} | [
"java.io.IOException",
"org.apache.http.HttpResponse",
"org.apache.http.util.EntityUtils"
] | import java.io.IOException; import org.apache.http.HttpResponse; import org.apache.http.util.EntityUtils; | import java.io.*; import org.apache.http.*; import org.apache.http.util.*; | [
"java.io",
"org.apache.http"
] | java.io; org.apache.http; | 2,851,074 |
@Override
final public EJBObject getEJBObject() throws IllegalStateException {
throw new IllegalStateException("getEJBObject not allowed for Singleton.");
} | final EJBObject function() throws IllegalStateException { throw new IllegalStateException(STR); } | /**
* Since EJB 3.1 Singleton does NOT support EJB 2.1 client view, throw
* IllegalStateException.
*
* @see com.ibm.ejs.container.SessionBeanO#getEJBObject()
*/ | Since EJB 3.1 Singleton does NOT support EJB 2.1 client view, throw IllegalStateException | getEJBObject | {
"repo_name": "kgibm/open-liberty",
"path": "dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/SingletonBeanO.java",
"license": "epl-1.0",
"size": 46522
} | [
"javax.ejb.EJBObject"
] | import javax.ejb.EJBObject; | import javax.ejb.*; | [
"javax.ejb"
] | javax.ejb; | 176,616 |
public KualiDecimal getTotal0to30() {
return total0to30;
} | KualiDecimal function() { return total0to30; } | /**
* Gets the total0to30 attribute.
*
* @return Returns the total0to30.
*/ | Gets the total0to30 attribute | getTotal0to30 | {
"repo_name": "quikkian-ua-devops/will-financials",
"path": "kfs-ar/src/main/java/org/kuali/kfs/module/ar/businessobject/lookup/CustomerAgingReportLookupableHelperServiceImpl.java",
"license": "agpl-3.0",
"size": 48795
} | [
"org.kuali.rice.core.api.util.type.KualiDecimal"
] | import org.kuali.rice.core.api.util.type.KualiDecimal; | import org.kuali.rice.core.api.util.type.*; | [
"org.kuali.rice"
] | org.kuali.rice; | 2,182,834 |
public List<BannedChampion> getBans() {
return bans;
} | List<BannedChampion> function() { return bans; } | /**
* If game was draft mode, contains banned champion data, otherwise null.
*/ | If game was draft mode, contains banned champion data, otherwise null | getBans | {
"repo_name": "a64adam/ulti",
"path": "src/main/java/dto/match/Team.java",
"license": "mit",
"size": 2848
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 125,927 |
public static String ok(String command) {
return String.format("(%s || true)", command);
} | static String function(String command) { return String.format(STR, command); } | /**
* Returns a command that always exits successfully
*/ | Returns a command that always exits successfully | ok | {
"repo_name": "neykov/incubator-brooklyn",
"path": "utils/common/src/main/java/brooklyn/util/ssh/BashCommands.java",
"license": "apache-2.0",
"size": 28917
} | [
"java.lang.String"
] | import java.lang.String; | import java.lang.*; | [
"java.lang"
] | java.lang; | 1,059,030 |
@ApiModelProperty(example = "null", required = true, value = "heads array")
public List<PlanetHead> getHeads() {
return heads;
} | @ApiModelProperty(example = "null", required = true, value = STR) List<PlanetHead> function() { return heads; } | /**
* heads array
*
* @return heads
**/ | heads array | getHeads | {
"repo_name": "GoldenGnu/eve-esi",
"path": "src/main/java/net/troja/eve/esi/model/PlanetExtractorDetails.java",
"license": "apache-2.0",
"size": 5411
} | [
"io.swagger.annotations.ApiModelProperty",
"java.util.List",
"net.troja.eve.esi.model.PlanetHead"
] | import io.swagger.annotations.ApiModelProperty; import java.util.List; import net.troja.eve.esi.model.PlanetHead; | import io.swagger.annotations.*; import java.util.*; import net.troja.eve.esi.model.*; | [
"io.swagger.annotations",
"java.util",
"net.troja.eve"
] | io.swagger.annotations; java.util; net.troja.eve; | 2,521,515 |
public OffsetDateTime scheduledPurgeDate() {
return this.innerProperties() == null ? null : this.innerProperties().scheduledPurgeDate();
} | OffsetDateTime function() { return this.innerProperties() == null ? null : this.innerProperties().scheduledPurgeDate(); } | /**
* Get the scheduledPurgeDate property: The scheduled purged date.
*
* @return the scheduledPurgeDate value.
*/ | Get the scheduledPurgeDate property: The scheduled purged date | scheduledPurgeDate | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/fluent/models/DeletedConfigurationStoreInner.java",
"license": "mit",
"size": 4221
} | [
"java.time.OffsetDateTime"
] | import java.time.OffsetDateTime; | import java.time.*; | [
"java.time"
] | java.time; | 1,839,345 |
boolean changeShippingAddressFromInvokedApp(PaymentAddress shippingAddress); | boolean changeShippingAddressFromInvokedApp(PaymentAddress shippingAddress); | /**
* Called to notify merchant of shipping address change. The payment app should block user
* interaction until updateWith() or onPaymentDetailsNotUpdated().
* https://w3c.github.io/payment-request/#dom-paymentrequestupdateevent
*
* @param shippingAddress Selected shipping address. Should not be null.
* @return Whether the payment state was valid.
*/ | Called to notify merchant of shipping address change. The payment app should block user interaction until updateWith() or onPaymentDetailsNotUpdated(). HREF | changeShippingAddressFromInvokedApp | {
"repo_name": "scheib/chromium",
"path": "components/payments/content/android/java/src/org/chromium/components/payments/PaymentRequestUpdateEventListener.java",
"license": "bsd-3-clause",
"size": 3049
} | [
"org.chromium.payments.mojom.PaymentAddress"
] | import org.chromium.payments.mojom.PaymentAddress; | import org.chromium.payments.mojom.*; | [
"org.chromium.payments"
] | org.chromium.payments; | 1,178,113 |
return new TranscoderInput(resolveURL(inputURI).toString());
} | return new TranscoderInput(resolveURL(inputURI).toString()); } | /**
* Creates the <tt>TranscoderInput</tt>.
*/ | Creates the TranscoderInput | createTranscoderInput | {
"repo_name": "srnsw/xena",
"path": "plugins/image/ext/src/batik-1.7/test-sources/org/apache/batik/transcoder/image/DefaultFontFamilyTest.java",
"license": "gpl-3.0",
"size": 2631
} | [
"org.apache.batik.transcoder.TranscoderInput"
] | import org.apache.batik.transcoder.TranscoderInput; | import org.apache.batik.transcoder.*; | [
"org.apache.batik"
] | org.apache.batik; | 1,344,013 |
public EAttribute getSeason_EndDate() {
return (EAttribute)getSeason().getEStructuralFeatures().get(2);
} | EAttribute function() { return (EAttribute)getSeason().getEStructuralFeatures().get(2); } | /**
* Returns the meta object for the attribute '{@link CIM15.IEC61970.LoadModel.Season#getEndDate <em>End Date</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>End Date</em>'.
* @see CIM15.IEC61970.LoadModel.Season#getEndDate()
* @see #getSeason()
* @generated
*/ | Returns the meta object for the attribute '<code>CIM15.IEC61970.LoadModel.Season#getEndDate End Date</code>'. | getSeason_EndDate | {
"repo_name": "SES-fortiss/SmartGridCoSimulation",
"path": "core/cim15/src/CIM15/IEC61970/LoadModel/LoadModelPackage.java",
"license": "apache-2.0",
"size": 161452
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 408,013 |
@Override // FSDatasetMBean
public long getDfsUsed() throws IOException {
synchronized(statsLock) {
return volumes.getDfsUsed();
}
} | @Override long function() throws IOException { synchronized(statsLock) { return volumes.getDfsUsed(); } } | /**
* Return the total space used by dfs datanode
*/ | Return the total space used by dfs datanode | getDfsUsed | {
"repo_name": "odpi/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java",
"license": "apache-2.0",
"size": 113008
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 397,460 |
protected void doPaint(IFigure figure, Graphics graphics, Insets insets) {
// Remember the clipping rectangle
Rectangle oldClip = new Rectangle();
oldClip = graphics.getClip(oldClip);
IMarker topMarker = getTopMarker();
IMarker bottomMarker = getBottomMarker();
if (topMarker != null || bottomMarker != null) {
ColorRegistry registry = BPELUIPlugin.INSTANCE.getColorRegistry();
graphics.setForegroundColor(registry.get(IBPELUIConstants.COLOR_ACTIVITY_BORDER));
Rectangle clippingRect;
if (bottomMarker == null) {
clippingRect = new Rectangle(topDrawerLocation.x, topDrawerLocation.y, DRAWER_WIDTH, DRAWER_HALF_HEIGHT + 1);
} else if (topMarker == null) {
clippingRect = new Rectangle(bottomDrawerLocation.x, bottomDrawerLocation.y, DRAWER_WIDTH, DRAWER_HALF_HEIGHT + 1);
} else {
clippingRect = new Rectangle(topDrawerLocation.x, topDrawerLocation.y, DRAWER_WIDTH, DRAWER_HEIGHT + 1);
}
graphics.setClip(clippingRect);
// -1 due to GEF
graphics.drawRoundRectangle(new Rectangle(topDrawerLocation.x + DRAWER_INSET, topDrawerLocation.y, DRAWER_WIDTH * 2, DRAWER_HEIGHT - 1), IBPELUIConstants.ARC_WIDTH, IBPELUIConstants.ARC_WIDTH);
graphics.setClip(oldClip);
if (bottomMarker == null || topMarker == null) {
graphics.drawLine(topDrawerLocation.x + DRAWER_INSET, topDrawerLocation.y + DRAWER_HALF_HEIGHT, topDrawerLocation.x + DRAWER_WIDTH, topDrawerLocation.y + DRAWER_HALF_HEIGHT);
}
}
// Draw the actual breakpoints
Image topImage = getTopImage();
if (topImage != null) {
graphics.drawImage(topImage, topImageLocation);
}
Image bottomImage = getBottomImage();
if (bottomImage != null) {
graphics.drawImage(bottomImage, bottomImageLocation);
}
} | void function(IFigure figure, Graphics graphics, Insets insets) { Rectangle oldClip = new Rectangle(); oldClip = graphics.getClip(oldClip); IMarker topMarker = getTopMarker(); IMarker bottomMarker = getBottomMarker(); if (topMarker != null bottomMarker != null) { ColorRegistry registry = BPELUIPlugin.INSTANCE.getColorRegistry(); graphics.setForegroundColor(registry.get(IBPELUIConstants.COLOR_ACTIVITY_BORDER)); Rectangle clippingRect; if (bottomMarker == null) { clippingRect = new Rectangle(topDrawerLocation.x, topDrawerLocation.y, DRAWER_WIDTH, DRAWER_HALF_HEIGHT + 1); } else if (topMarker == null) { clippingRect = new Rectangle(bottomDrawerLocation.x, bottomDrawerLocation.y, DRAWER_WIDTH, DRAWER_HALF_HEIGHT + 1); } else { clippingRect = new Rectangle(topDrawerLocation.x, topDrawerLocation.y, DRAWER_WIDTH, DRAWER_HEIGHT + 1); } graphics.setClip(clippingRect); graphics.drawRoundRectangle(new Rectangle(topDrawerLocation.x + DRAWER_INSET, topDrawerLocation.y, DRAWER_WIDTH * 2, DRAWER_HEIGHT - 1), IBPELUIConstants.ARC_WIDTH, IBPELUIConstants.ARC_WIDTH); graphics.setClip(oldClip); if (bottomMarker == null topMarker == null) { graphics.drawLine(topDrawerLocation.x + DRAWER_INSET, topDrawerLocation.y + DRAWER_HALF_HEIGHT, topDrawerLocation.x + DRAWER_WIDTH, topDrawerLocation.y + DRAWER_HALF_HEIGHT); } } Image topImage = getTopImage(); if (topImage != null) { graphics.drawImage(topImage, topImageLocation); } Image bottomImage = getBottomImage(); if (bottomImage != null) { graphics.drawImage(bottomImage, bottomImageLocation); } } | /**
* Subclasses should call this paint method unless there is a very good
* reason for overriding its behaviour. To affect where various things
* appear, override the calculate() method.
*/ | Subclasses should call this paint method unless there is a very good reason for overriding its behaviour. To affect where various things appear, override the calculate() method | doPaint | {
"repo_name": "Drifftr/devstudio-tooling-bps",
"path": "plugins/org.eclipse.bpel.ui.noEmbeddedEditors/src/org/eclipse/bpel/ui/editparts/borders/CollapsableBorder.java",
"license": "apache-2.0",
"size": 9009
} | [
"org.eclipse.bpel.ui.BPELUIPlugin",
"org.eclipse.bpel.ui.IBPELUIConstants",
"org.eclipse.core.resources.IMarker",
"org.eclipse.draw2d.Graphics",
"org.eclipse.draw2d.IFigure",
"org.eclipse.draw2d.geometry.Insets",
"org.eclipse.draw2d.geometry.Rectangle",
"org.eclipse.jface.resource.ColorRegistry",
"org.eclipse.swt.graphics.Image"
] | import org.eclipse.bpel.ui.BPELUIPlugin; import org.eclipse.bpel.ui.IBPELUIConstants; import org.eclipse.core.resources.IMarker; import org.eclipse.draw2d.Graphics; import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.geometry.Insets; import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.jface.resource.ColorRegistry; import org.eclipse.swt.graphics.Image; | import org.eclipse.bpel.ui.*; import org.eclipse.core.resources.*; import org.eclipse.draw2d.*; import org.eclipse.draw2d.geometry.*; import org.eclipse.jface.resource.*; import org.eclipse.swt.graphics.*; | [
"org.eclipse.bpel",
"org.eclipse.core",
"org.eclipse.draw2d",
"org.eclipse.jface",
"org.eclipse.swt"
] | org.eclipse.bpel; org.eclipse.core; org.eclipse.draw2d; org.eclipse.jface; org.eclipse.swt; | 48,046 |
public XYItemLabelGenerator getSeriesItemLabelGenerator(int series);
| XYItemLabelGenerator function(int series); | /**
* Returns the item label generator for a series.
*
* @param series the series index (zero based).
*
* @return The generator (possibly <code>null</code>).
*
* @see #setSeriesItemLabelGenerator(int, XYItemLabelGenerator)
*/ | Returns the item label generator for a series | getSeriesItemLabelGenerator | {
"repo_name": "sebkur/JFreeChart",
"path": "src/main/java/org/jfree/chart/renderer/xy/XYItemRenderer.java",
"license": "lgpl-3.0",
"size": 64436
} | [
"org.jfree.chart.labels.XYItemLabelGenerator"
] | import org.jfree.chart.labels.XYItemLabelGenerator; | import org.jfree.chart.labels.*; | [
"org.jfree.chart"
] | org.jfree.chart; | 1,960,034 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.