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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
private void handleSelectAll() throws JavaModelException {
selectAll(true);
methodSelectionChanged();
}
| void function() throws JavaModelException { selectAll(true); methodSelectionChanged(); } | /**
* Handle the select all action.
*
* @throws JavaModelException
*/ | Handle the select all action | handleSelectAll | {
"repo_name": "junit-tools-team/junit-tools",
"path": "org.junit.tools/src/org/junit/tools/ui/generator/swt/control/GroupMethodSelectionCtrl.java",
"license": "apache-2.0",
"size": 20024
} | [
"org.eclipse.jdt.core.JavaModelException"
] | import org.eclipse.jdt.core.JavaModelException; | import org.eclipse.jdt.core.*; | [
"org.eclipse.jdt"
] | org.eclipse.jdt; | 441,640 |
void injectAdvertisements(Article article); | void injectAdvertisements(Article article); | /**
* Process any new submissions.
* @param article the unprocessed article.
*/ | Process any new submissions | injectAdvertisements | {
"repo_name": "ikbenpinda/slackernews",
"path": "src/main/java/nl/achan/newsfeed/NewsFeed.java",
"license": "mit",
"size": 581
} | [
"nl.achan.util.domain.Article"
] | import nl.achan.util.domain.Article; | import nl.achan.util.domain.*; | [
"nl.achan.util"
] | nl.achan.util; | 2,797,070 |
@Test
public void testGetEpochOffset() {
EthiopianEra instance = EthiopianEra.AMETE_ALEM;
int expResult = -285019;
int result = instance.getEpochOffset();
assertEquals(expResult, result);
instance = EthiopianEra.AMETE_MIHRET;
expResult = 1723856;
result = instance.getEpochOffset();
assertEquals(expResult, result);
} | void function() { EthiopianEra instance = EthiopianEra.AMETE_ALEM; int expResult = -285019; int result = instance.getEpochOffset(); assertEquals(expResult, result); instance = EthiopianEra.AMETE_MIHRET; expResult = 1723856; result = instance.getEpochOffset(); assertEquals(expResult, result); } | /**
* Test of getEpochOffset method, of class EthiopianEra.
*/ | Test of getEpochOffset method, of class EthiopianEra | testGetEpochOffset | {
"repo_name": "andegna/EthiopianChronology",
"path": "test/com/andegna/chrono/EthiopianEraTest.java",
"license": "mit",
"size": 2674
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 883,001 |
// First, check if the location with this city name exists in the db
Cursor cursor = mContext.getContentResolver().query(
LocationEntry.CONTENT_URI,
new String[]{LocationEntry._ID},
LocationEntry.COLUMN_LOCATION_SETTING + " = ?",
new String[]{locationSetting},
null);
if (cursor.moveToFirst()) {
int locationIdIndex = cursor.getColumnIndex(LocationEntry._ID);
return cursor.getLong(locationIdIndex);
} else {
ContentValues locationValues = new ContentValues();
locationValues.put(LocationEntry.COLUMN_LOCATION_SETTING, locationSetting);
locationValues.put(LocationEntry.COLUMN_CITY_NAME, cityName);
locationValues.put(LocationEntry.COLUMN_COORD_LAT, lat);
locationValues.put(LocationEntry.COLUMN_COORD_LONG, lon);
Uri locationInsertUri = mContext.getContentResolver()
.insert(LocationEntry.CONTENT_URI, locationValues);
return ContentUris.parseId(locationInsertUri);
}
} | Cursor cursor = mContext.getContentResolver().query( LocationEntry.CONTENT_URI, new String[]{LocationEntry._ID}, LocationEntry.COLUMN_LOCATION_SETTING + STR, new String[]{locationSetting}, null); if (cursor.moveToFirst()) { int locationIdIndex = cursor.getColumnIndex(LocationEntry._ID); return cursor.getLong(locationIdIndex); } else { ContentValues locationValues = new ContentValues(); locationValues.put(LocationEntry.COLUMN_LOCATION_SETTING, locationSetting); locationValues.put(LocationEntry.COLUMN_CITY_NAME, cityName); locationValues.put(LocationEntry.COLUMN_COORD_LAT, lat); locationValues.put(LocationEntry.COLUMN_COORD_LONG, lon); Uri locationInsertUri = mContext.getContentResolver() .insert(LocationEntry.CONTENT_URI, locationValues); return ContentUris.parseId(locationInsertUri); } } | /**
* Helper method to handle insertion of a new location in the weather database.
*
* @param locationSetting The location string used to request updates from the server.
* @param cityName A human-readable city name, e.g "Mountain View"
* @param lat the latitude of the city
* @param lon the longitude of the city
* @return the row ID of the added location.
*/ | Helper method to handle insertion of a new location in the weather database | addLocation | {
"repo_name": "lichuan0217/WeatherApp",
"path": "app/src/main/java/com/example/android/sunshine/app/FetchWeatherTask.java",
"license": "apache-2.0",
"size": 12681
} | [
"android.content.ContentUris",
"android.content.ContentValues",
"android.database.Cursor",
"android.net.Uri",
"com.example.android.sunshine.app.data.WeatherContract"
] | import android.content.ContentUris; import android.content.ContentValues; import android.database.Cursor; import android.net.Uri; import com.example.android.sunshine.app.data.WeatherContract; | import android.content.*; import android.database.*; import android.net.*; import com.example.android.sunshine.app.data.*; | [
"android.content",
"android.database",
"android.net",
"com.example.android"
] | android.content; android.database; android.net; com.example.android; | 2,908,174 |
private ResourceContent createResourceContent(ProjectResource resource,
String dataPath) throws IOException {
EntityManager em = entityManager.get();
// extract data from file
Path path = Paths.get(dataPath);
byte[] data = Files.readAllBytes(path);
// create Resource Content
ResourceContent content = new ResourceContent();
content.setResource(resource);
content.setContent(data);
em.persist(content);
return content;
} | ResourceContent function(ProjectResource resource, String dataPath) throws IOException { EntityManager em = entityManager.get(); Path path = Paths.get(dataPath); byte[] data = Files.readAllBytes(path); ResourceContent content = new ResourceContent(); content.setResource(resource); content.setContent(data); em.persist(content); return content; } | /**
* Persists a ResourceContent object
* @param resource ProjectResource to be persisted
* @return ProjectResource
* @throws IOException
*/ | Persists a ResourceContent object | createResourceContent | {
"repo_name": "sharemycode/service",
"path": "src/main/java/net/sharemycode/controller/ProjectController.java",
"license": "apache-2.0",
"size": 44112
} | [
"java.io.IOException",
"java.nio.file.Files",
"java.nio.file.Path",
"java.nio.file.Paths",
"javax.persistence.EntityManager",
"net.sharemycode.model.ProjectResource",
"net.sharemycode.model.ResourceContent"
] | import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import javax.persistence.EntityManager; import net.sharemycode.model.ProjectResource; import net.sharemycode.model.ResourceContent; | import java.io.*; import java.nio.file.*; import javax.persistence.*; import net.sharemycode.model.*; | [
"java.io",
"java.nio",
"javax.persistence",
"net.sharemycode.model"
] | java.io; java.nio; javax.persistence; net.sharemycode.model; | 2,462,384 |
boolean doit(org.hotswap.agent.javassist.CtClass clazz, org.hotswap.agent.javassist.bytecode.MethodInfo minfo,
LoopContext context, org.hotswap.agent.javassist.bytecode.CodeIterator iterator, int endPos)
throws CannotCompileException {
boolean edited = false;
while (iterator.hasNext() && iterator.lookAhead() < endPos) {
int size = iterator.getCodeLength();
if (loopBody(iterator, clazz, minfo, context)) {
edited = true;
int size2 = iterator.getCodeLength();
if (size != size2) {
endPos += size2 - size;
}
}
}
return edited;
}
final static class NewOp {
NewOp next;
int pos;
String type;
NewOp(NewOp n, int p, String t) {
next = n;
pos = p;
type = t;
}
}
final static class LoopContext {
NewOp newList;
int maxLocals;
int maxStack;
LoopContext(int locals) {
maxLocals = locals;
maxStack = 0;
newList = null;
} | boolean doit(org.hotswap.agent.javassist.CtClass clazz, org.hotswap.agent.javassist.bytecode.MethodInfo minfo, LoopContext context, org.hotswap.agent.javassist.bytecode.CodeIterator iterator, int endPos) throws CannotCompileException { boolean edited = false; while (iterator.hasNext() && iterator.lookAhead() < endPos) { int size = iterator.getCodeLength(); if (loopBody(iterator, clazz, minfo, context)) { edited = true; int size2 = iterator.getCodeLength(); if (size != size2) { endPos += size2 - size; } } } return edited; } final static class NewOp { NewOp next; int pos; String type; NewOp(NewOp n, int p, String t) { next = n; pos = p; type = t; } } final static class LoopContext { NewOp newList; int maxLocals; int maxStack; LoopContext(int locals) { maxLocals = locals; maxStack = 0; newList = null; } | /**
* Visits each bytecode in the given range.
*/ | Visits each bytecode in the given range | doit | {
"repo_name": "alpapad/HotswapAgent",
"path": "hotswap-agent-core/src/main/java/org/hotswap/agent/javassist/expr/ExprEditor.java",
"license": "gpl-2.0",
"size": 10501
} | [
"org.hotswap.agent.javassist.CannotCompileException"
] | import org.hotswap.agent.javassist.CannotCompileException; | import org.hotswap.agent.javassist.*; | [
"org.hotswap.agent"
] | org.hotswap.agent; | 2,448,341 |
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getTitle());
} | KeyNamePair function() { return new KeyNamePair(get_ID(), getTitle()); } | /** Get Record ID/ColumnName
@return ID/ColumnName pair
*/ | Get Record ID/ColumnName | getKeyNamePair | {
"repo_name": "klst-com/metasfresh",
"path": "de.metas.adempiere.adempiere/base/src/main/java-gen/org/compiere/model/X_AD_Attachment.java",
"license": "gpl-2.0",
"size": 5483
} | [
"org.compiere.util.KeyNamePair"
] | import org.compiere.util.KeyNamePair; | import org.compiere.util.*; | [
"org.compiere.util"
] | org.compiere.util; | 1,119,195 |
void showDateDialog(@Nullable String dateStr) {
Calendar calendar = Calendar.getInstance();
try {
if (dateStr != null) {
Date date = mDateFormat.parse(dateStr);
calendar.setTime(date);
} else {
calendar.setTime(new Date());
}
} catch (ParseException e) {
e.printStackTrace();
}
mYear = calendar.get(Calendar.YEAR);
mMonth = calendar.get(Calendar.MONTH);
mDay = calendar.get(Calendar.DAY_OF_MONTH);
DatePickerDialog datePickerDialog
= DatePickerDialog.newInstance(StatisticsFragment.this,
mYear, mMonth, mDay);
datePickerDialog.show(mStatisticsActivity.getFragmentManager(),
"DateFragment");
} | void showDateDialog(@Nullable String dateStr) { Calendar calendar = Calendar.getInstance(); try { if (dateStr != null) { Date date = mDateFormat.parse(dateStr); calendar.setTime(date); } else { calendar.setTime(new Date()); } } catch (ParseException e) { e.printStackTrace(); } mYear = calendar.get(Calendar.YEAR); mMonth = calendar.get(Calendar.MONTH); mDay = calendar.get(Calendar.DAY_OF_MONTH); DatePickerDialog datePickerDialog = DatePickerDialog.newInstance(StatisticsFragment.this, mYear, mMonth, mDay); datePickerDialog.show(mStatisticsActivity.getFragmentManager(), STR); } | /**
* Show date picker dialog
*
* @param dateStr start or end date string
*/ | Show date picker dialog | showDateDialog | {
"repo_name": "lynring24/ITimeU",
"path": "ITimeU/app/src/main/java/com/itto3/itimeu/StatisticsFragment.java",
"license": "apache-2.0",
"size": 21741
} | [
"android.support.annotation.Nullable",
"com.wdullaer.materialdatetimepicker.date.DatePickerDialog",
"java.text.ParseException",
"java.util.Calendar",
"java.util.Date"
] | import android.support.annotation.Nullable; import com.wdullaer.materialdatetimepicker.date.DatePickerDialog; import java.text.ParseException; import java.util.Calendar; import java.util.Date; | import android.support.annotation.*; import com.wdullaer.materialdatetimepicker.date.*; import java.text.*; import java.util.*; | [
"android.support",
"com.wdullaer.materialdatetimepicker",
"java.text",
"java.util"
] | android.support; com.wdullaer.materialdatetimepicker; java.text; java.util; | 213,694 |
public static byte[] toBytes(Object o) {
Class<?> clazz = o.getClass();
if (clazz.equals(Enum.class)) {
return new byte[] { (byte)((Enum<?>) o).ordinal() }; // yeah, yeah it's a hack
} else if (clazz.equals(Byte.TYPE) || clazz.equals(Byte.class)) {
return new byte[] { (Byte) o };
} else if (clazz.equals(Boolean.TYPE) || clazz.equals(Boolean.class)) {
return new byte[] { ((Boolean) o ? (byte) 1 :(byte) 0)};
} else if (clazz.equals(Short.TYPE) || clazz.equals(Short.class)) {
return Bytes.toBytes((Short) o);
} else if (clazz.equals(Integer.TYPE) || clazz.equals(Integer.class)) {
return Bytes.toBytes((Integer) o);
} else if (clazz.equals(Long.TYPE) || clazz.equals(Long.class)) {
return Bytes.toBytes((Long) o);
} else if (clazz.equals(Float.TYPE) || clazz.equals(Float.class)) {
return Bytes.toBytes((Float) o);
} else if (clazz.equals(Double.TYPE) || clazz.equals(Double.class)) {
return Bytes.toBytes((Double) o);
} else if (clazz.equals(String.class)) {
return Bytes.toBytes((String) o);
} else if (clazz.equals(Utf8.class)) {
return ((Utf8) o).getBytes();
} else if (clazz.isArray() && clazz.getComponentType().equals(Byte.TYPE)) {
return (byte[])o;
}
throw new RuntimeException("Can't parse data as class: " + clazz);
} | static byte[] function(Object o) { Class<?> clazz = o.getClass(); if (clazz.equals(Enum.class)) { return new byte[] { (byte)((Enum<?>) o).ordinal() }; } else if (clazz.equals(Byte.TYPE) clazz.equals(Byte.class)) { return new byte[] { (Byte) o }; } else if (clazz.equals(Boolean.TYPE) clazz.equals(Boolean.class)) { return new byte[] { ((Boolean) o ? (byte) 1 :(byte) 0)}; } else if (clazz.equals(Short.TYPE) clazz.equals(Short.class)) { return Bytes.toBytes((Short) o); } else if (clazz.equals(Integer.TYPE) clazz.equals(Integer.class)) { return Bytes.toBytes((Integer) o); } else if (clazz.equals(Long.TYPE) clazz.equals(Long.class)) { return Bytes.toBytes((Long) o); } else if (clazz.equals(Float.TYPE) clazz.equals(Float.class)) { return Bytes.toBytes((Float) o); } else if (clazz.equals(Double.TYPE) clazz.equals(Double.class)) { return Bytes.toBytes((Double) o); } else if (clazz.equals(String.class)) { return Bytes.toBytes((String) o); } else if (clazz.equals(Utf8.class)) { return ((Utf8) o).getBytes(); } else if (clazz.isArray() && clazz.getComponentType().equals(Byte.TYPE)) { return (byte[])o; } throw new RuntimeException(STR + clazz); } | /**
* Converts an instance of a <em>basic class</em> to an array of bytes.
* @param o Instance of Enum|Byte|Boolean|Short|Integer|Long|Float|Double|String|Utf8
* @return array of bytes with <code>o</code> serialized with org.apache.hadoop.hbase.util.Bytes
*/ | Converts an instance of a basic class to an array of bytes | toBytes | {
"repo_name": "SwathiMystery/gora",
"path": "gora-hbase/src/main/java/org/apache/gora/hbase/util/HBaseByteInterface.java",
"license": "apache-2.0",
"size": 10941
} | [
"org.apache.avro.util.Utf8",
"org.apache.hadoop.hbase.util.Bytes"
] | import org.apache.avro.util.Utf8; import org.apache.hadoop.hbase.util.Bytes; | import org.apache.avro.util.*; import org.apache.hadoop.hbase.util.*; | [
"org.apache.avro",
"org.apache.hadoop"
] | org.apache.avro; org.apache.hadoop; | 939,332 |
@AllowedFFDC("javax.transaction.xa.XAException") // TODO remove this once Microsoft bug is fixed
@Test
public void testTransactionBranchesTightlyCoupled() throws Exception {
tran.begin();
try {
try (Connection con1 = unsharable_ds_xa_tightly_coupled.getConnection()) {
con1.createStatement().executeUpdate("INSERT INTO MYTABLE VALUES (32, 'thirty-two')");
// Obtain a second (unshared) connection so that we have 2 transaction branches
try (Connection con2 = unsharable_ds_xa_tightly_coupled.getConnection()) {
assertEquals(1, con2.createStatement().executeUpdate("UPDATE MYTABLE SET STRVAL='XXXII' WHERE ID=32"));
}
}
} finally {
// TODO switch to commit once Microsoft bug is fixed
tran.rollback();
}
} | @AllowedFFDC(STR) void function() throws Exception { tran.begin(); try { try (Connection con1 = unsharable_ds_xa_tightly_coupled.getConnection()) { con1.createStatement().executeUpdate(STR); try (Connection con2 = unsharable_ds_xa_tightly_coupled.getConnection()) { assertEquals(1, con2.createStatement().executeUpdate(STR)); } } } finally { tran.rollback(); } } | /**
* Confirm that locks are shared between transaction branches that are tightly coupled.
*/ | Confirm that locks are shared between transaction branches that are tightly coupled | testTransactionBranchesTightlyCoupled | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.jdbc_fat_sqlserver/test-applications/sqlserverfat/src/web/SQLServerTestServlet.java",
"license": "epl-1.0",
"size": 19877
} | [
"java.sql.Connection",
"junit.framework.Assert"
] | import java.sql.Connection; import junit.framework.Assert; | import java.sql.*; import junit.framework.*; | [
"java.sql",
"junit.framework"
] | java.sql; junit.framework; | 836,893 |
public PutCalendarResponse deleteCalendarJob(DeleteCalendarJobRequest request, RequestOptions options) throws IOException {
return restHighLevelClient.performRequestAndParseEntity(request,
MLRequestConverters::deleteCalendarJob,
options,
PutCalendarResponse::fromXContent,
Collections.emptySet());
} | PutCalendarResponse function(DeleteCalendarJobRequest request, RequestOptions options) throws IOException { return restHighLevelClient.performRequestAndParseEntity(request, MLRequestConverters::deleteCalendarJob, options, PutCalendarResponse::fromXContent, Collections.emptySet()); } | /**
* Removes Machine Learning Job(s) from a calendar
* <p>
* For additional info
* see <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-calendar-job.html">
* ML Delete calendar job documentation</a>
*
* @param request The request
* @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
* @return The {@link PutCalendarResponse} containing the updated calendar
* @throws IOException when there is a serialization issue sending the request or receiving the response
*/ | Removes Machine Learning Job(s) from a calendar For additional info see ML Delete calendar job documentation | deleteCalendarJob | {
"repo_name": "HonzaKral/elasticsearch",
"path": "client/rest-high-level/src/main/java/org/elasticsearch/client/MachineLearningClient.java",
"license": "apache-2.0",
"size": 130306
} | [
"java.io.IOException",
"java.util.Collections",
"org.elasticsearch.client.ml.DeleteCalendarJobRequest",
"org.elasticsearch.client.ml.PutCalendarResponse"
] | import java.io.IOException; import java.util.Collections; import org.elasticsearch.client.ml.DeleteCalendarJobRequest; import org.elasticsearch.client.ml.PutCalendarResponse; | import java.io.*; import java.util.*; import org.elasticsearch.client.ml.*; | [
"java.io",
"java.util",
"org.elasticsearch.client"
] | java.io; java.util; org.elasticsearch.client; | 1,418,726 |
@Nullable
public List<String> getEnabledProtocols() {
return enabledProtocols;
} | List<String> function() { return enabledProtocols; } | /**
* Returns the enabled SSL protocols.
* @return the enabled SSL protocols.
*/ | Returns the enabled SSL protocols | getEnabledProtocols | {
"repo_name": "minwoox/armeria",
"path": "spring/boot2-autoconfigure/src/main/java/com/linecorp/armeria/spring/Ssl.java",
"license": "apache-2.0",
"size": 8445
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,936,299 |
public static void registerArmourRecipe(Item ingot, Item helmet, Item chestplate, Item leggings, Item boots) {
GameRegistry.addRecipe(new ItemStack(helmet), new Object[] { "III","I I"," ",'I',ingot});
GameRegistry.addRecipe(new ItemStack(helmet), new Object[] { " ","III","I I",'I',ingot});
GameRegistry.addRecipe(new ItemStack(chestplate), new Object[] { "I I","III","III",'I',ingot});
GameRegistry.addRecipe(new ItemStack(leggings), new Object[] { "III","I I","I I",'I',ingot});
GameRegistry.addRecipe(new ItemStack(boots), new Object[] { "I I","I I"," ",'I',ingot});
GameRegistry.addRecipe(new ItemStack(boots), new Object[] { " ","I I","I I",'I',ingot});
}
/**
* Registers armour using the ingot from the {@link OreDictionary}
* @param ingotOD The ingot from the {@link OreDictionary}
| static void function(Item ingot, Item helmet, Item chestplate, Item leggings, Item boots) { GameRegistry.addRecipe(new ItemStack(helmet), new Object[] { "III",STR," ",'I',ingot}); GameRegistry.addRecipe(new ItemStack(helmet), new Object[] { " ","III",STR,'I',ingot}); GameRegistry.addRecipe(new ItemStack(chestplate), new Object[] { STR,"III","III",'I',ingot}); GameRegistry.addRecipe(new ItemStack(leggings), new Object[] { "III",STR,STR,'I',ingot}); GameRegistry.addRecipe(new ItemStack(boots), new Object[] { STR,STR," ",'I',ingot}); GameRegistry.addRecipe(new ItemStack(boots), new Object[] { " ",STR,STR,'I',ingot}); } /** * Registers armour using the ingot from the {@link OreDictionary} * @param ingotOD The ingot from the {@link OreDictionary} | /**
* Registers armour using the ingot
* @param ingot The ingot
* @param helmet The helmet
* @param chestplate The chestplate
* @param leggings The leggings
* @param boots The boots
*/ | Registers armour using the ingot | registerArmourRecipe | {
"repo_name": "SparkyTheFox/Sparkys-Mod-1.11.2-1.4.0-Alpha-SourceCode",
"path": "common/mod/sparkyfox/servermod/lib/OreRecipeHandler.java",
"license": "lgpl-3.0",
"size": 11337
} | [
"net.minecraft.item.Item",
"net.minecraft.item.ItemStack",
"net.minecraftforge.fml.common.registry.GameRegistry",
"net.minecraftforge.oredict.OreDictionary"
] | import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.oredict.OreDictionary; | import net.minecraft.item.*; import net.minecraftforge.fml.common.registry.*; import net.minecraftforge.oredict.*; | [
"net.minecraft.item",
"net.minecraftforge.fml",
"net.minecraftforge.oredict"
] | net.minecraft.item; net.minecraftforge.fml; net.minecraftforge.oredict; | 1,455,458 |
//-----------------------------------------------------------------------
@Override
public String convertToString(T object) {
try {
return (String) toString.invoke(object);
} catch (IllegalAccessException ex) {
throw new IllegalStateException("Method is not accessible: " + toString);
} catch (InvocationTargetException ex) {
if (ex.getCause() instanceof RuntimeException) {
throw (RuntimeException) ex.getCause();
}
throw new RuntimeException(ex.getMessage(), ex.getCause());
}
}
| String function(T object) { try { return (String) toString.invoke(object); } catch (IllegalAccessException ex) { throw new IllegalStateException(STR + toString); } catch (InvocationTargetException ex) { if (ex.getCause() instanceof RuntimeException) { throw (RuntimeException) ex.getCause(); } throw new RuntimeException(ex.getMessage(), ex.getCause()); } } | /**
* Converts the object to a {@code String}.
* @param object the object to convert, not null
* @return the converted string, may be null but generally not
*/ | Converts the object to a String | convertToString | {
"repo_name": "fengshao0907/joda-convert",
"path": "src/main/java/org/joda/convert/ReflectionStringConverter.java",
"license": "apache-2.0",
"size": 3068
} | [
"java.lang.reflect.InvocationTargetException"
] | import java.lang.reflect.InvocationTargetException; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 1,031,794 |
public static long getLong(Properties props, String key, long defaultValue) {
String value = props.getProperty(key);
if (value != null) {
return Long.parseLong(value);
} else {
return defaultValue;
}
} | static long function(Properties props, String key, long defaultValue) { String value = props.getProperty(key); if (value != null) { return Long.parseLong(value); } else { return defaultValue; } } | /**
* Load an integer property as a long.
* If the key is not present, returns defaultValue.
*/ | Load an integer property as a long. If the key is not present, returns defaultValue | getLong | {
"repo_name": "mayukuntian/stanford-ner",
"path": "src/edu/stanford/nlp/util/PropertiesUtils.java",
"license": "gpl-2.0",
"size": 9247
} | [
"java.util.Properties"
] | import java.util.Properties; | import java.util.*; | [
"java.util"
] | java.util; | 644,385 |
public void showTree() {
DefaultMutableTreeNode root = new DefaultMutableTreeNode("Tree");
DefaultTreeModel model = new DefaultTreeModel(root);
JTree tree = new JTree(model);
FrequentAtomsTrie.display(model, root);
for (int i = 0; i < tree.getRowCount(); i++) {
tree.expandRow(i);
}
// Construction a visualization of the window
JFrame v = new JFrame();
JScrollPane scroll = new JScrollPane(tree);
v.getContentPane().add(scroll);
v.pack();
v.setVisible(true);
v.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
} | void function() { DefaultMutableTreeNode root = new DefaultMutableTreeNode("Tree"); DefaultTreeModel model = new DefaultTreeModel(root); JTree tree = new JTree(model); FrequentAtomsTrie.display(model, root); for (int i = 0; i < tree.getRowCount(); i++) { tree.expandRow(i); } JFrame v = new JFrame(); JScrollPane scroll = new JScrollPane(tree); v.getContentPane().add(scroll); v.pack(); v.setVisible(true); v.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); } | /**
* Method to show the tree in a graphical way
*/ | Method to show the tree in a graphical way | showTree | {
"repo_name": "Quanhua-Guan/spmf",
"path": "ca/pfv/spmf/algorithms/sequentialpatterns/clasp_AGP/AlgoCM_ClaSP.java",
"license": "gpl-3.0",
"size": 17524
} | [
"javax.swing.JFrame",
"javax.swing.JScrollPane",
"javax.swing.JTree",
"javax.swing.WindowConstants",
"javax.swing.tree.DefaultMutableTreeNode",
"javax.swing.tree.DefaultTreeModel"
] | import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTree; import javax.swing.WindowConstants; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeModel; | import javax.swing.*; import javax.swing.tree.*; | [
"javax.swing"
] | javax.swing; | 868,183 |
public ServiceCall<Void> dateTimeValidAsync(final ServiceCallback<Void> serviceCallback) {
return ServiceCall.fromResponse(dateTimeValidWithServiceResponseAsync(), serviceCallback);
} | ServiceCall<Void> function(final ServiceCallback<Void> serviceCallback) { return ServiceCall.fromResponse(dateTimeValidWithServiceResponseAsync(), serviceCallback); } | /**
* Get '2012-01-01T01:01:01Z' as date-time.
*
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @return the {@link ServiceCall} object
*/ | Get '2012-01-01T01:01:01Z' as date-time | dateTimeValidAsync | {
"repo_name": "matthchr/autorest",
"path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/url/implementation/PathsImpl.java",
"license": "mit",
"size": 77364
} | [
"com.microsoft.rest.ServiceCall",
"com.microsoft.rest.ServiceCallback"
] | import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 1,376,462 |
void sendSymbol(@NotNull Morse.Symbol symbol); | void sendSymbol(@NotNull Morse.Symbol symbol); | /**
* Sends a symbol of Morse code to this receiver, which is used to generate MIDI commands.
* @param symbol A symbol of Morse code to receive.
*/ | Sends a symbol of Morse code to this receiver, which is used to generate MIDI commands | sendSymbol | {
"repo_name": "paxromana96/morse-beeper",
"path": "src/com/brownian/morse/receivers/MorseReceiver.java",
"license": "mit",
"size": 956
} | [
"com.brownian.morse.Morse",
"com.sun.istack.internal.NotNull"
] | import com.brownian.morse.Morse; import com.sun.istack.internal.NotNull; | import com.brownian.morse.*; import com.sun.istack.internal.*; | [
"com.brownian.morse",
"com.sun.istack"
] | com.brownian.morse; com.sun.istack; | 312,881 |
protected void processWarningOccurred(int imageIndex,
String baseName,
String keyword)
{
if (baseName == null || keyword == null)
throw new IllegalArgumentException ("null argument");
ResourceBundle b = null;
try
{
b = ResourceBundle.getBundle(baseName, getLocale());
}
catch (MissingResourceException e)
{
throw new IllegalArgumentException ("no resource bundle found");
}
Object str = null;
try
{
str = b.getObject(keyword);
}
catch (MissingResourceException e)
{
throw new IllegalArgumentException ("no results found for keyword");
}
if (! (str instanceof String))
throw new IllegalArgumentException ("retrieved object not a String");
String warning = (String) str;
if (warningListeners != null)
{
Iterator it = warningListeners.iterator();
while (it.hasNext())
{
IIOWriteWarningListener listener =
(IIOWriteWarningListener) it.next();
listener.warningOccurred(this, imageIndex, warning);
}
}
} | void function(int imageIndex, String baseName, String keyword) { if (baseName == null keyword == null) throw new IllegalArgumentException (STR); ResourceBundle b = null; try { b = ResourceBundle.getBundle(baseName, getLocale()); } catch (MissingResourceException e) { throw new IllegalArgumentException (STR); } Object str = null; try { str = b.getObject(keyword); } catch (MissingResourceException e) { throw new IllegalArgumentException (STR); } if (! (str instanceof String)) throw new IllegalArgumentException (STR); String warning = (String) str; if (warningListeners != null) { Iterator it = warningListeners.iterator(); while (it.hasNext()) { IIOWriteWarningListener listener = (IIOWriteWarningListener) it.next(); listener.warningOccurred(this, imageIndex, warning); } } } | /**
* Notify all installed warning listeners, by calling their
* warningOccurred methods, that a warning message has been raised.
* The warning message is retrieved from a resource bundle, using
* the given basename and keyword.
*
* @param imageIndex the index of the image that was being written
* when the warning was raised
* @param baseName the basename of the resource from which to
* retrieve the warning message
* @param keyword the keyword used to retrieve the warning from the
* resource bundle
*
* @exception IllegalArgumentException if either baseName or keyword
* is null
* @exception IllegalArgumentException if no resource bundle is
* found using baseName
* @exception IllegalArgumentException if the given keyword produces
* no results from the resource bundle
* @exception IllegalArgumentException if the retrieved object is
* not a String
*/ | Notify all installed warning listeners, by calling their warningOccurred methods, that a warning message has been raised. The warning message is retrieved from a resource bundle, using the given basename and keyword | processWarningOccurred | {
"repo_name": "shaotuanchen/sunflower_exp",
"path": "tools/source/gcc-4.2.4/libjava/classpath/javax/imageio/ImageWriter.java",
"license": "bsd-3-clause",
"size": 44820
} | [
"java.util.Iterator",
"java.util.MissingResourceException",
"java.util.ResourceBundle",
"javax.imageio.event.IIOWriteWarningListener"
] | import java.util.Iterator; import java.util.MissingResourceException; import java.util.ResourceBundle; import javax.imageio.event.IIOWriteWarningListener; | import java.util.*; import javax.imageio.event.*; | [
"java.util",
"javax.imageio"
] | java.util; javax.imageio; | 2,773,026 |
@Override
public void messageReceived(final GetBlobHeadRequest request, TransportChannel channel) throws Exception {
final BlobTransferStatus transferStatus = blobTransferTarget.getActiveTransfer(request.transferId);
assert transferStatus != null :
"Received GetBlobHeadRequest for transfer" + request.transferId.toString() + "but don't have an activeTransfer with that id";
final DiscoveryNode recipientNode = clusterService.state().getNodes().get(request.senderNodeId);
final long bytesToSend = request.endPos;
blobTransferTarget.gotAGetBlobHeadRequest(request.transferId);
channel.sendResponse(TransportResponse.Empty.INSTANCE);
threadPool.generic().execute(
new PutHeadChunkRunnable(
transferStatus.digestBlob(), bytesToSend, transportService, blobTransferTarget,
recipientNode, request.transferId)
);
}
} | void function(final GetBlobHeadRequest request, TransportChannel channel) throws Exception { final BlobTransferStatus transferStatus = blobTransferTarget.getActiveTransfer(request.transferId); assert transferStatus != null : STR + request.transferId.toString() + STR; final DiscoveryNode recipientNode = clusterService.state().getNodes().get(request.senderNodeId); final long bytesToSend = request.endPos; blobTransferTarget.gotAGetBlobHeadRequest(request.transferId); channel.sendResponse(TransportResponse.Empty.INSTANCE); threadPool.generic().execute( new PutHeadChunkRunnable( transferStatus.digestBlob(), bytesToSend, transportService, blobTransferTarget, recipientNode, request.transferId) ); } } | /**
* this is method is called on the recovery source node
* the target is requesting the head of a file it got a PutReplicaChunkRequest for.
*/ | this is method is called on the recovery source node the target is requesting the head of a file it got a PutReplicaChunkRequest for | messageReceived | {
"repo_name": "adrpar/crate",
"path": "blob/src/main/java/io/crate/blob/pending_transfer/BlobHeadRequestHandler.java",
"license": "apache-2.0",
"size": 6473
} | [
"io.crate.blob.BlobTransferStatus",
"org.elasticsearch.cluster.node.DiscoveryNode",
"org.elasticsearch.transport.TransportChannel",
"org.elasticsearch.transport.TransportResponse"
] | import io.crate.blob.BlobTransferStatus; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.transport.TransportChannel; import org.elasticsearch.transport.TransportResponse; | import io.crate.blob.*; import org.elasticsearch.cluster.node.*; import org.elasticsearch.transport.*; | [
"io.crate.blob",
"org.elasticsearch.cluster",
"org.elasticsearch.transport"
] | io.crate.blob; org.elasticsearch.cluster; org.elasticsearch.transport; | 2,168,908 |
@Test
public void gr22v12000c12000birl3() {
reasoningTest("gr2_2_v12000_c12000_bir_l3_0.ivml", ReasoningOperation.VALIDATION, 2373);
} | @Test void function() { reasoningTest(STR, ReasoningOperation.VALIDATION, 2373); } | /**
* Tests gr2_2.
*/ | Tests gr2_2 | gr22v12000c12000birl3 | {
"repo_name": "SSEHUB/EASyProducer",
"path": "Plugins/Reasoner/Drools/de.uni_hildesheim.sse.reasoning.drools2.test/test/net/ssehub/easy/reasoning/drools2/performance/Group22.java",
"license": "apache-2.0",
"size": 13606
} | [
"net.ssehub.easy.reasoning.core.reasoner.ReasoningOperation",
"org.junit.Test"
] | import net.ssehub.easy.reasoning.core.reasoner.ReasoningOperation; import org.junit.Test; | import net.ssehub.easy.reasoning.core.reasoner.*; import org.junit.*; | [
"net.ssehub.easy",
"org.junit"
] | net.ssehub.easy; org.junit; | 2,695,190 |
public static String[] getTypesFromSpans(final Span[] spans,
final String[] tokens) {
final List<String> tagsList = new ArrayList<String>();
for (final Span span : spans) {
tagsList.add(span.getType());
}
return tagsList.toArray(new String[tagsList.size()]);
} | static String[] function(final Span[] spans, final String[] tokens) { final List<String> tagsList = new ArrayList<String>(); for (final Span span : spans) { tagsList.add(span.getType()); } return tagsList.toArray(new String[tagsList.size()]); } | /**
* Get an array of Spans and their associated tokens and obtains an array of
* Strings containing the type for each Span.
*
* @param spans
* the array of Spans
* @param tokens
* the array of tokens
* @return an array of string with the types
*/ | Get an array of Spans and their associated tokens and obtains an array of Strings containing the type for each Span | getTypesFromSpans | {
"repo_name": "ixa-ehu/ixa-pipe-ml",
"path": "src/main/java/eus/ixa/ixa/pipe/ml/utils/Span.java",
"license": "apache-2.0",
"size": 13443
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 716,005 |
default void importCertificateChain(String alias, char[] keyPassword, String file)
throws AdaptrisSecurityException {
throw new KeystoreException("Default behaviour is read-only");
} | default void importCertificateChain(String alias, char[] keyPassword, String file) throws AdaptrisSecurityException { throw new KeystoreException(STR); } | /**
* Import a certificate chain from a file, giving it the assigned alias.
* <p>
* Certificate Chains are only appropriate for keystore <code>keyEntry</code> types. This assumes that a <code>keyEntry</code> with
* the alias <code>alias</code> has already been created, and the secret key associated with this <code>keyEntry</code> is protected
* by <code>keyPassword</code>
* </p>
*
* @implNote The default implementation throws an instance of {@link AdaptrisSecurityException} and performs no other action.
* @param keyPassword the password to access the private key
* @param alias the alias to be assigned
* @param file the Certificate Chain file to be imported
* @throws AdaptrisSecurityException for any error
* @see #importCertificateChain(String, char[], File)
*/ | Import a certificate chain from a file, giving it the assigned alias. Certificate Chains are only appropriate for keystore <code>keyEntry</code> types. This assumes that a <code>keyEntry</code> with the alias <code>alias</code> has already been created, and the secret key associated with this <code>keyEntry</code> is protected by <code>keyPassword</code> | importCertificateChain | {
"repo_name": "adaptris/interlok",
"path": "interlok-core/src/main/java/com/adaptris/security/keystore/KeystoreProxy.java",
"license": "apache-2.0",
"size": 15650
} | [
"com.adaptris.security.exc.AdaptrisSecurityException",
"com.adaptris.security.exc.KeystoreException"
] | import com.adaptris.security.exc.AdaptrisSecurityException; import com.adaptris.security.exc.KeystoreException; | import com.adaptris.security.exc.*; | [
"com.adaptris.security"
] | com.adaptris.security; | 629,247 |
DimensionRawColumnChunk readRawDimensionChunk(FileReader fileReader, int columnIndex)
throws IOException; | DimensionRawColumnChunk readRawDimensionChunk(FileReader fileReader, int columnIndex) throws IOException; | /**
* Below method will be used to read the chunk based on block index
*
* @param fileReader file reader to read the blocks from file
* @param columnIndex column to be read
* @return dimension column chunk
*/ | Below method will be used to read the chunk based on block index | readRawDimensionChunk | {
"repo_name": "zzcclp/carbondata",
"path": "core/src/main/java/org/apache/carbondata/core/datastore/chunk/reader/DimensionColumnChunkReader.java",
"license": "apache-2.0",
"size": 2845
} | [
"java.io.IOException",
"org.apache.carbondata.core.datastore.FileReader",
"org.apache.carbondata.core.datastore.chunk.impl.DimensionRawColumnChunk"
] | import java.io.IOException; import org.apache.carbondata.core.datastore.FileReader; import org.apache.carbondata.core.datastore.chunk.impl.DimensionRawColumnChunk; | import java.io.*; import org.apache.carbondata.core.datastore.*; import org.apache.carbondata.core.datastore.chunk.impl.*; | [
"java.io",
"org.apache.carbondata"
] | java.io; org.apache.carbondata; | 363,488 |
public static void fixMultiAssignment(HConnection connection, HRegionInfo region,
List<ServerName> servers)
throws IOException, KeeperException, InterruptedException {
HRegionInfo actualRegion = new HRegionInfo(region);
// Close region on the servers silently
for(ServerName server : servers) {
closeRegionSilentlyAndWait(connection, server, actualRegion);
}
// Force ZK node to OFFLINE so master assigns
forceOfflineInZK(connection.getAdmin(), actualRegion);
} | static void function(HConnection connection, HRegionInfo region, List<ServerName> servers) throws IOException, KeeperException, InterruptedException { HRegionInfo actualRegion = new HRegionInfo(region); for(ServerName server : servers) { closeRegionSilentlyAndWait(connection, server, actualRegion); } forceOfflineInZK(connection.getAdmin(), actualRegion); } | /**
* Fix multiple assignment by doing silent closes on each RS hosting the region
* and then force ZK unassigned node to OFFLINE to trigger assignment by
* master.
*
* @param connection HBase connection to the cluster
* @param region Region to undeploy
* @param servers list of Servers to undeploy from
*/ | Fix multiple assignment by doing silent closes on each RS hosting the region and then force ZK unassigned node to OFFLINE to trigger assignment by master | fixMultiAssignment | {
"repo_name": "Guavus/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsckRepair.java",
"license": "apache-2.0",
"size": 7927
} | [
"java.io.IOException",
"java.util.List",
"org.apache.hadoop.hbase.HRegionInfo",
"org.apache.hadoop.hbase.ServerName",
"org.apache.hadoop.hbase.client.HConnection",
"org.apache.zookeeper.KeeperException"
] | import java.io.IOException; import java.util.List; import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.client.HConnection; import org.apache.zookeeper.KeeperException; | import java.io.*; import java.util.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.client.*; import org.apache.zookeeper.*; | [
"java.io",
"java.util",
"org.apache.hadoop",
"org.apache.zookeeper"
] | java.io; java.util; org.apache.hadoop; org.apache.zookeeper; | 2,034,425 |
public synchronized void update(Context context, long now) {
if (database == null)
return;
// If it's too soon since the last check, don't even try.
if (now - lastDataCheck < MIN_CHECK_INTERVAL)
return;
// Check all the files we're caching, and see if any of them
// is absent or old enough to need refreshing. If so, kick
// off a load.
boolean checking = false;
for (Entry entry : targetFiles.values()) {
if (entry.path == null || now - entry.date > REFRESH_INTERVAL) {
FileFetcher ff =
new FileFetcher(context, entry.url, entry.name,
this, FETCH_TIMEOUT, entry.date);
WebFetcher.queue(ff);
checking = true;
}
}
if (checking)
lastDataCheck = now;
}
// ******************************************************************** //
// Fetched Data Handling.
// ******************************************************************** // | synchronized void function(Context context, long now) { if (database == null) return; if (now - lastDataCheck < MIN_CHECK_INTERVAL) return; boolean checking = false; for (Entry entry : targetFiles.values()) { if (entry.path == null now - entry.date > REFRESH_INTERVAL) { FileFetcher ff = new FileFetcher(context, entry.url, entry.name, this, FETCH_TIMEOUT, entry.date); WebFetcher.queue(ff); checking = true; } } if (checking) lastDataCheck = now; } | /**
* Check to see whether we need to update our cached copies of the
* files. If so, kick off a web fetch.
*
* The observers will be notified for each file that we load.
*
* @param context The application context. Used for
* determining where the local files are kept.
* @param now The current time in millis.
*/ | Check to see whether we need to update our cached copies of the files. If so, kick off a web fetch. The observers will be notified for each file that we load | update | {
"repo_name": "lnanek/MyMonitorForGlass",
"path": "HermitAndroidRefactor/src/org/hermit/android/net/CachedFile.java",
"license": "gpl-2.0",
"size": 12192
} | [
"android.content.Context"
] | import android.content.Context; | import android.content.*; | [
"android.content"
] | android.content; | 2,279,221 |
@Test
public void testUnsubscribeUpper() throws Exception {
createPowerSpy();
target.unsubscribeUpper("UpperId");
PowerMockito.verifyPrivate(target).invoke(
"removeEntryEventSubscription", "NODE_CHANGED", "UpperId");
PowerMockito.verifyPrivate(target).invoke(
"removeEntryEventSubscription", "PORT_CHANGED", "UpperId");
PowerMockito.verifyPrivate(target).invoke(
"removeEntryEventSubscription", "LINK_CHANGED", "UpperId");
PowerMockito.verifyPrivate(target).invoke(
"removeEntryEventSubscription", "FLOW_CHANGED", "UpperId");
PowerMockito.verifyPrivate(target, atLeastOnce()).invoke(
"applyEventSubscription");
} | void function() throws Exception { createPowerSpy(); target.unsubscribeUpper(STR); PowerMockito.verifyPrivate(target).invoke( STR, STR, STR); PowerMockito.verifyPrivate(target).invoke( STR, STR, STR); PowerMockito.verifyPrivate(target).invoke( STR, STR, STR); PowerMockito.verifyPrivate(target).invoke( STR, STR, STR); PowerMockito.verifyPrivate(target, atLeastOnce()).invoke( STR); } | /**
* Test method for {@link org.o3project.odenos.component.linklayerizer.LinkLayerizer#unsubscribeUpper(java.lang.String)}.
* @throws Exception
*/ | Test method for <code>org.o3project.odenos.component.linklayerizer.LinkLayerizer#unsubscribeUpper(java.lang.String)</code> | testUnsubscribeUpper | {
"repo_name": "narry/odenos",
"path": "src/test/java/org/o3project/odenos/component/linklayerizer/LinkLayerizerTest.java",
"license": "apache-2.0",
"size": 127722
} | [
"org.mockito.Mockito",
"org.powermock.api.mockito.PowerMockito"
] | import org.mockito.Mockito; import org.powermock.api.mockito.PowerMockito; | import org.mockito.*; import org.powermock.api.mockito.*; | [
"org.mockito",
"org.powermock.api"
] | org.mockito; org.powermock.api; | 1,904,125 |
public void setFreemarkerSettings(Properties settings) {
freemarkerSettings = settings;
} | void function(Properties settings) { freemarkerSettings = settings; } | /**
* Set properties that contain well-known FreeMarker keys which will be
* passed to FreeMarker's Configuration.setSettings method.
* @see freemarker.template.Configuration#setSettings
*/ | Set properties that contain well-known FreeMarker keys which will be passed to FreeMarker's Configuration.setSettings method | setFreemarkerSettings | {
"repo_name": "dachengxi/spring1.1.1_source",
"path": "src/org/springframework/ui/freemarker/FreeMarkerConfigurationFactory.java",
"license": "mit",
"size": 7738
} | [
"java.util.Properties"
] | import java.util.Properties; | import java.util.*; | [
"java.util"
] | java.util; | 660,656 |
public String getMemoryUsedFromJmx(String nodeIp, String clientPort,
ProcessMemoryType memoryType) throws Exception {
Map<String, Object> beanJavaMemory = new HashMap<String, Object>();
String beanName = HadoopMonitor.JMX_BEAN_NAME_JAVA_MEMORY;
beanJavaMemory = this.getJmxBeanData(nodeIp, clientPort, beanName);
String memoryKeyName = "";
switch (memoryType) {
case HEAP:
memoryKeyName = HadoopConstants.Hadoop.Keys.JMX_DATA_KEY_HEAP_MEMORY_USAGE;
break;
case NONHEAP:
memoryKeyName = HadoopConstants.Hadoop.Keys.JMX_DATA_KEY_NON_HEAP_MEMORY_USAGE;
break;
}
JSONObject memoryUsageJson = (JSONObject) beanJavaMemory
.get(memoryKeyName);
long heapUsed = ((Number) memoryUsageJson
.get(HadoopConstants.Hadoop.Keys.JMX_DATA_KEY_MEMORY_USAGE_USED))
.longValue();
return HadoopDFSManager.convertBytes(heapUsed);
} | String function(String nodeIp, String clientPort, ProcessMemoryType memoryType) throws Exception { Map<String, Object> beanJavaMemory = new HashMap<String, Object>(); String beanName = HadoopMonitor.JMX_BEAN_NAME_JAVA_MEMORY; beanJavaMemory = this.getJmxBeanData(nodeIp, clientPort, beanName); String memoryKeyName = ""; switch (memoryType) { case HEAP: memoryKeyName = HadoopConstants.Hadoop.Keys.JMX_DATA_KEY_HEAP_MEMORY_USAGE; break; case NONHEAP: memoryKeyName = HadoopConstants.Hadoop.Keys.JMX_DATA_KEY_NON_HEAP_MEMORY_USAGE; break; } JSONObject memoryUsageJson = (JSONObject) beanJavaMemory .get(memoryKeyName); long heapUsed = ((Number) memoryUsageJson .get(HadoopConstants.Hadoop.Keys.JMX_DATA_KEY_MEMORY_USAGE_USED)) .longValue(); return HadoopDFSManager.convertBytes(heapUsed); } | /**
* Gets the memory used from jmx.
*
* @param nodeIp
* the node ip
* @param clientPort
* the client port
* @param memoryType
* the memory type
* @return the memory used from jmx
* @throws Exception
* the exception
*/ | Gets the memory used from jmx | getMemoryUsedFromJmx | {
"repo_name": "impetus-opensource/ankush",
"path": "ankush/src/main/java/com/impetus/ankush2/hadoop/utils/HadoopUtils.java",
"license": "lgpl-3.0",
"size": 62017
} | [
"com.impetus.ankush2.hadoop.monitor.HadoopDFSManager",
"com.impetus.ankush2.hadoop.monitor.HadoopMonitor",
"java.util.HashMap",
"java.util.Map",
"org.json.simple.JSONObject"
] | import com.impetus.ankush2.hadoop.monitor.HadoopDFSManager; import com.impetus.ankush2.hadoop.monitor.HadoopMonitor; import java.util.HashMap; import java.util.Map; import org.json.simple.JSONObject; | import com.impetus.ankush2.hadoop.monitor.*; import java.util.*; import org.json.simple.*; | [
"com.impetus.ankush2",
"java.util",
"org.json.simple"
] | com.impetus.ankush2; java.util; org.json.simple; | 2,736,869 |
void abort(Throwable t) throws IOException {
LOG.info("Aborting because of " + StringUtils.stringifyException(t));
try {
downlink.abort();
downlink.flush();
} catch (IOException e) {
// IGNORE cleanup problems
}
try {
handler.waitForFinish();
} catch (Throwable ignored) {
process.destroy();
}
IOException wrapper = new IOException("pipe child exception");
wrapper.initCause(t);
throw wrapper;
} | void abort(Throwable t) throws IOException { LOG.info(STR + StringUtils.stringifyException(t)); try { downlink.abort(); downlink.flush(); } catch (IOException e) { } try { handler.waitForFinish(); } catch (Throwable ignored) { process.destroy(); } IOException wrapper = new IOException(STR); wrapper.initCause(t); throw wrapper; } | /**
* Abort the application and wait for it to finish.
* @param t the exception that signalled the problem
* @throws IOException A wrapper around the exception that was passed in
*/ | Abort the application and wait for it to finish | abort | {
"repo_name": "apurtell/hadoop",
"path": "hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/pipes/Application.java",
"license": "apache-2.0",
"size": 11819
} | [
"java.io.IOException",
"org.apache.hadoop.util.StringUtils"
] | import java.io.IOException; import org.apache.hadoop.util.StringUtils; | import java.io.*; import org.apache.hadoop.util.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 2,188,507 |
public RoutingNodes getRoutingNodes() {
if (routingNodes != null) {
return routingNodes;
}
routingNodes = new RoutingNodes(this);
return routingNodes;
} | RoutingNodes function() { if (routingNodes != null) { return routingNodes; } routingNodes = new RoutingNodes(this); return routingNodes; } | /**
* Returns a built (on demand) routing nodes view of the routing table.
*/ | Returns a built (on demand) routing nodes view of the routing table | getRoutingNodes | {
"repo_name": "ESamir/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/cluster/ClusterState.java",
"license": "apache-2.0",
"size": 31416
} | [
"org.elasticsearch.cluster.routing.RoutingNodes"
] | import org.elasticsearch.cluster.routing.RoutingNodes; | import org.elasticsearch.cluster.routing.*; | [
"org.elasticsearch.cluster"
] | org.elasticsearch.cluster; | 1,281,584 |
@Override
public InputStream toStream() {
ByteBuf out = PooledByteBufAllocator.DEFAULT.buffer(HEADER_MAX_SIZE, HEADER_MAX_SIZE);
out.writeInt(MAGIC_WORD)
.writeLong(headerLength)
.writeLong(blockLength)
.writeLong(firstEntryId)
.writeBytes(PADDING);
// true means the input stream will release the ByteBuf on close
return new ByteBufInputStream(out, true);
} | InputStream function() { ByteBuf out = PooledByteBufAllocator.DEFAULT.buffer(HEADER_MAX_SIZE, HEADER_MAX_SIZE); out.writeInt(MAGIC_WORD) .writeLong(headerLength) .writeLong(blockLength) .writeLong(firstEntryId) .writeBytes(PADDING); return new ByteBufInputStream(out, true); } | /**
* Get the content of the data block header as InputStream.
* Read out in format:
* [ magic_word -- int ][ block_len -- int ][ first_entry_id -- long] [padding zeros]
*/ | Get the content of the data block header as InputStream. Read out in format: [ magic_word -- int ][ block_len -- int ][ first_entry_id -- long] [padding zeros] | toStream | {
"repo_name": "nkurihar/pulsar",
"path": "tiered-storage/jcloud/src/main/java/org/apache/bookkeeper/mledger/offload/jcloud/impl/DataBlockHeaderImpl.java",
"license": "apache-2.0",
"size": 4577
} | [
"io.netty.buffer.ByteBuf",
"io.netty.buffer.ByteBufInputStream",
"io.netty.buffer.PooledByteBufAllocator",
"java.io.InputStream"
] | import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufInputStream; import io.netty.buffer.PooledByteBufAllocator; import java.io.InputStream; | import io.netty.buffer.*; import java.io.*; | [
"io.netty.buffer",
"java.io"
] | io.netty.buffer; java.io; | 2,696,039 |
public HttpSession getHttpSession(){
return this.httpSession;
}
| HttpSession function(){ return this.httpSession; } | /**
* Gets the http session associated with this message.
*
* @return the http session
*/ | Gets the http session associated with this message | getHttpSession | {
"repo_name": "LarsKristensen/SequenceZAP",
"path": "zaproxy/src/org/parosproxy/paros/network/HttpMessage.java",
"license": "apache-2.0",
"size": 28420
} | [
"org.zaproxy.zap.extension.httpsessions.HttpSession"
] | import org.zaproxy.zap.extension.httpsessions.HttpSession; | import org.zaproxy.zap.extension.httpsessions.*; | [
"org.zaproxy.zap"
] | org.zaproxy.zap; | 2,783,970 |
protected void handleFlowElements(ContainerShape container, List<FlowElement> flowElementsToBeDrawn) {
List<BoundaryEvent> boundaryEvents = new ArrayList<BoundaryEvent>();
List<DataObject> dataObjects = new ArrayList<DataObject>();
for (FlowElement flowElement : flowElementsToBeDrawn) {
if (flowElement instanceof BoundaryEvent) {
// defer handling of boundary events
// until the elements they are attached to are
// rendered
boundaryEvents.add((BoundaryEvent) flowElement);
} else if (flowElement instanceof Gateway) {
handleGateway((Gateway) flowElement, container);
} else if (flowElement instanceof SubProcess) {
handleSubProcess((SubProcess) flowElement, container);
} else if (flowElement instanceof CallActivity) {
handleCallActivity((CallActivity) flowElement, container);
} else if (flowElement instanceof Task) {
handleTask((Task) flowElement, container);
} else if (flowElement instanceof Event) {
handleEvent((Event) flowElement, container);
} else if (flowElement instanceof DataObjectReference) {
handleDataObjectReference((DataObjectReference) flowElement, container);
} else if (flowElement instanceof DataObject) {
// handle dataobjects because they may need
// conversion to dataObjecReferences
dataObjects.add((DataObject) flowElement);
} else if (flowElement instanceof DataStoreReference) {
handleDataStoreReference((DataStoreReference) flowElement, container);
} else {
// yea, unhandled element
}
if (flowElement instanceof Activity) {
Activity activity = (Activity) flowElement;
handleDataInputAssociations(activity.getDataInputAssociations(), container);
handleDataOutputAssociations(activity.getDataOutputAssociations(), container);
} else if (flowElement instanceof CatchEvent) {
CatchEvent catchEvent = (CatchEvent) flowElement;
handleDataOutputAssociations(catchEvent.getDataOutputAssociation(), container);
} else if (flowElement instanceof ThrowEvent) {
ThrowEvent throwEvent = (ThrowEvent) flowElement;
handleDataInputAssociations(throwEvent.getDataInputAssociation(), container);
}
}
for (DataObject dataObject : dataObjects) {
// legacy import for data object as flow element
// (should be data object reference instead)
// we did that wrong in the old camunda modeler days
handleDataObject(dataObject, container);
}
// handle boundary events last
for (BoundaryEvent boundaryEvent : boundaryEvents) {
handleEvent(boundaryEvent, container);
}
} | void function(ContainerShape container, List<FlowElement> flowElementsToBeDrawn) { List<BoundaryEvent> boundaryEvents = new ArrayList<BoundaryEvent>(); List<DataObject> dataObjects = new ArrayList<DataObject>(); for (FlowElement flowElement : flowElementsToBeDrawn) { if (flowElement instanceof BoundaryEvent) { boundaryEvents.add((BoundaryEvent) flowElement); } else if (flowElement instanceof Gateway) { handleGateway((Gateway) flowElement, container); } else if (flowElement instanceof SubProcess) { handleSubProcess((SubProcess) flowElement, container); } else if (flowElement instanceof CallActivity) { handleCallActivity((CallActivity) flowElement, container); } else if (flowElement instanceof Task) { handleTask((Task) flowElement, container); } else if (flowElement instanceof Event) { handleEvent((Event) flowElement, container); } else if (flowElement instanceof DataObjectReference) { handleDataObjectReference((DataObjectReference) flowElement, container); } else if (flowElement instanceof DataObject) { dataObjects.add((DataObject) flowElement); } else if (flowElement instanceof DataStoreReference) { handleDataStoreReference((DataStoreReference) flowElement, container); } else { } if (flowElement instanceof Activity) { Activity activity = (Activity) flowElement; handleDataInputAssociations(activity.getDataInputAssociations(), container); handleDataOutputAssociations(activity.getDataOutputAssociations(), container); } else if (flowElement instanceof CatchEvent) { CatchEvent catchEvent = (CatchEvent) flowElement; handleDataOutputAssociations(catchEvent.getDataOutputAssociation(), container); } else if (flowElement instanceof ThrowEvent) { ThrowEvent throwEvent = (ThrowEvent) flowElement; handleDataInputAssociations(throwEvent.getDataInputAssociation(), container); } } for (DataObject dataObject : dataObjects) { handleDataObject(dataObject, container); } for (BoundaryEvent boundaryEvent : boundaryEvents) { handleEvent(boundaryEvent, container); } } | /**
* processes all {@link FlowElement FlowElements} in a given container.
*
* @param container
* @param flowElementsToBeDrawn
*/ | processes all <code>FlowElement FlowElements</code> in a given container | handleFlowElements | {
"repo_name": "camunda/camunda-eclipse-plugin",
"path": "org.camunda.bpm.modeler/src/org/camunda/bpm/modeler/core/importer/ModelImport.java",
"license": "epl-1.0",
"size": 36227
} | [
"java.util.ArrayList",
"java.util.List",
"org.eclipse.bpmn2.Activity",
"org.eclipse.bpmn2.BoundaryEvent",
"org.eclipse.bpmn2.CallActivity",
"org.eclipse.bpmn2.CatchEvent",
"org.eclipse.bpmn2.DataObject",
"org.eclipse.bpmn2.DataObjectReference",
"org.eclipse.bpmn2.DataStoreReference",
"org.eclipse.bpmn2.Event",
"org.eclipse.bpmn2.FlowElement",
"org.eclipse.bpmn2.Gateway",
"org.eclipse.bpmn2.SubProcess",
"org.eclipse.bpmn2.Task",
"org.eclipse.bpmn2.ThrowEvent",
"org.eclipse.graphiti.mm.pictograms.ContainerShape"
] | import java.util.ArrayList; import java.util.List; import org.eclipse.bpmn2.Activity; import org.eclipse.bpmn2.BoundaryEvent; import org.eclipse.bpmn2.CallActivity; import org.eclipse.bpmn2.CatchEvent; import org.eclipse.bpmn2.DataObject; import org.eclipse.bpmn2.DataObjectReference; import org.eclipse.bpmn2.DataStoreReference; import org.eclipse.bpmn2.Event; import org.eclipse.bpmn2.FlowElement; import org.eclipse.bpmn2.Gateway; import org.eclipse.bpmn2.SubProcess; import org.eclipse.bpmn2.Task; import org.eclipse.bpmn2.ThrowEvent; import org.eclipse.graphiti.mm.pictograms.ContainerShape; | import java.util.*; import org.eclipse.bpmn2.*; import org.eclipse.graphiti.mm.pictograms.*; | [
"java.util",
"org.eclipse.bpmn2",
"org.eclipse.graphiti"
] | java.util; org.eclipse.bpmn2; org.eclipse.graphiti; | 2,551,156 |
public static long swapLong(long value)
{
return
( ( ( value >> 0 ) & 0xff ) << 56 ) +
( ( ( value >> 8 ) & 0xff ) << 48 ) +
( ( ( value >> 16 ) & 0xff ) << 40 ) +
( ( ( value >> 24 ) & 0xff ) << 32 ) +
( ( ( value >> 32 ) & 0xff ) << 24 ) +
( ( ( value >> 40 ) & 0xff ) << 16 ) +
( ( ( value >> 48 ) & 0xff ) << 8 ) +
( ( ( value >> 56 ) & 0xff ) << 0 );
}
public static class LoadMapper
extends Mapper<NullWritable, NullWritable, NullWritable, NullWritable>
{
protected long recordsToWrite;
protected Connection connection;
protected BufferedMutator mutator;
protected Configuration conf;
protected int numBackReferencesPerRow;
protected String shortTaskId;
protected Random rand = new Random();
protected Counter rowsWritten, refsWritten; | static long function(long value) { return ( ( ( value >> 0 ) & 0xff ) << 56 ) + ( ( ( value >> 8 ) & 0xff ) << 48 ) + ( ( ( value >> 16 ) & 0xff ) << 40 ) + ( ( ( value >> 24 ) & 0xff ) << 32 ) + ( ( ( value >> 32 ) & 0xff ) << 24 ) + ( ( ( value >> 40 ) & 0xff ) << 16 ) + ( ( ( value >> 48 ) & 0xff ) << 8 ) + ( ( ( value >> 56 ) & 0xff ) << 0 ); } public static class LoadMapper extends Mapper<NullWritable, NullWritable, NullWritable, NullWritable> { protected long recordsToWrite; protected Connection connection; protected BufferedMutator mutator; protected Configuration conf; protected int numBackReferencesPerRow; protected String shortTaskId; protected Random rand = new Random(); protected Counter rowsWritten, refsWritten; | /**
* Converts a "long" value between endian systems.
* Borrowed from Apache Commons IO
* @param value value to convert
* @return the converted value
*/ | Converts a "long" value between endian systems. Borrowed from Apache Commons IO | swapLong | {
"repo_name": "HubSpot/hbase",
"path": "hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestLoadAndVerify.java",
"license": "apache-2.0",
"size": 25432
} | [
"java.util.Random",
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.hbase.client.BufferedMutator",
"org.apache.hadoop.hbase.client.Connection",
"org.apache.hadoop.io.NullWritable",
"org.apache.hadoop.mapreduce.Counter",
"org.apache.hadoop.mapreduce.Mapper"
] | import java.util.Random; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.client.BufferedMutator; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.io.NullWritable; import org.apache.hadoop.mapreduce.Counter; import org.apache.hadoop.mapreduce.Mapper; | import java.util.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.io.*; import org.apache.hadoop.mapreduce.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 107,996 |
private void _getKeysWithInterest(int interestType, Object interestArg, boolean allowTombstones,
SetCollector collector) throws IOException {
// this could be parallelized by building up a list of buckets for each
// vm and sending out the requests for keys in parallel. That might dump
// more onto this vm in one swoop than it could handle, though, so we're
// keeping it simple for now
int totalBuckets = getTotalNumberOfBuckets();
int retryAttempts = calcRetry();
for (int bucket = 0; bucket < totalBuckets; bucket++) {
Set bucketSet = null;
int lbucket = bucket;
final RetryTimeKeeper retryTime = new RetryTimeKeeper(Integer.MAX_VALUE);
InternalDistributedMember bucketNode = getOrCreateNodeForBucketRead(lbucket);
for (int count = 0; count <= retryAttempts; count++) {
if (logger.isDebugEnabled()) {
logger.debug("_getKeysWithInterest bucketId={} attempt={}", bucket, (count + 1));
}
try {
if (bucketNode != null) {
if (bucketNode.equals(getMyId())) {
bucketSet = this.dataStore.handleRemoteGetKeys(lbucket, interestType, interestArg,
allowTombstones);
} else {
FetchKeysResponse r = FetchKeysMessage.sendInterestQuery(bucketNode, this, lbucket,
interestType, interestArg, allowTombstones);
bucketSet = r.waitForKeys();
}
}
break;
} catch (PRLocallyDestroyedException ignore) {
if (logger.isDebugEnabled()) {
logger.debug("_getKeysWithInterest: Encountered PRLocallyDestroyedException");
}
checkReadiness();
} catch (ForceReattemptException prce) {
// no checkKey possible
if (logger.isDebugEnabled()) {
logger.debug("_getKeysWithInterest: retry attempt: {}", count, prce);
}
checkReadiness();
InternalDistributedMember lastTarget = bucketNode;
bucketNode = getOrCreateNodeForBucketRead(lbucket);
if (lastTarget.equals(bucketNode)) {
if (retryTime.overMaximum()) {
break;
}
retryTime.waitToRetryNode();
}
}
} // for(count)
if (bucketSet != null) {
collector.receiveSet(bucketSet);
}
} // for(bucket)
} | void function(int interestType, Object interestArg, boolean allowTombstones, SetCollector collector) throws IOException { int totalBuckets = getTotalNumberOfBuckets(); int retryAttempts = calcRetry(); for (int bucket = 0; bucket < totalBuckets; bucket++) { Set bucketSet = null; int lbucket = bucket; final RetryTimeKeeper retryTime = new RetryTimeKeeper(Integer.MAX_VALUE); InternalDistributedMember bucketNode = getOrCreateNodeForBucketRead(lbucket); for (int count = 0; count <= retryAttempts; count++) { if (logger.isDebugEnabled()) { logger.debug(STR, bucket, (count + 1)); } try { if (bucketNode != null) { if (bucketNode.equals(getMyId())) { bucketSet = this.dataStore.handleRemoteGetKeys(lbucket, interestType, interestArg, allowTombstones); } else { FetchKeysResponse r = FetchKeysMessage.sendInterestQuery(bucketNode, this, lbucket, interestType, interestArg, allowTombstones); bucketSet = r.waitForKeys(); } } break; } catch (PRLocallyDestroyedException ignore) { if (logger.isDebugEnabled()) { logger.debug(STR); } checkReadiness(); } catch (ForceReattemptException prce) { if (logger.isDebugEnabled()) { logger.debug(STR, count, prce); } checkReadiness(); InternalDistributedMember lastTarget = bucketNode; bucketNode = getOrCreateNodeForBucketRead(lbucket); if (lastTarget.equals(bucketNode)) { if (retryTime.overMaximum()) { break; } retryTime.waitToRetryNode(); } } } if (bucketSet != null) { collector.receiveSet(bucketSet); } } } | /**
* finds all the keys matching the given interest type and passes them to the given collector
*
* @param allowTombstones whether to return destroyed entries
*/ | finds all the keys matching the given interest type and passes them to the given collector | _getKeysWithInterest | {
"repo_name": "PurelyApplied/geode",
"path": "geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java",
"license": "apache-2.0",
"size": 379321
} | [
"java.io.IOException",
"java.util.Set",
"org.apache.geode.distributed.internal.membership.InternalDistributedMember",
"org.apache.geode.internal.cache.partitioned.FetchKeysMessage",
"org.apache.geode.internal.cache.partitioned.PRLocallyDestroyedException"
] | import java.io.IOException; import java.util.Set; import org.apache.geode.distributed.internal.membership.InternalDistributedMember; import org.apache.geode.internal.cache.partitioned.FetchKeysMessage; import org.apache.geode.internal.cache.partitioned.PRLocallyDestroyedException; | import java.io.*; import java.util.*; import org.apache.geode.distributed.internal.membership.*; import org.apache.geode.internal.cache.partitioned.*; | [
"java.io",
"java.util",
"org.apache.geode"
] | java.io; java.util; org.apache.geode; | 762,284 |
List<IObject> checkImage(Image object)
throws DSOutOfServiceException, DSAccessException
{
isSessionAlive();
try {
IDeletePrx service = getDeleteService();
if (service == null) service = getDeleteService();
return service.checkImageDelete(object.getId().getValue(), true);
} catch (Exception e) {
handleException(e, "Cannot delete the image: "+object.getId());
}
return new ArrayList<IObject>();
}
| List<IObject> checkImage(Image object) throws DSOutOfServiceException, DSAccessException { isSessionAlive(); try { IDeletePrx service = getDeleteService(); if (service == null) service = getDeleteService(); return service.checkImageDelete(object.getId().getValue(), true); } catch (Exception e) { handleException(e, STR+object.getId()); } return new ArrayList<IObject>(); } | /**
* Returns the list of object than can prevent the delete.
*
* @param object The object to handle.
* @return See above.
* @throws DSOutOfServiceException If the connection is broken, or logged
* in.
* @throws DSAccessException If an error occurred while trying to
* retrieve data from OMEDS service.
*/ | Returns the list of object than can prevent the delete | checkImage | {
"repo_name": "joshmoore/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/env/data/OMEROGateway.java",
"license": "gpl-2.0",
"size": 264705
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 854,305 |
public void doPreFilter(final HttpServletRequest request)
throws ServletException {
} | void function(final HttpServletRequest request) throws ServletException { } | /** This method can be overridden to allow a subclass to set up ready for a
* transformation.
*
* @param request Incoming HttpServletRequest object
* @throws ServletException
*/ | This method can be overridden to allow a subclass to set up ready for a transformation | doPreFilter | {
"repo_name": "nblair/bw-util",
"path": "bw-util-servlet-filters/src/main/java/org/bedework/util/servlet/filters/AbstractFilter.java",
"license": "apache-2.0",
"size": 5886
} | [
"javax.servlet.ServletException",
"javax.servlet.http.HttpServletRequest"
] | import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; | import javax.servlet.*; import javax.servlet.http.*; | [
"javax.servlet"
] | javax.servlet; | 313,451 |
public CustomChainableMap<K, V> cPutAll(Map<? extends K, ? extends V> m) {
this.getBackingMap().putAll(m);
return this;
}
| CustomChainableMap<K, V> function(Map<? extends K, ? extends V> m) { this.getBackingMap().putAll(m); return this; } | /**
* Version of the putAll method that allows chaining.
*
* @param m
* @return
*/ | Version of the putAll method that allows chaining | cPutAll | {
"repo_name": "paul-manjarres/another-logserver",
"path": "another-logserver/another-logserver-common/src/main/java/org/another/logserver/common/utils/CustomChainableMap.java",
"license": "apache-2.0",
"size": 4321
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 228,563 |
@Test
public void testSpreadOutSlotAllocationStrategy() throws Exception {
try (SlotManagerImpl slotManager = createSlotManagerBuilder()
.setSlotMatchingStrategy(LeastUtilizationSlotMatchingStrategy.INSTANCE)
.buildAndStartWithDirectExec(ResourceManagerId.generate(), new TestingResourceActionsBuilder().build())) {
final List<CompletableFuture<JobID>> requestSlotFutures = new ArrayList<>();
final int numberTaskExecutors = 5;
// register n TaskExecutors with 2 slots each
for (int i = 0; i < numberTaskExecutors; i++) {
final CompletableFuture<JobID> requestSlotFuture = new CompletableFuture<>();
requestSlotFutures.add(requestSlotFuture);
registerTaskExecutorWithTwoSlots(slotManager, requestSlotFuture);
}
final JobID jobId = new JobID();
// request n slots
for (int i = 0; i < numberTaskExecutors; i++) {
assertTrue(slotManager.registerSlotRequest(createSlotRequest(jobId)));
}
// check that every TaskExecutor has received a slot request
final Set<JobID> jobIds = new HashSet<>(FutureUtils.combineAll(requestSlotFutures).get(10L, TimeUnit.SECONDS));
assertThat(jobIds, hasSize(1));
assertThat(jobIds, containsInAnyOrder(jobId));
}
} | void function() throws Exception { try (SlotManagerImpl slotManager = createSlotManagerBuilder() .setSlotMatchingStrategy(LeastUtilizationSlotMatchingStrategy.INSTANCE) .buildAndStartWithDirectExec(ResourceManagerId.generate(), new TestingResourceActionsBuilder().build())) { final List<CompletableFuture<JobID>> requestSlotFutures = new ArrayList<>(); final int numberTaskExecutors = 5; for (int i = 0; i < numberTaskExecutors; i++) { final CompletableFuture<JobID> requestSlotFuture = new CompletableFuture<>(); requestSlotFutures.add(requestSlotFuture); registerTaskExecutorWithTwoSlots(slotManager, requestSlotFuture); } final JobID jobId = new JobID(); for (int i = 0; i < numberTaskExecutors; i++) { assertTrue(slotManager.registerSlotRequest(createSlotRequest(jobId))); } final Set<JobID> jobIds = new HashSet<>(FutureUtils.combineAll(requestSlotFutures).get(10L, TimeUnit.SECONDS)); assertThat(jobIds, hasSize(1)); assertThat(jobIds, containsInAnyOrder(jobId)); } } | /**
* The spread out slot allocation strategy should spread out the allocated
* slots across all available TaskExecutors. See FLINK-12122.
*/ | The spread out slot allocation strategy should spread out the allocated slots across all available TaskExecutors. See FLINK-12122 | testSpreadOutSlotAllocationStrategy | {
"repo_name": "jinglining/flink",
"path": "flink-runtime/src/test/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManagerImplTest.java",
"license": "apache-2.0",
"size": 72682
} | [
"java.util.ArrayList",
"java.util.HashSet",
"java.util.List",
"java.util.Set",
"java.util.concurrent.CompletableFuture",
"java.util.concurrent.TimeUnit",
"org.apache.flink.api.common.JobID",
"org.apache.flink.runtime.concurrent.FutureUtils",
"org.apache.flink.runtime.resourcemanager.ResourceManagerId",
"org.hamcrest.Matchers",
"org.junit.Assert"
] | import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.concurrent.TimeUnit; import org.apache.flink.api.common.JobID; import org.apache.flink.runtime.concurrent.FutureUtils; import org.apache.flink.runtime.resourcemanager.ResourceManagerId; import org.hamcrest.Matchers; import org.junit.Assert; | import java.util.*; import java.util.concurrent.*; import org.apache.flink.api.common.*; import org.apache.flink.runtime.concurrent.*; import org.apache.flink.runtime.resourcemanager.*; import org.hamcrest.*; import org.junit.*; | [
"java.util",
"org.apache.flink",
"org.hamcrest",
"org.junit"
] | java.util; org.apache.flink; org.hamcrest; org.junit; | 845,705 |
public GVRSceneObject loadModelFromURL(String urlString) throws IOException {
return loadModelFromURL(urlString, false);
} | GVRSceneObject function(String urlString) throws IOException { return loadModelFromURL(urlString, false); } | /**
* Simple, high-level method to load a scene object {@link GVRModelSceneObject} from
* a 3D model from a URL.
*
* @param urlString
* A URL string pointing to where the model file is located.
*
* @return A {@link GVRModelSceneObject} that contains the meshes with textures and bones
* and animations.
*
* @throws IOException
* File does not exist or cannot be read
*
*/ | Simple, high-level method to load a scene object <code>GVRModelSceneObject</code> from a 3D model from a URL | loadModelFromURL | {
"repo_name": "mwitchwilliams/GearVRf",
"path": "GVRf/Framework/framework/src/main/java/org/gearvrf/GVRContext.java",
"license": "apache-2.0",
"size": 133515
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,654,902 |
public void nameFromFilename()
{
if (!Const.isEmpty(filename))
{
setName( Const.createName(filename) );
}
} | void function() { if (!Const.isEmpty(filename)) { setName( Const.createName(filename) ); } } | /**
* Builds a name for the transformation. If no name is yet set, create the name
* from the filename.
*/ | Builds a name for the transformation. If no name is yet set, create the name from the filename | nameFromFilename | {
"repo_name": "lihongqiang/kettle-4.4.0-stable",
"path": "src/org/pentaho/di/trans/TransMeta.java",
"license": "apache-2.0",
"size": 249634
} | [
"org.pentaho.di.core.Const"
] | import org.pentaho.di.core.Const; | import org.pentaho.di.core.*; | [
"org.pentaho.di"
] | org.pentaho.di; | 643,416 |
public void libTesting()
{
lf("testing Gel");
JFrame frame = new JFrame(unitName);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(new Label("hello. i am an accessory window."));
GCanvas canvas = new GCanvas();
frame.add(canvas);
frame.setLocation(100, 200);
frame.setSize(500, 500);
frame.setVisible(true);
GElement el1 = new GElement().setCanvas(canvas).setMoveTo(new Point(10, 0));
GElement el2 = new GElement().setCanvas(canvas).setMoveTo(new Point(0, 10));
new GConnector().setFrom(el1).setTo(el2).setCanvas(canvas);
new GContainer().setSize(100, 100).addReferencingElement(el1).addReferencingElement(el2).setCanvas(canvas);
}
| void function() { lf(STR); JFrame frame = new JFrame(unitName); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new Label(STR)); GCanvas canvas = new GCanvas(); frame.add(canvas); frame.setLocation(100, 200); frame.setSize(500, 500); frame.setVisible(true); GElement el1 = new GElement().setCanvas(canvas).setMoveTo(new Point(10, 0)); GElement el2 = new GElement().setCanvas(canvas).setMoveTo(new Point(0, 10)); new GConnector().setFrom(el1).setTo(el2).setCanvas(canvas); new GContainer().setSize(100, 100).addReferencingElement(el1).addReferencingElement(el2).setCanvas(canvas); } | /**
* Tests correct inclusion of external functionality.
*/ | Tests correct inclusion of external functionality | libTesting | {
"repo_name": "andreiolaru-ro/net.xqhs.aTasker",
"path": "test/testing/Tester.java",
"license": "gpl-3.0",
"size": 2429
} | [
"java.awt.Label",
"java.awt.Point",
"javax.swing.JFrame",
"net.xqhs.graphical.GCanvas",
"net.xqhs.graphical.GConnector",
"net.xqhs.graphical.GContainer",
"net.xqhs.graphical.GElement"
] | import java.awt.Label; import java.awt.Point; import javax.swing.JFrame; import net.xqhs.graphical.GCanvas; import net.xqhs.graphical.GConnector; import net.xqhs.graphical.GContainer; import net.xqhs.graphical.GElement; | import java.awt.*; import javax.swing.*; import net.xqhs.graphical.*; | [
"java.awt",
"javax.swing",
"net.xqhs.graphical"
] | java.awt; javax.swing; net.xqhs.graphical; | 2,876,058 |
protected void writeSerializedData( final ObjectOutputStream stream,
final Object o )
throws IOException {
stream.writeObject( o );
} | void function( final ObjectOutputStream stream, final Object o ) throws IOException { stream.writeObject( o ); } | /**
* Handles the serialization of an single element of this table.
*
* @param stream the stream which should write the object
* @param o the object that should be serialized
* @throws java.io.IOException if an IO error occured
*/ | Handles the serialization of an single element of this table | writeSerializedData | {
"repo_name": "EgorZhuk/pentaho-reporting",
"path": "libraries/libbase/src/main/java/org/pentaho/reporting/libraries/base/util/ObjectTable.java",
"license": "lgpl-2.1",
"size": 12351
} | [
"java.io.IOException",
"java.io.ObjectOutputStream"
] | import java.io.IOException; import java.io.ObjectOutputStream; | import java.io.*; | [
"java.io"
] | java.io; | 2,566,058 |
private void reference(StringBuilder sb, Map<String,String> map, Rover rover, boolean primitivesAllowed) {
char type = rover.take();
sb.append(type);
if (type == '[') {
reference(sb, map, rover, true);
} else if (type == 'L') {
String fqnb = rover.upTo("<;.");
sb.append(fqnb);
body(sb, map, rover);
while (rover.peek() == '.') {
sb.append(rover.take('.'));
sb.append(rover.upTo("<;."));
body(sb, map, rover);
}
sb.append(rover.take(';'));
} else if (type == 'T') {
String name = rover.upTo(";");
name = assign(map, name);
sb.append(name);
sb.append(rover.take(';'));
} else {
if (!primitivesAllowed)
throw new IllegalStateException("Primitives are not allowed without an array");
}
} | void function(StringBuilder sb, Map<String,String> map, Rover rover, boolean primitivesAllowed) { char type = rover.take(); sb.append(type); if (type == '[') { reference(sb, map, rover, true); } else if (type == 'L') { String fqnb = rover.upTo("<;."); sb.append(fqnb); body(sb, map, rover); while (rover.peek() == '.') { sb.append(rover.take('.')); sb.append(rover.upTo("<;.")); body(sb, map, rover); } sb.append(rover.take(';')); } else if (type == 'T') { String name = rover.upTo(";"); name = assign(map, name); sb.append(name); sb.append(rover.take(';')); } else { if (!primitivesAllowed) throw new IllegalStateException(STR); } } | /**
* The heart of the routine. Handle a reference to a type. Can be an array,
* a class, a type variable, or a primitive.
*
* @param sb
* @param map
* @param rover
* @param primitivesAllowed
*/ | The heart of the routine. Handle a reference to a type. Can be an array, a class, a type variable, or a primitive | reference | {
"repo_name": "joansmith/bnd",
"path": "biz.aQute.bndlib/src/aQute/bnd/compatibility/Signatures.java",
"license": "apache-2.0",
"size": 13616
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 830,360 |
@Override
public void draw(Graphics2D g2, XYPlot plot, Rectangle2D dataArea,
ValueAxis domainAxis, ValueAxis rangeAxis,
int rendererIndex,
PlotRenderingInfo info) {
PlotOrientation orientation = plot.getOrientation();
RectangleEdge domainEdge = Plot.resolveDomainAxisLocation(
plot.getDomainAxisLocation(), orientation);
RectangleEdge rangeEdge = Plot.resolveRangeAxisLocation(
plot.getRangeAxisLocation(), orientation);
// compute transform matrix elements via sample points. Assume no
// rotation or shear.
Rectangle2D bounds = this.shape.getBounds2D();
double x0 = bounds.getMinX();
double x1 = bounds.getMaxX();
double xx0 = domainAxis.valueToJava2D(x0, dataArea, domainEdge);
double xx1 = domainAxis.valueToJava2D(x1, dataArea, domainEdge);
double m00 = (xx1 - xx0) / (x1 - x0);
double m02 = xx0 - x0 * m00;
double y0 = bounds.getMaxY();
double y1 = bounds.getMinY();
double yy0 = rangeAxis.valueToJava2D(y0, dataArea, rangeEdge);
double yy1 = rangeAxis.valueToJava2D(y1, dataArea, rangeEdge);
double m11 = (yy1 - yy0) / (y1 - y0);
double m12 = yy0 - m11 * y0;
// create transform & transform shape
Shape s = null;
if (orientation == PlotOrientation.HORIZONTAL) {
AffineTransform t1 = new AffineTransform(0.0f, 1.0f, 1.0f, 0.0f,
0.0f, 0.0f);
AffineTransform t2 = new AffineTransform(m11, 0.0f, 0.0f, m00,
m12, m02);
s = t1.createTransformedShape(this.shape);
s = t2.createTransformedShape(s);
}
else if (orientation == PlotOrientation.VERTICAL) {
AffineTransform t = new AffineTransform(m00, 0, 0, m11, m02, m12);
s = t.createTransformedShape(this.shape);
}
if (this.fillPaint != null) {
g2.setPaint(this.fillPaint);
g2.fill(s);
}
if (this.stroke != null && this.outlinePaint != null) {
g2.setPaint(this.outlinePaint);
g2.setStroke(this.stroke);
g2.draw(s);
}
addEntity(info, s, rendererIndex, getToolTipText(), getURL());
} | void function(Graphics2D g2, XYPlot plot, Rectangle2D dataArea, ValueAxis domainAxis, ValueAxis rangeAxis, int rendererIndex, PlotRenderingInfo info) { PlotOrientation orientation = plot.getOrientation(); RectangleEdge domainEdge = Plot.resolveDomainAxisLocation( plot.getDomainAxisLocation(), orientation); RectangleEdge rangeEdge = Plot.resolveRangeAxisLocation( plot.getRangeAxisLocation(), orientation); Rectangle2D bounds = this.shape.getBounds2D(); double x0 = bounds.getMinX(); double x1 = bounds.getMaxX(); double xx0 = domainAxis.valueToJava2D(x0, dataArea, domainEdge); double xx1 = domainAxis.valueToJava2D(x1, dataArea, domainEdge); double m00 = (xx1 - xx0) / (x1 - x0); double m02 = xx0 - x0 * m00; double y0 = bounds.getMaxY(); double y1 = bounds.getMinY(); double yy0 = rangeAxis.valueToJava2D(y0, dataArea, rangeEdge); double yy1 = rangeAxis.valueToJava2D(y1, dataArea, rangeEdge); double m11 = (yy1 - yy0) / (y1 - y0); double m12 = yy0 - m11 * y0; Shape s = null; if (orientation == PlotOrientation.HORIZONTAL) { AffineTransform t1 = new AffineTransform(0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f); AffineTransform t2 = new AffineTransform(m11, 0.0f, 0.0f, m00, m12, m02); s = t1.createTransformedShape(this.shape); s = t2.createTransformedShape(s); } else if (orientation == PlotOrientation.VERTICAL) { AffineTransform t = new AffineTransform(m00, 0, 0, m11, m02, m12); s = t.createTransformedShape(this.shape); } if (this.fillPaint != null) { g2.setPaint(this.fillPaint); g2.fill(s); } if (this.stroke != null && this.outlinePaint != null) { g2.setPaint(this.outlinePaint); g2.setStroke(this.stroke); g2.draw(s); } addEntity(info, s, rendererIndex, getToolTipText(), getURL()); } | /**
* Draws the annotation. This method is usually called by the
* {@link XYPlot} class, you shouldn't need to call it directly.
*
* @param g2 the graphics device.
* @param plot the plot.
* @param dataArea the data area.
* @param domainAxis the domain axis.
* @param rangeAxis the range axis.
* @param rendererIndex the renderer index.
* @param info the plot rendering info.
*/ | Draws the annotation. This method is usually called by the <code>XYPlot</code> class, you shouldn't need to call it directly | draw | {
"repo_name": "oskopek/jfreechart-fse",
"path": "src/main/java/org/jfree/chart/annotations/XYShapeAnnotation.java",
"license": "lgpl-2.1",
"size": 11347
} | [
"java.awt.Graphics2D",
"java.awt.Shape",
"java.awt.geom.AffineTransform",
"java.awt.geom.Rectangle2D",
"org.jfree.chart.axis.ValueAxis",
"org.jfree.chart.plot.Plot",
"org.jfree.chart.plot.PlotOrientation",
"org.jfree.chart.plot.PlotRenderingInfo",
"org.jfree.chart.plot.XYPlot",
"org.jfree.chart.ui.RectangleEdge"
] | import java.awt.Graphics2D; import java.awt.Shape; import java.awt.geom.AffineTransform; import java.awt.geom.Rectangle2D; import org.jfree.chart.axis.ValueAxis; import org.jfree.chart.plot.Plot; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.plot.PlotRenderingInfo; import org.jfree.chart.plot.XYPlot; import org.jfree.chart.ui.RectangleEdge; | import java.awt.*; import java.awt.geom.*; import org.jfree.chart.axis.*; import org.jfree.chart.plot.*; import org.jfree.chart.ui.*; | [
"java.awt",
"org.jfree.chart"
] | java.awt; org.jfree.chart; | 1,205,678 |
protected Settings restClientSettings() {
Settings.Builder builder = Settings.builder();
if (System.getProperty("tests.rest.client_path_prefix") != null) {
builder.put(CLIENT_PATH_PREFIX, System.getProperty("tests.rest.client_path_prefix"));
}
return builder.build();
} | Settings function() { Settings.Builder builder = Settings.builder(); if (System.getProperty(STR) != null) { builder.put(CLIENT_PATH_PREFIX, System.getProperty(STR)); } return builder.build(); } | /**
* Used to obtain settings for the REST client that is used to send REST requests.
*/ | Used to obtain settings for the REST client that is used to send REST requests | restClientSettings | {
"repo_name": "uschindler/elasticsearch",
"path": "test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java",
"license": "apache-2.0",
"size": 65113
} | [
"org.elasticsearch.client.RequestOptions",
"org.elasticsearch.common.settings.Settings"
] | import org.elasticsearch.client.RequestOptions; import org.elasticsearch.common.settings.Settings; | import org.elasticsearch.client.*; import org.elasticsearch.common.settings.*; | [
"org.elasticsearch.client",
"org.elasticsearch.common"
] | org.elasticsearch.client; org.elasticsearch.common; | 1,445,550 |
void publishEventOutsideUI(@Nonnull String eventName, @Nullable List<?> args); | void publishEventOutsideUI(@Nonnull String eventName, @Nullable List<?> args); | /**
* Publishes an event.<p>
* Listeners will be notified outside of the UI thread.
*
* @param eventName the name of the event
* @param args event arguments sent to listeners
*/ | Publishes an event. Listeners will be notified outside of the UI thread | publishEventOutsideUI | {
"repo_name": "tschulte/griffon",
"path": "subprojects/griffon-core/src/main/java/griffon/core/event/EventPublisher.java",
"license": "apache-2.0",
"size": 6185
} | [
"java.util.List",
"javax.annotation.Nonnull",
"javax.annotation.Nullable"
] | import java.util.List; import javax.annotation.Nonnull; import javax.annotation.Nullable; | import java.util.*; import javax.annotation.*; | [
"java.util",
"javax.annotation"
] | java.util; javax.annotation; | 1,173,300 |
public static DelegatedInstanceFactory empty(int initialMapSize) {
return of(new HashMap<>(initialMapSize));
} | static DelegatedInstanceFactory function(int initialMapSize) { return of(new HashMap<>(initialMapSize)); } | /**
* Creates a new instance of DelegatedInstanceFactory with a new map.
*
* @param initialMapSize the initial map size
* @return the instance
* @see #of(Map)
*/ | Creates a new instance of DelegatedInstanceFactory with a new map | empty | {
"repo_name": "InfinityRefactoring/8R-Reflections",
"path": "src/main/java/com/infinityrefactoring/reflections/DelegatedInstanceFactory.java",
"license": "apache-2.0",
"size": 6274
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 2,043,748 |
public void initDefault () {
initParty(new Party());
}
| void function () { initParty(new Party()); } | /**
* Initialize model with default values.
*/ | Initialize model with default values | initDefault | {
"repo_name": "Club-Rock-ISEN/EntryManager",
"path": "src/main/java/org/clubrockisen/model/PartyModel.java",
"license": "bsd-3-clause",
"size": 7521
} | [
"org.clubrockisen.entities.Party"
] | import org.clubrockisen.entities.Party; | import org.clubrockisen.entities.*; | [
"org.clubrockisen.entities"
] | org.clubrockisen.entities; | 2,035,919 |
public static void setTimerBarIncrement(Player player, String message, int seconds) {
setTimerBarIncrement(player, message, new int[]{seconds, 20}, null);
} | static void function(Player player, String message, int seconds) { setTimerBarIncrement(player, message, new int[]{seconds, 20}, null); } | /**
* Assign a timer bar (incrementing) to a player, with a specified message and number of seconds.
*
* @param player Player to assign this bar to.
* @param message String message to be displayed on the bar.
* @param seconds Number of seconds for this bar to take to fully fill.
*/ | Assign a timer bar (incrementing) to a player, with a specified message and number of seconds | setTimerBarIncrement | {
"repo_name": "ewized/CommonUtils",
"path": "src/main/java/com/archeinteractive/dev/commonutils/bossbar/BossBar.java",
"license": "gpl-3.0",
"size": 18117
} | [
"org.bukkit.entity.Player"
] | import org.bukkit.entity.Player; | import org.bukkit.entity.*; | [
"org.bukkit.entity"
] | org.bukkit.entity; | 1,465,347 |
private ModelImport<M> getConflict(M model, Set<M> done) throws RestrictionEvaluationException {
ModelImport<M> result = null;
if (null != model) {
if (!done.contains(model)) {
done.add(model);
result = getConflict(model.getName(), model.getVersion());
for (int i = 0; null == result && i < model.getImportsCount(); i++) {
@SuppressWarnings("unchecked")
ModelImport<M> imp = (ModelImport<M>) model.getImport(i);
if (!imp.isConflict() && null != imp.getResolved()) {
result = getConflict(imp.getResolved(), done);
}
}
}
}
return result;
} | ModelImport<M> function(M model, Set<M> done) throws RestrictionEvaluationException { ModelImport<M> result = null; if (null != model) { if (!done.contains(model)) { done.add(model); result = getConflict(model.getName(), model.getVersion()); for (int i = 0; null == result && i < model.getImportsCount(); i++) { @SuppressWarnings(STR) ModelImport<M> imp = (ModelImport<M>) model.getImport(i); if (!imp.isConflict() && null != imp.getResolved()) { result = getConflict(imp.getResolved(), done); } } } } return result; } | /**
* Returns the first conflict <code>model</code> and its (recursive) imports have with the conflict import
* statements collected in this context.
*
* @param model the model information to search for (may be <b>null</b>
* @param done the models visited so far (cycle check)
* @return the first conflict or <b>null</b> if there is none
* @throws RestrictionEvaluationException in case of evaluation problems
*/ | Returns the first conflict <code>model</code> and its (recursive) imports have with the conflict import statements collected in this context | getConflict | {
"repo_name": "SSEHUB/EASyProducer",
"path": "Plugins/VarModel/Utils/src/net/ssehub/easy/basics/modelManagement/ResolutionContext.java",
"license": "apache-2.0",
"size": 13125
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 386,660 |
@Nonnull
public ManagedAppStatusRawRequest select(@Nonnull final String value) {
addSelectOption(value);
return this;
} | ManagedAppStatusRawRequest function(@Nonnull final String value) { addSelectOption(value); return this; } | /**
* Sets the select clause for the request
*
* @param value the select clause
* @return the updated request
*/ | Sets the select clause for the request | select | {
"repo_name": "microsoftgraph/msgraph-sdk-java",
"path": "src/main/java/com/microsoft/graph/requests/ManagedAppStatusRawRequest.java",
"license": "mit",
"size": 6159
} | [
"javax.annotation.Nonnull"
] | import javax.annotation.Nonnull; | import javax.annotation.*; | [
"javax.annotation"
] | javax.annotation; | 2,246,913 |
int UNPROCESSABLE_ENTITY = 422;
int TOO_MANY_REQUESTS = 429; // response code returned in some cases
int SERVICE_UNAVAILABLE = 503;
JSONObject getJSONResponse(WebTarget target); | int UNPROCESSABLE_ENTITY = 422; int TOO_MANY_REQUESTS = 429; int SERVICE_UNAVAILABLE = 503; JSONObject getJSONResponse(WebTarget target); | /**
* Invoke a GET call on the web target and return the result as a parsed JSON object. Throws a QuandlRuntimeException if there was a CSV
* parsing problem or response code was not OK
*
* @param target the WebTarget describing the call to make, not null
* @return the parsed JSON object
*/ | Invoke a GET call on the web target and return the result as a parsed JSON object. Throws a QuandlRuntimeException if there was a CSV parsing problem or response code was not OK | getJSONResponse | {
"repo_name": "jimmoores/quandl4j",
"path": "core/src/main/java/com/jimmoores/quandl/util/RESTDataProvider.java",
"license": "apache-2.0",
"size": 1768
} | [
"javax.ws.rs.client.WebTarget",
"org.json.JSONObject"
] | import javax.ws.rs.client.WebTarget; import org.json.JSONObject; | import javax.ws.rs.client.*; import org.json.*; | [
"javax.ws",
"org.json"
] | javax.ws; org.json; | 1,033,177 |
@Test
public void testPutAllStoreSomeOverlapWriterNoOverlapSomeFailWithAbort() throws Exception {
Map<String, String> originalStoreContent = getEntryMap(KEY_SET_A, KEY_SET_B);
FakeStore fakeStore = new FakeStore(originalStoreContent);
this.store = spy(fakeStore);
Map<String, String> originalWriterContent = getEntryMap(KEY_SET_A, KEY_SET_B, KEY_SET_D);
FakeCacheLoaderWriter fakeLoaderWriter = new FakeCacheLoaderWriter(originalWriterContent, KEY_SET_C);
fakeLoaderWriter.setCompleteFailureKey("keyC4");
this.cacheLoaderWriter = spy(fakeLoaderWriter);
InternalCache<String, String> ehcache = this.getEhcache(this.cacheLoaderWriter);
Map<String, String> contentUpdates = getAltEntryMap("new_", fanIn(KEY_SET_A, KEY_SET_C));
Set<String> expectedFailures = KEY_SET_C;
Map<String, String> expectedSuccesses = copyWithout(contentUpdates, expectedFailures);
try {
ehcache.putAll(contentUpdates);
fail();
} catch (BulkCacheWritingException e) {
// Expected
assertThat(e.getSuccesses(), Matchers.equalTo(expectedSuccesses.keySet()));
assertThat(e.getFailures().keySet(), Matchers.equalTo(expectedFailures));
}
verify(this.store, atLeast(1)).bulkCompute(this.bulkComputeSetCaptor.capture(), getAnyEntryIterableFunction());
assertThat(this.getBulkComputeArgs(), everyItem(isIn(contentUpdates.keySet())));
assertThat(fakeStore.getEntryMap(), equalTo(union(originalStoreContent, expectedSuccesses)));
verify(this.cacheLoaderWriter, atLeast(1)).writeAll(getAnyEntryIterable());
assertThat(fakeLoaderWriter.getEntryMap(), equalTo(union(originalWriterContent, expectedSuccesses)));
verifyZeroInteractions(this.resilienceStrategy);
validateStats(ehcache, EnumSet.noneOf(CacheOperationOutcomes.PutOutcome.class));
validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.PutAllOutcome.FAILURE));
assertThat(ehcache.getBulkMethodEntries().get(BulkOps.PUT_ALL).intValue(), is(expectedSuccesses.size()));
} | void function() throws Exception { Map<String, String> originalStoreContent = getEntryMap(KEY_SET_A, KEY_SET_B); FakeStore fakeStore = new FakeStore(originalStoreContent); this.store = spy(fakeStore); Map<String, String> originalWriterContent = getEntryMap(KEY_SET_A, KEY_SET_B, KEY_SET_D); FakeCacheLoaderWriter fakeLoaderWriter = new FakeCacheLoaderWriter(originalWriterContent, KEY_SET_C); fakeLoaderWriter.setCompleteFailureKey("keyC4"); this.cacheLoaderWriter = spy(fakeLoaderWriter); InternalCache<String, String> ehcache = this.getEhcache(this.cacheLoaderWriter); Map<String, String> contentUpdates = getAltEntryMap("new_", fanIn(KEY_SET_A, KEY_SET_C)); Set<String> expectedFailures = KEY_SET_C; Map<String, String> expectedSuccesses = copyWithout(contentUpdates, expectedFailures); try { ehcache.putAll(contentUpdates); fail(); } catch (BulkCacheWritingException e) { assertThat(e.getSuccesses(), Matchers.equalTo(expectedSuccesses.keySet())); assertThat(e.getFailures().keySet(), Matchers.equalTo(expectedFailures)); } verify(this.store, atLeast(1)).bulkCompute(this.bulkComputeSetCaptor.capture(), getAnyEntryIterableFunction()); assertThat(this.getBulkComputeArgs(), everyItem(isIn(contentUpdates.keySet()))); assertThat(fakeStore.getEntryMap(), equalTo(union(originalStoreContent, expectedSuccesses))); verify(this.cacheLoaderWriter, atLeast(1)).writeAll(getAnyEntryIterable()); assertThat(fakeLoaderWriter.getEntryMap(), equalTo(union(originalWriterContent, expectedSuccesses))); verifyZeroInteractions(this.resilienceStrategy); validateStats(ehcache, EnumSet.noneOf(CacheOperationOutcomes.PutOutcome.class)); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.PutAllOutcome.FAILURE)); assertThat(ehcache.getBulkMethodEntries().get(BulkOps.PUT_ALL).intValue(), is(expectedSuccesses.size())); } | /**
* Tests {@link EhcacheWithLoaderWriter#putAll(Map)} for
* <ul>
* <li>non-empty request map</li>
* <li>populated {@code Store} - some keys overlap request</li>
* <li>populated {@code CacheLoaderWriter} - some keys overlap</li>
* <li>some {@link CacheLoaderWriter#writeAll(Iterable)} calls fail</li>
* <li>at least one {@link CacheLoaderWriter#writeAll(Iterable)} call aborts</li>
* </ul>
*/ | Tests <code>EhcacheWithLoaderWriter#putAll(Map)</code> for non-empty request map populated Store - some keys overlap request populated CacheLoaderWriter - some keys overlap some <code>CacheLoaderWriter#writeAll(Iterable)</code> calls fail at least one <code>CacheLoaderWriter#writeAll(Iterable)</code> call aborts | testPutAllStoreSomeOverlapWriterNoOverlapSomeFailWithAbort | {
"repo_name": "alexsnaps/ehcache3",
"path": "core/src/test/java/org/ehcache/core/EhcacheWithLoaderWriterBasicPutAllTest.java",
"license": "apache-2.0",
"size": 95478
} | [
"java.util.EnumSet",
"java.util.Map",
"java.util.Set",
"org.ehcache.core.EhcacheBasicBulkUtil",
"org.ehcache.core.EhcacheBasicPutAllTest",
"org.ehcache.core.statistics.BulkOps",
"org.ehcache.core.statistics.CacheOperationOutcomes",
"org.ehcache.spi.loaderwriter.BulkCacheWritingException",
"org.hamcrest.Matchers",
"org.junit.Assert",
"org.mockito.Mockito"
] | import java.util.EnumSet; import java.util.Map; import java.util.Set; import org.ehcache.core.EhcacheBasicBulkUtil; import org.ehcache.core.EhcacheBasicPutAllTest; import org.ehcache.core.statistics.BulkOps; import org.ehcache.core.statistics.CacheOperationOutcomes; import org.ehcache.spi.loaderwriter.BulkCacheWritingException; import org.hamcrest.Matchers; import org.junit.Assert; import org.mockito.Mockito; | import java.util.*; import org.ehcache.core.*; import org.ehcache.core.statistics.*; import org.ehcache.spi.loaderwriter.*; import org.hamcrest.*; import org.junit.*; import org.mockito.*; | [
"java.util",
"org.ehcache.core",
"org.ehcache.spi",
"org.hamcrest",
"org.junit",
"org.mockito"
] | java.util; org.ehcache.core; org.ehcache.spi; org.hamcrest; org.junit; org.mockito; | 1,193,912 |
public ParseNode ParsesOk(String stmt) {
SqlScanner input = new SqlScanner(new StringReader(stmt));
SqlParser parser = new SqlParser(input);
ParseNode node = null;
try {
node = (ParseNode) parser.parse().value;
} catch (Exception e) {
e.printStackTrace();
fail("\nParser error:\n" + parser.getErrorMsg(stmt));
}
assertNotNull(node);
return node;
} | ParseNode function(String stmt) { SqlScanner input = new SqlScanner(new StringReader(stmt)); SqlParser parser = new SqlParser(input); ParseNode node = null; try { node = (ParseNode) parser.parse().value; } catch (Exception e) { e.printStackTrace(); fail(STR + parser.getErrorMsg(stmt)); } assertNotNull(node); return node; } | /**
* Parse 'stmt' and return the root ParseNode.
*/ | Parse 'stmt' and return the root ParseNode | ParsesOk | {
"repo_name": "scalingdata/Impala",
"path": "fe/src/test/java/com/cloudera/impala/analysis/AnalyzerTest.java",
"license": "apache-2.0",
"size": 30097
} | [
"java.io.StringReader",
"org.junit.Assert"
] | import java.io.StringReader; import org.junit.Assert; | import java.io.*; import org.junit.*; | [
"java.io",
"org.junit"
] | java.io; org.junit; | 2,806,890 |
EAttribute getElementReferenceExpression_ArrayAccess(); | EAttribute getElementReferenceExpression_ArrayAccess(); | /**
* Returns the meta object for the attribute '{@link org.yakindu.base.expressions.expressions.ElementReferenceExpression#isArrayAccess <em>Array Access</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Array Access</em>'.
* @see org.yakindu.base.expressions.expressions.ElementReferenceExpression#isArrayAccess()
* @see #getElementReferenceExpression()
* @generated
*/ | Returns the meta object for the attribute '<code>org.yakindu.base.expressions.expressions.ElementReferenceExpression#isArrayAccess Array Access</code>'. | getElementReferenceExpression_ArrayAccess | {
"repo_name": "Yakindu/statecharts",
"path": "plugins/org.yakindu.base.expressions/emf-gen/org/yakindu/base/expressions/expressions/ExpressionsPackage.java",
"license": "epl-1.0",
"size": 108238
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,930,874 |
@GET
@Path("{organizationId}/apis/{apiId}/versions/{version}/policies/{policyId}")
@Produces(MediaType.APPLICATION_JSON)
public PolicyBean getApiPolicy(@PathParam("organizationId") String organizationId,
@PathParam("apiId") String apiId, @PathParam("version") String version,
@PathParam("policyId") long policyId) throws OrganizationNotFoundException, ApiVersionNotFoundException,
PolicyNotFoundException, NotAuthorizedException;
| @Path(STR) @Produces(MediaType.APPLICATION_JSON) PolicyBean function(@PathParam(STR) String organizationId, @PathParam("apiId") String apiId, @PathParam(STR) String version, @PathParam(STR) long policyId) throws OrganizationNotFoundException, ApiVersionNotFoundException, PolicyNotFoundException, NotAuthorizedException; | /**
* Use this endpoint to get information about a single Policy in the API version.
* @summary Get API Policy
* @param organizationId The Organization ID.
* @param apiId The API ID.
* @param version The API version.
* @param policyId The Policy ID.
* @statuscode 200 If the Policy is successfully returned.
* @statuscode 404 If the API does not exist.
* @return Full information about the Policy.
* @throws OrganizationNotFoundException when trying to get, update, or delete an organization that does not exist
* @throws ApiVersionNotFoundException when trying to get, update, or delete an API version that does not exist
* @throws PolicyNotFoundException when trying to get, update, or delete a policy that does not exist
* @throws NotAuthorizedException when the user attempts to do or see something that they are not authorized (do not have permission) to
*/ | Use this endpoint to get information about a single Policy in the API version | getApiPolicy | {
"repo_name": "jasonchaffee/apiman",
"path": "manager/api/rest/src/main/java/io/apiman/manager/api/rest/contract/IOrganizationResource.java",
"license": "apache-2.0",
"size": 109599
} | [
"io.apiman.manager.api.beans.policies.PolicyBean",
"io.apiman.manager.api.rest.contract.exceptions.ApiVersionNotFoundException",
"io.apiman.manager.api.rest.contract.exceptions.NotAuthorizedException",
"io.apiman.manager.api.rest.contract.exceptions.OrganizationNotFoundException",
"io.apiman.manager.api.rest.contract.exceptions.PolicyNotFoundException",
"javax.ws.rs.Path",
"javax.ws.rs.PathParam",
"javax.ws.rs.Produces",
"javax.ws.rs.core.MediaType"
] | import io.apiman.manager.api.beans.policies.PolicyBean; import io.apiman.manager.api.rest.contract.exceptions.ApiVersionNotFoundException; import io.apiman.manager.api.rest.contract.exceptions.NotAuthorizedException; import io.apiman.manager.api.rest.contract.exceptions.OrganizationNotFoundException; import io.apiman.manager.api.rest.contract.exceptions.PolicyNotFoundException; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; | import io.apiman.manager.api.beans.policies.*; import io.apiman.manager.api.rest.contract.exceptions.*; import javax.ws.rs.*; import javax.ws.rs.core.*; | [
"io.apiman.manager",
"javax.ws"
] | io.apiman.manager; javax.ws; | 483,396 |
public FormatTokenPosition findImportant(FormatTokenPosition startPosition,
FormatTokenPosition limitPosition, boolean stopOnEOL, boolean backward) {
// Return immediately for equal positions
if (startPosition.equals(limitPosition)) {
return null;
}
if (backward) {
TokenItem limitToken;
int limitOffset;
if (limitPosition == null) {
limitToken = null;
limitOffset = 0;
} else { // valid limit position
limitPosition = getPreviousPosition(limitPosition);
if (limitPosition == null) {
limitToken = null;
limitOffset = 0;
} else { // valid limit position
limitToken = limitPosition.getToken();
limitOffset = limitPosition.getOffset();
}
}
startPosition = getPreviousPosition(startPosition);
if (startPosition == null) {
return null;
}
TokenItem token = startPosition.getToken();
int offset = startPosition.getOffset();
while (true) {
String text = token.getImage();
while (offset >= 0) {
if (stopOnEOL && text.charAt(offset) == '\n') {
return null;
}
if (isImportant(token, offset)) {
return getPosition(token, offset);
}
if (token == limitToken && offset == limitOffset) {
return null;
}
offset--;
}
token = token.getPrevious();
if (token == null) {
return null;
}
offset = token.getImage().length() - 1;
}
} else { // forward direction
TokenItem limitToken;
int limitOffset;
if (limitPosition == null) {
limitToken = null;
limitOffset = 0;
} else { // valid limit position
limitToken = limitPosition.getToken();
limitOffset = limitPosition.getOffset();
}
TokenItem token = startPosition.getToken();
int offset = startPosition.getOffset();
if (token == null)
return null;
while (true) {
String text = token.getImage();
int textLen = text.length();
while (offset < textLen) {
if (token == limitToken && offset == limitOffset) {
return null;
}
if (stopOnEOL && text.charAt(offset) == '\n') {
return null;
}
if (isImportant(token, offset)) {
return getPosition(token, offset);
}
offset++;
}
token = token.getNext();
if (token == null) {
return null;
}
offset = 0;
}
}
} | FormatTokenPosition function(FormatTokenPosition startPosition, FormatTokenPosition limitPosition, boolean stopOnEOL, boolean backward) { if (startPosition.equals(limitPosition)) { return null; } if (backward) { TokenItem limitToken; int limitOffset; if (limitPosition == null) { limitToken = null; limitOffset = 0; } else { limitPosition = getPreviousPosition(limitPosition); if (limitPosition == null) { limitToken = null; limitOffset = 0; } else { limitToken = limitPosition.getToken(); limitOffset = limitPosition.getOffset(); } } startPosition = getPreviousPosition(startPosition); if (startPosition == null) { return null; } TokenItem token = startPosition.getToken(); int offset = startPosition.getOffset(); while (true) { String text = token.getImage(); while (offset >= 0) { if (stopOnEOL && text.charAt(offset) == '\n') { return null; } if (isImportant(token, offset)) { return getPosition(token, offset); } if (token == limitToken && offset == limitOffset) { return null; } offset--; } token = token.getPrevious(); if (token == null) { return null; } offset = token.getImage().length() - 1; } } else { TokenItem limitToken; int limitOffset; if (limitPosition == null) { limitToken = null; limitOffset = 0; } else { limitToken = limitPosition.getToken(); limitOffset = limitPosition.getOffset(); } TokenItem token = startPosition.getToken(); int offset = startPosition.getOffset(); if (token == null) return null; while (true) { String text = token.getImage(); int textLen = text.length(); while (offset < textLen) { if (token == limitToken && offset == limitOffset) { return null; } if (stopOnEOL && text.charAt(offset) == '\n') { return null; } if (isImportant(token, offset)) { return getPosition(token, offset); } offset++; } token = token.getNext(); if (token == null) { return null; } offset = 0; } } } | /** Get the first position that is not whitespace and that is not comment.
* @param startPosition position from which the search starts.
* For the backward search the character right at startPosition
* is not considered as part of the search.
* @param limitPosition position where the search will be broken
* reporting that nothing was found. It can be null to search
* till the end or begining of the chain (depending on direction).
* @param stopOnEOL whether stop and return EOL token or continue search if
* EOL token is found.
* @param backward whether search in backward direction.
* @return first non-whitespace token or EOL or null if all the tokens
* till the begining of the chain are whitespaces.
*/ | Get the first position that is not whitespace and that is not comment | findImportant | {
"repo_name": "sitsang/studio",
"path": "src/main/java/org/netbeans/editor/ext/ExtFormatSupport.java",
"license": "gpl-3.0",
"size": 19875
} | [
"org.netbeans.editor.TokenItem"
] | import org.netbeans.editor.TokenItem; | import org.netbeans.editor.*; | [
"org.netbeans.editor"
] | org.netbeans.editor; | 523,109 |
interface WithSourcePortRanges {
Update withSourcePortRanges(List<String> sourcePortRanges);
}
} | interface WithSourcePortRanges { Update withSourcePortRanges(List<String> sourcePortRanges); } } | /**
* Specifies sourcePortRanges.
* @param sourcePortRanges The source port ranges
* @return the next update stage
*/ | Specifies sourcePortRanges | withSourcePortRanges | {
"repo_name": "navalev/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/network/v2019_08_01/NetworkSecurityGroupSecurityRule.java",
"license": "mit",
"size": 24372
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,388,756 |
try {
Cache<ClassLoader, Class> compiledClasses =
COMPILED_CACHE.get(
// "code" as a key should be sufficient as the class name
// is part of the Java code
code,
() ->
CacheBuilder.newBuilder()
.maximumSize(5)
.weakKeys()
.softValues()
.build());
return compiledClasses.get(cl, () -> doCompile(cl, name, code));
} catch (Exception e) {
throw new FlinkRuntimeException(e.getMessage(), e);
}
} | try { Cache<ClassLoader, Class> compiledClasses = COMPILED_CACHE.get( code, () -> CacheBuilder.newBuilder() .maximumSize(5) .weakKeys() .softValues() .build()); return compiledClasses.get(cl, () -> doCompile(cl, name, code)); } catch (Exception e) { throw new FlinkRuntimeException(e.getMessage(), e); } } | /**
* Compiles a generated code to a Class.
*
* @param cl the ClassLoader used to load the class
* @param name the class name
* @param code the generated code
* @param <T> the class type
* @return the compiled class
*/ | Compiles a generated code to a Class | compile | {
"repo_name": "lincoln-lil/flink",
"path": "flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/generated/CompileUtils.java",
"license": "apache-2.0",
"size": 8405
} | [
"org.apache.flink.shaded.guava30.com.google.common.cache.Cache",
"org.apache.flink.shaded.guava30.com.google.common.cache.CacheBuilder",
"org.apache.flink.util.FlinkRuntimeException"
] | import org.apache.flink.shaded.guava30.com.google.common.cache.Cache; import org.apache.flink.shaded.guava30.com.google.common.cache.CacheBuilder; import org.apache.flink.util.FlinkRuntimeException; | import org.apache.flink.shaded.guava30.com.google.common.cache.*; import org.apache.flink.util.*; | [
"org.apache.flink"
] | org.apache.flink; | 1,178,059 |
void renderAtmosphere(ModelBatch modelBatch, float alpha, double t); | void renderAtmosphere(ModelBatch modelBatch, float alpha, double t); | /**
* Renders the atmosphere.
*
* @param modelBatch The model batch to use.
* @param alpha The opacity.
* @param t The time in seconds since the start.
*/ | Renders the atmosphere | renderAtmosphere | {
"repo_name": "ari-zah/gaiasky",
"path": "core/src/gaia/cu9/ari/gaiaorbit/render/IAtmosphereRenderable.java",
"license": "lgpl-3.0",
"size": 536
} | [
"com.badlogic.gdx.graphics.g3d.ModelBatch"
] | import com.badlogic.gdx.graphics.g3d.ModelBatch; | import com.badlogic.gdx.graphics.g3d.*; | [
"com.badlogic.gdx"
] | com.badlogic.gdx; | 483,097 |
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<TagsResourceInner> createOrUpdateAtScopeWithResponse(
String scope, TagsResourceInner parameters, Context context) {
return createOrUpdateAtScopeWithResponseAsync(scope, parameters, context).block();
} | @ServiceMethod(returns = ReturnType.SINGLE) Response<TagsResourceInner> function( String scope, TagsResourceInner parameters, Context context) { return createOrUpdateAtScopeWithResponseAsync(scope, parameters, context).block(); } | /**
* This operation allows adding or replacing the entire set of tags on the specified resource or subscription. The
* specified entity can have a maximum of 50 tags.
*
* @param scope The resource scope.
* @param parameters Wrapper resource for tags API requests and responses.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return wrapper resource for tags API requests and responses.
*/ | This operation allows adding or replacing the entire set of tags on the specified resource or subscription. The specified entity can have a maximum of 50 tags | createOrUpdateAtScopeWithResponse | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanagerhybrid/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/implementation/TagOperationsClientImpl.java",
"license": "mit",
"size": 71642
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.core.util.Context",
"com.azure.resourcemanager.resources.fluent.models.TagsResourceInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.resources.fluent.models.TagsResourceInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.resources.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 2,714,836 |
public double getLowerMargin() {
return this.lowerMargin;
}
/**
* Sets the lower margin for the axis and sends an {@link AxisChangeEvent} | double function() { return this.lowerMargin; } /** * Sets the lower margin for the axis and sends an {@link AxisChangeEvent} | /**
* Returns the lower margin for the axis.
*
* @return The margin.
*
* @see #getUpperMargin()
* @see #setLowerMargin(double)
*/ | Returns the lower margin for the axis | getLowerMargin | {
"repo_name": "ceabie/jfreechart",
"path": "source/org/jfree/chart/axis/CategoryAxis.java",
"license": "lgpl-2.1",
"size": 56211
} | [
"org.jfree.chart.event.AxisChangeEvent"
] | import org.jfree.chart.event.AxisChangeEvent; | import org.jfree.chart.event.*; | [
"org.jfree.chart"
] | org.jfree.chart; | 1,142,767 |
@ApiModelProperty(value = "A list of the envelopes in the specified folder or folders. ")
public java.util.List<FolderItemV2> getFolderItems() {
return folderItems;
} | @ApiModelProperty(value = STR) java.util.List<FolderItemV2> function() { return folderItems; } | /**
* A list of the envelopes in the specified folder or folders. .
* @return folderItems
**/ | A list of the envelopes in the specified folder or folders. | getFolderItems | {
"repo_name": "docusign/docusign-java-client",
"path": "src/main/java/com/docusign/esign/model/FolderItemResponse.java",
"license": "mit",
"size": 7448
} | [
"com.docusign.esign.model.FolderItemV2",
"io.swagger.annotations.ApiModelProperty"
] | import com.docusign.esign.model.FolderItemV2; import io.swagger.annotations.ApiModelProperty; | import com.docusign.esign.model.*; import io.swagger.annotations.*; | [
"com.docusign.esign",
"io.swagger.annotations"
] | com.docusign.esign; io.swagger.annotations; | 2,582,033 |
Result cloudData = null;
try {
cloudData = detectionService.getCloudResponse(reqHeaders);
} catch (ClientException ex) {
log.error("{}", ex.getMessage());
model.addAttribute("exceptionMessage", ex.getMessage());
}
Properties properties = exampleVisitorService.getProperties(detectionService, cloudData, log);
if (properties == null) {
properties = new Properties();
}
model.addAttribute("properties", properties);
return "visitor";
} | Result cloudData = null; try { cloudData = detectionService.getCloudResponse(reqHeaders); } catch (ClientException ex) { log.error("{}", ex.getMessage()); model.addAttribute(STR, ex.getMessage()); } Properties properties = exampleVisitorService.getProperties(detectionService, cloudData, log); if (properties == null) { properties = new Properties(); } model.addAttribute(STR, properties); return STR; } | /**
* Visitor page.
*
* This web example displays the whole list of the detected user device
* properties.
*
* @param reqHeaders
* @param model
* @return
*/ | Visitor page. This web example displays the whole list of the detected user device properties | visitorInformation | {
"repo_name": "afilias-technologies/deviceatlas-cloud-java",
"path": "deviceatlas-cloud-java-examples/src/WebApp/src/main/java/com/deviceatlas/cloud/example/web/controller/VisitorController.java",
"license": "mit",
"size": 3361
} | [
"com.deviceatlas.cloud.deviceidentification.client.ClientException",
"com.deviceatlas.cloud.deviceidentification.client.Properties",
"com.deviceatlas.cloud.deviceidentification.client.Result"
] | import com.deviceatlas.cloud.deviceidentification.client.ClientException; import com.deviceatlas.cloud.deviceidentification.client.Properties; import com.deviceatlas.cloud.deviceidentification.client.Result; | import com.deviceatlas.cloud.deviceidentification.client.*; | [
"com.deviceatlas.cloud"
] | com.deviceatlas.cloud; | 1,695,868 |
private void expandParms(Tticket tticket, Event event) {
String strRet = EventUtil.expandParms(tticket.getContent(), event);
if (strRet != null) {
tticket.setContent(strRet);
}
} | void function(Tticket tticket, Event event) { String strRet = EventUtil.expandParms(tticket.getContent(), event); if (strRet != null) { tticket.setContent(strRet); } } | /**
* Expand parms in the event tticket
*/ | Expand parms in the event tticket | expandParms | {
"repo_name": "RangerRick/opennms",
"path": "opennms-config/src/main/java/org/opennms/netmgt/config/EventExpander.java",
"license": "gpl-2.0",
"size": 29114
} | [
"org.opennms.netmgt.eventd.datablock.EventUtil",
"org.opennms.netmgt.xml.event.Event",
"org.opennms.netmgt.xml.event.Tticket"
] | import org.opennms.netmgt.eventd.datablock.EventUtil; import org.opennms.netmgt.xml.event.Event; import org.opennms.netmgt.xml.event.Tticket; | import org.opennms.netmgt.eventd.datablock.*; import org.opennms.netmgt.xml.event.*; | [
"org.opennms.netmgt"
] | org.opennms.netmgt; | 1,118,506 |
public static void w(String tag, String msg, Object... args) {
if (sLevel > LEVEL_WARNING) {
return;
}
if (args.length > 0) {
msg = String.format(msg, args);
}
Log.w(tag, msg);
} | static void function(String tag, String msg, Object... args) { if (sLevel > LEVEL_WARNING) { return; } if (args.length > 0) { msg = String.format(msg, args); } Log.w(tag, msg); } | /**
* Send a WARNING log message
*
* @param tag
* @param msg
* @param args
*/ | Send a WARNING log message | w | {
"repo_name": "liu-xiao-dong/JD-Test",
"path": "common/src/main/java/com/sxjs/common/widget/pulltorefresh/util/PtrCLog.java",
"license": "apache-2.0",
"size": 6155
} | [
"android.util.Log"
] | import android.util.Log; | import android.util.*; | [
"android.util"
] | android.util; | 481,838 |
public void setTargetPanel(AbstractTargetPanel targetPanel) {
this._targetPanel = targetPanel;
} | void function(AbstractTargetPanel targetPanel) { this._targetPanel = targetPanel; } | /**
* Sets the target panel.
*
* @param targetPanel
* the new target panel
*/ | Sets the target panel | setTargetPanel | {
"repo_name": "Governance/dtgov",
"path": "dtgov-ui-war/src/main/java/org/overlord/dtgov/ui/client/local/pages/TargetPage.java",
"license": "apache-2.0",
"size": 23891
} | [
"org.overlord.dtgov.ui.client.local.pages.targets.panel.AbstractTargetPanel"
] | import org.overlord.dtgov.ui.client.local.pages.targets.panel.AbstractTargetPanel; | import org.overlord.dtgov.ui.client.local.pages.targets.panel.*; | [
"org.overlord.dtgov"
] | org.overlord.dtgov; | 2,912,510 |
public void addSubAttribute(String name, String value) {
if (name == null || name.length() == 0)
throw new IllegalArgumentException("type name is empty");
if (value == null || value.length() == 0)
throw new IllegalArgumentException("value is empty");
AttributeType type = getDictionary().getAttributeTypeByName(name);
if (type == null)
throw new IllegalArgumentException("unknown attribute type '" + name + "'");
if (type.getVendorId() == -1)
throw new IllegalArgumentException("attribute type '" + name + "' is not a Vendor-Specific sub-attribute");
if (type.getVendorId() != getChildVendorId())
throw new IllegalArgumentException("attribute type '" + name + "' does not belong to vendor ID " + getChildVendorId());
RadiusAttribute attribute = createRadiusAttribute(getDictionary(), getChildVendorId(), type.getTypeCode());
attribute.setAttributeValue(value);
addSubAttribute(attribute);
} | void function(String name, String value) { if (name == null name.length() == 0) throw new IllegalArgumentException(STR); if (value == null value.length() == 0) throw new IllegalArgumentException(STR); AttributeType type = getDictionary().getAttributeTypeByName(name); if (type == null) throw new IllegalArgumentException(STR + name + "'"); if (type.getVendorId() == -1) throw new IllegalArgumentException(STR + name + STR); if (type.getVendorId() != getChildVendorId()) throw new IllegalArgumentException(STR + name + STR + getChildVendorId()); RadiusAttribute attribute = createRadiusAttribute(getDictionary(), getChildVendorId(), type.getTypeCode()); attribute.setAttributeValue(value); addSubAttribute(attribute); } | /**
* Adds a sub-attribute with the specified name to this attribute.
*
* @param name
* name of the sub-attribute
* @param value
* value of the sub-attribute
* @exception IllegalArgumentException
* invalid sub-attribute name or value
*/ | Adds a sub-attribute with the specified name to this attribute | addSubAttribute | {
"repo_name": "talkincode/ToughRADIUS",
"path": "src/main/java/org/tinyradius/attribute/VendorSpecificAttribute.java",
"license": "lgpl-3.0",
"size": 10373
} | [
"org.tinyradius.dictionary.AttributeType"
] | import org.tinyradius.dictionary.AttributeType; | import org.tinyradius.dictionary.*; | [
"org.tinyradius.dictionary"
] | org.tinyradius.dictionary; | 85,560 |
private void updateMavlinkVersionPreference(String version) {
final Preference mavlinkVersionPref = findPreference(getString(R.string.pref_mavlink_version_key));
if (mavlinkVersionPref != null) {
if (version == null) {
mavlinkVersionPref.setSummary(getString(R.string.empty_content));
} else {
mavlinkVersionPref.setSummary('v' + version);
}
}
} | void function(String version) { final Preference mavlinkVersionPref = findPreference(getString(R.string.pref_mavlink_version_key)); if (mavlinkVersionPref != null) { if (version == null) { mavlinkVersionPref.setSummary(getString(R.string.empty_content)); } else { mavlinkVersionPref.setSummary('v' + version); } } } | /**
* This is used to update the mavlink version preference.
*
* @param version
* mavlink version
*/ | This is used to update the mavlink version preference | updateMavlinkVersionPreference | {
"repo_name": "TShapinsky/droidplanner",
"path": "Android/src/org/droidplanner/android/fragments/SettingsFragment.java",
"license": "gpl-3.0",
"size": 17824
} | [
"android.preference.Preference"
] | import android.preference.Preference; | import android.preference.*; | [
"android.preference"
] | android.preference; | 2,821,425 |
public final Criteria getCriteria()
{
return getClazzCriteria().setCacheable( cacheable );
}
| final Criteria function() { return getClazzCriteria().setCacheable( cacheable ); } | /**
* Creates a Criteria for the implementation Class type.
* <p/>
* Please note that sharing is not considered.
*
* @return a Criteria instance.
*/ | Creates a Criteria for the implementation Class type. Please note that sharing is not considered | getCriteria | {
"repo_name": "steffeli/inf5750-tracker-capture",
"path": "dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java",
"license": "bsd-3-clause",
"size": 22123
} | [
"org.hibernate.Criteria"
] | import org.hibernate.Criteria; | import org.hibernate.*; | [
"org.hibernate"
] | org.hibernate; | 1,807,413 |
public void switchUser(User user) {
mCurrentUser = user;
persistCurrentUser();
} | void function(User user) { mCurrentUser = user; persistCurrentUser(); } | /**
* Switches the current user.
*
* @param user the user to log in
*/ | Switches the current user | switchUser | {
"repo_name": "tope018/CSC439_Project",
"path": "app/src/main/java/de/fhdw/ergoholics/brainphaser/logic/UserManager.java",
"license": "gpl-3.0",
"size": 2493
} | [
"de.fhdw.ergoholics.brainphaser.model.User"
] | import de.fhdw.ergoholics.brainphaser.model.User; | import de.fhdw.ergoholics.brainphaser.model.*; | [
"de.fhdw.ergoholics"
] | de.fhdw.ergoholics; | 2,037,778 |
public static <K, InputT, OutputT>
PTransformOverrideFactory<
PCollection<KV<K, InputT>>, PCollectionTuple,
ParDo.MultiOutput<KV<K, InputT>, OutputT>>
multiOutputOverrideFactory() {
return new MultiOutputOverrideFactory<>();
}
private static class SingleOutputOverrideFactory<K, InputT, OutputT>
implements PTransformOverrideFactory<
PCollection<KV<K, InputT>>, PCollection<OutputT>,
ParDo.SingleOutput<KV<K, InputT>, OutputT>> { | static <K, InputT, OutputT> PTransformOverrideFactory< PCollection<KV<K, InputT>>, PCollectionTuple, ParDo.MultiOutput<KV<K, InputT>, OutputT>> function() { return new MultiOutputOverrideFactory<>(); } private static class SingleOutputOverrideFactory<K, InputT, OutputT> implements PTransformOverrideFactory< PCollection<KV<K, InputT>>, PCollection<OutputT>, ParDo.SingleOutput<KV<K, InputT>, OutputT>> { | /**
* Returns a {@link PTransformOverrideFactory} that replaces a multi-output
* {@link ParDo} with a composite transform specialized for the {@link DataflowRunner}.
*/ | Returns a <code>PTransformOverrideFactory</code> that replaces a multi-output <code>ParDo</code> with a composite transform specialized for the <code>DataflowRunner</code> | multiOutputOverrideFactory | {
"repo_name": "dhalperi/beam",
"path": "runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/BatchStatefulParDoOverrides.java",
"license": "apache-2.0",
"size": 11493
} | [
"org.apache.beam.sdk.runners.PTransformOverrideFactory",
"org.apache.beam.sdk.transforms.ParDo",
"org.apache.beam.sdk.values.PCollection",
"org.apache.beam.sdk.values.PCollectionTuple"
] | import org.apache.beam.sdk.runners.PTransformOverrideFactory; import org.apache.beam.sdk.transforms.ParDo; import org.apache.beam.sdk.values.PCollection; import org.apache.beam.sdk.values.PCollectionTuple; | import org.apache.beam.sdk.runners.*; import org.apache.beam.sdk.transforms.*; import org.apache.beam.sdk.values.*; | [
"org.apache.beam"
] | org.apache.beam; | 1,658,285 |
protected CmsLockInfo getLock(String sitepath) throws CmsException {
CmsObject cms = getCmsObject();
CmsUser user = cms.getRequestContext().getCurrentUser();
CmsLock lock = cms.getLock(sitepath);
if (lock.isOwnedBy(user)) {
return CmsLockInfo.forSuccess();
}
if (lock.getUserId().isNullUUID()) {
cms.lockResourceTemporary(sitepath);
return CmsLockInfo.forSuccess();
}
CmsUser owner = cms.readUser(lock.getUserId());
return CmsLockInfo.forLockedResource(owner.getName());
} | CmsLockInfo function(String sitepath) throws CmsException { CmsObject cms = getCmsObject(); CmsUser user = cms.getRequestContext().getCurrentUser(); CmsLock lock = cms.getLock(sitepath); if (lock.isOwnedBy(user)) { return CmsLockInfo.forSuccess(); } if (lock.getUserId().isNullUUID()) { cms.lockResourceTemporary(sitepath); return CmsLockInfo.forSuccess(); } CmsUser owner = cms.readUser(lock.getUserId()); return CmsLockInfo.forLockedResource(owner.getName()); } | /**
* Helper method for locking a resource which returns some information on whether the locking
* failed, and why.<p>
*
* @param sitepath the site path of the resource to lock
* @return the locking information
*
* @throws CmsException if something went wrong
*/ | Helper method for locking a resource which returns some information on whether the locking failed, and why | getLock | {
"repo_name": "serrapos/opencms-core",
"path": "src/org/opencms/gwt/CmsCoreService.java",
"license": "lgpl-2.1",
"size": 50473
} | [
"org.opencms.file.CmsObject",
"org.opencms.file.CmsUser",
"org.opencms.gwt.shared.CmsLockInfo",
"org.opencms.lock.CmsLock",
"org.opencms.main.CmsException"
] | import org.opencms.file.CmsObject; import org.opencms.file.CmsUser; import org.opencms.gwt.shared.CmsLockInfo; import org.opencms.lock.CmsLock; import org.opencms.main.CmsException; | import org.opencms.file.*; import org.opencms.gwt.shared.*; import org.opencms.lock.*; import org.opencms.main.*; | [
"org.opencms.file",
"org.opencms.gwt",
"org.opencms.lock",
"org.opencms.main"
] | org.opencms.file; org.opencms.gwt; org.opencms.lock; org.opencms.main; | 996,295 |
public Map<String, DatasetRecord> getDatasetRecords() {
return datasetRecords;
} | Map<String, DatasetRecord> function() { return datasetRecords; } | /**
* Gets the map of data set records for the event
*/ | Gets the map of data set records for the event | getDatasetRecords | {
"repo_name": "hansonchar/aws-lambda-java-libs",
"path": "aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoEvent.java",
"license": "apache-2.0",
"size": 4961
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 223,920 |
public Adapter createCallDefAdapter() {
return null;
} | Adapter function() { return null; } | /**
* Creates a new adapter for an object of class '{@link com.rockwellcollins.atc.agree.agree.CallDef <em>Call Def</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see com.rockwellcollins.atc.agree.agree.CallDef
* @generated
*/ | Creates a new adapter for an object of class '<code>com.rockwellcollins.atc.agree.agree.CallDef Call Def</code>'. This default implementation returns null so that we can easily ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway. | createCallDefAdapter | {
"repo_name": "smaccm/smaccm",
"path": "fm-workbench/agree/com.rockwellcollins.atc.agree/src-gen/com/rockwellcollins/atc/agree/agree/util/AgreeAdapterFactory.java",
"license": "bsd-3-clause",
"size": 66651
} | [
"org.eclipse.emf.common.notify.Adapter"
] | import org.eclipse.emf.common.notify.Adapter; | import org.eclipse.emf.common.notify.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 901,324 |
public DrawerBuilder withHasStableIds(boolean hasStableIds) {
this.mHasStableIds = hasStableIds;
if (mAdapter != null) {
mAdapter.setHasStableIds(hasStableIds);
}
return this;
}
// an adapter to use for the list
protected boolean mPositionBasedStateManagement = true;
protected FastAdapter<IDrawerItem> mAdapter;
protected HeaderAdapter<IDrawerItem> mHeaderAdapter = new HeaderAdapter<>();
protected ItemAdapter<IDrawerItem> mItemAdapter = new ItemAdapter<>();
protected FooterAdapter<IDrawerItem> mFooterAdapter = new FooterAdapter<>(); | DrawerBuilder function(boolean hasStableIds) { this.mHasStableIds = hasStableIds; if (mAdapter != null) { mAdapter.setHasStableIds(hasStableIds); } return this; } protected boolean mPositionBasedStateManagement = true; protected FastAdapter<IDrawerItem> mAdapter; protected HeaderAdapter<IDrawerItem> mHeaderAdapter = new HeaderAdapter<>(); protected ItemAdapter<IDrawerItem> mItemAdapter = new ItemAdapter<>(); protected FooterAdapter<IDrawerItem> mFooterAdapter = new FooterAdapter<>(); | /**
* define this if you want enable hasStableIds for the adapter which is generated.
* WARNING: only use this if you have set an identifer for all of your items else this could cause
* many weird things
*
* @param hasStableIds
* @return
*/ | define this if you want enable hasStableIds for the adapter which is generated. many weird things | withHasStableIds | {
"repo_name": "natodemon/Lunary-Ethereum-Wallet",
"path": "materialdrawer/src/main/java/com/mikepenz/materialdrawer/DrawerBuilder.java",
"license": "gpl-3.0",
"size": 67146
} | [
"com.mikepenz.fastadapter.FastAdapter",
"com.mikepenz.fastadapter.adapters.FooterAdapter",
"com.mikepenz.fastadapter.adapters.HeaderAdapter",
"com.mikepenz.fastadapter.adapters.ItemAdapter",
"com.mikepenz.materialdrawer.model.interfaces.IDrawerItem"
] | import com.mikepenz.fastadapter.FastAdapter; import com.mikepenz.fastadapter.adapters.FooterAdapter; import com.mikepenz.fastadapter.adapters.HeaderAdapter; import com.mikepenz.fastadapter.adapters.ItemAdapter; import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; | import com.mikepenz.fastadapter.*; import com.mikepenz.fastadapter.adapters.*; import com.mikepenz.materialdrawer.model.interfaces.*; | [
"com.mikepenz.fastadapter",
"com.mikepenz.materialdrawer"
] | com.mikepenz.fastadapter; com.mikepenz.materialdrawer; | 2,366,638 |
private void downloadFile(AlluxioURI path, HttpServletRequest request,
HttpServletResponse response) throws FileDoesNotExistException, IOException,
InvalidPathException, AlluxioException {
FileSystem alluxioClient = FileSystem.Factory.get();
URIStatus status = alluxioClient.getStatus(path);
long len = status.getLength();
String fileName = path.getName();
response.setContentType("application/octet-stream");
if (len <= Integer.MAX_VALUE) {
response.setContentLength((int) len);
} else {
response.addHeader("Content-Length", Long.toString(len));
}
response.addHeader("Content-Disposition", "attachment;filename=" + fileName);
FileInStream is = null;
ServletOutputStream out = null;
try {
OpenFileOptions options = OpenFileOptions.defaults().setReadType(ReadType.NO_CACHE);
is = alluxioClient.openFile(path, options);
out = response.getOutputStream();
ByteStreams.copy(is, out);
} finally {
if (out != null) {
out.flush();
out.close();
}
if (is != null) {
is.close();
}
}
} | void function(AlluxioURI path, HttpServletRequest request, HttpServletResponse response) throws FileDoesNotExistException, IOException, InvalidPathException, AlluxioException { FileSystem alluxioClient = FileSystem.Factory.get(); URIStatus status = alluxioClient.getStatus(path); long len = status.getLength(); String fileName = path.getName(); response.setContentType(STR); if (len <= Integer.MAX_VALUE) { response.setContentLength((int) len); } else { response.addHeader(STR, Long.toString(len)); } response.addHeader(STR, STR + fileName); FileInStream is = null; ServletOutputStream out = null; try { OpenFileOptions options = OpenFileOptions.defaults().setReadType(ReadType.NO_CACHE); is = alluxioClient.openFile(path, options); out = response.getOutputStream(); ByteStreams.copy(is, out); } finally { if (out != null) { out.flush(); out.close(); } if (is != null) { is.close(); } } } | /**
* This function prepares for downloading a file.
*
* @param path the path of the file to download
* @param request the {@link HttpServletRequest} object
* @param response the {@link HttpServletResponse} object
* @throws FileDoesNotExistException if the file does not exist
* @throws InvalidPathException if an invalid path is encountered
*/ | This function prepares for downloading a file | downloadFile | {
"repo_name": "ShailShah/alluxio",
"path": "core/server/master/src/main/java/alluxio/web/WebInterfaceDownloadServlet.java",
"license": "apache-2.0",
"size": 5228
} | [
"com.google.common.io.ByteStreams",
"java.io.IOException",
"javax.servlet.ServletOutputStream",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse"
] | import com.google.common.io.ByteStreams; import java.io.IOException; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; | import com.google.common.io.*; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; | [
"com.google.common",
"java.io",
"javax.servlet"
] | com.google.common; java.io; javax.servlet; | 1,690,413 |
List<String> getSupportedVirtualToolIds(); | List<String> getSupportedVirtualToolIds(); | /**
* The list of virtual tools ids supported by this provider.
*
* @return
*/ | The list of virtual tools ids supported by this provider | getSupportedVirtualToolIds | {
"repo_name": "roxolan/nakamura",
"path": "bundles/basiclti/src/main/java/org/sakaiproject/nakamura/api/basiclti/VirtualToolDataProvider.java",
"license": "apache-2.0",
"size": 1884
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,104,075 |
void advancePeekPosition(int length) throws IOException, InterruptedException; | void advancePeekPosition(int length) throws IOException, InterruptedException; | /**
* Advances the peek position by {@code length} bytes.
*
* @param length The number of bytes to peek from the input.
* @throws EOFException If the end of input was encountered.
* @throws IOException If an error occurs peeking from the input.
* @throws InterruptedException If the thread is interrupted.
*/ | Advances the peek position by length bytes | advancePeekPosition | {
"repo_name": "malizadehq/MyTelegram",
"path": "TMessagesProj/src/main/java/org/telegram/messenger/exoplayer/extractor/ExtractorInput.java",
"license": "gpl-2.0",
"size": 11071
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,137,617 |
protected void onResume() {
if (prefs.getBoolean("layout-updated", false)) {
// Restart current activity to refresh view, since some preferences
// may require using a new UI
prefs.edit().putBoolean("layout-updated", false).apply();
Intent i = getApplicationContext().getPackageManager().getLaunchIntentForPackage(
getApplicationContext().getPackageName());
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity(i);
}
if (kissBar.getVisibility() != View.VISIBLE) {
updateRecords(searchEditText.getText().toString());
displayClearOnInput();
} else {
displayKissBar(false);
}
// Activity manifest specifies stateAlwaysHidden as windowSoftInputMode
// so the keyboard will be hidden by default
// we may want to display it if the setting is set
if (prefs.getBoolean("display-keyboard", false)) {
// Display keyboard
showKeyboard();
new Handler().postDelayed(displayKeyboardRunnable, 10);
// For some weird reasons, keyboard may be hidden by the system
// So we have to run this multiple time at different time
// See https://github.com/Neamar/KISS/issues/119
new Handler().postDelayed(displayKeyboardRunnable, 100);
new Handler().postDelayed(displayKeyboardRunnable, 500);
} else {
// Not used (thanks windowSoftInputMode)
// unless coming back from KISS settings
hideKeyboard();
}
super.onResume();
} | void function() { if (prefs.getBoolean(STR, false)) { prefs.edit().putBoolean(STR, false).apply(); Intent i = getApplicationContext().getPackageManager().getLaunchIntentForPackage( getApplicationContext().getPackageName()); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP Intent.FLAG_ACTIVITY_NEW_TASK Intent.FLAG_ACTIVITY_NO_ANIMATION); startActivity(i); } if (kissBar.getVisibility() != View.VISIBLE) { updateRecords(searchEditText.getText().toString()); displayClearOnInput(); } else { displayKissBar(false); } if (prefs.getBoolean(STR, false)) { showKeyboard(); new Handler().postDelayed(displayKeyboardRunnable, 10); new Handler().postDelayed(displayKeyboardRunnable, 100); new Handler().postDelayed(displayKeyboardRunnable, 500); } else { hideKeyboard(); } super.onResume(); } | /**
* Empty text field on resume and show keyboard
*/ | Empty text field on resume and show keyboard | onResume | {
"repo_name": "7ShaYaN7/SmartLauncher",
"path": "app/src/main/java/fr/neamar/kiss/MainActivity.java",
"license": "mit",
"size": 21166
} | [
"android.content.Intent",
"android.os.Handler",
"android.view.View"
] | import android.content.Intent; import android.os.Handler; import android.view.View; | import android.content.*; import android.os.*; import android.view.*; | [
"android.content",
"android.os",
"android.view"
] | android.content; android.os; android.view; | 2,153,795 |
@Override
public Size2D arrange(BlockContainer container, Graphics2D g2,
RectangleConstraint constraint) {
LengthConstraintType w = constraint.getWidthConstraintType();
LengthConstraintType h = constraint.getHeightConstraintType();
if (w == LengthConstraintType.NONE) {
if (h == LengthConstraintType.NONE) {
return arrangeNN(container, g2);
}
else if (h == LengthConstraintType.FIXED) {
throw new RuntimeException("Not implemented.");
}
else if (h == LengthConstraintType.RANGE) {
throw new RuntimeException("Not implemented.");
}
}
else if (w == LengthConstraintType.FIXED) {
if (h == LengthConstraintType.NONE) {
throw new RuntimeException("Not implemented.");
}
else if (h == LengthConstraintType.FIXED) {
return arrangeFF(container, g2, constraint);
}
else if (h == LengthConstraintType.RANGE) {
throw new RuntimeException("Not implemented.");
}
}
else if (w == LengthConstraintType.RANGE) {
if (h == LengthConstraintType.NONE) {
throw new RuntimeException("Not implemented.");
}
else if (h == LengthConstraintType.FIXED) {
return arrangeRF(container, g2, constraint);
}
else if (h == LengthConstraintType.RANGE) {
return arrangeRR(container, g2, constraint);
}
}
return new Size2D(); // TODO: complete this
}
| Size2D function(BlockContainer container, Graphics2D g2, RectangleConstraint constraint) { LengthConstraintType w = constraint.getWidthConstraintType(); LengthConstraintType h = constraint.getHeightConstraintType(); if (w == LengthConstraintType.NONE) { if (h == LengthConstraintType.NONE) { return arrangeNN(container, g2); } else if (h == LengthConstraintType.FIXED) { throw new RuntimeException(STR); } else if (h == LengthConstraintType.RANGE) { throw new RuntimeException(STR); } } else if (w == LengthConstraintType.FIXED) { if (h == LengthConstraintType.NONE) { throw new RuntimeException(STR); } else if (h == LengthConstraintType.FIXED) { return arrangeFF(container, g2, constraint); } else if (h == LengthConstraintType.RANGE) { throw new RuntimeException(STR); } } else if (w == LengthConstraintType.RANGE) { if (h == LengthConstraintType.NONE) { throw new RuntimeException(STR); } else if (h == LengthConstraintType.FIXED) { return arrangeRF(container, g2, constraint); } else if (h == LengthConstraintType.RANGE) { return arrangeRR(container, g2, constraint); } } return new Size2D(); } | /**
* Calculates and sets the bounds of all the items in the specified
* container, subject to the given constraint. The <code>Graphics2D</code>
* can be used by some items (particularly items containing text) to
* calculate sizing parameters.
*
* @param container the container whose items are being arranged.
* @param g2 the graphics device.
* @param constraint the size constraint.
*
* @return The size of the container after arrangement of the contents.
*/ | Calculates and sets the bounds of all the items in the specified container, subject to the given constraint. The <code>Graphics2D</code> can be used by some items (particularly items containing text) to calculate sizing parameters | arrange | {
"repo_name": "oskopek/jfreechart-fse",
"path": "src/main/java/org/jfree/chart/block/ColumnArrangement.java",
"license": "lgpl-2.1",
"size": 14238
} | [
"java.awt.Graphics2D",
"org.jfree.chart.ui.Size2D"
] | import java.awt.Graphics2D; import org.jfree.chart.ui.Size2D; | import java.awt.*; import org.jfree.chart.ui.*; | [
"java.awt",
"org.jfree.chart"
] | java.awt; org.jfree.chart; | 2,547,127 |
public List<ConnectionEventListener> getListeners()
{
List<ConnectionEventListener> result = null;
synchronized (listeners)
{
result = new ArrayList<ConnectionEventListener>(listeners);
}
return result;
}
/**
* {@inheritDoc} | List<ConnectionEventListener> function() { List<ConnectionEventListener> result = null; synchronized (listeners) { result = new ArrayList<ConnectionEventListener>(listeners); } return result; } /** * {@inheritDoc} | /**
* Get listeners
* @return The value
*/ | Get listeners | getListeners | {
"repo_name": "ironjacamar/ironjacamar",
"path": "core/tests/src/test/java/org/jboss/jca/core/connectionmanager/connections/adapter/TestManagedConnection.java",
"license": "lgpl-2.1",
"size": 21632
} | [
"java.util.ArrayList",
"java.util.List",
"javax.resource.spi.ConnectionEventListener"
] | import java.util.ArrayList; import java.util.List; import javax.resource.spi.ConnectionEventListener; | import java.util.*; import javax.resource.spi.*; | [
"java.util",
"javax.resource"
] | java.util; javax.resource; | 2,280,391 |
public XPathFunction getBodyFunction() {
return bodyFunction;
} | XPathFunction function() { return bodyFunction; } | /**
* Gets the {@link XPathFunction} for getting the input message body.
* <p/>
* A default function will be assigned (if no custom assigned) when either starting this builder
* or on first evaluation.
*
* @return the function, or <tt>null</tt> if this builder has not been started/used before.
*/ | Gets the <code>XPathFunction</code> for getting the input message body. A default function will be assigned (if no custom assigned) when either starting this builder or on first evaluation | getBodyFunction | {
"repo_name": "engagepoint/camel",
"path": "camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java",
"license": "apache-2.0",
"size": 44017
} | [
"javax.xml.xpath.XPathFunction"
] | import javax.xml.xpath.XPathFunction; | import javax.xml.xpath.*; | [
"javax.xml"
] | javax.xml; | 2,808,301 |
public void testAddListener_ToAllThenRemove()
throws Exception
{
MockRemoteCacheListener<String, String> mockListener1 = new MockRemoteCacheListener<String, String>();
MockRemoteCacheListener<String, String> mockListener2 = new MockRemoteCacheListener<String, String>();
String cacheName = "testAddListenerToAllThenRemove";
// DO WORK
server.addCacheListener( cacheName, mockListener1 );
server.addCacheListener( cacheName, mockListener2 );
// VERIFY
assertEquals( "Wrong number of listeners.", 2, server.getCacheListeners( cacheName ).eventQMap.size() );
assertEquals( "Wrong listener id.", 1, mockListener1.getListenerId() );
assertEquals( "Wrong listener id.", 2, mockListener2.getListenerId() );
// DO WORK
server.removeCacheListener( cacheName, mockListener1.getListenerId() );
assertEquals( "Wrong number of listeners.", 1, server.getCacheListeners( cacheName ).eventQMap.size() );
} | void function() throws Exception { MockRemoteCacheListener<String, String> mockListener1 = new MockRemoteCacheListener<String, String>(); MockRemoteCacheListener<String, String> mockListener2 = new MockRemoteCacheListener<String, String>(); String cacheName = STR; server.addCacheListener( cacheName, mockListener1 ); server.addCacheListener( cacheName, mockListener2 ); assertEquals( STR, 2, server.getCacheListeners( cacheName ).eventQMap.size() ); assertEquals( STR, 1, mockListener1.getListenerId() ); assertEquals( STR, 2, mockListener2.getListenerId() ); server.removeCacheListener( cacheName, mockListener1.getListenerId() ); assertEquals( STR, 1, server.getCacheListeners( cacheName ).eventQMap.size() ); } | /**
* Add a listener. Pass the id of 0, verify that the server sets a new listener id. Do another
* and verify that the second gets an id of 2. Call remove Listener and verify that it is
* removed.
* <p>
* @throws Exception
*/ | Add a listener. Pass the id of 0, verify that the server sets a new listener id. Do another and verify that the second gets an id of 2. Call remove Listener and verify that it is removed. | testAddListener_ToAllThenRemove | {
"repo_name": "mohanaraosv/commons-jcs",
"path": "commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServerUnitTest.java",
"license": "apache-2.0",
"size": 17365
} | [
"org.apache.commons.jcs.auxiliary.remote.MockRemoteCacheListener"
] | import org.apache.commons.jcs.auxiliary.remote.MockRemoteCacheListener; | import org.apache.commons.jcs.auxiliary.remote.*; | [
"org.apache.commons"
] | org.apache.commons; | 452,628 |
public IndexRequest source(Map source, XContentType contentType) throws ElasticsearchGenerationException {
try {
XContentBuilder builder = XContentFactory.contentBuilder(contentType);
builder.map(source);
return source(builder);
} catch (IOException e) {
throw new ElasticsearchGenerationException("Failed to generate [" + source + "]", e);
}
}
/**
* Sets the document source to index.
*
* Note, its preferable to either set it using {@link #source(org.elasticsearch.common.xcontent.XContentBuilder)} | IndexRequest function(Map source, XContentType contentType) throws ElasticsearchGenerationException { try { XContentBuilder builder = XContentFactory.contentBuilder(contentType); builder.map(source); return source(builder); } catch (IOException e) { throw new ElasticsearchGenerationException(STR + source + "]", e); } } /** * Sets the document source to index. * * Note, its preferable to either set it using {@link #source(org.elasticsearch.common.xcontent.XContentBuilder)} | /**
* Index the Map as the provided content type.
*
* @param source The map to index
*/ | Index the Map as the provided content type | source | {
"repo_name": "jprante/elasticsearch-server",
"path": "server/src/main/java/org/elasticsearch/action/index/IndexRequest.java",
"license": "apache-2.0",
"size": 21887
} | [
"java.io.IOException",
"java.util.Map",
"org.elasticsearch.ElasticsearchGenerationException",
"org.elasticsearch.common.xcontent.XContentBuilder",
"org.elasticsearch.common.xcontent.XContentFactory",
"org.elasticsearch.common.xcontent.XContentType"
] | import java.io.IOException; import java.util.Map; import org.elasticsearch.ElasticsearchGenerationException; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentType; | import java.io.*; import java.util.*; import org.elasticsearch.*; import org.elasticsearch.common.xcontent.*; | [
"java.io",
"java.util",
"org.elasticsearch",
"org.elasticsearch.common"
] | java.io; java.util; org.elasticsearch; org.elasticsearch.common; | 518,841 |
public Date getValidityStartDate() {
return validityStartDate;
}
| Date function() { return validityStartDate; } | /**
* Gets the validity start date.
*
* @return the validity start date
*/ | Gets the validity start date | getValidityStartDate | {
"repo_name": "Wisheri/Travel-Card-Reminder",
"path": "hsl-card-library/src/main/java/com/hsl/cardproducts/eTicket.java",
"license": "apache-2.0",
"size": 8071
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 2,671,200 |
public SimpleTransform2 invert() {
float z = (m00 * m11 - m01 * m10);
if (z == 0) {
throw new GameException("Transform is not invertible.");
}
float n00 = m11 / z;
float n01 = -m01 / z;
float n10 = -m10 / z;
float n11 = m00 / z;
float n02 = -n00 * m02 - n01 * m12;
float n12 = -n10 * m02 - n11 * m12;
m00 = n00;
m01 = n01;
m02 = n02;
m10 = n10;
m11 = n11;
m12 = n12;
return this;
} | SimpleTransform2 function() { float z = (m00 * m11 - m01 * m10); if (z == 0) { throw new GameException(STR); } float n00 = m11 / z; float n01 = -m01 / z; float n10 = -m10 / z; float n11 = m00 / z; float n02 = -n00 * m02 - n01 * m12; float n12 = -n10 * m02 - n11 * m12; m00 = n00; m01 = n01; m02 = n02; m10 = n10; m11 = n11; m12 = n12; return this; } | /**
* Locally invert this Transform
* @return this Transform
*/ | Locally invert this Transform | invert | {
"repo_name": "gotcake/CakeGameEngine",
"path": "src/org/cake/game/geom/SimpleTransform2.java",
"license": "gpl-3.0",
"size": 13932
} | [
"org.cake.game.exception.GameException"
] | import org.cake.game.exception.GameException; | import org.cake.game.exception.*; | [
"org.cake.game"
] | org.cake.game; | 2,091,561 |
private List<InputStream> getInputStreamsForFile(final String filename) throws IOException {
// First try using the PropertyManager's class loader
Enumeration<URL> urls = PropertyManager.class.getClassLoader().getResources(filename);
final List<InputStream> ioStreams = new ArrayList<InputStream>();
while (urls.hasMoreElements()) {
ioStreams.add(urls.nextElement().openStream());
}
if (ioStreams.size() > 0)
return ioStreams;
// Second try, use the thread context classloader
urls = Thread.currentThread().getContextClassLoader().getResources(filename);
while (urls.hasMoreElements()) {
ioStreams.add(urls.nextElement().openConnection().getInputStream());
}
if (ioStreams.size() > 0)
return ioStreams;
// That didn't work, try again... (This way only works for single items)
final URL filePathURL = PropertyManager.class.getResource(filename);
if (filePathURL != null) {
ioStreams.add(filePathURL.openConnection().getInputStream());
return ioStreams;
}
ioStreams.add(new ClassPathResource(filename).getInputStream());
return ioStreams;
}
| List<InputStream> function(final String filename) throws IOException { Enumeration<URL> urls = PropertyManager.class.getClassLoader().getResources(filename); final List<InputStream> ioStreams = new ArrayList<InputStream>(); while (urls.hasMoreElements()) { ioStreams.add(urls.nextElement().openStream()); } if (ioStreams.size() > 0) return ioStreams; urls = Thread.currentThread().getContextClassLoader().getResources(filename); while (urls.hasMoreElements()) { ioStreams.add(urls.nextElement().openConnection().getInputStream()); } if (ioStreams.size() > 0) return ioStreams; final URL filePathURL = PropertyManager.class.getResource(filename); if (filePathURL != null) { ioStreams.add(filePathURL.openConnection().getInputStream()); return ioStreams; } ioStreams.add(new ClassPathResource(filename).getInputStream()); return ioStreams; } | /**
* Opens an inputstream (wrapped in a buffer) for the given filename using
* several mechanisms, the first being the classpath, then looking in the same
* directory as the PropertyManager (this mode will only load fall-through
* files that are included in the Pelzer.util jar)
*/ | Opens an inputstream (wrapped in a buffer) for the given filename using several mechanisms, the first being the classpath, then looking in the same directory as the PropertyManager (this mode will only load fall-through files that are included in the Pelzer.util jar) | getInputStreamsForFile | {
"repo_name": "jpelzer/pelzer-util",
"path": "src/main/java/com/pelzer/util/PropertyManager.java",
"license": "apache-2.0",
"size": 37293
} | [
"java.io.IOException",
"java.io.InputStream",
"java.util.ArrayList",
"java.util.Enumeration",
"java.util.List"
] | import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,450,086 |
public final synchronized List<TaskDetail> getTaskDetails() {
List<TaskDetail> result = new ArrayList<>();
for (Entry<String, TaskHolder> entry : tasks.entrySet()) {
TaskHolder holder = entry.getValue();
Task task = holder.task;
LocalDateTime next = LocalDateTime.now();
next = next.plusSeconds(task.timeUnit().toSeconds(task.delay(next)));
result.add(new TaskDetail(holder.id, task.name(), next,
holder.stats, task.metadata()));
}
return result;
} | final synchronized List<TaskDetail> function() { List<TaskDetail> result = new ArrayList<>(); for (Entry<String, TaskHolder> entry : tasks.entrySet()) { TaskHolder holder = entry.getValue(); Task task = holder.task; LocalDateTime next = LocalDateTime.now(); next = next.plusSeconds(task.timeUnit().toSeconds(task.delay(next))); result.add(new TaskDetail(holder.id, task.name(), next, holder.stats, task.metadata())); } return result; } | /**
* Gets list of {@link TaskDetail} structures which represents currently
* scheduled cron tasks.
* <p>
* Thread-safe function.</p>
*
* @return list of {@link TaskDetail} structures
*/ | Gets list of <code>TaskDetail</code> structures which represents currently scheduled cron tasks. Thread-safe function | getTaskDetails | {
"repo_name": "JJCron/JJCron",
"path": "src/cz/polankam/jjcron/TaskScheduler.java",
"license": "mit",
"size": 14285
} | [
"cz.polankam.jjcron.remote.TaskDetail",
"java.time.LocalDateTime",
"java.util.ArrayList",
"java.util.List",
"java.util.Map"
] | import cz.polankam.jjcron.remote.TaskDetail; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.Map; | import cz.polankam.jjcron.remote.*; import java.time.*; import java.util.*; | [
"cz.polankam.jjcron",
"java.time",
"java.util"
] | cz.polankam.jjcron; java.time; java.util; | 326,249 |
@WebMethod
boolean createAvis(
@WebParam(name = "clientRef") String clientRef,
@WebParam(name = "articleRef") String articleRef,
@WebParam(name = "batchRef") String batchRef,
@WebParam(name = "amount") BigDecimal amount,
@WebParam(name = "expectedDelivery") Date expectedDelivery,
@WebParam(name = "bestBeforeEnd") Date bestBeforeEnd,
@WebParam(name = "useNotBefore") Date useNotBefore,
@WebParam(name = "expireBatch") boolean expireBatch);
/**
* Creates an avis for the given article.
*
* In contrast to {@link #createAvis(String, String, String, BigDecimal, Date, Date, Date, boolean)} | boolean createAvis( @WebParam(name = STR) String clientRef, @WebParam(name = STR) String articleRef, @WebParam(name = STR) String batchRef, @WebParam(name = STR) BigDecimal amount, @WebParam(name = STR) Date expectedDelivery, @WebParam(name = STR) Date bestBeforeEnd, @WebParam(name = STR) Date useNotBefore, @WebParam(name = STR) boolean expireBatch); /** * Creates an avis for the given article. * * In contrast to {@link #createAvis(String, String, String, BigDecimal, Date, Date, Date, boolean)} | /**
* Creates an avis for the given article.
*
* All existing instances of this article belonging to another/old batch might be send to
* the extinguishing process depending on the expireBatch flag.
*
* @param clientRef a reference to the client
* @param articleRef a reference to the article
* @param expectedDelivery date when the delivery is expected
* @param bestBeforeEnd best before end date
* @param useNotBefore do not use this article before this date
* @param expireBatch if true, existing batches of this article must be extinguished after arrival of this article
* @return true if the avis is created successfully
*/ | Creates an avis for the given article. All existing instances of this article belonging to another/old batch might be send to the extinguishing process depending on the expireBatch flag | createAvis | {
"repo_name": "Jacksson/mywms",
"path": "server.app/los.inventory-ejb/src/de/linogistix/los/inventory/facade/ManageInventoryFacade.java",
"license": "gpl-2.0",
"size": 11856
} | [
"java.math.BigDecimal",
"java.util.Date",
"javax.jws.WebParam"
] | import java.math.BigDecimal; import java.util.Date; import javax.jws.WebParam; | import java.math.*; import java.util.*; import javax.jws.*; | [
"java.math",
"java.util",
"javax.jws"
] | java.math; java.util; javax.jws; | 1,385,128 |
private void showDeleteDialog(boolean single) {
LogUtils.i(TAG, "<showDeleteDialog> single = " + single);
removeOldFragmentByTag(DIALOG_TAG_DELETE);
FragmentManager fragmentManager = getFragmentManager();
LogUtils.i(TAG, "<showDeleteDialog> fragmentManager = " + fragmentManager);
DialogFragment newFragment = DeleteDialogFragment.newInstance(single);
((DeleteDialogFragment) newFragment).setOnClickListener(mDeleteDialogListener);
newFragment.show(fragmentManager, DIALOG_TAG_DELETE);
fragmentManager.executePendingTransactions();
} | void function(boolean single) { LogUtils.i(TAG, STR + single); removeOldFragmentByTag(DIALOG_TAG_DELETE); FragmentManager fragmentManager = getFragmentManager(); LogUtils.i(TAG, STR + fragmentManager); DialogFragment newFragment = DeleteDialogFragment.newInstance(single); ((DeleteDialogFragment) newFragment).setOnClickListener(mDeleteDialogListener); newFragment.show(fragmentManager, DIALOG_TAG_DELETE); fragmentManager.executePendingTransactions(); } | /**
* show DeleteDialogFragment
*
* @param single
* if the number of files to be deleted == 0 ?
*/ | show DeleteDialogFragment | showDeleteDialog | {
"repo_name": "rex-xxx/mt6572_x201",
"path": "packages/apps/SoundRecorder/src/com/android/soundrecorder/RecordingFileList.java",
"license": "gpl-2.0",
"size": 30682
} | [
"android.app.DialogFragment",
"android.app.FragmentManager"
] | import android.app.DialogFragment; import android.app.FragmentManager; | import android.app.*; | [
"android.app"
] | android.app; | 2,390,405 |
private void undeployRegion(Connection conn, ServerName sn,
HRegionInfo hri) throws IOException, InterruptedException {
try {
HBaseFsckRepair.closeRegionSilentlyAndWait((HConnection) conn, sn, hri);
if (!hri.isMetaTable()) {
admin.offline(hri.getRegionName());
}
} catch (IOException ioe) {
LOG.warn("Got exception when attempting to offline region "
+ Bytes.toString(hri.getRegionName()), ioe);
}
} | void function(Connection conn, ServerName sn, HRegionInfo hri) throws IOException, InterruptedException { try { HBaseFsckRepair.closeRegionSilentlyAndWait((HConnection) conn, sn, hri); if (!hri.isMetaTable()) { admin.offline(hri.getRegionName()); } } catch (IOException ioe) { LOG.warn(STR + Bytes.toString(hri.getRegionName()), ioe); } } | /**
* This method is used to undeploy a region -- close it and attempt to
* remove its state from the Master.
*/ | This method is used to undeploy a region -- close it and attempt to remove its state from the Master | undeployRegion | {
"repo_name": "joshelser/hbase",
"path": "hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java",
"license": "apache-2.0",
"size": 98829
} | [
"java.io.IOException",
"org.apache.hadoop.hbase.HRegionInfo",
"org.apache.hadoop.hbase.ServerName",
"org.apache.hadoop.hbase.client.Connection",
"org.apache.hadoop.hbase.client.HConnection"
] | import java.io.IOException; import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.client.HConnection; | import java.io.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.client.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 509,503 |
public void connect() throws Exception {
this.control = new IMRUJobControl<Model, Data>();
control.localIntermediateModelPath = options.localIntermediateModelPath;
control.modelFileName = options.modelFileNameHDFS;
control.memCache = options.memCache;
control.noDiskCache = options.noDiskCache;
control.frameSize = options.frameSize;
control.connect(options.host, options.port, options.imruPort,
options.hadoopConfPath, options.clusterConfPath);
hcc = control.hcc;
conf = control.confFactory.createConfiguration();
if (options.inputPaths != null)
options.examplePaths = options.inputPaths;
// set aggregation type
if (options.aggTreeType == null) {
int mappers = options.examplePaths.split(",").length;
// Map<String, NodeControllerInfo> map = hcc.getNodeControllerInfos();
if (mappers < 3)
control.selectNoAggregation(options.examplePaths);
else
control.selectNAryAggregation(options.examplePaths, 2);
} else if (options.aggTreeType.equals("none")) {
control.selectNoAggregation(options.examplePaths);
} else if (options.aggTreeType.equals("generic")) {
control.selectGenericAggregation(options.examplePaths,
options.aggCount);
} else if (options.aggTreeType.equals("nary")) {
Map<String, NodeControllerInfo> map = hcc.getNodeControllerInfos();
if (map.size() < 3) {
Rt.p("Change to generic aggregation because there are only "
+ map.size() + " nodes");
control.selectGenericAggregation(options.examplePaths,
options.fanIn);
} else {
control.selectNAryAggregation(options.examplePaths,
options.fanIn);
}
} else {
throw new IllegalArgumentException("Invalid aggregation tree type");
}
// hyracks connection
}
| void function() throws Exception { this.control = new IMRUJobControl<Model, Data>(); control.localIntermediateModelPath = options.localIntermediateModelPath; control.modelFileName = options.modelFileNameHDFS; control.memCache = options.memCache; control.noDiskCache = options.noDiskCache; control.frameSize = options.frameSize; control.connect(options.host, options.port, options.imruPort, options.hadoopConfPath, options.clusterConfPath); hcc = control.hcc; conf = control.confFactory.createConfiguration(); if (options.inputPaths != null) options.examplePaths = options.inputPaths; if (options.aggTreeType == null) { int mappers = options.examplePaths.split(",").length; if (mappers < 3) control.selectNoAggregation(options.examplePaths); else control.selectNAryAggregation(options.examplePaths, 2); } else if (options.aggTreeType.equals("none")) { control.selectNoAggregation(options.examplePaths); } else if (options.aggTreeType.equals(STR)) { control.selectGenericAggregation(options.examplePaths, options.aggCount); } else if (options.aggTreeType.equals("nary")) { Map<String, NodeControllerInfo> map = hcc.getNodeControllerInfos(); if (map.size() < 3) { Rt.p(STR + map.size() + STR); control.selectGenericAggregation(options.examplePaths, options.fanIn); } else { control.selectNAryAggregation(options.examplePaths, options.fanIn); } } else { throw new IllegalArgumentException(STR); } } | /**
* connect to the cluster controller
*
* @throws Exception
*/ | connect to the cluster controller | connect | {
"repo_name": "sigmod/asterixdb-analytics",
"path": "imru/imru-example/src/main/java/edu/uci/ics/hyracks/imru/example/utils/Client.java",
"license": "apache-2.0",
"size": 23375
} | [
"edu.uci.ics.hyracks.imru.api.IMRUJobControl",
"edu.uci.ics.hyracks.imru.util.Rt",
"java.util.Map",
"org.apache.hyracks.api.client.NodeControllerInfo"
] | import edu.uci.ics.hyracks.imru.api.IMRUJobControl; import edu.uci.ics.hyracks.imru.util.Rt; import java.util.Map; import org.apache.hyracks.api.client.NodeControllerInfo; | import edu.uci.ics.hyracks.imru.api.*; import edu.uci.ics.hyracks.imru.util.*; import java.util.*; import org.apache.hyracks.api.client.*; | [
"edu.uci.ics",
"java.util",
"org.apache.hyracks"
] | edu.uci.ics; java.util; org.apache.hyracks; | 2,576,022 |
public static void disposeColors() {
for (Color color : m_colorMap.values()) {
color.dispose();
}
m_colorMap.clear();
} | static void function() { for (Color color : m_colorMap.values()) { color.dispose(); } m_colorMap.clear(); } | /**
* Dispose of all the cached {@link Color}'s.
*/ | Dispose of all the cached <code>Color</code>'s | disposeColors | {
"repo_name": "capitalone/Hydrograph",
"path": "hydrograph.ui/hydrograph.ui.parametergrid/src/main/java/hydrograph/ui/parametergrid/utils/SWTResourceManager.java",
"license": "apache-2.0",
"size": 15622
} | [
"org.eclipse.swt.graphics.Color"
] | import org.eclipse.swt.graphics.Color; | import org.eclipse.swt.graphics.*; | [
"org.eclipse.swt"
] | org.eclipse.swt; | 566,987 |
public ReportBuilder error(@Nullable Throwable exception) {
this.exception = exception;
return this;
}
| ReportBuilder function(@Nullable Throwable exception) { this.exception = exception; return this; } | /**
* Set the current exception that occurred.
* @param exception - exception that occurred.
* @return This builder, for chaining.
*/ | Set the current exception that occurred | error | {
"repo_name": "dmulloy2/ProtocolLib",
"path": "src/main/java/com/comphenix/protocol/error/Report.java",
"license": "gpl-2.0",
"size": 7342
} | [
"javax.annotation.Nullable"
] | import javax.annotation.Nullable; | import javax.annotation.*; | [
"javax.annotation"
] | javax.annotation; | 1,506,318 |
void handleSetFromGlobal(JSModule module, Scope scope,
Node n, Node parent, String name,
boolean isPropAssign, Name.Type type) {
if (maybeHandlePrototypePrefix(module, scope, n, parent, name)) {
return;
}
Name nameObj = getOrCreateName(name);
nameObj.type = type;
Ref set = new Ref(module, scope, n, nameObj, Ref.Type.SET_FROM_GLOBAL,
currentPreOrderIndex++);
nameObj.addRef(set);
if (isNestedAssign(parent)) {
// This assignment is both a set and a get that creates an alias.
Ref get = new Ref(module, scope, n, nameObj, Ref.Type.ALIASING_GET,
currentPreOrderIndex++);
nameObj.addRef(get);
Ref.markTwins(set, get);
} else if (isTypeDeclaration(n)) {
// Names with a @constructor or @enum annotation are always collapsed
nameObj.setDeclaredType();
}
} | void handleSetFromGlobal(JSModule module, Scope scope, Node n, Node parent, String name, boolean isPropAssign, Name.Type type) { if (maybeHandlePrototypePrefix(module, scope, n, parent, name)) { return; } Name nameObj = getOrCreateName(name); nameObj.type = type; Ref set = new Ref(module, scope, n, nameObj, Ref.Type.SET_FROM_GLOBAL, currentPreOrderIndex++); nameObj.addRef(set); if (isNestedAssign(parent)) { Ref get = new Ref(module, scope, n, nameObj, Ref.Type.ALIASING_GET, currentPreOrderIndex++); nameObj.addRef(get); Ref.markTwins(set, get); } else if (isTypeDeclaration(n)) { nameObj.setDeclaredType(); } } | /**
* Updates our representation of the global namespace to reflect an
* assignment to a global name in global scope.
*
* @param module the current module
* @param scope the current scope
* @param n The node currently being visited
* @param parent {@code n}'s parent
* @param name The global name (e.g. "a" or "a.b.c.d")
* @param isPropAssign Whether this set corresponds to a property
* assignment of the form <code>a.b.c = ...;</code>
* @param type The type of the value that the name is being assigned
*/ | Updates our representation of the global namespace to reflect an assignment to a global name in global scope | handleSetFromGlobal | {
"repo_name": "Medium/closure-compiler",
"path": "src/com/google/javascript/jscomp/GlobalNamespace.java",
"license": "apache-2.0",
"size": 43810
} | [
"com.google.javascript.rhino.Node"
] | import com.google.javascript.rhino.Node; | import com.google.javascript.rhino.*; | [
"com.google.javascript"
] | com.google.javascript; | 330,532 |
public void setExecutionDate(LocalDate executionDate) {
this.executionDate = executionDate;
} | void function(LocalDate executionDate) { this.executionDate = executionDate; } | /**
* Sets a new execution date.
*
* @param executionDate The new execution date.
*/ | Sets a new execution date | setExecutionDate | {
"repo_name": "TrackerSB/Green2",
"path": "Green2/Programs/MemberManagement/src/main/java/bayern/steinbrecher/green2/memberManagement/people/Originator.java",
"license": "gpl-3.0",
"size": 10153
} | [
"java.time.LocalDate"
] | import java.time.LocalDate; | import java.time.*; | [
"java.time"
] | java.time; | 525,313 |
public HubRouteTableProperties withLabels(List<String> labels) {
this.labels = labels;
return this;
} | HubRouteTableProperties function(List<String> labels) { this.labels = labels; return this; } | /**
* Set the labels property: List of labels associated with this route table.
*
* @param labels the labels value to set.
* @return the HubRouteTableProperties object itself.
*/ | Set the labels property: List of labels associated with this route table | withLabels | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/fluent/models/HubRouteTableProperties.java",
"license": "mit",
"size": 3766
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,835,873 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.