method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public List<LaunchConfiguration> describeLaunchConfigurations(String... names) { if (names == null || names.length == 0) { LOGGER.info(String.format("Getting all launch configurations in region %s.", region)); } else { LOGGER.info(String.format("Getting launch configurations for %d names in region %s.", names.length, region)); } List<LaunchConfiguration> lcs = new LinkedList<LaunchConfiguration>(); AmazonAutoScalingClient asgClient = asgClient(); DescribeLaunchConfigurationsRequest request = new DescribeLaunchConfigurationsRequest() .withLaunchConfigurationNames(names); DescribeLaunchConfigurationsResult result = asgClient.describeLaunchConfigurations(request); lcs.addAll(result.getLaunchConfigurations()); while (result.getNextToken() != null) { request.setNextToken(result.getNextToken()); result = asgClient.describeLaunchConfigurations(request); lcs.addAll(result.getLaunchConfigurations()); } LOGGER.info(String.format("Got %d launch configurations in region %s.", lcs.size(), region)); return lcs; }
List<LaunchConfiguration> function(String... names) { if (names == null names.length == 0) { LOGGER.info(String.format(STR, region)); } else { LOGGER.info(String.format(STR, names.length, region)); } List<LaunchConfiguration> lcs = new LinkedList<LaunchConfiguration>(); AmazonAutoScalingClient asgClient = asgClient(); DescribeLaunchConfigurationsRequest request = new DescribeLaunchConfigurationsRequest() .withLaunchConfigurationNames(names); DescribeLaunchConfigurationsResult result = asgClient.describeLaunchConfigurations(request); lcs.addAll(result.getLaunchConfigurations()); while (result.getNextToken() != null) { request.setNextToken(result.getNextToken()); result = asgClient.describeLaunchConfigurations(request); lcs.addAll(result.getLaunchConfigurations()); } LOGGER.info(String.format(STR, lcs.size(), region)); return lcs; }
/** * Describe a set of specific launch configurations. * * @param names the launch configuration names * @return the launch configurations */
Describe a set of specific launch configurations
describeLaunchConfigurations
{ "repo_name": "agilemobiledev/SimianArmy", "path": "src/main/java/com/netflix/simianarmy/client/aws/AWSClient.java", "license": "apache-2.0", "size": 19195 }
[ "com.amazonaws.services.autoscaling.AmazonAutoScalingClient", "com.amazonaws.services.autoscaling.model.DescribeLaunchConfigurationsRequest", "com.amazonaws.services.autoscaling.model.DescribeLaunchConfigurationsResult", "com.amazonaws.services.autoscaling.model.LaunchConfiguration", "java.util.LinkedList", "java.util.List" ]
import com.amazonaws.services.autoscaling.AmazonAutoScalingClient; import com.amazonaws.services.autoscaling.model.DescribeLaunchConfigurationsRequest; import com.amazonaws.services.autoscaling.model.DescribeLaunchConfigurationsResult; import com.amazonaws.services.autoscaling.model.LaunchConfiguration; import java.util.LinkedList; import java.util.List;
import com.amazonaws.services.autoscaling.*; import com.amazonaws.services.autoscaling.model.*; import java.util.*;
[ "com.amazonaws.services", "java.util" ]
com.amazonaws.services; java.util;
442,706
public Bucket bucket(String name) { checkArgument(!Strings.isNullOrEmpty(name), "Bucket name not specified. Specify the bucket name via the storageBucket " + "option when initializing the app, or specify the bucket name explicitly when " + "calling the getBucket() method."); Bucket bucket = storage.get(name); checkArgument(bucket != null, "Bucket " + name + " does not exist."); return bucket; } private static final String SERVICE_ID = StorageClient.class.getName(); private static class StorageClientService extends FirebaseService<StorageClient> { StorageClientService(StorageClient client) { super(SERVICE_ID, client); } }
Bucket function(String name) { checkArgument(!Strings.isNullOrEmpty(name), STR + STR + STR); Bucket bucket = storage.get(name); checkArgument(bucket != null, STR + name + STR); return bucket; } private static final String SERVICE_ID = StorageClient.class.getName(); private static class StorageClientService extends FirebaseService<StorageClient> { StorageClientService(StorageClient client) { super(SERVICE_ID, client); } }
/** * Returns a cloud storage Bucket instance for the specified bucket name. * * @param name a non-null, non-empty bucket name. * @return a cloud storage <a href="https://googlecloudplatform.github.io/google-cloud-java/latest/google-cloud-clients/com/google/cloud/storage/Bucket.html">{@code Bucket}</a> * instance. * @throws IllegalArgumentException If the bucket name is null, empty, or if the specified * bucket does not exist. */
Returns a cloud storage Bucket instance for the specified bucket name
bucket
{ "repo_name": "firebase/firebase-admin-java", "path": "src/main/java/com/google/firebase/cloud/StorageClient.java", "license": "apache-2.0", "size": 4577 }
[ "com.google.cloud.storage.Bucket", "com.google.common.base.Preconditions", "com.google.common.base.Strings", "com.google.firebase.internal.FirebaseService" ]
import com.google.cloud.storage.Bucket; import com.google.common.base.Preconditions; import com.google.common.base.Strings; import com.google.firebase.internal.FirebaseService;
import com.google.cloud.storage.*; import com.google.common.base.*; import com.google.firebase.internal.*;
[ "com.google.cloud", "com.google.common", "com.google.firebase" ]
com.google.cloud; com.google.common; com.google.firebase;
718,655
protected Builder getRequestBuilderForPath(String endpointPath, MultivaluedMap<String,?> queryParams) { WebTarget t = client.target("http://" + this.host + ":" + this.port + API_DEPLOY_PATH) .path(endpointPath) .queryParam("format", "json"); // Add in custom-defined query params. if(queryParams != null) { for(String key : queryParams.keySet()) { t = t.queryParam(key, queryParams.getFirst(key)); } } System.out.println(t.getUri()); Builder b = t.request(MediaType.APPLICATION_JSON_TYPE) .accept(MediaType.APPLICATION_JSON_TYPE) .header("User-Agent", UA); return b; } // End getRequestBuilderForPath
Builder function(String endpointPath, MultivaluedMap<String,?> queryParams) { WebTarget t = client.target(STRformatSTRjsonSTRUser-Agent", UA); return b; }
/** * Takes an endpoint path (one of the finals declared in the top of the class) and returns a Builder for it, setting * standard options on the request such as a user agent header, requesting a JSON response, and configured to the * location of the client host/port. * @param endpointPath * @param queryParams * @return */
Takes an endpoint path (one of the finals declared in the top of the class) and returns a Builder for it, setting standard options on the request such as a user agent header, requesting a JSON response, and configured to the location of the client host/port
getRequestBuilderForPath
{ "repo_name": "plus-provenance/plus", "path": "src/main/java/org/mitre/provenance/client/RESTProvenanceClient.java", "license": "apache-2.0", "size": 17004 }
[ "javax.ws.rs.client.Invocation", "javax.ws.rs.client.WebTarget", "javax.ws.rs.core.MultivaluedMap" ]
import javax.ws.rs.client.Invocation; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.client.*; import javax.ws.rs.core.*;
[ "javax.ws" ]
javax.ws;
1,243,981
public static String getTTPath(final TransitionTarget tt) { StringBuilder sb = new StringBuilder("/"); for (int i = 0; i < tt.getNumberOfAncestors(); i++) { sb.append(tt.getAncestor(i).getId()); sb.append("/"); } sb.append(tt.getId()); return sb.toString(); } private LogUtils() { super(); }
static String function(final TransitionTarget tt) { StringBuilder sb = new StringBuilder("/"); for (int i = 0; i < tt.getNumberOfAncestors(); i++) { sb.append(tt.getAncestor(i).getId()); sb.append("/"); } sb.append(tt.getId()); return sb.toString(); } private LogUtils() { super(); }
/** * Write out this TransitionTarget location in a XPath style format. * * @param tt The TransitionTarget whose &quot;path&quot; is to needed * @return String The XPath style location of the TransitionTarget within * the SCXML document */
Write out this TransitionTarget location in a XPath style format
getTTPath
{ "repo_name": "mohanaraosv/commons-scxml", "path": "src/main/java/org/apache/commons/scxml2/env/LogUtils.java", "license": "apache-2.0", "size": 2619 }
[ "org.apache.commons.scxml2.model.TransitionTarget" ]
import org.apache.commons.scxml2.model.TransitionTarget;
import org.apache.commons.scxml2.model.*;
[ "org.apache.commons" ]
org.apache.commons;
1,028,756
private void exchangeCodeForToken(AuthorizationCode code, ActionListener<Tuple<AccessToken, JWT>> tokensListener) { try { final AuthorizationCodeGrant codeGrant = new AuthorizationCodeGrant(code, rpConfig.getRedirectUri()); final HttpPost httpPost = new HttpPost(opConfig.getTokenEndpoint()); final List<NameValuePair> params = new ArrayList<>(); for (Map.Entry<String, List<String>> entry : codeGrant.toParameters().entrySet()) { // All parameters of AuthorizationCodeGrant are singleton lists params.add(new BasicNameValuePair(entry.getKey(), entry.getValue().get(0))); }
void function(AuthorizationCode code, ActionListener<Tuple<AccessToken, JWT>> tokensListener) { try { final AuthorizationCodeGrant codeGrant = new AuthorizationCodeGrant(code, rpConfig.getRedirectUri()); final HttpPost httpPost = new HttpPost(opConfig.getTokenEndpoint()); final List<NameValuePair> params = new ArrayList<>(); for (Map.Entry<String, List<String>> entry : codeGrant.toParameters().entrySet()) { params.add(new BasicNameValuePair(entry.getKey(), entry.getValue().get(0))); }
/** * Attempts to make a request to the Token Endpoint of the OpenID Connect provider in order to exchange an * authorization code for an Id Token (and potentially an Access Token) */
Attempts to make a request to the Token Endpoint of the OpenID Connect provider in order to exchange an authorization code for an Id Token (and potentially an Access Token)
exchangeCodeForToken
{ "repo_name": "gingerwizard/elasticsearch", "path": "x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/oidc/OpenIdConnectAuthenticator.java", "license": "apache-2.0", "size": 46993 }
[ "com.nimbusds.oauth2.sdk.AuthorizationCode", "com.nimbusds.oauth2.sdk.AuthorizationCodeGrant", "com.nimbusds.oauth2.sdk.token.AccessToken", "java.util.ArrayList", "java.util.List", "java.util.Map", "org.apache.http.NameValuePair", "org.apache.http.client.methods.HttpPost", "org.apache.http.message.BasicNameValuePair", "org.elasticsearch.action.ActionListener", "org.elasticsearch.common.collect.Tuple" ]
import com.nimbusds.oauth2.sdk.AuthorizationCode; import com.nimbusds.oauth2.sdk.AuthorizationCodeGrant; import com.nimbusds.oauth2.sdk.token.AccessToken; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.apache.http.NameValuePair; import org.apache.http.client.methods.HttpPost; import org.apache.http.message.BasicNameValuePair; import org.elasticsearch.action.ActionListener; import org.elasticsearch.common.collect.Tuple;
import com.nimbusds.oauth2.sdk.*; import com.nimbusds.oauth2.sdk.token.*; import java.util.*; import org.apache.http.*; import org.apache.http.client.methods.*; import org.apache.http.message.*; import org.elasticsearch.action.*; import org.elasticsearch.common.collect.*;
[ "com.nimbusds.oauth2", "java.util", "org.apache.http", "org.elasticsearch.action", "org.elasticsearch.common" ]
com.nimbusds.oauth2; java.util; org.apache.http; org.elasticsearch.action; org.elasticsearch.common;
853,049
void perform(Command command, Logger logger) throws IOException; public final static class FinalStep implements Step { private String message; public FinalStep() { this("Finished action successfully!"); } public FinalStep(String message) { this.message = message; }
void perform(Command command, Logger logger) throws IOException; public final static class FinalStep implements Step { private String message; public FinalStep() { this(STR); } public FinalStep(String message) { this.message = message; }
/** * Perform this step. * @param command Command that triggered the action. * @param logger The Action's logger. * @throws IOException If there is anything wrong in the communication * with Github. */
Perform this step
perform
{ "repo_name": "opencharles/charles-rest", "path": "src/main/java/com/amihaiemil/charles/github/Step.java", "license": "bsd-3-clause", "size": 3573 }
[ "java.io.IOException", "org.slf4j.Logger" ]
import java.io.IOException; import org.slf4j.Logger;
import java.io.*; import org.slf4j.*;
[ "java.io", "org.slf4j" ]
java.io; org.slf4j;
931,431
@PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateNodes(InputStream input) { log.trace(String.format(MESSAGE_NODE, UPDATE)); Set<OpenstackNode> nodes = readNodeConfiguration(input); for (OpenstackNode osNode: nodes) { OpenstackNode existing = osNodeService.node(osNode.hostname()); if (existing == null) { log.warn("There is no node configuration to update : {}", osNode.hostname()); return Response.notModified().build(); } else if (!existing.equals(osNode)) { osNodeAdminService.updateNode(osNode); } } return Response.ok().build(); }
@Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response function(InputStream input) { log.trace(String.format(MESSAGE_NODE, UPDATE)); Set<OpenstackNode> nodes = readNodeConfiguration(input); for (OpenstackNode osNode: nodes) { OpenstackNode existing = osNodeService.node(osNode.hostname()); if (existing == null) { log.warn(STR, osNode.hostname()); return Response.notModified().build(); } else if (!existing.equals(osNode)) { osNodeAdminService.updateNode(osNode); } } return Response.ok().build(); }
/** * Creates a set of openstack nodes' config from the JSON input stream. * * @param input openstack nodes JSON input stream * @return 200 OK with the updated openstack node's config, 400 BAD_REQUEST * if the JSON is malformed, and 304 NOT_MODIFIED without the updated config * @onos.rsModel OpenstackNode */
Creates a set of openstack nodes' config from the JSON input stream
updateNodes
{ "repo_name": "kuujo/onos", "path": "apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/web/OpenstackNodeWebResource.java", "license": "apache-2.0", "size": 6767 }
[ "java.io.InputStream", "java.util.Set", "javax.ws.rs.Consumes", "javax.ws.rs.Produces", "javax.ws.rs.core.MediaType", "javax.ws.rs.core.Response", "org.onosproject.openstacknode.api.OpenstackNode" ]
import java.io.InputStream; import java.util.Set; import javax.ws.rs.Consumes; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.onosproject.openstacknode.api.OpenstackNode;
import java.io.*; import java.util.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.onosproject.openstacknode.api.*;
[ "java.io", "java.util", "javax.ws", "org.onosproject.openstacknode" ]
java.io; java.util; javax.ws; org.onosproject.openstacknode;
721,070
private List<Exit> removeNormalExits() { return currentExitsByReason.put(Exit.Reason.NORMAL, new ArrayList<Exit>()); }
List<Exit> function() { return currentExitsByReason.put(Exit.Reason.NORMAL, new ArrayList<Exit>()); }
/** * Remove all normal exits from current exit list. */
Remove all normal exits from current exit list
removeNormalExits
{ "repo_name": "syntelos/gwtcc", "path": "src/com/google/gwt/dev/jjs/impl/gflow/cfg/CfgBuilder.java", "license": "apache-2.0", "size": 40125 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
62,571
public URI region(final Region region) { return WebRegionResource.uri(_data, region.getUniqueId()); }
URI function(final Region region) { return WebRegionResource.uri(_data, region.getUniqueId()); }
/** * Gets the URI. * @param region the region, not null * @return the URI */
Gets the URI
region
{ "repo_name": "McLeodMoores/starling", "path": "projects/web/src/main/java/com/opengamma/web/region/WebRegionUris.java", "license": "apache-2.0", "size": 2735 }
[ "com.opengamma.core.region.Region" ]
import com.opengamma.core.region.Region;
import com.opengamma.core.region.*;
[ "com.opengamma.core" ]
com.opengamma.core;
599,779
private void addMessageHeaderHtml(StringBuilder html, Message message) throws MessagingException { html.append("<table style=\"border: 0\">"); // From: <sender> Address[] from = message.getFrom(); if (from != null && from.length > 0) { addTableRow(html, context.getString(R.string.message_compose_quote_header_from), Address.toString(from)); } // To: <recipients> Address[] to = message.getRecipients(Message.RecipientType.TO); if (to != null && to.length > 0) { addTableRow(html, context.getString(R.string.message_compose_quote_header_to), Address.toString(to)); } // Cc: <recipients> Address[] cc = message.getRecipients(Message.RecipientType.CC); if (cc != null && cc.length > 0) { addTableRow(html, context.getString(R.string.message_compose_quote_header_cc), Address.toString(cc)); } // Date: <date> Date date = message.getSentDate(); if (date != null) { addTableRow(html, context.getString(R.string.message_compose_quote_header_send_date), date.toString()); } // Subject: <subject> String subject = message.getSubject(); addTableRow(html, context.getString(R.string.message_compose_quote_header_subject), (subject == null) ? context.getString(R.string.general_no_subject) : subject); html.append("</table>"); }
void function(StringBuilder html, Message message) throws MessagingException { html.append(STRborder: 0\">"); Address[] from = message.getFrom(); if (from != null && from.length > 0) { addTableRow(html, context.getString(R.string.message_compose_quote_header_from), Address.toString(from)); } Address[] to = message.getRecipients(Message.RecipientType.TO); if (to != null && to.length > 0) { addTableRow(html, context.getString(R.string.message_compose_quote_header_to), Address.toString(to)); } Address[] cc = message.getRecipients(Message.RecipientType.CC); if (cc != null && cc.length > 0) { addTableRow(html, context.getString(R.string.message_compose_quote_header_cc), Address.toString(cc)); } Date date = message.getSentDate(); if (date != null) { addTableRow(html, context.getString(R.string.message_compose_quote_header_send_date), date.toString()); } String subject = message.getSubject(); addTableRow(html, context.getString(R.string.message_compose_quote_header_subject), (subject == null) ? context.getString(R.string.general_no_subject) : subject); html.append(STR); }
/** * Extract important header values from a message to display inline (HTML version). * * @param html * The {@link StringBuilder} that will receive the (HTML) output. * @param message * The message to extract the header values from. * * @throws com.fsck.k9.mail.MessagingException * In case of an error. */
Extract important header values from a message to display inline (HTML version)
addMessageHeaderHtml
{ "repo_name": "G00fY2/k-9_material_design", "path": "k9mail/src/main/java/com/fsck/k9/mailstore/MessageViewInfoExtractor.java", "license": "apache-2.0", "size": 20025 }
[ "com.fsck.k9.mail.Address", "com.fsck.k9.mail.Message", "com.fsck.k9.mail.MessagingException", "java.util.Date" ]
import com.fsck.k9.mail.Address; import com.fsck.k9.mail.Message; import com.fsck.k9.mail.MessagingException; import java.util.Date;
import com.fsck.k9.mail.*; import java.util.*;
[ "com.fsck.k9", "java.util" ]
com.fsck.k9; java.util;
2,226,929
public T1 caseEExtendedNumericResourceDef(EExtendedNumericResourceDef object) { return null; }
T1 function(EExtendedNumericResourceDef object) { return null; }
/** * Returns the result of interpreting the object as an instance of '<em>EExtended Numeric Resource Def</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>EExtended Numeric Resource Def</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */
Returns the result of interpreting the object as an instance of 'EExtended Numeric Resource Def'. This implementation returns null; returning a non-null result will terminate the switch.
caseEExtendedNumericResourceDef
{ "repo_name": "nasa/OpenSPIFe", "path": "gov.nasa.ensemble.dictionary/src/gov/nasa/ensemble/dictionary/util/DictionarySwitch.java", "license": "apache-2.0", "size": 46564 }
[ "gov.nasa.ensemble.dictionary.EExtendedNumericResourceDef" ]
import gov.nasa.ensemble.dictionary.EExtendedNumericResourceDef;
import gov.nasa.ensemble.dictionary.*;
[ "gov.nasa.ensemble" ]
gov.nasa.ensemble;
2,612,984
public InputSource resolveEntity (String publicId, String systemId) throws SAXException, IOException { if (entityResolver != null) { return entityResolver.resolveEntity(publicId, systemId); } else { return null; } } //////////////////////////////////////////////////////////////////// // Implementation of org.xml.sax.DTDHandler. ////////////////////////////////////////////////////////////////////
InputSource function (String publicId, String systemId) throws SAXException, IOException { if (entityResolver != null) { return entityResolver.resolveEntity(publicId, systemId); } else { return null; } }
/** * Filter an external entity resolution. * * @param publicId The entity's public identifier, or null. * @param systemId The entity's system identifier. * @return A new InputSource or null for the default. * @exception org.xml.sax.SAXException The client may throw * an exception during processing. * @exception java.io.IOException The client may throw an * I/O-related exception while obtaining the * new InputSource. */
Filter an external entity resolution
resolveEntity
{ "repo_name": "FauxFaux/jdk9-jaxp", "path": "src/java.xml/share/classes/org/xml/sax/helpers/XMLFilterImpl.java", "license": "gpl-2.0", "size": 21751 }
[ "java.io.IOException", "org.xml.sax.InputSource", "org.xml.sax.SAXException" ]
import java.io.IOException; import org.xml.sax.InputSource; import org.xml.sax.SAXException;
import java.io.*; import org.xml.sax.*;
[ "java.io", "org.xml.sax" ]
java.io; org.xml.sax;
1,474,397
public final void info(Object pObject) { getLogger().log(FQCN, Level.INFO, pObject, null); }
final void function(Object pObject) { getLogger().log(FQCN, Level.INFO, pObject, null); }
/** * generate a message for loglevel INFO * * @param pObject the message Object */
generate a message for loglevel INFO
info
{ "repo_name": "CU-CommunityApps/cu-db-ojb", "path": "src/java/org/apache/ojb/broker/util/logging/Log4jLoggerImpl.java", "license": "apache-2.0", "size": 11594 }
[ "org.apache.log4j.Level" ]
import org.apache.log4j.Level;
import org.apache.log4j.*;
[ "org.apache.log4j" ]
org.apache.log4j;
1,816,568
protected Ty copy() { throw new MiscErrorException("Shouldn't be calling copy()! Type: " + this.getClass(), new CloneNotSupportedException()); }
Ty function() { throw new MiscErrorException(STR + this.getClass(), new CloneNotSupportedException()); }
/** * <p> * Implemented by concrete subclasses of {@link Ty} to manufacture a copy of themselves. * </p> * * @return A new {@link Ty} that is a deep copy of the original. */
Implemented by concrete subclasses of <code>Ty</code> to manufacture a copy of themselves.
copy
{ "repo_name": "ClemsonRSRG/RESOLVE", "path": "src/java/edu/clemson/rsrg/absyn/rawtypes/Ty.java", "license": "bsd-3-clause", "size": 5879 }
[ "edu.clemson.rsrg.statushandling.exception.MiscErrorException" ]
import edu.clemson.rsrg.statushandling.exception.MiscErrorException;
import edu.clemson.rsrg.statushandling.exception.*;
[ "edu.clemson.rsrg" ]
edu.clemson.rsrg;
875,688
@Override protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaTemplate())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaServer())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaAuthorization())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaTransportSerializationType())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaPersistenceType())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaGenerator())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaGeneratorSlot())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaDataType())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaConstant())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaCache())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaSettings())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaEntity())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaDto())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaQueue())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaRESTCustomService())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaRESTWorkflow())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaRESTCrud())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaEnum())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaAppInstallTrigger())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaAppUpdateTrigger())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaSMSTrigger())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaDeviceStartupTrigger())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaEmailTrigger())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaTimerTrigger())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaPushTrigger())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaGeofenceTrigger())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaBluetoothModule())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaNFCModule())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaPushModule())); }
void function(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaTemplate())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaServer())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaAuthorization())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaTransportSerializationType())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaPersistenceType())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaGenerator())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaGeneratorSlot())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaDataType())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaConstant())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaCache())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaSettings())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaEntity())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaDto())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaQueue())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaRESTCustomService())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaRESTWorkflow())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaRESTCrud())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaEnum())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaAppInstallTrigger())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaAppUpdateTrigger())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaSMSTrigger())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaDeviceStartupTrigger())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaEmailTrigger())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaTimerTrigger())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaPushTrigger())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaGeofenceTrigger())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaBluetoothModule())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaNFCModule())); newChildDescriptors.add (createChildParameter (MobaPackage.Literals.MOBA_APPLICATION__FEATURES, MobaFactory.eINSTANCE.createMobaPushModule())); }
/** * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children * that can be created under this object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds <code>org.eclipse.emf.edit.command.CommandParameter</code>s describing the children that can be created under this object.
collectNewChildDescriptors
{ "repo_name": "florianpirchner/mobadsl", "path": "org.mobadsl.semantic.model.edit/src/org/mobadsl/semantic/model/moba/provider/MobaApplicationItemProvider.java", "license": "apache-2.0", "size": 10564 }
[ "java.util.Collection", "org.mobadsl.semantic.model.moba.MobaFactory", "org.mobadsl.semantic.model.moba.MobaPackage" ]
import java.util.Collection; import org.mobadsl.semantic.model.moba.MobaFactory; import org.mobadsl.semantic.model.moba.MobaPackage;
import java.util.*; import org.mobadsl.semantic.model.moba.*;
[ "java.util", "org.mobadsl.semantic" ]
java.util; org.mobadsl.semantic;
46,653
@ServiceMethod(returns = ReturnType.SINGLE) public void deactivateRevision(String resourceGroupName, String containerAppName, String name) { deactivateRevisionAsync(resourceGroupName, containerAppName, name).block(); }
@ServiceMethod(returns = ReturnType.SINGLE) void function(String resourceGroupName, String containerAppName, String name) { deactivateRevisionAsync(resourceGroupName, containerAppName, name).block(); }
/** * Deactivates a revision for a Container App. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param containerAppName Name of the Container App. * @param name Name of the Container App Revision to deactivate. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws DefaultErrorResponseErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */
Deactivates a revision for a Container App
deactivateRevision
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-appservice/src/main/java/com/azure/resourcemanager/appservice/implementation/ContainerAppsRevisionsClientImpl.java", "license": "mit", "size": 51756 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.*;
[ "com.azure.core" ]
com.azure.core;
527,299
private AffineTransform simulateFiducialCheck(BoardLocation boardLocation) { Placement fid1 = new Placement("FID1"); fid1.setLocation(new Location(LengthUnit.Millimeters, 1, 1, 0, 0)); Placement fid2 = new Placement("FID2"); fid2.setLocation(new Location(LengthUnit.Millimeters, 2, 1, 0, 0)); Placement fid3 = new Placement("FID3"); fid3.setLocation(new Location(LengthUnit.Millimeters, 2, 2, 0, 0)); boardLocation.setPlacementTransform(null); Location fid1l = Utils2D.calculateBoardPlacementLocation(boardLocation, fid1.getLocation()); Location fid2l = Utils2D.calculateBoardPlacementLocation(boardLocation, fid2.getLocation()); Location fid3l = Utils2D.calculateBoardPlacementLocation(boardLocation, fid3.getLocation()); if (boardLocation.getSide() == Side.Bottom) { fid1.setLocation(fid1.getLocation().multiply(-1, 1, 1, 1)); fid2.setLocation(fid2.getLocation().multiply(-1, 1, 1, 1)); fid3.setLocation(fid3.getLocation().multiply(-1, 1, 1, 1)); } AffineTransform tx = Utils2D.deriveAffineTransform(fid1.getLocation(), fid2.getLocation(), fid3.getLocation(), fid1l, fid2l, fid3l); boardLocation.setPlacementTransform(tx); return tx; }
AffineTransform function(BoardLocation boardLocation) { Placement fid1 = new Placement("FID1"); fid1.setLocation(new Location(LengthUnit.Millimeters, 1, 1, 0, 0)); Placement fid2 = new Placement("FID2"); fid2.setLocation(new Location(LengthUnit.Millimeters, 2, 1, 0, 0)); Placement fid3 = new Placement("FID3"); fid3.setLocation(new Location(LengthUnit.Millimeters, 2, 2, 0, 0)); boardLocation.setPlacementTransform(null); Location fid1l = Utils2D.calculateBoardPlacementLocation(boardLocation, fid1.getLocation()); Location fid2l = Utils2D.calculateBoardPlacementLocation(boardLocation, fid2.getLocation()); Location fid3l = Utils2D.calculateBoardPlacementLocation(boardLocation, fid3.getLocation()); if (boardLocation.getSide() == Side.Bottom) { fid1.setLocation(fid1.getLocation().multiply(-1, 1, 1, 1)); fid2.setLocation(fid2.getLocation().multiply(-1, 1, 1, 1)); fid3.setLocation(fid3.getLocation().multiply(-1, 1, 1, 1)); } AffineTransform tx = Utils2D.deriveAffineTransform(fid1.getLocation(), fid2.getLocation(), fid3.getLocation(), fid1l, fid2l, fid3l); boardLocation.setPlacementTransform(tx); return tx; }
/** * Simulates a 3 point fiducial check by generating 3 placements at fixed locations, * calculating their board placement location and running deriveAffineTransform. * * This is to be used when it is known that calculateBoardLocation is working correctly * for the given BoardLocation without a placement transform set. * * @param boardLocation * @return */
Simulates a 3 point fiducial check by generating 3 placements at fixed locations, calculating their board placement location and running deriveAffineTransform. This is to be used when it is known that calculateBoardLocation is working correctly for the given BoardLocation without a placement transform set
simulateFiducialCheck
{ "repo_name": "openpnp/openpnp", "path": "src/test/java/CalculateBoardLocationTests.java", "license": "gpl-3.0", "size": 13833 }
[ "java.awt.geom.AffineTransform", "org.openpnp.model.Board", "org.openpnp.model.BoardLocation", "org.openpnp.model.LengthUnit", "org.openpnp.model.Location", "org.openpnp.model.Placement", "org.openpnp.util.Utils2D" ]
import java.awt.geom.AffineTransform; import org.openpnp.model.Board; import org.openpnp.model.BoardLocation; import org.openpnp.model.LengthUnit; import org.openpnp.model.Location; import org.openpnp.model.Placement; import org.openpnp.util.Utils2D;
import java.awt.geom.*; import org.openpnp.model.*; import org.openpnp.util.*;
[ "java.awt", "org.openpnp.model", "org.openpnp.util" ]
java.awt; org.openpnp.model; org.openpnp.util;
2,323,189
private void generateSelectPartOfQuery(String[] selectColumnName, StringBuffer sqlBuff, String className) { logger.debug("Prepare select part of query."); if (selectColumnName != null && selectColumnName.length > 0) { sqlBuff.append("Select "); for (int i = 0; i < selectColumnName.length; i++) { sqlBuff.append(DAOUtility.getInstance(). createAttributeNameForHQL(className, selectColumnName[i])); if (i != selectColumnName.length - 1) { sqlBuff.append(", "); } } sqlBuff.append(" "); } }
void function(String[] selectColumnName, StringBuffer sqlBuff, String className) { logger.debug(STR); if (selectColumnName != null && selectColumnName.length > 0) { sqlBuff.append(STR); for (int i = 0; i < selectColumnName.length; i++) { sqlBuff.append(DAOUtility.getInstance(). createAttributeNameForHQL(className, selectColumnName[i])); if (i != selectColumnName.length - 1) { sqlBuff.append(STR); } } sqlBuff.append(" "); } }
/** * Generate Select Block. * @param selectColumnName select Column Name. * @param sqlBuff sqlBuff * @param className class Name. */
Generate Select Block
generateSelectPartOfQuery
{ "repo_name": "NCIP/commons-module", "path": "software/washu-commons/src/main/java/edu/wustl/dao/HibernateDAOImpl.java", "license": "bsd-3-clause", "size": 26964 }
[ "edu.wustl.dao.util.DAOUtility" ]
import edu.wustl.dao.util.DAOUtility;
import edu.wustl.dao.util.*;
[ "edu.wustl.dao" ]
edu.wustl.dao;
2,801,138
@Override public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException { broadcaster.removeNotificationListener(listener); } // ------------------------------------------------------------- Attributes
void function(NotificationListener listener) throws ListenerNotFoundException { broadcaster.removeNotificationListener(listener); }
/** * Remove a JMX-NotificationListener * @see javax.management.NotificationBroadcaster#removeNotificationListener(javax.management.NotificationListener) */
Remove a JMX-NotificationListener
removeNotificationListener
{ "repo_name": "WhiteBearSolutions/WBSAirback", "path": "packages/wbsairback-tomcat/wbsairback-tomcat-7.0.22/java/org/apache/catalina/core/StandardContext.java", "license": "apache-2.0", "size": 198551 }
[ "javax.management.ListenerNotFoundException", "javax.management.NotificationListener" ]
import javax.management.ListenerNotFoundException; import javax.management.NotificationListener;
import javax.management.*;
[ "javax.management" ]
javax.management;
1,555,226
public Observable<ServiceResponse<Void>> postPathGlobalValidWithServiceResponseAsync() { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); }
Observable<ServiceResponse<Void>> function() { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); }
/** * POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed. * * @return the {@link ServiceResponse} object if successful. */
POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed
postPathGlobalValidWithServiceResponseAsync
{ "repo_name": "yugangw-msft/autorest", "path": "src/generator/AutoRest.Java.Azure.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/SubscriptionInCredentialsInner.java", "license": "mit", "size": 19398 }
[ "com.microsoft.rest.ServiceResponse" ]
import com.microsoft.rest.ServiceResponse;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
2,326,531
public void testAddAll1() { ArrayDeque q = new ArrayDeque(); try { q.addAll(null); shouldThrow(); } catch (NullPointerException success) {} }
void function() { ArrayDeque q = new ArrayDeque(); try { q.addAll(null); shouldThrow(); } catch (NullPointerException success) {} }
/** * addAll(null) throws NPE */
addAll(null) throws NPE
testAddAll1
{ "repo_name": "life-beam/j2objc", "path": "jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ArrayDequeTest.java", "license": "apache-2.0", "size": 26347 }
[ "java.util.ArrayDeque" ]
import java.util.ArrayDeque;
import java.util.*;
[ "java.util" ]
java.util;
542,413
@SideOnly(Side.CLIENT) void resetProgressAndMessage(String message);
@SideOnly(Side.CLIENT) void resetProgressAndMessage(String message);
/** * this string, followed by "working..." and then the "% complete" are the 3 lines shown. This resets progress to 0, * and the WorkingString to "working...". */
this string, followed by "working..." and then the "% complete" are the 3 lines shown. This resets progress to 0, and the WorkingString to "working..."
resetProgressAndMessage
{ "repo_name": "aebert1/BigTransport", "path": "build/tmp/recompileMc/sources/net/minecraft/util/IProgressUpdate.java", "license": "gpl-3.0", "size": 902 }
[ "net.minecraftforge.fml.relauncher.Side", "net.minecraftforge.fml.relauncher.SideOnly" ]
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.fml.relauncher.*;
[ "net.minecraftforge.fml" ]
net.minecraftforge.fml;
2,884,665
protected GraphicsNode instantiateGraphicsNode() { return new ImageNode(); }
GraphicsNode function() { return new ImageNode(); }
/** * Creates an <tt>ImageNode</tt>. */
Creates an ImageNode
instantiateGraphicsNode
{ "repo_name": "shyamalschandra/flex-sdk", "path": "modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGImageElementBridge.java", "license": "apache-2.0", "size": 38587 }
[ "org.apache.flex.forks.batik.gvt.GraphicsNode", "org.apache.flex.forks.batik.gvt.ImageNode" ]
import org.apache.flex.forks.batik.gvt.GraphicsNode; import org.apache.flex.forks.batik.gvt.ImageNode;
import org.apache.flex.forks.batik.gvt.*;
[ "org.apache.flex" ]
org.apache.flex;
285,492
public byte[] getEncoded() { try { ByteArrayOutputStream bOut = new ByteArrayOutputStream(); BCPGOutputStream pgpOut = new BCPGOutputStream(bOut); pgpOut.writeObject(this); return bOut.toByteArray(); } catch (IOException e) { return null; } }
byte[] function() { try { ByteArrayOutputStream bOut = new ByteArrayOutputStream(); BCPGOutputStream pgpOut = new BCPGOutputStream(bOut); pgpOut.writeObject(this); return bOut.toByteArray(); } catch (IOException e) { return null; } }
/** * return the standard PGP encoding of the key. * * @see org.bouncycastle.bcpg.BCPGKey#getEncoded() */
return the standard PGP encoding of the key
getEncoded
{ "repo_name": "GaloisInc/hacrypto", "path": "src/Java/BouncyCastle/BouncyCastle-1.50/pg/src/main/java/org/bouncycastle/bcpg/ECSecretBCPGKey.java", "license": "bsd-3-clause", "size": 1474 }
[ "java.io.ByteArrayOutputStream", "java.io.IOException" ]
import java.io.ByteArrayOutputStream; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,454,269
public void computeNonEdgeForces(int pointIndex, double theta, INDArray negativeForce, AtomicDouble sumQ) { // Make sure that we spend no time on empty nodes or self-interactions if(cumSize == 0 || (isLeaf() && size == 1 && index[0] == pointIndex)) return; // Compute distance between point and center-of-mass buf.assign(data.slice(pointIndex)).subi(centerOfMass); double D = Nd4j.getBlasWrapper().dot(buf,buf); // Check whether we can use this node as a "summary" if(isLeaf || FastMath.max(boundary.getHh(), boundary.getHw()) / FastMath.sqrt(D) < theta) { // Compute and add t-SNE force between point and current node double Q = 1.0 / (1.0 + D); double mult = cumSize * Q; sumQ.addAndGet(mult); mult *= Q; negativeForce.addi(buf.mul(mult)); } else { // Recursively apply Barnes-Hut to children northWest.computeNonEdgeForces(pointIndex, theta, negativeForce, sumQ); northEast.computeNonEdgeForces(pointIndex, theta, negativeForce, sumQ); southWest.computeNonEdgeForces(pointIndex, theta, negativeForce, sumQ); southEast.computeNonEdgeForces(pointIndex, theta, negativeForce, sumQ); } }
void function(int pointIndex, double theta, INDArray negativeForce, AtomicDouble sumQ) { if(cumSize == 0 (isLeaf() && size == 1 && index[0] == pointIndex)) return; buf.assign(data.slice(pointIndex)).subi(centerOfMass); double D = Nd4j.getBlasWrapper().dot(buf,buf); if(isLeaf FastMath.max(boundary.getHh(), boundary.getHw()) / FastMath.sqrt(D) < theta) { double Q = 1.0 / (1.0 + D); double mult = cumSize * Q; sumQ.addAndGet(mult); mult *= Q; negativeForce.addi(buf.mul(mult)); } else { northWest.computeNonEdgeForces(pointIndex, theta, negativeForce, sumQ); northEast.computeNonEdgeForces(pointIndex, theta, negativeForce, sumQ); southWest.computeNonEdgeForces(pointIndex, theta, negativeForce, sumQ); southEast.computeNonEdgeForces(pointIndex, theta, negativeForce, sumQ); } }
/** * Compute non edge forces using barnes hut * @param pointIndex * @param theta * @param negativeForce * @param sumQ */
Compute non edge forces using barnes hut
computeNonEdgeForces
{ "repo_name": "xuzhongxing/deeplearning4j", "path": "deeplearning4j-core/src/main/java/org/deeplearning4j/clustering/quadtree/QuadTree.java", "license": "apache-2.0", "size": 11124 }
[ "com.google.common.util.concurrent.AtomicDouble", "java.lang.Math", "org.apache.commons.math3.util.FastMath", "org.nd4j.linalg.api.ndarray.INDArray", "org.nd4j.linalg.factory.Nd4j" ]
import com.google.common.util.concurrent.AtomicDouble; import java.lang.Math; import org.apache.commons.math3.util.FastMath; import org.nd4j.linalg.api.ndarray.INDArray; import org.nd4j.linalg.factory.Nd4j;
import com.google.common.util.concurrent.*; import java.lang.*; import org.apache.commons.math3.util.*; import org.nd4j.linalg.api.ndarray.*; import org.nd4j.linalg.factory.*;
[ "com.google.common", "java.lang", "org.apache.commons", "org.nd4j.linalg" ]
com.google.common; java.lang; org.apache.commons; org.nd4j.linalg;
1,337,087
@Generated(hash = 713229351) public void update() { if (myDao == null) { throw new DaoException("Entity is detached from DAO context"); } myDao.update(this); }
@Generated(hash = 713229351) void function() { if (myDao == null) { throw new DaoException(STR); } myDao.update(this); }
/** * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}. * Entity must attached to an entity context. */
Convenient call for <code>org.greenrobot.greendao.AbstractDao#update(Object)</code>. Entity must attached to an entity context
update
{ "repo_name": "literacyapp-org/literacyapp-android", "path": "contentprovider/src/main/java/org/literacyapp/contentprovider/model/content/multimedia/Audio.java", "license": "apache-2.0", "size": 10434 }
[ "org.greenrobot.greendao.DaoException", "org.greenrobot.greendao.annotation.Generated" ]
import org.greenrobot.greendao.DaoException; import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.*; import org.greenrobot.greendao.annotation.*;
[ "org.greenrobot.greendao" ]
org.greenrobot.greendao;
1,426,136
final protected void drawImage(ImageData src, int ox, int oy) { ImageData dst = imageData; PaletteData srcPalette = src.palette; ImageData srcMask = null; int alphaMask = 0, alphaShift = 0; if (src.maskData != null) { srcMask = src.getTransparencyMask (); if (src.depth == 32) { alphaMask = ~(srcPalette.redMask | srcPalette.greenMask | srcPalette.blueMask); while (alphaMask != 0 && ((alphaMask >>> alphaShift) & 1) == 0) alphaShift++; } } for (int srcY = 0, dstY = srcY + oy; srcY < src.height; srcY++, dstY++) { for (int srcX = 0, dstX = srcX + ox; srcX < src.width; srcX++, dstX++) { if (!(0 <= dstX && dstX < dst.width && 0 <= dstY && dstY < dst.height)) continue; int srcPixel = src.getPixel(srcX, srcY); int srcAlpha = 255; if (src.maskData != null) { if (src.depth == 32) { srcAlpha = (srcPixel & alphaMask) >>> alphaShift; if (srcAlpha == 0) { srcAlpha = srcMask.getPixel(srcX, srcY) != 0 ? 255 : 0; } } else { if (srcMask.getPixel(srcX, srcY) == 0) srcAlpha = 0; } } else if (src.transparentPixel != -1) { if (src.transparentPixel == srcPixel) srcAlpha = 0; } else if (src.alpha != -1) { srcAlpha = src.alpha; } else if (src.alphaData != null) { srcAlpha = src.getAlpha(srcX, srcY); } if (srcAlpha == 0) continue; int srcRed, srcGreen, srcBlue; if (srcPalette.isDirect) { srcRed = srcPixel & srcPalette.redMask; srcRed = (srcPalette.redShift < 0) ? srcRed >>> -srcPalette.redShift : srcRed << srcPalette.redShift; srcGreen = srcPixel & srcPalette.greenMask; srcGreen = (srcPalette.greenShift < 0) ? srcGreen >>> -srcPalette.greenShift : srcGreen << srcPalette.greenShift; srcBlue = srcPixel & srcPalette.blueMask; srcBlue = (srcPalette.blueShift < 0) ? srcBlue >>> -srcPalette.blueShift : srcBlue << srcPalette.blueShift; } else { RGB rgb = srcPalette.getRGB(srcPixel); srcRed = rgb.red; srcGreen = rgb.green; srcBlue = rgb.blue; } int dstRed, dstGreen, dstBlue, dstAlpha; if (srcAlpha == 255) { dstRed = srcRed; dstGreen = srcGreen; dstBlue= srcBlue; dstAlpha = srcAlpha; } else { int dstPixel = dst.getPixel(dstX, dstY); dstAlpha = dst.getAlpha(dstX, dstY); dstRed = (dstPixel & 0xFF) >>> 0; dstGreen = (dstPixel & 0xFF00) >>> 8; dstBlue = (dstPixel & 0xFF0000) >>> 16; if (dstAlpha == 255) { // simplified calculations for performance dstRed += (srcRed - dstRed) * srcAlpha / 255; dstGreen += (srcGreen - dstGreen) * srcAlpha / 255; dstBlue += (srcBlue - dstBlue) * srcAlpha / 255; } else { // See Porter T., Duff T. 1984. "Compositing Digital Images". // Computer Graphics 18 (3): 253-259. dstRed = srcRed * srcAlpha * 255 + dstRed * dstAlpha * (255 - srcAlpha); dstGreen = srcGreen * srcAlpha * 255 + dstGreen * dstAlpha * (255 - srcAlpha); dstBlue = srcBlue * srcAlpha * 255 + dstBlue * dstAlpha * (255 - srcAlpha); dstAlpha = srcAlpha * 255 + dstAlpha * (255 - srcAlpha); if (dstAlpha != 0) { // if both original alphas == 0, then all colors are 0 dstRed /= dstAlpha; dstGreen /= dstAlpha; dstBlue /= dstAlpha; dstAlpha /= 255; } } } dst.setPixel(dstX, dstY, ((dstRed & 0xFF) << 0) | ((dstGreen & 0xFF) << 8) | ((dstBlue & 0xFF) << 16)); dst.setAlpha(dstX, dstY, dstAlpha); } } }
final void function(ImageData src, int ox, int oy) { ImageData dst = imageData; PaletteData srcPalette = src.palette; ImageData srcMask = null; int alphaMask = 0, alphaShift = 0; if (src.maskData != null) { srcMask = src.getTransparencyMask (); if (src.depth == 32) { alphaMask = ~(srcPalette.redMask srcPalette.greenMask srcPalette.blueMask); while (alphaMask != 0 && ((alphaMask >>> alphaShift) & 1) == 0) alphaShift++; } } for (int srcY = 0, dstY = srcY + oy; srcY < src.height; srcY++, dstY++) { for (int srcX = 0, dstX = srcX + ox; srcX < src.width; srcX++, dstX++) { if (!(0 <= dstX && dstX < dst.width && 0 <= dstY && dstY < dst.height)) continue; int srcPixel = src.getPixel(srcX, srcY); int srcAlpha = 255; if (src.maskData != null) { if (src.depth == 32) { srcAlpha = (srcPixel & alphaMask) >>> alphaShift; if (srcAlpha == 0) { srcAlpha = srcMask.getPixel(srcX, srcY) != 0 ? 255 : 0; } } else { if (srcMask.getPixel(srcX, srcY) == 0) srcAlpha = 0; } } else if (src.transparentPixel != -1) { if (src.transparentPixel == srcPixel) srcAlpha = 0; } else if (src.alpha != -1) { srcAlpha = src.alpha; } else if (src.alphaData != null) { srcAlpha = src.getAlpha(srcX, srcY); } if (srcAlpha == 0) continue; int srcRed, srcGreen, srcBlue; if (srcPalette.isDirect) { srcRed = srcPixel & srcPalette.redMask; srcRed = (srcPalette.redShift < 0) ? srcRed >>> -srcPalette.redShift : srcRed << srcPalette.redShift; srcGreen = srcPixel & srcPalette.greenMask; srcGreen = (srcPalette.greenShift < 0) ? srcGreen >>> -srcPalette.greenShift : srcGreen << srcPalette.greenShift; srcBlue = srcPixel & srcPalette.blueMask; srcBlue = (srcPalette.blueShift < 0) ? srcBlue >>> -srcPalette.blueShift : srcBlue << srcPalette.blueShift; } else { RGB rgb = srcPalette.getRGB(srcPixel); srcRed = rgb.red; srcGreen = rgb.green; srcBlue = rgb.blue; } int dstRed, dstGreen, dstBlue, dstAlpha; if (srcAlpha == 255) { dstRed = srcRed; dstGreen = srcGreen; dstBlue= srcBlue; dstAlpha = srcAlpha; } else { int dstPixel = dst.getPixel(dstX, dstY); dstAlpha = dst.getAlpha(dstX, dstY); dstRed = (dstPixel & 0xFF) >>> 0; dstGreen = (dstPixel & 0xFF00) >>> 8; dstBlue = (dstPixel & 0xFF0000) >>> 16; if (dstAlpha == 255) { dstRed += (srcRed - dstRed) * srcAlpha / 255; dstGreen += (srcGreen - dstGreen) * srcAlpha / 255; dstBlue += (srcBlue - dstBlue) * srcAlpha / 255; } else { dstRed = srcRed * srcAlpha * 255 + dstRed * dstAlpha * (255 - srcAlpha); dstGreen = srcGreen * srcAlpha * 255 + dstGreen * dstAlpha * (255 - srcAlpha); dstBlue = srcBlue * srcAlpha * 255 + dstBlue * dstAlpha * (255 - srcAlpha); dstAlpha = srcAlpha * 255 + dstAlpha * (255 - srcAlpha); if (dstAlpha != 0) { dstRed /= dstAlpha; dstGreen /= dstAlpha; dstBlue /= dstAlpha; dstAlpha /= 255; } } } dst.setPixel(dstX, dstY, ((dstRed & 0xFF) << 0) ((dstGreen & 0xFF) << 8) ((dstBlue & 0xFF) << 16)); dst.setAlpha(dstX, dstY, dstAlpha); } } }
/** * Draws the given source image data into this composite image at the given * position. * <p> * Call this internal framework method to superimpose another image atop * this composite image. * </p> * * @param src * the source image data * @param ox * the x position * @param oy * the y position */
Draws the given source image data into this composite image at the given position. Call this internal framework method to superimpose another image atop this composite image.
drawImage
{ "repo_name": "ghillairet/gef-gwt", "path": "src/main/java/org/eclipse/jface/resource/CompositeImageDescriptor.java", "license": "epl-1.0", "size": 7793 }
[ "org.eclipse.swt.graphics.ImageData", "org.eclipse.swt.graphics.PaletteData" ]
import org.eclipse.swt.graphics.ImageData; import org.eclipse.swt.graphics.PaletteData;
import org.eclipse.swt.graphics.*;
[ "org.eclipse.swt" ]
org.eclipse.swt;
2,496,124
@Test public void testTJDBCInputProperties_1() throws Exception { String name = "input"; TJDBCInputProperties result = new TJDBCInputProperties(name); assertEquals("properties.input.displayName", result.getDisplayName()); assertEquals(name, result.getName()); assertEquals(name, result.getTitle()); }
void function() throws Exception { String name = "input"; TJDBCInputProperties result = new TJDBCInputProperties(name); assertEquals(STR, result.getDisplayName()); assertEquals(name, result.getName()); assertEquals(name, result.getTitle()); }
/** * Run the TJDBCInputProperties(String) constructor test. * * @throws Exception * * @generatedBy CodePro at 17-6-20 PM3:13 */
Run the TJDBCInputProperties(String) constructor test
testTJDBCInputProperties_1
{ "repo_name": "Talend/components", "path": "components/components-jdbc/components-jdbc-definition/src/test/java/org/talend/components/jdbc/tjdbcinput/TJDBCInputPropertiesTest.java", "license": "apache-2.0", "size": 11537 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
24,270
private void reloadReferencesAndUpdateEO(ModelDiff diff, EngineeringObjectModelWrapper model) { for (ModelDiffEntry entry : diff.getDifferences().values()) { mergeEngineeringObjectWithReferencedModel(entry.getField(), model); } }
void function(ModelDiff diff, EngineeringObjectModelWrapper model) { for (ModelDiffEntry entry : diff.getDifferences().values()) { mergeEngineeringObjectWithReferencedModel(entry.getField(), model); } }
/** * Reload the references which have changed in the actual update and update the Engineering Object accordingly. */
Reload the references which have changed in the actual update and update the Engineering Object accordingly
reloadReferencesAndUpdateEO
{ "repo_name": "openengsb/openengsb", "path": "components/ekb/persistence-persist-edb/src/main/java/org/openengsb/core/ekb/persistence/persist/edb/internal/EngineeringObjectEnhancer.java", "license": "apache-2.0", "size": 13650 }
[ "org.openengsb.core.ekb.common.EngineeringObjectModelWrapper" ]
import org.openengsb.core.ekb.common.EngineeringObjectModelWrapper;
import org.openengsb.core.ekb.common.*;
[ "org.openengsb.core" ]
org.openengsb.core;
193,486
public void scrapeData() { // Copy data final DynamicData data = widget.getGridWidget().getData().getFlattenedData(); final List<DynamicColumn<DTColumnConfig>> columns = widget.getGridWidget().getColumns(); final int GRID_ROWS = data.size(); List<List<DTCellValue>> grid = new ArrayList<List<DTCellValue>>(); for ( int iRow = 0; iRow < GRID_ROWS; iRow++ ) { DynamicDataRow dataRow = data.get( iRow ); List<DTCellValue> row = new ArrayList<DTCellValue>(); for ( int iCol = 0; iCol < columns.size(); iCol++ ) { //Values put back into the Model are type-safe CellValue< ? > cv = dataRow.get( iCol ); DTColumnConfig column = columns.get( iCol ).getModelColumn(); DTCellValue dcv = cellValueFactory.convertToDTModelCell( column, cv ); dcv.setOtherwise( cv.isOtherwise() ); row.add( dcv ); } grid.add( row ); } this.model.setData( grid ); }
void function() { final DynamicData data = widget.getGridWidget().getData().getFlattenedData(); final List<DynamicColumn<DTColumnConfig>> columns = widget.getGridWidget().getColumns(); final int GRID_ROWS = data.size(); List<List<DTCellValue>> grid = new ArrayList<List<DTCellValue>>(); for ( int iRow = 0; iRow < GRID_ROWS; iRow++ ) { DynamicDataRow dataRow = data.get( iRow ); List<DTCellValue> row = new ArrayList<DTCellValue>(); for ( int iCol = 0; iCol < columns.size(); iCol++ ) { CellValue< ? > cv = dataRow.get( iCol ); DTColumnConfig column = columns.get( iCol ).getModelColumn(); DTCellValue dcv = cellValueFactory.convertToDTModelCell( column, cv ); dcv.setOtherwise( cv.isOtherwise() ); row.add( dcv ); } grid.add( row ); } this.model.setData( grid ); }
/** * Update the Decision Table model with the data contained in the grid. The * Decision Table does not synchronise model data with UI data during user * interaction with the UI. Consequentially this should be called to refresh * the Model with the UI when needed. */
Update the Decision Table model with the data contained in the grid. The Decision Table does not synchronise model data with UI data during user interaction with the UI. Consequentially this should be called to refresh the Model with the UI when needed
scrapeData
{ "repo_name": "Rikkola/guvnor", "path": "guvnor-webapp/src/main/java/org/drools/guvnor/client/decisiontable/widget/AbstractDecisionTableWidget.java", "license": "apache-2.0", "size": 52589 }
[ "java.util.ArrayList", "java.util.List", "org.drools.guvnor.client.widgets.decoratedgrid.CellValue", "org.drools.guvnor.client.widgets.decoratedgrid.DynamicColumn", "org.drools.guvnor.client.widgets.decoratedgrid.data.DynamicData", "org.drools.guvnor.client.widgets.decoratedgrid.data.DynamicDataRow", "org.drools.ide.common.client.modeldriven.dt.DTCellValue", "org.drools.ide.common.client.modeldriven.dt.DTColumnConfig" ]
import java.util.ArrayList; import java.util.List; import org.drools.guvnor.client.widgets.decoratedgrid.CellValue; import org.drools.guvnor.client.widgets.decoratedgrid.DynamicColumn; import org.drools.guvnor.client.widgets.decoratedgrid.data.DynamicData; import org.drools.guvnor.client.widgets.decoratedgrid.data.DynamicDataRow; import org.drools.ide.common.client.modeldriven.dt.DTCellValue; import org.drools.ide.common.client.modeldriven.dt.DTColumnConfig;
import java.util.*; import org.drools.guvnor.client.widgets.decoratedgrid.*; import org.drools.guvnor.client.widgets.decoratedgrid.data.*; import org.drools.ide.common.client.modeldriven.dt.*;
[ "java.util", "org.drools.guvnor", "org.drools.ide" ]
java.util; org.drools.guvnor; org.drools.ide;
2,446,657
try { // the first atom will/should be the type MP4Atom type = MP4Atom.createAtom(fis); // expect ftyp log.debug("Type {}", MP4Atom.intToType(type.getType())); //log.debug("Atom int types - free={} wide={}", MP4Atom.typeToInt("free"), MP4Atom.typeToInt("wide")); // keep a running count of the number of atoms found at the "top" levels int topAtoms = 0; // we want a moov and an mdat, anything else throw the invalid file type error while (topAtoms < 2) { MP4Atom atom = MP4Atom.createAtom(fis); switch (atom.getType()) { case 1836019574: //moov topAtoms++; MP4Atom moov = atom; // expect moov log.debug("Type {}", MP4Atom.intToType(moov.getType())); log.debug("moov children: {}", moov.getChildren()); moovOffset = fis.getOffset() - moov.getSize(); MP4Atom mvhd = moov.lookup(MP4Atom.typeToInt("mvhd"), 0); if (mvhd != null) { log.debug("Movie header atom found"); //get the initial timescale timeScale = mvhd.getTimeScale(); duration = mvhd.getDuration(); log.debug("Time scale {} Duration {}", timeScale, duration); } MP4Atom trak = moov.lookup(MP4Atom.typeToInt("trak"), 0); if (trak != null) { log.debug("Track atom found"); log.debug("trak children: {}", trak.getChildren()); // trak: tkhd, edts, mdia MP4Atom edts = trak.lookup(MP4Atom.typeToInt("edts"), 0); if (edts != null) { log.debug("Edit atom found"); log.debug("edts children: {}", edts.getChildren()); } MP4Atom mdia = trak.lookup(MP4Atom.typeToInt("mdia"), 0); if (mdia != null) { log.debug("Media atom found"); // mdia: mdhd, hdlr, minf int scale = 0; //get the media header atom MP4Atom mdhd = mdia.lookup(MP4Atom.typeToInt("mdhd"), 0); if (mdhd != null) { log.debug("Media data header atom found"); //this will be for either video or audio depending media info scale = mdhd.getTimeScale(); log.debug("Time scale {}", scale); } MP4Atom hdlr = mdia .lookup(MP4Atom.typeToInt("hdlr"), 0); if (hdlr != null) { log.debug("Handler ref atom found"); // soun or vide log.debug("Handler type: {}", MP4Atom .intToType(hdlr.getHandlerType())); String hdlrType = MP4Atom.intToType(hdlr.getHandlerType()); if ("soun".equals(hdlrType)) { if (scale > 0) { audioTimeScale = scale * 1.0; log.debug("Audio time scale: {}", audioTimeScale); } } } MP4Atom minf = mdia .lookup(MP4Atom.typeToInt("minf"), 0); if (minf != null) { log.debug("Media info atom found"); // minf: (audio) smhd, dinf, stbl / (video) vmhd, // dinf, stbl MP4Atom smhd = minf.lookup(MP4Atom .typeToInt("smhd"), 0); if (smhd != null) { log.debug("Sound header atom found"); MP4Atom dinf = minf.lookup(MP4Atom .typeToInt("dinf"), 0); if (dinf != null) { log.debug("Data info atom found"); // dinf: dref log.debug("Sound dinf children: {}", dinf .getChildren()); MP4Atom dref = dinf.lookup(MP4Atom .typeToInt("dref"), 0); if (dref != null) { log.debug("Data reference atom found"); } } MP4Atom stbl = minf.lookup(MP4Atom .typeToInt("stbl"), 0); if (stbl != null) { log.debug("Sample table atom found"); // stbl: stsd, stts, stss, stsc, stsz, stco, // stsh log.debug("Sound stbl children: {}", stbl .getChildren()); // stsd - sample description // stts - time to sample // stsc - sample to chunk // stsz - sample size // stco - chunk offset //stsd - has codec child MP4Atom stsd = stbl.lookup(MP4Atom.typeToInt("stsd"), 0); if (stsd != null) { //stsd: mp4a log.debug("Sample description atom found"); MP4Atom mp4a = stsd.getChildren().get(0); //could set the audio codec here setAudioCodecId(MP4Atom.intToType(mp4a.getType())); //log.debug("{}", ToStringBuilder.reflectionToString(mp4a)); log.debug("Sample size: {}", mp4a.getSampleSize()); int ats = mp4a.getTimeScale(); //skip invalid audio time scale if (ats > 0) { audioTimeScale = ats * 1.0; } audioChannels = mp4a.getChannelCount(); log.debug("Sample rate (audio time scale): {}", audioTimeScale); log.debug("Channels: {}", audioChannels); //mp4a: esds if (mp4a.getChildren().size() > 0) { log.debug("Elementary stream descriptor atom found"); MP4Atom esds = mp4a.getChildren().get(0); log.debug("{}", ToStringBuilder.reflectionToString(esds)); MP4Descriptor descriptor = esds.getEsd_descriptor(); log.debug("{}", ToStringBuilder.reflectionToString(descriptor)); if (descriptor != null) { Vector<MP4Descriptor> children = descriptor.getChildren(); for (int e = 0; e < children.size(); e++) { MP4Descriptor descr = children.get(e); log.debug("{}", ToStringBuilder.reflectionToString(descr)); if (descr.getChildren().size() > 0) { Vector<MP4Descriptor> children2 = descr.getChildren(); for (int e2 = 0; e2 < children2.size(); e2++) { MP4Descriptor descr2 = children2.get(e2); log.debug("{}", ToStringBuilder.reflectionToString(descr2)); if (descr2.getType() == MP4Descriptor.MP4DecSpecificInfoDescriptorTag) { //we only want the MP4DecSpecificInfoDescriptorTag audioDecoderBytes = descr2.getDSID(); //compare the bytes to get the aacaot/aottype //match first byte switch(audioDecoderBytes[0]) { case 0x12: default: //AAC LC - 12 10 audioCodecType = 1; break; case 0x0a: //AAC Main - 0A 10 audioCodecType = 0; break; case 0x11: case 0x13: //AAC LC SBR - 11 90 & 13 xx audioCodecType = 2; break; } //we want to break out of top level for loop e = 99; break; } } } } } } } //stsc - has Records MP4Atom stsc = stbl.lookup(MP4Atom.typeToInt("stsc"), 0); if (stsc != null) { log.debug("Sample to chunk atom found"); audioSamplesToChunks = stsc.getRecords(); log.debug("Record count: {}", audioSamplesToChunks.size()); MP4Atom.Record rec = audioSamplesToChunks.firstElement(); log.debug("Record data: Description index={} Samples per chunk={}", rec.getSampleDescriptionIndex(), rec.getSamplesPerChunk()); } //stsz - has Samples MP4Atom stsz = stbl.lookup(MP4Atom.typeToInt("stsz"), 0); if (stsz != null) { log.debug("Sample size atom found"); audioSamples = stsz.getSamples(); //vector full of integers log.debug("Sample size: {}", stsz.getSampleSize()); log.debug("Sample count: {}", audioSamples.size()); } //stco - has Chunks MP4Atom stco = stbl.lookup(MP4Atom.typeToInt("stco"), 0); if (stco != null) { log.debug("Chunk offset atom found"); //vector full of integers audioChunkOffsets = stco.getChunks(); log.debug("Chunk count: {}", audioChunkOffsets.size()); } //stts - has TimeSampleRecords MP4Atom stts = stbl.lookup(MP4Atom.typeToInt("stts"), 0); if (stts != null) { log.debug("Time to sample atom found"); Vector<MP4Atom.TimeSampleRecord> records = stts.getTimeToSamplesRecords(); log.debug("Record count: {}", records.size()); MP4Atom.TimeSampleRecord rec = records.firstElement(); log.debug("Record data: Consecutive samples={} Duration={}", rec.getConsecutiveSamples(), rec.getSampleDuration()); //if we have 1 record then all samples have the same duration if (records.size() > 1) { //TODO: handle audio samples with varying durations log.warn("Audio samples have differing durations, audio playback may fail"); } audioSampleDuration = rec.getSampleDuration(); } } } } } } //real duration StringBuilder sb = new StringBuilder(); double clipTime = ((double) duration / (double) timeScale); log.debug("Clip time: {}", clipTime); int minutes = (int) (clipTime / 60); if (minutes > 0) { sb.append(minutes); sb.append('.'); } //formatter for seconds / millis NumberFormat df = DecimalFormat.getInstance(); df.setMaximumFractionDigits(2); sb.append(df.format((clipTime % 60))); formattedDuration = sb.toString(); log.debug("Time: {}", formattedDuration); break; case 1835295092: //mdat topAtoms++; long dataSize = 0L; MP4Atom mdat = atom; dataSize = mdat.getSize(); log.debug("{}", ToStringBuilder.reflectionToString(mdat)); mdatOffset = fis.getOffset() - dataSize; log.debug("File size: {} mdat size: {}", file.length(), dataSize); break; case 1718773093: //free case 2003395685: //wide break; default: log.warn("Unexpected atom: {}", MP4Atom.intToType(atom.getType())); } } //add the tag name (size) to the offsets moovOffset += 8; mdatOffset += 8; log.debug("Offsets moov: {} mdat: {}", moovOffset, mdatOffset); } catch (IOException e) { log.error("Exception decoding header / atoms", e); } }
try { MP4Atom type = MP4Atom.createAtom(fis); log.debug(STR, MP4Atom.intToType(type.getType())); int topAtoms = 0; while (topAtoms < 2) { MP4Atom atom = MP4Atom.createAtom(fis); switch (atom.getType()) { case 1836019574: topAtoms++; MP4Atom moov = atom; log.debug(STR, MP4Atom.intToType(moov.getType())); log.debug(STR, moov.getChildren()); moovOffset = fis.getOffset() - moov.getSize(); MP4Atom mvhd = moov.lookup(MP4Atom.typeToInt("mvhd"), 0); if (mvhd != null) { log.debug(STR); timeScale = mvhd.getTimeScale(); duration = mvhd.getDuration(); log.debug(STR, timeScale, duration); } MP4Atom trak = moov.lookup(MP4Atom.typeToInt("trak"), 0); if (trak != null) { log.debug(STR); log.debug(STR, trak.getChildren()); MP4Atom edts = trak.lookup(MP4Atom.typeToInt("edts"), 0); if (edts != null) { log.debug(STR); log.debug(STR, edts.getChildren()); } MP4Atom mdia = trak.lookup(MP4Atom.typeToInt("mdia"), 0); if (mdia != null) { log.debug(STR); int scale = 0; MP4Atom mdhd = mdia.lookup(MP4Atom.typeToInt("mdhd"), 0); if (mdhd != null) { log.debug(STR); scale = mdhd.getTimeScale(); log.debug(STR, scale); } MP4Atom hdlr = mdia .lookup(MP4Atom.typeToInt("hdlr"), 0); if (hdlr != null) { log.debug(STR); log.debug(STR, MP4Atom .intToType(hdlr.getHandlerType())); String hdlrType = MP4Atom.intToType(hdlr.getHandlerType()); if ("soun".equals(hdlrType)) { if (scale > 0) { audioTimeScale = scale * 1.0; log.debug(STR, audioTimeScale); } } } MP4Atom minf = mdia .lookup(MP4Atom.typeToInt("minf"), 0); if (minf != null) { log.debug(STR); MP4Atom smhd = minf.lookup(MP4Atom .typeToInt("smhd"), 0); if (smhd != null) { log.debug(STR); MP4Atom dinf = minf.lookup(MP4Atom .typeToInt("dinf"), 0); if (dinf != null) { log.debug(STR); log.debug(STR, dinf .getChildren()); MP4Atom dref = dinf.lookup(MP4Atom .typeToInt("dref"), 0); if (dref != null) { log.debug(STR); } } MP4Atom stbl = minf.lookup(MP4Atom .typeToInt("stbl"), 0); if (stbl != null) { log.debug(STR); log.debug(STR, stbl .getChildren()); MP4Atom stsd = stbl.lookup(MP4Atom.typeToInt("stsd"), 0); if (stsd != null) { log.debug(STR); MP4Atom mp4a = stsd.getChildren().get(0); setAudioCodecId(MP4Atom.intToType(mp4a.getType())); log.debug(STR, mp4a.getSampleSize()); int ats = mp4a.getTimeScale(); if (ats > 0) { audioTimeScale = ats * 1.0; } audioChannels = mp4a.getChannelCount(); log.debug(STR, audioTimeScale); log.debug(STR, audioChannels); if (mp4a.getChildren().size() > 0) { log.debug(STR); MP4Atom esds = mp4a.getChildren().get(0); log.debug("{}", ToStringBuilder.reflectionToString(esds)); MP4Descriptor descriptor = esds.getEsd_descriptor(); log.debug("{}", ToStringBuilder.reflectionToString(descriptor)); if (descriptor != null) { Vector<MP4Descriptor> children = descriptor.getChildren(); for (int e = 0; e < children.size(); e++) { MP4Descriptor descr = children.get(e); log.debug("{}", ToStringBuilder.reflectionToString(descr)); if (descr.getChildren().size() > 0) { Vector<MP4Descriptor> children2 = descr.getChildren(); for (int e2 = 0; e2 < children2.size(); e2++) { MP4Descriptor descr2 = children2.get(e2); log.debug("{}", ToStringBuilder.reflectionToString(descr2)); if (descr2.getType() == MP4Descriptor.MP4DecSpecificInfoDescriptorTag) { audioDecoderBytes = descr2.getDSID(); switch(audioDecoderBytes[0]) { case 0x12: default: audioCodecType = 1; break; case 0x0a: audioCodecType = 0; break; case 0x11: case 0x13: audioCodecType = 2; break; } e = 99; break; } } } } } } } MP4Atom stsc = stbl.lookup(MP4Atom.typeToInt("stsc"), 0); if (stsc != null) { log.debug(STR); audioSamplesToChunks = stsc.getRecords(); log.debug(STR, audioSamplesToChunks.size()); MP4Atom.Record rec = audioSamplesToChunks.firstElement(); log.debug(STR, rec.getSampleDescriptionIndex(), rec.getSamplesPerChunk()); } MP4Atom stsz = stbl.lookup(MP4Atom.typeToInt("stsz"), 0); if (stsz != null) { log.debug(STR); audioSamples = stsz.getSamples(); log.debug(STR, stsz.getSampleSize()); log.debug(STR, audioSamples.size()); } MP4Atom stco = stbl.lookup(MP4Atom.typeToInt("stco"), 0); if (stco != null) { log.debug(STR); audioChunkOffsets = stco.getChunks(); log.debug(STR, audioChunkOffsets.size()); } MP4Atom stts = stbl.lookup(MP4Atom.typeToInt("stts"), 0); if (stts != null) { log.debug(STR); Vector<MP4Atom.TimeSampleRecord> records = stts.getTimeToSamplesRecords(); log.debug(STR, records.size()); MP4Atom.TimeSampleRecord rec = records.firstElement(); log.debug(STR, rec.getConsecutiveSamples(), rec.getSampleDuration()); if (records.size() > 1) { log.warn(STR); } audioSampleDuration = rec.getSampleDuration(); } } } } } } StringBuilder sb = new StringBuilder(); double clipTime = ((double) duration / (double) timeScale); log.debug(STR, clipTime); int minutes = (int) (clipTime / 60); if (minutes > 0) { sb.append(minutes); sb.append('.'); } NumberFormat df = DecimalFormat.getInstance(); df.setMaximumFractionDigits(2); sb.append(df.format((clipTime % 60))); formattedDuration = sb.toString(); log.debug(STR, formattedDuration); break; case 1835295092: topAtoms++; long dataSize = 0L; MP4Atom mdat = atom; dataSize = mdat.getSize(); log.debug("{}", ToStringBuilder.reflectionToString(mdat)); mdatOffset = fis.getOffset() - dataSize; log.debug(STR, file.length(), dataSize); break; case 1718773093: case 2003395685: break; default: log.warn(STR, MP4Atom.intToType(atom.getType())); } } moovOffset += 8; mdatOffset += 8; log.debug(STR, moovOffset, mdatOffset); } catch (IOException e) { log.error(STR, e); } }
/** * This handles the moov atom being at the beginning or end of the file, so the mdat may also * be before or after the moov atom. */
This handles the moov atom being at the beginning or end of the file, so the mdat may also be before or after the moov atom
decodeHeader
{ "repo_name": "OpenCorrelate/red5load", "path": "red5/src/main/java/org/red5/io/m4a/impl/M4AReader.java", "license": "lgpl-3.0", "size": 25037 }
[ "java.io.IOException", "java.text.DecimalFormat", "java.text.NumberFormat", "java.util.Vector", "org.apache.commons.lang.builder.ToStringBuilder", "org.red5.io.mp4.MP4Atom", "org.red5.io.mp4.MP4Descriptor" ]
import java.io.IOException; import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.Vector; import org.apache.commons.lang.builder.ToStringBuilder; import org.red5.io.mp4.MP4Atom; import org.red5.io.mp4.MP4Descriptor;
import java.io.*; import java.text.*; import java.util.*; import org.apache.commons.lang.builder.*; import org.red5.io.mp4.*;
[ "java.io", "java.text", "java.util", "org.apache.commons", "org.red5.io" ]
java.io; java.text; java.util; org.apache.commons; org.red5.io;
2,236,860
Polygon flip() { Collections.reverse(vertices); plane.flip(); return this; }
Polygon flip() { Collections.reverse(vertices); plane.flip(); return this; }
/** * Flips this polygon. * * @return this polygon */
Flips this polygon
flip
{ "repo_name": "nilsschmidt1337/ldparteditor", "path": "src/org/nschmidt/csg/Polygon.java", "license": "mit", "size": 10200 }
[ "java.util.Collections" ]
import java.util.Collections;
import java.util.*;
[ "java.util" ]
java.util;
319,224
protected void addAutoSlideStoppablePropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Presentation_autoSlideStoppable_feature"), getString("_UI_PropertyDescriptor_description", "_UI_Presentation_autoSlideStoppable_feature", "_UI_Presentation_type"), RevealPackage.Literals.PRESENTATION__AUTO_SLIDE_STOPPABLE, true, false, false, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null)); }
void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), RevealPackage.Literals.PRESENTATION__AUTO_SLIDE_STOPPABLE, true, false, false, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null)); }
/** * This adds a property descriptor for the Auto Slide Stoppable feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds a property descriptor for the Auto Slide Stoppable feature.
addAutoSlideStoppablePropertyDescriptor
{ "repo_name": "CohesionForce/reveal", "path": "plugins/com.cohesionforce.reveal.model.edit/src/com/cohesionforce/reveal/provider/PresentationItemProvider.java", "license": "epl-1.0", "size": 31411 }
[ "com.cohesionforce.reveal.RevealPackage", "org.eclipse.emf.edit.provider.ComposeableAdapterFactory", "org.eclipse.emf.edit.provider.ItemPropertyDescriptor" ]
import com.cohesionforce.reveal.RevealPackage; import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import com.cohesionforce.reveal.*; import org.eclipse.emf.edit.provider.*;
[ "com.cohesionforce.reveal", "org.eclipse.emf" ]
com.cohesionforce.reveal; org.eclipse.emf;
2,110,223
public static void changeResourceStringBundle(String path) { BUNDLE = java.util.ResourceBundle.getBundle(path); }
static void function(String path) { BUNDLE = java.util.ResourceBundle.getBundle(path); }
/** * Changes the source of a String Bundle to a given resource file * * @param path Path to the String Bundle */
Changes the source of a String Bundle to a given resource file
changeResourceStringBundle
{ "repo_name": "sammyukavi/farming-app-simulation", "path": "src/farming/app/utilities/Strings.java", "license": "mit", "size": 2859 }
[ "java.util.ResourceBundle" ]
import java.util.ResourceBundle;
import java.util.*;
[ "java.util" ]
java.util;
1,861,897
@Override public synchronized Restlet createInboundRoot() { Verifier verifier = new SecretVerifier() {
synchronized Restlet function() { Verifier verifier = new SecretVerifier() {
/** * Creates a root Restlet that will receive all incoming calls. */
Creates a root Restlet that will receive all incoming calls
createInboundRoot
{ "repo_name": "padmaragl/activiti-karaf", "path": "activiti-karaf-webapps/activiti-karaf-web-rest/src/main/java/org/activiti/rest/application/ActivitiRestApplication.java", "license": "apache-2.0", "size": 7727 }
[ "org.restlet.Restlet", "org.restlet.security.SecretVerifier", "org.restlet.security.Verifier" ]
import org.restlet.Restlet; import org.restlet.security.SecretVerifier; import org.restlet.security.Verifier;
import org.restlet.*; import org.restlet.security.*;
[ "org.restlet", "org.restlet.security" ]
org.restlet; org.restlet.security;
172,377
protected Map<String, String[]> getParameterMap() { return m_parameterMap; }
Map<String, String[]> function() { return m_parameterMap; }
/** * Returns the map of parameters read from the current request.<p> * * This method will also handle parameters from forms * of type <code>multipart/form-data</code>.<p> * * @return the map of parameters read from the current request */
Returns the map of parameters read from the current request. This method will also handle parameters from forms of type <code>multipart/form-data</code>
getParameterMap
{ "repo_name": "victos/opencms-core", "path": "src/org/opencms/workplace/CmsWorkplace.java", "license": "lgpl-2.1", "size": 80916 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,365,478
public static RewardsReport REWARDS_REPORT(Field<Integer> minMonthlyPurchases, Field<BigDecimal> minDollarAmountPurchased) { return RewardsReport.REWARDS_REPORT.call(minMonthlyPurchases, minDollarAmountPurchased); } public static final SalesByFilmCategory SALES_BY_FILM_CATEGORY = no.mesan.ark.persistering.generated.tables.SalesByFilmCategory.SALES_BY_FILM_CATEGORY; public static final SalesByStore SALES_BY_STORE = no.mesan.ark.persistering.generated.tables.SalesByStore.SALES_BY_STORE; public static final Staff STAFF = no.mesan.ark.persistering.generated.tables.Staff.STAFF; public static final StaffList STAFF_LIST = no.mesan.ark.persistering.generated.tables.StaffList.STAFF_LIST; public static final Store STORE = no.mesan.ark.persistering.generated.tables.Store.STORE;
static RewardsReport function(Field<Integer> minMonthlyPurchases, Field<BigDecimal> minDollarAmountPurchased) { return RewardsReport.REWARDS_REPORT.call(minMonthlyPurchases, minDollarAmountPurchased); } public static final SalesByFilmCategory SALES_BY_FILM_CATEGORY = no.mesan.ark.persistering.generated.tables.SalesByFilmCategory.SALES_BY_FILM_CATEGORY; public static final SalesByStore SALES_BY_STORE = no.mesan.ark.persistering.generated.tables.SalesByStore.SALES_BY_STORE; public static final Staff STAFF = no.mesan.ark.persistering.generated.tables.Staff.STAFF; public static final StaffList STAFF_LIST = no.mesan.ark.persistering.generated.tables.StaffList.STAFF_LIST; public static final Store STORE = no.mesan.ark.persistering.generated.tables.Store.STORE;
/** * Get <code>public.rewards_report</code> as a table. */
Get <code>public.rewards_report</code> as a table
REWARDS_REPORT
{ "repo_name": "mesan/fag-ark-persistering-test-jooq", "path": "fag-ark-persistering-test-jooq-spring/src/main/java/no/mesan/ark/persistering/generated/Tables.java", "license": "unlicense", "size": 8738 }
[ "java.math.BigDecimal", "no.mesan.ark.persistering.generated.tables.RewardsReport", "no.mesan.ark.persistering.generated.tables.SalesByFilmCategory", "no.mesan.ark.persistering.generated.tables.SalesByStore", "no.mesan.ark.persistering.generated.tables.Staff", "no.mesan.ark.persistering.generated.tables.StaffList", "no.mesan.ark.persistering.generated.tables.Store", "org.jooq.Field" ]
import java.math.BigDecimal; import no.mesan.ark.persistering.generated.tables.RewardsReport; import no.mesan.ark.persistering.generated.tables.SalesByFilmCategory; import no.mesan.ark.persistering.generated.tables.SalesByStore; import no.mesan.ark.persistering.generated.tables.Staff; import no.mesan.ark.persistering.generated.tables.StaffList; import no.mesan.ark.persistering.generated.tables.Store; import org.jooq.Field;
import java.math.*; import no.mesan.ark.persistering.generated.tables.*; import org.jooq.*;
[ "java.math", "no.mesan.ark", "org.jooq" ]
java.math; no.mesan.ark; org.jooq;
1,534,155
public static boolean containsAll(Map<?, ?> base, Map<?, ?> map) { assert base != null; assert map != null; for (Map.Entry<?, ?> entry : map.entrySet()) if (base.containsKey(entry.getKey())) { Object val = base.get(entry.getKey()); if (val == null && entry.getValue() == null) continue; if (val == null || entry.getValue() == null || !val.equals(entry.getValue())) // Mismatch found. return false; } else return false; // All entries in 'map' are contained in base map. return true; }
static boolean function(Map<?, ?> base, Map<?, ?> map) { assert base != null; assert map != null; for (Map.Entry<?, ?> entry : map.entrySet()) if (base.containsKey(entry.getKey())) { Object val = base.get(entry.getKey()); if (val == null && entry.getValue() == null) continue; if (val == null entry.getValue() == null !val.equals(entry.getValue())) return false; } else return false; return true; }
/** * Checks if the map passed in is contained in base map. * * @param base Base map. * @param map Map to check. * @return {@code True} if all entries within map are contained in base map, * {@code false} otherwise. */
Checks if the map passed in is contained in base map
containsAll
{ "repo_name": "ascherbakoff/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java", "license": "apache-2.0", "size": 385578 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,273,609
public I_CmsEditableGroupRow buildRow(CmsEditableGroup group, Component component); } private AbstractOrderedLayout m_container; private boolean m_editEnabled; private I_EmptyHandler m_emptyHandler; private Label m_errorLabel = new Label(); private Listener m_errorListener; private String m_errorMessage; private boolean m_hideAdd; private Supplier<Component> m_newComponentFactory; private I_RowBuilder m_rowBuilder = new DefaultRowBuilder(); private String m_rowCaption; public CmsEditableGroup( AbstractOrderedLayout container, Supplier<Component> componentFactory, I_EmptyHandler emptyHandler) { m_hideAdd = false; m_emptyHandler = emptyHandler; m_container = container; m_newComponentFactory = componentFactory; m_emptyHandler = emptyHandler; m_emptyHandler.init(this); m_errorListener = new Listener() { private static final long serialVersionUID = 1L;
I_CmsEditableGroupRow function(CmsEditableGroup group, Component component); } private AbstractOrderedLayout m_container; private boolean m_editEnabled; private I_EmptyHandler m_emptyHandler; private Label m_errorLabel = new Label(); private Listener m_errorListener; private String m_errorMessage; private boolean m_hideAdd; private Supplier<Component> m_newComponentFactory; private I_RowBuilder m_rowBuilder = new DefaultRowBuilder(); private String m_rowCaption; public CmsEditableGroup( AbstractOrderedLayout container, Supplier<Component> componentFactory, I_EmptyHandler emptyHandler) { m_hideAdd = false; m_emptyHandler = emptyHandler; m_container = container; m_newComponentFactory = componentFactory; m_emptyHandler = emptyHandler; m_emptyHandler.init(this); m_errorListener = new Listener() { private static final long serialVersionUID = 1L;
/** * Builds a row for the given group by wrapping the given component. * * @param group the group * @param component the component * @return the new row */
Builds a row for the given group by wrapping the given component
buildRow
{ "repo_name": "alkacon/opencms-core", "path": "src/org/opencms/ui/components/editablegroup/CmsEditableGroup.java", "license": "lgpl-2.1", "size": 15115 }
[ "com.google.common.base.Supplier", "com.vaadin.ui.AbstractOrderedLayout", "com.vaadin.ui.Component", "com.vaadin.v7.ui.Label" ]
import com.google.common.base.Supplier; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.Component; import com.vaadin.v7.ui.Label;
import com.google.common.base.*; import com.vaadin.ui.*; import com.vaadin.v7.ui.*;
[ "com.google.common", "com.vaadin.ui", "com.vaadin.v7" ]
com.google.common; com.vaadin.ui; com.vaadin.v7;
152,694
public UiNode getNode() { return this.node; } /** * {@inheritDoc}
UiNode function() { return this.node; } /** * {@inheritDoc}
/** * This method gets the {@link AbstractUiNode node} that owns this adapter. * * @return the owing {@link AbstractUiNode node}. */
This method gets the <code>AbstractUiNode node</code> that owns this adapter
getNode
{ "repo_name": "m-m-m/multimedia", "path": "mmm-uit/mmm-uit-api/src/main/java/net/sf/mmm/ui/toolkit/base/view/AbstractUiNodeAdapter.java", "license": "apache-2.0", "size": 5518 }
[ "net.sf.mmm.ui.toolkit.api.view.UiNode" ]
import net.sf.mmm.ui.toolkit.api.view.UiNode;
import net.sf.mmm.ui.toolkit.api.view.*;
[ "net.sf.mmm" ]
net.sf.mmm;
2,334,443
protected void onDrawBitmap(final Canvas canvas, final Rect src, final Rect dst) { if (hasBitmap()) { canvas.drawBitmap(mBitmap.bmp, src, dst, mPaint); } }
void function(final Canvas canvas, final Rect src, final Rect dst) { if (hasBitmap()) { canvas.drawBitmap(mBitmap.bmp, src, dst, mPaint); } }
/** * Override this method to customize how to draw the bitmap to the canvas for the given bounds. * The bitmap to be drawn can be found at {@link #getBitmap()}. */
Override this method to customize how to draw the bitmap to the canvas for the given bounds. The bitmap to be drawn can be found at <code>#getBitmap()</code>
onDrawBitmap
{ "repo_name": "s20121035/rk3288_android5.1_repo", "path": "frameworks/opt/bitmap/src/com/android/bitmap/drawable/BasicBitmapDrawable.java", "license": "gpl-3.0", "size": 13943 }
[ "android.graphics.Canvas", "android.graphics.Rect" ]
import android.graphics.Canvas; import android.graphics.Rect;
import android.graphics.*;
[ "android.graphics" ]
android.graphics;
1,827,245
public static Constraint complexMembers() { return new PathConstraint("Complex/component*"); }
static Constraint function() { return new PathConstraint(STR); }
/** * From Complex to its members recursively (also getting member of the inner complexes). * @return generative constraint to get the members of the Complex */
From Complex to its members recursively (also getting member of the inner complexes)
complexMembers
{ "repo_name": "CreativeCodingLab/PathwayMatrix", "path": "src/org/biopax/paxtools/pattern/constraint/ConBox.java", "license": "mit", "size": 19558 }
[ "org.biopax.paxtools.pattern.Constraint" ]
import org.biopax.paxtools.pattern.Constraint;
import org.biopax.paxtools.pattern.*;
[ "org.biopax.paxtools" ]
org.biopax.paxtools;
788,224
@GET @Produces(MediaType.APPLICATION_JSON) public Response getMessage( @PathParam("user") final String user, @PathParam("domain") final String domain, @PathParam("messageid") final UUID messageId, @QueryParam("label") final Integer labelId, @QueryParam("markseen") @DefaultValue("false") final boolean markAsSeen, @QueryParam("adjacent") @DefaultValue("false") final boolean getAdjacentIds) { Mailbox mailbox = new Mailbox(user, domain); byte[] response; Map<String, Object> result = new HashMap<String, Object>(3); try { Message message = messageDAO.getParsed(mailbox, messageId); result.put("message", message); // automatically mark as seen if requested and not seen yet if (markAsSeen && (message.getMarkers() == null || !message.getMarkers().contains(Marker.SEEN))) { Set<Marker> markers = new HashSet<Marker>(1); markers.add(Marker.SEEN); messageDAO.addMarker(mailbox, markers, messageId); } // get adjacent message ids (prev/next) if (getAdjacentIds) { Assert.notNull(labelId, "Adjacent messages require label."); // fetch next message ID List<UUID> ids = messageDAO.getMessageIds(mailbox, labelId, messageId, 2, true); if(ids.size() == 2) result.put("next", ids.get(1)); // fetch previous message ID ids = messageDAO.getMessageIds(mailbox, labelId, messageId, 2, false); if(ids.size() == 2) result.put("prev", ids.get(1)); } // get message as JSON response = JSONUtils.fromObject(result); } catch (IllegalArgumentException iae) { throw new BadRequestException(iae.getMessage()); } catch (Exception e) { logger.warn("Internal Server Error: ", e); throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR); } return Response.ok(response, MediaType.APPLICATION_JSON).build(); }
@Produces(MediaType.APPLICATION_JSON) Response function( @PathParam("user") final String user, @PathParam(STR) final String domain, @PathParam(STR) final UUID messageId, @QueryParam("label") final Integer labelId, @QueryParam(STR) @DefaultValue("false") final boolean markAsSeen, @QueryParam(STR) @DefaultValue("false") final boolean getAdjacentIds) { Mailbox mailbox = new Mailbox(user, domain); byte[] response; Map<String, Object> result = new HashMap<String, Object>(3); try { Message message = messageDAO.getParsed(mailbox, messageId); result.put(STR, message); if (markAsSeen && (message.getMarkers() == null !message.getMarkers().contains(Marker.SEEN))) { Set<Marker> markers = new HashSet<Marker>(1); markers.add(Marker.SEEN); messageDAO.addMarker(mailbox, markers, messageId); } if (getAdjacentIds) { Assert.notNull(labelId, STR); List<UUID> ids = messageDAO.getMessageIds(mailbox, labelId, messageId, 2, true); if(ids.size() == 2) result.put("next", ids.get(1)); ids = messageDAO.getMessageIds(mailbox, labelId, messageId, 2, false); if(ids.size() == 2) result.put("prev", ids.get(1)); } response = JSONUtils.fromObject(result); } catch (IllegalArgumentException iae) { throw new BadRequestException(iae.getMessage()); } catch (Exception e) { logger.warn(STR, e); throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR); } return Response.ok(response, MediaType.APPLICATION_JSON).build(); }
/** * Get parsed message contents (headers and body) * * @param account * @param messageId * @param labelId * @param markAsSeen Automatically mark as SEEN * @param getAdjacentIds Get prev/next message IDs in given label * @return */
Get parsed message contents (headers and body)
getMessage
{ "repo_name": "normanmaurer/elasticinbox", "path": "modules/rest/src/main/java/com/elasticinbox/rest/v2/SingleMessageResource.java", "license": "bsd-3-clause", "size": 15275 }
[ "com.elasticinbox.common.utils.Assert", "com.elasticinbox.common.utils.JSONUtils", "com.elasticinbox.core.model.Mailbox", "com.elasticinbox.core.model.Marker", "com.elasticinbox.core.model.Message", "com.elasticinbox.rest.BadRequestException", "java.util.HashMap", "java.util.HashSet", "java.util.List", "java.util.Map", "java.util.Set", "javax.ws.rs.DefaultValue", "javax.ws.rs.PathParam", "javax.ws.rs.Produces", "javax.ws.rs.QueryParam", "javax.ws.rs.WebApplicationException", "javax.ws.rs.core.MediaType", "javax.ws.rs.core.Response" ]
import com.elasticinbox.common.utils.Assert; import com.elasticinbox.common.utils.JSONUtils; import com.elasticinbox.core.model.Mailbox; import com.elasticinbox.core.model.Marker; import com.elasticinbox.core.model.Message; import com.elasticinbox.rest.BadRequestException; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import javax.ws.rs.DefaultValue; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response;
import com.elasticinbox.common.utils.*; import com.elasticinbox.core.model.*; import com.elasticinbox.rest.*; import java.util.*; import javax.ws.rs.*; import javax.ws.rs.core.*;
[ "com.elasticinbox.common", "com.elasticinbox.core", "com.elasticinbox.rest", "java.util", "javax.ws" ]
com.elasticinbox.common; com.elasticinbox.core; com.elasticinbox.rest; java.util; javax.ws;
332,619
public void setNullCharacterStream(Reader nullCharacterStream) { this.nullCharacterStream = nullCharacterStream; }
void function(Reader nullCharacterStream) { this.nullCharacterStream = nullCharacterStream; }
/** * Sets the value to return when a SQL null is encountered as the result of * invoking a <code>getCharacterStream</code> method. * * @param nullCharacterStream the value */
Sets the value to return when a SQL null is encountered as the result of invoking a <code>getCharacterStream</code> method
setNullCharacterStream
{ "repo_name": "reesun/dbutils", "path": "src/main/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSet.java", "license": "apache-2.0", "size": 17687 }
[ "java.io.Reader" ]
import java.io.Reader;
import java.io.*;
[ "java.io" ]
java.io;
692,274
public AxisSpace reserveSpace(Graphics2D g2, Plot plot, Rectangle2D plotArea, RectangleEdge edge, AxisSpace space) { // create a new space object if one wasn't supplied... if (space == null) { space = new AxisSpace(); } // if the axis is not visible, no additional space is required... if (!isVisible()) { return space; } // if the axis has a fixed dimension, return it... double dimension = getFixedDimension(); if (dimension > 0.0) { space.ensureAtLeast(dimension, edge); } // get the axis label size and update the space object... Rectangle2D labelEnclosure = getLabelEnclosure(g2, edge); double labelHeight = 0.0; double labelWidth = 0.0; double tickLabelBandsDimension = 0.0; for (int i = 0; i < this.labelInfo.length; i++) { PeriodAxisLabelInfo info = this.labelInfo[i]; FontMetrics fm = g2.getFontMetrics(info.getLabelFont()); tickLabelBandsDimension += info.getPadding().extendHeight(fm.getHeight()); } if (RectangleEdge.isTopOrBottom(edge)) { labelHeight = labelEnclosure.getHeight(); space.add(labelHeight + tickLabelBandsDimension, edge); } else if (RectangleEdge.isLeftOrRight(edge)) { labelWidth = labelEnclosure.getWidth(); space.add(labelWidth + tickLabelBandsDimension, edge); } // add space for the outer tick labels, if any... double tickMarkSpace = 0.0; if (isTickMarksVisible()) { tickMarkSpace = getTickMarkOutsideLength(); } if (this.minorTickMarksVisible) { tickMarkSpace = Math.max(tickMarkSpace, this.minorTickMarkOutsideLength); } space.add(tickMarkSpace, edge); return space; }
AxisSpace function(Graphics2D g2, Plot plot, Rectangle2D plotArea, RectangleEdge edge, AxisSpace space) { if (space == null) { space = new AxisSpace(); } if (!isVisible()) { return space; } double dimension = getFixedDimension(); if (dimension > 0.0) { space.ensureAtLeast(dimension, edge); } Rectangle2D labelEnclosure = getLabelEnclosure(g2, edge); double labelHeight = 0.0; double labelWidth = 0.0; double tickLabelBandsDimension = 0.0; for (int i = 0; i < this.labelInfo.length; i++) { PeriodAxisLabelInfo info = this.labelInfo[i]; FontMetrics fm = g2.getFontMetrics(info.getLabelFont()); tickLabelBandsDimension += info.getPadding().extendHeight(fm.getHeight()); } if (RectangleEdge.isTopOrBottom(edge)) { labelHeight = labelEnclosure.getHeight(); space.add(labelHeight + tickLabelBandsDimension, edge); } else if (RectangleEdge.isLeftOrRight(edge)) { labelWidth = labelEnclosure.getWidth(); space.add(labelWidth + tickLabelBandsDimension, edge); } double tickMarkSpace = 0.0; if (isTickMarksVisible()) { tickMarkSpace = getTickMarkOutsideLength(); } if (this.minorTickMarksVisible) { tickMarkSpace = Math.max(tickMarkSpace, this.minorTickMarkOutsideLength); } space.add(tickMarkSpace, edge); return space; }
/** * Estimates the space (height or width) required to draw the axis. * * @param g2 the graphics device. * @param plot the plot that the axis belongs to. * @param plotArea the area within which the plot (including axes) should * be drawn. * @param edge the axis location. * @param space space already reserved. * * @return The space required to draw the axis (including pre-reserved * space). */
Estimates the space (height or width) required to draw the axis
reserveSpace
{ "repo_name": "ibestvina/multithread-centiscape", "path": "CentiScaPe2.1/src/main/java/org/jfree/chart/axis/PeriodAxis.java", "license": "mit", "size": 43095 }
[ "java.awt.FontMetrics", "java.awt.Graphics2D", "java.awt.geom.Rectangle2D", "org.jfree.chart.plot.Plot", "org.jfree.ui.RectangleEdge" ]
import java.awt.FontMetrics; import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; import org.jfree.chart.plot.Plot; import org.jfree.ui.RectangleEdge;
import java.awt.*; import java.awt.geom.*; import org.jfree.chart.plot.*; import org.jfree.ui.*;
[ "java.awt", "org.jfree.chart", "org.jfree.ui" ]
java.awt; org.jfree.chart; org.jfree.ui;
1,274,473
public byte[] signAuthn(final byte[] toBeSigned, final boolean requireSecureReader, final String applicationName) throws NoSuchAlgorithmException, CardException, IOException, InterruptedException, UserCancelledException { final MessageDigest messageDigest = BeIDDigest.SHA_1 .getMessageDigestInstance(); final byte[] digest = messageDigest.digest(toBeSigned); return this.sign(digest, BeIDDigest.SHA_1, FileType.AuthentificationCertificate, requireSecureReader, applicationName); }
byte[] function(final byte[] toBeSigned, final boolean requireSecureReader, final String applicationName) throws NoSuchAlgorithmException, CardException, IOException, InterruptedException, UserCancelledException { final MessageDigest messageDigest = BeIDDigest.SHA_1 .getMessageDigestInstance(); final byte[] digest = messageDigest.digest(toBeSigned); return this.sign(digest, BeIDDigest.SHA_1, FileType.AuthentificationCertificate, requireSecureReader, applicationName); }
/** * Create an authentication signature. * * @param toBeSigned * the data to be signed * @param requireSecureReader * whether to require a secure pinpad reader to obtain the * citizen's PIN if false, the current BeIDCardUI will be used in * the absence of a secure pinpad reader. If true, an exception * will be thrown unless a SPR is available * @param applicationName * the optional application name. * @return a SHA-1 digest of the input data signed by the citizen's * authentication key * @throws NoSuchAlgorithmException * @throws CardException * @throws IOException * @throws InterruptedException * @throws UserCancelledException */
Create an authentication signature
signAuthn
{ "repo_name": "brunogoossens/BEID-CommandLineInterface", "path": "commons-eid-client/src/main/java/be/fedict/commons/eid/client/BeIDCard.java", "license": "gpl-3.0", "size": 60187 }
[ "be.fedict.commons.eid.client.impl.BeIDDigest", "be.fedict.commons.eid.client.spi.UserCancelledException", "java.io.IOException", "java.security.MessageDigest", "java.security.NoSuchAlgorithmException", "javax.smartcardio.CardException" ]
import be.fedict.commons.eid.client.impl.BeIDDigest; import be.fedict.commons.eid.client.spi.UserCancelledException; import java.io.IOException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import javax.smartcardio.CardException;
import be.fedict.commons.eid.client.impl.*; import be.fedict.commons.eid.client.spi.*; import java.io.*; import java.security.*; import javax.smartcardio.*;
[ "be.fedict.commons", "java.io", "java.security", "javax.smartcardio" ]
be.fedict.commons; java.io; java.security; javax.smartcardio;
810,833
private static void comprobarFechasFacturas(String tipo, Date[] fechaPagoFacturaOriginal, Date[] fechaPagoFacturaMigrated) { boolean distinto = false; if (fechaPagoFacturaOriginal.length != fechaPagoFacturaMigrated.length) { distinto = true; log.error("El número de fechas de facturas " + tipo + " originales y migradas es distinto: " + fechaPagoFacturaOriginal.length + " y " + fechaPagoFacturaMigrated.length); } else { for (int i = 0; i < fechaPagoFacturaOriginal.length; i++) { if (!fechaPagoFacturaOriginal[i].equals(fechaPagoFacturaMigrated[i])) { distinto = true; log.error("La fecha de pago de una factura de las " + tipo + " es diferente:" + "\noriginal: " + fechaPagoFacturaOriginal[i] + "\nmigrada: " + fechaPagoFacturaMigrated[i]); } } } if (!distinto) { log.info("El importe de las facturas " + tipo + " originales y migradas es el mismo"); } }
static void function(String tipo, Date[] fechaPagoFacturaOriginal, Date[] fechaPagoFacturaMigrated) { boolean distinto = false; if (fechaPagoFacturaOriginal.length != fechaPagoFacturaMigrated.length) { distinto = true; log.error(STR + tipo + STR + fechaPagoFacturaOriginal.length + STR + fechaPagoFacturaMigrated.length); } else { for (int i = 0; i < fechaPagoFacturaOriginal.length; i++) { if (!fechaPagoFacturaOriginal[i].equals(fechaPagoFacturaMigrated[i])) { distinto = true; log.error(STR + tipo + STR + STR + fechaPagoFacturaOriginal[i] + STR + fechaPagoFacturaMigrated[i]); } } } if (!distinto) { log.info(STR + tipo + STR); } }
/** * tests the value of the dates migrated and original */
tests the value of the dates migrated and original
comprobarFechasFacturas
{ "repo_name": "autentia/TNTConcept", "path": "tntconcept-test/src/main/java/com/autentia/tnt/bill/migration/BillToBillPaymentMigration.java", "license": "gpl-3.0", "size": 11875 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
1,919,595
@DELETE @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response deleteClienteUs(ClienteUs cliente) { RotondAndesTM tm = new RotondAndesTM(getPath()); try { tm.deleteClienteUs(cliente); } catch (Exception e) { return Response.status(500).entity(doErrorMessage(e)).build(); } return Response.status(200).entity(cliente).build(); }
@Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response function(ClienteUs cliente) { RotondAndesTM tm = new RotondAndesTM(getPath()); try { tm.deleteClienteUs(cliente); } catch (Exception e) { return Response.status(500).entity(doErrorMessage(e)).build(); } return Response.status(200).entity(cliente).build(); }
/** * Metodo que expone servicio REST usando DELETE que elimina el video que recibe en Json * <b>URL: </b> http://"ip o nombre de host":8080/VideoAndes/rest/videos * @param video - video a aliminar. * @return Json con el video que elimino o Json con el error que se produjo */
Metodo que expone servicio REST usando DELETE que elimina el video que recibe en Json
deleteClienteUs
{ "repo_name": "amvalero10/Iteracion2_final", "path": "src/rest/ClienteUsService.java", "license": "mit", "size": 11706 }
[ "javax.ws.rs.Consumes", "javax.ws.rs.Produces", "javax.ws.rs.core.MediaType", "javax.ws.rs.core.Response" ]
import javax.ws.rs.Consumes; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response;
import javax.ws.rs.*; import javax.ws.rs.core.*;
[ "javax.ws" ]
javax.ws;
2,337,689
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { ObjectInputStream.GetField fields = in.readFields(); String language = (String)fields.get("language", ""); String script = (String)fields.get("script", ""); String country = (String)fields.get("country", ""); String variant = (String)fields.get("variant", ""); String extStr = (String)fields.get("extensions", ""); baseLocale = BaseLocale.getInstance(convertOldISOCodes(language), script, country, variant); if (extStr.length() > 0) { try { InternalLocaleBuilder bldr = new InternalLocaleBuilder(); bldr.setExtensions(extStr); localeExtensions = bldr.getLocaleExtensions(); } catch (LocaleSyntaxException e) { throw new IllformedLocaleException(e.getMessage()); } } else { localeExtensions = null; } }
void function(ObjectInputStream in) throws IOException, ClassNotFoundException { ObjectInputStream.GetField fields = in.readFields(); String language = (String)fields.get(STR, STRscriptSTRSTRcountrySTRSTRvariantSTRSTRextensionsSTR"); baseLocale = BaseLocale.getInstance(convertOldISOCodes(language), script, country, variant); if (extStr.length() > 0) { try { InternalLocaleBuilder bldr = new InternalLocaleBuilder(); bldr.setExtensions(extStr); localeExtensions = bldr.getLocaleExtensions(); } catch (LocaleSyntaxException e) { throw new IllformedLocaleException(e.getMessage()); } } else { localeExtensions = null; } }
/** * Deserializes this <code>Locale</code>. * @param in the <code>ObjectInputStream</code> to read * @throws IOException * @throws ClassNotFoundException * @throws IllformedLocaleException * @since 1.7 */
Deserializes this <code>Locale</code>
readObject
{ "repo_name": "universsky/openjdk", "path": "jdk/src/java.base/share/classes/java/util/Locale.java", "license": "gpl-2.0", "size": 137045 }
[ "java.io.IOException", "java.io.ObjectInputStream" ]
import java.io.IOException; import java.io.ObjectInputStream;
import java.io.*;
[ "java.io" ]
java.io;
2,103,489
private KeyStoreManager prepareServerKeystore() { KeyStoreManager keystore = keyStoreService.getSystemKeyStore(); if(!keystore.aliasExists(X509ExtendedKeyManagerImpl.HTTPS_ALIAS)) { keystore.createOrUpdateKey(X509ExtendedKeyManagerImpl.HTTPS_ALIAS, "RSA", 2048, generateCertificateInfo()); keyStoreService.saveKeyStore(keystore); } return keystore; }
KeyStoreManager function() { KeyStoreManager keystore = keyStoreService.getSystemKeyStore(); if(!keystore.aliasExists(X509ExtendedKeyManagerImpl.HTTPS_ALIAS)) { keystore.createOrUpdateKey(X509ExtendedKeyManagerImpl.HTTPS_ALIAS, "RSA", 2048, generateCertificateInfo()); keyStoreService.saveKeyStore(keystore); } return keystore; }
/** * Prepares the keystore for serving HTTPs requests. This method will create the keystore if it does not exist * and generate a self-signed certificate. If the keystore already exists, it is not modified in any way. * * @return a prepared keystore */
Prepares the keystore for serving HTTPs requests. This method will create the keystore if it does not exist and generate a self-signed certificate. If the keystore already exists, it is not modified in any way
prepareServerKeystore
{ "repo_name": "apruden/agate", "path": "agate-webapp/src/main/java/org/obiba/agate/config/ssl/SslContextFactoryImpl.java", "license": "gpl-3.0", "size": 2487 }
[ "org.obiba.security.KeyStoreManager", "org.obiba.ssl.X509ExtendedKeyManagerImpl" ]
import org.obiba.security.KeyStoreManager; import org.obiba.ssl.X509ExtendedKeyManagerImpl;
import org.obiba.security.*; import org.obiba.ssl.*;
[ "org.obiba.security", "org.obiba.ssl" ]
org.obiba.security; org.obiba.ssl;
935,610
@NotNull(message = "Updated time is never NULL") public Github.Time updated() throws IOException { try { return new Github.Time(this.jsn.text("updated_at")); } catch (final ParseException ex) { throw new IllegalArgumentException( "Cannot parse value of 'updated_at' property", ex ); } } }
@NotNull(message = STR) Github.Time function() throws IOException { try { return new Github.Time(this.jsn.text(STR)); } catch (final ParseException ex) { throw new IllegalArgumentException( STR, ex ); } } }
/** * Returns the value of updated_at property of User's JSON. * @return The 'updated_at' property value. * @throws IOException If any I/O error occurs. */
Returns the value of updated_at property of User's JSON
updated
{ "repo_name": "cvrebert/typed-github", "path": "src/main/java/com/jcabi/github/User.java", "license": "bsd-3-clause", "size": 17501 }
[ "java.io.IOException", "java.text.ParseException", "javax.validation.constraints.NotNull" ]
import java.io.IOException; import java.text.ParseException; import javax.validation.constraints.NotNull;
import java.io.*; import java.text.*; import javax.validation.constraints.*;
[ "java.io", "java.text", "javax.validation" ]
java.io; java.text; javax.validation;
443,026
public void testAddValue() { DefaultKeyedValues v1 = new DefaultKeyedValues(); v1.addValue("A", 1.0); assertEquals(new Double(1.0), v1.getValue("A")); v1.addValue("B", 2.0); assertEquals(new Double(2.0), v1.getValue("B")); v1.addValue("B", 3.0); assertEquals(new Double(3.0), v1.getValue("B")); assertEquals(2, v1.getItemCount()); v1.addValue("A", null); assertNull(v1.getValue("A")); assertEquals(2, v1.getItemCount()); boolean pass = false; try { v1.addValue(null, 99.9); } catch (IllegalArgumentException e) { pass = true; } assertTrue(pass); }
void function() { DefaultKeyedValues v1 = new DefaultKeyedValues(); v1.addValue("A", 1.0); assertEquals(new Double(1.0), v1.getValue("A")); v1.addValue("B", 2.0); assertEquals(new Double(2.0), v1.getValue("B")); v1.addValue("B", 3.0); assertEquals(new Double(3.0), v1.getValue("B")); assertEquals(2, v1.getItemCount()); v1.addValue("A", null); assertNull(v1.getValue("A")); assertEquals(2, v1.getItemCount()); boolean pass = false; try { v1.addValue(null, 99.9); } catch (IllegalArgumentException e) { pass = true; } assertTrue(pass); }
/** * Some checks for the addValue() method. */
Some checks for the addValue() method
testAddValue
{ "repo_name": "JSansalone/JFreeChart", "path": "tests/org/jfree/data/junit/DefaultKeyedValuesTests.java", "license": "lgpl-2.1", "size": 16825 }
[ "org.jfree.data.DefaultKeyedValues" ]
import org.jfree.data.DefaultKeyedValues;
import org.jfree.data.*;
[ "org.jfree.data" ]
org.jfree.data;
1,802,267
public RawGatewayInfo getGatewayInfo(Connection connection) { final RawGatewayInfo info = mMap.get(connection); if (info != null) { return info; } return EMPTY_INFO; }
RawGatewayInfo function(Connection connection) { final RawGatewayInfo info = mMap.get(connection); if (info != null) { return info; } return EMPTY_INFO; }
/** * If the parameter matches the connection object we previously saved through * setGatewayInfoForConnection, return the associated raw gateway info data. If not, then * return an empty raw gateway info. */
If the parameter matches the connection object we previously saved through setGatewayInfoForConnection, return the associated raw gateway info data. If not, then return an empty raw gateway info
getGatewayInfo
{ "repo_name": "md5555/android_packages_services_Telephony", "path": "src/com/android/phone/CallGatewayManager.java", "license": "apache-2.0", "size": 8323 }
[ "com.android.internal.telephony.Connection" ]
import com.android.internal.telephony.Connection;
import com.android.internal.telephony.*;
[ "com.android.internal" ]
com.android.internal;
528,962
@Override public void run() { final Path path = Paths.get(spath); try { // We wait until the file we are told to monitor exists. while(!Files.exists(path)) { Thread.sleep(200); } // get the first event before looping WatchKey key = null; while(session.isOpen() && connected && (key = watcher.take()) != null) { try { if (!Files.exists(path)) continue; for (WatchEvent<?> event : key.pollEvents()) { if (!Files.exists(path)) continue; Path epath = (Path)event.context(); if (!Files.isDirectory(path) && !path.endsWith(epath)) continue; try { // Data has changed, read its shape and publish the event using a web socket. final IDataHolder holder = ServiceHolder.getLoaderService().getData(spath, new IMonitor.Stub()); if (holder == null) continue; // We do not stop if the loader got nothing. final ILazyDataset lz = sdataset!=null && !"".equals(sdataset) ? holder.getLazyDataset(sdataset) : holder.getLazyDataset(0); if (lz == null) continue; // We do not stop if the loader got nothing. if (lz instanceof IDynamicDataset) { ((IDynamicDataset)lz).refreshShape(); } if (writing) { ServiceHolder.getLoaderService().clearSoftReferenceCache(spath); } final DataEvent evt = new DataEvent(lz.getName(), lz.getShape()); evt.setFilePath(spath); // We manually JSON the object because we // do not want a dependency and object simple String json = evt.encode(); session.getRemote().sendString(json); if (diagInfo!=null) diagInfo.record("JSON Send", json); } catch (Exception ne) { logger.error("Exception getting data from "+path); continue; } break; } } finally { key.reset(); } } } catch (Exception e) { logger.error("Exception monitoring "+path, e); if (session.isOpen()) session.close(403, e.getMessage()); } finally { if (diagInfo!=null) diagInfo.record("Close Thread", Thread.currentThread().getName()); try { watcher.close(); } catch (IOException e) { logger.error("Error closing watcher",e); } } } }
void function() { final Path path = Paths.get(spath); try { while(!Files.exists(path)) { Thread.sleep(200); } WatchKey key = null; while(session.isOpen() && connected && (key = watcher.take()) != null) { try { if (!Files.exists(path)) continue; for (WatchEvent<?> event : key.pollEvents()) { if (!Files.exists(path)) continue; Path epath = (Path)event.context(); if (!Files.isDirectory(path) && !path.endsWith(epath)) continue; try { final IDataHolder holder = ServiceHolder.getLoaderService().getData(spath, new IMonitor.Stub()); if (holder == null) continue; final ILazyDataset lz = sdataset!=null && !STRJSON SendSTRException getting data from STRException monitoring STRClose ThreadSTRError closing watcher",e); } } } }
/** * In order to implement a file watcher, we loop forever * ensuring requesting to take the next item from the file * watchers queue. */
In order to implement a file watcher, we loop forever ensuring requesting to take the next item from the file watchers queue
run
{ "repo_name": "jamesmudd/dawnsci", "path": "org.eclipse.dawnsci.remotedataset.server/src/org/eclipse/dawnsci/remotedataset/server/event/FileMonitorSocket.java", "license": "epl-1.0", "size": 7100 }
[ "java.nio.file.Files", "java.nio.file.Path", "java.nio.file.Paths", "java.nio.file.WatchEvent", "java.nio.file.WatchKey", "org.eclipse.dawnsci.analysis.api.io.IDataHolder", "org.eclipse.dawnsci.remotedataset.ServiceHolder", "org.eclipse.january.IMonitor", "org.eclipse.january.dataset.ILazyDataset" ]
import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.WatchEvent; import java.nio.file.WatchKey; import org.eclipse.dawnsci.analysis.api.io.IDataHolder; import org.eclipse.dawnsci.remotedataset.ServiceHolder; import org.eclipse.january.IMonitor; import org.eclipse.january.dataset.ILazyDataset;
import java.nio.file.*; import org.eclipse.dawnsci.analysis.api.io.*; import org.eclipse.dawnsci.remotedataset.*; import org.eclipse.january.*; import org.eclipse.january.dataset.*;
[ "java.nio", "org.eclipse.dawnsci", "org.eclipse.january" ]
java.nio; org.eclipse.dawnsci; org.eclipse.january;
55,503
protected IRI getIdOfCreatedDisco(IRI updateEventID, Rdf4jTriplestore ts){ IRI createdDisco = null; Set<Statement> stmts = null; try { if (this.isEventId(updateEventID, ts)) { stmts = ts.getStatements(updateEventID, PROV.GENERATED, null, updateEventID); } if (stmts != null){ for (Statement stmt:stmts){ Value vObject = stmt.getObject(); if (vObject instanceof IRI){ IRI iri = (IRI)vObject; if (this.isDiscoId(iri, ts)){ createdDisco = (IRI)vObject; break; } } } } } catch (Exception e) { throw new RMapException (e); } return createdDisco; }
IRI function(IRI updateEventID, Rdf4jTriplestore ts){ IRI createdDisco = null; Set<Statement> stmts = null; try { if (this.isEventId(updateEventID, ts)) { stmts = ts.getStatements(updateEventID, PROV.GENERATED, null, updateEventID); } if (stmts != null){ for (Statement stmt:stmts){ Value vObject = stmt.getObject(); if (vObject instanceof IRI){ IRI iri = (IRI)vObject; if (this.isDiscoId(iri, ts)){ createdDisco = (IRI)vObject; break; } } } } } catch (Exception e) { throw new RMapException (e); } return createdDisco; }
/** * Get IRI of a created DiSCO from an update Event. * * @param updateEventID IRI of an update event * @param ts the triplestore instance * @return IRI of created DiSCO from UpdateEvent, or null if not found */
Get IRI of a created DiSCO from an update Event
getIdOfCreatedDisco
{ "repo_name": "rmap-project/rmap", "path": "core/src/main/java/info/rmapproject/core/rmapservice/impl/rdf4j/ORMapEventMgr.java", "license": "apache-2.0", "size": 33412 }
[ "info.rmapproject.core.exception.RMapException", "info.rmapproject.core.rmapservice.impl.rdf4j.triplestore.Rdf4jTriplestore", "java.util.Set", "org.eclipse.rdf4j.model.Statement", "org.eclipse.rdf4j.model.Value" ]
import info.rmapproject.core.exception.RMapException; import info.rmapproject.core.rmapservice.impl.rdf4j.triplestore.Rdf4jTriplestore; import java.util.Set; import org.eclipse.rdf4j.model.Statement; import org.eclipse.rdf4j.model.Value;
import info.rmapproject.core.exception.*; import info.rmapproject.core.rmapservice.impl.rdf4j.triplestore.*; import java.util.*; import org.eclipse.rdf4j.model.*;
[ "info.rmapproject.core", "java.util", "org.eclipse.rdf4j" ]
info.rmapproject.core; java.util; org.eclipse.rdf4j;
2,608,010
public Group getGroup(String groupName) { if (groupName.toLowerCase().startsWith("g:")) return GroupManager.getGlobalGroups().getGroup(groupName); else return getGroups().get(groupName.toLowerCase()); }
Group function(String groupName) { if (groupName.toLowerCase().startsWith("g:")) return GroupManager.getGlobalGroups().getGroup(groupName); else return getGroups().get(groupName.toLowerCase()); }
/** * Returns a group of the given name * * @param groupName the name of the group * @return a group if it is found. null if not found. */
Returns a group of the given name
getGroup
{ "repo_name": "alistarle/Essentials-Alykraft", "path": "EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java", "license": "gpl-3.0", "size": 37508 }
[ "org.anjocaido.groupmanager.GroupManager", "org.anjocaido.groupmanager.data.Group" ]
import org.anjocaido.groupmanager.GroupManager; import org.anjocaido.groupmanager.data.Group;
import org.anjocaido.groupmanager.*; import org.anjocaido.groupmanager.data.*;
[ "org.anjocaido.groupmanager" ]
org.anjocaido.groupmanager;
2,777,214
public final Date getDate() { return $date == null ? null : (Date)$date.clone(); }
final Date function() { return $date == null ? null : (Date)$date.clone(); }
/** * Can be {@code null}. */
Can be null
getDate
{ "repo_name": "jandppw/ppwcode-recovered-from-google-code", "path": "java/research/jpa/trunk/src/main/java/org/ppwcode/research/jpa/hibernate/semanticsBeta/Detail.java", "license": "apache-2.0", "size": 3230 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
1,082,978
public Handler getMockHandler() { Handler handler = new AbstractHandler() {
Handler function() { Handler handler = new AbstractHandler() {
/** * Creates an {@link org.mortbay.jetty.handler.AbstractHandler handler} returning an arbitrary String as a response. * * @return never <code>null</code>. */
Creates an <code>org.mortbay.jetty.handler.AbstractHandler handler</code> returning an arbitrary String as a response
getMockHandler
{ "repo_name": "lbndev/sonarqube", "path": "sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/MockHttpServer.java", "license": "lgpl-3.0", "size": 3564 }
[ "org.eclipse.jetty.server.Handler", "org.eclipse.jetty.server.handler.AbstractHandler" ]
import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.server.*; import org.eclipse.jetty.server.handler.*;
[ "org.eclipse.jetty" ]
org.eclipse.jetty;
1,229,003
void deleteMember(PerunSession sess, Member member) throws MemberNotExistsException, PrivilegeException, MemberAlreadyRemovedException;
void deleteMember(PerunSession sess, Member member) throws MemberNotExistsException, PrivilegeException, MemberAlreadyRemovedException;
/** * Deletes only member data appropriated by member id. * * @param sess * @param member * @throws InternalErrorException * @throws MemberNotExistsException * @throws PrivilegeException * @throws MemberAlreadyRemovedException */
Deletes only member data appropriated by member id
deleteMember
{ "repo_name": "balcirakpeter/perun", "path": "perun-core/src/main/java/cz/metacentrum/perun/core/api/MembersManager.java", "license": "bsd-2-clause", "size": 64459 }
[ "cz.metacentrum.perun.core.api.exceptions.MemberAlreadyRemovedException", "cz.metacentrum.perun.core.api.exceptions.MemberNotExistsException", "cz.metacentrum.perun.core.api.exceptions.PrivilegeException" ]
import cz.metacentrum.perun.core.api.exceptions.MemberAlreadyRemovedException; import cz.metacentrum.perun.core.api.exceptions.MemberNotExistsException; import cz.metacentrum.perun.core.api.exceptions.PrivilegeException;
import cz.metacentrum.perun.core.api.exceptions.*;
[ "cz.metacentrum.perun" ]
cz.metacentrum.perun;
2,691,027
protected static void initialize() { Log.printLine("Initialising..."); entities = new ArrayList<SimEntity>(); entitiesByName = new LinkedHashMap<String, SimEntity>(); future = new FutureQueue(); deferred = new DeferredQueue(); waitPredicates = new HashMap<Integer, Predicate>(); clock = 0; running = false; } // The two standard predicates public final static PredicateAny SIM_ANY = new PredicateAny(); public final static PredicateNone SIM_NONE = new PredicateNone(); // Public access methods
static void function() { Log.printLine(STR); entities = new ArrayList<SimEntity>(); entitiesByName = new LinkedHashMap<String, SimEntity>(); future = new FutureQueue(); deferred = new DeferredQueue(); waitPredicates = new HashMap<Integer, Predicate>(); clock = 0; running = false; } public final static PredicateAny SIM_ANY = new PredicateAny(); public final static PredicateNone SIM_NONE = new PredicateNone();
/** * Initialise the simulation for stand alone simulations. This function should be called at the * start of the simulation. */
Initialise the simulation for stand alone simulations. This function should be called at the start of the simulation
initialize
{ "repo_name": "asmhmahmud/Bats-Autoscaler", "path": "AzureSimulator/src/org/cloudbus/cloudsim/core/CloudSim.java", "license": "gpl-3.0", "size": 25716 }
[ "java.util.ArrayList", "java.util.HashMap", "java.util.LinkedHashMap", "org.cloudbus.cloudsim.Log", "org.cloudbus.cloudsim.core.predicates.Predicate", "org.cloudbus.cloudsim.core.predicates.PredicateAny", "org.cloudbus.cloudsim.core.predicates.PredicateNone" ]
import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; import org.cloudbus.cloudsim.Log; import org.cloudbus.cloudsim.core.predicates.Predicate; import org.cloudbus.cloudsim.core.predicates.PredicateAny; import org.cloudbus.cloudsim.core.predicates.PredicateNone;
import java.util.*; import org.cloudbus.cloudsim.*; import org.cloudbus.cloudsim.core.predicates.*;
[ "java.util", "org.cloudbus.cloudsim" ]
java.util; org.cloudbus.cloudsim;
2,731,428
appOutputStream = new WolfSSLAppOutputStream(this); appInputStream = new WolfSSLAppInputStream(this); assert (appOutputStream != null); assert (appInputStream != null); assert (context != null); assert (jsseSession != null); assert (sslParameters != null); // Get the enabled cipher suites String list = WolfSSLCipherSuiteList.getWolfSSLCipherSuiteList(sslParameters.getCipherSuites()); logger.debug("List of enabled cipher suites: {}", list); try { // Create a new session session = new WolfSSLSession(context); } catch (WolfSSLException e) { throw new IOException("Cannot create session: " + e.getMessage()); } logger.debug("Session created."); assert (session != null); assert (list != null && !list.isEmpty()); int ret = session.setCipherList(list); if (ret != WolfSSL.SSL_SUCCESS) { logger.error("setCipherList({}) not successful!", list); } else { logger.debug("setCipherList({}) successful.", list); } // TODO: Fix it for production! ret = session.disableCRL(); if (ret != WolfSSL.SSL_SUCCESS) { throw new IOException("failed to disable CRL check"); } // Set the file descriptor ret = session.setFd(this); if (ret != WolfSSL.SSL_SUCCESS) { throw new IOException("Failed to set file descriptor"); } logger.debug("setFd successful."); if (clientMode) { ret = session.connect(); } else { ret = session.accept(); } if (ret != WolfSSL.SSL_SUCCESS) { int err = session.getError(ret); String errString = WolfSSL.getErrorString(err); throw new IOException("wolfSSL_connect failed. err = " + err + ", " + errString); } if (clientMode) logger.debug("client doneConnect() successful."); else logger.debug("server doneConnect() successful."); }
appOutputStream = new WolfSSLAppOutputStream(this); appInputStream = new WolfSSLAppInputStream(this); assert (appOutputStream != null); assert (appInputStream != null); assert (context != null); assert (jsseSession != null); assert (sslParameters != null); String list = WolfSSLCipherSuiteList.getWolfSSLCipherSuiteList(sslParameters.getCipherSuites()); logger.debug(STR, list); try { session = new WolfSSLSession(context); } catch (WolfSSLException e) { throw new IOException(STR + e.getMessage()); } logger.debug(STR); assert (session != null); assert (list != null && !list.isEmpty()); int ret = session.setCipherList(list); if (ret != WolfSSL.SSL_SUCCESS) { logger.error(STR, list); } else { logger.debug(STR, list); } ret = session.disableCRL(); if (ret != WolfSSL.SSL_SUCCESS) { throw new IOException(STR); } ret = session.setFd(this); if (ret != WolfSSL.SSL_SUCCESS) { throw new IOException(STR); } logger.debug(STR); if (clientMode) { ret = session.connect(); } else { ret = session.accept(); } if (ret != WolfSSL.SSL_SUCCESS) { int err = session.getError(ret); String errString = WolfSSL.getErrorString(err); throw new IOException(STR + err + STR + errString); } if (clientMode) logger.debug(STR); else logger.debug(STR); }
/** * Encapsulates things that have to be done after the socket has been * connected. * * @throws IOException * If an error occurs. */
Encapsulates things that have to be done after the socket has been connected
doneConnect
{ "repo_name": "steffenmueller4/wolfssl-jsse-integration", "path": "src/main/java/edu/kit/aifb/eorg/wolfssl/WolfSSLSocketImpl.java", "license": "gpl-2.0", "size": 10234 }
[ "com.wolfssl.WolfSSL", "com.wolfssl.WolfSSLException", "com.wolfssl.WolfSSLSession", "java.io.IOException" ]
import com.wolfssl.WolfSSL; import com.wolfssl.WolfSSLException; import com.wolfssl.WolfSSLSession; import java.io.IOException;
import com.wolfssl.*; import java.io.*;
[ "com.wolfssl", "java.io" ]
com.wolfssl; java.io;
594,461
public final static EarlyTerminatingCollector wrapCountBasedEarlyTerminatingCollector(final Collector delegate, int maxCountHits) { return new EarlyTerminatingCollector(delegate, maxCountHits); }
final static EarlyTerminatingCollector function(final Collector delegate, int maxCountHits) { return new EarlyTerminatingCollector(delegate, maxCountHits); }
/** * Wraps <code>delegate</code> with count based early termination collector with a threshold of <code>maxCountHits</code> */
Wraps <code>delegate</code> with count based early termination collector with a threshold of <code>maxCountHits</code>
wrapCountBasedEarlyTerminatingCollector
{ "repo_name": "wangyuxue/elasticsearch", "path": "core/src/main/java/org/elasticsearch/common/lucene/Lucene.java", "license": "apache-2.0", "size": 36428 }
[ "org.apache.lucene.search.Collector" ]
import org.apache.lucene.search.Collector;
import org.apache.lucene.search.*;
[ "org.apache.lucene" ]
org.apache.lucene;
924,107
public Set<AiTile> getSafeTilesWithoutEnnemyBlast() { ai.checkInterruption(); Set<AiTile> getSafeTilesWithoutEnnemyBlast = ai.getSafeTiles; getSafeTilesWithoutEnnemyBlast.removeAll(ai.dangerZoneForEnnemyBomb); return getSafeTilesWithoutEnnemyBlast; }
Set<AiTile> function() { ai.checkInterruption(); Set<AiTile> getSafeTilesWithoutEnnemyBlast = ai.getSafeTiles; getSafeTilesWithoutEnnemyBlast.removeAll(ai.dangerZoneForEnnemyBomb); return getSafeTilesWithoutEnnemyBlast; }
/** * Calcule les cases hors de danger et ne contenant pas d'adversaires. * * @return getSafeTilesWithoutEnnemyBlast liste des cases hors de danger et sans ennemis */
Calcule les cases hors de danger et ne contenant pas d'adversaires
getSafeTilesWithoutEnnemyBlast
{ "repo_name": "vlabatut/totalboumboum", "path": "resources/ai/org/totalboumboum/ai/v201314/ais/donmezlabatcamy/v4/TileHandler.java", "license": "gpl-2.0", "size": 20297 }
[ "java.util.Set", "org.totalboumboum.ai.v201314.adapter.data.AiTile" ]
import java.util.Set; import org.totalboumboum.ai.v201314.adapter.data.AiTile;
import java.util.*; import org.totalboumboum.ai.v201314.adapter.data.*;
[ "java.util", "org.totalboumboum.ai" ]
java.util; org.totalboumboum.ai;
41,700
@Override public void allBindingsChanged(BindingProvider provider) { if (context.getConfig().isValid()) { context.getJobScheduler().restart(); } }
void function(BindingProvider provider) { if (context.getConfig().isValid()) { context.getJobScheduler().restart(); } }
/** * Restart scheduler if all binding changes. */
Restart scheduler if all binding changes
allBindingsChanged
{ "repo_name": "cschneider/openhab", "path": "bundles/binding/org.openhab.binding.weather/src/main/java/org/openhab/binding/weather/internal/bus/WeatherBinding.java", "license": "epl-1.0", "size": 3021 }
[ "org.openhab.core.binding.BindingProvider" ]
import org.openhab.core.binding.BindingProvider;
import org.openhab.core.binding.*;
[ "org.openhab.core" ]
org.openhab.core;
2,459,270
// -------------------------------------------------------------------------------------------- public int close() { int result = RESULT_ERROR_UNKNOWN; if (null == mPort) { return RESULT_ERROR_NOT_OPEN; } try { mPort.close(); mPort = null; mDeviceType = DevType.NONE; result = RESULT_SUCCESS; } catch (EpsonIoException ie) { result = RESULT_ERROR_FAILER; } return result; }
int function() { int result = RESULT_ERROR_UNKNOWN; if (null == mPort) { return RESULT_ERROR_NOT_OPEN; } try { mPort.close(); mPort = null; mDeviceType = DevType.NONE; result = RESULT_SUCCESS; } catch (EpsonIoException ie) { result = RESULT_ERROR_FAILER; } return result; }
/** * close printer * * @return int * */
close printer
close
{ "repo_name": "Random-Word/xtreme-pos", "path": "workspace/ePOSEasySelectSample/src/com/example/eposeasyselectsample/printer/ComEpsonIo.java", "license": "gpl-3.0", "size": 9016 }
[ "com.epson.epsonio.DevType", "com.epson.epsonio.EpsonIoException" ]
import com.epson.epsonio.DevType; import com.epson.epsonio.EpsonIoException;
import com.epson.epsonio.*;
[ "com.epson.epsonio" ]
com.epson.epsonio;
298,311
public ServiceCall<Void> putOptionalBodyAsync(final ServiceCallback<Void> serviceCallback) { return ServiceCall.create(putOptionalBodyWithServiceResponseAsync(), serviceCallback); }
ServiceCall<Void> function(final ServiceCallback<Void> serviceCallback) { return ServiceCall.create(putOptionalBodyWithServiceResponseAsync(), serviceCallback); }
/** * Test implicitly optional body parameter. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @return the {@link ServiceCall} object */
Test implicitly optional body parameter
putOptionalBodyAsync
{ "repo_name": "tbombach/autorest", "path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/requiredoptional/implementation/ImplicitsImpl.java", "license": "mit", "size": 29759 }
[ "com.microsoft.rest.ServiceCall", "com.microsoft.rest.ServiceCallback" ]
import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
1,502,254
public HistoryEvent createActivityInstanceUpdateEvt(DelegateExecution execution, DelegateTask task);
HistoryEvent function(DelegateExecution execution, DelegateTask task);
/** * Creates the history event fired when an activity instances is <strong>updated</strong>. * * @param execution the current execution. * @param task the task association that is currently updated. (May be null in case there is not task associated.) * @return the history event */
Creates the history event fired when an activity instances is updated
createActivityInstanceUpdateEvt
{ "repo_name": "menski/camunda-bpm-platform", "path": "engine/src/main/java/org/camunda/bpm/engine/impl/history/producer/HistoryEventProducer.java", "license": "apache-2.0", "size": 6615 }
[ "org.camunda.bpm.engine.delegate.DelegateExecution", "org.camunda.bpm.engine.delegate.DelegateTask", "org.camunda.bpm.engine.impl.history.event.HistoryEvent" ]
import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.DelegateTask; import org.camunda.bpm.engine.impl.history.event.HistoryEvent;
import org.camunda.bpm.engine.delegate.*; import org.camunda.bpm.engine.impl.history.event.*;
[ "org.camunda.bpm" ]
org.camunda.bpm;
1,722,737
public void copyFrom(WeblogEntryData entry, Locale locale) throws RollerException { mLogger.debug("copy from called"); super.copyFrom(entry, locale); mCategoryId = entry.getCategory().getId(); mCreatorId = entry.getCreator().getId(); mWebsiteId = entry.getWebsite().getId(); initPubTimeDateStrings(entry.getWebsite(), locale); if (entry.getPlugins() != null) { pluginsArray = StringUtils.split(entry.getPlugins(), ","); } attributes = new HashMap(); Iterator atts = entry.getEntryAttributes().iterator(); while (atts.hasNext()) { EntryAttributeData att = (EntryAttributeData)atts.next(); attributes.put(att.getName(), att.getValue()); } }
void function(WeblogEntryData entry, Locale locale) throws RollerException { mLogger.debug(STR); super.copyFrom(entry, locale); mCategoryId = entry.getCategory().getId(); mCreatorId = entry.getCreator().getId(); mWebsiteId = entry.getWebsite().getId(); initPubTimeDateStrings(entry.getWebsite(), locale); if (entry.getPlugins() != null) { pluginsArray = StringUtils.split(entry.getPlugins(), ","); } attributes = new HashMap(); Iterator atts = entry.getEntryAttributes().iterator(); while (atts.hasNext()) { EntryAttributeData att = (EntryAttributeData)atts.next(); attributes.put(att.getName(), att.getValue()); } }
/** * Copy values from WeblogEntryData to this Form. */
Copy values from WeblogEntryData to this Form
copyFrom
{ "repo_name": "paulnguyen/cmpe279", "path": "eclipse/Roller/src/org/apache/roller/ui/authoring/struts/formbeans/WeblogEntryFormEx.java", "license": "apache-2.0", "size": 13778 }
[ "java.util.HashMap", "java.util.Iterator", "java.util.Locale", "org.apache.commons.lang.StringUtils", "org.apache.roller.RollerException", "org.apache.roller.pojos.EntryAttributeData", "org.apache.roller.pojos.WeblogEntryData" ]
import java.util.HashMap; import java.util.Iterator; import java.util.Locale; import org.apache.commons.lang.StringUtils; import org.apache.roller.RollerException; import org.apache.roller.pojos.EntryAttributeData; import org.apache.roller.pojos.WeblogEntryData;
import java.util.*; import org.apache.commons.lang.*; import org.apache.roller.*; import org.apache.roller.pojos.*;
[ "java.util", "org.apache.commons", "org.apache.roller" ]
java.util; org.apache.commons; org.apache.roller;
2,389,017
public void setArpHighValue(String arpHighValue) throws JNCException { setArpHighValue(new YangUInt8(arpHighValue)); }
void function(String arpHighValue) throws JNCException { setArpHighValue(new YangUInt8(arpHighValue)); }
/** * Sets the value for child leaf "arp-high", * using a String value. * @param arpHighValue used during instantiation. */
Sets the value for child leaf "arp-high", using a String value
setArpHighValue
{ "repo_name": "jnpr-shinma/yangfile", "path": "hitel/src/hctaEpc/mmeSgsn/subscriber/MmeQosConversion.java", "license": "apache-2.0", "size": 19183 }
[ "com.tailf.jnc.YangUInt8" ]
import com.tailf.jnc.YangUInt8;
import com.tailf.jnc.*;
[ "com.tailf.jnc" ]
com.tailf.jnc;
72,481
UserModel authenticate(String username, char[] password);
UserModel authenticate(String username, char[] password);
/** * Authenticate a user based on a username and password. * * @param username * @param password * @return a user object or null */
Authenticate a user based on a username and password
authenticate
{ "repo_name": "heavenlyhash/gitblit", "path": "src/main/java/com/gitblit/IUserService.java", "license": "apache-2.0", "size": 7855 }
[ "com.gitblit.models.UserModel" ]
import com.gitblit.models.UserModel;
import com.gitblit.models.*;
[ "com.gitblit.models" ]
com.gitblit.models;
1,140,227
public synchronized void insert(XEvent event, int index) throws IndexOutOfBoundsException, IOException { if (index < 0 || index > size) { throw new IndexOutOfBoundsException(); } // check if we can append if (index == size) { append(event); return; } // adjust size and overflow size size++; overflowSize++; // add to overflow set for (int i = overflowSize - 2; i >= 0; i--) { if (overflowIndices[i] >= index) { overflowIndices[i + 1] = overflowIndices[i] + 1; overflowEntries[i + 1] = overflowEntries[i]; } else { overflowIndices[i + 1] = index; overflowEntries[i + 1] = event; if (overflowSize == overflowIndices.length) { consolidate(); } return; } } // if we arrive here, we must insert at zero overflowIndices[0] = index; overflowEntries[0] = event; if (overflowSize == overflowIndices.length) { consolidate(); } }
synchronized void function(XEvent event, int index) throws IndexOutOfBoundsException, IOException { if (index < 0 index > size) { throw new IndexOutOfBoundsException(); } if (index == size) { append(event); return; } size++; overflowSize++; for (int i = overflowSize - 2; i >= 0; i--) { if (overflowIndices[i] >= index) { overflowIndices[i + 1] = overflowIndices[i] + 1; overflowEntries[i + 1] = overflowEntries[i]; } else { overflowIndices[i + 1] = index; overflowEntries[i + 1] = event; if (overflowSize == overflowIndices.length) { consolidate(); } return; } } overflowIndices[0] = index; overflowEntries[0] = event; if (overflowSize == overflowIndices.length) { consolidate(); } }
/** * Inserts an event at a given index into the list. * * @param event * The event to be inserted. * @param index * Requested index of the inserted event. */
Inserts an event at a given index into the list
insert
{ "repo_name": "nicksi/xestools", "path": "src/main/java/org/deckfour/xes/model/buffered/XFastEventList.java", "license": "mit", "size": 12474 }
[ "java.io.IOException", "org.deckfour.xes.model.XEvent" ]
import java.io.IOException; import org.deckfour.xes.model.XEvent;
import java.io.*; import org.deckfour.xes.model.*;
[ "java.io", "org.deckfour.xes" ]
java.io; org.deckfour.xes;
1,777,204
@SuppressWarnings("unchecked") public List<String> getListIdFromJSON(Object data){ JSONArray jsonArray = JSONArray.fromObject(data); List<String> SEGSISTEMA_ID = (List<String>) JSONArray.toCollection(jsonArray,String.class); return SEGSISTEMA_ID; }
@SuppressWarnings(STR) List<String> function(Object data){ JSONArray jsonArray = JSONArray.fromObject(data); List<String> SEGSISTEMA_ID = (List<String>) JSONArray.toCollection(jsonArray,String.class); return SEGSISTEMA_ID; }
/** * Tranform array of Strings in json data format into * list of Strings * @param data - json data from request * @return */
Tranform array of Strings in json data format into list of Strings
getListIdFromJSON
{ "repo_name": "IvanSantiago/retopublico", "path": "MiMappir/src/mx/gob/sct/utic/mimappir/admseg/postgreSQL/services/SEGSISTEMA_Service.java", "license": "gpl-2.0", "size": 5774 }
[ "java.util.List", "net.sf.json.JSONArray" ]
import java.util.List; import net.sf.json.JSONArray;
import java.util.*; import net.sf.json.*;
[ "java.util", "net.sf.json" ]
java.util; net.sf.json;
2,457,390
@Override public Object asyncSendBarrierMessage() { if (transmitQ == null) { return Boolean.FALSE; } OFBarrierRequest barrierMsg = new OFBarrierRequest(); int xid = getNextXid(); barrierMsg.setXid(xid); transmitQ.add(new PriorityMessage(barrierMsg, 0, true)); return Boolean.TRUE; }
Object function() { if (transmitQ == null) { return Boolean.FALSE; } OFBarrierRequest barrierMsg = new OFBarrierRequest(); int xid = getNextXid(); barrierMsg.setXid(xid); transmitQ.add(new PriorityMessage(barrierMsg, 0, true)); return Boolean.TRUE; }
/** * Send Barrier message asynchronously. The caller is not blocked. The * Barrier message will be sent in a transmit thread which will be blocked * until the Barrier reply is received. */
Send Barrier message asynchronously. The caller is not blocked. The Barrier message will be sent in a transmit thread which will be blocked until the Barrier reply is received
asyncSendBarrierMessage
{ "repo_name": "lbchen/ODL", "path": "opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/SwitchHandler.java", "license": "epl-1.0", "size": 33456 }
[ "org.openflow.protocol.OFBarrierRequest" ]
import org.openflow.protocol.OFBarrierRequest;
import org.openflow.protocol.*;
[ "org.openflow.protocol" ]
org.openflow.protocol;
2,009,715
CompletableFuture<Optional<byte[]>> getStateData();
CompletableFuture<Optional<byte[]>> getStateData();
/** * Reads data if it exists * * @return persisted data or empty optional if data not exists */
Reads data if it exists
getStateData
{ "repo_name": "vladimir-bukhtoyarov/bucket4j", "path": "bucket4j-core/src/main/java/io/github/bucket4j/distributed/proxy/generic/compare_and_swap/AsyncCompareAndSwapOperation.java", "license": "apache-2.0", "size": 1955 }
[ "java.util.Optional", "java.util.concurrent.CompletableFuture" ]
import java.util.Optional; import java.util.concurrent.CompletableFuture;
import java.util.*; import java.util.concurrent.*;
[ "java.util" ]
java.util;
1,479,856
public void addResultTimeToObservation(Observation observation, TimeInstant resultTime, Time phenomenonTime) throws CodedException { if (resultTime != null) { if (resultTime.getValue() != null) { observation.setResultTime(resultTime.getValue().toDate()); } else if (resultTime.getIndeterminateValue().contains(Sos2Constants.EN_PHENOMENON_TIME) && phenomenonTime instanceof TimeInstant) { observation.setResultTime(((TimeInstant) phenomenonTime).getValue().toDate()); } else { throw new NoApplicableCodeException() .withMessage("Error while adding result time to Hibernate Observation entitiy!"); } } else { if (phenomenonTime instanceof TimeInstant) { observation.setResultTime(((TimeInstant) phenomenonTime).getValue().toDate()); } else { throw new NoApplicableCodeException() .withMessage("Error while adding result time to Hibernate Observation entitiy!"); } } }
void function(Observation observation, TimeInstant resultTime, Time phenomenonTime) throws CodedException { if (resultTime != null) { if (resultTime.getValue() != null) { observation.setResultTime(resultTime.getValue().toDate()); } else if (resultTime.getIndeterminateValue().contains(Sos2Constants.EN_PHENOMENON_TIME) && phenomenonTime instanceof TimeInstant) { observation.setResultTime(((TimeInstant) phenomenonTime).getValue().toDate()); } else { throw new NoApplicableCodeException() .withMessage(STR); } } else { if (phenomenonTime instanceof TimeInstant) { observation.setResultTime(((TimeInstant) phenomenonTime).getValue().toDate()); } else { throw new NoApplicableCodeException() .withMessage(STR); } } }
/** * Add result time to observation object * * @param observation * Observation object * @param resultTime * SOS resullt time * @param phenomenonTime * SOS phenomenon time * @throws CodedException * If an error occurs */
Add result time to observation object
addResultTimeToObservation
{ "repo_name": "geomatico/52n-sos-4.0", "path": "hibernate/common/src/main/java/org/n52/sos/ds/hibernate/dao/ObservationDAO.java", "license": "gpl-2.0", "size": 26233 }
[ "org.n52.sos.ds.hibernate.entities.Observation", "org.n52.sos.exception.CodedException", "org.n52.sos.exception.ows.NoApplicableCodeException", "org.n52.sos.ogc.gml.time.Time", "org.n52.sos.ogc.gml.time.TimeInstant", "org.n52.sos.ogc.sos.Sos2Constants" ]
import org.n52.sos.ds.hibernate.entities.Observation; import org.n52.sos.exception.CodedException; import org.n52.sos.exception.ows.NoApplicableCodeException; import org.n52.sos.ogc.gml.time.Time; import org.n52.sos.ogc.gml.time.TimeInstant; import org.n52.sos.ogc.sos.Sos2Constants;
import org.n52.sos.ds.hibernate.entities.*; import org.n52.sos.exception.*; import org.n52.sos.exception.ows.*; import org.n52.sos.ogc.gml.time.*; import org.n52.sos.ogc.sos.*;
[ "org.n52.sos" ]
org.n52.sos;
2,771,057
private void initialize() { this.setLayout(new BorderLayout(5, 5)); this.add(getSlider(), BorderLayout.CENTER); this.add(getPText(), BorderLayout.EAST); }
void function() { this.setLayout(new BorderLayout(5, 5)); this.add(getSlider(), BorderLayout.CENTER); this.add(getPText(), BorderLayout.EAST); }
/** * This method initializes this * */
This method initializes this
initialize
{ "repo_name": "iCarto/siga", "path": "libUIComponent/src/org/gvsig/gui/beans/slidertext/ColorSliderTextContainer.java", "license": "gpl-3.0", "size": 8597 }
[ "java.awt.BorderLayout" ]
import java.awt.BorderLayout;
import java.awt.*;
[ "java.awt" ]
java.awt;
59,806
public DateRangeBuilder to(Calendar calendar) { return to(calendar.getTime()); }
DateRangeBuilder function(Calendar calendar) { return to(calendar.getTime()); }
/** * Set to date * * @param calendar Calendar * @return Builder for date range * @see DateRange#getTo() */
Set to date
to
{ "repo_name": "girinoboy/lojacasamento", "path": "pagseguro-api/src/main/java/br/com/uol/pagseguro/api/common/domain/builder/DateRangeBuilder.java", "license": "mit", "size": 3975 }
[ "java.util.Calendar" ]
import java.util.Calendar;
import java.util.*;
[ "java.util" ]
java.util;
2,837,944
@Test public void testJavaFileUsingDefaults() { SourceTypeDiscoverer discoverer = new SourceTypeDiscoverer(); File javaFile = new File("/path/to/MyClass.java"); SourceType type = discoverer.getSourceTypeOfFile(javaFile); assertEquals("SourceType must be Java 1.4!", SourceType.JAVA_14, type); }
void function() { SourceTypeDiscoverer discoverer = new SourceTypeDiscoverer(); File javaFile = new File(STR); SourceType type = discoverer.getSourceTypeOfFile(javaFile); assertEquals(STR, SourceType.JAVA_14, type); }
/** * Test on Java file with default options. */
Test on Java file with default options
testJavaFileUsingDefaults
{ "repo_name": "bolav/pmd-src-4.2.6-perl", "path": "regress/test/net/sourceforge/pmd/SourceTypeDiscovererTest.java", "license": "bsd-3-clause", "size": 1659 }
[ "java.io.File", "net.sourceforge.pmd.SourceType", "net.sourceforge.pmd.SourceTypeDiscoverer", "org.junit.Assert" ]
import java.io.File; import net.sourceforge.pmd.SourceType; import net.sourceforge.pmd.SourceTypeDiscoverer; import org.junit.Assert;
import java.io.*; import net.sourceforge.pmd.*; import org.junit.*;
[ "java.io", "net.sourceforge.pmd", "org.junit" ]
java.io; net.sourceforge.pmd; org.junit;
2,013,662
public void setBoolean(int parameterIndex, boolean x) throws SQLException { if (this.useTrueBoolean) { setInternal(parameterIndex, x ? "1" : "0"); } else { setInternal(parameterIndex, x ? "'t'" : "'f'"); this.parameterTypes[parameterIndex - 1 + getParameterIndexOffset()] = Types.BOOLEAN; } }
void function(int parameterIndex, boolean x) throws SQLException { if (this.useTrueBoolean) { setInternal(parameterIndex, x ? "1" : "0"); } else { setInternal(parameterIndex, x ? "'t'" : "'f'"); this.parameterTypes[parameterIndex - 1 + getParameterIndexOffset()] = Types.BOOLEAN; } }
/** * Set a parameter to a Java boolean value. The driver converts this to a * SQL BIT value when it sends it to the database. * * @param parameterIndex * the first parameter is 1... * @param x * the parameter value * * @throws SQLException * if a database access error occurs */
Set a parameter to a Java boolean value. The driver converts this to a SQL BIT value when it sends it to the database
setBoolean
{ "repo_name": "slockhart/sql-app", "path": "mysql-connector-java-5.1.34/src/com/mysql/jdbc/PreparedStatement.java", "license": "gpl-2.0", "size": 201673 }
[ "java.sql.SQLException", "java.sql.Types" ]
import java.sql.SQLException; import java.sql.Types;
import java.sql.*;
[ "java.sql" ]
java.sql;
2,158,302
public static Color getPrimary3() { return ColorBlind.getDichromatColor(MetalLookAndFeel.getCurrentTheme().getPrimaryControl()); }
static Color function() { return ColorBlind.getDichromatColor(MetalLookAndFeel.getCurrentTheme().getPrimaryControl()); }
/** * Get Primary3 * @return primary 3 */
Get Primary3
getPrimary3
{ "repo_name": "klst-com/metasfresh", "path": "de.metas.adempiere.adempiere/base/src/main/java-legacy/org/adempiere/plaf/AdempierePLAF.java", "license": "gpl-2.0", "size": 18734 }
[ "java.awt.Color", "javax.swing.plaf.metal.MetalLookAndFeel", "org.compiere.swing.ColorBlind" ]
import java.awt.Color; import javax.swing.plaf.metal.MetalLookAndFeel; import org.compiere.swing.ColorBlind;
import java.awt.*; import javax.swing.plaf.metal.*; import org.compiere.swing.*;
[ "java.awt", "javax.swing", "org.compiere.swing" ]
java.awt; javax.swing; org.compiere.swing;
2,559,287
boolean analyzeSyncMsgList(PccId pccId);
boolean analyzeSyncMsgList(PccId pccId);
/** * Analyzes report messages received during LSP DB sync again tunnel store and takes necessary actions. * * @param pccId the id of pcc client * @return success or failure */
Analyzes report messages received during LSP DB sync again tunnel store and takes necessary actions
analyzeSyncMsgList
{ "repo_name": "maheshraju-Huawei/actn", "path": "protocols/pcep/api/src/main/java/org/onosproject/pcep/controller/driver/PcepAgent.java", "license": "apache-2.0", "size": 2619 }
[ "org.onosproject.pcep.controller.PccId" ]
import org.onosproject.pcep.controller.PccId;
import org.onosproject.pcep.controller.*;
[ "org.onosproject.pcep" ]
org.onosproject.pcep;
578,757
InputStream getContent() throws ForbiddenException, ServerException;
InputStream getContent() throws ForbiddenException, ServerException;
/** * Gets content of the file. * * @return content ot he file * @throws ForbiddenException * if this item is not a file * @throws ServerException * if other error occurs * @see #isFile() */
Gets content of the file
getContent
{ "repo_name": "snjeza/che", "path": "wsagent/che-core-api-project/src/main/java/org/eclipse/che/api/vfs/VirtualFile.java", "license": "epl-1.0", "size": 25616 }
[ "java.io.InputStream", "org.eclipse.che.api.core.ForbiddenException", "org.eclipse.che.api.core.ServerException" ]
import java.io.InputStream; import org.eclipse.che.api.core.ForbiddenException; import org.eclipse.che.api.core.ServerException;
import java.io.*; import org.eclipse.che.api.core.*;
[ "java.io", "org.eclipse.che" ]
java.io; org.eclipse.che;
577,557
List<Pair<ExecutionReference, ExecutableFlow>> fetchQueuedFlows() throws ExecutorManagerException;
List<Pair<ExecutionReference, ExecutableFlow>> fetchQueuedFlows() throws ExecutorManagerException;
/** * <pre> * Fetch queued flows which have not yet dispatched * Note: * 1. throws an Exception in case of a SQL issue * 2. return empty list when no queued execution is found * </pre> * * @return List of queued flows and corresponding execution reference */
<code> Fetch queued flows which have not yet dispatched Note: 1. throws an Exception in case of a SQL issue 2. return empty list when no queued execution is found </code>
fetchQueuedFlows
{ "repo_name": "chengren311/azkaban", "path": "azkaban-common/src/main/java/azkaban/executor/ExecutorLoader.java", "license": "apache-2.0", "size": 9123 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
302,312
@Autowired public void setDomainController(@Value("${ntlm.authn.domain.controller:}") @NotNull final String domainController) { if (StringUtils.isBlank(domainController)) { this.domainController = DEFAULT_DOMAIN_CONTROLLER; } else { this.domainController = domainController; } }
void function(@Value(STR) @NotNull final String domainController) { if (StringUtils.isBlank(domainController)) { this.domainController = DEFAULT_DOMAIN_CONTROLLER; } else { this.domainController = domainController; } }
/** * Sets domain controller. Will default if none is defined or passed. * * @param domainController the domain controller */
Sets domain controller. Will default if none is defined or passed
setDomainController
{ "repo_name": "y1011/cas-server", "path": "cas-server-support-spnego/src/main/java/org/jasig/cas/support/spnego/authentication/handler/support/NtlmAuthenticationHandler.java", "license": "apache-2.0", "size": 6337 }
[ "javax.validation.constraints.NotNull", "org.apache.commons.lang3.StringUtils", "org.springframework.beans.factory.annotation.Value" ]
import javax.validation.constraints.NotNull; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Value;
import javax.validation.constraints.*; import org.apache.commons.lang3.*; import org.springframework.beans.factory.annotation.*;
[ "javax.validation", "org.apache.commons", "org.springframework.beans" ]
javax.validation; org.apache.commons; org.springframework.beans;
1,918,858
public Vector<ContentValues> getImages() { return mImages; }
Vector<ContentValues> function() { return mImages; }
/** * A getter that returns the image data Vector * @return A Vector containing all of the image data retrieved by the parser */
A getter that returns the image data Vector
getImages
{ "repo_name": "xu6148152/binea_project_for_android", "path": "threadsample/src/com/example/android/threadsample/RSSPullParser.java", "license": "mit", "size": 7822 }
[ "android.content.ContentValues", "java.util.Vector" ]
import android.content.ContentValues; import java.util.Vector;
import android.content.*; import java.util.*;
[ "android.content", "java.util" ]
android.content; java.util;
2,182,022
private static void parseIdReferences(Object policyIdReferenceObject, StdMutableResult stdMutableResult, boolean isSet) throws JSONStructureException { String idTypeName = isSet ? "PolicySetIdReference" : "PolicyIdReference"; if (!(policyIdReferenceObject instanceof List)) { throw new JSONStructureException(idTypeName + " must be array"); } List<?> policyIdReferenceList = (List<?>)policyIdReferenceObject; for (Object idReferenceObject : policyIdReferenceList) { if (idReferenceObject == null || !(idReferenceObject instanceof Map)) { throw new JSONStructureException(idTypeName + " array item must be non-null object"); } Map<?, ?> idReferenceMap = (Map<?, ?>)idReferenceObject; // mandatory Id Object idReferenceIdObject = idReferenceMap.remove("Id"); if (idReferenceIdObject == null) { throw new JSONStructureException(idTypeName + " array item must contain Id"); } Identifier idReferenceId = new IdentifierImpl(idReferenceIdObject.toString()); // optional Version StdVersion version = null; Object idReferenceVersionObject = idReferenceMap.remove("Version"); if (idReferenceVersionObject != null) { try { version = StdVersion.newInstance(idReferenceVersionObject.toString()); } catch (ParseException e) { throw new JSONStructureException(idTypeName + " array item Version: " + e.getMessage()); } } checkUnknown("IdReference in " + idTypeName, idReferenceMap); StdIdReference policyIdentifier = new StdIdReference(idReferenceId, version); // add to the appropriate list in the Result if (isSet) { stdMutableResult.addPolicySetIdentifier(policyIdentifier); } else { stdMutableResult.addPolicyIdentifier(policyIdentifier); } } } // // PRIMARY INTERFACE METHODS //
static void function(Object policyIdReferenceObject, StdMutableResult stdMutableResult, boolean isSet) throws JSONStructureException { String idTypeName = isSet ? STR : STR; if (!(policyIdReferenceObject instanceof List)) { throw new JSONStructureException(idTypeName + STR); } List<?> policyIdReferenceList = (List<?>)policyIdReferenceObject; for (Object idReferenceObject : policyIdReferenceList) { if (idReferenceObject == null !(idReferenceObject instanceof Map)) { throw new JSONStructureException(idTypeName + STR); } Map<?, ?> idReferenceMap = (Map<?, ?>)idReferenceObject; Object idReferenceIdObject = idReferenceMap.remove("Id"); if (idReferenceIdObject == null) { throw new JSONStructureException(idTypeName + STR); } Identifier idReferenceId = new IdentifierImpl(idReferenceIdObject.toString()); StdVersion version = null; Object idReferenceVersionObject = idReferenceMap.remove(STR); if (idReferenceVersionObject != null) { try { version = StdVersion.newInstance(idReferenceVersionObject.toString()); } catch (ParseException e) { throw new JSONStructureException(idTypeName + STR + e.getMessage()); } } checkUnknown(STR + idTypeName, idReferenceMap); StdIdReference policyIdentifier = new StdIdReference(idReferenceId, version); if (isSet) { stdMutableResult.addPolicySetIdentifier(policyIdentifier); } else { stdMutableResult.addPolicyIdentifier(policyIdentifier); } } } //
/** * When reading a JSON string to create a Result object, parse the PolicyIdReference and * PolicySetIdReference texts. * * @param policyIdReferenceObject * @param stdMutableResult * @param isSet */
When reading a JSON string to create a Result object, parse the PolicyIdReference and PolicySetIdReference texts
parseIdReferences
{ "repo_name": "dash-/apache-openaz", "path": "openaz-xacml/src/main/java/org/apache/openaz/xacml/std/json/JSONResponse.java", "license": "apache-2.0", "size": 96000 }
[ "java.text.ParseException", "java.util.List", "java.util.Map", "org.apache.openaz.xacml.api.Identifier", "org.apache.openaz.xacml.std.IdentifierImpl", "org.apache.openaz.xacml.std.StdIdReference", "org.apache.openaz.xacml.std.StdMutableResult", "org.apache.openaz.xacml.std.StdVersion" ]
import java.text.ParseException; import java.util.List; import java.util.Map; import org.apache.openaz.xacml.api.Identifier; import org.apache.openaz.xacml.std.IdentifierImpl; import org.apache.openaz.xacml.std.StdIdReference; import org.apache.openaz.xacml.std.StdMutableResult; import org.apache.openaz.xacml.std.StdVersion;
import java.text.*; import java.util.*; import org.apache.openaz.xacml.api.*; import org.apache.openaz.xacml.std.*;
[ "java.text", "java.util", "org.apache.openaz" ]
java.text; java.util; org.apache.openaz;
2,489,813
@Test public void testSettingNullAndGetting() { CouchbaseCache cache = new CouchbaseCache(cacheName, client); String key = "couchbase-cache-test"; String value = "Hello World!"; cache.put(key, value); cache.put(key, null); assertNull(cache.get(key)); }
void function() { CouchbaseCache cache = new CouchbaseCache(cacheName, client); String key = STR; String value = STR; cache.put(key, value); cache.put(key, null); assertNull(cache.get(key)); }
/** * Putting into cache on the same key not null value, and then null value, * results in null object */
Putting into cache on the same key not null value, and then null value, results in null object
testSettingNullAndGetting
{ "repo_name": "couchbaselabs/couchbase-spring-cache", "path": "src/integration/java/com/couchbase/client/spring/cache/CouchbaseCacheTests.java", "license": "apache-2.0", "size": 8984 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
1,684,988
Value object; //iterate the conditions, execute the expressions and compare both values if(conditions != null){ boolean flag = true; iter: for (String expr : conditions.keySet()) { String cond = conditions.get(expr); List<String> values = processor.extractValueFromNode(node, expr); for(String value : values){ if(value == null || !value.equals(cond)){ flag = false; break iter; } } } if(flag){ object = processor.processSubjectMap(dataset, map.getSubjectMap(), node); if (subject != null && object != null){ dataset.add(subject, predicate, object); log.debug("[ConditionalJoinRMLPerformer:addTriples] Subject " + subject + " Predicate " + predicate + "Object " + object.toString()); } else log.debug("[ConditionalJoinRMLPerformer:addTriples] triple for Subject " + subject + " Predicate " + predicate + "Object " + object + "was not created"); } } }
Value object; if(conditions != null){ boolean flag = true; iter: for (String expr : conditions.keySet()) { String cond = conditions.get(expr); List<String> values = processor.extractValueFromNode(node, expr); for(String value : values){ if(value == null !value.equals(cond)){ flag = false; break iter; } } } if(flag){ object = processor.processSubjectMap(dataset, map.getSubjectMap(), node); if (subject != null && object != null){ dataset.add(subject, predicate, object); log.debug(STR + subject + STR + predicate + STR + object.toString()); } else log.debug(STR + subject + STR + predicate + STR + object + STR); } } }
/** * Compare expressions from join to complete it * * @param node current object in parent iteration * @param dataset * @param map */
Compare expressions from join to complete it
perform
{ "repo_name": "linkeddatalab/statspace", "path": "src/main/java/be/ugent/mmlab/rml/core/ConditionalJoinRMLPerformer.java", "license": "mit", "size": 2869 }
[ "java.util.List", "org.openrdf.model.Value" ]
import java.util.List; import org.openrdf.model.Value;
import java.util.*; import org.openrdf.model.*;
[ "java.util", "org.openrdf.model" ]
java.util; org.openrdf.model;
1,653,952
public Iterator<Spring> getSprings() { return springs.iterator(); }
Iterator<Spring> function() { return springs.iterator(); }
/** * Get an iterator over all registered Springs. * @return an iterator over the Springs. */
Get an iterator over all registered Springs
getSprings
{ "repo_name": "effrafax/Prefux", "path": "src/main/java/prefux/util/force/ForceSimulator.java", "license": "bsd-3-clause", "size": 8702 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
2,410,647
ExecRow getLastRow() throws StandardException;
ExecRow getLastRow() throws StandardException;
/** * Returns the last row from the query, and returns NULL when there * are no rows. * * @return The last row, or NULL if no rows. * * @exception StandardException Thrown on failure * @see Row */
Returns the last row from the query, and returns NULL when there are no rows
getLastRow
{ "repo_name": "lpxz/grail-derby104", "path": "java/engine/org/apache/derby/iapi/sql/ResultSet.java", "license": "apache-2.0", "size": 10329 }
[ "org.apache.derby.iapi.error.StandardException", "org.apache.derby.iapi.sql.execute.ExecRow" ]
import org.apache.derby.iapi.error.StandardException; import org.apache.derby.iapi.sql.execute.ExecRow;
import org.apache.derby.iapi.error.*; import org.apache.derby.iapi.sql.execute.*;
[ "org.apache.derby" ]
org.apache.derby;
510,417
public native boolean raiseImage(Rectangle raiseInfo, boolean raise) throws MagickException;
native boolean function(Rectangle raiseInfo, boolean raise) throws MagickException;
/** * Creates a simulated three-dimensional button-like effect by * lightening and darkening the edges of the image. Members width * and height of raiseInfo define the width of the vertical and * horizontal edge of the effect. * * @param raiseInfo the rectangle for which border is drawn * @param raise true to create raise effect, false to lower * @return true if successful, false otherwise * @exception MagickException on error */
Creates a simulated three-dimensional button-like effect by lightening and darkening the edges of the image. Members width and height of raiseInfo define the width of the vertical and horizontal edge of the effect
raiseImage
{ "repo_name": "marianvandzura/jmagick", "path": "src/magick/MagickImage.java", "license": "lgpl-2.1", "size": 66515 }
[ "java.awt.Rectangle" ]
import java.awt.Rectangle;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,461,587
Collection<ResourcePath> getChildResources(ResourcePath parent);
Collection<ResourcePath> getChildResources(ResourcePath parent);
/** * Returns a collection of the child resources of the specified parent. * * @param parent parent of the resource to be returned * @return a collection of the child resources of the specified resource */
Returns a collection of the child resources of the specified parent
getChildResources
{ "repo_name": "planoAccess/clonedONOS", "path": "core/api/src/main/java/org/onosproject/net/newresource/ResourceStore.java", "license": "apache-2.0", "size": 4892 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
307,017
List<Position> fetch(String keyword) throws IOException;
List<Position> fetch(String keyword) throws IOException;
/** * Fetch jobs with the keyword * @param keyword * @return Jobs filtered by keyword * @throws IOException */
Fetch jobs with the keyword
fetch
{ "repo_name": "brunocvcunha/jobstats", "path": "src/main/java/org/brunocvcunha/jobstats/crawler/IJobSeeker.java", "license": "apache-2.0", "size": 1565 }
[ "java.io.IOException", "java.util.List", "org.brunocvcunha.jobstats.model.Position" ]
import java.io.IOException; import java.util.List; import org.brunocvcunha.jobstats.model.Position;
import java.io.*; import java.util.*; import org.brunocvcunha.jobstats.model.*;
[ "java.io", "java.util", "org.brunocvcunha.jobstats" ]
java.io; java.util; org.brunocvcunha.jobstats;
446,736
public File getFile(Key<File> key, File root) { File f = get(key); if (root != null) f = new FileLocator(f).setLibraryRoot(root).locate(); return f; }
File function(Key<File> key, File root) { File f = get(key); if (root != null) f = new FileLocator(f).setLibraryRoot(root).locate(); return f; }
/** * Gets a file stored in the map * * @param key the file key * @param root the projects main folder * @return the file */
Gets a file stored in the map
getFile
{ "repo_name": "hneemann/Digital", "path": "src/main/java/de/neemann/digital/core/element/ElementAttributes.java", "license": "gpl-3.0", "size": 10244 }
[ "de.neemann.digital.FileLocator", "java.io.File" ]
import de.neemann.digital.FileLocator; import java.io.File;
import de.neemann.digital.*; import java.io.*;
[ "de.neemann.digital", "java.io" ]
de.neemann.digital; java.io;
1,011,322
protected void keyTyped(char typedChar, int keyCode) throws IOException { if (keyCode == 1 || keyCode == this.mc.gameSettings.keyBindInventory.getKeyCode()) { this.mc.thePlayer.closeScreen(); } this.checkHotbarKeys(keyCode); if (this.theSlot != null && this.theSlot.getHasStack()) { if (keyCode == this.mc.gameSettings.keyBindPickBlock.getKeyCode()) { this.handleMouseClick(this.theSlot, this.theSlot.slotNumber, 0, ClickType.CLONE); } else if (keyCode == this.mc.gameSettings.keyBindDrop.getKeyCode()) { this.handleMouseClick(this.theSlot, this.theSlot.slotNumber, isCtrlKeyDown() ? 1 : 0, ClickType.THROW); } } }
void function(char typedChar, int keyCode) throws IOException { if (keyCode == 1 keyCode == this.mc.gameSettings.keyBindInventory.getKeyCode()) { this.mc.thePlayer.closeScreen(); } this.checkHotbarKeys(keyCode); if (this.theSlot != null && this.theSlot.getHasStack()) { if (keyCode == this.mc.gameSettings.keyBindPickBlock.getKeyCode()) { this.handleMouseClick(this.theSlot, this.theSlot.slotNumber, 0, ClickType.CLONE); } else if (keyCode == this.mc.gameSettings.keyBindDrop.getKeyCode()) { this.handleMouseClick(this.theSlot, this.theSlot.slotNumber, isCtrlKeyDown() ? 1 : 0, ClickType.THROW); } } }
/** * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) */
Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code)
keyTyped
{ "repo_name": "MartyParty21/AwakenDreamsClient", "path": "mcp/src/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java", "license": "gpl-3.0", "size": 28691 }
[ "java.io.IOException", "net.minecraft.inventory.ClickType" ]
import java.io.IOException; import net.minecraft.inventory.ClickType;
import java.io.*; import net.minecraft.inventory.*;
[ "java.io", "net.minecraft.inventory" ]
java.io; net.minecraft.inventory;
1,039,607
public SerializationFormat defaultSerializationFormat() { return allowedSerializationFormatArray[0]; }
SerializationFormat function() { return allowedSerializationFormatArray[0]; }
/** * Returns the default serialization format of this service. */
Returns the default serialization format of this service
defaultSerializationFormat
{ "repo_name": "jonefeewang/armeria", "path": "thrift/src/main/java/com/linecorp/armeria/server/thrift/THttpService.java", "license": "apache-2.0", "size": 36378 }
[ "com.linecorp.armeria.common.SerializationFormat" ]
import com.linecorp.armeria.common.SerializationFormat;
import com.linecorp.armeria.common.*;
[ "com.linecorp.armeria" ]
com.linecorp.armeria;
2,325,463
public static void setConnectionManagerTimeout(final HttpParams params, long timeout) { if (params == null) { throw new IllegalArgumentException("HTTP parameters may not be null"); } params.setLongParameter(ClientPNames.CONN_MANAGER_TIMEOUT, timeout); } /** * Get the connectiion manager timeout value. * This is defined by the parameter {@code ClientPNames.CONN_MANAGER_TIMEOUT}. * Failing that it uses the parameter {@code CoreConnectionPNames.CONNECTION_TIMEOUT}
static void function(final HttpParams params, long timeout) { if (params == null) { throw new IllegalArgumentException(STR); } params.setLongParameter(ClientPNames.CONN_MANAGER_TIMEOUT, timeout); } /** * Get the connectiion manager timeout value. * This is defined by the parameter {@code ClientPNames.CONN_MANAGER_TIMEOUT}. * Failing that it uses the parameter {@code CoreConnectionPNames.CONNECTION_TIMEOUT}
/** * Set the parameter {@code ClientPNames.CONN_MANAGER_TIMEOUT}. * * @since 4.2 */
Set the parameter ClientPNames.CONN_MANAGER_TIMEOUT
setConnectionManagerTimeout
{ "repo_name": "0x90sled/droidtowers", "path": "main/source/org/apach3/http/client/params/HttpClientParams.java", "license": "mit", "size": 4799 }
[ "org.apach3.http.params.HttpParams" ]
import org.apach3.http.params.HttpParams;
import org.apach3.http.params.*;
[ "org.apach3.http" ]
org.apach3.http;
1,281,320
void updateQuery(ICab2bQuery query) throws RemoteException;
void updateQuery(ICab2bQuery query) throws RemoteException;
/** * This method updates the given ICab2bQuery object. * * @throws RemoteException if updating fails */
This method updates the given ICab2bQuery object
updateQuery
{ "repo_name": "NCIP/cab2b", "path": "software/cab2b/src/java/common/edu/wustl/cab2b/common/ejb/queryengine/QueryEngineBusinessInterface.java", "license": "bsd-3-clause", "size": 3953 }
[ "edu.wustl.cab2b.common.queryengine.ICab2bQuery", "java.rmi.RemoteException" ]
import edu.wustl.cab2b.common.queryengine.ICab2bQuery; import java.rmi.RemoteException;
import edu.wustl.cab2b.common.queryengine.*; import java.rmi.*;
[ "edu.wustl.cab2b", "java.rmi" ]
edu.wustl.cab2b; java.rmi;
2,336,646
boolean streamClosed(InputStream wrapped) throws IOException ;
boolean streamClosed(InputStream wrapped) throws IOException ;
/** * Indicates that the {@link EofSensorInputStream stream} is closed. * This method will be called only if EOF was <i>not</i> detected * before closing. Otherwise, {@link #eofDetected eofDetected} is called. * * @param wrapped the underlying stream which has not reached EOF * * @return <code>true</code> if <code>wrapped</code> should be closed, * <code>false</code> if it should be left alone * * @throws IOException * in case of an IO problem, for example if the watcher itself * closes the underlying stream. The caller will leave the * wrapped stream alone, as if <code>false</code> was returned. */
Indicates that the <code>EofSensorInputStream stream</code> is closed. This method will be called only if EOF was not detected before closing. Otherwise, <code>#eofDetected eofDetected</code> is called
streamClosed
{ "repo_name": "haikuowuya/android_system_code", "path": "src/org/apache/http/conn/EofSensorWatcher.java", "license": "apache-2.0", "size": 4276 }
[ "java.io.IOException", "java.io.InputStream" ]
import java.io.IOException; import java.io.InputStream;
import java.io.*;
[ "java.io" ]
java.io;
1,480,802
public Set<ConflictBucketCandidate> getConflictBucketCandidates(String modelElementId, String featureName) { return modelElementIdReservationMap.getConflictBucketCandidates(modelElementId, featureName); }
Set<ConflictBucketCandidate> function(String modelElementId, String featureName) { return modelElementIdReservationMap.getConflictBucketCandidates(modelElementId, featureName); }
/** * Returns all conflict bucket candidates for the given model element and a feature. * * @param modelElementId * the ID of a model element * @param featureName * the feature name * @return a set of {@link ConflictBucketCandidate}s */
Returns all conflict bucket candidates for the given model element and a feature
getConflictBucketCandidates
{ "repo_name": "edgarmueller/emfstore-rest", "path": "bundles/org.eclipse.emf.emfstore.server/src/org/eclipse/emf/emfstore/internal/server/conflictDetection/ReservationSet.java", "license": "epl-1.0", "size": 14301 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
2,461,805