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 void setOrientation(PlotOrientation orientation) {
super.setOrientation(orientation);
Iterator iterator = this.subplots.iterator();
while (iterator.hasNext()) {
CategoryPlot plot = (CategoryPlot) iterator.next();
plot.setOrientation(orientation);
}
}
|
void function(PlotOrientation orientation) { super.setOrientation(orientation); Iterator iterator = this.subplots.iterator(); while (iterator.hasNext()) { CategoryPlot plot = (CategoryPlot) iterator.next(); plot.setOrientation(orientation); } }
|
/**
* Sets the orientation for the plot (and all the subplots).
*
* @param orientation the orientation.
*/
|
Sets the orientation for the plot (and all the subplots)
|
setOrientation
|
{
"repo_name": "Epsilon2/Memetic-Algorithm-for-TSP",
"path": "jfreechart-1.0.16/source/org/jfree/chart/plot/CombinedRangeCategoryPlot.java",
"license": "mit",
"size": 20149
}
|
[
"java.util.Iterator"
] |
import java.util.Iterator;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 245,193 |
@FIXVersion(introduced = "4.3", retired = "4.4")
@TagNumRef(tagNum = TagNum.QuantityType)
public void setQuantityType(QuantityType quantityType) {
this.quantityType = quantityType;
}
|
@FIXVersion(introduced = "4.3", retired = "4.4") @TagNumRef(tagNum = TagNum.QuantityType) void function(QuantityType quantityType) { this.quantityType = quantityType; }
|
/**
* Message field setter.
* @param quantityType field value
*/
|
Message field setter
|
setQuantityType
|
{
"repo_name": "marvisan/HadesFIX",
"path": "Model/src/main/java/net/hades/fix/message/group/QuoteRequestRejectGroup.java",
"license": "gpl-3.0",
"size": 50378
}
|
[
"net.hades.fix.message.anno.FIXVersion",
"net.hades.fix.message.anno.TagNumRef",
"net.hades.fix.message.type.QuantityType",
"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.QuantityType; 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;
| 1,896,671 |
protected void disableLink(final ComponentTag tag)
{
// if the tag is an anchor proper
if (tag.getName().equalsIgnoreCase("a") || tag.getName().equalsIgnoreCase("link") ||
tag.getName().equalsIgnoreCase("area"))
{
// Change anchor link to span tag
tag.setName("span");
// Remove any href from the old link
tag.remove("href");
tag.remove("onclick");
}
// if the tag is a button or input
else if ("button".equalsIgnoreCase(tag.getName()) ||
"input".equalsIgnoreCase(tag.getName()))
{
tag.put("disabled", "disabled");
}
}
|
void function(final ComponentTag tag) { if (tag.getName().equalsIgnoreCase("a") tag.getName().equalsIgnoreCase("link") tag.getName().equalsIgnoreCase("area")) { tag.setName("span"); tag.remove("href"); tag.remove(STR); } else if (STR.equalsIgnoreCase(tag.getName()) "input".equalsIgnoreCase(tag.getName())) { tag.put(STR, STR); } }
|
/**
* Alters the tag so that the link renders as disabled.
*
* This method is meant to be called from {@link #onComponentTag(ComponentTag)} method of the
* derived class.
*
* @param tag
*/
|
Alters the tag so that the link renders as disabled. This method is meant to be called from <code>#onComponentTag(ComponentTag)</code> method of the derived class
|
disableLink
|
{
"repo_name": "martin-g/wicket-osgi",
"path": "wicket-core/src/main/java/org/apache/wicket/markup/html/link/AbstractLink.java",
"license": "apache-2.0",
"size": 6192
}
|
[
"org.apache.wicket.markup.ComponentTag"
] |
import org.apache.wicket.markup.ComponentTag;
|
import org.apache.wicket.markup.*;
|
[
"org.apache.wicket"
] |
org.apache.wicket;
| 889,477 |
ActorRef<? extends Message> ref = null;
try {
ref = new ActorRefImpl(this, mode, name);
} catch (RemoteException e) {
e.printStackTrace();
}
return ref;
}
/**
* Stops all the actors of the system, clear the container (map) and shutdown
* executor service instance {@code eService}
|
ActorRef<? extends Message> ref = null; try { ref = new ActorRefImpl(this, mode, name); } catch (RemoteException e) { e.printStackTrace(); } return ref; } /** * Stops all the actors of the system, clear the container (map) and shutdown * executor service instance {@code eService}
|
/**
* Create an instance of {@link ActorRef}
*
* @param mode Possible mode to create an actor. Could be{@code LOCAL} or
* {@code REMOTE}.
* @return An instance to {@link ActorRef}
*/
|
Create an instance of <code>ActorRef</code>
|
createActorReference
|
{
"repo_name": "codepr/jas",
"path": "src/main/java/io/github/codepr/jas/actors/ActorSystemImpl.java",
"license": "mit",
"size": 3277
}
|
[
"io.github.codepr.jas.actors.ActorRef",
"java.rmi.RemoteException"
] |
import io.github.codepr.jas.actors.ActorRef; import java.rmi.RemoteException;
|
import io.github.codepr.jas.actors.*; import java.rmi.*;
|
[
"io.github.codepr",
"java.rmi"
] |
io.github.codepr; java.rmi;
| 2,429,361 |
public void testNextOnly() throws Exception {
String encoding = null;
File testFile = new File(getTestDirectory(), "LineIterator-nextOnly.txt");
List<String> lines = createLinesFile(testFile, encoding, 3);
LineIterator iterator = FileUtils.lineIterator(testFile, encoding);
try {
for (int i = 0; i < lines.size(); i++) {
String line = iterator.next();
assertEquals("next() line " + i, lines.get(i), line);
}
assertEquals("No more expected", false, iterator.hasNext());
} finally {
LineIterator.closeQuietly(iterator);
}
}
|
void function() throws Exception { String encoding = null; File testFile = new File(getTestDirectory(), STR); List<String> lines = createLinesFile(testFile, encoding, 3); LineIterator iterator = FileUtils.lineIterator(testFile, encoding); try { for (int i = 0; i < lines.size(); i++) { String line = iterator.next(); assertEquals(STR + i, lines.get(i), line); } assertEquals(STR, false, iterator.hasNext()); } finally { LineIterator.closeQuietly(iterator); } }
|
/**
* Test the iterator using only the next() method.
*/
|
Test the iterator using only the next() method
|
testNextOnly
|
{
"repo_name": "sebastiansemmle/acio",
"path": "src/test/java/org/apache/commons/io/LineIteratorTestCase.java",
"license": "apache-2.0",
"size": 14612
}
|
[
"java.io.File",
"java.util.List"
] |
import java.io.File; import java.util.List;
|
import java.io.*; import java.util.*;
|
[
"java.io",
"java.util"
] |
java.io; java.util;
| 962,704 |
private double getCount(final Object gemNr, final String gu, final GerinneGeschlFlaechenReportDialog.Art art) {
final List<GmdPartObjGeschl> gemList = gemPartMap.get(gemNr);
int count = 0;
for (final GmdPartObjGeschl tmp : gemList) {
if (tmp.getOwner().equals(gu) && tmp.getArt().equals(art.name())) {
++count;
}
}
return count;
}
|
double function(final Object gemNr, final String gu, final GerinneGeschlFlaechenReportDialog.Art art) { final List<GmdPartObjGeschl> gemList = gemPartMap.get(gemNr); int count = 0; for (final GmdPartObjGeschl tmp : gemList) { if (tmp.getOwner().equals(gu) && tmp.getArt().equals(art.name())) { ++count; } } return count; }
|
/**
* DOCUMENT ME!
*
* @param gemNr DOCUMENT ME!
* @param gu gew DOCUMENT ME!
* @param art DOCUMENT ME!
*
* @return DOCUMENT ME!
*/
|
DOCUMENT ME
|
getCount
|
{
"repo_name": "cismet/watergis-client",
"path": "src/main/java/de/cismet/watergis/reports/GerinneGFlReport.java",
"license": "lgpl-3.0",
"size": 159735
}
|
[
"de.cismet.watergis.gui.dialog.GerinneGeschlFlaechenReportDialog",
"de.cismet.watergis.reports.types.GmdPartObjGeschl",
"java.util.List"
] |
import de.cismet.watergis.gui.dialog.GerinneGeschlFlaechenReportDialog; import de.cismet.watergis.reports.types.GmdPartObjGeschl; import java.util.List;
|
import de.cismet.watergis.gui.dialog.*; import de.cismet.watergis.reports.types.*; import java.util.*;
|
[
"de.cismet.watergis",
"java.util"
] |
de.cismet.watergis; java.util;
| 489,829 |
public void testConstructor() throws Exception {
String home = System.getProperty("user.home");
assertEquals(new File(home), converter.convert(File.class, home));
// assertEquals(new Version(1, 0, 0), converter.convert(Version.class,
// "1.0.0"));
}
|
void function() throws Exception { String home = System.getProperty(STR); assertEquals(new File(home), converter.convert(File.class, home)); }
|
/**
* Test constructor
*
* @throws Exception
*/
|
Test constructor
|
testConstructor
|
{
"repo_name": "psoreide/bnd",
"path": "aQute.libg/test/aQute/lib/converter/ConverterTest.java",
"license": "apache-2.0",
"size": 16914
}
|
[
"java.io.File"
] |
import java.io.File;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 1,705,181 |
public void cleanUp() throws SubversionException {
if (sshScript != null) {
try {
sshScript.delete();
} catch (ServerException e) {
throw new SubversionException(e);
}
}
}
|
void function() throws SubversionException { if (sshScript != null) { try { sshScript.delete(); } catch (ServerException e) { throw new SubversionException(e); } } }
|
/**
* Cleanups ssh environment.
*/
|
Cleanups ssh environment
|
cleanUp
|
{
"repo_name": "bartlomiej-laczkowski/che",
"path": "plugins/plugin-svn/che-plugin-svn-ext-server/src/main/java/org/eclipse/che/plugin/svn/server/utils/SshEnvironment.java",
"license": "epl-1.0",
"size": 2189
}
|
[
"org.eclipse.che.api.core.ServerException",
"org.eclipse.che.plugin.svn.server.SubversionException"
] |
import org.eclipse.che.api.core.ServerException; import org.eclipse.che.plugin.svn.server.SubversionException;
|
import org.eclipse.che.api.core.*; import org.eclipse.che.plugin.svn.server.*;
|
[
"org.eclipse.che"
] |
org.eclipse.che;
| 2,377,785 |
public static Object lookupMandatoryBean(Exchange exchange, String name) throws NoSuchBeanException {
Object value = lookupBean(exchange, name);
if (value == null) {
throw new NoSuchBeanException(name);
}
return value;
}
|
static Object function(Exchange exchange, String name) throws NoSuchBeanException { Object value = lookupBean(exchange, name); if (value == null) { throw new NoSuchBeanException(name); } return value; }
|
/**
* Performs a lookup in the registry of the mandatory bean name and throws an exception if it could not be found
*
* @param exchange the exchange
* @param name the bean name
* @return the bean
* @throws NoSuchBeanException if no bean could be found in the registry
*/
|
Performs a lookup in the registry of the mandatory bean name and throws an exception if it could not be found
|
lookupMandatoryBean
|
{
"repo_name": "FingolfinTEK/camel",
"path": "camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java",
"license": "apache-2.0",
"size": 37051
}
|
[
"org.apache.camel.Exchange",
"org.apache.camel.NoSuchBeanException"
] |
import org.apache.camel.Exchange; import org.apache.camel.NoSuchBeanException;
|
import org.apache.camel.*;
|
[
"org.apache.camel"
] |
org.apache.camel;
| 2,700,958 |
log.debug("entering process with caseReceipt {}", caseReceipt);
UUID caseId = UUID.fromString(caseReceipt.getCaseId());
InboundChannel inboundChannel = caseReceipt.getInboundChannel();
Timestamp responseTimestamp = new Timestamp(caseReceipt.getResponseDateTime().toGregorianCalendar()
.getTimeInMillis());
Case existingCase = caseService.findCaseById(caseId);
log.debug("existingCase is {}", existingCase);
CategoryDTO.CategoryName category = null;
switch (inboundChannel) {
case OFFLINE:
category = OFFLINE_RESPONSE_PROCESSED;
break;
case ONLINE:
category = ONLINE_QUESTIONNAIRE_RESPONSE;
break;
case PAPER:
category = PAPER_QUESTIONNAIRE_RESPONSE;
break;
default:
break;
}
if (existingCase == null) {
log.error(String.format(EXISTING_CASE_NOT_FOUND, caseId));
} else {
CaseEvent caseEvent = new CaseEvent();
caseEvent.setCaseFK(existingCase.getCasePK());
caseEvent.setCategory(category);
log.info("" + caseEvent.getCategory());
caseEvent.setCreatedBy(SYSTEM);
caseEvent.setDescription(QUESTIONNAIRE_RESPONSE);
log.debug("about to invoke the event creation...");
caseService.createCaseEvent(caseEvent, null, responseTimestamp);
}
}
|
log.debug(STR, caseReceipt); UUID caseId = UUID.fromString(caseReceipt.getCaseId()); InboundChannel inboundChannel = caseReceipt.getInboundChannel(); Timestamp responseTimestamp = new Timestamp(caseReceipt.getResponseDateTime().toGregorianCalendar() .getTimeInMillis()); Case existingCase = caseService.findCaseById(caseId); log.debug(STR, existingCase); CategoryDTO.CategoryName category = null; switch (inboundChannel) { case OFFLINE: category = OFFLINE_RESPONSE_PROCESSED; break; case ONLINE: category = ONLINE_QUESTIONNAIRE_RESPONSE; break; case PAPER: category = PAPER_QUESTIONNAIRE_RESPONSE; break; default: break; } if (existingCase == null) { log.error(String.format(EXISTING_CASE_NOT_FOUND, caseId)); } else { CaseEvent caseEvent = new CaseEvent(); caseEvent.setCaseFK(existingCase.getCasePK()); caseEvent.setCategory(category); log.info(STRabout to invoke the event creation..."); caseService.createCaseEvent(caseEvent, null, responseTimestamp); } }
|
/**
* To process CaseReceipts read from queue
*
* @param caseReceipt to process
* @throws CTPException CTPException
*/
|
To process CaseReceipts read from queue
|
process
|
{
"repo_name": "pilif42/rm-case-service",
"path": "src/main/java/uk/gov/ons/ctp/response/casesvc/message/impl/CaseReceiptReceiverImpl.java",
"license": "mit",
"size": 3512
}
|
[
"java.sql.Timestamp",
"java.util.UUID",
"uk.gov.ons.ctp.response.casesvc.domain.model.Case",
"uk.gov.ons.ctp.response.casesvc.domain.model.CaseEvent",
"uk.gov.ons.ctp.response.casesvc.message.feedback.InboundChannel",
"uk.gov.ons.ctp.response.casesvc.representation.CategoryDTO"
] |
import java.sql.Timestamp; import java.util.UUID; import uk.gov.ons.ctp.response.casesvc.domain.model.Case; import uk.gov.ons.ctp.response.casesvc.domain.model.CaseEvent; import uk.gov.ons.ctp.response.casesvc.message.feedback.InboundChannel; import uk.gov.ons.ctp.response.casesvc.representation.CategoryDTO;
|
import java.sql.*; import java.util.*; import uk.gov.ons.ctp.response.casesvc.domain.model.*; import uk.gov.ons.ctp.response.casesvc.message.feedback.*; import uk.gov.ons.ctp.response.casesvc.representation.*;
|
[
"java.sql",
"java.util",
"uk.gov.ons"
] |
java.sql; java.util; uk.gov.ons;
| 359,490 |
Observable<List<Genre>> genres();
|
Observable<List<Genre>> genres();
|
/**
* Get an {@link rx.Observable} which will emit a List of {@link Genre}.
*/
|
Get an <code>rx.Observable</code> which will emit a List of <code>Genre</code>
|
genres
|
{
"repo_name": "orcchg/RxMusic",
"path": "app/src/main/java/com/orcchg/dev/maxa/rxmusic/domain/repository/music/GenreRepository.java",
"license": "apache-2.0",
"size": 638
}
|
[
"com.orcchg.dev.maxa.rxmusic.domain.model.music.Genre",
"java.util.List"
] |
import com.orcchg.dev.maxa.rxmusic.domain.model.music.Genre; import java.util.List;
|
import com.orcchg.dev.maxa.rxmusic.domain.model.music.*; import java.util.*;
|
[
"com.orcchg.dev",
"java.util"
] |
com.orcchg.dev; java.util;
| 396,576 |
public ExecutionType getExecutionType() {
return this.executionType;
}
|
ExecutionType function() { return this.executionType; }
|
/**
* Missing description at method getExecutionType.
*
* @return the ExecutionType.
*/
|
Missing description at method getExecutionType
|
getExecutionType
|
{
"repo_name": "NABUCCO/org.nabucco.testautomation.config",
"path": "org.nabucco.testautomation.config.facade.datatype/src/main/gen/org/nabucco/testautomation/config/facade/datatype/TestConfigElement.java",
"license": "epl-1.0",
"size": 34185
}
|
[
"org.nabucco.testautomation.result.facade.datatype.ExecutionType"
] |
import org.nabucco.testautomation.result.facade.datatype.ExecutionType;
|
import org.nabucco.testautomation.result.facade.datatype.*;
|
[
"org.nabucco.testautomation"
] |
org.nabucco.testautomation;
| 2,325,041 |
@Test
public void testpathComputationCase10() {
Link link1 = addLink(DEVICE1, 10, DEVICE2, 20, true, 50);
Link link2 = addLink(DEVICE2, 30, DEVICE4, 40, true, 20);
Link link3 = addLink(DEVICE1, 80, DEVICE3, 70, true, 100);
Link link4 = addLink(DEVICE3, 60, DEVICE4, 50, true, 80);
CapabilityConstraint capabilityConst = CapabilityConstraint
.of(CapabilityConstraint.CapabilityType.WITHOUT_SIGNALLING_AND_WITHOUT_SR);
List<Constraint> constraints = new LinkedList<>();
constraints.add(capabilityConst);
CostConstraint costConst = CostConstraint.of(COST);
constraints.add(costConst);
TeLinkConfig teLinkConfig = netConfigRegistry.addConfig(LinkKey.linkKey(link1), TeLinkConfig.class);
teLinkConfig.igpCost(50)
.apply();
TeLinkConfig teLinkConfig2 = netConfigRegistry.addConfig(LinkKey.linkKey(link2), TeLinkConfig.class);
teLinkConfig2.igpCost(20)
.apply();
TeLinkConfig teLinkConfig3 = netConfigRegistry.addConfig(LinkKey.linkKey(link3), TeLinkConfig.class);
teLinkConfig3.igpCost(100)
.apply();
TeLinkConfig teLinkConfig4 = netConfigRegistry.addConfig(LinkKey.linkKey(link4), TeLinkConfig.class);
teLinkConfig4.igpCost(80)
.apply();
//Device1
DefaultAnnotations.Builder builder = DefaultAnnotations.builder();
builder.set(AnnotationKeys.TYPE, L3);
builder.set(LSRID, "1.1.1.1");
addDevice(DEVICE1, builder);
DeviceCapability device1Cap = netConfigRegistry.addConfig(DeviceId.deviceId("1.1.1.1"), DeviceCapability.class);
device1Cap.setLabelStackCap(false)
.setLocalLabelCap(true)
.setSrCap(false)
.apply();
//Device2
builder = DefaultAnnotations.builder();
builder.set(AnnotationKeys.TYPE, L3);
builder.set(LSRID, "2.2.2.2");
addDevice(DEVICE2, builder);
DeviceCapability device2Cap = netConfigRegistry.addConfig(DeviceId.deviceId("2.2.2.2"), DeviceCapability.class);
device2Cap.setLabelStackCap(false)
.setLocalLabelCap(true)
.setSrCap(false)
.apply();
//Device3
builder = DefaultAnnotations.builder();
builder.set(AnnotationKeys.TYPE, L3);
builder.set(LSRID, "3.3.3.3");
addDevice(DEVICE3, builder);
DeviceCapability device3Cap = netConfigRegistry.addConfig(DeviceId.deviceId("3.3.3.3"), DeviceCapability.class);
device3Cap.setLabelStackCap(false)
.setLocalLabelCap(true)
.setSrCap(false)
.apply();
//Device4
builder = DefaultAnnotations.builder();
builder.set(AnnotationKeys.TYPE, L3);
builder.set(LSRID, "4.4.4.4");
addDevice(DEVICE4, builder);
DeviceCapability device4Cap = netConfigRegistry.addConfig(DeviceId.deviceId("4.4.4.4"), DeviceCapability.class);
device4Cap.setLabelStackCap(false)
.setLocalLabelCap(true)
.setSrCap(false)
.apply();
Set<Path> paths = computePath(link1, link2, link3, link4, constraints);
List<Link> links = new LinkedList<>();
links.add(link1);
links.add(link2);
assertThat(paths.iterator().next().links(), is(links));
assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(70.0)));
}
|
void function() { Link link1 = addLink(DEVICE1, 10, DEVICE2, 20, true, 50); Link link2 = addLink(DEVICE2, 30, DEVICE4, 40, true, 20); Link link3 = addLink(DEVICE1, 80, DEVICE3, 70, true, 100); Link link4 = addLink(DEVICE3, 60, DEVICE4, 50, true, 80); CapabilityConstraint capabilityConst = CapabilityConstraint .of(CapabilityConstraint.CapabilityType.WITHOUT_SIGNALLING_AND_WITHOUT_SR); List<Constraint> constraints = new LinkedList<>(); constraints.add(capabilityConst); CostConstraint costConst = CostConstraint.of(COST); constraints.add(costConst); TeLinkConfig teLinkConfig = netConfigRegistry.addConfig(LinkKey.linkKey(link1), TeLinkConfig.class); teLinkConfig.igpCost(50) .apply(); TeLinkConfig teLinkConfig2 = netConfigRegistry.addConfig(LinkKey.linkKey(link2), TeLinkConfig.class); teLinkConfig2.igpCost(20) .apply(); TeLinkConfig teLinkConfig3 = netConfigRegistry.addConfig(LinkKey.linkKey(link3), TeLinkConfig.class); teLinkConfig3.igpCost(100) .apply(); TeLinkConfig teLinkConfig4 = netConfigRegistry.addConfig(LinkKey.linkKey(link4), TeLinkConfig.class); teLinkConfig4.igpCost(80) .apply(); DefaultAnnotations.Builder builder = DefaultAnnotations.builder(); builder.set(AnnotationKeys.TYPE, L3); builder.set(LSRID, STR); addDevice(DEVICE1, builder); DeviceCapability device1Cap = netConfigRegistry.addConfig(DeviceId.deviceId(STR), DeviceCapability.class); device1Cap.setLabelStackCap(false) .setLocalLabelCap(true) .setSrCap(false) .apply(); builder = DefaultAnnotations.builder(); builder.set(AnnotationKeys.TYPE, L3); builder.set(LSRID, STR); addDevice(DEVICE2, builder); DeviceCapability device2Cap = netConfigRegistry.addConfig(DeviceId.deviceId(STR), DeviceCapability.class); device2Cap.setLabelStackCap(false) .setLocalLabelCap(true) .setSrCap(false) .apply(); builder = DefaultAnnotations.builder(); builder.set(AnnotationKeys.TYPE, L3); builder.set(LSRID, STR); addDevice(DEVICE3, builder); DeviceCapability device3Cap = netConfigRegistry.addConfig(DeviceId.deviceId(STR), DeviceCapability.class); device3Cap.setLabelStackCap(false) .setLocalLabelCap(true) .setSrCap(false) .apply(); builder = DefaultAnnotations.builder(); builder.set(AnnotationKeys.TYPE, L3); builder.set(LSRID, STR); addDevice(DEVICE4, builder); DeviceCapability device4Cap = netConfigRegistry.addConfig(DeviceId.deviceId(STR), DeviceCapability.class); device4Cap.setLabelStackCap(false) .setLocalLabelCap(true) .setSrCap(false) .apply(); Set<Path> paths = computePath(link1, link2, link3, link4, constraints); List<Link> links = new LinkedList<>(); links.add(link1); links.add(link2); assertThat(paths.iterator().next().links(), is(links)); assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(70.0))); }
|
/**
* Devices supporting CR capability.
*/
|
Devices supporting CR capability
|
testpathComputationCase10
|
{
"repo_name": "kuujo/onos",
"path": "apps/pce/app/src/test/java/org/onosproject/pce/pceservice/PathComputationTest.java",
"license": "apache-2.0",
"size": 58187
}
|
[
"com.google.common.collect.ImmutableSet",
"java.util.LinkedList",
"java.util.List",
"java.util.Set",
"org.hamcrest.MatcherAssert",
"org.hamcrest.core.Is",
"org.onlab.graph.ScalarWeight",
"org.onosproject.net.AnnotationKeys",
"org.onosproject.net.DefaultAnnotations",
"org.onosproject.net.DeviceId",
"org.onosproject.net.Link",
"org.onosproject.net.LinkKey",
"org.onosproject.net.Path",
"org.onosproject.net.intent.Constraint",
"org.onosproject.pce.pceservice.constraint.CapabilityConstraint",
"org.onosproject.pce.pceservice.constraint.CostConstraint",
"org.onosproject.pcep.api.DeviceCapability",
"org.onosproject.pcep.api.TeLinkConfig"
] |
import com.google.common.collect.ImmutableSet; import java.util.LinkedList; import java.util.List; import java.util.Set; import org.hamcrest.MatcherAssert; import org.hamcrest.core.Is; import org.onlab.graph.ScalarWeight; import org.onosproject.net.AnnotationKeys; import org.onosproject.net.DefaultAnnotations; import org.onosproject.net.DeviceId; import org.onosproject.net.Link; import org.onosproject.net.LinkKey; import org.onosproject.net.Path; import org.onosproject.net.intent.Constraint; import org.onosproject.pce.pceservice.constraint.CapabilityConstraint; import org.onosproject.pce.pceservice.constraint.CostConstraint; import org.onosproject.pcep.api.DeviceCapability; import org.onosproject.pcep.api.TeLinkConfig;
|
import com.google.common.collect.*; import java.util.*; import org.hamcrest.*; import org.hamcrest.core.*; import org.onlab.graph.*; import org.onosproject.net.*; import org.onosproject.net.intent.*; import org.onosproject.pce.pceservice.constraint.*; import org.onosproject.pcep.api.*;
|
[
"com.google.common",
"java.util",
"org.hamcrest",
"org.hamcrest.core",
"org.onlab.graph",
"org.onosproject.net",
"org.onosproject.pce",
"org.onosproject.pcep"
] |
com.google.common; java.util; org.hamcrest; org.hamcrest.core; org.onlab.graph; org.onosproject.net; org.onosproject.pce; org.onosproject.pcep;
| 318,632 |
public QueryEntity setFieldsScale(Map<String, Integer> fieldsScale) {
this.fieldsScale = fieldsScale;
return this;
}
|
QueryEntity function(Map<String, Integer> fieldsScale) { this.fieldsScale = fieldsScale; return this; }
|
/**
* Sets fieldsScale map for a fields.
*
* @param fieldsScale Scale map for a fields.
* @return {@code This} for chaining.
*/
|
Sets fieldsScale map for a fields
|
setFieldsScale
|
{
"repo_name": "andrey-kuznetsov/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java",
"license": "apache-2.0",
"size": 31017
}
|
[
"java.util.Map"
] |
import java.util.Map;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,851,609 |
public ArrayList<String> getTokenisedNameSetFor( String projectName,
Species species,
Integer count,
Integer minimumLength );
|
ArrayList<String> function( String projectName, Species species, Integer count, Integer minimumLength );
|
/**
* Retrieves a list of a specified number of tokenised names of a given
* species declared in a particular project. The minimum length of each
* name can be specified.
* @param projectName a string consisting of the project name, a space
* and the project version
* @param species a species of name
* @param count the maximum number of names to return. If there are fewer
* names meeting the criteria all those names are returned. Where there are
* more names than requested the list will contain a random selection of
* {@code count} names is that meet the other criteria.
* @param minimumLength the minimum length in characters of names returned.
* A value of zero (0) is interpreted as meaning any length.
* @return a list of tokenised names, with a space between each
* alphanumeric token
*/
|
Retrieves a list of a specified number of tokenised names of a given species declared in a particular project. The minimum length of each name can be specified
|
getTokenisedNameSetFor
|
{
"repo_name": "sjbutler/jimdb",
"path": "src/uk/ac/open/crc/jimdb/DatabaseReader.java",
"license": "apache-2.0",
"size": 11423
}
|
[
"java.util.ArrayList",
"uk.ac.open.crc.idtk.Species"
] |
import java.util.ArrayList; import uk.ac.open.crc.idtk.Species;
|
import java.util.*; import uk.ac.open.crc.idtk.*;
|
[
"java.util",
"uk.ac.open"
] |
java.util; uk.ac.open;
| 917,499 |
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
java.awt.GridBagConstraints gridBagConstraints;
javax.swing.ButtonGroup buttonGroup = new javax.swing.ButtonGroup();
javax.swing.JPanel waypointSettings = new javax.swing.JPanel();
allButton = new javax.swing.JRadioButton();
mostRecentButton = new javax.swing.JRadioButton();
showWaypointsWOTSCheckBox = new javax.swing.JCheckBox();
daysSpinner = new javax.swing.JSpinner(numberModel);
daysLabel = new javax.swing.JLabel();
showLabel = new javax.swing.JLabel();
javax.swing.JPanel buttonPanel = new javax.swing.JPanel();
applyButton = new javax.swing.JButton();
javax.swing.JLabel optionsLabel = new javax.swing.JLabel();
dsCBPanel = new CheckBoxListPanel<DataSource>();
atCBPanel = new CheckBoxListPanel<ARTIFACT_TYPE>();
setMinimumSize(new java.awt.Dimension(10, 700));
setPreferredSize(new java.awt.Dimension(300, 700));
setLayout(new java.awt.GridBagLayout());
waypointSettings.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(GeoFilterPanel.class, "GeoFilterPanel.waypointSettings.border.title"))); // NOI18N
waypointSettings.setLayout(new java.awt.GridBagLayout());
|
@SuppressWarnings(STR) void function() { java.awt.GridBagConstraints gridBagConstraints; javax.swing.ButtonGroup buttonGroup = new javax.swing.ButtonGroup(); javax.swing.JPanel waypointSettings = new javax.swing.JPanel(); allButton = new javax.swing.JRadioButton(); mostRecentButton = new javax.swing.JRadioButton(); showWaypointsWOTSCheckBox = new javax.swing.JCheckBox(); daysSpinner = new javax.swing.JSpinner(numberModel); daysLabel = new javax.swing.JLabel(); showLabel = new javax.swing.JLabel(); javax.swing.JPanel buttonPanel = new javax.swing.JPanel(); applyButton = new javax.swing.JButton(); javax.swing.JLabel optionsLabel = new javax.swing.JLabel(); dsCBPanel = new CheckBoxListPanel<DataSource>(); atCBPanel = new CheckBoxListPanel<ARTIFACT_TYPE>(); setMinimumSize(new java.awt.Dimension(10, 700)); setPreferredSize(new java.awt.Dimension(300, 700)); setLayout(new java.awt.GridBagLayout()); waypointSettings.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(GeoFilterPanel.class, STR))); waypointSettings.setLayout(new java.awt.GridBagLayout());
|
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
|
This method is called from within the constructor to initialize the form. regenerated by the Form Editor
|
initComponents
|
{
"repo_name": "sleuthkit/autopsy",
"path": "Core/src/org/sleuthkit/autopsy/geolocation/GeoFilterPanel.java",
"license": "apache-2.0",
"size": 25825
}
|
[
"org.sleuthkit.autopsy.guiutils.CheckBoxListPanel",
"org.sleuthkit.datamodel.DataSource"
] |
import org.sleuthkit.autopsy.guiutils.CheckBoxListPanel; import org.sleuthkit.datamodel.DataSource;
|
import org.sleuthkit.autopsy.guiutils.*; import org.sleuthkit.datamodel.*;
|
[
"org.sleuthkit.autopsy",
"org.sleuthkit.datamodel"
] |
org.sleuthkit.autopsy; org.sleuthkit.datamodel;
| 739,584 |
public static List<OFPhysicalPort>
ofPhysicalPortListOf(Collection<ImmutablePort> ports) {
if (ports == null) {
throw new NullPointerException("Port list must not be null");
}
ArrayList<OFPhysicalPort> ofppList=
new ArrayList<OFPhysicalPort>(ports.size());
for (ImmutablePort p: ports) {
if (p == null)
throw new NullPointerException("Port must not be null");
ofppList.add(p.toOFPhysicalPort());
}
return ofppList;
}
|
static List<OFPhysicalPort> function(Collection<ImmutablePort> ports) { if (ports == null) { throw new NullPointerException(STR); } ArrayList<OFPhysicalPort> ofppList= new ArrayList<OFPhysicalPort>(ports.size()); for (ImmutablePort p: ports) { if (p == null) throw new NullPointerException(STR); ofppList.add(p.toOFPhysicalPort()); } return ofppList; }
|
/**
* Convert a Collection of ImmutablePort to a list of OFPhyscialPorts.
* All ImmutablePorts in the Collection must be non-null.
* No other checks (name / number uniqueness) are performed
* @param ports
* @return a list of {@link OFPhysicalPort}s. This is list is owned by
* the caller. The returned list is not thread-safe
* @throws NullPointerException if any {@link ImmutablePort} or the port
* list is null
* @throws IllegalArgumentException
*/
|
Convert a Collection of ImmutablePort to a list of OFPhyscialPorts. All ImmutablePorts in the Collection must be non-null. No other checks (name / number uniqueness) are performed
|
ofPhysicalPortListOf
|
{
"repo_name": "xuraylei/floodlight_with_topoguard",
"path": "src/main/java/net/floodlightcontroller/core/ImmutablePort.java",
"license": "apache-2.0",
"size": 22076
}
|
[
"java.util.ArrayList",
"java.util.Collection",
"java.util.List",
"org.openflow.protocol.OFPhysicalPort"
] |
import java.util.ArrayList; import java.util.Collection; import java.util.List; import org.openflow.protocol.OFPhysicalPort;
|
import java.util.*; import org.openflow.protocol.*;
|
[
"java.util",
"org.openflow.protocol"
] |
java.util; org.openflow.protocol;
| 1,396,948 |
private DataWriter create(long blockSize, long workerCapacity) throws Exception {
mBuffer = ByteBuffer.allocate((int) workerCapacity);
mLocalWriter = new FixedCapacityTestDataWriter(mBuffer);
DataWriter writer =
new UfsFallbackLocalFileDataWriter(mLocalWriter, null, mContext, mAddress, BLOCK_ID,
blockSize, OutStreamOptions.defaults(mClientContext).setMountId(MOUNT_ID));
return writer;
}
|
DataWriter function(long blockSize, long workerCapacity) throws Exception { mBuffer = ByteBuffer.allocate((int) workerCapacity); mLocalWriter = new FixedCapacityTestDataWriter(mBuffer); DataWriter writer = new UfsFallbackLocalFileDataWriter(mLocalWriter, null, mContext, mAddress, BLOCK_ID, blockSize, OutStreamOptions.defaults(mClientContext).setMountId(MOUNT_ID)); return writer; }
|
/**
* Creates a {@link DataWriter}.
*
* @param blockSize the block length
* @param workerCapacity the capacity of the local worker
* @return the data writer instance
*/
|
Creates a <code>DataWriter</code>
|
create
|
{
"repo_name": "bf8086/alluxio",
"path": "core/client/fs/src/test/java/alluxio/client/block/stream/UfsFallbackLocalFileDataWriterTest.java",
"license": "apache-2.0",
"size": 15381
}
|
[
"java.nio.ByteBuffer"
] |
import java.nio.ByteBuffer;
|
import java.nio.*;
|
[
"java.nio"
] |
java.nio;
| 1,197,148 |
if (cls == null)
throw IIOPLogger.ROOT_LOGGER.cannotAnalyzeNullClass();
if (cls == Void.TYPE)
return voidAnalysis;
if (cls == Boolean.TYPE)
return booleanAnalysis;
if (cls == Character.TYPE)
return charAnalysis;
if (cls == Byte.TYPE)
return byteAnalysis;
if (cls == Short.TYPE)
return shortAnalysis;
if (cls == Integer.TYPE)
return intAnalysis;
if (cls == Long.TYPE)
return longAnalysis;
if (cls == Float.TYPE)
return floatAnalysis;
if (cls == Double.TYPE)
return doubleAnalysis;
throw IIOPLogger.ROOT_LOGGER.notAPrimitive(cls.getName());
}
|
if (cls == null) throw IIOPLogger.ROOT_LOGGER.cannotAnalyzeNullClass(); if (cls == Void.TYPE) return voidAnalysis; if (cls == Boolean.TYPE) return booleanAnalysis; if (cls == Character.TYPE) return charAnalysis; if (cls == Byte.TYPE) return byteAnalysis; if (cls == Short.TYPE) return shortAnalysis; if (cls == Integer.TYPE) return intAnalysis; if (cls == Long.TYPE) return longAnalysis; if (cls == Float.TYPE) return floatAnalysis; if (cls == Double.TYPE) return doubleAnalysis; throw IIOPLogger.ROOT_LOGGER.notAPrimitive(cls.getName()); }
|
/**
* Get a singleton instance representing one of the primitive types.
*/
|
Get a singleton instance representing one of the primitive types
|
getPrimitiveAnalysis
|
{
"repo_name": "xasx/wildfly",
"path": "iiop-openjdk/src/main/java/org/wildfly/iiop/openjdk/rmi/PrimitiveAnalysis.java",
"license": "lgpl-2.1",
"size": 3483
}
|
[
"org.wildfly.iiop.openjdk.logging.IIOPLogger"
] |
import org.wildfly.iiop.openjdk.logging.IIOPLogger;
|
import org.wildfly.iiop.openjdk.logging.*;
|
[
"org.wildfly.iiop"
] |
org.wildfly.iiop;
| 2,175,277 |
EAttribute getClassRule_PackageName();
|
EAttribute getClassRule_PackageName();
|
/**
* Returns the meta object for the attribute '{@link nexcore.tool.mda.model.developer.reverseTransformation.ClassRule#getPackageName <em>Package Name</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Package Name</em>'.
* @see nexcore.tool.mda.model.developer.reverseTransformation.ClassRule#getPackageName()
* @see #getClassRule()
* @generated
*/
|
Returns the meta object for the attribute '<code>nexcore.tool.mda.model.developer.reverseTransformation.ClassRule#getPackageName Package Name</code>'.
|
getClassRule_PackageName
|
{
"repo_name": "SK-HOLDINGS-CC/NEXCORE-UML-Modeler",
"path": "nexcore.tool.mda.model/src/java/nexcore/tool/mda/model/developer/reverseTransformation/ReverseTransformationPackage.java",
"license": "epl-1.0",
"size": 46728
}
|
[
"org.eclipse.emf.ecore.EAttribute"
] |
import org.eclipse.emf.ecore.EAttribute;
|
import org.eclipse.emf.ecore.*;
|
[
"org.eclipse.emf"
] |
org.eclipse.emf;
| 1,726,357 |
@ChaiProviderImplementor.LdapOperation
@ChaiProviderImplementor.SearchOperation
Map<String, Map<String,String>> search(String baseDN, SearchHelper searchHelper)
throws ChaiOperationException, ChaiUnavailableException, IllegalStateException;
|
@ChaiProviderImplementor.LdapOperation @ChaiProviderImplementor.SearchOperation Map<String, Map<String,String>> search(String baseDN, SearchHelper searchHelper) throws ChaiOperationException, ChaiUnavailableException, IllegalStateException;
|
/**
* Performs a search against the directory for the objects, given the specified basedn and {@link SearchHelper}.
* A subtree search is implied. Attribute values are returned according to the attributes specifed in
* the {@code SearchHelper}.
*
* @param baseDN A valid object DN for the top of the search, or an empty string if the whole ldap namespace is to be searched
* @param searchHelper A Chai searchHelper
* @return A Map containing strings of entryDNs as keys, and values of Properties objects. Within each properties object the key
* is a specified attribute name and its associated value.
* @throws ChaiOperationException If an error is encountered during the operation
* @throws ChaiUnavailableException If no directory servers are reachable
* @throws IllegalStateException If the underlying connection is not in an available state
* @see com.novell.ldapchai.ChaiEntry#search(String)
*/
|
Performs a search against the directory for the objects, given the specified basedn and <code>SearchHelper</code>. A subtree search is implied. Attribute values are returned according to the attributes specifed in the SearchHelper
|
search
|
{
"repo_name": "sammonsjl/ldapchai-opendj",
"path": "src/com/novell/ldapchai/provider/ChaiProvider.java",
"license": "lgpl-2.1",
"size": 25721
}
|
[
"com.novell.ldapchai.exception.ChaiOperationException",
"com.novell.ldapchai.exception.ChaiUnavailableException",
"com.novell.ldapchai.util.SearchHelper",
"java.util.Map"
] |
import com.novell.ldapchai.exception.ChaiOperationException; import com.novell.ldapchai.exception.ChaiUnavailableException; import com.novell.ldapchai.util.SearchHelper; import java.util.Map;
|
import com.novell.ldapchai.exception.*; import com.novell.ldapchai.util.*; import java.util.*;
|
[
"com.novell.ldapchai",
"java.util"
] |
com.novell.ldapchai; java.util;
| 753,223 |
public MulticastDefinition onPrepare(Processor onPrepare) {
this.onPrepareProcessor = onPrepare;
return this;
}
/**
* Uses the {@link Processor} when preparing the {@link org.apache.camel.Exchange} to be send. This can be used to
* deep-clone messages that should be send, or any custom logic needed before the exchange is send.
*
* @param onPrepare reference to the processor to lookup in the {@link org.apache.camel.spi.Registry}
|
MulticastDefinition function(Processor onPrepare) { this.onPrepareProcessor = onPrepare; return this; } /** * Uses the {@link Processor} when preparing the {@link org.apache.camel.Exchange} to be send. This can be used to * deep-clone messages that should be send, or any custom logic needed before the exchange is send. * * @param onPrepare reference to the processor to lookup in the {@link org.apache.camel.spi.Registry}
|
/**
* Uses the {@link Processor} when preparing the {@link org.apache.camel.Exchange} to be send. This can be used to
* deep-clone messages that should be send, or any custom logic needed before the exchange is send.
*
* @param onPrepare the processor
* @return the builder
*/
|
Uses the <code>Processor</code> when preparing the <code>org.apache.camel.Exchange</code> to be send. This can be used to deep-clone messages that should be send, or any custom logic needed before the exchange is send
|
onPrepare
|
{
"repo_name": "apache/camel",
"path": "core/camel-core-model/src/main/java/org/apache/camel/model/MulticastDefinition.java",
"license": "apache-2.0",
"size": 18523
}
|
[
"org.apache.camel.Processor"
] |
import org.apache.camel.Processor;
|
import org.apache.camel.*;
|
[
"org.apache.camel"
] |
org.apache.camel;
| 1,501,789 |
void flushCommits() throws IOException;
|
void flushCommits() throws IOException;
|
/**
* Executes all the buffered {@link Put} operations.
* <p>
* This method gets called once automatically for every {@link Put} or batch
* of {@link Put}s (when <code>put(List<Put>)</code> is used) when
* {@link #isAutoFlush} is {@code true}.
* @throws IOException if a remote or network exception occurs.
*/
|
Executes all the buffered <code>Put</code> operations. This method gets called once automatically for every <code>Put</code> or batch of <code>Put</code>s (when <code>put(List)</code> is used) when <code>#isAutoFlush</code> is true
|
flushCommits
|
{
"repo_name": "Shmuma/hbase",
"path": "src/main/java/org/apache/hadoop/hbase/client/HTableInterface.java",
"license": "apache-2.0",
"size": 12881
}
|
[
"java.io.IOException"
] |
import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 2,409,727 |
private String getLookupType(QName type)
{
String result = null;
if (ContentModel.TYPE_CONTENT.equals(type) == true)
{
result = CMIS_TYPE_DOCUMENT;
}
else
{
type = type.getPrefixedQName(namespaceService);
result = type.getPrefixString();
}
return result;
}
|
String function(QName type) { String result = null; if (ContentModel.TYPE_CONTENT.equals(type) == true) { result = CMIS_TYPE_DOCUMENT; } else { type = type.getPrefixedQName(namespaceService); result = type.getPrefixString(); } return result; }
|
/**
* Gets the lookup type string for the rendition configuration, either the prefix string for the Alfresco type
* or the cmis equivalent for cm:content. Note that non-sub types of content will not be looked up since
* we can't rendition non content nodes.
* @param type content type
* @return String lookup type string
*/
|
Gets the lookup type string for the rendition configuration, either the prefix string for the Alfresco type or the cmis equivalent for cm:content. Note that non-sub types of content will not be looked up since we can't rendition non content nodes
|
getLookupType
|
{
"repo_name": "loftuxab/community-edition-old",
"path": "modules/wcmquickstart/wcmquickstartmodule/source/java/org/alfresco/module/org_alfresco_module_wcmquickstart/rendition/RenditionHelper.java",
"license": "lgpl-3.0",
"size": 15020
}
|
[
"org.alfresco.model.ContentModel",
"org.alfresco.service.namespace.QName"
] |
import org.alfresco.model.ContentModel; import org.alfresco.service.namespace.QName;
|
import org.alfresco.model.*; import org.alfresco.service.namespace.*;
|
[
"org.alfresco.model",
"org.alfresco.service"
] |
org.alfresco.model; org.alfresco.service;
| 1,896,970 |
public void testEmbeddedPC()
throws Exception
{
addClassesToSchema(new Class[] {EmbeddedPCOwner.class, EmbeddedPC.class});
EntityManager em = emf.createEntityManager();
EntityTransaction tx = em.getTransaction();
RDBMSStoreManager databaseMgr = (RDBMSStoreManager)storeMgr;
Connection conn = null; ManagedConnection mconn = null;
try
{
tx.begin();
mconn = databaseMgr.getConnectionManager().getConnection(0); conn = (Connection) mconn.getConnection();
DatabaseMetaData dmd = conn.getMetaData();
// Map with embedded value taking default value column names
Set<String> columnNames = new HashSet<String>();
columnNames.add("ID"); // Id
columnNames.add("EMB_NAME"); // PC "name"
columnNames.add("EMB_VALUE"); // PC "value"
columnNames.add("PC_EMB_NAME"); // PC "name" (overridden)
columnNames.add("PC_EMB_VALUE"); // PC "value" (overridden)
RDBMSTestHelper.checkColumnsForTable(storeMgr, dmd, "JPA_PC_EMBEDDED_OWNER", columnNames);
}
catch (Exception e)
{
LOG.error("Exception thrown", e);
fail("Exception thrown : " + e.getMessage());
}
finally
{
if (conn != null)
{
mconn.close();
}
if (tx.isActive())
{
tx.rollback();
}
em.close();
}
}
|
void function() throws Exception { addClassesToSchema(new Class[] {EmbeddedPCOwner.class, EmbeddedPC.class}); EntityManager em = emf.createEntityManager(); EntityTransaction tx = em.getTransaction(); RDBMSStoreManager databaseMgr = (RDBMSStoreManager)storeMgr; Connection conn = null; ManagedConnection mconn = null; try { tx.begin(); mconn = databaseMgr.getConnectionManager().getConnection(0); conn = (Connection) mconn.getConnection(); DatabaseMetaData dmd = conn.getMetaData(); Set<String> columnNames = new HashSet<String>(); columnNames.add("ID"); columnNames.add(STR); columnNames.add(STR); columnNames.add(STR); columnNames.add(STR); RDBMSTestHelper.checkColumnsForTable(storeMgr, dmd, STR, columnNames); } catch (Exception e) { LOG.error(STR, e); fail(STR + e.getMessage()); } finally { if (conn != null) { mconn.close(); } if (tx.isActive()) { tx.rollback(); } em.close(); } }
|
/**
* Test for JPA embedded PC.
*/
|
Test for JPA embedded PC
|
testEmbeddedPC
|
{
"repo_name": "datanucleus/tests",
"path": "jakarta/rdbms/src/test/org/datanucleus/tests/SchemaTest.java",
"license": "apache-2.0",
"size": 30960
}
|
[
"jakarta.persistence.EntityManager",
"jakarta.persistence.EntityTransaction",
"java.sql.Connection",
"java.sql.DatabaseMetaData",
"java.util.HashSet",
"java.util.Set",
"org.datanucleus.samples.annotations.embedded.pc.EmbeddedPC",
"org.datanucleus.samples.annotations.embedded.pc.EmbeddedPCOwner",
"org.datanucleus.store.connection.ManagedConnection",
"org.datanucleus.store.rdbms.RDBMSStoreManager"
] |
import jakarta.persistence.EntityManager; import jakarta.persistence.EntityTransaction; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.util.HashSet; import java.util.Set; import org.datanucleus.samples.annotations.embedded.pc.EmbeddedPC; import org.datanucleus.samples.annotations.embedded.pc.EmbeddedPCOwner; import org.datanucleus.store.connection.ManagedConnection; import org.datanucleus.store.rdbms.RDBMSStoreManager;
|
import jakarta.persistence.*; import java.sql.*; import java.util.*; import org.datanucleus.samples.annotations.embedded.pc.*; import org.datanucleus.store.connection.*; import org.datanucleus.store.rdbms.*;
|
[
"jakarta.persistence",
"java.sql",
"java.util",
"org.datanucleus.samples",
"org.datanucleus.store"
] |
jakarta.persistence; java.sql; java.util; org.datanucleus.samples; org.datanucleus.store;
| 1,744,437 |
public CMISNodeInfoImpl createNodeInfo(AssociationRef assocRef)
{
return new CMISNodeInfoImpl(this, assocRef);
}
|
CMISNodeInfoImpl function(AssociationRef assocRef) { return new CMISNodeInfoImpl(this, assocRef); }
|
/**
* Creates an object info object.
*/
|
Creates an object info object
|
createNodeInfo
|
{
"repo_name": "loftuxab/alfresco-community-loftux",
"path": "projects/repository/source/java/org/alfresco/opencmis/CMISConnector.java",
"license": "lgpl-3.0",
"size": 153672
}
|
[
"org.alfresco.service.cmr.repository.AssociationRef"
] |
import org.alfresco.service.cmr.repository.AssociationRef;
|
import org.alfresco.service.cmr.repository.*;
|
[
"org.alfresco.service"
] |
org.alfresco.service;
| 599,249 |
public static JToolBar getToolbar( String toolbarName ) {
XMLUtils xmlUtils = new XMLUtils();
return (JToolBar) xmlUtils.loadFromXMLStream( CommonMethods.class
.getResourceAsStream( "/res/toolbars/" + toolbarName + ".xml" ) );
}
|
static JToolBar function( String toolbarName ) { XMLUtils xmlUtils = new XMLUtils(); return (JToolBar) xmlUtils.loadFromXMLStream( CommonMethods.class .getResourceAsStream( STR + toolbarName + ".xml" ) ); }
|
/**
* Return a specified JToolBar
*
* @param toolbarName
* name of the toolbar
* @return a ToolBar
*/
|
Return a specified JToolBar
|
getToolbar
|
{
"repo_name": "Rubbiroid/VVIDE",
"path": "src/vvide/utils/CommonMethods.java",
"license": "gpl-3.0",
"size": 7225
}
|
[
"javax.swing.JToolBar"
] |
import javax.swing.JToolBar;
|
import javax.swing.*;
|
[
"javax.swing"
] |
javax.swing;
| 500,390 |
Results validate( String key );
|
Results validate( String key );
|
/**
* Validate the JSON document store at the specified key.
*
* @param key the key or identifier for the document
* @return the validation results; or null if there is no JSON document for the given key
*/
|
Validate the JSON document store at the specified key
|
validate
|
{
"repo_name": "flownclouds/modeshape",
"path": "modeshape-schematic/src/main/java/org/infinispan/schematic/SchematicDb.java",
"license": "apache-2.0",
"size": 10119
}
|
[
"org.infinispan.schematic.SchemaLibrary"
] |
import org.infinispan.schematic.SchemaLibrary;
|
import org.infinispan.schematic.*;
|
[
"org.infinispan.schematic"
] |
org.infinispan.schematic;
| 1,260,813 |
public CastAs<ConstraintBuilder> cast( Name literal ) {
return new CastAsUpperBoundary(this, literal);
}
|
CastAs<ConstraintBuilder> function( Name literal ) { return new CastAsUpperBoundary(this, literal); }
|
/**
* Define the upper boundary value of a range.
*
* @param literal the literal value that is to be cast
* @return the constraint builder; never null
*/
|
Define the upper boundary value of a range
|
cast
|
{
"repo_name": "vhalbert/modeshape",
"path": "modeshape-jcr/src/main/java/org/modeshape/jcr/query/QueryBuilder.java",
"license": "apache-2.0",
"size": 126740
}
|
[
"org.modeshape.jcr.value.Name"
] |
import org.modeshape.jcr.value.Name;
|
import org.modeshape.jcr.value.*;
|
[
"org.modeshape.jcr"
] |
org.modeshape.jcr;
| 1,939,213 |
protected Artifact getArtifact( AbstractWebapp additionalWebapp )
throws MojoExecutionException
{
Artifact artifact;
VersionRange vr;
try
{
vr = VersionRange.createFromVersionSpec( additionalWebapp.getVersion() );
}
catch ( InvalidVersionSpecificationException e )
{
getLog().warn( "fail to create versionRange from version: " + additionalWebapp.getVersion(), e );
vr = VersionRange.createFromVersion( additionalWebapp.getVersion() );
}
if ( StringUtils.isEmpty( additionalWebapp.getClassifier() ) )
{
artifact =
factory.createDependencyArtifact( additionalWebapp.getGroupId(), additionalWebapp.getArtifactId(), vr,
additionalWebapp.getType(), null, Artifact.SCOPE_COMPILE );
}
else
{
artifact =
factory.createDependencyArtifact( additionalWebapp.getGroupId(), additionalWebapp.getArtifactId(), vr,
additionalWebapp.getType(), additionalWebapp.getClassifier(),
Artifact.SCOPE_COMPILE );
}
try
{
resolver.resolve( artifact, project.getRemoteArtifactRepositories(), this.local );
}
catch ( ArtifactResolutionException e )
{
throw new MojoExecutionException( "Unable to resolve artifact.", e );
}
catch ( ArtifactNotFoundException e )
{
throw new MojoExecutionException( "Unable to find artifact.", e );
}
return artifact;
}
|
Artifact function( AbstractWebapp additionalWebapp ) throws MojoExecutionException { Artifact artifact; VersionRange vr; try { vr = VersionRange.createFromVersionSpec( additionalWebapp.getVersion() ); } catch ( InvalidVersionSpecificationException e ) { getLog().warn( STR + additionalWebapp.getVersion(), e ); vr = VersionRange.createFromVersion( additionalWebapp.getVersion() ); } if ( StringUtils.isEmpty( additionalWebapp.getClassifier() ) ) { artifact = factory.createDependencyArtifact( additionalWebapp.getGroupId(), additionalWebapp.getArtifactId(), vr, additionalWebapp.getType(), null, Artifact.SCOPE_COMPILE ); } else { artifact = factory.createDependencyArtifact( additionalWebapp.getGroupId(), additionalWebapp.getArtifactId(), vr, additionalWebapp.getType(), additionalWebapp.getClassifier(), Artifact.SCOPE_COMPILE ); } try { resolver.resolve( artifact, project.getRemoteArtifactRepositories(), this.local ); } catch ( ArtifactResolutionException e ) { throw new MojoExecutionException( STR, e ); } catch ( ArtifactNotFoundException e ) { throw new MojoExecutionException( STR, e ); } return artifact; }
|
/**
* Resolves the Artifact from the remote repository if necessary. If no version is specified, it will be retrieved
* from the dependency list or from the DependencyManagement section of the pom.
*
* @param additionalWebapp containing information about artifact from plugin configuration.
* @return Artifact object representing the specified file.
* @throws MojoExecutionException with a message if the version can't be found in DependencyManagement.
*/
|
Resolves the Artifact from the remote repository if necessary. If no version is specified, it will be retrieved from the dependency list or from the DependencyManagement section of the pom
|
getArtifact
|
{
"repo_name": "karthikjaps/Tomcat",
"path": "tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractRunMojo.java",
"license": "apache-2.0",
"size": 54598
}
|
[
"org.apache.commons.lang.StringUtils",
"org.apache.maven.artifact.Artifact",
"org.apache.maven.artifact.resolver.ArtifactNotFoundException",
"org.apache.maven.artifact.resolver.ArtifactResolutionException",
"org.apache.maven.artifact.versioning.InvalidVersionSpecificationException",
"org.apache.maven.artifact.versioning.VersionRange",
"org.apache.maven.plugin.MojoExecutionException",
"org.apache.tomcat.maven.common.config.AbstractWebapp"
] |
import org.apache.commons.lang.StringUtils; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.resolver.ArtifactNotFoundException; import org.apache.maven.artifact.resolver.ArtifactResolutionException; import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; import org.apache.maven.artifact.versioning.VersionRange; import org.apache.maven.plugin.MojoExecutionException; import org.apache.tomcat.maven.common.config.AbstractWebapp;
|
import org.apache.commons.lang.*; import org.apache.maven.artifact.*; import org.apache.maven.artifact.resolver.*; import org.apache.maven.artifact.versioning.*; import org.apache.maven.plugin.*; import org.apache.tomcat.maven.common.config.*;
|
[
"org.apache.commons",
"org.apache.maven",
"org.apache.tomcat"
] |
org.apache.commons; org.apache.maven; org.apache.tomcat;
| 2,257,097 |
@Nullable
public GameProfile getGameProfileForUsername(String username)
{
String s = username.toLowerCase(Locale.ROOT);
PlayerProfileCache.ProfileEntry playerprofilecache$profileentry = (PlayerProfileCache.ProfileEntry)this.usernameToProfileEntryMap.get(s);
if (playerprofilecache$profileentry != null && (new Date()).getTime() >= playerprofilecache$profileentry.expirationDate.getTime())
{
this.uuidToProfileEntryMap.remove(playerprofilecache$profileentry.getGameProfile().getId());
this.usernameToProfileEntryMap.remove(playerprofilecache$profileentry.getGameProfile().getName().toLowerCase(Locale.ROOT));
this.gameProfiles.remove(playerprofilecache$profileentry.getGameProfile());
playerprofilecache$profileentry = null;
}
if (playerprofilecache$profileentry != null)
{
GameProfile gameprofile = playerprofilecache$profileentry.getGameProfile();
this.gameProfiles.remove(gameprofile);
this.gameProfiles.addFirst(gameprofile);
}
else
{
GameProfile gameprofile1 = lookupProfile(this.profileRepo, s);
if (gameprofile1 != null)
{
this.addEntry(gameprofile1);
playerprofilecache$profileentry = (PlayerProfileCache.ProfileEntry)this.usernameToProfileEntryMap.get(s);
}
}
this.save();
return playerprofilecache$profileentry == null ? null : playerprofilecache$profileentry.getGameProfile();
}
|
GameProfile function(String username) { String s = username.toLowerCase(Locale.ROOT); PlayerProfileCache.ProfileEntry playerprofilecache$profileentry = (PlayerProfileCache.ProfileEntry)this.usernameToProfileEntryMap.get(s); if (playerprofilecache$profileentry != null && (new Date()).getTime() >= playerprofilecache$profileentry.expirationDate.getTime()) { this.uuidToProfileEntryMap.remove(playerprofilecache$profileentry.getGameProfile().getId()); this.usernameToProfileEntryMap.remove(playerprofilecache$profileentry.getGameProfile().getName().toLowerCase(Locale.ROOT)); this.gameProfiles.remove(playerprofilecache$profileentry.getGameProfile()); playerprofilecache$profileentry = null; } if (playerprofilecache$profileentry != null) { GameProfile gameprofile = playerprofilecache$profileentry.getGameProfile(); this.gameProfiles.remove(gameprofile); this.gameProfiles.addFirst(gameprofile); } else { GameProfile gameprofile1 = lookupProfile(this.profileRepo, s); if (gameprofile1 != null) { this.addEntry(gameprofile1); playerprofilecache$profileentry = (PlayerProfileCache.ProfileEntry)this.usernameToProfileEntryMap.get(s); } } this.save(); return playerprofilecache$profileentry == null ? null : playerprofilecache$profileentry.getGameProfile(); }
|
/**
* Get a player's GameProfile given their username. Mojang's server's will be contacted if the entry is not cached
* locally.
*/
|
Get a player's GameProfile given their username. Mojang's server's will be contacted if the entry is not cached locally
|
getGameProfileForUsername
|
{
"repo_name": "F1r3w477/CustomWorldGen",
"path": "build/tmp/recompileMc/sources/net/minecraft/server/management/PlayerProfileCache.java",
"license": "lgpl-3.0",
"size": 14713
}
|
[
"com.mojang.authlib.GameProfile",
"java.util.Date",
"java.util.Locale"
] |
import com.mojang.authlib.GameProfile; import java.util.Date; import java.util.Locale;
|
import com.mojang.authlib.*; import java.util.*;
|
[
"com.mojang.authlib",
"java.util"
] |
com.mojang.authlib; java.util;
| 627,412 |
public Animator rotate(float fromRotation, float toRotation, float duration, Interpolator interpolator, boolean isFrom) {
Animator animator;
if (isFrom) {
animator = ObjectAnimator.ofFloat(mView, "rotation", toRotation, fromRotation);
} else {
animator = ObjectAnimator.ofFloat(mView, "rotation", fromRotation, toRotation);
}
setProperties(animator, duration, interpolator);
return animator;
}
|
Animator function(float fromRotation, float toRotation, float duration, Interpolator interpolator, boolean isFrom) { Animator animator; if (isFrom) { animator = ObjectAnimator.ofFloat(mView, STR, toRotation, fromRotation); } else { animator = ObjectAnimator.ofFloat(mView, STR, fromRotation, toRotation); } setProperties(animator, duration, interpolator); return animator; }
|
/**
* Animates transition between current rotation to target rotation
*
* @param fromRotation
* @param toRotation
* @param duration
* @param interpolator
* @param isFrom
* @return
*/
|
Animates transition between current rotation to target rotation
|
rotate
|
{
"repo_name": "canyinghao/CanAnimation",
"path": "cananimation/src/main/java/com/canyinghao/cananimation/CanObjectAnimator.java",
"license": "apache-2.0",
"size": 14801
}
|
[
"android.animation.Animator",
"android.animation.ObjectAnimator",
"android.view.animation.Interpolator"
] |
import android.animation.Animator; import android.animation.ObjectAnimator; import android.view.animation.Interpolator;
|
import android.animation.*; import android.view.animation.*;
|
[
"android.animation",
"android.view"
] |
android.animation; android.view;
| 2,254,642 |
private static boolean isChildOf(DetailAST ast, int type) {
boolean result = false;
DetailAST node = ast;
do {
if (node.getType() == type) {
result = true;
}
node = node.getParent();
} while (node != null && !result);
return result;
}
|
static boolean function(DetailAST ast, int type) { boolean result = false; DetailAST node = ast; do { if (node.getType() == type) { result = true; } node = node.getParent(); } while (node != null && !result); return result; }
|
/**
* Determines if the given AST node has a parent node with given token type code.
*
* @param ast the AST from which to search for annotations
* @param type the type code of parent token
*
* @return {@code true} if the AST node has a parent with given token type.
*/
|
Determines if the given AST node has a parent node with given token type code
|
isChildOf
|
{
"repo_name": "Bhavik3/checkstyle",
"path": "src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MagicNumberCheck.java",
"license": "lgpl-2.1",
"size": 15882
}
|
[
"com.puppycrawl.tools.checkstyle.api.DetailAST"
] |
import com.puppycrawl.tools.checkstyle.api.DetailAST;
|
import com.puppycrawl.tools.checkstyle.api.*;
|
[
"com.puppycrawl.tools"
] |
com.puppycrawl.tools;
| 2,895,844 |
private void subtestTwoTableSeqInnerFunctionJoin(Client client, String joinOp) throws Exception {
client.callProcedure("R1.INSERT", -1, 5, 1); // -1,5,1,1,3
client.callProcedure("R1.INSERT", 1, 1, 1); // 1,1,1,1,3
client.callProcedure("R1.INSERT", 2, 2, 2); // Eliminated by JOIN
client.callProcedure("R1.INSERT", 3, 3, 3); // 3,3,3,3,4
client.callProcedure("R2.INSERT", 1, 3); // 1,1,1,1,3
client.callProcedure("R2.INSERT", 3, 4); // 3,3,3,3,4
String query;
query = "SELECT * FROM R1 JOIN R2 " +
"ON ABS(R1.A) " + joinOp + " R2.A;";
validateRowCount(client, query, 3);
}
|
void function(Client client, String joinOp) throws Exception { client.callProcedure(STR, -1, 5, 1); client.callProcedure(STR, 1, 1, 1); client.callProcedure(STR, 2, 2, 2); client.callProcedure(STR, 3, 3, 3); client.callProcedure(STR, 1, 3); client.callProcedure(STR, 3, 4); String query; query = STR + STR + joinOp + STR; validateRowCount(client, query, 3); }
|
/**
* Two table NLJ
* @throws NoConnectionsException
* @throws IOException
* @throws ProcCallException
*/
|
Two table NLJ
|
subtestTwoTableSeqInnerFunctionJoin
|
{
"repo_name": "migue/voltdb",
"path": "tests/frontend/org/voltdb/regressionsuites/TestJoinsSuite.java",
"license": "agpl-3.0",
"size": 77053
}
|
[
"org.voltdb.client.Client"
] |
import org.voltdb.client.Client;
|
import org.voltdb.client.*;
|
[
"org.voltdb.client"
] |
org.voltdb.client;
| 2,238,358 |
@Nullable
public Filter searchFilter(String... types) {
if (types == null || types.length == 0) {
if (hasNested) {
return NonNestedDocsFilter.INSTANCE;
} else {
return null;
}
}
// if we filter by types, we don't need to filter by non nested docs
// since they have different types (starting with __)
if (types.length == 1) {
DocumentMapper docMapper = documentMapper(types[0]);
if (docMapper == null) {
return new TermFilter(new Term(types[0]));
}
return docMapper.typeFilter();
}
// see if we can use terms filter
boolean useTermsFilter = true;
for (String type : types) {
DocumentMapper docMapper = documentMapper(type);
if (docMapper == null) {
useTermsFilter = false;
break;
}
if (!docMapper.typeMapper().indexed()) {
useTermsFilter = false;
break;
}
}
if (useTermsFilter) {
Term[] typesTerms = new Term[types.length];
for (int i = 0; i < typesTerms.length; i++) {
typesTerms[i] = new Term(TypeFieldMapper.NAME, types[i]);
}
return new XTermsFilter(typesTerms);
} else {
XBooleanFilter bool = new XBooleanFilter();
for (String type : types) {
DocumentMapper docMapper = documentMapper(type);
if (docMapper == null) {
bool.add(new FilterClause(new TermFilter(new Term(TypeFieldMapper.NAME, type)), BooleanClause.Occur.SHOULD));
} else {
bool.add(new FilterClause(docMapper.typeFilter(), BooleanClause.Occur.SHOULD));
}
}
return bool;
}
}
|
Filter function(String... types) { if (types == null types.length == 0) { if (hasNested) { return NonNestedDocsFilter.INSTANCE; } else { return null; } } if (types.length == 1) { DocumentMapper docMapper = documentMapper(types[0]); if (docMapper == null) { return new TermFilter(new Term(types[0])); } return docMapper.typeFilter(); } boolean useTermsFilter = true; for (String type : types) { DocumentMapper docMapper = documentMapper(type); if (docMapper == null) { useTermsFilter = false; break; } if (!docMapper.typeMapper().indexed()) { useTermsFilter = false; break; } } if (useTermsFilter) { Term[] typesTerms = new Term[types.length]; for (int i = 0; i < typesTerms.length; i++) { typesTerms[i] = new Term(TypeFieldMapper.NAME, types[i]); } return new XTermsFilter(typesTerms); } else { XBooleanFilter bool = new XBooleanFilter(); for (String type : types) { DocumentMapper docMapper = documentMapper(type); if (docMapper == null) { bool.add(new FilterClause(new TermFilter(new Term(TypeFieldMapper.NAME, type)), BooleanClause.Occur.SHOULD)); } else { bool.add(new FilterClause(docMapper.typeFilter(), BooleanClause.Occur.SHOULD)); } } return bool; } }
|
/**
* A filter for search. If a filter is required, will return it, otherwise, will return <tt>null</tt>.
*/
|
A filter for search. If a filter is required, will return it, otherwise, will return null
|
searchFilter
|
{
"repo_name": "speedplane/elasticsearch",
"path": "src/main/java/org/elasticsearch/index/mapper/MapperService.java",
"license": "apache-2.0",
"size": 39179
}
|
[
"org.apache.lucene.index.Term",
"org.apache.lucene.queries.FilterClause",
"org.apache.lucene.search.BooleanClause",
"org.apache.lucene.search.Filter",
"org.apache.lucene.search.XTermsFilter",
"org.elasticsearch.common.lucene.search.TermFilter",
"org.elasticsearch.common.lucene.search.XBooleanFilter",
"org.elasticsearch.index.mapper.internal.TypeFieldMapper",
"org.elasticsearch.index.search.nested.NonNestedDocsFilter"
] |
import org.apache.lucene.index.Term; import org.apache.lucene.queries.FilterClause; import org.apache.lucene.search.BooleanClause; import org.apache.lucene.search.Filter; import org.apache.lucene.search.XTermsFilter; import org.elasticsearch.common.lucene.search.TermFilter; import org.elasticsearch.common.lucene.search.XBooleanFilter; import org.elasticsearch.index.mapper.internal.TypeFieldMapper; import org.elasticsearch.index.search.nested.NonNestedDocsFilter;
|
import org.apache.lucene.index.*; import org.apache.lucene.queries.*; import org.apache.lucene.search.*; import org.elasticsearch.common.lucene.search.*; import org.elasticsearch.index.mapper.internal.*; import org.elasticsearch.index.search.nested.*;
|
[
"org.apache.lucene",
"org.elasticsearch.common",
"org.elasticsearch.index"
] |
org.apache.lucene; org.elasticsearch.common; org.elasticsearch.index;
| 509,411 |
public WebApplicationContext getUnrefreshedApplicationContext();
public BeanConfiguration addPrototypeBean(String name, Class clazz);
|
WebApplicationContext getUnrefreshedApplicationContext(); public BeanConfiguration function(String name, Class clazz);
|
/**
* Adds a prototype bean definition
*
* @param name The name of the bean
* @param clazz The class of the bean
* @return A BeanConfiguration instance
*/
|
Adds a prototype bean definition
|
addPrototypeBean
|
{
"repo_name": "sincere520/testGitRepo",
"path": "hudson-core/src/main/java/hudson/util/spring/RuntimeSpringConfiguration.java",
"license": "mit",
"size": 7072
}
|
[
"org.springframework.web.context.WebApplicationContext"
] |
import org.springframework.web.context.WebApplicationContext;
|
import org.springframework.web.context.*;
|
[
"org.springframework.web"
] |
org.springframework.web;
| 309 |
private void mergeOrRemoveDepop(boolean isRight) {
if (isRight) { // case where we wanted to go right
// try merge
if (xToCheck == xTotal) {// on the first line
// update width
TemporaryRectangle tempRectangle = stack.peek();
stack.peek().setWidth(
tempRectangle.getCurrentPosition().getY()
- tempRectangle.getUpperLeftCorner().getY());
stack.peek().setHeight(1);
stack.peek().setValidated(true);
stack.peek().setPotentialSecondArea(0);
}
if (stack.size() > 1)
tryMerge();
} else {// case where we wanted to go down - stack point
tryMerge();
lastpoint = currentPoint;
currentPoint = currentPoint.getNextRight();
if (currentPoint == null)
potentialVSvalidated(-1, -1);
}
}
|
void function(boolean isRight) { if (isRight) { if (xToCheck == xTotal) { TemporaryRectangle tempRectangle = stack.peek(); stack.peek().setWidth( tempRectangle.getCurrentPosition().getY() - tempRectangle.getUpperLeftCorner().getY()); stack.peek().setHeight(1); stack.peek().setValidated(true); stack.peek().setPotentialSecondArea(0); } if (stack.size() > 1) tryMerge(); } else { tryMerge(); lastpoint = currentPoint; currentPoint = currentPoint.getNextRight(); if (currentPoint == null) potentialVSvalidated(-1, -1); } }
|
/**
* Merge or remove a depoped rectangle
*
* @param isRight
* last move was in the eastern direction
*/
|
Merge or remove a depoped rectangle
|
mergeOrRemoveDepop
|
{
"repo_name": "jsubercaze/wsrm",
"path": "src/main/java/fr/tse/lt2c/satin/matrix/extraction/linkedmatrix/refactored/WSMRDecomposer.java",
"license": "apache-2.0",
"size": 34036
}
|
[
"fr.tse.lt2c.satin.matrix.beans.TemporaryRectangle"
] |
import fr.tse.lt2c.satin.matrix.beans.TemporaryRectangle;
|
import fr.tse.lt2c.satin.matrix.beans.*;
|
[
"fr.tse.lt2c"
] |
fr.tse.lt2c;
| 1,288,838 |
public InetAddress getInetAddress() throws UnknownHostException {
return InetAddressUtils.addr(addressToByteString());
}
|
InetAddress function() throws UnknownHostException { return InetAddressUtils.addr(addressToByteString()); }
|
/**
* <P>
* the InetAddress of the address contained for the record.
* </P>
*
* @return The InetAddress of the address
* @exception java.net.UnknownHostException
* Thrown if the InetAddress object cannot be constructed.
* @throws java.net.UnknownHostException if any.
*/
|
the InetAddress of the address contained for the record.
|
getInetAddress
|
{
"repo_name": "tdefilip/opennms",
"path": "opennms-provision/opennms-detector-datagram/src/main/java/org/opennms/netmgt/provision/support/dns/DNSAddressRR.java",
"license": "agpl-3.0",
"size": 6225
}
|
[
"java.net.InetAddress",
"java.net.UnknownHostException",
"org.opennms.core.utils.InetAddressUtils"
] |
import java.net.InetAddress; import java.net.UnknownHostException; import org.opennms.core.utils.InetAddressUtils;
|
import java.net.*; import org.opennms.core.utils.*;
|
[
"java.net",
"org.opennms.core"
] |
java.net; org.opennms.core;
| 1,603,525 |
public void setAliases(Map<String, String> aliases) {
this.aliases = aliases;
}
|
void function(Map<String, String> aliases) { this.aliases = aliases; }
|
/**
* Sets mapping from full property name in dot notation to an alias that will be used as SQL column name.
* Example: {"parent.name" -> "parentName"}.
*
* @param aliases Aliases map.
*/
|
Sets mapping from full property name in dot notation to an alias that will be used as SQL column name. Example: {"parent.name" -> "parentName"}
|
setAliases
|
{
"repo_name": "agura/incubator-ignite",
"path": "modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java",
"license": "apache-2.0",
"size": 6317
}
|
[
"java.util.Map"
] |
import java.util.Map;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,893,676 |
private JComponent createToolBar()
{
toolBar = new JToolBar();
toolBar.setOpaque(false);
toolBar.setFloatable(false);
toolBar.setBorder(null);
buttonIndex = 0;
toolBar.add(exceptionButton);
toolBar.add(Box.createHorizontalStrut(5));
buttonIndex = 2;
toolBar.add(cancelButton);
JLabel l = new JLabel();
Font f = l.getFont();
l.setForeground(UIUtilities.LIGHT_GREY.darker());
l.setFont(f.deriveFont(f.getStyle(), f.getSize()-2));
String s = UIUtilities.formatShortDateTime(null);
String[] values = s.split(" ");
if (values.length > 1) {
String v = values[1];
if (values.length > 2) v +=" "+values[2];
l.setText(v);
toolBar.add(Box.createHorizontalStrut(5));
toolBar.add(l);
toolBar.add(Box.createHorizontalStrut(5));
}
return toolBar;
}
|
JComponent function() { toolBar = new JToolBar(); toolBar.setOpaque(false); toolBar.setFloatable(false); toolBar.setBorder(null); buttonIndex = 0; toolBar.add(exceptionButton); toolBar.add(Box.createHorizontalStrut(5)); buttonIndex = 2; toolBar.add(cancelButton); JLabel l = new JLabel(); Font f = l.getFont(); l.setForeground(UIUtilities.LIGHT_GREY.darker()); l.setFont(f.deriveFont(f.getStyle(), f.getSize()-2)); String s = UIUtilities.formatShortDateTime(null); String[] values = s.split(" "); if (values.length > 1) { String v = values[1]; if (values.length > 2) v +=" "+values[2]; l.setText(v); toolBar.add(Box.createHorizontalStrut(5)); toolBar.add(l); toolBar.add(Box.createHorizontalStrut(5)); } return toolBar; }
|
/**
* Returns the tool bar.
*
* @return See above.
*/
|
Returns the tool bar
|
createToolBar
|
{
"repo_name": "bramalingam/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/env/ui/ActivityComponent.java",
"license": "gpl-2.0",
"size": 27836
}
|
[
"java.awt.Font",
"javax.swing.Box",
"javax.swing.JComponent",
"javax.swing.JLabel",
"javax.swing.JToolBar",
"org.openmicroscopy.shoola.util.ui.UIUtilities"
] |
import java.awt.Font; import javax.swing.Box; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JToolBar; import org.openmicroscopy.shoola.util.ui.UIUtilities;
|
import java.awt.*; import javax.swing.*; import org.openmicroscopy.shoola.util.ui.*;
|
[
"java.awt",
"javax.swing",
"org.openmicroscopy.shoola"
] |
java.awt; javax.swing; org.openmicroscopy.shoola;
| 2,572,046 |
public void setTime(long millis) {
try {
mService.setTime(millis);
} catch (RemoteException ex) {
}
}
/**
* Set the system default time zone.
* Requires the permission android.permission.SET_TIME_ZONE.
*
* @param timeZone in the format understood by {@link java.util.TimeZone}
|
void function(long millis) { try { mService.setTime(millis); } catch (RemoteException ex) { } } /** * Set the system default time zone. * Requires the permission android.permission.SET_TIME_ZONE. * * @param timeZone in the format understood by {@link java.util.TimeZone}
|
/**
* Set the system wall clock time.
* Requires the permission android.permission.SET_TIME.
*
* @param millis time in milliseconds since the Epoch
*/
|
Set the system wall clock time. Requires the permission android.permission.SET_TIME
|
setTime
|
{
"repo_name": "mateor/PDroidHistory",
"path": "frameworks/base/core/java/android/app/AlarmManager.java",
"license": "gpl-3.0",
"size": 13332
}
|
[
"android.os.RemoteException"
] |
import android.os.RemoteException;
|
import android.os.*;
|
[
"android.os"
] |
android.os;
| 43,431 |
public static <M extends Map<K, V>, K, V> M dict(Iterable<Pair<K, V>> iterable, M map) {
dbc.precondition(iterable != null, "cannot call dict with a null iterable");
dbc.precondition(map != null, "cannot call dict with a null map");
final Function<Iterator<Pair<K, V>>, M> consumer = new ConsumeIntoMap<>(new ConstantSupplier<M>(map));
return consumer.apply(iterable.iterator());
}
|
static <M extends Map<K, V>, K, V> M function(Iterable<Pair<K, V>> iterable, M map) { dbc.precondition(iterable != null, STR); dbc.precondition(map != null, STR); final Function<Iterator<Pair<K, V>>, M> consumer = new ConsumeIntoMap<>(new ConstantSupplier<M>(map)); return consumer.apply(iterable.iterator()); }
|
/**
* Yields all elements of the iterator (in the provided map).
*
* @param <M> the returned map type
* @param <K> the map key type
* @param <V> the map value type
* @param iterable the iterable that will be consumed
* @param map the map where the iterator is consumed
* @return the map filled with iterator values
*/
|
Yields all elements of the iterator (in the provided map)
|
dict
|
{
"repo_name": "emaze/emaze-dysfunctional",
"path": "src/main/java/net/emaze/dysfunctional/Consumers.java",
"license": "bsd-3-clause",
"size": 28336
}
|
[
"java.util.Iterator",
"java.util.Map",
"java.util.function.Function",
"net.emaze.dysfunctional.consumers.ConsumeIntoMap",
"net.emaze.dysfunctional.dispatching.delegates.ConstantSupplier",
"net.emaze.dysfunctional.tuples.Pair"
] |
import java.util.Iterator; import java.util.Map; import java.util.function.Function; import net.emaze.dysfunctional.consumers.ConsumeIntoMap; import net.emaze.dysfunctional.dispatching.delegates.ConstantSupplier; import net.emaze.dysfunctional.tuples.Pair;
|
import java.util.*; import java.util.function.*; import net.emaze.dysfunctional.consumers.*; import net.emaze.dysfunctional.dispatching.delegates.*; import net.emaze.dysfunctional.tuples.*;
|
[
"java.util",
"net.emaze.dysfunctional"
] |
java.util; net.emaze.dysfunctional;
| 77,914 |
private int compareMethodsConsumes(MethodRecord record1,
MethodRecord record2,
MediaType inputMediaType) {
// get media type of metadata 1 best matching the input media type
MediaType bestMatch1 =
selectBestMatchingMediaType(inputMediaType, record1.getMetadata().getConsumes());
// get media type of metadata 2 best matching the input media type
MediaType bestMatch2 =
selectBestMatchingMediaType(inputMediaType, record2.getMetadata().getConsumes());
if (bestMatch1 == null && bestMatch2 == null) {
return 0;
}
if (bestMatch1 != null && bestMatch2 == null) {
return 1;
}
if (bestMatch1 == null && bestMatch2 != null) {
return -1;
}
int retVal = MediaTypeUtils.compareTo(bestMatch1, bestMatch2);
if (retVal != 0) {
return retVal;
}
Map<String, String> inputParameters = inputMediaType.getParameters();
Map<String, String> bestMatch1Params = bestMatch1.getParameters();
boolean didMatchAllParamsForBestMatch1 = true;
for (String key : bestMatch1Params.keySet()) {
String inputValue = inputParameters.get(key);
String value1 = bestMatch1Params.get(key);
if (!value1.equals(inputValue)) {
didMatchAllParamsForBestMatch1 = false;
break;
}
}
Map<String, String> bestMatch2Params = bestMatch2.getParameters();
boolean didMatchAllParamsForBestMatch2 = true;
for (String key : bestMatch2Params.keySet()) {
String inputValue = inputParameters.get(key);
String value2 = bestMatch2Params.get(key);
if (!value2.equals(inputValue)) {
didMatchAllParamsForBestMatch2 = false;
break;
}
}
if (didMatchAllParamsForBestMatch1 && !didMatchAllParamsForBestMatch2) {
return 1;
}
if (!didMatchAllParamsForBestMatch1 && didMatchAllParamsForBestMatch2) {
return -1;
}
if (didMatchAllParamsForBestMatch1 && didMatchAllParamsForBestMatch2) {
int size1 = bestMatch1Params.size();
int size2 = bestMatch2Params.size();
if (size1 > size2) {
return 1;
} else if (size2 > size1) {
return -1;
}
}
return 0;
}
|
int function(MethodRecord record1, MethodRecord record2, MediaType inputMediaType) { MediaType bestMatch1 = selectBestMatchingMediaType(inputMediaType, record1.getMetadata().getConsumes()); MediaType bestMatch2 = selectBestMatchingMediaType(inputMediaType, record2.getMetadata().getConsumes()); if (bestMatch1 == null && bestMatch2 == null) { return 0; } if (bestMatch1 != null && bestMatch2 == null) { return 1; } if (bestMatch1 == null && bestMatch2 != null) { return -1; } int retVal = MediaTypeUtils.compareTo(bestMatch1, bestMatch2); if (retVal != 0) { return retVal; } Map<String, String> inputParameters = inputMediaType.getParameters(); Map<String, String> bestMatch1Params = bestMatch1.getParameters(); boolean didMatchAllParamsForBestMatch1 = true; for (String key : bestMatch1Params.keySet()) { String inputValue = inputParameters.get(key); String value1 = bestMatch1Params.get(key); if (!value1.equals(inputValue)) { didMatchAllParamsForBestMatch1 = false; break; } } Map<String, String> bestMatch2Params = bestMatch2.getParameters(); boolean didMatchAllParamsForBestMatch2 = true; for (String key : bestMatch2Params.keySet()) { String inputValue = inputParameters.get(key); String value2 = bestMatch2Params.get(key); if (!value2.equals(inputValue)) { didMatchAllParamsForBestMatch2 = false; break; } } if (didMatchAllParamsForBestMatch1 && !didMatchAllParamsForBestMatch2) { return 1; } if (!didMatchAllParamsForBestMatch1 && didMatchAllParamsForBestMatch2) { return -1; } if (didMatchAllParamsForBestMatch1 && didMatchAllParamsForBestMatch2) { int size1 = bestMatch1Params.size(); int size2 = bestMatch2Params.size(); if (size1 > size2) { return 1; } else if (size2 > size1) { return -1; } } return 0; }
|
/**
* Compare two methods in terms of matching to the input media type
*
* @param record1 the first method
* @param record2 the second method
* @param inputMediaType the input entity media type
* @return positive integer if record1 is a better match, negative integer
* if record2 is a better match, 0 if they are equal in matching
* terms
*/
|
Compare two methods in terms of matching to the input media type
|
compareMethodsConsumes
|
{
"repo_name": "apache/wink",
"path": "wink-server/src/main/java/org/apache/wink/server/internal/registry/ResourceRegistry.java",
"license": "apache-2.0",
"size": 33256
}
|
[
"java.util.Map",
"javax.ws.rs.core.MediaType",
"org.apache.wink.common.internal.utils.MediaTypeUtils"
] |
import java.util.Map; import javax.ws.rs.core.MediaType; import org.apache.wink.common.internal.utils.MediaTypeUtils;
|
import java.util.*; import javax.ws.rs.core.*; import org.apache.wink.common.internal.utils.*;
|
[
"java.util",
"javax.ws",
"org.apache.wink"
] |
java.util; javax.ws; org.apache.wink;
| 162,980 |
protected String readString(int n) throws IOException {
return readString(n, US_ASCII);
}
|
String function(int n) throws IOException { return readString(n, US_ASCII); }
|
/**
* Reads a String from the InputStream with US-ASCII charset. The parser
* will read n bytes and convert it to ascii string. This is used for
* reading values of type {@link ExifTag#TYPE_ASCII}.
*/
|
Reads a String from the InputStream with US-ASCII charset. The parser will read n bytes and convert it to ascii string. This is used for reading values of type <code>ExifTag#TYPE_ASCII</code>
|
readString
|
{
"repo_name": "AdeebNqo/Thula",
"path": "Thula/src/main/java/com/adeebnqo/Thula/exif/ExifParser.java",
"license": "gpl-3.0",
"size": 34327
}
|
[
"java.io.IOException"
] |
import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 478,213 |
private Resource computeMaxAMResource() {
Resource maxResource = Resources.clone(getFairShare());
Resource maxShare = getMaxShare();
if (maxResource.getMemorySize() == 0) {
maxResource.setMemorySize(
Math.min(scheduler.getRootQueueMetrics().getAvailableMB(),
maxShare.getMemorySize()));
}
if (maxResource.getVirtualCores() == 0) {
maxResource.setVirtualCores(Math.min(
scheduler.getRootQueueMetrics().getAvailableVirtualCores(),
maxShare.getVirtualCores()));
}
scheduler.getRootQueueMetrics()
.fillInValuesFromAvailableResources(maxShare, maxResource);
// Round up to allow AM to run when there is only one vcore on the cluster
return Resources.multiplyAndRoundUp(maxResource, maxAMShare);
}
|
Resource function() { Resource maxResource = Resources.clone(getFairShare()); Resource maxShare = getMaxShare(); if (maxResource.getMemorySize() == 0) { maxResource.setMemorySize( Math.min(scheduler.getRootQueueMetrics().getAvailableMB(), maxShare.getMemorySize())); } if (maxResource.getVirtualCores() == 0) { maxResource.setVirtualCores(Math.min( scheduler.getRootQueueMetrics().getAvailableVirtualCores(), maxShare.getVirtualCores())); } scheduler.getRootQueueMetrics() .fillInValuesFromAvailableResources(maxShare, maxResource); return Resources.multiplyAndRoundUp(maxResource, maxAMShare); }
|
/**
* Compute the maximum resource AM can use. The value is the result of
* multiplying FairShare and maxAMShare. If FairShare is zero, use
* min(maxShare, available resource) instead to prevent zero value for
* maximum AM resource since it forbids any job running in the queue.
*
* @return the maximum resource AM can use
*/
|
Compute the maximum resource AM can use. The value is the result of multiplying FairShare and maxAMShare. If FairShare is zero, use min(maxShare, available resource) instead to prevent zero value for maximum AM resource since it forbids any job running in the queue
|
computeMaxAMResource
|
{
"repo_name": "plusplusjiajia/hadoop",
"path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSLeafQueue.java",
"license": "apache-2.0",
"size": 21312
}
|
[
"org.apache.hadoop.yarn.api.records.Resource",
"org.apache.hadoop.yarn.util.resource.Resources"
] |
import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.util.resource.Resources;
|
import org.apache.hadoop.yarn.api.records.*; import org.apache.hadoop.yarn.util.resource.*;
|
[
"org.apache.hadoop"
] |
org.apache.hadoop;
| 2,481,934 |
protected void buildPdfMetadata(Map model, Document document, HttpServletRequest request) {
}
|
void function(Map model, Document document, HttpServletRequest request) { }
|
/**
* Populate the iText Document's meta fields (author, title, etc.).
* <br>Default is an empty implementation. Subclasses may override this method
* to add meta fields such as title, subject, author, creator, keywords, etc.
* This method is called after assigning a PdfWriter to the Document and
* before calling <code>document.open()</code>.
* @param model the model, in case meta information must be populated from it
* @param document the iText document being populated
* @param request in case we need locale etc. Shouldn't look at attributes.
* @see com.lowagie.text.Document#addTitle
* @see com.lowagie.text.Document#addSubject
* @see com.lowagie.text.Document#addKeywords
* @see com.lowagie.text.Document#addAuthor
* @see com.lowagie.text.Document#addCreator
* @see com.lowagie.text.Document#addProducer
* @see com.lowagie.text.Document#addCreationDate
* @see com.lowagie.text.Document#addHeader
*/
|
Populate the iText Document's meta fields (author, title, etc.). Default is an empty implementation. Subclasses may override this method to add meta fields such as title, subject, author, creator, keywords, etc. This method is called after assigning a PdfWriter to the Document and before calling <code>document.open()</code>
|
buildPdfMetadata
|
{
"repo_name": "codeApeFromChina/resource",
"path": "frame_packages/java_libs/spring-2.5.6-src/src/org/springframework/web/servlet/view/document/AbstractPdfView.java",
"license": "unlicense",
"size": 7342
}
|
[
"com.lowagie.text.Document",
"java.util.Map",
"javax.servlet.http.HttpServletRequest"
] |
import com.lowagie.text.Document; import java.util.Map; import javax.servlet.http.HttpServletRequest;
|
import com.lowagie.text.*; import java.util.*; import javax.servlet.http.*;
|
[
"com.lowagie.text",
"java.util",
"javax.servlet"
] |
com.lowagie.text; java.util; javax.servlet;
| 599,327 |
protected void paintTabLines(int x, int y, int endX, Graphics2D g,
TabExpander e, RSyntaxTextArea host) {
// We allow tab lines to be painted in more than just Token.WHITESPACE,
// i.e. for MLC's and Token.IDENTIFIERS (for TokenMakers that return
// whitespace as identifiers for performance). But we only paint tab
// lines for the leading whitespace in the token. So, if this isn't a
// WHITESPACE token, figure out the leading whitespace's length.
if (type!=Token.WHITESPACE) {
int offs = textOffset;
for (; offs<textOffset+textCount; offs++) {
if (!RSyntaxUtilities.isWhitespace(text[offs])) {
break; // MLC text, etc.
}
}
int len = offs - textOffset;
if (len<2) { // Must be at least two whitespaces to see tab line
return;
}
//endX = x + (int)getWidthUpTo(len, host, e, x);
endX = (int)getWidthUpTo(len, host, e, 0);
}
// Get the length of a tab.
FontMetrics fm = host.getFontMetricsForTokenType(type);
int tabSize = host.getTabSize();
if (tabBuf==null || tabBuf.length<tabSize) {
tabBuf = new char[tabSize];
for (int i=0; i<tabSize; i++) {
tabBuf[i] = ' ';
}
}
// Note different token types (MLC's, whitespace) could possibly be
// using different fonts, which means we can't cache the actual width
// of a tab as it may be different per-token-type. We could keep a
// per-token-type cache, but we'd have to clear it whenever they
// modified token styles.
int tabW = fm.charsWidth(tabBuf, 0, tabSize);
// Draw any tab lines. Here we're assuming that "x" is the left
// margin of the editor.
g.setColor(host.getTabLineColor());
int x0 = x + tabW;
int y0 = y - fm.getAscent();
if ((y0&1)>0) {
// Only paint on even y-pixels to prevent doubling up between lines
y0++;
}
while (x0<endX) {
int y1 = y0;
int y2 = y0 + host.getLineHeight();
while (y1<y2) {
g.drawLine(x0, y1, x0, y1);
y1 += 2;
}
//g.drawLine(x0,y0, x0,y0+host.getLineHeight());
x0 += tabW;
}
}
|
void function(int x, int y, int endX, Graphics2D g, TabExpander e, RSyntaxTextArea host) { if (type!=Token.WHITESPACE) { int offs = textOffset; for (; offs<textOffset+textCount; offs++) { if (!RSyntaxUtilities.isWhitespace(text[offs])) { break; } } int len = offs - textOffset; if (len<2) { return; } endX = (int)getWidthUpTo(len, host, e, 0); } FontMetrics fm = host.getFontMetricsForTokenType(type); int tabSize = host.getTabSize(); if (tabBuf==null tabBuf.length<tabSize) { tabBuf = new char[tabSize]; for (int i=0; i<tabSize; i++) { tabBuf[i] = ' '; } } int tabW = fm.charsWidth(tabBuf, 0, tabSize); g.setColor(host.getTabLineColor()); int x0 = x + tabW; int y0 = y - fm.getAscent(); if ((y0&1)>0) { y0++; } while (x0<endX) { int y1 = y0; int y2 = y0 + host.getLineHeight(); while (y1<y2) { g.drawLine(x0, y1, x0, y1); y1 += 2; } x0 += tabW; } }
|
/**
* Paints dotted "tab" lines; that is, lines that show where your caret
* would go to on the line if you hit "tab". This visual effect is usually
* done in the leading whitespace token(s) of lines.
*
* @param x The starting x-offset of this token. It is assumed that this
* is the left margin of the text area (may be non-zero due to
* insets), since tab lines are only painted for leading whitespace.
* @param y The baseline where this token was painted.
* @param endX The ending x-offset of this token.
* @param g The graphics context.
* @param e Used to expand tabs.
* @param host The text area.
*/
|
Paints dotted "tab" lines; that is, lines that show where your caret would go to on the line if you hit "tab". This visual effect is usually done in the leading whitespace token(s) of lines
|
paintTabLines
|
{
"repo_name": "thomasgalvin/ThirdParty",
"path": "RText/RText-Editor/src/main/java/org/fife/ui/rsyntaxtextarea/Token.java",
"license": "apache-2.0",
"size": 32580
}
|
[
"java.awt.FontMetrics",
"java.awt.Graphics2D",
"javax.swing.text.TabExpander"
] |
import java.awt.FontMetrics; import java.awt.Graphics2D; import javax.swing.text.TabExpander;
|
import java.awt.*; import javax.swing.text.*;
|
[
"java.awt",
"javax.swing"
] |
java.awt; javax.swing;
| 2,093,370 |
@Override
@CallSuper
public void onClick(View view) {
if (mAdapter.isItemEnabled(getFlexibleAdapterPosition())) {
toggleExpansion();
}
super.onClick(view);
}
|
void function(View view) { if (mAdapter.isItemEnabled(getFlexibleAdapterPosition())) { toggleExpansion(); } super.onClick(view); }
|
/**
* Called when user taps once on the ItemView.
* <p><b>Note:</b> In Expandable version, it tries to expand, but before,
* it checks if the view {@link #isViewExpandableOnClick()}.</p>
*
* @param view the view that receives the event
* @since 5.0.0-b1
*/
|
Called when user taps once on the ItemView. Note: In Expandable version, it tries to expand, but before, it checks if the view <code>#isViewExpandableOnClick()</code>
|
onClick
|
{
"repo_name": "davideas/FlexibleAdapter",
"path": "flexible-adapter/src/main/java/eu/davidea/viewholders/ExpandableViewHolder.java",
"license": "apache-2.0",
"size": 7781
}
|
[
"android.view.View"
] |
import android.view.View;
|
import android.view.*;
|
[
"android.view"
] |
android.view;
| 1,289,047 |
private InternalRequest createRequest(AbstractBceRequest bceRequest, HttpMethodName httpMethod,
String... pathVariables) {
List<String> path = new ArrayList<String>();
path.add(VERSION);
if (pathVariables != null) {
for (String pathVariable : pathVariables) {
path.add(pathVariable);
}
}
URI uri = HttpUtils.appendUri(this.getEndpoint(), path.toArray(new String[path.size()]));
InternalRequest request = new InternalRequest(httpMethod, uri);
request.setCredentials(bceRequest.getRequestCredentials());
return request;
}
|
InternalRequest function(AbstractBceRequest bceRequest, HttpMethodName httpMethod, String... pathVariables) { List<String> path = new ArrayList<String>(); path.add(VERSION); if (pathVariables != null) { for (String pathVariable : pathVariables) { path.add(pathVariable); } } URI uri = HttpUtils.appendUri(this.getEndpoint(), path.toArray(new String[path.size()])); InternalRequest request = new InternalRequest(httpMethod, uri); request.setCredentials(bceRequest.getRequestCredentials()); return request; }
|
/**
* Creates and initializes a new request object for the specified network resource. This method is responsible
* for determining the right way to address resources.
*
* @param bceRequest The original request, as created by the user.
* @param httpMethod The HTTP method to use when sending the request.
* @param pathVariables The optional variables used in the URI path.
*
* @return A new request object, populated with endpoint, resource path, ready for callers to populate
* any additional headers or parameters, and execute.
*/
|
Creates and initializes a new request object for the specified network resource. This method is responsible for determining the right way to address resources
|
createRequest
|
{
"repo_name": "baidubce/bce-sdk-java",
"path": "src/main/java/com/baidubce/services/blb/BlbClient.java",
"license": "apache-2.0",
"size": 27829
}
|
[
"com.baidubce.http.HttpMethodName",
"com.baidubce.internal.InternalRequest",
"com.baidubce.model.AbstractBceRequest",
"com.baidubce.util.HttpUtils",
"java.util.ArrayList",
"java.util.List"
] |
import com.baidubce.http.HttpMethodName; import com.baidubce.internal.InternalRequest; import com.baidubce.model.AbstractBceRequest; import com.baidubce.util.HttpUtils; import java.util.ArrayList; import java.util.List;
|
import com.baidubce.http.*; import com.baidubce.internal.*; import com.baidubce.model.*; import com.baidubce.util.*; import java.util.*;
|
[
"com.baidubce.http",
"com.baidubce.internal",
"com.baidubce.model",
"com.baidubce.util",
"java.util"
] |
com.baidubce.http; com.baidubce.internal; com.baidubce.model; com.baidubce.util; java.util;
| 1,901,954 |
//----------------------------------------------------------------------
public void setSerialPortSpeed(int speed)
throws IOException
{
try
{
serial_port_.setSerialPortParams(speed,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
}
catch(UnsupportedCommOperationException e)
{
e.printStackTrace();
throw new IOException(e.getMessage());
}
}
|
void function(int speed) throws IOException { try { serial_port_.setSerialPortParams(speed, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } catch(UnsupportedCommOperationException e) { e.printStackTrace(); throw new IOException(e.getMessage()); } }
|
/**
* Sets the speed for the serial port.
* @param speed the speed to set (e.g. 4800, 9600, 19200, 38400, ...)
*/
|
Sets the speed for the serial port
|
setSerialPortSpeed
|
{
"repo_name": "FracturedPlane/GpsdInspector",
"path": "src/org/dinopolis/gpstool/gpsinput/GPSSerialDevice.java",
"license": "gpl-3.0",
"size": 6969
}
|
[
"gnu.io.SerialPort",
"gnu.io.UnsupportedCommOperationException",
"java.io.IOException"
] |
import gnu.io.SerialPort; import gnu.io.UnsupportedCommOperationException; import java.io.IOException;
|
import gnu.io.*; import java.io.*;
|
[
"gnu.io",
"java.io"
] |
gnu.io; java.io;
| 2,729,187 |
@Override public void enterGenericMethodDeclaration(@NotNull JavaParser.GenericMethodDeclarationContext ctx) { }
|
@Override public void enterGenericMethodDeclaration(@NotNull JavaParser.GenericMethodDeclarationContext ctx) { }
|
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
|
The default implementation does nothing
|
exitArguments
|
{
"repo_name": "martinaguero/deep",
"path": "src/org/trimatek/deep/lexer/JavaBaseListener.java",
"license": "apache-2.0",
"size": 39286
}
|
[
"org.antlr.v4.runtime.misc.NotNull"
] |
import org.antlr.v4.runtime.misc.NotNull;
|
import org.antlr.v4.runtime.misc.*;
|
[
"org.antlr.v4"
] |
org.antlr.v4;
| 1,030,694 |
@Test
public void testServiceCustomUIPath() throws Throwable {
setUp(false);
String resourcePath = "customUiPath";
// Service with custom path
class CustomUiPathService extends StatelessService {
public static final String SELF_LINK = "/custom";
public CustomUiPathService() {
super();
toggleOption(ServiceOption.HTML_USER_INTERFACE, true);
}
|
void function() throws Throwable { setUp(false); String resourcePath = STR; class CustomUiPathService extends StatelessService { public static final String SELF_LINK = STR; public CustomUiPathService() { super(); toggleOption(ServiceOption.HTML_USER_INTERFACE, true); }
|
/**
* This test verify the custom Ui path resource of service
**/
|
This test verify the custom Ui path resource of service
|
testServiceCustomUIPath
|
{
"repo_name": "toliaqat/xenon",
"path": "xenon-common/src/test/java/com/vmware/xenon/common/TestServiceHost.java",
"license": "apache-2.0",
"size": 124462
}
|
[
"com.vmware.xenon.common.Service"
] |
import com.vmware.xenon.common.Service;
|
import com.vmware.xenon.common.*;
|
[
"com.vmware.xenon"
] |
com.vmware.xenon;
| 2,798,506 |
public static String buildUIMAClassPath(String uimaHomeEnv) {
try {
StringBuffer cpBuffer = new StringBuffer();
File uimaLibDir = new File(uimaHomeEnv + UIMA_LIB_DIR);
cpBuffer = addListOfJarFiles(uimaLibDir, cpBuffer);
File vinciLibDir = new File(uimaHomeEnv + VINCI_LIB_DIR);
cpBuffer = addListOfJarFiles(vinciLibDir, cpBuffer);
return cpBuffer.toString();
} catch (IOException exc) {
return File.pathSeparator;
}
}
|
static String function(String uimaHomeEnv) { try { StringBuffer cpBuffer = new StringBuffer(); File uimaLibDir = new File(uimaHomeEnv + UIMA_LIB_DIR); cpBuffer = addListOfJarFiles(uimaLibDir, cpBuffer); File vinciLibDir = new File(uimaHomeEnv + VINCI_LIB_DIR); cpBuffer = addListOfJarFiles(vinciLibDir, cpBuffer); return cpBuffer.toString(); } catch (IOException exc) { return File.pathSeparator; } }
|
/**
* Creates a string that should be added to the CLASSPATH environment variable for UIMA framework.
*
* @param uimaHomeEnv
* The location of UIMA framework (UIMA_HOME environment variable value).
* @return The CLASSPATH string for UIMA framework.
*/
|
Creates a string that should be added to the CLASSPATH environment variable for UIMA framework
|
buildUIMAClassPath
|
{
"repo_name": "apache/uima-uimaj",
"path": "uimaj-core/src/main/java/org/apache/uima/pear/tools/InstallationController.java",
"license": "apache-2.0",
"size": 85779
}
|
[
"java.io.File",
"java.io.IOException"
] |
import java.io.File; import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 289,544 |
private Uri getCurrentLocation() {
return mCurrentLocation;
}// getCurrentLocation()
|
Uri function() { return mCurrentLocation; }
|
/**
* Gets current location.
*
* @return the current location.
*/
|
Gets current location
|
getCurrentLocation
|
{
"repo_name": "red13dotnet/keepass2android",
"path": "src/java/android-filechooser/code/src/group/pals/android/lib/ui/filechooser/FragmentFiles.java",
"license": "gpl-3.0",
"size": 90560
}
|
[
"android.net.Uri"
] |
import android.net.Uri;
|
import android.net.*;
|
[
"android.net"
] |
android.net;
| 701,769 |
public void setMustAttributeTypeOids( List<String> mustAttributeTypeOids )
{
if ( locked )
{
throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
}
if ( !isReadOnly )
{
this.mustAttributeTypeOids = mustAttributeTypeOids;
}
}
|
void function( List<String> mustAttributeTypeOids ) { if ( locked ) { throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) ); } if ( !isReadOnly ) { this.mustAttributeTypeOids = mustAttributeTypeOids; } }
|
/**
* Sets the list of required AttributeTypes OIDs
*
* @param mustAttributeTypeOids the list of required AttributeTypes OIDs
*/
|
Sets the list of required AttributeTypes OIDs
|
setMustAttributeTypeOids
|
{
"repo_name": "darranl/directory-shared",
"path": "ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/NameForm.java",
"license": "apache-2.0",
"size": 14735
}
|
[
"java.util.List",
"org.apache.directory.api.i18n.I18n"
] |
import java.util.List; import org.apache.directory.api.i18n.I18n;
|
import java.util.*; import org.apache.directory.api.i18n.*;
|
[
"java.util",
"org.apache.directory"
] |
java.util; org.apache.directory;
| 1,276,516 |
public void setTime(int parameterIndex, Time x)
throws java.sql.SQLException {
setTimeInternal(parameterIndex, x, null, Util.getDefaultTimeZone(), false);
}
|
void function(int parameterIndex, Time x) throws java.sql.SQLException { setTimeInternal(parameterIndex, x, null, Util.getDefaultTimeZone(), false); }
|
/**
* Set a parameter to a java.sql.Time value. The driver converts this to a
* SQL TIME value when it sends it to the database.
*
* @param parameterIndex
* the first parameter is 1...));
* @param x
* the parameter value
*
* @throws java.sql.SQLException
* if a database access error occurs
*/
|
Set a parameter to a java.sql.Time value. The driver converts this to a SQL TIME value when it sends it to the database
|
setTime
|
{
"repo_name": "seadsystem/SchemaSpy",
"path": "src/com/mysql/jdbc/PreparedStatement.java",
"license": "gpl-2.0",
"size": 165044
}
|
[
"java.sql.SQLException",
"java.sql.Time"
] |
import java.sql.SQLException; import java.sql.Time;
|
import java.sql.*;
|
[
"java.sql"
] |
java.sql;
| 2,032,043 |
@Override
public EndpointReference getEndpointReference() {
return null;
}
|
EndpointReference function() { return null; }
|
/**
* Unused in this mock.
* @see javax.xml.ws.BindingProvider#getEndpointReference()
*/
|
Unused in this mock
|
getEndpointReference
|
{
"repo_name": "stoksey69/googleads-java-lib",
"path": "modules/ads_lib_appengine/src/test/java/com/google/api/ads/common/lib/soap/jaxws/testing/mocks/CampaignServiceInterfaceImpl.java",
"license": "apache-2.0",
"size": 3555
}
|
[
"javax.xml.ws.EndpointReference"
] |
import javax.xml.ws.EndpointReference;
|
import javax.xml.ws.*;
|
[
"javax.xml"
] |
javax.xml;
| 2,801,670 |
protected boolean incrementalBuild( IResourceDelta delta,
IProgressMonitor monitor ) throws CoreException
{
// Create the dependency list only if it's not created.
projectCache_.getDependencyList( ).createDependencyList( false );
monitor.worked( 10 );
boolean foundCfg = false;
// TODO: unprocessed files should be reprocessed on each build
// until they get so.
DependencyListBuilder list = projectCache_.getDependencyList( );
Queue< IResourceDelta > deltasQueue = new LinkedBlockingDeque< IResourceDelta >( );
List< DependencyListNode > nodesToProcess = new ArrayList< DependencyListNode >( );
// gather the list of configs modified
deltasQueue.add( delta );
while( ! deltasQueue.isEmpty( ) ) {
IResourceDelta deltaItem = deltasQueue.poll( );
IResource resource = deltaItem.getResource( );
// process just config files
if( ResourceUtils.isConfigFile( resource ) ) {
IFile file = ( IFile ) resource;
int deltaKind = deltaItem.getKind( );
if( deltaKind == IResourceDelta.REMOVED ) {
projectCache_.getDependencyList( ).removeNode( file );
projectCache_.getWMLConfigs( ).remove(
file.getProjectRelativePath( ).toString( ) );
}
else if( deltaKind == IResourceDelta.ADDED ) {
DependencyListNode newNode = list.addNode( file );
if( newNode == null ) {
Logger.getInstance( ).logError(
"Couldn't create a new" + "PDL node for file: "
+ file.getFullPath( ).toString( ) );
}
else {
nodesToProcess.add( newNode );
}
}
else if( deltaKind == IResourceDelta.CHANGED ) {
DependencyListNode node = list.getNode( file );
if( node == null ) {
Logger.getInstance( ).logError(
"Couldn't find file "
+ file.getFullPath( ).toString( )
+ " in PDL!." );
}
else {
nodesToProcess.add( node );
list.updateNode( node );
}
}
else {
Logger.getInstance( ).log(
"unknown delta kind: " + deltaKind );
}
}
// skip core library files
if( resource instanceof IContainer
&& WesnothProjectsExplorer.CORE_LIBRARY_NAME
.equals( resource.getName( ) ) ) {
continue;
}
deltasQueue
.addAll( Arrays.asList( deltaItem.getAffectedChildren( ) ) );
}
// sort the list by index (ascending)
Collections.sort( nodesToProcess,
new Comparator< DependencyListNode >( ) {
|
boolean function( IResourceDelta delta, IProgressMonitor monitor ) throws CoreException { projectCache_.getDependencyList( ).createDependencyList( false ); monitor.worked( 10 ); boolean foundCfg = false; DependencyListBuilder list = projectCache_.getDependencyList( ); Queue< IResourceDelta > deltasQueue = new LinkedBlockingDeque< IResourceDelta >( ); List< DependencyListNode > nodesToProcess = new ArrayList< DependencyListNode >( ); deltasQueue.add( delta ); while( ! deltasQueue.isEmpty( ) ) { IResourceDelta deltaItem = deltasQueue.poll( ); IResource resource = deltaItem.getResource( ); if( ResourceUtils.isConfigFile( resource ) ) { IFile file = ( IFile ) resource; int deltaKind = deltaItem.getKind( ); if( deltaKind == IResourceDelta.REMOVED ) { projectCache_.getDependencyList( ).removeNode( file ); projectCache_.getWMLConfigs( ).remove( file.getProjectRelativePath( ).toString( ) ); } else if( deltaKind == IResourceDelta.ADDED ) { DependencyListNode newNode = list.addNode( file ); if( newNode == null ) { Logger.getInstance( ).logError( STR + STR + file.getFullPath( ).toString( ) ); } else { nodesToProcess.add( newNode ); } } else if( deltaKind == IResourceDelta.CHANGED ) { DependencyListNode node = list.getNode( file ); if( node == null ) { Logger.getInstance( ).logError( STR + file.getFullPath( ).toString( ) + STR ); } else { nodesToProcess.add( node ); list.updateNode( node ); } } else { Logger.getInstance( ).log( STR + deltaKind ); } } if( resource instanceof IContainer && WesnothProjectsExplorer.CORE_LIBRARY_NAME .equals( resource.getName( ) ) ) { continue; } deltasQueue .addAll( Arrays.asList( deltaItem.getAffectedChildren( ) ) ); } Collections.sort( nodesToProcess, new Comparator< DependencyListNode >( ) {
|
/**
* Does an incremental build on this project
*
* @param delta
* The delta which contains the project modifications
* @param monitor
* The monitor used to signal progress
* @return True if there were config files processed
* @throws CoreException
*/
|
Does an incremental build on this project
|
incrementalBuild
|
{
"repo_name": "RushilPatel/BattleForWesnoth",
"path": "utils/umc_dev/org.wesnoth/src/org/wesnoth/builder/WesnothProjectBuilder.java",
"license": "gpl-2.0",
"size": 15804
}
|
[
"java.util.ArrayList",
"java.util.Arrays",
"java.util.Collections",
"java.util.Comparator",
"java.util.List",
"java.util.Queue",
"java.util.concurrent.LinkedBlockingDeque",
"org.eclipse.core.resources.IContainer",
"org.eclipse.core.resources.IFile",
"org.eclipse.core.resources.IResource",
"org.eclipse.core.resources.IResourceDelta",
"org.eclipse.core.runtime.CoreException",
"org.eclipse.core.runtime.IProgressMonitor",
"org.wesnoth.Logger",
"org.wesnoth.utils.ResourceUtils",
"org.wesnoth.views.WesnothProjectsExplorer"
] |
import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.Queue; import java.util.concurrent.LinkedBlockingDeque; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResourceDelta; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.wesnoth.Logger; import org.wesnoth.utils.ResourceUtils; import org.wesnoth.views.WesnothProjectsExplorer;
|
import java.util.*; import java.util.concurrent.*; import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; import org.wesnoth.*; import org.wesnoth.utils.*; import org.wesnoth.views.*;
|
[
"java.util",
"org.eclipse.core",
"org.wesnoth",
"org.wesnoth.utils",
"org.wesnoth.views"
] |
java.util; org.eclipse.core; org.wesnoth; org.wesnoth.utils; org.wesnoth.views;
| 263,800 |
private void silenceC3P0Logger() {
Properties p = new Properties(System.getProperties());
p.put("com.mchange.v2.log.MLog", "com.mchange.v2.log.FallbackMLog");
p.put("com.mchange.v2.log.FallbackMLog.DEFAULT_CUTOFF_LEVEL", "OFF"); // or any other
System.setProperties(p);
}
|
void function() { Properties p = new Properties(System.getProperties()); p.put(STR, STR); p.put(STR, "OFF"); System.setProperties(p); }
|
/**
* Hack to kill com.mchange.v2 log spamming.
*/
|
Hack to kill com.mchange.v2 log spamming
|
silenceC3P0Logger
|
{
"repo_name": "bitrepository/reference",
"path": "bitrepository-service/src/main/java/org/bitrepository/service/database/DBConnector.java",
"license": "lgpl-2.1",
"size": 4490
}
|
[
"java.util.Properties"
] |
import java.util.Properties;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 257,187 |
public static void assertSameDay(Date actual, Date expected, String message) {
Calendar actualCal = Calendar.getInstance(), expectedCal = Calendar.getInstance();
actualCal.setTime(actual);
expectedCal.setTime(expected);
assertSameDay(actualCal, expectedCal, message);
}
|
static void function(Date actual, Date expected, String message) { Calendar actualCal = Calendar.getInstance(), expectedCal = Calendar.getInstance(); actualCal.setTime(actual); expectedCal.setTime(expected); assertSameDay(actualCal, expectedCal, message); }
|
/**
* Asserts that two dates fall on same day. If they do not, an
* AssertionError, with the given message, is thrown.
*
* @param actual the actual value
* @param expected the expected value
* @param message the assertion error message
*/
|
Asserts that two dates fall on same day. If they do not, an AssertionError, with the given message, is thrown
|
assertSameDay
|
{
"repo_name": "osframework/testng-ext",
"path": "src/main/java/org/osframework/testng/Assert.java",
"license": "apache-2.0",
"size": 3590
}
|
[
"java.util.Calendar",
"java.util.Date"
] |
import java.util.Calendar; import java.util.Date;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 716,258 |
public List<BoxToken> getActiveTokens() {
List<BoxToken> retVal = new ArrayList<BoxToken>();
try {
List<Company> companies = companyLocalService.getCompanies();
boolean expired = false;
for (Company company : companies) {
long companyId = company.getCompanyId();
retVal.addAll(boxTokenPersistence.findByC_E(companyId, expired));
}
} catch (SystemException e) {
e.printStackTrace();
}
return retVal;
}
|
List<BoxToken> function() { List<BoxToken> retVal = new ArrayList<BoxToken>(); try { List<Company> companies = companyLocalService.getCompanies(); boolean expired = false; for (Company company : companies) { long companyId = company.getCompanyId(); retVal.addAll(boxTokenPersistence.findByC_E(companyId, expired)); } } catch (SystemException e) { e.printStackTrace(); } return retVal; }
|
/**
* NOTE FOR DEVELOPERS:
*
* Never reference this interface directly. Always use {@link com.bvakili.portlet.integration.box.service.BoxTokenLocalServiceUtil} to access the box token local service.
*/
|
Never reference this interface directly. Always use <code>com.bvakili.portlet.integration.box.service.BoxTokenLocalServiceUtil</code> to access the box token local service
|
getActiveTokens
|
{
"repo_name": "bmvakili/liferay-plugins-sdk-6.2.0-rc6",
"path": "portlets/BoxComIntegrationLiferay-portlet/docroot/WEB-INF/src/com/bvakili/portlet/integration/box/service/impl/BoxTokenLocalServiceImpl.java",
"license": "apache-2.0",
"size": 3991
}
|
[
"com.bvakili.portlet.integration.box.model.BoxToken",
"com.liferay.portal.kernel.exception.SystemException",
"com.liferay.portal.model.Company",
"java.util.ArrayList",
"java.util.List"
] |
import com.bvakili.portlet.integration.box.model.BoxToken; import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.model.Company; import java.util.ArrayList; import java.util.List;
|
import com.bvakili.portlet.integration.box.model.*; import com.liferay.portal.kernel.exception.*; import com.liferay.portal.model.*; import java.util.*;
|
[
"com.bvakili.portlet",
"com.liferay.portal",
"java.util"
] |
com.bvakili.portlet; com.liferay.portal; java.util;
| 1,801,218 |
@CheckReturnValue
@Beta
public MapSplitter withKeyValueSeparator(Splitter keyValueSplitter) {
return new MapSplitter(this, keyValueSplitter);
}
@Beta
public static final class MapSplitter {
private static final String INVALID_ENTRY_MESSAGE =
"Chunk [%s] is not a valid entry";
private final Splitter outerSplitter;
private final Splitter entrySplitter;
private MapSplitter(Splitter outerSplitter, Splitter entrySplitter) {
this.outerSplitter = outerSplitter; // only "this" is passed
this.entrySplitter = checkNotNull(entrySplitter);
}
|
MapSplitter function(Splitter keyValueSplitter) { return new MapSplitter(this, keyValueSplitter); } public static final class MapSplitter { private static final String INVALID_ENTRY_MESSAGE = STR; private final Splitter outerSplitter; private final Splitter entrySplitter; private MapSplitter(Splitter outerSplitter, Splitter entrySplitter) { this.outerSplitter = outerSplitter; this.entrySplitter = checkNotNull(entrySplitter); }
|
/**
* Returns a {@code MapSplitter} which splits entries based on this splitter,
* and splits entries into keys and values using the specified key-value
* splitter.
*
* @since 10.0
*/
|
Returns a MapSplitter which splits entries based on this splitter, and splits entries into keys and values using the specified key-value splitter
|
withKeyValueSeparator
|
{
"repo_name": "DARKPOP/external_guava",
"path": "guava/src/com/google/common/base/Splitter.java",
"license": "apache-2.0",
"size": 20329
}
|
[
"com.google.common.base.Preconditions"
] |
import com.google.common.base.Preconditions;
|
import com.google.common.base.*;
|
[
"com.google.common"
] |
com.google.common;
| 860,613 |
private void startConsumers() throws IOException {
// Create consumers but don't start yet
for (int i = 0; i < endpoint.getConcurrentConsumers(); i++) {
createConsumer();
}
// Try starting consumers (which will fail if RabbitMQ can't connect)
try {
for (RabbitConsumer consumer : this.consumers) {
consumer.start();
}
} catch (Exception e) {
log.info("Connection failed, will start background thread to retry!", e);
reconnect();
}
}
|
void function() throws IOException { for (int i = 0; i < endpoint.getConcurrentConsumers(); i++) { createConsumer(); } try { for (RabbitConsumer consumer : this.consumers) { consumer.start(); } } catch (Exception e) { log.info(STR, e); reconnect(); } }
|
/**
* Add a consumer thread for given channel
*/
|
Add a consumer thread for given channel
|
startConsumers
|
{
"repo_name": "sebi-hgdata/camel",
"path": "components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQConsumer.java",
"license": "apache-2.0",
"size": 7015
}
|
[
"java.io.IOException"
] |
import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 545,821 |
@SuppressWarnings("unchecked")
private static <T> T doInvokeMethod(Object tested, Class<?> declaringClass, String methodToExecute,
Object... arguments) throws Exception {
Method methodToInvoke = findMethodOrThrowException(tested, declaringClass, methodToExecute, arguments);
// Invoke test
return (T) performMethodInvocation(tested, methodToInvoke, arguments);
}
|
@SuppressWarnings(STR) static <T> T function(Object tested, Class<?> declaringClass, String methodToExecute, Object... arguments) throws Exception { Method methodToInvoke = findMethodOrThrowException(tested, declaringClass, methodToExecute, arguments); return (T) performMethodInvocation(tested, methodToInvoke, arguments); }
|
/**
* Do invoke method.
*
* @param <T> the generic type
* @param tested the tested
* @param declaringClass the declaring class
* @param methodToExecute the method to execute
* @param arguments the arguments
* @return the t
* @throws Exception the exception
*/
|
Do invoke method
|
doInvokeMethod
|
{
"repo_name": "jayway/powermock",
"path": "powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java",
"license": "apache-2.0",
"size": 115150
}
|
[
"java.lang.reflect.Method"
] |
import java.lang.reflect.Method;
|
import java.lang.reflect.*;
|
[
"java.lang"
] |
java.lang;
| 968,461 |
@Test (timeout=300000)
public void testOfflineSnapshotRegionOperationsIndependent() throws Exception {
runTestRegionOperationsIndependent(false);
}
|
@Test (timeout=300000) void function() throws Exception { runTestRegionOperationsIndependent(false); }
|
/**
* Verify that region operations, in this case splitting a region, are independent between the
* cloned table and the original.
*/
|
Verify that region operations, in this case splitting a region, are independent between the cloned table and the original
|
testOfflineSnapshotRegionOperationsIndependent
|
{
"repo_name": "juwi/hbase",
"path": "hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMobSnapshotCloneIndependence.java",
"license": "apache-2.0",
"size": 17790
}
|
[
"org.junit.Test"
] |
import org.junit.Test;
|
import org.junit.*;
|
[
"org.junit"
] |
org.junit;
| 1,051,651 |
EReference getDocumentRoot_LockFeature();
|
EReference getDocumentRoot_LockFeature();
|
/**
* Returns the meta object for the containment reference '{@link net.opengis.wfs20.DocumentRoot#getLockFeature <em>Lock Feature</em>}'. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @return the meta object for the containment reference '<em>Lock Feature</em>'.
* @see net.opengis.wfs20.DocumentRoot#getLockFeature()
* @see #getDocumentRoot()
* @generated
*/
|
Returns the meta object for the containment reference '<code>net.opengis.wfs20.DocumentRoot#getLockFeature Lock Feature</code>'.
|
getDocumentRoot_LockFeature
|
{
"repo_name": "geotools/geotools",
"path": "modules/ogc/net.opengis.wfs/src/net/opengis/wfs20/Wfs20Package.java",
"license": "lgpl-2.1",
"size": 404067
}
|
[
"org.eclipse.emf.ecore.EReference"
] |
import org.eclipse.emf.ecore.EReference;
|
import org.eclipse.emf.ecore.*;
|
[
"org.eclipse.emf"
] |
org.eclipse.emf;
| 1,181,428 |
public boolean next() throws IOException {
Stopwatch timer = Stopwatch.createUnstarted();
currentPageCount = -1;
valuesRead = 0;
valuesReadyToRead = 0;
// TODO - the metatdata for total size appears to be incorrect for impala generated files, need to find cause
// and submit a bug report
if(!dataReader.hasRemainder() || parentColumnReader.totalValuesRead == parentColumnReader.columnChunkMetaData.getValueCount()) {
return false;
}
clearBuffers();
// next, we need to decompress the bytes
// TODO - figure out if we need multiple dictionary pages, I believe it may be limited to one
// I think we are clobbering parts of the dictionary if there can be multiple pages of dictionary
do {
long start=inputStream.getPos();
timer.start();
pageHeader = dataReader.readPageHeader();
long timeToRead = timer.elapsed(TimeUnit.MICROSECONDS);
this.updateStats(pageHeader, "Page Header Read", start, timeToRead, 0,0);
if (logger.isTraceEnabled()) {
logger.trace("ParquetTrace,{},{},{},{},{},{},{},{}", "Page Header Read", "",
this.parentColumnReader.parentReader.fsPath,
this.parentColumnReader.columnDescriptor, start, 0, 0, timeToRead);
}
timer.reset();
if (pageHeader.getType() == PageType.DICTIONARY_PAGE) {
readDictionaryPage(pageHeader, parentColumnReader);
}
} while (pageHeader.getType() == PageType.DICTIONARY_PAGE);
//TODO: Handle buffer allocation exception
allocatePageData(pageHeader.getUncompressed_page_size());
int compressedSize = pageHeader.getCompressed_page_size();
int uncompressedSize = pageHeader.getUncompressed_page_size();
readPage(pageHeader, compressedSize, uncompressedSize, pageData);
currentPageCount = pageHeader.data_page_header.num_values;
final Encoding rlEncoding = METADATA_CONVERTER.getEncoding(pageHeader.data_page_header.repetition_level_encoding);
final Encoding dlEncoding = METADATA_CONVERTER.getEncoding(pageHeader.data_page_header.definition_level_encoding);
final Encoding valueEncoding = METADATA_CONVERTER.getEncoding(pageHeader.data_page_header.encoding);
byteLength = pageHeader.uncompressed_page_size;
final ByteBuffer pageDataBuffer = pageData.nioBuffer(0, LargeMemoryUtil.checkedCastToInt(pageData.capacity()));
readPosInBytes = 0;
if (parentColumnReader.getColumnDescriptor().getMaxRepetitionLevel() > 0) {
repetitionLevels = rlEncoding.getValuesReader(parentColumnReader.columnDescriptor, ValuesType.REPETITION_LEVEL);
repetitionLevels.initFromPage(currentPageCount, pageDataBuffer, (int) readPosInBytes);
// we know that the first value will be a 0, at the end of each list of repeated values we will hit another 0 indicating
// a new record, although we don't know the length until we hit it (and this is a one way stream of integers) so we
// read the first zero here to simplify the reading processes, and start reading the first value the same as all
// of the rest. Effectively we are 'reading' the non-existent value in front of the first allowing direct access to
// the first list of repetition levels
readPosInBytes = repetitionLevels.getNextOffset();
repetitionLevels.readInteger();
}
if (parentColumnReader.columnDescriptor.getMaxDefinitionLevel() != 0){
parentColumnReader.currDefLevel = -1;
definitionLevels = dlEncoding.getValuesReader(parentColumnReader.columnDescriptor, ValuesType.DEFINITION_LEVEL);
definitionLevels.initFromPage(currentPageCount, pageDataBuffer, (int) readPosInBytes);
readPosInBytes = definitionLevels.getNextOffset();
if (!valueEncoding.usesDictionary()) {
valueReader = valueEncoding.getValuesReader(parentColumnReader.columnDescriptor, ValuesType.VALUES);
valueReader.initFromPage(currentPageCount, pageDataBuffer, (int) readPosInBytes);
}
}
if (parentColumnReader.columnDescriptor.getType() == PrimitiveType.PrimitiveTypeName.BOOLEAN) {
valueReader = valueEncoding.getValuesReader(parentColumnReader.columnDescriptor, ValuesType.VALUES);
valueReader.initFromPage(currentPageCount, pageDataBuffer, (int) readPosInBytes);
}
if (valueEncoding.usesDictionary()) {
// initialize two of the dictionary readers, one is for determining the lengths of each value, the second is for
// actually copying the values out into the vectors
dictionaryLengthDeterminingReader = new DictionaryValuesReader(dictionary);
dictionaryLengthDeterminingReader.initFromPage(currentPageCount, pageDataBuffer, (int) readPosInBytes);
dictionaryValueReader = new DictionaryValuesReader(dictionary);
dictionaryValueReader.initFromPage(currentPageCount, pageDataBuffer, (int) readPosInBytes);
parentColumnReader.usingDictionary = true;
} else {
parentColumnReader.usingDictionary = false;
}
// readPosInBytes is used for actually reading the values after we determine how many will fit in the vector
// readyToReadPosInBytes serves a similar purpose for the vector types where we must count up the values that will
// fit one record at a time, such as for variable length data. Both operations must start in the same location after the
// definition and repetition level data which is stored alongside the page data itself
readyToReadPosInBytes = readPosInBytes;
return true;
}
|
boolean function() throws IOException { Stopwatch timer = Stopwatch.createUnstarted(); currentPageCount = -1; valuesRead = 0; valuesReadyToRead = 0; if(!dataReader.hasRemainder() parentColumnReader.totalValuesRead == parentColumnReader.columnChunkMetaData.getValueCount()) { return false; } clearBuffers(); do { long start=inputStream.getPos(); timer.start(); pageHeader = dataReader.readPageHeader(); long timeToRead = timer.elapsed(TimeUnit.MICROSECONDS); this.updateStats(pageHeader, STR, start, timeToRead, 0,0); if (logger.isTraceEnabled()) { logger.trace(STR, STR, "", this.parentColumnReader.parentReader.fsPath, this.parentColumnReader.columnDescriptor, start, 0, 0, timeToRead); } timer.reset(); if (pageHeader.getType() == PageType.DICTIONARY_PAGE) { readDictionaryPage(pageHeader, parentColumnReader); } } while (pageHeader.getType() == PageType.DICTIONARY_PAGE); allocatePageData(pageHeader.getUncompressed_page_size()); int compressedSize = pageHeader.getCompressed_page_size(); int uncompressedSize = pageHeader.getUncompressed_page_size(); readPage(pageHeader, compressedSize, uncompressedSize, pageData); currentPageCount = pageHeader.data_page_header.num_values; final Encoding rlEncoding = METADATA_CONVERTER.getEncoding(pageHeader.data_page_header.repetition_level_encoding); final Encoding dlEncoding = METADATA_CONVERTER.getEncoding(pageHeader.data_page_header.definition_level_encoding); final Encoding valueEncoding = METADATA_CONVERTER.getEncoding(pageHeader.data_page_header.encoding); byteLength = pageHeader.uncompressed_page_size; final ByteBuffer pageDataBuffer = pageData.nioBuffer(0, LargeMemoryUtil.checkedCastToInt(pageData.capacity())); readPosInBytes = 0; if (parentColumnReader.getColumnDescriptor().getMaxRepetitionLevel() > 0) { repetitionLevels = rlEncoding.getValuesReader(parentColumnReader.columnDescriptor, ValuesType.REPETITION_LEVEL); repetitionLevels.initFromPage(currentPageCount, pageDataBuffer, (int) readPosInBytes); readPosInBytes = repetitionLevels.getNextOffset(); repetitionLevels.readInteger(); } if (parentColumnReader.columnDescriptor.getMaxDefinitionLevel() != 0){ parentColumnReader.currDefLevel = -1; definitionLevels = dlEncoding.getValuesReader(parentColumnReader.columnDescriptor, ValuesType.DEFINITION_LEVEL); definitionLevels.initFromPage(currentPageCount, pageDataBuffer, (int) readPosInBytes); readPosInBytes = definitionLevels.getNextOffset(); if (!valueEncoding.usesDictionary()) { valueReader = valueEncoding.getValuesReader(parentColumnReader.columnDescriptor, ValuesType.VALUES); valueReader.initFromPage(currentPageCount, pageDataBuffer, (int) readPosInBytes); } } if (parentColumnReader.columnDescriptor.getType() == PrimitiveType.PrimitiveTypeName.BOOLEAN) { valueReader = valueEncoding.getValuesReader(parentColumnReader.columnDescriptor, ValuesType.VALUES); valueReader.initFromPage(currentPageCount, pageDataBuffer, (int) readPosInBytes); } if (valueEncoding.usesDictionary()) { dictionaryLengthDeterminingReader = new DictionaryValuesReader(dictionary); dictionaryLengthDeterminingReader.initFromPage(currentPageCount, pageDataBuffer, (int) readPosInBytes); dictionaryValueReader = new DictionaryValuesReader(dictionary); dictionaryValueReader.initFromPage(currentPageCount, pageDataBuffer, (int) readPosInBytes); parentColumnReader.usingDictionary = true; } else { parentColumnReader.usingDictionary = false; } readyToReadPosInBytes = readPosInBytes; return true; }
|
/**
* Grab the next page.
*
* @return - if another page was present
* @throws java.io.IOException
*/
|
Grab the next page
|
next
|
{
"repo_name": "dremio/dremio-oss",
"path": "sabot/kernel/src/main/java/com/dremio/exec/store/parquet/columnreaders/PageReader.java",
"license": "apache-2.0",
"size": 18225
}
|
[
"com.google.common.base.Stopwatch",
"java.io.IOException",
"java.nio.ByteBuffer",
"java.util.concurrent.TimeUnit",
"org.apache.arrow.memory.util.LargeMemoryUtil",
"org.apache.parquet.column.Encoding",
"org.apache.parquet.column.ValuesType",
"org.apache.parquet.column.values.dictionary.DictionaryValuesReader",
"org.apache.parquet.format.PageType",
"org.apache.parquet.schema.PrimitiveType"
] |
import com.google.common.base.Stopwatch; import java.io.IOException; import java.nio.ByteBuffer; import java.util.concurrent.TimeUnit; import org.apache.arrow.memory.util.LargeMemoryUtil; import org.apache.parquet.column.Encoding; import org.apache.parquet.column.ValuesType; import org.apache.parquet.column.values.dictionary.DictionaryValuesReader; import org.apache.parquet.format.PageType; import org.apache.parquet.schema.PrimitiveType;
|
import com.google.common.base.*; import java.io.*; import java.nio.*; import java.util.concurrent.*; import org.apache.arrow.memory.util.*; import org.apache.parquet.column.*; import org.apache.parquet.column.values.dictionary.*; import org.apache.parquet.format.*; import org.apache.parquet.schema.*;
|
[
"com.google.common",
"java.io",
"java.nio",
"java.util",
"org.apache.arrow",
"org.apache.parquet"
] |
com.google.common; java.io; java.nio; java.util; org.apache.arrow; org.apache.parquet;
| 1,458,851 |
@Override
public NotificationHubGetResponse get(String resourceGroupName, String namespaceName, String notificationHubName) throws IOException, ServiceException {
// Validate
if (resourceGroupName == null) {
throw new NullPointerException("resourceGroupName");
}
if (namespaceName == null) {
throw new NullPointerException("namespaceName");
}
if (notificationHubName == null) {
throw new NullPointerException("notificationHubName");
}
// Tracing
boolean shouldTrace = CloudTracing.getIsEnabled();
String invocationId = null;
if (shouldTrace) {
invocationId = Long.toString(CloudTracing.getNextInvocationId());
HashMap<String, Object> tracingParameters = new HashMap<String, Object>();
tracingParameters.put("resourceGroupName", resourceGroupName);
tracingParameters.put("namespaceName", namespaceName);
tracingParameters.put("notificationHubName", notificationHubName);
CloudTracing.enter(invocationId, this, "getAsync", tracingParameters);
}
// Construct URL
String url = "";
url = url + "/subscriptions/";
if (this.getClient().getCredentials().getSubscriptionId() != null) {
url = url + URLEncoder.encode(this.getClient().getCredentials().getSubscriptionId(), "UTF-8");
}
url = url + "/resourceGroups/";
url = url + URLEncoder.encode(resourceGroupName, "UTF-8");
url = url + "/providers/";
url = url + "Microsoft.NotificationHubs";
url = url + "/namespaces/";
url = url + URLEncoder.encode(namespaceName, "UTF-8");
url = url + "/notificationHubs/";
url = url + URLEncoder.encode(notificationHubName, "UTF-8");
ArrayList<String> queryParameters = new ArrayList<String>();
queryParameters.add("api-version=" + "2014-09-01");
if (queryParameters.size() > 0) {
url = url + "?" + CollectionStringBuilder.join(queryParameters, "&");
}
String baseUrl = this.getClient().getBaseUri().toString();
// Trim '/' character from the end of baseUrl and beginning of url.
if (baseUrl.charAt(baseUrl.length() - 1) == '/') {
baseUrl = baseUrl.substring(0, (baseUrl.length() - 1) + 0);
}
if (url.charAt(0) == '/') {
url = url.substring(1);
}
url = baseUrl + "/" + url;
url = url.replace(" ", "%20");
// Create HTTP transport objects
HttpGet httpRequest = new HttpGet(url);
// Set Headers
// Send Request
HttpResponse httpResponse = null;
try {
if (shouldTrace) {
CloudTracing.sendRequest(invocationId, httpRequest);
}
httpResponse = this.getClient().getHttpClient().execute(httpRequest);
if (shouldTrace) {
CloudTracing.receiveResponse(invocationId, httpResponse);
}
int statusCode = httpResponse.getStatusLine().getStatusCode();
if (statusCode != HttpStatus.SC_OK) {
ServiceException ex = ServiceException.createFromJson(httpRequest, null, httpResponse, httpResponse.getEntity());
if (shouldTrace) {
CloudTracing.error(invocationId, ex);
}
throw ex;
}
// Create Result
NotificationHubGetResponse result = null;
// Deserialize Response
if (statusCode == HttpStatus.SC_OK) {
InputStream responseContent = httpResponse.getEntity().getContent();
result = new NotificationHubGetResponse();
ObjectMapper objectMapper = new ObjectMapper();
JsonNode responseDoc = null;
if (responseContent == null == false) {
responseDoc = objectMapper.readTree(responseContent);
}
if (responseDoc != null && responseDoc instanceof NullNode == false) {
NotificationHubResource valueInstance = new NotificationHubResource();
result.setValue(valueInstance);
JsonNode idValue = responseDoc.get("id");
if (idValue != null && idValue instanceof NullNode == false) {
String idInstance;
idInstance = idValue.getTextValue();
valueInstance.setId(idInstance);
}
JsonNode locationValue = responseDoc.get("location");
if (locationValue != null && locationValue instanceof NullNode == false) {
String locationInstance;
locationInstance = locationValue.getTextValue();
valueInstance.setLocation(locationInstance);
}
JsonNode nameValue = responseDoc.get("name");
if (nameValue != null && nameValue instanceof NullNode == false) {
String nameInstance;
nameInstance = nameValue.getTextValue();
valueInstance.setName(nameInstance);
}
JsonNode typeValue = responseDoc.get("type");
if (typeValue != null && typeValue instanceof NullNode == false) {
String typeInstance;
typeInstance = typeValue.getTextValue();
valueInstance.setType(typeInstance);
}
JsonNode tagsSequenceElement = ((JsonNode) responseDoc.get("tags"));
if (tagsSequenceElement != null && tagsSequenceElement instanceof NullNode == false) {
Iterator<Map.Entry<String, JsonNode>> itr = tagsSequenceElement.getFields();
while (itr.hasNext()) {
Map.Entry<String, JsonNode> property = itr.next();
String tagsKey = property.getKey();
String tagsValue = property.getValue().getTextValue();
valueInstance.getTags().put(tagsKey, tagsValue);
}
}
JsonNode propertiesValue = responseDoc.get("properties");
if (propertiesValue != null && propertiesValue instanceof NullNode == false) {
NotificationHubProperties propertiesInstance = new NotificationHubProperties();
valueInstance.setProperties(propertiesInstance);
}
}
}
result.setStatusCode(statusCode);
if (httpResponse.getHeaders("x-ms-request-id").length > 0) {
result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue());
}
if (shouldTrace) {
CloudTracing.exit(invocationId, result);
}
return result;
} finally {
if (httpResponse != null && httpResponse.getEntity() != null) {
httpResponse.getEntity().getContent().close();
}
}
}
|
NotificationHubGetResponse function(String resourceGroupName, String namespaceName, String notificationHubName) throws IOException, ServiceException { if (resourceGroupName == null) { throw new NullPointerException(STR); } if (namespaceName == null) { throw new NullPointerException(STR); } if (notificationHubName == null) { throw new NullPointerException(STR); } boolean shouldTrace = CloudTracing.getIsEnabled(); String invocationId = null; if (shouldTrace) { invocationId = Long.toString(CloudTracing.getNextInvocationId()); HashMap<String, Object> tracingParameters = new HashMap<String, Object>(); tracingParameters.put(STR, resourceGroupName); tracingParameters.put(STR, namespaceName); tracingParameters.put(STR, notificationHubName); CloudTracing.enter(invocationId, this, STR, tracingParameters); } String url = STR/subscriptions/STRUTF-8STR/resourceGroups/STRUTF-8STR/providers/STRMicrosoft.NotificationHubsSTR/namespaces/STRUTF-8STR/notificationHubs/STRUTF-8STRapi-version=STR2014-09-01STR?STR&STR/STR STR%20STRidSTRlocationSTRnameSTRtypeSTRtagsSTRpropertiesSTRx-ms-request-idSTRx-ms-request-id").getValue()); } if (shouldTrace) { CloudTracing.exit(invocationId, result); } return result; } finally { if (httpResponse != null && httpResponse.getEntity() != null) { httpResponse.getEntity().getContent().close(); } } }
|
/**
* Lists the notification hubs associated with a namespace.
*
* @param resourceGroupName Required. The name of the resource group.
* @param namespaceName Required. The namespace name.
* @param notificationHubName Required. The notification hub name.
* @throws IOException Signals that an I/O exception of some sort has
* occurred. This class is the general class of exceptions produced by
* failed or interrupted I/O operations.
* @throws ServiceException Thrown if an unexpected response is found.
* @return The response of the Get NotificationHub operation.
*/
|
Lists the notification hubs associated with a namespace
|
get
|
{
"repo_name": "flydream2046/azure-sdk-for-java",
"path": "service-management/azure-svc-mgmt-notificationhubs/src/main/java/com/microsoft/azure/management/notificationhubs/NotificationHubOperationsImpl.java",
"license": "apache-2.0",
"size": 120338
}
|
[
"com.microsoft.azure.management.notificationhubs.models.NotificationHubGetResponse",
"com.microsoft.windowsazure.exception.ServiceException",
"com.microsoft.windowsazure.tracing.CloudTracing",
"java.io.IOException",
"java.util.HashMap"
] |
import com.microsoft.azure.management.notificationhubs.models.NotificationHubGetResponse; import com.microsoft.windowsazure.exception.ServiceException; import com.microsoft.windowsazure.tracing.CloudTracing; import java.io.IOException; import java.util.HashMap;
|
import com.microsoft.azure.management.notificationhubs.models.*; import com.microsoft.windowsazure.exception.*; import com.microsoft.windowsazure.tracing.*; import java.io.*; import java.util.*;
|
[
"com.microsoft.azure",
"com.microsoft.windowsazure",
"java.io",
"java.util"
] |
com.microsoft.azure; com.microsoft.windowsazure; java.io; java.util;
| 2,140,046 |
public static HibernateValidatorConfiguration getConfiguration(Locale locale) {
return getConfiguration( HibernateValidator.class, locale );
}
|
static HibernateValidatorConfiguration function(Locale locale) { return getConfiguration( HibernateValidator.class, locale ); }
|
/**
* Returns the {@code Configuration} object for Hibernate Validator. This method also sets the default locale to
* the given locale.
*
* @param locale The default locale to set.
*
* @return an instance of {@code Configuration} for Hibernate Validator.
*/
|
Returns the Configuration object for Hibernate Validator. This method also sets the default locale to the given locale
|
getConfiguration
|
{
"repo_name": "hferentschik/hibernate-validator",
"path": "engine/src/test/java/org/hibernate/validator/testutil/ValidatorUtil.java",
"license": "apache-2.0",
"size": 9128
}
|
[
"java.util.Locale",
"org.hibernate.validator.HibernateValidator",
"org.hibernate.validator.HibernateValidatorConfiguration"
] |
import java.util.Locale; import org.hibernate.validator.HibernateValidator; import org.hibernate.validator.HibernateValidatorConfiguration;
|
import java.util.*; import org.hibernate.validator.*;
|
[
"java.util",
"org.hibernate.validator"
] |
java.util; org.hibernate.validator;
| 2,396,122 |
protected void paintButtonPressed(Graphics g, AbstractButton b)
{
if (b.isContentAreaFilled())
{
g.setColor(getSelectColor());
g.fillRect(0, 0, b.getWidth(), b.getHeight());
}
}
|
void function(Graphics g, AbstractButton b) { if (b.isContentAreaFilled()) { g.setColor(getSelectColor()); g.fillRect(0, 0, b.getWidth(), b.getHeight()); } }
|
/**
* Paints the background of the button to indicate that it is in the
* "pressed" state.
*
* @param g the graphics context.
* @param b the button.
*/
|
Paints the background of the button to indicate that it is in the "pressed" state
|
paintButtonPressed
|
{
"repo_name": "taciano-perez/JamVM-PH",
"path": "src/classpath/javax/swing/plaf/metal/MetalButtonUI.java",
"license": "gpl-2.0",
"size": 8643
}
|
[
"java.awt.Graphics",
"javax.swing.AbstractButton"
] |
import java.awt.Graphics; import javax.swing.AbstractButton;
|
import java.awt.*; import javax.swing.*;
|
[
"java.awt",
"javax.swing"
] |
java.awt; javax.swing;
| 201,137 |
@SuppressWarnings({"unchecked", "TypeParameterUnusedInFormals"})
public static <T> T waitForFragment(Activity activity, String fragmentTag)
throws InterruptedException {
CriteriaHelper.pollInstrumentationThread(new FragmentPresentCriteria(activity, fragmentTag),
ACTIVITY_START_TIMEOUT_MS, CONDITION_POLL_INTERVAL_MS);
return (T) activity.getFragmentManager().findFragmentByTag(fragmentTag);
}
|
@SuppressWarnings({STR, STR}) static <T> T function(Activity activity, String fragmentTag) throws InterruptedException { CriteriaHelper.pollInstrumentationThread(new FragmentPresentCriteria(activity, fragmentTag), ACTIVITY_START_TIMEOUT_MS, CONDITION_POLL_INTERVAL_MS); return (T) activity.getFragmentManager().findFragmentByTag(fragmentTag); }
|
/**
* Waits for a fragment to be registered by the specified activity.
*
* @param activity The activity that owns the fragment.
* @param fragmentTag The tag of the fragment to be loaded.
*/
|
Waits for a fragment to be registered by the specified activity
|
waitForFragment
|
{
"repo_name": "danakj/chromium",
"path": "chrome/test/android/javatests/src/org/chromium/chrome/test/util/ActivityUtils.java",
"license": "bsd-3-clause",
"size": 5467
}
|
[
"android.app.Activity",
"org.chromium.content.browser.test.util.CriteriaHelper"
] |
import android.app.Activity; import org.chromium.content.browser.test.util.CriteriaHelper;
|
import android.app.*; import org.chromium.content.browser.test.util.*;
|
[
"android.app",
"org.chromium.content"
] |
android.app; org.chromium.content;
| 681,737 |
@ServiceMethod(returns = ReturnType.SINGLE)
TemplateHashResultInner calculateTemplateHash(Object template);
|
@ServiceMethod(returns = ReturnType.SINGLE) TemplateHashResultInner calculateTemplateHash(Object template);
|
/**
* Calculate the hash of the given template.
*
* @param template The template provided to calculate hash.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the request to calculate template hash.
*/
|
Calculate the hash of the given template
|
calculateTemplateHash
|
{
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/fluent/DeploymentsClient.java",
"license": "mit",
"size": 218889
}
|
[
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.resourcemanager.resources.fluent.models.TemplateHashResultInner"
] |
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.resources.fluent.models.TemplateHashResultInner;
|
import com.azure.core.annotation.*; import com.azure.resourcemanager.resources.fluent.models.*;
|
[
"com.azure.core",
"com.azure.resourcemanager"
] |
com.azure.core; com.azure.resourcemanager;
| 217,599 |
public static void configureDB(Configuration conf, String driverClass,
String dbUrl, String userName, String passwd) {
configureDB(conf, driverClass, dbUrl, userName, passwd, null);
}
|
static void function(Configuration conf, String driverClass, String dbUrl, String userName, String passwd) { configureDB(conf, driverClass, dbUrl, userName, passwd, null); }
|
/**
* Sets the DB access related fields in the {@link Configuration}.
* @param conf the configuration
* @param driverClass JDBC Driver class name
* @param dbUrl JDBC DB access URL
* @param userName DB access username
* @param passwd DB access passwd
*/
|
Sets the DB access related fields in the <code>Configuration</code>
|
configureDB
|
{
"repo_name": "infinidb/sqoop",
"path": "src/java/org/apache/sqoop/mapreduce/db/DBConfiguration.java",
"license": "apache-2.0",
"size": 9921
}
|
[
"org.apache.hadoop.conf.Configuration"
] |
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.*;
|
[
"org.apache.hadoop"
] |
org.apache.hadoop;
| 1,543,106 |
NestedSet<Artifact> getFilesToCompile(
boolean isLipoContextCollector, boolean parseHeaders, boolean usePic) {
if (isLipoContextCollector) {
return NestedSetBuilder.<Artifact>emptySet(Order.STABLE_ORDER);
}
NestedSetBuilder<Artifact> files = NestedSetBuilder.stableOrder();
files.addAll(getObjectFiles(usePic));
if (parseHeaders) {
files.addAll(getHeaderTokenFiles());
}
return files.build();
}
public static final class Builder {
private final Set<Artifact> objectFiles = new LinkedHashSet<>();
private final Set<Artifact> picObjectFiles = new LinkedHashSet<>();
private final ImmutableMap.Builder<Artifact, Artifact> ltoBitcodeFiles = ImmutableMap.builder();
private final Set<Artifact> dwoFiles = new LinkedHashSet<>();
private final Set<Artifact> picDwoFiles = new LinkedHashSet<>();
private final NestedSetBuilder<Artifact> temps = NestedSetBuilder.stableOrder();
private final Set<Artifact> headerTokenFiles = new LinkedHashSet<>();
private final List<IncludeScannable> lipoScannables = new ArrayList<>();
|
NestedSet<Artifact> getFilesToCompile( boolean isLipoContextCollector, boolean parseHeaders, boolean usePic) { if (isLipoContextCollector) { return NestedSetBuilder.<Artifact>emptySet(Order.STABLE_ORDER); } NestedSetBuilder<Artifact> files = NestedSetBuilder.stableOrder(); files.addAll(getObjectFiles(usePic)); if (parseHeaders) { files.addAll(getHeaderTokenFiles()); } return files.build(); } public static final class Builder { private final Set<Artifact> objectFiles = new LinkedHashSet<>(); private final Set<Artifact> picObjectFiles = new LinkedHashSet<>(); private final ImmutableMap.Builder<Artifact, Artifact> ltoBitcodeFiles = ImmutableMap.builder(); private final Set<Artifact> dwoFiles = new LinkedHashSet<>(); private final Set<Artifact> picDwoFiles = new LinkedHashSet<>(); private final NestedSetBuilder<Artifact> temps = NestedSetBuilder.stableOrder(); private final Set<Artifact> headerTokenFiles = new LinkedHashSet<>(); private final List<IncludeScannable> lipoScannables = new ArrayList<>();
|
/**
* Returns the output files that are considered "compiled" by this C++ compile action.
*/
|
Returns the output files that are considered "compiled" by this C++ compile action
|
getFilesToCompile
|
{
"repo_name": "spxtr/bazel",
"path": "src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationOutputs.java",
"license": "apache-2.0",
"size": 8888
}
|
[
"com.google.common.collect.ImmutableMap",
"com.google.devtools.build.lib.actions.Artifact",
"com.google.devtools.build.lib.collect.nestedset.NestedSet",
"com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder",
"com.google.devtools.build.lib.collect.nestedset.Order",
"java.util.ArrayList",
"java.util.LinkedHashSet",
"java.util.List",
"java.util.Set"
] |
import com.google.common.collect.ImmutableMap; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.collect.nestedset.NestedSet; import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder; import com.google.devtools.build.lib.collect.nestedset.Order; import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.List; import java.util.Set;
|
import com.google.common.collect.*; import com.google.devtools.build.lib.actions.*; import com.google.devtools.build.lib.collect.nestedset.*; import java.util.*;
|
[
"com.google.common",
"com.google.devtools",
"java.util"
] |
com.google.common; com.google.devtools; java.util;
| 2,165,661 |
protected final void clearSection(int offset, int length)
{
Arrays.fill(pageData, offset, offset + length, (byte) 0);
}
|
final void function(int offset, int length) { Arrays.fill(pageData, offset, offset + length, (byte) 0); }
|
/**
* Zero out a portion of the page.
*
* @param offset position of first byte to clear
* @param length how many bytes to clear
**/
|
Zero out a portion of the page
|
clearSection
|
{
"repo_name": "viaper/DBPlus",
"path": "DerbyHodgepodge/java/engine/org/apache/derby/impl/store/raw/data/StoredPage.java",
"license": "apache-2.0",
"size": 356248
}
|
[
"java.util.Arrays"
] |
import java.util.Arrays;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,847,073 |
public void setVehicleTableModel(VehicleTableModel model) {
this.vehicleTable.setModel(this.model = Preconditions.checkNotNull(model));
}
|
void function(VehicleTableModel model) { this.vehicleTable.setModel(this.model = Preconditions.checkNotNull(model)); }
|
/**
* Installs the new table model for the vehicle table.
*
* @param model The new model.
*/
|
Installs the new table model for the vehicle table
|
setVehicleTableModel
|
{
"repo_name": "zyxist/opentrans",
"path": "opentrans-lightweight/src/main/java/org/invenzzia/opentrans/lightweight/ui/tabs/vehicles/VehicleTab.java",
"license": "gpl-3.0",
"size": 14436
}
|
[
"com.google.common.base.Preconditions"
] |
import com.google.common.base.Preconditions;
|
import com.google.common.base.*;
|
[
"com.google.common"
] |
com.google.common;
| 2,340,082 |
public static CompletableFuture<Boolean> zkDeleteIfNotExist(ZooKeeperClient zkc, String path, LongVersion version) {
ZooKeeper zk;
try {
zk = zkc.get();
} catch (ZooKeeperClient.ZooKeeperConnectionException e) {
return FutureUtils.exception(zkException(e, path));
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return FutureUtils.exception(zkException(e, path));
}
|
static CompletableFuture<Boolean> function(ZooKeeperClient zkc, String path, LongVersion version) { ZooKeeper zk; try { zk = zkc.get(); } catch (ZooKeeperClient.ZooKeeperConnectionException e) { return FutureUtils.exception(zkException(e, path)); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return FutureUtils.exception(zkException(e, path)); }
|
/**
* Delete the given <i>path</i> from zookeeper.
*
* @param zkc
* zookeeper client
* @param path
* path to delete
* @param version
* version used to set data
* @return future representing if the delete is successful. Return true if the node is deleted,
* false if the node doesn't exist, otherwise future will throw exception
*
*/
|
Delete the given path from zookeeper
|
zkDeleteIfNotExist
|
{
"repo_name": "sijie/bookkeeper",
"path": "stream/distributedlog/core/src/main/java/org/apache/distributedlog/util/Utils.java",
"license": "apache-2.0",
"size": 30421
}
|
[
"java.util.concurrent.CompletableFuture",
"org.apache.bookkeeper.common.concurrent.FutureUtils",
"org.apache.bookkeeper.versioning.LongVersion",
"org.apache.distributedlog.ZooKeeperClient",
"org.apache.zookeeper.ZooKeeper"
] |
import java.util.concurrent.CompletableFuture; import org.apache.bookkeeper.common.concurrent.FutureUtils; import org.apache.bookkeeper.versioning.LongVersion; import org.apache.distributedlog.ZooKeeperClient; import org.apache.zookeeper.ZooKeeper;
|
import java.util.concurrent.*; import org.apache.bookkeeper.common.concurrent.*; import org.apache.bookkeeper.versioning.*; import org.apache.distributedlog.*; import org.apache.zookeeper.*;
|
[
"java.util",
"org.apache.bookkeeper",
"org.apache.distributedlog",
"org.apache.zookeeper"
] |
java.util; org.apache.bookkeeper; org.apache.distributedlog; org.apache.zookeeper;
| 2,018,265 |
new Main().run(args);
}
|
new Main().run(args); }
|
/**
* Allow this route to be run as an application
*/
|
Allow this route to be run as an application
|
main
|
{
"repo_name": "YMartsynkevych/camel",
"path": "examples/camel-example-spring-javaconfig/src/main/java/org/apache/camel/example/spring/javaconfig/MyRouteConfig.java",
"license": "apache-2.0",
"size": 3587
}
|
[
"org.apache.camel.spring.javaconfig.Main"
] |
import org.apache.camel.spring.javaconfig.Main;
|
import org.apache.camel.spring.javaconfig.*;
|
[
"org.apache.camel"
] |
org.apache.camel;
| 2,337,567 |
ArrayList<String> getStringArrayList(String key) {
unparcel();
Object o = mMap.get(key);
if (o == null) {
return null;
}
try {
return (ArrayList<String>) o;
} catch (ClassCastException e) {
typeWarning(key, o, "ArrayList<String>", e);
return null;
}
}
|
ArrayList<String> getStringArrayList(String key) { unparcel(); Object o = mMap.get(key); if (o == null) { return null; } try { return (ArrayList<String>) o; } catch (ClassCastException e) { typeWarning(key, o, STR, e); return null; } }
|
/**
* Returns the value associated with the given key, or null if
* no mapping of the desired type exists for the given key or a null
* value is explicitly associated with the key.
*
* @param key a String, or null
* @return an ArrayList<String> value, or null
*/
|
Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key
|
getStringArrayList
|
{
"repo_name": "s20121035/rk3288_android5.1_repo",
"path": "frameworks/base/core/java/android/os/BaseBundle.java",
"license": "gpl-3.0",
"size": 40770
}
|
[
"java.util.ArrayList"
] |
import java.util.ArrayList;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,601,860 |
public boolean saveAs() {
File f;
FreeMindFileDialog chooser = getFileChooser();
if (getMapsParentFile() == null) {
chooser.setSelectedFile(new File(getFileNameProposal()
+ freemind.main.FreeMindCommon.FREEMIND_FILE_EXTENSION));
}
chooser.setDialogTitle(getText("save_as"));
boolean repeatSaveAsQuestion;
do {
repeatSaveAsQuestion = false;
int returnVal = chooser.showSaveDialog(getView());
if (returnVal != JFileChooser.APPROVE_OPTION) {// not ok pressed
return false;
}
// |= Pressed O.K.
f = chooser.getSelectedFile();
lastCurrentDir = f.getParentFile();
// Force the extension to be .mm
String ext = Tools.getExtension(f.getName());
if (!ext.equals(freemind.main.FreeMindCommon.FREEMIND_FILE_EXTENSION_WITHOUT_DOT)) {
f = new File(f.getParent(), f.getName()
+ freemind.main.FreeMindCommon.FREEMIND_FILE_EXTENSION);
}
if (f.exists()) { // If file exists, ask before overwriting.
int overwriteMap = JOptionPane.showConfirmDialog(getView(),
getText("map_already_exists"), "FreeMind",
JOptionPane.YES_NO_OPTION);
if (overwriteMap != JOptionPane.YES_OPTION) {
// repeat the save as dialog.
repeatSaveAsQuestion = true;
}
}
} while (repeatSaveAsQuestion);
try { // We have to lock the file of the map even when it does not exist
// yet
String lockingUser = getModel().tryToLock(f);
if (lockingUser != null) {
getFrame().getController().informationMessage(
Tools.expandPlaceholders(
getText("map_locked_by_save_as"), f.getName(),
lockingUser));
return false;
}
} catch (Exception e) { // Throwed by tryToLock
getFrame().getController().informationMessage(
Tools.expandPlaceholders(
getText("locking_failed_by_save_as"), f.getName()));
return false;
}
save(f);
// Update the name of the map
getController().getMapModuleManager().updateMapModuleName();
return true;
}
|
boolean function() { File f; FreeMindFileDialog chooser = getFileChooser(); if (getMapsParentFile() == null) { chooser.setSelectedFile(new File(getFileNameProposal() + freemind.main.FreeMindCommon.FREEMIND_FILE_EXTENSION)); } chooser.setDialogTitle(getText(STR)); boolean repeatSaveAsQuestion; do { repeatSaveAsQuestion = false; int returnVal = chooser.showSaveDialog(getView()); if (returnVal != JFileChooser.APPROVE_OPTION) { return false; } f = chooser.getSelectedFile(); lastCurrentDir = f.getParentFile(); String ext = Tools.getExtension(f.getName()); if (!ext.equals(freemind.main.FreeMindCommon.FREEMIND_FILE_EXTENSION_WITHOUT_DOT)) { f = new File(f.getParent(), f.getName() + freemind.main.FreeMindCommon.FREEMIND_FILE_EXTENSION); } if (f.exists()) { int overwriteMap = JOptionPane.showConfirmDialog(getView(), getText(STR), STR, JOptionPane.YES_NO_OPTION); if (overwriteMap != JOptionPane.YES_OPTION) { repeatSaveAsQuestion = true; } } } while (repeatSaveAsQuestion); try { String lockingUser = getModel().tryToLock(f); if (lockingUser != null) { getFrame().getController().informationMessage( Tools.expandPlaceholders( getText(STR), f.getName(), lockingUser)); return false; } } catch (Exception e) { getFrame().getController().informationMessage( Tools.expandPlaceholders( getText(STR), f.getName())); return false; } save(f); getController().getMapModuleManager().updateMapModuleName(); return true; }
|
/**
* Save as; return false is the action was cancelled
*/
|
Save as; return false is the action was cancelled
|
saveAs
|
{
"repo_name": "filemon/freemind",
"path": "freemind/modes/ControllerAdapter.java",
"license": "gpl-2.0",
"size": 48711
}
|
[
"java.io.File",
"javax.swing.JFileChooser",
"javax.swing.JOptionPane"
] |
import java.io.File; import javax.swing.JFileChooser; import javax.swing.JOptionPane;
|
import java.io.*; import javax.swing.*;
|
[
"java.io",
"javax.swing"
] |
java.io; javax.swing;
| 2,450,641 |
public void beginType(String type, String kind, int modifiers,
String extendsType, String... implementsTypes) throws IOException {
indent();
modifiers(modifiers);
out.write(kind);
out.write(" ");
type(type);
if (extendsType != null) {
out.write("\n");
indent();
out.write(" extends ");
type(extendsType);
}
if (implementsTypes.length > 0) {
out.write("\n");
indent();
out.write(" implements ");
for (int i = 0; i < implementsTypes.length; i++) {
if (i != 0) {
out.write(", ");
}
type(implementsTypes[i]);
}
}
out.write(" {\n");
pushScope(Scope.TYPE_DECLARATION);
}
|
void function(String type, String kind, int modifiers, String extendsType, String... implementsTypes) throws IOException { indent(); modifiers(modifiers); out.write(kind); out.write(" "); type(type); if (extendsType != null) { out.write("\n"); indent(); out.write(STR); type(extendsType); } if (implementsTypes.length > 0) { out.write("\n"); indent(); out.write(STR); for (int i = 0; i < implementsTypes.length; i++) { if (i != 0) { out.write(STR); } type(implementsTypes[i]); } } out.write(STR); pushScope(Scope.TYPE_DECLARATION); }
|
/**
* Emits a type declaration.
*
* @param kind such as "class", "interface" or "enum".
* @param extendsType the class to extend, or null for no extends clause.
*/
|
Emits a type declaration
|
beginType
|
{
"repo_name": "jjrobinson/Reddit-DailyProgrammer",
"path": "lib/GSON/gson/src/codegen/src/main/java/com/google/gson/codegen/JavaWriter.java",
"license": "apache-2.0",
"size": 11646
}
|
[
"java.io.IOException"
] |
import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 2,124,691 |
public interface FontRecord extends Serializable {
public FontFamily getFamily();
|
interface FontRecord extends Serializable { public FontFamily function();
|
/**
* Returns the family for this record.
*
* @return the font family.
*/
|
Returns the family for this record
|
getFamily
|
{
"repo_name": "EgorZhuk/pentaho-reporting",
"path": "libraries/libfonts/src/main/java/org/pentaho/reporting/libraries/fonts/registry/FontRecord.java",
"license": "lgpl-2.1",
"size": 3159
}
|
[
"java.io.Serializable"
] |
import java.io.Serializable;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 2,280,374 |
private void move(int dy) {
int oldIdx = list.getSelectedIndex();
if (oldIdx < 0) {
return;
}
String o = listModel.get(oldIdx);
// Compute the new index:
int newInd = Math.max(0, Math.min(listModel.size() - 1, oldIdx + dy));
listModel.remove(oldIdx);
listModel.add(newInd, o);
list.setSelectedIndex(newInd);
}
protected class FieldListFocusListener<T> implements FocusListener {
private final JList<T> list;
public FieldListFocusListener(JList<T> list) {
this.list = list;
}
|
void function(int dy) { int oldIdx = list.getSelectedIndex(); if (oldIdx < 0) { return; } String o = listModel.get(oldIdx); int newInd = Math.max(0, Math.min(listModel.size() - 1, oldIdx + dy)); listModel.remove(oldIdx); listModel.add(newInd, o); list.setSelectedIndex(newInd); } protected class FieldListFocusListener<T> implements FocusListener { private final JList<T> list; public FieldListFocusListener(JList<T> list) { this.list = list; }
|
/**
* If a field is selected in the list, move it dy positions.
*/
|
If a field is selected in the list, move it dy positions
|
move
|
{
"repo_name": "conde2/DC-UFSCar-ES2-201701-BoxTesters",
"path": "src/main/java/org/jabref/gui/customentrytypes/FieldSetComponent.java",
"license": "mit",
"size": 11648
}
|
[
"java.awt.event.FocusListener",
"javax.swing.JList"
] |
import java.awt.event.FocusListener; import javax.swing.JList;
|
import java.awt.event.*; import javax.swing.*;
|
[
"java.awt",
"javax.swing"
] |
java.awt; javax.swing;
| 1,287,651 |
private void deleteFarMonths(Calendar currentDay) {
if (mEventRects == null) return;
Calendar nextMonth = (Calendar) currentDay.clone();
nextMonth.add(Calendar.MONTH, 1);
nextMonth.set(Calendar.DAY_OF_MONTH, nextMonth.getActualMaximum(Calendar.DAY_OF_MONTH));
nextMonth.set(Calendar.HOUR_OF_DAY, 12);
nextMonth.set(Calendar.MINUTE, 59);
nextMonth.set(Calendar.SECOND, 59);
Calendar prevMonth = (Calendar) currentDay.clone();
prevMonth.add(Calendar.MONTH, -1);
prevMonth.set(Calendar.DAY_OF_MONTH, 1);
prevMonth.set(Calendar.HOUR_OF_DAY, 0);
prevMonth.set(Calendar.MINUTE, 0);
prevMonth.set(Calendar.SECOND, 0);
List<EventRect> newEvents = new ArrayList<EventRect>();
for (EventRect eventRect : mEventRects) {
boolean isFarMonth = eventRect.event.getStartTime().getTimeInMillis() > nextMonth.getTimeInMillis() || eventRect.event.getEndTime().getTimeInMillis() < prevMonth.getTimeInMillis();
if (!isFarMonth) newEvents.add(eventRect);
}
mEventRects.clear();
mEventRects.addAll(newEvents);
}
/////////////////////////////////////////////////////////////////
//
// Functions related to setting and getting the properties.
//
/////////////////////////////////////////////////////////////////
|
void function(Calendar currentDay) { if (mEventRects == null) return; Calendar nextMonth = (Calendar) currentDay.clone(); nextMonth.add(Calendar.MONTH, 1); nextMonth.set(Calendar.DAY_OF_MONTH, nextMonth.getActualMaximum(Calendar.DAY_OF_MONTH)); nextMonth.set(Calendar.HOUR_OF_DAY, 12); nextMonth.set(Calendar.MINUTE, 59); nextMonth.set(Calendar.SECOND, 59); Calendar prevMonth = (Calendar) currentDay.clone(); prevMonth.add(Calendar.MONTH, -1); prevMonth.set(Calendar.DAY_OF_MONTH, 1); prevMonth.set(Calendar.HOUR_OF_DAY, 0); prevMonth.set(Calendar.MINUTE, 0); prevMonth.set(Calendar.SECOND, 0); List<EventRect> newEvents = new ArrayList<EventRect>(); for (EventRect eventRect : mEventRects) { boolean isFarMonth = eventRect.event.getStartTime().getTimeInMillis() > nextMonth.getTimeInMillis() eventRect.event.getEndTime().getTimeInMillis() < prevMonth.getTimeInMillis(); if (!isFarMonth) newEvents.add(eventRect); } mEventRects.clear(); mEventRects.addAll(newEvents); }
|
/**
* Deletes the events of the months that are too far away from the current month.
* @param currentDay The current day.
*/
|
Deletes the events of the months that are too far away from the current month
|
deleteFarMonths
|
{
"repo_name": "cymcsg/UltimateAndroid",
"path": "deprecated/UltimateAndroidGradle/ultimateandroiduiwidget/src/main/java/com/marshalchen/common/uimodule/weekview/WeekView.java",
"license": "apache-2.0",
"size": 50220
}
|
[
"java.util.ArrayList",
"java.util.Calendar",
"java.util.List"
] |
import java.util.ArrayList; import java.util.Calendar; import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,884,791 |
public static Board board(String cards) {
return Boards.board(cards);
}
/**
* Constructs a new {@link Board}, dealing the cards from the specified
* {@link Deck}.
*
* <p>
* Alias for {@link Boards#board(Deck, Street)}
|
static Board function(String cards) { return Boards.board(cards); } /** * Constructs a new {@link Board}, dealing the cards from the specified * {@link Deck}. * * <p> * Alias for {@link Boards#board(Deck, Street)}
|
/**
* Constructs a new {@link Board} using the specified card shorthand.
*
* <p>
* Alias for {@link Boards#board(String)}.
* </p>
*
* @param cards
* The cards shorthand, see {@link Boards#board(String)} for
* information on formatting.
* @return A new {@link Board} using the specified cards.
*/
|
Constructs a new <code>Board</code> using the specified card shorthand. Alias for <code>Boards#board(String)</code>.
|
board
|
{
"repo_name": "ableiten/foldem",
"path": "src/main/java/codes/derive/foldem/Poker.java",
"license": "gpl-3.0",
"size": 15089
}
|
[
"codes.derive.foldem.board.Board",
"codes.derive.foldem.board.Boards",
"codes.derive.foldem.board.Street"
] |
import codes.derive.foldem.board.Board; import codes.derive.foldem.board.Boards; import codes.derive.foldem.board.Street;
|
import codes.derive.foldem.board.*;
|
[
"codes.derive.foldem"
] |
codes.derive.foldem;
| 1,487,820 |
public static String createHash(String password)
throws NoSuchAlgorithmException, InvalidKeySpecException
{
return createHash(password.toCharArray());
}
|
static String function(String password) throws NoSuchAlgorithmException, InvalidKeySpecException { return createHash(password.toCharArray()); }
|
/**
* Returns a salted PBKDF2 hash of the password.
*
* @param password the password to hash
* @return a salted PBKDF2 hash of the password
*/
|
Returns a salted PBKDF2 hash of the password
|
createHash
|
{
"repo_name": "ajohnston9/ciscorouter",
"path": "CiscoRouterTool/src/ciscoroutertool/settings/PasswordHash.java",
"license": "mit",
"size": 7357
}
|
[
"java.security.NoSuchAlgorithmException",
"java.security.spec.InvalidKeySpecException"
] |
import java.security.NoSuchAlgorithmException; import java.security.spec.InvalidKeySpecException;
|
import java.security.*; import java.security.spec.*;
|
[
"java.security"
] |
java.security;
| 2,501,418 |
private static CharsetDecoder getDecoder(Charset charset)
{
if (charset == null) {
throw new NullPointerException("charset");
}
Map<Charset, CharsetDecoder> map = decoders.get();
CharsetDecoder d = map.get(charset);
if (d != null) {
d.reset();
d.onMalformedInput(CodingErrorAction.REPLACE);
d.onUnmappableCharacter(CodingErrorAction.REPLACE);
return d;
}
d = charset.newDecoder();
d.onMalformedInput(CodingErrorAction.REPLACE);
d.onUnmappableCharacter(CodingErrorAction.REPLACE);
map.put(charset, d);
return d;
}
|
static CharsetDecoder function(Charset charset) { if (charset == null) { throw new NullPointerException(STR); } Map<Charset, CharsetDecoder> map = decoders.get(); CharsetDecoder d = map.get(charset); if (d != null) { d.reset(); d.onMalformedInput(CodingErrorAction.REPLACE); d.onUnmappableCharacter(CodingErrorAction.REPLACE); return d; } d = charset.newDecoder(); d.onMalformedInput(CodingErrorAction.REPLACE); d.onUnmappableCharacter(CodingErrorAction.REPLACE); map.put(charset, d); return d; }
|
/**
* Returns a cached thread-local {@link CharsetDecoder} for the specified
* <tt>charset</tt>.
*/
|
Returns a cached thread-local <code>CharsetDecoder</code> for the specified charset
|
getDecoder
|
{
"repo_name": "IMCG/sessdb",
"path": "benchmark/src/main/java/com/ctriposs/sdb/benchmark/utils/Slices.java",
"license": "mit",
"size": 8378
}
|
[
"java.nio.charset.Charset",
"java.nio.charset.CharsetDecoder",
"java.nio.charset.CodingErrorAction",
"java.util.Map"
] |
import java.nio.charset.Charset; import java.nio.charset.CharsetDecoder; import java.nio.charset.CodingErrorAction; import java.util.Map;
|
import java.nio.charset.*; import java.util.*;
|
[
"java.nio",
"java.util"
] |
java.nio; java.util;
| 1,578,195 |
public final void setPrintIcon(Image image) {
requireNonNull(image);
printIconProperty().set(image);
}
|
final void function(Image image) { requireNonNull(image); printIconProperty().set(image); }
|
/**
* Sets the value of the {@link #printIconProperty()}.
*
* @param image
* will be the icon of window/dialog.
*/
|
Sets the value of the <code>#printIconProperty()</code>
|
setPrintIcon
|
{
"repo_name": "dlemmermann/CalendarFX",
"path": "CalendarFXView/src/main/java/com/calendarfx/view/print/PrintView.java",
"license": "apache-2.0",
"size": 20604
}
|
[
"java.util.Objects"
] |
import java.util.Objects;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,746,601 |
public Map getPortlets() {
return portlets;
}
|
Map function() { return portlets; }
|
/**
* Get map with portlet instance id's map to portlet keys with all portlet
* instances on this page.
**/
|
Get map with portlet instance id's map to portlet keys with all portlet instances on this page
|
getPortlets
|
{
"repo_name": "axeolotl/wsrp4cxf",
"path": "commons-consumer/src/java/org/apache/wsrp4j/commons/consumer/driver/PageImpl.java",
"license": "apache-2.0",
"size": 6455
}
|
[
"java.util.Map"
] |
import java.util.Map;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 277,915 |
public Filter handleStream(InputStream inIS,
ParsedURL origURL,
boolean needRawData) {
final DeferRable dr = new DeferRable();
final InputStream is = inIS;
final boolean raw = needRawData;
final String errCode;
final Object [] errParam;
if (origURL != null) {
errCode = ERR_URL_FORMAT_UNREADABLE;
errParam = new Object[] {"PNG", origURL};
} else {
errCode = ERR_STREAM_FORMAT_UNREADABLE;
errParam = new Object[] {"PNG"};
}
|
Filter function(InputStream inIS, ParsedURL origURL, boolean needRawData) { final DeferRable dr = new DeferRable(); final InputStream is = inIS; final boolean raw = needRawData; final String errCode; final Object [] errParam; if (origURL != null) { errCode = ERR_URL_FORMAT_UNREADABLE; errParam = new Object[] {"PNG", origURL}; } else { errCode = ERR_STREAM_FORMAT_UNREADABLE; errParam = new Object[] {"PNG"}; }
|
/**
* Decode the Stream into a RenderableImage
*
* @param inIS The input stream that contains the image.
* @param origURL The original URL, if any, for documentation
* purposes only. This may be null.
* @param needRawData If true the image returned should not have
* any default color correction the file may
* specify applied. */
|
Decode the Stream into a RenderableImage
|
handleStream
|
{
"repo_name": "sflyphotobooks/crp-batik",
"path": "sources/org/apache/batik/ext/awt/image/codec/png/PNGRegistryEntry.java",
"license": "apache-2.0",
"size": 5069
}
|
[
"java.io.InputStream",
"org.apache.batik.ext.awt.image.renderable.DeferRable",
"org.apache.batik.ext.awt.image.renderable.Filter",
"org.apache.batik.util.ParsedURL"
] |
import java.io.InputStream; import org.apache.batik.ext.awt.image.renderable.DeferRable; import org.apache.batik.ext.awt.image.renderable.Filter; import org.apache.batik.util.ParsedURL;
|
import java.io.*; import org.apache.batik.ext.awt.image.renderable.*; import org.apache.batik.util.*;
|
[
"java.io",
"org.apache.batik"
] |
java.io; org.apache.batik;
| 365,992 |
public static void showError(Sip descriptionObject, Exception ex) {
Platform.runLater(() -> {
if (displayErrorMessage) {
addErrorMessage();
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.initStyle(StageStyle.UNDECORATED);
alert.initOwner(stage);
alert.setTitle(I18n.t(Constants.I18N_CREATIONMODALPROCESSING_ALERT_TITLE));
String header = String.format(I18n.t(Constants.I18N_CREATIONMODALPROCESSING_ALERT_HEADER),
descriptionObject.getTitle());
alert.setHeaderText(header);
StringBuilder content = new StringBuilder();
if (ex.getLocalizedMessage() != null) {
content.append(ex.getLocalizedMessage());
}
content.append("\n");
content.append(I18n.t(Constants.I18N_CREATIONMODALPROCESSING_CAUSE));
if (ex.getCause() != null) {
content.append(": ").append(ex.getCause().getLocalizedMessage());
}
alert.setContentText(content.toString());
alert.getDialogPane().setStyle(ConfigurationManager.getStyle("export.alert"));
// Create expandable Exception.
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
pw.println(ex.getMessage());
for (StackTraceElement ste : ex.getStackTrace()) {
pw.println("\t" + ste);
}
String exceptionText = sw.toString();
Label label = new Label(I18n.t(Constants.I18N_CREATIONMODALPROCESSING_ALERT_STACK_TRACE));
TextArea textArea = new TextArea(exceptionText);
textArea.setWrapText(true);
textArea.setEditable(false);
textArea.minWidthProperty().bind(alert.getDialogPane().widthProperty().subtract(20));
textArea.maxWidthProperty().bind(alert.getDialogPane().widthProperty().subtract(20));
GridPane expContent = new GridPane();
expContent.setMaxWidth(Double.MAX_VALUE);
expContent.add(label, 0, 0);
expContent.add(textArea, 0, 1);
textArea.minHeightProperty().bind(expContent.heightProperty().subtract(20));
// Set expandable Exception into the dialog pane.
alert.getDialogPane().setExpandableContent(expContent);
alert.getDialogPane().minWidthProperty().bind(stage.widthProperty());
alert.getDialogPane().minHeightProperty().bind(stage.heightProperty());
// Without this setStyle the pane won't resize correctly. Black magic...
alert.getDialogPane().setStyle(ConfigurationManager.getStyle("creationmodalprocessing.blackmagic"));
alert.show();
checkIfTooManyErrors();
}
});
}
|
static void function(Sip descriptionObject, Exception ex) { Platform.runLater(() -> { if (displayErrorMessage) { addErrorMessage(); Alert alert = new Alert(Alert.AlertType.ERROR); alert.initStyle(StageStyle.UNDECORATED); alert.initOwner(stage); alert.setTitle(I18n.t(Constants.I18N_CREATIONMODALPROCESSING_ALERT_TITLE)); String header = String.format(I18n.t(Constants.I18N_CREATIONMODALPROCESSING_ALERT_HEADER), descriptionObject.getTitle()); alert.setHeaderText(header); StringBuilder content = new StringBuilder(); if (ex.getLocalizedMessage() != null) { content.append(ex.getLocalizedMessage()); } content.append("\n"); content.append(I18n.t(Constants.I18N_CREATIONMODALPROCESSING_CAUSE)); if (ex.getCause() != null) { content.append(STR).append(ex.getCause().getLocalizedMessage()); } alert.setContentText(content.toString()); alert.getDialogPane().setStyle(ConfigurationManager.getStyle(STR)); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); pw.println(ex.getMessage()); for (StackTraceElement ste : ex.getStackTrace()) { pw.println("\t" + ste); } String exceptionText = sw.toString(); Label label = new Label(I18n.t(Constants.I18N_CREATIONMODALPROCESSING_ALERT_STACK_TRACE)); TextArea textArea = new TextArea(exceptionText); textArea.setWrapText(true); textArea.setEditable(false); textArea.minWidthProperty().bind(alert.getDialogPane().widthProperty().subtract(20)); textArea.maxWidthProperty().bind(alert.getDialogPane().widthProperty().subtract(20)); GridPane expContent = new GridPane(); expContent.setMaxWidth(Double.MAX_VALUE); expContent.add(label, 0, 0); expContent.add(textArea, 0, 1); textArea.minHeightProperty().bind(expContent.heightProperty().subtract(20)); alert.getDialogPane().setExpandableContent(expContent); alert.getDialogPane().minWidthProperty().bind(stage.widthProperty()); alert.getDialogPane().minHeightProperty().bind(stage.heightProperty()); alert.getDialogPane().setStyle(ConfigurationManager.getStyle(STR)); alert.show(); checkIfTooManyErrors(); } }); }
|
/**
* Shows an alert with the error message regarding an exception found when
* exporting a SIP.
*
* @param descriptionObject
* The SIP being exported when the exception was thrown
* @param ex
* The thrown exception
*/
|
Shows an alert with the error message regarding an exception found when exporting a SIP
|
showError
|
{
"repo_name": "DGLABArquivos/roda-in",
"path": "src/main/java/org/roda/rodain/ui/creation/CreationModalProcessing.java",
"license": "lgpl-3.0",
"size": 13284
}
|
[
"java.io.PrintWriter",
"java.io.StringWriter",
"org.roda.rodain.core.ConfigurationManager",
"org.roda.rodain.core.Constants",
"org.roda.rodain.core.I18n",
"org.roda.rodain.core.schema.Sip"
] |
import java.io.PrintWriter; import java.io.StringWriter; import org.roda.rodain.core.ConfigurationManager; import org.roda.rodain.core.Constants; import org.roda.rodain.core.I18n; import org.roda.rodain.core.schema.Sip;
|
import java.io.*; import org.roda.rodain.core.*; import org.roda.rodain.core.schema.*;
|
[
"java.io",
"org.roda.rodain"
] |
java.io; org.roda.rodain;
| 2,532,647 |
protected void setBlasYKnownForTest(FloatMatrix blasYKnown) {
this.blasYKnown = blasYKnown;
}
|
void function(FloatMatrix blasYKnown) { this.blasYKnown = blasYKnown; }
|
/**
* Only for testing.
*/
|
Only for testing
|
setBlasYKnownForTest
|
{
"repo_name": "linqs/psl",
"path": "psl-core/src/main/java/org/linqs/psl/application/learning/weight/bayesian/GaussianProcessPrior.java",
"license": "apache-2.0",
"size": 14599
}
|
[
"org.linqs.psl.util.FloatMatrix"
] |
import org.linqs.psl.util.FloatMatrix;
|
import org.linqs.psl.util.*;
|
[
"org.linqs.psl"
] |
org.linqs.psl;
| 599,987 |
public int read() throws IOException {
if (count - pos <= 2) {
fill();
if (count - pos <= 2) {
return -1;
}
}
return buf[pos++] & 0xff;
}
|
int function() throws IOException { if (count - pos <= 2) { fill(); if (count - pos <= 2) { return -1; } } return buf[pos++] & 0xff; }
|
/**
* See the general contract of the <code>read</code>
* method of <code>InputStream</code>.
* <p>
* Returns <code>-1</code> (end of file) when the MIME
* boundary of this part is encountered.
*
* @return the next byte of data, or <code>-1</code> if the end of the
* stream is reached.
* @exception IOException if an I/O error occurs.
*/
|
See the general contract of the <code>read</code> method of <code>InputStream</code>. Returns <code>-1</code> (end of file) when the MIME boundary of this part is encountered
|
read
|
{
"repo_name": "javaosc-projects/javaosc-framework",
"path": "galaxy/src/main/java/org/javaosc/galaxy/web/multipart/PartInputStream.java",
"license": "apache-2.0",
"size": 7988
}
|
[
"java.io.IOException"
] |
import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 2,823,849 |
protected Object createServiceProvider(final Class category,
final Class implementation,
final Hints hints)
throws FactoryRegistryException
{
if (GeometryFactory.class.isAssignableFrom(category) &&
GeometryFactory.class.equals(implementation))
{
return new GeometryFactory(getPrecisionModel(hints), getSRID(hints),
getCoordinateSequenceFactory(hints));
}
return super.createServiceProvider(category, implementation, hints);
}
|
Object function(final Class category, final Class implementation, final Hints hints) throws FactoryRegistryException { if (GeometryFactory.class.isAssignableFrom(category) && GeometryFactory.class.equals(implementation)) { return new GeometryFactory(getPrecisionModel(hints), getSRID(hints), getCoordinateSequenceFactory(hints)); } return super.createServiceProvider(category, implementation, hints); }
|
/**
* Creates a new instance of the specified factory using the specified hints.
*
* @param category The category to instantiate.
* @param implementation The factory class to instantiate.
* @param hints The implementation hints.
* @return The factory.
* @throws org.geotools.factory.FactoryRegistryException if the factory creation failed.
*/
|
Creates a new instance of the specified factory using the specified hints
|
createServiceProvider
|
{
"repo_name": "TerraMobile/TerraMobile",
"path": "sldparser/src/main/geotools/geometry/jts/JTSFactoryFinder.java",
"license": "apache-2.0",
"size": 14229
}
|
[
"com.vividsolutions.jts.geom.GeometryFactory",
"org.geotools.factory.FactoryRegistryException",
"org.geotools.factory.Hints"
] |
import com.vividsolutions.jts.geom.GeometryFactory; import org.geotools.factory.FactoryRegistryException; import org.geotools.factory.Hints;
|
import com.vividsolutions.jts.geom.*; import org.geotools.factory.*;
|
[
"com.vividsolutions.jts",
"org.geotools.factory"
] |
com.vividsolutions.jts; org.geotools.factory;
| 725,720 |
Document set(String fieldPath, ByteBuffer value);
|
Document set(String fieldPath, ByteBuffer value);
|
/**
* Sets the value of the specified fieldPath in this Document to the
* specified ByteBuffer.
*
* @param fieldPath the FieldPath to set
* @param value the ByteBuffer
* @return {@code this} for chaining.
*/
|
Sets the value of the specified fieldPath in this Document to the specified ByteBuffer
|
set
|
{
"repo_name": "kcheng-mr/ojai",
"path": "core/src/main/java/org/ojai/Document.java",
"license": "apache-2.0",
"size": 37450
}
|
[
"java.nio.ByteBuffer"
] |
import java.nio.ByteBuffer;
|
import java.nio.*;
|
[
"java.nio"
] |
java.nio;
| 1,881,231 |
@Test(timeout = 120000)
public void testCreateXAttr() throws Exception {
Map<String, byte[]> expectedXAttrs = Maps.newHashMap();
expectedXAttrs.put(name1, value1);
expectedXAttrs.put(name2, null);
expectedXAttrs.put(security1, null);
doTestCreateXAttr(filePath, expectedXAttrs);
expectedXAttrs.put(raw1, value1);
doTestCreateXAttr(rawFilePath, expectedXAttrs);
}
|
@Test(timeout = 120000) void function() throws Exception { Map<String, byte[]> expectedXAttrs = Maps.newHashMap(); expectedXAttrs.put(name1, value1); expectedXAttrs.put(name2, null); expectedXAttrs.put(security1, null); doTestCreateXAttr(filePath, expectedXAttrs); expectedXAttrs.put(raw1, value1); doTestCreateXAttr(rawFilePath, expectedXAttrs); }
|
/**
* Tests for creating xattr
* 1. Create an xattr using XAttrSetFlag.CREATE.
* 2. Create an xattr which already exists and expect an exception.
* 3. Create multiple xattrs.
* 4. Restart NN and save checkpoint scenarios.
*/
|
Tests for creating xattr 1. Create an xattr using XAttrSetFlag.CREATE. 2. Create an xattr which already exists and expect an exception. 3. Create multiple xattrs. 4. Restart NN and save checkpoint scenarios
|
testCreateXAttr
|
{
"repo_name": "apurtell/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/FSXAttrBaseTest.java",
"license": "apache-2.0",
"size": 51073
}
|
[
"java.util.Map",
"org.apache.hadoop.thirdparty.com.google.common.collect.Maps",
"org.junit.Test"
] |
import java.util.Map; import org.apache.hadoop.thirdparty.com.google.common.collect.Maps; import org.junit.Test;
|
import java.util.*; import org.apache.hadoop.thirdparty.com.google.common.collect.*; import org.junit.*;
|
[
"java.util",
"org.apache.hadoop",
"org.junit"
] |
java.util; org.apache.hadoop; org.junit;
| 871,528 |
public void messageReceived(PilightConnection connection, Status status);
|
void function(PilightConnection connection, Status status);
|
/**
* Update for a device received.
*
* @param connection The connection to pilight that received the update
* @param status Object containing list of devices that were updated and their current state
*/
|
Update for a device received
|
messageReceived
|
{
"repo_name": "TheNetStriker/openhab",
"path": "bundles/binding/org.openhab.binding.pilight/src/main/java/org/openhab/binding/pilight/internal/IPilightMessageReceivedCallback.java",
"license": "epl-1.0",
"size": 940
}
|
[
"org.openhab.binding.pilight.internal.communication.Status"
] |
import org.openhab.binding.pilight.internal.communication.Status;
|
import org.openhab.binding.pilight.internal.communication.*;
|
[
"org.openhab.binding"
] |
org.openhab.binding;
| 526,810 |
@Override
public void mapTileRequestCompleted(final MapTileRequestState pState, final Drawable pDrawable) {
// put the tile in the cache
putTileIntoCache(pState, pDrawable);
// tell our caller we've finished and it should update its view
if (mTileRequestCompleteHandler != null) {
mTileRequestCompleteHandler.sendEmptyMessage(MapTile.MAPTILE_SUCCESS_ID);
}
if (DEBUG_TILE_PROVIDERS) {
logger.debug("MapTileProviderBase.mapTileRequestCompleted(): " + pState.getMapTile());
}
}
|
void function(final MapTileRequestState pState, final Drawable pDrawable) { putTileIntoCache(pState, pDrawable); if (mTileRequestCompleteHandler != null) { mTileRequestCompleteHandler.sendEmptyMessage(MapTile.MAPTILE_SUCCESS_ID); } if (DEBUG_TILE_PROVIDERS) { logger.debug(STR + pState.getMapTile()); } }
|
/**
* Called by implementation class methods indicating that they have completed the request as
* best it can. The tile is added to the cache, and a MAPTILE_SUCCESS_ID message is sent.
*
* @param pState
* the map tile request state object
* @param pDrawable
* the Drawable of the map tile
*/
|
Called by implementation class methods indicating that they have completed the request as best it can. The tile is added to the cache, and a MAPTILE_SUCCESS_ID message is sent
|
mapTileRequestCompleted
|
{
"repo_name": "Sarfarazsajjad/osmdroid",
"path": "osmdroid-android/src/main/java/org/osmdroid/tileprovider/MapTileProviderBase.java",
"license": "apache-2.0",
"size": 14190
}
|
[
"android.graphics.drawable.Drawable"
] |
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.*;
|
[
"android.graphics"
] |
android.graphics;
| 2,337,434 |
void createQueue(String address, RoutingType routingType, String queueName, String filter, boolean durable, boolean autoCreated,
int maxConsumers, boolean purgeOnNoConsumers, Boolean exclusive, Boolean lastValue) throws ActiveMQException;
|
void createQueue(String address, RoutingType routingType, String queueName, String filter, boolean durable, boolean autoCreated, int maxConsumers, boolean purgeOnNoConsumers, Boolean exclusive, Boolean lastValue) throws ActiveMQException;
|
/**
* Creates a <em>non-temporary</em>queue.
*
* @param address the queue will be bound to this address
* @param routingType the routing type for this queue, MULTICAST or ANYCAST
* @param queueName the name of the queue
* @param filter only messages which match this filter will be put in the queue
* @param durable whether the queue is durable or not
* @param autoCreated whether to mark this queue as autoCreated or not
* @param maxConsumers how many concurrent consumers will be allowed on this queue
* @param purgeOnNoConsumers whether to delete the contents of the queue when the last consumer disconnects
* @param exclusive whether the queue should be exclusive
* @param lastValue whether the queue should be lastValue
* @throws ActiveMQException
*/
|
Creates a non-temporaryqueue
|
createQueue
|
{
"repo_name": "iweiss/activemq-artemis",
"path": "artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ClientSession.java",
"license": "apache-2.0",
"size": 50872
}
|
[
"org.apache.activemq.artemis.api.core.ActiveMQException",
"org.apache.activemq.artemis.api.core.RoutingType"
] |
import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.RoutingType;
|
import org.apache.activemq.artemis.api.core.*;
|
[
"org.apache.activemq"
] |
org.apache.activemq;
| 585,933 |
public LeastSquareResults solve(final DoubleMatrix1D observedValues, final DoubleMatrix1D sigma, final Function1D<DoubleMatrix1D, DoubleMatrix1D> func,
final Function1D<DoubleMatrix1D, DoubleMatrix2D> jac, final DoubleMatrix1D startPos, final Function1D<DoubleMatrix1D, Boolean> constraints, final DoubleMatrix1D maxJumps) {
Validate.notNull(observedValues, "observedValues");
Validate.notNull(sigma, " sigma");
Validate.notNull(func, " func");
Validate.notNull(jac, " jac");
Validate.notNull(startPos, "startPos");
final int nObs = observedValues.getNumberOfElements();
final int nParms = startPos.getNumberOfElements();
Validate.isTrue(nObs == sigma.getNumberOfElements(), "observedValues and sigma must be same length");
ArgumentChecker.isTrue(nObs >= nParms, "must have data points greater or equal to number of parameters. #date points = {}, #parameters = {}", nObs, nParms);
ArgumentChecker.isTrue(constraints.evaluate(startPos), "The inital value of the parameters (startPos) is {} - this is not an allowed value", startPos);
DoubleMatrix2D alpha;
DecompositionResult decmp;
DoubleMatrix1D theta = startPos;
double lambda = 0.0; // TODO debug if the model is linear, it will be solved in 1 step
double newChiSqr, oldChiSqr;
DoubleMatrix1D error = getError(func, observedValues, sigma, theta);
DoubleMatrix1D newError;
DoubleMatrix2D jacobian = getJacobian(jac, sigma, theta);
oldChiSqr = getChiSqr(error);
// If we start at the solution we are done
if (oldChiSqr == 0.0) {
return finish(oldChiSqr, jacobian, theta, sigma);
}
DoubleMatrix1D beta = getChiSqrGrad(error, jacobian);
for (int count = 0; count < MAX_ATTEMPTS; count++) {
alpha = getModifiedCurvatureMatrix(jacobian, lambda);
DoubleMatrix1D deltaTheta;
try {
decmp = _decomposition.evaluate(alpha);
deltaTheta = decmp.solve(beta);
} catch (final Exception e) {
throw new MathException(e);
}
DoubleMatrix1D trialTheta = (DoubleMatrix1D) _algebra.add(theta, deltaTheta);
// if the new value of theta is not in the model domain or the jump is too large, keep increasing lambda until an
// acceptable step is found
if (!constraints.evaluate(trialTheta) || !allowJump(deltaTheta, maxJumps)) {
lambda = increaseLambda(lambda);
continue;
}
newError = getError(func, observedValues, sigma, trialTheta);
newChiSqr = getChiSqr(newError);
// Check for convergence when no improvement in chiSqr occurs
if (Math.abs(newChiSqr - oldChiSqr) / (1 + oldChiSqr) < _eps) {
final DoubleMatrix2D alpha0 = lambda == 0.0 ? alpha : getModifiedCurvatureMatrix(jacobian, 0.0);
// if the model is an exact fit to the data, then no more improvement is possible
if (newChiSqr < _eps) {
if (lambda > 0.0) {
decmp = _decomposition.evaluate(alpha0);
}
return finish(alpha0, decmp, newChiSqr, jacobian, trialTheta, sigma);
}
final SVDecompositionCommons svd = (SVDecompositionCommons) DecompositionFactory.SV_COMMONS;
// add the second derivative information to the Hessian matrix to check we are not at a local maximum or saddle
// point
final VectorFieldSecondOrderDifferentiator diff = new VectorFieldSecondOrderDifferentiator();
final Function1D<DoubleMatrix1D, DoubleMatrix2D[]> secDivFunc = diff.differentiate(func, constraints);
final DoubleMatrix2D[] secDiv = secDivFunc.evaluate(trialTheta);
final double[][] temp = new double[nParms][nParms];
for (int i = 0; i < nObs; i++) {
for (int j = 0; j < nParms; j++) {
for (int k = 0; k < nParms; k++) {
temp[j][k] -= newError.getEntry(i) * secDiv[i].getEntry(j, k) / sigma.getEntry(i);
}
}
}
final DoubleMatrix2D newAlpha = (DoubleMatrix2D) _algebra.add(alpha0, new DoubleMatrix2D(temp));
final SVDecompositionResult svdRes = svd.evaluate(newAlpha);
final double[] w = svdRes.getSingularValues();
final DoubleMatrix2D u = svdRes.getU();
final DoubleMatrix2D v = svdRes.getV();
final double[] p = new double[nParms];
boolean saddle = false;
double sum = 0.0;
for (int i = 0; i < nParms; i++) {
double a = 0.0;
for (int j = 0; j < nParms; j++) {
a += u.getEntry(j, i) * v.getEntry(j, i);
}
final int sign = a > 0.0 ? 1 : -1;
if (w[i] * sign < 0.0) {
sum += w[i];
w[i] = -w[i];
saddle = true;
}
}
// if a local maximum or saddle point is found (as indicated by negative eigenvalues), move in a direction that
// is a weighted
// sum of the eigenvectors corresponding to the negative eigenvalues
if (saddle) {
lambda = increaseLambda(lambda);
for (int i = 0; i < nParms; i++) {
if (w[i] < 0.0) {
final double scale = 0.5 * Math.sqrt(-oldChiSqr * w[i]) / sum;
for (int j = 0; j < nParms; j++) {
p[j] += scale * u.getEntry(j, i);
}
}
}
final DoubleMatrix1D direction = new DoubleMatrix1D(p);
deltaTheta = direction;
trialTheta = (DoubleMatrix1D) _algebra.add(theta, deltaTheta);
int i = 0;
double scale = 1.0;
while (!constraints.evaluate(trialTheta)) {
scale *= -0.5;
deltaTheta = (DoubleMatrix1D) _algebra.scale(direction, scale);
trialTheta = (DoubleMatrix1D) _algebra.add(theta, deltaTheta);
i++;
if (i > 10) {
throw new MathException("Could not satify constraint");
}
}
newError = getError(func, observedValues, sigma, trialTheta);
newChiSqr = getChiSqr(newError);
int counter = 0;
while (newChiSqr > oldChiSqr) {
// if even a tiny move along the negative eigenvalue cannot improve chiSqr, then exit
if (counter > 10 || Math.abs(newChiSqr - oldChiSqr) / (1 + oldChiSqr) < _eps) {
LOGGER.warn("Saddle point detected, but no improvement to chi^2 possible by moving away. It is recommended that a different starting point is used.");
return finish(newAlpha, decmp, oldChiSqr, jacobian, theta, sigma);
}
scale /= 2.0;
deltaTheta = (DoubleMatrix1D) _algebra.scale(direction, scale);
trialTheta = (DoubleMatrix1D) _algebra.add(theta, deltaTheta);
newError = getError(func, observedValues, sigma, trialTheta);
newChiSqr = getChiSqr(newError);
counter++;
}
} else {
// this should be the normal finish - i.e. no improvement in chiSqr and at a true minimum (although there is
// no guarantee it is not a local minimum)
return finish(newAlpha, decmp, newChiSqr, jacobian, trialTheta, sigma);
}
}
if (newChiSqr < oldChiSqr) {
lambda = decreaseLambda(lambda);
theta = trialTheta;
error = newError;
jacobian = getJacobian(jac, sigma, trialTheta);
beta = getChiSqrGrad(error, jacobian);
oldChiSqr = newChiSqr;
} else {
lambda = increaseLambda(lambda);
}
}
throw new MathException("Could not converge in " + MAX_ATTEMPTS + " attempts");
}
|
LeastSquareResults function(final DoubleMatrix1D observedValues, final DoubleMatrix1D sigma, final Function1D<DoubleMatrix1D, DoubleMatrix1D> func, final Function1D<DoubleMatrix1D, DoubleMatrix2D> jac, final DoubleMatrix1D startPos, final Function1D<DoubleMatrix1D, Boolean> constraints, final DoubleMatrix1D maxJumps) { Validate.notNull(observedValues, STR); Validate.notNull(sigma, STR); Validate.notNull(func, STR); Validate.notNull(jac, STR); Validate.notNull(startPos, STR); final int nObs = observedValues.getNumberOfElements(); final int nParms = startPos.getNumberOfElements(); Validate.isTrue(nObs == sigma.getNumberOfElements(), STR); ArgumentChecker.isTrue(nObs >= nParms, STR, nObs, nParms); ArgumentChecker.isTrue(constraints.evaluate(startPos), STR, startPos); DoubleMatrix2D alpha; DecompositionResult decmp; DoubleMatrix1D theta = startPos; double lambda = 0.0; double newChiSqr, oldChiSqr; DoubleMatrix1D error = getError(func, observedValues, sigma, theta); DoubleMatrix1D newError; DoubleMatrix2D jacobian = getJacobian(jac, sigma, theta); oldChiSqr = getChiSqr(error); if (oldChiSqr == 0.0) { return finish(oldChiSqr, jacobian, theta, sigma); } DoubleMatrix1D beta = getChiSqrGrad(error, jacobian); for (int count = 0; count < MAX_ATTEMPTS; count++) { alpha = getModifiedCurvatureMatrix(jacobian, lambda); DoubleMatrix1D deltaTheta; try { decmp = _decomposition.evaluate(alpha); deltaTheta = decmp.solve(beta); } catch (final Exception e) { throw new MathException(e); } DoubleMatrix1D trialTheta = (DoubleMatrix1D) _algebra.add(theta, deltaTheta); if (!constraints.evaluate(trialTheta) !allowJump(deltaTheta, maxJumps)) { lambda = increaseLambda(lambda); continue; } newError = getError(func, observedValues, sigma, trialTheta); newChiSqr = getChiSqr(newError); if (Math.abs(newChiSqr - oldChiSqr) / (1 + oldChiSqr) < _eps) { final DoubleMatrix2D alpha0 = lambda == 0.0 ? alpha : getModifiedCurvatureMatrix(jacobian, 0.0); if (newChiSqr < _eps) { if (lambda > 0.0) { decmp = _decomposition.evaluate(alpha0); } return finish(alpha0, decmp, newChiSqr, jacobian, trialTheta, sigma); } final SVDecompositionCommons svd = (SVDecompositionCommons) DecompositionFactory.SV_COMMONS; final VectorFieldSecondOrderDifferentiator diff = new VectorFieldSecondOrderDifferentiator(); final Function1D<DoubleMatrix1D, DoubleMatrix2D[]> secDivFunc = diff.differentiate(func, constraints); final DoubleMatrix2D[] secDiv = secDivFunc.evaluate(trialTheta); final double[][] temp = new double[nParms][nParms]; for (int i = 0; i < nObs; i++) { for (int j = 0; j < nParms; j++) { for (int k = 0; k < nParms; k++) { temp[j][k] -= newError.getEntry(i) * secDiv[i].getEntry(j, k) / sigma.getEntry(i); } } } final DoubleMatrix2D newAlpha = (DoubleMatrix2D) _algebra.add(alpha0, new DoubleMatrix2D(temp)); final SVDecompositionResult svdRes = svd.evaluate(newAlpha); final double[] w = svdRes.getSingularValues(); final DoubleMatrix2D u = svdRes.getU(); final DoubleMatrix2D v = svdRes.getV(); final double[] p = new double[nParms]; boolean saddle = false; double sum = 0.0; for (int i = 0; i < nParms; i++) { double a = 0.0; for (int j = 0; j < nParms; j++) { a += u.getEntry(j, i) * v.getEntry(j, i); } final int sign = a > 0.0 ? 1 : -1; if (w[i] * sign < 0.0) { sum += w[i]; w[i] = -w[i]; saddle = true; } } if (saddle) { lambda = increaseLambda(lambda); for (int i = 0; i < nParms; i++) { if (w[i] < 0.0) { final double scale = 0.5 * Math.sqrt(-oldChiSqr * w[i]) / sum; for (int j = 0; j < nParms; j++) { p[j] += scale * u.getEntry(j, i); } } } final DoubleMatrix1D direction = new DoubleMatrix1D(p); deltaTheta = direction; trialTheta = (DoubleMatrix1D) _algebra.add(theta, deltaTheta); int i = 0; double scale = 1.0; while (!constraints.evaluate(trialTheta)) { scale *= -0.5; deltaTheta = (DoubleMatrix1D) _algebra.scale(direction, scale); trialTheta = (DoubleMatrix1D) _algebra.add(theta, deltaTheta); i++; if (i > 10) { throw new MathException(STR); } } newError = getError(func, observedValues, sigma, trialTheta); newChiSqr = getChiSqr(newError); int counter = 0; while (newChiSqr > oldChiSqr) { if (counter > 10 Math.abs(newChiSqr - oldChiSqr) / (1 + oldChiSqr) < _eps) { LOGGER.warn(STR); return finish(newAlpha, decmp, oldChiSqr, jacobian, theta, sigma); } scale /= 2.0; deltaTheta = (DoubleMatrix1D) _algebra.scale(direction, scale); trialTheta = (DoubleMatrix1D) _algebra.add(theta, deltaTheta); newError = getError(func, observedValues, sigma, trialTheta); newChiSqr = getChiSqr(newError); counter++; } } else { return finish(newAlpha, decmp, newChiSqr, jacobian, trialTheta, sigma); } } if (newChiSqr < oldChiSqr) { lambda = decreaseLambda(lambda); theta = trialTheta; error = newError; jacobian = getJacobian(jac, sigma, trialTheta); beta = getChiSqrGrad(error, jacobian); oldChiSqr = newChiSqr; } else { lambda = increaseLambda(lambda); } } throw new MathException(STR + MAX_ATTEMPTS + STR); }
|
/**
* Use this when the model is given as a function of its parameters only (i.e. a function that takes a set of
* parameters and return a set of model values,
* so the measurement points are already known to the function), and analytic parameter sensitivity is available
* @param observedValues Set of measurement values
* @param sigma Set of measurement errors
* @param func The model as a function of its parameters only
* @param jac The model sensitivity to its parameters (i.e. the Jacobian matrix) as a function of its parameters only
* @param startPos Initial value of the parameters
* @param constraints A function that returns true if the trial point is within the constraints of the model
* @param maxJumps A vector containing the maximum absolute allowed step in a particular direction in each iteration.
* Can be null, in which case on constant
* on the step size is applied.
* @return value of the fitted parameters
*/
|
Use this when the model is given as a function of its parameters only (i.e. a function that takes a set of parameters and return a set of model values, so the measurement points are already known to the function), and analytic parameter sensitivity is available
|
solve
|
{
"repo_name": "jeorme/OG-Platform",
"path": "projects/OG-Analytics/src/main/java/com/opengamma/analytics/math/statistics/leastsquare/NonLinearLeastSquare.java",
"license": "apache-2.0",
"size": 30213
}
|
[
"com.opengamma.analytics.math.MathException",
"com.opengamma.analytics.math.differentiation.VectorFieldSecondOrderDifferentiator",
"com.opengamma.analytics.math.function.Function1D",
"com.opengamma.analytics.math.linearalgebra.DecompositionFactory",
"com.opengamma.analytics.math.linearalgebra.DecompositionResult",
"com.opengamma.analytics.math.linearalgebra.SVDecompositionCommons",
"com.opengamma.analytics.math.linearalgebra.SVDecompositionResult",
"com.opengamma.analytics.math.matrix.DoubleMatrix1D",
"com.opengamma.analytics.math.matrix.DoubleMatrix2D",
"com.opengamma.util.ArgumentChecker",
"org.apache.commons.lang.Validate"
] |
import com.opengamma.analytics.math.MathException; import com.opengamma.analytics.math.differentiation.VectorFieldSecondOrderDifferentiator; import com.opengamma.analytics.math.function.Function1D; import com.opengamma.analytics.math.linearalgebra.DecompositionFactory; import com.opengamma.analytics.math.linearalgebra.DecompositionResult; import com.opengamma.analytics.math.linearalgebra.SVDecompositionCommons; import com.opengamma.analytics.math.linearalgebra.SVDecompositionResult; import com.opengamma.analytics.math.matrix.DoubleMatrix1D; import com.opengamma.analytics.math.matrix.DoubleMatrix2D; import com.opengamma.util.ArgumentChecker; import org.apache.commons.lang.Validate;
|
import com.opengamma.analytics.math.*; import com.opengamma.analytics.math.differentiation.*; import com.opengamma.analytics.math.function.*; import com.opengamma.analytics.math.linearalgebra.*; import com.opengamma.analytics.math.matrix.*; import com.opengamma.util.*; import org.apache.commons.lang.*;
|
[
"com.opengamma.analytics",
"com.opengamma.util",
"org.apache.commons"
] |
com.opengamma.analytics; com.opengamma.util; org.apache.commons;
| 1,535,395 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.