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
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
public ServiceFuture<Void> cancelAtSubscriptionScopeAsync(String deploymentName, final ServiceCallback<Void> serviceCallback) {
return ServiceFuture.fromResponse(cancelAtSubscriptionScopeWithServiceResponseAsync(deploymentName), serviceCallback);
} | ServiceFuture<Void> function(String deploymentName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(cancelAtSubscriptionScopeWithServiceResponseAsync(deploymentName), serviceCallback); } | /**
* Cancels a currently running template deployment.
* You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed.
*
* @param deploymentName The name of the deployment.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/ | Cancels a currently running template deployment. You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed | cancelAtSubscriptionScopeAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/resources/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/resources/v2020_06_01/implementation/DeploymentsInner.java",
"license": "mit",
"size": 445517
} | [
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture"
] | import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 1,455,994 |
Optional<DiscreteResource> lookup(DiscreteResourceId id); | Optional<DiscreteResource> lookup(DiscreteResourceId id); | /**
* Look up a discrete resource instance by ID.
*
* @param id id
* @return found instance enclosed by Optional
*/ | Look up a discrete resource instance by ID | lookup | {
"repo_name": "shlee89/athena",
"path": "core/store/dist/src/main/java/org/onosproject/store/resource/impl/DiscreteResources.java",
"license": "apache-2.0",
"size": 3147
} | [
"java.util.Optional",
"org.onosproject.net.resource.DiscreteResource",
"org.onosproject.net.resource.DiscreteResourceId"
] | import java.util.Optional; import org.onosproject.net.resource.DiscreteResource; import org.onosproject.net.resource.DiscreteResourceId; | import java.util.*; import org.onosproject.net.resource.*; | [
"java.util",
"org.onosproject.net"
] | java.util; org.onosproject.net; | 2,186,392 |
@Column(name = "data", length = 16777215)
@Override
public Map<String,Object> getData() {
return (Map<String,Object>) get(9);
} | @Column(name = "data", length = 16777215) Map<String,Object> function() { return (Map<String,Object>) get(9); } | /**
* Getter for <code>cattle.service_expose_map.data</code>.
*/ | Getter for <code>cattle.service_expose_map.data</code> | getData | {
"repo_name": "vincent99/cattle",
"path": "code/iaas/model/src/main/java/io/cattle/platform/core/model/tables/records/ServiceExposeMapRecord.java",
"license": "apache-2.0",
"size": 21690
} | [
"java.util.Map",
"javax.persistence.Column"
] | import java.util.Map; import javax.persistence.Column; | import java.util.*; import javax.persistence.*; | [
"java.util",
"javax.persistence"
] | java.util; javax.persistence; | 2,473,782 |
public Locale getLanguage(); | Locale function(); | /**
* Returns the language definition of this layout context. If not set, it defaults to the parent's language. If the
* root's language is also not defined, then use the system default.
*
* @return the defined language, never null.
*/ | Returns the language definition of this layout context. If not set, it defaults to the parent's language. If the root's language is also not defined, then use the system default | getLanguage | {
"repo_name": "mbatchelor/pentaho-reporting",
"path": "libraries/libcss/src/main/java/org/pentaho/reporting/libraries/css/dom/LayoutElement.java",
"license": "lgpl-2.1",
"size": 2217
} | [
"java.util.Locale"
] | import java.util.Locale; | import java.util.*; | [
"java.util"
] | java.util; | 1,822,643 |
public final Class<? extends Attribute> getCategory() {
return DateTimeAtCompleted.class;
} | final Class<? extends Attribute> function() { return DateTimeAtCompleted.class; } | /**
* Get the printing attribute class which is to be used as the "category"
* for this printing attribute value.
* <P>
* For class DateTimeAtCompleted, the category is class
* DateTimeAtCompleted itself.
*
* @return Printing attribute class (category), an instance of class
* {@link java.lang.Class java.lang.Class}.
*/ | Get the printing attribute class which is to be used as the "category" for this printing attribute value. For class DateTimeAtCompleted, the category is class DateTimeAtCompleted itself | getCategory | {
"repo_name": "rokn/Count_Words_2015",
"path": "testing/openjdk2/jdk/src/share/classes/javax/print/attribute/standard/DateTimeAtCompleted.java",
"license": "mit",
"size": 4861
} | [
"javax.print.attribute.Attribute"
] | import javax.print.attribute.Attribute; | import javax.print.attribute.*; | [
"javax.print"
] | javax.print; | 2,652,624 |
private StartContainerCmd executeStartContainerRequest(DockerClient client, Message message) {
LOGGER.debug("Executing Docker Start Container Request");
String containerId = DockerHelper.getProperty(DockerConstants.DOCKER_CONTAINER_ID, configuration, message, String.class);
ObjectHelper.notNull(containerId, "Container ID must be specified");
StartContainerCmd startContainerCmd = client.startContainerCmd(containerId);
return startContainerCmd;
} | StartContainerCmd function(DockerClient client, Message message) { LOGGER.debug(STR); String containerId = DockerHelper.getProperty(DockerConstants.DOCKER_CONTAINER_ID, configuration, message, String.class); ObjectHelper.notNull(containerId, STR); StartContainerCmd startContainerCmd = client.startContainerCmd(containerId); return startContainerCmd; } | /**
* Produce a start container request
*
* @param client
* @param message
* @return
*/ | Produce a start container request | executeStartContainerRequest | {
"repo_name": "objectiser/camel",
"path": "components/camel-docker/src/main/java/org/apache/camel/component/docker/producer/DockerProducer.java",
"license": "apache-2.0",
"size": 41056
} | [
"com.github.dockerjava.api.DockerClient",
"com.github.dockerjava.api.command.StartContainerCmd",
"org.apache.camel.Message",
"org.apache.camel.component.docker.DockerConstants",
"org.apache.camel.component.docker.DockerHelper",
"org.apache.camel.util.ObjectHelper"
] | import com.github.dockerjava.api.DockerClient; import com.github.dockerjava.api.command.StartContainerCmd; import org.apache.camel.Message; import org.apache.camel.component.docker.DockerConstants; import org.apache.camel.component.docker.DockerHelper; import org.apache.camel.util.ObjectHelper; | import com.github.dockerjava.api.*; import com.github.dockerjava.api.command.*; import org.apache.camel.*; import org.apache.camel.component.docker.*; import org.apache.camel.util.*; | [
"com.github.dockerjava",
"org.apache.camel"
] | com.github.dockerjava; org.apache.camel; | 2,841,635 |
public void setPass(String raw) {
try {
raw = PASS_HASH_PREFIX + PasswordHash.hash(raw);
}
catch (Exception e) {
Log.debug("Failed to hash password.");
e.printStackTrace();
return;
}
this.pass = raw;
}
| void function(String raw) { try { raw = PASS_HASH_PREFIX + PasswordHash.hash(raw); } catch (Exception e) { Log.debug(STR); e.printStackTrace(); return; } this.pass = raw; } | /**
* Sets the password for this profile to the raw text.
* @param raw the raw text, this will be hashed
*/ | Sets the password for this profile to the raw text | setPass | {
"repo_name": "tehnewb/Titan",
"path": "src/org/maxgamer/rs/logonv4/Profile.java",
"license": "gpl-3.0",
"size": 5816
} | [
"net.crackstation.hash.PasswordHash",
"org.maxgamer.rs.lib.log.Log"
] | import net.crackstation.hash.PasswordHash; import org.maxgamer.rs.lib.log.Log; | import net.crackstation.hash.*; import org.maxgamer.rs.lib.log.*; | [
"net.crackstation.hash",
"org.maxgamer.rs"
] | net.crackstation.hash; org.maxgamer.rs; | 1,647,527 |
CompletableFuture<List<FlowResponsePayload>> getFlowsForLink(SwitchId srcSwitch, Integer srcPort,
SwitchId dstSwitch, Integer dstPort); | CompletableFuture<List<FlowResponsePayload>> getFlowsForLink(SwitchId srcSwitch, Integer srcPort, SwitchId dstSwitch, Integer dstPort); | /**
* Get all flows for a particular link.
*
* @param srcSwitch source switch dpid.
* @param srcPort source port number.
* @param dstSwitch destination switch dpid.
* @param dstPort destination port number.
* @return all flows for a particular link.
*/ | Get all flows for a particular link | getFlowsForLink | {
"repo_name": "jonvestal/open-kilda",
"path": "src-java/northbound-service/northbound/src/main/java/org/openkilda/northbound/service/LinkService.java",
"license": "apache-2.0",
"size": 5841
} | [
"java.util.List",
"java.util.concurrent.CompletableFuture",
"org.openkilda.messaging.payload.flow.FlowResponsePayload",
"org.openkilda.model.SwitchId"
] | import java.util.List; import java.util.concurrent.CompletableFuture; import org.openkilda.messaging.payload.flow.FlowResponsePayload; import org.openkilda.model.SwitchId; | import java.util.*; import java.util.concurrent.*; import org.openkilda.messaging.payload.flow.*; import org.openkilda.model.*; | [
"java.util",
"org.openkilda.messaging",
"org.openkilda.model"
] | java.util; org.openkilda.messaging; org.openkilda.model; | 1,826,161 |
public SignedShort getTypeNum() {
return TYPENUM;
} | SignedShort function() { return TYPENUM; } | /**
* return uniuque type number.
* @return SignedShort holding unique type number
*/ | return uniuque type number | getTypeNum | {
"repo_name": "kyle0311/oliot-fc",
"path": "fc-server/src/main/java/kr/ac/kaist/resl/ltk/generated/messages/ENABLE_EVENTS_AND_REPORTS.java",
"license": "lgpl-2.1",
"size": 7655
} | [
"org.llrp.ltk.types.SignedShort"
] | import org.llrp.ltk.types.SignedShort; | import org.llrp.ltk.types.*; | [
"org.llrp.ltk"
] | org.llrp.ltk; | 2,735,059 |
public final Alignment getHorizontalAlignment()
{
return eHAlign;
} | final Alignment function() { return eHAlign; } | /***************************************
* Returns the horizontal alignment. The default value is {@link
* Alignment#FILL}.
*
* @return The horizontal alignment
*/ | Returns the horizontal alignment. The default value is <code>Alignment#FILL</code> | getHorizontalAlignment | {
"repo_name": "esoco/gewt",
"path": "src/main/java/de/esoco/ewt/style/StyleData.java",
"license": "apache-2.0",
"size": 20311
} | [
"de.esoco.lib.property.Alignment"
] | import de.esoco.lib.property.Alignment; | import de.esoco.lib.property.*; | [
"de.esoco.lib"
] | de.esoco.lib; | 713,776 |
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<RoleInstanceInner> list(String resourceGroupName, String cloudServiceName) {
final InstanceViewTypes expand = null;
return new PagedIterable<>(listAsync(resourceGroupName, cloudServiceName, expand));
} | @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable<RoleInstanceInner> function(String resourceGroupName, String cloudServiceName) { final InstanceViewTypes expand = null; return new PagedIterable<>(listAsync(resourceGroupName, cloudServiceName, expand)); } | /**
* Gets the list of all role instances in a cloud service. Use nextLink property in the response to get the next
* page of role instances. Do this till nextLink is null to fetch all the role instances.
*
* @param resourceGroupName The resourceGroupName parameter.
* @param cloudServiceName The cloudServiceName parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the list of all role instances in a cloud service as paginated response with {@link PagedIterable}.
*/ | Gets the list of all role instances in a cloud service. Use nextLink property in the response to get the next page of role instances. Do this till nextLink is null to fetch all the role instances | list | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/implementation/CloudServiceRoleInstancesClientImpl.java",
"license": "mit",
"size": 109969
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.PagedIterable",
"com.azure.resourcemanager.compute.fluent.models.RoleInstanceInner",
"com.azure.resourcemanager.compute.models.InstanceViewTypes"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedIterable; import com.azure.resourcemanager.compute.fluent.models.RoleInstanceInner; import com.azure.resourcemanager.compute.models.InstanceViewTypes; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.compute.fluent.models.*; import com.azure.resourcemanager.compute.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 430,124 |
public void setOwner(Path p, String username, String groupname
) throws IOException {
} | void function(Path p, String username, String groupname ) throws IOException { } | /**
* Set owner of a path (i.e. a file or a directory).
* The parameters username and groupname cannot both be null.
* @param p The path
* @param username If it is null, the original username remains unchanged.
* @param groupname If it is null, the original groupname remains unchanged.
*/ | Set owner of a path (i.e. a file or a directory). The parameters username and groupname cannot both be null | setOwner | {
"repo_name": "jonathangizmo/HadoopDistJ",
"path": "hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java",
"license": "mit",
"size": 110020
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,934,273 |
private Boolean constraintsExistsForRelationship(String type, List<String> propertyNames) {
Schema schema = tx.schema();
for (ConstraintDefinition constraintDefinition : Iterables.asList(schema.getConstraints(RelationshipType.withName(type)))) {
List<String> properties = Iterables.asList(constraintDefinition.getPropertyKeys());
if (properties.equals(propertyNames)) {
return true;
}
}
return false;
} | Boolean function(String type, List<String> propertyNames) { Schema schema = tx.schema(); for (ConstraintDefinition constraintDefinition : Iterables.asList(schema.getConstraints(RelationshipType.withName(type)))) { List<String> properties = Iterables.asList(constraintDefinition.getPropertyKeys()); if (properties.equals(propertyNames)) { return true; } } return false; } | /**
* Checks if a constraint exists for a given type and a list of properties
* This method checks for constraints on relationships
*
* @param type
* @param propertyNames
* @return true if the constraint exists otherwise it returns false
*/ | Checks if a constraint exists for a given type and a list of properties This method checks for constraints on relationships | constraintsExistsForRelationship | {
"repo_name": "neo4j-contrib/neo4j-apoc-procedures",
"path": "core/src/main/java/apoc/schema/Schemas.java",
"license": "apache-2.0",
"size": 29441
} | [
"java.util.List",
"org.neo4j.graphdb.RelationshipType",
"org.neo4j.graphdb.schema.ConstraintDefinition",
"org.neo4j.graphdb.schema.Schema",
"org.neo4j.internal.helpers.collection.Iterables"
] | import java.util.List; import org.neo4j.graphdb.RelationshipType; import org.neo4j.graphdb.schema.ConstraintDefinition; import org.neo4j.graphdb.schema.Schema; import org.neo4j.internal.helpers.collection.Iterables; | import java.util.*; import org.neo4j.graphdb.*; import org.neo4j.graphdb.schema.*; import org.neo4j.internal.helpers.collection.*; | [
"java.util",
"org.neo4j.graphdb",
"org.neo4j.internal"
] | java.util; org.neo4j.graphdb; org.neo4j.internal; | 2,839,073 |
protected List<E> getOrderedElements() {
List<E> list = new ArrayList<E>();
for (E e : getSubjectGenerator().order(new ArrayList<E>(getSampleElements()))) {
list.add(e);
}
return Collections.unmodifiableList(list);
} | List<E> function() { List<E> list = new ArrayList<E>(); for (E e : getSubjectGenerator().order(new ArrayList<E>(getSampleElements()))) { list.add(e); } return Collections.unmodifiableList(list); } | /**
* Returns the {@linkplain #getSampleElements() sample elements} as ordered by
* {@link TestContainerGenerator#order(List)}. Tests should used this method
* only if they declare requirement {@link
* com.google.common.collect.testing.features.CollectionFeature#KNOWN_ORDER}.
*/ | Returns the #getSampleElements() sample elements as ordered by <code>TestContainerGenerator#order(List)</code>. Tests should used this method only if they declare requirement <code>com.google.common.collect.testing.features.CollectionFeature#KNOWN_ORDER</code> | getOrderedElements | {
"repo_name": "DavesMan/guava",
"path": "guava-testlib/src/com/google/common/collect/testing/AbstractContainerTester.java",
"license": "apache-2.0",
"size": 8493
} | [
"java.util.ArrayList",
"java.util.Collections",
"java.util.List"
] | import java.util.ArrayList; import java.util.Collections; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,882,350 |
public static Fingerprint createFingerprint() {
Random random = new Random();
Set<Integer> positionSet = new HashSet<>();
while (positionSet.size() <= FINGERPRINT_LENGTH) {
positionSet.add(random.nextInt(MAX_POSITION));
}
Integer[] positionsInteger = new Integer[FINGERPRINT_LENGTH];
positionsInteger = positionSet.toArray(positionsInteger);
sort(positionsInteger);
return new Fingerprint(ArrayUtils.toPrimitive(positionsInteger));
} | static Fingerprint function() { Random random = new Random(); Set<Integer> positionSet = new HashSet<>(); while (positionSet.size() <= FINGERPRINT_LENGTH) { positionSet.add(random.nextInt(MAX_POSITION)); } Integer[] positionsInteger = new Integer[FINGERPRINT_LENGTH]; positionsInteger = positionSet.toArray(positionsInteger); sort(positionsInteger); return new Fingerprint(ArrayUtils.toPrimitive(positionsInteger)); } | /**
* Create dummy {@link Fingerprint}.
*
* @return dummy fingerprint.
*/ | Create dummy <code>Fingerprint</code> | createFingerprint | {
"repo_name": "cortical-io/java-client-sdk",
"path": "retina-service-java-api-client/src/test/java/io/cortical/rest/model/TestDataMother.java",
"license": "bsd-2-clause",
"size": 6312
} | [
"io.cortical.rest.model.Fingerprint",
"java.util.Arrays",
"java.util.HashSet",
"java.util.Random",
"java.util.Set",
"org.apache.commons.lang3.ArrayUtils"
] | import io.cortical.rest.model.Fingerprint; import java.util.Arrays; import java.util.HashSet; import java.util.Random; import java.util.Set; import org.apache.commons.lang3.ArrayUtils; | import io.cortical.rest.model.*; import java.util.*; import org.apache.commons.lang3.*; | [
"io.cortical.rest",
"java.util",
"org.apache.commons"
] | io.cortical.rest; java.util; org.apache.commons; | 1,432,570 |
File execute() throws PackagingException; | File execute() throws PackagingException; | /**
* Actually perform the packaging.
* @throws PackagingException something went wrong.
*/ | Actually perform the packaging | execute | {
"repo_name": "chrisdutz/flexmojos",
"path": "flexmojos-maven-plugin/src/main/java/net/flexmojos/oss/plugin/air/packager/Packager.java",
"license": "gpl-2.0",
"size": 930
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 2,911,901 |
@Override
public String getText(Object object) {
String label = ((BusCable)object).getName();
return label == null || label.length() == 0 ?
getString("_UI_BusCable_type") :
getString("_UI_BusCable_type") + " " + label;
}
| String function(Object object) { String label = ((BusCable)object).getName(); return label == null label.length() == 0 ? getString(STR) : getString(STR) + " " + label; } | /**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This returns the label text for the adapted class. | getText | {
"repo_name": "KAMP-Research/KAMP4APS",
"path": "edu.kit.ipd.sdq.kamp4aps.aps.edit/src/edu/kit/ipd/sdq/kamp4aps/model/aPS/BusComponents/provider/BusCableItemProvider.java",
"license": "apache-2.0",
"size": 6070
} | [
"edu.kit.ipd.sdq.kamp4aps.model.aPS.BusComponents"
] | import edu.kit.ipd.sdq.kamp4aps.model.aPS.BusComponents; | import edu.kit.ipd.sdq.kamp4aps.model.*; | [
"edu.kit.ipd"
] | edu.kit.ipd; | 2,191,992 |
@Test
public void testMapPersonEntityToPerson() {
// Given
PersonEntity personEntity = new PersonEntity();
personEntity.setEmailAddress(mockValues.nextString(45));
personEntity.setPassword(mockValues.nextString(45));
personEntity.setFirstName(mockValues.nextString(45));
personEntity.setLastName(mockValues.nextString(45));
// When
Person person = personServiceMapper.mapPersonEntityToPerson(personEntity);
// Then
assertEquals(personEntity.getEmailAddress(), person.getEmailAddress());
assertEquals(personEntity.getPassword(), person.getPassword());
assertEquals(personEntity.getFirstName(), person.getFirstName());
assertEquals(personEntity.getLastName(), person.getLastName());
}
| void function() { PersonEntity personEntity = new PersonEntity(); personEntity.setEmailAddress(mockValues.nextString(45)); personEntity.setPassword(mockValues.nextString(45)); personEntity.setFirstName(mockValues.nextString(45)); personEntity.setLastName(mockValues.nextString(45)); Person person = personServiceMapper.mapPersonEntityToPerson(personEntity); assertEquals(personEntity.getEmailAddress(), person.getEmailAddress()); assertEquals(personEntity.getPassword(), person.getPassword()); assertEquals(personEntity.getFirstName(), person.getFirstName()); assertEquals(personEntity.getLastName(), person.getLastName()); } | /**
* Mapping from 'PersonEntity' to 'Person'
* @param personEntity
*/ | Mapping from 'PersonEntity' to 'Person' | testMapPersonEntityToPerson | {
"repo_name": "obasola/master",
"path": "src/test/java/com/kumasi/journal/business/service/mapping/PersonServiceMapperTest.java",
"license": "mit",
"size": 2686
} | [
"com.kumasi.journal.domain.Person",
"com.kumasi.journal.domain.jpa.PersonEntity",
"org.junit.Assert"
] | import com.kumasi.journal.domain.Person; import com.kumasi.journal.domain.jpa.PersonEntity; import org.junit.Assert; | import com.kumasi.journal.domain.*; import com.kumasi.journal.domain.jpa.*; import org.junit.*; | [
"com.kumasi.journal",
"org.junit"
] | com.kumasi.journal; org.junit; | 2,347,068 |
@NotNull
List<PyTargetExpression> getClassAttributesInherited(@NotNull TypeEvalContext context); | List<PyTargetExpression> getClassAttributesInherited(@NotNull TypeEvalContext context); | /**
* Returns all class attributes this class class contains, including inherited one.
* Process may be heavy, depending or your context.
*
* @param context context to use for this process
* @return list of attrs.
*
* TODO: Replace it and {@link #getClassAttributes()} with a single getClassAttributes(@NotNull TypeEvalContext context, boolean inherited)
*/ | Returns all class attributes this class class contains, including inherited one. Process may be heavy, depending or your context | getClassAttributesInherited | {
"repo_name": "MichaelNedzelsky/intellij-community",
"path": "python/psi-api/src/com/jetbrains/python/psi/PyClass.java",
"license": "apache-2.0",
"size": 10344
} | [
"com.jetbrains.python.psi.types.TypeEvalContext",
"java.util.List",
"org.jetbrains.annotations.NotNull"
] | import com.jetbrains.python.psi.types.TypeEvalContext; import java.util.List; import org.jetbrains.annotations.NotNull; | import com.jetbrains.python.psi.types.*; import java.util.*; import org.jetbrains.annotations.*; | [
"com.jetbrains.python",
"java.util",
"org.jetbrains.annotations"
] | com.jetbrains.python; java.util; org.jetbrains.annotations; | 1,154,737 |
public void testParseQuantityReqItem() {
String itemLine = "3,BX,123,,paper,6";
try {
PurApItem item = parser.parseItem(itemLine, itemClass, documentNumber);
assertEquals(item.getItemQuantity().compareTo(new KualiDecimal(3)), 0);
assertEquals(item.getItemUnitOfMeasureCode(), "BX");
assertEquals(item.getItemCatalogNumber(), "123");
assertEquals(item.getItemDescription(), "paper");
assertEquals(item.getItemUnitPrice().compareTo(new BigDecimal(6)), 0);
assertEquals(item.getItemTypeCode(), PurapConstants.ItemTypeCodes.ITEM_TYPE_ITEM_CODE);
assertTrue(item instanceof RequisitionItem);
assertFalse(((RequisitionItem)item).isItemRestrictedIndicator());
}
catch(ItemParserException e) {
fail("Caught ItemParserException with valid quantity-driven requisition item.");
}
}
| void function() { String itemLine = STR; try { PurApItem item = parser.parseItem(itemLine, itemClass, documentNumber); assertEquals(item.getItemQuantity().compareTo(new KualiDecimal(3)), 0); assertEquals(item.getItemUnitOfMeasureCode(), "BX"); assertEquals(item.getItemCatalogNumber(), "123"); assertEquals(item.getItemDescription(), "paper"); assertEquals(item.getItemUnitPrice().compareTo(new BigDecimal(6)), 0); assertEquals(item.getItemTypeCode(), PurapConstants.ItemTypeCodes.ITEM_TYPE_ITEM_CODE); assertTrue(item instanceof RequisitionItem); assertFalse(((RequisitionItem)item).isItemRestrictedIndicator()); } catch(ItemParserException e) { fail(STR); } } | /**
* Tests whether parseItem returns successfully with valid quantity-driven Requisition item line as input.
*/ | Tests whether parseItem returns successfully with valid quantity-driven Requisition item line as input | testParseQuantityReqItem | {
"repo_name": "ua-eas/ua-kfs-5.3",
"path": "test/unit/src/org/kuali/kfs/module/purap/util/ItemParserTest.java",
"license": "agpl-3.0",
"size": 10595
} | [
"java.math.BigDecimal",
"org.kuali.kfs.module.purap.PurapConstants",
"org.kuali.kfs.module.purap.businessobject.PurApItem",
"org.kuali.kfs.module.purap.businessobject.RequisitionItem",
"org.kuali.kfs.module.purap.exception.ItemParserException",
"org.kuali.rice.core.api.util.type.KualiDecimal"
] | import java.math.BigDecimal; import org.kuali.kfs.module.purap.PurapConstants; import org.kuali.kfs.module.purap.businessobject.PurApItem; import org.kuali.kfs.module.purap.businessobject.RequisitionItem; import org.kuali.kfs.module.purap.exception.ItemParserException; import org.kuali.rice.core.api.util.type.KualiDecimal; | import java.math.*; import org.kuali.kfs.module.purap.*; import org.kuali.kfs.module.purap.businessobject.*; import org.kuali.kfs.module.purap.exception.*; import org.kuali.rice.core.api.util.type.*; | [
"java.math",
"org.kuali.kfs",
"org.kuali.rice"
] | java.math; org.kuali.kfs; org.kuali.rice; | 677,936 |
@ServiceMethod(returns = ReturnType.SINGLE)
public OperationJobExtendedInfoInner adhocBackup(
String vaultName, String resourceGroupName, String backupInstanceName, TriggerBackupRequest parameters) {
return adhocBackupAsync(vaultName, resourceGroupName, backupInstanceName, parameters).block();
} | @ServiceMethod(returns = ReturnType.SINGLE) OperationJobExtendedInfoInner function( String vaultName, String resourceGroupName, String backupInstanceName, TriggerBackupRequest parameters) { return adhocBackupAsync(vaultName, resourceGroupName, backupInstanceName, parameters).block(); } | /**
* Trigger adhoc backup.
*
* @param vaultName The name of the backup vault.
* @param resourceGroupName The name of the resource group where the backup vault is present.
* @param backupInstanceName The name of the backup instance.
* @param parameters Request body for operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return operationJobExtendedInfo.
*/ | Trigger adhoc backup | adhocBackup | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupInstancesClientImpl.java",
"license": "mit",
"size": 135868
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.resourcemanager.dataprotection.fluent.models.OperationJobExtendedInfoInner",
"com.azure.resourcemanager.dataprotection.models.TriggerBackupRequest"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.dataprotection.fluent.models.OperationJobExtendedInfoInner; import com.azure.resourcemanager.dataprotection.models.TriggerBackupRequest; | import com.azure.core.annotation.*; import com.azure.resourcemanager.dataprotection.fluent.models.*; import com.azure.resourcemanager.dataprotection.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 2,756,456 |
protected IOFileFilter getFileFilter() {
return new WildcardFileFilter( this.wildCharacter );
} | IOFileFilter function() { return new WildcardFileFilter( this.wildCharacter ); } | /**
* Returns {@link IOFileFilter} constructed using the wild character. Subclasses can override this method
* return their own version of {@link IOFileFilter} instance.
*
* @return {@link IOFileFilter} constructed using the wild character. Subclasses can override this method
* return their own version of {@link IOFileFilter} instance.
*/ | Returns <code>IOFileFilter</code> constructed using the wild character. Subclasses can override this method return their own version of <code>IOFileFilter</code> instance | getFileFilter | {
"repo_name": "apache/chukwa",
"path": "core/src/main/java/org/apache/hadoop/chukwa/datacollection/adaptor/DirTailingAdaptor.java",
"license": "apache-2.0",
"size": 5458
} | [
"org.apache.commons.io.filefilter.IOFileFilter",
"org.apache.commons.io.filefilter.WildcardFileFilter"
] | import org.apache.commons.io.filefilter.IOFileFilter; import org.apache.commons.io.filefilter.WildcardFileFilter; | import org.apache.commons.io.filefilter.*; | [
"org.apache.commons"
] | org.apache.commons; | 2,084,906 |
public static Message getMessage(InputStream connection, int requiredMsgType) throws PyroException, IOException {
byte[] headerdata=IOUtil.recv(connection, HEADER_SIZE);
MessageHeader header=parseMessageHeader(headerdata);
if(requiredMsgType!=0 && header.type!=requiredMsgType) {
throw new PyroException("invalid msg type received: "+header.type);
}
byte[] data=IOUtil.recv(connection, header.datasize);
if(Config.MSG_TRACE_DIR!=null) {
TraceMessageRecv(header.sequence, headerdata, data);
}
if(((header.flags&FLAGS_HMAC) != 0) && (Config.HMAC_KEY!=null)) {
if(!Arrays.equals(header.hmac, makeHMAC(data))) {
throw new PyroException("message hmac mismatch");
}
} else if(((header.flags&FLAGS_HMAC) != 0) != (Config.HMAC_KEY!=null)) {
throw new PyroException("hmac key config not symmetric");
}
Message msg=new Message();
msg.type=header.type;
msg.flags=header.flags;
msg.sequence=header.sequence;
msg.data=data;
return msg;
}
| static Message function(InputStream connection, int requiredMsgType) throws PyroException, IOException { byte[] headerdata=IOUtil.recv(connection, HEADER_SIZE); MessageHeader header=parseMessageHeader(headerdata); if(requiredMsgType!=0 && header.type!=requiredMsgType) { throw new PyroException(STR+header.type); } byte[] data=IOUtil.recv(connection, header.datasize); if(Config.MSG_TRACE_DIR!=null) { TraceMessageRecv(header.sequence, headerdata, data); } if(((header.flags&FLAGS_HMAC) != 0) && (Config.HMAC_KEY!=null)) { if(!Arrays.equals(header.hmac, makeHMAC(data))) { throw new PyroException(STR); } } else if(((header.flags&FLAGS_HMAC) != 0) != (Config.HMAC_KEY!=null)) { throw new PyroException(STR); } Message msg=new Message(); msg.type=header.type; msg.flags=header.flags; msg.sequence=header.sequence; msg.data=data; return msg; } | /**
* Receive a message from the connection. If you set requiredMsgType to the required
* message type id instead of zero, it will check the incoming message type and
* raise a PyroException if they don't match.
*/ | Receive a message from the connection. If you set requiredMsgType to the required message type id instead of zero, it will check the incoming message type and raise a PyroException if they don't match | getMessage | {
"repo_name": "RichIsMyName/PicklingToolsRepo",
"path": "Java/pyrolite-export/java/src/net/razorvine/pyro/MessageFactory.java",
"license": "bsd-3-clause",
"size": 7259
} | [
"java.io.IOException",
"java.io.InputStream",
"java.util.Arrays"
] | import java.io.IOException; import java.io.InputStream; import java.util.Arrays; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 202,714 |
private boolean isSafeIntent(PackageManager pm, Intent intent) {
AuthenticatorDescription authDesc =
mAuthenticatorHelper.getAccountTypeDescription(mAccountType);
ResolveInfo resolveInfo = pm.resolveActivity(intent, 0);
if (resolveInfo == null) {
return false;
}
ActivityInfo resolvedActivityInfo = resolveInfo.activityInfo;
ApplicationInfo resolvedAppInfo = resolvedActivityInfo.applicationInfo;
try {
ApplicationInfo authenticatorAppInf = pm.getApplicationInfo(authDesc.packageName, 0);
return resolvedActivityInfo.exported
|| resolvedAppInfo.uid == authenticatorAppInf.uid;
} catch (NameNotFoundException e) {
Log.e(TAG,
"Intent considered unsafe due to exception.",
e);
return false;
}
} | boolean function(PackageManager pm, Intent intent) { AuthenticatorDescription authDesc = mAuthenticatorHelper.getAccountTypeDescription(mAccountType); ResolveInfo resolveInfo = pm.resolveActivity(intent, 0); if (resolveInfo == null) { return false; } ActivityInfo resolvedActivityInfo = resolveInfo.activityInfo; ApplicationInfo resolvedAppInfo = resolvedActivityInfo.applicationInfo; try { ApplicationInfo authenticatorAppInf = pm.getApplicationInfo(authDesc.packageName, 0); return resolvedActivityInfo.exported resolvedAppInfo.uid == authenticatorAppInf.uid; } catch (NameNotFoundException e) { Log.e(TAG, STR, e); return false; } } | /**
* Determines if the supplied Intent is safe. A safe intent is one that is
* will launch a exported=true activity or owned by the same uid as the
* authenticator supplying the intent.
*/ | Determines if the supplied Intent is safe. A safe intent is one that is will launch a exported=true activity or owned by the same uid as the authenticator supplying the intent | isSafeIntent | {
"repo_name": "manuelmagix/android_packages_apps_Settings",
"path": "src/com/android/settings/accounts/ManageAccountsSettings.java",
"license": "apache-2.0",
"size": 23511
} | [
"android.accounts.AuthenticatorDescription",
"android.content.Intent",
"android.content.pm.ActivityInfo",
"android.content.pm.ApplicationInfo",
"android.content.pm.PackageManager",
"android.content.pm.ResolveInfo",
"android.util.Log"
] | import android.accounts.AuthenticatorDescription; import android.content.Intent; import android.content.pm.ActivityInfo; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.util.Log; | import android.accounts.*; import android.content.*; import android.content.pm.*; import android.util.*; | [
"android.accounts",
"android.content",
"android.util"
] | android.accounts; android.content; android.util; | 1,651,136 |
private void copyOrMove(List<Message> messages, final String destination,
final FolderOperation operation) {
Map<String, List<Message>> folderMap = new HashMap<String, List<Message>>();
for (Message message : messages) {
if ((operation == FolderOperation.MOVE && !mController.isMoveCapable(message)) ||
(operation == FolderOperation.COPY && !mController.isCopyCapable(message))) {
Toast.makeText(getActivity(), R.string.move_copy_cannot_copy_unsynced_message,
Toast.LENGTH_LONG).show();
// XXX return meaningful error value?
// message isn't synchronized
return;
}
String folderName = message.getFolder().getName();
if (folderName.equals(destination)) {
// Skip messages already in the destination folder
continue;
}
List<Message> outMessages = folderMap.get(folderName);
if (outMessages == null) {
outMessages = new ArrayList<Message>();
folderMap.put(folderName, outMessages);
}
outMessages.add(message);
}
for (Map.Entry<String, List<Message>> entry : folderMap.entrySet()) {
String folderName = entry.getKey();
List<Message> outMessages = entry.getValue();
Account account = outMessages.get(0).getFolder().getAccount();
if (operation == FolderOperation.MOVE) {
if (mThreadedList) {
mController.moveMessagesInThread(account, folderName, outMessages, destination);
} else {
mController.moveMessages(account, folderName, outMessages, destination, null);
}
} else {
if (mThreadedList) {
mController.copyMessagesInThread(account, folderName, outMessages, destination);
} else {
mController.copyMessages(account, folderName, outMessages, destination, null);
}
}
}
}
class ActionModeCallback implements ActionMode.Callback {
private MenuItem mSelectAll;
private MenuItem mMarkAsRead;
private MenuItem mMarkAsUnread;
private MenuItem mFlag;
private MenuItem mUnflag; | void function(List<Message> messages, final String destination, final FolderOperation operation) { Map<String, List<Message>> folderMap = new HashMap<String, List<Message>>(); for (Message message : messages) { if ((operation == FolderOperation.MOVE && !mController.isMoveCapable(message)) (operation == FolderOperation.COPY && !mController.isCopyCapable(message))) { Toast.makeText(getActivity(), R.string.move_copy_cannot_copy_unsynced_message, Toast.LENGTH_LONG).show(); return; } String folderName = message.getFolder().getName(); if (folderName.equals(destination)) { continue; } List<Message> outMessages = folderMap.get(folderName); if (outMessages == null) { outMessages = new ArrayList<Message>(); folderMap.put(folderName, outMessages); } outMessages.add(message); } for (Map.Entry<String, List<Message>> entry : folderMap.entrySet()) { String folderName = entry.getKey(); List<Message> outMessages = entry.getValue(); Account account = outMessages.get(0).getFolder().getAccount(); if (operation == FolderOperation.MOVE) { if (mThreadedList) { mController.moveMessagesInThread(account, folderName, outMessages, destination); } else { mController.moveMessages(account, folderName, outMessages, destination, null); } } else { if (mThreadedList) { mController.copyMessagesInThread(account, folderName, outMessages, destination); } else { mController.copyMessages(account, folderName, outMessages, destination, null); } } } } class ActionModeCallback implements ActionMode.Callback { private MenuItem mSelectAll; private MenuItem mMarkAsRead; private MenuItem mMarkAsUnread; private MenuItem mFlag; private MenuItem mUnflag; | /**
* The underlying implementation for {@link #copy(List, String)} and
* {@link #move(List, String)}. This method was added mainly because those 2
* methods share common behavior.
*
* @param messages
* The list of messages to copy or move. Never {@code null}.
* @param destination
* The name of the destination folder. Never {@code null} or {@link K9#FOLDER_NONE}.
* @param operation
* Specifies what operation to perform. Never {@code null}.
*/ | The underlying implementation for <code>#copy(List, String)</code> and <code>#move(List, String)</code>. This method was added mainly because those 2 methods share common behavior | copyOrMove | {
"repo_name": "imaeses/k-9",
"path": "src/com/fsck/k9/fragment/MessageListFragment.java",
"license": "bsd-3-clause",
"size": 128275
} | [
"android.support.v7.view.ActionMode",
"android.view.MenuItem",
"android.widget.Toast",
"com.fsck.k9.Account",
"com.fsck.k9.mail.Message",
"java.util.ArrayList",
"java.util.HashMap",
"java.util.List",
"java.util.Map"
] | import android.support.v7.view.ActionMode; import android.view.MenuItem; import android.widget.Toast; import com.fsck.k9.Account; import com.fsck.k9.mail.Message; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; | import android.support.v7.view.*; import android.view.*; import android.widget.*; import com.fsck.k9.*; import com.fsck.k9.mail.*; import java.util.*; | [
"android.support",
"android.view",
"android.widget",
"com.fsck.k9",
"java.util"
] | android.support; android.view; android.widget; com.fsck.k9; java.util; | 1,818,735 |
private Artifact artifactFor(String targetName) {
return artifactsByName.get("foo/" + targetName);
} | Artifact function(String targetName) { return artifactsByName.get("foo/" + targetName); } | /**
* Gets a generated artifact object for a target in package "foo" from {@code
* artifactsByName}.
*/ | Gets a generated artifact object for a target in package "foo" from artifactsByName | artifactFor | {
"repo_name": "aehlig/bazel",
"path": "src/test/java/com/google/devtools/build/lib/analysis/LabelExpanderTest.java",
"license": "apache-2.0",
"size": 10274
} | [
"com.google.devtools.build.lib.actions.Artifact"
] | import com.google.devtools.build.lib.actions.Artifact; | import com.google.devtools.build.lib.actions.*; | [
"com.google.devtools"
] | com.google.devtools; | 1,823,491 |
public Optional<Conflict> getConflict(@Nullable String namespace, String path); | Optional<Conflict> function(@Nullable String namespace, String path); | /**
* Gets the specified conflict from the database.
*
* @param namespace the namespace of the conflict
* @param path the conflict to retrieve
* @return the conflict, or {@link Optional#absent()} if it was not found
*/ | Gets the specified conflict from the database | getConflict | {
"repo_name": "msieger/geogig",
"path": "src/core/src/main/java/org/locationtech/geogig/storage/ConflictsDatabase.java",
"license": "bsd-3-clause",
"size": 2465
} | [
"com.google.common.base.Optional",
"javax.annotation.Nullable",
"org.locationtech.geogig.api.plumbing.merge.Conflict"
] | import com.google.common.base.Optional; import javax.annotation.Nullable; import org.locationtech.geogig.api.plumbing.merge.Conflict; | import com.google.common.base.*; import javax.annotation.*; import org.locationtech.geogig.api.plumbing.merge.*; | [
"com.google.common",
"javax.annotation",
"org.locationtech.geogig"
] | com.google.common; javax.annotation; org.locationtech.geogig; | 479,066 |
@Override
public ServletContext getServletContext() {
return null;
} | ServletContext function() { return null; } | /**
* Returns the ServletContext to which this session belongs.
* The ServletContext object for the web application
* */ | Returns the ServletContext to which this session belongs. The ServletContext object for the web application | getServletContext | {
"repo_name": "TimKap/tkapkaev",
"path": "chapter_007/src/test/java/ru/job4j/security/controller/authorization/MockHttpSession.java",
"license": "apache-2.0",
"size": 7135
} | [
"javax.servlet.ServletContext"
] | import javax.servlet.ServletContext; | import javax.servlet.*; | [
"javax.servlet"
] | javax.servlet; | 2,905,383 |
Collection<LabelResource> applyFromGlobalPool(long applyNum); | Collection<LabelResource> applyFromGlobalPool(long applyNum); | /**
* Returns labels from the global label resource pool.
*
* @param applyNum the applying number
* @return collection of applying labels
*/ | Returns labels from the global label resource pool | applyFromGlobalPool | {
"repo_name": "donNewtonAlpha/onos",
"path": "incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceService.java",
"license": "apache-2.0",
"size": 3337
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 853,982 |
@Test
public void testFindSetterWithTwoOptions() throws Exception {
findSetter(bean, "overloaded", Number.class).invoke(bean, Integer.valueOf(123));
assertEquals(123, bean.getOverloaded().intValue());
}
| void function() throws Exception { findSetter(bean, STR, Number.class).invoke(bean, Integer.valueOf(123)); assertEquals(123, bean.getOverloaded().intValue()); } | /**
* Tests the findSetter() method with a field type that's compatible with 2 setters (the exact match should always
* be used).
*/ | Tests the findSetter() method with a field type that's compatible with 2 setters (the exact match should always be used) | testFindSetterWithTwoOptions | {
"repo_name": "liwei5365/super-csv",
"path": "super-csv/src/test/java/org/supercsv/util/ReflectionUtilsTest.java",
"license": "apache-2.0",
"size": 10600
} | [
"org.junit.Assert",
"org.supercsv.util.ReflectionUtils"
] | import org.junit.Assert; import org.supercsv.util.ReflectionUtils; | import org.junit.*; import org.supercsv.util.*; | [
"org.junit",
"org.supercsv.util"
] | org.junit; org.supercsv.util; | 2,665,750 |
private void fireAttributeAdded(String key, Object value) {
if (attributeListeners.size() < 1) {
return;
}
HttpSessionBindingEvent event =
new HttpSessionBindingEvent(this, key, value);
for (Object attributeListener : attributeListeners) {
HttpSessionAttributeListener listener =
(HttpSessionAttributeListener) attributeListener;
listener.attributeAdded(event);
}
} | void function(String key, Object value) { if (attributeListeners.size() < 1) { return; } HttpSessionBindingEvent event = new HttpSessionBindingEvent(this, key, value); for (Object attributeListener : attributeListeners) { HttpSessionAttributeListener listener = (HttpSessionAttributeListener) attributeListener; listener.attributeAdded(event); } } | /**
* <p>Fire an attribute added event to interested listeners.</p>
*
* @param key Attribute whose value was added
* @param value The new value
*/ | Fire an attribute added event to interested listeners | fireAttributeAdded | {
"repo_name": "clescot/jguard",
"path": "jguard-jee-extras/src/test/java/org/apache/shale/test/mock/MockHttpSession.java",
"license": "lgpl-2.1",
"size": 8135
} | [
"javax.servlet.http.HttpSessionAttributeListener",
"javax.servlet.http.HttpSessionBindingEvent"
] | import javax.servlet.http.HttpSessionAttributeListener; import javax.servlet.http.HttpSessionBindingEvent; | import javax.servlet.http.*; | [
"javax.servlet"
] | javax.servlet; | 2,140,924 |
public static ImmutableSet<AppleResourceDescriptionArg> collectRecursiveResources(
XCodeDescriptions xcodeDescriptions,
TargetGraph targetGraph,
Optional<AppleDependenciesCache> cache,
TargetNode<?> targetNode,
RecursiveDependenciesMode mode) {
return FluentIterable.from(
AppleBuildRules.getRecursiveTargetNodeDependenciesOfTypes(
xcodeDescriptions,
targetGraph,
cache,
mode,
targetNode,
ImmutableSet.of(AppleResourceDescription.class)))
.transform(input -> (AppleResourceDescriptionArg) input.getConstructorArg())
.toSet();
} | static ImmutableSet<AppleResourceDescriptionArg> function( XCodeDescriptions xcodeDescriptions, TargetGraph targetGraph, Optional<AppleDependenciesCache> cache, TargetNode<?> targetNode, RecursiveDependenciesMode mode) { return FluentIterable.from( AppleBuildRules.getRecursiveTargetNodeDependenciesOfTypes( xcodeDescriptions, targetGraph, cache, mode, targetNode, ImmutableSet.of(AppleResourceDescription.class))) .transform(input -> (AppleResourceDescriptionArg) input.getConstructorArg()) .toSet(); } | /**
* Collect resources from recursive dependencies.
*
* @param targetGraph The {@link TargetGraph} containing the node and its dependencies.
* @param targetNode {@link TargetNode} at the tip of the traversal.
* @return The recursive resource buildables.
*/ | Collect resources from recursive dependencies | collectRecursiveResources | {
"repo_name": "shs96c/buck",
"path": "src/com/facebook/buck/apple/AppleResources.java",
"license": "apache-2.0",
"size": 4275
} | [
"com.facebook.buck.apple.AppleBuildRules",
"com.facebook.buck.core.model.targetgraph.TargetGraph",
"com.facebook.buck.core.model.targetgraph.TargetNode",
"com.google.common.collect.FluentIterable",
"com.google.common.collect.ImmutableSet",
"java.util.Optional"
] | import com.facebook.buck.apple.AppleBuildRules; import com.facebook.buck.core.model.targetgraph.TargetGraph; import com.facebook.buck.core.model.targetgraph.TargetNode; import com.google.common.collect.FluentIterable; import com.google.common.collect.ImmutableSet; import java.util.Optional; | import com.facebook.buck.apple.*; import com.facebook.buck.core.model.targetgraph.*; import com.google.common.collect.*; import java.util.*; | [
"com.facebook.buck",
"com.google.common",
"java.util"
] | com.facebook.buck; com.google.common; java.util; | 247,258 |
private ObjectId rebaseCommit(Repository git, ObjectInserter inserter,
RevCommit original, RevCommit base, MergeUtil mergeUtil,
PersonIdent committerIdent) throws MergeConflictException, IOException {
RevCommit parentCommit = original.getParent(0);
if (base.equals(parentCommit)) {
throw new IOException("Change is already up to date.");
}
ThreeWayMerger merger = mergeUtil.newThreeWayMerger(git, inserter);
merger.setBase(parentCommit);
merger.merge(original, base);
if (merger.getResultTreeId() == null) {
throw new MergeConflictException(
"The change could not be rebased due to a conflict during merge.");
}
CommitBuilder cb = new CommitBuilder();
cb.setTreeId(merger.getResultTreeId());
cb.setParentId(base);
cb.setAuthor(original.getAuthorIdent());
cb.setMessage(original.getFullMessage());
cb.setCommitter(committerIdent);
ObjectId objectId = inserter.insert(cb);
inserter.flush();
return objectId;
} | ObjectId function(Repository git, ObjectInserter inserter, RevCommit original, RevCommit base, MergeUtil mergeUtil, PersonIdent committerIdent) throws MergeConflictException, IOException { RevCommit parentCommit = original.getParent(0); if (base.equals(parentCommit)) { throw new IOException(STR); } ThreeWayMerger merger = mergeUtil.newThreeWayMerger(git, inserter); merger.setBase(parentCommit); merger.merge(original, base); if (merger.getResultTreeId() == null) { throw new MergeConflictException( STR); } CommitBuilder cb = new CommitBuilder(); cb.setTreeId(merger.getResultTreeId()); cb.setParentId(base); cb.setAuthor(original.getAuthorIdent()); cb.setMessage(original.getFullMessage()); cb.setCommitter(committerIdent); ObjectId objectId = inserter.insert(cb); inserter.flush(); return objectId; } | /**
* Rebase a commit.
*
* @param git repository to find commits in.
* @param inserter inserter to handle new trees and blobs.
* @param original the commit to rebase.
* @param base base to rebase against.
* @param mergeUtil merge utilities for the destination project.
* @param committerIdent committer identity.
* @return the id of the rebased commit.
* @throws MergeConflictException the rebase failed due to a merge conflict.
* @throws IOException the merge failed for another reason.
*/ | Rebase a commit | rebaseCommit | {
"repo_name": "Overruler/gerrit",
"path": "gerrit-server/src/main/java/com/google/gerrit/server/changedetail/RebaseChange.java",
"license": "apache-2.0",
"size": 16659
} | [
"com.google.gerrit.server.git.MergeConflictException",
"com.google.gerrit.server.git.MergeUtil",
"java.io.IOException",
"org.eclipse.jgit.lib.CommitBuilder",
"org.eclipse.jgit.lib.ObjectId",
"org.eclipse.jgit.lib.ObjectInserter",
"org.eclipse.jgit.lib.PersonIdent",
"org.eclipse.jgit.lib.Repository",
"org.eclipse.jgit.merge.ThreeWayMerger",
"org.eclipse.jgit.revwalk.RevCommit"
] | import com.google.gerrit.server.git.MergeConflictException; import com.google.gerrit.server.git.MergeUtil; import java.io.IOException; import org.eclipse.jgit.lib.CommitBuilder; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectInserter; import org.eclipse.jgit.lib.PersonIdent; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.merge.ThreeWayMerger; import org.eclipse.jgit.revwalk.RevCommit; | import com.google.gerrit.server.git.*; import java.io.*; import org.eclipse.jgit.lib.*; import org.eclipse.jgit.merge.*; import org.eclipse.jgit.revwalk.*; | [
"com.google.gerrit",
"java.io",
"org.eclipse.jgit"
] | com.google.gerrit; java.io; org.eclipse.jgit; | 1,585,863 |
private void appendValue(CssValueNode node) {
if (node instanceof CssBooleanExpressionNode) {
appendBooleanExpression((CssBooleanExpressionNode) node);
} else {
sb.append(node.getValue());
}
} | void function(CssValueNode node) { if (node instanceof CssBooleanExpressionNode) { appendBooleanExpression((CssBooleanExpressionNode) node); } else { sb.append(node.getValue()); } } | /**
* This method appends the representation of a value but does not cover
* all cases at the moment.
*/ | This method appends the representation of a value but does not cover all cases at the moment | appendValue | {
"repo_name": "gravitydev/closure-stylesheets",
"path": "tests/com/google/common/css/compiler/passes/testing/AstPrinter.java",
"license": "apache-2.0",
"size": 6351
} | [
"com.google.common.css.compiler.ast.CssBooleanExpressionNode",
"com.google.common.css.compiler.ast.CssValueNode"
] | import com.google.common.css.compiler.ast.CssBooleanExpressionNode; import com.google.common.css.compiler.ast.CssValueNode; | import com.google.common.css.compiler.ast.*; | [
"com.google.common"
] | com.google.common; | 1,229,265 |
public void assertIsAfter(AssertionInfo info, Date actual, Date other) {
assertNotNull(info, actual);
dateParameterIsNotNull(other);
if (isAfter(actual, other)) return;
throw failures.failure(info, shouldBeAfter(actual, other, comparisonStrategy));
} | void function(AssertionInfo info, Date actual, Date other) { assertNotNull(info, actual); dateParameterIsNotNull(other); if (isAfter(actual, other)) return; throw failures.failure(info, shouldBeAfter(actual, other, comparisonStrategy)); } | /**
* Verifies that the actual {@code Date} is strictly after the given one.
* @param info contains information about the assertion.
* @param actual the "actual" {@code Date}.
* @param other the given Date.
* @throws AssertionError if {@code actual} is {@code null}.
* @throws NullPointerException if other {@code Date} is {@code null}.
* @throws AssertionError if the actual {@code Date} is not strictly after the given one.
*/ | Verifies that the actual Date is strictly after the given one | assertIsAfter | {
"repo_name": "AlexBischof/assertj-core",
"path": "src/main/java/org/assertj/core/internal/Dates.java",
"license": "apache-2.0",
"size": 39187
} | [
"java.util.Date",
"org.assertj.core.api.AssertionInfo",
"org.assertj.core.error.ShouldBeAfter"
] | import java.util.Date; import org.assertj.core.api.AssertionInfo; import org.assertj.core.error.ShouldBeAfter; | import java.util.*; import org.assertj.core.api.*; import org.assertj.core.error.*; | [
"java.util",
"org.assertj.core"
] | java.util; org.assertj.core; | 1,609,582 |
private static void putValue1() {
try {
Region r1 = cache.getRegion("/HARegionQueueDUnitTest_region");
r1.put("key-1", "value-1");
} catch (Exception ex) {
fail("failed while region.put()", ex);
}
} | static void function() { try { Region r1 = cache.getRegion(STR); r1.put("key-1", STR); } catch (Exception ex) { fail(STR, ex); } } | /**
* do puts on key-1
*/ | do puts on key-1 | putValue1 | {
"repo_name": "davebarnes97/geode",
"path": "geode-core/src/distributedTest/java/org/apache/geode/internal/cache/ha/HARegionQueueDUnitTest.java",
"license": "apache-2.0",
"size": 37477
} | [
"org.apache.geode.cache.Region",
"org.apache.geode.test.dunit.Assert"
] | import org.apache.geode.cache.Region; import org.apache.geode.test.dunit.Assert; | import org.apache.geode.cache.*; import org.apache.geode.test.dunit.*; | [
"org.apache.geode"
] | org.apache.geode; | 1,892,670 |
public void testModifyAdvertiserUnknownAgencyIdError()
throws XmlRpcException, MalformedURLException {
final Integer id = createAgency();
deleteAgency(id);
Map<String, Object> struct = new HashMap<String, Object>();
struct.put(ADVERTISER_ID, advertiserId);
struct.put(AGENCY_ID, id);
Object[] params = new Object[] { sessionId, struct };
try {
execute(MODIFY_ADVERTISER_METHOD, params);
fail(ErrorMessage.METHOD_EXECUTED_SUCCESSFULLY_BUT_SHOULD_NOT_HAVE);
} catch (XmlRpcException e) {
assertEquals(ErrorMessage.WRONG_ERROR_MESSAGE, ErrorMessage
.getMessage(ErrorMessage.UNKNOWN_ID_ERROR, AGENCY_ID), e
.getMessage());
}
} | void function() throws XmlRpcException, MalformedURLException { final Integer id = createAgency(); deleteAgency(id); Map<String, Object> struct = new HashMap<String, Object>(); struct.put(ADVERTISER_ID, advertiserId); struct.put(AGENCY_ID, id); Object[] params = new Object[] { sessionId, struct }; try { execute(MODIFY_ADVERTISER_METHOD, params); fail(ErrorMessage.METHOD_EXECUTED_SUCCESSFULLY_BUT_SHOULD_NOT_HAVE); } catch (XmlRpcException e) { assertEquals(ErrorMessage.WRONG_ERROR_MESSAGE, ErrorMessage .getMessage(ErrorMessage.UNKNOWN_ID_ERROR, AGENCY_ID), e .getMessage()); } } | /**
* Try to modify advertiser with unknown agency id
*
* @throws XmlRpcException
* @throws MalformedURLException
*/ | Try to modify advertiser with unknown agency id | testModifyAdvertiserUnknownAgencyIdError | {
"repo_name": "adqio/revive-adserver",
"path": "www/api/v2/xmlrpc/tests/unit/src/test/java/org/openx/advertiser/TestModifyAdvertiser.java",
"license": "gpl-2.0",
"size": 7256
} | [
"java.net.MalformedURLException",
"java.util.HashMap",
"java.util.Map",
"org.apache.xmlrpc.XmlRpcException",
"org.openx.utils.ErrorMessage"
] | import java.net.MalformedURLException; import java.util.HashMap; import java.util.Map; import org.apache.xmlrpc.XmlRpcException; import org.openx.utils.ErrorMessage; | import java.net.*; import java.util.*; import org.apache.xmlrpc.*; import org.openx.utils.*; | [
"java.net",
"java.util",
"org.apache.xmlrpc",
"org.openx.utils"
] | java.net; java.util; org.apache.xmlrpc; org.openx.utils; | 984,576 |
@Override
void printSubNodes(int depth)
{
if (SanityManager.DEBUG)
{
super.printSubNodes(depth);
if (resultSet != null)
{
printLabel(depth, "resultSet: ");
resultSet.treePrint(depth + 1);
}
}
} | void printSubNodes(int depth) { if (SanityManager.DEBUG) { super.printSubNodes(depth); if (resultSet != null) { printLabel(depth, STR); resultSet.treePrint(depth + 1); } } } | /**
* Prints the sub-nodes of this object. See QueryTreeNode.java for
* how tree printing is supposed to work.
*
* @param depth The depth of this node in the tree
*/ | Prints the sub-nodes of this object. See QueryTreeNode.java for how tree printing is supposed to work | printSubNodes | {
"repo_name": "apache/derby",
"path": "java/org.apache.derby.engine/org/apache/derby/impl/sql/compile/DMLStatementNode.java",
"license": "apache-2.0",
"size": 14267
} | [
"org.apache.derby.shared.common.sanity.SanityManager"
] | import org.apache.derby.shared.common.sanity.SanityManager; | import org.apache.derby.shared.common.sanity.*; | [
"org.apache.derby"
] | org.apache.derby; | 877,848 |
Map<Import, Definitions> getImportDefinitions(final Metadata metadata,
final List<Import> imports); | Map<Import, Definitions> getImportDefinitions(final Metadata metadata, final List<Import> imports); | /**
* This method loads all imported DMN definitions from a list of imports.
* @param metadata represents the metadata from the main DMN model.
* @param imports represent the list of imported files.
* @return a map {@link Definitions} indexed by {@link Import}s.
*/ | This method loads all imported DMN definitions from a list of imports | getImportDefinitions | {
"repo_name": "jomarko/kie-wb-common",
"path": "kie-wb-common-dmn/kie-wb-common-dmn-backend/src/main/java/org/kie/workbench/common/dmn/backend/common/DMNMarshallerImportsHelperStandalone.java",
"license": "apache-2.0",
"size": 3883
} | [
"java.util.List",
"java.util.Map",
"org.kie.dmn.model.api.Definitions",
"org.kie.dmn.model.api.Import",
"org.kie.workbench.common.stunner.core.diagram.Metadata"
] | import java.util.List; import java.util.Map; import org.kie.dmn.model.api.Definitions; import org.kie.dmn.model.api.Import; import org.kie.workbench.common.stunner.core.diagram.Metadata; | import java.util.*; import org.kie.dmn.model.api.*; import org.kie.workbench.common.stunner.core.diagram.*; | [
"java.util",
"org.kie.dmn",
"org.kie.workbench"
] | java.util; org.kie.dmn; org.kie.workbench; | 679,333 |
protected Object wrapIfNecessary(Object bean, String beanName, Object cacheKey) {
if (beanName != null && this.targetSourcedBeans.contains(beanName)) {
return bean;
}
if (Boolean.FALSE.equals(this.advisedBeans.get(cacheKey))) {
return bean;
}
if (isInfrastructureClass(bean.getClass()) || shouldSkip(bean.getClass(), beanName)) {
this.advisedBeans.put(cacheKey, Boolean.FALSE);
return bean;
}
// Create proxy if we have advice.
Object[] specificInterceptors = getAdvicesAndAdvisorsForBean(bean.getClass(), beanName, null);
if (specificInterceptors != DO_NOT_PROXY) {
this.advisedBeans.put(cacheKey, Boolean.TRUE);
Object proxy = createProxy(
bean.getClass(), beanName, specificInterceptors, new SingletonTargetSource(bean));
this.proxyTypes.put(cacheKey, proxy.getClass());
return proxy;
}
this.advisedBeans.put(cacheKey, Boolean.FALSE);
return bean;
} | Object function(Object bean, String beanName, Object cacheKey) { if (beanName != null && this.targetSourcedBeans.contains(beanName)) { return bean; } if (Boolean.FALSE.equals(this.advisedBeans.get(cacheKey))) { return bean; } if (isInfrastructureClass(bean.getClass()) shouldSkip(bean.getClass(), beanName)) { this.advisedBeans.put(cacheKey, Boolean.FALSE); return bean; } Object[] specificInterceptors = getAdvicesAndAdvisorsForBean(bean.getClass(), beanName, null); if (specificInterceptors != DO_NOT_PROXY) { this.advisedBeans.put(cacheKey, Boolean.TRUE); Object proxy = createProxy( bean.getClass(), beanName, specificInterceptors, new SingletonTargetSource(bean)); this.proxyTypes.put(cacheKey, proxy.getClass()); return proxy; } this.advisedBeans.put(cacheKey, Boolean.FALSE); return bean; } | /**
* Wrap the given bean if necessary, i.e. if it is eligible for being proxied.
* @param bean the raw bean instance
* @param beanName the name of the bean
* @param cacheKey the cache key for metadata access
* @return a proxy wrapping the bean, or the raw bean instance as-is
*/ | Wrap the given bean if necessary, i.e. if it is eligible for being proxied | wrapIfNecessary | {
"repo_name": "shivpun/spring-framework",
"path": "spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAutoProxyCreator.java",
"license": "apache-2.0",
"size": 22736
} | [
"org.springframework.aop.target.SingletonTargetSource"
] | import org.springframework.aop.target.SingletonTargetSource; | import org.springframework.aop.target.*; | [
"org.springframework.aop"
] | org.springframework.aop; | 2,748,848 |
void exceptionReceived(V4L4JException e); | void exceptionReceived(V4L4JException e); | /**
* This method is called if an error occurs during capture. It is safe to
* assume that if this method is called, no more calls to
* {@link #nextFrame(VideoFrame)} will follow.
*
* @param e
* the exception that was raised during the capture.
*/ | This method is called if an error occurs during capture. It is safe to assume that if this method is called, no more calls to <code>#nextFrame(VideoFrame)</code> will follow | exceptionReceived | {
"repo_name": "mailmindlin/v4l4j",
"path": "src/au/edu/jcu/v4l4j/CaptureCallback.java",
"license": "gpl-3.0",
"size": 2306
} | [
"au.edu.jcu.v4l4j.exceptions.V4L4JException"
] | import au.edu.jcu.v4l4j.exceptions.V4L4JException; | import au.edu.jcu.v4l4j.exceptions.*; | [
"au.edu.jcu"
] | au.edu.jcu; | 2,228,417 |
private static void removeItems(final ItemStack[] items, final GlowCraftingInventory inv,
final int amount) {
if (amount < 0) {
throw new IllegalArgumentException("Can not remove negative amount of layers.");
}
for (int i = 0; i < items.length; i++) {
if (!InventoryUtil.isEmpty(items[i])) {
int itemAmount = items[i].getAmount();
if (itemAmount > amount) {
items[i].setAmount(itemAmount - amount);
inv.updateResultSlot();
} else {
inv.setItem(i + 1, InventoryUtil.createEmptyStack());
}
}
}
} | static void function(final ItemStack[] items, final GlowCraftingInventory inv, final int amount) { if (amount < 0) { throw new IllegalArgumentException(STR); } for (int i = 0; i < items.length; i++) { if (!InventoryUtil.isEmpty(items[i])) { int itemAmount = items[i].getAmount(); if (itemAmount > amount) { items[i].setAmount(itemAmount - amount); inv.updateResultSlot(); } else { inv.setItem(i + 1, InventoryUtil.createEmptyStack()); } } } } | /**
* Remove a specific amount of layers from the crafting matrix and recipe result.
*
* @param items The items to remove the ingredients from.
* @param inv The inventory to remove the items from.
* @param amount The amount of items you want to remove.
*/ | Remove a specific amount of layers from the crafting matrix and recipe result | removeItems | {
"repo_name": "GlowstonePlusPlus/GlowstonePlusPlus",
"path": "src/main/java/net/glowstone/inventory/GlowCraftingInventory.java",
"license": "mit",
"size": 6900
} | [
"net.glowstone.util.InventoryUtil",
"org.bukkit.inventory.ItemStack"
] | import net.glowstone.util.InventoryUtil; import org.bukkit.inventory.ItemStack; | import net.glowstone.util.*; import org.bukkit.inventory.*; | [
"net.glowstone.util",
"org.bukkit.inventory"
] | net.glowstone.util; org.bukkit.inventory; | 2,763,253 |
public T value()
throws ConcurrentModificationException, NoSuchElementException {
if (referenceCount != count) {
throw MathRuntimeException.createConcurrentModificationException("map has been modified while iterating");
}
if (current < 0) {
throw MathRuntimeException.createNoSuchElementException("iterator exhausted");
}
return values[current];
}
| T function() throws ConcurrentModificationException, NoSuchElementException { if (referenceCount != count) { throw MathRuntimeException.createConcurrentModificationException(STR); } if (current < 0) { throw MathRuntimeException.createNoSuchElementException(STR); } return values[current]; } | /**
* Get the value of current entry.
* @return value of current entry
* @exception ConcurrentModificationException if the map is modified during iteration
* @exception NoSuchElementException if there is no element left in the map
*/ | Get the value of current entry | value | {
"repo_name": "SpoonLabs/astor",
"path": "examples/math_85/src/java/org/apache/commons/math/util/OpenIntToFieldHashMap.java",
"license": "gpl-2.0",
"size": 19891
} | [
"java.util.ConcurrentModificationException",
"java.util.NoSuchElementException",
"org.apache.commons.math.MathRuntimeException"
] | import java.util.ConcurrentModificationException; import java.util.NoSuchElementException; import org.apache.commons.math.MathRuntimeException; | import java.util.*; import org.apache.commons.math.*; | [
"java.util",
"org.apache.commons"
] | java.util; org.apache.commons; | 1,747,556 |
public static Calendar parseDate(String value, String format) throws ParseException {
Calendar date = Calendar.getInstance();
date.setTime(new SimpleDateFormat(format).parse(value.trim()));
return date;
} | static Calendar function(String value, String format) throws ParseException { Calendar date = Calendar.getInstance(); date.setTime(new SimpleDateFormat(format).parse(value.trim())); return date; } | /**
* Parse the date of the format.
*/ | Parse the date of the format | parseDate | {
"repo_name": "BOTlibre/BOTlibre",
"path": "ai-engine/source/org/botlibre/util/Utils.java",
"license": "epl-1.0",
"size": 57729
} | [
"java.text.ParseException",
"java.text.SimpleDateFormat",
"java.util.Calendar"
] | import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; | import java.text.*; import java.util.*; | [
"java.text",
"java.util"
] | java.text; java.util; | 2,707,752 |
@Test
public final void testReadDataTimeout() throws Exception {
// Setup the resources for the test.
int timeout = 100;
assertThat("Network should be empty", xbeeDevice.getNetwork().getNumberOfDevices(), is(equalTo(0)));
// Call the method under test.
XBeeMessage readMessage = xbeeDevice.readData(timeout);
// Verify the result.
PowerMockito.verifyPrivate(xbeeDevice).invoke("readDataPacket", null, timeout);
RemoteXBeeDevice src = readMessage.getDevice();
assertThat("Source remote device must not be null", src, is(not(equalTo(null))));
assertThat("64-bit address must be '" + addr64 + "' and not '" + src.get64BitAddress() + "'", src.get64BitAddress(), is(equalTo(addr64)));
assertThat("16-bit address must be '" + addr16 + "' and not '" + src.get16BitAddress() + "'", src.get16BitAddress(), is(equalTo(addr16)));
assertThat("Received data must be '" + receivedData + "' and not '" + readMessage.getDataString() + "'", readMessage.getDataString(), is(equalTo(receivedData)));
assertThat("Receive message must not be broadcast", readMessage.isBroadcast(), is(equalTo(false)));
assertThat("Network should contain only 1 device", xbeeDevice.getNetwork().getNumberOfDevices(), is(equalTo(1)));
}
| final void function() throws Exception { int timeout = 100; assertThat(STR, xbeeDevice.getNetwork().getNumberOfDevices(), is(equalTo(0))); XBeeMessage readMessage = xbeeDevice.readData(timeout); PowerMockito.verifyPrivate(xbeeDevice).invoke(STR, null, timeout); RemoteXBeeDevice src = readMessage.getDevice(); assertThat(STR, src, is(not(equalTo(null)))); assertThat(STR + addr64 + STR + src.get64BitAddress() + "'", src.get64BitAddress(), is(equalTo(addr64))); assertThat(STR + addr16 + STR + src.get16BitAddress() + "'", src.get16BitAddress(), is(equalTo(addr16))); assertThat(STR + receivedData + STR + readMessage.getDataString() + "'", readMessage.getDataString(), is(equalTo(receivedData))); assertThat(STR, readMessage.isBroadcast(), is(equalTo(false))); assertThat(STR, xbeeDevice.getNetwork().getNumberOfDevices(), is(equalTo(1))); } | /**
* Test method for {@link com.digi.xbee.api.XBeeDevice#readData(int))}.
*
* @throws Exception
*/ | Test method for <code>com.digi.xbee.api.XBeeDevice#readData(int))</code> | testReadDataTimeout | {
"repo_name": "brucetsao/XBeeJavaLibrary",
"path": "library/src/test/java/com/digi/xbee/api/XBeeDeviceReadDataTest.java",
"license": "mpl-2.0",
"size": 25280
} | [
"com.digi.xbee.api.models.XBeeMessage",
"org.hamcrest.core.Is",
"org.junit.Assert",
"org.powermock.api.mockito.PowerMockito"
] | import com.digi.xbee.api.models.XBeeMessage; import org.hamcrest.core.Is; import org.junit.Assert; import org.powermock.api.mockito.PowerMockito; | import com.digi.xbee.api.models.*; import org.hamcrest.core.*; import org.junit.*; import org.powermock.api.mockito.*; | [
"com.digi.xbee",
"org.hamcrest.core",
"org.junit",
"org.powermock.api"
] | com.digi.xbee; org.hamcrest.core; org.junit; org.powermock.api; | 2,298,017 |
public static void deleteCourse(Context context, Integer id) {
deleteCourse(context, String.valueOf(id));
} | static void function(Context context, Integer id) { deleteCourse(context, String.valueOf(id)); } | /**
* Delete a course.
*
* @param id
* The identifier of the course to delete.
*/ | Delete a course | deleteCourse | {
"repo_name": "rgmf/LTN",
"path": "src/es/rgmf/ltn/model/WriterModel.java",
"license": "gpl-3.0",
"size": 14603
} | [
"android.content.Context"
] | import android.content.Context; | import android.content.*; | [
"android.content"
] | android.content; | 746,787 |
public void showTooltipAt(double x, double y, double dx, double dy) {
PCamera camera = getCamera();
PBounds cameraBounds = camera.getBoundsReference();
PBounds tooltipBounds = getBoundsReference();
Point2D pos = new Point2D.Double(x, y);
camera.viewToLocal(pos);
x = pos.getX();
y = pos.getY();
if (x + tooltipBounds.getWidth() > cameraBounds.getWidth()) {
final double _x = pos.getX() - tooltipBounds.getWidth() - dx;
if (cameraBounds.getX() - _x < x + tooltipBounds.getWidth() - cameraBounds.getMaxX()) {
x = _x;
}
}
if (y + tooltipBounds.getHeight() > cameraBounds.getHeight()) {
final double _y = pos.getY() - tooltipBounds.getHeight() - dy;
if (cameraBounds.getY() - _y < y + tooltipBounds.getHeight() - cameraBounds.getMaxY()) {
y = _y;
}
}
pos.setLocation(x + dx, y + dy);
setPosition(pos.getX(), pos.getY());
setVisible(true);
}
| void function(double x, double y, double dx, double dy) { PCamera camera = getCamera(); PBounds cameraBounds = camera.getBoundsReference(); PBounds tooltipBounds = getBoundsReference(); Point2D pos = new Point2D.Double(x, y); camera.viewToLocal(pos); x = pos.getX(); y = pos.getY(); if (x + tooltipBounds.getWidth() > cameraBounds.getWidth()) { final double _x = pos.getX() - tooltipBounds.getWidth() - dx; if (cameraBounds.getX() - _x < x + tooltipBounds.getWidth() - cameraBounds.getMaxX()) { x = _x; } } if (y + tooltipBounds.getHeight() > cameraBounds.getHeight()) { final double _y = pos.getY() - tooltipBounds.getHeight() - dy; if (cameraBounds.getY() - _y < y + tooltipBounds.getHeight() - cameraBounds.getMaxY()) { y = _y; } } pos.setLocation(x + dx, y + dy); setPosition(pos.getX(), pos.getY()); setVisible(true); } | /**
* This method places the tooltip so that it is still visible on the screen
* even if the point is close to the edge.
*/ | This method places the tooltip so that it is still visible on the screen even if the point is close to the edge | showTooltipAt | {
"repo_name": "e3bo/jflowmap",
"path": "src/jflowmap/views/PTooltip.java",
"license": "apache-2.0",
"size": 6402
} | [
"edu.umd.cs.piccolo.PCamera",
"edu.umd.cs.piccolo.util.PBounds",
"java.awt.geom.Point2D"
] | import edu.umd.cs.piccolo.PCamera; import edu.umd.cs.piccolo.util.PBounds; import java.awt.geom.Point2D; | import edu.umd.cs.piccolo.*; import edu.umd.cs.piccolo.util.*; import java.awt.geom.*; | [
"edu.umd.cs",
"java.awt"
] | edu.umd.cs; java.awt; | 255,516 |
public Path createTezDir(Path scratchDir, Configuration conf)
throws IOException {
UserGroupInformation ugi;
String userName = System.getProperty("user.name");
try {
ugi = Utils.getUGI();
userName = ugi.getShortUserName();
} catch (LoginException e) {
throw new IOException(e);
}
scratchDir = new Path(scratchDir, userName);
Path tezDir = getTezDir(scratchDir);
if (!HiveConf.getBoolVar(conf, ConfVars.HIVE_RPC_QUERY_PLAN)) {
FileSystem fs = tezDir.getFileSystem(conf);
LOG.debug("TezDir path set " + tezDir + " for user: " + userName);
// since we are adding the user name to the scratch dir, we do not
// need to give more permissions here
// Since we are doing RPC creating a dir is not necessary
fs.mkdirs(tezDir);
}
return tezDir;
} | Path function(Path scratchDir, Configuration conf) throws IOException { UserGroupInformation ugi; String userName = System.getProperty(STR); try { ugi = Utils.getUGI(); userName = ugi.getShortUserName(); } catch (LoginException e) { throw new IOException(e); } scratchDir = new Path(scratchDir, userName); Path tezDir = getTezDir(scratchDir); if (!HiveConf.getBoolVar(conf, ConfVars.HIVE_RPC_QUERY_PLAN)) { FileSystem fs = tezDir.getFileSystem(conf); LOG.debug(STR + tezDir + STR + userName); fs.mkdirs(tezDir); } return tezDir; } | /**
* createTezDir creates a temporary directory in the scratchDir folder to
* be used with Tez. Assumes scratchDir exists.
*/ | createTezDir creates a temporary directory in the scratchDir folder to be used with Tez. Assumes scratchDir exists | createTezDir | {
"repo_name": "jcamachor/hive",
"path": "ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DagUtils.java",
"license": "apache-2.0",
"size": 77100
} | [
"java.io.IOException",
"javax.security.auth.login.LoginException",
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.fs.FileSystem",
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.hive.conf.HiveConf",
"org.apache.hadoop.hive.shims.Utils",
"org.apache.hadoop.security.UserGroupInformation"
] | import java.io.IOException; import javax.security.auth.login.LoginException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.shims.Utils; import org.apache.hadoop.security.UserGroupInformation; | import java.io.*; import javax.security.auth.login.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hive.conf.*; import org.apache.hadoop.hive.shims.*; import org.apache.hadoop.security.*; | [
"java.io",
"javax.security",
"org.apache.hadoop"
] | java.io; javax.security; org.apache.hadoop; | 2,736,337 |
private void applyDelegateRelationship(
DelegateRelationship delegateRelationship) {
ObjectType delegatorObject = ObjectType.cast(
typeRegistry.getType(delegateRelationship.delegator));
ObjectType delegateBaseObject = ObjectType.cast(
typeRegistry.getType(delegateRelationship.delegateBase));
ObjectType delegateSuperObject = ObjectType.cast(
typeRegistry.getType(codingConvention.getDelegateSuperclassName()));
if (delegatorObject != null &&
delegateBaseObject != null &&
delegateSuperObject != null) {
FunctionType delegatorCtor = delegatorObject.getConstructor();
FunctionType delegateBaseCtor = delegateBaseObject.getConstructor();
FunctionType delegateSuperCtor = delegateSuperObject.getConstructor();
if (delegatorCtor != null && delegateBaseCtor != null &&
delegateSuperCtor != null) {
FunctionParamBuilder functionParamBuilder =
new FunctionParamBuilder(typeRegistry);
functionParamBuilder.addRequiredParams(
getNativeType(U2U_CONSTRUCTOR_TYPE));
FunctionType findDelegate = typeRegistry.createFunctionType(
typeRegistry.createDefaultObjectUnion(delegateBaseObject),
functionParamBuilder.build());
FunctionType delegateProxy = typeRegistry.createConstructorType(
delegateBaseObject.getReferenceName() + DELEGATE_PROXY_SUFFIX,
null, null, null, null);
delegateProxy.setPrototypeBasedOn(delegateBaseObject);
codingConvention.applyDelegateRelationship(
delegateSuperObject, delegateBaseObject, delegatorObject,
delegateProxy, findDelegate);
delegateProxyPrototypes.add(delegateProxy.getPrototype());
}
}
} | void function( DelegateRelationship delegateRelationship) { ObjectType delegatorObject = ObjectType.cast( typeRegistry.getType(delegateRelationship.delegator)); ObjectType delegateBaseObject = ObjectType.cast( typeRegistry.getType(delegateRelationship.delegateBase)); ObjectType delegateSuperObject = ObjectType.cast( typeRegistry.getType(codingConvention.getDelegateSuperclassName())); if (delegatorObject != null && delegateBaseObject != null && delegateSuperObject != null) { FunctionType delegatorCtor = delegatorObject.getConstructor(); FunctionType delegateBaseCtor = delegateBaseObject.getConstructor(); FunctionType delegateSuperCtor = delegateSuperObject.getConstructor(); if (delegatorCtor != null && delegateBaseCtor != null && delegateSuperCtor != null) { FunctionParamBuilder functionParamBuilder = new FunctionParamBuilder(typeRegistry); functionParamBuilder.addRequiredParams( getNativeType(U2U_CONSTRUCTOR_TYPE)); FunctionType findDelegate = typeRegistry.createFunctionType( typeRegistry.createDefaultObjectUnion(delegateBaseObject), functionParamBuilder.build()); FunctionType delegateProxy = typeRegistry.createConstructorType( delegateBaseObject.getReferenceName() + DELEGATE_PROXY_SUFFIX, null, null, null, null); delegateProxy.setPrototypeBasedOn(delegateBaseObject); codingConvention.applyDelegateRelationship( delegateSuperObject, delegateBaseObject, delegatorObject, delegateProxy, findDelegate); delegateProxyPrototypes.add(delegateProxy.getPrototype()); } } } | /**
* Apply special properties that only apply to delegates.
*/ | Apply special properties that only apply to delegates | applyDelegateRelationship | {
"repo_name": "abdullah38rcc/closure-compiler",
"path": "src/com/google/javascript/jscomp/TypedScopeCreator.java",
"license": "apache-2.0",
"size": 77579
} | [
"com.google.javascript.jscomp.CodingConvention",
"com.google.javascript.rhino.jstype.FunctionParamBuilder",
"com.google.javascript.rhino.jstype.FunctionType",
"com.google.javascript.rhino.jstype.ObjectType"
] | import com.google.javascript.jscomp.CodingConvention; import com.google.javascript.rhino.jstype.FunctionParamBuilder; import com.google.javascript.rhino.jstype.FunctionType; import com.google.javascript.rhino.jstype.ObjectType; | import com.google.javascript.jscomp.*; import com.google.javascript.rhino.jstype.*; | [
"com.google.javascript"
] | com.google.javascript; | 739,560 |
Map<String, I_CmsSearchConfigurationFacetField> parseFieldFacets(); | Map<String, I_CmsSearchConfigurationFacetField> parseFieldFacets(); | /** Returns the configuration for the field facets.
* @return The configuration for the field facets.
*/ | Returns the configuration for the field facets | parseFieldFacets | {
"repo_name": "alkacon/opencms-core",
"path": "src/org/opencms/jsp/search/config/parser/I_CmsSearchConfigurationParser.java",
"license": "lgpl-2.1",
"size": 3670
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,613,818 |
public void setScreenBrightness(ScreenBrightness brightness) {
screenBrightness = brightness;
} | void function(ScreenBrightness brightness) { screenBrightness = brightness; } | /**
* Sets the {@link ScreenBrightness} of this player.
*
* @param brightness The screen brightness.
*/ | Sets the <code>ScreenBrightness</code> of this player | setScreenBrightness | {
"repo_name": "Major-/apollo",
"path": "game/src/main/org/apollo/game/model/entity/Player.java",
"license": "isc",
"size": 24470
} | [
"org.apollo.game.model.entity.setting.ScreenBrightness"
] | import org.apollo.game.model.entity.setting.ScreenBrightness; | import org.apollo.game.model.entity.setting.*; | [
"org.apollo.game"
] | org.apollo.game; | 1,986,339 |
public void selectionChanged(ISelection selection) {
setEnabled(false);
} | void function(ISelection selection) { setEnabled(false); } | /**
* Notifies this action that the given selection has changed. This default
* implementation sets the action's enablement state to <code>false</code>.
*
* @param selection the new selection
*/ | Notifies this action that the given selection has changed. This default implementation sets the action's enablement state to <code>false</code> | selectionChanged | {
"repo_name": "elucash/eclipse-oxygen",
"path": "org.eclipse.jdt.ui/src/org/eclipse/jdt/ui/actions/SelectionDispatchAction.java",
"license": "epl-1.0",
"size": 8712
} | [
"org.eclipse.jface.viewers.ISelection"
] | import org.eclipse.jface.viewers.ISelection; | import org.eclipse.jface.viewers.*; | [
"org.eclipse.jface"
] | org.eclipse.jface; | 1,569,307 |
public synchronized Task findTask(String id) {
Task t = tasksRunning.get(id);
if (t != null) return t;
t = tasksDone.get(id);
if (t != null) return t;
for (Task tt : tasksToRun)
if (tt.getId().equals(id)) return tt;
return null;
} | synchronized Task function(String id) { Task t = tasksRunning.get(id); if (t != null) return t; t = tasksDone.get(id); if (t != null) return t; for (Task tt : tasksToRun) if (tt.getId().equals(id)) return tt; return null; } | /**
* Find a task by ID
*/ | Find a task by ID | findTask | {
"repo_name": "leepc12/BigDataScript",
"path": "src/org/bds/executioner/Executioner.java",
"license": "apache-2.0",
"size": 21991
} | [
"org.bds.task.Task"
] | import org.bds.task.Task; | import org.bds.task.*; | [
"org.bds.task"
] | org.bds.task; | 580,921 |
public static PairedStats fromByteArray(byte[] byteArray) {
checkNotNull(byteArray);
checkArgument(
byteArray.length == BYTES,
"Expected PairedStats.BYTES = %s, got %s",
BYTES,
byteArray.length);
ByteBuffer buffer = ByteBuffer.wrap(byteArray).order(ByteOrder.LITTLE_ENDIAN);
Stats xStats = Stats.readFrom(buffer);
Stats yStats = Stats.readFrom(buffer);
double sumOfProductsOfDeltas = buffer.getDouble();
return new PairedStats(xStats, yStats, sumOfProductsOfDeltas);
}
private static final long serialVersionUID = 0; | static PairedStats function(byte[] byteArray) { checkNotNull(byteArray); checkArgument( byteArray.length == BYTES, STR, BYTES, byteArray.length); ByteBuffer buffer = ByteBuffer.wrap(byteArray).order(ByteOrder.LITTLE_ENDIAN); Stats xStats = Stats.readFrom(buffer); Stats yStats = Stats.readFrom(buffer); double sumOfProductsOfDeltas = buffer.getDouble(); return new PairedStats(xStats, yStats, sumOfProductsOfDeltas); } private static final long serialVersionUID = 0; | /**
* Creates a {@link PairedStats} instance from the given byte representation which was obtained by
* {@link #toByteArray}.
*
* <p><b>Note:</b> No guarantees are made regarding stability of the representation between
* versions.
*/ | Creates a <code>PairedStats</code> instance from the given byte representation which was obtained by <code>#toByteArray</code>. Note: No guarantees are made regarding stability of the representation between versions | fromByteArray | {
"repo_name": "EdwardLee03/guava",
"path": "android/guava/src/com/google/common/math/PairedStats.java",
"license": "apache-2.0",
"size": 12905
} | [
"com.google.common.base.Preconditions",
"java.nio.ByteBuffer",
"java.nio.ByteOrder"
] | import com.google.common.base.Preconditions; import java.nio.ByteBuffer; import java.nio.ByteOrder; | import com.google.common.base.*; import java.nio.*; | [
"com.google.common",
"java.nio"
] | com.google.common; java.nio; | 1,307,709 |
public void resetUserLayoutAllProfiles(final IPersonAttributes personAttributes) {
RestrictedPerson person = PersonFactory.createRestrictedPerson();
person.setAttributes(personAttributes.getAttributes());
// get the integer uid into the person object without creating any new person data
int uid = userIdentityStore.getPortalUID(person, false);
person.setID(uid);
try {
Hashtable<Integer, UserProfile> userProfileList =
userLayoutStore.getUserProfileList(person);
for (Integer key : userProfileList.keySet()) {
UserProfile userProfile = userProfileList.get(key);
userProfile.setLayoutId(0);
userLayoutStore.updateUserProfile(person, userProfile);
logger.info(
"resetUserLayout complete for " + person + "for profile " + userProfile);
}
} catch (Exception e) {
final String msg = "Exception caught during resetUserLayout for " + person;
logger.error(msg, e);
throw new PortalException(msg, e);
}
return;
} | void function(final IPersonAttributes personAttributes) { RestrictedPerson person = PersonFactory.createRestrictedPerson(); person.setAttributes(personAttributes.getAttributes()); int uid = userIdentityStore.getPortalUID(person, false); person.setID(uid); try { Hashtable<Integer, UserProfile> userProfileList = userLayoutStore.getUserProfileList(person); for (Integer key : userProfileList.keySet()) { UserProfile userProfile = userProfileList.get(key); userProfile.setLayoutId(0); userLayoutStore.updateUserProfile(person, userProfile); logger.info( STR + person + STR + userProfile); } } catch (Exception e) { final String msg = STR + person; logger.error(msg, e); throw new PortalException(msg, e); } return; } | /**
* Resets a users layout for all the users profiles
*
* @param personAttributes
*/ | Resets a users layout for all the users profiles | resetUserLayoutAllProfiles | {
"repo_name": "jhelmer-unicon/uPortal",
"path": "uportal-war/src/main/java/org/apereo/portal/layout/UserLayoutHelperImpl.java",
"license": "apache-2.0",
"size": 5066
} | [
"java.util.Hashtable",
"org.apereo.portal.PortalException",
"org.apereo.portal.UserProfile",
"org.apereo.portal.security.PersonFactory",
"org.apereo.portal.security.provider.RestrictedPerson",
"org.jasig.services.persondir.IPersonAttributes"
] | import java.util.Hashtable; import org.apereo.portal.PortalException; import org.apereo.portal.UserProfile; import org.apereo.portal.security.PersonFactory; import org.apereo.portal.security.provider.RestrictedPerson; import org.jasig.services.persondir.IPersonAttributes; | import java.util.*; import org.apereo.portal.*; import org.apereo.portal.security.*; import org.apereo.portal.security.provider.*; import org.jasig.services.persondir.*; | [
"java.util",
"org.apereo.portal",
"org.jasig.services"
] | java.util; org.apereo.portal; org.jasig.services; | 2,684,327 |
public BufferedImage getBitmap() {
return myBitmap;
}
| BufferedImage function() { return myBitmap; } | /**
* The returned value may be null if it cannot be downloaded!
* @return the bitmap of the tile
*/ | The returned value may be null if it cannot be downloaded | getBitmap | {
"repo_name": "xafero/travelingsales",
"path": "osmnavigation/src/main/java/org/openstreetmap/travelingsalesman/painting/SmoothTilePainter.java",
"license": "gpl-3.0",
"size": 44882
} | [
"java.awt.image.BufferedImage"
] | import java.awt.image.BufferedImage; | import java.awt.image.*; | [
"java.awt"
] | java.awt; | 866,246 |
public void setDemographic(Demographic demographic) {
this.demographic = demographic;
} | void function(Demographic demographic) { this.demographic = demographic; } | /**
* Sets the demographic for the document.
* @param demographic The demographic.
*/ | Sets the demographic for the document | setDemographic | {
"repo_name": "scoophealth/oscar",
"path": "src/main/java/org/oscarehr/sharingcenter/model/DemographicExport.java",
"license": "gpl-2.0",
"size": 3235
} | [
"org.oscarehr.common.model.Demographic"
] | import org.oscarehr.common.model.Demographic; | import org.oscarehr.common.model.*; | [
"org.oscarehr.common"
] | org.oscarehr.common; | 986,739 |
public void add(SourceSplit split, E record) {
add(split.splitId(), record);
} | void function(SourceSplit split, E record) { add(split.splitId(), record); } | /**
* Add the record from the given source split.
*
* @param split the source split the record was from.
* @param record the record to add.
*/ | Add the record from the given source split | add | {
"repo_name": "darionyaphet/flink",
"path": "flink-connectors/flink-connector-base/src/main/java/org/apache/flink/connector/base/source/reader/RecordsBySplits.java",
"license": "apache-2.0",
"size": 4744
} | [
"org.apache.flink.api.connector.source.SourceSplit"
] | import org.apache.flink.api.connector.source.SourceSplit; | import org.apache.flink.api.connector.source.*; | [
"org.apache.flink"
] | org.apache.flink; | 2,146,637 |
private void init() throws SlickException {
try {
Texture tex = InternalTextureLoader.get().createTexture(image.getWidth(), image.getHeight(),
image.getFilter());
pbuffer = new Pbuffer(screenWidth, screenHeight, new PixelFormat(8, 0, 0), null, null);
// Initialise state of the pbuffer context.
pbuffer.makeCurrent();
initGL();
image.draw(0, 0);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, tex.getTextureID());
GL11.glCopyTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, 0, 0, tex.getTextureWidth(),
tex.getTextureHeight(), 0);
image.setTexture(tex);
Display.makeCurrent();
} catch (Exception e) {
Log.error(e);
throw new SlickException("Failed to create PBuffer for dynamic image. OpenGL driver failure?");
}
} | void function() throws SlickException { try { Texture tex = InternalTextureLoader.get().createTexture(image.getWidth(), image.getHeight(), image.getFilter()); pbuffer = new Pbuffer(screenWidth, screenHeight, new PixelFormat(8, 0, 0), null, null); pbuffer.makeCurrent(); initGL(); image.draw(0, 0); GL11.glBindTexture(GL11.GL_TEXTURE_2D, tex.getTextureID()); GL11.glCopyTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, 0, 0, tex.getTextureWidth(), tex.getTextureHeight(), 0); image.setTexture(tex); Display.makeCurrent(); } catch (Exception e) { Log.error(e); throw new SlickException(STR); } } | /**
* Initialise the PBuffer that will be used to render to
* <p/>
*
* @throws SlickException
*/ | Initialise the PBuffer that will be used to render to | init | {
"repo_name": "emabrey/SleekSlick2D",
"path": "slick/src/main/java/org/newdawn/slick/opengl/pbuffer/PBufferUniqueGraphics.java",
"license": "bsd-3-clause",
"size": 5126
} | [
"org.lwjgl.opengl.Display",
"org.lwjgl.opengl.Pbuffer",
"org.lwjgl.opengl.PixelFormat",
"org.newdawn.slick.SlickException",
"org.newdawn.slick.opengl.InternalTextureLoader",
"org.newdawn.slick.opengl.Texture",
"org.newdawn.slick.util.Log"
] | import org.lwjgl.opengl.Display; import org.lwjgl.opengl.Pbuffer; import org.lwjgl.opengl.PixelFormat; import org.newdawn.slick.SlickException; import org.newdawn.slick.opengl.InternalTextureLoader; import org.newdawn.slick.opengl.Texture; import org.newdawn.slick.util.Log; | import org.lwjgl.opengl.*; import org.newdawn.slick.*; import org.newdawn.slick.opengl.*; import org.newdawn.slick.util.*; | [
"org.lwjgl.opengl",
"org.newdawn.slick"
] | org.lwjgl.opengl; org.newdawn.slick; | 2,031,373 |
private PointF transformCoordBitmapToTouch(float bx, float by) {
matrix.getValues(m);
float origW = getDrawable().getIntrinsicWidth();
float origH = getDrawable().getIntrinsicHeight();
float px = bx / origW;
float py = by / origH;
float finalX = m[Matrix.MTRANS_X] + getImageWidth() * px;
float finalY = m[Matrix.MTRANS_Y] + getImageHeight() * py;
return new PointF(finalX, finalY);
}
private class Fling implements Runnable {
CompatScroller scroller;
int currX, currY;
Fling(int velocityX, int velocityY) {
setState(State.FLING);
scroller = new CompatScroller(context);
matrix.getValues(m);
int startX = (int) m[Matrix.MTRANS_X];
int startY = (int) m[Matrix.MTRANS_Y];
int minX, maxX, minY, maxY;
if (getImageWidth() > viewWidth) {
minX = viewWidth - (int) getImageWidth();
maxX = 0;
} else {
minX = maxX = startX;
}
if (getImageHeight() > viewHeight) {
minY = viewHeight - (int) getImageHeight();
maxY = 0;
} else {
minY = maxY = startY;
}
scroller.fling(startX, startY, (int) velocityX, (int) velocityY, minX,
maxX, minY, maxY);
currX = startX;
currY = startY;
} | PointF function(float bx, float by) { matrix.getValues(m); float origW = getDrawable().getIntrinsicWidth(); float origH = getDrawable().getIntrinsicHeight(); float px = bx / origW; float py = by / origH; float finalX = m[Matrix.MTRANS_X] + getImageWidth() * px; float finalY = m[Matrix.MTRANS_Y] + getImageHeight() * py; return new PointF(finalX, finalY); } private class Fling implements Runnable { CompatScroller scroller; int currX, currY; Fling(int velocityX, int velocityY) { setState(State.FLING); scroller = new CompatScroller(context); matrix.getValues(m); int startX = (int) m[Matrix.MTRANS_X]; int startY = (int) m[Matrix.MTRANS_Y]; int minX, maxX, minY, maxY; if (getImageWidth() > viewWidth) { minX = viewWidth - (int) getImageWidth(); maxX = 0; } else { minX = maxX = startX; } if (getImageHeight() > viewHeight) { minY = viewHeight - (int) getImageHeight(); maxY = 0; } else { minY = maxY = startY; } scroller.fling(startX, startY, (int) velocityX, (int) velocityY, minX, maxX, minY, maxY); currX = startX; currY = startY; } | /**
* Inverse of transformCoordTouchToBitmap. This function will transform the coordinates in the
* drawable's coordinate system to the view's coordinate system.
*
* @param bx x-coordinate in original bitmap coordinate system
* @param by y-coordinate in original bitmap coordinate system
* @return Coordinates of the point in the view's coordinate system.
*/ | Inverse of transformCoordTouchToBitmap. This function will transform the coordinates in the drawable's coordinate system to the view's coordinate system | transformCoordBitmapToTouch | {
"repo_name": "dalingge/GankGirl",
"path": "app/src/main/java/com/dalingge/gankio/common/widgets/TouchImageView.java",
"license": "lgpl-2.1",
"size": 42682
} | [
"android.graphics.Matrix",
"android.graphics.PointF"
] | import android.graphics.Matrix; import android.graphics.PointF; | import android.graphics.*; | [
"android.graphics"
] | android.graphics; | 561,753 |
private ServiceInterface initGrisu(String proxyUser, char[] proxyPass)
throws Exception {
ServiceInterface si = null;
try {
si = LoginManager.myProxyLogin("Local", proxyUser, proxyPass);
} catch (LoginException e) {
logger.error("Unable to create ServiceInterface: "+e.toString(), e);
throw new Exception("Proxy generation failed!");
}
return si;
} | ServiceInterface function(String proxyUser, char[] proxyPass) throws Exception { ServiceInterface si = null; try { si = LoginManager.myProxyLogin("Local", proxyUser, proxyPass); } catch (LoginException e) { logger.error(STR+e.toString(), e); throw new Exception(STR); } return si; } | /**
* Initializes a Grisu ServiceInterface which may subsequently be used
* for grid activities.
* Uses a username and password for MyProxy authentication.
*
* @param proxyUser MyProxy username
* @param proxyPass MyProxy password
*
* @return the Grisu ServiceInterface object or null on error
*/ | Initializes a Grisu ServiceInterface which may subsequently be used for grid activities. Uses a username and password for MyProxy authentication | initGrisu | {
"repo_name": "AuScope/VirtualRockLab",
"path": "src/main/java/org/auscope/vrl/web/LoginController.java",
"license": "gpl-3.0",
"size": 20810
} | [
"org.vpac.grisu.control.ServiceInterface",
"org.vpac.grisu.frontend.control.login.LoginException",
"org.vpac.grisu.frontend.control.login.LoginManager"
] | import org.vpac.grisu.control.ServiceInterface; import org.vpac.grisu.frontend.control.login.LoginException; import org.vpac.grisu.frontend.control.login.LoginManager; | import org.vpac.grisu.control.*; import org.vpac.grisu.frontend.control.login.*; | [
"org.vpac.grisu"
] | org.vpac.grisu; | 1,773,996 |
public void testRegression() {
performRegressionTest(
new File[]{
new TmpFile("dumpfile_all.txt"),
new TmpFile("dumpfile_min.txt"),
new TmpFile("dumpfile_max.txt"),
new TmpFile("dumpfile_interval.txt"),
new TmpFile("dumpfile_min_max.txt"),
new TmpFile("dumpfile_min_max_interval.txt")});
} | void function() { performRegressionTest( new File[]{ new TmpFile(STR), new TmpFile(STR), new TmpFile(STR), new TmpFile(STR), new TmpFile(STR), new TmpFile(STR)}); } | /**
* Performs a regression test, comparing against previously generated output.
*/ | Performs a regression test, comparing against previously generated output | testRegression | {
"repo_name": "automenta/adams-core",
"path": "src/test/java/adams/flow/control/FlowTest.java",
"license": "gpl-3.0",
"size": 5663
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 1,427,414 |
public static TypeInference forAggregateFunction(
DataTypeFactory typeFactory,
Class<? extends AggregateFunction<?, ?>> function) {
final FunctionMappingExtractor mappingExtractor = new FunctionMappingExtractor(
typeFactory,
function,
UserDefinedFunctionHelper.AGGREGATE_ACCUMULATE,
createParameterSignatureExtraction(1),
createGenericResultExtraction(AggregateFunction.class, 1),
createGenericResultExtraction(AggregateFunction.class, 0),
createParameterWithAccumulatorVerification());
return extractTypeInference(mappingExtractor);
} | static TypeInference function( DataTypeFactory typeFactory, Class<? extends AggregateFunction<?, ?>> function) { final FunctionMappingExtractor mappingExtractor = new FunctionMappingExtractor( typeFactory, function, UserDefinedFunctionHelper.AGGREGATE_ACCUMULATE, createParameterSignatureExtraction(1), createGenericResultExtraction(AggregateFunction.class, 1), createGenericResultExtraction(AggregateFunction.class, 0), createParameterWithAccumulatorVerification()); return extractTypeInference(mappingExtractor); } | /**
* Extracts a type inference from a {@link AggregateFunction}.
*/ | Extracts a type inference from a <code>AggregateFunction</code> | forAggregateFunction | {
"repo_name": "hequn8128/flink",
"path": "flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/extraction/TypeInferenceExtractor.java",
"license": "apache-2.0",
"size": 10389
} | [
"org.apache.flink.table.catalog.DataTypeFactory",
"org.apache.flink.table.functions.AggregateFunction",
"org.apache.flink.table.functions.UserDefinedFunctionHelper",
"org.apache.flink.table.types.extraction.FunctionMappingExtractor",
"org.apache.flink.table.types.inference.TypeInference"
] | import org.apache.flink.table.catalog.DataTypeFactory; import org.apache.flink.table.functions.AggregateFunction; import org.apache.flink.table.functions.UserDefinedFunctionHelper; import org.apache.flink.table.types.extraction.FunctionMappingExtractor; import org.apache.flink.table.types.inference.TypeInference; | import org.apache.flink.table.catalog.*; import org.apache.flink.table.functions.*; import org.apache.flink.table.types.extraction.*; import org.apache.flink.table.types.inference.*; | [
"org.apache.flink"
] | org.apache.flink; | 2,642,509 |
public Set<ANES_URN> listParameters() throws ParameterizationException;
| Set<ANES_URN> function() throws ParameterizationException; | /**
* Returns a list of all identifiers available through this interface.
*
* Identifiers may represent:
*
* - parameters that can be retrieved or modified, or ; - setters and
* getters functions that can be invoked to retrieve or modify parameters.
*
* @return an array of identifiers in ANES_URN format.
* @throws ParameterizationException
*/ | Returns a list of all identifiers available through this interface. Identifiers may represent: - parameters that can be retrieved or modified, or ; - setters and getters functions that can be invoked to retrieve or modify parameters | listParameters | {
"repo_name": "DEMANES/demanes-api",
"path": "src/eu/artemis/demanes/parameterization/Parameterizable.java",
"license": "apache-2.0",
"size": 2628
} | [
"eu.artemis.demanes.exceptions.ParameterizationException",
"java.util.Set"
] | import eu.artemis.demanes.exceptions.ParameterizationException; import java.util.Set; | import eu.artemis.demanes.exceptions.*; import java.util.*; | [
"eu.artemis.demanes",
"java.util"
] | eu.artemis.demanes; java.util; | 357,920 |
public void setInetSocketAddress(InetSocketAddress address) {
this.port = address.getPort();
this.hostname = address.getHostName();
} | void function(InetSocketAddress address) { this.port = address.getPort(); this.hostname = address.getHostName(); } | /**
* Set address that the IPC server of this task is using
*
* @param address Address
*/ | Set address that the IPC server of this task is using | setInetSocketAddress | {
"repo_name": "basio/graph",
"path": "giraph-core/src/main/java/org/apache/giraph/graph/TaskInfo.java",
"license": "apache-2.0",
"size": 3697
} | [
"java.net.InetSocketAddress"
] | import java.net.InetSocketAddress; | import java.net.*; | [
"java.net"
] | java.net; | 894,260 |
public void archiveCourseGroups(File exportDirectory) {
File exportLearningGroupFile = new File(exportDirectory, "default_" + LEARNINGGROUPARCHIVE_XLS);
businessGroupService.archiveGroups(getAllBusinessGroups(), exportLearningGroupFile);
} | void function(File exportDirectory) { File exportLearningGroupFile = new File(exportDirectory, STR + LEARNINGGROUPARCHIVE_XLS); businessGroupService.archiveGroups(getAllBusinessGroups(), exportLearningGroupFile); } | /**
* Archive all learning-group-contexts and right-group-contexts.
* @param exportDirectory
*/ | Archive all learning-group-contexts and right-group-contexts | archiveCourseGroups | {
"repo_name": "stevenhva/InfoLearn_OpenOLAT",
"path": "src/main/java/org/olat/course/groupsandrights/PersistingCourseGroupManager.java",
"license": "apache-2.0",
"size": 18789
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 2,134,529 |
public static MozuClient setPasswordChangeRequiredClient(Boolean isPasswordChangeRequired, Integer accountId, String userId) throws Exception
{
MozuUrl url = com.mozu.api.urls.commerce.customer.CustomerAccountUrl.setPasswordChangeRequiredUrl(accountId, userId);
String verb = "POST";
MozuClient mozuClient = (MozuClient) MozuClientFactory.getInstance();
mozuClient.setVerb(verb);
mozuClient.setResourceUrl(url);
mozuClient.setBody(isPasswordChangeRequired);
return mozuClient;
}
| static MozuClient function(Boolean isPasswordChangeRequired, Integer accountId, String userId) throws Exception { MozuUrl url = com.mozu.api.urls.commerce.customer.CustomerAccountUrl.setPasswordChangeRequiredUrl(accountId, userId); String verb = "POST"; MozuClient mozuClient = (MozuClient) MozuClientFactory.getInstance(); mozuClient.setVerb(verb); mozuClient.setResourceUrl(url); mozuClient.setBody(isPasswordChangeRequired); return mozuClient; } | /**
*
* <p><pre><code>
* MozuClient mozuClient=SetPasswordChangeRequiredClient( isPasswordChangeRequired, accountId, userId);
* client.setBaseAddress(url);
* client.executeRequest();
* </code></pre></p>
* @param accountId Unique identifier of the customer account.
* @param userId Unique identifier of the user whose tenant scopes you want to retrieve.
* @param isPasswordChangeRequired If true, the password for the customer account must be changed.
* @return Mozu.Api.MozuClient
* @see bool
*/ | <code><code> MozuClient mozuClient=SetPasswordChangeRequiredClient( isPasswordChangeRequired, accountId, userId); client.setBaseAddress(url); client.executeRequest(); </code></code> | setPasswordChangeRequiredClient | {
"repo_name": "Mozu/mozu-java",
"path": "mozu-java-core/src/main/java/com/mozu/api/clients/commerce/customer/CustomerAccountClient.java",
"license": "mit",
"size": 40636
} | [
"com.mozu.api.MozuClient",
"com.mozu.api.MozuClientFactory",
"com.mozu.api.MozuUrl"
] | import com.mozu.api.MozuClient; import com.mozu.api.MozuClientFactory; import com.mozu.api.MozuUrl; | import com.mozu.api.*; | [
"com.mozu.api"
] | com.mozu.api; | 229,821 |
public static String matches(String regex) {
reportMatcher(new Matches(regex));
return "";
} | static String function(String regex) { reportMatcher(new Matches(regex)); return ""; } | /**
* <code>String</code> argument that matches the given regular expression.
* <p>
* See examples in javadoc for {@link ArgumentMatchers} class
*
* @param regex the regular expression.
* @return empty String ("").
*
* @see AdditionalMatchers#not(boolean)
*/ | <code>String</code> argument that matches the given regular expression. See examples in javadoc for <code>ArgumentMatchers</code> class | matches | {
"repo_name": "terebesirobert/mockito",
"path": "src/main/java/org/mockito/ArgumentMatchers.java",
"license": "mit",
"size": 48644
} | [
"org.mockito.internal.matchers.Matches"
] | import org.mockito.internal.matchers.Matches; | import org.mockito.internal.matchers.*; | [
"org.mockito.internal"
] | org.mockito.internal; | 1,292,506 |
@Override
public COSStream getStream()
{
throw new UnsupportedOperationException( "not supported for memory stream" );
} | COSStream function() { throw new UnsupportedOperationException( STR ); } | /**
* Get the cos stream associated with this object.
*
* @return The cos object that matches this Java object.
*/ | Get the cos stream associated with this object | getStream | {
"repo_name": "mdamt/pdfbox",
"path": "pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDMemoryStream.java",
"license": "apache-2.0",
"size": 7502
} | [
"org.apache.pdfbox.cos.COSStream"
] | import org.apache.pdfbox.cos.COSStream; | import org.apache.pdfbox.cos.*; | [
"org.apache.pdfbox"
] | org.apache.pdfbox; | 181,767 |
public ServiceFuture<VirtualNetworkGatewayConnectionInner> updateTagsAsync(String resourceGroupName, String virtualNetworkGatewayConnectionName, Map<String, String> tags, final ServiceCallback<VirtualNetworkGatewayConnectionInner> serviceCallback) {
return ServiceFuture.fromResponse(updateTagsWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, tags), serviceCallback);
} | ServiceFuture<VirtualNetworkGatewayConnectionInner> function(String resourceGroupName, String virtualNetworkGatewayConnectionName, Map<String, String> tags, final ServiceCallback<VirtualNetworkGatewayConnectionInner> serviceCallback) { return ServiceFuture.fromResponse(updateTagsWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, tags), serviceCallback); } | /**
* Updates a virtual network gateway connection tags.
*
* @param resourceGroupName The name of the resource group.
* @param virtualNetworkGatewayConnectionName The name of the virtual network gateway connection.
* @param tags Resource tags.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/ | Updates a virtual network gateway connection tags | updateTagsAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/network/v2019_07_01/implementation/VirtualNetworkGatewayConnectionsInner.java",
"license": "mit",
"size": 146427
} | [
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture",
"java.util.Map"
] | import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; import java.util.Map; | import com.microsoft.rest.*; import java.util.*; | [
"com.microsoft.rest",
"java.util"
] | com.microsoft.rest; java.util; | 507,987 |
public static boolean isUpdateShow(Context context, int showTvdbId) {
final Cursor show = context.getContentResolver().query(Shows.buildShowUri(showTvdbId),
new String[] {
Shows._ID, Shows.LASTUPDATED
}, null, null, null
);
boolean isUpdate = false;
if (show != null) {
if (show.moveToFirst()) {
long lastUpdateTime = show.getLong(1);
if (System.currentTimeMillis() - lastUpdateTime > DateUtils.HOUR_IN_MILLIS * 12) {
isUpdate = true;
}
}
show.close();
}
return isUpdate;
} | static boolean function(Context context, int showTvdbId) { final Cursor show = context.getContentResolver().query(Shows.buildShowUri(showTvdbId), new String[] { Shows._ID, Shows.LASTUPDATED }, null, null, null ); boolean isUpdate = false; if (show != null) { if (show.moveToFirst()) { long lastUpdateTime = show.getLong(1); if (System.currentTimeMillis() - lastUpdateTime > DateUtils.HOUR_IN_MILLIS * 12) { isUpdate = true; } } show.close(); } return isUpdate; } | /**
* Returns true if the given show has not been updated in the last 12 hours.
*/ | Returns true if the given show has not been updated in the last 12 hours | isUpdateShow | {
"repo_name": "TreyWiranta/ASV",
"path": "SeriesGuide/src/main/java/com/battlelancer/seriesguide/thetvdbapi/TvdbTools.java",
"license": "unlicense",
"size": 33860
} | [
"android.content.Context",
"android.database.Cursor",
"android.text.format.DateUtils",
"com.battlelancer.seriesguide.provider.SeriesGuideContract"
] | import android.content.Context; import android.database.Cursor; import android.text.format.DateUtils; import com.battlelancer.seriesguide.provider.SeriesGuideContract; | import android.content.*; import android.database.*; import android.text.format.*; import com.battlelancer.seriesguide.provider.*; | [
"android.content",
"android.database",
"android.text",
"com.battlelancer.seriesguide"
] | android.content; android.database; android.text; com.battlelancer.seriesguide; | 1,968,549 |
@Override
public void set(int fieldNum, Object val) throws ExecException {
mFields.set(fieldNum, val);
} | void function(int fieldNum, Object val) throws ExecException { mFields.set(fieldNum, val); } | /**
* Set the value in a given field.
*
* @param fieldNum
* Number of the field to set the value for.
* @param val
* Object to put in the indicated field.
* @throws ExecException
* if the field number is greater than or equal to the number of fields in the tuple.
*/ | Set the value in a given field | set | {
"repo_name": "siddaartha/spork",
"path": "src/org/apache/pig/data/DefaultTuple.java",
"license": "apache-2.0",
"size": 21668
} | [
"org.apache.pig.backend.executionengine.ExecException"
] | import org.apache.pig.backend.executionengine.ExecException; | import org.apache.pig.backend.executionengine.*; | [
"org.apache.pig"
] | org.apache.pig; | 2,899,801 |
void onRemoveFromFavoritesAction(Uri contactUri);
| void onRemoveFromFavoritesAction(Uri contactUri); | /**
* Removes the specified contact from favorites.
*/ | Removes the specified contact from favorites | onRemoveFromFavoritesAction | {
"repo_name": "risingsunm/Contacts_4.0",
"path": "src/com/android/contacts/list/OnContactBrowserActionListener.java",
"license": "gpl-2.0",
"size": 2278
} | [
"android.net.Uri"
] | import android.net.Uri; | import android.net.*; | [
"android.net"
] | android.net; | 272,788 |
public void removeOperator(Operator operator) {
if (operators.contains(operator)) {
operator.disconnectAll();
operators.remove(operator);
if (inputs.containsKey(operator)) {
inputs.remove(operator).disconnectAll();
}
if (outputs.containsKey(operator)) {
outputs.remove(operator).disconnectAll();
}
}
} | void function(Operator operator) { if (operators.contains(operator)) { operator.disconnectAll(); operators.remove(operator); if (inputs.containsKey(operator)) { inputs.remove(operator).disconnectAll(); } if (outputs.containsKey(operator)) { outputs.remove(operator).disconnectAll(); } } } | /**
* Removes an operator from this sub-plan.
* @param operator the operator
*/ | Removes an operator from this sub-plan | removeOperator | {
"repo_name": "ashigeru/asakusafw-compiler",
"path": "compiler-project/plan/src/main/java/com/asakusafw/lang/compiler/planning/basic/BasicSubPlan.java",
"license": "apache-2.0",
"size": 11799
} | [
"com.asakusafw.lang.compiler.model.graph.Operator"
] | import com.asakusafw.lang.compiler.model.graph.Operator; | import com.asakusafw.lang.compiler.model.graph.*; | [
"com.asakusafw.lang"
] | com.asakusafw.lang; | 1,739,182 |
public final void setDigitalObjectId(DigitalObjectId digitalObjectId) {
this.digitalObjectId = digitalObjectId;
} | final void function(DigitalObjectId digitalObjectId) { this.digitalObjectId = digitalObjectId; } | /**
* Set the digital object id.
*
* @param digitalObjectId The digital object id.
*/ | Set the digital object id | setDigitalObjectId | {
"repo_name": "kit-data-manager/base",
"path": "DataOrganization/src/main/java/edu/kit/dama/mdm/dataorganization/entity/impl/client/NodeId.java",
"license": "apache-2.0",
"size": 4030
} | [
"edu.kit.dama.commons.types.DigitalObjectId"
] | import edu.kit.dama.commons.types.DigitalObjectId; | import edu.kit.dama.commons.types.*; | [
"edu.kit.dama"
] | edu.kit.dama; | 900,937 |
@Test
public final void testTrivial()
{
final JCGLContextType c =
this.newGL33Context("main", 24, 8);
final JCGLInterfaceGL33Type g =
c.contextGetGL33();
final R2UnitQuadType quad =
R2UnitQuad.newUnitQuad(g);
final R2IDPoolType id_pool =
R2IDPool.newPool();
final R2ShaderPreprocessingEnvironmentType sources =
ShaderPreprocessing.preprocessor();
final R2StencilRendererType r =
this.getRenderer(g, sources, id_pool, quad);
final AreaL area = AreasL.create(0, 0, 640L, 480L);
final JCGLTextureUnitAllocatorType ta =
JCGLTextureUnitAllocator.newAllocatorWithStack(
8, g.textures().textureGetUnits());
final JCGLTextureUnitContextParentType tc =
ta.rootContext();
final R2InstanceSingleType i =
R2InstanceSingle.of(
id_pool.freshID(),
quad.arrayObject(),
R2TransformIdentity.get(),
PMatrices3x3D.identity());
final R2ProjectionOrthographic proj =
R2ProjectionOrthographic.create();
final R2SceneStencilsType ii = R2SceneStencils.create();
ii.stencilsAddSingle(i);
final R2MatricesType m = R2Matrices.create();
m.withObserver(
PMatrices4x4D.identity(),
proj,
unit(),
(x, y) -> {
r.renderStencilsWithBoundBuffer(x, newFake(), tc, area, ii);
return unit();
});
} | final void function() { final JCGLContextType c = this.newGL33Context("main", 24, 8); final JCGLInterfaceGL33Type g = c.contextGetGL33(); final R2UnitQuadType quad = R2UnitQuad.newUnitQuad(g); final R2IDPoolType id_pool = R2IDPool.newPool(); final R2ShaderPreprocessingEnvironmentType sources = ShaderPreprocessing.preprocessor(); final R2StencilRendererType r = this.getRenderer(g, sources, id_pool, quad); final AreaL area = AreasL.create(0, 0, 640L, 480L); final JCGLTextureUnitAllocatorType ta = JCGLTextureUnitAllocator.newAllocatorWithStack( 8, g.textures().textureGetUnits()); final JCGLTextureUnitContextParentType tc = ta.rootContext(); final R2InstanceSingleType i = R2InstanceSingle.of( id_pool.freshID(), quad.arrayObject(), R2TransformIdentity.get(), PMatrices3x3D.identity()); final R2ProjectionOrthographic proj = R2ProjectionOrthographic.create(); final R2SceneStencilsType ii = R2SceneStencils.create(); ii.stencilsAddSingle(i); final R2MatricesType m = R2Matrices.create(); m.withObserver( PMatrices4x4D.identity(), proj, unit(), (x, y) -> { r.renderStencilsWithBoundBuffer(x, newFake(), tc, area, ii); return unit(); }); } | /**
* Just check that execution proceeds without errors.
*/ | Just check that execution proceeds without errors | testTrivial | {
"repo_name": "io7m/r2",
"path": "com.io7m.r2.tests/src/test/java/com/io7m/r2/tests/rendering/stencil/api/R2StencilRendererContract.java",
"license": "isc",
"size": 4180
} | [
"com.io7m.jcanephora.core.api.JCGLContextType",
"com.io7m.jcanephora.core.api.JCGLInterfaceGL33Type",
"com.io7m.jcanephora.texture.unit_allocator.JCGLTextureUnitAllocator",
"com.io7m.jcanephora.texture.unit_allocator.JCGLTextureUnitAllocatorType",
"com.io7m.jcanephora.texture.unit_allocator.JCGLTextureUnitContextParentType",
"com.io7m.jfunctional.Unit",
"com.io7m.jregions.core.unparameterized.areas.AreaL",
"com.io7m.jregions.core.unparameterized.areas.AreasL",
"com.io7m.jtensors.core.parameterized.matrices.PMatrices3x3D",
"com.io7m.jtensors.core.parameterized.matrices.PMatrices4x4D",
"com.io7m.r2.core.api.ids.R2IDPool",
"com.io7m.r2.core.api.ids.R2IDPoolType",
"com.io7m.r2.instances.R2InstanceSingle",
"com.io7m.r2.instances.R2InstanceSingleType",
"com.io7m.r2.matrices.R2Matrices",
"com.io7m.r2.matrices.R2MatricesType",
"com.io7m.r2.meshes.defaults.R2UnitQuad",
"com.io7m.r2.projections.R2ProjectionOrthographic",
"com.io7m.r2.rendering.stencil.R2SceneStencils",
"com.io7m.r2.rendering.stencil.api.R2SceneStencilsType",
"com.io7m.r2.rendering.stencil.api.R2StencilRendererType",
"com.io7m.r2.shaders.api.R2ShaderPreprocessingEnvironmentType",
"com.io7m.r2.tests.ShaderPreprocessing",
"com.io7m.r2.tests.core.R2FakeProfilingContext",
"com.io7m.r2.transforms.R2TransformIdentity",
"com.io7m.r2.unit_quads.R2UnitQuadType"
] | import com.io7m.jcanephora.core.api.JCGLContextType; import com.io7m.jcanephora.core.api.JCGLInterfaceGL33Type; import com.io7m.jcanephora.texture.unit_allocator.JCGLTextureUnitAllocator; import com.io7m.jcanephora.texture.unit_allocator.JCGLTextureUnitAllocatorType; import com.io7m.jcanephora.texture.unit_allocator.JCGLTextureUnitContextParentType; import com.io7m.jfunctional.Unit; import com.io7m.jregions.core.unparameterized.areas.AreaL; import com.io7m.jregions.core.unparameterized.areas.AreasL; import com.io7m.jtensors.core.parameterized.matrices.PMatrices3x3D; import com.io7m.jtensors.core.parameterized.matrices.PMatrices4x4D; import com.io7m.r2.core.api.ids.R2IDPool; import com.io7m.r2.core.api.ids.R2IDPoolType; import com.io7m.r2.instances.R2InstanceSingle; import com.io7m.r2.instances.R2InstanceSingleType; import com.io7m.r2.matrices.R2Matrices; import com.io7m.r2.matrices.R2MatricesType; import com.io7m.r2.meshes.defaults.R2UnitQuad; import com.io7m.r2.projections.R2ProjectionOrthographic; import com.io7m.r2.rendering.stencil.R2SceneStencils; import com.io7m.r2.rendering.stencil.api.R2SceneStencilsType; import com.io7m.r2.rendering.stencil.api.R2StencilRendererType; import com.io7m.r2.shaders.api.R2ShaderPreprocessingEnvironmentType; import com.io7m.r2.tests.ShaderPreprocessing; import com.io7m.r2.tests.core.R2FakeProfilingContext; import com.io7m.r2.transforms.R2TransformIdentity; import com.io7m.r2.unit_quads.R2UnitQuadType; | import com.io7m.jcanephora.core.api.*; import com.io7m.jcanephora.texture.unit_allocator.*; import com.io7m.jfunctional.*; import com.io7m.jregions.core.unparameterized.areas.*; import com.io7m.jtensors.core.parameterized.matrices.*; import com.io7m.r2.core.api.ids.*; import com.io7m.r2.instances.*; import com.io7m.r2.matrices.*; import com.io7m.r2.meshes.defaults.*; import com.io7m.r2.projections.*; import com.io7m.r2.rendering.stencil.*; import com.io7m.r2.rendering.stencil.api.*; import com.io7m.r2.shaders.api.*; import com.io7m.r2.tests.*; import com.io7m.r2.tests.core.*; import com.io7m.r2.transforms.*; import com.io7m.r2.unit_quads.*; | [
"com.io7m.jcanephora",
"com.io7m.jfunctional",
"com.io7m.jregions",
"com.io7m.jtensors",
"com.io7m.r2"
] | com.io7m.jcanephora; com.io7m.jfunctional; com.io7m.jregions; com.io7m.jtensors; com.io7m.r2; | 637,334 |
public void testGcdSecondZero() {
byte aBytes[] = {15, 24, 123, 57, -15, 24, 123, 57, -15, 24, 123, 57};
byte bBytes[] = {0};
int aSign = 1;
int bSign = 1;
byte rBytes[] = {15, 24, 123, 57, -15, 24, 123, 57, -15, 24, 123, 57};
BigInteger aNumber = new BigInteger(aSign, aBytes);
BigInteger bNumber = new BigInteger(bSign, bBytes);
BigInteger result = aNumber.gcd(bNumber);
byte resBytes[] = new byte[rBytes.length];
resBytes = result.toByteArray();
for(int i = 0; i < resBytes.length; i++) {
assertTrue(resBytes[i] == rBytes[i]);
}
assertEquals("incorrect sign", 1, result.signum());
} | void function() { byte aBytes[] = {15, 24, 123, 57, -15, 24, 123, 57, -15, 24, 123, 57}; byte bBytes[] = {0}; int aSign = 1; int bSign = 1; byte rBytes[] = {15, 24, 123, 57, -15, 24, 123, 57, -15, 24, 123, 57}; BigInteger aNumber = new BigInteger(aSign, aBytes); BigInteger bNumber = new BigInteger(bSign, bBytes); BigInteger result = aNumber.gcd(bNumber); byte resBytes[] = new byte[rBytes.length]; resBytes = result.toByteArray(); for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } assertEquals(STR, 1, result.signum()); } | /**
* gcd: the second number is zero
*/ | gcd: the second number is zero | testGcdSecondZero | {
"repo_name": "groschovskiy/j2objc",
"path": "jre_emul/apache_harmony/classlib/modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerModPowTest.java",
"license": "apache-2.0",
"size": 12067
} | [
"java.math.BigInteger"
] | import java.math.BigInteger; | import java.math.*; | [
"java.math"
] | java.math; | 1,970,352 |
public JsonArray getCacheArray(String sql) throws Exception
{
return getCacheArrayExpiry(sql, expiry, new Object[]{});
}
| JsonArray function(String sql) throws Exception { return getCacheArrayExpiry(sql, expiry, new Object[]{}); } | /**
* Load a JSON array from the cache if not found or expired then load object from
* the database using the SQL.
* @param sql
* @return
* @throws Exception
*/ | Load a JSON array from the cache if not found or expired then load object from the database using the SQL | getCacheArray | {
"repo_name": "jhertz123/katujo-web-utils",
"path": "src/main/java/com/katujo/web/utils/DatabaseCacheManager.java",
"license": "mit",
"size": 12036
} | [
"com.google.gson.JsonArray"
] | import com.google.gson.JsonArray; | import com.google.gson.*; | [
"com.google.gson"
] | com.google.gson; | 2,864,576 |
public Command fixError(TestError testError) {
return null;
} | Command function(TestError testError) { return null; } | /**
* Fixes the error with the appropriate command
*
* @param testError
* @return The command to fix the error
*/ | Fixes the error with the appropriate command | fixError | {
"repo_name": "CURocketry/Ground_Station_GUI",
"path": "src/org/openstreetmap/josm/data/validation/Test.java",
"license": "gpl-3.0",
"size": 10176
} | [
"org.openstreetmap.josm.command.Command"
] | import org.openstreetmap.josm.command.Command; | import org.openstreetmap.josm.command.*; | [
"org.openstreetmap.josm"
] | org.openstreetmap.josm; | 1,824,248 |
@Basic( optional = true )
@Column( name = "year_entrd_service" )
public Integer getYearEntrdService() {
return this.yearEntrdService;
} | @Basic( optional = true ) @Column( name = STR ) Integer function() { return this.yearEntrdService; } | /**
* Return the value associated with the column: yearEntrdService.
* @return A Integer object (this.yearEntrdService)
*/ | Return the value associated with the column: yearEntrdService | getYearEntrdService | {
"repo_name": "servinglynk/servinglynk-hmis",
"path": "hmis-model-v2020/src/main/java/com/servinglynk/hmis/warehouse/model/v2020/ClientVeteranInfo.java",
"license": "mpl-2.0",
"size": 18622
} | [
"javax.persistence.Basic",
"javax.persistence.Column"
] | import javax.persistence.Basic; import javax.persistence.Column; | import javax.persistence.*; | [
"javax.persistence"
] | javax.persistence; | 663,667 |
@Named("Listar")
@ActionSemantics(Of.SAFE)
@MemberOrder(sequence = "2")
public List<Menu> listarMenuesTodos() {
return allInstances(Menu.class);
} | @Named(STR) @ActionSemantics(Of.SAFE) @MemberOrder(sequence = "2") List<Menu> function() { return allInstances(Menu.class); } | /**
* Obtiene una lista de todos los Menues en general
* @return List<Menu>
*/ | Obtiene una lista de todos los Menues en general | listarMenuesTodos | {
"repo_name": "resto-tesis/resto-tesis",
"path": "dom/src/main/java/dom/menu/MenuServicio.java",
"license": "apache-2.0",
"size": 8268
} | [
"java.util.List",
"org.apache.isis.applib.annotation.ActionSemantics",
"org.apache.isis.applib.annotation.MemberOrder",
"org.apache.isis.applib.annotation.Named"
] | import java.util.List; import org.apache.isis.applib.annotation.ActionSemantics; import org.apache.isis.applib.annotation.MemberOrder; import org.apache.isis.applib.annotation.Named; | import java.util.*; import org.apache.isis.applib.annotation.*; | [
"java.util",
"org.apache.isis"
] | java.util; org.apache.isis; | 2,760,259 |
default AdvancedStreamEndpointConsumerBuilder exchangePattern(
ExchangePattern exchangePattern) {
doSetProperty("exchangePattern", exchangePattern);
return this;
} | default AdvancedStreamEndpointConsumerBuilder exchangePattern( ExchangePattern exchangePattern) { doSetProperty(STR, exchangePattern); return this; } | /**
* Sets the exchange pattern when the consumer creates an exchange.
*
* The option is a: <code>org.apache.camel.ExchangePattern</code> type.
*
* Group: consumer (advanced)
*/ | Sets the exchange pattern when the consumer creates an exchange. The option is a: <code>org.apache.camel.ExchangePattern</code> type. Group: consumer (advanced) | exchangePattern | {
"repo_name": "adessaigne/camel",
"path": "core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/StreamEndpointBuilderFactory.java",
"license": "apache-2.0",
"size": 36350
} | [
"org.apache.camel.ExchangePattern"
] | import org.apache.camel.ExchangePattern; | import org.apache.camel.*; | [
"org.apache.camel"
] | org.apache.camel; | 2,809,115 |
public final SMTPException getException() {
return exception;
} | final SMTPException function() { return exception; } | /**
* Return the {@link SMTPException} which was thrown while process the future
*
* @return exception
*/ | Return the <code>SMTPException</code> which was thrown while process the future | getException | {
"repo_name": "normanmaurer/niosmtp",
"path": "src/main/java/me/normanmaurer/niosmtp/transport/FutureResult.java",
"license": "apache-2.0",
"size": 3311
} | [
"me.normanmaurer.niosmtp.SMTPException"
] | import me.normanmaurer.niosmtp.SMTPException; | import me.normanmaurer.niosmtp.*; | [
"me.normanmaurer.niosmtp"
] | me.normanmaurer.niosmtp; | 2,490,162 |
public void saveState() {
try {
if (!(viewer instanceof PydevCommonViewer)) {
//we have to check that because we can be asked to restore things in the ProjectExplorer too, and not
//only in the pydev package explorer -- and in this case, the method: getTreePathFromItem(Item item) is
//not be overridden and can cause the method to fail.
return;
}
if (DEBUG) {
System.out.println("saveState");
}
PydevCommonViewer treeViewer = (PydevCommonViewer) viewer;
TreePath[] expandedTreePaths = treeViewer.getExpandedTreePaths();
for (TreePath path : expandedTreePaths) {
if (DEBUG) {
System.out.println("saveState expanded:" + path);
}
save(path, "expanded");
}
ISelection selection = viewer.getSelection();
if (selection instanceof ITreeSelection) {
ITreeSelection treeSelection = (ITreeSelection) selection;
TreePath[] paths = treeSelection.getPaths();
for (TreePath path : paths) {
if (DEBUG) {
System.out.println("saveState selected:" + path);
}
save(path, "selected");
}
}
} catch (Exception e) {
Log.log(e);
}
} | void function() { try { if (!(viewer instanceof PydevCommonViewer)) { return; } if (DEBUG) { System.out.println(STR); } PydevCommonViewer treeViewer = (PydevCommonViewer) viewer; TreePath[] expandedTreePaths = treeViewer.getExpandedTreePaths(); for (TreePath path : expandedTreePaths) { if (DEBUG) { System.out.println(STR + path); } save(path, STR); } ISelection selection = viewer.getSelection(); if (selection instanceof ITreeSelection) { ITreeSelection treeSelection = (ITreeSelection) selection; TreePath[] paths = treeSelection.getPaths(); for (TreePath path : paths) { if (DEBUG) { System.out.println(STR + path); } save(path, STR); } } } catch (Exception e) { Log.log(e); } } | /**
* This is the function that is responsible for saving the paths in the tree.
*/ | This is the function that is responsible for saving the paths in the tree | saveState | {
"repo_name": "fabioz/Pydev",
"path": "plugins/org.python.pydev/src_navigator/org/python/pydev/navigator/PyPackageStateSaver.java",
"license": "epl-1.0",
"size": 8307
} | [
"org.eclipse.jface.viewers.ISelection",
"org.eclipse.jface.viewers.ITreeSelection",
"org.eclipse.jface.viewers.TreePath",
"org.python.pydev.core.log.Log",
"org.python.pydev.navigator.ui.PydevPackageExplorer"
] | import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ITreeSelection; import org.eclipse.jface.viewers.TreePath; import org.python.pydev.core.log.Log; import org.python.pydev.navigator.ui.PydevPackageExplorer; | import org.eclipse.jface.viewers.*; import org.python.pydev.core.log.*; import org.python.pydev.navigator.ui.*; | [
"org.eclipse.jface",
"org.python.pydev"
] | org.eclipse.jface; org.python.pydev; | 2,894,575 |
public static void getToken(StreamTokenizer tokenizer) throws IOException {
tokenizer.nextToken();
if (tokenizer.ttype== StreamTokenizer.TT_EOL) {
return;
}
if ((tokenizer.ttype == '\'') ||
(tokenizer.ttype == '"')) {
tokenizer.ttype = StreamTokenizer.TT_WORD;
} else if ((tokenizer.ttype == StreamTokenizer.TT_WORD) &&
(tokenizer.sval.equals("?"))) {
tokenizer.ttype = '?';
}
} | static void function(StreamTokenizer tokenizer) throws IOException { tokenizer.nextToken(); if (tokenizer.ttype== StreamTokenizer.TT_EOL) { return; } if ((tokenizer.ttype == '\'') (tokenizer.ttype == 'STR?"))) { tokenizer.ttype = '?'; } } | /**
* Gets token.
*
* @param tokenizer the stream tokenizer
* @throws IOException if reading the next token fails
*/ | Gets token | getToken | {
"repo_name": "goddesss/DataModeling",
"path": "src/weka/core/converters/ConverterUtils.java",
"license": "gpl-2.0",
"size": 34301
} | [
"java.io.IOException",
"java.io.StreamTokenizer"
] | import java.io.IOException; import java.io.StreamTokenizer; | import java.io.*; | [
"java.io"
] | java.io; | 602,671 |
public Date getActiveEndDate(); | Date function(); | /**
* Returns the the last date that the Sku should be available for sale. This field is used to determine
* whether a user can add the sku to their cart.
*/ | Returns the the last date that the Sku should be available for sale. This field is used to determine whether a user can add the sku to their cart | getActiveEndDate | {
"repo_name": "sanlingdd/broadleaf",
"path": "core/broadleaf-framework/src/main/java/org/broadleafcommerce/core/catalog/domain/Sku.java",
"license": "apache-2.0",
"size": 22073
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 1,217,671 |
Iterator getPropertyIterator() {
return this.propertyValues.keySet().iterator();
} | Iterator getPropertyIterator() { return this.propertyValues.keySet().iterator(); } | /**
* Returns an iterator over all bean property names.
*
* @return An iterator.
*/ | Returns an iterator over all bean property names | getPropertyIterator | {
"repo_name": "viaper/DBPlus",
"path": "DerbyHodgepodge/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DataSourceReferenceTest.java",
"license": "apache-2.0",
"size": 28285
} | [
"java.util.Iterator"
] | import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 2,398,302 |
public ConnectPoint getSrc() {
return src;
} | ConnectPoint function() { return src; } | /**
* Returns the source transponder port.
*
* @return source transponder port
*/ | Returns the source transponder port | getSrc | {
"repo_name": "kuujo/onos",
"path": "core/api/src/main/java/org/onosproject/net/intent/OpticalConnectivityIntent.java",
"license": "apache-2.0",
"size": 8842
} | [
"org.onosproject.net.ConnectPoint"
] | import org.onosproject.net.ConnectPoint; | import org.onosproject.net.*; | [
"org.onosproject.net"
] | org.onosproject.net; | 2,597,375 |
@Test void testIdenticalExpressionInSubQuery() {
final String sql = "select deptno\n"
+ "from EMP\n"
+ "where deptno in (1, 2) or deptno in (1, 2)";
sql(sql).ok();
} | @Test void testIdenticalExpressionInSubQuery() { final String sql = STR + STR + STR; sql(sql).ok(); } | /**
* Test case for
* <a href="https://issues.apache.org/jira/browse/CALCITE-710">[CALCITE-710]
* When look up sub-queries, perform the same logic as the way when ones were
* registered</a>.
*/ | Test case for [CALCITE-710] When look up sub-queries, perform the same logic as the way when ones were registered | testIdenticalExpressionInSubQuery | {
"repo_name": "vlsi/calcite",
"path": "core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java",
"license": "apache-2.0",
"size": 133510
} | [
"org.junit.jupiter.api.Test"
] | import org.junit.jupiter.api.Test; | import org.junit.jupiter.api.*; | [
"org.junit.jupiter"
] | org.junit.jupiter; | 2,451,883 |
private List<User> getUsersThatVotedOnContentId(final long contentId, final boolean up) {
return DSL.using(jooqConfig).
select(USER_TABLE.fields()).
from(USER_TABLE.join(VOTE_TABLE).
on(USER_TABLE.ID.eq(VOTE_TABLE.USER_ID))).
where(VOTE_TABLE.CONTENT_ID.eq(contentId)).
and(VOTE_TABLE.UP.eq(up)).fetchInto(User.class);
} | List<User> function(final long contentId, final boolean up) { return DSL.using(jooqConfig). select(USER_TABLE.fields()). from(USER_TABLE.join(VOTE_TABLE). on(USER_TABLE.ID.eq(VOTE_TABLE.USER_ID))). where(VOTE_TABLE.CONTENT_ID.eq(contentId)). and(VOTE_TABLE.UP.eq(up)).fetchInto(User.class); } | /**
* Returns a list of all users which gave a "in" or a "comb" to the given news article.
*/ | Returns a list of all users which gave a "in" or a "comb" to the given news article | getUsersThatVotedOnContentId | {
"repo_name": "XMBomb/InComb",
"path": "src/main/java/com/incomb/server/model/dao/ContentVoteDao.java",
"license": "apache-2.0",
"size": 7137
} | [
"com.incomb.server.model.User",
"java.util.List",
"org.jooq.impl.DSL"
] | import com.incomb.server.model.User; import java.util.List; import org.jooq.impl.DSL; | import com.incomb.server.model.*; import java.util.*; import org.jooq.impl.*; | [
"com.incomb.server",
"java.util",
"org.jooq.impl"
] | com.incomb.server; java.util; org.jooq.impl; | 1,958,539 |
EReference getPowerSystemResource_OperatingShare(); | EReference getPowerSystemResource_OperatingShare(); | /**
* Returns the meta object for the reference list '{@link CIM.IEC61970.Core.PowerSystemResource#getOperatingShare <em>Operating Share</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the reference list '<em>Operating Share</em>'.
* @see CIM.IEC61970.Core.PowerSystemResource#getOperatingShare()
* @see #getPowerSystemResource()
* @generated
*/ | Returns the meta object for the reference list '<code>CIM.IEC61970.Core.PowerSystemResource#getOperatingShare Operating Share</code>'. | getPowerSystemResource_OperatingShare | {
"repo_name": "georghinkel/ttc2017smartGrids",
"path": "solutions/ModelJoin/src/main/java/CIM/IEC61970/Core/CorePackage.java",
"license": "mit",
"size": 253784
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,481,190 |
public Enumeration<K> keys() {
return new KeyIterator();
} | Enumeration<K> function() { return new KeyIterator(); } | /**
* Returns an enumeration of the keys in this table.
*
* @return an enumeration of the keys in this table
* @see #keySet()
*/ | Returns an enumeration of the keys in this table | keys | {
"repo_name": "davinash/geode",
"path": "geode-core/src/main/java/org/apache/geode/internal/util/concurrent/CustomEntryConcurrentHashMap.java",
"license": "apache-2.0",
"size": 88692
} | [
"java.util.Enumeration"
] | import java.util.Enumeration; | import java.util.*; | [
"java.util"
] | java.util; | 1,550,381 |
@Override
public boolean equals(@Nullable Object o) {
if (o instanceof TypeToken) {
TypeToken<?> that = (TypeToken<?>) o;
return runtimeType.equals(that.runtimeType);
}
return false;
} | boolean function(@Nullable Object o) { if (o instanceof TypeToken) { TypeToken<?> that = (TypeToken<?>) o; return runtimeType.equals(that.runtimeType); } return false; } | /**
* Returns true if {@code o} is another {@code TypeToken} that represents the same {@link Type}.
*/ | Returns true if o is another TypeToken that represents the same <code>Type</code> | equals | {
"repo_name": "antlr/codebuff",
"path": "output/java_guava/1.4.19/TypeToken.java",
"license": "bsd-2-clause",
"size": 48320
} | [
"javax.annotation.Nullable"
] | import javax.annotation.Nullable; | import javax.annotation.*; | [
"javax.annotation"
] | javax.annotation; | 1,300,528 |
public String getValueAsString(int index) {
switch (type) {
case TIFFTag.TIFF_ASCII:
return ((String[])data)[index];
case TIFFTag.TIFF_BYTE: case TIFFTag.TIFF_UNDEFINED:
return Integer.toString(((byte[])data)[index] & 0xff);
case TIFFTag.TIFF_SBYTE:
return Integer.toString(((byte[])data)[index]);
case TIFFTag.TIFF_SHORT:
return Integer.toString(((char[])data)[index] & 0xffff);
case TIFFTag.TIFF_SSHORT:
return Integer.toString(((short[])data)[index]);
case TIFFTag.TIFF_SLONG:
return Integer.toString(((int[])data)[index]);
case TIFFTag.TIFF_LONG: case TIFFTag.TIFF_IFD_POINTER:
return Long.toString(((long[])data)[index]);
case TIFFTag.TIFF_FLOAT:
return Float.toString(((float[])data)[index]);
case TIFFTag.TIFF_DOUBLE:
return Double.toString(((double[])data)[index]);
case TIFFTag.TIFF_SRATIONAL:
int[] ivalue = getAsSRational(index);
String srationalString;
if(ivalue[1] != 0 && ivalue[0] % ivalue[1] == 0) {
// If the denominator is a non-zero integral divisor
// of the numerator then convert the fraction to be
// with respect to a unity denominator.
srationalString =
Integer.toString(ivalue[0] / ivalue[1]) + "/1";
} else {
// Use the values directly.
srationalString =
Integer.toString(ivalue[0]) +
"/" +
Integer.toString(ivalue[1]);
}
return srationalString;
case TIFFTag.TIFF_RATIONAL:
long[] lvalue = getAsRational(index);
String rationalString;
if(lvalue[1] != 0L && lvalue[0] % lvalue[1] == 0) {
// If the denominator is a non-zero integral divisor
// of the numerator then convert the fraction to be
// with respect to a unity denominator.
rationalString =
Long.toString(lvalue[0] / lvalue[1]) + "/1";
} else {
// Use the values directly.
rationalString =
Long.toString(lvalue[0]) +
"/" +
Long.toString(lvalue[1]);
}
return rationalString;
default:
throw new ClassCastException();
}
} | String function(int index) { switch (type) { case TIFFTag.TIFF_ASCII: return ((String[])data)[index]; case TIFFTag.TIFF_BYTE: case TIFFTag.TIFF_UNDEFINED: return Integer.toString(((byte[])data)[index] & 0xff); case TIFFTag.TIFF_SBYTE: return Integer.toString(((byte[])data)[index]); case TIFFTag.TIFF_SHORT: return Integer.toString(((char[])data)[index] & 0xffff); case TIFFTag.TIFF_SSHORT: return Integer.toString(((short[])data)[index]); case TIFFTag.TIFF_SLONG: return Integer.toString(((int[])data)[index]); case TIFFTag.TIFF_LONG: case TIFFTag.TIFF_IFD_POINTER: return Long.toString(((long[])data)[index]); case TIFFTag.TIFF_FLOAT: return Float.toString(((float[])data)[index]); case TIFFTag.TIFF_DOUBLE: return Double.toString(((double[])data)[index]); case TIFFTag.TIFF_SRATIONAL: int[] ivalue = getAsSRational(index); String srationalString; if(ivalue[1] != 0 && ivalue[0] % ivalue[1] == 0) { srationalString = Integer.toString(ivalue[0] / ivalue[1]) + "/1"; } else { srationalString = Integer.toString(ivalue[0]) + "/" + Integer.toString(ivalue[1]); } return srationalString; case TIFFTag.TIFF_RATIONAL: long[] lvalue = getAsRational(index); String rationalString; if(lvalue[1] != 0L && lvalue[0] % lvalue[1] == 0) { rationalString = Long.toString(lvalue[0] / lvalue[1]) + "/1"; } else { rationalString = Long.toString(lvalue[0]) + "/" + Long.toString(lvalue[1]); } return rationalString; default: throw new ClassCastException(); } } | /**
* Returns a <code>String</code> containing a human-readable
* version of the data item. Data of type
* <code>TIFFTag.TIFF_RATIONAL</code> or <code>TIFF_SRATIONAL</code> are
* represented as a pair of integers separated by a
* <code>'/'</code> character.
*
* @throws ClassCastException if the field is not of one of the
* legal field types.
*/ | Returns a <code>String</code> containing a human-readable version of the data item. Data of type <code>TIFFTag.TIFF_RATIONAL</code> or <code>TIFF_SRATIONAL</code> are represented as a pair of integers separated by a <code>'/'</code> character | getValueAsString | {
"repo_name": "Windowsfreak/NIStreamer",
"path": "Windows/testjni32/src/com/sun/media/imageio/plugins/tiff/TIFFField.java",
"license": "mit",
"size": 40085
} | [
"com.sun.media.imageio.plugins.tiff.TIFFTag"
] | import com.sun.media.imageio.plugins.tiff.TIFFTag; | import com.sun.media.imageio.plugins.tiff.*; | [
"com.sun.media"
] | com.sun.media; | 2,188,397 |
public static <K, V> ListValuedMap<K, V> createListValuedHashMap() {
return MultiValuedHashMap.<K, V>listValuedHashMap();
} | static <K, V> ListValuedMap<K, V> function() { return MultiValuedHashMap.<K, V>listValuedHashMap(); } | /**
* Creates a {@link ListValuedMap} with a {@link java.util.HashMap HashMap} as its internal storage.
*
* @param <K> the key type
* @param <V> the value type
* @return a new <code>ListValuedMap</code>
*/ | Creates a <code>ListValuedMap</code> with a <code>java.util.HashMap HashMap</code> as its internal storage | createListValuedHashMap | {
"repo_name": "gonmarques/commons-collections",
"path": "src/main/java/org/apache/commons/collections4/MultiMapUtils.java",
"license": "apache-2.0",
"size": 10721
} | [
"org.apache.commons.collections4.multimap.MultiValuedHashMap"
] | import org.apache.commons.collections4.multimap.MultiValuedHashMap; | import org.apache.commons.collections4.multimap.*; | [
"org.apache.commons"
] | org.apache.commons; | 377,651 |
@Test
public void testOneRuleImplicitCycleJava() throws Exception {
Package pkg =
createScratchPackageForImplicitCycle(
"cycle", "java_library(name='jcyc',", " srcs = ['libjcyc.jar', 'foo.java'])");
assertThrows(NoSuchTargetException.class, () -> pkg.getTarget("jcyc"));
assertThat(pkg.containsErrors()).isTrue();
assertContainsEvent("rule 'jcyc' has file 'libjcyc.jar' as both an" + " input and an output");
} | void function() throws Exception { Package pkg = createScratchPackageForImplicitCycle( "cycle", STR, STR); assertThrows(NoSuchTargetException.class, () -> pkg.getTarget("jcyc")); assertThat(pkg.containsErrors()).isTrue(); assertContainsEvent(STR + STR); } | /**
* Test to detect implicit input/output file overlap in rules.
*/ | Test to detect implicit input/output file overlap in rules | testOneRuleImplicitCycleJava | {
"repo_name": "cushon/bazel",
"path": "src/test/java/com/google/devtools/build/lib/analysis/CircularDependencyTest.java",
"license": "apache-2.0",
"size": 14431
} | [
"com.google.common.truth.Truth",
"com.google.devtools.build.lib.packages.NoSuchTargetException",
"com.google.devtools.build.lib.packages.Package",
"org.junit.Assert"
] | import com.google.common.truth.Truth; import com.google.devtools.build.lib.packages.NoSuchTargetException; import com.google.devtools.build.lib.packages.Package; import org.junit.Assert; | import com.google.common.truth.*; import com.google.devtools.build.lib.packages.*; import org.junit.*; | [
"com.google.common",
"com.google.devtools",
"org.junit"
] | com.google.common; com.google.devtools; org.junit; | 1,305,235 |
List<SurveyUser> getSessionUsers(Long sessionId); | List<SurveyUser> getSessionUsers(Long sessionId); | /**
* Get all users under one tool session.
*
* @param sessionId
* @return
*/ | Get all users under one tool session | getSessionUsers | {
"repo_name": "lamsfoundation/lams",
"path": "lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/service/ISurveyService.java",
"license": "gpl-2.0",
"size": 9944
} | [
"java.util.List",
"org.lamsfoundation.lams.tool.survey.model.SurveyUser"
] | import java.util.List; import org.lamsfoundation.lams.tool.survey.model.SurveyUser; | import java.util.*; import org.lamsfoundation.lams.tool.survey.model.*; | [
"java.util",
"org.lamsfoundation.lams"
] | java.util; org.lamsfoundation.lams; | 1,339,004 |
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
} | boolean function(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } | /**
* Handle action bar item clicks here. The action bar will automatically
* handle clicks on the Home/Up button, so long as you specify a parent
* activity in AndroidManifest.xml.
*
* @param item
* The menu item.
* @return true if the item is selected.
*/ | Handle action bar item clicks here. The action bar will automatically handle clicks on the Home/Up button, so long as you specify a parent activity in AndroidManifest.xml | onOptionsItemSelected | {
"repo_name": "CMPUT301F14T06/Team06MapleSyrup",
"path": "App/src/ca/ualberta/app/activity/MyLocalActivity.java",
"license": "apache-2.0",
"size": 13725
} | [
"android.view.MenuItem"
] | import android.view.MenuItem; | import android.view.*; | [
"android.view"
] | android.view; | 2,750,891 |
@Nonnull
FlowSnippetDTO instantiateTemplate(@Nonnull String processGroupId, @Nonnull String templateId); | FlowSnippetDTO instantiateTemplate(@Nonnull String processGroupId, @Nonnull String templateId); | /**
* Instantiates a template.
*
* @param processGroupId the process group id
* @param templateId the template id
* @return the created flow
* @throws NifiComponentNotFoundException if the process group or template does not exist
*/ | Instantiates a template | instantiateTemplate | {
"repo_name": "claudiu-stanciu/kylo",
"path": "integrations/nifi/nifi-rest/nifi-rest-client/nifi-rest-client-api/src/main/java/com/thinkbiganalytics/nifi/rest/client/NiFiProcessGroupsRestClient.java",
"license": "apache-2.0",
"size": 9155
} | [
"javax.annotation.Nonnull",
"org.apache.nifi.web.api.dto.FlowSnippetDTO"
] | import javax.annotation.Nonnull; import org.apache.nifi.web.api.dto.FlowSnippetDTO; | import javax.annotation.*; import org.apache.nifi.web.api.dto.*; | [
"javax.annotation",
"org.apache.nifi"
] | javax.annotation; org.apache.nifi; | 115,696 |
@Test
public void testGetDocumentIds() throws Exception {
final List<String> ids = NAVUtils.getDocumentIds(sig);
assertTrue(ids.size() == 2);
assertEquals(ids.get(0), "urn:oid:1.3.345245354.435345");
} | void function() throws Exception { final List<String> ids = NAVUtils.getDocumentIds(sig); assertTrue(ids.size() == 2); assertEquals(ids.get(0), STR); } | /**
* Tests document ids
* @throws Exception - error thrown
*/ | Tests document ids | testGetDocumentIds | {
"repo_name": "NCIP/cacis",
"path": "nav/src/test/java/gov/nih/nci/cacis/nav/NAVUtilsTest.java",
"license": "bsd-3-clause",
"size": 1722
} | [
"java.util.List",
"org.junit.Assert"
] | import java.util.List; import org.junit.Assert; | import java.util.*; import org.junit.*; | [
"java.util",
"org.junit"
] | java.util; org.junit; | 2,660,620 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.