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
@ResponseStatus(HttpStatus.NO_CONTENT) @RequestMapping(value = UrlHelpers.EVALUATION_ID_ACL, method = RequestMethod.DELETE) public void deleteAcl( @RequestParam(value = AuthorizationConstants.USER_ID_PARAM) Long userId, @PathVariable String evalId, HttpServletRequest request) throws NotFoundException, DatastoreException, InvalidModelException, UnauthorizedException, ConflictingUpdateException { serviceProvider.getEvaluationService().deleteAcl(userId, evalId); }
@ResponseStatus(HttpStatus.NO_CONTENT) @RequestMapping(value = UrlHelpers.EVALUATION_ID_ACL, method = RequestMethod.DELETE) void function( @RequestParam(value = AuthorizationConstants.USER_ID_PARAM) Long userId, @PathVariable String evalId, HttpServletRequest request) throws NotFoundException, DatastoreException, InvalidModelException, UnauthorizedException, ConflictingUpdateException { serviceProvider.getEvaluationService().deleteAcl(userId, evalId); }
/** * Deletes the ACL (access control list) of the specified evaluation. The user should have the proper * <a href="${org.sagebionetworks.evaluation.model.UserEvaluationPermissions}">permissions</a> * to delete the ACL. * * @param userId The user deleting the ACL. * @param evalId The ID of the evaluation whose ACL is being removed. */
Deletes the ACL (access control list) of the specified evaluation. The user should have the proper permissions to delete the ACL
deleteAcl
{ "repo_name": "hhu94/Synapse-Repository-Services", "path": "services/repository/src/main/java/org/sagebionetworks/repo/web/controller/EvaluationController.java", "license": "apache-2.0", "size": 50728 }
[ "javax.servlet.http.HttpServletRequest", "org.sagebionetworks.repo.model.AuthorizationConstants", "org.sagebionetworks.repo.model.ConflictingUpdateException", "org.sagebionetworks.repo.model.DatastoreException", "org.sagebionetworks.repo.model.InvalidModelException", "org.sagebionetworks.repo.model.UnauthorizedException", "org.sagebionetworks.repo.web.NotFoundException", "org.sagebionetworks.repo.web.UrlHelpers", "org.springframework.http.HttpStatus", "org.springframework.web.bind.annotation.PathVariable", "org.springframework.web.bind.annotation.RequestMapping", "org.springframework.web.bind.annotation.RequestMethod", "org.springframework.web.bind.annotation.RequestParam", "org.springframework.web.bind.annotation.ResponseStatus" ]
import javax.servlet.http.HttpServletRequest; import org.sagebionetworks.repo.model.AuthorizationConstants; import org.sagebionetworks.repo.model.ConflictingUpdateException; import org.sagebionetworks.repo.model.DatastoreException; import org.sagebionetworks.repo.model.InvalidModelException; import org.sagebionetworks.repo.model.UnauthorizedException; import org.sagebionetworks.repo.web.NotFoundException; import org.sagebionetworks.repo.web.UrlHelpers; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseStatus;
import javax.servlet.http.*; import org.sagebionetworks.repo.model.*; import org.sagebionetworks.repo.web.*; import org.springframework.http.*; import org.springframework.web.bind.annotation.*;
[ "javax.servlet", "org.sagebionetworks.repo", "org.springframework.http", "org.springframework.web" ]
javax.servlet; org.sagebionetworks.repo; org.springframework.http; org.springframework.web;
1,302,424
private JScrollPane getJScrollPane() { if (jScrollPane == null) { jScrollPane = new JScrollPane(); jScrollPane.setViewportView(getTableTest()); jScrollPane.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED)); } return jScrollPane; }
JScrollPane function() { if (jScrollPane == null) { jScrollPane = new JScrollPane(); jScrollPane.setViewportView(getTableTest()); jScrollPane.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED)); } return jScrollPane; }
/** * This method initializes jScrollPane * * @return javax.swing.JScrollPane */
This method initializes jScrollPane
getJScrollPane
{ "repo_name": "UjuE/zaproxy", "path": "src/org/zaproxy/zap/extension/ascan/PolicyAllCategoryPanel.java", "license": "apache-2.0", "size": 27685 }
[ "javax.swing.JScrollPane" ]
import javax.swing.JScrollPane;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
2,492,364
@Test public void shouldRetrieveAllVotes() throws Exception { String uname = "uname", rname = "rname", username = "username", password = "password"; Set<Vote> votes = new HashSet<Vote>(); Set<Winner> winners = new HashSet<Winner>(); User validUser = new User(mockId, uname, username, password, votes); Restaurant validRestaurant = new Restaurant(mockId, rname, winners, votes); Date mockVotingDate = new Date(Calendar.getInstance().getTimeInMillis()); Vote validVote = new Vote(mockId, mockVotingDate, validUser, validRestaurant); List<Vote> validVotes = new ArrayList<>(); validVotes.add(validVote); when(voteService.findAllVotes()).thenReturn(validVotes); this.mockMvc.perform(get(votesPath + "/").contentType(contentType)) .andDo(print()).andExpect(status().isOk()); }
void function() throws Exception { String uname = "uname", rname = "rname", username = STR, password = STR; Set<Vote> votes = new HashSet<Vote>(); Set<Winner> winners = new HashSet<Winner>(); User validUser = new User(mockId, uname, username, password, votes); Restaurant validRestaurant = new Restaurant(mockId, rname, winners, votes); Date mockVotingDate = new Date(Calendar.getInstance().getTimeInMillis()); Vote validVote = new Vote(mockId, mockVotingDate, validUser, validRestaurant); List<Vote> validVotes = new ArrayList<>(); validVotes.add(validVote); when(voteService.findAllVotes()).thenReturn(validVotes); this.mockMvc.perform(get(votesPath + "/").contentType(contentType)) .andDo(print()).andExpect(status().isOk()); }
/** * Votes API */
Votes API
shouldRetrieveAllVotes
{ "repo_name": "advecchia/dbserver-voting", "path": "src/test/java/com/dbserver/voting/controller/RestApiControllerTest.java", "license": "apache-2.0", "size": 20398 }
[ "com.dbserver.voting.models.Restaurant", "com.dbserver.voting.models.User", "com.dbserver.voting.models.Vote", "com.dbserver.voting.models.Winner", "java.sql.Date", "java.util.ArrayList", "java.util.Calendar", "java.util.HashSet", "java.util.List", "java.util.Set", "org.mockito.Mockito" ]
import com.dbserver.voting.models.Restaurant; import com.dbserver.voting.models.User; import com.dbserver.voting.models.Vote; import com.dbserver.voting.models.Winner; import java.sql.Date; import java.util.ArrayList; import java.util.Calendar; import java.util.HashSet; import java.util.List; import java.util.Set; import org.mockito.Mockito;
import com.dbserver.voting.models.*; import java.sql.*; import java.util.*; import org.mockito.*;
[ "com.dbserver.voting", "java.sql", "java.util", "org.mockito" ]
com.dbserver.voting; java.sql; java.util; org.mockito;
2,462,495
@Test public void testPortAndPath() { Map<String, Object> conf = new HashMap<>(defaultConf); WebTestSink sink = new WebTestSink(); sink.init(conf, context); Assert.assertEquals(sink.servicePort, 9999); Assert.assertEquals(sink.servicePath, "test"); }
void function() { Map<String, Object> conf = new HashMap<>(defaultConf); WebTestSink sink = new WebTestSink(); sink.init(conf, context); Assert.assertEquals(sink.servicePort, 9999); Assert.assertEquals(sink.servicePath, "test"); }
/** * Testing port and path setting */
Testing port and path setting
testPortAndPath
{ "repo_name": "lucperkins/heron", "path": "heron/metricsmgr/tests/java/com/twitter/heron/metricsmgr/sink/WebSinkTest.java", "license": "apache-2.0", "size": 7985 }
[ "java.util.HashMap", "java.util.Map", "org.junit.Assert" ]
import java.util.HashMap; import java.util.Map; import org.junit.Assert;
import java.util.*; import org.junit.*;
[ "java.util", "org.junit" ]
java.util; org.junit;
1,233,383
@Test public void testSameAsDecorated() { Iterator<E> iter = new SkippingIterator<E>(testList.iterator(), 0); assertTrue(iter.hasNext()); assertEquals("a", iter.next()); assertTrue(iter.hasNext()); assertEquals("b", iter.next()); assertTrue(iter.hasNext()); assertEquals("c", iter.next()); assertTrue(iter.hasNext()); assertEquals("d", iter.next()); assertTrue(iter.hasNext()); assertEquals("e", iter.next()); assertTrue(iter.hasNext()); assertEquals("f", iter.next()); assertTrue(iter.hasNext()); assertEquals("g", iter.next()); assertFalse(iter.hasNext()); try { iter.next(); fail("Expected NoSuchElementException."); } catch (NoSuchElementException nsee) { } }
void function() { Iterator<E> iter = new SkippingIterator<E>(testList.iterator(), 0); assertTrue(iter.hasNext()); assertEquals("a", iter.next()); assertTrue(iter.hasNext()); assertEquals("b", iter.next()); assertTrue(iter.hasNext()); assertEquals("c", iter.next()); assertTrue(iter.hasNext()); assertEquals("d", iter.next()); assertTrue(iter.hasNext()); assertEquals("e", iter.next()); assertTrue(iter.hasNext()); assertEquals("f", iter.next()); assertTrue(iter.hasNext()); assertEquals("g", iter.next()); assertFalse(iter.hasNext()); try { iter.next(); fail(STR); } catch (NoSuchElementException nsee) { } }
/** * Test a decorated iterator bounded such that the <code>offset</code> is * zero, in that the SkippingIterator should return all the same elements * as its decorated iterator. */
Test a decorated iterator bounded such that the <code>offset</code> is zero, in that the SkippingIterator should return all the same elements as its decorated iterator
testSameAsDecorated
{ "repo_name": "MuShiiii/commons-collections", "path": "src/test/java/org/apache/commons/collections4/iterators/SkippingIteratorTest.java", "license": "apache-2.0", "size": 9617 }
[ "java.util.Iterator", "java.util.NoSuchElementException" ]
import java.util.Iterator; import java.util.NoSuchElementException;
import java.util.*;
[ "java.util" ]
java.util;
2,758,954
public void register(DateFormat format) { formats.add(format); }
void function(DateFormat format) { formats.add(format); }
/** * Registers a date format to the list of internally checked ones. * * @param format date format */
Registers a date format to the list of internally checked ones
register
{ "repo_name": "codders/k2-sling-fork", "path": "bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/helper/DateParser.java", "license": "apache-2.0", "size": 4723 }
[ "java.text.DateFormat" ]
import java.text.DateFormat;
import java.text.*;
[ "java.text" ]
java.text;
1,659,621
public static void merge(Configuration destConf, Configuration srcConf) { for (Map.Entry<String, String> e : srcConf) { destConf.set(e.getKey(), e.getValue()); } }
static void function(Configuration destConf, Configuration srcConf) { for (Map.Entry<String, String> e : srcConf) { destConf.set(e.getKey(), e.getValue()); } }
/** * Merge two configurations. * @param destConf the configuration that will be overwritten with items * from the srcConf * @param srcConf the source configuration **/
Merge two configurations
merge
{ "repo_name": "JingchengDu/hbase", "path": "hbase-common/src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java", "license": "apache-2.0", "size": 12620 }
[ "java.util.Map", "org.apache.hadoop.conf.Configuration" ]
import java.util.Map; import org.apache.hadoop.conf.Configuration;
import java.util.*; import org.apache.hadoop.conf.*;
[ "java.util", "org.apache.hadoop" ]
java.util; org.apache.hadoop;
1,023,906
String getRiddle() { return Rand.rand(riddleMap.keySet()); } private static class RiddleLoader extends DefaultHandler { Map<String, Collection<String>> riddles; String currentKey; String currentAnswer;
String getRiddle() { return Rand.rand(riddleMap.keySet()); } private static class RiddleLoader extends DefaultHandler { Map<String, Collection<String>> riddles; String currentKey; String currentAnswer;
/** * Get a random riddle. * * @return A random ridde */
Get a random riddle
getRiddle
{ "repo_name": "sourceress-project/archestica", "path": "src/games/stendhal/server/maps/quests/SolveRiddles.java", "license": "gpl-2.0", "size": 10851 }
[ "games.stendhal.common.Rand", "java.util.Collection", "java.util.Map", "org.xml.sax.helpers.DefaultHandler" ]
import games.stendhal.common.Rand; import java.util.Collection; import java.util.Map; import org.xml.sax.helpers.DefaultHandler;
import games.stendhal.common.*; import java.util.*; import org.xml.sax.helpers.*;
[ "games.stendhal.common", "java.util", "org.xml.sax" ]
games.stendhal.common; java.util; org.xml.sax;
359,681
@Override public BytesRef getPayload() throws IOException { if (storePayloads) { if (payloadLength <= 0) { return null; } assert lazyProxPointer == -1; assert posPendingCount < freq; if (payloadPending) { payload.grow(payloadLength); proxIn.readBytes(payload.bytes(), 0, payloadLength); payload.setLength(payloadLength); payloadPending = false; } return payload.get(); } else { return null; } }
BytesRef function() throws IOException { if (storePayloads) { if (payloadLength <= 0) { return null; } assert lazyProxPointer == -1; assert posPendingCount < freq; if (payloadPending) { payload.grow(payloadLength); proxIn.readBytes(payload.bytes(), 0, payloadLength); payload.setLength(payloadLength); payloadPending = false; } return payload.get(); } else { return null; } }
/** Returns the payload at this position, or null if no * payload was indexed. */
Returns the payload at this position, or null if no
getPayload
{ "repo_name": "PATRIC3/p3_solr", "path": "lucene/backward-codecs/src/java/org/apache/lucene/codecs/lucene40/Lucene40PostingsReader.java", "license": "apache-2.0", "size": 33008 }
[ "java.io.IOException", "org.apache.lucene.util.BytesRef" ]
import java.io.IOException; import org.apache.lucene.util.BytesRef;
import java.io.*; import org.apache.lucene.util.*;
[ "java.io", "org.apache.lucene" ]
java.io; org.apache.lucene;
957,108
public void onUtilityCacheStarted() { synchronized (pendingJobCtxs) { if (pendingJobCtxs.size() == 0) return; Iterator<ComputeJobContext> iter = pendingJobCtxs.iterator(); while (iter.hasNext()) { iter.next().callcc(); iter.remove(); } } }
void function() { synchronized (pendingJobCtxs) { if (pendingJobCtxs.size() == 0) return; Iterator<ComputeJobContext> iter = pendingJobCtxs.iterator(); while (iter.hasNext()) { iter.next().callcc(); iter.remove(); } } }
/** * Called right after utility cache is started and ready for the usage. */
Called right after utility cache is started and ready for the usage
onUtilityCacheStarted
{ "repo_name": "pperalta/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java", "license": "apache-2.0", "size": 67778 }
[ "java.util.Iterator", "org.apache.ignite.compute.ComputeJobContext" ]
import java.util.Iterator; import org.apache.ignite.compute.ComputeJobContext;
import java.util.*; import org.apache.ignite.compute.*;
[ "java.util", "org.apache.ignite" ]
java.util; org.apache.ignite;
754,419
public void withdraw(Commit<? extends Withdraw> commit) { try { String topic = commit.value().topic(); Leadership oldLeadership = leadership(topic); elections.computeIfPresent(topic, (k, v) -> v.cleanup( topic, commit.session(), termCounter(topic)::incrementAndGet)); Leadership newLeadership = leadership(topic); if (!Objects.equal(oldLeadership, newLeadership)) { notifyLeadershipChange(oldLeadership, newLeadership); } } catch (Exception e) { logger().error("State machine operation failed", e); throw Throwables.propagate(e); } }
void function(Commit<? extends Withdraw> commit) { try { String topic = commit.value().topic(); Leadership oldLeadership = leadership(topic); elections.computeIfPresent(topic, (k, v) -> v.cleanup( topic, commit.session(), termCounter(topic)::incrementAndGet)); Leadership newLeadership = leadership(topic); if (!Objects.equal(oldLeadership, newLeadership)) { notifyLeadershipChange(oldLeadership, newLeadership); } } catch (Exception e) { logger().error(STR, e); throw Throwables.propagate(e); } }
/** * Applies an {@link AtomixLeaderElectorOperations.Withdraw} commit. * * @param commit withdraw commit */
Applies an <code>AtomixLeaderElectorOperations.Withdraw</code> commit
withdraw
{ "repo_name": "osinstom/onos", "path": "core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixLeaderElectorService.java", "license": "apache-2.0", "size": 24892 }
[ "com.google.common.base.Objects", "com.google.common.base.Throwables", "io.atomix.protocols.raft.service.Commit", "org.onosproject.cluster.Leadership", "org.onosproject.store.primitives.resources.impl.AtomixLeaderElectorOperations" ]
import com.google.common.base.Objects; import com.google.common.base.Throwables; import io.atomix.protocols.raft.service.Commit; import org.onosproject.cluster.Leadership; import org.onosproject.store.primitives.resources.impl.AtomixLeaderElectorOperations;
import com.google.common.base.*; import io.atomix.protocols.raft.service.*; import org.onosproject.cluster.*; import org.onosproject.store.primitives.resources.impl.*;
[ "com.google.common", "io.atomix.protocols", "org.onosproject.cluster", "org.onosproject.store" ]
com.google.common; io.atomix.protocols; org.onosproject.cluster; org.onosproject.store;
1,636,534
public void setDoneText(@Nullable final CharSequence text) { TextView doneText = (TextView) findViewById(R.id.done); doneText.setText(text); }
void function(@Nullable final CharSequence text) { TextView doneText = (TextView) findViewById(R.id.done); doneText.setText(text); }
/** * Override done text * * @param text your text */
Override done text
setDoneText
{ "repo_name": "mingjunli/GithubApp", "path": "appintro/src/main/java/com/github/paolorotolo/appintro/AppIntro.java", "license": "apache-2.0", "size": 3948 }
[ "android.support.annotation.Nullable", "android.widget.TextView" ]
import android.support.annotation.Nullable; import android.widget.TextView;
import android.support.annotation.*; import android.widget.*;
[ "android.support", "android.widget" ]
android.support; android.widget;
2,181,265
protected Object getObjectId(Object element) { if (element == null || (element instanceof JsonNull)) { throw new IllegalArgumentException("Element cannot be null"); } else if (element instanceof Integer) { return ((Integer) element).intValue(); } else if (element instanceof String) { return element; } else { JsonObject jsonObject; if (element instanceof JsonObject) { jsonObject = (JsonObject)element; } else { jsonObject = mClient.getGsonBuilder().create().toJsonTree(element).getAsJsonObject(); } updateIdProperty(jsonObject); JsonElement idProperty = jsonObject.get("id"); if (idProperty == null || (idProperty instanceof JsonNull)) { throw new IllegalArgumentException("Element must contain id property"); } if (idProperty.isJsonPrimitive()) { if (idProperty.getAsJsonPrimitive().isNumber()) { return idProperty.getAsJsonPrimitive().getAsLong(); } else if(idProperty.getAsJsonPrimitive().isString()) { return idProperty.getAsJsonPrimitive().getAsString(); } else { throw new IllegalArgumentException("Invalid id type"); } } else { throw new IllegalArgumentException("Invalid id type"); } } }
Object function(Object element) { if (element == null (element instanceof JsonNull)) { throw new IllegalArgumentException(STR); } else if (element instanceof Integer) { return ((Integer) element).intValue(); } else if (element instanceof String) { return element; } else { JsonObject jsonObject; if (element instanceof JsonObject) { jsonObject = (JsonObject)element; } else { jsonObject = mClient.getGsonBuilder().create().toJsonTree(element).getAsJsonObject(); } updateIdProperty(jsonObject); JsonElement idProperty = jsonObject.get("id"); if (idProperty == null (idProperty instanceof JsonNull)) { throw new IllegalArgumentException(STR); } if (idProperty.isJsonPrimitive()) { if (idProperty.getAsJsonPrimitive().isNumber()) { return idProperty.getAsJsonPrimitive().getAsLong(); } else if(idProperty.getAsJsonPrimitive().isString()) { return idProperty.getAsJsonPrimitive().getAsString(); } else { throw new IllegalArgumentException(STR); } } else { throw new IllegalArgumentException(STR); } } }
/** * Gets the id property from a given element * * @param element * The element to use * @return The id of the element */
Gets the id property from a given element
getObjectId
{ "repo_name": "marianosz/azure-mobile-services", "path": "sdk/android/src/sdk/src/com/microsoft/windowsazure/mobileservices/MobileServiceTableBase.java", "license": "apache-2.0", "size": 27160 }
[ "com.google.gson.JsonElement", "com.google.gson.JsonNull", "com.google.gson.JsonObject" ]
import com.google.gson.JsonElement; import com.google.gson.JsonNull; import com.google.gson.JsonObject;
import com.google.gson.*;
[ "com.google.gson" ]
com.google.gson;
672,492
void logging( CliRequest cliRequest ) { // LOG LEVEL cliRequest.verbose = cliRequest.commandLine.hasOption( CLIManager.VERBOSE ) || cliRequest.commandLine.hasOption( CLIManager.DEBUG ); cliRequest.quiet = !cliRequest.verbose && cliRequest.commandLine.hasOption( CLIManager.QUIET ); cliRequest.showErrors = cliRequest.verbose || cliRequest.commandLine.hasOption( CLIManager.ERRORS ); slf4jLoggerFactory = LoggerFactory.getILoggerFactory(); Slf4jConfiguration slf4jConfiguration = Slf4jConfigurationFactory.getConfiguration( slf4jLoggerFactory ); if ( cliRequest.verbose ) { cliRequest.request.setLoggingLevel( MavenExecutionRequest.LOGGING_LEVEL_DEBUG ); slf4jConfiguration.setRootLoggerLevel( Slf4jConfiguration.Level.DEBUG ); } else if ( cliRequest.quiet ) { cliRequest.request.setLoggingLevel( MavenExecutionRequest.LOGGING_LEVEL_ERROR ); slf4jConfiguration.setRootLoggerLevel( Slf4jConfiguration.Level.ERROR ); } // else fall back to default log level specified in conf // see https://issues.apache.org/jira/browse/MNG-2570 // LOG COLOR String styleColor = cliRequest.getUserProperties().getProperty( STYLE_COLOR_PROPERTY, "auto" ); styleColor = cliRequest.commandLine.getOptionValue( COLOR, styleColor ); if ( "always".equals( styleColor ) || "yes".equals( styleColor ) || "force".equals( styleColor ) ) { MessageUtils.setColorEnabled( true ); } else if ( "never".equals( styleColor ) || "no".equals( styleColor ) || "none".equals( styleColor ) ) { MessageUtils.setColorEnabled( false ); } else if ( !"auto".equals( styleColor ) && !"tty".equals( styleColor ) && !"if-tty".equals( styleColor ) ) { throw new IllegalArgumentException( "Invalid color configuration value '" + styleColor + "'. Supported are 'auto', 'always', 'never'." ); } else if ( cliRequest.commandLine.hasOption( CLIManager.BATCH_MODE ) || cliRequest.commandLine.hasOption( CLIManager.LOG_FILE ) ) { MessageUtils.setColorEnabled( false ); } // LOG STREAMS if ( cliRequest.commandLine.hasOption( CLIManager.LOG_FILE ) ) { File logFile = new File( cliRequest.commandLine.getOptionValue( CLIManager.LOG_FILE ) ); logFile = resolveFile( logFile, cliRequest.workingDirectory ); // redirect stdout and stderr to file try { PrintStream ps = new PrintStream( new FileOutputStream( logFile ) ); System.setOut( ps ); System.setErr( ps ); } catch ( FileNotFoundException e ) { // // Ignore // } } slf4jConfiguration.activate(); plexusLoggerManager = new Slf4jLoggerManager(); slf4jLogger = slf4jLoggerFactory.getLogger( this.getClass().getName() ); if ( cliRequest.commandLine.hasOption( CLIManager.FAIL_ON_SEVERITY ) ) { String logLevelThreshold = cliRequest.commandLine.getOptionValue( CLIManager.FAIL_ON_SEVERITY ); if ( slf4jLoggerFactory instanceof MavenSlf4jWrapperFactory ) { LogLevelRecorder logLevelRecorder = new LogLevelRecorder( logLevelThreshold ); ( (MavenSlf4jWrapperFactory) slf4jLoggerFactory ).setLogLevelRecorder( logLevelRecorder ); slf4jLogger.info( "Enabled to break the build on log level {}.", logLevelThreshold ); } else { slf4jLogger.warn( "Expected LoggerFactory to be of type '{}', but found '{}' instead. " + "The --fail-on-severity flag will not take effect.", MavenSlf4jWrapperFactory.class.getName(), slf4jLoggerFactory.getClass().getName() ); } } if ( cliRequest.commandLine.hasOption( CLIManager.DEBUG ) ) { slf4jLogger.warn( "The option '--debug' is deprecated and may be repurposed as Java debug" + " in a future version. Use -X/--verbose instead." ); } }
void logging( CliRequest cliRequest ) { cliRequest.verbose = cliRequest.commandLine.hasOption( CLIManager.VERBOSE ) cliRequest.commandLine.hasOption( CLIManager.DEBUG ); cliRequest.quiet = !cliRequest.verbose && cliRequest.commandLine.hasOption( CLIManager.QUIET ); cliRequest.showErrors = cliRequest.verbose cliRequest.commandLine.hasOption( CLIManager.ERRORS ); slf4jLoggerFactory = LoggerFactory.getILoggerFactory(); Slf4jConfiguration slf4jConfiguration = Slf4jConfigurationFactory.getConfiguration( slf4jLoggerFactory ); if ( cliRequest.verbose ) { cliRequest.request.setLoggingLevel( MavenExecutionRequest.LOGGING_LEVEL_DEBUG ); slf4jConfiguration.setRootLoggerLevel( Slf4jConfiguration.Level.DEBUG ); } else if ( cliRequest.quiet ) { cliRequest.request.setLoggingLevel( MavenExecutionRequest.LOGGING_LEVEL_ERROR ); slf4jConfiguration.setRootLoggerLevel( Slf4jConfiguration.Level.ERROR ); } String styleColor = cliRequest.getUserProperties().getProperty( STYLE_COLOR_PROPERTY, "auto" ); styleColor = cliRequest.commandLine.getOptionValue( COLOR, styleColor ); if ( STR.equals( styleColor ) "yes".equals( styleColor ) "force".equals( styleColor ) ) { MessageUtils.setColorEnabled( true ); } else if ( "never".equals( styleColor ) "no".equals( styleColor ) "none".equals( styleColor ) ) { MessageUtils.setColorEnabled( false ); } else if ( !"auto".equals( styleColor ) && !"tty".equals( styleColor ) && !STR.equals( styleColor ) ) { throw new IllegalArgumentException( STR + styleColor + STR ); } else if ( cliRequest.commandLine.hasOption( CLIManager.BATCH_MODE ) cliRequest.commandLine.hasOption( CLIManager.LOG_FILE ) ) { MessageUtils.setColorEnabled( false ); } if ( cliRequest.commandLine.hasOption( CLIManager.LOG_FILE ) ) { File logFile = new File( cliRequest.commandLine.getOptionValue( CLIManager.LOG_FILE ) ); logFile = resolveFile( logFile, cliRequest.workingDirectory ); try { PrintStream ps = new PrintStream( new FileOutputStream( logFile ) ); System.setOut( ps ); System.setErr( ps ); } catch ( FileNotFoundException e ) { } slf4jConfiguration.activate(); plexusLoggerManager = new Slf4jLoggerManager(); slf4jLogger = slf4jLoggerFactory.getLogger( this.getClass().getName() ); if ( cliRequest.commandLine.hasOption( CLIManager.FAIL_ON_SEVERITY ) ) { String logLevelThreshold = cliRequest.commandLine.getOptionValue( CLIManager.FAIL_ON_SEVERITY ); if ( slf4jLoggerFactory instanceof MavenSlf4jWrapperFactory ) { LogLevelRecorder logLevelRecorder = new LogLevelRecorder( logLevelThreshold ); ( (MavenSlf4jWrapperFactory) slf4jLoggerFactory ).setLogLevelRecorder( logLevelRecorder ); slf4jLogger.info( STR, logLevelThreshold ); } else { slf4jLogger.warn( STR + STR, MavenSlf4jWrapperFactory.class.getName(), slf4jLoggerFactory.getClass().getName() ); } } if ( cliRequest.commandLine.hasOption( CLIManager.DEBUG ) ) { slf4jLogger.warn( STR + STR ); } }
/** * configure logging */
configure logging
logging
{ "repo_name": "cstamas/maven", "path": "maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java", "license": "apache-2.0", "size": 69014 }
[ "java.io.File", "java.io.FileNotFoundException", "java.io.FileOutputStream", "java.io.PrintStream", "org.apache.maven.cli.ResolveFile", "org.apache.maven.cli.logging.Slf4jConfiguration", "org.apache.maven.cli.logging.Slf4jConfigurationFactory", "org.apache.maven.cli.logging.Slf4jLoggerManager", "org.apache.maven.execution.MavenExecutionRequest", "org.apache.maven.logwrapper.LogLevelRecorder", "org.apache.maven.logwrapper.MavenSlf4jWrapperFactory", "org.apache.maven.shared.utils.logging.MessageUtils", "org.slf4j.LoggerFactory" ]
import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.PrintStream; import org.apache.maven.cli.ResolveFile; import org.apache.maven.cli.logging.Slf4jConfiguration; import org.apache.maven.cli.logging.Slf4jConfigurationFactory; import org.apache.maven.cli.logging.Slf4jLoggerManager; import org.apache.maven.execution.MavenExecutionRequest; import org.apache.maven.logwrapper.LogLevelRecorder; import org.apache.maven.logwrapper.MavenSlf4jWrapperFactory; import org.apache.maven.shared.utils.logging.MessageUtils; import org.slf4j.LoggerFactory;
import java.io.*; import org.apache.maven.cli.*; import org.apache.maven.cli.logging.*; import org.apache.maven.execution.*; import org.apache.maven.logwrapper.*; import org.apache.maven.shared.utils.logging.*; import org.slf4j.*;
[ "java.io", "org.apache.maven", "org.slf4j" ]
java.io; org.apache.maven; org.slf4j;
1,634,206
TestSuite suite; suite = new TestSuite(ViewerProxyTesterSuite.class.getName()); addToSuite(suite); return suite; }
TestSuite suite; suite = new TestSuite(ViewerProxyTesterSuite.class.getName()); addToSuite(suite); return suite; }
/** * Create a test suite just for these tests. */
Create a test suite just for these tests
suite
{ "repo_name": "netarchivesuite/netarchivesuite-svngit-migration", "path": "tests/dk/netarkivet/viewerproxy/ViewerProxyTesterSuite.java", "license": "lgpl-2.1", "size": 2491 }
[ "junit.framework.TestSuite" ]
import junit.framework.TestSuite;
import junit.framework.*;
[ "junit.framework" ]
junit.framework;
1,638,467
public void attach(BuildContext context) { // do common shared code here, so it executes for all nodes doAttach(context); // do common shared code here, so it executes for all nodes }
void function(BuildContext context) { doAttach(context); }
/** * Attaches the node into the network. Usually to the parent <code>ObjectSource</code> or <code>TupleSource</code> */
Attaches the node into the network. Usually to the parent <code>ObjectSource</code> or <code>TupleSource</code>
attach
{ "repo_name": "manstis/drools", "path": "drools-core/src/main/java/org/drools/core/common/BaseNode.java", "license": "apache-2.0", "size": 6591 }
[ "org.drools.core.reteoo.builder.BuildContext" ]
import org.drools.core.reteoo.builder.BuildContext;
import org.drools.core.reteoo.builder.*;
[ "org.drools.core" ]
org.drools.core;
1,265,629
@Test public void testGetTotalMemoryInKB() { final long expected = Runtime.getRuntime().totalMemory() / 1024; final long compare = MemoryExtensions.getTotalMemoryInKB(); this.result = expected == compare; AssertJUnit.assertTrue("", this.result); } /** * Test method for {@link MemoryExtensions}
void function() { final long expected = Runtime.getRuntime().totalMemory() / 1024; final long compare = MemoryExtensions.getTotalMemoryInKB(); this.result = expected == compare; AssertJUnit.assertTrue("", this.result); } /** * Test method for {@link MemoryExtensions}
/** * Test method for {@link de.alpharogroup.lang.MemoryExtensions#getTotalMemoryInKB()}. */
Test method for <code>de.alpharogroup.lang.MemoryExtensions#getTotalMemoryInKB()</code>
testGetTotalMemoryInKB
{ "repo_name": "lightblueseas/jcommons-lang", "path": "src/test/java/de/alpharogroup/lang/MemoryExtensionsTest.java", "license": "mit", "size": 3931 }
[ "org.testng.AssertJUnit", "org.testng.annotations.Test" ]
import org.testng.AssertJUnit; import org.testng.annotations.Test;
import org.testng.*; import org.testng.annotations.*;
[ "org.testng", "org.testng.annotations" ]
org.testng; org.testng.annotations;
1,186,285
private void parseAssociationAttributes(Association assoc, Node associationNode) { NamedNodeMap attributes = associationNode.getAttributes(); if (attributes.getNamedItem(DIRECTION) != null) { assoc.setDirection(attributes.getNamedItem(DIRECTION).getNodeValue()); } if (attributes.getNamedItem(SOURCE) == null) { this.output.addParseError("There is an association without " + "a defined source element.", associationNode); } else { String sourceId = attributes.getNamedItem(SOURCE).getNodeValue(); Object object = this.diagram.getObject(sourceId); if ((object == null) || !(object instanceof GraphicalObject)) { this.output.addError("A source object with the Id " + sourceId + " does not exist for this association ", assoc.getId()); } else { assoc.setSource((GraphicalObject)object); } } if (attributes.getNamedItem(TARGET) == null) { this.output.addParseError("There is an association without " + "a defined target element.", associationNode); } else { String targetId = attributes.getNamedItem(TARGET).getNodeValue(); Object object = this.diagram.getObject(targetId); if ((object == null) || !(object instanceof GraphicalObject)){ this.output.addError("A target object with the Id " + targetId + " does not exist for this association ", assoc.getId()); } else { assoc.setTarget((GraphicalObject)object); } } }
void function(Association assoc, Node associationNode) { NamedNodeMap attributes = associationNode.getAttributes(); if (attributes.getNamedItem(DIRECTION) != null) { assoc.setDirection(attributes.getNamedItem(DIRECTION).getNodeValue()); } if (attributes.getNamedItem(SOURCE) == null) { this.output.addParseError(STR + STR, associationNode); } else { String sourceId = attributes.getNamedItem(SOURCE).getNodeValue(); Object object = this.diagram.getObject(sourceId); if ((object == null) !(object instanceof GraphicalObject)) { this.output.addError(STR + sourceId + STR, assoc.getId()); } else { assoc.setSource((GraphicalObject)object); } } if (attributes.getNamedItem(TARGET) == null) { this.output.addParseError(STR + STR, associationNode); } else { String targetId = attributes.getNamedItem(TARGET).getNodeValue(); Object object = this.diagram.getObject(targetId); if ((object == null) !(object instanceof GraphicalObject)){ this.output.addError(STR + targetId + STR, assoc.getId()); } else { assoc.setTarget((GraphicalObject)object); } } }
/** * Parses the attributes of an association node and adds the information * to a given association. * * If the association defines a source or a target object * that is not contained in the diagram, an error is added to the output. * * @param assoc The association to store the information in. * @param associationNode The association node to be parsed. */
Parses the attributes of an association node and adds the information to a given association. If the association defines a source or a target object that is not contained in the diagram, an error is added to the output
parseAssociationAttributes
{ "repo_name": "grasscrm/gdesigner", "path": "editor/server/src/de/hpi/bpel4chor/parser/ConnectionsParser.java", "license": "apache-2.0", "size": 11169 }
[ "de.hpi.bpel4chor.model.GraphicalObject", "de.hpi.bpel4chor.model.connections.Association", "org.w3c.dom.NamedNodeMap", "org.w3c.dom.Node" ]
import de.hpi.bpel4chor.model.GraphicalObject; import de.hpi.bpel4chor.model.connections.Association; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node;
import de.hpi.bpel4chor.model.*; import de.hpi.bpel4chor.model.connections.*; import org.w3c.dom.*;
[ "de.hpi.bpel4chor", "org.w3c.dom" ]
de.hpi.bpel4chor; org.w3c.dom;
545,119
public static void write(SocketChannel ch, ByteBuffer[] buffers, SSLEngine sslEngine) throws IOException { synchronized (ch) { doWrite(ch, buffers, sslEngine); } } protected static final int MAX_SIZE_PER_PACKET = 18000; protected static final int HEADER_FLAG_FOLLOWING = 0x10000;
static void function(SocketChannel ch, ByteBuffer[] buffers, SSLEngine sslEngine) throws IOException { synchronized (ch) { doWrite(ch, buffers, sslEngine); } } protected static final int MAX_SIZE_PER_PACKET = 18000; protected static final int HEADER_FLAG_FOLLOWING = 0x10000;
/** * write method to write to a socket. This method writes to completion so * it doesn't follow the nio standard. We use this to make sure we write * our own protocol. * * @param ch channel to write to. * @param buffers buffers to write. * @throws IOException if unable to write to completion. */
write method to write to a socket. This method writes to completion so it doesn't follow the nio standard. We use this to make sure we write our own protocol
write
{ "repo_name": "GabrielBrascher/cloudstack", "path": "utils/src/main/java/com/cloud/utils/nio/Link.java", "license": "apache-2.0", "size": 26773 }
[ "java.io.IOException", "java.nio.ByteBuffer", "java.nio.channels.SocketChannel", "javax.net.ssl.SSLEngine" ]
import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.SocketChannel; import javax.net.ssl.SSLEngine;
import java.io.*; import java.nio.*; import java.nio.channels.*; import javax.net.ssl.*;
[ "java.io", "java.nio", "javax.net" ]
java.io; java.nio; javax.net;
2,704,920
private static void runExtensiveMergerTest(Merger merger) throws InterruptedException { int inputCount = new TestFutureBatch().allFutures.size(); for (int i = 0; i < inputCount; i++) { for (int j = 0; j < inputCount; j++) { for (boolean iBeforeJ : new boolean[] { true, false }) { TestFutureBatch inputs = new TestFutureBatch(); ListenableFuture<String> iFuture = inputs.allFutures.get(i).future; ListenableFuture<String> jFuture = inputs.allFutures.get(j).future; ListenableFuture<List<String>> future = merger.merged(iFuture, jFuture); // Test timed get before we've completed any delayed futures. try { List<String> result = future.get(0, MILLISECONDS); assertTrue("Got " + result, Arrays.asList("a", null).containsAll(result)); } catch (CancellationException e) { assertTrue(merger == Merger.allMerger); inputs.assertHasImmediateCancel(iFuture, jFuture, e); } catch (ExecutionException e) { assertTrue(merger == Merger.allMerger); inputs.assertHasImmediateFailure(iFuture, jFuture, e); } catch (TimeoutException e) { inputs.assertHasDelayed(iFuture, jFuture, e); } // Same tests with pseudoTimedGet. try { List<String> result = conditionalPseudoTimedGet( inputs, iFuture, jFuture, future, 20, MILLISECONDS); assertTrue("Got " + result, Arrays.asList("a", null).containsAll(result)); } catch (CancellationException e) { assertTrue(merger == Merger.allMerger); inputs.assertHasImmediateCancel(iFuture, jFuture, e); } catch (ExecutionException e) { assertTrue(merger == Merger.allMerger); inputs.assertHasImmediateFailure(iFuture, jFuture, e); } catch (TimeoutException e) { inputs.assertHasDelayed(iFuture, jFuture, e); } // Finish the two futures in the currently specified order: inputs.allFutures.get(iBeforeJ ? i : j).finisher.run(); inputs.allFutures.get(iBeforeJ ? j : i).finisher.run(); // Test untimed get now that we've completed any delayed futures. try { List<String> result = future.get(); assertTrue("Got " + result, Arrays.asList("a", "b", null).containsAll(result)); } catch (CancellationException e) { assertTrue(merger == Merger.allMerger); inputs.assertHasCancel(iFuture, jFuture, e); } catch (ExecutionException e) { assertTrue(merger == Merger.allMerger); inputs.assertHasFailure(iFuture, jFuture, e); } } } } }
static void function(Merger merger) throws InterruptedException { int inputCount = new TestFutureBatch().allFutures.size(); for (int i = 0; i < inputCount; i++) { for (int j = 0; j < inputCount; j++) { for (boolean iBeforeJ : new boolean[] { true, false }) { TestFutureBatch inputs = new TestFutureBatch(); ListenableFuture<String> iFuture = inputs.allFutures.get(i).future; ListenableFuture<String> jFuture = inputs.allFutures.get(j).future; ListenableFuture<List<String>> future = merger.merged(iFuture, jFuture); try { List<String> result = future.get(0, MILLISECONDS); assertTrue(STR + result, Arrays.asList("a", null).containsAll(result)); } catch (CancellationException e) { assertTrue(merger == Merger.allMerger); inputs.assertHasImmediateCancel(iFuture, jFuture, e); } catch (ExecutionException e) { assertTrue(merger == Merger.allMerger); inputs.assertHasImmediateFailure(iFuture, jFuture, e); } catch (TimeoutException e) { inputs.assertHasDelayed(iFuture, jFuture, e); } try { List<String> result = conditionalPseudoTimedGet( inputs, iFuture, jFuture, future, 20, MILLISECONDS); assertTrue(STR + result, Arrays.asList("a", null).containsAll(result)); } catch (CancellationException e) { assertTrue(merger == Merger.allMerger); inputs.assertHasImmediateCancel(iFuture, jFuture, e); } catch (ExecutionException e) { assertTrue(merger == Merger.allMerger); inputs.assertHasImmediateFailure(iFuture, jFuture, e); } catch (TimeoutException e) { inputs.assertHasDelayed(iFuture, jFuture, e); } inputs.allFutures.get(iBeforeJ ? i : j).finisher.run(); inputs.allFutures.get(iBeforeJ ? j : i).finisher.run(); try { List<String> result = future.get(); assertTrue(STR + result, Arrays.asList("a", "b", null).containsAll(result)); } catch (CancellationException e) { assertTrue(merger == Merger.allMerger); inputs.assertHasCancel(iFuture, jFuture, e); } catch (ExecutionException e) { assertTrue(merger == Merger.allMerger); inputs.assertHasFailure(iFuture, jFuture, e); } } } } }
/** * For each possible pair of futures from {@link TestFutureBatch}, for each * possible completion order of those futures, test that various get calls * (timed before future completion, untimed before future completion, and * untimed after future completion) return or throw the proper values. */
For each possible pair of futures from <code>TestFutureBatch</code>, for each possible completion order of those futures, test that various get calls (timed before future completion, untimed before future completion, and untimed after future completion) return or throw the proper values
runExtensiveMergerTest
{ "repo_name": "binhvu7/guava", "path": "guava-tests/test/com/google/common/util/concurrent/FuturesTest.java", "license": "apache-2.0", "size": 97327 }
[ "com.google.common.util.concurrent.Futures", "java.util.Arrays", "java.util.List", "java.util.concurrent.CancellationException", "java.util.concurrent.ExecutionException", "java.util.concurrent.TimeoutException" ]
import com.google.common.util.concurrent.Futures; import java.util.Arrays; import java.util.List; import java.util.concurrent.CancellationException; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException;
import com.google.common.util.concurrent.*; import java.util.*; import java.util.concurrent.*;
[ "com.google.common", "java.util" ]
com.google.common; java.util;
2,372,432
@Override public int compareTo(final HTableDescriptor other) { return TableDescriptor.COMPARATOR.compare(this, other); } /** * Returns an unmodifiable collection of all the {@link HColumnDescriptor}
int function(final HTableDescriptor other) { return TableDescriptor.COMPARATOR.compare(this, other); } /** * Returns an unmodifiable collection of all the {@link HColumnDescriptor}
/** * Compares the descriptor with another descriptor which is passed as a parameter. * This compares the content of the two descriptors and not the reference. * * @return 0 if the contents of the descriptors are exactly matching, * 1 if there is a mismatch in the contents */
Compares the descriptor with another descriptor which is passed as a parameter. This compares the content of the two descriptors and not the reference
compareTo
{ "repo_name": "Eshcar/hbase", "path": "hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java", "license": "apache-2.0", "size": 32679 }
[ "org.apache.hadoop.hbase.client.TableDescriptor" ]
import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.client.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
1,723,317
@Test(expected = IllegalArgumentException.class) public void getGroups_null() throws Exception { reg.getGroups(null, 0); }
@Test(expected = IllegalArgumentException.class) void function() throws Exception { reg.getGroups(null, 0); }
/** * Test method for {@link com.ibm.ws.security.registry.UserRegistry#getGroups(java.lang.String, int)}. */
Test method for <code>com.ibm.ws.security.registry.UserRegistry#getGroups(java.lang.String, int)</code>
getGroups_null
{ "repo_name": "OpenLiberty/open-liberty", "path": "dev/com.ibm.ws.security.registry/test/com/ibm/ws/security/registry/UserRegistryIllegalArgumentTemplate.java", "license": "epl-1.0", "size": 9316 }
[ "org.junit.Test" ]
import org.junit.Test;
import org.junit.*;
[ "org.junit" ]
org.junit;
2,274,845
public MathTransform createMathTransform(final ParameterValueGroup parameters) throws ParameterNotFoundException, FactoryException { return new IdrEquidistantCylindrical(parameters); } }
MathTransform function(final ParameterValueGroup parameters) throws ParameterNotFoundException, FactoryException { return new IdrEquidistantCylindrical(parameters); } }
/** * Creates a transform from the specified group of parameter values. * * @param parameters The group of parameter values. * @return The created math transform. * @throws ParameterNotFoundException if a required parameter was not found. */
Creates a transform from the specified group of parameter values
createMathTransform
{ "repo_name": "iCarto/siga", "path": "libJCRS/src/org/geotools/referencing/operation/projection/IdrEquidistantCylindrical.java", "license": "gpl-3.0", "size": 10118 }
[ "org.opengis.parameter.ParameterNotFoundException", "org.opengis.parameter.ParameterValueGroup", "org.opengis.referencing.FactoryException", "org.opengis.referencing.operation.MathTransform" ]
import org.opengis.parameter.ParameterNotFoundException; import org.opengis.parameter.ParameterValueGroup; import org.opengis.referencing.FactoryException; import org.opengis.referencing.operation.MathTransform;
import org.opengis.parameter.*; import org.opengis.referencing.*; import org.opengis.referencing.operation.*;
[ "org.opengis.parameter", "org.opengis.referencing" ]
org.opengis.parameter; org.opengis.referencing;
2,406,849
public Inset unit(byte unit) { if (unit == UNIT_BASELINE && side != Component.TOP) { throw new IllegalArgumentException("baseline unit can only be used on the top inset."); } this.unit = unit; if (unit == UNIT_BASELINE) { referencePosition = 0f; getOppositeInset().setAuto().referenceComponent(null).referencePosition(0f); } return this; }
Inset function(byte unit) { if (unit == UNIT_BASELINE && side != Component.TOP) { throw new IllegalArgumentException(STR); } this.unit = unit; if (unit == UNIT_BASELINE) { referencePosition = 0f; getOppositeInset().setAuto().referenceComponent(null).referencePosition(0f); } return this; }
/** * Sets the unit for this constraint. This doesn't perform any recalculation * on the value. Just sets the unit. * @param unit The unit. One of {@link #UNIT_AUTO}, {@link #UNIT_DIPS}, {@link #UNIT_PIXELS}, or {@link #UNIT_PERCENT}. * @return Self for chaining. * @see #setAuto() * @see #setDips() * @see #setPixels() * @see #setPercent() * @see #changeUnits(byte) To change units while recalculating the value to be effectively equivalent. */
Sets the unit for this constraint. This doesn't perform any recalculation on the value. Just sets the unit
unit
{ "repo_name": "saeder/CodenameOne", "path": "CodenameOne/src/com/codename1/ui/layouts/LayeredLayout.java", "license": "gpl-2.0", "size": 150779 }
[ "com.codename1.ui.Component", "com.codename1.ui.layouts.LayeredLayout" ]
import com.codename1.ui.Component; import com.codename1.ui.layouts.LayeredLayout;
import com.codename1.ui.*; import com.codename1.ui.layouts.*;
[ "com.codename1.ui" ]
com.codename1.ui;
1,654,069
private static void initializeWithDefaultValuesIfNeeded() { if (DB_CONN_URL == null) { Log.warn("Initializing DB_CONN_URL to system default values ..."); DB_CONN_URL = "jdbc:h2:file:~/h2db"; } if (DB_USERNAME == null) { Log.warn("Initializing DB_USERNAME to system default values ..."); DB_USERNAME = "ssnoc_user"; } if (DB_PASSWORD == null) { Log.warn("Initializing DB_USERNAME to system default values ..."); //DB_PASSWORD = "bHGSR87#%1x"; DB_PASSWORD = ""; } if (DB_CONNECTION_POOL_SIZE == 0) { Log.warn("Initializing DB_CONNECTION_POOL_SIZE to system default values ..."); DB_CONNECTION_POOL_SIZE = 20; } if (ADMIN_CODE == null) { Log.warn("Initializing ADMIN_CODE to system default values ..."); ADMIN_CODE = "5830"; } }
static void function() { if (DB_CONN_URL == null) { Log.warn(STR); DB_CONN_URL = STR; } if (DB_USERNAME == null) { Log.warn(STR); DB_USERNAME = STR; } if (DB_PASSWORD == null) { Log.warn(STR); DB_PASSWORD = STRInitializing DB_CONNECTION_POOL_SIZE to system default values ...STRInitializing ADMIN_CODE to system default values ...STR5830"; } }
/** * This method will initialize the static variables with default values for * the system to use if we are unable to load the properties file for some * reason. */
This method will initialize the static variables with default values for the system to use if we are unable to load the properties file for some reason
initializeWithDefaultValuesIfNeeded
{ "repo_name": "ccjeremiahlin/fse-F14-SA5-SSNoC-Java-REST", "path": "src/main/java/edu/cmu/sv/ws/ssnoc/common/utils/PropertyUtils.java", "license": "apache-2.0", "size": 3621 }
[ "edu.cmu.sv.ws.ssnoc.common.logging.Log" ]
import edu.cmu.sv.ws.ssnoc.common.logging.Log;
import edu.cmu.sv.ws.ssnoc.common.logging.*;
[ "edu.cmu.sv" ]
edu.cmu.sv;
2,336,922
private void updateVisibility(boolean isExpand) { int collapsedViewVisibility = isExpand ? View.GONE : View.VISIBLE; int expandedViewVisibility = isExpand ? View.VISIBLE : View.GONE; mSearchIcon.setVisibility(collapsedViewVisibility); mCollapsedSearchBox.setVisibility(collapsedViewVisibility); mVoiceSearchButtonView.setVisibility(collapsedViewVisibility); mOverflowButtonView.setVisibility(collapsedViewVisibility); mBackButtonView.setVisibility(expandedViewVisibility); // TODO: Prevents keyboard from jumping up in landscape mode after exiting the // SearchFragment when the query string is empty. More elegant fix? //mExpandedSearchBox.setVisibility(expandedViewVisibility); mClearButtonView.setVisibility(expandedViewVisibility); }
void function(boolean isExpand) { int collapsedViewVisibility = isExpand ? View.GONE : View.VISIBLE; int expandedViewVisibility = isExpand ? View.VISIBLE : View.GONE; mSearchIcon.setVisibility(collapsedViewVisibility); mCollapsedSearchBox.setVisibility(collapsedViewVisibility); mVoiceSearchButtonView.setVisibility(collapsedViewVisibility); mOverflowButtonView.setVisibility(collapsedViewVisibility); mBackButtonView.setVisibility(expandedViewVisibility); mClearButtonView.setVisibility(expandedViewVisibility); }
/** * Updates the visibility of views depending on whether we will show the expanded or collapsed * search view. This helps prevent some jank with the crossfading if we are animating. * * @param isExpand Whether we are about to show the expanded search box. */
Updates the visibility of views depending on whether we will show the expanded or collapsed search view. This helps prevent some jank with the crossfading if we are animating
updateVisibility
{ "repo_name": "s20121035/rk3288_android5.1_repo", "path": "packages/apps/Dialer/src/com/android/dialer/widget/SearchEditTextLayout.java", "license": "gpl-3.0", "size": 10188 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
107,719
public Service setUserCodeCharset(UserCodeCharset charset) { this.userCodeCharset = charset; return this; }
Service function(UserCodeCharset charset) { this.userCodeCharset = charset; return this; }
/** * Set the character set for end-user verification codes * ({@code user_code}) for Device Flow. * * @param charset * The character set for end-user verification codes * ({@code user_code}) for Device Flow. * * @return * {@code this} object. * * @since 2.43 */
Set the character set for end-user verification codes (user_code) for Device Flow
setUserCodeCharset
{ "repo_name": "authlete/authlete-java-common", "path": "src/main/java/com/authlete/common/dto/Service.java", "license": "apache-2.0", "size": 222386 }
[ "com.authlete.common.types.UserCodeCharset" ]
import com.authlete.common.types.UserCodeCharset;
import com.authlete.common.types.*;
[ "com.authlete.common" ]
com.authlete.common;
1,505,223
@Override public TMessage readMessageBegin() throws TException { int size = readI32(); if (size < 0) { int version = size & VERSION_MASK; if (version != VERSION_1) { throw new TProtocolException(TProtocolException.BAD_VERSION, "Bad version in readMessageBegin"); } return new TMessage(readString(), (byte)(size & 0x000000ff), readI32()); } else { if (strictRead_) { throw new TProtocolException(TProtocolException.BAD_VERSION, "Missing version in readMessageBegin, old client?"); } return new TMessage(readStringBody(size), readByte(), readI32()); } } @Override public void readMessageEnd() {}
TMessage function() throws TException { int size = readI32(); if (size < 0) { int version = size & VERSION_MASK; if (version != VERSION_1) { throw new TProtocolException(TProtocolException.BAD_VERSION, STR); } return new TMessage(readString(), (byte)(size & 0x000000ff), readI32()); } else { if (strictRead_) { throw new TProtocolException(TProtocolException.BAD_VERSION, STR); } return new TMessage(readStringBody(size), readByte(), readI32()); } } public void readMessageEnd() {}
/** * Reading methods. */
Reading methods
readMessageBegin
{ "repo_name": "alexchenzl/evernote-sdk-java", "path": "src/main/java/com/evernote/thrift/protocol/TBinaryProtocol.java", "license": "bsd-2-clause", "size": 11186 }
[ "com.evernote.thrift.TException" ]
import com.evernote.thrift.TException;
import com.evernote.thrift.*;
[ "com.evernote.thrift" ]
com.evernote.thrift;
679,159
public static QDataSet circle( double dradius ) { QDataSet radius= DataSetUtil.asDataSet(dradius); return circle( radius ); }
static QDataSet function( double dradius ) { QDataSet radius= DataSetUtil.asDataSet(dradius); return circle( radius ); }
/** * return a dataset with X and Y forming a circle, introduced as a convenient way to indicate planet location. * @param dradius * @return QDataSet that when plotted is a circle. */
return a dataset with X and Y forming a circle, introduced as a convenient way to indicate planet location
circle
{ "repo_name": "autoplot/app", "path": "QDataSet/src/org/das2/qds/ops/Ops.java", "license": "gpl-2.0", "size": 492716 }
[ "org.das2.qds.DataSetUtil", "org.das2.qds.QDataSet" ]
import org.das2.qds.DataSetUtil; import org.das2.qds.QDataSet;
import org.das2.qds.*;
[ "org.das2.qds" ]
org.das2.qds;
524,977
protected RequestHandle sendRequest(DefaultHttpClient client, HttpContext httpContext, HttpUriRequest uriRequest, String contentType, ResponseHandlerInterface responseHandler, Context context) { if (uriRequest == null) { throw new IllegalArgumentException("HttpUriRequest must not be null"); } if (responseHandler == null) { throw new IllegalArgumentException("ResponseHandler must not be null"); } if (responseHandler.getUseSynchronousMode()) { throw new IllegalArgumentException("Synchronous ResponseHandler used in AsyncHttpClient. You should create your response handler in a looper thread or use SyncHttpClient instead."); } if (contentType != null) { uriRequest.setHeader("Content-Type", contentType); } responseHandler.setRequestHeaders(uriRequest.getAllHeaders()); responseHandler.setRequestURI(uriRequest.getURI()); AsyncHttpRequest request = new AsyncHttpRequest(client, httpContext, uriRequest, responseHandler); threadPool.submit(request); RequestHandle requestHandle = new RequestHandle(request); if (context != null) { // Add request to request map List<RequestHandle> requestList = requestMap.get(context); if (requestList == null) { requestList = new LinkedList(); requestMap.put(context, requestList); } if (responseHandler instanceof RangeFileAsyncHttpResponseHandler) ((RangeFileAsyncHttpResponseHandler) responseHandler).updateRequestHeaders(uriRequest); requestList.add(requestHandle); Iterator<RequestHandle> iterator = requestList.iterator(); while (iterator.hasNext()) { if (iterator.next().shouldBeGarbageCollected()) { iterator.remove(); } } } return requestHandle; }
RequestHandle function(DefaultHttpClient client, HttpContext httpContext, HttpUriRequest uriRequest, String contentType, ResponseHandlerInterface responseHandler, Context context) { if (uriRequest == null) { throw new IllegalArgumentException(STR); } if (responseHandler == null) { throw new IllegalArgumentException(STR); } if (responseHandler.getUseSynchronousMode()) { throw new IllegalArgumentException(STR); } if (contentType != null) { uriRequest.setHeader(STR, contentType); } responseHandler.setRequestHeaders(uriRequest.getAllHeaders()); responseHandler.setRequestURI(uriRequest.getURI()); AsyncHttpRequest request = new AsyncHttpRequest(client, httpContext, uriRequest, responseHandler); threadPool.submit(request); RequestHandle requestHandle = new RequestHandle(request); if (context != null) { List<RequestHandle> requestList = requestMap.get(context); if (requestList == null) { requestList = new LinkedList(); requestMap.put(context, requestList); } if (responseHandler instanceof RangeFileAsyncHttpResponseHandler) ((RangeFileAsyncHttpResponseHandler) responseHandler).updateRequestHeaders(uriRequest); requestList.add(requestHandle); Iterator<RequestHandle> iterator = requestList.iterator(); while (iterator.hasNext()) { if (iterator.next().shouldBeGarbageCollected()) { iterator.remove(); } } } return requestHandle; }
/** * Puts a new request in queue as a new thread in pool to be executed * * @param client HttpClient to be used for request, can differ in single requests * @param contentType MIME body type, for POST and PUT requests, may be null * @param context Context of Android application, to hold the reference of request * @param httpContext HttpContext in which the request will be executed * @param responseHandler ResponseHandler or its subclass to put the response into * @param uriRequest instance of HttpUriRequest, which means it must be of HttpDelete, * HttpPost, HttpGet, HttpPut, etc. * @return RequestHandle of future request process */
Puts a new request in queue as a new thread in pool to be executed
sendRequest
{ "repo_name": "OuYangRanRan/qianqianProject", "path": "IM_Demo/src/com/loopj/android/http/AsyncHttpClient.java", "license": "gpl-2.0", "size": 50490 }
[ "android.content.Context", "java.util.Iterator", "java.util.LinkedList", "java.util.List", "org.apache.http.client.methods.HttpUriRequest", "org.apache.http.impl.client.DefaultHttpClient", "org.apache.http.protocol.HttpContext" ]
import android.content.Context; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.protocol.HttpContext;
import android.content.*; import java.util.*; import org.apache.http.client.methods.*; import org.apache.http.impl.client.*; import org.apache.http.protocol.*;
[ "android.content", "java.util", "org.apache.http" ]
android.content; java.util; org.apache.http;
2,062,609
public void test_getDefaultAlgorithm() { String def = TrustManagerFactory.getDefaultAlgorithm(); if (getDefaultAlgorithm() == null) { assertNull("DefaultAlgorithm must be null", def); } else { assertEquals("Invalid default algorithm", def, getDefaultAlgorithm()); } String defA = "Proba.trustmanagerfactory.defaul.type"; Security.setProperty("ssl.TrustManagerFactory.algorithm", defA); assertEquals("Incorrect getDefaultAlgorithm()", TrustManagerFactory.getDefaultAlgorithm(), defA); if (def == null) { def = ""; } Security.setProperty("ssl.TrustManagerFactory.algorithm", def); assertEquals("Incorrect getDefaultAlgorithm()", TrustManagerFactory.getDefaultAlgorithm(), def); }
void function() { String def = TrustManagerFactory.getDefaultAlgorithm(); if (getDefaultAlgorithm() == null) { assertNull(STR, def); } else { assertEquals(STR, def, getDefaultAlgorithm()); } String defA = STR; Security.setProperty(STR, defA); assertEquals(STR, TrustManagerFactory.getDefaultAlgorithm(), defA); if (def == null) { def = ""; } Security.setProperty(STR, def); assertEquals(STR, TrustManagerFactory.getDefaultAlgorithm(), def); }
/** * Test for <code>getDefaultAlgorithm()</code> method * Assertion: returns value which is specifoed in security property */
Test for <code>getDefaultAlgorithm()</code> method Assertion: returns value which is specifoed in security property
test_getDefaultAlgorithm
{ "repo_name": "xdajog/samsung_sources_i927", "path": "libcore/luni/src/test/java/tests/api/javax/net/ssl/TrustManagerFactory1Test.java", "license": "gpl-2.0", "size": 21731 }
[ "java.security.Security", "javax.net.ssl.TrustManagerFactory" ]
import java.security.Security; import javax.net.ssl.TrustManagerFactory;
import java.security.*; import javax.net.ssl.*;
[ "java.security", "javax.net" ]
java.security; javax.net;
2,902,097
@Test() //GS-11380 public void testWrongTemplateXmlAnnotation() throws InterruptedException { // see @Archive(batchSize=2) annotation and atomic=true in MockArchiveContainer final int expectedBatchSize = 2; try { xmlTest(TEST_WRONG_TEMPLATE_ANNOTATION_XML , expectedBatchSize); Assert.fail("Expected exception"); } catch (AssertionError e) { Assert.assertEquals("expected:<5> but was:<0>", e.getMessage()); } }
@Test() void function() throws InterruptedException { final int expectedBatchSize = 2; try { xmlTest(TEST_WRONG_TEMPLATE_ANNOTATION_XML , expectedBatchSize); Assert.fail(STR); } catch (AssertionError e) { Assert.assertEquals(STR, e.getMessage()); } }
/** * Tests archiver with wrong template (processed = true) */
Tests archiver with wrong template (processed = true)
testWrongTemplateXmlAnnotation
{ "repo_name": "Gigaspaces/xap-openspaces", "path": "src/test/java/org/openspaces/itest/archive/ArchiveContainerTest.java", "license": "apache-2.0", "size": 20242 }
[ "junit.framework.Assert", "org.junit.Test" ]
import junit.framework.Assert; import org.junit.Test;
import junit.framework.*; import org.junit.*;
[ "junit.framework", "org.junit" ]
junit.framework; org.junit;
338,860
@Test(expected = ConstraintViolationException.class) public void testUpdateApplicationNullId() throws GenieException { this.appService.updateApplication(null, this.appService.getApplication(APP_1_ID)); }
@Test(expected = ConstraintViolationException.class) void function() throws GenieException { this.appService.updateApplication(null, this.appService.getApplication(APP_1_ID)); }
/** * Test to update an application. * * @throws GenieException For any problem */
Test to update an application
testUpdateApplicationNullId
{ "repo_name": "sensaid/genie", "path": "genie-core/src/integration-test/java/com/netflix/genie/core/services/impl/jpa/IntTestApplicationConfigServiceJPAImpl.java", "license": "apache-2.0", "size": 35923 }
[ "com.netflix.genie.common.exceptions.GenieException", "javax.validation.ConstraintViolationException", "org.junit.Test" ]
import com.netflix.genie.common.exceptions.GenieException; import javax.validation.ConstraintViolationException; import org.junit.Test;
import com.netflix.genie.common.exceptions.*; import javax.validation.*; import org.junit.*;
[ "com.netflix.genie", "javax.validation", "org.junit" ]
com.netflix.genie; javax.validation; org.junit;
461,586
public void setTriggerFilter(FileFilter triggerFilter) { synchronized (this.monitor) { this.triggerFilter = triggerFilter; } }
void function(FileFilter triggerFilter) { synchronized (this.monitor) { this.triggerFilter = triggerFilter; } }
/** * Set an optional {@link FileFilter} used to limit the files that trigger a change. * @param triggerFilter a trigger filter or null */
Set an optional <code>FileFilter</code> used to limit the files that trigger a change
setTriggerFilter
{ "repo_name": "jbovet/spring-boot", "path": "spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FileSystemWatcher.java", "license": "apache-2.0", "size": 9071 }
[ "java.io.FileFilter" ]
import java.io.FileFilter;
import java.io.*;
[ "java.io" ]
java.io;
2,248,900
Optional<PathExpressions> getPathExpressionsForProject( Config pluginConfig, Project.NameKey project) { requireNonNull(pluginConfig, "pluginConfig"); requireNonNull(project, "project"); String pathExpressionsName = pluginConfig.getString(SECTION_CODE_OWNERS, null, KEY_PATH_EXPRESSIONS); if (Strings.isNullOrEmpty(pathExpressionsName)) { return Optional.empty(); } Optional<PathExpressions> pathExpressions = PathExpressions.tryParse(pathExpressionsName); if (!pathExpressions.isPresent()) { logger.atWarning().log( "Path expressions '%s' that are configured for project %s in" + " %s.config (parameter %s.%s) not found. Falling back to default path" + " expressions.", pathExpressionsName, project, pluginName, SECTION_CODE_OWNERS, KEY_PATH_EXPRESSIONS); } return pathExpressions; }
Optional<PathExpressions> getPathExpressionsForProject( Config pluginConfig, Project.NameKey project) { requireNonNull(pluginConfig, STR); requireNonNull(project, STR); String pathExpressionsName = pluginConfig.getString(SECTION_CODE_OWNERS, null, KEY_PATH_EXPRESSIONS); if (Strings.isNullOrEmpty(pathExpressionsName)) { return Optional.empty(); } Optional<PathExpressions> pathExpressions = PathExpressions.tryParse(pathExpressionsName); if (!pathExpressions.isPresent()) { logger.atWarning().log( STR + STR + STR, pathExpressionsName, project, pluginName, SECTION_CODE_OWNERS, KEY_PATH_EXPRESSIONS); } return pathExpressions; }
/** * Gets the path expressions that are configured for the given project. * * @param pluginConfig the plugin config from which the path expressions should be read. * @param project the project for which the configured path expressions should be read * @return the path expressions that are configured for the given project, {@link * Optional#empty()} if there is no project-specific path expression configuration */
Gets the path expressions that are configured for the given project
getPathExpressionsForProject
{ "repo_name": "GerritCodeReview/plugins_code-owners", "path": "java/com/google/gerrit/plugins/codeowners/backend/config/BackendConfig.java", "license": "apache-2.0", "size": 16063 }
[ "com.google.common.base.Strings", "com.google.gerrit.entities.Project", "com.google.gerrit.plugins.codeowners.backend.PathExpressions", "java.util.Objects", "java.util.Optional", "org.eclipse.jgit.lib.Config" ]
import com.google.common.base.Strings; import com.google.gerrit.entities.Project; import com.google.gerrit.plugins.codeowners.backend.PathExpressions; import java.util.Objects; import java.util.Optional; import org.eclipse.jgit.lib.Config;
import com.google.common.base.*; import com.google.gerrit.entities.*; import com.google.gerrit.plugins.codeowners.backend.*; import java.util.*; import org.eclipse.jgit.lib.*;
[ "com.google.common", "com.google.gerrit", "java.util", "org.eclipse.jgit" ]
com.google.common; com.google.gerrit; java.util; org.eclipse.jgit;
836,705
@Test public void buildOslpMessageSignatureFailure() throws IOException, NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException { final OslpEnvelope request = this.buildMessage(); final byte[] fakeDeviceId = new byte[] { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9 }; // Validate security key is set in request final byte[] securityKey = request.getSecurityKey(); assertTrue(securityKey.length == OslpEnvelope.SECURITY_KEY_LENGTH); assertFalse(ArrayUtils.isEmpty(securityKey)); // Verify the message using public certificate final OslpEnvelope response = new OslpEnvelope.Builder().withSignature(SIGNATURE).withProvider(PROVIDER) .withSecurityKey(request.getSecurityKey()).withDeviceId(fakeDeviceId) .withSequenceNumber(request.getSequenceNumber()).withPayloadMessage(request.getPayloadMessage()) .build(); assertFalse(response.validate(CertificateHelper.createPublicKeyFromBase64(PUBLIC_KEY_BASE_64, KEY_TYPE, PROVIDER))); }
void function() throws IOException, NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException { final OslpEnvelope request = this.buildMessage(); final byte[] fakeDeviceId = new byte[] { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9 }; final byte[] securityKey = request.getSecurityKey(); assertTrue(securityKey.length == OslpEnvelope.SECURITY_KEY_LENGTH); assertFalse(ArrayUtils.isEmpty(securityKey)); final OslpEnvelope response = new OslpEnvelope.Builder().withSignature(SIGNATURE).withProvider(PROVIDER) .withSecurityKey(request.getSecurityKey()).withDeviceId(fakeDeviceId) .withSequenceNumber(request.getSequenceNumber()).withPayloadMessage(request.getPayloadMessage()) .build(); assertFalse(response.validate(CertificateHelper.createPublicKeyFromBase64(PUBLIC_KEY_BASE_64, KEY_TYPE, PROVIDER))); }
/** * Valid must fail when message is changed and hash does not match * * @throws IOException * @throws NoSuchAlgorithmException * @throws InvalidKeySpecException * @throws NoSuchProviderException */
Valid must fail when message is changed and hash does not match
buildOslpMessageSignatureFailure
{ "repo_name": "OSGP/Protocol-Adapter-OSLP", "path": "oslp/src/test/java/org/opensmartgridplatform/oslp/OslpEnvelopeRsaTest.java", "license": "apache-2.0", "size": 11953 }
[ "java.io.IOException", "java.security.NoSuchAlgorithmException", "java.security.NoSuchProviderException", "java.security.spec.InvalidKeySpecException", "org.apache.commons.lang3.ArrayUtils", "org.junit.Assert", "org.opensmartgridplatform.shared.security.CertificateHelper" ]
import java.io.IOException; import java.security.NoSuchAlgorithmException; import java.security.NoSuchProviderException; import java.security.spec.InvalidKeySpecException; import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.opensmartgridplatform.shared.security.CertificateHelper;
import java.io.*; import java.security.*; import java.security.spec.*; import org.apache.commons.lang3.*; import org.junit.*; import org.opensmartgridplatform.shared.security.*;
[ "java.io", "java.security", "org.apache.commons", "org.junit", "org.opensmartgridplatform.shared" ]
java.io; java.security; org.apache.commons; org.junit; org.opensmartgridplatform.shared;
2,476,066
public void logUpdateMasterKey(DelegationKey key) throws IOException { synchronized (this) { getEditLog().logUpdateMasterKey(key); } getEditLog().logSync(); }
void function(DelegationKey key) throws IOException { synchronized (this) { getEditLog().logUpdateMasterKey(key); } getEditLog().logSync(); }
/** * Log the updateMasterKey operation to edit logs * * @param key new delegation key. */
Log the updateMasterKey operation to edit logs
logUpdateMasterKey
{ "repo_name": "andy8788/hadoop-hdfs", "path": "src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java", "license": "apache-2.0", "size": 214042 }
[ "java.io.IOException", "org.apache.hadoop.security.token.delegation.DelegationKey" ]
import java.io.IOException; import org.apache.hadoop.security.token.delegation.DelegationKey;
import java.io.*; import org.apache.hadoop.security.token.delegation.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
1,530,333
public void start(int svc) throws ChannelException { if ( getNext()!=null ) getNext().start(svc); }
void function(int svc) throws ChannelException { if ( getNext()!=null ) getNext().start(svc); }
/** * Starts up the channel. This can be called multiple times for individual services to start * The svc parameter can be the logical or value of any constants * @param svc int value of <BR> * DEFAULT - will start all services <BR> * MBR_RX_SEQ - starts the membership receiver <BR> * MBR_TX_SEQ - starts the membership broadcaster <BR> * SND_TX_SEQ - starts the replication transmitter<BR> * SND_RX_SEQ - starts the replication receiver<BR> * @throws ChannelException if a startup error occurs or the service is already started. */
Starts up the channel. This can be called multiple times for individual services to start The svc parameter can be the logical or value of any constants
start
{ "repo_name": "plumer/codana", "path": "tomcat_files/6.0.43/ChannelInterceptorBase.java", "license": "mit", "size": 5425 }
[ "org.apache.catalina.tribes.ChannelException" ]
import org.apache.catalina.tribes.ChannelException;
import org.apache.catalina.tribes.*;
[ "org.apache.catalina" ]
org.apache.catalina;
1,057,966
private String tagMatcher( String property , String tags , String operator ) { StringBuffer result = new StringBuffer(); String theOperator = " all "; // initialize to 'all', but change to 'any' if using 'or' if (operator.trim().equals("or")) { theOperator = " any "; } if (tags != null && tags.length() > 0) { try { String [] parts = tags.split(","); if (parts.length > 0) { result.append(theOperator); result.append(" (x in ["); result.append("\""); result.append(parts[0].trim()); result.append("\" "); } if (parts.length > 1) { for (int i=1; i < parts.length; i++) { result.append(", \""); result.append(parts[i].trim()); result.append("\""); } } result.append("] where x in "); result.append(property); result.append(") "); } catch (Exception e) { ErrorUtils.report(logger, e); } } return result.toString(); }
String function( String property , String tags , String operator ) { StringBuffer result = new StringBuffer(); String theOperator = STR; if (operator.trim().equals("or")) { theOperator = STR; } if (tags != null && tags.length() > 0) { try { String [] parts = tags.split(","); if (parts.length > 0) { result.append(theOperator); result.append(STR); result.append("\"STR\" "); } if (parts.length > 1) { for (int i=1; i < parts.length; i++) { result.append(STRSTR\STR] where x in STR) "); } catch (Exception e) { ErrorUtils.report(logger, e); } } return result.toString(); }
/** * if the operator is an 'or': * * any (x in ["a", "b"] where x in link.tags) * * if the operator is an 'and': * * all (x in ["a", "b"] where x in link.tags) * * @param property * @param tags * @param operator * @return */
if the operator is an 'or': any (x in ["a", "b"] where x in link.tags) if the operator is an 'and': all (x in ["a", "b"] where x in link.tags)
tagMatcher
{ "repo_name": "OCMC-Translation-Projects/ioc-liturgical-ws", "path": "src/main/java/ioc/liturgical/ws/managers/databases/external/neo4j/cypher/CypherQueryForLinks.java", "license": "epl-1.0", "size": 7421 }
[ "org.ocmc.ioc.liturgical.utils.ErrorUtils" ]
import org.ocmc.ioc.liturgical.utils.ErrorUtils;
import org.ocmc.ioc.liturgical.utils.*;
[ "org.ocmc.ioc" ]
org.ocmc.ioc;
416,452
private static String shortestParam(LatLng[] points) { String joined = join('|', points); String encoded = "enc:" + PolylineEncoding.encode(points); return joined.length() < encoded.length() ? joined : encoded; }
static String function(LatLng[] points) { String joined = join(' ', points); String encoded = "enc:" + PolylineEncoding.encode(points); return joined.length() < encoded.length() ? joined : encoded; }
/** * Chooses the shortest param (only a guess, since the * length is different after URL encoding). */
Chooses the shortest param (only a guess, since the length is different after URL encoding)
shortestParam
{ "repo_name": "GabrielApG/google-maps-services-java", "path": "src/main/java/com/google/maps/ElevationApi.java", "license": "apache-2.0", "size": 5150 }
[ "com.google.maps.internal.PolylineEncoding", "com.google.maps.internal.StringJoin", "com.google.maps.model.LatLng" ]
import com.google.maps.internal.PolylineEncoding; import com.google.maps.internal.StringJoin; import com.google.maps.model.LatLng;
import com.google.maps.internal.*; import com.google.maps.model.*;
[ "com.google.maps" ]
com.google.maps;
359,217
static public String stackTrace(Throwable thing) { StringWriter stringTarget = new StringWriter(); PrintWriter writer = new PrintWriter(stringTarget); thing.printStackTrace(writer); writer.close(); return stringTarget.toString(); }
static String function(Throwable thing) { StringWriter stringTarget = new StringWriter(); PrintWriter writer = new PrintWriter(stringTarget); thing.printStackTrace(writer); writer.close(); return stringTarget.toString(); }
/** * <p>This is a convenience method used by the server to get a * stack trace from a throwable object in String form. </p> */
This is a convenience method used by the server to get a stack trace from a throwable object in String form.
stackTrace
{ "repo_name": "jonabbey/Ganymede", "path": "src/ganymede/arlut/csd/ganymede/server/Ganymede.java", "license": "gpl-2.0", "size": 70893 }
[ "java.io.PrintWriter", "java.io.StringWriter" ]
import java.io.PrintWriter; import java.io.StringWriter;
import java.io.*;
[ "java.io" ]
java.io;
2,690,159
@GET @Path("transactions/") public BitsoTransaction[] getTransactions() throws BitsoException, IOException;
@Path(STR) BitsoTransaction[] function() throws BitsoException, IOException;
/** * Returns descending list of transactions. */
Returns descending list of transactions
getTransactions
{ "repo_name": "stevenuray/XChange", "path": "xchange-bitso/src/main/java/org/knowm/xchange/bitso/Bitso.java", "license": "mit", "size": 1276 }
[ "java.io.IOException", "javax.ws.rs.Path", "org.knowm.xchange.bitso.dto.BitsoException", "org.knowm.xchange.bitso.dto.marketdata.BitsoTransaction" ]
import java.io.IOException; import javax.ws.rs.Path; import org.knowm.xchange.bitso.dto.BitsoException; import org.knowm.xchange.bitso.dto.marketdata.BitsoTransaction;
import java.io.*; import javax.ws.rs.*; import org.knowm.xchange.bitso.dto.*; import org.knowm.xchange.bitso.dto.marketdata.*;
[ "java.io", "javax.ws", "org.knowm.xchange" ]
java.io; javax.ws; org.knowm.xchange;
1,959,769
Map<String, PartitionMetadata> loadPartitionsByRefs(TableMetaRef table, List<String> partitionColumnNames, ListMap<TNetworkAddress> hostIndex, List<PartitionRef> partitionRefs) throws MetaException, TException;
Map<String, PartitionMetadata> loadPartitionsByRefs(TableMetaRef table, List<String> partitionColumnNames, ListMap<TNetworkAddress> hostIndex, List<PartitionRef> partitionRefs) throws MetaException, TException;
/** * Load the given partitions from the specified table. * * If a requested partition does not exist, no exception will be thrown. * Instead, the resulting map will contain no entry for that partition. */
Load the given partitions from the specified table. If a requested partition does not exist, no exception will be thrown. Instead, the resulting map will contain no entry for that partition
loadPartitionsByRefs
{ "repo_name": "cloudera/Impala", "path": "fe/src/main/java/org/apache/impala/catalog/local/MetaProvider.java", "license": "apache-2.0", "size": 4904 }
[ "java.util.List", "java.util.Map", "org.apache.hadoop.hive.metastore.api.MetaException", "org.apache.impala.thrift.TNetworkAddress", "org.apache.impala.util.ListMap", "org.apache.thrift.TException" ]
import java.util.List; import java.util.Map; import org.apache.hadoop.hive.metastore.api.MetaException; import org.apache.impala.thrift.TNetworkAddress; import org.apache.impala.util.ListMap; import org.apache.thrift.TException;
import java.util.*; import org.apache.hadoop.hive.metastore.api.*; import org.apache.impala.thrift.*; import org.apache.impala.util.*; import org.apache.thrift.*;
[ "java.util", "org.apache.hadoop", "org.apache.impala", "org.apache.thrift" ]
java.util; org.apache.hadoop; org.apache.impala; org.apache.thrift;
131,451
static GVRPickedObject makeObjectHit(long colliderPointer, int collidableIndex, float distance, float hitx, float hity, float hitz) { GVRCollider collider = GVRCollider.lookup(colliderPointer); if (collider == null) { Log.d("GVRBoundsPicker", "makeObjectHit: cannot find collider for %x", colliderPointer); return null; } GVRPicker.GVRPickedObject hit = new GVRPicker.GVRPickedObject(collider, new float[] { hitx, hity, hitz }, distance); hit.collidableIndex = collidableIndex; return hit; }
static GVRPickedObject makeObjectHit(long colliderPointer, int collidableIndex, float distance, float hitx, float hity, float hitz) { GVRCollider collider = GVRCollider.lookup(colliderPointer); if (collider == null) { Log.d(STR, STR, colliderPointer); return null; } GVRPicker.GVRPickedObject hit = new GVRPicker.GVRPickedObject(collider, new float[] { hitx, hity, hitz }, distance); hit.collidableIndex = collidableIndex; return hit; }
/** * Internal utility to help JNI add hit objects to the pick list. */
Internal utility to help JNI add hit objects to the pick list
makeObjectHit
{ "repo_name": "NolaDonato/GearVRf", "path": "GVRf/Framework/framework/src/main/java/org/gearvrf/GVRBoundsPicker.java", "license": "apache-2.0", "size": 10555 }
[ "org.gearvrf.utility.Log" ]
import org.gearvrf.utility.Log;
import org.gearvrf.utility.*;
[ "org.gearvrf.utility" ]
org.gearvrf.utility;
941,521
public static @Nullable Filter getFilter(final String sparql) throws Exception { requireNonNull(sparql);
static @Nullable Filter function(final String sparql) throws Exception { requireNonNull(sparql);
/** * Get the first {@link Filter} node from a SPARQL query. * * @param sparql - The query that contains a single Projection node. * @return The first {@link Filter} that is encountered. * @throws Exception The query could not be parsed. */
Get the first <code>Filter</code> node from a SPARQL query
getFilter
{ "repo_name": "apache/incubator-rya", "path": "test/rdf/src/main/java/org/apache/rya/streams/kafka/RdfTestUtil.java", "license": "apache-2.0", "size": 5230 }
[ "edu.umd.cs.findbugs.annotations.Nullable", "java.util.Objects", "org.eclipse.rdf4j.query.algebra.Filter" ]
import edu.umd.cs.findbugs.annotations.Nullable; import java.util.Objects; import org.eclipse.rdf4j.query.algebra.Filter;
import edu.umd.cs.findbugs.annotations.*; import java.util.*; import org.eclipse.rdf4j.query.algebra.*;
[ "edu.umd.cs", "java.util", "org.eclipse.rdf4j" ]
edu.umd.cs; java.util; org.eclipse.rdf4j;
1,925,622
public static URL resolveURL(URL base, String target) throws MalformedURLException { target = target.trim(); // handle the case that there is a target that is a pure query, // for example // http://careers3.accenture.com/Careers/ASPX/Search.aspx?co=0&sk=0 // It has urls in the page of the form href="?co=0&sk=0&pg=1", and by // default // URL constructs the base+target combo as // http://careers3.accenture.com/Careers/ASPX/?co=0&sk=0&pg=1, incorrectly // dropping the Search.aspx target // // Browsers handle these just fine, they must have an exception similar to // this if (target.startsWith("?")) { return fixPureQueryTargets(base, target); } return new URL(base, target); }
static URL function(URL base, String target) throws MalformedURLException { target = target.trim(); if (target.startsWith("?")) { return fixPureQueryTargets(base, target); } return new URL(base, target); }
/** * Resolve relative URL-s and fix a java.net.URL error in handling of URLs * with pure query targets. * * @param base * base url * @param target * target url (may be relative) * @return resolved absolute url. * @throws MalformedURLException if the input base URL is malformed */
Resolve relative URL-s and fix a java.net.URL error in handling of URLs with pure query targets
resolveURL
{ "repo_name": "commoncrawl/nutch", "path": "src/java/org/apache/nutch/util/URLUtil.java", "license": "apache-2.0", "size": 18287 }
[ "java.net.MalformedURLException" ]
import java.net.MalformedURLException;
import java.net.*;
[ "java.net" ]
java.net;
2,208,966
private static final Font deriveFont(Font f, int style) { // return f.deriveFont(style); // see #49973 for details. Font result = Utilities.isMac() ? new Font(f.getName(), style, f.getSize()) : f.deriveFont(style); return result; }
static final Font function(Font f, int style) { Font result = Utilities.isMac() ? new Font(f.getName(), style, f.getSize()) : f.deriveFont(style); return result; }
/** * Workaround for Apple bug 3644261 - after using form editor, all boldface * fonts start showing up with incorrect metrics, such that all boldface * fonts in the entire IDE are displayed 12px below where they should be. * Embarrassing and awful. */
Workaround for Apple bug 3644261 - after using form editor, all boldface fonts start showing up with incorrect metrics, such that all boldface fonts in the entire IDE are displayed 12px below where they should be. Embarrassing and awful
deriveFont
{ "repo_name": "autoplot/app", "path": "JythonSupport/src/org/das2/jythoncompletion/ui/PatchedHtmlRenderer.java", "license": "gpl-2.0", "size": 45293 }
[ "java.awt.Font", "org.das2.jythoncompletion.nbadapt.Utilities" ]
import java.awt.Font; import org.das2.jythoncompletion.nbadapt.Utilities;
import java.awt.*; import org.das2.jythoncompletion.nbadapt.*;
[ "java.awt", "org.das2.jythoncompletion" ]
java.awt; org.das2.jythoncompletion;
750,658
public void setLocale(Locale locale) { fLocale = locale; fErrorReporter.setLocale(locale); } // setLocale(Locale)
void function(Locale locale) { fLocale = locale; fErrorReporter.setLocale(locale); }
/** * Set the locale to use for messages. * * @param locale The locale object to use for localization of messages. * * @exception XNIException Thrown if the parser does not support the * specified locale. */
Set the locale to use for messages
setLocale
{ "repo_name": "BartoszJarocki/boilerpipe-android", "path": "src/main/java/mf/org/apache/xerces/impl/dtd/XMLDTDLoader.java", "license": "apache-2.0", "size": 20380 }
[ "java.util.Locale" ]
import java.util.Locale;
import java.util.*;
[ "java.util" ]
java.util;
1,177,278
public FileSystem createFalconFileSystem(final URI uri) throws FalconException { Validate.notNull(uri, "uri cannot be null"); try { Configuration conf = new Configuration(); if (UserGroupInformation.isSecurityEnabled()) { conf.set(SecurityUtil.NN_PRINCIPAL, StartupProperties.get().getProperty(SecurityUtil.NN_PRINCIPAL)); } return createFileSystem(UserGroupInformation.getLoginUser(), uri, conf); } catch (IOException e) { throw new FalconException("Exception while getting FileSystem for: " + uri, e); } }
FileSystem function(final URI uri) throws FalconException { Validate.notNull(uri, STR); try { Configuration conf = new Configuration(); if (UserGroupInformation.isSecurityEnabled()) { conf.set(SecurityUtil.NN_PRINCIPAL, StartupProperties.get().getProperty(SecurityUtil.NN_PRINCIPAL)); } return createFileSystem(UserGroupInformation.getLoginUser(), uri, conf); } catch (IOException e) { throw new FalconException(STR + uri, e); } }
/** * This method is only used by Falcon internally to talk to the config store on HDFS. * * @param uri file system URI for config store. * @return FileSystem created with the provided proxyUser/group. * @throws org.apache.falcon.FalconException * if the filesystem could not be created. */
This method is only used by Falcon internally to talk to the config store on HDFS
createFalconFileSystem
{ "repo_name": "PraveenAdlakha/falcon", "path": "common/src/main/java/org/apache/falcon/hadoop/HadoopClientFactory.java", "license": "apache-2.0", "size": 14898 }
[ "java.io.IOException", "org.apache.commons.lang.Validate", "org.apache.falcon.FalconException", "org.apache.falcon.security.SecurityUtil", "org.apache.falcon.util.StartupProperties", "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.fs.FileSystem", "org.apache.hadoop.security.UserGroupInformation" ]
import java.io.IOException; import org.apache.commons.lang.Validate; import org.apache.falcon.FalconException; import org.apache.falcon.security.SecurityUtil; import org.apache.falcon.util.StartupProperties; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.security.UserGroupInformation;
import java.io.*; import org.apache.commons.lang.*; import org.apache.falcon.*; import org.apache.falcon.security.*; import org.apache.falcon.util.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.security.*;
[ "java.io", "org.apache.commons", "org.apache.falcon", "org.apache.hadoop" ]
java.io; org.apache.commons; org.apache.falcon; org.apache.hadoop;
1,401,722
Response<NamespaceResource> getByIdWithResponse(String id, Context context);
Response<NamespaceResource> getByIdWithResponse(String id, Context context);
/** * Returns the description for the specified namespace. * * @param id the resource ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return description of a Namespace resource. */
Returns the description for the specified namespace
getByIdWithResponse
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/notificationhubs/azure-resourcemanager-notificationhubs/src/main/java/com/azure/resourcemanager/notificationhubs/models/Namespaces.java", "license": "mit", "size": 20638 }
[ "com.azure.core.http.rest.Response", "com.azure.core.util.Context" ]
import com.azure.core.http.rest.Response; import com.azure.core.util.Context;
import com.azure.core.http.rest.*; import com.azure.core.util.*;
[ "com.azure.core" ]
com.azure.core;
2,533,517
@GET @GZIP @Path("jobs/{jobid}/result/log/all") @Produces("application/json") String jobLogs(@HeaderParam("sessionid") String sessionId, @PathParam("jobid") String jobId) throws NotConnectedRestException, UnknownJobRestException, UnknownTaskRestException, PermissionRestException;
@Path(STR) @Produces(STR) String jobLogs(@HeaderParam(STR) String sessionId, @PathParam("jobid") String jobId) throws NotConnectedRestException, UnknownJobRestException, UnknownTaskRestException, PermissionRestException;
/** * Returns all the logs generated by the job (either stdout and stderr) * * When tasks inside this jobs have several execution attempts, only last attempt logs with be contained in the job log. * * Multiple attempts are available using "jobs/{jobid}/log/full" rest endpoint. * * @param sessionId * a valid session id * @param jobId * the id of the job * @return all the logs generated by the job (either stdout and stderr) or * an empty string if the result is not yet available */
Returns all the logs generated by the job (either stdout and stderr) When tasks inside this jobs have several execution attempts, only last attempt logs with be contained in the job log. Multiple attempts are available using "jobs/{jobid}/log/full" rest endpoint
jobLogs
{ "repo_name": "tobwiens/scheduling", "path": "rest/rest-api/src/main/java/org/ow2/proactive_grid_cloud_portal/common/SchedulerRestInterface.java", "license": "agpl-3.0", "size": 80291 }
[ "javax.ws.rs.HeaderParam", "javax.ws.rs.Path", "javax.ws.rs.PathParam", "javax.ws.rs.Produces", "org.ow2.proactive_grid_cloud_portal.scheduler.exception.NotConnectedRestException", "org.ow2.proactive_grid_cloud_portal.scheduler.exception.PermissionRestException", "org.ow2.proactive_grid_cloud_portal.scheduler.exception.UnknownJobRestException", "org.ow2.proactive_grid_cloud_portal.scheduler.exception.UnknownTaskRestException" ]
import javax.ws.rs.HeaderParam; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import org.ow2.proactive_grid_cloud_portal.scheduler.exception.NotConnectedRestException; import org.ow2.proactive_grid_cloud_portal.scheduler.exception.PermissionRestException; import org.ow2.proactive_grid_cloud_portal.scheduler.exception.UnknownJobRestException; import org.ow2.proactive_grid_cloud_portal.scheduler.exception.UnknownTaskRestException;
import javax.ws.rs.*; import org.ow2.proactive_grid_cloud_portal.scheduler.exception.*;
[ "javax.ws", "org.ow2.proactive_grid_cloud_portal" ]
javax.ws; org.ow2.proactive_grid_cloud_portal;
443,752
public InputStream getResourceAsStream(String name);
InputStream function(String name);
/** * Retrieves the named resource. This allows resources to be * obtained without specifying how they are retrieved. */
Retrieves the named resource. This allows resources to be obtained without specifying how they are retrieved
getResourceAsStream
{ "repo_name": "austinv11/CollectiveFramework", "path": "src/main/java/rehost/javazoom/jl/decoder/JavaLayerHook.java", "license": "gpl-2.0", "size": 1378 }
[ "java.io.InputStream" ]
import java.io.InputStream;
import java.io.*;
[ "java.io" ]
java.io;
2,577,275
@ServiceMethod(returns = ReturnType.SINGLE) PollerFlux<PollResult<Void>, Void> beginRedeployAsync(String resourceGroupName, String vmName);
@ServiceMethod(returns = ReturnType.SINGLE) PollerFlux<PollResult<Void>, Void> beginRedeployAsync(String resourceGroupName, String vmName);
/** * Shuts down the virtual machine, moves it to a new node, and powers it back on. * * @param resourceGroupName The name of the resource group. * @param vmName The name of the virtual machine. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */
Shuts down the virtual machine, moves it to a new node, and powers it back on
beginRedeployAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/fluent/VirtualMachinesClient.java", "license": "mit", "size": 106942 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.management.polling.PollResult", "com.azure.core.util.polling.PollerFlux" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.management.polling.PollResult; import com.azure.core.util.polling.PollerFlux;
import com.azure.core.annotation.*; import com.azure.core.management.polling.*; import com.azure.core.util.polling.*;
[ "com.azure.core" ]
com.azure.core;
2,054,138
public double getDragViewOffsetY() { return peer.getDragViewOffsetY(); } static { // This is used by classes in different packages to get access to // private and package private methods. DragboardHelper.setDragboardAccessor((dragboard, restricted) -> { dragboard.dataAccessRestricted = restricted; }); }
double function() { return peer.getDragViewOffsetY(); } static { DragboardHelper.setDragboardAccessor((dragboard, restricted) -> { dragboard.dataAccessRestricted = restricted; }); }
/** * Gets the y position of the cursor of the drag view image. * This method returns meaningful value only when starting drag and drop * operation in the DRAG_DETECTED handler, it returns 0 at other times. * @return y position of the cursor over the image * @since JavaFX 8.0 */
Gets the y position of the cursor of the drag view image. This method returns meaningful value only when starting drag and drop operation in the DRAG_DETECTED handler, it returns 0 at other times
getDragViewOffsetY
{ "repo_name": "loveyoupeng/rt", "path": "modules/graphics/src/main/java/javafx/scene/input/Dragboard.java", "license": "gpl-2.0", "size": 6577 }
[ "com.sun.javafx.scene.input.DragboardHelper" ]
import com.sun.javafx.scene.input.DragboardHelper;
import com.sun.javafx.scene.input.*;
[ "com.sun.javafx" ]
com.sun.javafx;
2,558,448
private void disableMonitoring() throws Exception { if (isMonitoringTest()) { final Map<String, Object> settings = new HashMap<>(); settings.put("xpack.monitoring.collection.enabled", null); settings.put("xpack.monitoring.collection.interval", null); settings.put("xpack.monitoring.exporters._local.enabled", null); awaitCallApi("cluster.put_settings", emptyMap(), singletonList(singletonMap("transient", settings)), response -> { Object acknowledged = response.evaluate("acknowledged"); return acknowledged != null && (Boolean) acknowledged; }, () -> "Exception when disabling monitoring"); assertBusy(() -> { try { ClientYamlTestResponse response = callApi("xpack.usage", singletonMap("filter_path", "monitoring.enabled_exporters"), emptyList(), getApiCallHeaders()); @SuppressWarnings("unchecked") final Map<String, ?> exporters = (Map<String, ?>) response.evaluate("monitoring.enabled_exporters"); if (exporters.isEmpty() == false) { fail("Exporters were not found"); } final Map<String, String> params = new HashMap<>(); params.put("node_id", "_local"); params.put("metric", "thread_pool"); params.put("filter_path", "nodes.*.thread_pool.write.active"); response = callApi("nodes.stats", params, emptyList(), getApiCallHeaders()); @SuppressWarnings("unchecked") final Map<String, Object> nodes = (Map<String, Object>) response.evaluate("nodes"); @SuppressWarnings("unchecked") final Map<String, Object> node = (Map<String, Object>) nodes.values().iterator().next(); final Number activeWrites = (Number) extractValue("thread_pool.write.active", node); assertNotNull(activeWrites); assertThat(activeWrites, equalTo(0)); } catch (Exception e) { throw new ElasticsearchException("Failed to wait for monitoring exporters to stop:", e); } }); } }
void function() throws Exception { if (isMonitoringTest()) { final Map<String, Object> settings = new HashMap<>(); settings.put(STR, null); settings.put(STR, null); settings.put(STR, null); awaitCallApi(STR, emptyMap(), singletonList(singletonMap(STR, settings)), response -> { Object acknowledged = response.evaluate(STR); return acknowledged != null && (Boolean) acknowledged; }, () -> STR); assertBusy(() -> { try { ClientYamlTestResponse response = callApi(STR, singletonMap(STR, STR), emptyList(), getApiCallHeaders()); @SuppressWarnings(STR) final Map<String, ?> exporters = (Map<String, ?>) response.evaluate(STR); if (exporters.isEmpty() == false) { fail(STR); } final Map<String, String> params = new HashMap<>(); params.put(STR, STR); params.put(STR, STR); params.put(STR, STR); response = callApi(STR, params, emptyList(), getApiCallHeaders()); @SuppressWarnings(STR) final Map<String, Object> nodes = (Map<String, Object>) response.evaluate("nodes"); @SuppressWarnings(STR) final Map<String, Object> node = (Map<String, Object>) nodes.values().iterator().next(); final Number activeWrites = (Number) extractValue(STR, node); assertNotNull(activeWrites); assertThat(activeWrites, equalTo(0)); } catch (Exception e) { throw new ElasticsearchException(STR, e); } }); } }
/** * Disable monitoring */
Disable monitoring
disableMonitoring
{ "repo_name": "robin13/elasticsearch", "path": "x-pack/plugin/src/test/java/org/elasticsearch/xpack/test/rest/AbstractXPackRestTest.java", "license": "apache-2.0", "size": 12597 }
[ "java.util.Collections", "java.util.HashMap", "java.util.Map", "org.elasticsearch.ElasticsearchException", "org.elasticsearch.common.xcontent.support.XContentMapValues", "org.elasticsearch.test.rest.yaml.ClientYamlTestResponse", "org.hamcrest.Matchers" ]
import java.util.Collections; import java.util.HashMap; import java.util.Map; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.common.xcontent.support.XContentMapValues; import org.elasticsearch.test.rest.yaml.ClientYamlTestResponse; import org.hamcrest.Matchers;
import java.util.*; import org.elasticsearch.*; import org.elasticsearch.common.xcontent.support.*; import org.elasticsearch.test.rest.yaml.*; import org.hamcrest.*;
[ "java.util", "org.elasticsearch", "org.elasticsearch.common", "org.elasticsearch.test", "org.hamcrest" ]
java.util; org.elasticsearch; org.elasticsearch.common; org.elasticsearch.test; org.hamcrest;
2,467,470
@Message(id = 82, value = "The password must be different from the username") PasswordValidationException passwordUsernameMatchError();
@Message(id = 82, value = STR) PasswordValidationException passwordUsernameMatchError();
/** * Error message if the password and username match. * * @return an {@link PasswordValidationException} for the error. */
Error message if the password and username match
passwordUsernameMatchError
{ "repo_name": "luck3y/wildfly-core", "path": "domain-management/src/main/java/org/jboss/as/domain/management/logging/DomainManagementLogger.java", "license": "lgpl-2.1", "size": 66410 }
[ "org.jboss.as.domain.management.security.password.PasswordValidationException", "org.jboss.logging.annotations.Message" ]
import org.jboss.as.domain.management.security.password.PasswordValidationException; import org.jboss.logging.annotations.Message;
import org.jboss.as.domain.management.security.password.*; import org.jboss.logging.annotations.*;
[ "org.jboss.as", "org.jboss.logging" ]
org.jboss.as; org.jboss.logging;
707,573
public int read() throws IOException { synchronized (lock) { ensureOpen(); for (;;) { if (nextChar >= nChars) { fill(); if (nextChar >= nChars) return -1; } if (skipLF) { skipLF = false; if (cb[nextChar] == '\n') { nextChar++; continue; } } return cb[nextChar++]; } } }
int function() throws IOException { synchronized (lock) { ensureOpen(); for (;;) { if (nextChar >= nChars) { fill(); if (nextChar >= nChars) return -1; } if (skipLF) { skipLF = false; if (cb[nextChar] == '\n') { nextChar++; continue; } } return cb[nextChar++]; } } }
/** * Reads a single character. * * @return The character read, as an integer in the range * 0 to 65535 (<tt>0x00-0xffff</tt>), or -1 if the * end of the stream has been reached * @exception IOException If an I/O error occurs */
Reads a single character
read
{ "repo_name": "shahankhatch/ScalableGraphSummaries", "path": "SGBGraphChi/src/main/java/edu/toronto/cs/sgb/util/CustomBufferedReader.java", "license": "apache-2.0", "size": 20689 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,143,401
log.info("Buscando empresa por CNPJ: {}", cnpj); Response<EmpresaDto> response = new Response<EmpresaDto>(); Optional<Empresa> empresa = empresaService.buscarPorCnpj(cnpj); if (!empresa.isPresent()) { log.info("Empresa não encontrada para o CNPJ: {}", cnpj); response.getErrors().add("Empresa não encontrada para o CNPJ " + cnpj); return ResponseEntity.badRequest().body(response); } response.setData(this.converterEmpresaDto(empresa.get())); return ResponseEntity.ok(response); }
log.info(STR, cnpj); Response<EmpresaDto> response = new Response<EmpresaDto>(); Optional<Empresa> empresa = empresaService.buscarPorCnpj(cnpj); if (!empresa.isPresent()) { log.info(STR, cnpj); response.getErrors().add(STR + cnpj); return ResponseEntity.badRequest().body(response); } response.setData(this.converterEmpresaDto(empresa.get())); return ResponseEntity.ok(response); }
/** * Retorna uma empresa dado um CNPJ. * * @param cnpj * @return ResponseEntity<Response<EmpresaDto>> */
Retorna uma empresa dado um CNPJ
buscarPorCnpj
{ "repo_name": "juanleirojl/ponto-inteligente-api", "path": "src/main/java/com/jlit/pontointeligente/api/controllers/EmpresaController.java", "license": "mit", "size": 2196 }
[ "com.jlit.pontointeligente.api.dtos.EmpresaDto", "com.jlit.pontointeligente.api.entities.Empresa", "com.jlit.pontointeligente.api.response.Response", "java.util.Optional", "org.springframework.http.ResponseEntity" ]
import com.jlit.pontointeligente.api.dtos.EmpresaDto; import com.jlit.pontointeligente.api.entities.Empresa; import com.jlit.pontointeligente.api.response.Response; import java.util.Optional; import org.springframework.http.ResponseEntity;
import com.jlit.pontointeligente.api.dtos.*; import com.jlit.pontointeligente.api.entities.*; import com.jlit.pontointeligente.api.response.*; import java.util.*; import org.springframework.http.*;
[ "com.jlit.pontointeligente", "java.util", "org.springframework.http" ]
com.jlit.pontointeligente; java.util; org.springframework.http;
1,575,469
public static final void setRouting(Map map, Edge.Routing routing) { map.put(ROUTING, routing); }
static final void function(Map map, Edge.Routing routing) { map.put(ROUTING, routing); }
/** * Sets the routing attribute in the specified map to the specified value. */
Sets the routing attribute in the specified map to the specified value
setRouting
{ "repo_name": "Baltasarq/Gia", "path": "src/JGraph/src/org/jgraph/graph/GraphConstants.java", "license": "mit", "size": 48823 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,183,846
@SuppressWarnings("unused") private void setZoom(JSONArray args, CallbackContext callbackContext) throws JSONException { Long zoom; zoom = args.getLong(1); this.myMoveCamera(CameraUpdateFactory.zoomTo(zoom), callbackContext); }
@SuppressWarnings(STR) void function(JSONArray args, CallbackContext callbackContext) throws JSONException { Long zoom; zoom = args.getLong(1); this.myMoveCamera(CameraUpdateFactory.zoomTo(zoom), callbackContext); }
/** * Set zoom of the map * @param args * @param callbackContext * @throws JSONException */
Set zoom of the map
setZoom
{ "repo_name": "smcpjames/cordova-plugin-googlemaps", "path": "src/android/plugin/google/maps/PluginMap.java", "license": "apache-2.0", "size": 23075 }
[ "com.google.android.gms.maps.CameraUpdateFactory", "org.apache.cordova.CallbackContext", "org.json.JSONArray", "org.json.JSONException" ]
import com.google.android.gms.maps.CameraUpdateFactory; import org.apache.cordova.CallbackContext; import org.json.JSONArray; import org.json.JSONException;
import com.google.android.gms.maps.*; import org.apache.cordova.*; import org.json.*;
[ "com.google.android", "org.apache.cordova", "org.json" ]
com.google.android; org.apache.cordova; org.json;
2,240,921
public void testSameType() { for (XMLAttributeDefaultType a : samples()) { for (XMLAttributeDefaultType b : samples()) { if (a != null && b != null) { if (a.equals(b)) { assertTrue("sameType fails", a.sameType(b)); } } } } }
void function() { for (XMLAttributeDefaultType a : samples()) { for (XMLAttributeDefaultType b : samples()) { if (a != null && b != null) { if (a.equals(b)) { assertTrue(STR, a.sameType(b)); } } } } }
/** Test {@link XMLAttributeDefaultType#sameType(XMLAttributeDefaultType)}. */
Test <code>XMLAttributeDefaultType#sameType(XMLAttributeDefaultType)</code>
testSameType
{ "repo_name": "conormcd/exemplar", "path": "tests/junit/src/junit/com/mcdermottroe/exemplar/model/XMLAttributeDefaultTypeTest.java", "license": "bsd-3-clause", "size": 5431 }
[ "com.mcdermottroe.exemplar.model.XMLAttributeDefaultType" ]
import com.mcdermottroe.exemplar.model.XMLAttributeDefaultType;
import com.mcdermottroe.exemplar.model.*;
[ "com.mcdermottroe.exemplar" ]
com.mcdermottroe.exemplar;
2,236,656
public static String getPasswordResetUsername(final RequestContext requestContext) { val flowScope = requestContext.getFlowScope(); return flowScope.getString("username"); }
static String function(final RequestContext requestContext) { val flowScope = requestContext.getFlowScope(); return flowScope.getString(STR); }
/** * Gets password reset username. * * @param requestContext the request context * @return the password reset username */
Gets password reset username
getPasswordResetUsername
{ "repo_name": "rrenomeron/cas", "path": "support/cas-server-support-pm-webflow/src/main/java/org/apereo/cas/pm/web/flow/PasswordManagementWebflowUtils.java", "license": "apache-2.0", "size": 4079 }
[ "org.springframework.webflow.execution.RequestContext" ]
import org.springframework.webflow.execution.RequestContext;
import org.springframework.webflow.execution.*;
[ "org.springframework.webflow" ]
org.springframework.webflow;
2,246,017
@ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux<TableEntity> listEntities() { return listEntities(new ListEntitiesOptions()); }
@ServiceMethod(returns = ReturnType.COLLECTION) PagedFlux<TableEntity> function() { return listEntities(new ListEntitiesOptions()); }
/** * Lists all entities within the table. * * @return A paged reactive result containing all entities within the table. */
Lists all entities within the table
listEntities
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableAsyncClient.java", "license": "mit", "size": 41804 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedFlux", "com.azure.data.tables.models.ListEntitiesOptions", "com.azure.data.tables.models.TableEntity" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedFlux; import com.azure.data.tables.models.ListEntitiesOptions; import com.azure.data.tables.models.TableEntity;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.data.tables.models.*;
[ "com.azure.core", "com.azure.data" ]
com.azure.core; com.azure.data;
1,594,641
public static int mysqlToJavaType(String mysqlType) { if (mysqlType.equalsIgnoreCase("BIT")) { return mysqlToJavaType(FIELD_TYPE_BIT); } else if (mysqlType.equalsIgnoreCase("TINYINT")) { return mysqlToJavaType(FIELD_TYPE_TINY); } else if (mysqlType.equalsIgnoreCase("SMALLINT")) { return mysqlToJavaType(FIELD_TYPE_SHORT); } else if (mysqlType.equalsIgnoreCase("MEDIUMINT")) { return mysqlToJavaType(FIELD_TYPE_INT24); } else if (mysqlType.equalsIgnoreCase("INT") || mysqlType.equalsIgnoreCase("INTEGER")) { return mysqlToJavaType(FIELD_TYPE_LONG); } else if (mysqlType.equalsIgnoreCase("BIGINT")) { return mysqlToJavaType(FIELD_TYPE_LONGLONG); } else if (mysqlType.equalsIgnoreCase("INT24")) { return mysqlToJavaType(FIELD_TYPE_INT24); } else if (mysqlType.equalsIgnoreCase("REAL")) { return mysqlToJavaType(FIELD_TYPE_DOUBLE); } else if (mysqlType.equalsIgnoreCase("FLOAT")) { return mysqlToJavaType(FIELD_TYPE_FLOAT); } else if (mysqlType.equalsIgnoreCase("DECIMAL")) { return mysqlToJavaType(FIELD_TYPE_DECIMAL); } else if (mysqlType.equalsIgnoreCase("NUMERIC")) { return mysqlToJavaType(FIELD_TYPE_DECIMAL); } else if (mysqlType.equalsIgnoreCase("DOUBLE")) { return mysqlToJavaType(FIELD_TYPE_DOUBLE); } else if (mysqlType.equalsIgnoreCase("CHAR")) { return mysqlToJavaType(FIELD_TYPE_STRING); } else if (mysqlType.equalsIgnoreCase("VARCHAR")) { return mysqlToJavaType(FIELD_TYPE_VAR_STRING); } else if (mysqlType.equalsIgnoreCase("DATE")) { return mysqlToJavaType(FIELD_TYPE_DATE); } else if (mysqlType.equalsIgnoreCase("TIME")) { return mysqlToJavaType(FIELD_TYPE_TIME); } else if (mysqlType.equalsIgnoreCase("YEAR")) { return mysqlToJavaType(FIELD_TYPE_YEAR); } else if (mysqlType.equalsIgnoreCase("TIMESTAMP")) { return mysqlToJavaType(FIELD_TYPE_TIMESTAMP); } else if (mysqlType.equalsIgnoreCase("DATETIME")) { return mysqlToJavaType(FIELD_TYPE_DATETIME); } else if (mysqlType.equalsIgnoreCase("TINYBLOB")) { return Types.BINARY; } else if (mysqlType.equalsIgnoreCase("BLOB")) { return Types.LONGVARBINARY; } else if (mysqlType.equalsIgnoreCase("MEDIUMBLOB")) { return Types.LONGVARBINARY; } else if (mysqlType.equalsIgnoreCase("LONGBLOB")) { return Types.LONGVARBINARY; } else if (mysqlType.equalsIgnoreCase("TINYTEXT")) { return Types.VARCHAR; } else if (mysqlType.equalsIgnoreCase("TEXT")) { return Types.LONGVARCHAR; } else if (mysqlType.equalsIgnoreCase("MEDIUMTEXT")) { return Types.LONGVARCHAR; } else if (mysqlType.equalsIgnoreCase("LONGTEXT")) { return Types.LONGVARCHAR; } else if (mysqlType.equalsIgnoreCase("ENUM")) { return mysqlToJavaType(FIELD_TYPE_ENUM); } else if (mysqlType.equalsIgnoreCase("SET")) { return mysqlToJavaType(FIELD_TYPE_SET); } else if (mysqlType.equalsIgnoreCase("GEOMETRY")) { return mysqlToJavaType(FIELD_TYPE_GEOMETRY); } else if (mysqlType.equalsIgnoreCase("BINARY")) { return Types.BINARY; // no concrete type on the wire } else if (mysqlType.equalsIgnoreCase("VARBINARY")) { return Types.VARBINARY; // no concrete type on the wire } else if (mysqlType.equalsIgnoreCase("BIT")) { return mysqlToJavaType(FIELD_TYPE_BIT); } else if (mysqlType.equalsIgnoreCase("JSON")) { return mysqlToJavaType(FIELD_TYPE_JSON); } // Punt return Types.OTHER; }
static int function(String mysqlType) { if (mysqlType.equalsIgnoreCase("BIT")) { return mysqlToJavaType(FIELD_TYPE_BIT); } else if (mysqlType.equalsIgnoreCase(STR)) { return mysqlToJavaType(FIELD_TYPE_TINY); } else if (mysqlType.equalsIgnoreCase(STR)) { return mysqlToJavaType(FIELD_TYPE_SHORT); } else if (mysqlType.equalsIgnoreCase(STR)) { return mysqlToJavaType(FIELD_TYPE_INT24); } else if (mysqlType.equalsIgnoreCase("INT") mysqlType.equalsIgnoreCase(STR)) { return mysqlToJavaType(FIELD_TYPE_LONG); } else if (mysqlType.equalsIgnoreCase(STR)) { return mysqlToJavaType(FIELD_TYPE_LONGLONG); } else if (mysqlType.equalsIgnoreCase("INT24")) { return mysqlToJavaType(FIELD_TYPE_INT24); } else if (mysqlType.equalsIgnoreCase("REAL")) { return mysqlToJavaType(FIELD_TYPE_DOUBLE); } else if (mysqlType.equalsIgnoreCase("FLOAT")) { return mysqlToJavaType(FIELD_TYPE_FLOAT); } else if (mysqlType.equalsIgnoreCase(STR)) { return mysqlToJavaType(FIELD_TYPE_DECIMAL); } else if (mysqlType.equalsIgnoreCase(STR)) { return mysqlToJavaType(FIELD_TYPE_DECIMAL); } else if (mysqlType.equalsIgnoreCase(STR)) { return mysqlToJavaType(FIELD_TYPE_DOUBLE); } else if (mysqlType.equalsIgnoreCase("CHAR")) { return mysqlToJavaType(FIELD_TYPE_STRING); } else if (mysqlType.equalsIgnoreCase(STR)) { return mysqlToJavaType(FIELD_TYPE_VAR_STRING); } else if (mysqlType.equalsIgnoreCase("DATE")) { return mysqlToJavaType(FIELD_TYPE_DATE); } else if (mysqlType.equalsIgnoreCase("TIME")) { return mysqlToJavaType(FIELD_TYPE_TIME); } else if (mysqlType.equalsIgnoreCase("YEAR")) { return mysqlToJavaType(FIELD_TYPE_YEAR); } else if (mysqlType.equalsIgnoreCase(STR)) { return mysqlToJavaType(FIELD_TYPE_TIMESTAMP); } else if (mysqlType.equalsIgnoreCase(STR)) { return mysqlToJavaType(FIELD_TYPE_DATETIME); } else if (mysqlType.equalsIgnoreCase(STR)) { return Types.BINARY; } else if (mysqlType.equalsIgnoreCase("BLOB")) { return Types.LONGVARBINARY; } else if (mysqlType.equalsIgnoreCase(STR)) { return Types.LONGVARBINARY; } else if (mysqlType.equalsIgnoreCase(STR)) { return Types.LONGVARBINARY; } else if (mysqlType.equalsIgnoreCase(STR)) { return Types.VARCHAR; } else if (mysqlType.equalsIgnoreCase("TEXT")) { return Types.LONGVARCHAR; } else if (mysqlType.equalsIgnoreCase(STR)) { return Types.LONGVARCHAR; } else if (mysqlType.equalsIgnoreCase(STR)) { return Types.LONGVARCHAR; } else if (mysqlType.equalsIgnoreCase("ENUM")) { return mysqlToJavaType(FIELD_TYPE_ENUM); } else if (mysqlType.equalsIgnoreCase("SET")) { return mysqlToJavaType(FIELD_TYPE_SET); } else if (mysqlType.equalsIgnoreCase(STR)) { return mysqlToJavaType(FIELD_TYPE_GEOMETRY); } else if (mysqlType.equalsIgnoreCase(STR)) { return Types.BINARY; } else if (mysqlType.equalsIgnoreCase(STR)) { return Types.VARBINARY; } else if (mysqlType.equalsIgnoreCase("BIT")) { return mysqlToJavaType(FIELD_TYPE_BIT); } else if (mysqlType.equalsIgnoreCase("JSON")) { return mysqlToJavaType(FIELD_TYPE_JSON); } return Types.OTHER; }
/** * Maps the given MySQL type to the correct JDBC type. */
Maps the given MySQL type to the correct JDBC type
mysqlToJavaType
{ "repo_name": "mapbased/vitess", "path": "java/jdbc/src/main/java/com/flipkart/vitess/util/MysqlDefs.java", "license": "bsd-3-clause", "size": 19689 }
[ "java.sql.Types" ]
import java.sql.Types;
import java.sql.*;
[ "java.sql" ]
java.sql;
2,664,908
@Private @VisibleForTesting public static int parseMaximumHeapSizeMB(String javaOpts) { // Find the last matching -Xmx following word boundaries Matcher m = JAVA_OPTS_XMX_PATTERN.matcher(javaOpts); if (m.matches()) { int size = Integer.parseInt(m.group(1)); if (size <= 0) { return -1; } if (m.group(2).isEmpty()) { // -Xmx specified in bytes return size / (1024 * 1024); } char unit = m.group(2).charAt(0); switch (unit) { case 'g': case 'G': // -Xmx specified in GB return size * 1024; case 'm': case 'M': // -Xmx specified in MB return size; case 'k': case 'K': // -Xmx specified in KB return size / 1024; } } // -Xmx not specified return -1; }
static int function(String javaOpts) { Matcher m = JAVA_OPTS_XMX_PATTERN.matcher(javaOpts); if (m.matches()) { int size = Integer.parseInt(m.group(1)); if (size <= 0) { return -1; } if (m.group(2).isEmpty()) { return size / (1024 * 1024); } char unit = m.group(2).charAt(0); switch (unit) { case 'g': case 'G': return size * 1024; case 'm': case 'M': return size; case 'k': case 'K': return size / 1024; } } return -1; }
/** * Parse the Maximum heap size from the java opts as specified by the -Xmx option * Format: -Xmx<size>[g|G|m|M|k|K] * @param javaOpts String to parse to read maximum heap size * @return Maximum heap size in MB or -1 if not specified */
Parse the Maximum heap size from the java opts as specified by the -Xmx option Format: -Xmx[g|G|m|M|k|K]
parseMaximumHeapSizeMB
{ "repo_name": "vesense/hadoop", "path": "hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/JobConf.java", "license": "apache-2.0", "size": 73573 }
[ "java.util.regex.Matcher" ]
import java.util.regex.Matcher;
import java.util.regex.*;
[ "java.util" ]
java.util;
1,106,893
private void processImport(DetailAST ast) { final FullIdent name = FullIdent.createFullIdentBelow(ast); imports.add(name.getText()); }
void function(DetailAST ast) { final FullIdent name = FullIdent.createFullIdentBelow(ast); imports.add(name.getText()); }
/** * Collects the details of imports. * @param ast node containing the import details */
Collects the details of imports
processImport
{ "repo_name": "sharang108/checkstyle", "path": "src/main/java/com/puppycrawl/tools/checkstyle/checks/AbstractTypeAwareCheck.java", "license": "lgpl-2.1", "size": 19479 }
[ "com.puppycrawl.tools.checkstyle.api.DetailAST", "com.puppycrawl.tools.checkstyle.api.FullIdent" ]
import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.FullIdent;
import com.puppycrawl.tools.checkstyle.api.*;
[ "com.puppycrawl.tools" ]
com.puppycrawl.tools;
2,536,387
public static byte[] readStream(InputStream inStream) throws Exception { ByteArrayOutputStream outStream = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int len = 0; while ((len = inStream.read(buffer)) != -1) { outStream.write(buffer, 0, len); } outStream.close(); inStream.close(); return outStream.toByteArray(); }
static byte[] function(InputStream inStream) throws Exception { ByteArrayOutputStream outStream = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int len = 0; while ((len = inStream.read(buffer)) != -1) { outStream.write(buffer, 0, len); } outStream.close(); inStream.close(); return outStream.toByteArray(); }
/** * Get data from stream * * @param inStream * @return byte[] * @throws Exception */
Get data from stream
readStream
{ "repo_name": "LibGdxGitHub2013/LoadImage", "path": "src/com/example/loadimage/MainActivity.java", "license": "epl-1.0", "size": 6369 }
[ "java.io.ByteArrayOutputStream", "java.io.InputStream" ]
import java.io.ByteArrayOutputStream; import java.io.InputStream;
import java.io.*;
[ "java.io" ]
java.io;
1,127,968
private native JavaScriptObject getVersionInfoJSObject() ;
native JavaScriptObject function() ;
/** * Returns a native javascript object containing version information * from the server. * * @return a javascript object with the version information */
Returns a native javascript object containing version information from the server
getVersionInfoJSObject
{ "repo_name": "Legioth/vaadin", "path": "client/src/main/java/com/vaadin/client/ApplicationConfiguration.java", "license": "apache-2.0", "size": 31124 }
[ "com.google.gwt.core.client.JavaScriptObject" ]
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.*;
[ "com.google.gwt" ]
com.google.gwt;
302,505
@Test public final void testGetOutputsWithType() throws ReadWriteException { final Map<String, Class<?>> outputs = TaxCalculatorFactory.getOutputs(1, 2016); for (final Map.Entry<String, Class<?>> entry : outputs.entrySet()) { System.out.println(entry.getKey() + ": " + entry.getValue().getName()); Assertions.assertTrue(entry.getValue() == BigDecimal.class || entry.getValue() == int.class || entry.getValue() == double.class); } }
final void function() throws ReadWriteException { final Map<String, Class<?>> outputs = TaxCalculatorFactory.getOutputs(1, 2016); for (final Map.Entry<String, Class<?>> entry : outputs.entrySet()) { System.out.println(entry.getKey() + STR + entry.getValue().getName()); Assertions.assertTrue(entry.getValue() == BigDecimal.class entry.getValue() == int.class entry.getValue() == double.class); } }
/** * Test {@link TaxCalculatorFactory#getOutputs(int, int)}. * * @throws ReadWriteException * error */
Test <code>TaxCalculatorFactory#getOutputs(int, int)</code>
testGetOutputsWithType
{ "repo_name": "admiralsmaster/taxcalculator", "path": "src/test/java/info/kuechler/bmf/taxcalculator/rw/FactoryTest.java", "license": "mit", "size": 6326 }
[ "java.math.BigDecimal", "java.util.Map", "org.junit.jupiter.api.Assertions" ]
import java.math.BigDecimal; import java.util.Map; import org.junit.jupiter.api.Assertions;
import java.math.*; import java.util.*; import org.junit.jupiter.api.*;
[ "java.math", "java.util", "org.junit.jupiter" ]
java.math; java.util; org.junit.jupiter;
78,475
public static int countColumn(File file, char delimiter) throws IOException { int count = 0; byte delim = (byte) delimiter; try (FileChannel fc = new RandomAccessFile(file, "r").getChannel()) { MappedByteBuffer buffer = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size()); byte currentChar = -1; byte prevChar = NEW_LINE; while (buffer.hasRemaining()) { currentChar = buffer.get(); if (currentChar == CARRIAGE_RETURN) { currentChar = NEW_LINE; } if (currentChar == delim || (currentChar == NEW_LINE && prevChar != NEW_LINE)) { count++; if (currentChar == NEW_LINE) { break; } } prevChar = currentChar; } // take care of cases where there's no newline at the end of the file if (!(currentChar == -1 || currentChar == NEW_LINE)) { count++; } } return count; }
static int function(File file, char delimiter) throws IOException { int count = 0; byte delim = (byte) delimiter; try (FileChannel fc = new RandomAccessFile(file, "r").getChannel()) { MappedByteBuffer buffer = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size()); byte currentChar = -1; byte prevChar = NEW_LINE; while (buffer.hasRemaining()) { currentChar = buffer.get(); if (currentChar == CARRIAGE_RETURN) { currentChar = NEW_LINE; } if (currentChar == delim (currentChar == NEW_LINE && prevChar != NEW_LINE)) { count++; if (currentChar == NEW_LINE) { break; } } prevChar = currentChar; } if (!(currentChar == -1 currentChar == NEW_LINE)) { count++; } } return count; }
/** * Counts the number of column of the first line in the file. * * @param file dataset * @param delimiter a single character used to separate the data * @throws IOException * @deprecated User edu.cmu.tetrad.io.AbstractDataReader instead. */
Counts the number of column of the first line in the file
countColumn
{ "repo_name": "amurrayw/tetrad", "path": "tetrad-lib/src/main/java/edu/cmu/tetrad/data/BigDataSetUtility.java", "license": "gpl-2.0", "size": 38641 }
[ "java.io.File", "java.io.IOException", "java.io.RandomAccessFile", "java.nio.MappedByteBuffer", "java.nio.channels.FileChannel" ]
import java.io.File; import java.io.IOException; import java.io.RandomAccessFile; import java.nio.MappedByteBuffer; import java.nio.channels.FileChannel;
import java.io.*; import java.nio.*; import java.nio.channels.*;
[ "java.io", "java.nio" ]
java.io; java.nio;
2,126,607
private static void setPreferenceTitle(View parent, int resId) { final TextView title = (TextView) parent.findViewById(android.R.id.title); title.setText(resId); }
static void function(View parent, int resId) { final TextView title = (TextView) parent.findViewById(android.R.id.title); title.setText(resId); }
/** * Set {@link android.R.id#title} for a preference view inflated with * {@link #inflatePreference(LayoutInflater, ViewGroup, View)}. */
Set <code>android.R.id#title</code> for a preference view inflated with <code>#inflatePreference(LayoutInflater, ViewGroup, View)</code>
setPreferenceTitle
{ "repo_name": "Ant-Droid/android_packages_apps_Settings_OLD", "path": "src/com/android/settings/DataUsageSummary.java", "license": "apache-2.0", "size": 111764 }
[ "android.view.View", "android.widget.TextView" ]
import android.view.View; import android.widget.TextView;
import android.view.*; import android.widget.*;
[ "android.view", "android.widget" ]
android.view; android.widget;
1,045,368
boolean removeWorker(Protos.TaskID taskID) throws Exception; class Worker implements Serializable { private static final long serialVersionUID = 1L; private final Protos.TaskID taskID; private final Option<Protos.SlaveID> slaveID; private final Option<String> hostname; private final WorkerState state; private Worker(Protos.TaskID taskID, Option<Protos.SlaveID> slaveID, Option<String> hostname, WorkerState state) { requireNonNull(taskID, "taskID"); requireNonNull(slaveID, "slaveID"); requireNonNull(hostname, "hostname"); requireNonNull(state, "state"); this.taskID = taskID; this.slaveID = slaveID; this.hostname = hostname; this.state = state; }
boolean removeWorker(Protos.TaskID taskID) throws Exception; class Worker implements Serializable { private static final long serialVersionUID = 1L; private final Protos.TaskID taskID; private final Option<Protos.SlaveID> slaveID; private final Option<String> hostname; private final WorkerState state; private Worker(Protos.TaskID taskID, Option<Protos.SlaveID> slaveID, Option<String> hostname, WorkerState state) { requireNonNull(taskID, STR); requireNonNull(slaveID, STR); requireNonNull(hostname, STR); requireNonNull(state, "state"); this.taskID = taskID; this.slaveID = slaveID; this.hostname = hostname; this.state = state; }
/** * Remove a worker from storage. * @return true if the worker existed. */
Remove a worker from storage
removeWorker
{ "repo_name": "oscarceballos/flink-1.3.2", "path": "flink-mesos/src/main/java/org/apache/flink/mesos/runtime/clusterframework/store/MesosWorkerStore.java", "license": "apache-2.0", "size": 5283 }
[ "java.io.Serializable", "java.util.Objects", "org.apache.mesos.Protos" ]
import java.io.Serializable; import java.util.Objects; import org.apache.mesos.Protos;
import java.io.*; import java.util.*; import org.apache.mesos.*;
[ "java.io", "java.util", "org.apache.mesos" ]
java.io; java.util; org.apache.mesos;
420,522
public void characters(char ch[], int start, int len) throws SAXException { this.log ("characters", new String(ch,start,len)); if (super.contentHandler!=null) { super.contentHandler.characters(ch,start,len); } }
void function(char ch[], int start, int len) throws SAXException { this.log (STR, new String(ch,start,len)); if (super.contentHandler!=null) { super.contentHandler.characters(ch,start,len); } }
/** * Receive notification of character data. */
Receive notification of character data
characters
{ "repo_name": "apache/cocoon", "path": "core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/transformation/LogTransformer.java", "license": "apache-2.0", "size": 11564 }
[ "org.xml.sax.SAXException" ]
import org.xml.sax.SAXException;
import org.xml.sax.*;
[ "org.xml.sax" ]
org.xml.sax;
376,093
public void putIndexedVariableProperties(String key, List<Map<String, String>> subKeyValues) { checkNotNull(key); checkNotNull(subKeyValues); for (int idx = 0; idx < subKeyValues.size(); idx++) { final Map<String, String> values = subKeyValues.get(idx); for (Map.Entry<String, String> value : values.entrySet()) { put(key + '.' + idx + '.' + value.getKey(), value.getValue()); } } } // --------------------------------------------------------------------------------------------
void function(String key, List<Map<String, String>> subKeyValues) { checkNotNull(key); checkNotNull(subKeyValues); for (int idx = 0; idx < subKeyValues.size(); idx++) { final Map<String, String> values = subKeyValues.get(idx); for (Map.Entry<String, String> value : values.entrySet()) { put(key + '.' + idx + '.' + value.getKey(), value.getValue()); } } }
/** * Adds an indexed mapping of properties under a common key. * * <p>For example: * * <pre> * schema.fields.0.type = INT, schema.fields.0.name = test * schema.fields.1.name = test2 * </pre> * * <p>The arity of the subKeyValues can differ. */
Adds an indexed mapping of properties under a common key. For example: <code> schema.fields.0.type = INT, schema.fields.0.name = test schema.fields.1.name = test2 </code> The arity of the subKeyValues can differ
putIndexedVariableProperties
{ "repo_name": "ueshin/apache-flink", "path": "flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/DescriptorProperties.java", "license": "apache-2.0", "size": 38931 }
[ "java.util.List", "java.util.Map", "org.apache.flink.util.Preconditions" ]
import java.util.List; import java.util.Map; import org.apache.flink.util.Preconditions;
import java.util.*; import org.apache.flink.util.*;
[ "java.util", "org.apache.flink" ]
java.util; org.apache.flink;
1,847,820
public Future<CommandResult> getDoorOpenEventsAsync() { return read(attributes.get(ATTR_DOOROPENEVENTS)); }
Future<CommandResult> function() { return read(attributes.get(ATTR_DOOROPENEVENTS)); }
/** * Get the <i>Door Open Events</i> attribute [attribute ID <b>0x0004</b>]. * <p> * This attribute holds the number of door open events that have occurred since it was last * zeroed. * <p> * The attribute is of type {@link Integer}. * <p> * The implementation of this attribute by a device is OPTIONAL * * @return the {@link Future<CommandResult>} command result future */
Get the Door Open Events attribute [attribute ID 0x0004]. This attribute holds the number of door open events that have occurred since it was last zeroed. The attribute is of type <code>Integer</code>. The implementation of this attribute by a device is OPTIONAL
getDoorOpenEventsAsync
{ "repo_name": "cschwer/com.zsmartsystems.zigbee", "path": "com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/ZclDoorLockCluster.java", "license": "epl-1.0", "size": 162296 }
[ "com.zsmartsystems.zigbee.CommandResult", "java.util.concurrent.Future" ]
import com.zsmartsystems.zigbee.CommandResult; import java.util.concurrent.Future;
import com.zsmartsystems.zigbee.*; import java.util.concurrent.*;
[ "com.zsmartsystems.zigbee", "java.util" ]
com.zsmartsystems.zigbee; java.util;
997,912
public String getRRGGBB() { Color color = getColor(); StringBuffer sb = new StringBuffer(); sb.append(Util.toHex((byte)color.getRed())) .append(Util.toHex((byte)color.getGreen())) .append(Util.toHex((byte)color.getBlue())); return sb.toString(); } // getRRGGBB
String function() { Color color = getColor(); StringBuffer sb = new StringBuffer(); sb.append(Util.toHex((byte)color.getRed())) .append(Util.toHex((byte)color.getGreen())) .append(Util.toHex((byte)color.getBlue())); return sb.toString(); }
/** * Get Color as RRGGBB hex string for HTML font tag * @return rgb hex value */
Get Color as RRGGBB hex string for HTML font tag
getRRGGBB
{ "repo_name": "geneos/adempiere", "path": "base/src/org/compiere/print/MPrintColor.java", "license": "gpl-2.0", "size": 8024 }
[ "java.awt.Color", "org.compiere.util.Util" ]
import java.awt.Color; import org.compiere.util.Util;
import java.awt.*; import org.compiere.util.*;
[ "java.awt", "org.compiere.util" ]
java.awt; org.compiere.util;
1,531,032
private Element getSchemaDocument(String schemaNamespace, StAXInputSource schemaSource, boolean mustResolve, short referType, Element referElement) { IOException exception = null; Element schemaElement = null; try { final boolean consumeRemainingContent = schemaSource.shouldConsumeRemainingContent(); final XMLStreamReader streamReader = schemaSource.getXMLStreamReader(); final XMLEventReader eventReader = schemaSource.getXMLEventReader(); // check whether the same document has been parsed before. // If so, return the document corresponding to that system id. XSDKey key = null; String schemaId = null; if (referType != XSDDescription.CONTEXT_PREPARSE) { schemaId = XMLEntityManager.expandSystemId(schemaSource.getSystemId(), schemaSource.getBaseSystemId(), false); boolean isDocument = consumeRemainingContent; if (!isDocument) { if (streamReader != null) { isDocument = (streamReader.getEventType() == XMLStreamReader.START_DOCUMENT); } else { isDocument = eventReader.peek().isStartDocument(); } } if (isDocument) { key = new XSDKey(schemaId, referType, schemaNamespace); if ((schemaElement = fTraversed.get(key)) != null) { fLastSchemaWasDuplicate = true; return schemaElement; } } } if (fStAXSchemaParser == null) { fStAXSchemaParser = new StAXSchemaParser(); } fStAXSchemaParser.reset(fSchemaParser, fSymbolTable); if (streamReader != null) { fStAXSchemaParser.parse(streamReader); if (consumeRemainingContent) { while (streamReader.hasNext()) { streamReader.next(); } } } else { fStAXSchemaParser.parse(eventReader); if (consumeRemainingContent) { while (eventReader.hasNext()) { eventReader.nextEvent(); } } } Document schemaDocument = fStAXSchemaParser.getDocument(); schemaElement = schemaDocument != null ? DOMUtil.getRoot(schemaDocument) : null; return getSchemaDocument0(key, schemaId, schemaElement); } catch (XMLStreamException e) { Throwable t = e.getNestedException(); if (t instanceof IOException) { exception = (IOException) t; } else { StAXLocationWrapper slw = new StAXLocationWrapper(); slw.setLocation(e.getLocation()); throw new XMLParseException(slw, e.getMessage(), e); } } catch (IOException e) { exception = e; } return getSchemaDocument1(mustResolve, true, schemaSource, referElement, exception); } // getSchemaDocument(String, StAXInputSource, boolean, short, Element): Element
Element function(String schemaNamespace, StAXInputSource schemaSource, boolean mustResolve, short referType, Element referElement) { IOException exception = null; Element schemaElement = null; try { final boolean consumeRemainingContent = schemaSource.shouldConsumeRemainingContent(); final XMLStreamReader streamReader = schemaSource.getXMLStreamReader(); final XMLEventReader eventReader = schemaSource.getXMLEventReader(); XSDKey key = null; String schemaId = null; if (referType != XSDDescription.CONTEXT_PREPARSE) { schemaId = XMLEntityManager.expandSystemId(schemaSource.getSystemId(), schemaSource.getBaseSystemId(), false); boolean isDocument = consumeRemainingContent; if (!isDocument) { if (streamReader != null) { isDocument = (streamReader.getEventType() == XMLStreamReader.START_DOCUMENT); } else { isDocument = eventReader.peek().isStartDocument(); } } if (isDocument) { key = new XSDKey(schemaId, referType, schemaNamespace); if ((schemaElement = fTraversed.get(key)) != null) { fLastSchemaWasDuplicate = true; return schemaElement; } } } if (fStAXSchemaParser == null) { fStAXSchemaParser = new StAXSchemaParser(); } fStAXSchemaParser.reset(fSchemaParser, fSymbolTable); if (streamReader != null) { fStAXSchemaParser.parse(streamReader); if (consumeRemainingContent) { while (streamReader.hasNext()) { streamReader.next(); } } } else { fStAXSchemaParser.parse(eventReader); if (consumeRemainingContent) { while (eventReader.hasNext()) { eventReader.nextEvent(); } } } Document schemaDocument = fStAXSchemaParser.getDocument(); schemaElement = schemaDocument != null ? DOMUtil.getRoot(schemaDocument) : null; return getSchemaDocument0(key, schemaId, schemaElement); } catch (XMLStreamException e) { Throwable t = e.getNestedException(); if (t instanceof IOException) { exception = (IOException) t; } else { StAXLocationWrapper slw = new StAXLocationWrapper(); slw.setLocation(e.getLocation()); throw new XMLParseException(slw, e.getMessage(), e); } } catch (IOException e) { exception = e; } return getSchemaDocument1(mustResolve, true, schemaSource, referElement, exception); }
/** * getSchemaDocument method uses StAXInputSource to parse a schema document. * @param schemaNamespace * @param schemaSource * @param mustResolve * @param referType * @param referElement * @return A schema Element. */
getSchemaDocument method uses StAXInputSource to parse a schema document
getSchemaDocument
{ "repo_name": "md-5/jdk10", "path": "src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java", "license": "gpl-2.0", "size": 206977 }
[ "com.sun.org.apache.xerces.internal.impl.XMLEntityManager", "com.sun.org.apache.xerces.internal.impl.xs.XSDDescription", "com.sun.org.apache.xerces.internal.util.DOMUtil", "com.sun.org.apache.xerces.internal.util.StAXInputSource", "com.sun.org.apache.xerces.internal.util.StAXLocationWrapper", "com.sun.org.apache.xerces.internal.xni.parser.XMLParseException", "java.io.IOException", "javax.xml.stream.XMLEventReader", "javax.xml.stream.XMLStreamException", "javax.xml.stream.XMLStreamReader", "org.w3c.dom.Document", "org.w3c.dom.Element" ]
import com.sun.org.apache.xerces.internal.impl.XMLEntityManager; import com.sun.org.apache.xerces.internal.impl.xs.XSDDescription; import com.sun.org.apache.xerces.internal.util.DOMUtil; import com.sun.org.apache.xerces.internal.util.StAXInputSource; import com.sun.org.apache.xerces.internal.util.StAXLocationWrapper; import com.sun.org.apache.xerces.internal.xni.parser.XMLParseException; import java.io.IOException; import javax.xml.stream.XMLEventReader; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import org.w3c.dom.Document; import org.w3c.dom.Element;
import com.sun.org.apache.xerces.internal.impl.*; import com.sun.org.apache.xerces.internal.impl.xs.*; import com.sun.org.apache.xerces.internal.util.*; import com.sun.org.apache.xerces.internal.xni.parser.*; import java.io.*; import javax.xml.stream.*; import org.w3c.dom.*;
[ "com.sun.org", "java.io", "javax.xml", "org.w3c.dom" ]
com.sun.org; java.io; javax.xml; org.w3c.dom;
1,831,263
@Nullable public static FeedItem getFeedItem(final long itemId) { Log.d(TAG, "getFeedItem() called with: " + "itemId = [" + itemId + "]"); PodDBAdapter adapter = PodDBAdapter.getInstance(); adapter.open(); try { return getFeedItem(itemId, adapter); } finally { adapter.close(); } }
static FeedItem function(final long itemId) { Log.d(TAG, STR + STR + itemId + "]"); PodDBAdapter adapter = PodDBAdapter.getInstance(); adapter.open(); try { return getFeedItem(itemId, adapter); } finally { adapter.close(); } }
/** * Loads a specific FeedItem from the database. This method should not be used for loading more * than one FeedItem because this method might query the database several times for each item. * * @param itemId The ID of the FeedItem * @return The FeedItem or null if the FeedItem could not be found. */
Loads a specific FeedItem from the database. This method should not be used for loading more than one FeedItem because this method might query the database several times for each item
getFeedItem
{ "repo_name": "johnjohndoe/AntennaPod", "path": "core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java", "license": "mit", "size": 34357 }
[ "android.util.Log", "de.danoeh.antennapod.model.feed.FeedItem" ]
import android.util.Log; import de.danoeh.antennapod.model.feed.FeedItem;
import android.util.*; import de.danoeh.antennapod.model.feed.*;
[ "android.util", "de.danoeh.antennapod" ]
android.util; de.danoeh.antennapod;
1,946,607
@Test public final void testXMin() { Assert.assertTrue(this.m.xMin() == -2); }
final void function() { Assert.assertTrue(this.m.xMin() == -2); }
/** * Test method for {@link fr.nantes1900.models.basis.Mesh#xMin()}. */
Test method for <code>fr.nantes1900.models.basis.Mesh#xMin()</code>
testXMin
{ "repo_name": "Nantes1900/Nantes-1900-PGROU-IHM", "path": "src/test/fr/nantes1900/models/MeshTest.java", "license": "gpl-3.0", "size": 20047 }
[ "junit.framework.Assert" ]
import junit.framework.Assert;
import junit.framework.*;
[ "junit.framework" ]
junit.framework;
2,083,625
public static AvPair makeBytes(@Nonnull MsvAv type, @Nonnull byte[] bytesValue) { Preconditions.checkNotNull(type); Preconditions.checkArgument(type.hasBytesValue()); Preconditions.checkNotNull(bytesValue); return new AvPair(type, null, 0, bytesValue); }
static AvPair function(@Nonnull MsvAv type, @Nonnull byte[] bytesValue) { Preconditions.checkNotNull(type); Preconditions.checkArgument(type.hasBytesValue()); Preconditions.checkNotNull(bytesValue); return new AvPair(type, null, 0, bytesValue); }
/** * Make an AvPair with a bytes value. * * @param type The type of the pair to make. * @param bytesValue The value for the pair to have. * @return A pair of that type with the given value. * @throws IllegalArgumentException if the type doesn't have a bytes value. */
Make an AvPair with a bytes value
makeBytes
{ "repo_name": "googlegsa/secmgr", "path": "src/main/java/com/google/enterprise/secmgr/ntlmssp/AvPair.java", "license": "apache-2.0", "size": 9659 }
[ "com.google.common.base.Preconditions", "javax.annotation.Nonnull" ]
import com.google.common.base.Preconditions; import javax.annotation.Nonnull;
import com.google.common.base.*; import javax.annotation.*;
[ "com.google.common", "javax.annotation" ]
com.google.common; javax.annotation;
1,569,922
private void showNotification(int id, NotificationCompat.Builder builder) { ((NotificationManager) getContext().getSystemService(Context.NOTIFICATION_SERVICE)) .notify(id, builder.build()); }
void function(int id, NotificationCompat.Builder builder) { ((NotificationManager) getContext().getSystemService(Context.NOTIFICATION_SERVICE)) .notify(id, builder.build()); }
/** * Builds and shows the notification * * @param id * @param builder */
Builds and shows the notification
showNotification
{ "repo_name": "Flole998/android", "path": "src/main/java/com/owncloud/android/syncadapter/FileSyncAdapter.java", "license": "gpl-2.0", "size": 23703 }
[ "android.app.NotificationManager", "android.content.Context", "android.support.v4.app.NotificationCompat" ]
import android.app.NotificationManager; import android.content.Context; import android.support.v4.app.NotificationCompat;
import android.app.*; import android.content.*; import android.support.v4.app.*;
[ "android.app", "android.content", "android.support" ]
android.app; android.content; android.support;
2,476,831
@RequiresApi(23) public static void setDataSource(@NonNull MediaMetadataRetriever retriever, @NonNull MediaDataSource dataSource) throws IOException { try { retriever.setDataSource(dataSource); } catch (Exception e) { throw new IOException(e); } }
@RequiresApi(23) static void function(@NonNull MediaMetadataRetriever retriever, @NonNull MediaDataSource dataSource) throws IOException { try { retriever.setDataSource(dataSource); } catch (Exception e) { throw new IOException(e); } }
/** * {@link MediaMetadataRetriever#setDataSource(MediaDataSource)} tends to crash in native code on * specific devices, so this just a wrapper to convert that into an {@link IOException}. */
<code>MediaMetadataRetriever#setDataSource(MediaDataSource)</code> tends to crash in native code on specific devices, so this just a wrapper to convert that into an <code>IOException</code>
setDataSource
{ "repo_name": "cascheberg/Signal-Android", "path": "app/src/main/java/org/thoughtcrime/securesms/util/MediaMetadataRetrieverUtil.java", "license": "gpl-3.0", "size": 850 }
[ "android.media.MediaDataSource", "android.media.MediaMetadataRetriever", "androidx.annotation.NonNull", "androidx.annotation.RequiresApi", "java.io.IOException" ]
import android.media.MediaDataSource; import android.media.MediaMetadataRetriever; import androidx.annotation.NonNull; import androidx.annotation.RequiresApi; import java.io.IOException;
import android.media.*; import androidx.annotation.*; import java.io.*;
[ "android.media", "androidx.annotation", "java.io" ]
android.media; androidx.annotation; java.io;
2,533,166
static <T1, T2, T3, T4> Tuple4<Seq<T1>, Seq<T2>, Seq<T3>, Seq<T4>> sequence4(Iterable<? extends Tuple4<? extends T1, ? extends T2, ? extends T3, ? extends T4>> tuples) { Objects.requireNonNull(tuples, "tuples is null"); final Stream<Tuple4<? extends T1, ? extends T2, ? extends T3, ? extends T4>> s = Stream.ofAll(tuples); return new Tuple4<>(s.map(Tuple4::_1), s.map(Tuple4::_2), s.map(Tuple4::_3), s.map(Tuple4::_4)); }
static <T1, T2, T3, T4> Tuple4<Seq<T1>, Seq<T2>, Seq<T3>, Seq<T4>> sequence4(Iterable<? extends Tuple4<? extends T1, ? extends T2, ? extends T3, ? extends T4>> tuples) { Objects.requireNonNull(tuples, STR); final Stream<Tuple4<? extends T1, ? extends T2, ? extends T3, ? extends T4>> s = Stream.ofAll(tuples); return new Tuple4<>(s.map(Tuple4::_1), s.map(Tuple4::_2), s.map(Tuple4::_3), s.map(Tuple4::_4)); }
/** * Turns a sequence of {@code Tuple4} into a Tuple4 of {@code Seq}s. * * @param <T1> 1st component type * @param <T2> 2nd component type * @param <T3> 3rd component type * @param <T4> 4th component type * @param tuples an {@code Iterable} of tuples * @return a tuple of 4 {@link Seq}s. */
Turns a sequence of Tuple4 into a Tuple4 of Seqs
sequence4
{ "repo_name": "dx-pbuckley/vavr", "path": "vavr/src-gen/main/java/io/vavr/Tuple.java", "license": "apache-2.0", "size": 19656 }
[ "io.vavr.collection.Seq", "io.vavr.collection.Stream", "java.util.Objects" ]
import io.vavr.collection.Seq; import io.vavr.collection.Stream; import java.util.Objects;
import io.vavr.collection.*; import java.util.*;
[ "io.vavr.collection", "java.util" ]
io.vavr.collection; java.util;
2,808,284
private void rewriteQuery(QueryExpression q, List<Conjunct> clauseList, QueryPlan qplan, ResolvedReferenceField context) { Error.push("rewriteQuery"); AnalyzeQuery analyzer = new AnalyzeQuery(compositeMetadata, context); try { QueryExpression cnf = qrewriter.rewrite(q); LOGGER.debug("Query in conjunctive normal form:{}", cnf); if (cnf instanceof NaryLogicalExpression && ((NaryLogicalExpression) cnf).getOp() == NaryLogicalOperator._and) { for (QueryExpression clause : ((NaryLogicalExpression) cnf).getQueries()) { analyzer.iterate(clause); clauseList.add(new Conjunct(clause, analyzer.getFieldInfo(), context)); } } else { analyzer.iterate(cnf); clauseList.add(new Conjunct(cnf, analyzer.getFieldInfo(), context)); } } catch (Error e) { // rethrow lightblue error throw e; } catch (Exception e) { // throw new Error (preserves current error context) LOGGER.error(e.getMessage(), e); throw Error.get(AssocConstants.ERR_REWRITE, e.getMessage()); } finally { Error.pop(); } }
void function(QueryExpression q, List<Conjunct> clauseList, QueryPlan qplan, ResolvedReferenceField context) { Error.push(STR); AnalyzeQuery analyzer = new AnalyzeQuery(compositeMetadata, context); try { QueryExpression cnf = qrewriter.rewrite(q); LOGGER.debug(STR, cnf); if (cnf instanceof NaryLogicalExpression && ((NaryLogicalExpression) cnf).getOp() == NaryLogicalOperator._and) { for (QueryExpression clause : ((NaryLogicalExpression) cnf).getQueries()) { analyzer.iterate(clause); clauseList.add(new Conjunct(clause, analyzer.getFieldInfo(), context)); } } else { analyzer.iterate(cnf); clauseList.add(new Conjunct(cnf, analyzer.getFieldInfo(), context)); } } catch (Error e) { throw e; } catch (Exception e) { LOGGER.error(e.getMessage(), e); throw Error.get(AssocConstants.ERR_REWRITE, e.getMessage()); } finally { Error.pop(); } }
/** * Rewrites the query expression in its conjunctive normal form, and adds * clauses to the end of the clause list */
Rewrites the query expression in its conjunctive normal form, and adds clauses to the end of the clause list
rewriteQuery
{ "repo_name": "bserdar/lightblue-core", "path": "crud/src/main/java/com/redhat/lightblue/assoc/QueryPlanChooser.java", "license": "gpl-3.0", "size": 13186 }
[ "com.redhat.lightblue.metadata.ResolvedReferenceField", "com.redhat.lightblue.query.NaryLogicalExpression", "com.redhat.lightblue.query.NaryLogicalOperator", "com.redhat.lightblue.query.QueryExpression", "com.redhat.lightblue.util.Error", "java.util.List" ]
import com.redhat.lightblue.metadata.ResolvedReferenceField; import com.redhat.lightblue.query.NaryLogicalExpression; import com.redhat.lightblue.query.NaryLogicalOperator; import com.redhat.lightblue.query.QueryExpression; import com.redhat.lightblue.util.Error; import java.util.List;
import com.redhat.lightblue.metadata.*; import com.redhat.lightblue.query.*; import com.redhat.lightblue.util.*; import java.util.*;
[ "com.redhat.lightblue", "java.util" ]
com.redhat.lightblue; java.util;
1,632,425
Collection<EntityDataChange> getCreated();
Collection<EntityDataChange> getCreated();
/** * Returns a list of all entities created * @return a list of all entities created */
Returns a list of all entities created
getCreated
{ "repo_name": "ethlo/dachs", "path": "dachs-common/src/main/java/com/ethlo/dachs/EntityDataChangeSet.java", "license": "apache-2.0", "size": 628 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
388,647
public BigInteger getQuantity() { return quantity; }
BigInteger function() { return quantity; }
/** * Returns the value of the '<em><b>Quantity</b></em>' attribute. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Quantity</em>' attribute isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Quantity</em>' attribute. * @see #isSetQuantity() * @see #unsetQuantity() * @see #setQuantity(BigInteger) * @generated */
Returns the value of the 'Quantity' attribute. If the meaning of the 'Quantity' attribute isn't clear, there really should be more of a description here...
getQuantity
{ "repo_name": "SES-fortiss/SmartGridCoSimulation", "path": "core/cim15/src/CIM15/IEC61970/Informative/InfWork/MaterialItem.java", "license": "apache-2.0", "size": 49319 }
[ "java.math.BigInteger" ]
import java.math.BigInteger;
import java.math.*;
[ "java.math" ]
java.math;
2,512,114
default List<Boolean> hasUserPermissions(List<Permission> permissions) throws IOException { return hasUserPermissions(null, permissions); }
default List<Boolean> hasUserPermissions(List<Permission> permissions) throws IOException { return hasUserPermissions(null, permissions); }
/** * Check if call user has specific permissions * @param permissions the specific permission list * @return True if user has the specific permissions * @throws IOException if a remote or network exception occurs */
Check if call user has specific permissions
hasUserPermissions
{ "repo_name": "francisliu/hbase", "path": "hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java", "license": "apache-2.0", "size": 106428 }
[ "java.io.IOException", "java.util.List", "org.apache.hadoop.hbase.security.access.Permission" ]
import java.io.IOException; import java.util.List; import org.apache.hadoop.hbase.security.access.Permission;
import java.io.*; import java.util.*; import org.apache.hadoop.hbase.security.access.*;
[ "java.io", "java.util", "org.apache.hadoop" ]
java.io; java.util; org.apache.hadoop;
1,803,754
public SessionShortVoCollection listSession(Date startDate, Date endDate, ActivityVo activity, ServiceRefVo service, LocationRefVo location, HcpLiteVo listOwner, ServiceFunctionRefVo clinicType, LocationRefVoCollection locationList, ProfileListType listType, LookupInstVo urgency) //wdev-19419 { // all params must be set if (startDate == null || endDate == null || activity == null) throw new DomainRuntimeException("Not all mandatory search params set in method listGenericSession"); ArrayList<String> markers = new ArrayList<String>(); ArrayList<Serializable> values = new ArrayList<Serializable>(); String serviceCriteria = ""; String listtypeCriteria = ""; //wdev-19419 String locationCriteria = ""; String clinicTypeCriteria = ""; String clinicTypeJoin = ""; String listOwnerJoin = ""; String listOwnerCriteria = ""; String urgencyJoin = ""; String urgencyCriteria = ""; // mandatory fields markers.add("activityId"); markers.add("open"); markers.add("startDate"); markers.add("endDate"); values.add(activity.getID_Activity()); values.add(getDomLookup(Session_Status_and_Reason.OPEN)); values.add(startDate.getDate()); values.add(endDate.getDate()); if (service != null) { markers.add("idService"); values.add(service.getID_Service()); serviceCriteria = " and session.service.id = :idService"; } if (clinicType != null) { markers.add("idClinicType"); values.add(clinicType.getID_ServiceFunction()); clinicTypeJoin = " left join slot.functions as func "; clinicTypeCriteria = " and func.id = :idClinicType "; } else { clinicTypeJoin = " left join slot.functions as func "; clinicTypeCriteria = " and func.id is null "; } if (listOwner != null) { markers.add("idListOwner"); values.add(listOwner.getID_Hcp()); listOwnerJoin = " left join session.listOwners as lowners left join lowners.hcp shcp left join slot.slotResp as slResp left join slResp.hcp as slHCP"; listOwnerCriteria = " and shcp.id = :idListOwner and (slHCP.id = :idListOwner or slResp is null)"; } //wdev-19419 if( listType != null) { markers.add("idlistType"); values.add(getDomLookup(listType).getId()); listtypeCriteria = " and session.listType.id = :idlistType"; } //----------- if (location != null) { markers.add("idLocation"); values.add(location.getID_Location()); locationCriteria = " and session.schLocation.id = :idLocation"; } else if(locationList != null) { List<String> locationIds = new ArrayList<String>(); for(LocationRefVo voRef : locationList) locationIds.add(voRef.getID_Location().toString()); locationCriteria = " and session.schLocation.id in (" + getIdString(locationIds) + ")"; } if (urgency != null && SchedulingPriority.ROUTINE.getID() == urgency.getID())//WDEV-22393 { markers.add("idUrgency"); values.add(urgency.getID()); urgencyJoin = " left join slot.priority as priority "; urgencyCriteria = " and priority.id = :idUrgency "; } DomainFactory factory = getDomainFactory(); markers.add("OUTPATIENT_SESSION"); values.add(SchProfileType.OUTPATIENT.getID()); markers.add("CAB_TYPE"); values.add(SchedCABSlotType.CAB.getID()); List<?> sessions = factory.find(" Select distinct session from Sch_Session as session " + " left join session.sessionSlots as slot " + clinicTypeJoin + listOwnerJoin + urgencyJoin + " where ( slot.activity.id = :activityId) " + " and session.sessionDate >= :startDate and session.sessionDate <= :endDate " + serviceCriteria + locationCriteria + clinicTypeCriteria + listOwnerCriteria + listtypeCriteria + urgencyCriteria + " and session.isFixed = 1 and session.sessionStatus = :open " + "and (session.sessionProfileType.id = :OUTPATIENT_SESSION) and session.isRIE is null AND (slot.directAccessSlot.id != :CAB_TYPE OR slot.directAccessSlot is null)", markers, values, 1000); //wdev-19419 if (sessions == null || sessions.size() == 0) return SessionShortVoAssembler.createSessionShortVoCollectionFromSch_Session(sessions); SessionShortVoCollection voCollSessionShort = new SessionShortVoCollection(); for (int i = 0; i < sessions.size(); i++) { if (sessions.get(i) instanceof Sch_Session) { Sch_Session session = (Sch_Session) sessions.get(i); SessionShortVo sessionShort = SessionShortVoAssembler.create(session); if (session.getSessionSlots() != null) { sessionShort.setCalendarSlots(new SessionSlotWithStatusOnlyVoCollection()); Iterator<?> slotIterator = session.getSessionSlots().iterator(); while (slotIterator.hasNext()) { Session_Slot slot = (Session_Slot) slotIterator.next(); SessionSlotWithStatusOnlyVo sessionSlot = SessionSlotWithStatusOnlyVoAssembler.create(slot); if (sessionSlot.getActivity().equals(activity)) { sessionShort.getCalendarSlots().add(sessionSlot); } } } voCollSessionShort.add(sessionShort); } } return voCollSessionShort.sort(); }
SessionShortVoCollection function(Date startDate, Date endDate, ActivityVo activity, ServiceRefVo service, LocationRefVo location, HcpLiteVo listOwner, ServiceFunctionRefVo clinicType, LocationRefVoCollection locationList, ProfileListType listType, LookupInstVo urgency) { if (startDate == null endDate == null activity == null) throw new DomainRuntimeException(STR); ArrayList<String> markers = new ArrayList<String>(); ArrayList<Serializable> values = new ArrayList<Serializable>(); String serviceCriteria = STRSTRSTRSTRSTRSTRSTRSTRSTRactivityIdSTRopenSTRstartDateSTRendDateSTRidServiceSTR and session.service.id = :idServiceSTRidClinicTypeSTR left join slot.functions as func STR and func.id = :idClinicType STR left join slot.functions as func STR and func.id is null STRidListOwnerSTR left join session.listOwners as lowners left join lowners.hcp shcp left join slot.slotResp as slResp left join slResp.hcp as slHCPSTR and shcp.id = :idListOwner and (slHCP.id = :idListOwner or slResp is null)STRidlistTypeSTR and session.listType.id = :idlistTypeSTRidLocationSTR and session.schLocation.id = :idLocationSTR and session.schLocation.id in (STR)STRidUrgencySTR left join slot.priority as priority STR and priority.id = :idUrgency STROUTPATIENT_SESSIONSTRCAB_TYPESTR Select distinct session from Sch_Session as session STR left join session.sessionSlots as slot STR where ( slot.activity.id = :activityId) STR and session.sessionDate >= :startDate and session.sessionDate <= :endDate STR and session.isFixed = 1 and session.sessionStatus = :open STRand (session.sessionProfileType.id = :OUTPATIENT_SESSION) and session.isRIE is null AND (slot.directAccessSlot.id != :CAB_TYPE OR slot.directAccessSlot is null)", markers, values, 1000); if (sessions == null sessions.size() == 0) return SessionShortVoAssembler.createSessionShortVoCollectionFromSch_Session(sessions); SessionShortVoCollection voCollSessionShort = new SessionShortVoCollection(); for (int i = 0; i < sessions.size(); i++) { if (sessions.get(i) instanceof Sch_Session) { Sch_Session session = (Sch_Session) sessions.get(i); SessionShortVo sessionShort = SessionShortVoAssembler.create(session); if (session.getSessionSlots() != null) { sessionShort.setCalendarSlots(new SessionSlotWithStatusOnlyVoCollection()); Iterator<?> slotIterator = session.getSessionSlots().iterator(); while (slotIterator.hasNext()) { Session_Slot slot = (Session_Slot) slotIterator.next(); SessionSlotWithStatusOnlyVo sessionSlot = SessionSlotWithStatusOnlyVoAssembler.create(slot); if (sessionSlot.getActivity().equals(activity)) { sessionShort.getCalendarSlots().add(sessionSlot); } } } voCollSessionShort.add(sessionShort); } } return voCollSessionShort.sort(); }
/** * list sessions for scheduling */
list sessions for scheduling
listSession
{ "repo_name": "FreudianNM/openMAXIMS", "path": "Source Library/openmaxims_workspace/RefMan/src/ims/RefMan/domain/impl/BookAppointmentImpl.java", "license": "agpl-3.0", "size": 160143 }
[ "java.io.Serializable", "java.util.ArrayList", "java.util.Iterator" ]
import java.io.Serializable; import java.util.ArrayList; import java.util.Iterator;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
115,559
public ArrayList<Long> getIdsAsList() { ArrayList<Long> returnList = new ArrayList<Long>(); Cursor cursor; try { cursor = db.query ( TABLE_NAME, new String[] {TABLE_ROW_ID}, null, null, null, null, null, null ); cursor.moveToFirst(); // if there is data available after the cursor's pointer, add // it to the ArrayList that will be returned by the method. if (!cursor.isAfterLast()) { do { returnList.add(cursor.getLong(0)); } while (cursor.moveToNext()); } cursor.close(); } catch (SQLException e) { Log.e("DB ERROR", e.toString()); e.printStackTrace(); } return returnList; }
ArrayList<Long> function() { ArrayList<Long> returnList = new ArrayList<Long>(); Cursor cursor; try { cursor = db.query ( TABLE_NAME, new String[] {TABLE_ROW_ID}, null, null, null, null, null, null ); cursor.moveToFirst(); if (!cursor.isAfterLast()) { do { returnList.add(cursor.getLong(0)); } while (cursor.moveToNext()); } cursor.close(); } catch (SQLException e) { Log.e(STR, e.toString()); e.printStackTrace(); } return returnList; }
/** * Get all the row ids from the database as a list * @return List of row ids */
Get all the row ids from the database as a list
getIdsAsList
{ "repo_name": "spookypeanut/Wake-Me-At", "path": "src/uk/co/spookypeanut/wake_me_at/DatabaseManager.java", "license": "gpl-3.0", "size": 31781 }
[ "android.database.Cursor", "android.database.SQLException", "android.util.Log", "java.util.ArrayList" ]
import android.database.Cursor; import android.database.SQLException; import android.util.Log; import java.util.ArrayList;
import android.database.*; import android.util.*; import java.util.*;
[ "android.database", "android.util", "java.util" ]
android.database; android.util; java.util;
1,654,330
@ApiModelProperty(value = "The username subscribed to the topic") public String getUsername() { return username; }
@ApiModelProperty(value = STR) String function() { return username; }
/** * The username subscribed to the topic * @return username **/
The username subscribed to the topic
getUsername
{ "repo_name": "knetikmedia/knetikcloud-java-client", "path": "src/main/java/com/knetikcloud/model/TopicSubscriberResource.java", "license": "apache-2.0", "size": 4222 }
[ "io.swagger.annotations.ApiModelProperty" ]
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.*;
[ "io.swagger.annotations" ]
io.swagger.annotations;
12,614
@SuppressWarnings("unchecked") public List<StreamRecord<? extends OUT>> extractOutputStreamRecords() { List<StreamRecord<? extends OUT>> resultElements = new LinkedList<>(); for (Object e: getOutput()) { if (e instanceof StreamRecord) { resultElements.add((StreamRecord<OUT>) e); } } return resultElements; }
@SuppressWarnings(STR) List<StreamRecord<? extends OUT>> function() { List<StreamRecord<? extends OUT>> resultElements = new LinkedList<>(); for (Object e: getOutput()) { if (e instanceof StreamRecord) { resultElements.add((StreamRecord<OUT>) e); } } return resultElements; }
/** * Get only the {@link StreamRecord StreamRecords} emitted by the operator. */
Get only the <code>StreamRecord StreamRecords</code> emitted by the operator
extractOutputStreamRecords
{ "repo_name": "ueshin/apache-flink", "path": "flink-streaming-java/src/test/java/org/apache/flink/streaming/util/AbstractStreamOperatorTestHarness.java", "license": "apache-2.0", "size": 22530 }
[ "java.util.LinkedList", "java.util.List", "org.apache.flink.streaming.runtime.streamrecord.StreamRecord" ]
import java.util.LinkedList; import java.util.List; import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import java.util.*; import org.apache.flink.streaming.runtime.streamrecord.*;
[ "java.util", "org.apache.flink" ]
java.util; org.apache.flink;
1,654,680
@Test public void testFailedNodes3() throws Exception { try { nodeSpi.set(createFailedNodeSpi(-1)); Ignite ignite0 = startGrid(0); nodeSpi.set(createFailedNodeSpi(2)); Ignite ignite1 = startGrid(1); assertEquals(1, ignite1.cluster().nodes().size()); waitNodeStop(ignite0.name()); ignite1.getOrCreateCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME)).put(1, 1); startGrid(2); assertEquals(2, ignite1.cluster().nodes().size()); tryCreateCache(2); } finally { stopAllGrids(); } }
void function() throws Exception { try { nodeSpi.set(createFailedNodeSpi(-1)); Ignite ignite0 = startGrid(0); nodeSpi.set(createFailedNodeSpi(2)); Ignite ignite1 = startGrid(1); assertEquals(1, ignite1.cluster().nodes().size()); waitNodeStop(ignite0.name()); ignite1.getOrCreateCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME)).put(1, 1); startGrid(2); assertEquals(2, ignite1.cluster().nodes().size()); tryCreateCache(2); } finally { stopAllGrids(); } }
/** * Coordinator is added in failed list during node start, test with two nodes. * * @throws Exception If failed. */
Coordinator is added in failed list during node start, test with two nodes
testFailedNodes3
{ "repo_name": "ascherbakoff/ignite", "path": "modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java", "license": "apache-2.0", "size": 86464 }
[ "org.apache.ignite.Ignite", "org.apache.ignite.configuration.CacheConfiguration" ]
import org.apache.ignite.Ignite; import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.*; import org.apache.ignite.configuration.*;
[ "org.apache.ignite" ]
org.apache.ignite;
2,034,407
moFormatos.add(new JFormatElemento(psFormato, new SimpleDateFormat(psFormato))); }
moFormatos.add(new JFormatElemento(psFormato, new SimpleDateFormat(psFormato))); }
/** * por optimizacion la aplicacion puede precargar formatos de uso frecuente */
por optimizacion la aplicacion puede precargar formatos de uso frecuente
addFormatoFrecuenteFecha
{ "repo_name": "Creativa3d/box3d", "path": "paquetes/src/utiles/JFormat.java", "license": "gpl-2.0", "size": 14743 }
[ "java.text.SimpleDateFormat" ]
import java.text.SimpleDateFormat;
import java.text.*;
[ "java.text" ]
java.text;
2,737,949
Table tbl; try { tbl = tblTask_.get(); } catch (Exception e) { tbl = IncompleteTable.createFailedMetadataLoadTable( TableId.createInvalidId(), catalog_.getDb(tblName_.getDb_name()), tblName_.getTable_name(), new TableLoadingException(e.getMessage(), e)); } Preconditions.checkState(tbl.isLoaded()); return tbl; }
Table tbl; try { tbl = tblTask_.get(); } catch (Exception e) { tbl = IncompleteTable.createFailedMetadataLoadTable( TableId.createInvalidId(), catalog_.getDb(tblName_.getDb_name()), tblName_.getTable_name(), new TableLoadingException(e.getMessage(), e)); } Preconditions.checkState(tbl.isLoaded()); return tbl; }
/** * Blocks until the table has finished loading and returns the result. If any errors * were encountered while loading the table an IncompleteTable will be returned. */
Blocks until the table has finished loading and returns the result. If any errors were encountered while loading the table an IncompleteTable will be returned
get
{ "repo_name": "mapr/impala", "path": "fe/src/main/java/com/cloudera/impala/catalog/TableLoadingMgr.java", "license": "apache-2.0", "size": 13631 }
[ "com.google.common.base.Preconditions" ]
import com.google.common.base.Preconditions;
import com.google.common.base.*;
[ "com.google.common" ]
com.google.common;
427,135
@Override public void afterUnmarshal(Object target, Object parent) { if (Precursor.class.isInstance(target)) { updateObject((Precursor) target); } // else, not business of this resolver }
void function(Object target, Object parent) { if (Precursor.class.isInstance(target)) { updateObject((Precursor) target); } }
/** * Method to perform the afterUnmarshal operation if the resolver * applies to the specified object. * * @param target the object to modify after unmarshalling. * @param parent object referencing the target. Null if target is root element. */
Method to perform the afterUnmarshal operation if the resolver applies to the specified object
afterUnmarshal
{ "repo_name": "tomas-pluskal/jmzml", "path": "src/main/java/uk/ac/ebi/jmzml/xml/jaxb/resolver/PrecursorRefResolver.java", "license": "apache-2.0", "size": 2898 }
[ "uk.ac.ebi.jmzml.model.mzml.Precursor" ]
import uk.ac.ebi.jmzml.model.mzml.Precursor;
import uk.ac.ebi.jmzml.model.mzml.*;
[ "uk.ac.ebi" ]
uk.ac.ebi;
180,463
@Override public HTable getTable(String tableName) { BlockingQueue<HTable> queue = tables.get(tableName); if (queue == null) { synchronized (tables) { queue = tables.get(tableName); if (queue == null) { queue = new LinkedBlockingQueue<HTable>(this.maxSize); for (int i = 0; i < this.maxSize; ++i) { queue.add(this.newHTable(tableName)); } tables.put(tableName, queue); } } } try { return queue.take(); } catch (Exception ex) { return null; } }
HTable function(String tableName) { BlockingQueue<HTable> queue = tables.get(tableName); if (queue == null) { synchronized (tables) { queue = tables.get(tableName); if (queue == null) { queue = new LinkedBlockingQueue<HTable>(this.maxSize); for (int i = 0; i < this.maxSize; ++i) { queue.add(this.newHTable(tableName)); } tables.put(tableName, queue); } } } try { return queue.take(); } catch (Exception ex) { return null; } }
/** * Get a reference to the specified table from the pool. * <p> * * Create a new one if one is not available. * * @param tableName * @return a reference to the specified table * @throws RuntimeException * if there is a problem instantiating the HTable */
Get a reference to the specified table from the pool. Create a new one if one is not available
getTable
{ "repo_name": "akkumar/hbasene", "path": "src/main/java/org/hbasene/index/IndexHTablePool.java", "license": "apache-2.0", "size": 4126 }
[ "java.util.concurrent.BlockingQueue", "java.util.concurrent.LinkedBlockingQueue", "org.apache.hadoop.hbase.client.HTable" ]
import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; import org.apache.hadoop.hbase.client.HTable;
import java.util.concurrent.*; import org.apache.hadoop.hbase.client.*;
[ "java.util", "org.apache.hadoop" ]
java.util; org.apache.hadoop;
1,085,597
public void setJobMetaVariables( JobMeta jobMeta ) { for ( int i = 0; i < variables.size(); i++ ) { try { String name = variables.getValueMeta( i ).getName(); String value = variables.getString( i, "" ); jobMeta.setVariable( name, Const.NVL( value, "" ) ); } catch ( Exception e ) { // Ignore the exception, it should never happen on a getString() // anyway. } } // Also set the parameters // setParametersAsVariablesInUI( jobMeta, jobMeta ); }
void function( JobMeta jobMeta ) { for ( int i = 0; i < variables.size(); i++ ) { try { String name = variables.getValueMeta( i ).getName(); String value = variables.getString( i, STR" ) ); } catch ( Exception e ) { } } }
/** * Set previously defined variables (set variables dialog) on the specified job * * @param jobMeta job's meta */
Set previously defined variables (set variables dialog) on the specified job
setJobMetaVariables
{ "repo_name": "wseyler/pentaho-kettle", "path": "ui/src/main/java/org/pentaho/di/ui/spoon/Spoon.java", "license": "apache-2.0", "size": 352020 }
[ "org.pentaho.di.job.JobMeta" ]
import org.pentaho.di.job.JobMeta;
import org.pentaho.di.job.*;
[ "org.pentaho.di" ]
org.pentaho.di;
2,606,532
private static void printXml(Document doc, StreamResult stream) { try { Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); DOMSource source = new DOMSource(doc); transformer.transform(source, stream); } catch (TransformerFactoryConfigurationError | TransformerException e) { e.printStackTrace(); } }
static void function(Document doc, StreamResult stream) { try { Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); DOMSource source = new DOMSource(doc); transformer.transform(source, stream); } catch (TransformerFactoryConfigurationError TransformerException e) { e.printStackTrace(); } }
/** * Prints the xml to the sysout * * @param doc */
Prints the xml to the sysout
printXml
{ "repo_name": "sveba/tv_grab_bg_neterra", "path": "src/main/java/eu/itplace/xmltvgrabber/App.java", "license": "gpl-3.0", "size": 2801 }
[ "javax.xml.transform.OutputKeys", "javax.xml.transform.Transformer", "javax.xml.transform.TransformerException", "javax.xml.transform.TransformerFactory", "javax.xml.transform.TransformerFactoryConfigurationError", "javax.xml.transform.dom.DOMSource", "javax.xml.transform.stream.StreamResult", "org.w3c.dom.Document" ]
import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.TransformerFactoryConfigurationError; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.w3c.dom.Document;
import javax.xml.transform.*; import javax.xml.transform.dom.*; import javax.xml.transform.stream.*; import org.w3c.dom.*;
[ "javax.xml", "org.w3c.dom" ]
javax.xml; org.w3c.dom;
1,931,102
Builder addExtraImportLibraries(Iterable<Artifact> extraImportLibraries) { this.extraImportLibraries = Iterables.concat(this.extraImportLibraries, extraImportLibraries); return this; }
Builder addExtraImportLibraries(Iterable<Artifact> extraImportLibraries) { this.extraImportLibraries = Iterables.concat(this.extraImportLibraries, extraImportLibraries); return this; }
/** * Adds additional static libraries to be linked into the final ObjC application bundle. */
Adds additional static libraries to be linked into the final ObjC application bundle
addExtraImportLibraries
{ "repo_name": "juhalindfors/bazel-patches", "path": "src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommon.java", "license": "apache-2.0", "size": 34854 }
[ "com.google.common.collect.Iterables", "com.google.devtools.build.lib.actions.Artifact" ]
import com.google.common.collect.Iterables; import com.google.devtools.build.lib.actions.Artifact;
import com.google.common.collect.*; import com.google.devtools.build.lib.actions.*;
[ "com.google.common", "com.google.devtools" ]
com.google.common; com.google.devtools;
786,995
public static InterProResultsList getXmlInformation(List<String> xmlList) throws IOException { for (String line:xmlList) logger.trace(line); Map<String,String> ec2go = getEc2Go(); Map<String,String> sl2go = getSl2Go(); Map<String,String> interpro2go = getInterPro2Go(); return InterProParser.getXmlInformation(xmlList, ec2go, sl2go, interpro2go); }
static InterProResultsList function(List<String> xmlList) throws IOException { for (String line:xmlList) logger.trace(line); Map<String,String> ec2go = getEc2Go(); Map<String,String> sl2go = getSl2Go(); Map<String,String> interpro2go = getInterPro2Go(); return InterProParser.getXmlInformation(xmlList, ec2go, sl2go, interpro2go); }
/** * Parse xml list to InterPro result list. * Additional maps are sought. * * @param xmlList * @return * @throws IOException */
Parse xml list to InterPro result list. Additional maps are sought
getXmlInformation
{ "repo_name": "merlin-sysbio/bioapis", "path": "src/main/java/pt/uminho/ceb/biosystems/merlin/bioapis/externalAPI/ebi/interpro/InterProParser.java", "license": "gpl-2.0", "size": 14610 }
[ "java.io.IOException", "java.util.List", "java.util.Map" ]
import java.io.IOException; import java.util.List; import java.util.Map;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
409,713