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 String [] getOptions() { Vector<String> options = new Vector<String>(); options.add("-S"); options.add("" + getSeed()); Collections.addAll(options, super.getOptions()); return options.toArray(new String[0]); }
String [] function() { Vector<String> options = new Vector<String>(); options.add("-S"); options.add("" + getSeed()); Collections.addAll(options, super.getOptions()); return options.toArray(new String[0]); }
/** * Gets the current settings of the classifier. * * @return an array of strings suitable for passing to setOptions */
Gets the current settings of the classifier
getOptions
{ "repo_name": "ahmedvc/umple", "path": "Umplificator/UmplifiedProjects/weka-umplified-0/src/main/java/weka/classifiers/RandomizableParallelMultipleClassifiersCombiner.java", "license": "mit", "size": 3928 }
[ "java.util.Collections", "java.util.Vector" ]
import java.util.Collections; import java.util.Vector;
import java.util.*;
[ "java.util" ]
java.util;
801,836
public Geometry getConvexHull() { return convexHull; } // ==================================================================
Geometry function() { return convexHull; }
/** * Gets the convex hull of all the sites in the triangulation, * including constraint vertices. * Only valid after the constraints have been enforced. * * @return the convex hull of the sites */
Gets the convex hull of all the sites in the triangulation, including constraint vertices. Only valid after the constraints have been enforced
getConvexHull
{ "repo_name": "Semantive/jts", "path": "src/main/java/com/vividsolutions/jts/triangulate/ConformingDelaunayTriangulator.java", "license": "lgpl-3.0", "size": 20594 }
[ "com.vividsolutions.jts.geom.Geometry" ]
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.*;
[ "com.vividsolutions.jts" ]
com.vividsolutions.jts;
1,124,090
public void testTimeoutOrCommit() throws Exception { Settings settings = Settings.builder() .put(DiscoverySettings.COMMIT_TIMEOUT_SETTING.getKey(), "1ms").build(); // short but so we will sometime commit sometime timeout MockNode master = createMockNode("master", settings); MockNode node = createMockNode("node", settings); ClusterState state = ClusterState.builder(master.clusterState) .nodes(DiscoveryNodes.builder(master.clusterState.nodes()).add(node.discoveryNode).masterNodeId(master.discoveryNode.getId())).build(); for (int i = 0; i < 10; i++) { state = ClusterState.builder(state).incrementVersion().build(); logger.debug("--> publishing version [{}], UUID [{}]", state.version(), state.stateUUID()); boolean success; try { publishState(master.action, state, master.clusterState, 2).await(1, TimeUnit.HOURS); success = true; } catch (Discovery.FailedToCommitClusterStateException OK) { success = false; } logger.debug("--> publishing [{}], verifying...", success ? "succeeded" : "failed"); if (success) { assertSameState(node.clusterState, state); } else { assertThat(node.clusterState.stateUUID(), not(equalTo(state.stateUUID()))); } } }
void function() throws Exception { Settings settings = Settings.builder() .put(DiscoverySettings.COMMIT_TIMEOUT_SETTING.getKey(), "1ms").build(); MockNode master = createMockNode(STR, settings); MockNode node = createMockNode("node", settings); ClusterState state = ClusterState.builder(master.clusterState) .nodes(DiscoveryNodes.builder(master.clusterState.nodes()).add(node.discoveryNode).masterNodeId(master.discoveryNode.getId())).build(); for (int i = 0; i < 10; i++) { state = ClusterState.builder(state).incrementVersion().build(); logger.debug(STR, state.version(), state.stateUUID()); boolean success; try { publishState(master.action, state, master.clusterState, 2).await(1, TimeUnit.HOURS); success = true; } catch (Discovery.FailedToCommitClusterStateException OK) { success = false; } logger.debug(STR, success ? STR : STR); if (success) { assertSameState(node.clusterState, state); } else { assertThat(node.clusterState.stateUUID(), not(equalTo(state.stateUUID()))); } } }
/** * Tests that cluster is committed or times out. It should never be the case that we fail * an update due to a commit timeout, but it ends up being committed anyway */
Tests that cluster is committed or times out. It should never be the case that we fail an update due to a commit timeout, but it ends up being committed anyway
testTimeoutOrCommit
{ "repo_name": "zkidkid/elasticsearch", "path": "core/src/test/java/org/elasticsearch/discovery/zen/publish/PublishClusterStateActionTests.java", "license": "apache-2.0", "size": 44836 }
[ "java.util.concurrent.TimeUnit", "org.elasticsearch.cluster.ClusterState", "org.elasticsearch.cluster.node.DiscoveryNodes", "org.elasticsearch.common.settings.Settings", "org.elasticsearch.discovery.Discovery", "org.elasticsearch.discovery.DiscoverySettings", "org.hamcrest.Matchers" ]
import java.util.concurrent.TimeUnit; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.discovery.Discovery; import org.elasticsearch.discovery.DiscoverySettings; import org.hamcrest.Matchers;
import java.util.concurrent.*; import org.elasticsearch.cluster.*; import org.elasticsearch.cluster.node.*; import org.elasticsearch.common.settings.*; import org.elasticsearch.discovery.*; import org.hamcrest.*;
[ "java.util", "org.elasticsearch.cluster", "org.elasticsearch.common", "org.elasticsearch.discovery", "org.hamcrest" ]
java.util; org.elasticsearch.cluster; org.elasticsearch.common; org.elasticsearch.discovery; org.hamcrest;
113,315
public void map(Id idArg, T valorId) throws VariavelJaDeclaradaException { try { HashMap<Id, T> aux = pilha.peek(); if (aux.put(idArg, valorId) != null) throw new IdentificadorJaDeclaradoException(); } catch (IdentificadorJaDeclaradoException e) { throw new VariavelJaDeclaradaException(idArg); } }
void function(Id idArg, T valorId) throws VariavelJaDeclaradaException { try { HashMap<Id, T> aux = pilha.peek(); if (aux.put(idArg, valorId) != null) throw new IdentificadorJaDeclaradoException(); } catch (IdentificadorJaDeclaradoException e) { throw new VariavelJaDeclaradaException(idArg); } }
/** * Mapeia o id no valor dado. * * @exception VariavelJaDeclaradaException * se já existir um mapeamento do identificador nesta tabela. */
Mapeia o id no valor dado
map
{ "repo_name": "ThaisaMirely/SimpleLang", "path": "plp-master/src/plp/expressions2/memory/Contexto.java", "license": "mit", "size": 2561 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
1,251,692
public byte[] read65536LongByteArray() throws IOException { int size = readShort(); if (size < 0) { throw new IOException("Illegal request of an array of " + size + " size"); } byte[] buffer = new byte[size]; int bytes_read_total = 0; int bytes_read = 0; while ((bytes_read_total < size) && (bytes_read = in.read(buffer, bytes_read_total, size - bytes_read_total)) != -1) { bytes_read_total += bytes_read; } if (bytes_read_total != size) { throw new IOException("Declared array size=" + size + " is not equal to actually read bytes count(" + bytes_read_total + ")!"); } return buffer; }
byte[] function() throws IOException { int size = readShort(); if (size < 0) { throw new IOException(STR + size + STR); } byte[] buffer = new byte[size]; int bytes_read_total = 0; int bytes_read = 0; while ((bytes_read_total < size) && (bytes_read = in.read(buffer, bytes_read_total, size - bytes_read_total)) != -1) { bytes_read_total += bytes_read; } if (bytes_read_total != size) { throw new IOException(STR + size + STR + bytes_read_total + ")!"); } return buffer; }
/** * This method reads a byte array of a maximum length of 65536 entries * * @return the byte array serialized * @throws java.io.IOException * if there is an IO error */
This method reads a byte array of a maximum length of 65536 entries
read65536LongByteArray
{ "repo_name": "atomixnmc/AtomMiniGdx", "path": "src/sg/atom/core/io/InputSerializer.java", "license": "apache-2.0", "size": 10096 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,224,543
private void shortcutDocIdsToLoad(SearchContext context) { final int[] docIdsToLoad; int docsOffset = 0; final Suggest suggest = context.queryResult().suggest(); int numSuggestDocs = 0; final List<CompletionSuggestion> completionSuggestions; if (suggest != null && suggest.hasScoreDocs()) { completionSuggestions = suggest.filter(CompletionSuggestion.class); for (CompletionSuggestion completionSuggestion : completionSuggestions) { numSuggestDocs += completionSuggestion.getOptions().size(); } } else { completionSuggestions = Collections.emptyList(); } if (context.request().scroll() != null) { TopDocs topDocs = context.queryResult().topDocs(); docIdsToLoad = new int[topDocs.scoreDocs.length + numSuggestDocs]; for (int i = 0; i < topDocs.scoreDocs.length; i++) { docIdsToLoad[docsOffset++] = topDocs.scoreDocs[i].doc; } } else { TopDocs topDocs = context.queryResult().topDocs(); if (topDocs.scoreDocs.length < context.from()) { // no more docs... docIdsToLoad = new int[numSuggestDocs]; } else { int totalSize = context.from() + context.size(); docIdsToLoad = new int[Math.min(topDocs.scoreDocs.length - context.from(), context.size()) + numSuggestDocs]; for (int i = context.from(); i < Math.min(totalSize, topDocs.scoreDocs.length); i++) { docIdsToLoad[docsOffset++] = topDocs.scoreDocs[i].doc; } } } for (CompletionSuggestion completionSuggestion : completionSuggestions) { for (CompletionSuggestion.Entry.Option option : completionSuggestion.getOptions()) { docIdsToLoad[docsOffset++] = option.getDoc().doc; } } context.docIdsToLoad(docIdsToLoad, 0, docIdsToLoad.length); }
void function(SearchContext context) { final int[] docIdsToLoad; int docsOffset = 0; final Suggest suggest = context.queryResult().suggest(); int numSuggestDocs = 0; final List<CompletionSuggestion> completionSuggestions; if (suggest != null && suggest.hasScoreDocs()) { completionSuggestions = suggest.filter(CompletionSuggestion.class); for (CompletionSuggestion completionSuggestion : completionSuggestions) { numSuggestDocs += completionSuggestion.getOptions().size(); } } else { completionSuggestions = Collections.emptyList(); } if (context.request().scroll() != null) { TopDocs topDocs = context.queryResult().topDocs(); docIdsToLoad = new int[topDocs.scoreDocs.length + numSuggestDocs]; for (int i = 0; i < topDocs.scoreDocs.length; i++) { docIdsToLoad[docsOffset++] = topDocs.scoreDocs[i].doc; } } else { TopDocs topDocs = context.queryResult().topDocs(); if (topDocs.scoreDocs.length < context.from()) { docIdsToLoad = new int[numSuggestDocs]; } else { int totalSize = context.from() + context.size(); docIdsToLoad = new int[Math.min(topDocs.scoreDocs.length - context.from(), context.size()) + numSuggestDocs]; for (int i = context.from(); i < Math.min(totalSize, topDocs.scoreDocs.length); i++) { docIdsToLoad[docsOffset++] = topDocs.scoreDocs[i].doc; } } } for (CompletionSuggestion completionSuggestion : completionSuggestions) { for (CompletionSuggestion.Entry.Option option : completionSuggestion.getOptions()) { docIdsToLoad[docsOffset++] = option.getDoc().doc; } } context.docIdsToLoad(docIdsToLoad, 0, docIdsToLoad.length); }
/** * Shortcut ids to load, we load only "from" and up to "size". The phase controller * handles this as well since the result is always size * shards for Q_A_F */
Shortcut ids to load, we load only "from" and up to "size". The phase controller handles this as well since the result is always size * shards for Q_A_F
shortcutDocIdsToLoad
{ "repo_name": "nezirus/elasticsearch", "path": "core/src/main/java/org/elasticsearch/search/SearchService.java", "license": "apache-2.0", "size": 36832 }
[ "java.util.Collections", "java.util.List", "org.apache.lucene.search.TopDocs", "org.elasticsearch.search.internal.SearchContext", "org.elasticsearch.search.suggest.Suggest", "org.elasticsearch.search.suggest.completion.CompletionSuggestion" ]
import java.util.Collections; import java.util.List; import org.apache.lucene.search.TopDocs; import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.suggest.Suggest; import org.elasticsearch.search.suggest.completion.CompletionSuggestion;
import java.util.*; import org.apache.lucene.search.*; import org.elasticsearch.search.internal.*; import org.elasticsearch.search.suggest.*; import org.elasticsearch.search.suggest.completion.*;
[ "java.util", "org.apache.lucene", "org.elasticsearch.search" ]
java.util; org.apache.lucene; org.elasticsearch.search;
185,051
public static ComponentUI createUI(JComponent a) { MultiPanelUI mui = new MultiPanelUI(); return MultiLookAndFeel.createUIs(mui, mui.uis, a); }
static ComponentUI function(JComponent a) { MultiPanelUI mui = new MultiPanelUI(); return MultiLookAndFeel.createUIs(mui, mui.uis, a); }
/** * Returns a multiplexing UI instance if any of the auxiliary * <code>LookAndFeel</code>s supports this UI. Otherwise, just returns the * UI object obtained from the default <code>LookAndFeel</code>. * * @param a the component to create the UI for * @return the UI delegate created */
Returns a multiplexing UI instance if any of the auxiliary <code>LookAndFeel</code>s supports this UI. Otherwise, just returns the UI object obtained from the default <code>LookAndFeel</code>
createUI
{ "repo_name": "mirkosertic/Bytecoder", "path": "classlib/java.desktop/src/main/resources/META-INF/modules/java.desktop/classes/javax/swing/plaf/multi/MultiPanelUI.java", "license": "apache-2.0", "size": 7272 }
[ "javax.swing.JComponent", "javax.swing.plaf.ComponentUI" ]
import javax.swing.JComponent; import javax.swing.plaf.ComponentUI;
import javax.swing.*; import javax.swing.plaf.*;
[ "javax.swing" ]
javax.swing;
491,071
public Observable<String> zrangebylexObservable(String key, String min, String max, LimitOptions options) { io.vertx.rx.java.ObservableFuture<String> handler = io.vertx.rx.java.RxHelper.observableFuture(); zrangebylex(key, min, max, options, handler.toHandler()); return handler; }
Observable<String> function(String key, String min, String max, LimitOptions options) { io.vertx.rx.java.ObservableFuture<String> handler = io.vertx.rx.java.RxHelper.observableFuture(); zrangebylex(key, min, max, options, handler.toHandler()); return handler; }
/** * Return a range of members in a sorted set, by lexicographical range * @param key Key string * @param min Pattern representing a minimum allowed value * @param max Pattern representing a maximum allowed value * @param options Limit options where limit can be specified * @return */
Return a range of members in a sorted set, by lexicographical range
zrangebylexObservable
{ "repo_name": "brianjcj/vertx-redis-client", "path": "src/main/generated/io/vertx/rxjava/redis/RedisTransaction.java", "license": "apache-2.0", "size": 184983 }
[ "io.vertx.redis.op.LimitOptions" ]
import io.vertx.redis.op.LimitOptions;
import io.vertx.redis.op.*;
[ "io.vertx.redis" ]
io.vertx.redis;
638,723
String getJobTaskTagsPrefix(String sessionId, String jobId, String prefix) throws RestServerException, ServiceException;
String getJobTaskTagsPrefix(String sessionId, String jobId, String prefix) throws RestServerException, ServiceException;
/** * Returns a list of the tags of the tasks belonging to job <code>jobId</code> and filtered by a prefix pattern * @param sessionId a valid session id * @param jobId jobid one wants to list the tasks' tags * @param prefix the prefix used to filter tags * @return a list tags */
Returns a list of the tags of the tasks belonging to job <code>jobId</code> and filtered by a prefix pattern
getJobTaskTagsPrefix
{ "repo_name": "ow2-proactive/scheduling-portal", "path": "scheduler-portal/src/main/java/org/ow2/proactive_grid_cloud_portal/scheduler/client/SchedulerService.java", "license": "agpl-3.0", "size": 21328 }
[ "org.ow2.proactive_grid_cloud_portal.common.shared.RestServerException", "org.ow2.proactive_grid_cloud_portal.common.shared.ServiceException" ]
import org.ow2.proactive_grid_cloud_portal.common.shared.RestServerException; import org.ow2.proactive_grid_cloud_portal.common.shared.ServiceException;
import org.ow2.proactive_grid_cloud_portal.common.shared.*;
[ "org.ow2.proactive_grid_cloud_portal" ]
org.ow2.proactive_grid_cloud_portal;
1,089,214
public static void construct( Model queryModel, List<Resource> instances, Model targetModel, Set<Resource> reached, Map<Resource,List<CommandWrapper>> class2Constructor, ProgressMonitor monitor) { construct(queryModel, instances, targetModel, reached, class2Constructor, null, null, monitor); }
static void function( Model queryModel, List<Resource> instances, Model targetModel, Set<Resource> reached, Map<Resource,List<CommandWrapper>> class2Constructor, ProgressMonitor monitor) { construct(queryModel, instances, targetModel, reached, class2Constructor, null, null, monitor); }
/** * Runs the constructors on a List of Resources. * @param queryModel the model to query over * @param instances the instances to run the constructors of * @param targetModel the model that shall receive the new triples * @param reached the Set of already reached Resources * @param monitor an optional progress monitor */
Runs the constructors on a List of Resources
construct
{ "repo_name": "vital-ai/sparql-spin", "path": "src/org/topbraid/spin/inference/SPINConstructors.java", "license": "apache-2.0", "size": 14556 }
[ "com.hp.hpl.jena.rdf.model.Model", "com.hp.hpl.jena.rdf.model.Resource", "java.util.List", "java.util.Map", "java.util.Set", "org.topbraid.spin.progress.ProgressMonitor", "org.topbraid.spin.util.CommandWrapper" ]
import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.Resource; import java.util.List; import java.util.Map; import java.util.Set; import org.topbraid.spin.progress.ProgressMonitor; import org.topbraid.spin.util.CommandWrapper;
import com.hp.hpl.jena.rdf.model.*; import java.util.*; import org.topbraid.spin.progress.*; import org.topbraid.spin.util.*;
[ "com.hp.hpl", "java.util", "org.topbraid.spin" ]
com.hp.hpl; java.util; org.topbraid.spin;
316,027
private String updateAsyncAPIDefinition(String apiId, String apiDefinition) throws APIManagementException, FaultGatewaysException { APIDefinitionValidationResponse response = AsyncApiParserUtil .validateAsyncAPISpecification(apiDefinition, true); if (!response.isValid()) { RestApiUtil.handleBadRequest(response.getErrorItems(), log); } return PublisherCommonUtils.updateAsyncAPIDefinition(apiId, response); }
String function(String apiId, String apiDefinition) throws APIManagementException, FaultGatewaysException { APIDefinitionValidationResponse response = AsyncApiParserUtil .validateAsyncAPISpecification(apiDefinition, true); if (!response.isValid()) { RestApiUtil.handleBadRequest(response.getErrorItems(), log); } return PublisherCommonUtils.updateAsyncAPIDefinition(apiId, response); }
/** * update AsyncAPI definition of the given API. The AsyncAPI will be validated before updating. * * @param apiId API Id * @param apiDefinition AsyncAPI definition * @return updated AsyncAPI definition * @throws APIManagementException when error occurred updating AsyncAPI * @throws FaultGatewaysException when error occurred publishing API to the gateway */
update AsyncAPI definition of the given API. The AsyncAPI will be validated before updating
updateAsyncAPIDefinition
{ "repo_name": "uvindra/carbon-apimgt", "path": "components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/impl/ApisApiServiceImpl.java", "license": "apache-2.0", "size": 274405 }
[ "org.wso2.carbon.apimgt.api.APIDefinitionValidationResponse", "org.wso2.carbon.apimgt.api.APIManagementException", "org.wso2.carbon.apimgt.api.FaultGatewaysException", "org.wso2.carbon.apimgt.impl.definitions.AsyncApiParserUtil", "org.wso2.carbon.apimgt.rest.api.publisher.v1.common.mappings.PublisherCommonU...
import org.wso2.carbon.apimgt.api.APIDefinitionValidationResponse; import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.api.FaultGatewaysException; import org.wso2.carbon.apimgt.impl.definitions.AsyncApiParserUtil; import org.wso2.carbon.apimgt.rest.api.publisher.v1.common.mappings.PublisherCommonUtils; import org.wso2.carbon.apimgt.rest.api.util.utils.RestApiUtil;
import org.wso2.carbon.apimgt.api.*; import org.wso2.carbon.apimgt.impl.definitions.*; import org.wso2.carbon.apimgt.rest.api.publisher.v1.common.mappings.*; import org.wso2.carbon.apimgt.rest.api.util.utils.*;
[ "org.wso2.carbon" ]
org.wso2.carbon;
198,128
@ServiceMethod(returns = ReturnType.SINGLE) public Response<ManagementLockObjectInner> getAtResourceLevelWithResponse( String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String lockName, Context context) { return getAtResourceLevelWithResponseAsync( resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName, context) .block(); }
@ServiceMethod(returns = ReturnType.SINGLE) Response<ManagementLockObjectInner> function( String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String lockName, Context context) { return getAtResourceLevelWithResponseAsync( resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName, context) .block(); }
/** * Get the management lock of a resource or any level below resource. * * @param resourceGroupName The name of the resource group. * @param resourceProviderNamespace The namespace of the resource provider. * @param parentResourcePath An extra path parameter needed in some services, like SQL Databases. * @param resourceType The type of the resource. * @param resourceName The name of the resource. * @param lockName The name of lock. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the management lock of a resource or any level below resource along with {@link Response}. */
Get the management lock of a resource or any level below resource
getAtResourceLevelWithResponse
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/implementation/ManagementLocksClientImpl.java", "license": "mit", "size": 183211 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.Response", "com.azure.core.util.Context", "com.azure.resourcemanager.resources.fluent.models.ManagementLockObjectInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.resources.fluent.models.ManagementLockObjectInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.resources.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
830,902
public void serviceRevoked(BeanContextServiceRevokedEvent bcssre) { synchronized(BeanContext.globalHierarchyLock) { if (services.containsKey(bcssre.getServiceClass())) return; fireServiceRevoked(bcssre); Iterator i; synchronized(children) { i = children.keySet().iterator(); } while (i.hasNext()) { Object c = i.next(); if (c instanceof BeanContextServices) { ((BeanContextServicesListener)c).serviceRevoked(bcssre); } } } }
void function(BeanContextServiceRevokedEvent bcssre) { synchronized(BeanContext.globalHierarchyLock) { if (services.containsKey(bcssre.getServiceClass())) return; fireServiceRevoked(bcssre); Iterator i; synchronized(children) { i = children.keySet().iterator(); } while (i.hasNext()) { Object c = i.next(); if (c instanceof BeanContextServices) { ((BeanContextServicesListener)c).serviceRevoked(bcssre); } } } }
/** * BeanContextServicesListener callback, propagates event to all * currently registered listeners and BeanContextServices children, * if this BeanContextService does not already implement this service * itself. * * subclasses may override or envelope this method to implement their * own propagation semantics. */
BeanContextServicesListener callback, propagates event to all currently registered listeners and BeanContextServices children, if this BeanContextService does not already implement this service itself. subclasses may override or envelope this method to implement their own propagation semantics
serviceRevoked
{ "repo_name": "rokn/Count_Words_2015", "path": "testing/openjdk/jdk/src/share/classes/java/beans/beancontext/BeanContextServicesSupport.java", "license": "mit", "size": 42459 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
2,053,955
public Integer readOptionalInt() throws IOException { if (readBoolean()) { return readInt(); } return null; } /** * Reads an int stored in variable-length format. Reads between one and * five bytes. Smaller values take fewer bytes. Negative numbers * will always use all 5 bytes and are therefore better serialized * using {@link #readInt}
Integer function() throws IOException { if (readBoolean()) { return readInt(); } return null; } /** * Reads an int stored in variable-length format. Reads between one and * five bytes. Smaller values take fewer bytes. Negative numbers * will always use all 5 bytes and are therefore better serialized * using {@link #readInt}
/** * Reads an optional {@link Integer}. */
Reads an optional <code>Integer</code>
readOptionalInt
{ "repo_name": "coding0011/elasticsearch", "path": "server/src/main/java/org/elasticsearch/common/io/stream/StreamInput.java", "license": "apache-2.0", "size": 47459 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,667,308
private static Map<String, Dictionary> getDictionaryMap(List<String> dictionaryColumnIdList, CarbonTable carbonTable) throws IOException { // if any complex dimension not present in query then return the empty map if (dictionaryColumnIdList.size() == 0) { return new HashMap<>(); } // this for dictionary unique identifier List<DictionaryColumnUniqueIdentifier> dictionaryColumnUniqueIdentifiers = getDictionaryColumnUniqueIdentifierList(dictionaryColumnIdList, carbonTable); CacheProvider cacheProvider = CacheProvider.getInstance(); Cache<DictionaryColumnUniqueIdentifier, Dictionary> forwardDictionaryCache = cacheProvider .createCache(CacheType.FORWARD_DICTIONARY); List<Dictionary> columnDictionaryList = forwardDictionaryCache.getAll(dictionaryColumnUniqueIdentifiers); Map<String, Dictionary> columnDictionaryMap = new HashMap<>(columnDictionaryList.size()); for (int i = 0; i < dictionaryColumnUniqueIdentifiers.size(); i++) { // TODO: null check for column dictionary, if cache size is less it // might return null here, in that case throw exception columnDictionaryMap .put(dictionaryColumnUniqueIdentifiers.get(i).getColumnIdentifier().getColumnId(), columnDictionaryList.get(i)); } return columnDictionaryMap; }
static Map<String, Dictionary> function(List<String> dictionaryColumnIdList, CarbonTable carbonTable) throws IOException { if (dictionaryColumnIdList.size() == 0) { return new HashMap<>(); } List<DictionaryColumnUniqueIdentifier> dictionaryColumnUniqueIdentifiers = getDictionaryColumnUniqueIdentifierList(dictionaryColumnIdList, carbonTable); CacheProvider cacheProvider = CacheProvider.getInstance(); Cache<DictionaryColumnUniqueIdentifier, Dictionary> forwardDictionaryCache = cacheProvider .createCache(CacheType.FORWARD_DICTIONARY); List<Dictionary> columnDictionaryList = forwardDictionaryCache.getAll(dictionaryColumnUniqueIdentifiers); Map<String, Dictionary> columnDictionaryMap = new HashMap<>(columnDictionaryList.size()); for (int i = 0; i < dictionaryColumnUniqueIdentifiers.size(); i++) { columnDictionaryMap .put(dictionaryColumnUniqueIdentifiers.get(i).getColumnIdentifier().getColumnId(), columnDictionaryList.get(i)); } return columnDictionaryMap; }
/** * Below method will be used to get the column id to its dictionary mapping * * @param dictionaryColumnIdList dictionary column list * @return dictionary mapping * @throws IOException */
Below method will be used to get the column id to its dictionary mapping
getDictionaryMap
{ "repo_name": "jatin9896/incubator-carbondata", "path": "core/src/main/java/org/apache/carbondata/core/scan/executor/util/QueryUtil.java", "license": "apache-2.0", "size": 32061 }
[ "java.io.IOException", "java.util.HashMap", "java.util.List", "java.util.Map", "org.apache.carbondata.core.cache.Cache", "org.apache.carbondata.core.cache.CacheProvider", "org.apache.carbondata.core.cache.CacheType", "org.apache.carbondata.core.cache.dictionary.Dictionary", "org.apache.carbondata.co...
import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.carbondata.core.cache.Cache; import org.apache.carbondata.core.cache.CacheProvider; import org.apache.carbondata.core.cache.CacheType; import org.apache.carbondata.core.cache.dictionary.Dictionary; import org.apache.carbondata.core.cache.dictionary.DictionaryColumnUniqueIdentifier; import org.apache.carbondata.core.metadata.schema.table.CarbonTable;
import java.io.*; import java.util.*; import org.apache.carbondata.core.cache.*; import org.apache.carbondata.core.cache.dictionary.*; import org.apache.carbondata.core.metadata.schema.table.*;
[ "java.io", "java.util", "org.apache.carbondata" ]
java.io; java.util; org.apache.carbondata;
1,311,823
public static synchronized ImmutableSet<BuildTarget> filterAllTargetsInProject( Parser parser, Cell cell, BuckEventBus buckEventBus, ListeningExecutorService executor) throws BuildFileParseException, IOException, InterruptedException { return FluentIterable.from( parser .buildTargetGraphForTargetNodeSpecs( buckEventBus, cell, false, executor, ImmutableList.of( TargetNodePredicateSpec.of( BuildFileSpec.fromRecursivePath(Paths.get(""), cell.getRoot())))) .getTargetGraph() .getNodes()) .transform(TargetNode::getBuildTarget) .toSet(); }
static synchronized ImmutableSet<BuildTarget> function( Parser parser, Cell cell, BuckEventBus buckEventBus, ListeningExecutorService executor) throws BuildFileParseException, IOException, InterruptedException { return FluentIterable.from( parser .buildTargetGraphForTargetNodeSpecs( buckEventBus, cell, false, executor, ImmutableList.of( TargetNodePredicateSpec.of( BuildFileSpec.fromRecursivePath(Paths.get(""), cell.getRoot())))) .getTargetGraph() .getNodes()) .transform(TargetNode::getBuildTarget) .toSet(); }
/** * Populates the collection of known build targets that this Parser will use to construct an * action graph using all build files inside the given project root and returns an optionally * filtered set of build targets. * * @return The build targets in the project filtered by the given filter. */
Populates the collection of known build targets that this Parser will use to construct an action graph using all build files inside the given project root and returns an optionally filtered set of build targets
filterAllTargetsInProject
{ "repo_name": "clonetwin26/buck", "path": "test/com/facebook/buck/parser/ParserTest.java", "license": "apache-2.0", "size": 101722 }
[ "com.facebook.buck.event.BuckEventBus", "com.facebook.buck.model.BuildTarget", "com.facebook.buck.parser.exceptions.BuildFileParseException", "com.facebook.buck.rules.Cell", "com.facebook.buck.rules.TargetNode", "com.google.common.collect.FluentIterable", "com.google.common.collect.ImmutableList", "co...
import com.facebook.buck.event.BuckEventBus; import com.facebook.buck.model.BuildTarget; import com.facebook.buck.parser.exceptions.BuildFileParseException; import com.facebook.buck.rules.Cell; import com.facebook.buck.rules.TargetNode; import com.google.common.collect.FluentIterable; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.common.util.concurrent.ListeningExecutorService; import java.io.IOException; import java.nio.file.Paths;
import com.facebook.buck.event.*; import com.facebook.buck.model.*; import com.facebook.buck.parser.exceptions.*; import com.facebook.buck.rules.*; import com.google.common.collect.*; import com.google.common.util.concurrent.*; import java.io.*; import java.nio.file.*;
[ "com.facebook.buck", "com.google.common", "java.io", "java.nio" ]
com.facebook.buck; com.google.common; java.io; java.nio;
1,384,283
private boolean changeFormStatus(FormStatus formStatus, String uuid) throws ConstraintViolations{ String sql = "UPDATE `"+ schemaName + "`.`form` SET `status`= ? WHERE `uuid`= ? ;"; int statusCode = -1; switch(formStatus){ case NEW:{ statusCode = FormStatusCodes.NEW; break; } case CREATING:{ statusCode = FormStatusCodes.CREATING; break; } case READY:{ statusCode = FormStatusCodes.READY; break; } case TRANSFERRING:{ statusCode = FormStatusCodes.TRANSFERRING; break; } case COMPLETE:{ statusCode = FormStatusCodes.COMPLETE; break; } default:{ return false; } } try (Connection connection = dataSource.getConnection(); PreparedStatement ps = connection.prepareStatement(sql)){ ps.setInt(1, new Integer(statusCode)); ps.setString(2, uuid); int rowCount = ps.executeUpdate(); if(rowCount > 0){ return true; } } catch(SQLException sqlException){ throw new ConstraintViolations("Could not change form status."); } return false; }
boolean function(FormStatus formStatus, String uuid) throws ConstraintViolations{ String sql = STR+ schemaName + STR; int statusCode = -1; switch(formStatus){ case NEW:{ statusCode = FormStatusCodes.NEW; break; } case CREATING:{ statusCode = FormStatusCodes.CREATING; break; } case READY:{ statusCode = FormStatusCodes.READY; break; } case TRANSFERRING:{ statusCode = FormStatusCodes.TRANSFERRING; break; } case COMPLETE:{ statusCode = FormStatusCodes.COMPLETE; break; } default:{ return false; } } try (Connection connection = dataSource.getConnection(); PreparedStatement ps = connection.prepareStatement(sql)){ ps.setInt(1, new Integer(statusCode)); ps.setString(2, uuid); int rowCount = ps.executeUpdate(); if(rowCount > 0){ return true; } } catch(SQLException sqlException){ throw new ConstraintViolations(STR); } return false; }
/** * Sets the status of the form entry with specified UUID to FormStatus. * The possible statuses are defined in the FormStatus enum and are mapped before * inserting into the database to the int values defined in FormStatusCodes. * <p> * In case status could not be set, will throw a ConstraintViolations. * * @param formStatus The status that this form entry will be set to * @param uuid The UUID of the entry in form table whose status should be changed * @return A boolean, indicating if the form status could be changed * @throws ConstraintViolations * @see FormStatus * @see FormStatusCodes * @see SQLException */
Sets the status of the form entry with specified UUID to FormStatus. The possible statuses are defined in the FormStatus enum and are mapped before inserting into the database to the int values defined in FormStatusCodes. In case status could not be set, will throw a ConstraintViolations
changeFormStatus
{ "repo_name": "SwissTPH/openhds-server", "path": "controller/src/main/java/org/openhds/controller/service/impl/ExtraFormServiceImpl.java", "license": "bsd-3-clause", "size": 25926 }
[ "java.sql.Connection", "java.sql.PreparedStatement", "java.sql.SQLException", "org.openhds.controller.exception.ConstraintViolations" ]
import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import org.openhds.controller.exception.ConstraintViolations;
import java.sql.*; import org.openhds.controller.exception.*;
[ "java.sql", "org.openhds.controller" ]
java.sql; org.openhds.controller;
1,388,663
public void setWeeks(Set<Week> weeks) { this.weeks = weeks; }
void function(Set<Week> weeks) { this.weeks = weeks; }
/** * Setter for weeks. * * @param weeks the weeks to set */
Setter for weeks
setWeeks
{ "repo_name": "excellentia/timeline", "path": "src/org/ag/timeline/presentation/transferobject/reply/WeekReply.java", "license": "gpl-3.0", "size": 552 }
[ "java.util.Set", "org.ag.timeline.business.model.Week" ]
import java.util.Set; import org.ag.timeline.business.model.Week;
import java.util.*; import org.ag.timeline.business.model.*;
[ "java.util", "org.ag.timeline" ]
java.util; org.ag.timeline;
2,406,807
void setRenderingSettings(Map map) { renderingSettings = map; loaders.remove(SETTINGS); }
void setRenderingSettings(Map map) { renderingSettings = map; loaders.remove(SETTINGS); }
/** * Sets the rendering settings linked to the currently viewed set * of pixels. * * @param map The map to set. */
Sets the rendering settings linked to the currently viewed set of pixels
setRenderingSettings
{ "repo_name": "joshmoore/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerModel.java", "license": "gpl-2.0", "size": 72048 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
876,558
@Type(type = "com.servinglynk.hmis.warehouse.enums.HealthinsuranceSchipEnumType") @Basic( optional = true ) @Column public HealthinsuranceSchipEnum getSchip() { return this.schip; }
@Type(type = STR) @Basic( optional = true ) HealthinsuranceSchipEnum function() { return this.schip; }
/** * Return the value associated with the column: schip. * @return A HealthinsuranceSchipEnum object (this.schip) */
Return the value associated with the column: schip
getSchip
{ "repo_name": "servinglynk/servinglynk-hmis", "path": "hmis-model-v2015/src/main/java/com/servinglynk/hmis/warehouse/model/v2015/Healthinsurance.java", "license": "mpl-2.0", "size": 30153 }
[ "com.servinglynk.hmis.warehouse.enums.HealthinsuranceSchipEnum", "javax.persistence.Basic", "org.hibernate.annotations.Type" ]
import com.servinglynk.hmis.warehouse.enums.HealthinsuranceSchipEnum; import javax.persistence.Basic; import org.hibernate.annotations.Type;
import com.servinglynk.hmis.warehouse.enums.*; import javax.persistence.*; import org.hibernate.annotations.*;
[ "com.servinglynk.hmis", "javax.persistence", "org.hibernate.annotations" ]
com.servinglynk.hmis; javax.persistence; org.hibernate.annotations;
1,924,529
private void inlineFunction( NodeTraversal t, Node callNode, FunctionState fs, InliningMode mode) { Function fn = fs.getFn(); String fnName = fn.getName(); Node fnNode = fs.getSafeFnNode(); Node newCode = injector.inline(t, callNode, fnName, fnNode, mode); t.getCompiler().reportCodeChange(); t.getCompiler().addToDebugLog("Inlined function: " + fn.getName()); } }
void function( NodeTraversal t, Node callNode, FunctionState fs, InliningMode mode) { Function fn = fs.getFn(); String fnName = fn.getName(); Node fnNode = fs.getSafeFnNode(); Node newCode = injector.inline(t, callNode, fnName, fnNode, mode); t.getCompiler().reportCodeChange(); t.getCompiler().addToDebugLog(STR + fn.getName()); } }
/** * Inline a function into the call site. */
Inline a function into the call site
inlineFunction
{ "repo_name": "abdullah38rcc/closure-compiler", "path": "src/com/google/javascript/jscomp/InlineFunctions.java", "license": "apache-2.0", "size": 34916 }
[ "com.google.javascript.jscomp.FunctionInjector", "com.google.javascript.rhino.Node" ]
import com.google.javascript.jscomp.FunctionInjector; import com.google.javascript.rhino.Node;
import com.google.javascript.jscomp.*; import com.google.javascript.rhino.*;
[ "com.google.javascript" ]
com.google.javascript;
982,726
public void setAmt (BigDecimal Amt) { set_Value (COLUMNNAME_Amt, Amt); }
void function (BigDecimal Amt) { set_Value (COLUMNNAME_Amt, Amt); }
/** Set Amount. @param Amt Amount */
Set Amount
setAmt
{ "repo_name": "geneos/adempiere", "path": "base/src/org/compiere/model/X_C_LandedCostAllocation.java", "license": "gpl-2.0", "size": 7969 }
[ "java.math.BigDecimal" ]
import java.math.BigDecimal;
import java.math.*;
[ "java.math" ]
java.math;
513,114
protected void handleWrite(SocketChannelContext context) throws IOException { context.flushChannel(); }
void function(SocketChannelContext context) throws IOException { context.flushChannel(); }
/** * This method is called when a channel signals it is ready to receive writes. All of the write logic * should occur in this call. * * @param context that can be written to */
This method is called when a channel signals it is ready to receive writes. All of the write logic should occur in this call
handleWrite
{ "repo_name": "gingerwizard/elasticsearch", "path": "libs/nio/src/main/java/org/elasticsearch/nio/EventHandler.java", "license": "apache-2.0", "size": 9519 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
621,158
ShowType getShow();
ShowType getShow();
/** * Returns the value of the '<em><b>Show</b></em>' attribute. * The literals are from the enumeration {@link org.w3.xlink.ShowType}. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Show</em>' attribute isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Show</em>' attribute. * @see org.w3.xlink.ShowType * @see #isSetShow() * @see #unsetShow() * @see #setShow(ShowType) * @see net.opengis.gml311.Gml311Package#getSymbolType_Show() * @model unsettable="true" * extendedMetaData="kind='attribute' name='show' namespace='http://www.w3.org/1999/xlink'" * @generated */
Returns the value of the 'Show' attribute. The literals are from the enumeration <code>org.w3.xlink.ShowType</code>. If the meaning of the 'Show' attribute isn't clear, there really should be more of a description here...
getShow
{ "repo_name": "geotools/geotools", "path": "modules/ogc/net.opengis.wmts/src/net/opengis/gml311/SymbolType.java", "license": "lgpl-2.1", "size": 17498 }
[ "org.w3.xlink.ShowType" ]
import org.w3.xlink.ShowType;
import org.w3.xlink.*;
[ "org.w3.xlink" ]
org.w3.xlink;
2,215,168
default void defineProperties(Shape shape) {}
default void defineProperties(Shape shape) {}
/** * Set the value for the root entity type * @param value entity type name */
Set the value for the root entity type
setRootEntityType
{ "repo_name": "ddalton/xor", "path": "src/main/java/tools/xor/EntityType.java", "license": "apache-2.0", "size": 14801 }
[ "tools.xor.service.Shape" ]
import tools.xor.service.Shape;
import tools.xor.service.*;
[ "tools.xor.service" ]
tools.xor.service;
2,898,462
try { JsonObject obj = new JsonObject(); int offset = 0; for( FieldDescriptor fd : rd.getFields()) { int to = offset + fd.getLength(); if( to > stringValue.length()) to = stringValue.length(); String val = stringValue.substring(offset, to); if( fd.getType().equals(FieldDescriptor.TYPE_CHAR)) { obj.addProperty(fd.getJsonName(), val.trim()); } else if( fd.getType().equals(FieldDescriptor.TYPE_ZONED)) { if( fd.getDecimals() == 0 ) { obj.addProperty(fd.getJsonName(), Long.parseLong(val)); }else { BigDecimal d = new BigDecimal(val); for( int i = 0; i < fd.getDecimals(); i++ ) { d = d.divide(new BigDecimal(10)); } obj.addProperty(fd.getJsonName(), d); } } offset += fd.getLength(); } return obj; } catch( Exception e ) { throw DCMExceptionHelper.defaultException(e.getMessage(), e); } }
try { JsonObject obj = new JsonObject(); int offset = 0; for( FieldDescriptor fd : rd.getFields()) { int to = offset + fd.getLength(); if( to > stringValue.length()) to = stringValue.length(); String val = stringValue.substring(offset, to); if( fd.getType().equals(FieldDescriptor.TYPE_CHAR)) { obj.addProperty(fd.getJsonName(), val.trim()); } else if( fd.getType().equals(FieldDescriptor.TYPE_ZONED)) { if( fd.getDecimals() == 0 ) { obj.addProperty(fd.getJsonName(), Long.parseLong(val)); }else { BigDecimal d = new BigDecimal(val); for( int i = 0; i < fd.getDecimals(); i++ ) { d = d.divide(new BigDecimal(10)); } obj.addProperty(fd.getJsonName(), d); } } offset += fd.getLength(); } return obj; } catch( Exception e ) { throw DCMExceptionHelper.defaultException(e.getMessage(), e); } }
/** * Converts String formatted record to a JSON Object * * @param rd * The Record Descriptor used * @param stringValue * The String valued object * @return A fully formatted JSON Object * @throws DCMException */
Converts String formatted record to a JSON Object
toJson
{ "repo_name": "mhapanow/iseries-ws", "path": "ws-services/src/main/java/org/dcm/services/impl/RecordHelper.java", "license": "apache-2.0", "size": 6921 }
[ "com.google.gson.JsonObject", "java.math.BigDecimal", "org.dcm.services.exception.DCMExceptionHelper", "org.dcm.services.model.FieldDescriptor" ]
import com.google.gson.JsonObject; import java.math.BigDecimal; import org.dcm.services.exception.DCMExceptionHelper; import org.dcm.services.model.FieldDescriptor;
import com.google.gson.*; import java.math.*; import org.dcm.services.exception.*; import org.dcm.services.model.*;
[ "com.google.gson", "java.math", "org.dcm.services" ]
com.google.gson; java.math; org.dcm.services;
1,694,239
@javax.annotation.Nullable @ApiModelProperty(value = "Specify whether the ConfigMap or its keys must be defined") public Boolean getOptional() { return optional; }
@javax.annotation.Nullable @ApiModelProperty(value = STR) Boolean function() { return optional; }
/** * Specify whether the ConfigMap or its keys must be defined * * @return optional */
Specify whether the ConfigMap or its keys must be defined
getOptional
{ "repo_name": "kubernetes-client/java", "path": "client-java-contrib/prometheus-operator/src/main/java/com/coreos/monitoring/models/V1ThanosRulerSpecProjectedConfigMap.java", "license": "apache-2.0", "size": 5822 }
[ "io.swagger.annotations.ApiModelProperty" ]
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.*;
[ "io.swagger.annotations" ]
io.swagger.annotations;
2,852,310
public CompletableFuture<Void> checkStatus() { return isDeduplicationEnabled().thenCompose(shouldBeEnabled -> { synchronized (this) { if (status == Status.Recovering || status == Status.Removing) { // If there's already a transition happening, check later for status pulsar.getExecutor().schedule(this::checkStatus, 1, TimeUnit.MINUTES); return CompletableFuture.completedFuture(null); } if (status == Status.Enabled && !shouldBeEnabled) { // Disabled deduping CompletableFuture<Void> future = new CompletableFuture<>(); status = Status.Removing; managedLedger.asyncDeleteCursor(PersistentTopic.DEDUPLICATION_CURSOR_NAME, new DeleteCursorCallback() {
CompletableFuture<Void> function() { return isDeduplicationEnabled().thenCompose(shouldBeEnabled -> { synchronized (this) { if (status == Status.Recovering status == Status.Removing) { pulsar.getExecutor().schedule(this::checkStatus, 1, TimeUnit.MINUTES); return CompletableFuture.completedFuture(null); } if (status == Status.Enabled && !shouldBeEnabled) { CompletableFuture<Void> future = new CompletableFuture<>(); status = Status.Removing; managedLedger.asyncDeleteCursor(PersistentTopic.DEDUPLICATION_CURSOR_NAME, new DeleteCursorCallback() {
/** * Check the status of deduplication. If the configuration has changed, it will enable/disable deduplication, * returning a future to track the completion of the task */
Check the status of deduplication. If the configuration has changed, it will enable/disable deduplication, returning a future to track the completion of the task
checkStatus
{ "repo_name": "merlimat/pulsar", "path": "pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/MessageDeduplication.java", "license": "apache-2.0", "size": 19927 }
[ "java.util.concurrent.CompletableFuture", "java.util.concurrent.TimeUnit", "org.apache.bookkeeper.mledger.AsyncCallbacks" ]
import java.util.concurrent.CompletableFuture; import java.util.concurrent.TimeUnit; import org.apache.bookkeeper.mledger.AsyncCallbacks;
import java.util.concurrent.*; import org.apache.bookkeeper.mledger.*;
[ "java.util", "org.apache.bookkeeper" ]
java.util; org.apache.bookkeeper;
136,433
@Override protected void onHandleIntent(Intent intent) { GeofencingEvent geoFenceEvent = GeofencingEvent.fromIntent(intent); if (geoFenceEvent.hasError()) { int errorCode = geoFenceEvent.getErrorCode(); Log.e(TAG, "Location Services error: " + errorCode); } else { int transitionType = geoFenceEvent.getGeofenceTransition(); if (Geofence.GEOFENCE_TRANSITION_ENTER == transitionType) { // Connect to the Google Api service in preparation for sending a DataItem. mGoogleApiClient.blockingConnect(CONNECTION_TIME_OUT_MS, TimeUnit.MILLISECONDS); // Get the geofence id triggered. Note that only one geofence can be triggered at a // time in this example, but in some cases you might want to consider the full list // of geofences triggered. String triggeredGeoFenceId = geoFenceEvent.getTriggeringGeofences().get(0) .getRequestId(); // Create a DataItem with this geofence's id. The wearable can use this to create // a notification. final PutDataMapRequest putDataMapRequest = PutDataMapRequest.create(GEOFENCE_DATA_ITEM_PATH); putDataMapRequest.getDataMap().putString(KEY_GEOFENCE_ID, triggeredGeoFenceId); putDataMapRequest.setUrgent(); if (mGoogleApiClient.isConnected()) { Wearable.DataApi.putDataItem( mGoogleApiClient, putDataMapRequest.asPutDataRequest()).await(); } else { Log.e(TAG, "Failed to send data item: " + putDataMapRequest + " - Client disconnected from Google Play Services"); } Toast.makeText(this, getString(R.string.entering_geofence), Toast.LENGTH_SHORT).show(); mGoogleApiClient.disconnect(); } else if (Geofence.GEOFENCE_TRANSITION_EXIT == transitionType) { // Delete the data item when leaving a geofence region. mGoogleApiClient.blockingConnect(CONNECTION_TIME_OUT_MS, TimeUnit.MILLISECONDS); Wearable.DataApi.deleteDataItems(mGoogleApiClient, GEOFENCE_DATA_ITEM_URI).await(); showToast(this, R.string.exiting_geofence); mGoogleApiClient.disconnect(); } } }
void function(Intent intent) { GeofencingEvent geoFenceEvent = GeofencingEvent.fromIntent(intent); if (geoFenceEvent.hasError()) { int errorCode = geoFenceEvent.getErrorCode(); Log.e(TAG, STR + errorCode); } else { int transitionType = geoFenceEvent.getGeofenceTransition(); if (Geofence.GEOFENCE_TRANSITION_ENTER == transitionType) { mGoogleApiClient.blockingConnect(CONNECTION_TIME_OUT_MS, TimeUnit.MILLISECONDS); String triggeredGeoFenceId = geoFenceEvent.getTriggeringGeofences().get(0) .getRequestId(); final PutDataMapRequest putDataMapRequest = PutDataMapRequest.create(GEOFENCE_DATA_ITEM_PATH); putDataMapRequest.getDataMap().putString(KEY_GEOFENCE_ID, triggeredGeoFenceId); putDataMapRequest.setUrgent(); if (mGoogleApiClient.isConnected()) { Wearable.DataApi.putDataItem( mGoogleApiClient, putDataMapRequest.asPutDataRequest()).await(); } else { Log.e(TAG, STR + putDataMapRequest + STR); } Toast.makeText(this, getString(R.string.entering_geofence), Toast.LENGTH_SHORT).show(); mGoogleApiClient.disconnect(); } else if (Geofence.GEOFENCE_TRANSITION_EXIT == transitionType) { mGoogleApiClient.blockingConnect(CONNECTION_TIME_OUT_MS, TimeUnit.MILLISECONDS); Wearable.DataApi.deleteDataItems(mGoogleApiClient, GEOFENCE_DATA_ITEM_URI).await(); showToast(this, R.string.exiting_geofence); mGoogleApiClient.disconnect(); } } }
/** * Handles incoming intents. * @param intent The Intent sent by Location Services. This Intent is provided to Location * Services (inside a PendingIntent) when addGeofences() is called. */
Handles incoming intents
onHandleIntent
{ "repo_name": "wiki2014/Learning-Summary", "path": "alps/developers/samples/android/wearable/wear/Geofencing/Application/src/main/java/com/example/android/wearable/geofencing/GeofenceTransitionsIntentService.java", "license": "gpl-3.0", "size": 5766 }
[ "android.content.Intent", "android.util.Log", "android.widget.Toast", "com.google.android.gms.location.Geofence", "com.google.android.gms.location.GeofencingEvent", "com.google.android.gms.wearable.PutDataMapRequest", "com.google.android.gms.wearable.Wearable", "java.util.concurrent.TimeUnit" ]
import android.content.Intent; import android.util.Log; import android.widget.Toast; import com.google.android.gms.location.Geofence; import com.google.android.gms.location.GeofencingEvent; import com.google.android.gms.wearable.PutDataMapRequest; import com.google.android.gms.wearable.Wearable; import java.util.concurrent.TimeUnit;
import android.content.*; import android.util.*; import android.widget.*; import com.google.android.gms.location.*; import com.google.android.gms.wearable.*; import java.util.concurrent.*;
[ "android.content", "android.util", "android.widget", "com.google.android", "java.util" ]
android.content; android.util; android.widget; com.google.android; java.util;
438,681
public Map<MetricName, ? extends Metric> metrics() { return Collections.unmodifiableMap(metrics.metrics()); }
Map<MetricName, ? extends Metric> function() { return Collections.unmodifiableMap(metrics.metrics()); }
/** * Get read-only handle on global metrics registry. * * @return Map of all metrics. */
Get read-only handle on global metrics registry
metrics
{ "repo_name": "lindong28/kafka", "path": "streams/test-utils/src/main/java/org/apache/kafka/streams/TopologyTestDriver.java", "license": "apache-2.0", "size": 61444 }
[ "java.util.Collections", "java.util.Map", "org.apache.kafka.common.Metric", "org.apache.kafka.common.MetricName" ]
import java.util.Collections; import java.util.Map; import org.apache.kafka.common.Metric; import org.apache.kafka.common.MetricName;
import java.util.*; import org.apache.kafka.common.*;
[ "java.util", "org.apache.kafka" ]
java.util; org.apache.kafka;
1,146,390
public FeatureResultSet queryFeaturesForChunk(GeometryEnvelope envelope, String where, String[] whereArgs, int limit, long offset) { return queryFeaturesForChunk(envelope, where, whereArgs, getPkColumnName(), limit, offset); }
FeatureResultSet function(GeometryEnvelope envelope, String where, String[] whereArgs, int limit, long offset) { return queryFeaturesForChunk(envelope, where, whereArgs, getPkColumnName(), limit, offset); }
/** * Query for features within the geometry envelope ordered by id, starting * at the offset and returning no more than the limit * * @param envelope * geometry envelope * @param where * where clause * @param whereArgs * where arguments * @param limit * chunk limit * @param offset * chunk query offset * @return feature results * @since 6.2.0 */
Query for features within the geometry envelope ordered by id, starting at the offset and returning no more than the limit
queryFeaturesForChunk
{ "repo_name": "ngageoint/geopackage-java", "path": "src/main/java/mil/nga/geopackage/extension/rtree/RTreeIndexTableDao.java", "license": "mit", "size": 349361 }
[ "mil.nga.geopackage.features.user.FeatureResultSet", "mil.nga.sf.GeometryEnvelope" ]
import mil.nga.geopackage.features.user.FeatureResultSet; import mil.nga.sf.GeometryEnvelope;
import mil.nga.geopackage.features.user.*; import mil.nga.sf.*;
[ "mil.nga.geopackage", "mil.nga.sf" ]
mil.nga.geopackage; mil.nga.sf;
1,962,697
@VisibleForTesting public static void addExpandedExecPathStrings(Iterable<Artifact> artifacts, Collection<String> output, ArtifactExpander artifactExpander) { addExpandedArtifacts(artifacts, output, ActionInputHelper.EXEC_PATH_STRING_FORMATTER, artifactExpander); }
static void function(Iterable<Artifact> artifacts, Collection<String> output, ArtifactExpander artifactExpander) { addExpandedArtifacts(artifacts, output, ActionInputHelper.EXEC_PATH_STRING_FORMATTER, artifactExpander); }
/** * Converts a collection of artifacts into execution-time path strings, and * adds those to a given collection. Middleman artifacts for * {@link MiddlemanType#AGGREGATING_MIDDLEMAN} middleman actions are expanded * once. */
Converts a collection of artifacts into execution-time path strings, and adds those to a given collection. Middleman artifacts for <code>MiddlemanType#AGGREGATING_MIDDLEMAN</code> middleman actions are expanded once
addExpandedExecPathStrings
{ "repo_name": "mrdomino/bazel", "path": "src/main/java/com/google/devtools/build/lib/actions/Artifact.java", "license": "apache-2.0", "size": 34303 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
2,444,940
public Date getFirstSelectionDate() { return getSelectionModel().getFirstSelectionDate(); }
Date function() { return getSelectionModel().getFirstSelectionDate(); }
/** * Returns the earliest selected date. * * * @return the first Date in the selection or null if empty. */
Returns the earliest selected date
getFirstSelectionDate
{ "repo_name": "syncer/swingx", "path": "swingx-core/src/main/java/org/jdesktop/swingx/JXMonthView.java", "license": "lgpl-2.1", "size": 62756 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
2,664,199
Date getPostDateAsDate();
Date getPostDateAsDate();
/** * Gets the entry post date. * * @return the entry post date */
Gets the entry post date
getPostDateAsDate
{ "repo_name": "jeraymond/orber.io", "path": "src/main/java/io/orber/site/web/gwt/shared/requestfactory/BlogEntryProxy.java", "license": "apache-2.0", "size": 4609 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
334,774
@Override public void mousePressed(MouseEvent evt) { // Currently dragging the mouse // User must have clicked the other mouse button // Ignore if (dragging) { return; } //You are about to drag the mouse dragging = true; rightButton = SwingUtilities.isRightMouseButton(evt); //Store initial point that was clicked startX = (short) evt.getX(); startY = (short) evt.getY(); // Create a new temporary workspace and save it to this object imageCraft.drawingArea.instantiateWorkSpace(); workSpace = imageCraft.drawingArea.getWorkSpace(); workSpaceGraphics = (Graphics2D) imageCraft.drawingArea.getWorkSpace().getGraphics(); //Determine which color to paint with and set the imageGraphics to that color Color toColor = imageCraft.getPaintColor(!rightButton); workSpaceGraphics.setColor(toColor); workSpaceGraphics.setStroke(new BasicStroke(penWidth)); // Set the backgroundColor so that we can use clearRect workSpaceGraphics.setBackground(new Color(0, 0, 0, 0)); drawingGraphics = imageCraft.drawingArea.getGraphics(); }
void function(MouseEvent evt) { if (dragging) { return; } dragging = true; rightButton = SwingUtilities.isRightMouseButton(evt); startX = (short) evt.getX(); startY = (short) evt.getY(); imageCraft.drawingArea.instantiateWorkSpace(); workSpace = imageCraft.drawingArea.getWorkSpace(); workSpaceGraphics = (Graphics2D) imageCraft.drawingArea.getWorkSpace().getGraphics(); Color toColor = imageCraft.getPaintColor(!rightButton); workSpaceGraphics.setColor(toColor); workSpaceGraphics.setStroke(new BasicStroke(penWidth)); workSpaceGraphics.setBackground(new Color(0, 0, 0, 0)); drawingGraphics = imageCraft.drawingArea.getGraphics(); }
/** * Start drawing the shape of shapeType * * @param evt The MouseEvent that has fired. */
Start drawing the shape of shapeType
mousePressed
{ "repo_name": "thomasjbarry/Image-Craft", "path": "tzk.imagecraft/src/tzk/image/tool/Shapes.java", "license": "mit", "size": 9714 }
[ "java.awt.BasicStroke", "java.awt.Color", "java.awt.Graphics2D", "java.awt.event.MouseEvent", "javax.swing.SwingUtilities" ]
import java.awt.BasicStroke; import java.awt.Color; import java.awt.Graphics2D; import java.awt.event.MouseEvent; import javax.swing.SwingUtilities;
import java.awt.*; import java.awt.event.*; import javax.swing.*;
[ "java.awt", "javax.swing" ]
java.awt; javax.swing;
2,851,391
public void removeButton(Widget w) { m_buttonPanel.remove(w); if (CmsCoreProvider.get().isIe7()) { m_buttonPanel.getElement().getStyle().setWidth(m_buttonPanel.getWidgetCount() * 22, Unit.PX); } }
void function(Widget w) { m_buttonPanel.remove(w); if (CmsCoreProvider.get().isIe7()) { m_buttonPanel.getElement().getStyle().setWidth(m_buttonPanel.getWidgetCount() * 22, Unit.PX); } }
/** * Removes a widget from the button panel.<p> * * @param w the widget to remove */
Removes a widget from the button panel
removeButton
{ "repo_name": "it-tavis/opencms-core", "path": "src-gwt/org/opencms/gwt/client/ui/CmsListItemWidget.java", "license": "lgpl-2.1", "size": 37155 }
[ "com.google.gwt.dom.client.Style", "com.google.gwt.user.client.ui.Widget", "org.opencms.gwt.client.CmsCoreProvider" ]
import com.google.gwt.dom.client.Style; import com.google.gwt.user.client.ui.Widget; import org.opencms.gwt.client.CmsCoreProvider;
import com.google.gwt.dom.client.*; import com.google.gwt.user.client.ui.*; import org.opencms.gwt.client.*;
[ "com.google.gwt", "org.opencms.gwt" ]
com.google.gwt; org.opencms.gwt;
2,241,495
public static long updateMetaIfNecessary(final MasterServices services) throws IOException { if (isMetaTableUpdated(services.getCatalogTracker())) { LOG.info("META already up-to date with PB serialization"); return 0; } LOG.info("META has Writable serializations, migrating hbase:meta to PB serialization"); try { long rows = updateMeta(services); LOG.info("META updated with PB serialization. Total rows updated: " + rows); return rows; } catch (IOException e) { LOG.warn("Update hbase:meta with PB serialization failed." + "Master startup aborted."); throw e; } }
static long function(final MasterServices services) throws IOException { if (isMetaTableUpdated(services.getCatalogTracker())) { LOG.info(STR); return 0; } LOG.info(STR); try { long rows = updateMeta(services); LOG.info(STR + rows); return rows; } catch (IOException e) { LOG.warn(STR + STR); throw e; } }
/** * Converting writable serialization to PB, if it is needed. * @param services MasterServices to get a handle on master * @return num migrated rows * @throws IOException or RuntimeException if something goes wrong */
Converting writable serialization to PB, if it is needed
updateMetaIfNecessary
{ "repo_name": "throughsky/lywebank", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/catalog/MetaMigrationConvertingToPB.java", "license": "apache-2.0", "size": 6650 }
[ "java.io.IOException", "org.apache.hadoop.hbase.master.MasterServices" ]
import java.io.IOException; import org.apache.hadoop.hbase.master.MasterServices;
import java.io.*; import org.apache.hadoop.hbase.master.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
1,773,487
public KualiDecimal getStateIncomeTaxPercent() { return stateIncomeTaxPercent; }
KualiDecimal function() { return stateIncomeTaxPercent; }
/** * Gets the stateIncomeTaxPercent attribute. * * @return Returns the stateIncomeTaxPercent */
Gets the stateIncomeTaxPercent attribute
getStateIncomeTaxPercent
{ "repo_name": "ua-eas/ua-kfs-5.3", "path": "work/src/org/kuali/kfs/fp/businessobject/DisbursementVoucherNonResidentAlienTax.java", "license": "agpl-3.0", "size": 11317 }
[ "org.kuali.rice.core.api.util.type.KualiDecimal" ]
import org.kuali.rice.core.api.util.type.KualiDecimal;
import org.kuali.rice.core.api.util.type.*;
[ "org.kuali.rice" ]
org.kuali.rice;
1,330,247
public List<AccessorySensor> getSensors() { if (mSensors != null) { // List of sensors already available. Avoid re-reading from // database. return mSensors; } mSensors = new ArrayList<AccessorySensor>(); Cursor cursor = null; try { cursor = mContext.getContentResolver().query( com.sonyericsson.extras.liveware.aef.registration.Registration.Sensor.URI, null, SensorColumns.DEVICE_ID + " = ?", new String[] { Long.toString(mId) }, null); while (cursor != null && cursor.moveToNext()) { int sensorId = cursor.getInt(cursor.getColumnIndexOrThrow(SensorColumns.SENSOR_ID)); boolean isInterruptSupported = cursor.getInt(cursor .getColumnIndexOrThrow(SensorColumns.SUPPORTS_SENSOR_INTERRUPT)) == 1; String name = cursor.getString(cursor.getColumnIndexOrThrow(SensorColumns.NAME)); int resolution = cursor.getInt(cursor .getColumnIndexOrThrow(SensorColumns.RESOLUTION)); int minimumDelay = cursor.getInt(cursor .getColumnIndexOrThrow(SensorColumns.MINIMUM_DELAY)); int maximumRange = cursor.getInt(cursor .getColumnIndexOrThrow(SensorColumns.MAXIMUM_RANGE)); int typeId = cursor.getInt(cursor .getColumnIndexOrThrow(SensorColumns.SENSOR_TYPE_ID)); AccessorySensorType type = getSensorType(typeId); AccessorySensor sensor = new AccessorySensor(mContext, mHostAppPackageName, sensorId, type, isInterruptSupported, name, resolution, minimumDelay, maximumRange); mSensors.add(sensor); } } catch (SQLException e) { if (Dbg.DEBUG) { Dbg.w("Failed to query sensor", e); } } catch (SecurityException e) { if (Dbg.DEBUG) { Dbg.w("Failed to query sensor", e); } } catch (IllegalArgumentException e) { if (Dbg.DEBUG) { Dbg.w("Failed to query sensor", e); } } finally { if (cursor != null) { cursor.close(); } } return mSensors; }
List<AccessorySensor> function() { if (mSensors != null) { return mSensors; } mSensors = new ArrayList<AccessorySensor>(); Cursor cursor = null; try { cursor = mContext.getContentResolver().query( com.sonyericsson.extras.liveware.aef.registration.Registration.Sensor.URI, null, SensorColumns.DEVICE_ID + STR, new String[] { Long.toString(mId) }, null); while (cursor != null && cursor.moveToNext()) { int sensorId = cursor.getInt(cursor.getColumnIndexOrThrow(SensorColumns.SENSOR_ID)); boolean isInterruptSupported = cursor.getInt(cursor .getColumnIndexOrThrow(SensorColumns.SUPPORTS_SENSOR_INTERRUPT)) == 1; String name = cursor.getString(cursor.getColumnIndexOrThrow(SensorColumns.NAME)); int resolution = cursor.getInt(cursor .getColumnIndexOrThrow(SensorColumns.RESOLUTION)); int minimumDelay = cursor.getInt(cursor .getColumnIndexOrThrow(SensorColumns.MINIMUM_DELAY)); int maximumRange = cursor.getInt(cursor .getColumnIndexOrThrow(SensorColumns.MAXIMUM_RANGE)); int typeId = cursor.getInt(cursor .getColumnIndexOrThrow(SensorColumns.SENSOR_TYPE_ID)); AccessorySensorType type = getSensorType(typeId); AccessorySensor sensor = new AccessorySensor(mContext, mHostAppPackageName, sensorId, type, isInterruptSupported, name, resolution, minimumDelay, maximumRange); mSensors.add(sensor); } } catch (SQLException e) { if (Dbg.DEBUG) { Dbg.w(STR, e); } } catch (SecurityException e) { if (Dbg.DEBUG) { Dbg.w(STR, e); } } catch (IllegalArgumentException e) { if (Dbg.DEBUG) { Dbg.w(STR, e); } } finally { if (cursor != null) { cursor.close(); } } return mSensors; }
/** * Get the sensors available. * * @return List of sensors. */
Get the sensors available
getSensors
{ "repo_name": "hecosire/hecosire-androidapp", "path": "smartExtensionUtils/src/main/java/com/sonyericsson/extras/liveware/extension/util/registration/DeviceInfo.java", "license": "mit", "size": 14180 }
[ "android.database.Cursor", "android.database.SQLException", "com.sonyericsson.extras.liveware.aef.registration.Registration", "com.sonyericsson.extras.liveware.extension.util.Dbg", "com.sonyericsson.extras.liveware.extension.util.sensor.AccessorySensor", "com.sonyericsson.extras.liveware.extension.util.se...
import android.database.Cursor; import android.database.SQLException; import com.sonyericsson.extras.liveware.aef.registration.Registration; import com.sonyericsson.extras.liveware.extension.util.Dbg; import com.sonyericsson.extras.liveware.extension.util.sensor.AccessorySensor; import com.sonyericsson.extras.liveware.extension.util.sensor.AccessorySensorType; import java.util.ArrayList; import java.util.List;
import android.database.*; import com.sonyericsson.extras.liveware.aef.registration.*; import com.sonyericsson.extras.liveware.extension.util.*; import com.sonyericsson.extras.liveware.extension.util.sensor.*; import java.util.*;
[ "android.database", "com.sonyericsson.extras", "java.util" ]
android.database; com.sonyericsson.extras; java.util;
2,344,202
public static Configurable configure() { return new MariaDBManager.Configurable(); } public static final class Configurable { private final ClientLogger logger = new ClientLogger(Configurable.class); private HttpClient httpClient; private HttpLogOptions httpLogOptions; private final List<HttpPipelinePolicy> policies = new ArrayList<>(); private RetryPolicy retryPolicy; private Duration defaultPollInterval; private Configurable() { }
static Configurable function() { return new MariaDBManager.Configurable(); } public static final class Configurable { private final ClientLogger logger = new ClientLogger(Configurable.class); private HttpClient httpClient; private HttpLogOptions httpLogOptions; private final List<HttpPipelinePolicy> policies = new ArrayList<>(); private RetryPolicy retryPolicy; private Duration defaultPollInterval; private Configurable() { }
/** * Gets a Configurable instance that can be used to create MariaDBManager with optional configuration. * * @return the Configurable instance allowing configurations. */
Gets a Configurable instance that can be used to create MariaDBManager with optional configuration
configure
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/MariaDBManager.java", "license": "mit", "size": 21939 }
[ "com.azure.core.http.HttpClient", "com.azure.core.http.policy.HttpLogOptions", "com.azure.core.http.policy.HttpPipelinePolicy", "com.azure.core.http.policy.RetryPolicy", "com.azure.core.util.logging.ClientLogger", "java.time.Duration", "java.util.ArrayList", "java.util.List" ]
import com.azure.core.http.HttpClient; import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.util.logging.ClientLogger; import java.time.Duration; import java.util.ArrayList; import java.util.List;
import com.azure.core.http.*; import com.azure.core.http.policy.*; import com.azure.core.util.logging.*; import java.time.*; import java.util.*;
[ "com.azure.core", "java.time", "java.util" ]
com.azure.core; java.time; java.util;
1,537,434
EList<BindingAttribute> getContainsBindingAttribute();
EList<BindingAttribute> getContainsBindingAttribute();
/** * Returns the value of the '<em><b>Contains Binding Attribute</b></em>' containment reference list. * The list contents are of type {@link workflow_bdsl.BindingAttribute}. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Contains Binding Attribute</em>' containment reference list isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Contains Binding Attribute</em>' containment reference list. * @see workflow_bdsl.Workflow_bdslPackage#getFlowDiagram_ContainsBindingAttribute() * @model containment="true" * @generated */
Returns the value of the 'Contains Binding Attribute' containment reference list. The list contents are of type <code>workflow_bdsl.BindingAttribute</code>. If the meaning of the 'Contains Binding Attribute' containment reference list isn't clear, there really should be more of a description here...
getContainsBindingAttribute
{ "repo_name": "jesusc/bento", "path": "tests/test-outputs/bento.sirius.tests.metamodels.output/src/workflow_bdsl/FlowDiagram.java", "license": "epl-1.0", "size": 8501 }
[ "org.eclipse.emf.common.util.EList" ]
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,133,832
private long when(String dateString) { if (dateString == null) { return 0L; } Date date = ClockScan.GetDate(dateString, null, null); if (date != null) { return date.getTime(); } else { return 0L; } } static class Pair implements Comparable<Pair> { public long time; public double value; public Pair(long time, double value) { this.time = time; this.value = value; }
long function(String dateString) { if (dateString == null) { return 0L; } Date date = ClockScan.GetDate(dateString, null, null); if (date != null) { return date.getTime(); } else { return 0L; } } static class Pair implements Comparable<Pair> { public long time; public double value; public Pair(long time, double value) { this.time = time; this.value = value; }
/** * Turn a date string into ms since epoch timestamp. * @param dateString Something that looks like a date and or time * @return 0 if invalid date */
Turn a date string into ms since epoch timestamp
when
{ "repo_name": "thinkingcow/brazil-on-appengine", "path": "src/sunlabs/brazil/appengine/ChartHelperTemplate.java", "license": "apache-2.0", "size": 5486 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
295,779
public ResponseAnswer setMultiselectResponse(BigDecimal questionId, BigDecimal val) { ResponseAnswer resAnswer = getResponseAnswer(questionId); if (resAnswer != null) { if (val.compareTo(BigDecimal.ONE) == 1) { resAnswer.setValue(questionId); return resAnswer; } else { response.getResponseAnswers().remove(resAnswer); return null; } } else { ResponseAnswer responseAnswer = getNewResponseAnswer(); responseAnswer.setQuestionLabelId(questionId); responseAnswer.setValue(questionId); responseAnswer.setAt(System.currentTimeMillis()); response.getResponseAnswers().add(responseAnswer); return responseAnswer; } }
ResponseAnswer function(BigDecimal questionId, BigDecimal val) { ResponseAnswer resAnswer = getResponseAnswer(questionId); if (resAnswer != null) { if (val.compareTo(BigDecimal.ONE) == 1) { resAnswer.setValue(questionId); return resAnswer; } else { response.getResponseAnswers().remove(resAnswer); return null; } } else { ResponseAnswer responseAnswer = getNewResponseAnswer(); responseAnswer.setQuestionLabelId(questionId); responseAnswer.setValue(questionId); responseAnswer.setAt(System.currentTimeMillis()); response.getResponseAnswers().add(responseAnswer); return responseAnswer; } }
/** * Set multiple choice response answer * * @param questionId question ID * @param val value * @return response answer */
Set multiple choice response answer
setMultiselectResponse
{ "repo_name": "Loyagram/campaign-sdk", "path": "campaignsdk/src/main/java/com/loyagram/android/campaignsdk/ui/LoyagramSurveyView.java", "license": "apache-2.0", "size": 20149 }
[ "com.loyagram.android.campaignsdk.models.ResponseAnswer", "java.math.BigDecimal" ]
import com.loyagram.android.campaignsdk.models.ResponseAnswer; import java.math.BigDecimal;
import com.loyagram.android.campaignsdk.models.*; import java.math.*;
[ "com.loyagram.android", "java.math" ]
com.loyagram.android; java.math;
100,028
private void init(DataView view, boolean writeAllowed, CursorConfig config, KeyRange range) throws DatabaseException { if (config == null) { config = view.cursorConfig; } this.view = view; this.writeAllowed = writeAllowed && view.writeAllowed; this.range = (range != null) ? range : view.range; readUncommitted = config.getReadUncommitted() || view.currentTxn.isReadUncommitted(); initThangs(); if (joinCursor == null) { cursor = new MyRangeCursor (this.range, config, view, this.writeAllowed); } }
void function(DataView view, boolean writeAllowed, CursorConfig config, KeyRange range) throws DatabaseException { if (config == null) { config = view.cursorConfig; } this.view = view; this.writeAllowed = writeAllowed && view.writeAllowed; this.range = (range != null) ? range : view.range; readUncommitted = config.getReadUncommitted() view.currentTxn.isReadUncommitted(); initThangs(); if (joinCursor == null) { cursor = new MyRangeCursor (this.range, config, view, this.writeAllowed); } }
/** * Constructor helper. */
Constructor helper
init
{ "repo_name": "nologic/nabs", "path": "client/trunk/shared/libraries/je-3.2.44/src/com/sleepycat/collections/DataCursor.java", "license": "gpl-2.0", "size": 28081 }
[ "com.sleepycat.je.CursorConfig", "com.sleepycat.je.DatabaseException", "com.sleepycat.util.keyrange.KeyRange" ]
import com.sleepycat.je.CursorConfig; import com.sleepycat.je.DatabaseException; import com.sleepycat.util.keyrange.KeyRange;
import com.sleepycat.je.*; import com.sleepycat.util.keyrange.*;
[ "com.sleepycat.je", "com.sleepycat.util" ]
com.sleepycat.je; com.sleepycat.util;
2,047,890
public BigDecimal getQty () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Qty); if (bd == null) return Env.ZERO; return bd; }
BigDecimal function () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Qty); if (bd == null) return Env.ZERO; return bd; }
/** Get Quantity. @return Quantity */
Get Quantity
getQty
{ "repo_name": "sumairsh/adempiere", "path": "base/src/org/compiere/model/X_C_ProjectTask.java", "license": "gpl-2.0", "size": 9496 }
[ "java.math.BigDecimal", "org.compiere.util.Env" ]
import java.math.BigDecimal; import org.compiere.util.Env;
import java.math.*; import org.compiere.util.*;
[ "java.math", "org.compiere.util" ]
java.math; org.compiere.util;
1,813,714
public static void untilWithAction(Supplier<Boolean> condition, WaitingAction waitingAction) { WaitConfig from = WaitConfig.from(DEFAULT_CONFIGURATION); waiter.get().waitUntilWithAction(from, condition, waitingAction); }
static void function(Supplier<Boolean> condition, WaitingAction waitingAction) { WaitConfig from = WaitConfig.from(DEFAULT_CONFIGURATION); waiter.get().waitUntilWithAction(from, condition, waitingAction); }
/** * Executes a wait operation based on the default timeout configuration of {@link WaitConfig} and the given boolean * supplier. The wait is executed until either the supplier returns <code>true</code> or the timeout is reached. * Additionally executes a {@link WaitAction} configured by the given {@link WaitingAction}. * * @param condition the supplier for the wait until operation * @param waitingAction the configured condition and action to execute during waiting * @see Wait * @see WaitUntil * @see Waiter * @see WaitConfig * @see WaitingAction * @see WaitAction * @since 2.8 */
Executes a wait operation based on the default timeout configuration of <code>WaitConfig</code> and the given boolean supplier. The wait is executed until either the supplier returns <code>true</code> or the timeout is reached. Additionally executes a <code>WaitAction</code> configured by the given <code>WaitingAction</code>
untilWithAction
{ "repo_name": "testIT-WebTester/webtester2-core", "path": "webtester-core/src/main/java/info/novatec/testit/webtester/waiting/Wait.java", "license": "apache-2.0", "size": 6604 }
[ "java.util.function.Supplier" ]
import java.util.function.Supplier;
import java.util.function.*;
[ "java.util" ]
java.util;
49,330
Enumeration<FileSelector> selectorElements();
Enumeration<FileSelector> selectorElements();
/** * Returns an enumerator for accessing the set of selectors. * * @return an enumerator that goes through each of the selectors */
Returns an enumerator for accessing the set of selectors
selectorElements
{ "repo_name": "Mayo-WE01051879/mayosapp", "path": "Build/src/main/org/apache/tools/ant/types/selectors/SelectorContainer.java", "license": "mit", "size": 5182 }
[ "java.util.Enumeration" ]
import java.util.Enumeration;
import java.util.*;
[ "java.util" ]
java.util;
717,330
public Collection<Group> getPublicSharedGroups() { HashSet<String> groupNames = getPublicGroupsFromCache(); if (groupNames == null) { synchronized(PUBLIC_GROUPS) { groupNames = getPublicGroupsFromCache(); if (groupNames == null) { groupNames = new HashSet<>(provider.getPublicSharedGroupNames()); savePublicGroupsInCache(groupNames); } } } return new GroupCollection(groupNames); }
Collection<Group> function() { HashSet<String> groupNames = getPublicGroupsFromCache(); if (groupNames == null) { synchronized(PUBLIC_GROUPS) { groupNames = getPublicGroupsFromCache(); if (groupNames == null) { groupNames = new HashSet<>(provider.getPublicSharedGroupNames()); savePublicGroupsInCache(groupNames); } } } return new GroupCollection(groupNames); }
/** * Returns an unmodifiable Collection of all public shared groups in the system. * * @return an unmodifiable Collection of all shared groups. */
Returns an unmodifiable Collection of all public shared groups in the system
getPublicSharedGroups
{ "repo_name": "speedy01/Openfire", "path": "xmppserver/src/main/java/org/jivesoftware/openfire/group/GroupManager.java", "license": "apache-2.0", "size": 34829 }
[ "java.util.Collection", "java.util.HashSet" ]
import java.util.Collection; import java.util.HashSet;
import java.util.*;
[ "java.util" ]
java.util;
2,160,564
public void createCluster(com.google.bigtable.admin.v2.CreateClusterRequest request, io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver) { asyncUnaryCall( getChannel().newCall(METHOD_CREATE_CLUSTER, getCallOptions()), request, responseObserver); }
void function(com.google.bigtable.admin.v2.CreateClusterRequest request, io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver) { asyncUnaryCall( getChannel().newCall(METHOD_CREATE_CLUSTER, getCallOptions()), request, responseObserver); }
/** * <pre> * Creates a cluster within an instance. * </pre> */
<code> Creates a cluster within an instance. </code>
createCluster
{ "repo_name": "rameshdharan/cloud-bigtable-client", "path": "bigtable-client-core-parent/bigtable-protos/src/generated/java/services/com/google/bigtable/admin/v2/BigtableInstanceAdminGrpc.java", "license": "apache-2.0", "size": 34248 }
[ "io.grpc.stub.ClientCalls", "io.grpc.stub.ServerCalls" ]
import io.grpc.stub.ClientCalls; import io.grpc.stub.ServerCalls;
import io.grpc.stub.*;
[ "io.grpc.stub" ]
io.grpc.stub;
2,896,447
protected boolean parseArguments() { m_argExpression = new TreeMap<String, String>(); int count = 0; for (TableItem item : m_viewer.getTable().getItems()) { count++; String arg = item.getText(1); String val = item.getText(2); if (arg.trim().isEmpty() || val.trim().isEmpty()) { MessageDialog.openError(getShell(), "Malformed arguments", "Argument " + count + " is incomplete"); m_argExpression = null; return false; } m_argExpression.put(arg, val); } return true; }
boolean function() { m_argExpression = new TreeMap<String, String>(); int count = 0; for (TableItem item : m_viewer.getTable().getItems()) { count++; String arg = item.getText(1); String val = item.getText(2); if (arg.trim().isEmpty() val.trim().isEmpty()) { MessageDialog.openError(getShell(), STR, STR + count + STR); m_argExpression = null; return false; } m_argExpression.put(arg, val); } return true; }
/*************************************************************************** * Process given arguments **************************************************************************/
Process given arguments
parseArguments
{ "repo_name": "Spacecraft-Code/SPELL", "path": "src/spel-gui/com.astra.ses.spell.gui/src/com/astra/ses/spell/gui/dialogs/StartWithParametersDialog.java", "license": "lgpl-3.0", "size": 15574 }
[ "java.util.TreeMap", "org.eclipse.jface.dialogs.MessageDialog", "org.eclipse.swt.widgets.TableItem" ]
import java.util.TreeMap; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.swt.widgets.TableItem;
import java.util.*; import org.eclipse.jface.dialogs.*; import org.eclipse.swt.widgets.*;
[ "java.util", "org.eclipse.jface", "org.eclipse.swt" ]
java.util; org.eclipse.jface; org.eclipse.swt;
1,186,992
public static GroupManagerHeartbeatHandler newGroupManagerHeartbeatHandler(NetworkAddress heartbeatAddress, String groupManagerId, int timeout, LocalControllerBackend backend) throws Exception { return new GroupManagerHeartbeatHandler(heartbeatAddress, groupManagerId, timeout, backend); }
static GroupManagerHeartbeatHandler function(NetworkAddress heartbeatAddress, String groupManagerId, int timeout, LocalControllerBackend backend) throws Exception { return new GroupManagerHeartbeatHandler(heartbeatAddress, groupManagerId, timeout, backend); }
/** * Creates a new group manager heartbeat handler. * * @param heartbeatAddress The heartbeat address * @param groupManagerId The groupManagerId * @param timeout The timeout * @param backend The local controller backend * @return The group manager heartbeat handler * @throws Exception The exception */
Creates a new group manager heartbeat handler
newGroupManagerHeartbeatHandler
{ "repo_name": "snoozesoftware/snoozenode", "path": "src/main/java/org/inria/myriads/snoozenode/heartbeat/HeartbeatFactory.java", "license": "gpl-2.0", "size": 5160 }
[ "org.inria.myriads.snoozecommon.communication.NetworkAddress", "org.inria.myriads.snoozenode.heartbeat.handler.GroupManagerHeartbeatHandler", "org.inria.myriads.snoozenode.localcontroller.LocalControllerBackend" ]
import org.inria.myriads.snoozecommon.communication.NetworkAddress; import org.inria.myriads.snoozenode.heartbeat.handler.GroupManagerHeartbeatHandler; import org.inria.myriads.snoozenode.localcontroller.LocalControllerBackend;
import org.inria.myriads.snoozecommon.communication.*; import org.inria.myriads.snoozenode.heartbeat.handler.*; import org.inria.myriads.snoozenode.localcontroller.*;
[ "org.inria.myriads" ]
org.inria.myriads;
2,498,918
@SuppressWarnings("null") @Override public boolean equals(@Nullable Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Connection other = (Connection) obj; if (!inputName.equals(other.inputName)) { return false; } if (outputModuleId == null) { if (other.outputModuleId != null) { return false; } } else if (!outputModuleId.equals(other.outputModuleId)) { return false; } if (outputName == null) { if (other.outputName != null) { return false; } } else if (!outputName.equals(other.outputName)) { return false; } if (reference == null) { if (other.reference != null) { return false; } } else if (!reference.equals(other.reference)) { return false; } return true; }
@SuppressWarnings("null") boolean function(@Nullable Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Connection other = (Connection) obj; if (!inputName.equals(other.inputName)) { return false; } if (outputModuleId == null) { if (other.outputModuleId != null) { return false; } } else if (!outputModuleId.equals(other.outputModuleId)) { return false; } if (outputName == null) { if (other.outputName != null) { return false; } } else if (!outputName.equals(other.outputName)) { return false; } if (reference == null) { if (other.reference != null) { return false; } } else if (!reference.equals(other.reference)) { return false; } return true; }
/** * Compares two connection objects. Two connections are equal if they own equal {@code inputName}, * {@code outputModuleId}, {@code outputName} and {@code reference}. * * @return {@code true} when own equal {@code inputName}, {@code outputModuleId}, {@code outputName} and * {@code reference} and {@code false} in the opposite. */
Compares two connection objects. Two connections are equal if they own equal inputName, outputModuleId, outputName and reference
equals
{ "repo_name": "Snickermicker/smarthome", "path": "bundles/automation/org.eclipse.smarthome.automation.core/src/main/java/org/eclipse/smarthome/automation/core/internal/Connection.java", "license": "epl-1.0", "size": 6170 }
[ "org.eclipse.jdt.annotation.Nullable" ]
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.jdt.annotation.*;
[ "org.eclipse.jdt" ]
org.eclipse.jdt;
1,517,843
public Map<Integer, List<Encounter>> getAllEncounters(Cohort patients);
Map<Integer, List<Encounter>> function(Cohort patients);
/** * Get all encounters for a cohort of patients * * @param patients Cohort of patients to search * @return Map of all encounters for specified patients. * @should get all encounters for a cohort of patients * @since 1.8 */
Get all encounters for a cohort of patients
getAllEncounters
{ "repo_name": "Bhamni/openmrs-core", "path": "api/src/main/java/org/openmrs/api/EncounterService.java", "license": "mpl-2.0", "size": 36306 }
[ "java.util.List", "java.util.Map", "org.openmrs.Cohort", "org.openmrs.Encounter" ]
import java.util.List; import java.util.Map; import org.openmrs.Cohort; import org.openmrs.Encounter;
import java.util.*; import org.openmrs.*;
[ "java.util", "org.openmrs" ]
java.util; org.openmrs;
1,668,426
public JsonStaxPrinter array(final double[] array) throws IOException { if (closed) { throw new IOException("Attempt to write into closed printer"); } else if (pseudoStackState[pseudoStackFill] != VALUE_AWAITING) { throw new IOException("Output structure failure: value is not awaiting here"); } else { if (array == null) { return nullValue(); } else { startArray(); for (int index = 0, maxIndex = array.length; index < maxIndex; index++) { if (index > 0) { splitter(); } value(array[index]); } endArray(); pseudoStackState[pseudoStackFill] = SPLITTER_AWAITING; return this; } } }
JsonStaxPrinter function(final double[] array) throws IOException { if (closed) { throw new IOException(STR); } else if (pseudoStackState[pseudoStackFill] != VALUE_AWAITING) { throw new IOException(STR); } else { if (array == null) { return nullValue(); } else { startArray(); for (int index = 0, maxIndex = array.length; index < maxIndex; index++) { if (index > 0) { splitter(); } value(array[index]); } endArray(); pseudoStackState[pseudoStackFill] = SPLITTER_AWAITING; return this; } } }
/** * <p>Print array of double</p> * @param array array to print * @return self * @throws IOException on any I/O errors */
Print array of double
array
{ "repo_name": "chav1961/purelib", "path": "src/main/java/chav1961/purelib/streams/JsonStaxPrinter.java", "license": "mit", "size": 26295 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,324,990
public static TableName getQualifiedTableName(ASTNode tabNameNode) throws SemanticException { // Ideally this would be removed, once the catalog is accessible in all use cases return getQualifiedTableName(tabNameNode, null); }
static TableName function(ASTNode tabNameNode) throws SemanticException { return getQualifiedTableName(tabNameNode, null); }
/** * Get the name reference of a DB table node. * @param tabNameNode * @return a {@link TableName}, not null. The catalog will be missing from this. * @throws SemanticException */
Get the name reference of a DB table node
getQualifiedTableName
{ "repo_name": "nishantmonu51/hive", "path": "ql/src/java/org/apache/hadoop/hive/ql/parse/BaseSemanticAnalyzer.java", "license": "apache-2.0", "size": 68519 }
[ "org.apache.hadoop.hive.common.TableName" ]
import org.apache.hadoop.hive.common.TableName;
import org.apache.hadoop.hive.common.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
2,546,409
protected FileObject getReadFolder() { return readFolder; }
FileObject function() { return readFolder; }
/** * Returns the read test folder. */
Returns the read test folder
getReadFolder
{ "repo_name": "easel/commons-vfs", "path": "core/src/test/java/org/apache/commons/vfs2/test/AbstractProviderTestCase.java", "license": "apache-2.0", "size": 12979 }
[ "org.apache.commons.vfs2.FileObject" ]
import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.*;
[ "org.apache.commons" ]
org.apache.commons;
2,634,068
private boolean matchContext(String context) { if (ObjectHelper.isNotEmpty(context)) { if (!camelContext.getName().equals(context)) { return false; } } return true; }
boolean function(String context) { if (ObjectHelper.isNotEmpty(context)) { if (!camelContext.getName().equals(context)) { return false; } } return true; }
/** * Does the given context match this camel context */
Does the given context match this camel context
matchContext
{ "repo_name": "engagepoint/camel", "path": "camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java", "license": "apache-2.0", "size": 30659 }
[ "org.apache.camel.util.ObjectHelper" ]
import org.apache.camel.util.ObjectHelper;
import org.apache.camel.util.*;
[ "org.apache.camel" ]
org.apache.camel;
176,108
public void refreshResourceTable() { resourceTable.removeAll(); for (Map.Entry<String, MockServiceResource> resource : resourceHolder.getMockResources().entrySet()) { TableItem item = new TableItem(resourceTable, SWT.NONE); String subContext = resource.getValue().getSubContext(); String enteredUrl = "http://localhost:" + getServicePort() + getServiceContext() + subContext; item.setText(0, enteredUrl); item.setText(1, subContext); item.setText(2, resource.getValue().getMethod()); } }
void function() { resourceTable.removeAll(); for (Map.Entry<String, MockServiceResource> resource : resourceHolder.getMockResources().entrySet()) { TableItem item = new TableItem(resourceTable, SWT.NONE); String subContext = resource.getValue().getSubContext(); String enteredUrl = "http: item.setText(0, enteredUrl); item.setText(1, subContext); item.setText(2, resource.getValue().getMethod()); } }
/** * Method of refreshing mock resources table. */
Method of refreshing mock resources table
refreshResourceTable
{ "repo_name": "prabushi/devstudio-tooling-esb", "path": "plugins/org.wso2.developerstudio.esb.form.editors/src/org/wso2/developerstudio/esb/form/editors/mockservice/MockServiceFormPage.java", "license": "apache-2.0", "size": 17126 }
[ "java.util.Map", "org.eclipse.swt.widgets.TableItem", "org.wso2.developerstudio.eclipse.esb.synapse.unit.test.model.MockServiceResource" ]
import java.util.Map; import org.eclipse.swt.widgets.TableItem; import org.wso2.developerstudio.eclipse.esb.synapse.unit.test.model.MockServiceResource;
import java.util.*; import org.eclipse.swt.widgets.*; import org.wso2.developerstudio.eclipse.esb.synapse.unit.test.model.*;
[ "java.util", "org.eclipse.swt", "org.wso2.developerstudio" ]
java.util; org.eclipse.swt; org.wso2.developerstudio;
993,222
protected boolean deriveProcessEnvironment(HttpServletRequest req) { Hashtable envp = new Hashtable(); command = getCommand(); if (command != null) { workingDirectory = new File(command.substring(0, command.lastIndexOf(File.separator))); envp.put("X_TOMCAT_COMMAND_PATH", command); //for kicks } this.env = envp; return true; }
boolean function(HttpServletRequest req) { Hashtable envp = new Hashtable(); command = getCommand(); if (command != null) { workingDirectory = new File(command.substring(0, command.lastIndexOf(File.separator))); envp.put(STR, command); } this.env = envp; return true; }
/** * Constructs the Process environment to be supplied to the invoked * process. Defines an environment no environment variables. * <p> * Should be overriden by subclasses to perform useful setup. * </p> * * @param HttpServletRequest request associated with the * Process' invocation * @return true if environment was set OK, false if there was a problem * and no environment was set */
Constructs the Process environment to be supplied to the invoked process. Defines an environment no environment variables. Should be overriden by subclasses to perform useful setup.
deriveProcessEnvironment
{ "repo_name": "c-rainstorm/jerrydog", "path": "src/main/java/org/apache/catalina/util/ProcessEnvironment.java", "license": "gpl-3.0", "size": 12024 }
[ "java.io.File", "java.util.Hashtable", "javax.servlet.http.HttpServletRequest" ]
import java.io.File; import java.util.Hashtable; import javax.servlet.http.HttpServletRequest;
import java.io.*; import java.util.*; import javax.servlet.http.*;
[ "java.io", "java.util", "javax.servlet" ]
java.io; java.util; javax.servlet;
2,140,721
MidiMessage message = event.getMessage(); if (message instanceof ShortMessage) { int command = ((ShortMessage) message).getCommand(); switch (command) { case ShortMessage.NOTE_ON: noteOn++; break; case ShortMessage.NOTE_OFF: noteOff++; break; default: other++; } } else { other++; } }
MidiMessage message = event.getMessage(); if (message instanceof ShortMessage) { int command = ((ShortMessage) message).getCommand(); switch (command) { case ShortMessage.NOTE_ON: noteOn++; break; case ShortMessage.NOTE_OFF: noteOff++; break; default: other++; } } else { other++; } }
/** * Performs the counting. * @param event The MidiEvent to count. */
Performs the counting
count
{ "repo_name": "bitzl/sound-of-geocities", "path": "src/main/java/com/bitzl/soundofgeocities/processing/counting/MidiEventCount.java", "license": "apache-2.0", "size": 1632 }
[ "javax.sound.midi.MidiMessage", "javax.sound.midi.ShortMessage" ]
import javax.sound.midi.MidiMessage; import javax.sound.midi.ShortMessage;
import javax.sound.midi.*;
[ "javax.sound" ]
javax.sound;
2,160,457
private static int[] partition(int n, long... v) { LOGGER.fine("Partition " + Arrays.toString(v) + " into " + n + " slices."); assert n <= v.length; // Going to return n ints. int[] ret = new int[n]; // Determine the ideal size of each partition. double ideal = 0; for (long l: v) ideal += l; ideal /= n; // Measure off a slice until it's larger than the ideal size, // then either use the slice or the previous one, whichever has // the smallest error. Only do the first n-1 slices, the last // one gets the remainder, whatever that is. int pos = 0; for (int i = 0; i < n - 1; i++) { ret[i] = pos; long total = 0, prev = 0; do { prev = total; total += v[pos++]; } while (pos < v.length && total < ideal); if (Math.abs(prev - ideal) < Math.abs(total - ideal)) { total = prev; --pos; } } ret[n - 1] = Math.min(pos, v.length - 1); // Done. return ret; }
static int[] function(int n, long... v) { LOGGER.fine(STR + Arrays.toString(v) + STR + n + STR); assert n <= v.length; int[] ret = new int[n]; double ideal = 0; for (long l: v) ideal += l; ideal /= n; int pos = 0; for (int i = 0; i < n - 1; i++) { ret[i] = pos; long total = 0, prev = 0; do { prev = total; total += v[pos++]; } while (pos < v.length && total < ideal); if (Math.abs(prev - ideal) < Math.abs(total - ideal)) { total = prev; --pos; } } ret[n - 1] = Math.min(pos, v.length - 1); return ret; }
/** * Partition v[] into n contiguous slices, keeping the values as * close to equal as possible. I can't prove that this is correct, * but it's fast and seems pretty close. */
Partition v[] into n contiguous slices, keeping the values as close to equal as possible. I can't prove that this is correct, but it's fast and seems pretty close
partition
{ "repo_name": "arturog8m/ocs", "path": "bundle/edu.gemini.qpt.client/src/main/java/edu/gemini/qpt/ui/action/SplitAction.java", "license": "bsd-3-clause", "size": 5896 }
[ "java.util.Arrays" ]
import java.util.Arrays;
import java.util.*;
[ "java.util" ]
java.util;
553,093
EventQueue.invokeLater(new Runnable() {
EventQueue.invokeLater(new Runnable() {
/** * Launch the application. */
Launch the application
main
{ "repo_name": "HechengLi/Filerenamer", "path": "src/FileRenamerUI.java", "license": "epl-1.0", "size": 7964 }
[ "java.awt.EventQueue" ]
import java.awt.EventQueue;
import java.awt.*;
[ "java.awt" ]
java.awt;
980,666
public RestResponse<Job> loadAnnotationSets(String variableSetId, String path, TsvAnnotationParams data, ObjectMap params) throws ClientException { params = params != null ? params : new ObjectMap(); params.putIfNotNull("variableSetId", variableSetId); params.putIfNotNull("path", path); params.put("body", data); return execute("cohorts", null, "annotationSets", null, "load", params, POST, Job.class); }
RestResponse<Job> function(String variableSetId, String path, TsvAnnotationParams data, ObjectMap params) throws ClientException { params = params != null ? params : new ObjectMap(); params.putIfNotNull(STR, variableSetId); params.putIfNotNull("path", path); params.put("body", data); return execute(STR, null, STR, null, "load", params, POST, Job.class); }
/** * Load annotation sets from a TSV file. * @param variableSetId Variable set id or name. * @param path Path where the TSV file is located in OpenCGA or where it should be located. * @param data JSON containing the 'content' of the TSV file if this has not yet been registered into OpenCGA. * @param params Map containing any of the following optional parameters. * study: Study [[user@]project:]study where study and project can be either the ID or UUID. * parents: Flag indicating whether to create parent directories if they don't exist (only when TSV file was not previously * associated). * annotationSetId: Annotation set id. If not provided, variableSetId will be used. * @return a RestResponse object. * @throws ClientException ClientException if there is any server error. */
Load annotation sets from a TSV file
loadAnnotationSets
{ "repo_name": "j-coll/opencga", "path": "opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/CohortClient.java", "license": "apache-2.0", "size": 13256 }
[ "org.opencb.commons.datastore.core.ObjectMap", "org.opencb.opencga.client.exceptions.ClientException", "org.opencb.opencga.core.models.common.TsvAnnotationParams", "org.opencb.opencga.core.models.job.Job", "org.opencb.opencga.core.response.RestResponse" ]
import org.opencb.commons.datastore.core.ObjectMap; import org.opencb.opencga.client.exceptions.ClientException; import org.opencb.opencga.core.models.common.TsvAnnotationParams; import org.opencb.opencga.core.models.job.Job; import org.opencb.opencga.core.response.RestResponse;
import org.opencb.commons.datastore.core.*; import org.opencb.opencga.client.exceptions.*; import org.opencb.opencga.core.models.common.*; import org.opencb.opencga.core.models.job.*; import org.opencb.opencga.core.response.*;
[ "org.opencb.commons", "org.opencb.opencga" ]
org.opencb.commons; org.opencb.opencga;
1,879,058
public int getCurrentItemShowing() { if (mCurrentItemShowing != HOUR_INDEX && mCurrentItemShowing != MINUTE_INDEX) { Log.e(TAG, "Current item showing was unfortunately set to "+mCurrentItemShowing); return -1; } return mCurrentItemShowing; }
int function() { if (mCurrentItemShowing != HOUR_INDEX && mCurrentItemShowing != MINUTE_INDEX) { Log.e(TAG, STR+mCurrentItemShowing); return -1; } return mCurrentItemShowing; }
/** * Get the item (hours or minutes) that is currently showing. */
Get the item (hours or minutes) that is currently showing
getCurrentItemShowing
{ "repo_name": "indashnet/InDashNet.Open.UN2000", "path": "android/frameworks/opt/datetimepicker/src/com/android/datetimepicker/time/RadialPickerLayout.java", "license": "apache-2.0", "size": 35246 }
[ "android.util.Log" ]
import android.util.Log;
import android.util.*;
[ "android.util" ]
android.util;
211,164
public int getPartColIndexForFilter( Table table, FilterBuilder filterBuilder) throws MetaException { int partitionColumnIndex; assert (table.getPartitionKeys().size() > 0); for (partitionColumnIndex = 0; partitionColumnIndex < table.getPartitionKeys().size(); ++partitionColumnIndex) { if (table.getPartitionKeys().get(partitionColumnIndex).getName(). equalsIgnoreCase(keyName)) { break; } } if( partitionColumnIndex == table.getPartitionKeys().size()) { filterBuilder.setError("Specified key <" + keyName + "> is not a partitioning key for the table"); return -1; } return partitionColumnIndex; }
int function( Table table, FilterBuilder filterBuilder) throws MetaException { int partitionColumnIndex; assert (table.getPartitionKeys().size() > 0); for (partitionColumnIndex = 0; partitionColumnIndex < table.getPartitionKeys().size(); ++partitionColumnIndex) { if (table.getPartitionKeys().get(partitionColumnIndex).getName(). equalsIgnoreCase(keyName)) { break; } } if( partitionColumnIndex == table.getPartitionKeys().size()) { filterBuilder.setError(STR + keyName + STR); return -1; } return partitionColumnIndex; }
/** * Get partition column index in the table partition column list that * corresponds to the key that is being filtered on by this tree node. * @param table The table. * @param filterBuilder filter builder used to report error, if any. * @return The index. */
Get partition column index in the table partition column list that corresponds to the key that is being filtered on by this tree node
getPartColIndexForFilter
{ "repo_name": "mapr/impala", "path": "thirdparty/hive-0.12.0-cdh5.1.2/src/metastore/src/java/org/apache/hadoop/hive/metastore/parser/ExpressionTree.java", "license": "apache-2.0", "size": 21451 }
[ "org.apache.hadoop.hive.metastore.api.MetaException", "org.apache.hadoop.hive.metastore.api.Table" ]
import org.apache.hadoop.hive.metastore.api.MetaException; import org.apache.hadoop.hive.metastore.api.Table;
import org.apache.hadoop.hive.metastore.api.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
934,095
public static String discoverClassname(byte[] classbytes) { ClassReader cr = new ClassReader(classbytes); ClassnameDiscoveryVisitor v = new ClassnameDiscoveryVisitor(); cr.accept(v, 0); return v.classname; } private static boolean checkedForNewProxyGenerateMethod = false; private static Method newProxyGenerateMethod;
static String function(byte[] classbytes) { ClassReader cr = new ClassReader(classbytes); ClassnameDiscoveryVisitor v = new ClassnameDiscoveryVisitor(); cr.accept(v, 0); return v.classname; } private static boolean checkedForNewProxyGenerateMethod = false; private static Method newProxyGenerateMethod;
/** * Discover the classname specified in the supplied bytecode and return it. * * @param classbytes the bytecode for the class * @return the classname recovered from the bytecode */
Discover the classname specified in the supplied bytecode and return it
discoverClassname
{ "repo_name": "spring-projects/spring-loaded", "path": "springloaded/src/main/java/org/springsource/loaded/Utils.java", "license": "apache-2.0", "size": 60704 }
[ "java.lang.reflect.Method", "org.objectweb.asm.ClassReader" ]
import java.lang.reflect.Method; import org.objectweb.asm.ClassReader;
import java.lang.reflect.*; import org.objectweb.asm.*;
[ "java.lang", "org.objectweb.asm" ]
java.lang; org.objectweb.asm;
1,030,889
@Override public Set<PredicateArgumentStructure<I, S>> getPredicateArgumentStructures() throws PredicateArgumentIdentificationException { if (null == predicateArgumentStructures) throw new PredicateArgumentIdentificationException("build() was not called."); return predicateArgumentStructures; } ///////////// PRIVATE /////////////
Set<PredicateArgumentStructure<I, S>> function() throws PredicateArgumentIdentificationException { if (null == predicateArgumentStructures) throw new PredicateArgumentIdentificationException(STR); return predicateArgumentStructures; }
/** * Returns all the predicate argument structures that have been found by {@link #build()}. */
Returns all the predicate argument structures that have been found by <code>#build()</code>
getPredicateArgumentStructures
{ "repo_name": "madhumita-git/Excitement-Open-Platform", "path": "lap/src/main/java/eu/excitementproject/eop/lap/biu/en/pasta/stanforddependencies/easyfirst/EasyFirstPredicateArgumentStructureBuilder.java", "license": "gpl-3.0", "size": 7612 }
[ "eu.excitementproject.eop.common.representation.pasta.PredicateArgumentStructure", "eu.excitementproject.eop.lap.biu.pasta.identification.PredicateArgumentIdentificationException", "java.util.Set" ]
import eu.excitementproject.eop.common.representation.pasta.PredicateArgumentStructure; import eu.excitementproject.eop.lap.biu.pasta.identification.PredicateArgumentIdentificationException; import java.util.Set;
import eu.excitementproject.eop.common.representation.pasta.*; import eu.excitementproject.eop.lap.biu.pasta.identification.*; import java.util.*;
[ "eu.excitementproject.eop", "java.util" ]
eu.excitementproject.eop; java.util;
2,812,543
private void copyFittedParams(int index, double[] params, int peakOffset) { final float[] fittedParams = fittedNeighbours[index].params; params[peakOffset + Gaussian2DFunction.SIGNAL] = fittedParams[Gaussian2DFunction.SIGNAL]; params[peakOffset + Gaussian2DFunction.X_POSITION] = fittedParams[Gaussian2DFunction.X_POSITION]; params[peakOffset + Gaussian2DFunction.Y_POSITION] = fittedParams[Gaussian2DFunction.Y_POSITION]; params[peakOffset + Gaussian2DFunction.Z_POSITION] = fittedParams[Gaussian2DFunction.Z_POSITION]; // Reset the width params if using an astigmatism z-model if (fitConfig.getAstigmatismZModel() != null) { params[peakOffset + Gaussian2DFunction.X_SD] = xsd; params[peakOffset + Gaussian2DFunction.Y_SD] = ysd; } else { params[peakOffset + Gaussian2DFunction.X_SD] = fittedParams[Gaussian2DFunction.X_SD]; params[peakOffset + Gaussian2DFunction.Y_SD] = fittedParams[Gaussian2DFunction.Y_SD]; } params[peakOffset + Gaussian2DFunction.ANGLE] = fittedParams[Gaussian2DFunction.ANGLE]; }
void function(int index, double[] params, int peakOffset) { final float[] fittedParams = fittedNeighbours[index].params; params[peakOffset + Gaussian2DFunction.SIGNAL] = fittedParams[Gaussian2DFunction.SIGNAL]; params[peakOffset + Gaussian2DFunction.X_POSITION] = fittedParams[Gaussian2DFunction.X_POSITION]; params[peakOffset + Gaussian2DFunction.Y_POSITION] = fittedParams[Gaussian2DFunction.Y_POSITION]; params[peakOffset + Gaussian2DFunction.Z_POSITION] = fittedParams[Gaussian2DFunction.Z_POSITION]; if (fitConfig.getAstigmatismZModel() != null) { params[peakOffset + Gaussian2DFunction.X_SD] = xsd; params[peakOffset + Gaussian2DFunction.Y_SD] = ysd; } else { params[peakOffset + Gaussian2DFunction.X_SD] = fittedParams[Gaussian2DFunction.X_SD]; params[peakOffset + Gaussian2DFunction.Y_SD] = fittedParams[Gaussian2DFunction.Y_SD]; } params[peakOffset + Gaussian2DFunction.ANGLE] = fittedParams[Gaussian2DFunction.ANGLE]; }
/** * Gets the parameters from the fitted neighbours at the specified index and copies them into * the provide parameters array at the specified offset. * * @param index the fitted neighbour index * @param params the output params * @param peakOffset the peak offset for the output parameters */
Gets the parameters from the fitted neighbours at the specified index and copies them into the provide parameters array at the specified offset
copyFittedParams
{ "repo_name": "aherbert/GDSC-SMLM", "path": "src/main/java/uk/ac/sussex/gdsc/smlm/engine/FitWorker.java", "license": "gpl-3.0", "size": 191121 }
[ "uk.ac.sussex.gdsc.smlm.function.gaussian.Gaussian2DFunction" ]
import uk.ac.sussex.gdsc.smlm.function.gaussian.Gaussian2DFunction;
import uk.ac.sussex.gdsc.smlm.function.gaussian.*;
[ "uk.ac.sussex" ]
uk.ac.sussex;
1,729,551
public int getPrecision(int column) throws SQLException { Field f = getField(column); // if (f.getMysqlType() == MysqlDefs.FIELD_TYPE_NEW_DECIMAL) { // return f.getLength(); // } if (isDecimalType(f.getSQLType())) { if (f.getDecimals() > 0) { return clampedGetLength(f) - 1 + f.getPrecisionAdjustFactor(); } return clampedGetLength(f) + f.getPrecisionAdjustFactor(); } switch (f.getMysqlType()) { case MysqlDefs.FIELD_TYPE_TINY_BLOB: case MysqlDefs.FIELD_TYPE_BLOB: case MysqlDefs.FIELD_TYPE_MEDIUM_BLOB: case MysqlDefs.FIELD_TYPE_LONG_BLOB: return clampedGetLength(f); // this may change in the future for now, the server only returns FIELD_TYPE_BLOB for _all_ BLOB types, but varying // lengths indicating the _maximum_ size for each BLOB type. default: return clampedGetLength(f) / f.getMaxBytesPerCharacter(); } }
int function(int column) throws SQLException { Field f = getField(column); if (isDecimalType(f.getSQLType())) { if (f.getDecimals() > 0) { return clampedGetLength(f) - 1 + f.getPrecisionAdjustFactor(); } return clampedGetLength(f) + f.getPrecisionAdjustFactor(); } switch (f.getMysqlType()) { case MysqlDefs.FIELD_TYPE_TINY_BLOB: case MysqlDefs.FIELD_TYPE_BLOB: case MysqlDefs.FIELD_TYPE_MEDIUM_BLOB: case MysqlDefs.FIELD_TYPE_LONG_BLOB: return clampedGetLength(f); default: return clampedGetLength(f) / f.getMaxBytesPerCharacter(); } }
/** * What is a column's number of decimal digits. * * @param column * the first column is 1, the second is 2... * * @return the precision * * @throws SQLException * if a database access error occurs */
What is a column's number of decimal digits
getPrecision
{ "repo_name": "scopej/mysql-connector-j", "path": "src/com/mysql/jdbc/ResultSetMetaData.java", "license": "gpl-2.0", "size": 24375 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
32,627
protected FSDataOutputStream getStream() { if (outStream == null) { throw new IllegalStateException("Output stream has not been opened"); } return outStream; }
FSDataOutputStream function() { if (outStream == null) { throw new IllegalStateException(STR); } return outStream; }
/** * Returns the current output stream, if the stream is open. */
Returns the current output stream, if the stream is open
getStream
{ "repo_name": "ueshin/apache-flink", "path": "flink-connectors/flink-connector-filesystem/src/main/java/org/apache/flink/streaming/connectors/fs/StreamWriterBase.java", "license": "apache-2.0", "size": 2770 }
[ "org.apache.hadoop.fs.FSDataOutputStream" ]
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
2,777,527
final BitBox bitbox = new WriteableBitBox(36).toBitBox(); final TenexDate td = new TenexDate(bitbox); assertEquals(0, td.getDayNumber()); assertEquals(0, td.getTimeNumber()); }
final BitBox bitbox = new WriteableBitBox(36).toBitBox(); final TenexDate td = new TenexDate(bitbox); assertEquals(0, td.getDayNumber()); assertEquals(0, td.getTimeNumber()); }
/** * Test the TenexDate constructor using the Tenex epoch. */
Test the TenexDate constructor using the Tenex epoch
constructor1
{ "repo_name": "BradNeuberg/hyperscope", "path": "augxml/src/test/org/nlsaugment/augxml/util/TestTenexDate.java", "license": "gpl-2.0", "size": 6463 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
171,582
JavaUtils.checkRegisterPermission(); algorithmsMap.put(id, algorithm); }
JavaUtils.checkRegisterPermission(); algorithmsMap.put(id, algorithm); }
/** * Method register * * @param id * @param algorithm * @throws SecurityException if a security manager is installed and the * caller does not have permission to register the JCE algorithm */
Method register
register
{ "repo_name": "JetBrains/jdk8u_jdk", "path": "src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/JCEMapper.java", "license": "gpl-2.0", "size": 12328 }
[ "com.sun.org.apache.xml.internal.security.utils.JavaUtils" ]
import com.sun.org.apache.xml.internal.security.utils.JavaUtils;
import com.sun.org.apache.xml.internal.security.utils.*;
[ "com.sun.org" ]
com.sun.org;
2,179,687
public static TypedProperties readBodyMap(ActiveMQBuffer message) { TypedProperties map = new TypedProperties(); readBodyMap(message, map); return map; }
static TypedProperties function(ActiveMQBuffer message) { TypedProperties map = new TypedProperties(); readBodyMap(message, map); return map; }
/** * Utility method to set the map on a message body */
Utility method to set the map on a message body
readBodyMap
{ "repo_name": "d0k1/activemq-artemis", "path": "artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/MapMessageUtil.java", "license": "apache-2.0", "size": 1731 }
[ "org.apache.activemq.artemis.api.core.ActiveMQBuffer", "org.apache.activemq.artemis.utils.TypedProperties" ]
import org.apache.activemq.artemis.api.core.ActiveMQBuffer; import org.apache.activemq.artemis.utils.TypedProperties;
import org.apache.activemq.artemis.api.core.*; import org.apache.activemq.artemis.utils.*;
[ "org.apache.activemq" ]
org.apache.activemq;
1,838,417
public static GlobalCycleOptions.Builder builder() { return new GlobalCycleOptions.Builder(); } private GlobalCycleOptions( boolean awaitAllMarketData, int numCycles, MarketDataSpecification marketDataSpec, ZonedDateTime valuationTime, Supplier<ZonedDateTime> valuationTimeSupplier) { JodaBeanUtils.notNull(awaitAllMarketData, "awaitAllMarketData"); JodaBeanUtils.notNull(marketDataSpec, "marketDataSpec"); this._awaitAllMarketData = awaitAllMarketData; this._numCycles = numCycles; this._marketDataSpec = marketDataSpec; this._valuationTime = valuationTime; this._valuationTimeSupplier = valuationTimeSupplier; validate(); }
static GlobalCycleOptions.Builder function() { return new GlobalCycleOptions.Builder(); } private GlobalCycleOptions( boolean awaitAllMarketData, int numCycles, MarketDataSpecification marketDataSpec, ZonedDateTime valuationTime, Supplier<ZonedDateTime> valuationTimeSupplier) { JodaBeanUtils.notNull(awaitAllMarketData, STR); JodaBeanUtils.notNull(marketDataSpec, STR); this._awaitAllMarketData = awaitAllMarketData; this._numCycles = numCycles; this._marketDataSpec = marketDataSpec; this._valuationTime = valuationTime; this._valuationTimeSupplier = valuationTimeSupplier; validate(); }
/** * Returns a builder used to create an instance of the bean. * @return the builder, not null */
Returns a builder used to create an instance of the bean
builder
{ "repo_name": "jeorme/OG-Platform", "path": "sesame/sesame-engine/src/main/java/com/opengamma/sesame/server/GlobalCycleOptions.java", "license": "apache-2.0", "size": 21749 }
[ "com.google.common.base.Supplier", "com.opengamma.engine.marketdata.spec.MarketDataSpecification", "org.joda.beans.JodaBeanUtils", "org.threeten.bp.ZonedDateTime" ]
import com.google.common.base.Supplier; import com.opengamma.engine.marketdata.spec.MarketDataSpecification; import org.joda.beans.JodaBeanUtils; import org.threeten.bp.ZonedDateTime;
import com.google.common.base.*; import com.opengamma.engine.marketdata.spec.*; import org.joda.beans.*; import org.threeten.bp.*;
[ "com.google.common", "com.opengamma.engine", "org.joda.beans", "org.threeten.bp" ]
com.google.common; com.opengamma.engine; org.joda.beans; org.threeten.bp;
2,846,452
void initialize(Map<String, Object> properties);
void initialize(Map<String, Object> properties);
/** * Initialize any configuration properties. */
Initialize any configuration properties
initialize
{ "repo_name": "BOTlibre/BOTlibre", "path": "micro-ai-engine/android/source/org/botlibre/api/avatar/Avatar.java", "license": "epl-1.0", "size": 1910 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,507,418
@Override public List<Limits> calculate(Number[] data) { List<Limits> result; result = new ArrayList<>(); result.add(new Limits(SPCUtils.stats_c(data, -1))); return result; }
List<Limits> function(Number[] data) { List<Limits> result; result = new ArrayList<>(); result.add(new Limits(SPCUtils.stats_c(data, -1))); return result; }
/** * Calculates the center/lower/upper limit. * * @param data the data to use for the calculation * @return the limits */
Calculates the center/lower/upper limit
calculate
{ "repo_name": "waikato-datamining/adams-base", "path": "adams-visualstats/src/main/java/adams/data/spc/CChart.java", "license": "gpl-3.0", "size": 3852 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,306,243
public static void writeString(DataOutputStream os, String str) throws IOException { if (str!=null) { os.writeInt(str.length()); os.writeChars(str); } else { os.writeInt(0); } }
static void function(DataOutputStream os, String str) throws IOException { if (str!=null) { os.writeInt(str.length()); os.writeChars(str); } else { os.writeInt(0); } }
/** * Writes string into DataOutputStream. First 4 octets tell string length * then each characger is written with 2 octets * @param os * @param str * @throws IOException */
Writes string into DataOutputStream. First 4 octets tell string length then each characger is written with 2 octets
writeString
{ "repo_name": "tuomount/JHeroes", "path": "src/org/jheroes/utilities/StreamUtilities.java", "license": "gpl-2.0", "size": 2227 }
[ "java.io.DataOutputStream", "java.io.IOException" ]
import java.io.DataOutputStream; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,626,765
public boolean addNewReference(Reference reference){ if(reference.index >= 0){ if(references.contains(reference)){ Logger.logln(NAME+"Cannot add duplicate references, addNewReference failed.",LogOut.STDERR); return false; } references.add(new Reference(reference.index,reference.value)); return true; } Logger.logln(NAME+"Cannot add Reference with 'index' less than zero",LogOut.STDERR); return false; }
boolean function(Reference reference){ if(reference.index >= 0){ if(references.contains(reference)){ Logger.logln(NAME+STR,LogOut.STDERR); return false; } references.add(new Reference(reference.index,reference.value)); return true; } Logger.logln(NAME+STR,LogOut.STDERR); return false; }
/** * Adds a Reference to the ArrayList of Reference objects, provided that the list does not already contain a Reference to the attribute that * is being referenced by the Reference reference, and that the input reference has an index (the attribute's index) greater than or equal to zero. * @param reference * @return */
Adds a Reference to the ArrayList of Reference objects, provided that the list does not already contain a Reference to the attribute that is being referenced by the Reference reference, and that the input reference has an index (the attribute's index) greater than or equal to zero
addNewReference
{ "repo_name": "jbdatko/pes", "path": "anonymouth/src/edu/drexel/psal/anonymouth/utils/SparseReferences.java", "license": "gpl-3.0", "size": 6840 }
[ "edu.drexel.psal.jstylo.generics.Logger" ]
import edu.drexel.psal.jstylo.generics.Logger;
import edu.drexel.psal.jstylo.generics.*;
[ "edu.drexel.psal" ]
edu.drexel.psal;
1,901,412
public List<JSONObject> process(String term, String query) throws IOException, SQLException { return process(term, query, 1); }
List<JSONObject> function(String term, String query) throws IOException, SQLException { return process(term, query, 1); }
/** * Process method is called to process a sparql query request * * @param term * is the concept term which is searched for * @param query * determines the type of query * @return * @throws IOException */
Process method is called to process a sparql query request
process
{ "repo_name": "kunalsen/cexplore", "path": "src/sw/proj/sparql/SparqlEvaluator.java", "license": "mit", "size": 12743 }
[ "java.io.IOException", "java.sql.SQLException", "java.util.List", "org.json.JSONObject" ]
import java.io.IOException; import java.sql.SQLException; import java.util.List; import org.json.JSONObject;
import java.io.*; import java.sql.*; import java.util.*; import org.json.*;
[ "java.io", "java.sql", "java.util", "org.json" ]
java.io; java.sql; java.util; org.json;
2,011,843
private int getColorForMeta(int metadata) { EnumDyeColor color = EnumDyeColor.byMetadata(metadata); int red = 0; int green = 0; int blue = 0; //RGB Values are from the item colors (Using Gimp) switch (color) { case WHITE: return 16777215; //Special value for white. Dunno case ORANGE: red = 244; green = 179; blue = 63; break; case MAGENTA: red = 219; green = 122; blue = 213; break; case LIGHT_BLUE: red = 130; green = 172; blue = 231; break; case YELLOW: red = 221; green = 231; blue = 39; break; case LIME: red = 131; green = 212; blue = 28; break; case PINK: red = 247; green = 180; blue = 214; break; case GRAY: red = 151; green = 151; blue = 151; break; case SILVER: red = 200; green = 200; blue = 200; break; case CYAN: red = 60; green = 142; blue = 176; break; case PURPLE: red = 164; green = 83; blue = 206; break; case BLUE: red = 10; green = 43; blue = 122; break; case BROWN: red = 112; green = 68; blue = 37; break; case GREEN: red = 74; green = 107; blue = 24; break; case RED: red = 190; green = 48; blue = 48; break; case BLACK: red = 28; green = 28; blue = 34; break; } return NumberHelper.rgbToInt(red, green, blue); }
int function(int metadata) { EnumDyeColor color = EnumDyeColor.byMetadata(metadata); int red = 0; int green = 0; int blue = 0; switch (color) { case WHITE: return 16777215; case ORANGE: red = 244; green = 179; blue = 63; break; case MAGENTA: red = 219; green = 122; blue = 213; break; case LIGHT_BLUE: red = 130; green = 172; blue = 231; break; case YELLOW: red = 221; green = 231; blue = 39; break; case LIME: red = 131; green = 212; blue = 28; break; case PINK: red = 247; green = 180; blue = 214; break; case GRAY: red = 151; green = 151; blue = 151; break; case SILVER: red = 200; green = 200; blue = 200; break; case CYAN: red = 60; green = 142; blue = 176; break; case PURPLE: red = 164; green = 83; blue = 206; break; case BLUE: red = 10; green = 43; blue = 122; break; case BROWN: red = 112; green = 68; blue = 37; break; case GREEN: red = 74; green = 107; blue = 24; break; case RED: red = 190; green = 48; blue = 48; break; case BLACK: red = 28; green = 28; blue = 34; break; } return NumberHelper.rgbToInt(red, green, blue); }
/** * Gets the right color for each brush * @param metadata * @return */
Gets the right color for each brush
getColorForMeta
{ "repo_name": "UniversalLP/Minimalistica", "path": "src/main/java/de/universallp/minimalistica/items/ItemPaintBrush.java", "license": "gpl-2.0", "size": 12683 }
[ "de.universallp.minimalistica.helper.NumberHelper", "net.minecraft.item.EnumDyeColor" ]
import de.universallp.minimalistica.helper.NumberHelper; import net.minecraft.item.EnumDyeColor;
import de.universallp.minimalistica.helper.*; import net.minecraft.item.*;
[ "de.universallp.minimalistica", "net.minecraft.item" ]
de.universallp.minimalistica; net.minecraft.item;
1,887,530
public static File currentPersistenceFile() { return persistenceFile.get().getFirst(); }
static File function() { return persistenceFile.get().getFirst(); }
/** * Get the file currently being saved by this thread. */
Get the file currently being saved by this thread
currentPersistenceFile
{ "repo_name": "GateNLP/gate-core", "path": "src/main/java/gate/util/persistence/PersistenceManager.java", "license": "lgpl-3.0", "size": 60975 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
426,193
public List<DefaultFileDatabase> getAllOrderByName(int startRecord, int numRecords) { return hbCrudDAO.getByQuery("getAllfileDatabasesNameAsc", startRecord, numRecords); }
List<DefaultFileDatabase> function(int startRecord, int numRecords) { return hbCrudDAO.getByQuery(STR, startRecord, numRecords); }
/** * Get all file databases starting at the start record and get up to * the numRecords - it will be ordered by name * * @param startRecord - the index to start at * @param numRecords - the number of records to get * @return the records found */
Get all file databases starting at the start record and get up to the numRecords - it will be ordered by name
getAllOrderByName
{ "repo_name": "nate-rcl/irplus", "path": "file_db_hibernate/src/edu/ur/hibernate/file/db/HbDefaultFileDatabaseDAO.java", "license": "apache-2.0", "size": 4717 }
[ "edu.ur.file.db.DefaultFileDatabase", "java.util.List" ]
import edu.ur.file.db.DefaultFileDatabase; import java.util.List;
import edu.ur.file.db.*; import java.util.*;
[ "edu.ur.file", "java.util" ]
edu.ur.file; java.util;
2,822,768
public Builder setAdvancementLevel(int advancementLevel) { checkArgument(advancementLevel >= 0, "Cannot have a less than zero advancement level!"); this.advancementLevel = advancementLevel; return this; }
Builder function(int advancementLevel) { checkArgument(advancementLevel >= 0, STR); this.advancementLevel = advancementLevel; return this; }
/** * Sets the level of which the role qualifies for advancement to a child role. * * @param advancementLevel The advancement level * * @return This builder for chaining */
Sets the level of which the role qualifies for advancement to a child role
setAdvancementLevel
{ "repo_name": "AfterKraft/KraftRPG-API", "path": "src/main/java/com/afterkraft/kraftrpg/api/role/Role.java", "license": "mit", "size": 20724 }
[ "com.google.common.base.Preconditions" ]
import com.google.common.base.Preconditions;
import com.google.common.base.*;
[ "com.google.common" ]
com.google.common;
735,252
public boolean canStart() { if (isRunning) { return false; } boolean hasItems = false; for (DPChest chest : chests) { for (ItemStack stack : chest.getChest().getInventory().getContents()) { if (stack != null) { hasItems = true; break; } } } return hasItems; }
boolean function() { if (isRunning) { return false; } boolean hasItems = false; for (DPChest chest : chests) { for (ItemStack stack : chest.getChest().getInventory().getContents()) { if (stack != null) { hasItems = true; break; } } } return hasItems; }
/** * Checks if the party can start. * * @return True if the party isn't running and has items to drop, else false. */
Checks if the party can start
canStart
{ "repo_name": "ampayne2/DropParty", "path": "src/main/java/ninja/amp/dropparty/parties/Party.java", "license": "lgpl-3.0", "size": 27228 }
[ "ninja.amp.dropparty.DPChest", "org.bukkit.inventory.ItemStack" ]
import ninja.amp.dropparty.DPChest; import org.bukkit.inventory.ItemStack;
import ninja.amp.dropparty.*; import org.bukkit.inventory.*;
[ "ninja.amp.dropparty", "org.bukkit.inventory" ]
ninja.amp.dropparty; org.bukkit.inventory;
2,113,013
public List<OFAction> getActions() { return this.actions; }
List<OFAction> function() { return this.actions; }
/** * Returns the actions contained in this message * @return a list of ordered OFAction objects */
Returns the actions contained in this message
getActions
{ "repo_name": "vonzhou/flc", "path": "src/main/java/org/openflow/protocol/OFFPUpdate.java", "license": "apache-2.0", "size": 3447 }
[ "java.util.List", "org.openflow.protocol.action.OFAction" ]
import java.util.List; import org.openflow.protocol.action.OFAction;
import java.util.*; import org.openflow.protocol.action.*;
[ "java.util", "org.openflow.protocol" ]
java.util; org.openflow.protocol;
1,389,044
public ISarlInterfaceBuilder addSarlInterface(String name) { ISarlInterfaceBuilder builder = this.iSarlInterfaceBuilderProvider.get(); builder.eInit(getSarlClass(), name, getTypeResolutionContext()); return builder; } @Inject private Provider<ISarlEnumerationBuilder> iSarlEnumerationBuilderProvider;
ISarlInterfaceBuilder function(String name) { ISarlInterfaceBuilder builder = this.iSarlInterfaceBuilderProvider.get(); builder.eInit(getSarlClass(), name, getTypeResolutionContext()); return builder; } private Provider<ISarlEnumerationBuilder> iSarlEnumerationBuilderProvider;
/** Create a SarlInterface. * @param name the name of the SarlInterface. * @return the builder. */
Create a SarlInterface
addSarlInterface
{ "repo_name": "sarl/sarl", "path": "main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlClassBuilderImpl.java", "license": "apache-2.0", "size": 9330 }
[ "javax.inject.Provider" ]
import javax.inject.Provider;
import javax.inject.*;
[ "javax.inject" ]
javax.inject;
1,128,826
protected boolean shouldParseNameAsAliases() { return true; } /** * Determine whether this parser is supposed to fire a * {@link org.springframework.beans.factory.parsing.BeanComponentDefinition}
boolean function() { return true; } /** * Determine whether this parser is supposed to fire a * {@link org.springframework.beans.factory.parsing.BeanComponentDefinition}
/** * Determine whether the element's "name" attribute should get parsed as * bean definition aliases, i.e. alternative bean definition names. * <p>The default implementation returns {@code true}. * @return whether the parser should evaluate the "name" attribute as aliases * @since 4.1.5 */
Determine whether the element's "name" attribute should get parsed as bean definition aliases, i.e. alternative bean definition names. The default implementation returns true
shouldParseNameAsAliases
{ "repo_name": "spring-projects/spring-framework", "path": "spring-beans/src/main/java/org/springframework/beans/factory/xml/AbstractBeanDefinitionParser.java", "license": "apache-2.0", "size": 9605 }
[ "org.springframework.beans.factory.parsing.BeanComponentDefinition" ]
import org.springframework.beans.factory.parsing.BeanComponentDefinition;
import org.springframework.beans.factory.parsing.*;
[ "org.springframework.beans" ]
org.springframework.beans;
2,088,692
public void putDateValid(List<LocalDate> arrayBody) throws ServiceException { if (arrayBody == null) { throw new ServiceException( new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")); } Validator.validate(arrayBody); try { Call<ResponseBody> call = service.putDateValid(arrayBody); ServiceResponse<Void> response = putDateValidDelegate(call.execute(), null); response.getBody(); } catch (ServiceException ex) { throw ex; } catch (Exception ex) { throw new ServiceException(ex); } }
void function(List<LocalDate> arrayBody) throws ServiceException { if (arrayBody == null) { throw new ServiceException( new IllegalArgumentException(STR)); } Validator.validate(arrayBody); try { Call<ResponseBody> call = service.putDateValid(arrayBody); ServiceResponse<Void> response = putDateValidDelegate(call.execute(), null); response.getBody(); } catch (ServiceException ex) { throw ex; } catch (Exception ex) { throw new ServiceException(ex); } }
/** * Set array value ['2000-12-01', '1980-01-02', '1492-10-12'] * * @param arrayBody the List&lt;LocalDate&gt; value * @throws ServiceException the exception wrapped in ServiceException if failed. */
Set array value ['2000-12-01', '1980-01-02', '1492-10-12']
putDateValid
{ "repo_name": "BretJohnson/autorest", "path": "AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/ArrayImpl.java", "license": "mit", "size": 128720 }
[ "com.microsoft.rest.ServiceException", "com.microsoft.rest.ServiceResponse", "com.microsoft.rest.Validator", "com.squareup.okhttp.ResponseBody", "java.util.List", "org.joda.time.LocalDate" ]
import com.microsoft.rest.ServiceException; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.Validator; import com.squareup.okhttp.ResponseBody; import java.util.List; import org.joda.time.LocalDate;
import com.microsoft.rest.*; import com.squareup.okhttp.*; import java.util.*; import org.joda.time.*;
[ "com.microsoft.rest", "com.squareup.okhttp", "java.util", "org.joda.time" ]
com.microsoft.rest; com.squareup.okhttp; java.util; org.joda.time;
1,406,161
@EnsuresNonNullIf(expression="get(#1)", result=true) public boolean containsKey(IValue key);
@EnsuresNonNullIf(expression=STR, result=true) boolean function(IValue key);
/** * Determine whether a certain key exists in this map. * @param key * @return true iff there is a value mapped to this key */
Determine whether a certain key exists in this map
containsKey
{ "repo_name": "usethesource/rascal-value", "path": "src/main/java/io/usethesource/vallang/IMap.java", "license": "epl-1.0", "size": 9994 }
[ "org.checkerframework.checker.nullness.qual.EnsuresNonNullIf" ]
import org.checkerframework.checker.nullness.qual.EnsuresNonNullIf;
import org.checkerframework.checker.nullness.qual.*;
[ "org.checkerframework.checker" ]
org.checkerframework.checker;
13,835
boolean needsUpdating(Object entry, int i, Type elemType);
boolean needsUpdating(Object entry, int i, Type elemType);
/** * Do we need to update this element? * * @param entry The collection element to check * @param i The index (for indexed collections) * @param elemType The type for the element * * @return {@code true} if the element needs updating */
Do we need to update this element
needsUpdating
{ "repo_name": "lamsfoundation/lams", "path": "3rdParty_sources/hibernate-core/org/hibernate/collection/spi/PersistentCollection.java", "license": "gpl-2.0", "size": 12695 }
[ "org.hibernate.type.Type" ]
import org.hibernate.type.Type;
import org.hibernate.type.*;
[ "org.hibernate.type" ]
org.hibernate.type;
249,980
public void execute(boolean sync, boolean modal, final GitTaskResultHandler resultHandler) { final Object LOCK = new Object(); final AtomicBoolean completed = new AtomicBoolean();
void function(boolean sync, boolean modal, final GitTaskResultHandler resultHandler) { final Object LOCK = new Object(); final AtomicBoolean completed = new AtomicBoolean();
/** * The most general execution method. * @param sync Set to <code>true</code> to make the calling thread wait for the task execution. * @param modal If <code>true</code>, the task will be modal with a modal progress dialog. If false, the task will be executed in * background. <code>modal</code> implies <code>sync</code>, i.e. if modal then sync doesn't matter: you'll wait anyway. * @param resultHandler Handle the result. * @see #execute(boolean) */
The most general execution method
execute
{ "repo_name": "michaelgallacher/intellij-community", "path": "plugins/git4idea/src/git4idea/commands/GitTask.java", "license": "apache-2.0", "size": 12365 }
[ "java.util.concurrent.atomic.AtomicBoolean" ]
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.*;
[ "java.util" ]
java.util;
2,894,850
@RequirePOST public synchronized void doDoDelete(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { checkPermission(DELETE); owner.deleteView(this); rsp.sendRedirect2(req.getContextPath()+"/" + owner.getUrl()); } /** * Creates a new {@link Item} in this collection. * * <p> * This method should call {@link ModifiableItemGroup#doCreateItem(StaplerRequest, StaplerResponse)}
synchronized void function(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { checkPermission(DELETE); owner.deleteView(this); rsp.sendRedirect2(req.getContextPath()+"/" + owner.getUrl()); } /** * Creates a new {@link Item} in this collection. * * <p> * This method should call {@link ModifiableItemGroup#doCreateItem(StaplerRequest, StaplerResponse)}
/** * Deletes this view. */
Deletes this view
doDoDelete
{ "repo_name": "rsandell/jenkins", "path": "core/src/main/java/hudson/model/View.java", "license": "mit", "size": 52084 }
[ "java.io.IOException", "javax.servlet.ServletException", "org.kohsuke.stapler.StaplerRequest", "org.kohsuke.stapler.StaplerResponse" ]
import java.io.IOException; import javax.servlet.ServletException; import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.StaplerResponse;
import java.io.*; import javax.servlet.*; import org.kohsuke.stapler.*;
[ "java.io", "javax.servlet", "org.kohsuke.stapler" ]
java.io; javax.servlet; org.kohsuke.stapler;
2,509,634
public static ImmutableLongArray copyOf(Iterable<Long> values) { if (values instanceof Collection) { return copyOf((Collection<Long>) values); } return builder().addAll(values).build(); }
static ImmutableLongArray function(Iterable<Long> values) { if (values instanceof Collection) { return copyOf((Collection<Long>) values); } return builder().addAll(values).build(); }
/** * Returns an immutable array containing the given values, in order. * * <p><b>Performance note:</b> this method delegates to {@link #copyOf(Collection)} if {@code * values} is a {@link Collection}. Otherwise it creates a {@link #builder} and uses {@link * Builder#addAll(Iterable)}, with all the performance implications associated with that. */
Returns an immutable array containing the given values, in order. Performance note: this method delegates to <code>#copyOf(Collection)</code> if values is a <code>Collection</code>. Otherwise it creates a <code>#builder</code> and uses <code>Builder#addAll(Iterable)</code>, with all the performance implications associated with that
copyOf
{ "repo_name": "typetools/guava", "path": "android/guava/src/com/google/common/primitives/ImmutableLongArray.java", "license": "apache-2.0", "size": 19385 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
1,614,097
// TODO(bazel-team): Move to CcCommon; refactor CcPlugin to use either CcLibraryHelper or // CcCommon. static List<String> expandMakeVariables( RuleContext ruleContext, String attributeName, List<String> input) { boolean tokenization = !ruleContext.getFeatures().contains("no_copts_tokenization"); List<String> tokens = new ArrayList<>(); for (String token : input) { try { // Legacy behavior: tokenize all items. if (tokenization) { ruleContext.tokenizeAndExpandMakeVars(tokens, attributeName, token); } else { String exp = ruleContext.expandSingleMakeVariable(attributeName, token); if (exp != null) { ShellUtils.tokenize(tokens, exp); } else { tokens.add(ruleContext.expandMakeVariables(attributeName, token)); } } } catch (ShellUtils.TokenizationException e) { ruleContext.attributeError(attributeName, e.getMessage()); } } return ImmutableList.copyOf(tokens); }
static List<String> expandMakeVariables( RuleContext ruleContext, String attributeName, List<String> input) { boolean tokenization = !ruleContext.getFeatures().contains(STR); List<String> tokens = new ArrayList<>(); for (String token : input) { try { if (tokenization) { ruleContext.tokenizeAndExpandMakeVars(tokens, attributeName, token); } else { String exp = ruleContext.expandSingleMakeVariable(attributeName, token); if (exp != null) { ShellUtils.tokenize(tokens, exp); } else { tokens.add(ruleContext.expandMakeVariables(attributeName, token)); } } } catch (ShellUtils.TokenizationException e) { ruleContext.attributeError(attributeName, e.getMessage()); } } return ImmutableList.copyOf(tokens); }
/** * Expands Make variables in a list of string and tokenizes the result. If the package feature * no_copts_tokenization is set, tokenize only items consisting of a single make variable. * * @param ruleContext the ruleContext to be used as the context of Make variable expansion * @param attributeName the name of the attribute to use in error reporting * @param input the list of strings to expand * @return a list of strings containing the expanded and tokenized values for the * attribute */
Expands Make variables in a list of string and tokenizes the result. If the package feature no_copts_tokenization is set, tokenize only items consisting of a single make variable
expandMakeVariables
{ "repo_name": "whuwxl/bazel", "path": "src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java", "license": "apache-2.0", "size": 25003 }
[ "com.google.common.collect.ImmutableList", "com.google.devtools.build.lib.analysis.RuleContext", "com.google.devtools.build.lib.shell.ShellUtils", "java.util.ArrayList", "java.util.List" ]
import com.google.common.collect.ImmutableList; import com.google.devtools.build.lib.analysis.RuleContext; import com.google.devtools.build.lib.shell.ShellUtils; import java.util.ArrayList; import java.util.List;
import com.google.common.collect.*; import com.google.devtools.build.lib.analysis.*; import com.google.devtools.build.lib.shell.*; import java.util.*;
[ "com.google.common", "com.google.devtools", "java.util" ]
com.google.common; com.google.devtools; java.util;
2,050,619
public boolean referencesTarget(String name, boolean baseTable) throws StandardException { return (!baseTable) && name.equals(methodCall.getJavaClassName()); }
boolean function(String name, boolean baseTable) throws StandardException { return (!baseTable) && name.equals(methodCall.getJavaClassName()); }
/** * Search to see if a query references the specifed table name. * * @param name Table name (String) to search for. * @param baseTable Whether or not name is for a base table * * @return true if found, else false * * @exception StandardException Thrown on error */
Search to see if a query references the specifed table name
referencesTarget
{ "repo_name": "youngor/openclouddb", "path": "src/main/java/com/akiban/sql/parser/FromVTI.java", "license": "apache-2.0", "size": 7328 }
[ "com.akiban.sql.StandardException" ]
import com.akiban.sql.StandardException;
import com.akiban.sql.*;
[ "com.akiban.sql" ]
com.akiban.sql;
2,789,448
@Test public void testDeleteJobFiles() throws PortalServiceException { final BlobStore mockBlobStore = context.mock(BlobStore.class); context.checking(new Expectations() { { allowing(mockBlobStoreContext).getBlobStore(); will(returnValue(mockBlobStore)); oneOf(mockBlobStore).blobExists(bucket, jobStorageBaseKey); will(returnValue(true)); oneOf(mockBlobStore).deleteDirectory(bucket, jobStorageBaseKey); oneOf(mockBlobStoreContext).close(); } }); service.deleteJobFiles(job); }
void function() throws PortalServiceException { final BlobStore mockBlobStore = context.mock(BlobStore.class); context.checking(new Expectations() { { allowing(mockBlobStoreContext).getBlobStore(); will(returnValue(mockBlobStore)); oneOf(mockBlobStore).blobExists(bucket, jobStorageBaseKey); will(returnValue(true)); oneOf(mockBlobStore).deleteDirectory(bucket, jobStorageBaseKey); oneOf(mockBlobStoreContext).close(); } }); service.deleteJobFiles(job); }
/** * Tests that requests for deleting files successfully call all dependencies * @throws PortalServiceException */
Tests that requests for deleting files successfully call all dependencies
testDeleteJobFiles
{ "repo_name": "GeoscienceAustralia/portal-core", "path": "src/test/java/org/auscope/portal/core/services/cloud/TestCloudStorageService.java", "license": "lgpl-3.0", "size": 17746 }
[ "org.auscope.portal.core.services.PortalServiceException", "org.jclouds.blobstore.BlobStore", "org.jmock.Expectations" ]
import org.auscope.portal.core.services.PortalServiceException; import org.jclouds.blobstore.BlobStore; import org.jmock.Expectations;
import org.auscope.portal.core.services.*; import org.jclouds.blobstore.*; import org.jmock.*;
[ "org.auscope.portal", "org.jclouds.blobstore", "org.jmock" ]
org.auscope.portal; org.jclouds.blobstore; org.jmock;
1,895,364
public static void read( Object object, Node node ) { // get this classes declared fields, public, private, protected, package, everything, but not super Field[] declaredFields = getAllDeclaredFields( object.getClass() ); for ( Field field : declaredFields ) { // ignore fields which are final, static or transient if ( Modifier.isFinal( field.getModifiers() ) || Modifier.isStatic( field.getModifiers() ) || Modifier.isTransient( field.getModifiers() ) ) { continue; } // if the field is not accessible (private), we'll open it up so we can operate on it boolean accessible = field.isAccessible(); if ( !accessible ) { field.setAccessible( true ); } try { // check if we're going to try to read an array if ( field.getType().isArray() ) { try { // get the node (if available) for the field Node fieldNode = XMLHandler.getSubNode( node, field.getName() ); if ( fieldNode == null ) { // doesn't exist (this is possible if fields were empty/null when persisted) continue; } // get the Java classname for the array elements String fieldClassName = XMLHandler.getTagAttribute( fieldNode, "class" ); Class<?> clazz = null; // primitive types require special handling if ( fieldClassName.equals( "boolean" ) ) { clazz = boolean.class; } else if ( fieldClassName.equals( "int" ) ) { clazz = int.class; } else if ( fieldClassName.equals( "float" ) ) { clazz = float.class; } else if ( fieldClassName.equals( "double" ) ) { clazz = double.class; } else if ( fieldClassName.equals( "long" ) ) { clazz = long.class; } else { // normal, non primitive array class clazz = Class.forName( fieldClassName ); } // get the child nodes for the field NodeList childrenNodes = fieldNode.getChildNodes(); // create a new, appropriately sized array int arrayLength = 0; for ( int i = 0; i < childrenNodes.getLength(); i++ ) { Node child = childrenNodes.item( i ); // ignore TEXT_NODE, they'll cause us to have a larger count than reality, even if they are empty if ( child.getNodeType() != Node.TEXT_NODE ) { arrayLength++; } } // create a new instance of our array Object array = Array.newInstance( clazz, arrayLength ); // set the new array on the field (on object, passed in) field.set( object, array ); int arrayIndex = 0; for ( int i = 0; i < childrenNodes.getLength(); i++ ) { Node child = childrenNodes.item( i ); if ( child.getNodeType() == Node.TEXT_NODE ) { continue; } // roll through all of our array elements setting them as encountered if ( String.class.isAssignableFrom( clazz ) || Number.class.isAssignableFrom( clazz ) ) { Constructor<?> constructor = clazz.getConstructor( String.class ); Object instance = constructor.newInstance( XMLHandler.getTagAttribute( child, "value" ) ); Array.set( array, arrayIndex++, instance ); } else if ( Boolean.class.isAssignableFrom( clazz ) || boolean.class.isAssignableFrom( clazz ) ) { Object value = Boolean.valueOf( XMLHandler.getTagAttribute( child, "value" ) ); Array.set( array, arrayIndex++, value ); } else if ( Integer.class.isAssignableFrom( clazz ) || int.class.isAssignableFrom( clazz ) ) { Object value = Integer.valueOf( XMLHandler.getTagAttribute( child, "value" ) ); Array.set( array, arrayIndex++, value ); } else if ( Float.class.isAssignableFrom( clazz ) || float.class.isAssignableFrom( clazz ) ) { Object value = Float.valueOf( XMLHandler.getTagAttribute( child, "value" ) ); Array.set( array, arrayIndex++, value ); } else if ( Double.class.isAssignableFrom( clazz ) || double.class.isAssignableFrom( clazz ) ) { Object value = Double.valueOf( XMLHandler.getTagAttribute( child, "value" ) ); Array.set( array, arrayIndex++, value ); } else if ( Long.class.isAssignableFrom( clazz ) || long.class.isAssignableFrom( clazz ) ) { Object value = Long.valueOf( XMLHandler.getTagAttribute( child, "value" ) ); Array.set( array, arrayIndex++, value ); } else { // create an instance of 'fieldClassName' Object instance = clazz.newInstance(); // add the instance to the array Array.set( array, arrayIndex++, instance ); // read child, the same way as the parent read( instance, child ); } } } catch ( Throwable t ) { t.printStackTrace(); // TODO: log this } } else if ( Collection.class.isAssignableFrom( field.getType() ) ) { // handle collections try { // get the node (if available) for the field Node fieldNode = XMLHandler.getSubNode( node, field.getName() ); if ( fieldNode == null ) { // doesn't exist (this is possible if fields were empty/null when persisted) continue; } // get the Java classname for the array elements String fieldClassName = XMLHandler.getTagAttribute( fieldNode, "class" ); fieldClassName = upgradeName( fieldClassName ); Class<?> clazz = Class.forName( fieldClassName ); // create a new, appropriately sized array, we already know it's a collection @SuppressWarnings( "unchecked" ) Collection<Object> collection = (Collection<Object>) field.getType().newInstance(); field.set( object, collection ); // iterate over all of the array elements and add them one by one as encountered NodeList childrenNodes = fieldNode.getChildNodes(); for ( int i = 0; i < childrenNodes.getLength(); i++ ) { Node child = childrenNodes.item( i ); if ( child.getNodeType() == Node.TEXT_NODE ) { continue; } // create an instance of 'fieldClassName' if ( String.class.isAssignableFrom( clazz ) || Number.class.isAssignableFrom( clazz ) || Boolean.class.isAssignableFrom( clazz ) ) { Constructor<?> constructor = clazz.getConstructor( String.class ); Object instance = constructor.newInstance( XMLHandler.getTagAttribute( child, "value" ) ); collection.add( instance ); } else { // read child, the same way as the parent Object instance = clazz.newInstance(); // add the instance to the array collection.add( instance ); read( instance, child ); } } } catch ( Throwable t ) { t.printStackTrace(); // TODO: log this } } else { // we're handling a regular field (not an array or list) try { String value = XMLHandler.getTagValue( node, field.getName() ); if ( value == null ) { continue; } if ( field.isAnnotationPresent( Password.class ) ) { value = Encr.decryptPasswordOptionallyEncrypted( value ); } // System.out.println("Setting " + field.getName() + "(" + field.getType().getSimpleName() + ") = " + value // + " on: " + object.getClass().getName()); if ( field.getType().isPrimitive() && "".equals( value ) ) { // skip setting of primitives if we see null continue; } else if ( "".equals( value ) ) { field.set( object, value ); } else if ( field.getType().isPrimitive() ) { // special primitive handling if ( double.class.isAssignableFrom( field.getType() ) ) { field.set( object, Double.parseDouble( value ) ); } else if ( float.class.isAssignableFrom( field.getType() ) ) { field.set( object, Float.parseFloat( value ) ); } else if ( long.class.isAssignableFrom( field.getType() ) ) { field.set( object, Long.parseLong( value ) ); } else if ( int.class.isAssignableFrom( field.getType() ) ) { field.set( object, Integer.parseInt( value ) ); } else if ( byte.class.isAssignableFrom( field.getType() ) ) { field.set( object, value.getBytes() ); } else if ( boolean.class.isAssignableFrom( field.getType() ) ) { field.set( object, "true".equalsIgnoreCase( value ) ); } } else if ( String.class.isAssignableFrom( field.getType() ) || Number.class.isAssignableFrom( field.getType() ) || Boolean.class.isAssignableFrom( field.getType() ) ) { Constructor<?> constructor = field.getType().getConstructor( String.class ); Object instance = constructor.newInstance( value ); field.set( object, instance ); } else { // we don't know what we're handling, but we'll give it a shot Node fieldNode = XMLHandler.getSubNode( node, field.getName() ); if ( fieldNode == null ) { // doesn't exist (this is possible if fields were empty/null when persisted) continue; } // get the Java classname for the array elements String fieldClassName = XMLHandler.getTagAttribute( fieldNode, "class" ); Class<?> clazz = Class.forName( fieldClassName ); Object instance = clazz.newInstance(); field.set( object, instance ); read( instance, fieldNode ); } } catch ( Throwable t ) { // TODO: log this t.printStackTrace(); } } } finally { if ( !accessible ) { field.setAccessible( false ); } } } }
static void function( Object object, Node node ) { Field[] declaredFields = getAllDeclaredFields( object.getClass() ); for ( Field field : declaredFields ) { if ( Modifier.isFinal( field.getModifiers() ) Modifier.isStatic( field.getModifiers() ) Modifier.isTransient( field.getModifiers() ) ) { continue; } boolean accessible = field.isAccessible(); if ( !accessible ) { field.setAccessible( true ); } try { if ( field.getType().isArray() ) { try { Node fieldNode = XMLHandler.getSubNode( node, field.getName() ); if ( fieldNode == null ) { continue; } String fieldClassName = XMLHandler.getTagAttribute( fieldNode, "class" ); Class<?> clazz = null; if ( fieldClassName.equals( STR ) ) { clazz = boolean.class; } else if ( fieldClassName.equals( "int" ) ) { clazz = int.class; } else if ( fieldClassName.equals( "float" ) ) { clazz = float.class; } else if ( fieldClassName.equals( STR ) ) { clazz = double.class; } else if ( fieldClassName.equals( "long" ) ) { clazz = long.class; } else { clazz = Class.forName( fieldClassName ); } NodeList childrenNodes = fieldNode.getChildNodes(); int arrayLength = 0; for ( int i = 0; i < childrenNodes.getLength(); i++ ) { Node child = childrenNodes.item( i ); if ( child.getNodeType() != Node.TEXT_NODE ) { arrayLength++; } } Object array = Array.newInstance( clazz, arrayLength ); field.set( object, array ); int arrayIndex = 0; for ( int i = 0; i < childrenNodes.getLength(); i++ ) { Node child = childrenNodes.item( i ); if ( child.getNodeType() == Node.TEXT_NODE ) { continue; } if ( String.class.isAssignableFrom( clazz ) Number.class.isAssignableFrom( clazz ) ) { Constructor<?> constructor = clazz.getConstructor( String.class ); Object instance = constructor.newInstance( XMLHandler.getTagAttribute( child, "value" ) ); Array.set( array, arrayIndex++, instance ); } else if ( Boolean.class.isAssignableFrom( clazz ) boolean.class.isAssignableFrom( clazz ) ) { Object value = Boolean.valueOf( XMLHandler.getTagAttribute( child, "value" ) ); Array.set( array, arrayIndex++, value ); } else if ( Integer.class.isAssignableFrom( clazz ) int.class.isAssignableFrom( clazz ) ) { Object value = Integer.valueOf( XMLHandler.getTagAttribute( child, "value" ) ); Array.set( array, arrayIndex++, value ); } else if ( Float.class.isAssignableFrom( clazz ) float.class.isAssignableFrom( clazz ) ) { Object value = Float.valueOf( XMLHandler.getTagAttribute( child, "value" ) ); Array.set( array, arrayIndex++, value ); } else if ( Double.class.isAssignableFrom( clazz ) double.class.isAssignableFrom( clazz ) ) { Object value = Double.valueOf( XMLHandler.getTagAttribute( child, "value" ) ); Array.set( array, arrayIndex++, value ); } else if ( Long.class.isAssignableFrom( clazz ) long.class.isAssignableFrom( clazz ) ) { Object value = Long.valueOf( XMLHandler.getTagAttribute( child, "value" ) ); Array.set( array, arrayIndex++, value ); } else { Object instance = clazz.newInstance(); Array.set( array, arrayIndex++, instance ); read( instance, child ); } } } catch ( Throwable t ) { t.printStackTrace(); } } else if ( Collection.class.isAssignableFrom( field.getType() ) ) { try { Node fieldNode = XMLHandler.getSubNode( node, field.getName() ); if ( fieldNode == null ) { continue; } String fieldClassName = XMLHandler.getTagAttribute( fieldNode, "class" ); fieldClassName = upgradeName( fieldClassName ); Class<?> clazz = Class.forName( fieldClassName ); @SuppressWarnings( STR ) Collection<Object> collection = (Collection<Object>) field.getType().newInstance(); field.set( object, collection ); NodeList childrenNodes = fieldNode.getChildNodes(); for ( int i = 0; i < childrenNodes.getLength(); i++ ) { Node child = childrenNodes.item( i ); if ( child.getNodeType() == Node.TEXT_NODE ) { continue; } if ( String.class.isAssignableFrom( clazz ) Number.class.isAssignableFrom( clazz ) Boolean.class.isAssignableFrom( clazz ) ) { Constructor<?> constructor = clazz.getConstructor( String.class ); Object instance = constructor.newInstance( XMLHandler.getTagAttribute( child, "value" ) ); collection.add( instance ); } else { Object instance = clazz.newInstance(); collection.add( instance ); read( instance, child ); } } } catch ( Throwable t ) { t.printStackTrace(); } } else { try { String value = XMLHandler.getTagValue( node, field.getName() ); if ( value == null ) { continue; } if ( field.isAnnotationPresent( Password.class ) ) { value = Encr.decryptPasswordOptionallyEncrypted( value ); } if ( field.getType().isPrimitive() && STRSTRtrueSTRclass" ); Class<?> clazz = Class.forName( fieldClassName ); Object instance = clazz.newInstance(); field.set( object, instance ); read( instance, fieldNode ); } } catch ( Throwable t ) { t.printStackTrace(); } } } finally { if ( !accessible ) { field.setAccessible( false ); } } } }
/** * This method will perform the work that used to be done by hand in each kettle input meta for: readData(Node node). * We handle all primitive types, complex user types, arrays, lists and any number of nested object levels, via * recursion of this method. * * @param object * The object to be persisted * @param node * The node to 'attach' our XML to */
This method will perform the work that used to be done by hand in each kettle input meta for: readData(Node node). We handle all primitive types, complex user types, arrays, lists and any number of nested object levels, via recursion of this method
read
{ "repo_name": "m-a-hall/big-data-plugin", "path": "kettle-plugins/common/job/src/main/java/org/pentaho/big/data/kettle/plugins/job/JobEntrySerializationHelper.java", "license": "apache-2.0", "size": 22587 }
[ "java.lang.reflect.Array", "java.lang.reflect.Constructor", "java.lang.reflect.Field", "java.lang.reflect.Modifier", "java.util.Collection", "org.pentaho.di.core.encryption.Encr", "org.pentaho.di.core.xml.XMLHandler", "org.w3c.dom.Node", "org.w3c.dom.NodeList" ]
import java.lang.reflect.Array; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.Collection; import org.pentaho.di.core.encryption.Encr; import org.pentaho.di.core.xml.XMLHandler; import org.w3c.dom.Node; import org.w3c.dom.NodeList;
import java.lang.reflect.*; import java.util.*; import org.pentaho.di.core.encryption.*; import org.pentaho.di.core.xml.*; import org.w3c.dom.*;
[ "java.lang", "java.util", "org.pentaho.di", "org.w3c.dom" ]
java.lang; java.util; org.pentaho.di; org.w3c.dom;
2,168,723
protected void transformColormap(byte[][] colormap) { for(int b = 0; b < 3; b++) { byte[] map = colormap[b]; int mapSize = map.length; int band = table.getNumBands() < 3 ? 0 : b; for(int i = 0; i < mapSize; i++) { int result = table.lookup(band, map[i] & 0xFF); map[i] = ImageUtil.clampByte(result); } } }
void function(byte[][] colormap) { for(int b = 0; b < 3; b++) { byte[] map = colormap[b]; int mapSize = map.length; int band = table.getNumBands() < 3 ? 0 : b; for(int i = 0; i < mapSize; i++) { int result = table.lookup(band, map[i] & 0xFF); map[i] = ImageUtil.clampByte(result); } } }
/** * Transform the colormap via the lookup table. */
Transform the colormap via the lookup table
transformColormap
{ "repo_name": "MarinnaCole/LightZone", "path": "lightcrafts/extsrc/com/lightcrafts/media/jai/opimage/LookupOpImage.java", "license": "bsd-3-clause", "size": 6672 }
[ "com.lightcrafts.media.jai.util.ImageUtil" ]
import com.lightcrafts.media.jai.util.ImageUtil;
import com.lightcrafts.media.jai.util.*;
[ "com.lightcrafts.media" ]
com.lightcrafts.media;
1,617,203
// the parse result map Map<String, String> map = new HashMap<String, String>(); // request input stream InputStream inputStream = null; try { inputStream = request.getInputStream(); SAXReader reader = new SAXReader(); Document document = reader.read(inputStream); Element root = document.getRootElement(); List<Element> elements = root.elements(); for (Element e : elements) { map.put(e.getName(), e.getText()); } } catch (Exception e) { LOG.error(e.getMessage()); } finally { // release resource if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { LOG.error(e.getMessage()); } } } return map; }
Map<String, String> map = new HashMap<String, String>(); InputStream inputStream = null; try { inputStream = request.getInputStream(); SAXReader reader = new SAXReader(); Document document = reader.read(inputStream); Element root = document.getRootElement(); List<Element> elements = root.elements(); for (Element e : elements) { map.put(e.getName(), e.getText()); } } catch (Exception e) { LOG.error(e.getMessage()); } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { LOG.error(e.getMessage()); } } } return map; }
/** * Parse the XML from wechat */
Parse the XML from wechat
parseXml
{ "repo_name": "Coralma/wcm", "path": "wcm-core/src/main/java/com/coral/wechat/utils/MessageParser.java", "license": "lgpl-3.0", "size": 1564 }
[ "java.io.IOException", "java.io.InputStream", "java.util.HashMap", "java.util.List", "java.util.Map", "org.dom4j.Document", "org.dom4j.Element", "org.dom4j.io.SAXReader" ]
import java.io.IOException; import java.io.InputStream; import java.util.HashMap; import java.util.List; import java.util.Map; import org.dom4j.Document; import org.dom4j.Element; import org.dom4j.io.SAXReader;
import java.io.*; import java.util.*; import org.dom4j.*; import org.dom4j.io.*;
[ "java.io", "java.util", "org.dom4j", "org.dom4j.io" ]
java.io; java.util; org.dom4j; org.dom4j.io;
1,207,229
public void onTabReselected(Tab tab, FragmentTransaction ft); } public static class LayoutParams extends ViewGroup.MarginLayoutParams { public int gravity = Gravity.NO_GRAVITY; public LayoutParams(@NonNull Context c, AttributeSet attrs) { super(c, attrs); TypedArray a = c.obtainStyledAttributes(attrs, R.styleable.ActionBarLayout); gravity = a.getInt(R.styleable.ActionBarLayout_android_layout_gravity, Gravity.NO_GRAVITY); a.recycle(); } public LayoutParams(int width, int height) { super(width, height); this.gravity = Gravity.CENTER_VERTICAL | GravityCompat.START; } public LayoutParams(int width, int height, int gravity) { super(width, height); this.gravity = gravity; } public LayoutParams(int gravity) { this(WRAP_CONTENT, MATCH_PARENT, gravity); } public LayoutParams(LayoutParams source) { super(source); this.gravity = source.gravity; } public LayoutParams(ViewGroup.LayoutParams source) { super(source); } } interface Callback {
void function(Tab tab, FragmentTransaction ft); } public static class LayoutParams extends ViewGroup.MarginLayoutParams { public int gravity = Gravity.NO_GRAVITY; public LayoutParams(@NonNull Context c, AttributeSet attrs) { super(c, attrs); TypedArray a = c.obtainStyledAttributes(attrs, R.styleable.ActionBarLayout); gravity = a.getInt(R.styleable.ActionBarLayout_android_layout_gravity, Gravity.NO_GRAVITY); a.recycle(); } public LayoutParams(int width, int height) { super(width, height); this.gravity = Gravity.CENTER_VERTICAL GravityCompat.START; } public LayoutParams(int width, int height, int gravity) { super(width, height); this.gravity = gravity; } public LayoutParams(int gravity) { this(WRAP_CONTENT, MATCH_PARENT, gravity); } public LayoutParams(LayoutParams source) { super(source); this.gravity = source.gravity; } public LayoutParams(ViewGroup.LayoutParams source) { super(source); } } interface Callback {
/** * Called when a tab that is already selected is chosen again by the user. * Some applications may use this action to return to the top level of a category. * * @param tab The tab that was reselected. * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute * once this method returns. This FragmentTransaction does not support * being added to the back stack. */
Called when a tab that is already selected is chosen again by the user. Some applications may use this action to return to the top level of a category
onTabReselected
{ "repo_name": "s20121035/rk3288_android5.1_repo", "path": "frameworks/support/v7/appcompat/src/android/support/v7/app/ActionBar.java", "license": "gpl-3.0", "size": 53048 }
[ "android.content.Context", "android.content.res.TypedArray", "android.support.annotation.NonNull", "android.support.v4.app.FragmentTransaction", "android.support.v4.view.GravityCompat", "android.util.AttributeSet", "android.view.Gravity", "android.view.ViewGroup" ]
import android.content.Context; import android.content.res.TypedArray; import android.support.annotation.NonNull; import android.support.v4.app.FragmentTransaction; import android.support.v4.view.GravityCompat; import android.util.AttributeSet; import android.view.Gravity; import android.view.ViewGroup;
import android.content.*; import android.content.res.*; import android.support.annotation.*; import android.support.v4.app.*; import android.support.v4.view.*; import android.util.*; import android.view.*;
[ "android.content", "android.support", "android.util", "android.view" ]
android.content; android.support; android.util; android.view;
1,866,471