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
protected boolean isSelected(Node n) { return contentManager.getContentElement(n) != null; } protected static HashMap selectorFactories = new HashMap(); static { ContentSelectorFactory f1 = new XPathPatternContentSelectorFactory(); ContentSelectorFactory f2 = new XPathSubsetContentSelectorFactory(); selectorFactories.put(null, f1); selectorFactories.put("XPathPattern", f1); selectorFactories.put("XPathSubset", f2); }
boolean function(Node n) { return contentManager.getContentElement(n) != null; } protected static HashMap selectorFactories = new HashMap(); static { ContentSelectorFactory f1 = new XPathPatternContentSelectorFactory(); ContentSelectorFactory f2 = new XPathSubsetContentSelectorFactory(); selectorFactories.put(null, f1); selectorFactories.put(STR, f1); selectorFactories.put(STR, f2); }
/** * Returns true if the given node has already been selected * by a content element. */
Returns true if the given node has already been selected by a content element
isSelected
{ "repo_name": "git-moss/Push2Display", "path": "lib/batik-1.8/sources/org/apache/batik/bridge/svg12/AbstractContentSelector.java", "license": "lgpl-3.0", "size": 5710 }
[ "java.util.HashMap", "org.w3c.dom.Node" ]
import java.util.HashMap; import org.w3c.dom.Node;
import java.util.*; import org.w3c.dom.*;
[ "java.util", "org.w3c.dom" ]
java.util; org.w3c.dom;
1,001,070
public static String getRecurlySignature(String privateJsKey, Long unixTime, String nonce, List<String> extraParams) { // Mandatory parameters shared by all signatures (as per spec) extraParams = (extraParams == null) ? new ArrayList<String>() : extraParams; extraParams.add(String.format(Locale.ROOT, PARAMETER_FORMAT, TIMESTAMP_PARAMETER, unixTime)); extraParams.add(String.format(Locale.ROOT, PARAMETER_FORMAT, NONCE_PARAMETER, nonce)); String protectedParams = Joiner.on(PARAMETER_SEPARATOR).join(extraParams); return generateRecurlyHMAC(privateJsKey, protectedParams) + "|" + protectedParams; }
static String function(String privateJsKey, Long unixTime, String nonce, List<String> extraParams) { extraParams = (extraParams == null) ? new ArrayList<String>() : extraParams; extraParams.add(String.format(Locale.ROOT, PARAMETER_FORMAT, TIMESTAMP_PARAMETER, unixTime)); extraParams.add(String.format(Locale.ROOT, PARAMETER_FORMAT, NONCE_PARAMETER, nonce)); String protectedParams = Joiner.on(PARAMETER_SEPARATOR).join(extraParams); return generateRecurlyHMAC(privateJsKey, protectedParams) + " " + protectedParams; }
/** * Get Recurly.js Signature with extra parameter strings in the format "[param]=[value]" * See spec here: https://docs.recurly.com/deprecated-api-docs/recurlyjs/signatures * <p> * Returns a signature key for use with recurly.js BuildSubscriptionForm. * * @param privateJsKey recurly.js private key * @param unixTime Unix timestamp, i.e. elapsed seconds since Midnight, Jan 1st 1970, UTC * @param nonce A randomly generated string (number used only once) * @param extraParams extra parameters to include in the signature * @return signature string on success, null otherwise */
Get Recurly.js Signature with extra parameter strings in the format "[param]=[value]" See spec here: HREF Returns a signature key for use with recurly.js BuildSubscriptionForm
getRecurlySignature
{ "repo_name": "killbilling/recurly-java-library", "path": "src/main/java/com/ning/billing/recurly/RecurlyJs.java", "license": "apache-2.0", "size": 4931 }
[ "com.google.common.base.Joiner", "java.util.ArrayList", "java.util.List", "java.util.Locale" ]
import com.google.common.base.Joiner; import java.util.ArrayList; import java.util.List; import java.util.Locale;
import com.google.common.base.*; import java.util.*;
[ "com.google.common", "java.util" ]
com.google.common; java.util;
2,568,847
public static int uuidToBytes(@Nullable UUID uuid, byte[] arr, int off) { return off + GridClientByteUtils.uuidToBytes(uuid, arr, off); }
static int function(@Nullable UUID uuid, byte[] arr, int off) { return off + GridClientByteUtils.uuidToBytes(uuid, arr, off); }
/** * Encodes {@link java.util.UUID} into a sequence of bytes using the {@link java.nio.ByteBuffer}, * storing the result into a new byte array. * * @param uuid Unique identifier. * @param arr Byte array to fill with result. * @param off Offset in {@code arr}. * @return Number of bytes overwritten in {@code bytes} array. */
Encodes <code>java.util.UUID</code> into a sequence of bytes using the <code>java.nio.ByteBuffer</code>, storing the result into a new byte array
uuidToBytes
{ "repo_name": "shurun19851206/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java", "license": "apache-2.0", "size": 289056 }
[ "org.jetbrains.annotations.Nullable" ]
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.*;
[ "org.jetbrains.annotations" ]
org.jetbrains.annotations;
1,742,952
EClass getCodeSystemCatalogEntrySummary();
EClass getCodeSystemCatalogEntrySummary();
/** * Returns the meta object for class '{@link org.openhealthtools.mdht.cts2.codesystem.CodeSystemCatalogEntrySummary * <em>Catalog Entry Summary</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @return the meta object for class '<em>Catalog Entry Summary</em>'. * @see org.openhealthtools.mdht.cts2.codesystem.CodeSystemCatalogEntrySummary * @generated */
Returns the meta object for class '<code>org.openhealthtools.mdht.cts2.codesystem.CodeSystemCatalogEntrySummary Catalog Entry Summary</code>'.
getCodeSystemCatalogEntrySummary
{ "repo_name": "drbgfc/mdht", "path": "cts2/plugins/org.openhealthtools.mdht.cts2.core/src/org/openhealthtools/mdht/cts2/codesystem/CodeSystemPackage.java", "license": "epl-1.0", "size": 50142 }
[ "org.eclipse.emf.ecore.EClass" ]
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
333,217
ShardRouting routingEntry();
ShardRouting routingEntry();
/** * Returns the latest cluster routing entry received with this shard. */
Returns the latest cluster routing entry received with this shard
routingEntry
{ "repo_name": "HonzaKral/elasticsearch", "path": "server/src/main/java/org/elasticsearch/indices/cluster/IndicesClusterStateService.java", "license": "apache-2.0", "size": 49998 }
[ "org.elasticsearch.cluster.routing.ShardRouting" ]
import org.elasticsearch.cluster.routing.ShardRouting;
import org.elasticsearch.cluster.routing.*;
[ "org.elasticsearch.cluster" ]
org.elasticsearch.cluster;
1,501,903
public ServiceFuture<Void> updateAsync(String resourceGroupName, String serviceName, String tagId, String ifMatch, String displayName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serviceName, tagId, ifMatch, displayName), serviceCallback); }
ServiceFuture<Void> function(String resourceGroupName, String serviceName, String tagId, String ifMatch, String displayName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serviceName, tagId, ifMatch, displayName), serviceCallback); }
/** * Updates the details of the tag specified by its identifier. * * @param resourceGroupName The name of the resource group. * @param serviceName The name of the API Management service. * @param tagId Tag identifier. Must be unique in the current API Management service instance. * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. * @param displayName Tag name. * @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 the details of the tag specified by its identifier
updateAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/apimanagement/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/apimanagement/v2018_06_01_preview/implementation/TagsInner.java", "license": "mit", "size": 231760 }
[ "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;
2,176,812
protected void setThumbBounds(int x, int y, int width, int height) { if ((thumbRect.x == x) && (thumbRect.y == y) && (thumbRect.width == width) && (thumbRect.height == height)) { return; } int minX = Math.min(x, thumbRect.x); int minY = Math.min(y, thumbRect.y); int maxX = Math.max(x + width, thumbRect.x + thumbRect.width); int maxY = Math.max(y + height, thumbRect.y + thumbRect.height); thumbRect.setBounds(x, y, width, height); scrollbar.repaint(minX, minY, (maxX - minX) + 1, (maxY - minY) + 1); } class ScrollBarListener extends BasicScrollBarUI.PropertyChangeHandler {
void function(int x, int y, int width, int height) { if ((thumbRect.x == x) && (thumbRect.y == y) && (thumbRect.width == width) && (thumbRect.height == height)) { return; } int minX = Math.min(x, thumbRect.x); int minY = Math.min(y, thumbRect.y); int maxX = Math.max(x + width, thumbRect.x + thumbRect.width); int maxY = Math.max(y + height, thumbRect.y + thumbRect.height); thumbRect.setBounds(x, y, width, height); scrollbar.repaint(minX, minY, (maxX - minX) + 1, (maxY - minY) + 1); } class ScrollBarListener extends BasicScrollBarUI.PropertyChangeHandler {
/** * This is overridden only to increase the invalid area. This * ensures that the "Shadow" below the thumb is invalidated */
This is overridden only to increase the invalid area. This ensures that the "Shadow" below the thumb is invalidated
setThumbBounds
{ "repo_name": "RenatGilmanov/tau-ui", "path": "src/java/com/taunova/ui/laf/ExtendedScrollBarUI.java", "license": "gpl-2.0", "size": 8530 }
[ "javax.swing.plaf.basic.BasicScrollBarUI" ]
import javax.swing.plaf.basic.BasicScrollBarUI;
import javax.swing.plaf.basic.*;
[ "javax.swing" ]
javax.swing;
546,882
public static boolean runSample(Azure azure, String clientId, String secret) { final String rgName = SdkContext.randomResourceName("rgACR", 15); final String acrName = SdkContext.randomResourceName("acrsample", 20); final String acsName = SdkContext.randomResourceName("acssample", 30); final String rootUserName = "acsuser"; final Region region = Region.US_EAST; final String dockerImageName = "nginx"; final String dockerImageTag = "latest"; final String dockerContainerName = "acrsample-nginx"; String acsSecretName = "mysecret112233"; String acsNamespace = "acrsample"; String acsLbIngressName = "lb-acrsample"; String servicePrincipalClientId = clientId; // replace with a real service principal client id String servicePrincipalSecret = secret; // and corresponding secret SSHShell shell = null; try { //============================================================= // If service principal client id and secret are not set via the local variables, attempt to read the service // principal client id and secret from a secondary ".azureauth" file set through an environment variable. // // If the environment variable was not set then reuse the main service principal set for running this sample. if (servicePrincipalClientId.isEmpty() || servicePrincipalSecret.isEmpty()) { String envSecondaryServicePrincipal = System.getenv("AZURE_AUTH_LOCATION_2"); if (envSecondaryServicePrincipal == null || !envSecondaryServicePrincipal.isEmpty() || !Files.exists(Paths.get(envSecondaryServicePrincipal))) { envSecondaryServicePrincipal = System.getenv("AZURE_AUTH_LOCATION"); } servicePrincipalClientId = Utils.getSecondaryServicePrincipalClientID(envSecondaryServicePrincipal); servicePrincipalSecret = Utils.getSecondaryServicePrincipalSecret(envSecondaryServicePrincipal); } //============================================================= // Create an SSH private/public key pair to be used when creating the container service System.out.println("Creating an SSH private and public key pair"); SSHShell.SshPublicPrivateKey sshKeys = SSHShell.generateSSHKeys("", "ACS"); System.out.println("SSH private key value: \n" + sshKeys.getSshPrivateKey()); System.out.println("SSH public key value: \n" + sshKeys.getSshPublicKey()); //============================================================= // Create an Azure Container Service with Kubernetes orchestration System.out.println("Creating an Azure Container Service with Kubernetes ochestration and one agent (virtual machine)"); Date t1 = new Date(); ContainerService azureContainerService = azure.containerServices().define(acsName) .withRegion(region) .withNewResourceGroup(rgName) .withKubernetesOrchestration() .withServicePrincipal(servicePrincipalClientId, servicePrincipalSecret) .withLinux() .withRootUsername(rootUserName) .withSshKey(sshKeys.getSshPublicKey()) .withMasterNodeCount(ContainerServiceMasterProfileCount.MIN) .withMasterLeafDomainLabel("dns-" + acsName) .defineAgentPool("agentpool") .withVMCount(1) .withVMSize(ContainerServiceVMSizeTypes.STANDARD_D1_V2) .withLeafDomainLabel("dns-ap-" + acsName) .attach() .create(); Date t2 = new Date(); System.out.println("Created Azure Container Service: (took " + ((t2.getTime() - t1.getTime()) / 1000) + " seconds) " + azureContainerService.id()); Utils.print(azureContainerService); //============================================================= // Create an Azure Container Registry to store and manage private Docker container images System.out.println("Creating an Azure Container Registry"); t1 = new Date(); Registry azureRegistry = azure.containerRegistries().define(acrName) .withRegion(region) .withNewResourceGroup(rgName) .withBasicSku() .withRegistryNameAsAdminUser() .create(); t2 = new Date(); System.out.println("Created Azure Container Registry: (took " + ((t2.getTime() - t1.getTime()) / 1000) + " seconds) " + azureRegistry.id()); Utils.print(azureRegistry); //============================================================= // Create a Docker client that will be used to push/pull images to/from the Azure Container Registry RegistryCredentials acrCredentials = azureRegistry.getCredentials(); DockerClient dockerClient = DockerUtils.createDockerClient(azure, rgName, region, azureRegistry.loginServerUrl(), acrCredentials.username(), acrCredentials.accessKeys().get(AccessKeyType.PRIMARY)); //============================================================= // Pull a temp image from public Docker repo and create a temporary container from that image // These steps can be replaced and instead build a custom image using a Dockerfile and the app's JAR dockerClient.pullImageCmd(dockerImageName) .withTag(dockerImageTag) .exec(new PullImageResultCallback()) .awaitSuccess(); System.out.println("List local Docker images:"); List<Image> images = dockerClient.listImagesCmd().withShowAll(true).exec(); for (Image image : images) { System.out.format("\tFound Docker image %s (%s)\n", image.getRepoTags()[0], image.getId()); } CreateContainerResponse dockerContainerInstance = dockerClient.createContainerCmd(dockerImageName + ":" + dockerImageTag) .withName(dockerContainerName) .withCmd("/hello") .exec(); System.out.println("List Docker containers:"); List<Container> dockerContainers = dockerClient.listContainersCmd() .withShowAll(true) .exec(); for (Container container : dockerContainers) { System.out.format("\tFound Docker container %s (%s)\n", container.getImage(), container.getId()); } //============================================================= // Commit the new container String privateRepoUrl = azureRegistry.loginServerUrl() + "/samples/" + dockerContainerName; String dockerImageId = dockerClient.commitCmd(dockerContainerInstance.getId()) .withRepository(privateRepoUrl) .withTag("latest").exec(); // We can now remove the temporary container instance dockerClient.removeContainerCmd(dockerContainerInstance.getId()) .withForce(true) .exec(); //============================================================= // Push the new Docker image to the Azure Container Registry dockerClient.pushImageCmd(privateRepoUrl) .withAuthConfig(dockerClient.authConfig()) .exec(new PushImageResultCallback()).awaitSuccess(); // Remove the temp image from the local Docker host try { dockerClient.removeImageCmd(dockerImageName + ":" + dockerImageTag).withForce(true).exec(); } catch (NotFoundException e) { // just ignore if not exist } //============================================================= // Verify that the image we saved in the Azure Container registry can be pulled and instantiated locally dockerClient.pullImageCmd(privateRepoUrl) .withAuthConfig(dockerClient.authConfig()) .exec(new PullImageResultCallback()).awaitSuccess(); System.out.println("List local Docker images after pulling sample image from the Azure Container Registry:"); images = dockerClient.listImagesCmd() .withShowAll(true) .exec(); for (Image image : images) { System.out.format("\tFound Docker image %s (%s)\n", image.getRepoTags()[0], image.getId()); } dockerContainerInstance = dockerClient.createContainerCmd(privateRepoUrl) .withName(dockerContainerName + "-private") .withCmd("/hello").exec(); System.out.println("List Docker containers after instantiating container from the Azure Container Registry sample image:"); dockerContainers = dockerClient.listContainersCmd() .withShowAll(true) .exec(); for (Container container : dockerContainers) { System.out.format("\tFound Docker container %s (%s)\n", container.getImage(), container.getId()); } //============================================================= // Download the Kubernetes config file from one of the master virtual machines azureContainerService = azure.containerServices().getByResourceGroup(rgName, acsName); System.out.println("Found Kubernetes master at: " + azureContainerService.masterFqdn()); shell = SSHShell.open(azureContainerService.masterFqdn(), 22, rootUserName, sshKeys.getSshPrivateKey().getBytes()); String kubeConfigContent = shell.download("config", ".kube", true); System.out.println("Found Kubernetes config:\n" + kubeConfigContent); //============================================================= // Instantiate the Kubernetes client using the downloaded ".kube/config" file content // The Kubernetes client API requires setting an environment variable pointing at a real file; // we will create a temporary file that will be deleted automatically when the sample exits File tempKubeConfigFile = File.createTempFile("kube", ".config", new File(System.getProperty("java.io.tmpdir"))); tempKubeConfigFile.deleteOnExit(); BufferedWriter buffOut = new BufferedWriter(new FileWriter(tempKubeConfigFile)); buffOut.write(kubeConfigContent); buffOut.close(); System.setProperty(Config.KUBERNETES_KUBECONFIG_FILE, tempKubeConfigFile.getPath()); Config config = new Config(); KubernetesClient kubernetesClient = new DefaultKubernetesClient(config); //============================================================= // List all the nodes available in the Kubernetes cluster System.out.println(kubernetesClient.nodes().list()); //============================================================= // Create a namespace where all the sample Kubernetes resources will be created Namespace ns = new NamespaceBuilder() .withNewMetadata() .withName(acsNamespace) .addToLabels("acr", "sample") .endMetadata() .build(); try { System.out.println("Created namespace" + kubernetesClient.namespaces().create(ns)); } catch (Exception ignored) { } Thread.sleep(5000); for (Namespace namespace : kubernetesClient.namespaces().list().getItems()) { System.out.println("\tFound Kubernetes namespace: " + namespace.toString()); } //============================================================= // Create a secret of type "docker-repository" that will be used for downloading the container image from // our Azure private container repo String basicAuth = new String(Base64.encodeBase64((acrCredentials.username() + ":" + acrCredentials.accessKeys().get(AccessKeyType.PRIMARY)).getBytes())); HashMap<String, String> secretData = new HashMap<>(1); String dockerCfg = String.format("{ \"%s\": { \"auth\": \"%s\", \"email\": \"%s\" } }", azureRegistry.loginServerUrl(), basicAuth, "[email protected]"); dockerCfg = new String(Base64.encodeBase64(dockerCfg.getBytes("UTF-8")), "UTF-8"); secretData.put(".dockercfg", dockerCfg); SecretBuilder secretBuilder = new SecretBuilder() .withNewMetadata() .withName(acsSecretName) .withNamespace(acsNamespace) .endMetadata() .withData(secretData) .withType("kubernetes.io/dockercfg"); System.out.println("Creating new secret: " + kubernetesClient.secrets().inNamespace(acsNamespace).create(secretBuilder.build())); Thread.sleep(5000); for (Secret kubeS : kubernetesClient.secrets().inNamespace(acsNamespace).list().getItems()) { System.out.println("\tFound secret: " + kubeS); } //============================================================= // Create a replication controller for our image stored in the Azure Container Registry ReplicationController rc = new ReplicationControllerBuilder() .withNewMetadata() .withName("acrsample-rc") .withNamespace(acsNamespace) .addToLabels("acrsample-nginx", "nginx") .endMetadata() .withNewSpec() .withReplicas(2) .withNewTemplate() .withNewMetadata() .addToLabels("acrsample-nginx", "nginx") .endMetadata() .withNewSpec() .addNewImagePullSecret(acsSecretName) .addNewContainer() .withName("acrsample-pod-nginx") .withImage(privateRepoUrl) .addNewPort() .withContainerPort(80) .endPort() .endContainer() .endSpec() .endTemplate() .endSpec() .build(); System.out.println("Creating a replication controller: " + kubernetesClient.replicationControllers().inNamespace(acsNamespace).create(rc)); Thread.sleep(5000); rc = kubernetesClient.replicationControllers().inNamespace(acsNamespace).withName("acrsample-rc").get(); System.out.println("Found replication controller: " + rc.toString()); for (Pod pod : kubernetesClient.pods().inNamespace(acsNamespace).list().getItems()) { System.out.println("\tFound Kubernetes pods: " + pod.toString()); } //============================================================= // Create a Load Balancer service that will expose the service to the world Service lbService = new ServiceBuilder() .withNewMetadata() .withName(acsLbIngressName) .withNamespace(acsNamespace) .endMetadata() .withNewSpec() .withType("LoadBalancer") .addNewPort() .withPort(80) .withProtocol("TCP") .endPort() .addToSelector("acrsample-nginx", "nginx") .endSpec() .build(); System.out.println("Creating a service: " + kubernetesClient.services().inNamespace(acsNamespace).create(lbService)); Thread.sleep(5000); System.out.println("\tFound service: " + kubernetesClient.services().inNamespace(acsNamespace).withName(acsLbIngressName).get()); //============================================================= // Wait until the external IP becomes available int timeout = 30 * 60 * 1000; // 30 minutes String matchIPV4 = "^(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)(\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)){3}$"; while (timeout > 0) { try { List<LoadBalancerIngress> lbIngressList = kubernetesClient.services().inNamespace(acsNamespace).withName(acsLbIngressName).get().getStatus().getLoadBalancer().getIngress(); if (lbIngressList != null && !lbIngressList.isEmpty() && lbIngressList.get(0) != null && lbIngressList.get(0).getIp().matches(matchIPV4)) { System.out.println("\tFound ingress IP: " + lbIngressList.get(0).getIp()); timeout = 0; } } catch (Exception ignored) { } if (timeout > 0) { timeout -= 30000; // 30 seconds Thread.sleep(30000); } } // Clean-up kubernetesClient.namespaces().delete(ns); shell.close(); shell = null; return true; } catch (Exception f) { System.out.println(f.getMessage()); f.printStackTrace(); } finally { try { System.out.println("Deleting Resource Group: " + rgName); azure.resourceGroups().beginDeleteByName(rgName); System.out.println("Deleted Resource Group: " + rgName); if (shell != null) { shell.close(); } } catch (NullPointerException npe) { System.out.println("Did not create any resources in Azure. No clean up is necessary"); } catch (Exception g) { g.printStackTrace(); } } return false; }
static boolean function(Azure azure, String clientId, String secret) { final String rgName = SdkContext.randomResourceName("rgACR", 15); final String acrName = SdkContext.randomResourceName(STR, 20); final String acsName = SdkContext.randomResourceName(STR, 30); final String rootUserName = STR; final Region region = Region.US_EAST; final String dockerImageName = "nginx"; final String dockerImageTag = STR; final String dockerContainerName = STR; String acsSecretName = STR; String acsNamespace = STR; String acsLbIngressName = STR; String servicePrincipalClientId = clientId; String servicePrincipalSecret = secret; SSHShell shell = null; try { if (servicePrincipalClientId.isEmpty() servicePrincipalSecret.isEmpty()) { String envSecondaryServicePrincipal = System.getenv(STR); if (envSecondaryServicePrincipal == null !envSecondaryServicePrincipal.isEmpty() !Files.exists(Paths.get(envSecondaryServicePrincipal))) { envSecondaryServicePrincipal = System.getenv(STR); } servicePrincipalClientId = Utils.getSecondaryServicePrincipalClientID(envSecondaryServicePrincipal); servicePrincipalSecret = Utils.getSecondaryServicePrincipalSecret(envSecondaryServicePrincipal); } System.out.println(STR); SSHShell.SshPublicPrivateKey sshKeys = SSHShell.generateSSHKeys(STRACSSTRSSH private key value: \nSTRSSH public key value: \nSTRCreating an Azure Container Service with Kubernetes ochestration and one agent (virtual machine)STRdns-STRagentpoolSTRdns-ap-STRCreated Azure Container Service: (took STR seconds) STRCreating an Azure Container RegistrySTRCreated Azure Container Registry: (took STR seconds) STRList local Docker images:STR\tFound Docker image %s (%s)\nSTR:STR/helloSTRList Docker containers:STR\tFound Docker container %s (%s)\nSTR/samples/" + dockerContainerName; String dockerImageId = dockerClient.commitCmd(dockerContainerInstance.getId()) .withRepository(privateRepoUrl) .withTag(STR).exec(); dockerClient.removeContainerCmd(dockerContainerInstance.getId()) .withForce(true) .exec(); dockerClient.pushImageCmd(privateRepoUrl) .withAuthConfig(dockerClient.authConfig()) .exec(new PushImageResultCallback()).awaitSuccess(); try { dockerClient.removeImageCmd(dockerImageName + ":STRList local Docker images after pulling sample image from the Azure Container Registry:STR\tFound Docker image %s (%s)\nSTR-privateSTR/helloSTRList Docker containers after instantiating container from the Azure Container Registry sample image:STR\tFound Docker container %s (%s)\nSTRFound Kubernetes master at: STRconfigSTR.kubeSTRFound Kubernetes config:\nSTRkubeSTR.configSTRjava.io.tmpdirSTRacrSTRsampleSTRCreated namespaceSTR\tFound Kubernetes namespace: STR:STR{ \"%s\": { \"auth\": \"%s\", \STR: \"%s\" } }STRacrsample@azure.comSTRUTF-8STRUTF-8STR.dockercfgSTRkubernetes.io/dockercfgSTRCreating new secret: STR\tFound secret: STRacrsample-rc") .withNamespace(acsNamespace) .addToLabels(STR, "nginx") .endMetadata() .withNewSpec() .withReplicas(2) .withNewTemplate() .withNewMetadata() .addToLabels(STR, "nginxSTRacrsample-pod-nginxSTRCreating a replication controller: STRacrsample-rcSTRFound replication controller: STR\tFound Kubernetes pods: STRLoadBalancerSTRTCP") .endPort() .addToSelector(STR, "nginxSTRCreating a service: STR\tFound service: STR^(25[0-5] 2[0-4]\\d [0-1]?\\d?\\d)(\\.(25[0-5] 2[0-4]\\d [0-1]?\\d?\\d)){3}$STR\tFound ingress IP: STRDeleting Resource Group: STRDeleted Resource Group: STRDid not create any resources in Azure. No clean up is necessary"); } catch (Exception g) { g.printStackTrace(); } } return false; }
/** * Main function which runs the actual sample. * * @param azure instance of the azure client * @param clientId secondary service principal client ID * @param secret secondary service principal secret * @return true if sample runs successfully */
Main function which runs the actual sample
runSample
{ "repo_name": "martinsawicki/azure-sdk-for-java", "path": "azure-samples/src/main/java/com/microsoft/azure/management/compute/samples/DeployImageFromContainerRegistryToKubernetes.java", "license": "mit", "size": 23808 }
[ "com.github.dockerjava.api.model.Container", "com.github.dockerjava.core.command.PushImageResultCallback", "com.microsoft.azure.management.Azure", "com.microsoft.azure.management.containerregistry.Registry", "com.microsoft.azure.management.resources.fluentcore.arm.Region", "com.microsoft.azure.management.resources.fluentcore.utils.SdkContext", "com.microsoft.azure.management.samples.SSHShell", "com.microsoft.azure.management.samples.Utils", "io.fabric8.kubernetes.api.model.Service", "java.nio.file.Files", "java.nio.file.Paths" ]
import com.github.dockerjava.api.model.Container; import com.github.dockerjava.core.command.PushImageResultCallback; import com.microsoft.azure.management.Azure; import com.microsoft.azure.management.containerregistry.Registry; import com.microsoft.azure.management.resources.fluentcore.arm.Region; import com.microsoft.azure.management.resources.fluentcore.utils.SdkContext; import com.microsoft.azure.management.samples.SSHShell; import com.microsoft.azure.management.samples.Utils; import io.fabric8.kubernetes.api.model.Service; import java.nio.file.Files; import java.nio.file.Paths;
import com.github.dockerjava.api.model.*; import com.github.dockerjava.core.command.*; import com.microsoft.azure.management.*; import com.microsoft.azure.management.containerregistry.*; import com.microsoft.azure.management.resources.fluentcore.arm.*; import com.microsoft.azure.management.resources.fluentcore.utils.*; import com.microsoft.azure.management.samples.*; import io.fabric8.kubernetes.api.model.*; import java.nio.file.*;
[ "com.github.dockerjava", "com.microsoft.azure", "io.fabric8.kubernetes", "java.nio" ]
com.github.dockerjava; com.microsoft.azure; io.fabric8.kubernetes; java.nio;
2,576,240
public static void cancelSwarm(Object swarm) { Assert.assertTrue(swarm instanceof InternalDistributedSystem); // TODO // Find the swarmSet and remove it ArrayList swarmSet; synchronized (allSwarms) { swarmSet = (ArrayList) allSwarms.get(swarm); if (swarmSet == null) { return; // already cancelled } // Remove before releasing synchronization, so any fresh timer ends up // in a new set with same key allSwarms.remove(swarmSet); } // synchronized // Empty the swarmSet synchronized (swarmSet) { Iterator it = swarmSet.iterator(); while (it.hasNext()) { WeakReference wr = (WeakReference) it.next(); SystemTimer st = (SystemTimer) wr.get(); // it.remove(); Not necessary, we're emptying the list... if (st != null) { st.cancelled = true; // for safety :-) st.timer.cancel(); // st.cancel() would just search for it again } } // while } // synchronized }
static void function(Object swarm) { Assert.assertTrue(swarm instanceof InternalDistributedSystem); ArrayList swarmSet; synchronized (allSwarms) { swarmSet = (ArrayList) allSwarms.get(swarm); if (swarmSet == null) { return; } allSwarms.remove(swarmSet); } synchronized (swarmSet) { Iterator it = swarmSet.iterator(); while (it.hasNext()) { WeakReference wr = (WeakReference) it.next(); SystemTimer st = (SystemTimer) wr.get(); if (st != null) { st.cancelled = true; st.timer.cancel(); } } } }
/** * Cancel all outstanding timers * * @param swarm the swarm to cancel */
Cancel all outstanding timers
cancelSwarm
{ "repo_name": "pdxrunner/geode", "path": "geode-core/src/main/java/org/apache/geode/internal/SystemTimer.java", "license": "apache-2.0", "size": 14529 }
[ "java.lang.ref.WeakReference", "java.util.ArrayList", "java.util.Iterator", "org.apache.geode.distributed.internal.InternalDistributedSystem" ]
import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Iterator; import org.apache.geode.distributed.internal.InternalDistributedSystem;
import java.lang.ref.*; import java.util.*; import org.apache.geode.distributed.internal.*;
[ "java.lang", "java.util", "org.apache.geode" ]
java.lang; java.util; org.apache.geode;
2,110,922
protected final void renderApplicationLevelHeaders(final HtmlHeaderContainer headerContainer) { Args.notNull(headerContainer, "headerContainer"); if (Application.exists()) { HeaderContributorListenerCollection headerContributorListenerCollection = Application.get().getHeaderContributorListenerCollection(); IHeaderResponse headerResponse = headerContainer.getHeaderResponse(); for (IHeaderContributor listener : headerContributorListenerCollection) { listener.renderHead(headerResponse); } } }
final void function(final HtmlHeaderContainer headerContainer) { Args.notNull(headerContainer, STR); if (Application.exists()) { HeaderContributorListenerCollection headerContributorListenerCollection = Application.get().getHeaderContributorListenerCollection(); IHeaderResponse headerResponse = headerContainer.getHeaderResponse(); for (IHeaderContributor listener : headerContributorListenerCollection) { listener.renderHead(headerResponse); } } }
/** * Render the application level headers * * @param headerContainer */
Render the application level headers
renderApplicationLevelHeaders
{ "repo_name": "mafulafunk/wicket", "path": "wicket-core/src/main/java/org/apache/wicket/markup/renderStrategy/AbstractHeaderRenderStrategy.java", "license": "apache-2.0", "size": 4888 }
[ "org.apache.wicket.Application", "org.apache.wicket.application.HeaderContributorListenerCollection", "org.apache.wicket.markup.head.IHeaderResponse", "org.apache.wicket.markup.html.IHeaderContributor", "org.apache.wicket.markup.html.internal.HtmlHeaderContainer", "org.apache.wicket.util.lang.Args" ]
import org.apache.wicket.Application; import org.apache.wicket.application.HeaderContributorListenerCollection; import org.apache.wicket.markup.head.IHeaderResponse; import org.apache.wicket.markup.html.IHeaderContributor; import org.apache.wicket.markup.html.internal.HtmlHeaderContainer; import org.apache.wicket.util.lang.Args;
import org.apache.wicket.*; import org.apache.wicket.application.*; import org.apache.wicket.markup.head.*; import org.apache.wicket.markup.html.*; import org.apache.wicket.markup.html.internal.*; import org.apache.wicket.util.lang.*;
[ "org.apache.wicket" ]
org.apache.wicket;
1,008,050
public final JsArray<Selection> getSelections() { return Selection.getSelections(this); }
final JsArray<Selection> function() { return Selection.getSelections(this); }
/** * Returns a selection array containing the selected row * * @return Selection array */
Returns a selection array containing the selected row
getSelections
{ "repo_name": "say2joe/fedkit", "path": "js/graphing/chap-links-library/gwt/src/Timeline/src/com/chap/links/client/Timeline.java", "license": "gpl-3.0", "size": 41569 }
[ "com.google.gwt.core.client.JsArray", "com.google.gwt.visualization.client.Selection" ]
import com.google.gwt.core.client.JsArray; import com.google.gwt.visualization.client.Selection;
import com.google.gwt.core.client.*; import com.google.gwt.visualization.client.*;
[ "com.google.gwt" ]
com.google.gwt;
373,531
static boolean isEmpty(Map<?, ?> map) { return map == null || map.size() == 0; }
static boolean isEmpty(Map<?, ?> map) { return map == null map.size() == 0; }
/** * Returns true if the map is null or empty * * @param map * @return */
Returns true if the map is null or empty
isEmpty
{ "repo_name": "fuero/gitblit", "path": "src/main/java/com/gitblit/models/TicketModel.java", "license": "apache-2.0", "size": 39357 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
266,727
public void addStatistics(String cartridgeType, MockScalingFactor scalingFactor, Integer value) { Map<String, Integer> factorValueMap = statisticsMap.get(cartridgeType); if (factorValueMap == null) { synchronized (MockHealthStatistics.class) { if (factorValueMap == null) { factorValueMap = new ConcurrentHashMap<String, Integer>(); statisticsMap.put(cartridgeType, factorValueMap); } } } factorValueMap.put(scalingFactor.toString(), value); }
void function(String cartridgeType, MockScalingFactor scalingFactor, Integer value) { Map<String, Integer> factorValueMap = statisticsMap.get(cartridgeType); if (factorValueMap == null) { synchronized (MockHealthStatistics.class) { if (factorValueMap == null) { factorValueMap = new ConcurrentHashMap<String, Integer>(); statisticsMap.put(cartridgeType, factorValueMap); } } } factorValueMap.put(scalingFactor.toString(), value); }
/** * Add statistics value for a cartridge type, scaling factor * * @param cartridgeType * @param scalingFactor * @param value */
Add statistics value for a cartridge type, scaling factor
addStatistics
{ "repo_name": "ravihansa3000/stratos", "path": "components/org.apache.stratos.mock.iaas/src/main/java/org/apache/stratos/mock/iaas/statistics/MockHealthStatistics.java", "license": "apache-2.0", "size": 4576 }
[ "java.util.Map", "java.util.concurrent.ConcurrentHashMap", "org.apache.stratos.mock.iaas.services.impl.MockScalingFactor" ]
import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import org.apache.stratos.mock.iaas.services.impl.MockScalingFactor;
import java.util.*; import java.util.concurrent.*; import org.apache.stratos.mock.iaas.services.impl.*;
[ "java.util", "org.apache.stratos" ]
java.util; org.apache.stratos;
644,019
protected void writeOutputFor( OutputType outputType, HashSet alreadyChecked, IndentingWriter writer) throws IOException { String fileName = outputType.getName(); CompoundType theType = (CompoundType) outputType.getType(); // Are we doing a Stub or Tie? if (fileName.endsWith(Utility.RMI_STUB_SUFFIX)) { // Stub. writeStub(outputType,writer); } else { // Tie writeTie(outputType,writer); } }
void function( OutputType outputType, HashSet alreadyChecked, IndentingWriter writer) throws IOException { String fileName = outputType.getName(); CompoundType theType = (CompoundType) outputType.getType(); if (fileName.endsWith(Utility.RMI_STUB_SUFFIX)) { writeStub(outputType,writer); } else { writeTie(outputType,writer); } }
/** * Write the output for the given OutputFileName into the output stream. * @param name One of the items returned by getOutputTypesFor(...) * @param alreadyChecked A set of Types which have already been checked. * Intended to be passed to Type.collectMatching(filter,alreadyChecked). * @param writer The output stream. */
Write the output for the given OutputFileName into the output stream
writeOutputFor
{ "repo_name": "rokn/Count_Words_2015", "path": "testing/openjdk/corba/src/share/classes/sun/rmi/rmic/iiop/StubGenerator.java", "license": "mit", "size": 76499 }
[ "com.sun.corba.se.impl.util.Utility", "java.io.IOException", "java.util.HashSet" ]
import com.sun.corba.se.impl.util.Utility; import java.io.IOException; import java.util.HashSet;
import com.sun.corba.se.impl.util.*; import java.io.*; import java.util.*;
[ "com.sun.corba", "java.io", "java.util" ]
com.sun.corba; java.io; java.util;
658,267
void addSchedulable(AbstractSchedulable schedulable);
void addSchedulable(AbstractSchedulable schedulable);
/** * Adds a sporadic or periodic task to this scheduler. * * @param schedulable the task to add */
Adds a sporadic or periodic task to this scheduler
addSchedulable
{ "repo_name": "mcpat/microjiac-public", "path": "microjiac-base-impl/src/main/java/de/jiac/micro/agent/IScheduler.java", "license": "gpl-3.0", "size": 1966 }
[ "de.jiac.micro.core.feature.AbstractSchedulable" ]
import de.jiac.micro.core.feature.AbstractSchedulable;
import de.jiac.micro.core.feature.*;
[ "de.jiac.micro" ]
de.jiac.micro;
2,012,271
void onTimeOut(ExecutionInstance instance) throws FalconException;
void onTimeOut(ExecutionInstance instance) throws FalconException;
/** * Invoked when an instance times out waiting for gating conditions to be satisfied. * * @param instance * @throws FalconException */
Invoked when an instance times out waiting for gating conditions to be satisfied
onTimeOut
{ "repo_name": "baishuo/falcon_search", "path": "scheduler/src/main/java/org/apache/falcon/state/InstanceStateChangeHandler.java", "license": "apache-2.0", "size": 2923 }
[ "org.apache.falcon.FalconException", "org.apache.falcon.execution.ExecutionInstance" ]
import org.apache.falcon.FalconException; import org.apache.falcon.execution.ExecutionInstance;
import org.apache.falcon.*; import org.apache.falcon.execution.*;
[ "org.apache.falcon" ]
org.apache.falcon;
2,426,135
public void setSalePrice(Money salePrice);
void function(Money salePrice);
/** * Sets the the Sale Price of the Sku. The Sale Price is the standard price the vendor sells * this item for. This price will automatically be overridden if your system is utilizing * the DynamicSkuPricingService. */
Sets the the Sale Price of the Sku. The Sale Price is the standard price the vendor sells this item for. This price will automatically be overridden if your system is utilizing the DynamicSkuPricingService
setSalePrice
{ "repo_name": "cloudbearings/BroadleafCommerce", "path": "core/broadleaf-framework/src/main/java/org/broadleafcommerce/core/catalog/domain/Sku.java", "license": "apache-2.0", "size": 25143 }
[ "org.broadleafcommerce.common.money.Money" ]
import org.broadleafcommerce.common.money.Money;
import org.broadleafcommerce.common.money.*;
[ "org.broadleafcommerce.common" ]
org.broadleafcommerce.common;
667,787
public OperationStatus delete(UUID appId, String versionId) { return deleteWithServiceResponseAsync(appId, versionId).toBlocking().single().body(); }
OperationStatus function(UUID appId, String versionId) { return deleteWithServiceResponseAsync(appId, versionId).toBlocking().single().body(); }
/** * Deletes an application version. * * @param appId The application ID. * @param versionId The version ID. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the OperationStatus object if successful. */
Deletes an application version
delete
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/cognitiveservices/ms-azure-cs-luis-authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/VersionsImpl.java", "license": "mit", "size": 77709 }
[ "com.microsoft.azure.cognitiveservices.language.luis.authoring.models.OperationStatus" ]
import com.microsoft.azure.cognitiveservices.language.luis.authoring.models.OperationStatus;
import com.microsoft.azure.cognitiveservices.language.luis.authoring.models.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
31,850
public Map<String, Iterable<? extends WindupVertexFrame>> pop() { Map<String, Iterable<? extends WindupVertexFrame>> frame = deque.pop(); return frame; }
Map<String, Iterable<? extends WindupVertexFrame>> function() { Map<String, Iterable<? extends WindupVertexFrame>> frame = deque.pop(); return frame; }
/** * Remove the top {@link Variables} layer from the the stack. */
Remove the top <code>Variables</code> layer from the the stack
pop
{ "repo_name": "sgilda/windup", "path": "config/api/src/main/java/org/jboss/windup/config/Variables.java", "license": "epl-1.0", "size": 6483 }
[ "java.util.Map", "org.jboss.windup.graph.model.WindupVertexFrame" ]
import java.util.Map; import org.jboss.windup.graph.model.WindupVertexFrame;
import java.util.*; import org.jboss.windup.graph.model.*;
[ "java.util", "org.jboss.windup" ]
java.util; org.jboss.windup;
2,380,558
protected void exportOrgUnit(Element parent, CmsOrganizationalUnit orgunit) throws SAXException, CmsException { Element orgunitElement = parent.addElement(CmsImportVersion7.N_ORGUNIT); getSaxWriter().writeOpen(orgunitElement); Element name = orgunitElement.addElement(CmsImportVersion7.N_NAME).addText(orgunit.getName()); digestElement(orgunitElement, name); Element description = orgunitElement.addElement(CmsImportVersion7.N_DESCRIPTION).addCDATA( orgunit.getDescription()); digestElement(orgunitElement, description); Element flags = orgunitElement.addElement(CmsImportVersion7.N_FLAGS).addText( Integer.toString(orgunit.getFlags())); digestElement(orgunitElement, flags); Element resources = orgunitElement.addElement(CmsImportVersion7.N_RESOURCES); Iterator<CmsResource> it = OpenCms.getOrgUnitManager().getResourcesForOrganizationalUnit( getCms(), orgunit.getName()).iterator(); while (it.hasNext()) { CmsResource resource = it.next(); resources.addElement(CmsImportVersion7.N_RESOURCE).addText(resource.getRootPath()); } digestElement(orgunitElement, resources); getReport().println( org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0), I_CmsReport.FORMAT_OK); Element groupsElement = parent.addElement(CmsImportVersion7.N_GROUPS); getSaxWriter().writeOpen(groupsElement); exportGroups(groupsElement, orgunit); getSaxWriter().writeClose(groupsElement); Element usersElement = parent.addElement(CmsImportVersion7.N_USERS); getSaxWriter().writeOpen(usersElement); exportUsers(usersElement, orgunit); getSaxWriter().writeClose(usersElement); getSaxWriter().writeClose(orgunitElement); }
void function(Element parent, CmsOrganizationalUnit orgunit) throws SAXException, CmsException { Element orgunitElement = parent.addElement(CmsImportVersion7.N_ORGUNIT); getSaxWriter().writeOpen(orgunitElement); Element name = orgunitElement.addElement(CmsImportVersion7.N_NAME).addText(orgunit.getName()); digestElement(orgunitElement, name); Element description = orgunitElement.addElement(CmsImportVersion7.N_DESCRIPTION).addCDATA( orgunit.getDescription()); digestElement(orgunitElement, description); Element flags = orgunitElement.addElement(CmsImportVersion7.N_FLAGS).addText( Integer.toString(orgunit.getFlags())); digestElement(orgunitElement, flags); Element resources = orgunitElement.addElement(CmsImportVersion7.N_RESOURCES); Iterator<CmsResource> it = OpenCms.getOrgUnitManager().getResourcesForOrganizationalUnit( getCms(), orgunit.getName()).iterator(); while (it.hasNext()) { CmsResource resource = it.next(); resources.addElement(CmsImportVersion7.N_RESOURCE).addText(resource.getRootPath()); } digestElement(orgunitElement, resources); getReport().println( org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0), I_CmsReport.FORMAT_OK); Element groupsElement = parent.addElement(CmsImportVersion7.N_GROUPS); getSaxWriter().writeOpen(groupsElement); exportGroups(groupsElement, orgunit); getSaxWriter().writeClose(groupsElement); Element usersElement = parent.addElement(CmsImportVersion7.N_USERS); getSaxWriter().writeOpen(usersElement); exportUsers(usersElement, orgunit); getSaxWriter().writeClose(usersElement); getSaxWriter().writeClose(orgunitElement); }
/** * Exports one single organizational unit with all it's data.<p> * * @param parent the parent node to add the groups to * @param orgunit the group to be exported * * @throws SAXException if something goes wrong processing the manifest.xml * @throws CmsException if something goes wrong reading the data to export */
Exports one single organizational unit with all it's data
exportOrgUnit
{ "repo_name": "victos/opencms-core", "path": "src/org/opencms/importexport/CmsExport.java", "license": "lgpl-2.1", "size": 62355 }
[ "java.util.Iterator", "org.dom4j.Element", "org.opencms.file.CmsResource", "org.opencms.main.CmsException", "org.opencms.main.OpenCms", "org.opencms.security.CmsOrganizationalUnit", "org.xml.sax.SAXException" ]
import java.util.Iterator; import org.dom4j.Element; import org.opencms.file.CmsResource; import org.opencms.main.CmsException; import org.opencms.main.OpenCms; import org.opencms.security.CmsOrganizationalUnit; import org.xml.sax.SAXException;
import java.util.*; import org.dom4j.*; import org.opencms.file.*; import org.opencms.main.*; import org.opencms.security.*; import org.xml.sax.*;
[ "java.util", "org.dom4j", "org.opencms.file", "org.opencms.main", "org.opencms.security", "org.xml.sax" ]
java.util; org.dom4j; org.opencms.file; org.opencms.main; org.opencms.security; org.xml.sax;
263,138
public void searchWorkers(InputEvent event) { searchResources(event.getValue(), getSelectedCriterions()); }
void function(InputEvent event) { searchResources(event.getValue(), getSelectedCriterions()); }
/** * Get input text, and search for workers * * @param event */
Get input text, and search for workers
searchWorkers
{ "repo_name": "bolobr/IEBT-Libreplan", "path": "libreplan-webapp/src/main/java/org/libreplan/web/resources/search/NewAllocationSelectorController.java", "license": "agpl-3.0", "size": 26417 }
[ "org.zkoss.zk.ui.event.InputEvent" ]
import org.zkoss.zk.ui.event.InputEvent;
import org.zkoss.zk.ui.event.*;
[ "org.zkoss.zk" ]
org.zkoss.zk;
1,840,856
@Path("proplist") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces({MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN}) @RolesAllowed("workspace/developer") public CLIOutputResponse proplist(final PropertyListRequest request) throws ServerException, IOException { request.setProjectPath(getRealPath(request.getProjectPath())); return this.subversionApi.proplist(request); }
@Path(STR) @Consumes(MediaType.APPLICATION_JSON) @Produces({MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN}) @RolesAllowed(STR) CLIOutputResponse function(final PropertyListRequest request) throws ServerException, IOException { request.setProjectPath(getRealPath(request.getProjectPath())); return this.subversionApi.proplist(request); }
/** * Get property for specified path or target. * * @param request * the property setting request * @return the property setting response * @throws ServerException * if there is a Subversion issue * @throws IOException * if there is a problem executing the command */
Get property for specified path or target
proplist
{ "repo_name": "riuvshin/che-plugins", "path": "plugin-svn/che-plugin-svn-ext-subversion/src/main/java/org/eclipse/che/ide/ext/svn/server/rest/SubversionService.java", "license": "epl-1.0", "size": 21075 }
[ "java.io.IOException", "javax.annotation.security.RolesAllowed", "javax.ws.rs.Consumes", "javax.ws.rs.Path", "javax.ws.rs.Produces", "javax.ws.rs.core.MediaType", "org.eclipse.che.api.core.ServerException", "org.eclipse.che.ide.ext.svn.shared.CLIOutputResponse", "org.eclipse.che.ide.ext.svn.shared.PropertyListRequest" ]
import java.io.IOException; import javax.annotation.security.RolesAllowed; import javax.ws.rs.Consumes; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import org.eclipse.che.api.core.ServerException; import org.eclipse.che.ide.ext.svn.shared.CLIOutputResponse; import org.eclipse.che.ide.ext.svn.shared.PropertyListRequest;
import java.io.*; import javax.annotation.security.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.eclipse.che.api.core.*; import org.eclipse.che.ide.ext.svn.shared.*;
[ "java.io", "javax.annotation", "javax.ws", "org.eclipse.che" ]
java.io; javax.annotation; javax.ws; org.eclipse.che;
2,799,272
@javax.annotation.Nullable @ApiModelProperty( value = "`rules` describes which requests will match this flow schema. This FlowSchema matches a request if and only if at least one member of rules matches the request. if it is an empty slice, there will be no requests matching the FlowSchema.") public List<V1beta1PolicyRulesWithSubjects> getRules() { return rules; }
@javax.annotation.Nullable @ApiModelProperty( value = STR) List<V1beta1PolicyRulesWithSubjects> function() { return rules; }
/** * &#x60;rules&#x60; describes which requests will match this flow schema. This FlowSchema matches * a request if and only if at least one member of rules matches the request. if it is an empty * slice, there will be no requests matching the FlowSchema. * * @return rules */
&#x60;rules&#x60; describes which requests will match this flow schema. This FlowSchema matches a request if and only if at least one member of rules matches the request. if it is an empty slice, there will be no requests matching the FlowSchema
getRules
{ "repo_name": "kubernetes-client/java", "path": "kubernetes/src/main/java/io/kubernetes/client/openapi/models/V1beta1FlowSchemaSpec.java", "license": "apache-2.0", "size": 7313 }
[ "io.swagger.annotations.ApiModelProperty", "java.util.List" ]
import io.swagger.annotations.ApiModelProperty; import java.util.List;
import io.swagger.annotations.*; import java.util.*;
[ "io.swagger.annotations", "java.util" ]
io.swagger.annotations; java.util;
2,664,443
List<Achievement> listCategory(final int category);
List<Achievement> listCategory(final int category);
/** * List achievements by category. * * @param category The category. * @return All achievements in a category. */
List achievements by category
listCategory
{ "repo_name": "EaW1805/data", "path": "src/main/java/com/eaw1805/data/managers/beans/AchievementManagerBean.java", "license": "mit", "size": 3410 }
[ "com.eaw1805.data.model.Achievement", "java.util.List" ]
import com.eaw1805.data.model.Achievement; import java.util.List;
import com.eaw1805.data.model.*; import java.util.*;
[ "com.eaw1805.data", "java.util" ]
com.eaw1805.data; java.util;
2,270,109
public List<LRProperty> getProperties() { return properties; } protected boolean started = false;
List<LRProperty> function() { return properties; } protected boolean started = false;
/** * This method returns the properties. * @return returns a list of LRProperty */
This method returns the properties
getProperties
{ "repo_name": "Auto-ID-Lab-Japan/fosstrak-fc", "path": "fc-server/src/main/java/org/fosstrak/ale/server/readers/LogicalReader.java", "license": "lgpl-2.1", "size": 5610 }
[ "java.util.List", "org.fosstrak.ale.xsd.ale.epcglobal.LRProperty" ]
import java.util.List; import org.fosstrak.ale.xsd.ale.epcglobal.LRProperty;
import java.util.*; import org.fosstrak.ale.xsd.ale.epcglobal.*;
[ "java.util", "org.fosstrak.ale" ]
java.util; org.fosstrak.ale;
1,700,232
private FileWriteHandle initNextWriteHandle(long curIdx) throws StorageException, IgniteCheckedException { try { File nextFile = pollNextFile(curIdx); if (log.isDebugEnabled()) log.debug("Switching to a new WAL segment: " + nextFile.getAbsolutePath()); FileIO fileIO = ioFactory.create(nextFile); FileWriteHandle hnd = new FileWriteHandle( fileIO, curIdx + 1, 0, maxWalSegmentSize, serializer); hnd.writeSerializerVersion(); return hnd; } catch (IOException e) { StorageException se = new StorageException("Unable to initialize WAL segment", e); cctx.kernalContext().failure().process(new FailureContext(CRITICAL_ERROR, se)); throw se; } }
FileWriteHandle function(long curIdx) throws StorageException, IgniteCheckedException { try { File nextFile = pollNextFile(curIdx); if (log.isDebugEnabled()) log.debug(STR + nextFile.getAbsolutePath()); FileIO fileIO = ioFactory.create(nextFile); FileWriteHandle hnd = new FileWriteHandle( fileIO, curIdx + 1, 0, maxWalSegmentSize, serializer); hnd.writeSerializerVersion(); return hnd; } catch (IOException e) { StorageException se = new StorageException(STR, e); cctx.kernalContext().failure().process(new FailureContext(CRITICAL_ERROR, se)); throw se; } }
/** * Fills the file header for a new segment. * Calling this method signals we are done with the segment and it can be archived. * If we don't have prepared file yet and achiever is busy this method blocks * * @param curIdx current absolute segment released by WAL writer * @return Initialized file handle. * @throws StorageException If IO exception occurred. * @throws IgniteCheckedException If failed. */
Fills the file header for a new segment. Calling this method signals we are done with the segment and it can be archived. If we don't have prepared file yet and achiever is busy this method blocks
initNextWriteHandle
{ "repo_name": "voipp/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FsyncModeFileWriteAheadLogManager.java", "license": "apache-2.0", "size": 115824 }
[ "java.io.File", "java.io.IOException", "org.apache.ignite.IgniteCheckedException", "org.apache.ignite.failure.FailureContext", "org.apache.ignite.internal.pagemem.wal.StorageException", "org.apache.ignite.internal.processors.cache.persistence.file.FileIO" ]
import java.io.File; import java.io.IOException; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.failure.FailureContext; import org.apache.ignite.internal.pagemem.wal.StorageException; import org.apache.ignite.internal.processors.cache.persistence.file.FileIO;
import java.io.*; import org.apache.ignite.*; import org.apache.ignite.failure.*; import org.apache.ignite.internal.pagemem.wal.*; import org.apache.ignite.internal.processors.cache.persistence.file.*;
[ "java.io", "org.apache.ignite" ]
java.io; org.apache.ignite;
1,535,126
public String doRemoveAttribute( HttpServletRequest request ) throws AccessDeniedException { String strIdAttribute = request.getParameter( PARAMETER_ID_ATTRIBUTE ); if ( StringUtils.isNotBlank( strIdAttribute ) && StringUtils.isNumeric( strIdAttribute ) ) { if ( !SecurityTokenService.getInstance( ).validate( request, JSP_URL_REMOVE_ATTRIBUTE ) ) { throw new AccessDeniedException( ERROR_INVALID_TOKEN ); } int nIdAttribute = Integer.parseInt( strIdAttribute ); _attributeService.removeAttribute( nIdAttribute ); } return getAdminDashboardsUrl( request, ANCHOR_ADMIN_DASHBOARDS ); }
String function( HttpServletRequest request ) throws AccessDeniedException { String strIdAttribute = request.getParameter( PARAMETER_ID_ATTRIBUTE ); if ( StringUtils.isNotBlank( strIdAttribute ) && StringUtils.isNumeric( strIdAttribute ) ) { if ( !SecurityTokenService.getInstance( ).validate( request, JSP_URL_REMOVE_ATTRIBUTE ) ) { throw new AccessDeniedException( ERROR_INVALID_TOKEN ); } int nIdAttribute = Integer.parseInt( strIdAttribute ); _attributeService.removeAttribute( nIdAttribute ); } return getAdminDashboardsUrl( request, ANCHOR_ADMIN_DASHBOARDS ); }
/** * Remove an user attribute * * @param request * HttpServletRequest * @return The Jsp URL of the process result * @throws AccessDeniedException * if the security token is invalid */
Remove an user attribute
doRemoveAttribute
{ "repo_name": "lutece-platform/lutece-core", "path": "src/java/fr/paris/lutece/portal/web/user/attribute/AttributeJspBean.java", "license": "bsd-3-clause", "size": 16220 }
[ "fr.paris.lutece.portal.service.admin.AccessDeniedException", "fr.paris.lutece.portal.service.security.SecurityTokenService", "javax.servlet.http.HttpServletRequest", "org.apache.commons.lang3.StringUtils" ]
import fr.paris.lutece.portal.service.admin.AccessDeniedException; import fr.paris.lutece.portal.service.security.SecurityTokenService; import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang3.StringUtils;
import fr.paris.lutece.portal.service.admin.*; import fr.paris.lutece.portal.service.security.*; import javax.servlet.http.*; import org.apache.commons.lang3.*;
[ "fr.paris.lutece", "javax.servlet", "org.apache.commons" ]
fr.paris.lutece; javax.servlet; org.apache.commons;
926,553
public void addSeries(Comparable seriesKey, double[][] data) { if (seriesKey == null) { throw new IllegalArgumentException( "The 'seriesKey' cannot be null."); } if (data == null) { throw new IllegalArgumentException("The 'data' is null."); } if (data.length != 2) { throw new IllegalArgumentException( "The 'data' array must have length == 2."); } if (data[0].length != data[1].length) { throw new IllegalArgumentException( "The 'data' array must contain two arrays with equal length."); } int seriesIndex = indexOf(seriesKey); if (seriesIndex == -1) { // add a new series this.seriesKeys.add(seriesKey); this.seriesList.add(data); } else { // replace an existing series this.seriesList.remove(seriesIndex); this.seriesList.add(seriesIndex, data); } notifyListeners(new DatasetChangeEvent(this, this)); }
void function(Comparable seriesKey, double[][] data) { if (seriesKey == null) { throw new IllegalArgumentException( STR); } if (data == null) { throw new IllegalArgumentException(STR); } if (data.length != 2) { throw new IllegalArgumentException( STR); } if (data[0].length != data[1].length) { throw new IllegalArgumentException( STR); } int seriesIndex = indexOf(seriesKey); if (seriesIndex == -1) { this.seriesKeys.add(seriesKey); this.seriesList.add(data); } else { this.seriesList.remove(seriesIndex); this.seriesList.add(seriesIndex, data); } notifyListeners(new DatasetChangeEvent(this, this)); }
/** * Adds a series or if a series with the same key already exists replaces * the data for that series, then sends a {@link DatasetChangeEvent} to * all registered listeners. * * @param seriesKey the series key (<code>null</code> not permitted). * @param data the data (must be an array with length 2, containing two * arrays of equal length, the first containing the x-values and the * second containing the y-values). */
Adds a series or if a series with the same key already exists replaces the data for that series, then sends a <code>DatasetChangeEvent</code> to all registered listeners
addSeries
{ "repo_name": "apetresc/JFreeChart", "path": "src/main/java/org/jfree/data/xy/DefaultXYDataset.java", "license": "lgpl-2.1", "size": 13251 }
[ "org.jfree.data.general.DatasetChangeEvent" ]
import org.jfree.data.general.DatasetChangeEvent;
import org.jfree.data.general.*;
[ "org.jfree.data" ]
org.jfree.data;
1,317,120
public final void testGetPrivateExponent() { RSAMultiPrimePrivateCrtKeySpec ks = new RSAMultiPrimePrivateCrtKeySpec( BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, opi); assertTrue(BigInteger.ONE.equals(ks.getPrivateExponent())); } // private stuff //
final void function() { RSAMultiPrimePrivateCrtKeySpec ks = new RSAMultiPrimePrivateCrtKeySpec( BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, opi); assertTrue(BigInteger.ONE.equals(ks.getPrivateExponent())); }
/** * Test for <code>getPrivateExponent()</code> method<br> * Assertion: returns private exponent */
Test for <code>getPrivateExponent()</code> method Assertion: returns private exponent
testGetPrivateExponent
{ "repo_name": "s20121035/rk3288_android5.1_repo", "path": "external/apache-harmony/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/RSAMultiPrimePrivateCrtKeySpecTest.java", "license": "gpl-3.0", "size": 23420 }
[ "java.math.BigInteger", "java.security.spec.RSAMultiPrimePrivateCrtKeySpec" ]
import java.math.BigInteger; import java.security.spec.RSAMultiPrimePrivateCrtKeySpec;
import java.math.*; import java.security.spec.*;
[ "java.math", "java.security" ]
java.math; java.security;
2,670,782
long getPosition() throws IOException;
long getPosition() throws IOException;
/** * Returns the number of bytes from the beginning of the file to the current position. * * @return the number of bytes from the beginning of the file to the current position. * @throws IOException if an I/O error occurs. */
Returns the number of bytes from the beginning of the file to the current position
getPosition
{ "repo_name": "blerer/horizondb-io", "path": "src/main/java/io/horizondb/io/files/FileDataInput.java", "license": "apache-2.0", "size": 1591 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
566,998
void pushPromise(int streamId, int promisedStreamId, List<Header> requestHeaders) throws IOException; /** * HTTP/2 only. Expresses that resources for the connection or a client- initiated stream are * available from a different network location or protocol configuration. * * <p>See <a href="http://tools.ietf.org/html/draft-ietf-httpbis-alt-svc-01">alt-svc</a> * * @param streamId when a client-initiated stream ID (odd number), the origin of this alternate * service is the origin of the stream. When zero, the origin is specified in the {@code origin}
void pushPromise(int streamId, int promisedStreamId, List<Header> requestHeaders) throws IOException; /** * HTTP/2 only. Expresses that resources for the connection or a client- initiated stream are * available from a different network location or protocol configuration. * * <p>See <a href="http: * * @param streamId when a client-initiated stream ID (odd number), the origin of this alternate * service is the origin of the stream. When zero, the origin is specified in the {@code origin}
/** * HTTP/2 only. Receive a push promise header block. <p> A push promise contains all the headers * that pertain to a server-initiated request, and a {@code promisedStreamId} to which response * frames will be delivered. Push promise frames are sent as a part of the response to {@code * streamId}. * * @param streamId client-initiated stream ID. Must be an odd number. * @param promisedStreamId server-initiated stream ID. Must be an even number. * @param requestHeaders minimally includes {@code :method}, {@code :scheme}, {@code * :authority}, and (@code :path}. */
HTTP/2 only. Receive a push promise header block. A push promise contains all the headers that pertain to a server-initiated request, and a promisedStreamId to which response frames will be delivered. Push promise frames are sent as a part of the response to streamId
pushPromise
{ "repo_name": "WeiDianzhao1989/AndroidAppLib", "path": "network/src/main/java/com/koudai/net/kernal/internal/framed/FrameReader.java", "license": "apache-2.0", "size": 5727 }
[ "java.io.IOException", "java.util.List" ]
import java.io.IOException; import java.util.List;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
959,156
void setText(String value);
void setText(String value);
/** * Sets the value of the '{@link org.xtext.example.delphi.astm.Comment#getText <em>Text</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Text</em>' attribute. * @see #getText() * @generated */
Sets the value of the '<code>org.xtext.example.delphi.astm.Comment#getText Text</code>' attribute.
setText
{ "repo_name": "adolfosbh/cs2as", "path": "org.xtext.example.delphi/emf-gen/org/xtext/example/delphi/astm/Comment.java", "license": "epl-1.0", "size": 1458 }
[ "java.lang.String" ]
import java.lang.String;
import java.lang.*;
[ "java.lang" ]
java.lang;
1,209,070
public boolean isItemChecked( int position ) { if ( mChoiceMode != ListView.CHOICE_MODE_NONE && mCheckStates != null ) { return mCheckStates.get( position, false ); } return false; }
boolean function( int position ) { if ( mChoiceMode != ListView.CHOICE_MODE_NONE && mCheckStates != null ) { return mCheckStates.get( position, false ); } return false; }
/** * Returns the checked state of the specified position. The result is only valid if the choice mode has been set to * {@link #CHOICE_MODE_SINGLE} or {@link #CHOICE_MODE_MULTIPLE}. * * @param position * The item whose checked state to return * @return The item's checked state or <code>false</code> if choice mode is invalid * * @see #setChoiceMode(int) */
Returns the checked state of the specified position. The result is only valid if the choice mode has been set to <code>#CHOICE_MODE_SINGLE</code> or <code>#CHOICE_MODE_MULTIPLE</code>
isItemChecked
{ "repo_name": "BaneP/CustomViews", "path": "HorizontalListViewLibrary/src/it/sephiroth/android/library/widget/AbsHListView.java", "license": "apache-2.0", "size": 178847 }
[ "android.widget.ListView" ]
import android.widget.ListView;
import android.widget.*;
[ "android.widget" ]
android.widget;
492,310
public static void clearProperties(JmsMessageFacade message, boolean excludeStandardJMSHeaders) throws JMSException { for (Entry<String, PropertyIntercepter> entry : PROPERTY_INTERCEPTERS.entrySet()) { if (excludeStandardJMSHeaders && STANDARD_HEADERS.contains(entry.getKey())) { continue; } entry.getValue().clearProperty(message); } message.clearProperties(); }
static void function(JmsMessageFacade message, boolean excludeStandardJMSHeaders) throws JMSException { for (Entry<String, PropertyIntercepter> entry : PROPERTY_INTERCEPTERS.entrySet()) { if (excludeStandardJMSHeaders && STANDARD_HEADERS.contains(entry.getKey())) { continue; } entry.getValue().clearProperty(message); } message.clearProperties(); }
/** * For each of the currently configured message property intercepter instances clear or * reset the value to its default. Once complete the method will direct the given provider * message facade to clear any message properties that might have been set. * * @param message * the JmsMessageFacade instance to read from * @param excludeStandardJMSHeaders * whether the standard JMS header names should be excluded from the returned set * * @throws JMSException if an error occurs while validating the defined property. */
For each of the currently configured message property intercepter instances clear or reset the value to its default. Once complete the method will direct the given provider message facade to clear any message properties that might have been set
clearProperties
{ "repo_name": "avranju/qpid-jms", "path": "qpid-jms-client/src/main/java/org/apache/qpid/jms/message/JmsMessagePropertyIntercepter.java", "license": "apache-2.0", "size": 26799 }
[ "java.util.Map", "javax.jms.JMSException", "org.apache.qpid.jms.message.facade.JmsMessageFacade" ]
import java.util.Map; import javax.jms.JMSException; import org.apache.qpid.jms.message.facade.JmsMessageFacade;
import java.util.*; import javax.jms.*; import org.apache.qpid.jms.message.facade.*;
[ "java.util", "javax.jms", "org.apache.qpid" ]
java.util; javax.jms; org.apache.qpid;
886,063
public static QDataSet accum( QDataSet accumDs, QDataSet ds ) { if (ds.rank() > 1) { throw new IllegalArgumentException("only rank 1"); } double accum=0; QDataSet accumDep0Ds; double accumDep0=0; QDataSet dep0ds= (QDataSet) ds.property(QDataSet.DEPEND_0); Units units; if ( accumDs==null ) { accumDep0= dep0ds!=null ? dep0ds.value(0) : 0; units= Units.dimensionless; } else if ( accumDs.rank()==0 ) { accum= accumDs.value(); accumDep0Ds= (QDataSet) accumDs.property( QDataSet.CONTEXT_0 ); if ( accumDep0Ds!=null ) accumDep0= accumDep0Ds.value(); else accumDep0=0; units= SemanticOps.getUnits(accumDs); } else if ( accumDs.rank()==1 ) { accum= accumDs.value(accumDs.length()-1); accumDep0Ds= (QDataSet) accumDs.property( QDataSet.DEPEND_0 ); if ( accumDep0Ds!=null ) accumDep0= accumDep0Ds.value(accumDs.length()); else accumDep0=0; units= SemanticOps.getUnits(accumDs); } else { throw new IllegalArgumentException("accumDs must be rank 0 or rank 1"); } WritableDataSet result= zeros( ds ); result.putProperty( QDataSet.UNITS, units ); DDataSet dep0= null; if ( dep0ds!=null ) { dep0= DDataSet.createRank1( ds.length() ); DataSetUtil.putProperties( DataSetUtil.getProperties(dep0ds), dep0 ); } for ( int i=0; i<result.length(); i++ ) { accum+= ds.value(i); result.putValue(i,accum); if ( dep0ds!=null ) { assert dep0!=null; dep0.putValue(i, ( accumDep0 + dep0ds.value(i)) / 2 ); accumDep0= dep0ds.value(i); } } return result; }
static QDataSet function( QDataSet accumDs, QDataSet ds ) { if (ds.rank() > 1) { throw new IllegalArgumentException(STR); } double accum=0; QDataSet accumDep0Ds; double accumDep0=0; QDataSet dep0ds= (QDataSet) ds.property(QDataSet.DEPEND_0); Units units; if ( accumDs==null ) { accumDep0= dep0ds!=null ? dep0ds.value(0) : 0; units= Units.dimensionless; } else if ( accumDs.rank()==0 ) { accum= accumDs.value(); accumDep0Ds= (QDataSet) accumDs.property( QDataSet.CONTEXT_0 ); if ( accumDep0Ds!=null ) accumDep0= accumDep0Ds.value(); else accumDep0=0; units= SemanticOps.getUnits(accumDs); } else if ( accumDs.rank()==1 ) { accum= accumDs.value(accumDs.length()-1); accumDep0Ds= (QDataSet) accumDs.property( QDataSet.DEPEND_0 ); if ( accumDep0Ds!=null ) accumDep0= accumDep0Ds.value(accumDs.length()); else accumDep0=0; units= SemanticOps.getUnits(accumDs); } else { throw new IllegalArgumentException(STR); } WritableDataSet result= zeros( ds ); result.putProperty( QDataSet.UNITS, units ); DDataSet dep0= null; if ( dep0ds!=null ) { dep0= DDataSet.createRank1( ds.length() ); DataSetUtil.putProperties( DataSetUtil.getProperties(dep0ds), dep0 ); } for ( int i=0; i<result.length(); i++ ) { accum+= ds.value(i); result.putValue(i,accum); if ( dep0ds!=null ) { assert dep0!=null; dep0.putValue(i, ( accumDep0 + dep0ds.value(i)) / 2 ); accumDep0= dep0ds.value(i); } } return result; }
/** * return an array that is the running sum of each element in the array, * starting with the value accum. * Result[i]= accum + total( ds[0:i+1] ) * @param accumDs the initial value of the running sum. Last value of Rank 0 or Rank 1 dataset is used, or may be null. * @param ds each element is added to the running sum * @return the running of each element in the array. * @see #diff(org.das2.qds.QDataSet) */
return an array that is the running sum of each element in the array, starting with the value accum. Result[i]= accum + total( ds[0:i+1] )
accum
{ "repo_name": "autoplot/app", "path": "QDataSet/src/org/das2/qds/ops/Ops.java", "license": "gpl-2.0", "size": 492716 }
[ "org.das2.datum.Units", "org.das2.qds.DDataSet", "org.das2.qds.DataSetUtil", "org.das2.qds.QDataSet", "org.das2.qds.SemanticOps", "org.das2.qds.WritableDataSet" ]
import org.das2.datum.Units; import org.das2.qds.DDataSet; import org.das2.qds.DataSetUtil; import org.das2.qds.QDataSet; import org.das2.qds.SemanticOps; import org.das2.qds.WritableDataSet;
import org.das2.datum.*; import org.das2.qds.*;
[ "org.das2.datum", "org.das2.qds" ]
org.das2.datum; org.das2.qds;
525,058
public List<Term> getSubterm(){ return item.getSubterm(); }
List<Term> function(){ return item.getSubterm(); }
/** * Return the encapsulate Low Level API object. */
Return the encapsulate Low Level API object
getSubterm
{ "repo_name": "lhillah/pnmlframework", "path": "pnmlFw-HLPN/src/fr/lip6/move/pnml/hlpn/strings/hlapi/GreaterThanOrEqualHLAPI.java", "license": "epl-1.0", "size": 108757 }
[ "fr.lip6.move.pnml.hlpn.terms.Term", "java.util.List" ]
import fr.lip6.move.pnml.hlpn.terms.Term; import java.util.List;
import fr.lip6.move.pnml.hlpn.terms.*; import java.util.*;
[ "fr.lip6.move", "java.util" ]
fr.lip6.move; java.util;
1,882,569
@ManagedAttribute(description = "The maximum file size for the file store in bytes") public void setMaxFileStoreSize(long maxFileStoreSize) { this.maxFileStoreSize = maxFileStoreSize; }
@ManagedAttribute(description = STR) void function(long maxFileStoreSize) { this.maxFileStoreSize = maxFileStoreSize; }
/** * Sets the maximum file size for the file store in bytes. * <p/> * The default is 1mb. */
Sets the maximum file size for the file store in bytes. The default is 1mb
setMaxFileStoreSize
{ "repo_name": "adessaigne/camel", "path": "core/camel-base/src/main/java/org/apache/camel/impl/engine/FileStateRepository.java", "license": "apache-2.0", "size": 10662 }
[ "org.apache.camel.api.management.ManagedAttribute" ]
import org.apache.camel.api.management.ManagedAttribute;
import org.apache.camel.api.management.*;
[ "org.apache.camel" ]
org.apache.camel;
1,843,594
public Document parse() throws IOException;
Document function() throws IOException;
/** * Parse the body of the response as a Document. * @return a parsed Document * @throws IOException on error */
Parse the body of the response as a Document
parse
{ "repo_name": "tiancj/MV", "path": "src/org/jsoup/Connection.java", "license": "gpl-2.0", "size": 17173 }
[ "java.io.IOException", "org.jsoup.nodes.Document" ]
import java.io.IOException; import org.jsoup.nodes.Document;
import java.io.*; import org.jsoup.nodes.*;
[ "java.io", "org.jsoup.nodes" ]
java.io; org.jsoup.nodes;
2,452,100
public List<Result<Blob>> updates() { return updateResult; }
List<Result<Blob>> function() { return updateResult; }
/** * Returns the results for the update operations using the request order. */
Returns the results for the update operations using the request order
updates
{ "repo_name": "aozarov/gcloud-java", "path": "gcloud-java-storage/src/main/java/com/google/cloud/storage/BatchResponse.java", "license": "apache-2.0", "size": 4301 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,397,906
protected synchronized void markDeadForever(Map<String, Object> options) { this.best = null; setDeadForever(options); }
synchronized void function(Map<String, Object> options) { this.best = null; setDeadForever(options); }
/** * This method should be called when a known node is declared dead - this is * ONLY called when a new epoch of that node is detected. Note that this method * is silent - no checks are done. Caveat emptor. * * @param address The now-dead address */
This method should be called when a known node is declared dead - this is ONLY called when a new epoch of that node is detected. Note that this method is silent - no checks are done. Caveat emptor
markDeadForever
{ "repo_name": "barnyard/pi", "path": "freepastry/src/org/mpisws/p2p/transport/sourceroute/manager/SourceRouteManagerImpl.java", "license": "apache-2.0", "size": 43670 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,619,966
@Test public void testSetAdaptedNumberProperty() { testNativeJsonObject.setNumberProperty("testAdaptedNumberProperty", 3.14); assertEquals(new TestJsonNumberPropertyAdapter().fromJsonProperty(3.14), testNativeJsonObject.testAdaptedNumberProperty); assertTrue("testNativeJsonObject.hasProperty(\"testAdaptedNumberProperty\") != true", testNativeJsonObject.hasProperty("testAdaptedNumberProperty")); }
void function() { testNativeJsonObject.setNumberProperty(STR, 3.14); assertEquals(new TestJsonNumberPropertyAdapter().fromJsonProperty(3.14), testNativeJsonObject.testAdaptedNumberProperty); assertTrue(STRtestAdaptedNumberProperty\STR, testNativeJsonObject.hasProperty(STR)); }
/** * Test the setting of the value of an adapted number property. * <p> * This test asserts that the native JSON object correctly sets the value of * an adapted number property. */
Test the setting of the value of an adapted number property. This test asserts that the native JSON object correctly sets the value of an adapted number property
testSetAdaptedNumberProperty
{ "repo_name": "kjots/json-toolkit", "path": "json-object.native/src/test/java/org/kjots/json/object/ntive/NativeJsonObjectNumberTest.java", "license": "apache-2.0", "size": 6638 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
2,914,665
private void traverseFileNames(String fixed, Pattern pattern, boolean forward) { currentCount = 0; estimatedTotalCount = 1000; final ArrayList selectedFileNames = new ArrayList(); Exchange ex = null; StringBuilder sb = new StringBuilder(); try { ex = persistit.getExchange("ffdemo", "filenames", true); ex.clear().append(forward ? "L2R" : "R2L"); // // Construct a KeyFilter that accepts all keys within the // designated subtree. // KeyFilter filter = new KeyFilter(ex.getKey()); if (fixed.length() != 0) { String end = fixed.substring(0, fixed.length() - 1) + new Character((char) (fixed.charAt(fixed.length() - 1) + 1)); // // append a Term that selects only the range accepted by the // fixed portion of the name. // filter = filter.append(KeyFilter.rangeTerm(fixed, end)); } while (ex.next(filter)) { String fileName = ex.getKey().indexTo(1).decodeString(); if (!forward) { sb.setLength(0); sb.append(fileName); fileName = sb.reverse().toString(); } // // Apply the Regex pattern, and if the name matches, // add it to the list model. // if (pattern.matcher(fileName).matches()) { selectedFileNames.add(fileName); currentCount++; if (currentCount + 200 > estimatedTotalCount) { estimatedTotalCount += 500; } if (currentCount % 100 == 0) { adjustProgressBar(currentCount, estimatedTotalCount); } } } estimatedTotalCount = currentCount; adjustProgressBar(currentCount, currentCount); setEnabled(searchField, true);
void function(String fixed, Pattern pattern, boolean forward) { currentCount = 0; estimatedTotalCount = 1000; final ArrayList selectedFileNames = new ArrayList(); Exchange ex = null; StringBuilder sb = new StringBuilder(); try { ex = persistit.getExchange(STR, STR, true); ex.clear().append(forward ? "L2R" : "R2L"); if (fixed.length() != 0) { String end = fixed.substring(0, fixed.length() - 1) + new Character((char) (fixed.charAt(fixed.length() - 1) + 1)); } while (ex.next(filter)) { String fileName = ex.getKey().indexTo(1).decodeString(); if (!forward) { sb.setLength(0); sb.append(fileName); fileName = sb.reverse().toString(); } selectedFileNames.add(fileName); currentCount++; if (currentCount + 200 > estimatedTotalCount) { estimatedTotalCount += 500; } if (currentCount % 100 == 0) { adjustProgressBar(currentCount, estimatedTotalCount); } } } estimatedTotalCount = currentCount; adjustProgressBar(currentCount, currentCount); setEnabled(searchField, true);
/** * Populate the DefaultListModel with file names that match the specified * pattern and update a progress bar while searching. * * @param fixed * @param pattern * @param forward */
Populate the DefaultListModel with file names that match the specified pattern and update a progress bar while searching
traverseFileNames
{ "repo_name": "jaytaylor/persistit", "path": "examples/FindFile/FindFile.java", "license": "epl-1.0", "size": 20586 }
[ "com.persistit.Exchange", "java.util.ArrayList", "java.util.regex.Pattern" ]
import com.persistit.Exchange; import java.util.ArrayList; import java.util.regex.Pattern;
import com.persistit.*; import java.util.*; import java.util.regex.*;
[ "com.persistit", "java.util" ]
com.persistit; java.util;
1,053,377
private void processImplements(RoundEnvironment roundEnv) { for (Element elem : roundEnv.getElementsAnnotatedWith(Implements.class)) { if (elem.getKind() == ElementKind.CLASS || elem.getKind() == ElementKind.INTERFACE) { AnnotationHandle implementsAnnotation = AnnotationHandle.of(elem, Implements.class); this.mixins.registerSoftImplements((TypeElement)elem, implementsAnnotation); } else { this.mixins.printMessage(MessageType.SOFT_IMPLEMENTS_ON_INVALID_TYPE, "Found an @Implements annotation on an element which is not a class or interface", elem); } } }
void function(RoundEnvironment roundEnv) { for (Element elem : roundEnv.getElementsAnnotatedWith(Implements.class)) { if (elem.getKind() == ElementKind.CLASS elem.getKind() == ElementKind.INTERFACE) { AnnotationHandle implementsAnnotation = AnnotationHandle.of(elem, Implements.class); this.mixins.registerSoftImplements((TypeElement)elem, implementsAnnotation); } else { this.mixins.printMessage(MessageType.SOFT_IMPLEMENTS_ON_INVALID_TYPE, STR, elem); } } }
/** * Searches for {@link Implements} annotations and registers them with their * parent mixins */
Searches for <code>Implements</code> annotations and registers them with their parent mixins
processImplements
{ "repo_name": "SpongePowered/Mixin", "path": "src/ap/java/org/spongepowered/tools/obfuscation/MixinObfuscationProcessorTargets.java", "license": "mit", "size": 8218 }
[ "javax.annotation.processing.RoundEnvironment", "javax.lang.model.element.Element", "javax.lang.model.element.ElementKind", "javax.lang.model.element.TypeElement", "org.spongepowered.asm.mixin.Implements", "org.spongepowered.tools.obfuscation.interfaces.IMessagerEx", "org.spongepowered.tools.obfuscation.mirror.AnnotationHandle" ]
import javax.annotation.processing.RoundEnvironment; import javax.lang.model.element.Element; import javax.lang.model.element.ElementKind; import javax.lang.model.element.TypeElement; import org.spongepowered.asm.mixin.Implements; import org.spongepowered.tools.obfuscation.interfaces.IMessagerEx; import org.spongepowered.tools.obfuscation.mirror.AnnotationHandle;
import javax.annotation.processing.*; import javax.lang.model.element.*; import org.spongepowered.asm.mixin.*; import org.spongepowered.tools.obfuscation.interfaces.*; import org.spongepowered.tools.obfuscation.mirror.*;
[ "javax.annotation", "javax.lang", "org.spongepowered.asm", "org.spongepowered.tools" ]
javax.annotation; javax.lang; org.spongepowered.asm; org.spongepowered.tools;
1,406,072
private void addAttachment(final Multipart multipart, final String filePath) throws MessagingException { MimeBodyPart attachPart = new MimeBodyPart(); DataSource source = new FileDataSource(filePath); attachPart.setDataHandler(new DataHandler(source)); attachPart.setFileName(new File(filePath).getName()); multipart.addBodyPart(attachPart); }
void function(final Multipart multipart, final String filePath) throws MessagingException { MimeBodyPart attachPart = new MimeBodyPart(); DataSource source = new FileDataSource(filePath); attachPart.setDataHandler(new DataHandler(source)); attachPart.setFileName(new File(filePath).getName()); multipart.addBodyPart(attachPart); }
/** * Adds a file as an attachment to the email's content * * @param multipart * @param filePath * @throws MessagingException */
Adds a file as an attachment to the email's content
addAttachment
{ "repo_name": "nengxu/OrientDB", "path": "server/src/main/java/com/orientechnologies/orient/server/plugin/mail/OMailPlugin.java", "license": "apache-2.0", "size": 6897 }
[ "java.io.File", "javax.activation.DataHandler", "javax.activation.DataSource", "javax.activation.FileDataSource", "javax.mail.MessagingException", "javax.mail.Multipart", "javax.mail.internet.MimeBodyPart" ]
import java.io.File; import javax.activation.DataHandler; import javax.activation.DataSource; import javax.activation.FileDataSource; import javax.mail.MessagingException; import javax.mail.Multipart; import javax.mail.internet.MimeBodyPart;
import java.io.*; import javax.activation.*; import javax.mail.*; import javax.mail.internet.*;
[ "java.io", "javax.activation", "javax.mail" ]
java.io; javax.activation; javax.mail;
2,651,441
public Index useIndex(String filename) throws xBaseJException, IOException { int i; Index NDXes; for (i = 1; i <= jNDXes.size(); i++) { NDXes = (Index) jNDXes.elementAt(i - 1); if (NDXes.getName().compareTo(filename) == 0) { jNDX = NDXes; return jNDX; } } if (readonly) jNDX = new NDX(filename, this, 'r'); else jNDX = new NDX(filename, this, ' '); jNDXes.addElement(jNDX); return jNDX; }
Index function(String filename) throws xBaseJException, IOException { int i; Index NDXes; for (i = 1; i <= jNDXes.size(); i++) { NDXes = (Index) jNDXes.elementAt(i - 1); if (NDXes.getName().compareTo(filename) == 0) { jNDX = NDXes; return jNDX; } } if (readonly) jNDX = new NDX(filename, this, 'r'); else jNDX = new NDX(filename, this, ' '); jNDXes.addElement(jNDX); return jNDX; }
/** * opens an Index file associated with the database. This index becomes the * primary index used in subsequent find methods. * * @param filename * an existing ndx file(can be full or partial pathname) or mdx * tag * @throws xBaseJException * org.xBaseJ Fields defined in index do not match fields in * database * @throws IOException * Java error caused by called methods */
opens an Index file associated with the database. This index becomes the primary index used in subsequent find methods
useIndex
{ "repo_name": "datacleaner/metamodel_extras", "path": "dbase/src/main/java/org/xBaseJ/DBF.java", "license": "lgpl-3.0", "size": 73588 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,218,906
public void setInvoiceLine(MInvoiceLine iLine, int M_Locator_ID, BigDecimal Qty) { setC_OrderLine_ID(iLine.getC_OrderLine_ID()); setLine(iLine.getLine()); setC_UOM_ID(iLine.getC_UOM_ID()); int M_Product_ID = iLine.getM_Product_ID(); if (M_Product_ID == 0) { set_ValueNoCheck("M_Product_ID", null); set_ValueNoCheck("M_Locator_ID", null); set_ValueNoCheck("M_AttributeSetInstance_ID", null); } else { setM_Product_ID(M_Product_ID); setM_AttributeSetInstance_ID(iLine.getM_AttributeSetInstance_ID()); if (M_Locator_ID == 0) setM_Locator_ID(Qty); // requires warehouse, product, asi else setM_Locator_ID(M_Locator_ID); } setC_Charge_ID(iLine.getC_Charge_ID()); setDescription(iLine.getDescription()); setIsDescription(iLine.isDescription()); // setC_Project_ID(iLine.getC_Project_ID()); setC_ProjectPhase_ID(iLine.getC_ProjectPhase_ID()); setC_ProjectTask_ID(iLine.getC_ProjectTask_ID()); setC_Activity_ID(iLine.getC_Activity_ID()); setC_Campaign_ID(iLine.getC_Campaign_ID()); setAD_OrgTrx_ID(iLine.getAD_OrgTrx_ID()); setUser1_ID(iLine.getUser1_ID()); setUser2_ID(iLine.getUser2_ID()); } // setInvoiceLine
void function(MInvoiceLine iLine, int M_Locator_ID, BigDecimal Qty) { setC_OrderLine_ID(iLine.getC_OrderLine_ID()); setLine(iLine.getLine()); setC_UOM_ID(iLine.getC_UOM_ID()); int M_Product_ID = iLine.getM_Product_ID(); if (M_Product_ID == 0) { set_ValueNoCheck(STR, null); set_ValueNoCheck(STR, null); set_ValueNoCheck(STR, null); } else { setM_Product_ID(M_Product_ID); setM_AttributeSetInstance_ID(iLine.getM_AttributeSetInstance_ID()); if (M_Locator_ID == 0) setM_Locator_ID(Qty); else setM_Locator_ID(M_Locator_ID); } setC_Charge_ID(iLine.getC_Charge_ID()); setDescription(iLine.getDescription()); setIsDescription(iLine.isDescription()); setC_ProjectPhase_ID(iLine.getC_ProjectPhase_ID()); setC_ProjectTask_ID(iLine.getC_ProjectTask_ID()); setC_Activity_ID(iLine.getC_Activity_ID()); setC_Campaign_ID(iLine.getC_Campaign_ID()); setAD_OrgTrx_ID(iLine.getAD_OrgTrx_ID()); setUser1_ID(iLine.getUser1_ID()); setUser2_ID(iLine.getUser2_ID()); }
/** * Set Invoice Line. * Does not set Quantity! * * @param iLine invoice line * @param M_Locator_ID locator * @param Qty qty only fo find suitable locator */
Set Invoice Line. Does not set Quantity
setInvoiceLine
{ "repo_name": "klst-com/metasfresh", "path": "de.metas.business/src/main/java-legacy/org/compiere/model/MInOutLine.java", "license": "gpl-2.0", "size": 19931 }
[ "java.math.BigDecimal" ]
import java.math.BigDecimal;
import java.math.*;
[ "java.math" ]
java.math;
283,926
public Range getWidthRange() { return this.widthRange; }
Range function() { return this.widthRange; }
/** * Returns the width range. * * @return The range (possibly <code>null</code>). */
Returns the width range
getWidthRange
{ "repo_name": "fluidware/Eastwood-Charts", "path": "source/org/jfree/chart/block/RectangleConstraint.java", "license": "lgpl-2.1", "size": 12177 }
[ "org.jfree.data.Range" ]
import org.jfree.data.Range;
import org.jfree.data.*;
[ "org.jfree.data" ]
org.jfree.data;
1,455,541
protected void removeCellOverlayComponent(mxICellOverlay overlay, Object cell) { if (overlay instanceof Component) { Component comp = (Component) overlay; if (comp.getParent() != null) { comp.setVisible(false); comp.getParent().remove(comp); eventSource.fireEvent(new mxEventObject(mxEvent.REMOVE_OVERLAY, "cell", cell, "overlay", overlay)); } } }
void function(mxICellOverlay overlay, Object cell) { if (overlay instanceof Component) { Component comp = (Component) overlay; if (comp.getParent() != null) { comp.setVisible(false); comp.getParent().remove(comp); eventSource.fireEvent(new mxEventObject(mxEvent.REMOVE_OVERLAY, "cell", cell, STR, overlay)); } } }
/** * Notified when an overlay has been removed from the graph. This * implementation removes the given overlay from its parent if it is a * component inside a component hierarchy. */
Notified when an overlay has been removed from the graph. This implementation removes the given overlay from its parent if it is a component inside a component hierarchy
removeCellOverlayComponent
{ "repo_name": "alect/Puzzledice", "path": "Tools/PuzzleMapEditor/src/com/mxgraph/swing/mxGraphComponent.java", "license": "mit", "size": 101883 }
[ "com.mxgraph.util.mxEventObject", "java.awt.Component" ]
import com.mxgraph.util.mxEventObject; import java.awt.Component;
import com.mxgraph.util.*; import java.awt.*;
[ "com.mxgraph.util", "java.awt" ]
com.mxgraph.util; java.awt;
2,799,783
private void loadGA(Command c, CliParams p, ProcessingContext ctx) throws IOException { GaQuery gq; try { gq = new GaQuery(); } catch (MalformedURLException e) { throw new IllegalArgumentException(e.getMessage()); } String configFile = c.getParamMandatory("configFile"); String usr = c.getParam("username"); String psw = c.getParam("password"); String token = c.getParam("token"); String id = c.getParamMandatory("profileId"); File conf = FileUtil.getFile(configFile); initSchema(conf.getAbsolutePath()); gq.setIds(id); if (token != null && token.length() > 0) { setGoogleAnalyticsToken(token); } else if (usr != null && usr.length() > 0 && psw != null && psw.length() > 0) { setGoogleAnalyticsUsername(usr); setGoogleAnalyticsPassword(psw); } else { throw new InvalidCommandException("The UseGoogleAnalytics command requires either GA token or " + "username and password!"); } setGoogleAnalyticsQuery(gq); gq.setDimensions(c.getParamMandatory("dimensions").replace("|", ",")); gq.setMetrics(c.getParamMandatory("metrics").replace("|", ",")); gq.setStartDate(c.getParamMandatory("startDate")); gq.setEndDate(c.getParamMandatory("endDate")); if (c.checkParam("filters")) gq.setFilters(c.getParam("filters")); c.paramsProcessed(); // sets the current connector ctx.setConnector(this); setProjectId(ctx); l.info("Google Analytics Connector successfully loaded (id: " + id + ")."); }
void function(Command c, CliParams p, ProcessingContext ctx) throws IOException { GaQuery gq; try { gq = new GaQuery(); } catch (MalformedURLException e) { throw new IllegalArgumentException(e.getMessage()); } String configFile = c.getParamMandatory(STR); String usr = c.getParam(STR); String psw = c.getParam(STR); String token = c.getParam("token"); String id = c.getParamMandatory(STR); File conf = FileUtil.getFile(configFile); initSchema(conf.getAbsolutePath()); gq.setIds(id); if (token != null && token.length() > 0) { setGoogleAnalyticsToken(token); } else if (usr != null && usr.length() > 0 && psw != null && psw.length() > 0) { setGoogleAnalyticsUsername(usr); setGoogleAnalyticsPassword(psw); } else { throw new InvalidCommandException(STR + STR); } setGoogleAnalyticsQuery(gq); gq.setDimensions(c.getParamMandatory(STR).replace(" ", ",")); gq.setMetrics(c.getParamMandatory(STR).replace(" ", ",")); gq.setStartDate(c.getParamMandatory(STR)); gq.setEndDate(c.getParamMandatory(STR)); if (c.checkParam(STR)) gq.setFilters(c.getParam(STR)); c.paramsProcessed(); ctx.setConnector(this); setProjectId(ctx); l.info(STR + id + ")."); }
/** * Loads new GA data command processor * * @param c command * @param p command line arguments * @param ctx current processing context * @throws IOException in case of IO issues */
Loads new GA data command processor
loadGA
{ "repo_name": "gooddata/GoodData-CL", "path": "connector/src/main/java/com/gooddata/connector/GaConnector.java", "license": "bsd-3-clause", "size": 13920 }
[ "com.gooddata.exception.InvalidCommandException", "com.gooddata.google.analytics.GaQuery", "com.gooddata.processor.CliParams", "com.gooddata.processor.Command", "com.gooddata.processor.ProcessingContext", "com.gooddata.util.FileUtil", "java.io.File", "java.io.IOException", "java.net.MalformedURLException" ]
import com.gooddata.exception.InvalidCommandException; import com.gooddata.google.analytics.GaQuery; import com.gooddata.processor.CliParams; import com.gooddata.processor.Command; import com.gooddata.processor.ProcessingContext; import com.gooddata.util.FileUtil; import java.io.File; import java.io.IOException; import java.net.MalformedURLException;
import com.gooddata.exception.*; import com.gooddata.google.analytics.*; import com.gooddata.processor.*; import com.gooddata.util.*; import java.io.*; import java.net.*;
[ "com.gooddata.exception", "com.gooddata.google", "com.gooddata.processor", "com.gooddata.util", "java.io", "java.net" ]
com.gooddata.exception; com.gooddata.google; com.gooddata.processor; com.gooddata.util; java.io; java.net;
825,944
public synchronized void openDriver(SurfaceHolder holder) throws IOException { Camera theCamera = camera; if (theCamera == null) { theCamera = new OpenCameraManager().build().open(); if (theCamera == null) { throw new IOException(); } camera = theCamera; } theCamera.setPreviewDisplay(holder); if (!initialized) { initialized = true; configManager.initFromCameraParameters(theCamera); if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) { if (requestedFramingRectLeftOffset > 0 && requestedFramingRectTopOffset > 0) { setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight, requestedFramingRectLeftOffset, requestedFramingRectTopOffset); } else { setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight); } requestedFramingRectWidth = 0; requestedFramingRectHeight = 0; requestedFramingRectLeftOffset = 0; requestedFramingRectTopOffset = 0; } } Camera.Parameters parameters = theCamera.getParameters(); String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save these, temporarily try { configManager.setDesiredCameraParameters(theCamera, false); } catch (RuntimeException re) { // Driver failed Log.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters"); Log.i(TAG, "Resetting to saved camera params: " + parametersFlattened); // Reset: if (parametersFlattened != null) { parameters = theCamera.getParameters(); parameters.unflatten(parametersFlattened); try { theCamera.setParameters(parameters); configManager.setDesiredCameraParameters(theCamera, true); } catch (RuntimeException re2) { // Well, darn. Give up Log.w(TAG, "Camera rejected even safe-mode parameters! No configuration"); } } } }
synchronized void function(SurfaceHolder holder) throws IOException { Camera theCamera = camera; if (theCamera == null) { theCamera = new OpenCameraManager().build().open(); if (theCamera == null) { throw new IOException(); } camera = theCamera; } theCamera.setPreviewDisplay(holder); if (!initialized) { initialized = true; configManager.initFromCameraParameters(theCamera); if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) { if (requestedFramingRectLeftOffset > 0 && requestedFramingRectTopOffset > 0) { setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight, requestedFramingRectLeftOffset, requestedFramingRectTopOffset); } else { setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight); } requestedFramingRectWidth = 0; requestedFramingRectHeight = 0; requestedFramingRectLeftOffset = 0; requestedFramingRectTopOffset = 0; } } Camera.Parameters parameters = theCamera.getParameters(); String parametersFlattened = parameters == null ? null : parameters.flatten(); try { configManager.setDesiredCameraParameters(theCamera, false); } catch (RuntimeException re) { Log.w(TAG, STR); Log.i(TAG, STR + parametersFlattened); if (parametersFlattened != null) { parameters = theCamera.getParameters(); parameters.unflatten(parametersFlattened); try { theCamera.setParameters(parameters); configManager.setDesiredCameraParameters(theCamera, true); } catch (RuntimeException re2) { Log.w(TAG, STR); } } } }
/** * Opens the camera driver and initializes the hardware parameters. * * @param holder The surface object which the camera will draw preview frames into. * @throws java.io.IOException Indicates the camera driver failed to open. */
Opens the camera driver and initializes the hardware parameters
openDriver
{ "repo_name": "Promptus/zxing-android-minimal", "path": "zxing-modified/src/com/welcu/android/zxingfragmentlib/camera/CameraManager.java", "license": "apache-2.0", "size": 13404 }
[ "android.hardware.Camera", "android.util.Log", "android.view.SurfaceHolder", "com.welcu.android.zxingfragmentlib.camera.open.OpenCameraManager", "java.io.IOException" ]
import android.hardware.Camera; import android.util.Log; import android.view.SurfaceHolder; import com.welcu.android.zxingfragmentlib.camera.open.OpenCameraManager; import java.io.IOException;
import android.hardware.*; import android.util.*; import android.view.*; import com.welcu.android.zxingfragmentlib.camera.open.*; import java.io.*;
[ "android.hardware", "android.util", "android.view", "com.welcu.android", "java.io" ]
android.hardware; android.util; android.view; com.welcu.android; java.io;
1,197,029
public static void copy(File source, File target, FilenameFilter filter) throws IOException { copy(source, target, filter, false, true); }
static void function(File source, File target, FilenameFilter filter) throws IOException { copy(source, target, filter, false, true); }
/** * Copy file or directory to the specified destination. Existed files in destination directory * will be overwritten. * * @param source copy source * @param target copy destination * @param filter copy filter * @throws java.io.IOException if any i/o error occurs */
Copy file or directory to the specified destination. Existed files in destination directory will be overwritten
copy
{ "repo_name": "akervern/che", "path": "core/commons/che-core-commons-lang/src/main/java/org/eclipse/che/commons/lang/IoUtil.java", "license": "epl-1.0", "size": 19102 }
[ "java.io.File", "java.io.FilenameFilter", "java.io.IOException" ]
import java.io.File; import java.io.FilenameFilter; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,844,064
public static File getObbDir(String packageName) { return new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/obb/" + packageName); }
static File function(String packageName) { return new File(Environment.getExternalStorageDirectory().getAbsolutePath() + STR + packageName); }
/** * Get the directory where APK Expansion Files aka OBB files are stored for the app as * specified by {@code packageName}. * * @see <a href="https://developer.android.com/google/play/expansion-files.html">APK Expansion Files</a> */
Get the directory where APK Expansion Files aka OBB files are stored for the app as specified by packageName
getObbDir
{ "repo_name": "CopperheadOS/platform_packages_apps_F-Droid", "path": "app/src/main/java/org/fdroid/fdroid/data/App.java", "license": "gpl-3.0", "size": 51294 }
[ "android.os.Environment", "java.io.File" ]
import android.os.Environment; import java.io.File;
import android.os.*; import java.io.*;
[ "android.os", "java.io" ]
android.os; java.io;
1,955,959
public void updateFinished(Testsystem testsystem) { tsHandler.updateTestsystem(testsystem); eventBus.post(new TestsystemChangedEvent(testsystem)); wizard.close(); LOGGER.info(testsystem.getName() + " updated"); }
void function(Testsystem testsystem) { tsHandler.updateTestsystem(testsystem); eventBus.post(new TestsystemChangedEvent(testsystem)); wizard.close(); LOGGER.info(testsystem.getName() + STR); }
/** * will be called when wizzard has been finished. * updates the testsystem * * @param testsystem the {@link Testsystem} to update */
will be called when wizzard has been finished. updates the testsystem
updateFinished
{ "repo_name": "encoway/ecasta", "path": "src/main/java/com/encoway/ecasta/systems/controller/WizzardController.java", "license": "mit", "size": 3352 }
[ "com.encoway.ecasta.systems.Testsystem", "com.encoway.ecasta.systems.events.TestsystemChangedEvent" ]
import com.encoway.ecasta.systems.Testsystem; import com.encoway.ecasta.systems.events.TestsystemChangedEvent;
import com.encoway.ecasta.systems.*; import com.encoway.ecasta.systems.events.*;
[ "com.encoway.ecasta" ]
com.encoway.ecasta;
2,491,518
double signum(Object value) { if (value instanceof Number) { double doubleValue = ((Number) value).doubleValue(); return Math.signum(doubleValue); } if (value instanceof BytesRef) { value = ((BytesRef) value).utf8ToString(); } return Math.signum(Double.parseDouble(value.toString())); }
double signum(Object value) { if (value instanceof Number) { double doubleValue = ((Number) value).doubleValue(); return Math.signum(doubleValue); } if (value instanceof BytesRef) { value = ((BytesRef) value).utf8ToString(); } return Math.signum(Double.parseDouble(value.toString())); }
/** * Returns -1, 0, or 1 if the value is lower than, equal to, or greater than 0 */
Returns -1, 0, or 1 if the value is lower than, equal to, or greater than 0
signum
{ "repo_name": "coding0011/elasticsearch", "path": "server/src/main/java/org/elasticsearch/index/mapper/NumberFieldMapper.java", "license": "apache-2.0", "size": 43941 }
[ "org.apache.lucene.util.BytesRef" ]
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.*;
[ "org.apache.lucene" ]
org.apache.lucene;
522,109
EClass getMSE();
EClass getMSE();
/** * Returns the meta object for class '{@link org.eclipse.gemoc.trace.commons.model.trace.MSE <em>MSE</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>MSE</em>'. * @see org.eclipse.gemoc.trace.commons.model.trace.MSE * @generated */
Returns the meta object for class '<code>org.eclipse.gemoc.trace.commons.model.trace.MSE MSE</code>'.
getMSE
{ "repo_name": "SiriusLab/SiriusAnimator", "path": "trace/commons/plugins/org.eclipse.gemoc.trace.commons.model/src/org/eclipse/gemoc/trace/commons/model/trace/TracePackage.java", "license": "epl-1.0", "size": 52505 }
[ "org.eclipse.emf.ecore.EClass" ]
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
4,257
private byte[] checkAndGetKekBytes(Key key) throws InvalidKeyException { if (! Registry.RAW_ENCODING_SHORT_NAME.equalsIgnoreCase(key.getFormat())) throw new InvalidKeyException("Only RAW key format is supported"); byte[] result = key.getEncoded(); int kekSize = result.length; if (kekSize != kwaKeySize) throw new InvalidKeyException("Invalid key material size. Expected " + kwaKeySize + " but found " + kekSize); return result; }
byte[] function(Key key) throws InvalidKeyException { if (! Registry.RAW_ENCODING_SHORT_NAME.equalsIgnoreCase(key.getFormat())) throw new InvalidKeyException(STR); byte[] result = key.getEncoded(); int kekSize = result.length; if (kekSize != kwaKeySize) throw new InvalidKeyException(STR + kwaKeySize + STR + kekSize); return result; }
/** * Returns the key bytes, iff it was in RAW format. * * @param key the opaque JCE secret key to use as the KEK. * @return the bytes of the encoded form of the designated kek, iff it was in * RAW format. * @throws InvalidKeyException if the designated key is not in the RAW format. */
Returns the key bytes, iff it was in RAW format
checkAndGetKekBytes
{ "repo_name": "selmentdev/selment-toolchain", "path": "source/gcc-latest/libjava/classpath/gnu/javax/crypto/jce/cipher/KeyWrappingAlgorithmAdapter.java", "license": "gpl-3.0", "size": 15668 }
[ "gnu.java.security.Registry", "java.security.InvalidKeyException", "java.security.Key" ]
import gnu.java.security.Registry; import java.security.InvalidKeyException; import java.security.Key;
import gnu.java.security.*; import java.security.*;
[ "gnu.java.security", "java.security" ]
gnu.java.security; java.security;
425,542
public void delete(SQLiteDatabase db) { EntityMapping mapping = getEntityMappingEnsureSchema(db); if (!mTransient) { mapping.delete(db, this); this.mTransient = true; } }
void function(SQLiteDatabase db) { EntityMapping mapping = getEntityMappingEnsureSchema(db); if (!mTransient) { mapping.delete(db, this); this.mTransient = true; } }
/** * Delete this object using the specified database connection. * * @param db The database connection to use. */
Delete this object using the specified database connection
delete
{ "repo_name": "pr02nl/ormdroid", "path": "src/com/roscopeco/ormdroid/Entity.java", "license": "apache-2.0", "size": 35153 }
[ "android.database.sqlite.SQLiteDatabase" ]
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.*;
[ "android.database" ]
android.database;
327,268
@SuppressWarnings("unchecked") @Test public void testOnFlowUpdatePre_Upper() throws Exception { createPowerSpy(); ConversionTable conversionTable = new ConversionTable(); conversionTable.addEntryConnectionType("LowerNetworkId", "lower"); conversionTable.addEntryConnectionType("UpperNetworkId", "upper"); conversionTable.addEntryConnectionType("LayerizedNetworkId", "layerized"); PowerMockito.doReturn(conversionTable).when(target, "conversionTable"); Map<String, NetworkInterface> netIfs = new HashMap<>(); NetworkInterface lowerNetIf = new NetworkInterface(dispatcher, "LowerNetworkId"); NetworkInterface upperNetIf = new NetworkInterface(dispatcher, "UpperNetworkId"); NetworkInterface layerizedNetIf = new NetworkInterface(dispatcher, "LayerizedNetworkId"); netIfs.put("LowerNetworkId", lowerNetIf); netIfs.put("UpperNetworkId", upperNetIf); netIfs.put("LayerizedNetworkId", layerizedNetIf); PowerMockito.doReturn(netIfs).when(target, "networkInterfaces"); List<BasicFlowMatch> settingMatches = new ArrayList<>(); List<String> settingPath = new ArrayList<>(Arrays.asList("path")); Map<String, List<FlowAction>> settingEdgeActions = new HashMap<>(); Map<String, String> settingAttribubtes = new HashMap<>(); BasicFlow settingFlow = new BasicFlow("0", "FlowId", "Owner", true, "0", "none", settingMatches, settingPath, settingEdgeActions, settingAttribubtes); doReturn(settingFlow).when(target).getFlow(anyString(), (Flow) anyObject()); LinkLayerizerBoundaryTable boundaryTable = Mockito .mock(LinkLayerizerBoundaryTable.class); LinkLayerizerOnFlow onFlow = Mockito.spy(new LinkLayerizerOnFlow( conversionTable, netIfs, boundaryTable)); Whitebox.setInternalState(target, "linkLayerizerOnFlow", onFlow); doNothing().when(onFlow).flowUpdateLowerNw(anyString(), (BasicFlow) anyObject(), (List<String>) anyList()); List<BasicFlowMatch> matches = new ArrayList<>(); List<String> path = new ArrayList<>(); Map<String, List<FlowAction>> edgeActions = new HashMap<>(); Map<String, String> attributes = new HashMap<>(); Flow prev = new BasicFlow("0", "FlowId", "Owner", true, "0", "none", matches, path, edgeActions, attributes); Flow curr = new BasicFlow("0", "FlowId", "Owner", true, "0", "none", matches, path, edgeActions, attributes); ArrayList<String> attributesList = new ArrayList<>(); boolean result = target.onFlowUpdatePre("UpperNetworkId", prev, curr, attributesList); assertThat(result, is(false)); verify(onFlow).flowUpdateUpperNwExistPath("UpperNetworkId", settingFlow, attributesList); }
@SuppressWarnings(STR) void function() throws Exception { createPowerSpy(); ConversionTable conversionTable = new ConversionTable(); conversionTable.addEntryConnectionType(STR, "lower"); conversionTable.addEntryConnectionType(STR, "upper"); conversionTable.addEntryConnectionType(STR, STR); PowerMockito.doReturn(conversionTable).when(target, STR); Map<String, NetworkInterface> netIfs = new HashMap<>(); NetworkInterface lowerNetIf = new NetworkInterface(dispatcher, STR); NetworkInterface upperNetIf = new NetworkInterface(dispatcher, STR); NetworkInterface layerizedNetIf = new NetworkInterface(dispatcher, STR); netIfs.put(STR, lowerNetIf); netIfs.put(STR, upperNetIf); netIfs.put(STR, layerizedNetIf); PowerMockito.doReturn(netIfs).when(target, STR); List<BasicFlowMatch> settingMatches = new ArrayList<>(); List<String> settingPath = new ArrayList<>(Arrays.asList("path")); Map<String, List<FlowAction>> settingEdgeActions = new HashMap<>(); Map<String, String> settingAttribubtes = new HashMap<>(); BasicFlow settingFlow = new BasicFlow("0", STR, "Owner", true, "0", "none", settingMatches, settingPath, settingEdgeActions, settingAttribubtes); doReturn(settingFlow).when(target).getFlow(anyString(), (Flow) anyObject()); LinkLayerizerBoundaryTable boundaryTable = Mockito .mock(LinkLayerizerBoundaryTable.class); LinkLayerizerOnFlow onFlow = Mockito.spy(new LinkLayerizerOnFlow( conversionTable, netIfs, boundaryTable)); Whitebox.setInternalState(target, STR, onFlow); doNothing().when(onFlow).flowUpdateLowerNw(anyString(), (BasicFlow) anyObject(), (List<String>) anyList()); List<BasicFlowMatch> matches = new ArrayList<>(); List<String> path = new ArrayList<>(); Map<String, List<FlowAction>> edgeActions = new HashMap<>(); Map<String, String> attributes = new HashMap<>(); Flow prev = new BasicFlow("0", STR, "Owner", true, "0", "none", matches, path, edgeActions, attributes); Flow curr = new BasicFlow("0", STR, "Owner", true, "0", "none", matches, path, edgeActions, attributes); ArrayList<String> attributesList = new ArrayList<>(); boolean result = target.onFlowUpdatePre(STR, prev, curr, attributesList); assertThat(result, is(false)); verify(onFlow).flowUpdateUpperNwExistPath(STR, settingFlow, attributesList); }
/** * Test method for {@link org.o3project.odenos.component.linklayerizer.LinkLayerizer#onFlowUpdatePre(java.lang.String, org.o3project.odenos.core.component.network.flow.Flow, org.o3project.odenos.core.component.network.flow.Flow, java.util.ArrayList)}. * @throws Exception */
Test method for <code>org.o3project.odenos.component.linklayerizer.LinkLayerizer#onFlowUpdatePre(java.lang.String, org.o3project.odenos.core.component.network.flow.Flow, org.o3project.odenos.core.component.network.flow.Flow, java.util.ArrayList)</code>
testOnFlowUpdatePre_Upper
{ "repo_name": "narry/odenos", "path": "src/test/java/org/o3project/odenos/component/linklayerizer/LinkLayerizerTest.java", "license": "apache-2.0", "size": 127722 }
[ "java.util.ArrayList", "java.util.Arrays", "java.util.HashMap", "java.util.List", "java.util.Map", "org.hamcrest.CoreMatchers", "org.junit.Assert", "org.mockito.Matchers", "org.mockito.Mockito", "org.o3project.odenos.core.component.ConversionTable", "org.o3project.odenos.core.component.NetworkInterface", "org.o3project.odenos.core.component.network.flow.Flow", "org.o3project.odenos.core.component.network.flow.basic.BasicFlow", "org.o3project.odenos.core.component.network.flow.basic.BasicFlowMatch", "org.o3project.odenos.core.component.network.flow.basic.FlowAction", "org.powermock.api.mockito.PowerMockito", "org.powermock.reflect.Whitebox" ]
import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import org.hamcrest.CoreMatchers; import org.junit.Assert; import org.mockito.Matchers; import org.mockito.Mockito; import org.o3project.odenos.core.component.ConversionTable; import org.o3project.odenos.core.component.NetworkInterface; import org.o3project.odenos.core.component.network.flow.Flow; import org.o3project.odenos.core.component.network.flow.basic.BasicFlow; import org.o3project.odenos.core.component.network.flow.basic.BasicFlowMatch; import org.o3project.odenos.core.component.network.flow.basic.FlowAction; import org.powermock.api.mockito.PowerMockito; import org.powermock.reflect.Whitebox;
import java.util.*; import org.hamcrest.*; import org.junit.*; import org.mockito.*; import org.o3project.odenos.core.component.*; import org.o3project.odenos.core.component.network.flow.*; import org.o3project.odenos.core.component.network.flow.basic.*; import org.powermock.api.mockito.*; import org.powermock.reflect.*;
[ "java.util", "org.hamcrest", "org.junit", "org.mockito", "org.o3project.odenos", "org.powermock.api", "org.powermock.reflect" ]
java.util; org.hamcrest; org.junit; org.mockito; org.o3project.odenos; org.powermock.api; org.powermock.reflect;
1,904,136
public void complexOneToOneFetchJoinTest() { EntityManager em = createEntityManager(); List<Man> allMen = getServerSession().readAllObjects(Man.class); List<Integer> allMenIds = new ArrayList(allMen.size()); for (Man man : allMen) { allMenIds.add((man != null) ? man.getId() : null); } Collections.sort(allMenIds); clearCache(); String ejbqlString = "SELECT m FROM Man m LEFT JOIN FETCH m.partnerLink"; List<Man> result = em.createQuery(ejbqlString).getResultList(); List<Integer> ids = new ArrayList(result.size()); for (Man man : result) { ids.add((man != null) ? man.getId() : null); } Collections.sort(ids); // compare ids, because comparer does not know class Man Assert.assertEquals("Complex OneToOne Fetch Join test failed", allMenIds, ids); }
void function() { EntityManager em = createEntityManager(); List<Man> allMen = getServerSession().readAllObjects(Man.class); List<Integer> allMenIds = new ArrayList(allMen.size()); for (Man man : allMen) { allMenIds.add((man != null) ? man.getId() : null); } Collections.sort(allMenIds); clearCache(); String ejbqlString = STR; List<Man> result = em.createQuery(ejbqlString).getResultList(); List<Integer> ids = new ArrayList(result.size()); for (Man man : result) { ids.add((man != null) ? man.getId() : null); } Collections.sort(ids); Assert.assertEquals(STR, allMenIds, ids); }
/** * Testing glassfish issue 2881 */
Testing glassfish issue 2881
complexOneToOneFetchJoinTest
{ "repo_name": "gameduell/eclipselink.runtime", "path": "jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/tests/jpa/jpql/JUnitJPQLComplexTestSuite.java", "license": "epl-1.0", "size": 208595 }
[ "java.util.ArrayList", "java.util.Collections", "java.util.List", "javax.persistence.EntityManager", "junit.framework.Assert", "org.eclipse.persistence.testing.models.jpa.advanced.Man" ]
import java.util.ArrayList; import java.util.Collections; import java.util.List; import javax.persistence.EntityManager; import junit.framework.Assert; import org.eclipse.persistence.testing.models.jpa.advanced.Man;
import java.util.*; import javax.persistence.*; import junit.framework.*; import org.eclipse.persistence.testing.models.jpa.advanced.*;
[ "java.util", "javax.persistence", "junit.framework", "org.eclipse.persistence" ]
java.util; javax.persistence; junit.framework; org.eclipse.persistence;
2,721,966
public ItemTree getActionReward(Integer actionID) { return actionRewards.get(actionID); }
ItemTree function(Integer actionID) { return actionRewards.get(actionID); }
/** * Retrieves the rewards for the given action or trigger. * @param actionID - unique ID for the given action. * @return Tree of every associated reward. */
Retrieves the rewards for the given action or trigger
getActionReward
{ "repo_name": "aadnk/ExperienceMod", "path": "ExperienceMod/src/main/java/com/comphenix/xp/parser/sections/ItemsSectionResult.java", "license": "gpl-2.0", "size": 1268 }
[ "com.comphenix.xp.lookup.ItemTree" ]
import com.comphenix.xp.lookup.ItemTree;
import com.comphenix.xp.lookup.*;
[ "com.comphenix.xp" ]
com.comphenix.xp;
2,356,374
private int getBufferedImageTypeFor(String compressionName) { if (compressionName.equalsIgnoreCase(TIFFConstants.COMPRESSION_CCITT_T6)) { return BufferedImage.TYPE_BYTE_BINARY; } else if (compressionName.equalsIgnoreCase(TIFFConstants.COMPRESSION_CCITT_T4)) { return BufferedImage.TYPE_BYTE_BINARY; } else { return BufferedImage.TYPE_INT_ARGB; } } // ---=== IFDocumentHandler configuration ===---
int function(String compressionName) { if (compressionName.equalsIgnoreCase(TIFFConstants.COMPRESSION_CCITT_T6)) { return BufferedImage.TYPE_BYTE_BINARY; } else if (compressionName.equalsIgnoreCase(TIFFConstants.COMPRESSION_CCITT_T4)) { return BufferedImage.TYPE_BYTE_BINARY; } else { return BufferedImage.TYPE_INT_ARGB; } }
/** * Determines the type value for the BufferedImage to be produced for rendering * the bitmap image. * @param compressionName the compression name * @return a value from the {@link BufferedImage}.TYPE_* constants */
Determines the type value for the BufferedImage to be produced for rendering the bitmap image
getBufferedImageTypeFor
{ "repo_name": "pellcorp/fop", "path": "src/java/org/apache/fop/render/bitmap/TIFFRendererConfigurator.java", "license": "apache-2.0", "size": 4190 }
[ "java.awt.image.BufferedImage" ]
import java.awt.image.BufferedImage;
import java.awt.image.*;
[ "java.awt" ]
java.awt;
338,868
Collection<Object> getAttributeKeys() throws InvalidSessionException;
Collection<Object> getAttributeKeys() throws InvalidSessionException;
/** * Returns the keys of all the attributes stored under this session. If there are no * attributes, this returns an empty collection. * * @return the keys of all attributes stored under this session, or an empty collection if * there are no session attributes. * @throws InvalidSessionException if this session has stopped or expired prior to calling this method. * @since 0.2 */
Returns the keys of all the attributes stored under this session. If there are no attributes, this returns an empty collection
getAttributeKeys
{ "repo_name": "xuegongzi/rabbitframework", "path": "rabbitframework-security-pom/rabbitframework-security/src/main/java/org/apache/shiro/session/Session.java", "license": "apache-2.0", "size": 10878 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
1,528,430
Response get();
Response get();
/** * Gets the response, possibly generating it if it does not exist yet */
Gets the response, possibly generating it if it does not exist yet
get
{ "repo_name": "quarkusio/quarkus", "path": "independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/LazyResponse.java", "license": "apache-2.0", "size": 1066 }
[ "javax.ws.rs.core.Response" ]
import javax.ws.rs.core.Response;
import javax.ws.rs.core.*;
[ "javax.ws" ]
javax.ws;
136,170
public void testSaveWithoutCreate() throws Exception { TodorooCursor<Task> cursor; // try to save task "happy" Task task = new Task(); task.setValue(Task.TITLE, "happy"); task.setValue(Task.ID, 1L); assertFalse(taskDao.save(task)); cursor = taskDao.query( Query.select(IDS)); assertEquals(0, cursor.getCount()); cursor.close(); }
void function() throws Exception { TodorooCursor<Task> cursor; Task task = new Task(); task.setValue(Task.TITLE, "happy"); task.setValue(Task.ID, 1L); assertFalse(taskDao.save(task)); cursor = taskDao.query( Query.select(IDS)); assertEquals(0, cursor.getCount()); cursor.close(); }
/** * Test save without prior create doesn't work */
Test save without prior create doesn't work
testSaveWithoutCreate
{ "repo_name": "michaltakac/astrid", "path": "tests/src/com/todoroo/astrid/dao/TaskDaoTests.java", "license": "gpl-3.0", "size": 7263 }
[ "com.todoroo.andlib.data.TodorooCursor", "com.todoroo.andlib.sql.Query", "com.todoroo.astrid.data.Task" ]
import com.todoroo.andlib.data.TodorooCursor; import com.todoroo.andlib.sql.Query; import com.todoroo.astrid.data.Task;
import com.todoroo.andlib.data.*; import com.todoroo.andlib.sql.*; import com.todoroo.astrid.data.*;
[ "com.todoroo.andlib", "com.todoroo.astrid" ]
com.todoroo.andlib; com.todoroo.astrid;
2,182,081
Serializable fileId = null; List<ObjectRevision> originalRevisions = null; RepositoryFile repositoryFile = repository.getFile( FileUtils.idToPath( pathId ) ); if ( repositoryFile != null ) { fileId = repositoryFile.getId(); } if ( fileId != null ) { try { originalRevisions = revisionService.getRevisions( new StringObjectId( fileId.toString() ) ); } catch ( KettleException e ) { return Response.serverError().build(); } List<PurObjectRevision> revisions = new ArrayList(); for ( ObjectRevision revision : originalRevisions ) { revisions.add( (PurObjectRevision) revision ); } GenericEntity<List<PurObjectRevision>> genericRevisionsEntity = new GenericEntity<List<PurObjectRevision>>( revisions ) { }; return Response.ok( genericRevisionsEntity ).build(); } else { return Response.serverError().build(); } }
Serializable fileId = null; List<ObjectRevision> originalRevisions = null; RepositoryFile repositoryFile = repository.getFile( FileUtils.idToPath( pathId ) ); if ( repositoryFile != null ) { fileId = repositoryFile.getId(); } if ( fileId != null ) { try { originalRevisions = revisionService.getRevisions( new StringObjectId( fileId.toString() ) ); } catch ( KettleException e ) { return Response.serverError().build(); } List<PurObjectRevision> revisions = new ArrayList(); for ( ObjectRevision revision : originalRevisions ) { revisions.add( (PurObjectRevision) revision ); } GenericEntity<List<PurObjectRevision>> genericRevisionsEntity = new GenericEntity<List<PurObjectRevision>>( revisions ) { }; return Response.ok( genericRevisionsEntity ).build(); } else { return Response.serverError().build(); } }
/** * Retrieves the version history of a selected repository file * * <p> * <b>Example Request:</b><br> * GET /pur-repository-plugin/api/revision/path:to:file/revisions * </p> * * @param pathId * (colon separated path for the repository file) * * <pre function="syntax.xml"> * :path:to:file:id * </pre> * @return file revisions objects <code> purObjectRevisions </code> * * <pre function="syntax.xml"> * &lt;purObjectRevisions&gt; * &lt;revision&gt; * &lt;versionId&gt;1.0&lt;/versionId&gt; * &lt;creationDate&gt;2014-07-22T14:42:46.029-04:00&lt;/creationDate&gt; * &lt;login&gt;admin&lt;/login&gt; * &lt;comment&gt;JMeter test&lt;/comment&gt; * &lt;/revision&gt; * &lt;/purObjectRevisions&gt; * </pre> */
Retrieves the version history of a selected repository file Example Request: GET /pur-repository-plugin/api/revision/path:to:file/revisions
doGetVersions
{ "repo_name": "AliaksandrShuhayeu/pentaho-kettle", "path": "plugins/pur/core/src/main/java/com/pentaho/di/revision/RevisionResource.java", "license": "apache-2.0", "size": 6649 }
[ "java.io.Serializable", "java.util.ArrayList", "java.util.List", "javax.ws.rs.core.GenericEntity", "javax.ws.rs.core.Response", "org.pentaho.di.core.exception.KettleException", "org.pentaho.di.repository.ObjectRevision", "org.pentaho.di.repository.StringObjectId", "org.pentaho.di.repository.pur.PurObjectRevision", "org.pentaho.platform.api.repository2.unified.RepositoryFile", "org.pentaho.platform.web.http.api.resources.utils.FileUtils" ]
import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.ws.rs.core.GenericEntity; import javax.ws.rs.core.Response; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.repository.ObjectRevision; import org.pentaho.di.repository.StringObjectId; import org.pentaho.di.repository.pur.PurObjectRevision; import org.pentaho.platform.api.repository2.unified.RepositoryFile; import org.pentaho.platform.web.http.api.resources.utils.FileUtils;
import java.io.*; import java.util.*; import javax.ws.rs.core.*; import org.pentaho.di.core.exception.*; import org.pentaho.di.repository.*; import org.pentaho.di.repository.pur.*; import org.pentaho.platform.api.repository2.unified.*; import org.pentaho.platform.web.http.api.resources.utils.*;
[ "java.io", "java.util", "javax.ws", "org.pentaho.di", "org.pentaho.platform" ]
java.io; java.util; javax.ws; org.pentaho.di; org.pentaho.platform;
1,246,715
public static WSDLLocation getWSDLLocationMetadata(EndpointReference epr, String addressingNamespace) throws AxisFault { WSDLLocation wsdlLocation = new WSDLLocation(); List attributes = null; if (AddressingConstants.Submission.WSA_NAMESPACE.equals(addressingNamespace)) attributes = epr.getAttributes(); else attributes = epr.getMetadataAttributes(); if (attributes != null) { //Retrieve the wsdl location. for (int i = 0, size = attributes.size(); i < size; i++) { OMAttribute omAttribute = (OMAttribute) attributes.get(i); if (WSDLLocation.isWSDLLocationAttribute(omAttribute)) { wsdlLocation.fromOM(omAttribute); break; } } } return wsdlLocation; }
static WSDLLocation function(EndpointReference epr, String addressingNamespace) throws AxisFault { WSDLLocation wsdlLocation = new WSDLLocation(); List attributes = null; if (AddressingConstants.Submission.WSA_NAMESPACE.equals(addressingNamespace)) attributes = epr.getAttributes(); else attributes = epr.getMetadataAttributes(); if (attributes != null) { for (int i = 0, size = attributes.size(); i < size; i++) { OMAttribute omAttribute = (OMAttribute) attributes.get(i); if (WSDLLocation.isWSDLLocationAttribute(omAttribute)) { wsdlLocation.fromOM(omAttribute); break; } } } return wsdlLocation; }
/** * Retrieves the wsdli:wsdlLocation attribute from an EPR. * * @param epr the EPR to retrieve the attribute from * @param addressingNamespace the WS-Addressing namespace associated with * the EPR. * @return an instance of <code>WSDLLocation</code>. The return value is * never <code>null</code>. * @throws AxisFault */
Retrieves the wsdli:wsdlLocation attribute from an EPR
getWSDLLocationMetadata
{ "repo_name": "arunasujith/wso2-axis2", "path": "modules/kernel/src/org/apache/axis2/addressing/EndpointReferenceHelper.java", "license": "apache-2.0", "size": 24457 }
[ "java.util.List", "org.apache.axiom.om.OMAttribute", "org.apache.axis2.AxisFault", "org.apache.axis2.addressing.metadata.WSDLLocation" ]
import java.util.List; import org.apache.axiom.om.OMAttribute; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.metadata.WSDLLocation;
import java.util.*; import org.apache.axiom.om.*; import org.apache.axis2.*; import org.apache.axis2.addressing.metadata.*;
[ "java.util", "org.apache.axiom", "org.apache.axis2" ]
java.util; org.apache.axiom; org.apache.axis2;
2,705,373
String strDateTime = pDateFix.matcher(isoDateString).replaceFirst("$1T$2Z"); if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.O) { // use Joda Time classes return DateTime.parse(strDateTime).toDate(); } else { // use built-in java.time classes OffsetDateTime odt = OffsetDateTime.parse(pOffsetFix.matcher(strDateTime).replaceFirst("$1:$2")); return Date.from(odt.toInstant()); } }
String strDateTime = pDateFix.matcher(isoDateString).replaceFirst(STR); if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.O) { return DateTime.parse(strDateTime).toDate(); } else { OffsetDateTime odt = OffsetDateTime.parse(pOffsetFix.matcher(strDateTime).replaceFirst("$1:$2")); return Date.from(odt.toInstant()); } }
/** * Takes in an ISO date string of the following format: * yyyy-MM-dd'T'HH:mm:ss.SSS(Z|+/-HH:mm) * * The milliseconds and time zone/offset values are optional. * * @param isoDateString the iso date string to parse * @return the date object */
Takes in an ISO date string of the following format: The milliseconds and time zone/offset values are optional
tolerantFromISODateString
{ "repo_name": "jamorham/xDrip-plus", "path": "app/src/main/java/com/eveningoutpost/dexdrip/Models/DateUtil.java", "license": "gpl-3.0", "size": 2858 }
[ "java.time.OffsetDateTime", "java.util.Date", "org.joda.time.DateTime" ]
import java.time.OffsetDateTime; import java.util.Date; import org.joda.time.DateTime;
import java.time.*; import java.util.*; import org.joda.time.*;
[ "java.time", "java.util", "org.joda.time" ]
java.time; java.util; org.joda.time;
1,702,368
public ValidationResult validate(final CidsBean bean, final List<String> errors) { return validate(bean, (CidsBean)bean.getProperty("massnahme"), errors); }
ValidationResult function(final CidsBean bean, final List<String> errors) { return validate(bean, (CidsBean)bean.getProperty(STR), errors); }
/** * DOCUMENT ME! * * @param bean Gup_Unterhaltungsmassnahme * @param errors DOCUMENT ME! * * @return DOCUMENT ME! */
DOCUMENT ME
validate
{ "repo_name": "cismet/cids-custom-wrrl-db-mv", "path": "src/main/java/de/cismet/cids/custom/wrrl_db_mv/util/gup/UnterhaltungsmassnahmeValidator.java", "license": "lgpl-3.0", "size": 11314 }
[ "de.cismet.cids.dynamics.CidsBean", "java.util.List" ]
import de.cismet.cids.dynamics.CidsBean; import java.util.List;
import de.cismet.cids.dynamics.*; import java.util.*;
[ "de.cismet.cids", "java.util" ]
de.cismet.cids; java.util;
2,596,321
public void cancel() throws IOException { try { _tmpOut.close(); } catch (IOException ignored) {} io(() -> finish(false)); }
void function() throws IOException { try { _tmpOut.close(); } catch (IOException ignored) {} io(() -> finish(false)); }
/** * Aborts the write process, leaving the destination file untouched * @throws IOException */
Aborts the write process, leaving the destination file untouched
cancel
{ "repo_name": "martylamb/AtomicFileOutputStream", "path": "src/main/java/com/martiansoftware/io/AtomicFileOutputStream.java", "license": "apache-2.0", "size": 4927 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,857,162
private void postPlugin(final boolean isPing) throws IOException { // Server software specific section PluginDescriptionFile description = plugin.getDescription(); String pluginName = description.getName(); boolean onlineMode = Bukkit.getServer().getOnlineMode(); // TRUE if online mode is enabled String pluginVersion = description.getVersion(); String serverVersion = Bukkit.getVersion(); int playersOnline = Bukkit.getServer().getOnlinePlayers().length; // END server software specific section -- all code below does not use any code outside of this class / Java // Construct the post data StringBuilder json = new StringBuilder(1024); json.append('{'); // The plugin's description file containg all of the plugin data such as name, version, author, etc appendJSONPair(json, "guid", guid); appendJSONPair(json, "plugin_version", pluginVersion); appendJSONPair(json, "server_version", serverVersion); appendJSONPair(json, "players_online", Integer.toString(playersOnline)); // New data as of R6 String osname = System.getProperty("os.name"); String osarch = System.getProperty("os.arch"); String osversion = System.getProperty("os.version"); String java_version = System.getProperty("java.version"); int coreCount = Runtime.getRuntime().availableProcessors(); // normalize os arch .. amd64 -> x86_64 if (osarch.equals("amd64")) { osarch = "x86_64"; } appendJSONPair(json, "osname", osname); appendJSONPair(json, "osarch", osarch); appendJSONPair(json, "osversion", osversion); appendJSONPair(json, "cores", Integer.toString(coreCount)); appendJSONPair(json, "auth_mode", onlineMode ? "1" : "0"); appendJSONPair(json, "java_version", java_version); // If we're pinging, append it if (isPing) { appendJSONPair(json, "ping", "1"); } if (graphs.size() > 0) { synchronized (graphs) { json.append(','); json.append('"'); json.append("graphs"); json.append('"'); json.append(':'); json.append('{'); boolean firstGraph = true; final Iterator<Graph> iter = graphs.iterator(); while (iter.hasNext()) { Graph graph = iter.next(); StringBuilder graphJson = new StringBuilder(); graphJson.append('{'); for (Plotter plotter : graph.getPlotters()) { appendJSONPair(graphJson, plotter.getColumnName(), Integer.toString(plotter.getValue())); } graphJson.append('}'); if (!firstGraph) { json.append(','); } json.append(escapeJSON(graph.getName())); json.append(':'); json.append(graphJson); firstGraph = false; } json.append('}'); } } // close json json.append('}'); // Create the url URL url = new URL(BASE_URL + String.format(REPORT_URL, urlEncode(pluginName))); // Connect to the website URLConnection connection; // Mineshafter creates a socks proxy, so we can safely bypass it // It does not reroute POST requests so we need to go around it if (isMineshafterPresent()) { connection = url.openConnection(Proxy.NO_PROXY); } else { connection = url.openConnection(); } byte[] uncompressed = json.toString().getBytes(); byte[] compressed = gzip(json.toString()); // Headers connection.addRequestProperty("User-Agent", "MCStats/" + REVISION); connection.addRequestProperty("Content-Type", "application/json"); connection.addRequestProperty("Content-Encoding", "gzip"); connection.addRequestProperty("Content-Length", Integer.toString(compressed.length)); connection.addRequestProperty("Accept", "application/json"); connection.addRequestProperty("Connection", "close"); connection.setDoOutput(true); if (debug) { System.out.println("[Metrics] Prepared request for " + pluginName + " uncompressed=" + uncompressed.length + " compressed=" + compressed.length); } // Write the data OutputStream os = connection.getOutputStream(); os.write(compressed); os.flush(); // Now read the response final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); String response = reader.readLine(); // close resources os.close(); reader.close(); if (response == null || response.startsWith("ERR") || response.startsWith("7")) { if (response == null) { response = "null"; } else if (response.startsWith("7")) { response = response.substring(response.startsWith("7,") ? 2 : 1); } throw new IOException(response); } else { // Is this the first update this hour? if (response.equals("1") || response.contains("This is your first update this hour")) { synchronized (graphs) { final Iterator<Graph> iter = graphs.iterator(); while (iter.hasNext()) { final Graph graph = iter.next(); for (Plotter plotter : graph.getPlotters()) { plotter.reset(); } } } } } }
void function(final boolean isPing) throws IOException { PluginDescriptionFile description = plugin.getDescription(); String pluginName = description.getName(); boolean onlineMode = Bukkit.getServer().getOnlineMode(); String pluginVersion = description.getVersion(); String serverVersion = Bukkit.getVersion(); int playersOnline = Bukkit.getServer().getOnlinePlayers().length; StringBuilder json = new StringBuilder(1024); json.append('{'); appendJSONPair(json, "guid", guid); appendJSONPair(json, STR, pluginVersion); appendJSONPair(json, STR, serverVersion); appendJSONPair(json, STR, Integer.toString(playersOnline)); String osname = System.getProperty(STR); String osarch = System.getProperty(STR); String osversion = System.getProperty(STR); String java_version = System.getProperty(STR); int coreCount = Runtime.getRuntime().availableProcessors(); if (osarch.equals("amd64")) { osarch = STR; } appendJSONPair(json, STR, osname); appendJSONPair(json, STR, osarch); appendJSONPair(json, STR, osversion); appendJSONPair(json, "cores", Integer.toString(coreCount)); appendJSONPair(json, STR, onlineMode ? "1" : "0"); appendJSONPair(json, STR, java_version); if (isPing) { appendJSONPair(json, "ping", "1"); } if (graphs.size() > 0) { synchronized (graphs) { json.append(','); json.append('STRgraphsSTR'); json.append(':'); json.append('{'); boolean firstGraph = true; final Iterator<Graph> iter = graphs.iterator(); while (iter.hasNext()) { Graph graph = iter.next(); StringBuilder graphJson = new StringBuilder(); graphJson.append('{'); for (Plotter plotter : graph.getPlotters()) { appendJSONPair(graphJson, plotter.getColumnName(), Integer.toString(plotter.getValue())); } graphJson.append('}'); if (!firstGraph) { json.append(','); } json.append(escapeJSON(graph.getName())); json.append(':'); json.append(graphJson); firstGraph = false; } json.append('}'); } } json.append('}'); URL url = new URL(BASE_URL + String.format(REPORT_URL, urlEncode(pluginName))); URLConnection connection; if (isMineshafterPresent()) { connection = url.openConnection(Proxy.NO_PROXY); } else { connection = url.openConnection(); } byte[] uncompressed = json.toString().getBytes(); byte[] compressed = gzip(json.toString()); connection.addRequestProperty(STR, STR + REVISION); connection.addRequestProperty(STR, STR); connection.addRequestProperty(STR, "gzip"); connection.addRequestProperty(STR, Integer.toString(compressed.length)); connection.addRequestProperty(STR, STR); connection.addRequestProperty(STR, "close"); connection.setDoOutput(true); if (debug) { System.out.println(STR + pluginName + STR + uncompressed.length + STR + compressed.length); } OutputStream os = connection.getOutputStream(); os.write(compressed); os.flush(); final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); String response = reader.readLine(); os.close(); reader.close(); if (response == null response.startsWith("ERR") response.startsWith("7")) { if (response == null) { response = "null"; } else if (response.startsWith("7")) { response = response.substring(response.startsWith("7,") ? 2 : 1); } throw new IOException(response); } else { if (response.equals("1") response.contains(STR)) { synchronized (graphs) { final Iterator<Graph> iter = graphs.iterator(); while (iter.hasNext()) { final Graph graph = iter.next(); for (Plotter plotter : graph.getPlotters()) { plotter.reset(); } } } } } }
/** * Generic method that posts a plugin to the metrics website */
Generic method that posts a plugin to the metrics website
postPlugin
{ "repo_name": "MrSugarCaney/FoodBalance", "path": "src/nl/SugCube/FoodBalance/Metrics.java", "license": "gpl-3.0", "size": 24829 }
[ "java.io.BufferedReader", "java.io.IOException", "java.io.InputStreamReader", "java.io.OutputStream", "java.net.Proxy", "java.net.URLConnection", "java.util.Iterator", "org.bukkit.Bukkit", "org.bukkit.plugin.PluginDescriptionFile" ]
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.Proxy; import java.net.URLConnection; import java.util.Iterator; import org.bukkit.Bukkit; import org.bukkit.plugin.PluginDescriptionFile;
import java.io.*; import java.net.*; import java.util.*; import org.bukkit.*; import org.bukkit.plugin.*;
[ "java.io", "java.net", "java.util", "org.bukkit", "org.bukkit.plugin" ]
java.io; java.net; java.util; org.bukkit; org.bukkit.plugin;
753,045
public PutIndexTemplateRequestBuilder setSource(BytesReference templateSource, XContentType xContentType) { request.source(templateSource, xContentType); return this; } /** * The template source definition. * @deprecated use {@link #setSource(BytesReference, XContentType)}
PutIndexTemplateRequestBuilder function(BytesReference templateSource, XContentType xContentType) { request.source(templateSource, xContentType); return this; } /** * The template source definition. * @deprecated use {@link #setSource(BytesReference, XContentType)}
/** * The template source definition. */
The template source definition
setSource
{ "repo_name": "strapdata/elassandra5-rc", "path": "core/src/main/java/org/elasticsearch/action/admin/indices/template/put/PutIndexTemplateRequestBuilder.java", "license": "apache-2.0", "size": 9687 }
[ "org.elasticsearch.common.bytes.BytesReference", "org.elasticsearch.common.xcontent.XContentType" ]
import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.common.bytes.*; import org.elasticsearch.common.xcontent.*;
[ "org.elasticsearch.common" ]
org.elasticsearch.common;
2,359,792
public static String getPhysicalFileFromResource(final String resource) throws IOException { final File file = File.createTempFile("tempfile", ".txt"); file.deleteOnExit(); final PrintWriter printWriter = new PrintWriter(file); printWriter.write(BaseTestQuery.getFile(resource)); printWriter.close(); return file.getPath(); }
static String function(final String resource) throws IOException { final File file = File.createTempFile(STR, ".txt"); file.deleteOnExit(); final PrintWriter printWriter = new PrintWriter(file); printWriter.write(BaseTestQuery.getFile(resource)); printWriter.close(); return file.getPath(); }
/** * Copy the resource (ex. file on classpath) to a physical file on FileSystem. * @param resource * @return the file path * @throws IOException */
Copy the resource (ex. file on classpath) to a physical file on FileSystem
getPhysicalFileFromResource
{ "repo_name": "dremio/dremio-oss", "path": "sabot/kernel/src/test/java/com/dremio/BaseTestQuery.java", "license": "apache-2.0", "size": 42649 }
[ "java.io.File", "java.io.IOException", "java.io.PrintWriter" ]
import java.io.File; import java.io.IOException; import java.io.PrintWriter;
import java.io.*;
[ "java.io" ]
java.io;
1,430,070
public EmailRequestStatus getStatus() { return status; }
EmailRequestStatus function() { return status; }
/** * Gets the email request status. * * @return the email request status. */
Gets the email request status
getStatus
{ "repo_name": "lorislab/appky", "path": "appky-application/src/main/java/org/lorislab/appky/application/model/EmailRequest.java", "license": "apache-2.0", "size": 4197 }
[ "org.lorislab.appky.application.model.enums.EmailRequestStatus" ]
import org.lorislab.appky.application.model.enums.EmailRequestStatus;
import org.lorislab.appky.application.model.enums.*;
[ "org.lorislab.appky" ]
org.lorislab.appky;
88,377
public final TopOfBookEventBuilder withBid(BidEvent inBid) { bid = inBid; return this; }
final TopOfBookEventBuilder function(BidEvent inBid) { bid = inBid; return this; }
/** * Sets the bid value. * * @param inBid a <code>BidEvent</code> value or <code>null</code> * @return a <code>TopOfBookEventBuilder</code> value */
Sets the bid value
withBid
{ "repo_name": "nagyist/marketcetera", "path": "trunk/core/src/main/java/org/marketcetera/event/impl/TopOfBookEventBuilder.java", "license": "apache-2.0", "size": 4574 }
[ "org.marketcetera.event.BidEvent" ]
import org.marketcetera.event.BidEvent;
import org.marketcetera.event.*;
[ "org.marketcetera.event" ]
org.marketcetera.event;
2,601,114
default SesEndpointBuilder replyToAddresses( List<String> replyToAddresses) { setProperty("replyToAddresses", replyToAddresses); return this; }
default SesEndpointBuilder replyToAddresses( List<String> replyToAddresses) { setProperty(STR, replyToAddresses); return this; }
/** * List of reply-to email address(es) for the message, override it using * 'CamelAwsSesReplyToAddresses' header. * * The option is a: <code>java.util.List&lt;java.lang.String&gt;</code> * type. * * Group: producer */
List of reply-to email address(es) for the message, override it using 'CamelAwsSesReplyToAddresses' header. The option is a: <code>java.util.List&lt;java.lang.String&gt;</code> type. Group: producer
replyToAddresses
{ "repo_name": "Fabryprog/camel", "path": "core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/SesEndpointBuilderFactory.java", "license": "apache-2.0", "size": 10440 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
911,524
Multimap<String, String> map = LinkedHashMultimap.create(); return parse(query, map); }
Multimap<String, String> map = LinkedHashMultimap.create(); return parse(query, map); }
/** * parse parameters from an url query string into a multidict * * @param query * @return */
parse parameters from an url query string into a multidict
parse
{ "repo_name": "mythguided/basis", "path": "basis-core/src/main/java/com/addthis/basis/util/MultidictUtil.java", "license": "apache-2.0", "size": 4618 }
[ "com.google.common.collect.LinkedHashMultimap", "com.google.common.collect.Multimap" ]
import com.google.common.collect.LinkedHashMultimap; import com.google.common.collect.Multimap;
import com.google.common.collect.*;
[ "com.google.common" ]
com.google.common;
237,740
EClass getInputOutputSpecification();
EClass getInputOutputSpecification();
/** * Returns the meta object for class '{@link org.eclipse.bpmn2.InputOutputSpecification <em>Input Output Specification</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>Input Output Specification</em>'. * @see org.eclipse.bpmn2.InputOutputSpecification * @generated */
Returns the meta object for class '<code>org.eclipse.bpmn2.InputOutputSpecification Input Output Specification</code>'.
getInputOutputSpecification
{ "repo_name": "lqjack/fixflow", "path": "modules/fixflow-core/src/main/java/org/eclipse/bpmn2/Bpmn2Package.java", "license": "apache-2.0", "size": 1014933 }
[ "org.eclipse.emf.ecore.EClass" ]
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,408,186
public Task.Status readTaskStatus() throws IOException { return readNamedWriteable(Task.Status.class); }
Task.Status function() throws IOException { return readNamedWriteable(Task.Status.class); }
/** * Reads a {@link Task.Status} from the current stream. */
Reads a <code>Task.Status</code> from the current stream
readTaskStatus
{ "repo_name": "strapdata/elassandra-test", "path": "core/src/main/java/org/elasticsearch/common/io/stream/StreamInput.java", "license": "apache-2.0", "size": 21079 }
[ "java.io.IOException", "org.elasticsearch.tasks.Task" ]
import java.io.IOException; import org.elasticsearch.tasks.Task;
import java.io.*; import org.elasticsearch.tasks.*;
[ "java.io", "org.elasticsearch.tasks" ]
java.io; org.elasticsearch.tasks;
1,344,535
private void addRequestQuestDialogue() { // Player asks for quest without having Klass's note apothecary.add(ConversationStates.ATTENDING, ConversationPhrases.QUEST_MESSAGES, new AndCondition( new NotCondition(new PlayerHasInfostringItemWithHimCondition("note", NOTE_INFOSTRING)), new QuestNotStartedCondition(questName)), ConversationStates.ATTENDING, "I'm sorry, but I'm much too busy right now. Perhaps you could talk to #Klaas.", null); // Player speaks to apothecary while carrying note. apothecary.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES, new AndCondition( new GreetingMatchesNameCondition(apothecary.getName()), new PlayerHasInfostringItemWithHimCondition("note", NOTE_INFOSTRING), new QuestNotStartedCondition(questName)), ConversationStates.QUEST_OFFERED, "Oh, a message from Klaas. Is that for me?", null); // Player explicitly requests "quest" while carrying note (in case note is dropped before speaking to apothecary). apothecary.add(ConversationStates.ATTENDING, ConversationPhrases.QUEST_MESSAGES, new AndCondition( new GreetingMatchesNameCondition(apothecary.getName()), new PlayerHasInfostringItemWithHimCondition("note", NOTE_INFOSTRING), new QuestNotStartedCondition(questName)), ConversationStates.QUEST_OFFERED, "Oh, a message from Klaas. Is that for me?", null); // Player accepts quest apothecary.add(ConversationStates.QUEST_OFFERED, ConversationPhrases.YES_MESSAGES, new PlayerHasInfostringItemWithHimCondition("note", NOTE_INFOSTRING), ConversationStates.ATTENDING, null, new MultipleActions( new SetQuestAction(questName, MIX_ITEMS), new IncreaseKarmaAction(5.0), new DropInfostringItemAction("note", NOTE_INFOSTRING), new SayRequiredItemsFromCollectionAction(questName, "Klaas has asked me to assist you. I can mix an antivenom that can be infused into a ring to increase its resistance to poison." + " I need you to bring me [items]. Do you have any of those with you?", false) ) ); // Player accepts quest but dropped note apothecary.add(ConversationStates.QUEST_OFFERED, ConversationPhrases.YES_MESSAGES, new AndCondition( new NotCondition(new QuestInStateCondition(questName, "ringmaker")), new NotCondition(new PlayerHasInfostringItemWithHimCondition("note", NOTE_INFOSTRING)) ), ConversationStates.ATTENDING, "Okay then, I will need you too... wait, where did that note go?", null ); // Player tries to leave without accepting/rejecting the quest apothecary.add(ConversationStates.QUEST_OFFERED, ConversationPhrases.GOODBYE_MESSAGES, null, ConversationStates.QUEST_OFFERED, "That is not a #yes or #no answer. I said, Is that note you are carrying for me?", null); // Player rejects quest apothecary.add(ConversationStates.QUEST_OFFERED, ConversationPhrases.NO_MESSAGES, null, // NPC walks away ConversationStates.IDLE, "Oh, well, carry on then.", new SetQuestAndModifyKarmaAction(questName, "rejected", -5.0)); }
void function() { apothecary.add(ConversationStates.ATTENDING, ConversationPhrases.QUEST_MESSAGES, new AndCondition( new NotCondition(new PlayerHasInfostringItemWithHimCondition("note", NOTE_INFOSTRING)), new QuestNotStartedCondition(questName)), ConversationStates.ATTENDING, STR, null); apothecary.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES, new AndCondition( new GreetingMatchesNameCondition(apothecary.getName()), new PlayerHasInfostringItemWithHimCondition("note", NOTE_INFOSTRING), new QuestNotStartedCondition(questName)), ConversationStates.QUEST_OFFERED, STR, null); apothecary.add(ConversationStates.ATTENDING, ConversationPhrases.QUEST_MESSAGES, new AndCondition( new GreetingMatchesNameCondition(apothecary.getName()), new PlayerHasInfostringItemWithHimCondition("note", NOTE_INFOSTRING), new QuestNotStartedCondition(questName)), ConversationStates.QUEST_OFFERED, STR, null); apothecary.add(ConversationStates.QUEST_OFFERED, ConversationPhrases.YES_MESSAGES, new PlayerHasInfostringItemWithHimCondition("note", NOTE_INFOSTRING), ConversationStates.ATTENDING, null, new MultipleActions( new SetQuestAction(questName, MIX_ITEMS), new IncreaseKarmaAction(5.0), new DropInfostringItemAction("note", NOTE_INFOSTRING), new SayRequiredItemsFromCollectionAction(questName, STR + STR, false) ) ); apothecary.add(ConversationStates.QUEST_OFFERED, ConversationPhrases.YES_MESSAGES, new AndCondition( new NotCondition(new QuestInStateCondition(questName, STR)), new NotCondition(new PlayerHasInfostringItemWithHimCondition("note", NOTE_INFOSTRING)) ), ConversationStates.ATTENDING, STR, null ); apothecary.add(ConversationStates.QUEST_OFFERED, ConversationPhrases.GOODBYE_MESSAGES, null, ConversationStates.QUEST_OFFERED, STR, null); apothecary.add(ConversationStates.QUEST_OFFERED, ConversationPhrases.NO_MESSAGES, null, ConversationStates.IDLE, STR, new SetQuestAndModifyKarmaAction(questName, STR, -5.0)); }
/** * Conversation states for NPC before quest is active. */
Conversation states for NPC before quest is active
addRequestQuestDialogue
{ "repo_name": "AntumDeluge/arianne-stendhal", "path": "src/games/stendhal/server/maps/quests/antivenom_ring/ApothecaryStage.java", "license": "gpl-2.0", "size": 17394 }
[ "games.stendhal.server.entity.npc.ConversationPhrases", "games.stendhal.server.entity.npc.ConversationStates", "games.stendhal.server.entity.npc.action.DropInfostringItemAction", "games.stendhal.server.entity.npc.action.IncreaseKarmaAction", "games.stendhal.server.entity.npc.action.MultipleActions", "games.stendhal.server.entity.npc.action.SayRequiredItemsFromCollectionAction", "games.stendhal.server.entity.npc.action.SetQuestAction", "games.stendhal.server.entity.npc.action.SetQuestAndModifyKarmaAction", "games.stendhal.server.entity.npc.condition.AndCondition", "games.stendhal.server.entity.npc.condition.GreetingMatchesNameCondition", "games.stendhal.server.entity.npc.condition.NotCondition", "games.stendhal.server.entity.npc.condition.PlayerHasInfostringItemWithHimCondition", "games.stendhal.server.entity.npc.condition.QuestInStateCondition", "games.stendhal.server.entity.npc.condition.QuestNotStartedCondition" ]
import games.stendhal.server.entity.npc.ConversationPhrases; import games.stendhal.server.entity.npc.ConversationStates; import games.stendhal.server.entity.npc.action.DropInfostringItemAction; import games.stendhal.server.entity.npc.action.IncreaseKarmaAction; import games.stendhal.server.entity.npc.action.MultipleActions; import games.stendhal.server.entity.npc.action.SayRequiredItemsFromCollectionAction; import games.stendhal.server.entity.npc.action.SetQuestAction; import games.stendhal.server.entity.npc.action.SetQuestAndModifyKarmaAction; import games.stendhal.server.entity.npc.condition.AndCondition; import games.stendhal.server.entity.npc.condition.GreetingMatchesNameCondition; import games.stendhal.server.entity.npc.condition.NotCondition; import games.stendhal.server.entity.npc.condition.PlayerHasInfostringItemWithHimCondition; import games.stendhal.server.entity.npc.condition.QuestInStateCondition; import games.stendhal.server.entity.npc.condition.QuestNotStartedCondition;
import games.stendhal.server.entity.npc.*; import games.stendhal.server.entity.npc.action.*; import games.stendhal.server.entity.npc.condition.*;
[ "games.stendhal.server" ]
games.stendhal.server;
296,254
public String execute() { String result; ScriptedPDFOverlayProcessor processor; Reader in; Iterable<CSVRecord> records; int row; result = null; // initialize groovy script processor = (ScriptedPDFOverlayProcessor) newInstance(m_Groovy, ScriptedPDFOverlayProcessor.class); if (processor == null) return "Failed to instantiate Groovy script: " + m_Groovy; // process spreadsheet try { in = new FileReader(m_Params); records = CSVFormat.EXCEL.withHeader().parse(in); row = 0; for (CSVRecord record : records) { row++; result = processor.overlay(m_PdfTemplate, row, record.toMap(), m_OutputDir); if (result != null) { result = "Failed to process row #" + row + ":\n" + result; break; } } } catch (Exception e) { result = "Failed to process!\n" + Utils.throwableToString(e); } return result; }
String function() { String result; ScriptedPDFOverlayProcessor processor; Reader in; Iterable<CSVRecord> records; int row; result = null; processor = (ScriptedPDFOverlayProcessor) newInstance(m_Groovy, ScriptedPDFOverlayProcessor.class); if (processor == null) return STR + m_Groovy; try { in = new FileReader(m_Params); records = CSVFormat.EXCEL.withHeader().parse(in); row = 0; for (CSVRecord record : records) { row++; result = processor.overlay(m_PdfTemplate, row, record.toMap(), m_OutputDir); if (result != null) { result = STR + row + ":\n" + result; break; } } } catch (Exception e) { result = STR + Utils.throwableToString(e); } return result; }
/** * Applies the groovy script to the PDF template, one time per row. * * @return null if successful, otherwise error message */
Applies the groovy script to the PDF template, one time per row
execute
{ "repo_name": "fracpete/fcms-doc-modifier", "path": "java/src/main/java/nz/ac/waikato/cms/doc/ScriptedPDFOverlay.java", "license": "gpl-3.0", "size": 9016 }
[ "java.io.FileReader", "java.io.Reader", "nz.ac.waikato.cms.core.Utils", "org.apache.commons.csv.CSVFormat", "org.apache.commons.csv.CSVRecord" ]
import java.io.FileReader; import java.io.Reader; import nz.ac.waikato.cms.core.Utils; import org.apache.commons.csv.CSVFormat; import org.apache.commons.csv.CSVRecord;
import java.io.*; import nz.ac.waikato.cms.core.*; import org.apache.commons.csv.*;
[ "java.io", "nz.ac.waikato", "org.apache.commons" ]
java.io; nz.ac.waikato; org.apache.commons;
990,496
public void actionPerformed (ActionEvent event) { Object source; Object[] selection; boolean valued; source = event.getSource (); if (source == mAttributeName) { selection = mAttributeName.getSelectedObjects (); if ((null != selection) && (0 != selection.length)) mFilter.setAttributeName ((String)selection[0]); } else if (source == mValued) { valued = mValued.isSelected (); if (valued) { mFilter.setAttributeValue (mAttributeValue.getText ()); mAttributeValue.setVisible (true); } else { mAttributeValue.setVisible (false); mAttributeValue.setText (""); mFilter.setAttributeValue (null); } } } // // DocumentListener interface //
void function (ActionEvent event) { Object source; Object[] selection; boolean valued; source = event.getSource (); if (source == mAttributeName) { selection = mAttributeName.getSelectedObjects (); if ((null != selection) && (0 != selection.length)) mFilter.setAttributeName ((String)selection[0]); } else if (source == mValued) { valued = mValued.isSelected (); if (valued) { mFilter.setAttributeValue (mAttributeValue.getText ()); mAttributeValue.setVisible (true); } else { mAttributeValue.setVisible (false); mAttributeValue.setText (""); mFilter.setAttributeValue (null); } } } //
/** * Invoked when an action occurs on the combo box. * @param event Details about the action event. */
Invoked when an action occurs on the combo box
actionPerformed
{ "repo_name": "patrickfav/tuwien", "path": "master/swt workspace/HTMLParser/src/org/htmlparser/parserapplications/filterbuilder/wrappers/HasAttributeFilterWrapper.java", "license": "apache-2.0", "size": 12932 }
[ "java.awt.event.ActionEvent" ]
import java.awt.event.ActionEvent;
import java.awt.event.*;
[ "java.awt" ]
java.awt;
1,790,365
private static short[] getUniquePositionVertexIndices(Mesh mesh) { FloatBuffer verticesBuffer = mesh.getVerticesBuffer(); int positionOffset = mesh.getVertexAttributes().findByUsage(VertexAttributes.Usage.Position).offset / 4; // Number of array elements which make up a vertex int vertexSize = mesh.getVertexSize() / 4; // The indices tell us which vertices are part of a triangle. short[] indices = new short[mesh.getNumIndices()]; mesh.getIndices(indices); // Marks true if an index has already been compared to avoid unnecessary comparisons Bits handledIndices = new Bits(mesh.getNumIndices()); for (int i = 0; i < indices.length; i++) { short indexI = indices[i]; if (handledIndices.get(indexI)) { // Index handled in an earlier iteration continue; } int vBufIndexI = indexI * vertexSize + positionOffset; float xi = verticesBuffer.get(vBufIndexI++); float yi = verticesBuffer.get(vBufIndexI++); float zi = verticesBuffer.get(vBufIndexI++); for (int j = i + 1; j < indices.length; j++) { short indexJ = indices[j]; int vBufIndexJ = indexJ * vertexSize + positionOffset; float xj = verticesBuffer.get(vBufIndexJ++); float yj = verticesBuffer.get(vBufIndexJ++); float zj = verticesBuffer.get(vBufIndexJ++); if (xi == xj && yi == yj && zi == zj) { indices[j] = indexI; } } handledIndices.set(indexI); } return indices; }
static short[] function(Mesh mesh) { FloatBuffer verticesBuffer = mesh.getVerticesBuffer(); int positionOffset = mesh.getVertexAttributes().findByUsage(VertexAttributes.Usage.Position).offset / 4; int vertexSize = mesh.getVertexSize() / 4; short[] indices = new short[mesh.getNumIndices()]; mesh.getIndices(indices); Bits handledIndices = new Bits(mesh.getNumIndices()); for (int i = 0; i < indices.length; i++) { short indexI = indices[i]; if (handledIndices.get(indexI)) { continue; } int vBufIndexI = indexI * vertexSize + positionOffset; float xi = verticesBuffer.get(vBufIndexI++); float yi = verticesBuffer.get(vBufIndexI++); float zi = verticesBuffer.get(vBufIndexI++); for (int j = i + 1; j < indices.length; j++) { short indexJ = indices[j]; int vBufIndexJ = indexJ * vertexSize + positionOffset; float xj = verticesBuffer.get(vBufIndexJ++); float yj = verticesBuffer.get(vBufIndexJ++); float zj = verticesBuffer.get(vBufIndexJ++); if (xi == xj && yi == yj && zi == zj) { indices[j] = indexI; } } handledIndices.set(indexI); } return indices; }
/** * Get an array of the vertex indices from the mesh. Any vertices which share the same position will be counted * as a single vertex and share the same index. That is, position duplicates will be filtered out. * * @param mesh * @return */
Get an array of the vertex indices from the mesh. Any vertices which share the same position will be counted as a single vertex and share the same index. That is, position duplicates will be filtered out
getUniquePositionVertexIndices
{ "repo_name": "jsjolund/GdxDemo3D", "path": "core/src/com/mygdx/game/pathfinding/NavMeshGraph.java", "license": "apache-2.0", "size": 16534 }
[ "com.badlogic.gdx.graphics.Mesh", "com.badlogic.gdx.graphics.VertexAttributes", "com.badlogic.gdx.utils.Bits", "java.nio.FloatBuffer" ]
import com.badlogic.gdx.graphics.Mesh; import com.badlogic.gdx.graphics.VertexAttributes; import com.badlogic.gdx.utils.Bits; import java.nio.FloatBuffer;
import com.badlogic.gdx.graphics.*; import com.badlogic.gdx.utils.*; import java.nio.*;
[ "com.badlogic.gdx", "java.nio" ]
com.badlogic.gdx; java.nio;
2,504,942
public KeyStore getCaCertKeystore() { try { KeyStore returnKeyStore = KeyStore.getInstance(KeyStore.getDefaultType()); returnKeyStore.load(null, null); Enumeration<String> e = CACertService.caCertKeystore.aliases(); while(e.hasMoreElements()) { Certificate cert = CACertService.caCertKeystore.getCertificate(e.nextElement()); returnKeyStore.setCertificateEntry(((X509Certificate) cert).getSubjectDN().toString(), cert); } return CACertService.caCertKeystore; } catch (KeyStoreException e) { return null; } catch (CertificateException e) { return null; } catch (NoSuchAlgorithmException e) { return null; } catch (IOException e) { return null; } }
KeyStore function() { try { KeyStore returnKeyStore = KeyStore.getInstance(KeyStore.getDefaultType()); returnKeyStore.load(null, null); Enumeration<String> e = CACertService.caCertKeystore.aliases(); while(e.hasMoreElements()) { Certificate cert = CACertService.caCertKeystore.getCertificate(e.nextElement()); returnKeyStore.setCertificateEntry(((X509Certificate) cert).getSubjectDN().toString(), cert); } return CACertService.caCertKeystore; } catch (KeyStoreException e) { return null; } catch (CertificateException e) { return null; } catch (NoSuchAlgorithmException e) { return null; } catch (IOException e) { return null; } }
/** * Get a copy of the currently loaded CA Certificate KeyStore * * @return Copy of currently loaded CA Certificate KeyStore */
Get a copy of the currently loaded CA Certificate KeyStore
getCaCertKeystore
{ "repo_name": "netkicorp/java-wns-resolver", "path": "src/main/java/com/netki/tlsa/CACertService.java", "license": "bsd-3-clause", "size": 2411 }
[ "java.io.IOException", "java.security.KeyStore", "java.security.KeyStoreException", "java.security.NoSuchAlgorithmException", "java.security.cert.Certificate", "java.security.cert.CertificateException", "java.security.cert.X509Certificate", "java.util.Enumeration" ]
import java.io.IOException; import java.security.KeyStore; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.security.cert.Certificate; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; import java.util.Enumeration;
import java.io.*; import java.security.*; import java.security.cert.*; import java.util.*;
[ "java.io", "java.security", "java.util" ]
java.io; java.security; java.util;
212,006
@Test public void testEntities() { // Check that the map of entities is empty assertEquals(0, controller.getEntities().size()); // Create a new VizObject with id 2 BasicController object = new BasicController(new BasicMesh(), new BasicView()); object.setProperty(MeshProperty.ID, "2"); // Add the object as a child controller.addEntity(object); // Check that the controller was notified assertTrue(controller.isUpdated()); // Check that the controller now has a map with one entity with id 2. assertEquals(1, controller.getEntities().size()); assertTrue("2".equals( controller.getEntities().get(0).getProperty(MeshProperty.ID))); // Create a new part with id 3 BasicController secondObject = new BasicController(new BasicMesh(), new BasicView()); secondObject.setProperty(MeshProperty.ID, "3"); // Add a second entity controller.addEntity(secondObject); // Check that the controller was notified assertTrue(controller.isUpdated()); // Check that there are two entities assertEquals(2, controller.getEntities().size()); // Remove one of the entities controller.removeEntity(object); // Wait for the notification thread try { Thread.sleep(50); } catch (InterruptedException e) { e.printStackTrace(); } // Check that the controller was notified assertTrue(controller.isUpdated()); List<IController> temp = controller.getEntities(); // Check that there is only one entity assertEquals(1, controller.getEntities().size()); // Check that empty categories return empty lists assertNotNull(controller.getEntitiesFromCategory(MeshCategory.FACES)); assertEquals(0, controller.getEntitiesFromCategory(MeshCategory.FACES).size()); }
void function() { assertEquals(0, controller.getEntities().size()); BasicController object = new BasicController(new BasicMesh(), new BasicView()); object.setProperty(MeshProperty.ID, "2"); controller.addEntity(object); assertTrue(controller.isUpdated()); assertEquals(1, controller.getEntities().size()); assertTrue("2".equals( controller.getEntities().get(0).getProperty(MeshProperty.ID))); BasicController secondObject = new BasicController(new BasicMesh(), new BasicView()); secondObject.setProperty(MeshProperty.ID, "3"); controller.addEntity(secondObject); assertTrue(controller.isUpdated()); assertEquals(2, controller.getEntities().size()); controller.removeEntity(object); try { Thread.sleep(50); } catch (InterruptedException e) { e.printStackTrace(); } assertTrue(controller.isUpdated()); List<IController> temp = controller.getEntities(); assertEquals(1, controller.getEntities().size()); assertNotNull(controller.getEntitiesFromCategory(MeshCategory.FACES)); assertEquals(0, controller.getEntitiesFromCategory(MeshCategory.FACES).size()); }
/** * Tests the state of the entities list as objects are added and removed, as * well as whether objects in it are sending proper notifications. */
Tests the state of the entities list as objects are added and removed, as well as whether objects in it are sending proper notifications
testEntities
{ "repo_name": "eclipse/eavp", "path": "org.eclipse.eavp.tests.viz.modeling/src/org/eclipse/eavp/tests/viz/modeling/BasicControllerTester.java", "license": "epl-1.0", "size": 14929 }
[ "java.util.List", "org.eclipse.eavp.viz.modeling.base.BasicController", "org.eclipse.eavp.viz.modeling.base.BasicMesh", "org.eclipse.eavp.viz.modeling.base.BasicView", "org.eclipse.eavp.viz.modeling.base.IController", "org.eclipse.eavp.viz.modeling.properties.MeshCategory", "org.eclipse.eavp.viz.modeling.properties.MeshProperty", "org.junit.Assert" ]
import java.util.List; import org.eclipse.eavp.viz.modeling.base.BasicController; import org.eclipse.eavp.viz.modeling.base.BasicMesh; import org.eclipse.eavp.viz.modeling.base.BasicView; import org.eclipse.eavp.viz.modeling.base.IController; import org.eclipse.eavp.viz.modeling.properties.MeshCategory; import org.eclipse.eavp.viz.modeling.properties.MeshProperty; import org.junit.Assert;
import java.util.*; import org.eclipse.eavp.viz.modeling.base.*; import org.eclipse.eavp.viz.modeling.properties.*; import org.junit.*;
[ "java.util", "org.eclipse.eavp", "org.junit" ]
java.util; org.eclipse.eavp; org.junit;
2,191,356
boolean all(FunctionExpression<Predicate1<TSource>> predicate);
boolean all(FunctionExpression<Predicate1<TSource>> predicate);
/** * Determines whether all the elements of a sequence * satisfy a condition. */
Determines whether all the elements of a sequence satisfy a condition
all
{ "repo_name": "YrAuYong/incubator-calcite", "path": "linq4j/src/main/java/org/apache/calcite/linq4j/ExtendedQueryable.java", "license": "apache-2.0", "size": 25225 }
[ "org.apache.calcite.linq4j.function.Predicate1", "org.apache.calcite.linq4j.tree.FunctionExpression" ]
import org.apache.calcite.linq4j.function.Predicate1; import org.apache.calcite.linq4j.tree.FunctionExpression;
import org.apache.calcite.linq4j.function.*; import org.apache.calcite.linq4j.tree.*;
[ "org.apache.calcite" ]
org.apache.calcite;
966,383
public void addColumn(String title, Function<Object, String> formatter, Alignment alignment) { columnTitles.add(title); columnFormatters.add(formatter); columnAlignments.add(alignment); columnValueMaxWidths.add(title.length()); }
void function(String title, Function<Object, String> formatter, Alignment alignment) { columnTitles.add(title); columnFormatters.add(formatter); columnAlignments.add(alignment); columnValueMaxWidths.add(title.length()); }
/** * Add a column specification to the Table, consisting of a title (or header) for the column, a formatting * {@link Function} to format a data {@link Object} belonging to the column to a String, and an {@link Alignment}. * <p> * @param title the column header * @param formatter a {@link Function} which maps data {@link Object}s in this column to Strings * @param alignment the alignment for the column in the output */
Add a column specification to the Table, consisting of a title (or header) for the column, a formatting <code>Function</code> to format a data <code>Object</code> belonging to the column to a String, and an <code>Alignment</code>.
addColumn
{ "repo_name": "nitsanw/honest-profiler", "path": "src/main/java/com/insightfullogic/honest_profiler/ports/javafx/util/report/Table.java", "license": "mit", "size": 6861 }
[ "java.util.function.Function" ]
import java.util.function.Function;
import java.util.function.*;
[ "java.util" ]
java.util;
1,957,230
public static <T> void register(ReferenceType refType, ObjectName name, Class<T> mbeanInterface, T object) { try { register(refType, JMXHelper.getHeliosMBeanServer(), name, mbeanInterface, object); } catch (Exception ex) { throw new RuntimeException(ex); } } private MBeanProxyBuilder() {}
static <T> void function(ReferenceType refType, ObjectName name, Class<T> mbeanInterface, T object) { try { register(refType, JMXHelper.getHeliosMBeanServer(), name, mbeanInterface, object); } catch (Exception ex) { throw new RuntimeException(ex); } } private MBeanProxyBuilder() {}
/** * Creates a proxy MBean and registers it to the default MBeanServer, overriding the * existing mbean if necessary. * @param refType The reference type to store the actual impl * @param name The name under which the MBean will be registered * @param mbeanInterface MBean interface to be exposed * @param object MBean instance to be exposed */
Creates a proxy MBean and registers it to the default MBeanServer, overriding the existing mbean if necessary
register
{ "repo_name": "nickman/heliosutils", "path": "src/main/java/com/heliosapm/utils/ref/MBeanProxyBuilder.java", "license": "apache-2.0", "size": 6008 }
[ "com.heliosapm.utils.jmx.JMXHelper", "com.heliosapm.utils.ref.ReferenceService", "javax.management.ObjectName" ]
import com.heliosapm.utils.jmx.JMXHelper; import com.heliosapm.utils.ref.ReferenceService; import javax.management.ObjectName;
import com.heliosapm.utils.jmx.*; import com.heliosapm.utils.ref.*; import javax.management.*;
[ "com.heliosapm.utils", "javax.management" ]
com.heliosapm.utils; javax.management;
1,051,398
private List<IWorker<ITestNGMethod>> createClassBasedParallelWorkers(List<ITestNGMethod> methods) { List<IWorker<ITestNGMethod>> result = Lists.newArrayList(); // Methods that belong to classes with a sequential=true or parallel=classes // attribute must all be run in the same worker Set<Class> sequentialClasses = Sets.newHashSet(); for (ITestNGMethod m : methods) { Class<? extends ITestClass> cls = m.getRealClass(); org.testng.annotations.ITestAnnotation test = m_annotationFinder.findAnnotation(cls, org.testng.annotations.ITestAnnotation.class); // If either sequential=true or parallel=classes, mark this class sequential if (test != null && (test.getSequential() || test.getSingleThreaded()) || XmlSuite.PARALLEL_CLASSES.equals(m_xmlTest.getParallel())) { sequentialClasses.add(cls); } } List<IMethodInstance> methodInstances = Lists.newArrayList(); for (ITestNGMethod tm : methods) { methodInstances.addAll(methodsToMultipleMethodInstances(tm)); } // // Finally, sort the parallel methods by classes // methodInstances = m_methodInterceptor.intercept(methodInstances, this); Map<String, String> params = m_xmlTest.getAllParameters(); Set<Class<?>> processedClasses = Sets.newHashSet(); for (IMethodInstance im : methodInstances) { Class<?> c = im.getMethod().getTestClass().getRealClass(); if (sequentialClasses.contains(c)) { if (!processedClasses.contains(c)) { processedClasses.add(c); if (System.getProperty("experimental") != null) { List<List<IMethodInstance>> instances = createInstances(methodInstances); for (List<IMethodInstance> inst : instances) { TestMethodWorker worker = createTestMethodWorker(inst, params, c); result.add(worker); } } else { // Sequential class: all methods in one worker TestMethodWorker worker = createTestMethodWorker(methodInstances, params, c); result.add(worker); } } } else { // Parallel class: each method in its own worker TestMethodWorker worker = createTestMethodWorker(Arrays.asList(im), params, c); result.add(worker); } } // Sort by priorities Collections.sort(result); return result; }
List<IWorker<ITestNGMethod>> function(List<ITestNGMethod> methods) { List<IWorker<ITestNGMethod>> result = Lists.newArrayList(); Set<Class> sequentialClasses = Sets.newHashSet(); for (ITestNGMethod m : methods) { Class<? extends ITestClass> cls = m.getRealClass(); org.testng.annotations.ITestAnnotation test = m_annotationFinder.findAnnotation(cls, org.testng.annotations.ITestAnnotation.class); if (test != null && (test.getSequential() test.getSingleThreaded()) XmlSuite.PARALLEL_CLASSES.equals(m_xmlTest.getParallel())) { sequentialClasses.add(cls); } } List<IMethodInstance> methodInstances = Lists.newArrayList(); for (ITestNGMethod tm : methods) { methodInstances.addAll(methodsToMultipleMethodInstances(tm)); } Map<String, String> params = m_xmlTest.getAllParameters(); Set<Class<?>> processedClasses = Sets.newHashSet(); for (IMethodInstance im : methodInstances) { Class<?> c = im.getMethod().getTestClass().getRealClass(); if (sequentialClasses.contains(c)) { if (!processedClasses.contains(c)) { processedClasses.add(c); if (System.getProperty(STR) != null) { List<List<IMethodInstance>> instances = createInstances(methodInstances); for (List<IMethodInstance> inst : instances) { TestMethodWorker worker = createTestMethodWorker(inst, params, c); result.add(worker); } } else { TestMethodWorker worker = createTestMethodWorker(methodInstances, params, c); result.add(worker); } } } else { TestMethodWorker worker = createTestMethodWorker(Arrays.asList(im), params, c); result.add(worker); } } Collections.sort(result); return result; }
/** * Create workers for parallel="classes" and similar cases. */
Create workers for parallel="classes" and similar cases
createClassBasedParallelWorkers
{ "repo_name": "tremes/testng", "path": "src/main/java/org/testng/TestRunner.java", "license": "apache-2.0", "size": 53629 }
[ "java.util.Arrays", "java.util.Collections", "java.util.List", "java.util.Map", "java.util.Set", "org.testng.collections.Lists", "org.testng.internal.TestMethodWorker", "org.testng.internal.annotations.Sets", "org.testng.internal.thread.graph.IWorker", "org.testng.xml.XmlSuite" ]
import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Set; import org.testng.collections.Lists; import org.testng.internal.TestMethodWorker; import org.testng.internal.annotations.Sets; import org.testng.internal.thread.graph.IWorker; import org.testng.xml.XmlSuite;
import java.util.*; import org.testng.collections.*; import org.testng.internal.*; import org.testng.internal.annotations.*; import org.testng.internal.thread.graph.*; import org.testng.xml.*;
[ "java.util", "org.testng.collections", "org.testng.internal", "org.testng.xml" ]
java.util; org.testng.collections; org.testng.internal; org.testng.xml;
1,214,751
public static AllClassesMatch newMatch(final EClass pCls) { return new Immutable(pCls); } private static final class Mutable extends AllClassesMatch { Mutable(final EClass pCls) { super(pCls); }
static AllClassesMatch function(final EClass pCls) { return new Immutable(pCls); } private static final class Mutable extends AllClassesMatch { Mutable(final EClass pCls) { super(pCls); }
/** * Returns a new (partial) match. * This can be used e.g. to call the matcher with a partial match. * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. * @param pCls the fixed value of pattern parameter cls, or null if not bound. * @return the (partial) match object. * */
Returns a new (partial) match. This can be used e.g. to call the matcher with a partial match. The returned match will be immutable. Use <code>#newEmptyMatch()</code> to obtain a mutable match object
newMatch
{ "repo_name": "upohl/eloquent", "path": "tests/org.muml.eloquent.ocl.vql.tests/src-gen/org/muml/eloquent/ocl/vql/tests/fixtures/AllClassesMatch.java", "license": "epl-1.0", "size": 5426 }
[ "org.eclipse.emf.ecore.EClass" ]
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,162,266
public ReceivedsResult getReportReceiveds(String msgIds) throws APIConnectionException, APIRequestException { return _reportClient.getReceiveds(msgIds); }
ReceivedsResult function(String msgIds) throws APIConnectionException, APIRequestException { return _reportClient.getReceiveds(msgIds); }
/** * Get received report. * * @param msgIds 100 msgids to batch getting is supported. * @return ReceivedResult. Can be printed to JSON. * @throws cn.jpush.api.common.APIConnectionException * @throws cn.jpush.api.common.APIRequestException */
Get received report
getReportReceiveds
{ "repo_name": "Casper3635/Student_Register", "path": "newStudent/src/cn/jpush/api/JPushClient.java", "license": "apache-2.0", "size": 10334 }
[ "cn.jpush.api.common.APIConnectionException", "cn.jpush.api.common.APIRequestException", "cn.jpush.api.report.ReceivedsResult" ]
import cn.jpush.api.common.APIConnectionException; import cn.jpush.api.common.APIRequestException; import cn.jpush.api.report.ReceivedsResult;
import cn.jpush.api.common.*; import cn.jpush.api.report.*;
[ "cn.jpush.api" ]
cn.jpush.api;
291,180
public static File getResourceSource(ClassLoader c, String resource) { if (c == null) { c = Locator.class.getClassLoader(); } URL url = null; if (c == null) { url = ClassLoader.getSystemResource(resource); } else { url = c.getResource(resource); } if (url != null) { String u = url.toString(); if (u.startsWith("jar:file:")) { int pling = u.indexOf("!"); String jarName = u.substring(4, pling); return new File(fromURI(jarName)); } else if (u.startsWith("file:")) { int tail = u.indexOf(resource); String dirName = u.substring(0, tail); return new File(fromURI(dirName)); } } return null; }
static File function(ClassLoader c, String resource) { if (c == null) { c = Locator.class.getClassLoader(); } URL url = null; if (c == null) { url = ClassLoader.getSystemResource(resource); } else { url = c.getResource(resource); } if (url != null) { String u = url.toString(); if (u.startsWith(STR)) { int pling = u.indexOf("!"); String jarName = u.substring(4, pling); return new File(fromURI(jarName)); } else if (u.startsWith("file:")) { int tail = u.indexOf(resource); String dirName = u.substring(0, tail); return new File(fromURI(dirName)); } } return null; }
/** * Find the directory or jar a give resource has been loaded from. * * @param c * the classloader to be consulted for the source * @param resource * the resource whose location is required. * * @return the file with the resource source or null if we cannot determine * the location. * * @since Ant 1.6 */
Find the directory or jar a give resource has been loaded from
getResourceSource
{ "repo_name": "Top-Q/jsystem", "path": "jsystem-core-projects/jsystem-launcher/src/main/java/jsystem/framework/launcher/Locator.java", "license": "apache-2.0", "size": 8154 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
12,283
protected boolean setException(Throwable throwable) { boolean result = sync.setException(checkNotNull(throwable)); if (result) { executionList.execute(); } // If it's an Error, we want to make sure it reaches the top of the // call stack, so we rethrow it. if (throwable instanceof Error) { throw (Error) throwable; } return result; } static final class Sync<V> extends AbstractQueuedSynchronizer { private static final long serialVersionUID = 0L; static final int RUNNING = 0; static final int COMPLETING = 1; static final int COMPLETED = 2; static final int CANCELLED = 4; private V value; private Throwable exception;
boolean function(Throwable throwable) { boolean result = sync.setException(checkNotNull(throwable)); if (result) { executionList.execute(); } if (throwable instanceof Error) { throw (Error) throwable; } return result; } static final class Sync<V> extends AbstractQueuedSynchronizer { private static final long serialVersionUID = 0L; static final int RUNNING = 0; static final int COMPLETING = 1; static final int COMPLETED = 2; static final int CANCELLED = 4; private V value; private Throwable exception;
/** * Subclasses should invoke this method to set the result of the computation * to an error, {@code throwable}. This will set the state of the future to * {@link AbstractFuture.Sync#COMPLETED} and invoke the listeners if the * state was successfully changed. * * @param throwable the exception that the task failed with. * @return true if the state was successfully changed. * @throws Error if the throwable was an {@link Error}. */
Subclasses should invoke this method to set the result of the computation to an error, throwable. This will set the state of the future to <code>AbstractFuture.Sync#COMPLETED</code> and invoke the listeners if the state was successfully changed
setException
{ "repo_name": "lowasser/guava-experimental", "path": "guava/src/com/google/common/util/concurrent/AbstractFuture.java", "license": "apache-2.0", "size": 12579 }
[ "java.util.concurrent.locks.AbstractQueuedSynchronizer" ]
import java.util.concurrent.locks.AbstractQueuedSynchronizer;
import java.util.concurrent.locks.*;
[ "java.util" ]
java.util;
785,273
@ReflectiveMethod(name = "b", types = {NMSBaseBlockPosition.class}) public NMSBlockPosition b(NMSBaseBlockPosition baseBlockPosition){ return new NMSBlockPosition(NMSWrapper.getInstance().exec(nmsObject, baseBlockPosition)); }
@ReflectiveMethod(name = "b", types = {NMSBaseBlockPosition.class}) NMSBlockPosition function(NMSBaseBlockPosition baseBlockPosition){ return new NMSBlockPosition(NMSWrapper.getInstance().exec(nmsObject, baseBlockPosition)); }
/** * TODO Find correct name * @see net.minecraft.server.v1_9_R1.BlockPosition#b(net.minecraft.server.v1_9_R1.BaseBlockPosition) */
TODO Find correct name
b
{ "repo_name": "Vilsol/NMSWrapper", "path": "src/main/java/me/vilsol/nmswrapper/wraps/unparsed/NMSBlockPosition.java", "license": "apache-2.0", "size": 5469 }
[ "me.vilsol.nmswrapper.NMSWrapper", "me.vilsol.nmswrapper.reflections.ReflectiveMethod" ]
import me.vilsol.nmswrapper.NMSWrapper; import me.vilsol.nmswrapper.reflections.ReflectiveMethod;
import me.vilsol.nmswrapper.*; import me.vilsol.nmswrapper.reflections.*;
[ "me.vilsol.nmswrapper" ]
me.vilsol.nmswrapper;
1,684,912
private static List<Element> getChildrenByName(Element el, String childName) { NodeList children = el.getChildNodes(); List<Element> elements = new ArrayList<>(28); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if (child.getNodeType() == Node.ELEMENT_NODE && child.getNodeName().equals(childName)) { elements.add((Element) child); } } return elements; }
static List<Element> function(Element el, String childName) { NodeList children = el.getChildNodes(); List<Element> elements = new ArrayList<>(28); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if (child.getNodeType() == Node.ELEMENT_NODE && child.getNodeName().equals(childName)) { elements.add((Element) child); } } return elements; }
/** * Retrieve all children whose are elements and whose names equal the given * name This returns an empty list if no children whose names match are * found * * @param el * @param childName * @return */
Retrieve all children whose are elements and whose names equal the given name This returns an empty list if no children whose names match are found
getChildrenByName
{ "repo_name": "peeyushsahu/PubMedMiner", "path": "src/main/java/de/unibonn/vishal/pubmed/PubMedFetcher.java", "license": "gpl-2.0", "size": 10512 }
[ "java.util.ArrayList", "java.util.List", "org.w3c.dom.Element", "org.w3c.dom.Node", "org.w3c.dom.NodeList" ]
import java.util.ArrayList; import java.util.List; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList;
import java.util.*; import org.w3c.dom.*;
[ "java.util", "org.w3c.dom" ]
java.util; org.w3c.dom;
297,115
@SuppressWarnings("unchecked") // SelfExtractor has no generics public static List<ProductRequirementInformation> createFromAppliesTo(String appliesTo) { if (appliesTo == null || appliesTo.isEmpty()) { throw new InvalidParameterException("Applies to must be set to a valid value but is " + appliesTo); } List<ProductRequirementInformation> products = new ArrayList<ProductRequirementInformation>(); List<ProductMatch> matchers = SelfExtractor.parseAppliesTo(appliesTo); for (ProductMatch match : matchers) { // All product must have their ID set so this should always produce a valid filter string String productId = match.getProductId(); String version = match.getVersion(); final String versionRange; if (version != null && version.endsWith("+")) { versionRange = version.substring(0, version.length() - 1); } else { if (version != null) { versionRange = Character.toString(VersionRange.LEFT_CLOSED) + version + ", " + version + Character.toString(VersionRange.RIGHT_CLOSED); } else { versionRange = null; } } String installType = match.getInstallType(); String licenseType = match.getLicenseType(); // The editions is a list of strings List<String> editions = match.getEditions(); products.add(new ProductRequirementInformation(versionRange, productId, installType, licenseType, editions)); } return products; }
@SuppressWarnings(STR) static List<ProductRequirementInformation> function(String appliesTo) { if (appliesTo == null appliesTo.isEmpty()) { throw new InvalidParameterException(STR + appliesTo); } List<ProductRequirementInformation> products = new ArrayList<ProductRequirementInformation>(); List<ProductMatch> matchers = SelfExtractor.parseAppliesTo(appliesTo); for (ProductMatch match : matchers) { String productId = match.getProductId(); String version = match.getVersion(); final String versionRange; if (version != null && version.endsWith("+")) { versionRange = version.substring(0, version.length() - 1); } else { if (version != null) { versionRange = Character.toString(VersionRange.LEFT_CLOSED) + version + STR + version + Character.toString(VersionRange.RIGHT_CLOSED); } else { versionRange = null; } } String installType = match.getInstallType(); String licenseType = match.getLicenseType(); List<String> editions = match.getEditions(); products.add(new ProductRequirementInformation(versionRange, productId, installType, licenseType, editions)); } return products; }
/** * Parse an appliesTo string to produce a list of product requirements * * @param appliesTo the appliesTo string * @return the product requirements information */
Parse an appliesTo string to produce a list of product requirements
createFromAppliesTo
{ "repo_name": "OpenLiberty/open-liberty", "path": "dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/ProductRequirementInformation.java", "license": "epl-1.0", "size": 6546 }
[ "java.security.InvalidParameterException", "java.util.ArrayList", "java.util.List", "org.osgi.framework.VersionRange" ]
import java.security.InvalidParameterException; import java.util.ArrayList; import java.util.List; import org.osgi.framework.VersionRange;
import java.security.*; import java.util.*; import org.osgi.framework.*;
[ "java.security", "java.util", "org.osgi.framework" ]
java.security; java.util; org.osgi.framework;
383,641
public static <T> void writeNullableList(List<T> items, ObjectDataOutput out) throws IOException { writeNullableCollection(items, out); } /** * Writes a collection to an {@link ObjectDataOutput}. The collection's size is written * to the data output, then each object in the collection is serialized. * * @param items collection of items to be serialized * @param out data output to write to * @param <T> type of items * @throws NullPointerException if {@code items} or {@code out} is {@code null}
static <T> void function(List<T> items, ObjectDataOutput out) throws IOException { writeNullableCollection(items, out); } /** * Writes a collection to an {@link ObjectDataOutput}. The collection's size is written * to the data output, then each object in the collection is serialized. * * @param items collection of items to be serialized * @param out data output to write to * @param <T> type of items * @throws NullPointerException if {@code items} or {@code out} is {@code null}
/** * Writes a list to an {@link ObjectDataOutput}. The list's size is written * to the data output, then each object in the list is serialized. * The list is allowed to be null. * * @param items list of items to be serialized * @param out data output to write to * @param <T> type of items * @throws IOException when an error occurs while writing to the output */
Writes a list to an <code>ObjectDataOutput</code>. The list's size is written to the data output, then each object in the list is serialized. The list is allowed to be null
writeNullableList
{ "repo_name": "mdogan/hazelcast", "path": "hazelcast/src/main/java/com/hazelcast/internal/serialization/impl/SerializationUtil.java", "license": "apache-2.0", "size": 16747 }
[ "com.hazelcast.nio.ObjectDataOutput", "java.io.IOException", "java.util.List" ]
import com.hazelcast.nio.ObjectDataOutput; import java.io.IOException; import java.util.List;
import com.hazelcast.nio.*; import java.io.*; import java.util.*;
[ "com.hazelcast.nio", "java.io", "java.util" ]
com.hazelcast.nio; java.io; java.util;
2,178,561
@Test public void translate() { Transform t = new Transform(); t.translate(2, -1); t.translate(4, 4); TestCase.assertEquals(6.000, t.getTranslationX(), 1.0e-3); TestCase.assertEquals(3.000, t.getTranslationY(), 1.0e-3); }
void function() { Transform t = new Transform(); t.translate(2, -1); t.translate(4, 4); TestCase.assertEquals(6.000, t.getTranslationX(), 1.0e-3); TestCase.assertEquals(3.000, t.getTranslationY(), 1.0e-3); }
/** * Test the translate method. */
Test the translate method
translate
{ "repo_name": "dmitrykolesnikovich/dyn4j", "path": "junit/org/dyn4j/geometry/TransformTest.java", "license": "bsd-3-clause", "size": 11890 }
[ "junit.framework.TestCase" ]
import junit.framework.TestCase;
import junit.framework.*;
[ "junit.framework" ]
junit.framework;
1,363,890
public ServiceFuture<ManagedClusterInner> getByResourceGroupAsync(String resourceGroupName, String resourceName, final ServiceCallback<ManagedClusterInner> serviceCallback) { return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); }
ServiceFuture<ManagedClusterInner> function(String resourceGroupName, String resourceName, final ServiceCallback<ManagedClusterInner> serviceCallback) { return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); }
/** * Gets a managed cluster. * Gets the details of the managed cluster with a specified resource group and name. * * @param resourceGroupName The name of the resource group. * @param resourceName The name of the managed cluster resource. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */
Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name
getByResourceGroupAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/containerservice/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_06_01/implementation/ManagedClustersInner.java", "license": "mit", "size": 126956 }
[ "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;
214,193
@Override public Iterator<RoadSegment> iterator() { return roadSegments.iterator(); }
Iterator<RoadSegment> function() { return roadSegments.iterator(); }
/** * Returns an iterator over all the road segments in the road network. * * @return an iterator over all the road segments in the road network */
Returns an iterator over all the road segments in the road network
iterator
{ "repo_name": "popikyardo/movsim-extended", "path": "core/src/main/java/org/movsim/simulator/roadnetwork/RoadNetwork.java", "license": "gpl-3.0", "size": 14268 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
2,834,894
@Override public void exitExprRemove(@NotNull QueryGrammarParser.ExprRemoveContext ctx) { }
@Override public void exitExprRemove(@NotNull QueryGrammarParser.ExprRemoveContext ctx) { }
/** * {@inheritDoc} * <p/> * The default implementation does nothing. */
The default implementation does nothing
enterExprRemove
{ "repo_name": "pmeisen/dis-timeintervaldataanalyzer", "path": "src/net/meisen/dissertation/impl/parser/query/generated/QueryGrammarBaseListener.java", "license": "bsd-3-clause", "size": 33327 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
1,760,934