method stringlengths 13 441k | clean_method stringlengths 7 313k | doc stringlengths 17 17.3k | comment stringlengths 3 1.42k | method_name stringlengths 1 273 | extra dict | imports list | imports_info stringlengths 19 34.8k | cluster_imports_info stringlengths 15 3.66k | libraries list | libraries_info stringlengths 6 661 | id int64 0 2.92M |
|---|---|---|---|---|---|---|---|---|---|---|---|
public static int[] gridEvents(final int... excl) {
if (F.isEmpty(excl))
return GRID_EVTS; | static int[] function(final int... excl) { if (F.isEmpty(excl)) return GRID_EVTS; | /**
* Gets all event types.
*
* @param excl Optional exclude events.
* @return All events minus excluded ones.
*/ | Gets all event types | gridEvents | {
"repo_name": "murador/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java",
"license": "apache-2.0",
"size": 294985
} | [
"org.apache.ignite.internal.util.typedef.F"
] | import org.apache.ignite.internal.util.typedef.F; | import org.apache.ignite.internal.util.typedef.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 1,945,007 |
public void addNode(String name, AbstractMap<String, String> attributes, String content)
{
xmlDocument.append(this.xmlElement(name, attributes, content));
} | void function(String name, AbstractMap<String, String> attributes, String content) { xmlDocument.append(this.xmlElement(name, attributes, content)); } | /**
* Add node to XML file
*/ | Add node to XML file | addNode | {
"repo_name": "guildenstern70/jurpe",
"path": "utils/src/main/java/net/littlelite/utils/XMLWriter.java",
"license": "gpl-2.0",
"size": 6667
} | [
"java.util.AbstractMap"
] | import java.util.AbstractMap; | import java.util.*; | [
"java.util"
] | java.util; | 2,871,526 |
protected void sequence_BiListAssignment_MonoListAssignment(ISerializationContext context, ListAssignment semanticObject) {
genericSequencer.createSequence(context, semanticObject);
}
| void function(ISerializationContext context, ListAssignment semanticObject) { genericSequencer.createSequence(context, semanticObject); } | /**
* Contexts:
* Assignment returns ListAssignment
*
* Constraint:
* (
* (
* feature=ID
* (leftValues+=ListAssignmentValue leftValues+=ListAssignmentValue*)?
* (rightValues+=ListAssignmentValue rightValues+=ListAssignmentValue*)?
* ) |
* (feature=ID (leftValues+=AssignmentValue leftValues+=AssignmentValue*)?)
* )
*/ | Contexts: Assignment returns ListAssignment Constraint: ( ( feature=ID (leftValues+=ListAssignmentValue leftValues+=ListAssignmentValue*)? (rightValues+=ListAssignmentValue rightValues+=ListAssignmentValue*)? ) | (feature=ID (leftValues+=AssignmentValue leftValues+=AssignmentValue*)?) ) | sequence_BiListAssignment_MonoListAssignment | {
"repo_name": "miklossy/xtext-core",
"path": "org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parser/epatch/serializer/EpatchTestLanguageSemanticSequencer.java",
"license": "epl-1.0",
"size": 22573
} | [
"org.eclipse.xtext.parser.epatch.epatchTestLanguage.ListAssignment",
"org.eclipse.xtext.serializer.ISerializationContext"
] | import org.eclipse.xtext.parser.epatch.epatchTestLanguage.ListAssignment; import org.eclipse.xtext.serializer.ISerializationContext; | import org.eclipse.xtext.parser.epatch.*; import org.eclipse.xtext.serializer.*; | [
"org.eclipse.xtext"
] | org.eclipse.xtext; | 813,970 |
public static String escapeUnsafeCharacters(String anyURI, boolean escapePercent)
{
if (anyURI==null)
return null;
// must escape % first since our escapes have % in them.
if (escapePercent)
anyURI = anyURI.replaceAll("\\"+PERCENT, (String)fCharToEscaped.get(PERCENT)); //$NON-NLS-1$
String key = null;
// escape all other characters except %
for (Iterator i = fCharToEscaped.keySet().iterator(); i.hasNext();)
{
key = (String)i.next();
if (key.equals(PERCENT))
continue;
anyURI = anyURI.replaceAll("\\"+key, (String)fCharToEscaped.get(key)); //$NON-NLS-1$
}
return anyURI;
} | static String function(String anyURI, boolean escapePercent) { if (anyURI==null) return null; if (escapePercent) anyURI = anyURI.replaceAll("\\"+PERCENT, (String)fCharToEscaped.get(PERCENT)); String key = null; for (Iterator i = fCharToEscaped.keySet().iterator(); i.hasNext();) { key = (String)i.next(); if (key.equals(PERCENT)) continue; anyURI = anyURI.replaceAll("\\"+key, (String)fCharToEscaped.get(key)); } return anyURI; } | /**
* Escapes the "delim" and "unwise" characters as specified by rfc2396. Also escapes the tilde (~) as this
* also seems to cause problems with the XSD validator. The characters are escaped using the UTF-8 hex
* notation, %HH.
*
* To do undo this operation, call convertUriToNamespace
*
* @param anyURI
* @param escapePercent - escapes '%' to it's hex value if true, ignores it otherwise.
* @return
*/ | Escapes the "delim" and "unwise" characters as specified by rfc2396. Also escapes the tilde (~) as this also seems to cause problems with the XSD validator. The characters are escaped using the UTF-8 hex notation, %HH. To do undo this operation, call convertUriToNamespace | escapeUnsafeCharacters | {
"repo_name": "chanakaudaya/developer-studio",
"path": "bps/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util/NamespaceUtils.java",
"license": "apache-2.0",
"size": 14740
} | [
"java.util.Iterator"
] | import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 2,416,252 |
@Override
public Adapter adapt(Notifier notifier, Object type) {
return super.adapt(notifier, this);
} | Adapter function(Notifier notifier, Object type) { return super.adapt(notifier, this); } | /**
* This implementation substitutes the factory itself as the key for the adapter.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This implementation substitutes the factory itself as the key for the adapter. | adapt | {
"repo_name": "CloudScale-Project/Environment",
"path": "plugins/org.scaledl.overview.edit/src/org/scaledl/overview/core/provider/CoreItemProviderAdapterFactory.java",
"license": "epl-1.0",
"size": 6368
} | [
"org.eclipse.emf.common.notify.Adapter",
"org.eclipse.emf.common.notify.Notifier"
] | import org.eclipse.emf.common.notify.Adapter; import org.eclipse.emf.common.notify.Notifier; | import org.eclipse.emf.common.notify.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,081,754 |
@Test
public final void testStoreObjectConnectionFails() {
FallbackImpl fallback = new FallbackImpl();
int lines = persistenceManager.getFallbackManager().getFallbackFileController().getNumberOfLines();
fallback.setObjectData(FallbackImpl.ERROR);
persistenceManager.storeData(fallback);
assertEquals(1, persistenceManager.getFallbackManager().getFallbackFileController().getNumberOfLines() - lines);
} | final void function() { FallbackImpl fallback = new FallbackImpl(); int lines = persistenceManager.getFallbackManager().getFallbackFileController().getNumberOfLines(); fallback.setObjectData(FallbackImpl.ERROR); persistenceManager.storeData(fallback); assertEquals(1, persistenceManager.getFallbackManager().getFallbackFileController().getNumberOfLines() - lines); } | /**
* Tests the storeData(IFallback) method when writing to the DB fails
*/ | Tests the storeData(IFallback) method when writing to the DB fails | testStoreObjectConnectionFails | {
"repo_name": "c2mon/c2mon",
"path": "c2mon-shared/c2mon-shared-persistence-manager/src/test/java/cern/c2mon/pmanager/persistence/impl/PersistenceManagerTest.java",
"license": "lgpl-3.0",
"size": 4106
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 143,613 |
@XmlElement(name = "progress")
Integer getProgress(); | @XmlElement(name = STR) Integer getProgress(); | /**
* Gets the progress percentage of the processing.
*
* @return The progress percentage of the processing.
* @since 1.0.0
*/ | Gets the progress percentage of the processing | getProgress | {
"repo_name": "stzilli/kapua",
"path": "service/device/management/registry/api/src/main/java/org/eclipse/kapua/service/device/management/registry/operation/notification/ManagementOperationNotificationCreator.java",
"license": "epl-1.0",
"size": 4657
} | [
"javax.xml.bind.annotation.XmlElement"
] | import javax.xml.bind.annotation.XmlElement; | import javax.xml.bind.annotation.*; | [
"javax.xml"
] | javax.xml; | 1,633,448 |
public List<ThesaurusSense> getSubsenses() {
return subsenses;
} | List<ThesaurusSense> function() { return subsenses; } | /**
* subsenses of word
* @return subsenses
**/ | subsenses of word | getSubsenses | {
"repo_name": "psh/OxfordDictionarySample",
"path": "app/src/main/java/com/gatebuzz/oxfordapi/model/ThesaurusSense.java",
"license": "apache-2.0",
"size": 6603
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 766,700 |
public void setWindow(Window2D window) {
this.window = window;
setBounds(getX(), getY(), window.getWidth(), window.getHeight());
} | void function(Window2D window) { this.window = window; setBounds(getX(), getY(), window.getWidth(), window.getHeight()); } | /**
* Sets the Window2D of this HUD component.
*
* @param window the Window2D to associate with this HUD component
*/ | Sets the Window2D of this HUD component | setWindow | {
"repo_name": "AsherBond/MondocosmOS",
"path": "wonderland/modules/foundation/hud/src/classes/org/jdesktop/wonderland/modules/hud/client/HUDComponent2D.java",
"license": "agpl-3.0",
"size": 7537
} | [
"org.jdesktop.wonderland.modules.appbase.client.Window2D"
] | import org.jdesktop.wonderland.modules.appbase.client.Window2D; | import org.jdesktop.wonderland.modules.appbase.client.*; | [
"org.jdesktop.wonderland"
] | org.jdesktop.wonderland; | 2,583,719 |
public static String valorParaComparacao(String valor, XMethod method,
XJavaDoc javaDoc) throws Wj2eeException {
XClass class1 = method.getPropertyType().getType();
String valueToCompare = "";
if (class1.isA(TagHandlerUtil.CLASS_NAME_COLLECTION)) {
valueToCompare = "new Long(" + valor + ")";
} else if (class1.isA(TagHandlerUtil.CLASS_NAME_DATE)) {
String formatoData = getFormatoData(javaDoc);
SimpleDateFormat sdf = new SimpleDateFormat(formatoData);
Date date;
try {
date = sdf.parse(valor);
} catch (ParseException e) {
throw new Wj2eeException(e,
"Nao foi possivel parsear o valor '" + valor
+ "' para data");
}
GregorianCalendar gregorianCalendar = new GregorianCalendar();
gregorianCalendar.setTime(date);
valueToCompare = "new GregorianCalendar("
+ gregorianCalendar.get(Calendar.YEAR) + ","
+ gregorianCalendar.get(Calendar.MONTH) + ","
+ gregorianCalendar.get(Calendar.DAY_OF_MONTH)
+ ").getTime()";
} else if (class1.isA(TagHandlerUtil.CLASS_NAME_NUMBER)) {
String numberChildClass = method.getPropertyType().getType()
.getName();
valueToCompare = "new " + numberChildClass + "(" + valor + ")";
} else if (class1.isA(TagHandlerUtil.CLASS_NAME_STRING)) {
valueToCompare = "new Long(" + valor + ")";
} else {
valueToCompare = valor + "";
}
return valueToCompare;
}
| static String function(String valor, XMethod method, XJavaDoc javaDoc) throws Wj2eeException { XClass class1 = method.getPropertyType().getType(); String valueToCompare = STRnew Long(STR)STRNao foi possivel parsear o valor 'STR' para dataSTRnew GregorianCalendar(STR,STR,STR).getTime()STRnew STR(STR)STRnew Long(STR)STR"; } return valueToCompare; } | /**
* Monta o comando java para criacao de um objeto para comparacao num
* processo de validacao
*
* @throws ParseException
*/ | Monta o comando java para criacao de um objeto para comparacao num processo de validacao | valorParaComparacao | {
"repo_name": "darciopacifico/omr",
"path": "branchs/msaf_validador/JazzXDoclet/src/main/java/xdoclet/jazzwizard/tagshandler/TagHandlerUtil.java",
"license": "apache-2.0",
"size": 90881
} | [
"java.util.GregorianCalendar",
"xdoclet.jazzwizard.Wj2eeException"
] | import java.util.GregorianCalendar; import xdoclet.jazzwizard.Wj2eeException; | import java.util.*; import xdoclet.jazzwizard.*; | [
"java.util",
"xdoclet.jazzwizard"
] | java.util; xdoclet.jazzwizard; | 2,783,301 |
public void setCreationDate(LocalDate creationDate) {
Date date = Date.from(creationDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
this.creationDate = DateUtil.date2SQLDate(date);
} | void function(LocalDate creationDate) { Date date = Date.from(creationDate.atStartOfDay(ZoneId.systemDefault()).toInstant()); this.creationDate = DateUtil.date2SQLDate(date); } | /**
* Set the creation time of the indexed document.
*/ | Set the creation time of the indexed document | setCreationDate | {
"repo_name": "auroreallibe/Silverpeas-Core",
"path": "core-library/src/main/java/org/silverpeas/core/index/indexing/model/IndexEntry.java",
"license": "agpl-3.0",
"size": 14561
} | [
"java.time.LocalDate",
"java.time.ZoneId",
"java.util.Date",
"org.silverpeas.core.util.DateUtil"
] | import java.time.LocalDate; import java.time.ZoneId; import java.util.Date; import org.silverpeas.core.util.DateUtil; | import java.time.*; import java.util.*; import org.silverpeas.core.util.*; | [
"java.time",
"java.util",
"org.silverpeas.core"
] | java.time; java.util; org.silverpeas.core; | 1,994,699 |
@Override
public int hashCode() {
return Objects.hash(caseSensitive, displaySettings, endAnchor, removeEndAnchor, removeStartAnchor, startAnchor);
} | int function() { return Objects.hash(caseSensitive, displaySettings, endAnchor, removeEndAnchor, removeStartAnchor, startAnchor); } | /**
* Returns the HashCode.
*/ | Returns the HashCode | hashCode | {
"repo_name": "docusign/docusign-java-client",
"path": "src/main/java/com/docusign/esign/model/DocumentHtmlDisplayAnchor.java",
"license": "mit",
"size": 6213
} | [
"java.util.Objects"
] | import java.util.Objects; | import java.util.*; | [
"java.util"
] | java.util; | 336,118 |
public static void setUserDyslexicFont(boolean dyslexicFont) {
userSettings.getSettings(SettingsConstants.USER_GENERAL_SETTINGS).
changePropertyValue(SettingsConstants.USER_DYSLEXIC_FONT,
"" + dyslexicFont);
userSettings.saveSettings(null);
} | static void function(boolean dyslexicFont) { userSettings.getSettings(SettingsConstants.USER_GENERAL_SETTINGS). changePropertyValue(SettingsConstants.USER_DYSLEXIC_FONT, "" + dyslexicFont); userSettings.saveSettings(null); } | /**
* Set user dyslexic font setting.
*
* @param isTrue new value for the user default font
*/ | Set user dyslexic font setting | setUserDyslexicFont | {
"repo_name": "kkashi01/appinventor-sources",
"path": "appinventor/appengine/src/com/google/appinventor/client/Ode.java",
"license": "apache-2.0",
"size": 99174
} | [
"com.google.appinventor.shared.settings.SettingsConstants"
] | import com.google.appinventor.shared.settings.SettingsConstants; | import com.google.appinventor.shared.settings.*; | [
"com.google.appinventor"
] | com.google.appinventor; | 1,342,765 |
public DeterministicKey get(List<ChildNumber> path, boolean relativePath, boolean create) {
ImmutableList<ChildNumber> absolutePath = relativePath
? ImmutableList.<ChildNumber>builder().addAll(rootPath).addAll(path).build()
: ImmutableList.copyOf(path);
if (!keys.containsKey(absolutePath)) {
if (!create)
throw new IllegalArgumentException(String.format("No key found for %s path %s.",
relativePath ? "relative" : "absolute", HDUtils.formatPath(path)));
checkArgument(absolutePath.size() > 0, "Can't derive the master key: nothing to derive from.");
DeterministicKey parent = get(absolutePath.subList(0, absolutePath.size() - 1), false, true);
putKey(HDKeyDerivation.deriveChildKey(parent, absolutePath.get(absolutePath.size() - 1)));
}
return keys.get(absolutePath);
} | DeterministicKey function(List<ChildNumber> path, boolean relativePath, boolean create) { ImmutableList<ChildNumber> absolutePath = relativePath ? ImmutableList.<ChildNumber>builder().addAll(rootPath).addAll(path).build() : ImmutableList.copyOf(path); if (!keys.containsKey(absolutePath)) { if (!create) throw new IllegalArgumentException(String.format(STR, relativePath ? STR : STR, HDUtils.formatPath(path))); checkArgument(absolutePath.size() > 0, STR); DeterministicKey parent = get(absolutePath.subList(0, absolutePath.size() - 1), false, true); putKey(HDKeyDerivation.deriveChildKey(parent, absolutePath.get(absolutePath.size() - 1))); } return keys.get(absolutePath); } | /**
* Returns a key for the given path, optionally creating it.
*
* @param path the path to the key
* @param relativePath whether the path is relative to the root path
* @param create whether the key corresponding to path should be created (with any necessary ancestors) if it doesn't exist already
* @return next newly created key using the child derivation function
* @throws IllegalArgumentException if create is false and the path was not found.
*/ | Returns a key for the given path, optionally creating it | get | {
"repo_name": "doged/dogecoindarkj",
"path": "core/src/main/java/com/dogecoindark/dogecoindarkj/crypto/DeterministicHierarchy.java",
"license": "apache-2.0",
"size": 8246
} | [
"com.google.common.base.Preconditions",
"com.google.common.collect.ImmutableList",
"java.util.List"
] | import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import java.util.List; | import com.google.common.base.*; import com.google.common.collect.*; import java.util.*; | [
"com.google.common",
"java.util"
] | com.google.common; java.util; | 2,428,059 |
//----------------------------------------------------------------------------
public boolean isFontItalic() throws TextException {
try {
FontSlant help = (FontSlant)getXPropertySet().getPropertyValue("CharPosture");
if(help == FontSlant.ITALIC) {
return true;
}
else {
return false;
}
}
catch(Exception exception) {
TextException textException = new TextException(exception.getMessage());
textException.initCause(exception);
throw textException;
}
}
| boolean function() throws TextException { try { FontSlant help = (FontSlant)getXPropertySet().getPropertyValue(STR); if(help == FontSlant.ITALIC) { return true; } else { return false; } } catch(Exception exception) { TextException textException = new TextException(exception.getMessage()); textException.initCause(exception); throw textException; } } | /**
* Returns if the text ist bold or italic or both.
*
* @return true the text is italic or both
*
* @throws TextException if the property can not be fetched
*
* @author Miriam Sutter
*/ | Returns if the text ist bold or italic or both | isFontItalic | {
"repo_name": "LibreOffice/noa-libre",
"path": "src/ag/ion/bion/officelayer/internal/text/CharacterProperties.java",
"license": "lgpl-2.1",
"size": 14422
} | [
"ag.ion.bion.officelayer.text.TextException",
"com.sun.star.awt.FontSlant"
] | import ag.ion.bion.officelayer.text.TextException; import com.sun.star.awt.FontSlant; | import ag.ion.bion.officelayer.text.*; import com.sun.star.awt.*; | [
"ag.ion.bion",
"com.sun.star"
] | ag.ion.bion; com.sun.star; | 2,140,913 |
public void testTimeIntervalCET_DST_Start() {
long interval = TimeUnit.MINUTES.toMillis(20);
DateTimeZone tz = DateTimeZone.forID("CET");
Rounding rounding = new TimeIntervalRounding(interval, tz);
// test DST start
assertThat(rounding.round(time("2016-03-27T01:55:00+01:00")), isDate(time("2016-03-27T01:40:00+01:00"), tz));
assertThat(rounding.round(time("2016-03-27T02:00:00+01:00")), isDate(time("2016-03-27T03:00:00+02:00"), tz));
assertThat(rounding.round(time("2016-03-27T03:15:00+02:00")), isDate(time("2016-03-27T03:00:00+02:00"), tz));
assertThat(rounding.round(time("2016-03-27T03:35:00+02:00")), isDate(time("2016-03-27T03:20:00+02:00"), tz));
} | void function() { long interval = TimeUnit.MINUTES.toMillis(20); DateTimeZone tz = DateTimeZone.forID("CET"); Rounding rounding = new TimeIntervalRounding(interval, tz); assertThat(rounding.round(time(STR)), isDate(time(STR), tz)); assertThat(rounding.round(time(STR)), isDate(time(STR), tz)); assertThat(rounding.round(time(STR)), isDate(time(STR), tz)); assertThat(rounding.round(time(STR)), isDate(time(STR), tz)); } | /**
* test DST start with interval rounding
* CET: 27 March 2016, 02:00:00 clocks were turned forward 1 hour to 27 March 2016, 03:00:00 local daylight time
*/ | test DST start with interval rounding | testTimeIntervalCET_DST_Start | {
"repo_name": "qwerty4030/elasticsearch",
"path": "server/src/test/java/org/elasticsearch/common/rounding/TimeZoneRoundingTests.java",
"license": "apache-2.0",
"size": 44535
} | [
"java.util.concurrent.TimeUnit",
"org.elasticsearch.common.rounding.Rounding",
"org.joda.time.DateTimeZone"
] | import java.util.concurrent.TimeUnit; import org.elasticsearch.common.rounding.Rounding; import org.joda.time.DateTimeZone; | import java.util.concurrent.*; import org.elasticsearch.common.rounding.*; import org.joda.time.*; | [
"java.util",
"org.elasticsearch.common",
"org.joda.time"
] | java.util; org.elasticsearch.common; org.joda.time; | 1,155,042 |
public Observable<ServiceResponse<Page<IntegrationAccountSchemaInner>>> listByIntegrationAccountsSinglePageAsync(final String resourceGroupName, final String integrationAccountName) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (integrationAccountName == null) {
throw new IllegalArgumentException("Parameter integrationAccountName is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
} | Observable<ServiceResponse<Page<IntegrationAccountSchemaInner>>> function(final String resourceGroupName, final String integrationAccountName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (integrationAccountName == null) { throw new IllegalArgumentException(STR); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException(STR); } | /**
* Gets a list of integration account schemas.
*
* @param resourceGroupName The resource group name.
* @param integrationAccountName The integration account name.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList<IntegrationAccountSchemaInner> object wrapped in {@link ServiceResponse} if successful.
*/ | Gets a list of integration account schemas | listByIntegrationAccountsSinglePageAsync | {
"repo_name": "martinsawicki/azure-sdk-for-java",
"path": "azure-mgmt-logic/src/main/java/com/microsoft/azure/management/logic/implementation/SchemasInner.java",
"license": "mit",
"size": 44608
} | [
"com.microsoft.azure.Page",
"com.microsoft.rest.ServiceResponse"
] | import com.microsoft.azure.Page; import com.microsoft.rest.ServiceResponse; | import com.microsoft.azure.*; import com.microsoft.rest.*; | [
"com.microsoft.azure",
"com.microsoft.rest"
] | com.microsoft.azure; com.microsoft.rest; | 1,964,243 |
@Test
public void testGetWorkSheetMergedCell() {
System.out.println("GetWorkSheetMergedCell");
String name = "test_cells.xlsx";
String sheetName = "Sheet1";
Integer mergedCellIndex = 0;
String storage = "";
String folder = "";
try {
MergedCellResponse result = cellsApi.GetWorkSheetMergedCell(name, sheetName, mergedCellIndex, storage, folder);
} catch (ApiException apiException) {
System.out.println("exp:" + apiException.getMessage());
assertNull(apiException);
}
} | void function() { System.out.println(STR); String name = STR; String sheetName = STR; Integer mergedCellIndex = 0; String storage = STRSTRexp:" + apiException.getMessage()); assertNull(apiException); } } | /**
* Test of GetWorkSheetMergedCell method, of class CellsApi.
*/ | Test of GetWorkSheetMergedCell method, of class CellsApi | testGetWorkSheetMergedCell | {
"repo_name": "aspose-cells/Aspose.Cells-for-Cloud",
"path": "SDKs/Aspose.Cells-Cloud-SDK-for-Android/Aspose.Cells-Cloud-SDK-Android/src/test/java/com/aspose/cells/api/CellsApiTest.java",
"license": "mit",
"size": 91749
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 239,902 |
EClass getTransition(); | EClass getTransition(); | /**
* Returns the meta object for class '{@link org.eclipse.xtext.resource.locationprovidertest.Transition <em>Transition</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Transition</em>'.
* @see org.eclipse.xtext.resource.locationprovidertest.Transition
* @generated
*/ | Returns the meta object for class '<code>org.eclipse.xtext.resource.locationprovidertest.Transition Transition</code>'. | getTransition | {
"repo_name": "miklossy/xtext-core",
"path": "org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/resource/locationprovidertest/LocationprovidertestPackage.java",
"license": "epl-1.0",
"size": 30586
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,294,071 |
public void shutdown() {
// This should stop the consumers! Since we already called the waitFor*Consumer() methods, this should
// stop the processing cleanly (and allow awaitTermination to end successfully and quickly)
this.continueProcessing = false;
if (null != linkExecutor) {
linkExecutor.shutdown();
try {
linkExecutor.awaitTermination(2, TimeUnit.MINUTES);
} catch (InterruptedException e) {
logger.error("Something happened while waiting for linkExecutor to be shutdown", e);
}
}
if (null != pageExecutor) {
pageExecutor.shutdown();
try {
pageExecutor.awaitTermination(2, TimeUnit.MINUTES);
} catch (InterruptedException e) {
logger.error("Something happened while waiting for pageExecutor to be shutdown", e);
}
}
if (null != wcPool) {
wcPool.close();
}
if (null != linkServiceConsumer) {
while (linkServiceConsumer.isAlive()) {
try {
logger.info("Waiting for the linkServiceConsumer thread to die...");
Thread.sleep(TimeUnit.SECONDS.toMillis(5));
} catch (InterruptedException e) {
logger.error("Something happened while waiting for linkServiceConsumer to be shutdown", e);
}
}
logger.info("... linkServiceConsumer thread is dead");
}
if (null != pageServiceConsumer) {
while (pageServiceConsumer.isAlive()) {
try {
logger.info("Waiting for the pageServiceConsumer thread to die...");
Thread.sleep(TimeUnit.SECONDS.toMillis(5));
} catch (InterruptedException e) {
logger.error("Something happened while waiting for pageServiceConsumer to be shutdown", e);
}
}
logger.info("... pageServiceConsumer thread is dead");
}
} | void function() { this.continueProcessing = false; if (null != linkExecutor) { linkExecutor.shutdown(); try { linkExecutor.awaitTermination(2, TimeUnit.MINUTES); } catch (InterruptedException e) { logger.error(STR, e); } } if (null != pageExecutor) { pageExecutor.shutdown(); try { pageExecutor.awaitTermination(2, TimeUnit.MINUTES); } catch (InterruptedException e) { logger.error(STR, e); } } if (null != wcPool) { wcPool.close(); } if (null != linkServiceConsumer) { while (linkServiceConsumer.isAlive()) { try { logger.info(STR); Thread.sleep(TimeUnit.SECONDS.toMillis(5)); } catch (InterruptedException e) { logger.error(STR, e); } } logger.info(STR); } if (null != pageServiceConsumer) { while (pageServiceConsumer.isAlive()) { try { logger.info(STR); Thread.sleep(TimeUnit.SECONDS.toMillis(5)); } catch (InterruptedException e) { logger.error(STR, e); } } logger.info(STR); } } | /**
* <p>Tell the executors ({@link #linkExecutor} and {@link #pageExecutor} to shutdown.</p>
*/ | Tell the executors (<code>#linkExecutor</code> and <code>#pageExecutor</code> to shutdown | shutdown | {
"repo_name": "cloudbearings/SiteCrawler",
"path": "src/main/java/com/salesforce/webdev/sitecrawler/SiteCrawler.java",
"license": "bsd-3-clause",
"size": 49094
} | [
"java.util.concurrent.TimeUnit"
] | import java.util.concurrent.TimeUnit; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 906,640 |
public static String getErrorResponse(Exception ex) throws IOException {
return "Error:" + ex.toString();
}
| static String function(Exception ex) throws IOException { return STR + ex.toString(); } | /**
* Utility method to send the error back to UI
*
* @param data
* @param resp
* @throws IOException
*/ | Utility method to send the error back to UI | getErrorResponse | {
"repo_name": "LookThisCode/DeveloperBus",
"path": "Season 2013/Bogota/Projects/Agronome_Grupo9/backend/agronome/src/co/com/agronome/proveedores/servlet/Util.java",
"license": "apache-2.0",
"size": 10052
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 349,441 |
public Map<String, DscConfigurationParameter> parameters() {
return this.parameters;
} | Map<String, DscConfigurationParameter> function() { return this.parameters; } | /**
* Get the parameters property: Gets or sets the configuration parameters.
*
* @return the parameters value.
*/ | Get the parameters property: Gets or sets the configuration parameters | parameters | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/automation/azure-resourcemanager-automation/src/main/java/com/azure/resourcemanager/automation/models/DscConfigurationUpdateParameters.java",
"license": "mit",
"size": 6220
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,182,298 |
public I2CPMessage take() throws InterruptedException {
return _in.take();
} | I2CPMessage function() throws InterruptedException { return _in.take(); } | /**
* Receive a message, blocking until one is available
* @return message
*/ | Receive a message, blocking until one is available | take | {
"repo_name": "oakes/Nightweb",
"path": "common/java/router/net/i2p/router/client/I2CPMessageQueueImpl.java",
"license": "unlicense",
"size": 1891
} | [
"net.i2p.data.i2cp.I2CPMessage"
] | import net.i2p.data.i2cp.I2CPMessage; | import net.i2p.data.i2cp.*; | [
"net.i2p.data"
] | net.i2p.data; | 2,691,630 |
public boolean isTransactionActive() {
try {
return getUserTransaction().getStatus() != Status.STATUS_NO_TRANSACTION;
} catch (Exception exception) {
throw new RuntimeException(exception);
}
} | boolean function() { try { return getUserTransaction().getStatus() != Status.STATUS_NO_TRANSACTION; } catch (Exception exception) { throw new RuntimeException(exception); } } | /**
* Return if the JTA transaction is active.
*/ | Return if the JTA transaction is active | isTransactionActive | {
"repo_name": "RallySoftware/eclipselink.runtime",
"path": "jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/framework/server/JEEPlatform.java",
"license": "epl-1.0",
"size": 4976
} | [
"javax.transaction.Status"
] | import javax.transaction.Status; | import javax.transaction.*; | [
"javax.transaction"
] | javax.transaction; | 2,181,941 |
public void copyFrom(QueryTreeNode node) throws StandardException {
super.copyFrom(node);
QueryTreeNodeList<N> other = (QueryTreeNodeList<N>)node;
for (N n : other.list)
list.add((N)getNodeFactory().copyNode(n, getParserContext()));
} | void function(QueryTreeNode node) throws StandardException { super.copyFrom(node); QueryTreeNodeList<N> other = (QueryTreeNodeList<N>)node; for (N n : other.list) list.add((N)getNodeFactory().copyNode(n, getParserContext())); } | /**
* Fill this node with a deep copy of the given node.
*/ | Fill this node with a deep copy of the given node | copyFrom | {
"repo_name": "youngor/openclouddb",
"path": "src/main/java/com/akiban/sql/parser/QueryTreeNodeList.java",
"license": "apache-2.0",
"size": 4355
} | [
"com.akiban.sql.StandardException"
] | import com.akiban.sql.StandardException; | import com.akiban.sql.*; | [
"com.akiban.sql"
] | com.akiban.sql; | 308,168 |
public static boolean rmR(File file) {
if (!file.exists()) {
return true;
}
boolean result = true;
if (file.isDirectory()) {
for (File subFile : file.listFiles()) {
result &= rmR(subFile);
}
} else {
result = file.delete();
}
return result;
} | static boolean function(File file) { if (!file.exists()) { return true; } boolean result = true; if (file.isDirectory()) { for (File subFile : file.listFiles()) { result &= rmR(subFile); } } else { result = file.delete(); } return result; } | /**
* rm -r
*/ | rm -r | rmR | {
"repo_name": "androidgilbert/Pioneer",
"path": "app/src/main/java/com/github/baoti/pioneer/misc/util/IoUtils.java",
"license": "apache-2.0",
"size": 17500
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 2,029,691 |
public static HRegion openHRegion(final Configuration conf, final FileSystem fs,
final Path rootDir, final HRegionInfo info, final HTableDescriptor htd, final HLog wal)
throws IOException {
return openHRegion(conf, fs, rootDir, info, htd, wal, null, null);
} | static HRegion function(final Configuration conf, final FileSystem fs, final Path rootDir, final HRegionInfo info, final HTableDescriptor htd, final HLog wal) throws IOException { return openHRegion(conf, fs, rootDir, info, htd, wal, null, null); } | /**
* Open a Region.
* @param conf The Configuration object to use.
* @param fs Filesystem to use
* @param rootDir Root directory for HBase instance
* @param info Info for region to be opened.
* @param htd the table descriptor
* @param wal HLog for region to use. This method will call
* HLog#setSequenceNumber(long) passing the result of the call to
* HRegion#getMinSequenceId() to ensure the log id is properly kept
* up. HRegionStore does this every time it opens a new region.
* @return new HRegion
* @throws IOException
*/ | Open a Region | openHRegion | {
"repo_name": "intel-hadoop/hbase-rhino",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java",
"license": "apache-2.0",
"size": 236546
} | [
"java.io.IOException",
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.fs.FileSystem",
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.hbase.HRegionInfo",
"org.apache.hadoop.hbase.HTableDescriptor",
"org.apache.hadoop.hbase.regionserver.wal.HLog"
] | import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.regionserver.wal.HLog; | import java.io.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.regionserver.wal.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 903,457 |
private List<ColumnFamilyDescriptor> createAndRegisterColumnFamilyDescriptors(
List<StateMetaInfoSnapshot> stateMetaInfoSnapshots,
boolean registerTtlCompactFilter) {
List<ColumnFamilyDescriptor> columnFamilyDescriptors =
new ArrayList<>(stateMetaInfoSnapshots.size());
for (StateMetaInfoSnapshot stateMetaInfoSnapshot : stateMetaInfoSnapshots) {
RegisteredStateMetaInfoBase metaInfoBase =
RegisteredStateMetaInfoBase.fromMetaInfoSnapshot(stateMetaInfoSnapshot);
ColumnFamilyDescriptor columnFamilyDescriptor = RocksDBOperationUtils.createColumnFamilyDescriptor(
metaInfoBase, columnFamilyOptionsFactory, registerTtlCompactFilter ? ttlCompactFiltersManager : null);
columnFamilyDescriptors.add(columnFamilyDescriptor);
}
return columnFamilyDescriptors;
} | List<ColumnFamilyDescriptor> function( List<StateMetaInfoSnapshot> stateMetaInfoSnapshots, boolean registerTtlCompactFilter) { List<ColumnFamilyDescriptor> columnFamilyDescriptors = new ArrayList<>(stateMetaInfoSnapshots.size()); for (StateMetaInfoSnapshot stateMetaInfoSnapshot : stateMetaInfoSnapshots) { RegisteredStateMetaInfoBase metaInfoBase = RegisteredStateMetaInfoBase.fromMetaInfoSnapshot(stateMetaInfoSnapshot); ColumnFamilyDescriptor columnFamilyDescriptor = RocksDBOperationUtils.createColumnFamilyDescriptor( metaInfoBase, columnFamilyOptionsFactory, registerTtlCompactFilter ? ttlCompactFiltersManager : null); columnFamilyDescriptors.add(columnFamilyDescriptor); } return columnFamilyDescriptors; } | /**
* This method recreates and registers all {@link ColumnFamilyDescriptor} from Flink's state meta data snapshot.
*/ | This method recreates and registers all <code>ColumnFamilyDescriptor</code> from Flink's state meta data snapshot | createAndRegisterColumnFamilyDescriptors | {
"repo_name": "ueshin/apache-flink",
"path": "flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/restore/RocksDBIncrementalRestoreOperation.java",
"license": "apache-2.0",
"size": 19844
} | [
"java.util.ArrayList",
"java.util.List",
"org.apache.flink.contrib.streaming.state.RocksDBOperationUtils",
"org.apache.flink.runtime.state.RegisteredStateMetaInfoBase",
"org.apache.flink.runtime.state.metainfo.StateMetaInfoSnapshot",
"org.rocksdb.ColumnFamilyDescriptor"
] | import java.util.ArrayList; import java.util.List; import org.apache.flink.contrib.streaming.state.RocksDBOperationUtils; import org.apache.flink.runtime.state.RegisteredStateMetaInfoBase; import org.apache.flink.runtime.state.metainfo.StateMetaInfoSnapshot; import org.rocksdb.ColumnFamilyDescriptor; | import java.util.*; import org.apache.flink.contrib.streaming.state.*; import org.apache.flink.runtime.state.*; import org.apache.flink.runtime.state.metainfo.*; import org.rocksdb.*; | [
"java.util",
"org.apache.flink",
"org.rocksdb"
] | java.util; org.apache.flink; org.rocksdb; | 420,469 |
@Test
void testMirrorNull()
{
final SpriteAnimated sprite = new SpriteAnimatedImpl(Graphics.createImageBuffer(64, 32), 16, 8);
assertThrows(() -> sprite.setMirror(null), "Unexpected null argument !");
}
| void testMirrorNull() { final SpriteAnimated sprite = new SpriteAnimatedImpl(Graphics.createImageBuffer(64, 32), 16, 8); assertThrows(() -> sprite.setMirror(null), STR); } | /**
* Test mirror <code>null</code>.
*/ | Test mirror <code>null</code> | testMirrorNull | {
"repo_name": "b3dgs/lionengine",
"path": "lionengine-core/src/test/java/com/b3dgs/lionengine/graphic/drawable/SpriteAnimatedTest.java",
"license": "gpl-3.0",
"size": 28639
} | [
"com.b3dgs.lionengine.UtilAssert",
"com.b3dgs.lionengine.graphic.Graphics"
] | import com.b3dgs.lionengine.UtilAssert; import com.b3dgs.lionengine.graphic.Graphics; | import com.b3dgs.lionengine.*; import com.b3dgs.lionengine.graphic.*; | [
"com.b3dgs.lionengine"
] | com.b3dgs.lionengine; | 2,215,011 |
public void deactivate(boolean forceVisibility) {
Map globalActionHandlers = getGlobalActionHandlers();
if (globalActionHandlers != null) {
for (Iterator iter = globalActionHandlers.keySet().iterator(); iter.hasNext();) {
String actionId = (String) iter.next();
getParent().setGlobalActionHandler(actionId, null);
}
}
super.deactivate(forceVisibility);
updateActionBars();
}
| void function(boolean forceVisibility) { Map globalActionHandlers = getGlobalActionHandlers(); if (globalActionHandlers != null) { for (Iterator iter = globalActionHandlers.keySet().iterator(); iter.hasNext();) { String actionId = (String) iter.next(); getParent().setGlobalActionHandler(actionId, null); } } super.deactivate(forceVisibility); updateActionBars(); } | /**
* We have to remove from the parent (CompositeEditor action bars)
* global action handlers contributed to this instance.
*/ | We have to remove from the parent (CompositeEditor action bars) global action handlers contributed to this instance | deactivate | {
"repo_name": "splinter/developer-studio",
"path": "bps/org.eclipse.bpel.common.ui/src/org/eclipse/bpel/common/ui/composite/CompositeEditorActionBars.java",
"license": "apache-2.0",
"size": 4234
} | [
"java.util.Iterator",
"java.util.Map"
] | import java.util.Iterator; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,913,893 |
public static String toString(String str, String name, @Nullable Object val, boolean sens) {
assert name != null;
Object[] propNames = new Object[1];
Object[] propVals = new Object[1];
boolean[] propSens = new boolean[1];
propNames[0] = name;
propVals[0] = val;
propSens[0] = sens;
SBLimitedLength sb = threadLocSB.get();
boolean newStr = sb.length() == 0;
try {
return toStringImpl(str, sb, propNames, propVals, propSens, 1);
}
finally {
if (newStr)
sb.reset();
}
} | static String function(String str, String name, @Nullable Object val, boolean sens) { assert name != null; Object[] propNames = new Object[1]; Object[] propVals = new Object[1]; boolean[] propSens = new boolean[1]; propNames[0] = name; propVals[0] = val; propSens[0] = sens; SBLimitedLength sb = threadLocSB.get(); boolean newStr = sb.length() == 0; try { return toStringImpl(str, sb, propNames, propVals, propSens, 1); } finally { if (newStr) sb.reset(); } } | /**
* Produces uniformed output of string with context properties
*
* @param str Output prefix or {@code null} if empty.
* @param name Property name.
* @param val Property value.
* @param sens Property sensitive flag.
* @return String presentation.
*/ | Produces uniformed output of string with context properties | toString | {
"repo_name": "ptupitsyn/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/util/tostring/GridToStringBuilder.java",
"license": "apache-2.0",
"size": 61767
} | [
"org.jetbrains.annotations.Nullable"
] | import org.jetbrains.annotations.Nullable; | import org.jetbrains.annotations.*; | [
"org.jetbrains.annotations"
] | org.jetbrains.annotations; | 1,010,256 |
public boolean accept(ClusterMessage msg) {
return (msg instanceof FileMessage) || (msg instanceof UndeployMessage);
} | boolean function(ClusterMessage msg) { return (msg instanceof FileMessage) (msg instanceof UndeployMessage); } | /**
* Before the cluster invokes messageReceived the cluster will ask the
* receiver to accept or decline the message, In the future, when messages
* get big, the accept method will only take a message header
*
* @param msg
* ClusterMessage
* @return boolean - returns true to indicate that messageReceived should be
* invoked. If false is returned, the messageReceived method will
* not be invoked.
*/ | Before the cluster invokes messageReceived the cluster will ask the receiver to accept or decline the message, In the future, when messages get big, the accept method will only take a message header | accept | {
"repo_name": "plumer/codana",
"path": "tomcat_files/6.0.0/FarmWarDeployer.java",
"license": "mit",
"size": 25223
} | [
"org.apache.catalina.ha.ClusterMessage"
] | import org.apache.catalina.ha.ClusterMessage; | import org.apache.catalina.ha.*; | [
"org.apache.catalina"
] | org.apache.catalina; | 1,571,051 |
@WebMethod(operationName = "revokePermissionFromRole")
@CacheEvict(value={Role.Cache.NAME, Permission.Cache.NAME, Responsibility.Cache.NAME, RoleMembership.Cache.NAME, RoleMember.Cache.NAME, DelegateMember.Cache.NAME, RoleResponsibility.Cache.NAME, DelegateType.Cache.NAME }, allEntries = true)
void revokePermissionFromRole(
@WebParam(name = "permissionId") String permissionId,
@WebParam(name = "roleId") String roleId)
throws RiceIllegalArgumentException; | @WebMethod(operationName = STR) @CacheEvict(value={Role.Cache.NAME, Permission.Cache.NAME, Responsibility.Cache.NAME, RoleMembership.Cache.NAME, RoleMember.Cache.NAME, DelegateMember.Cache.NAME, RoleResponsibility.Cache.NAME, DelegateType.Cache.NAME }, allEntries = true) void revokePermissionFromRole( @WebParam(name = STR) String permissionId, @WebParam(name = STR) String roleId) throws RiceIllegalArgumentException; | /**
* Removes the given permission to the given role
*
* @param permissionId the permissionId
* @param roleId the roleId
* @return void.
* @throws RiceIllegalArgumentException if permissionId or roleId is null or blank.
*/ | Removes the given permission to the given role | revokePermissionFromRole | {
"repo_name": "ricepanda/rice-git3",
"path": "rice-middleware/kim/kim-api/src/main/java/org/kuali/rice/kim/api/role/RoleService.java",
"license": "apache-2.0",
"size": 48854
} | [
"javax.jws.WebMethod",
"javax.jws.WebParam",
"org.kuali.rice.core.api.exception.RiceIllegalArgumentException",
"org.kuali.rice.kim.api.common.delegate.DelegateMember",
"org.kuali.rice.kim.api.common.delegate.DelegateType",
"org.kuali.rice.kim.api.permission.Permission",
"org.kuali.rice.kim.api.responsibility.Responsibility",
"org.springframework.cache.annotation.CacheEvict"
] | import javax.jws.WebMethod; import javax.jws.WebParam; import org.kuali.rice.core.api.exception.RiceIllegalArgumentException; import org.kuali.rice.kim.api.common.delegate.DelegateMember; import org.kuali.rice.kim.api.common.delegate.DelegateType; import org.kuali.rice.kim.api.permission.Permission; import org.kuali.rice.kim.api.responsibility.Responsibility; import org.springframework.cache.annotation.CacheEvict; | import javax.jws.*; import org.kuali.rice.core.api.exception.*; import org.kuali.rice.kim.api.common.delegate.*; import org.kuali.rice.kim.api.permission.*; import org.kuali.rice.kim.api.responsibility.*; import org.springframework.cache.annotation.*; | [
"javax.jws",
"org.kuali.rice",
"org.springframework.cache"
] | javax.jws; org.kuali.rice; org.springframework.cache; | 2,794,526 |
private AbstractArrayWrapper obtainArrayWrapper(Object parent,
String fullId, int start) {
// Check parent is a List
if (!(parent instanceof List) && !(parent instanceof Array)) {
throw new AccessorException(
fullId,
"Object before position "
+ start
+ " should be of class java.util.List or com.badlogic.gdx.utils.Array. Otherwise the operator "
+ LIST_SEPARATOR[0] + LIST_SEPARATOR[1]
+ " cannot be used.");
}
AbstractArrayWrapper wrapper = null;
if (parent instanceof List) {
List list = (List) parent;
wrapper = Pools.obtain(ListWrapper.class);
((ListWrapper) wrapper).set(list);
} else if (parent instanceof Array) {
Array array = (Array) parent;
wrapper = Pools.obtain(ArrayWrapper.class);
((ArrayWrapper) wrapper).set(array);
}
return wrapper;
}
public static interface AbstractMapWrapper { | AbstractArrayWrapper function(Object parent, String fullId, int start) { if (!(parent instanceof List) && !(parent instanceof Array)) { throw new AccessorException( fullId, STR + start + STR + LIST_SEPARATOR[0] + LIST_SEPARATOR[1] + STR); } AbstractArrayWrapper wrapper = null; if (parent instanceof List) { List list = (List) parent; wrapper = Pools.obtain(ListWrapper.class); ((ListWrapper) wrapper).set(list); } else if (parent instanceof Array) { Array array = (Array) parent; wrapper = Pools.obtain(ArrayWrapper.class); ((ArrayWrapper) wrapper).set(array); } return wrapper; } public static interface AbstractMapWrapper { | /**
* Gets a wrapper for the given {@code parent} object, which must be of type
* {@link Array} or {@link List}.
*
* @param parent
* An {@link Array} or {@link List}.
* @param fullId
* The fullId representing the object being resolved (e.g.
* "scene.children[2].scaleX"). For building accurate exception
* messages only.
* @param start
* The current position being parsed at {@code fullId}. For
* building accurate exception messages only.
* @return The wrapper
*/ | Gets a wrapper for the given parent object, which must be of type <code>Array</code> or <code>List</code> | obtainArrayWrapper | {
"repo_name": "gorco/ead",
"path": "engine/core/src/main/java/es/eucm/ead/engine/Accessor.java",
"license": "gpl-3.0",
"size": 38464
} | [
"com.badlogic.gdx.utils.Array",
"com.badlogic.gdx.utils.Pools",
"java.util.List"
] | import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Pools; import java.util.List; | import com.badlogic.gdx.utils.*; import java.util.*; | [
"com.badlogic.gdx",
"java.util"
] | com.badlogic.gdx; java.util; | 2,839,628 |
private String parseName() throws JasperException {
char ch = (char) reader.peekChar();
if (Character.isLetter(ch) || ch == '_' || ch == ':') {
StringBuilder buf = new StringBuilder();
buf.append(ch);
reader.nextChar();
ch = (char) reader.peekChar();
while (Character.isLetter(ch) || Character.isDigit(ch) || ch == '.'
|| ch == '_' || ch == '-' || ch == ':') {
buf.append(ch);
reader.nextChar();
ch = (char) reader.peekChar();
}
return buf.toString();
}
return null;
} | String function() throws JasperException { char ch = (char) reader.peekChar(); if (Character.isLetter(ch) ch == '_' ch == ':') { StringBuilder buf = new StringBuilder(); buf.append(ch); reader.nextChar(); ch = (char) reader.peekChar(); while (Character.isLetter(ch) Character.isDigit(ch) ch == '.' ch == '_' ch == '-' ch == ':') { buf.append(ch); reader.nextChar(); ch = (char) reader.peekChar(); } return buf.toString(); } return null; } | /**
* Name ::= (Letter | '_' | ':') (Letter | Digit | '.' | '_' | '-' | ':')*
*/ | Name ::= (Letter | '_' | ':') (Letter | Digit | '.' | '_' | '-' | ':') | parseName | {
"repo_name": "mayonghui2112/helloWorld",
"path": "sourceCode/apache-tomcat-7.0.82-src/java/org/apache/jasper/compiler/Parser.java",
"license": "apache-2.0",
"size": 67802
} | [
"org.apache.jasper.JasperException"
] | import org.apache.jasper.JasperException; | import org.apache.jasper.*; | [
"org.apache.jasper"
] | org.apache.jasper; | 1,655,714 |
public HttpRequest send(final byte[] input) throws HttpRequestException {
if (input != null)
incrementTotalSize(input.length);
return send(new ByteArrayInputStream(input));
} | HttpRequest function(final byte[] input) throws HttpRequestException { if (input != null) incrementTotalSize(input.length); return send(new ByteArrayInputStream(input)); } | /**
* Write byte array to request body
*
* @param input
* @return this request
* @throws HttpRequestException
*/ | Write byte array to request body | send | {
"repo_name": "sindhunaydu/web-perf-analyzer",
"path": "HttpRequest.java",
"license": "mit",
"size": 83766
} | [
"java.io.ByteArrayInputStream"
] | import java.io.ByteArrayInputStream; | import java.io.*; | [
"java.io"
] | java.io; | 333,884 |
protected void selectAutoTickUnit(Graphics2D g2,
Rectangle2D dataArea,
RectangleEdge edge) {
if (RectangleEdge.isTopOrBottom(edge)) {
selectHorizontalAutoTickUnit(g2, dataArea, edge);
}
else if (RectangleEdge.isLeftOrRight(edge)) {
selectVerticalAutoTickUnit(g2, dataArea, edge);
}
}
| void function(Graphics2D g2, Rectangle2D dataArea, RectangleEdge edge) { if (RectangleEdge.isTopOrBottom(edge)) { selectHorizontalAutoTickUnit(g2, dataArea, edge); } else if (RectangleEdge.isLeftOrRight(edge)) { selectVerticalAutoTickUnit(g2, dataArea, edge); } } | /**
* Selects an appropriate tick value for the axis. The strategy is to
* display as many ticks as possible (selected from an array of 'standard'
* tick units) without the labels overlapping.
*
* @param g2 the graphics device.
* @param dataArea the area defined by the axes.
* @param edge the axis location.
*/ | Selects an appropriate tick value for the axis. The strategy is to display as many ticks as possible (selected from an array of 'standard' tick units) without the labels overlapping | selectAutoTickUnit | {
"repo_name": "SpoonLabs/astor",
"path": "examples/chart_11/source/org/jfree/chart/axis/NumberAxis.java",
"license": "gpl-2.0",
"size": 54468
} | [
"java.awt.Graphics2D",
"java.awt.geom.Rectangle2D",
"org.jfree.chart.util.RectangleEdge"
] | import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; import org.jfree.chart.util.RectangleEdge; | import java.awt.*; import java.awt.geom.*; import org.jfree.chart.util.*; | [
"java.awt",
"org.jfree.chart"
] | java.awt; org.jfree.chart; | 417,651 |
public DatabaseGetCitiesByIdQuery cityIds(List<Integer> value) {
return unsafeParam("city_ids", value);
} | DatabaseGetCitiesByIdQuery function(List<Integer> value) { return unsafeParam(STR, value); } | /**
* City IDs.
*
* @param value value of "city ids" parameter.
* @return a reference to this {@code AbstractQueryBuilder} object to fulfill the "Builder" pattern.
*/ | City IDs | cityIds | {
"repo_name": "kokorin/vk-java-sdk",
"path": "sdk/src/main/java/com/vk/api/sdk/queries/database/DatabaseGetCitiesByIdQuery.java",
"license": "mit",
"size": 2116
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 563,452 |
public void removeFacets() {
_facetFields = new ArrayList<>();
}
//------------------------------------------------------
//------------------------------------------------------ | void function() { _facetFields = new ArrayList<>(); } | /**
* Remove the field facet info
*/ | Remove the field facet info | removeFacets | {
"repo_name": "PATRIC3/p3_solr",
"path": "solr/solrj/src/java/org/apache/solr/client/solrj/response/QueryResponse.java",
"license": "apache-2.0",
"size": 21516
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 17,982 |
private float crossCheckHorizontal(int startJ, int centerI, int maxCount,
int originalStateCountTotal) {
BitMatrix image = this.image;
int maxJ = image.getWidth();
int[] stateCount = getCrossCheckStateCount();
int j = startJ;
while (j >= 0 && image.get(j, centerI)) {
stateCount[2]++;
j--;
}
if (j < 0) {
return Float.NaN;
}
while (j >= 0 && !image.get(j, centerI) && stateCount[1] <= maxCount) {
stateCount[1]++;
j--;
}
if (j < 0 || stateCount[1] > maxCount) {
return Float.NaN;
}
while (j >= 0 && image.get(j, centerI) && stateCount[0] <= maxCount) {
stateCount[0]++;
j--;
}
if (stateCount[0] > maxCount) {
return Float.NaN;
}
j = startJ + 1;
while (j < maxJ && image.get(j, centerI)) {
stateCount[2]++;
j++;
}
if (j == maxJ) {
return Float.NaN;
}
while (j < maxJ && !image.get(j, centerI) && stateCount[3] < maxCount) {
stateCount[3]++;
j++;
}
if (j == maxJ || stateCount[3] >= maxCount) {
return Float.NaN;
}
while (j < maxJ && image.get(j, centerI) && stateCount[4] < maxCount) {
stateCount[4]++;
j++;
}
if (stateCount[4] >= maxCount) {
return Float.NaN;
}
// If we found a finder-pattern-like section, but its size is significantly different than
// the original, assume it's a false positive
int stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] +
stateCount[4];
if (5 * Math.abs(stateCountTotal - originalStateCountTotal) >= originalStateCountTotal) {
return Float.NaN;
}
return foundPatternCross(stateCount) ? centerFromEnd(stateCount, j) : Float.NaN;
} | float function(int startJ, int centerI, int maxCount, int originalStateCountTotal) { BitMatrix image = this.image; int maxJ = image.getWidth(); int[] stateCount = getCrossCheckStateCount(); int j = startJ; while (j >= 0 && image.get(j, centerI)) { stateCount[2]++; j--; } if (j < 0) { return Float.NaN; } while (j >= 0 && !image.get(j, centerI) && stateCount[1] <= maxCount) { stateCount[1]++; j--; } if (j < 0 stateCount[1] > maxCount) { return Float.NaN; } while (j >= 0 && image.get(j, centerI) && stateCount[0] <= maxCount) { stateCount[0]++; j--; } if (stateCount[0] > maxCount) { return Float.NaN; } j = startJ + 1; while (j < maxJ && image.get(j, centerI)) { stateCount[2]++; j++; } if (j == maxJ) { return Float.NaN; } while (j < maxJ && !image.get(j, centerI) && stateCount[3] < maxCount) { stateCount[3]++; j++; } if (j == maxJ stateCount[3] >= maxCount) { return Float.NaN; } while (j < maxJ && image.get(j, centerI) && stateCount[4] < maxCount) { stateCount[4]++; j++; } if (stateCount[4] >= maxCount) { return Float.NaN; } int stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4]; if (5 * Math.abs(stateCountTotal - originalStateCountTotal) >= originalStateCountTotal) { return Float.NaN; } return foundPatternCross(stateCount) ? centerFromEnd(stateCount, j) : Float.NaN; } | /**
* <p>Like {@link #crossCheckVertical(int, int, int, int)}, and in fact is basically identical,
* except it reads horizontally instead of vertically. This is used to cross-cross
* check a vertical cross check and locate the real center of the alignment pattern.</p>
*/ | Like <code>#crossCheckVertical(int, int, int, int)</code>, and in fact is basically identical, except it reads horizontally instead of vertically. This is used to cross-cross check a vertical cross check and locate the real center of the alignment pattern | crossCheckHorizontal | {
"repo_name": "saqimtiaz/BibSearch",
"path": "com.google.zxing.client.android.CaptureActivity/src/com/google/zxing/qrcode/detector/FinderPatternFinder.java",
"license": "mit",
"size": 21623
} | [
"com.google.zxing.common.BitMatrix"
] | import com.google.zxing.common.BitMatrix; | import com.google.zxing.common.*; | [
"com.google.zxing"
] | com.google.zxing; | 2,582,052 |
@FIXVersion(introduced = "4.2", retired = "4.3")
@TagNumRef(tagNum = TagNum.Issuer)
public void setIssuer(String issuer) {
getSafeInstrument().setIssuer(issuer);
} | @FIXVersion(introduced = "4.2", retired = "4.3") @TagNumRef(tagNum = TagNum.Issuer) void function(String issuer) { getSafeInstrument().setIssuer(issuer); } | /**
* Message field setter.
* @param issuer field value
*/ | Message field setter | setIssuer | {
"repo_name": "marvisan/HadesFIX",
"path": "Model/src/main/java/net/hades/fix/message/SecurityStatusMsg.java",
"license": "gpl-3.0",
"size": 64007
} | [
"net.hades.fix.message.anno.FIXVersion",
"net.hades.fix.message.anno.TagNumRef",
"net.hades.fix.message.type.TagNum"
] | import net.hades.fix.message.anno.FIXVersion; import net.hades.fix.message.anno.TagNumRef; import net.hades.fix.message.type.TagNum; | import net.hades.fix.message.anno.*; import net.hades.fix.message.type.*; | [
"net.hades.fix"
] | net.hades.fix; | 297,293 |
public Builder setOut(OutputStream os) {
out = os;
return this;
} | Builder function(OutputStream os) { out = os; return this; } | /**
* Changes the default output for languages running in <em>to be created</em>
* {@link PolyglotEngine virtual machine}. The default is to use {@link System#out}.
*
* @param os the stream to use as output
* @return instance of this builder
* @since 0.9
*/ | Changes the default output for languages running in to be created <code>PolyglotEngine virtual machine</code>. The default is to use <code>System#out</code> | setOut | {
"repo_name": "entlicher/truffle",
"path": "truffle/com.oracle.truffle.api.vm/src/com/oracle/truffle/api/vm/PolyglotEngine.java",
"license": "gpl-2.0",
"size": 52285
} | [
"java.io.OutputStream"
] | import java.io.OutputStream; | import java.io.*; | [
"java.io"
] | java.io; | 2,677,251 |
@POST
public Response createTransaction(@PathParam("path")
final List<PathSegment> pathList, @Context
final HttpServletRequest req) throws RepositoryException {
LOGGER.debug("creating transaction at path {}", pathList);
if (!pathList.isEmpty()) {
return status(BAD_REQUEST).build();
}
if (session instanceof TxSession) {
final Transaction t =
txService.getTransaction(((TxSession) session)
.getTxId());
t.updateExpiryDate();
return noContent().expires(t.getExpires()).build();
} else {
final Transaction t = txService.beginTransaction(session);
final HttpSession httpSession = req.getSession(true);
if (httpSession != null) {
httpSession.setAttribute("currentTx", t.getId());
}
return created(
uriInfo.getBaseUriBuilder().path(FedoraNodes.class)
.buildFromMap(
singletonMap("path", "tx:" +
t.getId()))).expires(
t.getExpires()).build();
}
} | Response function(@PathParam("path") final List<PathSegment> pathList, final HttpServletRequest req) throws RepositoryException { LOGGER.debug(STR, pathList); if (!pathList.isEmpty()) { return status(BAD_REQUEST).build(); } if (session instanceof TxSession) { final Transaction t = txService.getTransaction(((TxSession) session) .getTxId()); t.updateExpiryDate(); return noContent().expires(t.getExpires()).build(); } else { final Transaction t = txService.beginTransaction(session); final HttpSession httpSession = req.getSession(true); if (httpSession != null) { httpSession.setAttribute(STR, t.getId()); } return created( uriInfo.getBaseUriBuilder().path(FedoraNodes.class) .buildFromMap( singletonMap("path", "tx:" + t.getId()))).expires( t.getExpires()).build(); } } | /**
* Create a new transaction resource and add it to the registry
*
* @param pathList
* @return
* @throws RepositoryException
*/ | Create a new transaction resource and add it to the registry | createTransaction | {
"repo_name": "barmintor/fcrepo4",
"path": "fcrepo-http-api/src/main/java/org/fcrepo/http/api/FedoraTransactions.java",
"license": "apache-2.0",
"size": 5091
} | [
"java.util.Collections",
"java.util.List",
"javax.jcr.RepositoryException",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpSession",
"javax.ws.rs.PathParam",
"javax.ws.rs.core.PathSegment",
"javax.ws.rs.core.Response",
"org.fcrepo.kernel.Transaction",
"org.fcrepo.kernel.TxSession"
] | import java.util.Collections; import java.util.List; import javax.jcr.RepositoryException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import javax.ws.rs.PathParam; import javax.ws.rs.core.PathSegment; import javax.ws.rs.core.Response; import org.fcrepo.kernel.Transaction; import org.fcrepo.kernel.TxSession; | import java.util.*; import javax.jcr.*; import javax.servlet.http.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.fcrepo.kernel.*; | [
"java.util",
"javax.jcr",
"javax.servlet",
"javax.ws",
"org.fcrepo.kernel"
] | java.util; javax.jcr; javax.servlet; javax.ws; org.fcrepo.kernel; | 1,558,427 |
public void testModulusValue() throws Exception {
// Create key pair using java.security
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA", "BC");
keyGen.initialize(1024, new SecureRandom());
KeyPair keyPair = keyGen.generateKeyPair();
PublicKeyRSA rsaKey = (PublicKeyRSA) KeyFactory.createInstance(keyPair.getPublic(), "SHA1WITHRSA", null);
byte[] modulusData = ((ByteField) rsaKey.getSubfield(CVCTagEnum.MODULUS)).getData();
assertTrue("Leading zero found in modulus", modulusData[0] != 0);
}
| void function() throws Exception { KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA", "BC"); keyGen.initialize(1024, new SecureRandom()); KeyPair keyPair = keyGen.generateKeyPair(); PublicKeyRSA rsaKey = (PublicKeyRSA) KeyFactory.createInstance(keyPair.getPublic(), STR, null); byte[] modulusData = ((ByteField) rsaKey.getSubfield(CVCTagEnum.MODULUS)).getData(); assertTrue(STR, modulusData[0] != 0); } | /**
* Check: Create CVC public key from a java public key - the encoded modulus
* should not have ant leading zeroes
*/ | Check: Create CVC public key from a java public key - the encoded modulus should not have ant leading zeroes | testModulusValue | {
"repo_name": "procilon/cert-cvc",
"path": "src/test/java/org/ejbca/cvc/TestPublicKey.java",
"license": "lgpl-2.1",
"size": 10882
} | [
"java.security.KeyPair",
"java.security.KeyPairGenerator",
"java.security.SecureRandom"
] | import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.SecureRandom; | import java.security.*; | [
"java.security"
] | java.security; | 430,824 |
protected void quickSearch() {
List<CmsTreeItem> categories = new ArrayList<CmsTreeItem>();
if ((m_quickSearch != null)) {
categories = getFilteredCategories(hasQuickFilter() ? m_quickSearch.getFormValueAsString() : null);
sort(categories, SortParams.valueOf(m_event.getValue()));
}
}
| void function() { List<CmsTreeItem> categories = new ArrayList<CmsTreeItem>(); if ((m_quickSearch != null)) { categories = getFilteredCategories(hasQuickFilter() ? m_quickSearch.getFormValueAsString() : null); sort(categories, SortParams.valueOf(m_event.getValue())); } } | /**
* Sets the search query an selects the result tab.<p>
*/ | Sets the search query an selects the result tab | quickSearch | {
"repo_name": "victos/opencms-core",
"path": "src-gwt/org/opencms/gwt/client/ui/input/category/CmsCategoryTree.java",
"license": "lgpl-2.1",
"size": 39765
} | [
"java.util.ArrayList",
"java.util.List",
"org.opencms.gwt.client.ui.tree.CmsTreeItem"
] | import java.util.ArrayList; import java.util.List; import org.opencms.gwt.client.ui.tree.CmsTreeItem; | import java.util.*; import org.opencms.gwt.client.ui.tree.*; | [
"java.util",
"org.opencms.gwt"
] | java.util; org.opencms.gwt; | 242,143 |
public OutputStream getOutputStream() throws IOException{
return root.getResourceOutputStream(relPath);
}
| OutputStream function() throws IOException{ return root.getResourceOutputStream(relPath); } | /**
* Return a stream to write to this resource
*
* @return
* @throws IOException
*/ | Return a stream to write to this resource | getOutputStream | {
"repo_name": "codemucker/codemucker-jfind",
"path": "src/main/java/org/codemucker/jfind/RootResource.java",
"license": "apache-2.0",
"size": 4229
} | [
"java.io.IOException",
"java.io.OutputStream"
] | import java.io.IOException; import java.io.OutputStream; | import java.io.*; | [
"java.io"
] | java.io; | 454,783 |
@Test
@Category(NeedsRunner.class)
public void testSmallCompressedAutoReadActuallyUncompressed() throws Exception {
File smallGzNotCompressed =
writeToFile(TINY, tempFolder, "tiny_uncompressed.gz", UNCOMPRESSED);
// Should also work with AUTO mode set.
assertReadingCompressedFileMatchesExpected(smallGzNotCompressed, AUTO, TINY, p);
p.run();
} | @Category(NeedsRunner.class) void function() throws Exception { File smallGzNotCompressed = writeToFile(TINY, tempFolder, STR, UNCOMPRESSED); assertReadingCompressedFileMatchesExpected(smallGzNotCompressed, AUTO, TINY, p); p.run(); } | /**
* Tests reading from a small, uncompressed file with .gz extension. This must work in AUTO
* modes. This is needed because some network file systems / HTTP clients will transparently
* decompress gzipped content.
*/ | Tests reading from a small, uncompressed file with .gz extension. This must work in AUTO modes. This is needed because some network file systems / HTTP clients will transparently decompress gzipped content | testSmallCompressedAutoReadActuallyUncompressed | {
"repo_name": "RyanSkraba/beam",
"path": "sdks/java/core/src/test/java/org/apache/beam/sdk/io/TextIOReadTest.java",
"license": "apache-2.0",
"size": 34887
} | [
"java.io.File",
"org.apache.beam.sdk.testing.NeedsRunner",
"org.junit.experimental.categories.Category"
] | import java.io.File; import org.apache.beam.sdk.testing.NeedsRunner; import org.junit.experimental.categories.Category; | import java.io.*; import org.apache.beam.sdk.testing.*; import org.junit.experimental.categories.*; | [
"java.io",
"org.apache.beam",
"org.junit.experimental"
] | java.io; org.apache.beam; org.junit.experimental; | 182,698 |
private static String readWordFile(File file)
throws Exception
{
return null;
}
| static String function(File file) throws Exception { return null; } | /**
* Reads the content of the passed Microsoft Word file.
*
* @param file The file to handle.
* @return See above.
*/ | Reads the content of the passed Microsoft Word file | readWordFile | {
"repo_name": "tp81/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/util/file/IOUtil.java",
"license": "gpl-2.0",
"size": 12307
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 268,171 |
private Criterion createFeatureOfInterestFilter(SpatialFilter filter) {
filter.setValueReference(QueryUtils.createAssociation(FeatureEntity.PROPERTY_GEOMETRY_ENTITY,
GeometryEntity.PROPERTY_GEOMETRY));
return createDatasetCriterion(DatasetEntity.PROPERTY_FEATURE, filter);
} | Criterion function(SpatialFilter filter) { filter.setValueReference(QueryUtils.createAssociation(FeatureEntity.PROPERTY_GEOMETRY_ENTITY, GeometryEntity.PROPERTY_GEOMETRY)); return createDatasetCriterion(DatasetEntity.PROPERTY_FEATURE, filter); } | /**
* Creates a spatial filter criterion for the geometry of the feature.
*
* @param filter the filter
*
* @return the criterion
*/ | Creates a spatial filter criterion for the geometry of the feature | createFeatureOfInterestFilter | {
"repo_name": "52North/dao-series-api",
"path": "dao/src/main/java/org/n52/series/db/dao/FESCriterionGenerator.java",
"license": "gpl-3.0",
"size": 51453
} | [
"org.hibernate.criterion.Criterion",
"org.n52.series.db.beans.DatasetEntity",
"org.n52.series.db.beans.FeatureEntity",
"org.n52.series.db.beans.GeometryEntity",
"org.n52.shetland.ogc.filter.SpatialFilter"
] | import org.hibernate.criterion.Criterion; import org.n52.series.db.beans.DatasetEntity; import org.n52.series.db.beans.FeatureEntity; import org.n52.series.db.beans.GeometryEntity; import org.n52.shetland.ogc.filter.SpatialFilter; | import org.hibernate.criterion.*; import org.n52.series.db.beans.*; import org.n52.shetland.ogc.filter.*; | [
"org.hibernate.criterion",
"org.n52.series",
"org.n52.shetland"
] | org.hibernate.criterion; org.n52.series; org.n52.shetland; | 527,743 |
private void setService(String url, int timeout) {
ImsService service = new ImsService();
service.setServiceName(CATALOG_SERVICE_NAME);
service.setServerUrl(Val.chkStr(url));
service.setTimeoutMillisecs(Math.max(0, timeout));
setService(service);
} | void function(String url, int timeout) { ImsService service = new ImsService(); service.setServiceName(CATALOG_SERVICE_NAME); service.setServerUrl(Val.chkStr(url)); service.setTimeoutMillisecs(Math.max(0, timeout)); setService(service); } | /**
* Creates service.
* @param url host url
* @param timeout connection timeout
*/ | Creates service | setService | {
"repo_name": "GeoinformationSystems/GeoprocessingAppstore",
"path": "src/com/esri/gpt/catalog/arcims/TestConnectionRequest.java",
"license": "apache-2.0",
"size": 4303
} | [
"com.esri.gpt.framework.util.Val"
] | import com.esri.gpt.framework.util.Val; | import com.esri.gpt.framework.util.*; | [
"com.esri.gpt"
] | com.esri.gpt; | 1,415,987 |
public T constructInstance(boolean autoCommit, Object... keysAndValues) throws CoreException
{
assertEven(keysAndValues);
IMendixObject newObj = Core.instantiate(context, this.entity);
for(int i = 0; i < keysAndValues.length; i+= 2)
newObj.setValue(context, String.valueOf(keysAndValues[i]), toMemberValue(keysAndValues[i + 1]));
if (autoCommit)
Core.commit(context, newObj);
return createProxy(context, proxyClass, newObj);
}
| T function(boolean autoCommit, Object... keysAndValues) throws CoreException { assertEven(keysAndValues); IMendixObject newObj = Core.instantiate(context, this.entity); for(int i = 0; i < keysAndValues.length; i+= 2) newObj.setValue(context, String.valueOf(keysAndValues[i]), toMemberValue(keysAndValues[i + 1])); if (autoCommit) Core.commit(context, newObj); return createProxy(context, proxyClass, newObj); } | /**
* Creates one instance of the type of this XPath query, and initializes the provided attributes to the provided values.
* @param keysAndValues AttributeName, AttributeValue, AttributeName2, AttributeValue2... list.
* @return
* @throws CoreException
*/ | Creates one instance of the type of this XPath query, and initializes the provided attributes to the provided values | constructInstance | {
"repo_name": "mendix/TooltipImage",
"path": "test/javasource/communitycommons/XPath.java",
"license": "apache-2.0",
"size": 26327
} | [
"com.mendix.core.Core",
"com.mendix.core.CoreException",
"com.mendix.systemwideinterfaces.core.IMendixObject"
] | import com.mendix.core.Core; import com.mendix.core.CoreException; import com.mendix.systemwideinterfaces.core.IMendixObject; | import com.mendix.core.*; import com.mendix.systemwideinterfaces.core.*; | [
"com.mendix.core",
"com.mendix.systemwideinterfaces"
] | com.mendix.core; com.mendix.systemwideinterfaces; | 34,354 |
@Override
protected void fixInstanceClass(EClassifier eClassifier) {
if (eClassifier.getInstanceClassName() == null) {
eClassifier.setInstanceClassName("CIM.IEC61970.Informative.Financial." + eClassifier.getName());
setGeneratedClassName(eClassifier);
}
} | void function(EClassifier eClassifier) { if (eClassifier.getInstanceClassName() == null) { eClassifier.setInstanceClassName(STR + eClassifier.getName()); setGeneratedClassName(eClassifier); } } | /**
* Sets the instance class on the given classifier.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | Sets the instance class on the given classifier. | fixInstanceClass | {
"repo_name": "georghinkel/ttc2017smartGrids",
"path": "solutions/ModelJoin/src/main/java/CIM/IEC61970/Informative/Financial/impl/FinancialPackageImpl.java",
"license": "mit",
"size": 34471
} | [
"org.eclipse.emf.ecore.EClassifier"
] | import org.eclipse.emf.ecore.EClassifier; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,735,923 |
public List<ElectronicPaymentClaimClaimedHelper> getClaimedByCheckboxHelpers() {
return claimedByCheckboxHelpers;
}
| List<ElectronicPaymentClaimClaimedHelper> function() { return claimedByCheckboxHelpers; } | /**
* Gets the claimedByCheckboxHelpers attribute.
* @return Returns the claimedByCheckboxHelpers.
*/ | Gets the claimedByCheckboxHelpers attribute | getClaimedByCheckboxHelpers | {
"repo_name": "ua-eas/ua-kfs-5.3",
"path": "work/src/org/kuali/kfs/sys/web/struts/ElectronicFundTransferForm.java",
"license": "agpl-3.0",
"size": 8912
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,614,819 |
private void fixTypeNode(NodeTraversal t, Node typeNode) {
if (typeNode.isString()) {
String name = typeNode.getString();
// Type nodes can be module paths.
if (ModuleLoader.isPathIdentifier(name)) {
int lastSlash = name.lastIndexOf('/');
int endIndex = name.indexOf('.', lastSlash);
String localTypeName = null;
if (endIndex == -1) {
endIndex = name.length();
} else {
localTypeName = name.substring(endIndex);
}
String moduleName = name.substring(0, endIndex);
String globalModuleName = getImportedModuleName(t, typeNode, moduleName);
String baseImportProperty = getBasePropertyImport(globalModuleName);
typeNode.setString(
localTypeName == null ? baseImportProperty : baseImportProperty + localTypeName);
} else {
// A type node can be a getprop. Any portion of the getprop
// can be either an import alias or export alias. Check each
// segment.
boolean wasRewritten = false;
int endIndex = -1;
while (endIndex < name.length()) {
endIndex = name.indexOf('.', endIndex + 1);
if (endIndex == -1) {
endIndex = name.length();
}
String baseName = name.substring(0, endIndex);
String suffix = endIndex < name.length() ? name.substring(endIndex) : "";
Var typeDeclaration = t.getScope().getVar(baseName);
// Make sure we can find a variable declaration (and it's in this file)
if (typeDeclaration != null && typeDeclaration.getNode() != null
&& Objects.equals(typeDeclaration.getNode().getInputId(), typeNode.getInputId())) {
String importedModuleName = getModuleImportName(t, typeDeclaration.getNode());
// If the name is an import alias, rewrite it to be a reference to the
// module name directly
if (importedModuleName != null) {
typeNode.setString(importedModuleName + suffix);
typeNode.setOriginalName(name);
wasRewritten = true;
break;
} else if (this.allowFullRewrite) {
// Names referenced in export statements can only be rewritten in
// commonjs modules.
String exportedName = getExportedName(t, typeNode, typeDeclaration);
if (exportedName != null && !exportedName.equals(name)) {
typeNode.setString(exportedName + suffix);
typeNode.setOriginalName(name);
wasRewritten = true;
break;
}
}
}
}
// If the name was neither an import alias or referenced in an export,
// We still may need to rename it if it's global
if (!wasRewritten && this.allowFullRewrite) {
endIndex = name.indexOf('.');
if (endIndex == -1) {
endIndex = name.length();
}
String baseName = name.substring(0, endIndex);
Var typeDeclaration = t.getScope().getVar(baseName);
if (typeDeclaration != null && typeDeclaration.isGlobal()) {
String moduleName = getModuleName(t.getInput());
String newName = baseName + "$$" + moduleName;
if (endIndex < name.length()) {
newName += name.substring(endIndex);
}
typeNode.setString(newName);
typeNode.setOriginalName(name);
}
}
}
}
for (Node child = typeNode.getFirstChild(); child != null;
child = child.getNext()) {
fixTypeNode(t, child);
}
} | void function(NodeTraversal t, Node typeNode) { if (typeNode.isString()) { String name = typeNode.getString(); if (ModuleLoader.isPathIdentifier(name)) { int lastSlash = name.lastIndexOf('/'); int endIndex = name.indexOf('.', lastSlash); String localTypeName = null; if (endIndex == -1) { endIndex = name.length(); } else { localTypeName = name.substring(endIndex); } String moduleName = name.substring(0, endIndex); String globalModuleName = getImportedModuleName(t, typeNode, moduleName); String baseImportProperty = getBasePropertyImport(globalModuleName); typeNode.setString( localTypeName == null ? baseImportProperty : baseImportProperty + localTypeName); } else { boolean wasRewritten = false; int endIndex = -1; while (endIndex < name.length()) { endIndex = name.indexOf('.', endIndex + 1); if (endIndex == -1) { endIndex = name.length(); } String baseName = name.substring(0, endIndex); String suffix = endIndex < name.length() ? name.substring(endIndex) : STR$$" + moduleName; if (endIndex < name.length()) { newName += name.substring(endIndex); } typeNode.setString(newName); typeNode.setOriginalName(name); } } } } for (Node child = typeNode.getFirstChild(); child != null; child = child.getNext()) { fixTypeNode(t, child); } } | /**
* Update any type references in JSDoc annotations to account for all the rewriting we've done.
*/ | Update any type references in JSDoc annotations to account for all the rewriting we've done | fixTypeNode | {
"repo_name": "vobruba-martin/closure-compiler",
"path": "src/com/google/javascript/jscomp/ProcessCommonJSModules.java",
"license": "apache-2.0",
"size": 82937
} | [
"com.google.javascript.jscomp.deps.ModuleLoader",
"com.google.javascript.rhino.Node"
] | import com.google.javascript.jscomp.deps.ModuleLoader; import com.google.javascript.rhino.Node; | import com.google.javascript.jscomp.deps.*; import com.google.javascript.rhino.*; | [
"com.google.javascript"
] | com.google.javascript; | 2,660,567 |
public static void printDebugStackTrace(TraceComponent logger, Throwable t,
String message) {
if (logger.isDebugEnabled()) {
chTrace.traceDebugStack(logger, t, message);
}
} | static void function(TraceComponent logger, Throwable t, String message) { if (logger.isDebugEnabled()) { chTrace.traceDebugStack(logger, t, message); } } | /**
* Print debug stacktrace using given trace component.
*
* @param logger
* @param t
* @param message
*/ | Print debug stacktrace using given trace component | printDebugStackTrace | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.channelfw/src/com/ibm/websphere/channelfw/ChannelUtils.java",
"license": "epl-1.0",
"size": 56856
} | [
"com.ibm.websphere.ras.TraceComponent"
] | import com.ibm.websphere.ras.TraceComponent; | import com.ibm.websphere.ras.*; | [
"com.ibm.websphere"
] | com.ibm.websphere; | 1,579,350 |
public static List<String> splitOgnl(String ognl) {
List<String> methods = new ArrayList<String>();
StringBuilder sb = new StringBuilder();
int j = 0; // j is used as counter per method
boolean squareBracket = false; // special to keep track if we are inside a square bracket block - (eg [foo])
for (int i = 0; i < ognl.length(); i++) {
char ch = ognl.charAt(i);
// special for starting a new method
if (j == 0 || (j == 1 && ognl.charAt(i - 1) == '?')
|| (ch != '.' && ch != '?' && ch != ']')) {
sb.append(ch);
// special if we are doing square bracket
if (ch == '[') {
squareBracket = true;
}
j++; // advance
} else {
if (ch == '.' && !squareBracket) {
// only treat dot as a method separator if not inside a square bracket block
// as dots can be used in key names when accessing maps
// a dit denotes end of this method and a new method is to be invoked
String s = sb.toString();
// reset sb
sb.setLength(0);
// pass over ? to the new method
if (s.endsWith("?")) {
sb.append("?");
s = s.substring(0, s.length() - 1);
}
// add the method
methods.add(s);
// reset j to begin a new method
j = 0;
} else if (ch == ']') {
// append ending ] to method name
sb.append(ch);
String s = sb.toString();
// reset sb
sb.setLength(0);
// add the method
methods.add(s);
// reset j to begin a new method
j = 0;
// no more square bracket
squareBracket = false;
}
// and dont lose the char if its not an ] end marker (as we already added that)
if (ch != ']') {
sb.append(ch);
}
// only advance if already begun on the new method
if (j > 0) {
j++;
}
}
}
// add remainder in buffer when reached end of data
if (sb.length() > 0) {
methods.add(sb.toString());
}
return methods;
} | static List<String> function(String ognl) { List<String> methods = new ArrayList<String>(); StringBuilder sb = new StringBuilder(); int j = 0; boolean squareBracket = false; for (int i = 0; i < ognl.length(); i++) { char ch = ognl.charAt(i); if (j == 0 (j == 1 && ognl.charAt(i - 1) == '?') (ch != '.' && ch != '?' && ch != ']')) { sb.append(ch); if (ch == '[') { squareBracket = true; } j++; } else { if (ch == '.' && !squareBracket) { String s = sb.toString(); sb.setLength(0); if (s.endsWith("?")) { sb.append("?"); s = s.substring(0, s.length() - 1); } methods.add(s); j = 0; } else if (ch == ']') { sb.append(ch); String s = sb.toString(); sb.setLength(0); methods.add(s); j = 0; squareBracket = false; } if (ch != ']') { sb.append(ch); } if (j > 0) { j++; } } } if (sb.length() > 0) { methods.add(sb.toString()); } return methods; } | /**
* Regular expression with repeating groups is a pain to get right
* and then nobody understands the reg exp afterwards.
* So use a bit ugly/low-level java code to split the ognl into methods.
*/ | Regular expression with repeating groups is a pain to get right and then nobody understands the reg exp afterwards. So use a bit ugly/low-level java code to split the ognl into methods | splitOgnl | {
"repo_name": "cexbrayat/camel",
"path": "camel-core/src/main/java/org/apache/camel/util/OgnlHelper.java",
"license": "apache-2.0",
"size": 8240
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,215,336 |
private void writeNodeRecord(int operation, NodeState state)
throws JournalException {
record.writeChar(NODE_IDENTIFIER);
record.writeByte(operation);
record.writeNodeId(state.getNodeId());
} | void function(int operation, NodeState state) throws JournalException { record.writeChar(NODE_IDENTIFIER); record.writeByte(operation); record.writeNodeId(state.getNodeId()); } | /**
* Write a node record
*
* @param operation operation
* @param state node state
* @throws JournalException if an error occurs
*/ | Write a node record | writeNodeRecord | {
"repo_name": "tripodsan/jackrabbit",
"path": "jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ChangeLogRecord.java",
"license": "apache-2.0",
"size": 16257
} | [
"org.apache.jackrabbit.core.journal.JournalException",
"org.apache.jackrabbit.core.state.NodeState"
] | import org.apache.jackrabbit.core.journal.JournalException; import org.apache.jackrabbit.core.state.NodeState; | import org.apache.jackrabbit.core.journal.*; import org.apache.jackrabbit.core.state.*; | [
"org.apache.jackrabbit"
] | org.apache.jackrabbit; | 2,698,555 |
protected List<Successor> getSuccessors(Integer concept) {
// compute all successors of the given concept
List<Successor> successors = new ArrayList<>();
for (Integer relation : relationGraph.keySet()) {
// check that the relation is not auxiliary or the top or bottom relation
if (entityManager.isAuxiliary(relation) || relation < IntegerEntityManager.firstUsableIdentifier) {
continue;
}
// add all successors for the relation
for (Integer successor : relationGraph.get(relation).getByFirst(concept)) {
successors.add(new Successor(relation, successor));
}
}
// find the minimal successors in this set
List<Successor> minimalSuccessors = new ArrayList<>(successors);
for (Successor s1 : successors) {
if (!minimalSuccessors.contains(s1)) continue;
for (Successor s2 : successors) {
if (s1 != s2 && minimalSuccessors.contains(s2)
&& objectPropertyGraph.getSubsumers(s1.getRole()).contains(s2.getRole())
&& classGraph.getSubsumers(s1.getConcept()).contains(s2.getConcept())) {
minimalSuccessors.remove(s2);
}
}
}
return minimalSuccessors;
}
protected class Successor {
private Integer role;
private Integer concept;
public Successor(Integer role, Integer concept) {
this.role = role;
this.concept = concept;
} | List<Successor> function(Integer concept) { List<Successor> successors = new ArrayList<>(); for (Integer relation : relationGraph.keySet()) { if (entityManager.isAuxiliary(relation) relation < IntegerEntityManager.firstUsableIdentifier) { continue; } for (Integer successor : relationGraph.get(relation).getByFirst(concept)) { successors.add(new Successor(relation, successor)); } } List<Successor> minimalSuccessors = new ArrayList<>(successors); for (Successor s1 : successors) { if (!minimalSuccessors.contains(s1)) continue; for (Successor s2 : successors) { if (s1 != s2 && minimalSuccessors.contains(s2) && objectPropertyGraph.getSubsumers(s1.getRole()).contains(s2.getRole()) && classGraph.getSubsumers(s1.getConcept()).contains(s2.getConcept())) { minimalSuccessors.remove(s2); } } } return minimalSuccessors; } protected class Successor { private Integer role; private Integer concept; public Successor(Integer role, Integer concept) { this.role = role; this.concept = concept; } | /**
* Computes the set of all (minimal) successors of a given concept.
* A successor is a concept name in the completion graph that is reachable from the given concept via a single role.
*
* @param concept The concept for which the successors will be computed
* @return The set of all minimal successors
*/ | Computes the set of all (minimal) successors of a given concept. A successor is a concept name in the completion graph that is reachable from the given concept via a single role | getSuccessors | {
"repo_name": "julianmendez/gel",
"path": "gel/src/main/java/de/tudresden/inf/lat/gel/Generalization.java",
"license": "apache-2.0",
"size": 3818
} | [
"de.tudresden.inf.lat.jcel.coreontology.datatype.IntegerEntityManager",
"java.util.ArrayList",
"java.util.List"
] | import de.tudresden.inf.lat.jcel.coreontology.datatype.IntegerEntityManager; import java.util.ArrayList; import java.util.List; | import de.tudresden.inf.lat.jcel.coreontology.datatype.*; import java.util.*; | [
"de.tudresden.inf",
"java.util"
] | de.tudresden.inf; java.util; | 629,082 |
private ChatColor randomColor()
{
ChatColor color = null;
int rand = random.nextInt(availableColors.size());
color = availableColors.get(rand);
// Remove color from available colors
availableColors.remove(color);
return color;
}
| ChatColor function() { ChatColor color = null; int rand = random.nextInt(availableColors.size()); color = availableColors.get(rand); availableColors.remove(color); return color; } | /**
* Generate a random color according to the available colors
* @return A random color
*/ | Generate a random color according to the available colors | randomColor | {
"repo_name": "LetMeR00t/TaupeGunINSA",
"path": "src/taupegun/structures/Context.java",
"license": "mit",
"size": 20409
} | [
"org.bukkit.ChatColor"
] | import org.bukkit.ChatColor; | import org.bukkit.*; | [
"org.bukkit"
] | org.bukkit; | 2,063,563 |
MemberGroupVirtualAttributesModuleImplApi getMemberGroupVirtualAttributeModule(PerunSession sess, AttributeDefinition attribute) throws InternalErrorException {
Object attributeModule = getAttributesModule(sess, attribute);
if (attributeModule == null) return null;
if (attributeModule instanceof MemberGroupVirtualAttributesModuleImplApi) {
return (MemberGroupVirtualAttributesModuleImplApi) attributeModule;
} else {
throw new InternalErrorException("Required attribute module isn't MemberGroupVirtualAttributesModuleImplApi");
}
} | MemberGroupVirtualAttributesModuleImplApi getMemberGroupVirtualAttributeModule(PerunSession sess, AttributeDefinition attribute) throws InternalErrorException { Object attributeModule = getAttributesModule(sess, attribute); if (attributeModule == null) return null; if (attributeModule instanceof MemberGroupVirtualAttributesModuleImplApi) { return (MemberGroupVirtualAttributesModuleImplApi) attributeModule; } else { throw new InternalErrorException(STR); } } | /**
* Get member-group attribute module for the attribute.
*
* @param attribute attribute for which you get the module
* @return instance member-group attribute module null if the module doesn't exists
*/ | Get member-group attribute module for the attribute | getMemberGroupVirtualAttributeModule | {
"repo_name": "stavamichal/perun",
"path": "perun-core/src/main/java/cz/metacentrum/perun/core/impl/AttributesManagerImpl.java",
"license": "bsd-2-clause",
"size": 279474
} | [
"cz.metacentrum.perun.core.api.AttributeDefinition",
"cz.metacentrum.perun.core.api.PerunSession",
"cz.metacentrum.perun.core.api.exceptions.InternalErrorException",
"cz.metacentrum.perun.core.implApi.modules.attributes.MemberGroupVirtualAttributesModuleImplApi"
] | import cz.metacentrum.perun.core.api.AttributeDefinition; import cz.metacentrum.perun.core.api.PerunSession; import cz.metacentrum.perun.core.api.exceptions.InternalErrorException; import cz.metacentrum.perun.core.implApi.modules.attributes.MemberGroupVirtualAttributesModuleImplApi; | import cz.metacentrum.perun.core.*; import cz.metacentrum.perun.core.api.*; import cz.metacentrum.perun.core.api.exceptions.*; | [
"cz.metacentrum.perun"
] | cz.metacentrum.perun; | 1,888,488 |
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<ProviderInner> listAsync() {
final Integer top = null;
final String expand = null;
return new PagedFlux<>(() -> listSinglePageAsync(top, expand), nextLink -> listNextSinglePageAsync(nextLink));
} | @ServiceMethod(returns = ReturnType.COLLECTION) PagedFlux<ProviderInner> function() { final Integer top = null; final String expand = null; return new PagedFlux<>(() -> listSinglePageAsync(top, expand), nextLink -> listNextSinglePageAsync(nextLink)); } | /**
* Gets all resource providers for a subscription.
*
* @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 all resource providers for a subscription.
*/ | Gets all resource providers for a subscription | listAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/implementation/ProvidersClientImpl.java",
"license": "mit",
"size": 56925
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.PagedFlux",
"com.azure.resourcemanager.resources.fluent.models.ProviderInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedFlux; import com.azure.resourcemanager.resources.fluent.models.ProviderInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.resources.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 2,202,669 |
protected CheckInstrumentationVisitor checkClass(String className) {
InputStream is = cl.getResourceAsStream(className + ".class");
if(is != null) {
return checkFileAndClose(is, className);
}
return null;
} | CheckInstrumentationVisitor function(String className) { InputStream is = cl.getResourceAsStream(className + STR); if(is != null) { return checkFileAndClose(is, className); } return null; } | /**
* <p>Overwrite this function if Coroutines is used in a transformation chain.</p>
* <p>This method must create a new CheckInstrumentationVisitor and visit the
* specified class with it.</p>
* @param className the class the needs to be analysed
* @return a new CheckInstrumentationVisitor that has visited the specified
* class or null if the class was not found
*/ | Overwrite this function if Coroutines is used in a transformation chain. This method must create a new CheckInstrumentationVisitor and visit the specified class with it | checkClass | {
"repo_name": "ChiralBehaviors/Continuations",
"path": "src/main/java/de/matthiasmann/continuations/instrument/MethodDatabase.java",
"license": "apache-2.0",
"size": 13814
} | [
"java.io.InputStream"
] | import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 1,618,847 |
private NotificationManager getNotificationManager() {
return (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
} | NotificationManager function() { return (NotificationManager) getSystemService(NOTIFICATION_SERVICE); } | /**
* Shared manager for the notification service.
*/ | Shared manager for the notification service | getNotificationManager | {
"repo_name": "zoko7677/cordova-plugin-runagain",
"path": "src/android/ForegroundService.java",
"license": "apache-2.0",
"size": 8428
} | [
"android.app.NotificationManager"
] | import android.app.NotificationManager; | import android.app.*; | [
"android.app"
] | android.app; | 2,170,009 |
CalcExpression withSubstitutedValues(EvaluationState state, DeclarationList container, boolean withParams, boolean doNestedCalculations); | CalcExpression withSubstitutedValues(EvaluationState state, DeclarationList container, boolean withParams, boolean doNestedCalculations); | /**
* Replaces any const/param values available.
* Any missing constants/parameters will not be replaced, but will not cause an exception.
*
* @todo make this return a new calculation, instead of modifying this one
*
* @param state The current evaluation state.
* @param container The {@link DeclarationList} this expression is contained in.
* @param withParams Whether param() terms should be substituted.
* @param doNestedCalculations Whether nested calculations should be evaluated.
*
* @return A new CalcExpression with const/param terms inlined.
*/ | Replaces any const/param values available. Any missing constants/parameters will not be replaced, but will not cause an exception | withSubstitutedValues | {
"repo_name": "silentmatt/dss",
"path": "src/com/silentmatt/dss/calc/CalcExpression.java",
"license": "mit",
"size": 1872
} | [
"com.silentmatt.dss.declaration.DeclarationList",
"com.silentmatt.dss.evaluator.EvaluationState"
] | import com.silentmatt.dss.declaration.DeclarationList; import com.silentmatt.dss.evaluator.EvaluationState; | import com.silentmatt.dss.declaration.*; import com.silentmatt.dss.evaluator.*; | [
"com.silentmatt.dss"
] | com.silentmatt.dss; | 323,892 |
public void endElement(String name) throws SAXException {
endElement(null, name, name);
} | void function(String name) throws SAXException { endElement(null, name, name); } | /**
* Send the notification of the end of an element.
* @param name Name for the element.
* @throws SAXException Any SAX exception, possibly wrapping another exception.
*/ | Send the notification of the end of an element | endElement | {
"repo_name": "idega/com.idega.fop",
"path": "src/java/com/idega/fop/tools/EasyGenerationContentHandlerProxy.java",
"license": "gpl-3.0",
"size": 9684
} | [
"org.xml.sax.SAXException"
] | import org.xml.sax.SAXException; | import org.xml.sax.*; | [
"org.xml.sax"
] | org.xml.sax; | 1,592,677 |
public T caseMPDLPackageFile(MPDLPackageFile object) {
return null;
} | T function(MPDLPackageFile object) { return null; } | /**
* Returns the result of interpreting the object as an instance of '<em>MPDLPackageFile</em>'.
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>MPDLPackageFile</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/ | Returns the result of interpreting the object as an instance of 'MPDLPackageFile' | caseMPDLPackageFile | {
"repo_name": "parraman/micobs",
"path": "common/es.uah.aut.srg.micobs.pdl/src/es/uah/aut/srg/micobs/pdl/util/pdlSwitch.java",
"license": "epl-1.0",
"size": 33881
} | [
"es.uah.aut.srg.micobs.pdl.MPDLPackageFile"
] | import es.uah.aut.srg.micobs.pdl.MPDLPackageFile; | import es.uah.aut.srg.micobs.pdl.*; | [
"es.uah.aut"
] | es.uah.aut; | 1,594,774 |
public void addRequestFilterLast(
ServiceRequestFilter serviceRequestFilter) {
if (httpRequestInterceptorBackAdapter == null) {
httpRequestInterceptorBackAdapter = new HttpRequestInterceptorBackAdapter();
httpClientBuilder.addInterceptorLast(httpRequestInterceptorBackAdapter);
}
httpRequestInterceptorBackAdapter.addBack(serviceRequestFilter);
} | void function( ServiceRequestFilter serviceRequestFilter) { if (httpRequestInterceptorBackAdapter == null) { httpRequestInterceptorBackAdapter = new HttpRequestInterceptorBackAdapter(); httpClientBuilder.addInterceptorLast(httpRequestInterceptorBackAdapter); } httpRequestInterceptorBackAdapter.addBack(serviceRequestFilter); } | /**
* Add a ServiceRequestFilter to the end of all the request filters in
* Apache pipeline.
*
* @param serviceRequestFilter the filter to be added
*/ | Add a ServiceRequestFilter to the end of all the request filters in Apache pipeline | addRequestFilterLast | {
"repo_name": "vasanthangel4/autorest",
"path": "ClientRuntimes/Java/src/main/java/com/microsoft/rest/ServiceClient.java",
"license": "mit",
"size": 6028
} | [
"com.microsoft.rest.pipeline.HttpRequestInterceptorBackAdapter",
"com.microsoft.rest.pipeline.ServiceRequestFilter"
] | import com.microsoft.rest.pipeline.HttpRequestInterceptorBackAdapter; import com.microsoft.rest.pipeline.ServiceRequestFilter; | import com.microsoft.rest.pipeline.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 1,038,646 |
public void setFixedLegendItems(LegendItemCollection items) {
this.fixedLegendItems = items;
fireChangeEvent();
} | void function(LegendItemCollection items) { this.fixedLegendItems = items; fireChangeEvent(); } | /**
* Sets the fixed legend items for the plot. Leave this set to
* {@code null} if you prefer the legend items to be created
* automatically.
*
* @param items the legend items ({@code null} permitted).
*
* @see #getFixedLegendItems()
*
* @since 1.0.14
*/ | Sets the fixed legend items for the plot. Leave this set to null if you prefer the legend items to be created automatically | setFixedLegendItems | {
"repo_name": "simon04/jfreechart",
"path": "src/main/java/org/jfree/chart/plot/PolarPlot.java",
"license": "lgpl-2.1",
"size": 70680
} | [
"org.jfree.chart.LegendItemCollection"
] | import org.jfree.chart.LegendItemCollection; | import org.jfree.chart.*; | [
"org.jfree.chart"
] | org.jfree.chart; | 1,745,335 |
Date value = (Date) getValue();
return value != null ? new LocalDateTime(value).toString(formatter) : "";
} | Date value = (Date) getValue(); return value != null ? new LocalDateTime(value).toString(formatter) : ""; } | /**
* Format the YearMonthDay as String, using the specified format.
*
* @return DateTime formatted string
*/ | Format the YearMonthDay as String, using the specified format | getAsText | {
"repo_name": "jbordeau/uvlPresence",
"path": "src/main/java/org/uvl/presence/web/propertyeditors/LocaleDateTimeEditor.java",
"license": "apache-2.0",
"size": 1994
} | [
"java.util.Date",
"org.joda.time.LocalDateTime"
] | import java.util.Date; import org.joda.time.LocalDateTime; | import java.util.*; import org.joda.time.*; | [
"java.util",
"org.joda.time"
] | java.util; org.joda.time; | 2,820,910 |
protected void writeRaw(CharSequence seq, CharBuf buffer) {
if (seq != null) {
buffer.add(seq.toString());
}
} | void function(CharSequence seq, CharBuf buffer) { if (seq != null) { buffer.add(seq.toString()); } } | /**
* Serializes any char sequence and writes it into specified buffer
* without performing any manipulation of the given text.
*/ | Serializes any char sequence and writes it into specified buffer without performing any manipulation of the given text | writeRaw | {
"repo_name": "apache/incubator-groovy",
"path": "subprojects/groovy-json/src/main/java/groovy/json/DefaultJsonGenerator.java",
"license": "apache-2.0",
"size": 21233
} | [
"org.apache.groovy.json.internal.CharBuf"
] | import org.apache.groovy.json.internal.CharBuf; | import org.apache.groovy.json.internal.*; | [
"org.apache.groovy"
] | org.apache.groovy; | 924,798 |
public FeatureResultSet queryFeaturesForChunk(String[] columns, double minX,
double minY, double maxX, double maxY, String where,
String[] whereArgs, int limit, long offset) {
return queryFeaturesForChunk(columns, minX, minY, maxX, maxY, where,
whereArgs, getPkColumnName(), limit, offset);
} | FeatureResultSet function(String[] columns, double minX, double minY, double maxX, double maxY, String where, String[] whereArgs, int limit, long offset) { return queryFeaturesForChunk(columns, minX, minY, maxX, maxY, where, whereArgs, getPkColumnName(), limit, offset); } | /**
* Query for features within the bounds ordered by id, starting at the
* offset and returning no more than the limit
*
* @param columns
* columns
* @param minX
* min x
* @param minY
* min y
* @param maxX
* max x
* @param maxY
* max y
* @param where
* where clause
* @param whereArgs
* where arguments
* @param limit
* chunk limit
* @param offset
* chunk query offset
* @return results
* @since 6.2.0
*/ | Query for features within the bounds ordered by id, starting at the offset and returning no more than the limit | queryFeaturesForChunk | {
"repo_name": "ngageoint/geopackage-java",
"path": "src/main/java/mil/nga/geopackage/extension/rtree/RTreeIndexTableDao.java",
"license": "mit",
"size": 349361
} | [
"mil.nga.geopackage.features.user.FeatureResultSet"
] | import mil.nga.geopackage.features.user.FeatureResultSet; | import mil.nga.geopackage.features.user.*; | [
"mil.nga.geopackage"
] | mil.nga.geopackage; | 1,962,785 |
Preconditions.checkArgument(jsonString != null, "null argument not allowed");
return new JsonParser().parse(jsonString);
} | Preconditions.checkArgument(jsonString != null, STR); return new JsonParser().parse(jsonString); } | /**
* Parses a JSON-formatted {@link String}.
*
* @param jsonString
* The JSON-formatted string.
* @return A {@link JsonElement} for the parsed JSON {@link String}.
* @throws JsonParseException
* @throws IllegalArgumentException
*/ | Parses a JSON-formatted <code>String</code> | parseJsonString | {
"repo_name": "elastisys/scale.commons",
"path": "json/src/main/java/com/elastisys/scale/commons/json/JsonUtils.java",
"license": "apache-2.0",
"size": 8837
} | [
"com.elastisys.scale.commons.util.precond.Preconditions",
"com.google.gson.JsonParser"
] | import com.elastisys.scale.commons.util.precond.Preconditions; import com.google.gson.JsonParser; | import com.elastisys.scale.commons.util.precond.*; import com.google.gson.*; | [
"com.elastisys.scale",
"com.google.gson"
] | com.elastisys.scale; com.google.gson; | 2,836,988 |
@Test()
public void testAnythingGoes()
throws Exception
{
final ArrayList<ObjectPair<String,String>> preferredDeliveryMechanisms =
new ArrayList<ObjectPair<String,String>>(1);
preferredDeliveryMechanisms.add(
new ObjectPair<String,String>("Email", "tuser@example.com"));
DeliverSingleUseTokenExtendedRequest r =
new DeliverSingleUseTokenExtendedRequest(
"uid=test.user,dc=example,dc=com", "testAnythingGoes",
null, null, null, null, null, null, preferredDeliveryMechanisms,
true, true, true, true);
r = new DeliverSingleUseTokenExtendedRequest(r.duplicate());
assertNotNull(r.getOID());
assertEquals(r.getOID(), "1.3.6.1.4.1.30221.2.6.49");
assertNotNull(r.getValue());
assertNotNull(r.getUserDN());
assertDNsEqual(r.getUserDN(), "uid=test.user,dc=example,dc=com");
assertNotNull(r.getTokenID());
assertEquals(r.getTokenID(), "testAnythingGoes");
assertNull(r.getValidityDurationMillis());
assertNull(r.getMessageSubject());
assertNull(r.getFullTextBeforeToken());
assertNull(r.getFullTextAfterToken());
assertNull(r.getCompactTextBeforeToken());
assertNull(r.getCompactTextAfterToken());
assertNotNull(r.getPreferredDeliveryMechanisms());
assertEquals(r.getPreferredDeliveryMechanisms(),
preferredDeliveryMechanisms);
assertTrue(r.deliverIfPasswordExpired());
assertTrue(r.deliverIfAccountLocked());
assertTrue(r.deliverIfAccountDisabled());
assertTrue(r.deliverIfAccountExpired());
assertEquals(r.getControls().length, 0);
assertNotNull(r.getExtendedRequestName());
assertNotNull(r.toString());
} | @Test() void function() throws Exception { final ArrayList<ObjectPair<String,String>> preferredDeliveryMechanisms = new ArrayList<ObjectPair<String,String>>(1); preferredDeliveryMechanisms.add( new ObjectPair<String,String>("Email", STR)); DeliverSingleUseTokenExtendedRequest r = new DeliverSingleUseTokenExtendedRequest( STR, STR, null, null, null, null, null, null, preferredDeliveryMechanisms, true, true, true, true); r = new DeliverSingleUseTokenExtendedRequest(r.duplicate()); assertNotNull(r.getOID()); assertEquals(r.getOID(), STR); assertNotNull(r.getValue()); assertNotNull(r.getUserDN()); assertDNsEqual(r.getUserDN(), STR); assertNotNull(r.getTokenID()); assertEquals(r.getTokenID(), STR); assertNull(r.getValidityDurationMillis()); assertNull(r.getMessageSubject()); assertNull(r.getFullTextBeforeToken()); assertNull(r.getFullTextAfterToken()); assertNull(r.getCompactTextBeforeToken()); assertNull(r.getCompactTextAfterToken()); assertNotNull(r.getPreferredDeliveryMechanisms()); assertEquals(r.getPreferredDeliveryMechanisms(), preferredDeliveryMechanisms); assertTrue(r.deliverIfPasswordExpired()); assertTrue(r.deliverIfAccountLocked()); assertTrue(r.deliverIfAccountDisabled()); assertTrue(r.deliverIfAccountExpired()); assertEquals(r.getControls().length, 0); assertNotNull(r.getExtendedRequestName()); assertNotNull(r.toString()); } | /**
* Tests a case in which the token should be delivered no matter what.
*
* @throws Exception If an unexpected problem occurs.
*/ | Tests a case in which the token should be delivered no matter what | testAnythingGoes | {
"repo_name": "UnboundID/ldapsdk",
"path": "tests/unit/src/com/unboundid/ldap/sdk/unboundidds/extensions/DeliverSingleUseTokenExtendedRequestTestCase.java",
"license": "gpl-2.0",
"size": 11257
} | [
"com.unboundid.util.ObjectPair",
"java.util.ArrayList",
"org.testng.annotations.Test"
] | import com.unboundid.util.ObjectPair; import java.util.ArrayList; import org.testng.annotations.Test; | import com.unboundid.util.*; import java.util.*; import org.testng.annotations.*; | [
"com.unboundid.util",
"java.util",
"org.testng.annotations"
] | com.unboundid.util; java.util; org.testng.annotations; | 930,139 |
public static String decodePath(final String str) {
final int queryIdx = str.indexOf('?');
final String partBeforeQuery = queryIdx < 0 ? str : str.substring(0, queryIdx);
final String partFromQuery = queryIdx < 0 ? "" : str.substring(queryIdx);
final ByteArrayOutputStream buf = new ByteArrayOutputStream();
unescapeChars(partBeforeQuery, false, buf);
unescapeChars(partFromQuery, true, buf);
return new String(buf.toByteArray(), StandardCharsets.UTF_8);
} | static String function(final String str) { final int queryIdx = str.indexOf('?'); final String partBeforeQuery = queryIdx < 0 ? str : str.substring(0, queryIdx); final String partFromQuery = queryIdx < 0 ? "" : str.substring(queryIdx); final ByteArrayOutputStream buf = new ByteArrayOutputStream(); unescapeChars(partBeforeQuery, false, buf); unescapeChars(partFromQuery, true, buf); return new String(buf.toByteArray(), StandardCharsets.UTF_8); } | /**
* Unescape a URL segment, and turn it from UTF-8 bytes into a Java string.
*
* @param str
* the str
* @return the string
*/ | Unescape a URL segment, and turn it from UTF-8 bytes into a Java string | decodePath | {
"repo_name": "classgraph/classgraph",
"path": "src/main/java/nonapi/io/github/classgraph/utils/URLPathEncoder.java",
"license": "mit",
"size": 10179
} | [
"java.io.ByteArrayOutputStream",
"java.nio.charset.StandardCharsets"
] | import java.io.ByteArrayOutputStream; import java.nio.charset.StandardCharsets; | import java.io.*; import java.nio.charset.*; | [
"java.io",
"java.nio"
] | java.io; java.nio; | 2,047,695 |
public void update(GameContainer container, StateBasedGame game, int delta, Business business, MainState mainState,
boolean leftMouseClicked, int mouseX, int mouseY) throws SlickException {
// Super class update. This is where we check for mouse overs.
super.update(container, game, delta, business, leftMouseClicked, mouseX, mouseY,
referringMarketConsole.getReleaseDate() <= mainState.getTimeController().getTime());
// Buy Button Position
buyButton.update(container, game, delta, leftMouseClicked, false, mouseX, mouseY);
buyButton.setxPos(OffsetUtil.getPreciseOffset(this.xPos + 488f));
buyButton.setyPos(OffsetUtil.getPreciseOffset(this.yPos + 46f));
// Buy Button State
if(business.getMoney() >= referringMarketConsole.getPrice() && isAvailable) {
buyButton.setEnabled(true);
} else {
buyButton.setEnabled(false);
}
// Check if this List Row has been clicked
if(buyButton.gotLeftClicked(leftMouseClicked, mouseX, mouseY)) {
// Check if the player has the money to buy the Console but DON'T subtract it yet!
if(isAvailable && business.getMoney() >= referringMarketConsole.getPrice()) {
// Enter the PLACING_ASSET State
mainState.setCurrentMode(MainState.BUYING_ASSET);
// Instantiate the Console and give it to the Main State for placement
mainState.setPlacingAsset(new Console(business.getStore().getTables().size(), referringMarketConsole));
mainState.getPlacingAsset().setBeingMoved(true);
mainState.getPlacingAsset().setXTile(business.getStore().getMap().getXTileAtMouse());
mainState.getPlacingAsset().setYTile(business.getStore().getMap().getYTileAtMouse());
business.getStore().getMap().snapToGrid(mainState.getPlacingAsset());
// Close the Panel so the player can place the Console
mainState.hideAllPanels();
}
}
}
| void function(GameContainer container, StateBasedGame game, int delta, Business business, MainState mainState, boolean leftMouseClicked, int mouseX, int mouseY) throws SlickException { super.update(container, game, delta, business, leftMouseClicked, mouseX, mouseY, referringMarketConsole.getReleaseDate() <= mainState.getTimeController().getTime()); buyButton.update(container, game, delta, leftMouseClicked, false, mouseX, mouseY); buyButton.setxPos(OffsetUtil.getPreciseOffset(this.xPos + 488f)); buyButton.setyPos(OffsetUtil.getPreciseOffset(this.yPos + 46f)); if(business.getMoney() >= referringMarketConsole.getPrice() && isAvailable) { buyButton.setEnabled(true); } else { buyButton.setEnabled(false); } if(buyButton.gotLeftClicked(leftMouseClicked, mouseX, mouseY)) { if(isAvailable && business.getMoney() >= referringMarketConsole.getPrice()) { mainState.setCurrentMode(MainState.BUYING_ASSET); mainState.setPlacingAsset(new Console(business.getStore().getTables().size(), referringMarketConsole)); mainState.getPlacingAsset().setBeingMoved(true); mainState.getPlacingAsset().setXTile(business.getStore().getMap().getXTileAtMouse()); mainState.getPlacingAsset().setYTile(business.getStore().getMap().getYTileAtMouse()); business.getStore().getMap().snapToGrid(mainState.getPlacingAsset()); mainState.hideAllPanels(); } } } | /**
* The update method, where we call the super class update (for mouse overs) and check for clicks.
*/ | The update method, where we call the super class update (for mouse overs) and check for clicks | update | {
"repo_name": "lucasdnd/awesome-game-store",
"path": "src/com/lucasdnd/ags/ui/BuyConsolesListRow.java",
"license": "gpl-2.0",
"size": 7053
} | [
"com.lucasdnd.ags.gameplay.Business",
"com.lucasdnd.ags.gameplay.Console",
"com.lucasdnd.ags.map.OffsetUtil",
"com.lucasdnd.ags.system.MainState",
"org.newdawn.slick.GameContainer",
"org.newdawn.slick.SlickException",
"org.newdawn.slick.state.StateBasedGame"
] | import com.lucasdnd.ags.gameplay.Business; import com.lucasdnd.ags.gameplay.Console; import com.lucasdnd.ags.map.OffsetUtil; import com.lucasdnd.ags.system.MainState; import org.newdawn.slick.GameContainer; import org.newdawn.slick.SlickException; import org.newdawn.slick.state.StateBasedGame; | import com.lucasdnd.ags.gameplay.*; import com.lucasdnd.ags.map.*; import com.lucasdnd.ags.system.*; import org.newdawn.slick.*; import org.newdawn.slick.state.*; | [
"com.lucasdnd.ags",
"org.newdawn.slick"
] | com.lucasdnd.ags; org.newdawn.slick; | 1,903,530 |
public static Handler createStateMachineHandler() {
HandlerThread stateMachineThread = new HandlerThread("StateMachineThread");
stateMachineThread.start();
return new Handler(stateMachineThread.getLooper());
}
public StateMachine(
Handler handler,
StateChangeListener stateChangeListener,
State initialState,
Event timeoutEvent) {
this.handler = handler;
this.stateChangeListener = stateChangeListener;
this.state = initialState;
this.timeoutRunnable = () -> this.handleEvent(timeoutEvent);
} | static Handler function() { HandlerThread stateMachineThread = new HandlerThread(STR); stateMachineThread.start(); return new Handler(stateMachineThread.getLooper()); } public StateMachine( Handler handler, StateChangeListener stateChangeListener, State initialState, Event timeoutEvent) { this.handler = handler; this.stateChangeListener = stateChangeListener; this.state = initialState; this.timeoutRunnable = () -> this.handleEvent(timeoutEvent); } | /**
* Create a handler on a new handler thread
*
* @return a handler on a new handler thread
*/ | Create a handler on a new handler thread | createStateMachineHandler | {
"repo_name": "google/vr180",
"path": "java/com/google/vr180/common/wifi/StateMachine.java",
"license": "apache-2.0",
"size": 10877
} | [
"android.os.Handler",
"android.os.HandlerThread"
] | import android.os.Handler; import android.os.HandlerThread; | import android.os.*; | [
"android.os"
] | android.os; | 1,011,709 |
@Test
public void cornerSpr10111() throws Exception {
new ExtendedBeanInfo(Introspector.getBeanInfo(BigDecimal.class));
} | void function() throws Exception { new ExtendedBeanInfo(Introspector.getBeanInfo(BigDecimal.class)); } | /**
* Prior to SPR-10111 (a follow-up fix for SPR-9702), this method would throw an
* IntrospectionException regarding a "type mismatch between indexed and non-indexed
* methods" intermittently (approximately one out of every four times) under JDK 7
* due to non-deterministic results from {@link Class#getDeclaredMethods()}.
* See https://bugs.java.com/view_bug.do?bug_id=7023180
* @see #cornerSpr9702()
*/ | Prior to SPR-10111 (a follow-up fix for SPR-9702), this method would throw an IntrospectionException regarding a "type mismatch between indexed and non-indexed methods" intermittently (approximately one out of every four times) under JDK 7 due to non-deterministic results from <code>Class#getDeclaredMethods()</code>. See HREF | cornerSpr10111 | {
"repo_name": "spring-projects/spring-framework",
"path": "spring-beans/src/test/java/org/springframework/beans/ExtendedBeanInfoTests.java",
"license": "apache-2.0",
"size": 34920
} | [
"java.beans.Introspector",
"java.math.BigDecimal"
] | import java.beans.Introspector; import java.math.BigDecimal; | import java.beans.*; import java.math.*; | [
"java.beans",
"java.math"
] | java.beans; java.math; | 170,750 |
public static AWTKeyStroke getAWTKeyStrokeForEvent(KeyEvent event)
{
switch (event.id)
{
case KeyEvent.KEY_TYPED:
return getAWTKeyStroke(event.getKeyChar(), KeyEvent.VK_UNDEFINED,
extend(event.getModifiersEx()), false);
case KeyEvent.KEY_PRESSED:
return getAWTKeyStroke(KeyEvent.CHAR_UNDEFINED, event.getKeyCode(),
extend(event.getModifiersEx()), false);
case KeyEvent.KEY_RELEASED:
return getAWTKeyStroke(KeyEvent.CHAR_UNDEFINED, event.getKeyCode(),
extend(event.getModifiersEx()), true);
default:
return null;
}
} | static AWTKeyStroke function(KeyEvent event) { switch (event.id) { case KeyEvent.KEY_TYPED: return getAWTKeyStroke(event.getKeyChar(), KeyEvent.VK_UNDEFINED, extend(event.getModifiersEx()), false); case KeyEvent.KEY_PRESSED: return getAWTKeyStroke(KeyEvent.CHAR_UNDEFINED, event.getKeyCode(), extend(event.getModifiersEx()), false); case KeyEvent.KEY_RELEASED: return getAWTKeyStroke(KeyEvent.CHAR_UNDEFINED, event.getKeyCode(), extend(event.getModifiersEx()), true); default: return null; } } | /**
* Returns a keystroke representing what caused the key event.
*
* @param event the key event to convert
* @return the specified keystroke, or null if the event is invalid
* @throws NullPointerException if event is null
*/ | Returns a keystroke representing what caused the key event | getAWTKeyStrokeForEvent | {
"repo_name": "unofficial-opensource-apple/gcc_40",
"path": "libjava/java/awt/AWTKeyStroke.java",
"license": "gpl-2.0",
"size": 23150
} | [
"java.awt.event.KeyEvent"
] | import java.awt.event.KeyEvent; | import java.awt.event.*; | [
"java.awt"
] | java.awt; | 1,166,067 |
public static void appendAndDigest(File file, String str) {
append(file, str);
writeDigest(file.getPath());
} | static void function(File file, String str) { append(file, str); writeDigest(file.getPath()); } | /**
* Append string to specific file, then digest it.
*/ | Append string to specific file, then digest it | appendAndDigest | {
"repo_name": "CloudComLab/Voting-CAP",
"path": "src/utility/Utils.java",
"license": "apache-2.0",
"size": 11510
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 1,992,870 |
public Chunk loadChunk(int chunkX, int chunkZ)
{
Chunk chunk = new Chunk(this.world, chunkX, chunkZ);
this.chunkMapping.put(ChunkPos.asLong(chunkX, chunkZ), chunk);
net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(chunk));
chunk.setChunkLoaded(true);
return chunk;
} | Chunk function(int chunkX, int chunkZ) { Chunk chunk = new Chunk(this.world, chunkX, chunkZ); this.chunkMapping.put(ChunkPos.asLong(chunkX, chunkZ), chunk); net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(chunk)); chunk.setChunkLoaded(true); return chunk; } | /**
* loads or generates the chunk at the chunk location specified
*/ | loads or generates the chunk at the chunk location specified | loadChunk | {
"repo_name": "SuperUnitato/UnLonely",
"path": "build/tmp/recompileMc/sources/net/minecraft/client/multiplayer/ChunkProviderClient.java",
"license": "lgpl-2.1",
"size": 3844
} | [
"net.minecraft.util.math.ChunkPos",
"net.minecraft.world.chunk.Chunk"
] | import net.minecraft.util.math.ChunkPos; import net.minecraft.world.chunk.Chunk; | import net.minecraft.util.math.*; import net.minecraft.world.chunk.*; | [
"net.minecraft.util",
"net.minecraft.world"
] | net.minecraft.util; net.minecraft.world; | 1,158,612 |
public static void resetAuthenticationContext(AuthenticationContext context) {
context.setSubject(null);
context.setStateInfo(null);
context.setExternalIdP(null);
context.setAuthenticatorProperties(new HashMap<String, String>());
context.setRetryCount(0);
context.setRetrying(false);
context.setCurrentAuthenticator(null);
} | static void function(AuthenticationContext context) { context.setSubject(null); context.setStateInfo(null); context.setExternalIdP(null); context.setAuthenticatorProperties(new HashMap<String, String>()); context.setRetryCount(0); context.setRetrying(false); context.setCurrentAuthenticator(null); } | /**
* Reset authentication context.
*
* @param context Authentication Context.
* @throws FrameworkException
*/ | Reset authentication context | resetAuthenticationContext | {
"repo_name": "wso2/carbon-identity-framework",
"path": "components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/util/FrameworkUtils.java",
"license": "apache-2.0",
"size": 141138
} | [
"java.util.HashMap",
"org.wso2.carbon.identity.application.authentication.framework.context.AuthenticationContext"
] | import java.util.HashMap; import org.wso2.carbon.identity.application.authentication.framework.context.AuthenticationContext; | import java.util.*; import org.wso2.carbon.identity.application.authentication.framework.context.*; | [
"java.util",
"org.wso2.carbon"
] | java.util; org.wso2.carbon; | 2,342,898 |
public void addInvokestatic(CtClass clazz, String name,
CtClass returnType, CtClass[] paramTypes) {
String desc = Descriptor.ofMethod(returnType, paramTypes);
addInvokestatic(clazz, name, desc);
} | void function(CtClass clazz, String name, CtClass returnType, CtClass[] paramTypes) { String desc = Descriptor.ofMethod(returnType, paramTypes); addInvokestatic(clazz, name, desc); } | /**
* Appends INVOKESTATIC.
*
* @param clazz the target class.
* @param name the method name
* @param returnType the return type.
* @param paramTypes the parameter types.
*/ | Appends INVOKESTATIC | addInvokestatic | {
"repo_name": "erkieh/proxyhotswap",
"path": "src/main/java/io/github/proxyhotswap/javassist/bytecode/Bytecode.java",
"license": "gpl-2.0",
"size": 42033
} | [
"io.github.proxyhotswap.javassist.CtClass"
] | import io.github.proxyhotswap.javassist.CtClass; | import io.github.proxyhotswap.javassist.*; | [
"io.github.proxyhotswap"
] | io.github.proxyhotswap; | 306,454 |
boolean approve(TransportProvider p, Object objective); | boolean approve(TransportProvider p, Object objective); | /**
* Tells the service if it should accept the transport-specific objective
* (e.g. a channel, SocketAdress, ...).
*
* @param p
* TransportProvider who requests a new connection
* @param objective
* The objective for which a connection has to be aproved.
* @return the connection will be accepted if true
*/ | Tells the service if it should accept the transport-specific objective (e.g. a channel, SocketAdress, ...) | approve | {
"repo_name": "olir/nutshell-communicate",
"path": "src/main/java/de/serviceflow/nutshell/cl/intern/spi/ConnectionApprover.java",
"license": "apache-2.0",
"size": 1416
} | [
"de.serviceflow.nutshell.cl.intern.TransportProvider"
] | import de.serviceflow.nutshell.cl.intern.TransportProvider; | import de.serviceflow.nutshell.cl.intern.*; | [
"de.serviceflow.nutshell"
] | de.serviceflow.nutshell; | 755,951 |
public void setRawData(byte[] source) {
Validate.isTrue(source.length == data.length, "expected byte array of length " + data.length + ", not " + source.length);
System.arraycopy(source, 0, data, 0, source.length);
} | void function(byte[] source) { Validate.isTrue(source.length == data.length, STR + data.length + STR + source.length); System.arraycopy(source, 0, data, 0, source.length); } | /**
* Copies into the raw bytes of this nibble array from the given source.
* @param source The array to copy from.
* @throws IllegalArgumentException If source is not the correct length.
*/ | Copies into the raw bytes of this nibble array from the given source | setRawData | {
"repo_name": "ZephireNZ/Lantern",
"path": "src/main/java/org/spongepowered/lantern/util/NibbleArray.java",
"license": "mit",
"size": 4659
} | [
"org.apache.commons.lang3.Validate"
] | import org.apache.commons.lang3.Validate; | import org.apache.commons.lang3.*; | [
"org.apache.commons"
] | org.apache.commons; | 407,346 |
log.info("Test Ended on {}", host);
try {
if (!sampleStore.isEmpty()) {
sendBatch();
}
listener.testEnded(host);
} catch (RemoteException err) {
log.warn("testEnded(hostname)", err);
}
} | log.info(STR, host); try { if (!sampleStore.isEmpty()) { sendBatch(); } listener.testEnded(host); } catch (RemoteException err) { log.warn(STR, err); } } | /**
* Checks if any sample events are still present in the sampleStore and
* sends them to the listener. Informs the listener that the test ended.
*
* @param host the hostname that the test has ended on.
*/ | Checks if any sample events are still present in the sampleStore and sends them to the listener. Informs the listener that the test ended | testEnded | {
"repo_name": "ufctester/apache-jmeter",
"path": "src/core/org/apache/jmeter/samplers/StatisticalSampleSender.java",
"license": "apache-2.0",
"size": 8597
} | [
"java.rmi.RemoteException"
] | import java.rmi.RemoteException; | import java.rmi.*; | [
"java.rmi"
] | java.rmi; | 1,281,707 |
void setWarningLevel(CompilerOptions options,
String name, CheckLevel level) {
DiagnosticGroup group = forName(name);
Preconditions.checkNotNull(group, "No warning class for name: %s", name);
options.setWarningLevel(group, level);
} | void setWarningLevel(CompilerOptions options, String name, CheckLevel level) { DiagnosticGroup group = forName(name); Preconditions.checkNotNull(group, STR, name); options.setWarningLevel(group, level); } | /**
* Adds warning levels by name.
*/ | Adds warning levels by name | setWarningLevel | {
"repo_name": "wenzowski/closure-compiler",
"path": "src/com/google/javascript/jscomp/DiagnosticGroups.java",
"license": "apache-2.0",
"size": 12114
} | [
"com.google.common.base.Preconditions"
] | import com.google.common.base.Preconditions; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 1,395,853 |
public static boolean isActionPermittedForFileHierarchy(FileSystem fs, FileStatus fileStatus,
String userName, FsAction action) throws Exception {
return isActionPermittedForFileHierarchy(fs,fileStatus,userName, action, true);
} | static boolean function(FileSystem fs, FileStatus fileStatus, String userName, FsAction action) throws Exception { return isActionPermittedForFileHierarchy(fs,fileStatus,userName, action, true); } | /**
* Check if user userName has permissions to perform the given FsAction action
* on all files under the file whose FileStatus fileStatus is provided
*
* @param fs
* @param fileStatus
* @param userName
* @param action
* @return
* @throws IOException
*/ | Check if user userName has permissions to perform the given FsAction action on all files under the file whose FileStatus fileStatus is provided | isActionPermittedForFileHierarchy | {
"repo_name": "jcamachor/hive",
"path": "common/src/java/org/apache/hadoop/hive/common/FileUtils.java",
"license": "apache-2.0",
"size": 40951
} | [
"org.apache.hadoop.fs.FileStatus",
"org.apache.hadoop.fs.FileSystem",
"org.apache.hadoop.fs.permission.FsAction"
] | import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.permission.FsAction; | import org.apache.hadoop.fs.*; import org.apache.hadoop.fs.permission.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 550,534 |
@Override
public HashMap<String, ExpiredOrClosedAccountEntry> expiredOrClosedAccountsList(PurchaseOrderDocument po) {
HashMap<String, ExpiredOrClosedAccountEntry> list = new HashMap<String, ExpiredOrClosedAccountEntry>();
ExpiredOrClosedAccountEntry entry = null;
ExpiredOrClosedAccount originalAcct = null;
ExpiredOrClosedAccount replaceAcct = null;
String chartAccount = null;
if (po != null) {
// get list of active accounts
List<SourceAccountingLine> accountList = purapAccountingService.generateSummary(po.getItemsActiveOnly());
// loop through accounts
for (SourceAccountingLine poAccountingLine : accountList) {
Account account = accountService.getByPrimaryId(poAccountingLine.getChartOfAccountsCode(), poAccountingLine.getAccountNumber());
entry = new ExpiredOrClosedAccountEntry();
originalAcct = new ExpiredOrClosedAccount(poAccountingLine.getChartOfAccountsCode(), poAccountingLine.getAccountNumber(), poAccountingLine.getSubAccountNumber());
if (!account.isActive()) {
// 1. if the account is closed, get the continuation account and add it to the list
Account continuationAccount = accountService.getByPrimaryId(account.getContinuationFinChrtOfAcctCd(), account.getContinuationAccountNumber());
if (continuationAccount == null) {
replaceAcct = new ExpiredOrClosedAccount();
originalAcct.setContinuationAccountMissing(true);
entry.setOriginalAccount(originalAcct);
entry.setReplacementAccount(replaceAcct);
list.put(createChartAccountString(originalAcct), entry);
}
else {
replaceAcct = new ExpiredOrClosedAccount(continuationAccount.getChartOfAccountsCode(), continuationAccount.getAccountNumber(), poAccountingLine.getSubAccountNumber());
entry.setOriginalAccount(originalAcct);
entry.setReplacementAccount(replaceAcct);
list.put(createChartAccountString(originalAcct), entry);
}
// 2. if the account is expired and the current date is <= 90 days from the expiration date, do nothing
// 3. if the account is expired and the current date is > 90 days from the expiration date, get the continuation
// account and add it to the list
}
else if (account.isExpired()) {
Account continuationAccount = accountService.getByPrimaryId(account.getContinuationFinChrtOfAcctCd(), account.getContinuationAccountNumber());
String expirationExtensionDays = parameterService.getParameterValueAsString(ScrubberStep.class, KFSConstants.SystemGroupParameterNames.GL_SCRUBBER_VALIDATION_DAYS_OFFSET);
int expirationExtensionDaysInt = 3 * 30; // default to 90 days (approximately 3 months)
if (expirationExtensionDays.trim().length() > 0) {
expirationExtensionDaysInt = Integer.parseInt(expirationExtensionDays);
}
// if account is C&G and expired then add to list.
if ((account.isForContractsAndGrants() && dateTimeService.dateDiff(account.getAccountExpirationDate(), dateTimeService.getCurrentDate(), true) > expirationExtensionDaysInt)) {
if (continuationAccount == null) {
replaceAcct = new ExpiredOrClosedAccount();
originalAcct.setContinuationAccountMissing(true);
entry.setOriginalAccount(originalAcct);
entry.setReplacementAccount(replaceAcct);
list.put(createChartAccountString(originalAcct), entry);
}
else {
replaceAcct = new ExpiredOrClosedAccount(continuationAccount.getChartOfAccountsCode(), continuationAccount.getAccountNumber(), poAccountingLine.getSubAccountNumber());
entry.setOriginalAccount(originalAcct);
entry.setReplacementAccount(replaceAcct);
list.put(createChartAccountString(originalAcct), entry);
}
}
// if account is not C&G, use the same account, do not replace
}
}
}
return list;
} | HashMap<String, ExpiredOrClosedAccountEntry> function(PurchaseOrderDocument po) { HashMap<String, ExpiredOrClosedAccountEntry> list = new HashMap<String, ExpiredOrClosedAccountEntry>(); ExpiredOrClosedAccountEntry entry = null; ExpiredOrClosedAccount originalAcct = null; ExpiredOrClosedAccount replaceAcct = null; String chartAccount = null; if (po != null) { List<SourceAccountingLine> accountList = purapAccountingService.generateSummary(po.getItemsActiveOnly()); for (SourceAccountingLine poAccountingLine : accountList) { Account account = accountService.getByPrimaryId(poAccountingLine.getChartOfAccountsCode(), poAccountingLine.getAccountNumber()); entry = new ExpiredOrClosedAccountEntry(); originalAcct = new ExpiredOrClosedAccount(poAccountingLine.getChartOfAccountsCode(), poAccountingLine.getAccountNumber(), poAccountingLine.getSubAccountNumber()); if (!account.isActive()) { Account continuationAccount = accountService.getByPrimaryId(account.getContinuationFinChrtOfAcctCd(), account.getContinuationAccountNumber()); if (continuationAccount == null) { replaceAcct = new ExpiredOrClosedAccount(); originalAcct.setContinuationAccountMissing(true); entry.setOriginalAccount(originalAcct); entry.setReplacementAccount(replaceAcct); list.put(createChartAccountString(originalAcct), entry); } else { replaceAcct = new ExpiredOrClosedAccount(continuationAccount.getChartOfAccountsCode(), continuationAccount.getAccountNumber(), poAccountingLine.getSubAccountNumber()); entry.setOriginalAccount(originalAcct); entry.setReplacementAccount(replaceAcct); list.put(createChartAccountString(originalAcct), entry); } } else if (account.isExpired()) { Account continuationAccount = accountService.getByPrimaryId(account.getContinuationFinChrtOfAcctCd(), account.getContinuationAccountNumber()); String expirationExtensionDays = parameterService.getParameterValueAsString(ScrubberStep.class, KFSConstants.SystemGroupParameterNames.GL_SCRUBBER_VALIDATION_DAYS_OFFSET); int expirationExtensionDaysInt = 3 * 30; if (expirationExtensionDays.trim().length() > 0) { expirationExtensionDaysInt = Integer.parseInt(expirationExtensionDays); } if ((account.isForContractsAndGrants() && dateTimeService.dateDiff(account.getAccountExpirationDate(), dateTimeService.getCurrentDate(), true) > expirationExtensionDaysInt)) { if (continuationAccount == null) { replaceAcct = new ExpiredOrClosedAccount(); originalAcct.setContinuationAccountMissing(true); entry.setOriginalAccount(originalAcct); entry.setReplacementAccount(replaceAcct); list.put(createChartAccountString(originalAcct), entry); } else { replaceAcct = new ExpiredOrClosedAccount(continuationAccount.getChartOfAccountsCode(), continuationAccount.getAccountNumber(), poAccountingLine.getSubAccountNumber()); entry.setOriginalAccount(originalAcct); entry.setReplacementAccount(replaceAcct); list.put(createChartAccountString(originalAcct), entry); } } } } } return list; } | /**
* Generates a list of replacement accounts for expired or closed accounts, as well as for expired/closed accounts without a continuation account.
*
* @param document The purchase order document whose accounts we'll use to generate the list of
* replacement accounts for expired or closed accounts.
* @return The HashMap where the keys are the string representations of the chart and account
* of the original account and the values are the ExpiredOrClosedAccountEntry.
*/ | Generates a list of replacement accounts for expired or closed accounts, as well as for expired/closed accounts without a continuation account | expiredOrClosedAccountsList | {
"repo_name": "Ariah-Group/Finance",
"path": "af_webapp/src/main/java/org/kuali/kfs/module/purap/document/service/impl/AccountsPayableServiceImpl.java",
"license": "apache-2.0",
"size": 42850
} | [
"java.util.HashMap",
"java.util.List",
"org.kuali.kfs.coa.businessobject.Account",
"org.kuali.kfs.gl.batch.ScrubberStep",
"org.kuali.kfs.module.purap.document.PurchaseOrderDocument",
"org.kuali.kfs.module.purap.util.ExpiredOrClosedAccount",
"org.kuali.kfs.module.purap.util.ExpiredOrClosedAccountEntry",
"org.kuali.kfs.sys.KFSConstants",
"org.kuali.kfs.sys.businessobject.SourceAccountingLine"
] | import java.util.HashMap; import java.util.List; import org.kuali.kfs.coa.businessobject.Account; import org.kuali.kfs.gl.batch.ScrubberStep; import org.kuali.kfs.module.purap.document.PurchaseOrderDocument; import org.kuali.kfs.module.purap.util.ExpiredOrClosedAccount; import org.kuali.kfs.module.purap.util.ExpiredOrClosedAccountEntry; import org.kuali.kfs.sys.KFSConstants; import org.kuali.kfs.sys.businessobject.SourceAccountingLine; | import java.util.*; import org.kuali.kfs.coa.businessobject.*; import org.kuali.kfs.gl.batch.*; import org.kuali.kfs.module.purap.document.*; import org.kuali.kfs.module.purap.util.*; import org.kuali.kfs.sys.*; import org.kuali.kfs.sys.businessobject.*; | [
"java.util",
"org.kuali.kfs"
] | java.util; org.kuali.kfs; | 1,935,287 |
public ChartViewer createChart(iFormViewer fv, String key, int viewers, ChartDataItem series) {
Chart cfg = new Chart();
ChartViewer viewer;
cfg.setEventHandler("onFling", "class:" + eventHandlerClass + "#onChartFling");
cfg.setEventHandler("onScale", "class:" + eventHandlerClass + "#onChartScale");
cfg.setEventHandler("onResize", "class:" + eventHandlerClass + "#onChartResize");
int len = series.size();
if (viewers == 1) {
cfg.font.size.setValue("-2");
cfg.getPlotReference().labels.setValue(Plot.CLabels.linked_data);
} else {
cfg.font.size.setValue("-4");
cfg.domainAxis.visible.setValue(false);
}
cfg.domainAxis.fgColor.setValue("darkBorder");
cfg.rangeAxis.fgColor.setValue("darkBorder");
cfg.domainAxis.spot_setAttribute("labelColor", "Rare.Chart.foreground");
cfg.rangeAxis.spot_setAttribute("labelColor", "Rare.Chart.foreground");
cfg.getPlotReference().borderColor.setValue("darkBorder");
cfg.verticalAlign.setValue(Chart.CVerticalAlign.full);
cfg.setHorizontalAlignment(Chart.CHorizontalAlign.full);
viewer = new ChartViewer(fv);
configureChart(viewer, cfg, key, series);
if (len > chartPoints) {
for (int i = len - chartPoints; i < len; i++) {
series.addIndexToFilteredList(i);
}
}
viewer.configure(cfg);
viewer.addSeries(series);
String range = (String) series.getLinkedData();
if (range != null) {
viewer.addRangeMarker(range, '-');
}
viewer.setLinkedData(key);
viewer.rebuildChart();
viewer.setPlotValuesVisible(false);
return viewer;
} | ChartViewer function(iFormViewer fv, String key, int viewers, ChartDataItem series) { Chart cfg = new Chart(); ChartViewer viewer; cfg.setEventHandler(STR, STR + eventHandlerClass + STR); cfg.setEventHandler(STR, STR + eventHandlerClass + STR); cfg.setEventHandler(STR, STR + eventHandlerClass + STR); int len = series.size(); if (viewers == 1) { cfg.font.size.setValue("-2"); cfg.getPlotReference().labels.setValue(Plot.CLabels.linked_data); } else { cfg.font.size.setValue("-4"); cfg.domainAxis.visible.setValue(false); } cfg.domainAxis.fgColor.setValue(STR); cfg.rangeAxis.fgColor.setValue(STR); cfg.domainAxis.spot_setAttribute(STR, STR); cfg.rangeAxis.spot_setAttribute(STR, STR); cfg.getPlotReference().borderColor.setValue(STR); cfg.verticalAlign.setValue(Chart.CVerticalAlign.full); cfg.setHorizontalAlignment(Chart.CHorizontalAlign.full); viewer = new ChartViewer(fv); configureChart(viewer, cfg, key, series); if (len > chartPoints) { for (int i = len - chartPoints; i < len; i++) { series.addIndexToFilteredList(i); } } viewer.configure(cfg); viewer.addSeries(series); String range = (String) series.getLinkedData(); if (range != null) { viewer.addRangeMarker(range, '-'); } viewer.setLinkedData(key); viewer.rebuildChart(); viewer.setPlotValuesVisible(false); return viewer; } | /**
* Creates a new chart viewer
*
* @param fv
* the charts parent form
* @param rows
* the values for the chart
* @param key
* then key for the chart
* @param viewers
* the number of viewers being creates (use to decide on font size)
* @param series
* the series of data points to display
* @return the new chart viewer
*/ | Creates a new chart viewer | createChart | {
"repo_name": "sparseware/ccp-bellavista",
"path": "shared/com/sparseware/bellavista/aChartHandler.java",
"license": "apache-2.0",
"size": 21744
} | [
"com.appnativa.rare.spot.Chart",
"com.appnativa.rare.spot.Plot",
"com.appnativa.rare.ui.chart.ChartDataItem",
"com.appnativa.rare.viewer.ChartViewer"
] | import com.appnativa.rare.spot.Chart; import com.appnativa.rare.spot.Plot; import com.appnativa.rare.ui.chart.ChartDataItem; import com.appnativa.rare.viewer.ChartViewer; | import com.appnativa.rare.spot.*; import com.appnativa.rare.ui.chart.*; import com.appnativa.rare.viewer.*; | [
"com.appnativa.rare"
] | com.appnativa.rare; | 60,234 |
private static void executeStreamlink(final Video video) {
try {
ProcessBuilder pb = new ProcessBuilder();
List<String> command = new ArrayList<>();
command.add("streamlink");
if (Config.getValue(Config.PROP_MEDIA_PLAYER) != null) {
String mediaPlayer = Config.getValue(Config.PROP_MEDIA_PLAYER);
command.add("-p");
command.add(mediaPlayer);
}
command.add(video.getUrl());
command.add("best");
pb.command(command);
pb.start();
} catch (IOException e) {
Platform.runLater(() -> ErrorDialog.show(
"Streamlink not found",
"Streamlink cannot be found on your system."
+ "\nPlease, make sure Streamlink is installed."
+ "\n(https://streamlink.github.io/)"));
}
} | static void function(final Video video) { try { ProcessBuilder pb = new ProcessBuilder(); List<String> command = new ArrayList<>(); command.add(STR); if (Config.getValue(Config.PROP_MEDIA_PLAYER) != null) { String mediaPlayer = Config.getValue(Config.PROP_MEDIA_PLAYER); command.add("-p"); command.add(mediaPlayer); } command.add(video.getUrl()); command.add("best"); pb.command(command); pb.start(); } catch (IOException e) { Platform.runLater(() -> ErrorDialog.show( STR, STR + STR + "\n(https: } } | /**
* Execute Streamlink to read the given video.
*
* @param video Video to play
*/ | Execute Streamlink to read the given video | executeStreamlink | {
"repo_name": "Alkisum/YTSubscriber",
"path": "src/main/java/view/pane/VideoPane.java",
"license": "mit",
"size": 12080
} | [
"java.io.IOException",
"java.util.ArrayList",
"java.util.List"
] | import java.io.IOException; import java.util.ArrayList; import java.util.List; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,696,441 |
public void setColor (Color color)
{
int rgba = color.getRGB();
super.setCode(String.valueOf(rgba));
} // setColor
| void function (Color color) { int rgba = color.getRGB(); super.setCode(String.valueOf(rgba)); } | /**
* Set Color
* @param color Color
*/ | Set Color | setColor | {
"repo_name": "geneos/adempiere",
"path": "base/src/org/compiere/print/MPrintColor.java",
"license": "gpl-2.0",
"size": 8024
} | [
"java.awt.Color"
] | import java.awt.Color; | import java.awt.*; | [
"java.awt"
] | java.awt; | 1,531,031 |
private void normalizeRows(final List<String[]> rows) {
// find the longest row
final Optional<Integer> maxRowLength = rows.stream().map(row -> row.length).max(Integer::compareTo);
if (maxRowLength.isPresent()) {
// update all rows to the maxRowLength
for (int i = 0; i < rows.size(); i++) {
final String[] row = rows.get(i);
if (row.length < maxRowLength.get()) {
final List<String> newRow = new ArrayList<>(Arrays.asList(row));
// adding the remaining elements
for (int j = 0; j < maxRowLength.get() - row.length; j++) {
newRow.add(null);
}
rows.set(i, newRow.toArray(new String[newRow.size()]));
}
}
}
} | void function(final List<String[]> rows) { final Optional<Integer> maxRowLength = rows.stream().map(row -> row.length).max(Integer::compareTo); if (maxRowLength.isPresent()) { for (int i = 0; i < rows.size(); i++) { final String[] row = rows.get(i); if (row.length < maxRowLength.get()) { final List<String> newRow = new ArrayList<>(Arrays.asList(row)); for (int j = 0; j < maxRowLength.get() - row.length; j++) { newRow.add(null); } rows.set(i, newRow.toArray(new String[newRow.size()])); } } } } | /**
* Normalize all rows to the same length - we can encounter this situation when last columns are Strings
* and they are empty, making this hypothetical row smaller than a row that has values for all columns.
*/ | Normalize all rows to the same length - we can encounter this situation when last columns are Strings and they are empty, making this hypothetical row smaller than a row that has values for all columns | normalizeRows | {
"repo_name": "devgateway/oc-explorer",
"path": "persistence/src/main/java/org/devgateway/toolkit/persistence/excel/ExcelFileImportDefault.java",
"license": "mit",
"size": 3348
} | [
"java.util.ArrayList",
"java.util.Arrays",
"java.util.List",
"java.util.Optional"
] | import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Optional; | import java.util.*; | [
"java.util"
] | java.util; | 2,693,267 |
@ApiModelProperty(example = "TestAPI", value = "The name of the associated API")
public String getApiName() {
return apiName;
} | @ApiModelProperty(example = STR, value = STR) String function() { return apiName; } | /**
* The name of the associated API
* @return apiName
**/ | The name of the associated API | getApiName | {
"repo_name": "jaadds/product-apim",
"path": "modules/integration/tests-common/clients/publisher/src/gen/java/org/wso2/am/integration/clients/publisher/api/v1/dto/DocumentSearchResultDTO.java",
"license": "apache-2.0",
"size": 12686
} | [
"io.swagger.annotations.ApiModelProperty"
] | import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.*; | [
"io.swagger.annotations"
] | io.swagger.annotations; | 751,201 |
protected BucketRegion getMatchingBucket(PartitionedRegion region, Integer bucketId) {
// Force the bucket to be created if it is not already
region.getOrCreateNodeForBucketWrite(bucketId, null);
return region.getDataStore().getLocalBucketById(bucketId);
} | BucketRegion function(PartitionedRegion region, Integer bucketId) { region.getOrCreateNodeForBucketWrite(bucketId, null); return region.getDataStore().getLocalBucketById(bucketId); } | /**
* Find the bucket in region2 that matches the bucket id from region1.
*/ | Find the bucket in region2 that matches the bucket id from region1 | getMatchingBucket | {
"repo_name": "smanvi-pivotal/geode",
"path": "geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/IndexRepositoryFactory.java",
"license": "apache-2.0",
"size": 4856
} | [
"org.apache.geode.internal.cache.BucketRegion",
"org.apache.geode.internal.cache.PartitionedRegion"
] | import org.apache.geode.internal.cache.BucketRegion; import org.apache.geode.internal.cache.PartitionedRegion; | import org.apache.geode.internal.cache.*; | [
"org.apache.geode"
] | org.apache.geode; | 33,894 |
public Map<String, String> getVendorCreditMemoDocumentStatuses();
| Map<String, String> function(); | /**
* Retrieves the status code and status description for vendor credit memos.
*
* @return Map<String, String>
*/ | Retrieves the status code and status description for vendor credit memos | getVendorCreditMemoDocumentStatuses | {
"repo_name": "ua-eas/ua-kfs-5.3",
"path": "work/src/org/kuali/kfs/module/purap/dataaccess/StatusCodeAndDescriptionForPurapDocumentsDao.java",
"license": "agpl-3.0",
"size": 2171
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,711,214 |
public void assertDateCreated(CmsObject cms, String resourceName, long dateCreated) {
try {
// get the actual resource from the vfs
CmsResource res = cms.readResource(resourceName, CmsResourceFilter.ALL);
if (res.getDateCreated() != dateCreated) {
fail("[DateCreated "
+ dateCreated
+ " i.e. "
+ CmsDateUtil.getHeaderDate(dateCreated)
+ " != "
+ res.getDateCreated()
+ " i.e. "
+ CmsDateUtil.getHeaderDate(res.getDateCreated())
+ "]");
}
} catch (CmsException e) {
fail("cannot read resource " + resourceName + " " + CmsException.getStackTraceAsString(e));
}
} | void function(CmsObject cms, String resourceName, long dateCreated) { try { CmsResource res = cms.readResource(resourceName, CmsResourceFilter.ALL); if (res.getDateCreated() != dateCreated) { fail(STR + dateCreated + STR + CmsDateUtil.getHeaderDate(dateCreated) + STR + res.getDateCreated() + STR + CmsDateUtil.getHeaderDate(res.getDateCreated()) + "]"); } } catch (CmsException e) { fail(STR + resourceName + " " + CmsException.getStackTraceAsString(e)); } } | /**
* Compares the current date created of a resource with a given date.<p>
*
* @param cms the CmsObject
* @param resourceName the name of the resource to compare
* @param dateCreated the creation date
*/ | Compares the current date created of a resource with a given date | assertDateCreated | {
"repo_name": "serrapos/opencms-core",
"path": "test/org/opencms/test/OpenCmsTestCase.java",
"license": "lgpl-2.1",
"size": 144807
} | [
"org.opencms.file.CmsObject",
"org.opencms.file.CmsResource",
"org.opencms.file.CmsResourceFilter",
"org.opencms.main.CmsException",
"org.opencms.util.CmsDateUtil"
] | import org.opencms.file.CmsObject; import org.opencms.file.CmsResource; import org.opencms.file.CmsResourceFilter; import org.opencms.main.CmsException; import org.opencms.util.CmsDateUtil; | import org.opencms.file.*; import org.opencms.main.*; import org.opencms.util.*; | [
"org.opencms.file",
"org.opencms.main",
"org.opencms.util"
] | org.opencms.file; org.opencms.main; org.opencms.util; | 1,070,200 |
public Set<Path> getLocations() {
return locations;
} | Set<Path> function() { return locations; } | /**
* File locations for this partition
*
* @return file locations
*/ | File locations for this partition | getLocations | {
"repo_name": "kkhatua/drill",
"path": "metastore/metastore-api/src/main/java/org/apache/drill/metastore/metadata/PartitionMetadata.java",
"license": "apache-2.0",
"size": 3937
} | [
"java.util.Set",
"org.apache.hadoop.fs.Path"
] | import java.util.Set; import org.apache.hadoop.fs.Path; | import java.util.*; import org.apache.hadoop.fs.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 2,625,641 |
public static Supplier<List<Endpoint>> of(final Supplier<List<URI>> uriSupplier) {
return of(uriSupplier, DEFAULT_DNS_RESOLVER);
}
/**
* Returns a {@link Supplier} of a list of {@link Endpoint}.
*
* @param uriSupplier A Supplier of a list of URIs.
* @param dnsResolver An instance of {@link DnsResolver} | static Supplier<List<Endpoint>> function(final Supplier<List<URI>> uriSupplier) { return of(uriSupplier, DEFAULT_DNS_RESOLVER); } /** * Returns a {@link Supplier} of a list of {@link Endpoint}. * * @param uriSupplier A Supplier of a list of URIs. * @param dnsResolver An instance of {@link DnsResolver} | /**
* Returns a {@link Supplier} of a list of {@link Endpoint}.
*
* @param uriSupplier A Supplier of a list of URIs.
*
* @return A Supplier of a list of Endpoints.
*/ | Returns a <code>Supplier</code> of a list of <code>Endpoint</code> | of | {
"repo_name": "spotify/helios",
"path": "helios-client/src/main/java/com/spotify/helios/client/Endpoints.java",
"license": "apache-2.0",
"size": 5122
} | [
"com.google.common.base.Supplier",
"java.util.List",
"org.apache.http.conn.DnsResolver"
] | import com.google.common.base.Supplier; import java.util.List; import org.apache.http.conn.DnsResolver; | import com.google.common.base.*; import java.util.*; import org.apache.http.conn.*; | [
"com.google.common",
"java.util",
"org.apache.http"
] | com.google.common; java.util; org.apache.http; | 2,447,217 |
public AmazonS3 getS3Client()
{
return s3Client;
} | AmazonS3 function() { return s3Client; } | /**
* Returns the AmazonS3 service
*
* @return s3Client
*/ | Returns the AmazonS3 service | getS3Client | {
"repo_name": "brightchen/apex-malhar",
"path": "library/src/main/java/org/apache/apex/malhar/lib/fs/s3/S3RecordReader.java",
"license": "apache-2.0",
"size": 16580
} | [
"com.amazonaws.services.s3.AmazonS3"
] | import com.amazonaws.services.s3.AmazonS3; | import com.amazonaws.services.s3.*; | [
"com.amazonaws.services"
] | com.amazonaws.services; | 68,517 |
public UserRole[] getAllowedRoles() {
return new UserRole[] { UserRole.MANAGER, UserRole.ADMINISTRATOR };
} | UserRole[] function() { return new UserRole[] { UserRole.MANAGER, UserRole.ADMINISTRATOR }; } | /** Returns the user roles allowed to access this controller.
*
* @return The user roles allowed to access this controller.
*/ | Returns the user roles allowed to access this controller | getAllowedRoles | {
"repo_name": "leafsoftinfo/pyramus",
"path": "pyramus/src/main/java/fi/pyramus/json/courses/SaveCourseAssessmentsJSONRequestController.java",
"license": "gpl-3.0",
"size": 5468
} | [
"fi.pyramus.framework.UserRole"
] | import fi.pyramus.framework.UserRole; | import fi.pyramus.framework.*; | [
"fi.pyramus.framework"
] | fi.pyramus.framework; | 1,701,195 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.